[Pkg-ofed-commits] [opensm] 05/07: Imported Upstream version 3.3.15

Ana Beatriz Guerrero López ana at moszumanska.debian.org
Tue Jul 1 07:19:51 UTC 2014


This is an automated email from the git hooks/post-receive script.

ana pushed a commit to branch master
in repository opensm.

commit f37987159137e07430d958b34f87f7a79c998483
Author: Ana Guerrero López <ana at ekaia.org>
Date:   Mon Jun 30 22:55:34 2014 +0200

    Imported Upstream version 3.3.15
---
 ChangeLog                                          | 11027 ++++++++++++++++++-
 Makefile.am                                        |    15 +-
 Makefile.in                                        |   446 +-
 aclocal.m4                                         |  8934 ++++++++++++++-
 complib/Makefile.am                                |     5 -
 complib/Makefile.in                                |   275 +-
 complib/cl_complib.c                               |     6 +-
 complib/cl_dispatcher.c                            |    48 +-
 complib/cl_event.c                                 |    36 +-
 complib/cl_event_wheel.c                           |    43 +-
 complib/cl_list.c                                  |   125 +-
 complib/cl_log.c                                   |     9 +-
 complib/cl_map.c                                   |   174 +-
 complib/cl_nodenamemap.c                           |    34 +-
 complib/cl_pool.c                                  |   113 +-
 complib/cl_ptr_vector.c                            |    56 +-
 complib/cl_thread.c                                |     8 +-
 complib/cl_threadpool.c                            |    11 +-
 complib/cl_timer.c                                 |    71 +-
 complib/cl_vector.c                                |    85 +-
 complib/libosmcomp.map                             |     1 +
 complib/libosmcomp.ver                             |     2 +-
 config/config.guess                                |   514 +-
 config/config.sub                                  |   249 +-
 config/depcomp                                     |   153 +-
 config/install-sh                                  |    32 +-
 config/libtool.m4                                  |  7370 -------------
 config/ltmain.sh                                   |  4070 ++++---
 config/ltoptions.m4                                |   368 -
 config/ltsugar.m4                                  |   123 -
 config/ltversion.m4                                |    23 -
 config/lt~obsolete.m4                              |    92 -
 config/missing                                     |    94 +-
 config/osmvsel.m4                                  |    39 +-
 config/ylwrap                                      |    41 +-
 configure                                          |  8903 +++++++--------
 configure.in                                       |    29 +-
 doc/QoS_management_in_OpenSM.txt                   |     9 +
 doc/opensm-sriov.txt                               |   154 +
 doc/opensm_release_notes-3.2.txt                   |   626 --
 doc/opensm_release_notes-3.3.txt                   |  1164 ++
 doc/partition-config.txt                           |   176 +
 doc/performance-manager-HOWTO.txt                  |    11 +-
 include/Makefile.in                                |   218 +-
 include/complib/cl_atomic.h                        |    12 +-
 include/complib/cl_atomic_osd.h                    |     4 +-
 include/complib/cl_fleximap.h                      |    52 +-
 include/complib/cl_nodenamemap.h                   |     3 +-
 include/complib/cl_passivelock.h                   |    16 +-
 include/complib/cl_ptr_vector.h                    |     2 +-
 include/complib/cl_types.h                         |    63 +-
 include/complib/cl_types_osd.h                     |     7 +-
 include/complib/cl_vector.h                        |     2 +-
 include/config.h.in                                |     9 +
 include/iba/ib_cm_types.h                          |     4 +-
 include/iba/ib_types.h                             |  1802 ++-
 include/opensm/osm_attrib_req.h                    |     2 +-
 include/opensm/osm_base.h                          |   214 +-
 include/opensm/osm_config.h                        |    65 +
 include/opensm/osm_congestion_control.h            |   132 +
 include/opensm/osm_console.h                       |     3 +-
 include/opensm/osm_console_io.h                    |     9 +-
 include/opensm/osm_db.h                            |    24 +-
 include/opensm/osm_db_pack.h                       |   351 +-
 include/opensm/osm_event_plugin.h                  |    23 +-
 include/opensm/osm_file_ids.h                      |   156 +
 include/opensm/{osm_pkey_mgr.h => osm_guid.h}      |    56 +-
 include/opensm/osm_helper.h                        |   546 +-
 include/opensm/osm_inform.h                        |    21 +-
 include/opensm/osm_lid_mgr.h                       |    30 +-
 include/opensm/osm_log.h                           |   174 +-
 include/opensm/osm_mad_pool.h                      |    32 +-
 include/opensm/osm_madw.h                          |   159 +-
 include/opensm/osm_mcast_tbl.h                     |   101 +-
 include/opensm/osm_mcm_info.h                      |   136 -
 include/opensm/osm_mcm_port.h                      |   159 +-
 .../cl_nodenamemap.h => opensm/osm_mesh.h}         |    64 +-
 include/opensm/osm_msgdef.h                        |     5 +-
 include/opensm/osm_mtree.h                         |    18 +-
 include/opensm/osm_multicast.h                     |   258 +-
 include/opensm/osm_node.h                          |    89 +-
 include/opensm/osm_opensm.h                        |    72 +-
 include/opensm/osm_partition.h                     |    32 +-
 include/opensm/osm_path.h                          |    59 +-
 include/opensm/osm_perfmgr.h                       |   117 +-
 include/opensm/osm_perfmgr_db.h                    |    45 +-
 include/opensm/osm_pkey.h                          |   184 +-
 include/opensm/osm_port.h                          |   439 +-
 include/opensm/osm_port_profile.h                  |    13 +-
 include/opensm/osm_qos_policy.h                    |     9 +-
 include/opensm/osm_remote_sm.h                     |    12 +-
 include/opensm/osm_router.h                        |    18 +-
 include/opensm/osm_sa.h                            |    62 +-
 include/opensm/osm_sa_mad_ctrl.h                   |    31 +-
 include/opensm/osm_service.h                       |    21 +-
 include/opensm/osm_sm.h                            |   217 +-
 include/opensm/osm_sm_mad_ctrl.h                   |    34 +-
 include/opensm/osm_subnet.h                        |   633 +-
 include/opensm/osm_switch.h                        |   267 +-
 include/opensm/osm_ucast_cache.h                   |     3 +-
 .../opensm/osm_ucast_lash.h                        |    87 +-
 include/opensm/osm_ucast_mgr.h                     |    32 +-
 .../osm_mcm_info.c => include/opensm/osm_version.h |    49 +-
 include/opensm/osm_vl15intf.h                      |    48 +-
 include/opensm/st.h                                |     3 +-
 include/vendor/osm_vendor.h                        |     4 +-
 include/vendor/osm_vendor_api.h                    |    14 +-
 include/vendor/osm_vendor_ibumad.h                 |    10 +-
 include/vendor/osm_vendor_mlx.h                    |     5 +-
 include/vendor/osm_vendor_mlx_defs.h               |     4 +-
 include/vendor/osm_vendor_mlx_svc.h                |     6 -
 include/vendor/osm_vendor_sa_api.h                 |    14 +-
 libvendor/Makefile.in                              |   327 +-
 libvendor/libosmvendor.ver                         |     2 +-
 libvendor/osm_pkt_randomizer.c                     |    16 +-
 libvendor/osm_vendor_ibumad.c                      |   205 +-
 libvendor/osm_vendor_ibumad_sa.c                   |   180 +-
 libvendor/osm_vendor_mlx.c                         |    12 +-
 libvendor/osm_vendor_mlx_dispatcher.c              |    22 +-
 libvendor/osm_vendor_mlx_hca.c                     |     4 +-
 libvendor/osm_vendor_mlx_hca_sim.c                 |     6 +-
 libvendor/osm_vendor_mlx_rmpp_ctx.c                |     2 +-
 libvendor/osm_vendor_mlx_sa.c                      |   360 +-
 libvendor/osm_vendor_mlx_sender.c                  |     4 +-
 libvendor/osm_vendor_mlx_txn.c                     |    41 +-
 man/{opensm.8.in => opensm.8}                      |   663 +-
 man/opensm.8.in                                    |   647 +-
 man/osmtest.8                                      |     7 +-
 man/torus-2QoS.8                                   |   476 +
 man/torus-2QoS.8.in                                |   476 +
 man/torus-2QoS.conf.5                              |   210 +
 man/torus-2QoS.conf.5.in                           |   210 +
 opensm.spec.in => opensm.spec                      |    26 +-
 opensm.spec.in                                     |    16 +-
 opensm/Makefile.am                                 |    30 +-
 opensm/Makefile.in                                 |   314 +-
 opensm/libopensm.map                               |    41 +-
 opensm/libopensm.ver                               |     2 +-
 opensm/main.c                                      |   440 +-
 opensm/osm_congestion_control.c                    |   746 ++
 opensm/osm_console.c                               |   674 +-
 opensm/osm_console_io.c                            |   146 +-
 opensm/osm_db_files.c                              |   171 +-
 opensm/osm_db_pack.c                               |   228 +-
 opensm/osm_drop_mgr.c                              |   206 +-
 opensm/osm_dump.c                                  |   179 +-
 opensm/osm_event_plugin.c                          |    14 +-
 .../{osm_mcast_fwd_rcv.c => osm_guid_info_rcv.c}   |    97 +-
 opensm/osm_guid_mgr.c                              |   144 +
 opensm/osm_helper.c                                |  2769 +++--
 opensm/osm_inform.c                                |   337 +-
 opensm/osm_lid_mgr.c                               |   702 +-
 opensm/osm_lin_fwd_rcv.c                           |    18 +-
 opensm/osm_link_mgr.c                              |   315 +-
 opensm/osm_log.c                                   |   245 +-
 opensm/osm_mad_pool.c                              |    47 +-
 opensm/osm_mcast_fwd_rcv.c                         |    17 +-
 opensm/osm_mcast_mgr.c                             |   919 +-
 opensm/osm_mcast_tbl.c                             |   174 +-
 opensm/osm_mcm_port.c                              |    50 +-
 opensm/osm_mesh.c                                  |  1736 +++
 ...osm_pkey_rcv.c => osm_mlnx_ext_port_info_rcv.c} |   121 +-
 opensm/osm_mtree.c                                 |    55 +-
 opensm/osm_multicast.c                             |   433 +-
 opensm/osm_node.c                                  |   128 +-
 opensm/osm_node_desc_rcv.c                         |    34 +-
 opensm/osm_node_info_rcv.c                         |   469 +-
 opensm/osm_opensm.c                                |   173 +-
 opensm/osm_perfmgr.c                               |   804 +-
 opensm/osm_perfmgr_db.c                            |   728 +-
 opensm/osm_pkey.c                                  |   325 +-
 opensm/osm_pkey_mgr.c                              |   554 +-
 opensm/osm_pkey_rcv.c                              |    22 +-
 opensm/osm_port.c                                  |   379 +-
 opensm/osm_port_info_rcv.c                         |   227 +-
 opensm/osm_prtn.c                                  |   228 +-
 opensm/osm_prtn_config.c                           |   444 +-
 opensm/osm_qos.c                                   |   473 +-
 opensm/osm_qos_parser_l.c                          |   895 +-
 opensm/osm_qos_parser_l.l                          |    12 +-
 opensm/osm_qos_parser_y.c                          |  2010 ++--
 opensm/osm_qos_parser_y.h                          |    48 +-
 opensm/osm_qos_parser_y.y                          |   136 +-
 opensm/osm_qos_policy.c                            |   189 +-
 opensm/osm_remote_sm.c                             |    22 +-
 opensm/osm_req.c                                   |   260 +-
 opensm/osm_resp.c                                  |    31 +-
 opensm/osm_router.c                                |    16 +-
 opensm/osm_sa.c                                    |   334 +-
 opensm/osm_sa_class_port_info.c                    |    37 +-
 opensm/osm_sa_guidinfo_record.c                    |   596 +-
 opensm/osm_sa_informinfo.c                         |   172 +-
 opensm/osm_sa_lft_record.c                         |    49 +-
 opensm/osm_sa_link_record.c                        |   159 +-
 opensm/osm_sa_mad_ctrl.c                           |   186 +-
 opensm/osm_sa_mcmember_record.c                    |   947 +-
 opensm/osm_sa_mft_record.c                         |    53 +-
 opensm/osm_sa_multipath_record.c                   |   686 +-
 opensm/osm_sa_node_record.c                        |   212 +-
 opensm/osm_sa_path_record.c                        |  1468 +--
 opensm/osm_sa_pkey_record.c                        |   118 +-
 opensm/osm_sa_portinfo_record.c                    |   219 +-
 opensm/osm_sa_service_record.c                     |   251 +-
 opensm/osm_sa_slvl_record.c                        |    75 +-
 opensm/osm_sa_sminfo_record.c                      |   102 +-
 opensm/osm_sa_sw_info_record.c                     |    68 +-
 opensm/osm_sa_vlarb_record.c                       |    90 +-
 opensm/osm_service.c                               |    69 +-
 opensm/osm_slvl_map_rcv.c                          |    93 +-
 opensm/osm_sm.c                                    |   325 +-
 opensm/osm_sm_mad_ctrl.c                           |   390 +-
 opensm/osm_sm_state_mgr.c                          |   154 +-
 opensm/osm_sminfo_rcv.c                            |   156 +-
 opensm/osm_state_mgr.c                             |   508 +-
 opensm/osm_subnet.c                                |  2538 +++--
 opensm/osm_sw_info_rcv.c                           |   252 +-
 opensm/osm_switch.c                                |   453 +-
 opensm/osm_torus.c                                 |  9324 ++++++++++++++++
 opensm/osm_trap_rcv.c                              |   446 +-
 opensm/osm_ucast_cache.c                           |   316 +-
 opensm/osm_ucast_dfsssp.c                          |  2188 ++++
 opensm/osm_ucast_dnup.c                            |   499 +
 opensm/osm_ucast_file.c                            |    61 +-
 opensm/osm_ucast_ftree.c                           |  2301 ++--
 opensm/osm_ucast_lash.c                            |   580 +-
 opensm/osm_ucast_mgr.c                             |   791 +-
 opensm/osm_ucast_updn.c                            |    52 +-
 opensm/osm_vl15intf.c                              |    89 +-
 opensm/osm_vl_arb_rcv.c                            |    27 +-
 opensm/st.c                                        |    11 +-
 osmeventplugin/Makefile.in                         |   174 +-
 osmeventplugin/libosmeventplugin.ver               |     2 +-
 osmeventplugin/src/osmeventplugin.c                |    43 +-
 osmtest/Makefile.in                                |   186 +-
 osmtest/include/osmtest_base.h                     |     7 +-
 osmtest/main.c                                     |    40 +-
 osmtest/osmt_inform.c                              |     4 +-
 osmtest/osmt_mtl_regular_qp.c                      |     7 +-
 osmtest/osmt_multicast.c                           |   890 +-
 osmtest/osmt_service.c                             |    38 +-
 osmtest/osmt_slvl_vl_arb.c                         |    43 +-
 osmtest/osmtest.c                                  |   365 +-
 scripts/{opensm.init.in => opensm.init}            |     9 +-
 scripts/opensm.init.in                             |     1 +
 scripts/redhat-opensm.init                         |   292 +
 scripts/{sldd.sh.in => sldd.sh}                    |   149 +-
 scripts/sldd.sh.in                                 |   143 +-
 247 files changed, 73466 insertions(+), 33590 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cb67d2b..2964c5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,14 +1,11025 @@
-2005-09-12 Hal Rosenstock <halr at voltaire.com>
 
-	* Improved SA MCMemberRecord error messages
+** Version: opensm-3.3.15
 
-2005-08-22 Yael Kalka <yael at mellanox.co.il>
+Thu Aug 2 11:56:48 2012 +0300 Alex Netes
+98273dd3fe4e4d53036c6a5567294a04cd1aa208
 
-	* Merge of OpenSM 1.8.0 previously available only on Gen1
+	* opensm: packages versions update
 
-2005-08-14  Eitan Zahavi  <eitan at mellanox.co.il>
+Thu Aug 2 11:55:46 2012 +0300 Alex Netes
+f415dc2f1b0570ed9f4f531e4dd35470a8e1722a
 
-	* Provided a top level auto tools project so there is no need to
-	cd into each of the sub directories and do:
-	./autogen.sh && configure && make && make install
+	* opensm_release_notes-3.3: update
 
+Thu Aug 2 11:38:05 2012 +0300 Alex Netes
+e283ca619f9cf48f252e15a54a32d026456f3add
+
+	* opensm: update shared library versions
+
+Wed Aug 1 15:36:33 2012 -0700 Ira Weiny
+e7d4574f0d1442e41530b105bb40d50d57700c02
+
+	* opensm/perfmgr: update new error codes to '54' prefix
+
+Wed Aug 1 14:39:35 2012 -0700 Jim Foraker
+7e6bdefa28dfbecba69ae3d2baeafe6b5b1a9713
+
+	* opensm/man/opensm.8.in: Add section for MKey support
+
+Wed Aug 1 14:41:27 2012 -0400 Hal Rosenstock
+7d18662bd73ed1d80c34de841ba8def8f4ab8217
+
+	* osmtest/osmtest.c: Fix permissions
+
+Wed Aug 1 11:29:12 2012 -0400 Hal Rosenstock
+aebe678b0a6a20923e06d380b94712dc0fbbcf86
+
+	* opensm: Add support for multicast service records
+
+Wed Aug 1 07:52:35 2012 -0700 Jim Foraker
+5509234bb31274a90703345d18fffa82b71f4b68
+
+	* opensm/scripts/sldd.sh: Update to support guid2mkey/neighbors
+
+Wed Aug 1 07:52:34 2012 -0700 Jim Foraker
+2ae1477d3db4cb4ca653edbacbd72f1eb6165821
+
+	* opensm: Ensure sweep interval/mkey lease are sensibly set
+
+Wed Aug 1 07:52:33 2012 -0700 Jim Foraker
+cefe79b1c75e4d53396e77464aaf5b5b795f9872
+
+	* opensm: Check for valid mkey protection level in config file
+
+Wed Aug 1 07:52:32 2012 -0700 Jim Foraker
+8fa0d2ccdcde3222451d6fb1003d750e53a1717e
+
+	* opensm: Add neighboring link cache file
+
+Wed Aug 1 07:52:31 2012 -0700 Jim Foraker
+5088d08e7c150f382ee76299bbbca14a8ae189b0
+
+	* opensm: Log errors on SubnGet timeouts
+
+Wed Aug 1 07:52:30 2012 -0700 Jim Foraker
+9eed9c602558a336a512c3698649656a8ec383a6
+
+	* opensm: Add support for setting mkey protection levels
+
+Wed Aug 1 07:52:29 2012 -0700 Jim Foraker
+5c4157d42bb6b3d32610e2e59184d1bf8d862d7c
+
+	* opensm: Add locking where necessary around osm_req_*
+
+Wed Aug 1 07:52:28 2012 -0700 Jim Foraker
+2f74f34a93100091ce7b501dc83e49ccef66940e
+
+	* opensm: Allow recovery of subnets with misset mkeys
+
+Wed Aug 1 07:52:27 2012 -0700 Jim Foraker
+e5dc557125b453261dfac5f1efe61894462dd67d
+
+	* opensm: Add guid2mkey cache file support
+
+Wed Aug 1 09:58:04 2012 -0400 Hal Rosenstock
+3659b370651d1237289401aad3dcced95c14b43c
+
+	* opensm/osm_sa_class_port_info.c: Indicate support for PortInfo CapMask2 matching in SA ClassPortInfo:CapabilityMask2
+
+Wed Aug 1 09:57:52 2012 -0400 Hal Rosenstock
+8016d3bc6b75ef95ad318a511e3cff0b0f4a8827
+
+	* opensm/osm_base.h: Add some SA ClassPortInfo CapabilityMask2 bits
+
+Tue Jul 31 10:18:19 2012 -0700 Albert Chu
+20e1a460c4e146590e7e30ac6c6e77b960cd3521
+
+	* opensm/osm_congestion_control.c: Fix initialization hex string
+
+Tue Jul 31 12:27:09 2012 -0400 Hal Rosenstock
+a59072db80c08325f25a9577e986846cb3d903bb
+
+	* opensm/osm_congestion_control.c: Skip TID 0 on 32 bit wraparound
+
+Mon Jul 30 09:25:34 2012 -0400 Hal Rosenstock
+1a31c4429a18e7417a0eef18c26664c46beb55aa
+
+	* opensm/osm_perfmgr.c: Use non conflicting error codes in log messages
+
+Mon Jul 30 07:34:47 2012 -0400 Hal Rosenstock
+03a75d08fa7058187523d502d4176d1854ddc4fd
+
+	* opensm/osm_sa_path_record.c: Restore osm_get_path_params functionality
+
+Tue Jul 31 05:13:37 2012 -0400 Hal Rosenstock
+a9340cf7e2fefa1c07cce730f20a88f3f49c245d
+
+	* opensm: Support (null) being specified for per_module_logging_file option
+
+Tue Jul 31 02:44:43 2012 -0400 Hal Rosenstock
+00375aa03dbfff4edbccd2dfd2809fe90a5c993f
+
+	* opensm/osm_perfmgr.c: Eliminate compile warning
+
+Tue Jul 31 02:44:12 2012 -0400 Hal Rosenstock
+7868c98bdd9974dd99d8547783435f69de4da44e
+
+	* opensm: Remove unused per_module_logging option
+
+Wed Jul 4 13:48:15 2012 +0300 Alex Netes
+49c460b351ed44e9ec66843490d61f835e2b5670
+
+	* Call drop manager before checking for other Master SM in the fabric
+
+Wed Jun 27 16:16:06 2012 +0300 Yevgeny Kliteynik
+3585f8b84661852daecb520d4e1b91ede1159f56
+
+	* opensm: Fix crash found with ucast cache
+
+Mon Jun 18 14:44:59 2012 +0300 Alex Netes
+c0604f38a0fdc46d12bf60655237e1678310cec4
+
+	* Increase p_port->discovery_count only when received PortInfo for port 0 of the switch
+
+Sun Jun 24 10:54:10 2012 +0300 Hal Rosenstock
+24b30d2aee2a347d448d55ff05aa2689664745f0
+
+	* opensm/osm_node_info_rcv.c: Handle non-compliant SMA gracefully
+
+Sun Jun 24 10:19:47 2012 +0300 Hal Rosenstock
+a4f2689178e2d963cab1c06b65fff824a674c9f6
+
+	* opensm/osm_vendor_ibumad: Add management class into match criteria
+
+Thu Jun 21 19:13:22 2012 +0300 Alex Netes
+a322f51f6b7ec58e5063be0269c6bda4dfec9aab
+
+	* Skip TID 0 on 32 bit wraparound for SMP, SA and PerfMgt queries
+
+Thu Jun 21 14:52:46 2012 +0300 Alex Netes
+cded9afd9642e73ec9e5989e14685f6a072a37bb
+
+	* Fix transaction id casting
+
+Wed Jun 13 18:07:33 2012 +0300 Alex Netes
+63ebd0d01c92af990b4d5dafb251c2dbb1daabf0
+
+	* Fix crash in ucast cache when chain of switches connected back at once to the fabric
+
+Sun Jun 17 11:46:18 2012 +0300 Alex Netes
+3b21d6f2eea9b3ef235148681a88eaecdd576735
+
+	* Fix crash in ucast cache when ucast cache invalidates after updating one of the switches
+
+Mon Apr 23 22:20:36 2012 +0300 Hal Rosenstock
+4be63753f56008aba6da0d1008510a795d73813a
+
+	* opensm/osm_sa*.c: Log requester port GUID at DEBUG level
+
+Mon Apr 23 23:09:34 2012 +0300 Hal Rosenstock
+4cca51d5453469e8472f2467f057210895261cb8
+
+	* opensm/osm_sa_mcmember_record.c: Log requester port GUID at DEBUG level
+
+Mon Apr 23 22:19:43 2012 +0300 Hal Rosenstock
+15b3eae8ae0af555283fb3fbda0649e82cb485c0
+
+	* opensm/osm_sa_path_record.c: Log requester port GUID at DEBUG level
+
+Tue Apr 17 13:09:42 2012 +0300 Hal Rosenstock
+0b580cadf390a912b3b5d149c7672f884107730b
+
+	* opensm/osm_sa_path_record.c: Add debug logging to pr_match_mgrp_attributes
+
+Tue Apr 17 13:09:42 2012 +0300 Hal Rosenstock
+ed4b7fb61deb51baa5b588cee9d03dd6b4224a87
+
+	* opensm/osm_sa_mcmember_record.c: In mcmr_rcv_join_mgrp, add MGID to log message
+
+Wed Apr 18 15:54:27 2012 +0300 Alex Netes
+7e395427b69bfedee425e421d1dd907589c61011
+
+	* Fix pre-creation of MC group with MGID containing P_Key
+
+Sun Apr 22 13:37:07 2012 +0300 Hal Rosenstock
+872dae4c494dd8ac51c07bfb42251798d4150823
+
+	* opensm/osm_sa_mcmember_record.c: Dump MCMemberRecord in mcmr_query_mgrp
+
+Thu Apr 19 19:08:31 2012 +0300 Alex Netes
+69741e6e66ca9731f9efdaf65d5f2f6e7e03b2cc
+
+	* Fix base port0 sl2vl mapping optimization
+
+Thu Apr 19 18:37:34 2012 +0300 Alex Netes
+bcda38eaeaf5abfcec4418bce91459ab437f5599
+
+	* Fix SL2VL configuration
+
+Mon Apr 9 15:19:02 2012 +0300 Vladimir Koushnir
+71f2ce7b6684fa461fa1b10e6511d8bcd178ee51
+
+	* Sending SL2VL and VLARB SET MADs in distributed manner
+
+Wed Apr 11 16:47:15 2012 +0300 Vladimir Koushnir
+086d611a238bcb817e4697eea401ee8fdc49b975
+
+	* Fixes in SL2VL table distribution algorithm
+
+Thu Mar 22 14:38:45 2012 +0200 Alex Netes
+7d9f0c95e4a37b3f35ccbfc83eee73836793d818
+
+	* Fix deadlock between sminfo_set_req() and osm_sm_state_mgr()
+
+Wed Mar 7 19:57:39 2012 +0200 Hal Rosenstock
+f07bcc10bd45f5843f83ae872f1ad7f42e5b3705
+
+	* opensm/osm_subnet.c: Cosmetic formatting change
+
+Thu Feb 9 18:56:23 2012 +0200 Vladimir Koushnir
+647a98e74a8cc7f0d7b95c3b8fe789af7e89e9a0
+
+	* Fixed crash in sm_state_mgr_send_master_sm_info_req() during fabric merge
+
+Sun Jan 22 10:25:53 2012 +0200 Alex Netes
+048c66e39afbd6259faf1f1b4d2f04d93d550da9
+
+	* Fixed Multicast precreation parsing
+
+Wed Aug 31 22:51:48 2011 +0300 Hal Rosenstock
+c823a5b08ff166c8f41334840f9f4f460f28cf30
+
+	* opensm/osm_link_mgr.c: Set PortInfo:PortState to LinkDown when remote port isn't accessible
+
+Mon Oct 3 11:50:50 2011 +0200 Alex Netes
+ab88df6a3714f5cf7312bf62c756c1981dcf132d
+
+	* Add support to reread configuration file when stacked in rediscovery loop.
+
+Wed Nov 17 15:40:30 2010 -0500 Hal Rosenstock
+3fc662d26387f49a7e7ed717cd1745a57043d704
+
+	* opensm/torus-2QoS: Fix some typos in documentation
+
+Mon Jul 30 15:06:47 2012 -0700 Albert Chu
+fe62e5eaf9d4b20beb96b80e9ac780aaa670d3b9
+
+	* opensm: Add initial congestion control configuration support
+
+Mon Jul 30 10:57:44 2012 +0300 Alex Netes
+67c9bae737a1f755df8c8b4f7163c588cdd5f015
+
+	* opensm: Move per_mod_log_tbl array from subn to log structure
+
+Sun Jul 29 07:26:30 2012 -0400 Hal Rosenstock
+2cbd9f57b405a8e39240b2bdf191bbbaf701e8d0
+
+	* opensm/cl_atomic_osd.h: Cosmetic formatting change
+
+Wed Jul 25 06:40:59 2012 -0400 Hal Rosenstock
+cd63decfb07dab62162264c199e6caf915956141
+
+	* opensm/osm_helper.c: Add CapabilityMask2 to notice dump for trap 144
+
+Wed Jul 25 06:40:53 2012 -0400 Hal Rosenstock
+92058127aa04ba8a79d6a7e5e2b7e2a27593720c
+
+	* opensm/ib_types.h: Add CapabilityMask2 to notice for trap 144
+
+Wed Jul 25 06:40:46 2012 -0400 Hal Rosenstock
+1d5213a8f37b54fd51beaf5c15b3fd1adb6f6415
+
+	* opensm/osm_madw.h: Fix a couple of cut 'n paste commentary errors
+
+Wed Jul 25 06:40:33 2012 -0400 Hal Rosenstock
+25de7064e1fce178479712df4ef32af8e2217fcc
+
+	* opensm/osm_sa_path_record.c: Add missing end-of-line in the log message
+
+Wed Jul 25 06:40:14 2012 -0400 Hal Rosenstock
+3551530abf5d558049d99bdc18e87b660d8f515d
+
+	* opensm/osm_trap_rcv.c: Remove vestigial comment
+
+Wed Jul 25 06:39:56 2012 -0400 Hal Rosenstock
+324f269f8ec197f2bc78d7274622d9b85241cf7c
+
+	* opensm/osm_sa_inform_info.c: Fix some error log messages
+
+Wed Jul 25 06:39:46 2012 -0400 Hal Rosenstock
+067d21767cd29f1c5b5a6641ed4352e025f6032d
+
+	* opensm/osm_inform.c: Make log message format consistent for error messages
+
+Wed Jul 25 06:39:36 2012 -0400 Hal Rosenstock
+759b82ae4d2fb3218472ed88c53318d08ffc82e4
+
+	* opensm/osm_trap_rcv.c: Add better logging for traps 257 and 258
+
+Wed Jul 25 06:37:33 2012 -0400 Hal Rosenstock
+b806657d814b02a284c18c38edc475a021bfbf97
+
+	* opensm/osm_sa_mad_ctrl.c: Eliminate commented out code line
+
+Tue Jul 24 22:49:17 2012 -0700 Ira Weiny
+9d16039950f962bba4c427a8dc8e846215a0eeb1
+
+	* opensm/perfmgr: fix endian conversion of PortCounters
+
+Tue Jul 17 11:40:41 2012 -0700 Ira Weiny
+a851693ef7d235bd03b43e05bdf5d53803440565
+
+	* opensm/perfmgr: add logging of error counters
+
+Wed Jul 11 11:48:19 2012 -0700 Ira Weiny
+52fa6597dda08b4b04897bcdcf9f586ddfde5f5f
+
+	* opensm/console: add perfmgr "print_errors" (pe) console command.
+
+Tue Jul 3 16:54:00 2012 -0700 Ira Weiny
+a832ce2a3695aab4839bd371dc251ae23c1305db
+
+	* opensm/console: Add human readable output for perfmgr data counters
+
+Wed Jul 11 11:48:16 2012 -0700 Ira Weiny
+77a17569f7aba7b18977cacd7860c785a4e85288
+
+	* opensm/console: add abreviations for perfmgr commands
+
+Wed Jul 11 11:48:14 2012 -0700 Ira Weiny
+aca9a079453af49cb0c50c080af75e5ac6b439f7
+
+	* opensm/console; add port option to perfmgr print_counters
+
+Tue Jul 3 16:53:33 2012 -0700 Ira Weiny
+00628cca9b5ff6ef554b1fa289bbad309137d2ea
+
+	* opensm/console: add "print all" to print_counters console command
+
+Tue Jul 3 16:53:22 2012 -0700 Ira Weiny
+f5de9b53b02aa41aeed2f9d1ca9a8ba18cc988aa
+
+	* opensm: perfmgr mark inactive nodes in perfmgr db
+
+Tue Jul 3 16:53:12 2012 -0700 Ira Weiny
+ff06340a3ffdbec408bfd7a54b28ec4a59d16fa7
+
+	* opensm: perfmgr delete "inactive" nodes from the DB
+
+Tue Jul 3 16:53:00 2012 -0700 Ira Weiny
+68b1d92141dc91c47e4db12f677301f5531ef461
+
+	* opensm: perfmgr fix dump_counters
+
+Tue Jul 3 16:52:50 2012 -0700 Ira Weiny
+059d8f49b579b1b648b67d21e26d95672c0761b6
+
+	* opensm/console: protect against 0 entered for the perfmgr sweep_time
+
+Tue Jul 3 16:52:23 2012 -0700 Ira Weiny
+cc866077edd13ccd52a917c9413940adad54b17a
+
+	* opensm/perfmgr: Add config option to ignore Channel Adapters.
+
+Mon Jul 16 11:57:38 2012 +0300 Alex Netes
+74e12d9c53e1d98cce45b780c7991c411a8b5402
+
+	* opensm: fix part_enforce parameter parsing crash
+
+Thu Jul 12 12:23:06 2012 -0400 Hal Rosenstock
+91f0c004baadaaa77a20d9b14e0be82c63ff3dc1
+
+	* opensm/osm_node_info_rcv.c: In ni_rcv_process_existing_ca_or_router, handle error
+
+Tue Jul 10 13:09:10 2012 -0400 Hal Rosenstock
+c930a236b71f8e2aa9592ee2acad7283a743f87c
+
+	* opensm/osm_subnet.c: Indicate lmc and lmc_esp0 are not changeable "on the fly"
+
+Tue Jul 10 17:23:35 2012 +0300 Daniel Klein
+3e4e00b3cf8c229e791ff85fcbe5a6256535d75e
+
+	* opensm/osmtest: fix osmtest ignores timeout parameter
+
+Mon Jul 9 13:15:16 2012 -0400 Hal Rosenstock
+7825e67826c67efc351240569ad80c4fa1c73750
+
+	* opensm/libopensm.map: Removed unimplemented routine
+
+Mon Jul 9 13:15:10 2012 -0400 Hal Rosenstock
+7de7b04b31ab7eddf3c52a7448e2684876d30ed9
+
+	* opensm/main.c: Handle daemon mode with guid specified as 0 more gracefully
+
+Sun Jul 8 11:43:21 2012 -0400 Hal Rosenstock
+9478fbf6113efb74e90561cc5dc8becd1d60d932
+
+	* opensm/osm_subnet.c: Support MLNX ExtendedPortInfo for ConnectIB device
+
+Mon Jul 2 08:54:36 2012 -0400 Hal Rosenstock
+f8fc3347fca4f5a78cd0652e330b5561bb534532
+
+	* opensm/osm_node_info_rec.c: Also handle non compliant SMA in ni_rcv_process_existing
+
+Fri Jun 15 06:31:55 2012 -0400 Hal Rosenstock
+b4a481d933c5694a25cf65444741682ced742fb7
+
+	* opensm: Eliminate unneeded field in DR path structure
+
+Mon Jun 18 13:14:28 2012 -0400 Hal Rosenstock
+01bc8c9221754393e66696982ca210bc524f89f8
+
+	* opensm/osm_state_mgr.c: Force subn->need_update when coming out of STANDBY
+
+Mon Jun 18 06:13:32 2012 -0400 Hal Rosenstock
+276be8bfec8f2c92e52bada43be0522d69008ae5
+
+	* opensm: Dump info functions update for per module logging
+
+Fri Jun 15 06:32:08 2012 -0400 Hal Rosenstock
+63c6609c6dae4ef0a11087eaea999e9dc14adec6
+
+	* opensm/osm_port.h: Fix commentary typo
+
+Fri Jun 15 06:32:02 2012 -0400 Hal Rosenstock
+64b512a7cd5c2920d2de235e1bf884ff2fa7132d
+
+	* opensm/osm_vendor_ibumad.c: Make binding log message clearer
+
+Wed Jun 6 20:35:05 2012 -0400 Hal Rosenstock
+e70c8c17f0f459a05604663fd030654e45cad1dd
+
+	* opensm: Add enum for FILE_ID for per module logging
+
+Thu Jun 7 02:59:52 2012 +0300 Hal Rosenstock
+2a2db8c020afdbe352902b2b26db9f17418e56dd
+
+	* opensm: Add per module logging support
+
+Thu Jun 7 19:16:55 2012 +0000 Bart Van Assche
+4d682bb8ba05e0a6c5f616e70dc28bfa85ef7cce
+
+	* opensm: Fix pthread_create() return value checks
+
+Wed Jun 6 20:34:56 2012 -0400 Hal Rosenstock
+e21b106de1558ad5207076f8fb36cd5988f3762d
+
+	* opensm: Cosmetic changes
+
+Wed Jun 6 13:04:15 2012 -0400 Hal Rosenstock
+3ddb2e3b68dad08d4c4bf7d089c1886a75adfec3
+
+	* opensm: Add partition manager configuration doc to docs
+
+Sun Jun 3 12:08:42 2012 +0300 Alex Netes
+8a9d2679c1d67a2592ff19f0a38ca2dc14158a10
+
+	* opensm: fix locking in osm_guid_mgr_process
+
+Wed May 30 19:28:53 2012 -0400 Hal Rosenstock
+13ebee481707a92d2237481237f9b2e1211ee537
+
+	* opensm/osm_subnet.c: Fixed ftree/updn configuration failure when root_guid_file points to non-existing file
+
+Wed May 30 11:26:34 2012 -0400 Hal Rosenstock
+95866491ea2864b226348a89f3551d49f1098fb6
+
+	* opensm/opensm_release_notes-3.3.txt: Update Unsupported IB Compliance Statements
+
+Wed May 30 10:49:52 2012 -0400 Hal Rosenstock
+826b5c46d671bb257943589cb48ff972ca3f8759
+
+	* opensm/osm_ucast_dfsssp.c: Use osm_log_is_active
+
+Wed May 30 10:43:01 2012 -0400 Hal Rosenstock
+b2cad9d3aaadb3905e64db8c4b6023d3ce117d30
+
+	* opensm/complib/cl_fleximap.h: Cosmetic changes
+
+Wed May 30 10:42:55 2012 -0400 Hal Rosenstock
+740c22b333f65c34e13c04d0c89338d8e8b9bc91
+
+	* opensm/include/opensm/osm_log.h: Fix commentary cut 'n paste error
+
+Wed May 30 10:33:31 2012 -0400 Hal Rosenstock
+322a3103f179d1448c00ef25713a3373e07918dc
+
+	* opensm/osm_ucast_ftree.c: Add a couple of asserts
+
+** Version: opensm-3.3.14
+
+Thu May 24 18:28:22 2012 +0300 Alex Netes
+c9ecfbd48de724a1ba30f74bf1b5b213b11afda9
+
+	* opensm: packages versions update
+
+Thu May 24 18:20:16 2012 +0300 Alex Netes
+4a29c9425781bc8a0c6afbaf50397883d47d8f97
+
+	* opensm_release_notes-3.3: update
+
+Mon Apr 23 21:26:10 2012 +0300 Hal Rosenstock
+c3633e819c39f861b5313ae825fd6a0ebb157836
+
+	* opensm/osm_sminfo_rcv.c: Handle SMP status
+
+Wed Apr 18 13:37:07 2012 +0300 Vladimir Koushnir
+5b88b445d4483171407882cb69c7a9d7484fe6f9
+
+	* Fix logging messages about op_vls and mtu mismatch
+
+Sun Apr 29 17:00:33 2012 +0300 Alex Netes
+6a916fee03b6bef375f3fff426774af7c6052301
+
+	* Fix ucast cache crash, when switch doesn't have valid phys ports
+
+Tue Feb 14 16:13:56 2012 +0200 Alex Netes
+b9b3102ea478f21cde3c730cc60b7797b54895a6
+
+	* opensm: fix crash in osm_ucast_mgr
+
+Sun Apr 29 12:09:43 2012 +0300 Alex Netes
+84567b155e53b2880c7821d2321a2c6147813cc8
+
+	* opensm/osm_ucast_cache.c: fix crash in ucast cache when switch with lid 0 dropped
+
+Wed May 9 19:17:34 2012 +0300 Daniel Klein
+715d327e182ba1bf67112ebe83ec2b82c0a0e313
+
+	* opensm: fix search common pkeys
+
+Fri May 11 08:58:23 2012 -0400 Hal Rosenstock
+ca3c12b5840e1dce9c6b8f92b0759b6016e25b88
+
+	* opensm/osm_switch.c: In osm_switch_set_hops, return, error when port_num is invalid
+
+Wed Mar 28 18:48:01 2012 +0200 Alex Netes
+1552edb449bfdc09c43c147f7b0c19c49696d656
+
+	* Fix memory leak on dfsssp_context_destroy()
+
+Wed Mar 28 14:05:06 2012 +0200 Alex Netes
+e772c5b7f6fd1917f820f4b5c41576909b60a86e
+
+	* Changed sl_path API to include slid and dlid only
+
+Thu Mar 29 15:10:57 2012 +0200 Alex Netes
+433859f2280e307421d72f89a9e94f571e0e1bd0
+
+	* Removed unused variables
+
+Thu Jan 26 04:48:01 2012 +0100 Jens Domke
+caade28efe469a67a2be046a7d65aa5b2f413577
+
+	* Optimized and deadlock-free routing algorithm for InfiniBand
+
+Wed May 9 07:41:18 2012 -0400 Hal Rosenstock
+390493e75d1b4cb4874fb46cc43c1affb9405975
+
+	* opensm/osm_link_mgr.c: Fix sending PortInfo Set for ports supporting extended speed
+
+Sun Apr 29 21:30:50 2012 +0300 Alex Netes
+e24ff397a9e48331f3bca334dbfa5ac576ef77ea
+
+	* Fix Pkey enforcement configuration
+
+Tue Feb 14 10:09:39 2012 +0200 Alex Netes
+041e47aa8221aabed81c09d2e0ce9f6c78e9fb0c
+
+	* Fix PathRecord reply to be the same for allow_both_pkeys ON and OFF
+
+Tue Nov 15 10:42:41 2011 +0200 Alex Netes
+a6ac5e37a4b3072082e3616312feb9cd81ccb71f
+
+	* opensm/osm_drop_mgr.c: GID out trap fix
+
+Tue Apr 10 11:58:56 2012 +0300 Alex Netes
+3c9b81d4a345a8d25c1d4b1e451460a191ae544f
+
+	* OpenSM/osm_prtn_config.c: Fix non-initialized pointer usage
+
+Tue Apr 17 07:49:45 2012 -0400 Hal Rosenstock
+de5e3781107c8e10b2891db6cbadb233dfc90655
+
+	* opensm/complib/cl_[ptr_]vector.h: Commentary change for consistency
+
+Tue Apr 17 07:49:41 2012 -0400 Hal Rosenstock
+45f93ec8c9cc1880f31664d0e354ac56946a8d9b
+
+	* opensm: Add additional IBM vendor ID/OUI
+
+Sun Apr 15 11:56:29 2012 -0400 Hal Rosenstock
+c386eb211d8f4b742bf7d398ea1f6978b13e0c9b
+
+	* opensm/osm_state_mgr.c: Cosmetic change to log message
+
+Sun Jul 24 17:42:55 2011 +0300 Alex Netes
+703e5961055612833cee8ad92d2624cf9250f92f
+
+	* opensm: Add support for partition enforcement types to accomodate IBA extended link speeds
+
+Wed Feb 22 16:52:50 2012 +0200 Alex Netes
+a2a03a8921fb40399061453cd88787fc573084c6
+
+	* Check block_num validity in set_guidinfo() and del_guidinfo() requests
+
+Mon Feb 27 15:33:14 2012 +0200 Alex Netes
+8d764b8a9f115126c4771de805fbfea004c22064
+
+	* Fix continous looping when clearing accum_pkeys table
+
+Mon Feb 27 15:59:44 2012 +0200 Daniel Klein
+e6ec61fdf9b2f76ec9dbb4d85050c5d9ed2a4815
+
+	* end error resoponse to invalid LID in GUIDInfo request
+
+Wed Nov 30 10:09:04 2011 +0200 Daniel Klein
+77175057c673e2fca6cf8064faf8f5465f8e9479
+
+	* opensm/osm_pkey_mgr.c: fix segfault when trying to access not allocated block
+
+Thu Dec 29 21:45:10 2011 -0500 Hal Rosenstock
+7fce50001e04f016dc6ec694fd9483a99404d098
+
+	* opensm/Makefile.am: Add doc/opensm-sriov.txt to docs
+
+Thu Dec 29 21:45:03 2011 -0500 Hal Rosenstock
+264aeb10bd4122934c1961017684094770da91f9
+
+	* opensm: Add documentation for SRIOV support
+
+Tue Nov 22 15:23:59 2011 -0500 Hal Rosenstock
+c6398325759c7df0c6a730056a4396e9b2758c4f
+
+	* opensm: Enhance osm_physp_share_this_pkey for allow_both_pkeys policy
+
+Tue Nov 22 15:23:52 2011 -0500 Hal Rosenstock
+b17b63c5bdb80140cb64cd382b0e7d7161113b40
+
+	* opensm: When allowing both pkeys, on a switch external, (peer) port eliminate limited pkey when full pkey with same base is present
+
+Tue Nov 22 15:23:45 2011 -0500 Hal Rosenstock
+a758da24b2cc669b9bae014cb6888dcca9783bf6
+
+	* opensm: Add command line option for allow_both_pkeys
+
+Tue Nov 22 15:23:40 2011 -0500 Hal Rosenstock
+f412de3ba9748386a80799594f297a06b8fa4cd4
+
+	* opensm: Update partition documentation and man page for (allowing) both (limited and full) memberships in the same partition
+
+Tue Nov 22 15:23:32 2011 -0500 Hal Rosenstock
+726ce6ab6ca9acb21cf2b1fb4348956afebf0253
+
+	* Support allowing both full and limited members of same partition
+
+Tue May 24 13:25:35 2011 -0400 Hal Rosenstock
+4ccf32f71e4b8434f09e37f9ca21419d81f45a5d
+
+	* opensm/PKeyMgr: Support pkey index reuse when there are no longer any previously unused indices available
+
+Tue May 24 13:25:29 2011 -0400 Hal Rosenstock
+ef9cf49fd46fd4dde6edf78181bd928fa589171c
+
+	* opensm/osm_pkey.h: Commentary change
+
+Tue May 24 13:25:21 2011 -0400 Hal Rosenstock
+eb375a6b2227a58fee436d82fdf5cc108818b1a4
+
+	* opensm/osm_pkey_mgr.c: Detect pkey table overflow in pkey_mgr_update_port
+
+Tue May 24 13:24:57 2011 -0400 Hal Rosenstock
+411e7426e7f3995e69bd0b2000bf1ed424f67eae
+
+	* opensm/PkeyMgr: Don't change end port pkey index when simultaneously adding and removing partitions
+
+Tue Nov 22 15:24:09 2011 -0500 Hal Rosenstock
+15e7223fb92b42b3cdad9e70d33a97093e7444b1
+
+	* opensm/osm_sa_guidinfo_record.c: In set_guidinfo, better SM reassigned guid handing
+
+Sat May 21 10:56:26 2011 -0400 Hal Rosenstock
+8d49c5d49a6392f0297496db1260492568125a6f
+
+	* opensm/osm_sa_guidinfo_record.c: Fix locking
+
+Sat May 21 17:17:34 2011 +0300 Hal Rosenstock
+e79b7252d1b8eccf222023ddc7c54145876a5955
+
+	* opensm: Handle SubnSet GUIDInfo asynchronously from GUIDInfoRecord handling
+
+Fri Apr 29 13:45:27 2011 +0300 Hal Rosenstock
+96c741dc04392f2f643e8cbc2397252a810f713c
+
+	* opensm: Some cosmetic formatting changes
+
+Fri Apr 29 13:44:49 2011 +0300 Hal Rosenstock
+1d5e37035ab0e39f8e59f02ec2e123bb629fcc13
+
+	* opensm/osm_sa_guidinfo_record.c: Better status for SA response
+
+Fri Apr 29 03:19:55 2011 +0300 Hal Rosenstock
+efd3ba2e571c34a58b80e3db7df75b945fcaf2dc
+
+	* opensm/osm_sa.c: Change log level of message
+
+Fri Apr 29 00:03:29 2011 +0300 Hal Rosenstock
+db8b7da5033bf10600a3239a2731b6f1abadeb92
+
+	* opensm/osm_sa_service_record.c: Alias GUID support
+
+Fri Apr 29 00:00:56 2011 +0300 Hal Rosenstock
+53309869319a740597facff60977217512072b63
+
+	* opensm/osm_sa_multipath_record.c: Add support for alias GUIDs
+
+Thu Apr 28 23:55:35 2011 +0300 Hal Rosenstock
+44168c98cf0627e411b6e37f9237d6fd09224954
+
+	* opensm/osm_sa_guidinfo_record.c: In del_guidinfo, validate guid not in use
+
+Thu Apr 28 23:52:51 2011 +0300 Hal Rosenstock
+63eb65b54cd8d7539c3bf3725faa550eda5ed9fc
+
+	* opensm: Add multicast support for alias GUIDs
+
+Thu Apr 28 23:36:38 2011 +0300 Hal Rosenstock
+700d15f0bdb239bab7d0311a4b59fa007bc090a5
+
+	* opensm/osm_sa_path_record.c: Add support for alias GUIDs
+
+Thu Apr 28 23:29:55 2011 +0300 Hal Rosenstock
+f81838737ac1152352e1e7424c1a7caea0b72da8
+
+	* opensm/osm_sa_guidinfo_record.c: Use OSM_VENDOR_ID_OPENIB define rather than IB_OPENIB_OUI
+
+Fri May 20 15:50:14 2011 -0400 Hal Rosenstock
+97e360e78cca8db569cb84b7d819a056bad5896a
+
+	* opensm: Dump/load SA GUIDInfoRecords
+
+Fri May 20 15:49:55 2011 -0400 Hal Rosenstock
+fe74f1d678c4c096b81393749b1f51ad300ea0a9
+
+	* opensm: Make SA assigned guids persistent across port down/up events
+
+Thu Apr 28 22:43:07 2011 +0300 Hal Rosenstock
+eb8f1d94f443ec6fcacaec318a66fc83ab3e0b7a
+
+	* opensm: Add support for alias GUIDs
+
+Wed Feb 29 12:54:16 2012 -0600 Mike Heinz
+b3b18617c6d31a25d6c6f7eb3a5ce2d786cab9f7
+
+	* opensm: osm_subnet.c: Updated patch to add error-reporting to the parsing of opensm.conf
+
+Fri Mar 2 08:10:27 2012 -0500 Hal Rosenstock
+cd8a708ae0d0762511be5946256234d64d580876
+
+	* opensm/man/opensm.8.in: Add description for OSM_LOG_SYS logging flag
+
+Thu Mar 8 08:04:14 2012 -0500 Hal Rosenstock
+1308e5ca42091643baf53660b32173af5901e186
+
+	* opensm/osm_console.c: Add display of FDR10 ports to portstatus_parse
+
+Mon Mar 5 17:39:18 2012 -0800 Albert Chu
+eb90efd0bd953b4cb891e58bad179607dd0eb18f
+
+	* include/opensm/osm_subnet.h: fix comment typos
+
+Thu Mar 8 15:45:27 2012 -0800 Albert Chu
+0a315e3665bedbcf1af641ffe15d886d043236b2
+
+	* opensm/include/iba/ib_types.h: fix comment typos and errors
+
+Thu Feb 23 07:41:44 2012 -0500 Hal Rosenstock
+125baa0616a6588cd300fe5e033326da1bdccb9c
+
+	* opensm/opensm.8.in: Fix cut 'n paste error
+
+Thu Feb 23 07:41:36 2012 -0500 Hal Rosenstock
+f0d14d2aa2e4f07c582c02b3ae013dc478cd7080
+
+	* opensm/osm_ucast_ftree.c: Fix some typos
+
+Thu Feb 16 10:46:55 2012 -0800 Albert Chu
+f4722b0f833ed7a060f80b6757cfb9af78252678
+
+	* opensm: Reset client reregistration when receiving handover
+
+Mon Feb 13 16:13:47 2012 -0800 Albert Chu
+841096f370ae87d2829e852521911be317cb1a63
+
+	* opensm: Fix opensm handover/relinquish corner case
+
+Mon Feb 6 11:29:59 2012 -0500 Hal Rosenstock
+bf420ac9199ac6b9fea7e7d358e43d3d0dc03cf6
+
+	* opensm/osm_helper.c: Fix commentary typo
+
+Wed Jan 18 20:16:22 2012 +0200 Alex Netes
+2be999c3152a7822550ceb58609eec1ac0202554
+
+	* opensm: fixed description in osm_routing_engine
+
+Tue Jan 17 16:48:54 2012 +0200 Alex Netes
+cf3d1859b334b34c5da7aa1415d656b61a330f05
+
+	* gen_chlog.sh: fixed version ordering
+
+** Version: opensm-3.3.13
+
+Tue Jan 17 15:15:55 2012 +0200 Alex Netes
+437939d091b03df365b747eba966f8457f8adad4
+
+	* opensm: packages versions update
+
+Tue Jan 17 14:07:31 2012 +0200 Alex Netes
+e62d4c5bdf827aeb87f9ec8ed80f3a685c46b259
+
+	* opensm_release_notes-3.3: update
+
+Tue Jan 17 13:56:56 2012 +0200 Alex Netes
+52d28db27190f84bc14205d3c6138ddd5de1e4dd
+
+	* opensm: update shared library versions
+
+Thu Jan 12 16:14:35 2012 +0200 Alex Netes
+110ae103cbc6087f70bdcdd8be50e419ee4a6fab
+
+	* opensm: fixed segfault in osm_destroy
+
+Tue Dec 27 19:11:26 2011 -0500 Hal Rosenstock
+d66620555b751ebfa808c13e335c8fde81406752
+
+	* opensm/osm_prtn.c: Fix typo in log message
+
+Thu Apr 28 16:21:47 2011 -0700 Hefty, Sean
+f3ccb45f2cd6359cd1e8de2b02cbe42230911a96
+
+	* opensm: Remove duplicate definition of IB_MAD_STATUS_CLASS_MASK
+
+Mon Nov 14 14:50:43 2011 -0800 Albert Chu
+917070c6da6473854549bb37a36d443d9a99cd2d
+
+	* Move no_fallback_routing_engine from osm_subn_opt_t to osm_opensm_t.
+
+Mon Nov 14 14:49:49 2011 -0800 Albert Chu
+d71a924736707400bed47a3c69395cf864c970bb
+
+	* Free memory from osm_subn_opt_t when osm_subn_t destroyed
+
+Mon Nov 14 14:53:42 2011 -0800 Albert Chu
+1b75fa4885603a8c00ad9f0090d7187d78f36a7f
+
+	* Remove duplicate initialization of scatter_ports
+
+Thu Nov 10 10:01:40 2011 -0800 Albert Chu
+b5f4570414666314bf81c3b4bba1c86fa0dd05be
+
+	* Do not load configs from the default config file and specified config file
+
+Fri Nov 11 10:04:52 2011 -0800 Albert Chu
+f24a089783fa177b6df41639a0a2830e437f0ada
+
+	* Fix memleak and segfault
+
+Tue Dec 27 14:28:42 2011 -0500 Hal Rosenstock
+9b50961e4e58ad742c296bddbf9cbd4663b4af95
+
+	* opensm: Change osm_routing_engine struct to not use C++ reserved word
+
+Mon Jan 9 14:00:52 2012 +0200 Alex Netes
+247d0d8820d0536150869cfc00799b15a9a3d01f
+
+	* Fix IPoIB broadcast group creation on non-default Pkey
+
+Fri Jan 6 13:53:29 2012 +0200 Alex Netes
+0456b3f12fbbf7cf6bef5862c50d24e6b9ff41f5
+
+	* Fixed multicast groups reconfiguration during heawy sweep
+
+Mon Nov 7 13:45:39 2011 -0500 Hal Rosenstock
+c9c0aa61b3ab427a44763816eb11776e0c65d86f
+
+	* opensm/man/torus-2QoS.conf.5.in: Update portgroup_max_ports section
+
+Tue Nov 22 14:03:00 2011 -0500 Hal Rosenstock
+78d86bdba3cf55dd6792caeeeafbdd51bf330a79
+
+	* opensm/osm_subnet.c: Trivial optimization to code flow in subn_verify_sl2vl
+
+Mon Nov 21 07:02:05 2011 -0500 Hal Rosenstock
+6bb41e3ad339426f35a3cc80c4f460c72b19602b
+
+	* opensm/complib/cl_atomic.h: Commentary changes
+
+Fri Dec 9 08:06:38 2011 -0500 Hal Rosenstock
+28ee7b9bef9a7441865f1f07134758a586651fae
+
+	* opensm/osm_sa_class_port_info.c: Conditionalize setting of OSM_CAP2_IS_MCAST_TOP_SUPPORTED
+
+Fri Dec 23 13:47:53 2011 +0200 Alex Netes
+29e59a2e80de631fd8a0c80c6228b3a3ab5b616a
+
+	* Removed unused parameter "ib_mad_addr" from umad_reciever()
+
+Tue Dec 20 15:08:50 2011 -0500 Hal Rosenstock
+63ad0bb2974f3fabac5c38470d56ca58b32d7edc
+
+	* opensm/osmeventplugin/src/osmeventplugin.c: Output LIDs in decimal
+
+Tue Dec 20 15:08:40 2011 -0500 Hal Rosenstock
+17967c2c981e5dba906ae9914e485f373ea89d37
+
+	* opensm/osm_switch.h: Fix commentary typo
+
+Tue Dec 20 15:08:27 2011 -0500 Hal Rosenstock
+6d3e2230be5c31d83d28e78a2183d8cded73cfaa
+
+	* opensm/osm_perfmgr.c: Enhance send error log message
+
+Tue Dec 20 15:08:21 2011 -0500 Hal Rosenstock
+08abcd4275aef4a09250c1e3060ad46e108c8687
+
+	* opensm/osm_sa_mad_ctrl.c: Enhance send error log message
+
+Tue Dec 20 15:08:14 2011 -0500 Hal Rosenstock
+13f3e0f0e239eb950fb1ca4da6f0732e0361c6d7
+
+	* opensm/libvendor/osm_vendor_ibumad.c: Fix DR path printing on send timeouts
+
+Fri Nov 4 12:26:00 2011 -0700 Ira Weiny
+3c97f061af82b0bb0088ca624a98166160eb991a
+
+	* opensm: Add the precreation of multicast groups
+
+Tue Nov 8 17:01:24 2011 +0200 Alex Netes
+0dfd760a879176fb424c029f38f36bb7fbf1cb05
+
+	* Fix suggest parentheses around operand warning
+
+Mon Nov 7 13:26:36 2011 -0800 Albert Chu
+ad2dbf87b62d7c2c49b782a5c23d23fccbaf3fda
+
+	* Support source-target-port-guid QoS policy configuration with ULP 'any'
+
+Mon Nov 7 13:26:33 2011 -0800 Albert Chu
+080e3ad3335c284d8942f8154e6334fcaf529b1a
+
+	* Support source-port-guid QoS policy configuration with ULP 'any'
+
+Mon Nov 7 13:26:25 2011 -0800 Albert Chu
+49777a9f92ce7d3c0a0b86c60606d02464f8bc86
+
+	* Fix typo in qos-ulps parsing comment
+
+Mon Nov 7 10:20:46 2011 -0500 Hal Rosenstock
+bcfe1b99d09bceb74a5f0b2bdb920f4171a97557
+
+	* opensm/osm_torus.c: Use "OpenSM standard" error codes
+
+Mon Nov 7 18:12:35 2011 +0200 Alex Netes
+683397d831cbd9c8ac3c2aaed206b001916f5177
+
+	* Fix use of GNU old-style field designator extension
+
+Mon Nov 7 18:07:30 2011 +0200 Alex Netes
+719fcd451c836ee5c52922396219d3aeb96b64d5
+
+	* Fix use of logical && with constant operand; switch to bitwise &
+
+** Version: opensm-3.3.12
+
+Thu Nov 3 08:37:59 2011 +0200 Alex Netes
+dbcf81ffb651b9e15798259526ea2383efd7cff1
+
+	* opensm: packages versions update
+
+Thu Nov 3 08:37:06 2011 +0200 Alex Netes
+fca31d7073aecf82f5ecd4055b123f2b97d50117
+
+	* opensm_release_notes-3.3: update
+
+Tue Nov 1 08:37:55 2011 -0400 Hal Rosenstock
+7c1ee6449eb53422e9e1acbb731e313de4b0e5c5
+
+	* opensm: Fix typo in routing section in man page and doc
+
+Wed Nov 2 14:35:19 2011 +0200 Daniel Klein
+d206011ea20a8be19a73721fdc971b1b8ce251eb
+
+	* opensm/osmtest/osmtest.c: inventory file parsing bugfix
+
+Fri Sep 30 11:41:59 2011 -0400 Hal Rosenstock
+32945398527ee61f0fd51ae8b16f2c3833282b9b
+
+	* opensm: Only log SM PORT "state" when it changes
+
+Sun Sep 11 11:01:46 2011 +0300 Alex Netes
+e01121a93d5788627b52d36084bbfbc1c95ee7ee
+
+	* fixed deprecated conversion from string constant to char* warning
+
+Mon Oct 17 13:34:09 2011 -0400 Hal Rosenstock
+a7ba101c3f8bd1694a549d4ca0c6e0fa52253674
+
+	* opensm/main.c: Change size parameter in setvbuf call from 0 to BUFSIZ
+
+Mon Oct 17 13:46:04 2011 -0400 Hal Rosenstock
+15525794298439350d646158b707614c600a5260
+
+	* opensm/osm_sa_mcmember_record.c: Commentary changes relating to SA assigned MGIDs
+
+Tue Oct 18 09:17:38 2011 -0400 Hal Rosenstock
+b3bb0ab4a45b74cde70be0597a39d066df23357c
+
+	* opensm/osm_dump.c: Dump SL2VL tables if routing engine might have modified them
+
+Tue Oct 18 09:17:33 2011 -0400 Hal Rosenstock
+8a087199dfbda641303f9791db27acd61074c2aa
+
+	* opensm/osm_dump.c: dump SL2VL tables in debug verbosity level when QoS is on
+
+Thu Oct 27 12:55:51 2011 -0400 Hal Rosenstock
+7b3f43529de9b80ff701005a35751504eba3cb79
+
+	* opensm/osm_link_mgr.c: Remove no longer needed memset
+
+Thu Sep 29 08:49:32 2011 -0400 Hal Rosenstock
+2a9255499f0b908537bf015855a77f5b582e9099
+
+	* opensm/osmtest/osmt_multicast.c: Fix multicast flow failures on pkey validation
+
+Wed Sep 28 08:50:49 2011 -0400 Hal Rosenstock
+364e65b054fc8a7dfb135cb5adbf60241050d188
+
+	* opensm/osm_dump.c: Fix FDR10 speed dumping
+
+Tue Oct 4 09:53:28 2011 -0400 Hal Rosenstock
+fc908c91ecff3caeaf15ddad7580ca932ed9e82a
+
+	* opensm/osm_sa_multipath_record.c: Add mtu validation if supplied
+
+Tue Oct 4 09:53:23 2011 -0400 Hal Rosenstock
+687e1f81eff036e7b69592793ff90d27e7f544d4
+
+	* opensm/osm_sa_mcmember_record.c: Add mtu validation if supplied
+
+Tue Oct 4 09:53:18 2011 -0400 Hal Rosenstock
+76f5b0991101c06c57cd3c335b2593c2251d7b58
+
+	* opensm/osm_sa_path_record.c: Add mtu validation if supplied
+
+Tue Oct 4 09:53:10 2011 -0400 Hal Rosenstock
+9f38fae39262991ddd68a98fd72a45979fd3422b
+
+	* opensm/osm_helper: Add ib_mtu_is_valid
+
+Sat Oct 1 09:16:15 2011 -0400 Hal Rosenstock
+80e11b93e25542e1865844f77cf044d2a3b491f8
+
+	* osmtest/osmt_multicast.c: Fix check of partial JoinState delete request - removing NonMember (o15.0.1.14)
+
+Sat Oct 1 09:16:11 2011 -0400 Hal Rosenstock
+78e1e4e56697b6cb66b69e31b7699dd286f197e5
+
+	* osmtest/osmt_multicast.c: Fix check of BAD RATE when connecting to existing MGID (o15.0.1.13)
+
+Sat Oct 1 09:16:05 2011 -0400 Hal Rosenstock
+e94e972b493443d8a8979c38881045e4c17cba6c
+
+	* osmtest/osmt_multicast.c: Fix first MGID=0 MC group creation case
+
+Sat Oct 1 09:16:01 2011 -0400 Hal Rosenstock
+655230bcf7715ee13c90b8e8431d964881f8194f
+
+	* opensm/osm_sa_multipath_record.c: Add rate validation if supplied
+
+Sat Oct 1 09:15:51 2011 -0400 Hal Rosenstock
+cb1484df09ae6d742b323f7d27cfc457f24e0be5
+
+	* opensm/osm_sa_mcmember_record.c: Add rate validation if supplied
+
+Sat Oct 1 09:15:40 2011 -0400 Hal Rosenstock
+485d0686abdff272b308bb457f4c0d151da67c9f
+
+	* opensm/osm_sa_path_record.c: Add rate validation if supplied
+
+Sat Oct 1 09:15:32 2011 -0400 Hal Rosenstock
+300f4d9a158e98b99628411f59b457032aa990f3
+
+	* opensm/osm_helper: Add ib_rate_is_valid
+
+Thu Sep 22 14:22:46 2011 -0400 Hal Rosenstock
+daedad72461991e824ad2d2bb6ba4539fbecc19e
+
+	* opensm/osmtest/osmt_multicast.c: Fix an unrealistic rate case
+
+** Version: opensm-3.3.11
+
+Fri Sep 2 09:45:57 2011 +0300 Alex Netes
+15ad41de7cc9ccda61c5e3aec91e198bd09f04ca
+
+	* opensm: packages versions update
+
+Fri Sep 2 09:44:50 2011 +0300 Alex Netes
+8a8afa0bd9e9d8f26f078f9c54cce18f982b7d57
+
+	* opensm_release_notes-3.3: update
+
+Thu Sep 1 16:24:27 2011 -0700 Albert Chu
+5654e22c71a4655c46339162fa19bc79a5403bb9
+
+	* Fix invalid error check, which lead to segfault
+
+** Version: opensm-3.3.10
+
+Thu Sep 1 23:00:42 2011 +0300 Alex Netes
+73e24137c44c7c5f383a7714c6ec43f26368b22a
+
+	* opensm: packages versions update
+
+Thu Sep 1 22:58:21 2011 +0300 Alex Netes
+caf88987da287d081bb62ee4225d3d764c26f526
+
+	* opensm: update shared library versions
+
+Thu Sep 1 22:44:43 2011 +0300 Alex Netes
+4771a28fcdde59dad89c85fa81745c3ce52b9a69
+
+	* opensm_release_notes-3.3: update
+
+Thu Aug 18 05:40:50 2011 -0400 Hal Rosenstock
+e3a946d95eafb8061d932959ba8bd02ed200c120
+
+	* opensm: Add FDR10 support
+
+Wed Aug 31 13:35:14 2011 +0300 Alex Netes
+ec9adcc75aa3b6975ca36f5faf8496468b2e9c26
+
+	* add DnUp to list of supported engine names
+
+Fri Aug 19 14:06:38 2011 -0700 Ira Weiny
+9559dda77fd99f140e51b1b1f3412cd5862dd7c1
+
+	* opensm: add torus-2QoS to list of supported engine names
+
+Wed Aug 17 14:40:13 2011 -0400 Hal Rosenstock
+6cea3df28335200a0c60140090a767daf39b9a04
+
+	* opensm/osm_sa_portinfo_record.c: Add SA PortInfoRecord support for CapabilityMask2 matching
+
+Wed Aug 17 14:40:07 2011 -0400 Hal Rosenstock
+9ac7eebe2efbc1d52836fb0ff965e43737fe8c47
+
+	* opensm: Add infrastructure support for CapabilityMask2 field in PortInfo
+
+Wed Aug 17 14:39:48 2011 -0400 Hal Rosenstock
+e17dae69013d1999430c39efe52b9a96876e2b70
+
+	* opensm/osm_sa_portinfo_record.c: In pir_rcv_new_pir, fix switch port 0 physp
+
+Tue Aug 9 10:30:45 2011 -0400 Hal Rosenstock
+a33a8af18c502cfb1162f4b36735a474dbc276c2
+
+	* opensm: Add extended link speeds support
+
+Wed Aug 3 15:42:30 2011 -0700 Ira Weiny
+8bc7c30187c35bd149c53c0d50d13925045febb9
+
+	* opensm: make loopback console compile on by default.
+
+Tue Jul 26 12:24:47 2011 -0400 Hal Rosenstock
+e26fe06a942dc92de9471b110d2d8475ae3b2c2f
+
+	* opensm/osm_sa_multipath_record.c: Proper rate comparison and selection
+
+Tue Jul 26 11:23:51 2011 -0400 Hal Rosenstock
+2f32ea8526e7c14216341011be1501dcf94bdab7
+
+	* opensm/osm_sa_mcmember_record.c: Proper rate comparison and selection
+
+Tue Jul 26 11:23:46 2011 -0400 Hal Rosenstock
+45111c29b93b14effbb024e5c72b0c163dfcfbb5
+
+	* opensm/osm_sa_path_record.c: Proper rate comparison and selection
+
+Fri Jul 29 08:36:47 2011 -0400 Hal Rosenstock
+cc7ff0751ff23ca6e7c9dc5f261c1fb865ca2c15
+
+	* opensm/osm_helper: Add rate related routines
+
+Mon Jul 11 20:46:52 2011 +0300 Alex Netes
+37086c07880a5ec8e1415525204e0170ed34ad4a
+
+	* Remove unused variables from code
+
+Mon Jul 11 20:46:26 2011 +0300 Alex Netes
+93b2f567dabd5b73581c78c1b63d1561d69f11ed
+
+	* libvendor/osm_vendor_ibumad.c: fix unused-but-set warning
+
+Mon Jul 11 20:45:54 2011 +0300 Alex Netes
+cda58af67dec78c03e7d3ad86aaefe8958b51595
+
+	* fixed unsused-but-set warning for DEBUG variables
+
+Thu Jul 28 09:59:10 2011 -0400 Hal Rosenstock
+f427600259f3c7b3ba6518b4ecadd5201e1b0fda
+
+	* opensm/osm_sa_class_port_info.c: Minor simplification to setting CapabilityMask2
+
+Thu Jul 28 09:58:58 2011 -0400 Hal Rosenstock
+566b4625a421aa258b98113775b50af4e0b3f08c
+
+	* opensm/ib_types.h: Update SA PortInfoRecord component masks
+
+Tue Jul 26 08:31:13 2011 -0400 Hal Rosenstock
+b8c7632fe0c8be2467bc3063610e528f8bc4daf6
+
+	* opensm/osm_[lid pkey]_mgr.c: Remove no longer needed memset
+
+Mon Jul 18 07:45:28 2011 -0400 Hal Rosenstock
+f999195c2b80a89d70c20295bd876db253ba771c
+
+	* OpenSM: Add infrastructure for "full" SM PortInfo and SA PortInfoRecord attributes
+
+Wed Jul 20 08:44:15 2011 -0400 Hal Rosenstock
+f7d813d5ef53d657f8f3c9237bbd4ecb3ce36258
+
+	* opensm/doc/todo: Minor update
+
+Wed Jul 13 19:37:01 2011 -0400 Hal Rosenstock
+480de4ae8e75b7cc6fd19f1235b8c7ed974843c0
+
+	* opensm: Use forward extensible and safer way to compare mkey_lmc field in PortInfo attribute
+
+Wed Jul 6 15:11:16 2011 -0700 Ira Weiny
+22ca9662c6ec110a5f3390f2ac61476e5758f744
+
+	* opensm: enable perfmgr build by default
+
+Tue Jul 12 18:09:31 2011 -0700 Ira Weiny
+4250c598e0cd5f07d73c05948a76aac479b947a9
+
+	* opensm: perfmgr only run sweep timer when enabled.
+
+Tue Jul 5 13:24:34 2011 -0400 Hal Rosenstock
+dfeb3f6a9bbdfdb7dd18587d8fadc2710ed6c0bd
+
+	* opensm/osmtest/osmt_multicast.c: Use proper defines for rate
+
+Fri May 27 13:52:12 2011 -0400 Hal Rosenstock
+0ef986ad03a4f5db38190a7a52f1c1d31d80aae2
+
+	* opensm/osm_db_files.c: In osm_db_delete, don't free p_key
+
+Thu Jun 16 09:31:59 2011 -0400 Hal Rosenstock
+2d85bcd2b208d21cadd2317b95f7e4ba5ef0af56
+
+	* opensm/osm_sminfo_rcv.c: Eliminate unneeded return parameter from internal routine
+
+Wed Jun 22 09:50:14 2011 -0400 Hal Rosenstock
+e881d0ece885f4bb0748b6ecf9c6219e56bafbfa
+
+	* opensm/osmtest/osmt_multicast.: Fix typo in log message
+
+Mon Jun 27 20:08:03 2011 +0300 Alex Netes
+8ae061c752b070dc77476b43418f070ee99e8929
+
+	* opensm: don't set switch hops to lid 0
+
+Tue Jul 5 18:51:08 2011 +0300 Alex Netes
+5dffc78a51ba6e39b1b53e519a8b8436f80ec1f6
+
+	* renaming dimn_ports_file parameter to route_port_ordering_file
+
+Tue Jul 5 07:33:42 2011 -0400 Hal Rosenstock
+203f3c62b444a4c301c6b378ddcf20241800cb08
+
+	* opensm/osm_switch.c: Fix compile warnings
+
+Tue Jul 5 07:33:20 2011 -0400 Hal Rosenstock
+f87fb59e1c4dae7454fbd4c624adc91057b8150a
+
+	* opensm/current-routing.txt: Add DnUp description
+
+Tue Jul 5 07:33:01 2011 -0400 Hal Rosenstock
+67c2538e1969056e71466ef3cd01c1c7c8ac0be8
+
+	* opensm/man/opensm.8.in: Fix some typos
+
+Wed Mar 23 16:04:12 2011 -0700 Ken Schmidt
+f532007d2c9f354ad98f6f7b8481e87962e8e40c
+
+	* OpenSM - The DnUp routing algorithm.
+
+Wed Apr 6 17:40:22 2011 -0700 Albert L. Chu
+43ef9fe082c4038b6e2605c53032a660f265a7ae
+
+	* Cleanup scatter ports patch.
+
+Wed Apr 6 17:35:43 2011 -0700 Jared Carr
+18106723eb28efef352d32320df47226f99f8cee
+
+	* Support scatter ports.
+
+Wed Apr 6 15:27:20 2011 -0700 Albert L. Chu
+dd2110721e254c7bdec23ea4105cf31fee59e69d
+
+	* Support port shifting.
+
+Sun Apr 17 22:32:08 2011 -0700 Weiny, Ira K
+008af843a6faa434258e77d20a838ce9da30e71e
+
+	* opensm: perfmgr, only set orig_lid when we have a valid port. Otherwise leave it as 0
+
+Sat Jun 4 11:06:35 2011 -0400 Hal Rosenstock
+7338efc631ef74838637eb1b9d740a58c0b456a8
+
+	* opensm/osmtest/osmtest.c: Fix endian in some log messages
+
+Fri Apr 22 17:21:48 2011 -0400 Hal Rosenstock
+8a9021d1583f4573c5b73fb684506993c2aef9a6
+
+	* opensm: Provide option to disable use of MulticastFDBTop even if advertised
+
+Thu Jun 2 20:40:27 2011 -0400 Hal Rosenstock
+26f2be49e628a8b0ca77602c615cf3242fc4708b
+
+	* opensm/osm_ucast_ftree.c: Handle [sw hca]_create failures
+
+Thu Jun 2 20:40:21 2011 -0400 Hal Rosenstock
+b9837cceb27c54730b950fe373f9eaa868d97a14
+
+	* opensm/osm_switch.c: In switch_find_guid_common, handle NULL parameter
+
+Thu Jun 2 15:03:06 2011 -0400 Hal Rosenstock
+67063ca66008bfdb9aa4692a30f692d0dc28ea9b
+
+	* opensm/libvendor: Fix compile warnings on 64 bit machines when building --with-osmv=sim
+
+Wed Jun 1 16:33:01 2011 -0600 Jim Schutt
+efadfe9b926fb6165ca98cdcfbfcaebeb97f9d69
+
+	* opensm: use OSM_LOG_INFO on duplicate torus port order parsing
+
+Wed Jun 1 16:33:00 2011 -0600 Jim Schutt
+d3df5ef2b6467cdc01decbe70a0cd4c34039f865
+
+	* opensm: fail if configured torus port order references a port not available in all switches
+
+Wed Jun 1 18:40:46 2011 +0300 Alex Netes
+a8c209c7351d01f40f917a8ae2df19cc5c01fa26
+
+	* opensm: fixed port order configuration in torus routing engine
+
+Tue May 31 07:30:13 2011 -0400 Hal Rosenstock
+7359cfcfa70372b97db01e368423c88cf2801aa7
+
+	* opensm/osm_ucast_mgr.c: Fix some issues found by Coverity
+
+Tue May 31 07:30:07 2011 -0400 Hal Rosenstock
+0150ab9e099b4923ae0e06e0cf1d722b6dc0010b
+
+	* opensm/osm_ucast_ftree.c: Fix some issues found by Coverity
+
+Fri May 20 10:35:46 2011 -0400 Hal Rosenstock
+267a08f9a0072b05b55aae6987a08ab1758f5908
+
+	* opensm/osm_pkey_mgr.c: Fix cast
+
+Mon Apr 11 15:39:43 2011 -0400 Hal Rosenstock
+bfefac3f0a627c1bab99a3f43908104de3a6d5c6
+
+	* opensm/osm_pkey_mgr.c: Handle osm_pkey_tbl_new_block_get returning NULL
+
+Fri May 20 14:09:04 2011 -0400 Hal Rosenstock
+a9fc120718cf44d160d9b2ea5698f3d7fe701169
+
+	* opensm/osm_pkey_mgr.c: Pack switch peer port PKey tables
+
+Sun May 15 09:47:31 2011 +0300 Eli Dorfman
+2c5148408d562d86e1dd5d90939a58533ddebbe6
+
+	* opensm/osm_pkey_mgr: clean partition enforcement on inter-switch links
+
+Mon May 2 18:41:31 2011 +0300 David McMillen
+1c2a298b295eba7e24205519abc24e47106d15df
+
+	* OpenSM torus routing order list
+
+Thu Apr 28 10:31:01 2011 -0700 Hefty, Sean
+b92d21f040805b91ee6691e0b0e3f1dec37d4a67
+
+	* opensm: Create all directories in database path on Windows
+
+Wed Apr 20 10:32:05 2011 -0400 Hal Rosenstock
+bbfa9e03f3eb17f22a0e8b797af5b8e5d415b83f
+
+	* opensm: Prepare for alias GUID support
+
+Mon Apr 11 11:00:17 2011 -0400 Hal Rosenstock
+e1ffb57b5a309b15b0ed52ae6ec8b91647c90bd9
+
+	* opensm/osm_port: Add infrastructure for alias GUID support
+
+Mon Apr 18 09:29:57 2011 -0400 Hal Rosenstock
+0c496d0accfe7ac1d584d98da729e1fdc2ae7b23
+
+	* opensm/osm_perfmgr.c: Don't rely on PortInfo:PortState for base SP0
+
+Mon Apr 18 09:29:48 2011 -0400 Hal Rosenstock
+7f4a76535b6abc4acba910defe4d9ac13ddc6ac4
+
+	* opensm/osm_state_mgr.c: Don't rely on PortInfo:PortState for base SP0
+
+Tue Apr 26 17:35:38 2011 -0700 Ira Weiny
+cdad6e34375306986a64a5a886e796c8e24d3380
+
+	* opensm: ib_types.h add defines for PM CPI SamplesOnlySupported and PortCountersXmitWaitSupported
+
+Tue Apr 19 10:26:41 2011 -0400 Hal Rosenstock
+83b67527d161e695d67c68826f1d4b26fdd683dd
+
+	* opensm/osm_subnet.c: In osm_subn_destroy, delete service records
+
+Tue Apr 19 15:05:12 2011 -0400 Hal Rosenstock
+12f772d10c4ff42a4fc0cd1a6254f364064948e4
+
+	* opensm: Fix some OSM_SIGNAL and OSM_SM_SIGNAL numbering
+
+Tue Apr 19 10:27:52 2011 -0400 Hal Rosenstock
+c29c4f1a33f676fc553b2e301310023a95fdfbe9
+
+	* opensm/osm_sa_service_record.c: Fix minor memory leak
+
+Tue Apr 19 10:27:39 2011 -0400 Hal Rosenstock
+adc616159845617439b4c45eec64d0ea55c0cf35
+
+	* opensm/osm_sa_service_record.c: Remove useless if
+
+Fri Apr 15 15:19:22 2011 -0700 Ira Weiny
+f936f8b74a463737a3ddc32ec13107cc27e678f0
+
+	* opensm: fix strtoull error handling
+
+Tue Mar 22 17:36:16 2011 -0700 Albert L. Chu
+7bf74822cd2a0188c9a7135a7a2dfc7ea3fc9494
+
+	* fix segfault corner case w/ updn routing and LMC > 0
+
+Wed Apr 13 10:52:00 2011 +0300 Alex Netes
+0292ae223b9c4e45eb702a0d9fbc70bef8b37539
+
+	* opensm: fixed segfault when enable qos on fabric with no switches
+
+Thu Apr 7 15:02:53 2011 -0400 Hal Rosenstock
+619fa64c0fb683be3b25a697e009d116ff1da892
+
+	* osmtest/osmt_multicast.c: Fixed another insufficient component case
+
+Mon Apr 4 14:45:52 2011 -0400 Hal Rosenstock
+1618803da072cad3bb9c9f809f399ec6e88f2f5e
+
+	* opensm/osm_sa.c: Fix commentary typo
+
+Tue Apr 5 14:05:05 2011 -0400 Hal Rosenstock
+aebd9f9d9cdd1c60c2b3784c0c03cfe8f4014019
+
+	* opensm/osm_pkey_mgr.c: In pkey_mgr_update_peer_port, better last block handling
+
+Tue Apr 5 14:05:17 2011 -0400 Hal Rosenstock
+ffdcdec8a6557088b23e273c5d605465501d2d24
+
+	* osmtest/osmt_multicast.c: In osmt_run_mcast_flow, handle invalid status better
+
+Tue Apr 5 14:04:59 2011 -0400 Hal Rosenstock
+4656d0e106d892dade0760b8a942bd921f7619c7
+
+	* opensm/osm_pkey_mgr.c: In pkey_mgr_update_peer_port, initialize p_peer_pkey_tbl later in flow
+
+Thu Apr 7 10:49:52 2011 -0400 Hal Rosenstock
+f91441c1b32e7896741c31efe4ae097a70fe859c
+
+	* opensm/libvendor/osm_vendor_mlx_sa.c: Sync with osm_vendor_ibumad_sa.c
+
+Tue Apr 5 14:24:24 2011 -0400 Hal Rosenstock
+2f011c8f92dca815a1d8b51ee43960750420c973
+
+	* opensm/osm_helper: Add osm_dump_guid_info
+
+Tue Apr 5 18:56:01 2011 +0300 Hal Rosenstock
+a4144c5314911b5aa5e36c1b07291a4a3bb1b919
+
+	* osmtest/osmt_multicast.c: In some multicast flows, insufficient comps is warning
+
+Tue Apr 5 18:56:01 2011 +0300 Hal Rosenstock
+de5264380e41016d7bcfddbf08d9f2e5593d9711
+
+	* opensm/osm_pkey_mgr.c: Change log message to reflect used rather than max blocks
+
+Tue Apr 5 18:56:01 2011 +0300 Hal Rosenstock
+c98fec917342cb960b8458885edc85505da079ce
+
+	* opensm/osm_subnet.c: Fix description of max_msg_fifo_timeout
+
+Tue Apr 5 18:56:01 2011 +0300 Hal Rosenstock
+0a3839fc04d5d78f8a7ba162766eebb13f806419
+
+	* osmtest/osmtest.c: Fix trap flow not implemented log message
+
+Tue Apr 5 18:56:01 2011 +0300 Hal Rosenstock
+0fc8124c6cffbd70b1feae6893791ac91430a876
+
+	* opensm: Add OSM_VENDOR_ID_OPENIB support
+
+Tue Apr 5 18:56:01 2011 +0300 Hal Rosenstock
+c0d8b56a4531b76efa915e40cd0b1669f158cbc3
+
+	* opensm/osm_sa_node_record.c: In nr_rcv_create_nr, only set some variables when needed
+
+Tue Apr 5 18:56:01 2011 +0300 Hal Rosenstock
+9acaba0d8350c479e9f12aeabd92df6c221938da
+
+	* opensm/osm_helper.c: Add some missing fields to osm_dump_portinfo_record
+
+Tue Apr 5 18:56:01 2011 +0300 Hal Rosenstock
+67949b9ca6d6c49bc49bb9f4c850a3dedacdeb7d
+
+	* opensm: Cosmetic changes
+
+Tue Apr 5 18:56:01 2011 +0300 Hal Rosenstock
+3c4932159524c53c174857e35118fdaf7d2c2906
+
+	* opensm/osm_sa_service_record.c: Cosmetic changes
+
+Mon Apr 4 14:45:44 2011 -0400 Hal Rosenstock
+f08479a87fe96482791114ef4ab613b86dcdde24
+
+	* opensm/osm_base.h: Fix a commentary typo
+
+Mon Apr 4 13:37:54 2011 +0300 Hal Rosenstock
+ae966f64fe9fa0e638480f9819ec65b0cbe2dfcc
+
+	* osmtest/osmt_multicast.c: Fix some typos
+
+Mon Apr 4 13:35:42 2011 +0300 Hal Rosenstock
+8a3b5b9bea58f6c08cd3cc40ec40e3e09bf07e42
+
+	* osmtest/osmt_multicast.c: Fixed some error codes in OSM_LOG messages
+
+Mon Apr 4 13:34:13 2011 +0300 Hal Rosenstock
+c90953d4ac308c6a80fafed250055737d54e7232
+
+	* osmtest/osmt_multicast.c: Fixed a couple of typos in OSM_LOG messages
+
+Mon Apr 4 13:32:36 2011 +0300 Hal Rosenstock
+570715833b23f5343c06b43843ae5bf2f3dfe72a
+
+	* opensm/osm_prtn.c: Cosmetic formatting change
+
+Mon Apr 4 13:31:42 2011 +0300 Hal Rosenstock
+e1b625e6c83c6c52eebe13bea77cd42c3e41a8b5
+
+	* opensm/osm_pkey.c: Cosmetic formatting change
+
+Mon Apr 4 13:30:52 2011 +0300 Hal Rosenstock
+f7f1ead1b4e9bba741a0d1312513839504cab1e3
+
+	* opensm/osm_sa_mcmember_record.c: Fix handling of invalid PKey
+
+Mon Apr 4 13:19:30 2011 +0300 Hal Rosenstock
+0404e9edceb78c029ddb1e54881d1ef776b812ad
+
+	* opensm/osm_sa_mcmember_record.c: Changed status in a couple of SA responses
+
+Mon Apr 4 13:15:22 2011 +0300 Hal Rosenstock
+9d2bf0462397c47be672f96eeac5ebe512fbffef
+
+	* opensm/osm_pkey.c: Minor change to comment
+
+Mon Apr 4 13:12:34 2011 +0300 Hal Rosenstock
+fb630f6bf6667b2452f08eee1281855128575e5d
+
+	* opensm/include/opensm/osm_mcm_port.h: Cosmetic formatting changes
+
+Mon Apr 4 12:32:03 2011 +0300 Hal Rosenstock
+62fb69dd222089f0b378d66081bede5286beb611
+
+	* opensm/osm_pkey_mgr.c: Move clearing of empty_block after any "early" returns
+
+Fri Apr 1 18:37:18 2011 +0000 Hal Rosenstock
+65d3e4f2853dd1d0766e74e30eb2d833cd248d48
+
+	* opensm/osm_pkey_mgr.c: Fix commentary typo
+
+Tue Mar 29 10:46:49 2011 +0200 Eli Dorfman
+8a43aeab9027e5f32c45d196c61bdd41e4b281db
+
+	* Allow comma in plugin names parsing
+
+Wed Mar 9 16:28:23 2011 -0800 Ira Weiny
+34d61cce6244046f0f616402351119169847957d
+
+	* opensm/perfmgr: fix overflow processing
+
+Sun Mar 27 11:15:27 2011 +0200 Alex Netes
+c850d39c2a40ac3c03a199af6b0fe326b704b95b
+
+	* opensm/osm_opensm.c: Conditionalize sa_db_file_dump on sa_db_dump option
+
+Sun Mar 27 14:04:15 2011 +0200 Alex Netes
+cdf227c224a42dadcbc8114767562b6546dc9028
+
+	* opensm: Proper mfttop initialization when starting/restarting
+
+Mon Mar 7 12:05:04 2011 +0000 Alex Netes
+77d79b4069118ac844cc79e244a029f8f9c9cfdd
+
+	* opensm: fixed potential null variable dereferencing in libvendor
+
+Mon Mar 7 10:03:59 2011 +0000 Alex Netes
+350c6e49fe3ee492b397346633dee76d3cad9ade
+
+	* opensm: fixed potential memory leak in osm_ucast_ftree()
+
+Mon Mar 7 09:57:39 2011 +0000 Alex Netes
+e2068722c9d115979964552fecb120bf94a74567
+
+	* opensm: Fixed debug message in osm_vendor_send()
+
+Mon Mar 7 11:24:23 2011 +0000 Alex Netes
+1b3e93e3f5f27ea700027d34bca15d37cfc128db
+
+	* opensm: fixed sizeof of pointer allocation in osm_ucast_lash()
+
+Mon Mar 7 15:25:32 2011 +0000 Yevgeny Kliteynik
+2f56d1e2f6fc0737d5dd1e25017cc3197686c15d
+
+	* pensm/osm_qos_parser: QOS parser doesn't work after syntax error
+
+Mon Mar 7 15:35:01 2011 +0000 Alex Netes
+7f1970b1d030ac4e3544b053eff8851c0cc9b054
+
+	* opensm: removed unnecessary checks in main()
+
+Mon Mar 21 15:47:35 2011 +0200 Alex Netes
+f369aaf9cbd04e999f9c6c725fc5805b624f56f7
+
+	* Ignore command line option -timeout 0
+
+Mon Mar 7 09:58:37 2011 +0200 Alex Netes
+89c98f60eec9d8a5420c261a27a9390d629cec8b
+
+	* opensm: packages versions update
+
+Mon Mar 7 09:57:38 2011 +0200 Alex Netes
+9ca052eae7221dc5bb833e7162de7b4371805b63
+
+	* opensm_release_notes-3.3: update
+
+Mon Feb 14 16:15:32 2011 +0200 Alex Netes
+358cea271541652d5d2e9913a7ce5509bb107afb
+
+	* opensm: packages versions update
+
+Mon Feb 14 16:14:12 2011 +0200 Alex Netes
+f12289893ce7c14c7b793b3a9c6e52cd4f60da87
+
+	* opensm: update shared library versions
+
+Mon Feb 14 16:12:07 2011 +0200 Alex Netes
+1bd83ed4bdfe39679dd85da3436223669669b325
+
+	* opensm_release_notes-3.3: update
+
+Thu Jan 6 18:39:05 2011 +0200 Eli Dorfman (Voltaire)
+15989afbfbe55b2785acebf29a3db536d4910fec
+
+	* configure multicast only once during sweep
+
+Tue Mar 1 17:29:41 2011 -0700 Jason Gunthorpe
+f0b915afb1b69868a15eb2010c7c0db150c008fd
+
+	* Fix SANodeRecord.nodeInfo.localPortNum
+
+Thu Jun 17 18:16:29 2010 +0000 Hal Rosenstock
+c126ef166e2fddca71d5a28bfae3196cd4df5ecb
+
+	* opensm/osm_console.c: Add dump and clear redir perfmgr command support
+
+Thu Jun 17 17:28:49 2010 +0000 Hal Rosenstock
+bff2d70d8d3e67738618fb1ee4f9aa2570613299
+
+	* opensm/PerfMgr: Better redirection support
+
+Wed Sep 1 21:47:02 2010 +0000 Hal Rosenstock
+fb4394e5fd88a29cc2d29d44d4e09c1c01f02d86
+
+	* osmtest/SA client: Only set attribute offset for RMPP operations
+
+Fri Mar 4 14:08:47 2011 +0200 Alex Netes
+333265865d3929da33a37a75cd23ad42f06e25fe
+
+	* opensm: fixed memory leak in multicast spanning tree calculation
+
+Mon Feb 28 18:27:08 2011 +0200 Alex Netes
+e4525b15f7b8c721a2e8bde57db2891c004a18b7
+
+	* opensm: fixed indentation and decreased verbosity of RMPP length message
+
+Fri Feb 11 15:12:06 2011 -0700 Jason Gunthorpe
+827a386019ea64f6f47608573469788cafc19f0c
+
+	* Decode the SAPKeyTableRecord block number properly, and don't segv
+
+Mon Feb 14 15:25:36 2011 -0800 Ira Weiny
+10ac4c1bf127b13e38e17db49d28a4a4a94ac831
+
+	* Fix compile warning introduced by patch "fixed getline pointer allocation free in osm_console_io"
+
+Wed Feb 2 18:43:43 2011 +0200 Hal Rosenstock
+d69a82c2109a0d791a40d872c41ed721b84f6157
+
+	* opensm: Add support for SwitchInfo:MulticastFDBTop
+
+Thu Feb 10 12:53:50 2011 -0700 Hal Rosenstock
+7b52bed05b721b84a2c5e33d3b6e89bde7b71e31
+
+	* opensm.spec.in: Add in man5 for torus-2QoS.conf
+
+Thu Feb 3 13:53:55 2011 +0200 Alex Netes
+bf23d7c172dc6e70fca8fb6f5ca4b1319c28e9e4
+
+	* opensm: fixed getline pointer allocation free in osm_console_io
+
+Thu Feb 3 18:21:48 2011 +0200 Alex Netes
+54b1583138c3318bdb1a1715ca4a3dab476c0608
+
+	* Makefile: ChangeLog and version generation script path fix
+
+Tue Jan 25 17:09:04 2011 -0800 Ira Weiny
+74867c78845b138364cecf58a024e4d7f54818ee
+
+	* Add node/port/qos information to some error messages
+
+Thu Sep 9 14:12:21 2010 -0700 Stan C. Smith
+9978b464537c9fe5f2cdab969b94fc6fa9e09e5f
+
+	* replace (long*)(long) casting with transportable data type (uintptr_t)
+
+Mon Dec 6 15:55:11 2010 -0800 Stan C. Smith
+31a617d46be4140fe4d70f1a23021feea6aa6fca
+
+	* replace (long*)(long) casting with transportable data type (uintptr_t)
+
+Tue Sep 7 18:18:41 2010 +0300 Yevgeny Kliteynik
+8da7521cc65d48b274cc0ca6624ece16b420522c
+
+	* opensm/st.c: fix potential core dumps
+
+Tue Sep 7 22:30:09 2010 +0300 Yevgeny Kliteynik
+6a309119556d39d841cb0beafd6a17ad00c5f5f2
+
+	* opensm/osm_console.c: fix memory and file descriptor leaks
+
+Tue Sep 7 18:17:54 2010 +0300 Yevgeny Kliteynik
+696f12c3bbd2a64fb0dd32ca26bc1c44e1aea526
+
+	* opensm/osm_qos_parser_y.y: fixing bunch of memory leaks on invalid values
+
+Tue Sep 7 18:16:44 2010 +0300 Yevgeny Kliteynik
+3a7b97c119e86541e33f94315f793f7ee0679e82
+
+	* opensm/osm_ucast_file.c: closing file descriptor in error path
+
+Tue Sep 7 18:15:58 2010 +0300 Yevgeny Kliteynik
+b4575c5fc9b42eab31980eaa34e51ce675511011
+
+	* opensm/osm_pkey_mgr.c: fixing small memory leak
+
+Tue Sep 7 18:15:09 2010 +0300 Yevgeny Kliteynik
+dc0695f08a8f24f9729830e1963a9b177475502b
+
+	* opensm/osm_ucast_lash.c: small bug in calculating allocated size
+
+Tue Sep 7 18:11:55 2010 +0300 Yevgeny Kliteynik
+3c9604b39ea05c1ae5d44bf309116955b989bf03
+
+	* opensm/osm_ucast_ftree.c: fixing another memory leak at error path
+
+Tue Sep 7 18:11:01 2010 +0300 Yevgeny Kliteynik
+4460990f70601df548742719ee002aeb0d443434
+
+	* opensm/osm_ucast_ftree.c: fix small memory leak in error path
+
+Tue Sep 7 17:53:03 2010 +0300 Yevgeny Kliteynik
+857cd6c7a38e0d87cfc3872608c2311c65d5a8d8
+
+	* opensm/osm_trap_rcv.c: fix possible core dump
+
+Thu Jun 17 11:38:45 2010 -0400 Hal Rosenstock
+b74bef560a657797e7ad685687715516bebe5bec
+
+	* opensm/osm_trap_rcv.c: No need to check for sweep for trap 145
+
+Mon Sep 27 09:32:14 2010 -0400 Hal Rosenstock
+81dade3aeb1d5c80472a4f9fef55e9916bb38d3a
+
+	* opensm/osm_ucast_ftree: When roots are not connected, update hop count but not lft
+
+Mon Sep 27 09:40:40 2010 -0400 Hal Rosenstock
+acf2337d4fe9fd159429e16884dacb4bb49c0892
+
+	* osmtest/osmt_service.c: In osmt_run_service_records_flow, add missing status
+
+Mon Sep 27 09:46:40 2010 -0400 Hal Rosenstock
+0149b13f312843ba4225d8712b8b6b9891d505d8
+
+	* opensm: Fix some typos
+
+Fri Nov 12 15:11:22 2010 -0700 Jim Schutt
+8c50364e6b69bea9f7e86c50a46ae0ce7bb182e5
+
+	* opensm/doc/current-routing.txt: Sync torus-2QoS information with new man pages.
+
+Fri Nov 12 15:11:21 2010 -0700 Jim Schutt
+0b025100679c0824acdcabf1b97fd10846facffb
+
+	* opensm: Add torus-2QoS man pages.
+
+Fri Nov 12 15:11:20 2010 -0700 Jim Schutt
+2d1bae04b94ae278acfa55ac1c53e3c2ef7518d4
+
+	* opensm/man/opensm.8.in: Add references to torus-2QoS.
+
+Fri Nov 12 15:11:19 2010 -0700 Jim Schutt
+c18adbcecc485bb9299b94a2c8d4f30f9c2bd39b
+
+	* opensm/main.c: Add description of "no_fallback" to "--routing_engine" option documentation.
+
+Fri Nov 12 15:11:18 2010 -0700 Jim Schutt
+cdd1efe6f3ac8e78a1fd1a0f4e8138ee42cb91f6
+
+	* opensm/osm_subnet.c: Add torus-2QoS config file option to those configurable via opensm config file.
+
+Fri Nov 12 15:11:17 2010 -0700 Jim Schutt
+f4b076701d304032b271e16da0e2d6c32f1639ad
+
+	* opensm/osm_torus.c: Ignore multiple configurations of torus size.
+
+Fri Nov 12 15:11:16 2010 -0700 Jim Schutt
+eb8811bc666eddbde7c77156329de53ce6afca6c
+
+	* opensm/osm_torus.c: Use PRIx64 for GUID printing.
+
+Fri Nov 12 15:11:15 2010 -0700 Jim Schutt
+765a02d98c7f1314af897e77011e4c54d14b0503
+
+	* opensm/osm_torus.c: Also parse DOS line endings in torus-2QoS.conf.
+
+Fri Nov 12 15:11:14 2010 -0700 Jim Schutt
+0270d56d99f05fab5f1ae3288ca02aae16cb0f6d
+
+	* opensm: Cause torus-2QoS to warn if QoS configuration will cause issues.
+
+Fri Nov 12 15:11:13 2010 -0700 Jim Schutt
+cd9345e69595c96af95afb67a171dda10dc97342
+
+	* opensm: Fill in default QoS values at last possible moment.
+
+Fri Nov 12 15:11:12 2010 -0700 Jim Schutt
+7a142a0183762f3da44a47af29fd73ea95f5e26d
+
+	* opensm/osm_ucast_mgr.c: ensure osm_ucast_mgr_process() returns failure when no routing engine runs.
+
+Fri Nov 12 15:11:11 2010 -0700 Jim Schutt
+2fe3eb8ca1f6920544b583139d42274ea091c77a
+
+	* opensm: torus-2QoS requires that QoS be enabled.
+
+Fri Nov 12 15:11:10 2010 -0700 Jim Schutt
+6bfca67baf3cfd39244ea29ca587ff60441e9c62
+
+	* Revert "opensm: Do not require -Q option for torus-2QoS routing engine."
+
+Fri Sep 17 11:03:14 2010 -0600 Jim Schutt
+d0b8c590d18929260d6c9783fb6c3f81ad8b0bd5
+
+	* opensm/osm_torus.c: Handle calloc() failure on routing engine context creation.
+
+Fri Sep 17 11:03:13 2010 -0600 Jim Schutt
+d2f55b87516fc32170c83f965f16c4e2541e2c24
+
+	* opensm/osm_torus.c: Add check for invalid topology discovery due to user misconfiguration.
+
+Thu Feb 4 19:43:18 2010 +0200 Eli Dorfman (Voltaire)
+593547e891cb538c22ca4f38cadac862c3429c92
+
+	* Wrong handling of MC create and delete traps
+
+Mon Oct 4 09:16:44 2010 -0400 Hal Rosenstock
+6db7f4ab45828b24d999ff02889e648418d3965d
+
+	* opensm/osm_state_mgr.c: Don't signal DISCOVER to SM state machine when already DISCOVERING
+
+Thu Oct 7 16:33:01 2010 -0600 Jason Gunthorpe
+28693c58e359d4d27388dc1fcac66102994974d4
+
+	* Fix autotools to include the necessary M4 files
+
+Mon Oct 11 13:04:22 2010 +0200 Yevgeny Kliteynik
+c1c87305f8a089286ba65ea0aa0df60b47c88295
+
+	* osm_vl15intf.c: fixing use-after-free coredump
+
+Sun Sep 12 11:56:55 2010 +0200 Yevgeny Kliteynik
+3353f9b9db76bab15b13ba73f9d18cd53d8e432b
+
+	* opensm/osm_helper.c: use ARR_SIZE macro instead of hardcoded values
+
+Tue Sep 7 18:07:13 2010 +0300 Yevgeny Kliteynik
+2da9849b018245243d3d007b3e18e5a53ce531b5
+
+	* osmtest/osmt_slvl_vl_arb.c: handling fopen() failure
+
+Thu Sep 9 17:45:12 2010 +0300 Sasha Khapyorsky
+f48d5eaf80fef1bcf695c2839e9da2e32f8b2552
+
+	* opensm/osm_db_files.c: malloc() return value run-time check
+
+Tue Sep 7 18:05:36 2010 +0300 Yevgeny Kliteynik
+ea3ef8217d75f002c9b1e17f1a2ee19cc3047d8c
+
+	* opensm/osm_db_files.c: fix small memory leak
+
+Tue Sep 7 18:04:38 2010 +0300 Yevgeny Kliteynik
+f4a5174aa7b8a461e80fa2d626b72fad69b4c108
+
+	* opensm/osm_subnet.c: fixing small bug in error path
+
+Tue Sep 7 18:00:30 2010 +0300 Yevgeny Kliteynik
+c18ef238811776dc796ceb61d43aa67b98608ac0
+
+	* opensm/osm_mesh.c: fixing a bug in compare_switches()
+
+Tue Sep 7 18:03:52 2010 +0300 Yevgeny Kliteynik
+4da9aa67fe3dc5bc9be3ce6c0303e75fbf43a8fa
+
+	* opensm/osm_helper.c: cosmetics - move define closer to the relevant code
+
+Tue Sep 7 18:02:49 2010 +0300 Yevgeny Kliteynik
+83b74cd30f70df95f5a80231ce060138db039702
+
+	* opensm/osm_helper.c: fix potential overrun of the array
+
+Tue Sep 7 18:01:42 2010 +0300 Yevgeny Kliteynik
+85c0ac9377d0acf881a9191ce2da7c758f148138
+
+	* osmtest/osmtest.c: handle timeouts in PR stress test
+
+Wed Sep 8 00:03:29 2010 +0300 Sasha Khapyorsky
+ebb2c841aedf4623c83d724e1185bc0662f46135
+
+	* opensm/osm_node_info_rcv.c: move p_physp declaration under code block
+
+Tue Sep 7 17:58:53 2010 +0300 Yevgeny Kliteynik
+5c88113d51484076b0794f5aa9442ff8fc2e4f24
+
+	* opensm/osm_node_info_rcv.c: remove useless code line
+
+Tue Sep 7 17:59:34 2010 +0300 Yevgeny Kliteynik
+866d939da2ffd174b2db2399767d47ede7ae60e2
+
+	* opensm/osm_sa_vlarb_record.c: removed unused variable
+
+Tue Sep 7 17:57:35 2010 +0300 Yevgeny Kliteynik
+15a8770babfad831ec25898218cf1c5f35ad4b5c
+
+	* opensm/osm_sa_pkey_record.c: removing unused variable
+
+Tue Sep 7 17:55:42 2010 +0300 Yevgeny Kliteynik
+8f002b7fe00fa992497b9733086885afbd955249
+
+	* opensm/osm_pkey.c: removing unused function
+
+Tue Sep 7 17:56:35 2010 +0300 Yevgeny Kliteynik
+9c0fa2fc4ec8dc712e2c1f870969d1cc9b7b01b2
+
+	* opensm/osm_sminfo_rcv.c: removing unused variable
+
+Tue Sep 7 17:53:54 2010 +0300 Yevgeny Kliteynik
+d3f060aafc68a463afd1e92f42a624a8257f0848
+
+	* opensm/osm_mtree.c: removing useless 'if' statement
+
+Tue Sep 7 22:34:52 2010 +0300 Yevgeny Kliteynik
+bbef64a79758199dd5d1e217e268f6b9453855bb
+
+	* libvendor/osm_vendor_mlx_sa.c: remove useless "if" statement
+
+Tue Sep 7 18:13:52 2010 +0300 Yevgeny Kliteynik
+2da02b58af7bdf183bd1467ac38c75b06a76d4f5
+
+	* libvendor/osm_vendor_ibumad_sa.c: remove useless "if" statement
+
+Tue Sep 7 21:17:47 2010 +0300 Sasha Khapyorsky
+435dde076959c57169dbb95b4ffa597d1b44a6f2
+
+	* opensm/sa: simplify osm_mcmr_rcv_find_or_create_new_mgrp() function call
+
+Tue Sep 7 17:50:33 2010 +0300 Yevgeny Kliteynik
+4c822b0379ac42441fa67e98733534f9ebc891e3
+
+	* opensm/osm_prtn.c: removing TopSpin hack
+
+Sun Sep 5 18:24:54 2010 +0300 Yevgeny Kliteynik
+e7a872d22e61514cf4e7c66bbd41d9cda2ded351
+
+	* opensm/osm_qos_policy.c: change a log message
+
+Fri Sep 3 10:43:14 2010 -0600 Jim Schutt
+ffbe7d0cd173b6b6e4ae9fbf623a773f92fd1c52
+
+	* opensm: Cause status of unicast routing attempt to propogate to callers of osm_ucast_mgr_process().
+
+Fri Sep 3 10:43:13 2010 -0600 Jim Schutt
+125f35c12a156e4504408607e6edd72bdb0450ca
+
+	* opensm: Avoid havoc in dump_ucast_routes() caused by torus-2QoS persistent use of osm_port_t:priv.
+
+Fri Sep 3 10:43:12 2010 -0600 Jim Schutt
+9ddcf3419eade13bdc0a54f93930c49fe67efd63
+
+	* opensm: Avoid havoc in minhop caused by torus-2QoS persistent use of osm_port_t:priv.
+
+Fri Sep 3 10:43:11 2010 -0600 Jim Schutt
+b74faf2b352b0ee5bbf10f12ee07378505c01d0f
+
+	* opensm: Make it possible to configure no fallback routing engine.
+
+Fri Sep 3 10:43:10 2010 -0600 Jim Schutt
+5a60f394b16b5354ed3b40c8d815dfa352e1044a
+
+	* opensm: Do not require -Q option for torus-2QoS routing engine.
+
+Fri Sep 3 10:43:09 2010 -0600 Jim Schutt
+fedc08c87996487af211ace2898f018d005d4ca0
+
+	* opensm: Add opensm option to specify file name for extra torus-2QoS configuration information.
+
+Fri Sep 3 10:43:08 2010 -0600 Jim Schutt
+3da7219bbe48f9d3a1c436a4522a869164d700c3
+
+	* opensm: Enable torus-2QoS routing engine.
+
+Fri Sep 3 10:43:07 2010 -0600 Jim Schutt
+398f9865914f299bd968d72b9bac35bde75827c2
+
+	* opensm: Update documentation to describe torus-2QoS.
+
+Fri Sep 3 10:43:06 2010 -0600 Jim Schutt
+126736cbef8a5704d21c873c8f792dfbdbae57a2
+
+	* opensm: Add torus-2QoS routing engine, part 4.
+
+Fri Sep 3 10:43:05 2010 -0600 Jim Schutt
+ced8f8b4f99e562d8991bf0befdccc51ba78261c
+
+	* opensm: Add torus-2QoS routing engine, part 3.
+
+Fri Sep 3 10:43:04 2010 -0600 Jim Schutt
+6f3f5b4a532815a6ee5c1b7e7808fefc96a0008b
+
+	* opensm: Add torus-2QoS routing engine, part 2.
+
+Fri Sep 3 10:43:03 2010 -0600 Jim Schutt
+3b8b1534fab2a47a4333052ee7b8208098a10892
+
+	* opensm: Add torus-2QoS routing engine, part 1.
+
+Fri Sep 3 10:43:02 2010 -0600 Jim Schutt
+673877add5e92bc24c037d2a8a090175822472b9
+
+	* opensm: Make mcast_mgr_purge_tree() available outside osm_mcast_mgr.c.
+
+Fri Sep 3 10:43:01 2010 -0600 Jim Schutt
+2b5ee5459cc1fc8f6e5567cdeba52e74336b6b0c
+
+	* opensm: Add struct osm_routing_engine callback to build spanning trees for multicast.
+
+Fri Sep 3 10:43:00 2010 -0600 Jim Schutt
+b1356875542f14b71ca1afb7642b5c888e565fc2
+
+	* opensm: Track the minimum value in the fabric of data VLs supported.
+
+Fri Sep 3 10:42:59 2010 -0600 Jim Schutt
+d9d42dc0c8c27a971ab2adcfcdef5f6386301a87
+
+	* opensm: Allow the routing engine to participate in path SL calculations.
+
+Fri Sep 3 10:42:58 2010 -0600 Jim Schutt
+1104942fb0f538772db9fa64c3566f8dbaff041d
+
+	* opensm: Allow the routing engine to influence SL2VL calculations.
+
+Fri Sep 3 10:42:57 2010 -0600 Jim Schutt
+d7988c876fa11404e9a9349ef5b53c9842eb8422
+
+	* opensm: Prepare for routing engine input to path record SL lookup and SL2VL map setup.
+
+** Version: opensm-3.3.7
+
+Sat Sep 4 14:15:33 2010 +0300 Sasha Khapyorsky
+c9cd580b86d2ac2f5ea046dc9a02dd4a9c68bf07
+
+	* management: packages versions update
+
+Sat Sep 4 14:13:06 2010 +0300 Sasha Khapyorsky
+fec98892afe5fcb63276d4c4aea3b89cbd897e4f
+
+	* management: update shared library versions
+
+Sat Sep 4 13:32:37 2010 +0300 Sasha Khapyorsky
+8f47ad7414d2af60424e1c88c2392c80b0336f22
+
+	* opensm_release_notes-3.3: update
+
+Tue Aug 31 14:21:33 2010 -0400 Hal Rosenstock
+9ef1fc893f3b2c1c5327264119b4f9c1cbfb65d6
+
+	* opensm/osm_pkey_mgr.c: Eliminate unneeded parameter from pkey_mgr_get_physp_max_blocks API
+
+Tue Aug 31 14:20:42 2010 -0400 Hal Rosenstock
+b4843c6f851ecee37d425c94feaaf177b0b99029
+
+	* opensm/include/osm_helper.h: Eliminate some duplicate declarations
+
+Sun Aug 1 12:36:20 2010 +0300 Eli Dorfman (Voltaire)
+0dbe5ca6cd715d840c6deb34d5ba9f36a9aec9f5
+
+	* opensm: Fix sl2vl configuration
+
+Wed Aug 18 16:38:14 2010 +0300 Yevgeny Kliteynik
+cead6a579e77d1aca425f622c4d73d556929e290
+
+	* opensm/osm_opensm.c: no report when SM is exiting
+
+Wed Aug 25 19:36:54 2010 +0300 Sasha Khapyorsky
+741b9959fdaa8bbff87c6eaac11fde194f7f1d55
+
+	* complib/cl_timer: remove not needed timeval initializations
+
+Tue Aug 24 16:21:33 2010 +0300 Yevgeny Kliteynik
+f53a9d7141f7b68660b52e059fe74fee40d50d6a
+
+	* complib/cl_timer.c: fixing cl_timer calculation
+
+Fri Jul 9 10:27:05 2010 -0400 Hal Rosenstock
+dbdcf955addf946241a18d0985f960e32e36e6e7
+
+	* opensm/osm_helper.c: Add some missing message names to disp_msg_str
+
+Tue Jun 29 16:49:25 2010 +0300 Eli Dorfman (Voltaire)
+01f40c4fe5d41e29fab5699818de202c4b6af0af
+
+	* opensm/osm_lid_mgr.c: Allow switch lids to be non LMC aligned
+
+Wed Jun 30 13:00:38 2010 +0300 Yevgeny Kliteynik
+2d5ad86117c1a9501a749f3693b1da55afcd4217
+
+	* opensm/osmeventplugin: added new events to monitor SM
+
+Tue Jun 29 17:38:54 2010 +0300 Eli Dorfman (Voltaire)
+054fe32d59bfe703fef140fb82ae031d0ef0d807
+
+	* opensm: Modify OSM_LOG_SYS messages
+
+Sun Jun 20 12:31:55 2010 +0300 Eli Dorfman (Voltaire)
+0bb5645d1350999c67082a84278caf5cabc43faf
+
+	* opensm: Fix wrong messages in MC delete flow
+
+Tue Jun 22 10:13:41 2010 -0400 Hal Rosenstock
+44f6f5071116761e5c8c7019944316e0baf1a3d5
+
+	* opensm/osm_req.c: In osm_send_trap144, eliminate redundant clear of m_key in smp
+
+Mon Jan 25 15:22:48 2010 -0500 Hal Rosenstock
+c1bd7a3b19623d9a3ad059d4d01cbbccb55033f4
+
+	* opensm/osm_qos.c: Eliminate unneeded endport SL to VL setup
+
+Thu Jun 10 16:49:19 2010 +0300 Yevgeny Kliteynik
+d4a46a9a57afe483d91368a53dff0e23eaf6c349
+
+	* opensm/osm_sa_path_record.c: adding wrapper for pr_rcv_get_path_parms()
+
+Thu Jun 10 15:00:50 2010 +0300 Yevgeny Kliteynik
+582ec70de419c7af4964d8fcec74cd96dd863c5f
+
+	* opensm/main.c: force stdout to be line-buffered
+
+Mon Jun 14 08:46:46 2010 -0400 Hal Rosenstock
+9f9084b672b4df694af014048f1af0b5876a52ed
+
+	* opensm/osm_mcast_mgr.c: Only route MLIDs with more than 1 member
+
+Mon Jun 14 07:11:49 2010 -0400 Hal Rosenstock
+5bafefdc5ccc1c39d9285466654d3ae1ffc4b862
+
+	* opensm/osm_trap_rcv.c: No need for heavy sweep when just NodeDescription changes
+
+Tue Jun 15 11:33:41 2010 +0300 Yevgeny Kliteynik
+e8be8436133feffaa0c82a0bbcdfaf9aab442776
+
+	* opensm/osmtest.c: fix bug in getting attr offset
+
+Mon Jun 14 15:59:35 2010 +0300 Sasha Khapyorsky
+2b63324d440bc59610cae45e08ee9fe246986fc9
+
+	* iba/ib_types.h: remove assertion in ib_get_attr_offset()
+
+Thu Jun 10 18:01:31 2010 +0300 Eli Dorfman (Voltaire)
+82720e4e0902917827d030a4539a89997a7ab3d9
+
+	* return no path when path does not exist
+
+Wed Jun 9 14:29:11 2010 -0400 Hal Rosenstock
+7bd8e26d0e1d32f68adb031fb4df3d3d53b334ad
+
+	* opensm: Better handling of non responsive SMAs
+
+Mon Dec 22 11:03:59 2008 -0800 Ira Weiny
+42fb6dc7f050d8a86b64db655e3731dd6893f040
+
+	* opensm/osm_perfmgr.c: Remove unnecessary lock reference from Performance Manager object
+
+Wed Mar 24 17:50:10 2010 +0200 Yevgeny Kliteynik
+3d7d688a04fc994a18d8c4a44bc58dc83ab1f79f
+
+	* opensm: fixing compilation issues in some header files
+
+Tue Jun 1 08:56:52 2010 -0600 Jim Schutt
+8a1c61d58092074fa0b1609dd9e1ca23e130a8b4
+
+	* opensm/qos.c: Revert port ranges for calls to sl2vl_update_table().
+
+Mon May 24 20:58:48 2010 -0700 Stan C. Smith
+1e66124b80d0dcfd9d3a625078fc3ce6845ceaf6
+
+	* opensm - cleanup
+
+Tue May 25 08:32:46 2010 -0700 Stan C. Smith
+458e59a484dff66f37aee9e89a7cfdcb4a408126
+
+	* opensm/libvendor Reduce stack consumption
+
+Tue May 25 09:03:16 2010 -0700 Stan C. Smith
+6ec32d52bf36a97f744279ebd7bafc6df65d0f15
+
+	* opensm - address windows env issues
+
+Mon May 24 15:43:53 2010 -0400 Hal Rosenstock
+36f80f6c7718254a797c493eb92038f4556a8d55
+
+	* opensm/osm_sa_multipath_record.c: livelock in mpr_rcv_get_path_parms
+
+Mon May 24 15:42:51 2010 -0400 Hal Rosenstock
+8144ecf31c57c6c3dbe93ef54caec638bb9993cd
+
+	* opensm/osm_sa_path_record.c: Add error code to newly added log message
+
+Tue May 25 09:53:30 2010 -0700 Arthur Kepner
+6b23b71b331dd9a299ab2e9fef8b391fd2d0c109
+
+	* opensm: toggle sweeping V3
+
+Fri May 21 10:49:27 2010 -0700 Smith, Stan
+f3aaa184bec981ea6afd75330137df957c25205a
+
+	* ib_types.h add debug assert
+
+Fri May 21 10:23:26 2010 -0700 Smith, Stan
+b704f556d08cdede8a4ea523d971e0d0ca346347
+
+	* osmtest - use helper function
+
+Fri May 21 09:45:03 2010 -0700 Smith, Stan
+40d2623c0cd256b01225639051bd3845175f93f7
+
+	* opensm/complib use portable macro syntax
+
+** Version: opensm-3.3.6
+
+Sat May 22 18:00:16 2010 +0300 Sasha Khapyorsky
+19bd6f48ba95e341c36226fe9f316cb552fcd129
+
+	* management: packages versions update
+
+Sat May 22 17:52:50 2010 +0300 Sasha Khapyorsky
+b13986020b9828c40c96cbe37116f99567f4b697
+
+	* management: update shared library versions
+
+Sat May 22 16:04:10 2010 +0300 Sasha Khapyorsky
+c49f99fe3c110260243aff2c2f229c2a699b2c24
+
+	* opensm_release_notes-3.3: update
+
+Wed Apr 21 13:22:02 2010 +0200 Line Holen
+b949bdbca6eabaebb79aaa2cc886a9ad20b474ac
+
+	* opensm/osm_sa_path_record.c: Lower max number of hops allowed
+
+Mon Apr 26 13:42:10 2010 +0300 Sasha Khapyorsky
+add0fc6456e6b151f2f88a9f404ae89bbe8fdf2b
+
+	* opensm/osm_lid_mgr: revert 'coming_out_of_standby' replacement patch
+
+Mon May 17 10:22:04 2010 +0300 Yevgeny Kliteynik
+bd21679f98ff34812e714f9a9be5e630a2f006d6
+
+	* opensm/osm_log.c: add OSM_LOG_SYS to default flags
+
+Sun Apr 25 20:26:14 2010 +0300 Sasha Khapyorsky
+6c9240f6f1ddacaab964347417d72831bb4af9e7
+
+	* opensm/osm_lid_mgr: fix couple of duplicate LIDs bugs
+
+Mon Apr 26 13:42:10 2010 +0300 Sasha Khapyorsky
+9a0ed25b6226e1461e37555ae614987c28adf251
+
+	* opensm/osm_lid_mgr: use 'first_time_master_sweep' flag
+
+Sun Apr 25 16:44:17 2010 +0300 Sasha Khapyorsky
+de5df952916482e989feac59e873c4c64d3bee0b
+
+	* opensm/osm_lid_mgr.c: some cleanups
+
+Thu Sep 24 04:40:03 2009 +0300 Sasha Khapyorsky
+84e956710ad1eb9bbd2352576be61743305ed567
+
+	* opensm: conversion to osm_get_port_by_lid()
+
+Sun Apr 25 16:47:27 2010 +0300 Sasha Khapyorsky
+7864d1c74762a35dbb6f6e15ed6913808c9aae67
+
+	* opensm/osm_lid_mgr.c: fix memory leak
+
+Mon Apr 19 19:00:44 2010 +0300 Dave Olson
+4afbb61a4326ff118e90d0b512004e758d5f335e
+
+	* opensm/opensm.init.in: fix install warning on SLES11
+
+Mon Apr 19 11:15:43 2010 +0200 Line Holen
+8aa7567d467f0c79d26dd8d6b2914ed8e22f3053
+
+	* opensm/osm_sa_path_record.c: livelock in pr_rcv_get_path_parms
+
+Thu Apr 15 16:27:45 2010 +0300 Sasha Khapyorsky
+34de58d9588a175a3132aea3a17c6ab2adc655b0
+
+	* opensm/vendor: fix portguids array size
+
+Wed Apr 7 14:27:39 2010 -0500 Dale Purdy
+19dacb07d5cad8608984aa984a086f58011d45e2
+
+	* Dimension port order file support
+
+Tue Apr 13 13:40:35 2010 +0300 Yevgeny Kliteynik
+95fa2ebe1092c7abf1cc033e31fd74e6b4d69a07
+
+	* opensm/osm_subnet.c: fixing some options to not "hot-swappable"
+
+Tue Apr 13 13:43:14 2010 +0300 Yevgeny Kliteynik
+6d7233fc27e5deb7f91655b7bfdd04172dc090b0
+
+	* opensm/osm_subnet.{c,h}: passing options to the event plugins
+
+Tue Apr 13 13:39:14 2010 +0300 Yevgeny Kliteynik
+8dcd84d7184fbbae10e7acc1e980a738394662f4
+
+	* opensm/osm_subnet.h: cosmetics - fix description of event_plugin option
+
+Fri Feb 26 09:49:39 2010 +0100 Line Holen
+825e80396ade24a079a68db9a1f126f6aae65608
+
+	* opensm/osm_pkey.h: Fix typo in comment
+
+Thu Feb 4 20:12:20 2010 +0200 Eli Dorfman (Voltaire)
+8edd358f4675bae99a47aa451e5283b360b8a79f
+
+	* Delete port only after GID OUT trap was sent
+
+Mon Feb 8 21:26:50 2010 -0800 Arputham Benjamin
+163f19281a544edefaa4fc7825e541c24a40af46
+
+	* opensm: Add option to specify prefix to syslog messages
+
+Thu Feb 4 16:14:41 2010 +0200 Yevgeny Kliteynik
+fafe779c09a7c2d8905534e1a3230f33616ba8a2
+
+	* opensm/complib/cl_passivelock.h: remove unneeded casting
+
+Thu Feb 4 16:13:04 2010 +0200 Yevgeny Kliteynik
+61269fbdfecebd2cbbf833f9513b724475bb56a2
+
+	* opensm/complib/cl_types.h: convert cl_status_t to int
+
+Fri Feb 5 00:16:46 2010 +0200 Sasha Khapyorsky
+0c94b9147c0d969f5812e90edd599aacdf2e994a
+
+	* opensm/osm_mcast_mgr.c: preserve root switch calculation functionality
+
+Thu Feb 4 16:33:33 2010 +0200 Sasha Khapyorsky
+56750e16da2945319b80ea0e9628a696b68acd0e
+
+	* opensm/osm_mcast_mgr.c: code simplifications
+
+Thu Feb 4 22:25:14 2010 +0200 Sasha Khapyorsky
+e69b84098f3add3ee3220c09653d24aa21a6802b
+
+	* opensm/osm_mcast_mgr.c: fix bug in MC root switch calculation
+
+Thu Feb 4 15:27:12 2010 +0200 Sasha Khapyorsky
+1d75bcbfb72f472a50c26317b78a0812a28df4b2
+
+	* opensm/osm_mcast_mgr.c: fix some indentation errors
+
+Thu Feb 4 15:21:09 2010 +0200 Sasha Khapyorsky
+a2057aec578eac44176aecca07295ea05512ea2e
+
+	* opensm/osm_mcast_mgr.c: remove redundant casting
+
+Thu Feb 4 09:27:28 2010 -0500 Hal Rosenstock
+56f55fa9137748a76cad7ddfb6f53014be2301ee
+
+	* opensm/osm_mcast_mgr.c: Cosmetic changes
+
+Thu Dec 3 16:11:30 2009 +0200 Slava Strebkov
+588ef347609688da118867e5d2f4d2158ee6fcca
+
+	* opensm: Multicast root switch calculation
+
+Fri Jan 29 22:43:00 2010 +0200 Sasha Khapyorsky
+b89e760c404925445a0e6987e4a313c81405f30d
+
+	* opensm/osm_sa_pkey_record.c: optimize port selection logic
+
+Fri Jan 29 17:55:42 2010 +0200 Sasha Khapyorsky
+4549ab7bbc19b44b1517017fa739681d074be9b9
+
+	* opensm/osm_mcast_mgr.c: fix memory leak
+
+Tue Feb 2 15:29:26 2010 +0200 Yevgeny Kliteynik
+812d3dc50a623b2209a5b6fb87f1bde388d039a3
+
+	* opensm/complib/cl_ptr_vector.c: fix bug/compiler warning
+
+Mon Feb 1 14:46:47 2010 +0200 Yevgeny Kliteynik
+52919ae39f82e22d5cc49e87fa1758cb27e0cb79
+
+	* opensm/osm_subnet.h: remove redundant function definition
+
+Wed Jan 27 12:32:33 2010 +0200 Sasha Khapyorsky
+8ba32f3ff3d10ff95d97ddbd72e800cd0b691a7a
+
+	* opensm/osm_vl_arb_rcv.c: indentation improvement
+
+Wed Jan 27 10:45:29 2010 +0100 Line Holen
+43f6d76d728fe47f4878aca52e66c06658b4907c
+
+	* opensm/osm_vl_arb_rcv.c: fix double mutex release bug
+
+Tue Jan 26 18:10:54 2010 +0200 Yevgeny Kliteynik
+dbd50311ee173812cc765f9a4c2eaedd465f2e01
+
+	* opensm/osm_port_info_rcv.c: fix compilation warning
+
+Thu Jan 21 17:54:13 2010 +0200 Yevgeny Kliteynik
+ca22df7d1650fca4bc5de73ba1eabd6129c179d2
+
+	* opensm/osm_sa.{c,h}: osm_sa_db_file_dump() return values
+
+Mon Jan 25 08:30:23 2010 -0500 Hal Rosenstock
+2a444cdfb5771407837b46388322d886e4c5a29f
+
+	* opensm/osm_qos.c: Fix typo in OSM_LOG message
+
+Tue Jan 12 15:02:08 2010 +0200 Sasha Khapyorsky
+8121bce55fc635f71c576366b4dc9b6be7e6f00e
+
+	* opensm/osm_update_node_desc(): minor prototype improvement
+
+Wed Jan 13 17:34:13 2010 +0200 Eli Dorfman (Voltaire)
+35f44212c9e1341c58ba1fb836daac1ae74de110
+
+	* opensm: Add update_desc command to opensm console
+
+Mon Jan 4 14:15:30 2010 -0500 Hal Rosenstock
+86ad3e36fcc13cd302edc7a9d042fca6390802b6
+
+	* opensm/osm_vl_arb_rcv.c: Dump table after validating block number
+
+Mon Jan 11 10:47:47 2010 +0200 Yevgeny Kliteynik
+1c4f5ef69e804cf9c56d82d87b5798e9a043e5af
+
+	* opensm SA DB: dump only if modified
+
+Thu Jan 7 14:15:59 2010 +0200 Sasha Khapyorsky
+59e30bc75a28dcc7fb276967eb36a130b0cbbccf
+
+	* opensm/osm_sa_infrominfo.c: fixes and simplifications in lid range check
+
+Thu Jan 7 14:00:04 2010 +0200 Sasha Khapyorsky
+0bf76142a09543c8eaf9c06a12106660c5b933ee
+
+	* opensm/osm_sa_informinfo.c: minor simplifications and fixes
+
+Tue Dec 1 14:41:10 2009 -0500 Hal Rosenstock
+368ccf6ed18eab81ee1fbc0543767b4c91b2ec41
+
+	* opensm: Add support for optimized SLtoVLMappingTable programming
+
+Mon Jan 4 21:06:19 2010 +0200 Sasha Khapyorsky
+f9f908f72fab77760e22d7a504e3d926f7cfd418
+
+	* opensm/osm_qos.c: split switch external and end ports setup
+
+Mon Jan 4 18:50:28 2010 +0200 Sasha Khapyorsky
+fbad47dbb02d7b6b6ca8ce21a8b8e6f94e10e0a5
+
+	* opensm/osm_qos.c: merge SL2VL mapping capability check
+
+Tue Dec 29 15:48:14 2009 +0200 Sasha Khapyorsky
+123d874d2eed14192b279023590c10bbe52d5a54
+
+	* opensm/osm_slvl_map_rcv.c: verify port number values received from network
+
+Tue Dec 29 00:42:56 2009 +0200 Sasha Khapyorsky
+640c2fc7c1fa27da38ea40592dfb3912c6dc71c7
+
+	* opensm/osm_slvl_map_rcv.c: fix mutex double release bug
+
+Mon Dec 28 13:58:28 2009 +0200 Sasha Khapyorsky
+42781eb27aab588dfce4b12122095dd4d2274911
+
+	* opensm/osm_slvl_map_rcv.c: fix port parsing on BE machine
+
+Sun Dec 20 21:35:04 2009 +0200 Sasha Khapyorsky
+020dda70404196d3b8abbfbd3646fa10e19836d0
+
+	* osm_sa_path_record.c: cleanups
+
+Sun Dec 20 22:29:50 2009 +0200 Sasha Khapyorsky
+005982227890b1c7e74cbda4f1f1fe017b640ae4
+
+	* osm_sa_path_record.c: use PR DGID by reference
+
+Sun Dec 20 20:30:04 2009 +0200 Sasha Khapyorsky
+11059a8c27608db0e439dfe2d01b9217e11ed242
+
+	* osm_sa_path_record.c: separate mutlicast processing code
+
+Mon Dec 21 12:39:57 2009 +0200 Sasha Khapyorsky
+190fe5212a7811c72044c2a6b5dfe64f2180710a
+
+	* opensm/osm_sa_path_record.c: MGID must be specified explicitly
+
+Thu Dec 24 16:22:01 2009 +0200 Sasha Khapyorsky
+83ae138d3efaba06ac99261ea86ac3ff012a04c9
+
+	* opensm/osm_mcast_mgr.c: strip log-only variable
+
+** Version: opensm-3.3.5
+
+Thu Dec 24 15:14:41 2009 +0200 Sasha Khapyorsky
+0fa0ea350a74ed0fe090c35350a1d78959d3357e
+
+	* management: packages versions update
+
+Thu Dec 24 15:11:08 2009 +0200 Sasha Khapyorsky
+c21fe49dce61782d460ebf7f9f0c5ee5b9ef186e
+
+	* opensm: update libraries version strings
+
+Thu Dec 24 15:06:43 2009 +0200 Sasha Khapyorsky
+81ee98f58ba7b96b9e82e8a503c2f0243829d3e5
+
+	* opensm_release_notes-3.3: RN update
+
+Wed Dec 23 16:44:12 2009 +0200 Yevgeny Kliteynik
+a251743c4a3b7c4d19cf3f300b84c6aa6e1d0d0b
+
+	* opensm/osm_mcast_mgr.c: fix osm_mcast_mgr_compute_max_hops for managed switch
+
+Thu Dec 24 14:19:11 2009 +0200 Sasha Khapyorsky
+2faaf4f98d2917355912b0525db0838cc7bac357
+
+	* opensm: add Voltaire copyright notice
+
+Thu Dec 24 06:20:36 2009 -0500 Hal Rosenstock
+2a424a7e4fab93aad4781c3abad39be3015fee56
+
+	* opensm/osm_sm_mad_ctrl.c: In sm_mad_ctrl_send_err_cb, revert setting of init failure on QoS initialization failures
+
+Sun Dec 20 11:51:34 2009 +0200 Yevgeny Kliteynik
+f4459c82303bc5488e30b5e0bc9b74cdf077c968
+
+	* opensm: copyright updates
+
+Sun Dec 20 12:15:48 2009 +0200 Sasha Khapyorsky
+8ef66980591580b2903921189f4e218f0b21cffd
+
+	* opensm: cosmetic cleanup
+
+Wed Dec 16 08:57:24 2009 -0500 Hal Rosenstock
+6121265a284b19ac7b57dbc27e5e57a3b80e4f02
+
+	* opensm/osm_vendor_ibumad.c: Add transaction ID to osm_vendor_send log message
+
+Wed Dec 16 11:02:45 2009 +0200 Yevgeny Kliteynik
+c5270b4ef1b975c899a4753c8f54468e28d543e0
+
+	* opensm/osm_vl15intf.c: reverting commit 546399c3b983cdfe7adf4bd0b179358744603478
+
+Tue Dec 15 21:18:36 2009 +0200 Sasha Khapyorsky
+796ab79a2d1a28d5255d7e59f1b9a1bddb44f01c
+
+	* opensm/osm_sa_path_record.c: don't set dgid pointer for local subnet
+
+** Version: opensm-3.3.4
+
+Sun Dec 13 19:39:11 2009 +0200 Sasha Khapyorsky
+4693bba5c7845d2f7de7d5c48658da1152383a72
+
+	* management: package versions bump
+
+Sun Dec 13 19:36:19 2009 +0200 Sasha Khapyorsky
+0cbe3e7c51e14eb1eb12e8088fcbe8f1d181182d
+
+	* management: update library versions
+
+Sun Dec 13 19:22:55 2009 +0200 Sasha Khapyorsky
+665e310da04f23314ca035a4d312507e7c797865
+
+	* opensm_release_notes-3.3.txt: updates for 3.3.4 version
+
+Sun Dec 13 18:35:49 2009 +0200 Sasha Khapyorsky
+4a324ec6b11d648711da99eec28fca3a4c9993d8
+
+	* opensm/osm_vendor_ibumad.c: dump DR path at same log level as its error message
+
+Sun Dec 13 18:27:05 2009 +0200 Sasha Khapyorsky
+525faa14a3c6953cc4aff02eb3fe90dc13600717
+
+	* opensm/osm_sa.c: check for SA DB file only if requested
+
+Sun Dec 6 16:52:08 2009 +0200 Yevgeny Kliteynik
+1ff8fb0ae85aeb2a5ece22cc84867d4190176245
+
+	* opensm SA DB dump/restore: added option to dump SA DB on every sweep
+
+Sun Dec 6 16:40:40 2009 +0200 Yevgeny Kliteynik
+f1f19e9cf4958379e63a1c1b9ce4438483a97f31
+
+	* opensm SA DB dump/restore: load SA DB only once
+
+Sun Dec 6 11:19:51 2009 +0200 Yevgeny Kliteynik
+e8385c7d283a0ea7eab501cd7aad90d7a277db0a
+
+	* opensm: implement 'connect_roots' option in fat-tree routing
+
+Fri Dec 4 15:26:17 2009 +0100 Line Holen
+0a71c070359c822cf4459c32aa8a97accb8311bd
+
+	* opensm: Added print_desc to various log messages
+
+Fri Dec 4 10:41:50 2009 +0100 Line Holen
+4d26fea9404f4c61d1e347b11b06770f23738cff
+
+	* opensm/osm_vendor_ibumad.c: Move error info into single message
+
+Fri Dec 4 10:41:50 2009 +0100 Line Holen
+824e8e442c5cc8651632bbc496e7f64676750ad7
+
+	* opensm/osm_vendor_ibumad.c: Move error info into single message
+
+Wed Dec 9 10:48:20 2009 +0200 Yevgeny Kliteynik
+b587b83fad2320cea1e5edc649f28e4c45cb6079
+
+	* opensm/libvendor//osm_vendor_ibumad_sa.c: uninitialized fields
+
+Sun Dec 13 16:03:27 2009 +0200 Sasha Khapyorsky
+aa6477c5964e61e67d502d1b1c789f8c9a55e9b1
+
+	* opensm/osm_sm_mad_ctrl.c: minor optimizations
+
+Thu Dec 3 15:27:15 2009 +0100 Line Holen
+6afcbcf612ed1625cfebd6c9def2573eaca53a41
+
+	* opensm/osm_sm_mad_ctrl.c Changes to some error messages
+
+Thu Dec 3 11:12:04 2009 -0500 Hal Rosenstock
+ea5a892c9093a026f69584202d290c61bc7564da
+
+	* opensm/osm_sm_mad_ctrl.c: Add missing call to return mad to mad pool
+
+Mon Dec 7 12:26:20 2009 +0200 Yevgeny Kliteynik
+e585fca5dcf2ab32747aa12ac25608a95e37d66b
+
+	* opensm/osm_sa_mcmember_record.c: trivial optimization
+
+Mon Dec 7 12:22:55 2009 +0200 Yevgeny Kliteynik
+9563cd95cb8e09b464fbc6ccdc0674d10b44a2d1
+
+	* opensm/osm_sa_mcmember_record.c: print mcast join/create failures in VERBOSE instead of DEBUG level
+
+Tue Dec 1 11:15:48 2009 -0500 Hal Rosenstock
+ddca44b711e8238c670b9961cb79eda8a2499e97
+
+	* opensm/osm_sm_mad_ctrl.c: Make some minor simplifications
+
+Tue Dec 1 08:14:56 2009 -0500 Hal Rosenstock
+f67dd9ec56d325409a0490a2d717293113048a5e
+
+	* opensm/osm_vendor_ibumad.c: Change LID format to decimal in log message
+
+Mon Nov 30 16:45:23 2009 +0200 Yevgeny Kliteynik
+da24f8ed75d0e3a5ac90c40a2d3b09251281de54
+
+	* opensm/osm_vendor_mlx: fix compilation error
+
+Mon Nov 30 16:41:51 2009 +0200 Yevgeny Kliteynik
+760e225600e2b0097e22de3a203973cd28a45bfb
+
+	* opensm/osm_vendor_mlx_txn.c: eliminate bunch of compilation warnings
+
+Fri Nov 27 14:45:40 2009 +0100 Line Holen
+4d2d0e37ec0757efd1f6ca1642c5c3db0c839ca2
+
+	* opensm/osm_vl15intf.c Log change
+
+Fri Nov 27 14:27:13 2009 +0100 Line Holen
+6f76ca466655aa0ae31dfb78cbb2a30b296e4ec3
+
+	* opensm/osm_helper.c Log format changes
+
+Fri Nov 27 14:16:56 2009 +0100 Line Holen
+8f05ddcab7f7be7a1bbee8c3aec5a0eb8c0caa27
+
+	* opensm/osm_ucast_ftree.c Changed log level
+
+Tue Dec 1 05:31:09 2009 +0200 Sasha Khapyorsky
+46737d7d045ea2d0998f661e464e231819b4bc2f
+
+	* opensm/osm_state_mgr.c: cosmetic
+
+Fri Nov 27 14:14:48 2009 +0100 Line Holen
+43e936eca4f4f4c1a4b488686fea62e0c4a06451
+
+	* opensm/osm_state_mgr.c Added more info to some error messages
+
+Sat Nov 28 17:24:00 2009 +0200 Sasha Khapyorsky
+2f99e56655b42f642436e23560a13654df8600ae
+
+	* opensm/osm_trap_rcv.c: some cleaning
+
+Tue Nov 3 10:29:32 2009 -0500 Hal Rosenstock
+ee15df9cd75b5ad5e87b54a648701f1f469f8fc6
+
+	* opensm/osm_trap_rcv.c: Eliminate heavy sweep on receipt of trap 145
+
+Tue Oct 13 09:15:35 2009 -0700 Stan C. Smith
+e7897b99ef304a4256c49cd6d74c33421d4467dd
+
+	* opensm - standardize on a single Windows #define - take #2
+
+Fri Nov 27 18:33:16 2009 +0200 Sasha Khapyorsky
+888c2dc78d22bec5e1e15e4c80ae3fd3bb7e0f0f
+
+	* opensm/osm_db_files.c: kill useless malloc() castings
+
+Wed Oct 7 16:46:43 2009 -0700 Stan C. Smith
+174a4d8d179b7da0f7ee56042af8facee7dc910e
+
+	* remove unnecessary leading '/' from filename
+
+Fri Nov 27 17:54:20 2009 +0200 Sasha Khapyorsky
+1e653d292038ef9f167cee0b3b729f8bdc1cb21a
+
+	* opensm/osm_base.h: remove trailing '/' in OSM_DEFAULT_CACHE_DIR
+
+Fri Nov 27 17:28:46 2009 +0200 Sasha Khapyorsky
+98ef01ea80a8f07f358ba2d71de17bab398352d2
+
+	* opensm/osm_db_files.c: add '/' path delimited
+
+Tue Nov 17 14:08:38 2009 -0500 Hal Rosenstock
+0f35ea42ef8ff58bb6e5b923120f4d25496cb61c
+
+	* opensm/osm_sm_mad_ctrl.c: Fix qp0_mads_accounting
+
+Thu Nov 26 18:34:53 2009 +0200 Sasha Khapyorsky
+b1518d6686b47b4ca8001e43edcca877c3c3adb7
+
+	* opensm: IPv6 SNM update for man page and usage
+
+Thu Nov 26 18:08:34 2009 +0200 Sasha Khapyorsky
+b0c2701b91bcc5a73b3ecd3bdd3f8c3fc4b8b10d
+
+	* complib/cl_fleximap.h: fix comment typo
+
+Tue Nov 17 09:03:41 2009 -0500 Hal Rosenstock
+ccd95fbf789f91617a0611b89c6da4900ead571a
+
+	* opensm/osm_vl15intf.c: Cosmetic commentary change
+
+Tue Nov 17 09:02:57 2009 -0500 Hal Rosenstock
+c83d2a8f86c229b8dba707dae96bd393bbfa41ab
+
+	* opensm/complib/cl_event.c: Cosmetic changes
+
+Mon Nov 16 13:43:43 2009 -0500 Hal Rosenstock
+431f1f0c8eac2dcd2fee76323636c58fd6184a61
+
+	* opensm/osm_vendor_api.h: Fix commentary typo
+
+Mon Nov 16 13:43:03 2009 -0500 Hal Rosenstock
+c91e5553fc7e313ef28af981ac5aca19817dd283
+
+	* opensm/libvendor/osm_vendor_ibumad.c: Cosmetic change to OSM_LOG message
+
+Mon Nov 16 13:42:22 2009 -0500 Hal Rosenstock
+9da8ba7001972b2f3434054c8f7443c43935a12f
+
+	* opensm/osm_ucast_ftree.c: Cosmetic commentary changes
+
+Thu Nov 19 13:54:43 2009 +0200 Yevgeny Kliteynik
+b302a2755d69d0b947882bd43a784fe863b5ad5c
+
+	* opensm/osm_subnet.c: fixing bug in dumping options file
+
+Thu Nov 26 01:16:09 2009 +0200 Sasha Khapyorsky
+2428078c229718d5582886e696317045f1e85d0c
+
+	* opensm/osm_ucast_mgr.c: fix memory leak
+
+Fri Nov 13 19:57:53 2009 +0200 Sasha Khapyorsky
+56e73a8af87b80b3757f952af425b479dacfa6f0
+
+	* opensm: osm_get_mgrp_by_mgid() helper
+
+Thu Nov 12 03:53:17 2009 +0200 Sasha Khapyorsky
+d003bd00f01ebfa649f43e9bf39a055c70143619
+
+	* opensm: compress IPV6 SNM groups to use a single MLID
+
+Thu Nov 12 03:50:40 2009 +0200 Sasha Khapyorsky
+d654e820ee897d4516077901c635e2926e88c7f5
+
+	* complib/cl_fleximap: add cl_fmap_match() function
+
+Wed Nov 11 22:00:52 2009 +0200 Sasha Khapyorsky
+b995b82c8e96165da53aa4ed5c7779de86c2a691
+
+	* osm_sa_mcmember_record.c: pass MCM Record data to mlid allocator
+
+Sat Sep 19 19:51:37 2009 +0300 Slava Strebkov
+d6f8f3b334fd5554614adea92c7792b7faf36461
+
+	* osm_mgrp_box: infrastructure for mgid compression
+
+Wed Nov 11 19:36:08 2009 +0200 Sasha Khapyorsky
+0d1a77ab725e736683c5c2e7122ea1e154dc17c3
+
+	* opensm/osm_mcast_mgr.c: cosmetic fixes
+
+Wed Nov 11 21:38:55 2009 +0200 Sasha Khapyorsky
+1362fa96a49e4d7e8a48ff559b1ef52650ecf915
+
+	* opensm/osm_sa_member_record.c: mlid independent MGID generator
+
+Wed Nov 11 21:49:20 2009 +0200 Sasha Khapyorsky
+4bc9e979caa93a008d81881ecece6cbc971f3a3d
+
+	* opensm/osm_sa_mcmember_record.c: move mgid allocation code
+
+Sun Oct 4 12:53:28 2009 +0200 Sasha Khapyorsky
+8d587aef29ef5f6739ee6128a9a821620419cc03
+
+	* complib: replace intn_t types by C99 intptr_t
+
+Mon Nov 2 15:48:35 2009 +0200 Yevgeny Kliteynik
+d43a023cb1d5acaee5fd65febbebfaacfd7480b8
+
+	* opensm/include/iba/ib_types.h: adding Congestion Control definitions
+
+Fri Nov 13 11:37:21 2009 -0500 Hal Rosenstock
+c5e87164e2f8dba363ba670defe49ff11e38209d
+
+	* opensm: Cosmetic changes
+
+Fri Nov 13 17:33:10 2009 +0200 Sasha Khapyorsky
+e9cf56c5f6bc5f351e99abff19bb2af03fac2b8d
+
+	* osmtest/osmt_mtl_regular_qp.c: cleaning uintn_t use
+
+Fri Nov 13 08:41:48 2009 +0200 Sasha Khapyorsky
+8ffec3bed9ec1304e2e7881ad6d3cb4c82350d05
+
+	* opensm: remove braces around value in return statements
+
+Fri Nov 13 08:48:02 2009 +0200 Sasha Khapyorsky
+c253ff452918bf28458f00bc5e6da6ad3582e5c1
+
+	* opensm/osm_perfmgr_db.c: remove casting
+
+Fri Nov 13 08:46:44 2009 +0200 Sasha Khapyorsky
+c2272f776f67f261e743a632fed02d6337dfe49b
+
+	* opensm/osm_console.c: make const functions
+
+Sat Sep 19 01:23:01 2009 +0300 Sasha Khapyorsky
+77c019d18b17e41bb06da87bc7116b02dcf80191
+
+	* opensm/osm_mgrp_new(): add subnet db insertion
+
+Thu Nov 12 22:03:42 2009 +0200 Sasha Khapyorsky
+abad3805179198a8e833fe35b863e58825de8ba0
+
+	* complib/fleximap: make compar callback to return int
+
+Thu Nov 12 21:57:57 2009 +0200 Sasha Khapyorsky
+13f5f79cb9c09734f2875daae7d837e8c229fd56
+
+	* opensm: cleanup intn_t uses
+
+Fri Nov 13 04:58:02 2009 +0200 Sasha Khapyorsky
+1f5d66a62a3cd0618b3f6b32ae6f744494578c74
+
+	* opensm/main.c: kill unneeded braces
+
+Fri Nov 6 12:41:47 2009 -0600 Michael Reed
+11c711e77754e3cc7a358c979c243a6663753532
+
+	* opensm/main.c: opensm cannot be killed while asking for port guid
+
+Sun Nov 8 15:28:16 2009 +0200 Yevgeny Kliteynik
+112c97a1d80372b71e0fd9cef1c6bb12f680c472
+
+	* opensm/complib: bug in cl_list_insert_array_head/tail functions
+
+Mon Nov 9 17:48:08 2009 -0800 Stan C. Smith
+51d0b5b368921df7f1a104d4e48d3ddede3972da
+
+	* opensm - use C99 transportable data type for pointer storage
+
+Tue Nov 10 11:37:38 2009 +0200 Yevgeny Kliteynik
+7bed088d38cad441fc8d7bec3a8510eb17f45c17
+
+	* opensm/osm_state_mgr.c: do not probe remote side of port 0
+
+Fri Nov 6 15:42:19 2009 -0500 Hal Rosenstock
+e315149943b196b822d75583a024b732a2dd4a7a
+
+	* opensm/osm_link_mgr.c: Fix IBA reference for PortInfo attribute
+
+Mon Nov 9 15:07:29 2009 -0800 Stan C. Smith
+d4b4e04d4a4cb7b58548ac43d8ffc43e194dc024
+
+	* opensm - remove useless goto
+
+Wed Nov 11 19:38:13 2009 +0200 Sasha Khapyorsky
+125fbf7a0c132de2ef1645d2fd6f5e469eeb3dd8
+
+	* opensm/osm_mcast_mgr.c: fix return value on alloc_mfts() failures
+
+Tue Nov 10 10:39:47 2009 -0800 Ira Weiny
+b5f4e6ae6c3958a596296b5e83fd609f33e27fc6
+
+	* OpenSM: Fix unused variable compiler warning.
+
+Sat Sep 19 16:38:36 2009 +0300 Sasha Khapyorsky
+5a88e8f6d3fd4280657c2a2063551efe1cb473bf
+
+	* opensm/partition: keep multicast group pointer
+
+Fri Nov 6 09:14:02 2009 -0500 Hal Rosenstock
+48663a10d28ae2d0bb190333e381038288df6c52
+
+	* opensm: Only clear SMP beyond end of PortInfo attribute
+
+Fri Nov 6 09:08:08 2009 -0500 Hal Rosenstock
+8ce83b183d41a9f88058d7482f149d9aa2b400a6
+
+	* opensm/osm_base.h: Update IBA reference to use 1.2.1
+
+Fri Nov 6 09:06:24 2009 -0500 Hal Rosenstock
+2eebf9a84e07180d78014d2dc69dfe4622088bb8
+
+	* opensm/ib_types.h: Fix some commentary typos
+
+Wed Nov 4 12:34:04 2009 -0800 Stan C. Smith
+cf5d838fe4034f72c54b760dbb8d9869c10e0d28
+
+	* osmtest - code cleanup: remove Windows specific items.
+
+Wed Nov 4 09:29:08 2009 -0500 Hal Rosenstock
+c5f699b9b2909e7260f5810484ba36f4a51a60ca
+
+	* opensm/osm_switch.h: Remove dead osm_switch_get_physp_ptr routine
+
+Tue Nov 3 07:00:58 2009 -0500 Hal Rosenstock
+4f9a6f2f53fda827f3f0a8d778879158346252e9
+
+	* opensm/osm_mcast_tbl.c: In osm_mcast_tbl_clear_mlid, use memset to clear port mask entry
+
+Tue Nov 3 03:46:54 2009 +0200 Sasha Khapyorsky
+6ddfb1111a871e48c2d9f50651d41a847e42c0ab
+
+	* opensm/osm_trap_rcv.c: some consolidation
+
+Tue Nov 3 09:56:30 2009 +0200 Yevgeny Kliteynik
+e11a7379d4c28c611f913b9049bf1a8e6b5b5a6d
+
+	* opensm: copyright updates
+
+Tue Nov 3 09:56:30 2009 +0200 Yevgeny Kliteynik
+d02dc50ab6d8b364d44ff8544c826793c9e88e30
+
+	* opensm: copyright updates
+
+Thu Oct 29 12:22:06 2009 +0530 Keshetti Mahesh
+df14e4fb275d9cb62640e81ff931ba026fd57c32
+
+	* opensm/: Removed empty comments
+
+Tue Nov 3 02:59:24 2009 +0200 Sasha Khapyorsky
+dc2f149569102ca6e733ea93cce51e4f61a06e1f
+
+	* opensm/osm_trap_rcv.c: use source_lid and port_num for logging
+
+Mon Nov 2 14:06:54 2009 -0500 Hal Rosenstock
+548548eedc8c3cffc97e5b9b59a196fdf3965ec8
+
+	* opensm/osm_mcast_tbl: Fix size of port mask table array
+
+Mon Nov 2 21:36:41 2009 +0200 Sasha Khapyorsky
+66dde1c4dc068f3175b381d0e090c55637d3efd6
+
+	* opensm/osm_trap_rcv.c: some simplification
+
+Mon Nov 2 11:43:19 2009 -0500 Hal Rosenstock
+f72e12ee14678531fe5a795473ecc286fc957f0d
+
+	* opensm/main.c: Use strtoul rather than strtol for parsing transaction timeout
+
+Mon Nov 2 17:59:10 2009 +0200 elid
+e940f01aa7de1585a58dba3a2c27e4b4f55b6145
+
+	* opensm: Return single PathRecord for SubnAdmGet with DGID/SGID wild carded
+
+Mon Nov 2 17:32:57 2009 +0200 Sasha Khapyorsky
+7eb584cfdfb4d6167d8a277060e90a5338ccb0c6
+
+	* opensm/osm_sa_path_record.c: flow simplification
+
+Mon Nov 2 00:38:19 2009 +0200 Yevgeny Kliteynik
+b3784d889749d483a3e7b121cb7054c8cb4faf28
+
+	* opensm/osm_sa_mcmember_record.c: fsmall code optimization
+
+** Version: opensm-3.3.3
+
+Sun Nov 1 21:55:47 2009 +0200 Sasha Khapyorsky
+eb95933f0dbd006da8053ea4da0b95a98bd7edea
+
+	* management: bump package versions
+
+Sun Nov 1 21:42:56 2009 +0200 Sasha Khapyorsky
+b309b613b647d456ad6624575c586ed30870fd1a
+
+	* management: update libraries version information
+
+Sun Nov 1 21:03:06 2009 +0200 Sasha Khapyorsky
+f851005abbd85b1d5c98b9679736976a9da696ef
+
+	* opensm_release_notes-3.3: add newest features/fixes
+
+Sun Nov 1 20:38:11 2009 +0200 Sasha Khapyorsky
+55774fa16b9a57301231043a139cbd8baeb4278b
+
+	* opensm_release_notes-3.3: remove OFED dependency
+
+Sun Nov 1 20:05:57 2009 +0200 Sasha Khapyorsky
+cf7b7af5ef51ba904355afb6f25d6680a3edd8f2
+
+	* opensm_release_notes-3.3.txt: align formatting
+
+Mon Nov 2 02:09:14 2009 +0200 Sasha Khapyorsky
+4db32df4d74b70c820caf20f6f58ad147632d8d8
+
+	* management: update/add Voltaire copyright
+
+Sun Nov 1 18:34:16 2009 +0200 Sasha Khapyorsky
+b5b70bcff4b022434dd8c13b3ef9889d98b7cde1
+
+	* opensm/osm_trap_rcv.c: Improvements in log_trap_info()
+
+Sat Oct 31 07:25:01 2009 -0500 Hal Rosenstock
+1ef8a79d0745e4429e2bc94b5508a32e49b335b3
+
+	* opensm/osm_trap_rcv.c: Minor reorganization of trap_rcv_process_request
+
+Fri Oct 30 18:05:00 2009 -0500 Hal Rosenstock
+007a62e9b15ce514ca3da02f9d12e774c86358b8
+
+	* opensm: Add configurable retries for transactions
+
+Sun Nov 1 11:37:04 2009 +0200 Yevgeny Kliteynik
+07fb3293cbadd97ba4bf96ac376b0ca27c7ec4fb
+
+	* opensm/osm_sa_mcmember_record.c: optimization in zero mgid comparison
+
+Mon Aug 10 09:13:20 2009 -0400 Hal Rosenstock
+18118f2c7b915bdc95db077a5dbcf3e0a1f66903
+
+	* opensm/osm_sm_mad_ctrl.c: In sm_mad_ctrl_send_err_cb, set init failure on PKeyTable and QoS initialization failure
+
+Fri Oct 30 02:48:06 2009 +0200 Sasha Khapyorsky
+37b6d5bf4508c0de765cf255c4e65764571a232d
+
+	* opensm/link_mgr: verify port's lid
+
+Fri Oct 30 23:21:31 2009 +0200 Sasha Khapyorsky
+a77046282c9c5e7e32d99374e263d42030ff2321
+
+	* opensm/osm_mcast_tbl: fix mlid removal
+
+Thu Oct 22 09:43:00 2009 -0400 Hal Rosenstock
+2d499ecaff756eec0fe9343c0d1f79e0dd775c2b
+
+	* opensm/osm_vendor_ibumad: Use OSM_UMAD_MAX_AGENTS rather than UMAD_CA_MAX_AGENTS
+
+Fri Oct 30 01:28:43 2009 +0200 Sasha Khapyorsky
+1bfc0155c1810206506c5edc1fd078d3b59ddbf3
+
+	* opensm/osm_mcast_tbl: fix max_mlid_ho setup
+
+Thu Oct 29 21:11:43 2009 +0200 Sasha Khapyorsky
+9be521b8bc60c505ff69e6c524f6be4fd40c276d
+
+	* opensm/mcast_tbl: set max_mlid_ho as actually configured mlid
+
+Thu Oct 29 21:04:00 2009 +0200 Sasha Khapyorsky
+edab92c5bd1a4db6157a73fe34d188d9c8025b9d
+
+	* opensm/osm_mcast_tbl: remove redundant checks
+
+Thu Oct 29 20:40:15 2009 +0200 Sasha Khapyorsky
+aac22b697b9c9e6666f2552f1096966a203e5cdf
+
+	* opensm/osm_mcast_mgr: simplify alloc_mfts()
+
+Fri Oct 23 19:48:56 2009 -0400 Hal Rosenstock
+c3873d7b6d044f78b70a1b507fac062dce7f5df1
+
+	* opensm: Reduce heap consumption by multicast routing tables (MFTs)
+
+Wed Oct 28 11:54:43 2009 +0200 Yevgeny Kliteynik
+4899f856cb1f94dda4e82720e131e9ee318d2655
+
+	* opensm/osm_sa.c: don't ignore failure in osm_mgrp_add_port()
+
+Tue Oct 27 10:43:38 2009 -0700 Stan C. Smith
+808a87715d6525cfac2ed5ce013e1f9dd2ba5ee4
+
+	* opemsm code cleanup
+
+Tue Oct 27 10:36:13 2009 -0700 Stan C. Smith
+39c48e77e4a763e7c81bcb9b24ce85ad78a41efc
+
+	* remove extraneous Windows include
+
+Thu Oct 22 13:20:09 2009 +0200 Sasha Khapyorsky
+4e165b35c69c9cec180208112303921d4e19c446
+
+	* osmtest/osmt_multicast.c: fix strict aliasing breakage warning
+
+Fri Oct 23 23:52:23 2009 +0200 Sasha Khapyorsky
+34b5d9eb09e32fd6340bbb0697c8b9254c5e31e6
+
+	* opensm: make subnet's max mlid update implementation independent
+
+Fri Oct 16 14:28:34 2009 -0400 Hal Rosenstock
+2fcfcf3743999dd1e76c76fde941df44167ee909
+
+	* opensm/osm_mcast_tbl.(h c): Make max_mlid_ho be maximum MLID configured
+
+Thu Oct 22 17:33:03 2009 +0200 Yevgeny Kliteynik
+b899af94e9084429a1bd59ef57fabd693bbce19f
+
+	* opensm/osm_ucast_updn.c: cosmetics - rename function
+
+Wed Oct 21 08:50:27 2009 -0400 Hal Rosenstock
+94540f9838a8fd0ba272c3bb1bc77de8365674eb
+
+	* opensm/osm_ucast_cache.c: Eliminate unneeded define
+
+Tue Oct 20 09:35:20 2009 -0400 Hal Rosenstock
+f329919cb981441fc5dae70fa4941752b3e0368e
+
+	* opensm: Cosmetic changes
+
+Mon Oct 19 09:03:51 2009 -0400 Hal Rosenstock
+7d47a1d41f840c5f9cf3917ea9ab1b0b43fc9c69
+
+	* opensm/osm_sm_state_mgr.c: Cosmetic formatting changes
+
+Mon Oct 19 09:02:11 2009 -0400 Hal Rosenstock
+152efcee79f966eaeae7d9486583dda470b1c9db
+
+	* opensm/osm_vendor_api.h: Fix some commentary typos
+
+Mon Oct 19 09:00:28 2009 -0400 Hal Rosenstock
+0270fb0ad08a6469a9e6174b90bbdf8d72d0d7e4
+
+	* opensm: Add some additional HP vendor IDs/OUIs
+
+Fri Oct 16 11:03:05 2009 -0400 Hal Rosenstock
+0ed107a81f56843483fa9e4175e1eaee855e5293
+
+	* opensm/osm_sa_mcmember_record.c: Make mcmr_rcv_create_new_mgrp static function
+
+Thu Oct 22 12:59:55 2009 +0200 Sasha Khapyorsky
+348ae670f7cc9d62166cac64fdb67db0e17a610c
+
+	* osmtest/osmt_multicast.c: cleanups
+
+Thu Oct 22 12:16:47 2009 +0200 Sasha Khapyorsky
+b41efcc3cf9778d0633b080c98e6f99c4125c5ed
+
+	* osmtest/osmt_multicast: kill some duplications
+
+Fri Oct 16 15:40:36 2009 +0200 Line.Holen at Sun.COM
+5f7bbced33ba69e54f724767435262aba815fa99
+
+	* osm_ucast_ftree.c missing reset of ca_ports
+
+Fri Oct 16 13:43:10 2009 +0200 Sasha Khapyorsky
+098ec736eaca4ee2fc8f14933d253d134fa2a290
+
+	* opensm: fix LFT allocation size
+
+Thu Oct 15 23:50:46 2009 +0200 Sasha Khapyorsky
+227226b30290abf9993554e5abeb349ee44c777f
+
+	* opensm/osm_ucast_cache: reduce OSM_LOG_INFO debug printouts
+
+Thu Oct 15 16:00:29 2009 -0400 Hal Rosenstock
+6b103e43f855bd03178f2176e0d3fad4e1552895
+
+	* opensm/osm_ucast_updn.c: Further reduction in cas_per_sw allocation
+
+Thu Oct 15 14:43:07 2009 -0400 Hal Rosenstock
+e2e12c65e2e6193f3aae9fccda7d1eb30498eb90
+
+	* opensm/osm_lid_mgr.c: Cosmetic commentary changes
+
+Wed Oct 14 17:05:53 2009 -0700 Ira Weiny
+7835f7686425fc43d2230356819e4ae2737566db
+
+	* opensm/opensm/osm_subnet.c: adjust buffer to ensure a '\n' is printed
+
+Wed Oct 14 16:01:24 2009 -0400 Hal Rosenstock
+73b51709c3682111eaecdcabfb7dffc29fc4700f
+
+	* opensm/osm_mcast_mgr.c: Cosmetic changes
+
+Wed Oct 14 15:51:50 2009 -0400 Hal Rosenstock
+93f18a1cfd32b79a2e0c0c3d60d9a96750f3f9ce
+
+	* opensm/osm_subnet.h: Add mgrp_mgid_tbl description
+
+Wed Oct 14 10:45:38 2009 -0400 Hal Rosenstock
+2e17367f7625f9d76b7174f0c0f9b141774f8531
+
+	* opensm/osm_ucast_updn.c: Reduce temporary allocation of cas_per_sw
+
+Wed Oct 14 07:28:19 2009 -0400 Hal Rosenstock
+19c639c04ac27059b05f1a32147a06a43c6df604
+
+	* opensm/release notes: Fix typo
+
+Tue Oct 13 14:59:48 2009 -0400 Hal Rosenstock
+0646e8d1ad0cb5c5ac8b671838b233a6c278b0f1
+
+	* opensm/osm_mesh: Cosmetic changes
+
+Tue Oct 13 15:35:49 2009 -0400 Hal Rosenstock
+b806da3c20b4fd4a243f12b52ae67845d5ae513a
+
+	* opensm/ib_types.h: Mask off client rereg bit in set_client_rereg
+
+Tue Oct 13 14:10:38 2009 -0400 Hal Rosenstock
+4cba3b796ea89bc89e33bf54683d36d1f10b0978
+
+	* opensm: Add infrastructure support for PortInfo IsMulticastPkeyTrapSuppressionSupported
+
+Tue Oct 13 19:52:01 2009 +0200 Sasha Khapyorsky
+c5582e39e90e47cddec4519e5a348df22659d69c
+
+	* opensm/osm_state_mgr.c: in cleanup_switch() check only relevant LFT part
+
+Tue Oct 13 09:00:03 2009 -0400 Hal Rosenstock
+df13ce5b3138775535c818da1da2588cb60b20c7
+
+	* opensm: Reduce heap consumption by unicast routing tables (LFTs)
+
+Tue Oct 13 00:05:53 2009 +0200 Sasha Khapyorsky
+56edfe4d6087256c3e2175a8deed3541038d1a33
+
+	* osmtest/osmtest.c: remove strings.h inclusion
+
+Wed Oct 7 09:32:57 2009 -0700 Stan C. Smith
+9ba167d4e49018604845d3effd3eec3fe8d91f53
+
+	* use transportable constant attributes
+
+Mon Oct 12 11:57:08 2009 -0700 Stan C. Smith
+d543efcbfdd81b0de04a459d17cfe4b19cf2de70
+
+	* osmtest - code cleanup
+
+Mon Oct 12 11:52:24 2009 -0700 Stan C. Smith
+6cad6a3132f14fd34c0b645067ec8902d6b56ccc
+
+	* osmtest -code cleanup - use strncasecmp()
+
+Mon Oct 12 23:34:01 2009 +0200 Sasha Khapyorsky
+99151d403429085527b8fb442bb5e3dc92f1364e
+
+	* osmtest: initialize attr_array[] on declaration
+
+Mon Oct 12 10:21:29 2009 -0700 Stan C. Smith
+acd46a3b0a20a9cdb0ea429c441acf0e3c1a03a1
+
+	* osmtest - fix signed unsigned comparisons
+
+Mon Oct 12 10:17:12 2009 -0700 Stan C. Smith
+41e10da61a46de995f02d6ac9fdff8538937c484
+
+	* osmtest - clarify assignment operation
+
+Mon Oct 5 13:30:57 2009 -0400 Hal Rosenstock
+3b8aed67149f2b38b7bd2c60af413a0d2b796b2c
+
+	* opensm/osm_mcast_tbl.c: Cosmetic changes
+
+Mon Oct 5 09:36:32 2009 -0400 Hal Rosenstock
+459c3a022740b0bfe8b6b7c571ecb844cf70ab94
+
+	* opensm/osm_mcast_mgr.c: In mcast_mgr_set_mft_block, fix node GUID in log message
+
+Sat Oct 3 17:58:17 2009 +0200 Sasha Khapyorsky
+1c1c1880ceedbee48b9c56ac1f685790656738c3
+
+	* opensm/osm_sa_path_record.c: separate router guid resolution code
+
+Mon Oct 12 15:52:52 2009 +0200 Sasha Khapyorsky
+df346ecdc526a486555dcc12d1dcdcbd59ba1b99
+
+	* opensm/osm_helper.c: fix indentations
+
+Mon Oct 12 15:34:30 2009 +0200 Sasha Khapyorsky
+2377c8e428593e508c8ef23cc3ce402ee1c0af32
+
+	* opensm: fix gcc-4.4.1 warnings
+
+Fri Oct 9 10:48:37 2009 -0400 Hal Rosenstock
+c435d87304da3e07c207dcc6a380326dbde43e20
+
+	* opensm/osm_pkey.c: Cosmetic changes
+
+Fri Oct 9 10:47:50 2009 -0400 Hal Rosenstock
+917f1ed9d2d23179cf489c3052dbf525ddb93237
+
+	* opensm/osm_lid_mgr.c: Fix typo in OSM_LOG message
+
+Tue Sep 29 17:55:40 2009 -0400 Hal Rosenstock
+10cf6ecf9fe30495e5a3018ed1cff008fac93e71
+
+	* opensm/osm_mesh.c: Add dump_mesh routine at OSM_LOG_DEBUG level
+
+Thu Oct 1 16:09:42 2009 -0700 Smith, Stan
+3da27cfa26ee8c92fb7614380eb75f35d5dd7d24
+
+	* C++ style coding does not compile
+
+Thu Oct 1 22:13:14 2009 +0200 Sasha Khapyorsky
+be93c2cfda88208e78fc6300512494440b07eb3b
+
+	* opensm: remove meanless 'const' keywords in APIs
+
+Sat Oct 3 03:06:39 2009 +0200 Sasha Khapyorsky
+fdaf0d5aecc4e45d2124d519f8c8a24d3d9b2a27
+
+	* opensm/osm_qos_parser_y.y: fix endless loop
+
+Sat Oct 3 02:19:49 2009 +0200 Sasha Khapyorsky
+7733b40e13d22d99aaae6babf921b1279f94332e
+
+	* opensm: fix endless looping in mcast_mgr
+
+Thu Oct 1 22:13:14 2009 +0200 Sasha Khapyorsky
+067ffac2f307561b38d1ac9893f4eb5ca890e0d5
+
+	* opensm/osm_helper: remove meanless 'const' keywords
+
+Thu Oct 1 21:18:29 2009 +0200 Sasha Khapyorsky
+d9807d241f2488af46bfce911117b77af545aba4
+
+	* opensm: fix some obvious -Wsign-compare warnings
+
+Wed Sep 23 18:40:31 2009 +0300 Sasha Khapyorsky
+1127cc33d5f2f5f30ffc005433f41c84018b0cdf
+
+	* opensm/osm_get_port_by_lid(): don't bother with lmc
+
+Wed Sep 23 16:09:16 2009 +0300 Sasha Khapyorsky
+7d54828e2e0ec5e3d1a6a7ea4a8e9a7c89cf0e1e
+
+	* opensm/osm_get_port_by_lid(): speedup a port lookup
+
+Wed Sep 23 16:09:16 2009 +0300 Sasha Khapyorsky
+2f79de17448c78cb91697de05e006af559211db2
+
+	* opensm/osm_get_port_by_lid(): use faster cl_ptr_vector_get()
+
+Thu Oct 1 18:34:11 2009 +0200 Sasha Khapyorsky
+e070411509d895446b15fe0fa9f14bfa28a6606d
+
+	* opensm/osm_mesh.c: simplify compare_switches() function
+
+Thu Oct 1 19:13:38 2009 +0200 Sasha Khapyorsky
+a3f3352823f949864c4f296600d4bdb75227991e
+
+	* opensm/osm_helper.c: fix compiler warning
+
+Wed Sep 30 13:34:44 2009 -0700 Stan C. Smith
+d962f5dfc3832f460d0fb36ab119f461c052b4df
+
+	* cast to remove compiler warning.
+
+Thu Oct 1 17:50:04 2009 +0200 Sasha Khapyorsky
+f3cff048a69124bd286b7f40f34c3b13ef8e2a91
+
+	* opensm/osm_mesh.c: remove some castings
+
+Wed Sep 30 13:30:09 2009 -0700 Stan C. Smith
+c1ab20af0f82445e6b7a346938cd6a31fed4e8ba
+
+	* cast to remove warnings about signed vs. unsigned comparisons
+
+Wed Sep 30 13:20:59 2009 -0700 Stan C. Smith
+85549d770480287d940531d521b32d70a5234739
+
+	* osm_sa.c - void * arithmetic causes problems
+
+Tue Sep 29 09:44:16 2009 -0700 Stan C. Smith
+7452e287a00bd162af8d2a2f30d1ac8fb523e7f8
+
+	* osm_helper.c use explicit value for struct init
+
+Mon Sep 28 16:50:53 2009 -0700 Stan C. Smith
+4b371fbbb43b7cb68a6bac3d87d5eec1645f7978
+
+	* use standard varargs syntax in macro OSM_LOG()
+
+Mon Sep 28 15:52:41 2009 -0700 Stan C. Smith
+3a9e0fb433d3c9699162047bf29eb33f5ccc31d4
+
+	* update functions to match .h prototypes
+
+Fri Sep 25 09:05:29 2009 -0700 Stan C. Smith
+638dd6b945f897cd037bacd8bd9d2c50b64dc6bb
+
+	* update osm_db_files.c & osm_pack.c functions to match .h prototypes
+
+Fri Sep 25 17:42:02 2009 +0300 Sasha Khapyorsky
+fcf2a9ef56d72614c2c35479530768de12aa97cd
+
+	* opensm/osm_ucast_lash: fix use after free bug
+
+Sat Sep 19 15:34:02 2009 +0300 Sasha Khapyorsky
+2fee1d78a8735a78a8cb8202ca099c929d7d6f09
+
+	* opensm: osm_get_port_by_lid() helper
+
+Sat Sep 19 14:21:34 2009 +0300 Sasha Khapyorsky
+e2302f8054016eab59328aeb6ad423e83cab3203
+
+	* opensm: discard multicast SA PR with wildcard DGID
+
+Sat Sep 19 12:58:58 2009 +0300 Sasha Khapyorsky
+1b177141fc0d731f11ee7e7456bf7d7fda94b94b
+
+	* opensm/osm_sa_path_record.c: validate multicast membership
+
+Sat Sep 19 01:13:34 2009 +0300 Sasha Khapyorsky
+4d2bf5bbe6ae86dd54e08d4f7f1a16f529889505
+
+	* opensm/multicast: improve function prototypes
+
+Sat Sep 19 16:28:27 2009 +0300 Sasha Khapyorsky
+067b8f62b08aab0bec1e95cf535de6c6e08b2109
+
+	* opensm/osm_prtn.c: cosmetic
+
+Mon Sep 21 09:41:51 2009 -0400 Hal Rosenstock
+d19a37707c78cc7f64c954881331d7a6204d14da
+
+	* opensm/osm_mesh.c: Remove edges in lash matrix
+
+Tue Sep 22 18:31:13 2009 +0300 Sasha Khapyorsky
+a6470060c37591d77fd253b1fd40fe692ddecef7
+
+	* opensm/osm_sa_mcmember_record.c: clean uninitialized variable use
+
+Mon Sep 21 10:44:31 2009 -0400 Hal Rosenstock
+56c9535ece2c59d35234e631b0c8cdfbb60f8c67
+
+	* opensm/osm_perfmgr_db.c: Fix memory leak of db nodes
+
+Mon Sep 21 09:18:25 2009 -0400 Hal Rosenstock
+ab6c86631b6bf9fbd23bb43369ea0889b66acd27
+
+	* osmtest: Add SA get PathRecord stress test
+
+Tue Sep 1 08:55:05 2009 -0400 Hal Rosenstock
+79f54975b74ed2d537679def7a5db01d8dfd768c
+
+	* opensm: Add infrastructure support for more newly allocated PortInfo CapabilityMask bits
+
+Sat Sep 19 22:36:42 2009 +0300 Sasha Khapyorsky
+163202496e6d56c920ff3348f71b480b86602cd4
+
+	* opensm/osm_notice.c: move logging code to separate function
+
+Wed Sep 9 09:04:29 2009 -0400 Hal Rosenstock
+779bb0effba2e086f0fadfe550c8130ad8aff3a1
+
+	* opensm/osm_inform.c: For traps 64-67, use GID from DataDetails in log message
+
+Mon Sep 14 11:42:37 2009 -0400 Hal Rosenstock
+43e353ffc0d4def1bbf478e91664ebbae84bf4a1
+
+	* opensm/opensm.8.in: Indicate default rule for Default partition
+
+Fri Sep 18 20:56:50 2009 +0300 Sasha Khapyorsky
+148bef3e23efc7f7c552cd2c5d06a3066184b66b
+
+	* opensm/multicast: consolidate osm_mgrp_cleanup() calls
+
+Tue Sep 15 22:18:37 2009 +0300 Sasha Khapyorsky
+f8b18e0a3ccfa572998598382e758efd75024df9
+
+	* opensm: remove not used osm_mcm_info.[ch] files
+
+Fri Sep 18 18:15:45 2009 +0300 Sasha Khapyorsky
+a7fdac1947290bc0d91a1fc6933fad14d36fea68
+
+	* opensm/osm_sa_node_record.c: dump NodeInfo with debug verbosity
+
+Tue Sep 15 20:31:00 2009 +0300 Sasha Khapyorsky
+4ea39cc987e801dce28d14354c5d63e0af0a7550
+
+	* opensm/multicast: merge mcm_port and mcm_info
+
+Tue Sep 8 22:24:59 2009 +0300 Sasha Khapyorsky
+4894ade691564a37e798d1707c8abcf5a2205f2b
+
+	* opensm/multicast: consolidate port addition/removing code
+
+Mon Sep 7 18:34:49 2009 +0300 Sasha Khapyorsky
+5cfeae54cba00f20d73efea0ab556ddbcf4520b2
+
+	* opensm: port object reference in mcm ports list
+
+Thu Sep 17 20:57:36 2009 +0300 Sasha Khapyorsky
+ba866a71519076f97796eba52641a441aeb172b5
+
+	* opensm: fix uninitialized return value in osm_sm_mcgrp_leave()
+
+Tue Sep 15 14:35:48 2009 +0300 Sasha Khapyorsky
+9723ab881b0a0dba57cc7744b893d2ffa60b7279
+
+	* opensm/osm_multicast: remove unused osm_mcast_mgr_ctxt_t
+
+Sun Sep 13 16:09:27 2009 +0300 Sasha Khapyorsky
+144e31c74b1444eeab7a073a9c5366b9476ea978
+
+	* opensm/osm_prtn.c: minor improvements
+
+Tue Sep 8 22:37:28 2009 +0300 Sasha Khapyorsky
+157721259ff872d19e359250a059675264f15dce
+
+	* opensm/osm_multicast.[hc]: cosmetic changes
+
+Fri Sep 11 07:34:06 2009 -0400 Hal Rosenstock
+f70da14a067cdb40adb687b088ca97a397647c8f
+
+	* opensm/opensm.8.in: Cosmetic formatting change
+
+Tue Sep 8 02:08:23 2009 +0300 Sasha Khapyorsky
+444429c2c18660838394ad1fad1d5ff356971596
+
+	* opensm/osm_ucast_ftree.c: indentation fixes
+
+Wed Aug 19 20:51:15 2009 +0200 Nicolas Morey-Chaisemartin
+74478064a88196ff6ca9b28901044a3557f05010
+
+	* osm_ucast_ftree.c: Applied osm_indent
+
+Wed Aug 19 20:50:23 2009 +0200 Nicolas Morey-Chaisemartin
+0bfee7dcdb3566fc1903d565b3b6f81af6ae3e78
+
+	* osm_ucast_ftree.c: Cleaned up many comments
+
+Wed Aug 19 20:50:04 2009 +0200 Nicolas Morey-Chaisemartin
+8a2e1df3cd0bf032b1eb4f30f2fb8fa90766cbab
+
+	* osm_ucast_ftree.c: Removed reverse_hop parameters from fabric_route_upgoing_by_going_down
+
+Mon Sep 7 14:47:22 2009 +0300 Sasha Khapyorsky
+3d0fdc8286127c75abec7de434d00cf4f4a02d2c
+
+	* opensm/multicast: kill mc group to_be_deleted flag
+
+Mon Sep 7 05:08:15 2009 +0300 Sasha Khapyorsky
+9f900fcb365ca66d92f1cbbf09b1798fb7d8fae3
+
+	* opensm/osm_sa_mcmember_record.c: cosmetic
+
+Mon Sep 7 04:59:20 2009 +0300 Sasha Khapyorsky
+883f5de37f418c7835e381868b32c70d49872c3d
+
+	* opensm/osm_mcast_mgr.c: almost cosmetic
+
+Fri Sep 4 12:03:44 2009 +0300 Sasha Khapyorsky
+f0cf5a6abea62c6950ea1e61ddc89981c0eea35b
+
+	* opensm/osm_mcast_mgr.c: multicast routing by mlid - renaming
+
+Tue Mar 31 03:32:48 2009 +0300 Sasha Khapyorsky
+b8af033bf1ecc94986d7ece2c7811be6923b3975
+
+	* opensm/multicast: remove change id tracking
+
+Sun Dec 14 23:57:09 2008 +0200 Sasha Khapyorsky
+64b91dd58982127b5a2fba5c09faab2dc5d771a4
+
+	* opensm: improve multicast re-routing requests processing
+
+Sun Sep 6 18:19:24 2009 +0300 Sasha Khapyorsky
+2b4cebf9a094a105494a853eafd08e6c45148bbd
+
+	* opensm: remove not used osm_mgrp_apply_func() function
+
+Fri Sep 4 12:03:44 2009 +0300 Sasha Khapyorsky
+b33f8654c00db6adb5c9a6d1728db7dde2f32fab
+
+	* opensm: use mgrp pointer as osm_sm_mcgrp_join/leave() parameter
+
+Fri Sep 4 12:03:44 2009 +0300 Sasha Khapyorsky
+cecc3f94a42356af4c9b9c291055118c3537cc99
+
+	* opensm: use mgrp pointer in port mcm_info
+
+Thu Sep 3 09:00:36 2009 -0400 Hal Rosenstock
+f81886cd89c156c43ab3ba5119b4ac7a4fbcb4ed
+
+	* opensm doc: Indicated limited (rather than partial) partition membership
+
+Tue Sep 1 10:42:30 2009 -0400 Hal Rosenstock
+a30bcbc18bf6c4fdd001a2728e706a86b816d16b
+
+	* opensm/osm_base.h: Add new SA ClassPortInfo:CapabilityMask2 bit allocations
+
+Mon Aug 31 09:39:34 2009 -0400 Hal Rosenstock
+38cf7042f889e53eefde37fc6930c151b0d19461
+
+	* opensm: Parallelize (Stripe) MFT sets across switches
+
+Sun Aug 30 08:51:50 2009 -0400 Hal Rosenstock
+cc348a25945064984b655d56a61328808b20887a
+
+	* opensm: Add infrastructure support for MulticastFDBTop
+
+Wed Aug 26 11:54:47 2009 -0400 Hal Rosenstock
+de9cde064879a8a0479c08ec34426b8dd6ba6433
+
+	* opensm/ib_types.h: Add CounterSelect2 field to PortCounters attribute
+
+Thu Aug 6 14:23:15 2009 -0400 Hal Rosenstock
+df06fc3cc79b78d68c28651156927eb0fccaab09
+
+	* opensm/osm_ucast_lash.c: In lash_core, return status -1 for all errors
+
+Fri Aug 28 09:44:53 2009 -0400 Hal Rosenstock
+2a85f1499639bb53f4b08c86acbea717f73bc936
+
+	* opensm/osm_helper.c: Add SM priority changed into trap 144 description
+
+Wed Aug 26 21:02:55 2009 +0300 Sasha Khapyorsky
+f38f34e04c9990e2f95ec60edc51d3cd4a15a7b7
+
+	* opensm/osm_ucast_mgr.c: move fwd tables setup function
+
+Wed Aug 26 20:56:32 2009 +0300 Sasha Khapyorsky
+7c61bdffe101406b8268f34f12ce10dede195356
+
+	* opensm/osm_ucast_mgr.c: better function names
+
+Wed Aug 26 12:14:43 2009 +0300 Sasha Khapyorsky
+bd7317647c372c378572e5ad621562d58d7f2982
+
+	* opensm/osm_ucast_mgr: better lft setup
+
+Tue Aug 25 21:05:21 2009 +0300 Sasha Khapyorsky
+832c98469b0d84974f1ea0e1f31fc61c99811c59
+
+	* opensm/osm_ucast_mgr.c: simplify fwd tables setup flow
+
+Tue Aug 25 19:20:24 2009 -0400 Hal Rosenstock
+1b6f3baa20304af46e7bad5d7da0adae333a37b4
+
+	* opensm/osm_helper.c: Only change method when > rather than >=
+
+Fri Aug 7 07:08:11 2009 -0400 Hal Rosenstock
+6e2efdce7196e986e6aab371f766af5e61f0fe44
+
+	* opensm: Parallelize (Stripe) LFT sets across switches
+
+Sun Aug 23 20:19:16 2009 +0300 Sasha Khapyorsky
+27e0eb971905324d15f7b3b85cf19d725386b847
+
+	* complib: format comment blocks
+
+Sun Aug 23 20:13:05 2009 +0300 Sasha Khapyorsky
+eb032b9ede64a73189fef0c46802b4bfa451069b
+
+	* complib: indentation fixes
+
+Sun Aug 23 18:01:42 2009 +0300 Sasha Khapyorsky
+0844485e9f230607ae52d3d9b2aabd88827e7693
+
+	* complib/cl_event.c: change nanosec var type long
+
+Thu Aug 13 09:06:02 2009 -0700 Ira Weiny
+a7effc1d144c3c5dd72f424f02e9a4a2cc25db97
+
+	* opensm/complib: account for nsec overflow in timeout values
+
+Thu Aug 20 16:06:55 2009 +0300 Yevgeny Kliteynik
+02b0659a40354a2cab44a44cf72081660d4bb6bb
+
+	* opensm/osm_qos_policy.c: matching PR query to QoS level with pkey
+
+Thu Aug 20 16:07:16 2009 +0300 Yevgeny Kliteynik
+1f9396f99f0177d1bcaad8e43ee37c2b730d88dc
+
+	* opensm: fixing some data types in osm_req_get/set
+
+Fri Aug 14 10:11:32 2009 -0400 Hal Rosenstock
+3106a99ff6bb1dcc197e25372a9268f66a979547
+
+	* opensm/libvendor/osm_vendor_ibumad.c: Handle umad_alloc failure in osm_vendor_get
+
+Fri Aug 14 07:58:23 2009 -0400 Hal Rosenstock
+13fcaf8d8ecc5bc34dd67a03536e6f4e875c62bc
+
+	* opensm/osm_helper.c: In osm_dump_dr_smp, fix endian of status
+
+Fri Aug 14 07:56:07 2009 -0400 Hal Rosenstock
+64b69fa49933d17e57e922572b0c544572e729aa
+
+	* opensm/osm_sm_mad_ctrl.c: Fix endian of status in error message
+
+Wed Aug 12 09:22:47 2009 -0400 Hal Rosenstock
+42061d2328fd7490331fd04ce826c10ab879dd3d
+
+	* opensm/osm_mcast_tbl.c: In osm_mcast_tbl_get_block, eliminate unneeded check
+
+Tue Aug 11 14:40:11 2009 -0400 Hal Rosenstock
+a55afc0ea0c3039fc5f575ba4405ff013a5fecad
+
+	* opensm/osm_qos_policy.c: Some minor simplifications
+
+Wed Aug 5 15:03:44 2009 -0400 Hal Rosenstock
+616a1c317d1a447ad2fa9bffe741a0fa646e76b6
+
+	* opensm/osm_mesh.h: Fix SFW copyright
+
+Wed Aug 5 14:48:22 2009 -0400 Hal Rosenstock
+c7654a359138d995320ba4fe4e548cf0d4427d53
+
+	* opensm/osm_mesh.c: Reorder switches for lash
+
+Wed Aug 5 15:19:41 2009 -0400 Hal Rosenstock
+219bd237820ea68ed75d7c770f0acfef764ee7e0
+
+	* opensm/osm_trap_rcv.c: Validate trap is 144 before checking for NodeDescription changed
+
+Wed Aug 5 11:22:58 2009 -0400 Hal Rosenstock
+4d163b4b2126b85562bd06cf044b359e91ca3877
+
+	* opensm/osm_ucast_lash.c: Handle calloc failure in generate_cdg_for_sp
+
+Wed Aug 5 14:20:53 2009 +0300 Yevgeny Kliteynik
+6b2fc0349ac738abacd645748e39561f7920900a
+
+	* opensm: fixing handling of opt.max_wire_smps
+
+Tue Aug 4 17:44:13 2009 -0400 Hal Rosenstock
+15e7b015db8132a3481dc62b4177177dee48de4c
+
+	* opensm/osm_lin_fwd_rcv.c: Commentary change
+
+Tue Aug 4 17:39:05 2009 -0400 Hal Rosenstock
+d9a36a595c2ee491cd53055ed5cd7db6e46bf55c
+
+	* opensm/osm_ucast_lash.c: Directly call calloc/free rather than create/delete_cdg
+
+Tue Aug 4 11:13:37 2009 -0400 Hal Rosenstock
+f8634c236106438c9f23e93985b45bc375e21ef8
+
+	* opensm/osm_ucast_lash.c: Added error numbers to some error log messages
+
+Tue Aug 4 11:29:06 2009 +0300 Yevgeny Kliteynik
+ade94e0e889d1b114140036a9d34b85e51cdde5b
+
+	* opensm/osm_helper.c: fix printing trap 258 details
+
+Mon Aug 3 16:04:29 2009 +0300 Yevgeny Kliteynik
+08a759e1424e43f86a10f4603d85f88da18b7c00
+
+	* opensm: do not configure MFTs when mcast support is disabled
+
+Mon Aug 3 13:59:46 2009 -0400 Hal Rosenstock
+d48c68044258eb2d916f3128310ac5afdc151c08
+
+	* opensm/osm_trap_rcv.c: Use proper flag name in comment
+
+Sun Aug 2 20:14:45 2009 -0400 Hal Rosenstock
+09853166ae1abd6ae88662327562472393bd468e
+
+	* opensm/osm_sm_mad_ctrl.c: In sm_mad_ctrl_send_err_cb, indicate failed attribute
+
+Sun Aug 2 14:48:49 2009 -0400 Hal Rosenstock
+c7d1990318f2b2b4b375369c93f2bbd58a05a8ba
+
+	* opensm/osm_helper.h: Fix some commentary typos
+
+Sun Aug 2 14:48:05 2009 -0400 Hal Rosenstock
+38d68ab13f7010f9bff6fa1a15d2c953642f26f1
+
+	* opensm/osm_path.h: Fix osm_dr_path_extend return values comment
+
+Sun Aug 2 14:47:16 2009 -0400 Hal Rosenstock
+b84f9f463b060b8faed2a720a9cb8b4697548c42
+
+	* opensm/osm_ucast_lash.c: Remove osm_mesh_node_delete call from switch_delete
+
+Sun Aug 2 11:22:04 2009 -0400 Hal Rosenstock
+c0974c97b455046cee69225d66053cab875bc2eb
+
+	* opensm/osm_path.h: In osm_dr_path_init, only copy needed part of path
+
+Sun Aug 2 11:31:33 2009 -0400 Hal Rosenstock
+65d2ece76d92d0295385a656927a06e2d981d95d
+
+	* opensm: osm_dr_path_extend can fail due to invalid hop count
+
+Sun Aug 2 11:16:12 2009 -0400 Hal Rosenstock
+9317ecd187fc15fcdcf6098f82b0153d07ba74d9
+
+	* opensm/ib_types.h: Update ib_mad_is_response description
+
+Sun Aug 2 08:40:52 2009 -0400 Hal Rosenstock
+a3a715e7cd4d66648d5b099af6a64e188826d345
+
+	* opensm/osm_lash: Fix use after free problem in osm_mesh_node_delete
+
+Sat Aug 1 02:40:35 2009 +0300 Sasha Khapyorsky
+d0a35d53b5bb9a57054bbab6c4738c11276c008f
+
+	* opensm/osm_req.c: indentation fixes
+
+Fri Jul 31 13:36:40 2009 -0400 Hal Rosenstock
+9f241a87aa062c42135022a6a5b8258582cf9667
+
+	* opensm/osm_ucast_lash.c: Handle malloc failures better
+
+Tue Jul 28 18:55:10 2009 -0700 Ira Weiny
+1d1e83d78305a1dd0114e02cdd11327b0c344cfa
+
+	* opensm: remove extra "0x" from debug message.
+
+Mon Jul 27 16:22:59 2009 -0400 Hal Rosenstock
+1f3bac4e1f00a8817ba789c58ef7c3ae1b1b8def
+
+	* opensm/main.c: Display SMSL when specified
+
+Mon Jul 27 20:14:33 2009 +0300 Sasha Khapyorsky
+4b25cfd7fcf6ee4be0fd4a52be72535cf7df7ecd
+
+	* opensm/main.c: indentation fixes
+
+Thu Jul 23 09:05:29 2009 -0400 Hal Rosenstock
+d616c3c69bdeb73dd77a83d54bac4df779066108
+
+	* opensm: Add ability to configure SMSL
+
+Fri Jul 24 10:14:51 2009 -0400 Hal Rosenstock
+beeaaf68f4cbe9b424a68c3d52f7ec3d105c5102
+
+	* opensm/osm_ucast_lash.c: Minor cleanups
+
+Wed Jul 22 15:00:29 2009 -0400 Hal Rosenstock
+99182e10aa74400f2a188217c7d95ba7048adb78
+
+	* opensm/osm_subnet.c: Format lash_start_vl consistent with other uint8 items
+
+Wed Jul 22 14:59:40 2009 -0400 Hal Rosenstock
+cd6ce8436f52dbdda8d7a6cf07f3a2aa3d547cc1
+
+	* opensm/main.c: Display LASH start VL when specified
+
+Tue Mar 31 03:49:17 2009 +0300 Sasha Khapyorsky
+2874e4267793fc2b51a0b6c548546d86d38b2657
+
+	* opensm/osm_macst_mgr.c: merge functions
+
+Tue Mar 31 03:42:25 2009 +0300 Sasha Khapyorsky
+ab5ceb120ec9fed97ef36ed50c5368508d3095d2
+
+	* opensm/osm_mcst_mgr.c: check number of switches only once
+
+Mon Mar 30 18:37:07 2009 +0300 Sasha Khapyorsky
+453962ade1febc40c416a54b43a520a9e21a47e7
+
+	* opensm/osm_sm.c: code consolidation
+
+Sun Dec 7 21:57:14 2008 +0200 Sasha Khapyorsky
+b65d390612e65a058b21a44caf8a216d32a94a18
+
+	* opensm: find MC group by MGID using fleximap
+
+Wed Jul 22 08:44:49 2009 -0400 Hal Rosenstock
+14d1201e331b8798b8f7222e193364c4fc8433c9
+
+	* opensm/lash: Set minimum VL for LASH to use
+
+Mon Jul 20 11:19:00 2009 -0600 Jason Gunthorpe
+6da59b4b26ba71866ca1a540463cc6bae70a9530
+
+	* Clarify the syntax of the hop_weights_file
+
+Fri Jul 3 09:34:41 2009 -0400 Hal Rosenstock
+fd9bc128a4c1bf2916ccb184e2ed4bdaffb5bd71
+
+	* opensm/osm_mesh.c: Improve VL utilization
+
+Wed Jul 15 13:37:17 2009 +0200 Line.Holen at Sun.COM
+89dd72ed333a34bf76f2de69ec76a414be501371
+
+	* opensm/osm_ucast_ftree.c Fix assert comparing number of CAs to CN ports
+
+Mon Jul 13 16:41:13 2009 +0200 Nicolas Morey-Chaisemartin
+ee43c06788573719b34e6c17b8a2a32cf05ea5f7
+
+	* opensm/osm_ucast_ftree.cd: Added support for same level links
+
+Wed Jul 15 07:59:50 2009 -0400 Hal Rosenstock
+74b65b55e7d720f2509e478e828f1d008575a945
+
+	* opensm/osm_qos_policy.c: Use calloc rather than malloc/memset
+
+Wed Jul 15 07:58:35 2009 -0400 Hal Rosenstock
+c30a45de8a7a19138692f410a994c3661c85136c
+
+	* opensm/osm_qos_policy.c: Use proper size in malloc in osm_qos_policy_vlarb_scope_create
+
+Fri Jul 3 09:18:05 2009 -0400 Hal Rosenstock
+c4764d546626eb07c896bb3728ef8360c9c52589
+
+	* opensm/osm_ucast_ftree.c: Made error numbers unique in some log messages
+
+Mon Jun 29 14:44:57 2009 -0400 Hal Rosenstock
+a58a395c590d457d73d8662110db25213906ac1f
+
+	* opensm/osm_switch.c: In osm_switch_prepare_path_rebuild, use realloc
+
+Tue Jul 7 16:07:52 2009 +0200 Line.Holen at Sun.COM
+438f842f69008f2713bbdc4a50eed7ce7ea2928a
+
+	* opensm: Add new Sun vendor ID
+
+Tue Jul 7 10:00:07 2009 -0400 Hal Rosenstock
+0e09876b5d62a0a88a94c1ed4e04cb4addf7d461
+
+	* opensm/osm_mcast_tbl.c: In osm_mcast_tbl_init, use calloc
+
+Wed Jul 1 09:32:25 2009 +0200 Line.Holen at Sun.COM
+9cd0fbbf7a360649c683c7b182e0638aeece345b
+
+	* osm_ucast_ftree.c Count number of hops instead of calculating it
+
+Mon Jun 29 15:48:06 2009 +0200 Nicolas Morey-Chaisemartin
+b12ab3afc186fa798c26907fbdf02a4667a6ce29
+
+	* opensm/osm_ucast_ftree.c: Fixed issue with reverse_hops introduced by commit 1d7dd18b531c1d6370f80cc7303493d6f3e3e777.
+
+Thu Jul 2 23:23:54 2009 -0400 Hal Rosenstock
+19eae83044b5a8a0d76f008f3212edfb417c983a
+
+	* opensm/osm_sa_(path multipath)_record.c: Fix typo in a couple of log messages
+
+Thu Jul 2 15:48:40 2009 -0400 Hal Rosenstock
+25ad2bcd5d47b123a22a4a2d3df85f572b7a780b
+
+	* opensm/osm_ucast_mgr.c: Add error numbers to some error log messages
+
+Wed Jul 1 07:13:17 2009 -0400 Hal Rosenstock
+9a1133bf82a2d3d9334ea1be176c54f24f424026
+
+	* opensm/osmtest: Fix some typos
+
+Mon Jun 29 13:51:28 2009 +0300 Sasha Khapyorsky
+d7b5e7001ffa823aabf3338105fd26abdaeac2fd
+
+	* complib/Makefile.am: prevent file duplications
+
+Tue Jun 23 21:29:59 2009 +0300 Sasha Khapyorsky
+94d14a43b36f193773f982460174a481c75ed982
+
+	* opensm/osm_sminfo_rcv.c: clean type of smi_rcv_process_get_sm()
+
+Mon Dec 15 01:36:30 2008 +0200 Sasha Khapyorsky
+96b072928cdadfc3f7af34cca4a1e706f87f2da1
+
+	* opensm: sweep component processors return status value
+
+Thu Jun 25 08:54:08 2009 -0400 Hal Rosenstock
+8f51e733012772c1c62e223a806a5db8e659c895
+
+	* opensm/man/osmtest.8: Update email address
+
+Thu Jun 25 08:53:16 2009 -0400 Hal Rosenstock
+c6469d495f40f19e335f8447813532371b8853a6
+
+	* opensm/libvendor/osm_vendor_(ibumad mlx)_sa.c: Handle malloc failure in __osmv_send_sa_req
+
+Thu Jun 18 09:04:32 2009 -0400 Hal Rosenstock
+39ca4c03d16fc6e1891bac6a18e9c1eaf3f8e8a0
+
+	* opensm/osm_ucast_lash.c: Remove some unused code
+
+Thu Jun 18 16:45:57 2009 +0300 Sasha Khapyorsky
+7e73d2208e3596803457ed926b88ef758f569248
+
+	* opensm/osm_ucast_ftree.c: indentation fixes
+
+Sat Jun 13 13:51:32 2009 +0200 Nicolas Morey-Chaisemartin
+507706de02fdca65d150622ffe6db012252d4207
+
+	* opensm/osm_ucast_ftree.c: Enhanced Fat-Tree algorithm
+
+Sun Mar 15 09:42:07 2009 -0500 Dale Purdy
+702f9cdc7dbaaf88253284a75c7849ea6f5fea50
+
+	* Add LMC support to DOR routing
+
+Thu Jun 18 07:31:25 2009 -0400 Hal Rosenstock
+ff5f0f64204c8d00383aba05de281ed5acd1bbbc
+
+	* opensm/osm_ucast_lash.(h c): Replace memory allocation by array
+
+Wed Jun 17 20:37:45 2009 +0300 Sasha Khapyorsky
+06cc00bfdd75c60ced08808531c4641a826a074c
+
+	* opensm/osm_sa_node_record.c: simplify flows
+
+Fri May 22 07:43:46 2009 -0400 Hal Rosenstock
+780efb3ada3ff746fc27da8166b0a60e3dc7bb12
+
+	* opensm/osm_ucast_lash.c: Use calloc rather than malloc/memset
+
+Fri May 22 07:42:34 2009 -0400 Hal Rosenstock
+440fccfb8145d7a374e11e0a950da7fd8f207709
+
+	* opensm/osm_ucast_lash.c: Fix commentary typo
+
+Fri May 22 07:41:10 2009 -0400 Hal Rosenstock
+79d8e0eb3c9a4a20f435b44111442177aaf18f7d
+
+	* opensm/osm_mesh.c: Use define rather than hard coded constant
+
+Sun Jun 7 18:06:00 2009 +0300 Eli Dorfman (Voltaire)
+1245517fa9283919d296cba88cd63e776e2bc636
+
+	* opensm/osm_sa_node_record.c use comp mask to match by LID or GUID
+
+Thu Jun 4 11:08:27 2009 -0700 Ira Weiny
+9ee312a73af3320b8ea3cf9838f186b87e7e1b55
+
+	* Move _with_node_name_map rpm spec option from infiniband-diags to opensm.
+
+Thu Jun 4 15:30:34 2009 +0300 Eli Dorfman (Voltaire)
+19e08e33fc86d48a719fa994585b39f81a0891b0
+
+	* opensm/osm_sa.c add attribute and component mask to error message
+
+Wed May 27 12:32:23 2009 +0200 Line.Holen at Sun.COM
+21757e887d8d97dc1b8eec1e9dc0680e8bffefcb
+
+	* osm_dump.c dump port if lft is set up
+
+Wed Jun 10 16:14:33 2009 +0200 Line.Holen at Sun.COM
+d8699b2e6bca409e49143ad06b70b533cbb19b58
+
+	* osm_sa_patch_record.c Remove unneeded break statement
+
+Sun May 10 11:17:11 2009 +0300 Doron Shoham
+3f419701d5f521003495ce47945842b9197aab05
+
+	* osm_port.c: check if op_vls = 0 before max_op_vls comparison
+
+Tue May 12 14:32:33 2009 -0400 Hal Rosenstock
+7132086d3b366e9857150da9879216867c830c69
+
+	* opensm/osm_port.c: Change log level of Invalid OP_VLS 0 message to VERBOSE
+
+Tue May 12 07:21:03 2009 -0400 Hal Rosenstock
+dcee32212e2fa114ab4b85c4f260ef1b3d01052d
+
+	* opensm/PerfMgr: Reduce host name length
+
+Sat May 9 14:29:23 2009 +0300 Eli Dorfman (Voltaire)
+7d4f8db4ba1dc0d70249f1c0e359a345105f70f8
+
+	* opensm/osm_lid_mgr.c bug in opensm LID assignment
+
+Thu May 7 10:33:46 2009 -0400 Hal Rosenstock
+62aa728cd47e43186e4d5d27eea712a2f374d47c
+
+	* opensm/osm_port.c: Remove error number from debug level log message
+
+Wed May 6 10:13:26 2009 -0400 Hal Rosenstock
+4cab4a200c5f1de6acb3e530983428f3d12a0f54
+
+	* opensm/PerfMgr: Cosmetic changes
+
+Wed May 6 07:35:52 2009 -0400 Hal Rosenstock
+9c67b4f3fb35b6221eb2b99f61d016ab859989c7
+
+	* opensm/osm_perfmgr_db.c: Remove unneeded initialization in perfmgr_db_print_by_name
+
+Tue May 5 15:25:19 2009 +0200 Line.Holen at Sun.COM
+639b4cb906f2218312191d179475249c221ad09c
+
+	* opensm/osm_ucast_ftree.c Increase the size of the hop table
+
+Mon May 4 16:00:18 2009 -0400 Hal Rosenstock
+c9393b70c92fa4dbd3381c8a1ce83a998c25c95b
+
+	* opensm/PerfMgr DB: Remove leading underscores from internal names
+
+Fri May 1 17:47:24 2009 -0400 Hal Rosenstock
+c552ceb0c7a3eefb057fa7c4fc0df7de8f09f1b1
+
+	* opensm/PerfMgr: Remove some underbars from internal names
+
+Mon Apr 27 07:08:32 2009 -0400 Hal Rosenstock
+6cedabc4c1f57a4b54f3b7668902d91691842299
+
+	* opensm: Changes to spec and make files for updated release notes
+
+Mon Apr 27 09:53:30 2009 -0400 Hal Rosenstock
+e5ecccd8962332609e15fc5018b4359bda2a9019
+
+	* opensm: Add SuperMicro to list of recognized vendors
+
+Mon Apr 27 14:46:40 2009 +0200 Nicolas Morey-Chaisemartin
+4725ba81965e139a206272f5f454550767686604
+
+	* OpenSM: include/vendor/osm_vendor.h - Replaced #elif with no condition by #else
+
+Mon Apr 27 12:59:05 2009 +0200 Nicolas Morey-Chaisemartin
+6aef81c850f23a2e5aa7ba8018f56bda9c0c6d20
+
+	* management: Fixed custom_release in SPEC files
+
+Sun Apr 26 08:30:09 2009 -0400 Hal Rosenstock
+841991c49de2cd6e93082aed7e11191bafc96a6b
+
+	* opensm/PerfMgr: Change redir_tbl_size to num_ports for better clarity
+
+** Version: opensm-3.3.2
+
+Sun Apr 26 17:05:13 2009 +0300 Sasha Khapyorsky
+10f3f4502ad44b98022beded7308ce9866ad5105
+
+	* management: bump package versions
+
+Sun Apr 26 16:45:13 2009 +0300 Sasha Khapyorsky
+7a9346798a3d4d3a091187aeb5e951886cd4c2b2
+
+	* opensm: Release Notes update
+
+Tue Apr 21 07:13:00 2009 -0400 Hal Rosenstock
+b6e83c9827ba8ed85b0b06b6698ea3d72281aef1
+
+	* opensm/doc/performance-manager-HOWTO.txt: Indicate (previously implied) master state
+
+Tue Apr 21 11:46:12 2009 -0400 Hal Rosenstock
+b686ef5f6f104c64df562ab6e4204c40b60b3c72
+
+	* opensm/osm_pkey_mgr.c: Fix pkey endian in log message
+
+Tue Apr 21 11:12:53 2009 -0400 Hal Rosenstock
+db552c7a86cdb1579aecaa948e0da11ec545a559
+
+	* opensm/include/opensm/osm_pkey.h: Fix commentary typo
+
+Tue Apr 21 10:47:36 2009 -0400 Hal Rosenstock
+0ea77e20a26e04605c4b5f5100c241e35bf0c194
+
+	* opensm/man/opensm.8.in: Add mention of backing documentation for QoS policy file and performance manager
+
+Sun Apr 19 10:53:06 2009 -0400 Hal Rosenstock
+1dadba17e5f319c2cb89b9c43cfae13c6b736a4b
+
+	* opensm/osm_perfmgr.c: Eliminate duplicated error number
+
+Mon Apr 20 15:46:32 2009 +0300 Eli Dorfman (Voltaire)
+a6ea91ee02e1639176ae4b9059248fe48a981fc1
+
+	* ib_types.h: fix commit 103891092f5f6f0b2cf56555e19fdf008f164c41
+
+Fri Apr 17 11:17:05 2009 -0400 Hal Rosenstock
+942e4bb570f6ff56abc88852a6930aaa95a28431
+
+	* opensm: Some cosmetic formatting changes
+
+Fri Apr 17 11:11:39 2009 -0400 Hal Rosenstock
+0e80561ce7421cc751f5246a82b3b650132a2e0c
+
+	* opensm/osm_helper.c: Convert remaining helper routines for GID printing format
+
+Wed Apr 15 14:45:10 2009 -0400 Hal Rosenstock
+61d38b161ea21412ecfad369b780756a06c18c82
+
+	* opensm/osm_helper.c: Add support for MaxCreditHint and LinkRoundTripLatency to osm_dump_port_info
+
+Wed Apr 15 14:44:00 2009 -0400 Hal Rosenstock
+9bd928d4cc527308bb8a8433c8db9dae69adb187
+
+	* opensm/iba/ib_types.h: Add MaxCreditHint and LinkRoundTripLatency to PortInfo attribute
+
+Wed Apr 15 10:29:56 2009 -0400 Hal Rosenstock
+37d67d06027a508e68c9efffe6b57a075ea0b037
+
+	* opensm: Improve some snprintf uses
+
+Tue Apr 14 14:53:19 2009 -0400 Hal Rosenstock
+e5df70fc847bf12ee300167dc6a8d35f672f6d43
+
+	* opensm: Add Dell to known vendor list
+
+Wed Apr 15 09:06:08 2009 -0400 Hal Rosenstock
+66d075a5a09cc419400d8d0f0e261d398b5732c4
+
+	* opensm/osm_sa.c: Cosmetic change to a few log messages
+
+Tue Apr 14 21:11:36 2009 +0300 Sasha Khapyorsky
+3e7a84cf774ba7291ee7a4655e8a6b03099afb1d
+
+	* opensm/osm_helper.c: use single buffer in osm_dump_dr_smp()
+
+Tue Apr 14 20:39:26 2009 +0300 Sasha Khapyorsky
+e6850699a70e2f67695d6ffaf12bd0efe20b3ff7
+
+	* opensm/osm_helper.c: consolidate dr path printing code
+
+Tue Apr 14 19:25:50 2009 +0300 Sasha Khapyorsky
+52fc5e6dc1766821e0e5b2a1b3c0b905efbc0825
+
+	* opensm/osm_helper.c: return then log is inactive
+
+Tue Apr 14 10:45:47 2009 -0400 Hal Rosenstock
+9aa28b9e6b8582f7d1e662a95f7b88d8b8e62998
+
+	* opensm/osm_helper.c: Add more info for traps 144 and 256-259 in osm_dump_notice
+
+Thu Mar 26 11:39:57 2009 -0500 Hal Rosenstock
+de22ab75fb910150ac205cc2ed3f51b25457165d
+
+	* opensm/osm_ucast_mgr.c: Cosmetic formatting change
+
+Wed Mar 25 10:22:46 2009 -0500 Hal Rosenstock
+3f27a28ace108db5e1b5b54e5109d8cd3c670c6a
+
+	* opensm/osm_link_mgr.c: Remove extraneous parentheses
+
+Wed Mar 25 10:21:53 2009 -0500 Hal Rosenstock
+00337c96074d89b0225956851539eae971880ff4
+
+	* opensm/osm_slvl_map_rcv.c: Cosmetic formatting changes
+
+Wed Mar 25 10:21:03 2009 -0500 Hal Rosenstock
+78508147ebf5f1c8686cd012991c67c07b76637f
+
+	* opensm/osm_qos.c: Cosmetic formatting changes
+
+Tue Mar 24 17:16:55 2009 -0500 Hal Rosenstock
+d4f292b9cb9d2285ec9aa81c4fb758af847662df
+
+	* opensm/osm_qos.c: Cosmetic formatting changes
+
+Tue Apr 14 10:48:17 2009 +0200 Nicolas Morey Chaisemartin
+988ecd3f6b9ce8835edf4b08d45aba3ca7e47d8b
+
+	* opensm/osm_ucat_ftree.c Enhance min hops counters usage
+
+Tue Mar 24 14:41:21 2009 -0500 Hal Rosenstock
+db79c99f8414b08958e8a4aebb752625847931a4
+
+	* opensm/include/ib_types.h: Add ib_switch_info_get_state_opt_sl2vlmapping routine
+
+Tue Apr 14 11:26:42 2009 +0300 Sasha Khapyorsky
+1a753d1249812019d9aee5eb49d479d4c165dad3
+
+	* opensm: clean OSM_CDECL macro
+
+Mon Apr 13 14:30:26 2009 -0400 Hal Rosenstock
+b796aa3a319f35ff2b3e4d88fa2d81c24da0fef9
+
+	* opensm/partition-config.txt: Update for defmember feature
+
+Sun Apr 12 19:09:24 2009 +0300 Yevgeny Kliteynik
+1ba13a4eaf72021a55434943375c402b8fec3469
+
+	* opensm/osm_ucast_ftree.c: lids are always handled in host order
+
+Sun Apr 12 18:28:38 2009 +0300 Yevgeny Kliteynik
+9540628b6b5086ebcd23cc8a8229486f603f3f64
+
+	* opensm/osm_ucast_ftree.c: fixing bug in indexing
+
+Tue Apr 7 16:46:18 2009 -0700 Ira Weiny
+8f481eaa99dab777b448fbf4ced48b1ff84b8c8f
+
+	* Fix further bugs around console closure and clean up code.
+
+Tue Mar 24 13:44:48 2009 -0500 Hal Rosenstock
+3edead95404d36d2c9e7fbc92f3616b292777637
+
+	* opensm: Remove some __ prefixes
+
+Tue Mar 24 11:15:01 2009 -0500 Hal Rosenstock
+a0695f2948abb7fde64e1e6a4be68587ff5fac7f
+
+	* opensm/osm_sm_state_mgr.c: Remove unneeded return statement
+
+Tue Mar 24 11:14:13 2009 -0500 Hal Rosenstock
+2ed4e4282426ac037636bf2a2687afbe3f7ff3a8
+
+	* opensm/osm_sminfo_rcv.c: Minor simplification
+
+Tue Mar 24 07:10:25 2009 -0500 Hal Rosenstock
+4b362a60169a4266f4ca32fbbc2f6893fd982abd
+
+	* opensm/iba/ib_types.h: Add PortXmit/RcvDataSL PerfMgt attributes
+
+Tue Mar 24 03:25:00 2009 +0200 Sasha Khapyorsky
+20900def97aaea69c2be6aeec951472c1cd74b08
+
+	* opensm: fix indentations with osm_indent.
+
+Mon Mar 23 07:30:12 2009 -0500 Hal Rosenstock
+c0ec0a771c4653c36f5894967f1a4af466ce2a8c
+
+	* opensm: Remove __osm_ prefixes
+
+Mon Mar 23 07:29:22 2009 -0500 Hal Rosenstock
+936717553b5a32d9ea6dffe44ff07a50ec765528
+
+	* opensm: Some cosmetic changes
+
+Mon Mar 23 07:28:20 2009 -0500 Hal Rosenstock
+1a4d0f0e29fd20adeb3d506d5a9f97afcef73bb0
+
+	* opensm/include/ib_types.h: Fix some typos
+
+Wed Mar 18 23:28:48 2009 +0200 Sasha Khapyorsky
+8bbc46ae419348e2b16f972e71b50ba2cd331bf9
+
+	* opensm/osm_sw_info_rcv.c: consolidate flows
+
+Sat Feb 28 16:53:04 2009 +0200 Sasha Khapyorsky
+6163a536bfaf9b7f19ba9be1caf408579ecbb4a4
+
+	* opensm: kill __osm_ prefixes in static functions
+
+Tue Mar 17 22:15:26 2009 +0200 Sasha Khapyorsky
+af075dae28a9e58a2adac8c80e9ea9e6b585546d
+
+	* opensm/osm_sa_link_record.c: improve get_base_lid()
+
+Tue Mar 17 16:14:41 2009 +0200 Itai Baz
+26681ba139b776475530bdfe47f5667b677f69db
+
+	* ib_types.h: Adding BKEY violation trap (259)
+
+Sun Mar 15 14:22:58 2009 +0200 Sasha Khapyorsky
+23ac73e957586e3bc648d2e66070fd66034597b2
+
+	* opensm: some init functions simplification
+
+Thu Mar 12 15:20:08 2009 -0500 Hal Rosenstock
+fb0a810c9d40b1a65b2280a75aa91022de3303c9
+
+	* opensm: Utilize ib_gid_is_notzero routine
+
+Thu Mar 12 15:19:18 2009 -0500 Hal Rosenstock
+8b5921bd0ff224e1ce3caaf8a954d6570e447acc
+
+	* opensm: Add common ib_gid_is_notzero routine
+
+Mon Mar 16 07:39:35 2009 -0500 Hal Rosenstock
+4bf080aaac08416dd36cfe1b79a095742c59c536
+
+	* opensm/osm_req.c: Update send_trap144() log message
+
+Mon Mar 16 07:39:35 2009 -0500 Hal Rosenstock
+090a3878d0b40ad96f425e133ffaff9c89d4df78
+
+	* opensm/osm_req.c: Update log message based on commit 3551389dcb7353ffd51c66e6ad518648bc1dd19e
+
+Mon Mar 16 13:17:20 2009 +0100 Line.Holen at Sun.COM
+47ac864dd3d46a7f1fdb2a73a599a175d4ade5c1
+
+	* opensm/osm_link_mgr.c: indentation fixes
+
+Mon Mar 16 13:17:20 2009 +0100 Line.Holen at Sun.COM
+c9f89d6a345ee77c2eed7dad146db5662913edb5
+
+	* opensm/osm_link_mgr.c Remove __osm_ prefix
+
+Mon Mar 16 10:33:25 2009 +0200 Eli Dorfman (Voltaire)
+5367fd481a53b8368ecc657c3ac5f3db2b828875
+
+	* opensm/osm_opensm.c: add newline to log message
+
+Sun Mar 15 11:22:17 2009 +0200 Yevgeny Kliteynik
+c682eb6ce2c0c455d973b3cb8d68d323531442c4
+
+	* opensm/osm_ucast_ftree.c: some refactoring
+
+Thu Mar 12 16:15:10 2009 +0200 Eli Dorfman (Voltaire)
+04a68b3843902bcbf0fe07848f4c61f7902f4c45
+
+	* opensm: set IS_SM bit during opensm init
+
+Thu Mar 5 16:54:56 2009 +0200 Eli Dorfman (Voltaire)
+f4ca5e8fd375f65fcf593f004a51272db951102a
+
+	* fix local port smlid
+
+Tue Mar 10 10:37:39 2009 +0100 Line.Holen at Sun.COM
+0f479394d48ecbe8d287e0eefdf20cb0db5df43c
+
+	* opensm/osm_link_mgr.c initialize SMSL
+
+Thu Mar 12 19:44:04 2009 +0200 Sasha Khapyorsky
+fda068daa2797645f2b83e1cfd637b562947fc21
+
+	* opensm/osm_ucast_ftree: indentation fixes
+
+Thu Mar 12 11:30:18 2009 +0200 Yevgeny Kliteynik
+9327299687f42661e1f245ef9083778536751349
+
+	* opensm/osm_ucast_ftree.c: remove __osm_ftree prefix in static functions
+
+Thu Mar 5 16:43:53 2009 +0200 Eli Dorfman (Voltaire)
+d7865bc5d9152971f646106048e233ab13d72cda
+
+	* send trap144 when local priority is higher than master priority
+
+Tue Mar 10 14:24:25 2009 -0500 Hal Rosenstock
+060822a6d67e1ea270947cae168c31cdbf39ae07
+
+	* opensm/osm_trap_rcv.c: Remove extraneous comment
+
+Thu Mar 12 14:02:32 2009 +0200 Yevgeny Kliteynik
+c875f3beb9cdec1f7eee48f2d0e4abedc67fd053
+
+	* opensm/osm_subnet.c: fixing compiler warnings
+
+Fri Mar 6 13:20:53 2009 -0500 Hal Rosenstock
+f00832993058f52e7c542f15a76901434922bcd7
+
+	* libvendor/osm_vendor_mlx_dispatcher.c: Eliminate no longer needed osmv_mad_is_response
+
+Fri Mar 6 13:19:48 2009 -0500 Hal Rosenstock
+9ff1ff5e41ec768193ca34fe188404d0183bbda2
+
+	* opensm: Handle trap repress on trap 144 generation
+
+Fri Mar 6 07:30:38 2009 -0500 Hal Rosenstock
+4af4c60ee89444b2636c6178afa4d8b5828ffd23
+
+	* Add pkey table support to osm_get_all_port_attr
+
+Mon Mar 9 06:01:17 2009 -0500 Hal Rosenstock
+0ae4f115fee131ad3938d0d277b93b790da83bac
+
+	* opensm/osm_inform.c: In __osm_send_report, make sure p_report_madw valid before using
+
+Mon Mar 9 06:00:20 2009 -0500 Hal Rosenstock
+2490de587450e2179ff07cda7c857f630d9edada
+
+	* opensm/osm_req.c: Shouldn't reveal port's MKey on Trap method
+
+Fri Mar 6 10:25:54 2009 -0500 Hal Rosenstock
+35b81e51e5e99c0569bb389c4b0a92e191731037
+
+	* opensm/PerfMgr: A few more esp0 changes
+
+Mon Mar 9 18:22:30 2009 +0200 Sasha Khapyorsky
+18a8edcd702e59bac9df23af74083ef50a312c7a
+
+	* opensm/osm_console_io.c: move cio_close() function
+
+Mon Mar 9 18:22:30 2009 +0200 Sasha Khapyorsky
+20944afaae491fd7f5ce5a13331e06b722283149
+
+	* opensm/console: move cio_open() function
+
+Mon Mar 9 16:00:51 2009 +0200 Sasha Khapyorsky
+f98635eb68b782933816982a2e1649b898edadda
+
+	* opensm: fix build warning with --disable-console-socket
+
+Mon Mar 9 11:30:36 2009 +0100 Nicolas Morey Chaisemartin
+dc0abaa899805951e5a03e649cd75c6144be31e4
+
+	* Fixed cio_close use when ENABLE_OSM_CONSOLE_SOCKET is not set
+
+Fri Feb 27 13:46:53 2009 -0500 Hal Rosenstock
+47e243b87541975265b8fc53f1d4bb5a9cc5e817
+
+	* opensm/infiniband-diags: Changes for C rather than C++ style comments
+
+Fri Mar 6 13:25:25 2009 +0200 Sasha Khapyorsky
+eed01b4228c397e377e3a56d04c78d3934676716
+
+	* opensm/osm_console_io.c: remove 'osm_' prefix from static function names
+
+Fri Mar 6 10:28:38 2009 +0100 Nicolas Morey Chaisemartin
+ca68c64bc1cd42a29761da1dbb0482357e463fed
+
+	* opensm/osm_console_io.h: Modify osm_console_exit so only the connection is killed, not the socket
+
+Fri Mar 6 10:17:42 2009 +0100 Nicolas Morey Chaisemartin
+4292d9531a9bf01886743438a06e398e047d659a
+
+	* opensm/console: Fixed osm_console poll to handle POLLHUP
+
+Wed Mar 4 10:12:28 2009 -0500 Hal Rosenstock
+f9e424fb512e00595b44d4e2797adac192f7533d
+
+	* opensm/osm_req.c: In osm_send_trap144, set producer type according to node type
+
+Wed Mar 4 10:11:38 2009 -0500 Hal Rosenstock
+74efcb0443acd42763263fcd150473afd5091183
+
+	* opensm/libvendor/osm_vendor_ibumad.c: In clear_madw, fix tid endian in message
+
+Wed Mar 4 09:58:53 2009 +0100 Nicolas Morey Chaisemartin
+40437e1cb005bdcb6e2fe45e8d7b255824731aa8
+
+	* opensm/osm_switch.h : Fixed wrong comment about return value of osm_switch_set_hops
+
+Tue Mar 3 14:03:04 2009 -0500 Hal Rosenstock
+7e18d9728b74790752aaf55e4baddfe21f123cab
+
+	* opensm/libvendor/osm_vendor_ibumad.c: Commentary changes
+
+Tue Mar 3 16:52:28 2009 +0100 Nicolas Morey Chaisemartin
+e3f366d03855820330e886ea0da485edde8f9fbb
+
+	* opensm/osm_ucast_ftree.c: Removed useless initialisation on switch indexes
+
+Tue Mar 3 10:25:08 2009 -0500 Hal Rosenstock
+96fb22c305af551704744a76178ee3f7095dd0b4
+
+	* opensm/osm_trap_rcv.c: Cosmetic changes
+
+Mon Mar 2 16:02:29 2009 -0500 Hal Rosenstock
+5c8d2b890078c3226a0f1f586c89b93937335106
+
+	* opensm/osm_state_mgr.c: Cosmetic commentary change
+
+Mon Mar 2 16:01:25 2009 -0500 Hal Rosenstock
+73b4dd52ad26b5e3fcb5f060797fedfa5c6a552f
+
+	* opensm/osm_port.h: Fix a commentary typo
+
+Mon Mar 2 07:03:57 2009 -0500 Hal Rosenstock
+f83b921a3e93b1e22570eb73521412bb259fff86
+
+	* opensm/ib_types.h: Add attribute ID for PortCountersExtended
+
+Mon Mar 2 07:03:06 2009 -0500 Hal Rosenstock
+0f9164169d00ea9d7adc1d8b52fd2698b8a156fe
+
+	* opensm: Return error status when cl_disp_register fails
+
+Fri Feb 27 16:18:51 2009 -0500 Hal Rosenstock
+ed0bd4d2969949ed49f39453fb9c964df564a1fc
+
+	* opensm/osm_perfmgr.c: Improve assert in osm_pc_rcv_process
+
+Fri Feb 27 13:45:57 2009 -0500 Hal Rosenstock
+b3a1f6ef7d12923614aa90dccd961bec345796ff
+
+	* opensm/osm_perfmgr.c: In osm_perfmgr_shutdown, add missing cl_disp_unregister
+
+Fri Mar 6 01:39:16 2009 +0200 Sasha Khapyorsky
+00c94003f08719243e75d063718cb56ef2a5db38
+
+	* osmtest: remove useless prototypes
+
+Sat Feb 28 16:29:44 2009 +0200 Sasha Khapyorsky
+e3b00f183ad15417732f89b0ecccf9b9780952ac
+
+	* opensm: remove casting of ib_smp_get_payload_ptr()
+
+Fri Feb 27 22:37:51 2009 +0200 Sasha Khapyorsky
+0757f05624acaaf52a0bf7988b8cb73076e99c52
+
+	* opensm: PortInfo requests for discovered switches
+
+Fri Feb 27 21:02:07 2009 +0200 Sasha Khapyorsky
+e43645e4a85bb21f5bb3603f46c9f5b79cb8246e
+
+	* opensm: remove unneeded anymore physp initializations
+
+Fri Feb 27 11:22:22 2009 +0200 Sasha Khapyorsky
+b3b68395b2846ba41d61e2255132b36587183302
+
+	* opensm: initialize all switch ports
+
+Thu Feb 26 06:40:25 2009 +0200 Sasha Khapyorsky
+14c8101f7db3b766214175ea87a2589076452b57
+
+	* opensm/osm_lid_mgr: use single array for used_lids
+
+Sun Mar 1 23:24:57 2009 +0200 Sasha Khapyorsky
+2b55e85d6def77f04ee0f87b62dc81ca132866de
+
+	* opensm/osm_ucast_mgr.c: code simplifications
+
+Wed Feb 25 15:09:32 2009 -0600 Dale Purdy
+4bdeb767b5cce5c2e970e9f64787107ae91ebf4a
+
+	* opensm: Implement weighted routing
+
+Sat Feb 28 19:22:10 2009 +0200 Sasha Khapyorsky
+2cd1dc194e297f750330759a5fad91a6777050b8
+
+	* opensm/osm_console.c: kill warning: defined but not used
+
+Fri Feb 27 20:39:31 2009 +0200 Sasha Khapyorsky
+77bb9f7680fb5785ac8428b49bcf5b69fdb2b82f
+
+	* opensm: indentation fixes
+
+Thu Feb 12 10:11:42 2009 +0100 Nicolas Morey Chaisemartin
+f82758a013c78dbbddc2a5e502df5956d0fec77b
+
+	* Added documentation for io_guid_file and max_reverse_hop feature
+
+Thu Feb 12 10:11:38 2009 +0100 Nicolas Morey Chaisemartin
+d3af5aa1267e437741e0ec14f8bfcc6f1128a7e1
+
+	* opensm/osm_ucast_ftree.c: Added possible reverse hops for Ftree algorithm.
+
+Sat Feb 28 20:54:10 2009 +0200 Sasha Khapyorsky
+77e48585d573e131f41fdf9fa48ba8f4ac81e399
+
+	* opensm/main.c: cosmetic
+
+Fri Feb 13 10:24:24 2009 +0100 Nicolas Morey Chaisemartin
+e4d904545a41cdc50ec021c667b53f2254cd0df6
+
+	* opensm: Added io_guid_file and max_reverse_hops options
+
+** Version: opensm-3.3.1
+
+Sat Feb 28 18:50:54 2009 +0200 Sasha Khapyorsky
+8d6b3c808a6233f41e3d5a53e758de14b02fe68f
+
+	* management: bump all package versions
+
+Sat Feb 28 18:48:45 2009 +0200 Sasha Khapyorsky
+db59b192187cfd4efca46ebbeb7d0649f0da5ac9
+
+	* opensm: OpenSM Release Notes for 3.3
+
+Thu Feb 26 14:22:14 2009 +0200 Yevgeny Kliteynik
+d26c00df248cfe8abae1c02eb80131b31395a583
+
+	* opensm/osm_node_info_rcv.c: create physp for the newly discovered port of the known node
+
+Wed Feb 25 21:59:16 2009 +0200 Sasha Khapyorsky
+e87fc63721ce4fdc701fa578d56f2ca588ff565e
+
+	* opensm/osm_lid_mgr.c: consolidate flows
+
+Tue Feb 24 20:59:43 2009 +0200 Sasha Khapyorsky
+ee2054519aa9bda76b823bfbdf72f113970902e7
+
+	* opensm/sweep: add log message before lid assignment
+
+Tue Feb 24 21:03:51 2009 +0200 Sasha Khapyorsky
+4de6dc4496a65fd084149df8ad86ca193fc9f0ab
+
+	* opensm/lid_mgr: simplify lmc_mask initialization
+
+Wed Feb 25 19:25:25 2009 +0200 Sasha Khapyorsky
+d4475fae9b1742c6e21ecf854b46e8cf6e31365d
+
+	* opensm/lid_mgr: fix duplicated lid assignment
+
+Thu Feb 19 08:06:53 2009 -0500 Hal Rosenstock
+3197a3e95a7969e70110ff6fe73ab5492a493579
+
+	* opensm/console: Enhance perfmgr print_counters for better nodenames
+
+Wed Feb 18 10:32:27 2009 -0500 Hal Rosenstock
+67e12b64edac65d598af7a3edddcfa32a43fdfbe
+
+	* opensm/osm_console.c: Improve perfmgr print_counters error message
+
+Thu Feb 19 13:44:15 2009 -0500 Hal Rosenstock
+cc899896b0cc21128b9e35f0bd4c3bce660c8882
+
+	* opensm/man/opensm.8.in: Indicate ROUTER_EXP obsoleted
+
+Wed Feb 18 10:10:15 2009 -0500 Hal Rosenstock
+6d10e3acf64cb21ddcc4c95f77ef8989029e50a9
+
+	* opensm/osm_inform.c: Fix sense of zero GID compare in __match_inf_rec
+
+Sun Feb 15 09:05:00 2009 +0200 Sasha Khapyorsky
+ba797e690d517856e94cc00a45785068b092ae31
+
+	* opensm/Makefile.am: remove osm_build_id.h junk file generation
+
+Tue Feb 24 16:31:42 2009 +0200 Sasha Khapyorsky
+50003a932835b912caf2a49b008e588b41c4131f
+
+	* opensm/osm_qos.c: cosmetic: remove empty line
+
+Mon Feb 23 19:01:00 2009 +0200 Sasha Khapyorsky
+fa4b5d3f931670bed502abea28d76fbedf509f64
+
+	* opensm/main.c: remove enable_stack_dump() call
+
+Mon Feb 23 18:38:57 2009 +0200 Sasha Khapyorsky
+e75970c26ffe4d8c023cf52bb05d819d31e93baa
+
+	* opensm/osm_subnet: fix crash in qos string config parameters reloading
+
+Tue Feb 17 14:57:10 2009 +0200 Sasha Khapyorsky
+9623c29be8d1e0cad8e6f373a77f01ed0f881c98
+
+	* opensm: proper config file rescan
+
+Thu Feb 12 22:43:46 2009 +0200 Sasha Khapyorsky
+d464d2e131a29e78015f1a5a580a2aec79a59463
+
+	* opensm/osm_subnet.c: move parse and setup functions
+
+Sun Feb 15 11:23:42 2009 +0200 Sasha Khapyorsky
+35308996a2d13161bac231f30e0a129d11565d15
+
+	* opensm: pre-scan command line for config file option
+
+Tue Feb 17 20:38:15 2009 +0200 Sasha Khapyorsky
+91d317ca8bb62af4bac81aef732ed311eae6293f
+
+	* opensm/console/dump_portguid: minor improvements
+
+Tue Feb 17 19:18:05 2009 +0200 Sasha Khapyorsky
+010546cd6e1729a169bdf5983eb37c0348bc59c3
+
+	* opensm/console: dump_portguid - don't duplicate matched guids
+
+Tue Feb 17 19:13:28 2009 +0200 Sasha Khapyorsky
+b33baaacfe8b63fd9b168a38c2a356287038c054
+
+	* opensm/console: dump_portguid command fixes
+
+Sat Feb 14 08:55:50 2009 -0500 hnrose at comcast.net
+f1b7754f86835351cb87f19d2f3ee26bc0a16c51
+
+	* opensm/osm_console.c: Add missing command in help_perfmgr
+
+Sat Feb 14 08:55:04 2009 -0500 hnrose at comcast.net
+b075d0c3a36fff1c5dac54187d52e013fc69b421
+
+	* opensm/osm_console.c: Eliminate some extraneous parentheses
+
+Sat Feb 14 08:54:09 2009 -0500 hnrose at comcast.net
+6b023f9de2b3f3f344973f93cb494ed8f376bf83
+
+	* opensm/osm_console.c: Add list of SMs to status command
+
+Sat Feb 14 08:53:08 2009 -0500 hnrose at comcast.net
+94179b2759b1bae02dcf8aec70a849766cd33f49
+
+	* opensm/osm_helper.c: Add port counters to __osm_disp_msg_str
+
+Sat Feb 14 08:51:39 2009 -0500 hnrose at comcast.net
+0fff93ccb764951174e8649999422d5ae8635517
+
+	* opensm/osm_ucast_mgr.c: Add error numbers for some OSM_LOG prin
+
+Fri Feb 13 11:31:02 2009 -0800 Ralph Campbell
+440e24270f0a4eb9c77643f4a3e4ae7dac51ec7d
+
+	* opensm: fix structure definition for trap 257-258
+
+Thu Feb 12 17:01:22 2009 +0200 Yevgeny Kliteynik
+26c456a0688690db7ccab7cae616fb13ada2a5ba
+
+	* opensm/osm_state_mgr.c: small bug in scanning lid table
+
+Thu Feb 12 16:55:39 2009 +0200 Yevgeny Kliteynik
+da5b0e827f03e090e182471fb036a4bc1e95ae80
+
+	* opensm/osm_sa.c: fixing SA MAD dump
+
+Thu Feb 12 07:46:27 2009 +0100 Nicolas Morey Chaisemartin
+70f8e86bc770cf328ddc254357045a13cc83e9e4
+
+	* opensm/osm_console.c : Added dump_portguid function to console to generate a list of port guids matching one or more regexps
+
+Wed Feb 11 02:09:10 2009 +0200 Sasha Khapyorsky
+c1914a050da71741ac75c4ba68bba0ee171142b6
+
+	* opensm/osm_helper.c: print port number as decimal
+
+Wed Feb 11 16:02:25 2009 +0200 Sasha Khapyorsky
+aaf96c7e70580747216afcbb20cff64a13be6ee4
+
+	* opensm/ftree: make unsigned sw->down_port_groups_idx
+
+Tue Feb 10 10:53:21 2009 +0100 Nicolas Morey Chaisemartin
+7a7fd843f95830921eac3fc792b1d2de516c3298
+
+	* opensm/osm_ucast_ftree.c Fixed bad init value for down port index
+
+Sat Feb 7 22:54:09 2009 +0200 Sasha Khapyorsky
+d759edd66210de9e30da99559a167e096e3f56d3
+
+	* opensm/ftree: simplify root guids setup.
+
+Sat Feb 7 22:30:21 2009 +0200 Sasha Khapyorsky
+c129b209e311b3816c891bcf4464f52bdfef6e03
+
+	* opensm/ftree: cleanup ftree_sw_tbl_element_t use
+
+Tue Jun 24 23:25:03 2008 +0300 Sasha Khapyorsky
+e6fedcf8aaa416f9dc570f745e2d0ab59896f1eb
+
+	* opensm: sort port order for routing by switch loads
+
+Sun Feb 8 16:43:47 2009 +0200 Sasha Khapyorsky
+067ed0bb2bba402fbf0bacf1457d8ca8a77fd201
+
+	* opensm/qos_config: no invalid option message on default values
+
+Sat Feb 7 11:13:49 2009 +0200 Sasha Khapyorsky
+bc9974a8351f1f6721f865d108d780b70a6221d8
+
+	* opensm: avoid memory leaks on config parameters reloading
+
+Mon Feb 9 21:40:56 2009 +0200 Sasha Khapyorsky
+09d6f1fc4671885ce61dd07e0b2f2cececa527cc
+
+	* opensm/osm_ucast_ftree.c: cosmetic improvements
+
+Mon Feb 9 16:55:46 2009 +0100 Nicolas Morey Chaisemartin
+16fbeca1b04e50b7e1407c36cab55e8ee4ab50e7
+
+	* opensm/osm_ucast_ftree.c: Fixed bug on index port incrementation
+
+Sat Feb 7 11:25:37 2009 +0200 Sasha Khapyorsky
+e9da67614a231feb3d5344568271bcca1dbc1ff3
+
+	* opensm/osm_subnet.c: break matching when config parameter already found
+
+Sat Feb 7 11:10:45 2009 +0200 Sasha Khapyorsky
+f19d6774e1f06e3d9700739150bef11d8854ceab
+
+	* opensm/osm_subnet.c: clean_val() remove trailing quotation
+
+Thu Feb 5 21:36:20 2009 +0200 Sasha Khapyorsky
+007a9a9802527d56c4df404b41183967aeedb4ac
+
+	* opensm/osm_subnet.c: indentation fixes
+
+Thu Feb 5 21:06:30 2009 +0200 Sasha Khapyorsky
+5d307883ed94eac8570c7a66a8f7a452597a7c9b
+
+	* opensm/ib_types.h: cosmetic
+
+Tue Feb 3 16:11:46 2009 +0200 Sasha Khapyorsky
+9deb852381e686385c595909db81fd070b166596
+
+	* opensm: rescan config file even in standby
+
+Thu Feb 5 16:42:23 2009 -0700 Hal Rosenstock
+c5a768a4f61c64089568b7f86933e6888a630d48
+
+	* opensm/PerfMgr: Add copyrights
+
+Thu Feb 5 16:41:39 2009 -0700 Hal Rosenstock
+757c575b3ec2788ddfdd745c26b4fa61c96c5869
+
+	* opensm/doc/perf-manager-arch.txt: Fix some commentary typos
+
+Thu Feb 5 17:19:41 2009 +0200 Eli Dorfman (Voltaire)
+647b4dc4c5feea2b76b6c4b3f1eeadc42cb02497
+
+	* opensm/osm_subnet.c fix parse functions for big endian machines
+
+Thu Feb 5 17:00:19 2009 +0200 Eli Dorfman (Voltaire)
+cdd3e99fb4351a001f743140a3261cc6a9bac55f
+
+	* opensm/osm_subnet.c enable log_max_size opt update
+
+Thu Feb 5 02:27:02 2009 +0200 Sasha Khapyorsky
+3dabcba672a1e9f6a826195c1abdc77e590f271f
+
+	* opensm/osm_perfmgr.c: kill some redundant tests
+
+Wed Feb 4 15:06:06 2009 -0700 Hal Rosenstock
+d3b2048dc8c7e3086bafdc635af0defcc6260714
+
+	* opensm/PerfMgr: Primarily fix enhanced switch port 0 perf manager operation
+
+Thu Feb 5 02:13:15 2009 +0200 Sasha Khapyorsky
+eaf050cc4f2283990ef2f5dd705b96aa277a182a
+
+	* opensm/osm_sw_info_rcv.c: cosmetic changes
+
+Wed Feb 4 14:26:08 2009 -0700 Hal Rosenstock
+ac3458136c300650afa27eb3b183cdaa8ccc545f
+
+	* opensm/osm_node.h: Fix osm_node_get_num_physp description
+
+Wed Feb 4 09:15:10 2009 -0700 Hal Rosenstock
+9ff29b35b215f98bc74a754ef1b83afc9ac0a576
+
+	* opensm/PerfMgr: Mainly cosmetic changes
+
+Wed Feb 4 09:14:48 2009 -0700 Hal Rosenstock
+c390c99b0d36fe8d1ece1d17c6042826a06dd636
+
+	* opensm/include/iba/ib_types.h: Add xmit_wait for PortCounters
+
+Wed Feb 4 19:39:11 2009 +0200 Sasha Khapyorsky
+ea66d7bcbcaa5e8f2d339806d3a8315134b6139c
+
+	* opensm/main.c: indentation fixes in get_port_guid()
+
+Wed Feb 4 19:33:43 2009 +0200 Sasha Khapyorsky
+4b3e45f4ae6e7fdb231b10361463659b366b37b7
+
+	* opensm: fix port chooser
+
+Wed Feb 4 17:39:25 2009 +0200 Sasha Khapyorsky
+e3b8ffddbf2525a35685821a7c4ffd76dba594e7
+
+	* opensm/osm_subnet.c: fix compile warnings
+
+Mon Feb 2 13:35:40 2009 -0500 Hal Rosenstock
+8994f42cea596026ddd8dedb2d942b37c5f36dac
+
+	* opensm/osm_perfmgr.c: In osm_perfmgr_init, eliminate memory leak on error
+
+Mon Feb 2 12:06:50 2009 -0700 Hal Rosenstock
+731ee768e39dc77b20d862c6d8fe698251445cce
+
+	* opensm/osm_perfmgr_db.h: Remove unused typedef
+
+Mon Jan 26 16:34:36 2009 +0200 Eli Dorfman (Voltaire)
+b7e8b4909d883b153040e8c17fa8cff0412398a1
+
+	* opensm/osm_subnet.c support subnet configuration rescan and update
+
+Mon Jan 26 16:33:26 2009 +0200 Eli Dorfman (Voltaire)
+0bf7016b5b80daa951204c209e5dc26ebefe7fe9
+
+	* opensm/osm_log.c save log_max_size in subnet opt in MB
+
+Thu Jan 29 17:35:42 2009 +0200 Yevgeny Kliteynik
+183f8529a4b5330e0cf750a282ed2b21010aa49f
+
+	* opensm/osm_ucast_ftree.c: fix full topology dump
+
+Tue Jan 20 13:01:29 2009 +0200 Sasha Khapyorsky
+bddee2f475eed1d03f6f69324efdfade137b7b17
+
+	* opensm/osm_subnet.c: fix warnings in subn_free_qos_options()
+
+Sun Jan 11 22:39:52 2009 +0200 Sasha Khapyorsky
+6a2d48cb93bf354adf8ac362f4ee2e172c893727
+
+	* opensm: invalidate routing cache when entering master state
+
+Tue Jan 13 18:01:19 2009 +0200 Eli Dorfman (Voltaire)
+776392dd306413cb836be76e0196f51fe02fe761
+
+	* docs update documenatation about new partition keywords
+
+Tue Jan 13 18:00:17 2009 +0200 Eli Dorfman (Voltaire)
+51ebd3f2d9ab3bbacf0c55d52d5bdf9cf4cee9f8
+
+	* opensm: Add new partition keyword for all hca, switches and routers
+
+Sun Jan 11 22:51:41 2009 +0200 Sasha Khapyorsky
+4de079bd1667e91ae71d87cda5151ca9017ac826
+
+	* opensm/osm_subnet.c: drop some unneeded braces
+
+Sun Jan 11 22:39:52 2009 +0200 Sasha Khapyorsky
+49cd60e6c02fd2db564482eeac1360542aef4ad3
+
+	* opensm: update LFTs when entering master
+
+Thu Jan 1 10:57:26 2009 +0200 Yevgeny Kliteynik
+323fe46af58fec5715ecef51837b77c411f02925
+
+	* opensm/osm_port_info_rcv.c: don't clear sw->need_update if port 0 is active
+
+Sun Dec 21 13:54:02 2008 +0200 Eli Dorfman (Voltaire)
+4074969cb4461d9e19ff69b335787ae2c091074a
+
+	* opensm/osm_subnet.c Fix memory leak for QOS string parameters.
+
+Mon Dec 22 00:32:25 2008 +0200 Sasha Khapyorsky
+5c9bf9d224b493394178b72462c7eab1ee2f09c9
+
+	* opensm: remove libibcommon build dependencies
+
+Thu Dec 25 17:14:37 2008 +0200 Sasha Khapyorsky
+b6219f5e4b2b9ca8d624c8217aa202f9108410d4
+
+	* opensm/opensm.spec: fix event plugin config options
+
+Mon Dec 22 05:05:46 2008 +0200 Sasha Khapyorsky
+0776abe145ebeca7875ed4c9710829720c5767d9
+
+	* opensm/lash: simplify some memory allocations
+
+Mon Dec 22 05:05:46 2008 +0200 Sasha Khapyorsky
+fcde1c3b14723d47e0cfeef60b540f55ffa64a3e
+
+	* opensm/osm_mesh: simplify mesh node links and ports allocation
+
+Mon Dec 22 04:54:48 2008 +0200 Sasha Khapyorsky
+00c27383f473cf7185d3f9e1fa757e155d7c3175
+
+	* opensm/osm_mesh: make mesh_info static and const
+
+Thu Dec 18 16:48:13 2008 -0800 Ira Weiny
+ba3bb388f8a468650772b3e9d1f92acb96e44d69
+
+	* OpenSM: update osmeventplugin example for the new TRAP event.
+
+Sat Dec 20 21:50:01 2008 +0200 Sasha Khapyorsky
+6cd48d727523a2fc2f6ffc3c5c4a7ff630961f42
+
+	* opensm/lash: fix memory leaks
+
+Mon Dec 15 15:55:50 2008 -0600 Robert Pearson
+84ca9fefcdd5acd4e5f339ed9848b4334ad3c30b
+
+	* mesh analysis - integrate into lash core
+
+Wed Dec 10 12:49:45 2008 -0600 Robert Pearson
+e3cbaf369ccebef5a9d7a625947d8c36776557b3
+
+	* mesh analysis - lash preparation
+
+Sat Dec 20 21:26:58 2008 +0200 Sasha Khapyorsky
+6d8782c5b31790d0f938c425d2b1c5805c766e88
+
+	* opensm/mesh: fix memory leaks
+
+Wed Dec 10 12:44:41 2008 -0600 Robert Pearson
+5887f5fa794f7be8d005abcbff3ae97c678065ce
+
+	* mesh analysis - reorder links
+
+Wed Dec 10 12:40:33 2008 -0600 Robert Pearson
+f51baee74861a1654d5c586514a4193eb3ee75a2
+
+	* mesh analysis - induce global geometry
+
+Wed Dec 10 12:36:20 2008 -0600 Robert Pearson
+d31ced4c5deb0448954db5214bc9dd194a698d01
+
+	* mesh analysis - mesh info table
+
+Mon Dec 15 15:55:30 2008 -0600 Robert Pearson
+b41e3a08fe76cb9603b4720594f106e9de6a4212
+
+	* mesh analysis - local geometry
+
+Wed Dec 10 12:18:26 2008 -0600 Robert Pearson
+f9332ca40d638c0fffd39b5870627a9323674142
+
+	* mesh analysis - matrix/polynomial routines
+
+Mon Dec 15 15:29:12 2008 -0600 Robert Pearson
+250cd623361320bc0d145c9b4cbd745f423ca4c2
+
+	* mesh analysis - node and link structures
+
+Wed Dec 10 12:00:21 2008 -0600 Robert Pearson
+15f52ea545ab5db97190480f6a992dcb027f212b
+
+	* mesh analysis - mesh_t data structure
+
+Fri Dec 19 17:30:52 2008 +0200 Sasha Khapyorsky
+631ad07f1366db5603303c923b7c316b9ac1ca45
+
+	* opensm: add do_mesh_analysis configuration parameter
+
+Fri Dec 19 17:07:01 2008 +0200 Sasha Khapyorsky
+3c8697856fd8008271077a880c57e029f6f1831c
+
+	* opensm/man/opensm.8.in: add descrition for --do_mesh_analysis option
+
+Wed Dec 10 11:49:34 2008 -0600 Robert Pearson
+76022d3329b5a3e1d1ea98b4168ea90415ac3323
+
+	* mesh analysis - skeleton
+
+Fri Dec 19 17:28:27 2008 +0200 Sasha Khapyorsky
+fc80293ab6c18a3d37baa32a911a3741138cb921
+
+	* opensm/osm_subnet.c: indentation fixes
+
+Tue Dec 16 09:56:44 2008 +0200 Sasha Khapyorsky
+c38896bde819e1aa30a3d6293ea8bdb492533199
+
+	* opensm/vendor: save some stack memory
+
+Thu Dec 18 14:03:47 2008 -0600 Mike Heinz
+85bf1aeb88b6ad0e8342e744b3061a4c000cc321
+
+	* opensm/osm_vendor_*_sa: fix incompatibility with QLogic SM
+
+Wed Dec 17 17:00:54 2008 +0200 Yevgeny Kliteynik
+ee3953d86cf15edba3563c767e9108d0b84254dd
+
+	* opensm/osm_ucast_ftree.c: fixing errors in comments
+
+Wed Dec 17 13:44:36 2008 +0100 Nicolas Morey Chaisemartin
+29252ba700bae77cc151deefa3ca90f0f265fd29
+
+	* Corrected incoherency in __osm_ftree_fabric_route_to_non_cns comments
+
+Wed Dec 17 09:57:43 2008 +0200 Sasha Khapyorsky
+e4d7d6d44b8fbee6e1e9ac13a562fc6c38b3456e
+
+	* opensm/event_plugin: link opensm with -rdynamic flag
+
+Tue Dec 16 10:44:20 2008 -0700 Hal Rosenstock
+6c5191a6e626b7d452c2335eaebb368db669d00d
+
+	* opensm/osm_inform.c: Eliminate compile warning
+
+Wed Dec 10 03:02:38 2008 +0200 Sasha Khapyorsky
+b554626457e943de29e469d4be0f00c20bfda4b1
+
+	* opensm/osm_subnet: consolidate some duplicated code
+
+Tue Dec 9 16:11:29 2008 +0200 Sasha Khapyorsky
+e572a441ffad8e93ad8634aa2b2e42f8eedadcdf
+
+	* opensm/multicast: remove some unused parameters.
+
+Tue Dec 16 14:10:59 2008 +0200 Eli Dorfman
+fcde862e8c5705ced3d88d4fff70321aa794384b
+
+	* opensm/osm_inform.c report IB traps to plugin
+
+Mon Dec 15 11:22:11 2008 -0700 Hal Rosenstock
+77065358e4c068be727430662a8edf0b62b1f295
+
+	* opensm/libvendor/osm_vendor_sa_api.h: Fix commentary typo
+
+Sun Dec 7 15:51:13 2008 +0200 Sasha Khapyorsky
+0981c61f423ff668f90ef502f5735ff19730ddf0
+
+	* opensm/osm_sa_mcmember_record: improve __cleanup_mgrp()
+
+Sun Dec 7 15:46:55 2008 +0200 Sasha Khapyorsky
+b2485f60a6597ccefe30c327037da7c38709b9e4
+
+	* opensm/osm_sm.c: fix MC group creation in race condition
+
+Mon Dec 15 00:42:28 2008 +0200 Sasha Khapyorsky
+ed9d2b7a9625445b213bde4fc109083075704c12
+
+	* opensm: remove unused header osm_pkey_mgr.h
+
+Wed Dec 10 02:27:59 2008 +0200 Sasha Khapyorsky
+4560b5c56232585153213d2cb751158ee8de0e07
+
+	* opensm/osm_ucast_mgr: indentation fix
+
+Wed Dec 10 02:21:09 2008 +0200 Sasha Khapyorsky
+d4824ea819dd4b2e51272afa176f249c437055d8
+
+	* opensm: remove some unused variables and funcs
+
+Fri Dec 12 16:57:12 2008 -0800 Ira Weiny
+e5ac1e0b6b8d1d7e95aa247888a6231c06e8a046
+
+	* opensm/opensm/osm_console.c: move reporting of plugins to "status" command.
+
+** Version: opensm-3.3.0
+
+Sat Dec 13 19:46:15 2008 +0200 Sasha Khapyorsky
+a2e562802f3852e4bbab8ee00a80393b44a6a438
+
+	* management: bump all package versions
+
+** Version: opensm-3.2.5
+
+Sun Dec 7 00:16:36 2008 +0200 Sasha Khapyorsky
+47411f0d2a132ba27840a92c741593b1a16fc5a6
+
+	* management: update package versions
+
+Sun Dec 7 00:12:59 2008 +0200 Sasha Khapyorsky
+30538d838ae1c9695aa8747a28ff2babd193cad0
+
+	* opensm: Release Notes update for next version (3.2.5)
+
+Sat Dec 6 14:00:49 2008 +0200 Sasha Khapyorsky
+f740b7557effa5b9f8926420027901a7c1fc3cee
+
+	* opensm: add RN to distributed docs list
+
+Thu Dec 4 20:40:58 2008 +0200 Sasha Khapyorsky
+e7b586d7998be4040dd7176a75c8fbb7dfb96e20
+
+	* opensm: fix race in main OpenSM flow.
+
+Wed Dec 3 15:47:15 2008 +0100 Nicolas Morey Chaisemartin
+05a22c3efaee765a5d2cc9fb723aab538b03070d
+
+	* OpenSM: Fixed GUID check against cn_guid_file usinf Ftree.
+
+Thu Dec 4 07:01:24 2008 -0700 Hal Rosenstock
+22f42a98cd1179e543ab72f84daa386030a3203c
+
+	* opensm/osm_lid_mgr.c: Commentary fix
+
+Thu Dec 4 18:18:32 2008 +0200 Sasha Khapyorsky
+56d1d4a9cd8bd31f0595a162b15e739a4141023b
+
+	* opensm: more 3.2.4 related things for RN
+
+Thu Dec 4 14:58:17 2008 +0200 Yevgeny Kliteynik
+c80e7482bb9361d739ef3c752fc74b3501bf7461
+
+	* opensm: release notes for OSM 3.2.4
+
+Mon Dec 1 11:43:47 2008 -0700 Hal Rosenstock
+4ce5d42aea6e3888e9415ee7977d087e81be5638
+
+	* opensm/osm_prefix_route.h: prefix and guid are in network rather than host endian order
+
+Mon Dec 1 22:48:35 2008 +0200 Sasha Khapyorsky
+48d8d72c72001b115e1b7712858fc740afb3e80c
+
+	* opensm/osm_sa_path_record.c: minor indentation fix
+
+Mon Nov 24 12:06:59 2008 -0700 Hal Rosenstock
+447461926bdcef898f2b5a99e0bce353e2097f8e
+
+	* opensm.8.in: Update email address
+
+Mon Nov 24 20:26:20 2008 +0200 Sasha Khapyorsky
+2acb3cee52d2a59c82ad795ab62060eb42544780
+
+	* opensm/man/opensm.8: add some missing stuff
+
+Sun Nov 23 13:05:37 2008 +0200 Sasha Khapyorsky
+2aa3c4f5eb6286b05286c3e2b33ace71a5f4ac15
+
+	* opensm/ftree: save lft_buf memory allocations
+
+Mon Nov 24 10:08:10 2008 +0200 Sasha Khapyorsky
+c6bbf7c22411a5bc653c3b73dbb10218f6361286
+
+	* opensm: fix possible crash when disabling babbling port
+
+Sun Nov 23 19:52:54 2008 +0200 Sasha Khapyorsky
+4ea0a2bdb6beade085d65f720a6f2f2c75ac41e8
+
+	* opensm: rename switch lft_buf to new_lft
+
+Sun Nov 23 13:00:13 2008 +0200 Sasha Khapyorsky
+dea17e8fe89ed5544672597f0c569d4325caca0e
+
+	* opensm: free lft_buf right after use
+
+Wed Nov 19 22:56:19 2008 +0200 Sasha Khapyorsky
+1300e4f4c10768531cf728d8aa7a0294849d7c61
+
+	* opensm: remove osm_node_get_any_physp_ptr() function
+
+Wed Nov 19 22:56:19 2008 +0200 Sasha Khapyorsky
+1d6024cabc84230d929e729ee8f1f758967fbca9
+
+	* opensm: remove osm_node_get_any_dr_part_ptr() function
+
+Wed Nov 19 22:56:19 2008 +0200 Sasha Khapyorsky
+db21a1a0bc9dfb96eb59d689d503abb141d0ac5b
+
+	* opensm/osm_sw_info_rcv: eliminate osm_node_get_any_physp_ptr() use
+
+Sat Nov 22 13:32:29 2008 +0200 Sasha Khapyorsky
+056a9af2ef9b5ef95af43f1f428456bfe1173f63
+
+	* opensm/osm_sa_link_record: prevent potential endless recursion
+
+Sat Nov 22 14:31:59 2008 +0200 Sasha Khapyorsky
+a6a40d04f20191863834562898c742821134e849
+
+	* opensm: remove function names in OSM_LOG() string
+
+Thu Nov 20 10:00:38 2008 +0200 Eli Dorfman
+daddf54023d15685d29bff1248945d99046a482e
+
+	* opensm/osm_trap_rcv.c disable the port with the least hop count
+
+Thu Nov 20 10:33:19 2008 +0200 Yevgeny Kliteynik
+9ff8d110c85c35e0ba23b1c5599b3a6090b523a7
+
+	* opensm/osm_state_mgr.c: bug fix in unicast cache
+
+Wed Nov 19 11:55:07 2008 -0700 Hal Rosenstock
+f86976d1a6fd7a2c75cda4f9a9b5426b4075da3b
+
+	* opensm/osm_port_info_rcv.c: Remove SM from sm_guid_tbl when IsSM is not
+
+Wed Nov 19 11:43:14 2008 +0200 Yevgeny Kliteynik
+c54550360c28f5be6307cb6858551c6949e112e3
+
+	* opensm/osm_lid_mgr.c: cosmetics in log message
+
+Tue Nov 18 14:36:15 2008 +0200 Sasha Khapyorsky
+bce431e8ca5eb5c91825b9984607e1d526062ee3
+
+	* opensm: disable switch ports only
+
+Sun Nov 16 19:15:37 2008 +0200 Sasha Khapyorsky
+b7dcbfdcce3d1672fff6f5ddd6a7ee057aed3ec4
+
+	* opensm/osm_trap_rcv.c: separate port disabling code
+
+Wed Nov 19 19:45:30 2008 +0200 Sasha Khapyorsky
+50541a20e1d351e414fa24ae577634500e604e7f
+
+	* opensm: fix QoS config bug
+
+Tue Nov 18 12:31:28 2008 +0200 Sasha Khapyorsky
+1bc50be78358e9ccb495622f8f5c943488c2aa12
+
+	* opensm/osm_subnet: don't reassign zeroed config params
+
+Tue Nov 18 12:26:43 2008 +0200 Sasha Khapyorsky
+958329e2aaaeb0040489182c3dcb20ab1b7d28fa
+
+	* opensm/osm_subnet.c: fix high_limit sign when printing
+
+Tue Nov 18 11:47:23 2008 +0200 Sasha Khapyorsky
+d6df89bfa70e3c37d4345aa3e2acea647f48de6b
+
+	* opensm/osm_sa_sminfo_record: remove unused variable
+
+** Version: opensm-3.2.4
+
+Tue Nov 18 06:20:46 2008 +0200 Sasha Khapyorsky
+3517a206b6cd732724f7d077f8394c64fc61001a
+
+	* management: update versions
+
+Sun Nov 16 18:43:40 2008 +0200 Sasha Khapyorsky
+5861b191566140ee08636a6e6cc4db9f503cf98f
+
+	* opensm/osm_trap_rcv.c: kill some empty lines
+
+Mon Nov 17 14:58:10 2008 +0200 Yevgeny Kliteynik
+67d784bb61b722d09ed258a3f0948c043b09e83d
+
+	* opensm/osmtest: fixing some comments in mcast flow of osmtest
+
+Mon Nov 17 14:56:28 2008 +0200 Yevgeny Kliteynik
+66add2b091274925929868ef6a14c9a55a089170
+
+	* opensm/osm_sa_mcmember_record.c: bad return state when leaving mcast
+
+Sun Nov 16 11:37:34 2008 -0700 Hal Rosenstock
+6d1d2c205112ec13c923b98a1085898a476e0613
+
+	* opensm/osm_trap_rcv.c: Fix typo
+
+Fri Nov 14 14:28:48 2008 -0800 Ira Weiny
+07a8768bad6b829e712c24f8ac6ece97dd6940a3
+
+	* opensm: Add check for previous versions of plugins.
+
+Mon Nov 10 13:41:04 2008 -0800 Al Chu
+8c892da68b1a38ad42f793390aa588c75ee18c9d
+
+	* fix qos config parsing bugs
+
+Fri Nov 14 00:22:35 2008 +0200 Yevgeny Kliteynik
+8308f09496c6bfa35fb72cc98c02a95ef8441db0
+
+	* opensm/osm_lid_mgr.c: ignore and overwrite guid2lid (windows)
+
+Sun Nov 16 13:08:04 2008 +0200 Eli Dorfman
+5de254a517852659daf9711a8e2f4a35e110083f
+
+	* opensm/osm_sa_mcmember_record.c print multicast lid in error message
+
+Sun Nov 16 13:06:17 2008 +0200 Eli Dorfman
+ef86ebcda1d16ab79b24bcbe1e19596bc5baf38f
+
+	* opensm/osm_mcast_tbl.c wrong max mcast lid cause the sm to set invalid MFT block.
+
+Thu Nov 13 16:23:25 2008 +0200 Yevgeny Kliteynik
+760d12d5b735324428475c2ae2c069eadfbc3c68
+
+	* osmtest/osmt_multicast.c: some refinements to the multicast flow
+
+Thu Nov 13 11:18:07 2008 +0200 Eli Dorfman
+140c9583668188961c24211dfc74c6e680520a6c
+
+	* opensm/osm_sa_path_record.c print port guids in error message
+
+Thu Nov 13 07:36:19 2008 +0200 Sasha Khapyorsky
+f9829101bd58e44e1e159818752d7550485fadf4
+
+	* opensm/osm_sa_mcmember_record: simplify query code
+
+Thu Nov 13 04:02:18 2008 +0200 Sasha Khapyorsky
+cd14f542644f2c201bc0ab09332e75c350ec828e
+
+	* opensm/osm_sa_mcmember_record: return a real port JoinState on update
+
+Thu Nov 13 02:08:58 2008 +0200 Sasha Khapyorsky
+6adaa1d914d7d8c6d5cb0933f2bdb2f65999c890
+
+	* opensm/osm_subnet.c: move osm_subn_rescan_conf_files() function
+
+Thu Nov 13 01:22:57 2008 +0200 Sasha Khapyorsky
+d41516bdb2ba98fcf19d239c66ae6cb1e6bc47ef
+
+	* opensm/osm_subnet.c: consolidate qos parameters verification code
+
+Thu Nov 13 01:20:07 2008 +0200 Sasha Khapyorsky
+43e260a2755fd9ff1899746ec9ca7c6b4dc9ec44
+
+	* opensm/osm_subnet.c: use strdup() function
+
+Thu Nov 13 00:57:23 2008 +0200 Sasha Khapyorsky
+b304ddb2276cd145d1b5c1d05956b6a9a3e79d05
+
+	* opensm/osm_subnet.c: consolidate logging code
+
+Mon Nov 10 13:13:55 2008 -0800 Albert Chu
+f18f1a4036be5f224cb0d7f316f9e8ca5a41764e
+
+	* support dump_conf console command
+
+Mon Nov 10 13:41:13 2008 -0800 Al Chu
+7dbb294abe5f2afe5c25bc88cf16022d80519e89
+
+	* opensm: verify config inputs when config file is rescanned
+
+Tue Nov 11 07:23:34 2008 -0700 Hal Rosenstock
+a3823783cbf9c0eafe5f9fdf4f8e4d5124047b29
+
+	* OpenSM/osm_subnet.c: Fix log_max_size conversion to MB
+
+Tue Nov 11 14:08:22 2008 +0200 Yevgeny Kliteynik
+fca153c3bebe1cbde8f257c37155d7bb26740f5d
+
+	* opensm/Makefile.am: install QoS_management_in_OpenSM.txt
+
+Thu Nov 6 14:57:56 2008 +0200 Or Gerlitz
+46011fcc35efa315317587e361db9c5a81f9f6ac
+
+	* opensm: fix iser service-id used for SL assignment
+
+Tue Nov 4 09:57:44 2008 -0800 Ira Weiny
+83b664deca5238ca1d2f63b897d5b75ec1f9b4df
+
+	* opensm/opensm/osm_state_mgr.c: Add check for valid physical port before using pointer.
+
+Thu Nov 6 13:59:44 2008 +0200 Doron Shoham
+d01d9f8a0e40d5c5ebf0c0cc1d5a6b90dbc0dc8b
+
+	* export osm_log_max in MB
+
+Tue Nov 4 11:59:59 2008 +0200 Doron Shoham
+fe8e9908ce32178ab3bf88b83e7711ac88493bff
+
+	* change log_max_size to MB
+
+Mon Nov 10 16:36:54 2008 +0200 Yevgeny Kliteynik
+407593fe3b509bfcb72186d70c6cd8657df141ba
+
+	* opensm/osm_multicast.c: bug with joining/leaving mcast group
+
+Mon Nov 10 09:48:55 2008 -0800 Tim Meier
+fab169c9592a7ee412b26ae3d1fafb7229566c57
+
+	* opensm: osm_opensm.c added a method to remove plugins
+
+Mon Nov 10 16:25:09 2008 +0200 Yevgeny Kliteynik
+75161145c38ecab58156d96bd6fe4a4c6aa2be0d
+
+	* opensm/ib_types.h: rename IB_MC_REC_STATE_SEND_ONLY_MEMBER
+
+Mon Nov 10 16:19:17 2008 +0200 Yevgeny Kliteynik
+67d891403c5244ee75070837242365d52c800da6
+
+	* opensm/osm_pkey.c: cosmetics in some log message
+
+Thu Nov 6 11:49:31 2008 +0200 Doron Shoham
+d951ea5c5446d7fbed17787c9813f042e7f85ea5
+
+	* install QoS_management_in_OpenSM.txt
+
+Mon Nov 3 17:07:27 2008 +0200 Yevgeny Kliteynik
+87b240afd28a99071f5eba56e8cb4cce8445cf21
+
+	* opensm/osm_sa.c: adding missing include
+
+Mon Nov 3 17:05:56 2008 +0200 Yevgeny Kliteynik
+e7a3e9c33fffd98bd03139badb73c6afe2286b2f
+
+	* opensm/osm_ucast_cache: fixing coredump
+
+Sun Nov 2 20:02:37 2008 +0200 Sasha Khapyorsky
+a48bf0acfd6d13bee848875634b2c3c73452fb38
+
+	* opensm/osm_ucase_cache: simplify cached links allocation code
+
+Thu Oct 30 23:37:45 2008 +0200 Sasha Khapyorsky
+878191244218e59a8b6850f7fbe47fdc3f855116
+
+	* opensm/osm_ucast_cache.[ch]: indentation fixes
+
+Thu Oct 30 23:26:55 2008 +0200 Sasha Khapyorsky
+8aac1ce1d48f06a6859e1ffae4a597e8e61873ae
+
+	* opensm/osm_switch.c: minor: shorter flow
+
+Thu Oct 30 18:03:20 2008 +0200 Yevgeny Kliteynik
+fc7f24dad3a6838e3bb871f124430041aab1cfc9
+
+	* opensm: free lft_buf if it matches switch's lft
+
+Thu Oct 30 16:05:09 2008 +0200 Yevgeny Kliteynik
+ad7b555ea0a4a952766649d7b2f306224337e844
+
+	* opensm/osm_ucast_ftree.c: some simplification in LFT handling
+
+Wed Oct 29 15:01:58 2008 +0200 Yevgeny Kliteynik
+c124e46d4e8fb75a2476418b63d4f6a3984398f5
+
+	* opensm: replace switch's fwd_tbl with simple LFT - remove obsolete files
+
+Thu Oct 30 21:46:22 2008 +0200 Sasha Khapyorsky
+9e3b4371f30357f957b1bcc88630340c2f69fa6e
+
+	* opensm/include/opensm/osm_switch.h: minor simplifications
+
+Wed Oct 29 15:01:48 2008 +0200 Yevgeny Kliteynik
+3362436e4b722d4b20c2f725b0e5c0779619c553
+
+	* opensm: replace switch's fwd_tbl with simple LFT
+
+Sat Oct 25 22:18:00 2008 +0200 Sasha Khapyorsky
+5596796913e4f980c8903195a7f6740a22a31a07
+
+	* opensm: sweep on SIGCONT
+
+Sat Oct 25 21:33:03 2008 +0200 Sasha Khapyorsky
+6d13f290c82103d4f81dd0ecd9d79fba8179e406
+
+	* opensm: rename sm signal
+
+Sat Oct 25 21:03:36 2008 +0200 Sasha Khapyorsky
+b65c436562d5249d111d6e204819f7b5104dad81
+
+	* opensm: hide function name with OSM_LOG_MSG_BOX() macro
+
+Sat Oct 25 21:24:07 2008 +0200 Sasha Khapyorsky
+7ea6ab503e6543f0981a1db58c1c5f3a6901ff1d
+
+	* opensm: notify master SM with trap 144
+
+Sat Oct 25 20:08:11 2008 +0200 Sasha Khapyorsky
+befc5038cdf41cd4415391df9a1b0c84f4bd934c
+
+	* opensm: send trap144 to master SM when priority is raised
+
+Sat Oct 25 18:29:40 2008 +0200 Sasha Khapyorsky
+30c0ce624723ed4c3b17ba4419b44c482c840ca1
+
+	* opensm: osm_send_trap144() function
+
+Sat Oct 25 16:37:50 2008 -0400 Al Chu
+e3ee21005b9b9df97377d34e906acd971ac7f72b
+
+	* fix documentation typos
+
+Fri Oct 24 22:12:58 2008 +0200 Sasha Khapyorsky
+63b4b4be18c2b47daa0d3e37224202206ea312cc
+
+	* opensm: support more PortInfo:CapabilityMask bits
+
+Fri Oct 24 18:33:36 2008 +0200 Sasha Khapyorsky
+6bd333daaf19131df4fb80af21bea78b644a97f8
+
+	* opensm: remove update_master_sm_base_lid field in PortInfo madw context
+
+Fri Oct 24 17:08:28 2008 -0700 Al Chu
+c725c6326901b6126556d7748f555466a7c99e7e
+
+	* opensm: fix manpage typos
+
+Thu Oct 23 14:11:19 2008 +0200 Sasha Khapyorsky
+031ae33dee418872d0674c894a931ebb3ee279a3
+
+	* opensm/opens.spec: add -D option for logrotate file install command
+
+Wed Oct 22 21:09:32 2008 +0200 Sasha Khapyorsky
+110fd01218cc666e12438757c03389d76c2dd441
+
+	* opens/osm_inform.c: cosmetic changes
+
+Wed Oct 22 20:56:37 2008 +0200 Sasha Khapyorsky
+28ad891fe5159426bacaff048e477981796dcbd5
+
+	* opensm/scripts: unify scripts' config
+
+Wed Oct 22 16:45:19 2008 +0200 Yevgeny Kliteynik
+181ef8b8945d5306bcf5a9809d9e9122882efad1
+
+	* opensm/opensm/Makefile.am: allow 'make dist' from non-source directory
+
+Wed Oct 22 16:41:12 2008 +0200 Yevgeny Kliteynik
+55c539d53c86ffe6b32937de7947175d8055945b
+
+	* opensm/scripts/opensm.conf: remove obsolete config file
+
+Wed Oct 22 00:45:13 2008 +0200 Sasha Khapyorsky
+9072c8637834801e46bc5af732d231663d23fff8
+
+	* opensm/osm_ucast_lash: simplify get_phys_connection() prototype
+
+Wed Oct 22 00:39:12 2008 +0200 Sasha Khapyorsky
+7e3449365472738630767c6fe45b00491d64d2d8
+
+	* opensm/osm_ucast_lash: fix extra memory allocations
+
+** Version: opensm-3.2.3
+
+Sun Oct 19 20:53:23 2008 +0200 Sasha Khapyorsky
+9e87aac2eb7dbffaff44fc6e82bbedd0cca7a97d
+
+	* management/*/configure.in: bump all versions
+
+Sun Oct 19 20:48:42 2008 +0200 Sasha Khapyorsky
+d23a02f9d93586f4f09305fdb74bb3780336583d
+
+	* opensm/release notes: add recent changes
+
+Sun Oct 19 20:32:34 2008 +0200 Sasha Khapyorsky
+86b03133c81adae58f5f0fc038a692bbc997c4a2
+
+	* opensm/libopensm.ver: advance libopensm library version
+
+Wed Oct 8 12:28:44 2008 +0200 Sasha Khapyorsky
+245f455765a2e329a1b21c8b31169d73b2da0d3b
+
+	* management: update Voltaire copyright
+
+Sun Oct 19 19:59:08 2008 +0200 Sasha Khapyorsky
+ba51e8642a4aad05606b7a715fe9679715d9ad58
+
+	* opensm/osm_mcast_mgr.c: cosmetic
+
+Sun Oct 19 19:56:25 2008 +0200 Sasha Khapyorsky
+56e0c1effc09c5c4ac4527fd5db784fa75f38cf4
+
+	* opensm/osm_mcast_mgr: fix memory leak
+
+Sun Oct 19 17:11:11 2008 +0200 Sasha Khapyorsky
+aa31e80c5e41b6d19001620f2cedda973afbaea5
+
+	* opensm/osm_sa: fix memory leak in SA responder
+
+Sun Oct 19 01:22:37 2008 +0200 Sasha Khapyorsky
+fb1cb54ea7ab245df48fd7a28655b4b83e371f00
+
+	* opensm/osm_sa_lft_record.c: fix block number encoding byte order
+
+Thu Oct 16 13:42:59 2008 +0200 Yevgeny Kliteynik
+5e269ff3021973dafa32a4d95acc67b88a72b256
+
+	* opensm/doc/current-routing.txt: added ucast cache info
+
+Wed Oct 15 08:23:04 2008 -0600 Hal Rosenstock
+efb1469ec6d00890b8feca082152daa088ac046c
+
+	* OpenSM release notes: Indicate InfiniScale-IV support
+
+Wed Oct 8 21:28:45 2008 +0200 Sasha Khapyorsky
+b8950cc5775810c3131221aa925e90f2de276315
+
+	* opensm/osm_ucast_lash.c: indentation fixes
+
+Sat Oct 18 11:09:57 2008 +0200 Sasha Khapyorsky
+9e2e45c7c551b694457ff5df465dc727039e31e9
+
+	* opensm/osm_ucast_cache: trivial comment fix
+
+Thu Oct 16 00:21:20 2008 +0200 Yevgeny Kliteynik
+e6547897de0f2b438b5d14e649a95b16ef3bc61c
+
+	* opensm/Unicast Routing Cache: manpage entry
+
+Thu Oct 16 00:19:43 2008 +0200 Yevgeny Kliteynik
+4334878b379d1a19cc120711e4088d6f3febcb11
+
+	* opensm/Unicast Routing Cache: integrate cache into opensm
+
+Thu Oct 16 00:02:00 2008 +0200 Yevgeny Kliteynik
+33fff8530e1499bb7dc2c02d4a35031f477f1815
+
+	* opensm/Unicast Routing Cache: compile cache files
+
+Thu Oct 16 00:00:34 2008 +0200 Yevgeny Kliteynik
+8b46e11938659d4100813e7da01bbcc073a624fc
+
+	* opensm/Unicast Routing Cache: add osm_ucast_cache.{c,h} files
+
+Wed Oct 15 23:35:09 2008 +0200 Yevgeny Kliteynik
+cd6ce9bb802e9b1e11d1b4c3369677e607fa5031
+
+	* opensm/Unicast Routing Cache: add -A / --ucast_cache option
+
+Wed Oct 15 23:34:58 2008 +0200 Yevgeny Kliteynik
+14ed20a32e39212579e73e7b0c56d74eb740bbd2
+
+	* opensm/Unicast Routing Cache: move lft_buf from ucast_mgr to osm_switch
+
+Tue Oct 14 14:11:02 2008 -0600 Hal Rosenstock
+4b758222d5aae44aeb0d32cf49b03132caff6348
+
+	* OpenSM release notes: Clarify OpenSM compatibility due to change in default SM/SA keys
+
+Tue Oct 14 11:30:01 2008 +0200 Sasha Khapyorsky
+36d2c35c159a6e6fa62d297902cda2a781f07f93
+
+	* opensm: 3.2 release notes update
+
+Tue Oct 14 11:01:57 2008 +0200 Sasha Khapyorsky
+a3d633baf86d43395b0967a3840866443360d313
+
+	* opensm/osm_event_plugin.c: include config.h
+
+Sun Oct 12 01:25:40 2008 +0200 Sasha Khapyorsky
+7206f39ddce5e23a8885d4b9393d8a612906a156
+
+	* opensm: Unify options listing in usage() message
+
+Sat Oct 11 19:36:24 2008 +0200 Sasha Khapyorsky
+a96f3f0491cda584b2c70f2bf1c3c9c0db651ea0
+
+	* opensm/vendor: replace osm_vendor_select.h by osm_config.h
+
+Wed Oct 8 12:28:44 2008 +0200 Sasha Khapyorsky
+f0d46840c0b90c56592372743994bc0afa5a864b
+
+	* management: add Voltaire copyright
+
+Wed Oct 8 12:27:12 2008 +0200 Sasha Khapyorsky
+d367b4f360ce151f52e32de0f82d49948b8b2d47
+
+	* management/*/COPYING: update Voltaire copyright years
+
+Sat Oct 11 23:40:35 2008 +0200 Sasha Khapyorsky
+b56d4c332a3bea4f5a2570256e4cf2ed6c6739b6
+
+	* opensm: update Release Notes for OpenSM version 3.2
+
+Sat Oct 11 13:14:38 2008 +0200 Sasha Khapyorsky
+a9a1c98d061eac556a22314e56a4fcf85636399b
+
+	* opensm/osm_config.h: generated OSM_DEBUG macro
+
+Sat Oct 11 13:09:35 2008 +0200 Sasha Khapyorsky
+b3491b9cfa8daf0144b8fad8ac49f30053c15220
+
+	* opensm/opensm/Makefile.am: merge CFLAGS
+
+Fri Oct 10 22:51:41 2008 +0200 Sasha Khapyorsky
+3103aeb82f0e8ffd570265a851ea8e77018217e2
+
+	* opensm/vendor: remove osm_pkt_randomizer from ibumad vendor build
+
+Fri Oct 10 11:25:37 2008 +0200 Sasha Khapyorsky
+a34c2fdddfc3b29d7dc51a7a74984fe6df7feb81
+
+	* opensm/config/osmvsel.m4: fix indentations
+
+Thu Oct 9 14:59:44 2008 -0700 Ira Weiny
+50d61031ffee8aead089d08778f210a0e81b24ce
+
+	* opensm: Add osm_config.h file
+
+Fri Oct 10 10:10:39 2008 +0200 Sasha Khapyorsky
+dd05344bacf539ca077b01333c49256e7f38fa1b
+
+	* opensm: fix broken IPv6 SNM consolidation code
+
+Thu Oct 9 21:09:09 2008 +0200 Sasha Khapyorsky
+fed2316598460d122a24370c8aca9f9e8d5b4798
+
+	* opensm/osm_ucast_lash.c: minor code optimization
+
+Wed Oct 8 01:19:05 2008 +0200 Sasha Khapyorsky
+1ba9acd4ff365bec39c6e39c84d067fd721965c1
+
+	* opensm/osm_ucast_lash: fix buffer overflow
+
+Tue Oct 7 11:09:45 2008 +0200 Sasha Khapyorsky
+17ce519ec56b97f2e20ed145ac45d71ca188f9e7
+
+	* opensm/main.c: trivial usage message formatting fix
+
+Fri Oct 3 14:07:13 2008 -0600 Hal Rosenstock
+313de09ce16bf17864ecc05486b8b0ce8fb9a153
+
+	* OpenSM: Display port number in decimal in log messages
+
+Fri Oct 3 12:54:42 2008 -0600 Hal Rosenstock
+cd404357c5269f83100b3672bbc928cd49af2aab
+
+	* OpenSM: Display port number in decimal in log messages
+
+Mon Sep 29 15:51:25 2008 +0300 Sasha Khapyorsky
+282b65c316e5646c53ee10f78f2eb853ef48a47c
+
+	* opensm/osm_ucast_mgr: remove any_change tracking
+
+Mon Sep 29 15:41:53 2008 +0300 Sasha Khapyorsky
+7ca99dacc8fb2a36ef5d816b76daa49a4082840e
+
+	* opensm/osm_ucast_updn: cosmetic
+
+Sun Sep 21 19:38:23 2008 +0300 Albert Chu
+f05fa4cbd6e8adc9d5cd067cefa827e31e0d3c25
+
+	* opensm: routing chaining
+
+Wed Oct 1 04:00:34 2008 +0300 Sasha Khapyorsky
+47b931d34f79d126a3a22a964fd3535510306535
+
+	* opensm/osm_sa_mcmember_record.c: cosmetic - remove empty line
+
+Tue Sep 30 07:08:25 2008 -0600 Hal Rosenstock
+c19e5cb7f7c6d5d253bc4924a5e43caea537018a
+
+	* OpenSM: More man and doc changes for opensm.conf
+
+Fri Sep 26 22:35:39 2008 +0300 Sasha Khapyorsky
+92d3ae09a8184988e72fb6d7ba74bba355f6a64d
+
+	* opensm/man: remove any opensm.opts mentions from opensm man page
+
+Sat Sep 20 13:10:22 2008 +0300 Sasha Khapyorsky
+46d374596a5d3798cbf1c0791a73ff2efd773ac8
+
+	* opensm/osm_log.c: provide useful error message when file opening fails
+
+Sat Sep 20 12:55:52 2008 +0300 Sasha Khapyorsky
+d42f6c5844b4f9ce625069fbb2562f3ff14876ab
+
+	* opensm/osm_opensm.c: cosmetic formatting
+
+Wed Sep 17 21:52:47 2008 +0300 Sasha Khapyorsky
+d3d938d18cc9b4c43885375222937691e6f7d7b0
+
+	* opensm: consolidate mgrp_send_notice calls
+
+Mon Sep 15 14:00:51 2008 +0300 Sasha Khapyorsky
+4d6e504bd0a4f90af21a3fa7d068451869cf3c06
+
+	* opensm: multicast group create/delete notification fix
+
+Fri Sep 5 18:19:43 2008 +0300 Sasha Khapyorsky
+3941653cc473947fb52bbcdb850d3f8ade54d47c
+
+	* opensm/osm_sa_mcmember_record.c: cleanup code, simplify flows
+
+Fri Sep 5 17:34:19 2008 +0300 Sasha Khapyorsky
+c8b1cdc5d0b850277dff0f17a3068b868b4693d5
+
+	* opensm: simplify osm_get_mgrp_by_mgid() search function
+
+Fri Sep 5 19:32:22 2008 +0300 Sasha Khapyorsky
+6739e532dda64043f192fd8f77b9904a3e8d1ff9
+
+	* opensm/osm_multicast.[ch]: simplify flows, remove unused functions
+
+Fri Sep 5 17:30:59 2008 +0300 Sasha Khapyorsky
+62b1a5d48e4d8fd89bc4fce61eff840bb0114037
+
+	* opensm/osm_sm.c: cosmetic
+
+Fri Sep 5 17:28:01 2008 +0300 Sasha Khapyorsky
+2309f3a64f8188524d630279d2fc479c44ceb621
+
+	* opensm/osm_mcm_port.c: remove osm_mcm_port_init()
+
+Sat Sep 13 21:21:34 2008 +0300 Sasha Khapyorsky
+1b9ae223c6ce6c6b22b5bcb134d9c0972d85c01c
+
+	* opensm/opensm.spec.in: don't install old format conf file
+
+Sat Sep 13 21:19:02 2008 +0300 Sasha Khapyorsky
+478e7735f77b5e92795e1b2d28044ac31d126ae7
+
+	* opensm/redhat-opensm.init.in: make config file optional
+
+Sat Sep 13 00:10:43 2008 -0700 Sasha Khapyorsky
+337fb58affec85769d63670484289abf4001fd37
+
+	* opensm: do not start opensm on boot automatically
+
+Sat Sep 13 00:10:43 2008 -0700 Albert Chu
+b9ab56b896aa0c9fb3f6ebd5162d2f8bec746cff
+
+	* opensm/opensm.init: do not specify run levels on SuSE
+
+Fri Sep 12 09:59:50 2008 -0700 Al Chu
+9d8836bf9dccaf17f6cb76fdf5aa8f4b3a932214
+
+	* opensm: fix routing algorithm description
+
+Thu Sep 11 21:28:25 2008 +0300 Sasha Khapyorsky
+e68e54182d2bf4846b7a6d7c780139d0dc41c42e
+
+	* opensm: fix in usage message
+
+Wed Sep 10 07:19:20 2008 -0600 Hal Rosenstock
+c10c52283529a0d0961a9f178e26e43496b70507
+
+	* osm_(helper trap_rcv).c: Change output format of notice type to unsigned decimal
+
+Tue Sep 9 13:46:44 2008 -0700 Al Chu
+3c8179da5683ab6f9ca26dc72fac816b33b252c1
+
+	* opensm: remove old comment
+
+Tue Sep 9 10:01:43 2008 -0700 Al Chu
+efb95f912b1b3b39e036cd15e85e69890cec7856
+
+	* opensm: fix comment typo
+
+Wed Sep 3 11:21:22 2008 -0700 Al Chu
+02e1c949e8cf18944b9ddeb57c741159c39d940a
+
+	* opensm/console: close console socket on cleanup path
+
+Fri Sep 5 04:14:03 2008 +0300 Sasha Khapyorsky
+33180695647818bcd39504c509601a23e5ab0a0b
+
+	* opensm: fix strict-aliasing rules warnings
+
+Thu Sep 4 10:00:58 2008 -0700 Al Chu
+7af67fa626af25deff0b466f72c9f079a33354ac
+
+	* opensm: fix segfault corner case when osm_console_init fails
+
+Tue Sep 2 19:18:19 2008 +0300 Sasha Khapyorsky
+8a22af3bf6a75ede3f8cacf32bcf561d2717bd24
+
+	* opensm/*/Makefile.am: remove -Wno-deprecated-declarations C flags
+
+Tue Sep 2 19:08:14 2008 +0300 Sasha Khapyorsky
+d2ffd562759d67992aecfed9477960c1c07521a2
+
+	* opensm/Makefile.am: remove -fno-strict-aliasing flag from *CFLAGS
+
+Tue Sep 2 18:55:59 2008 +0300 Sasha Khapyorsky
+2a60f1fcd3f1954c52c1ea912dcd03a35eefedd8
+
+	* opensm/config: remove unused variables
+
+Tue Sep 2 17:57:50 2008 +0300 Sasha Khapyorsky
+7ddec2e27092f1a740b1801c782419401ab2f2d9
+
+	* opensm: opensm_release_notes-3.2.txt template
+
+Mon Aug 25 10:16:38 2008 -0700 Ira Weiny
+f81f7636ef9b1ceace78475792dd84a87532839f
+
+	* opensm: move vendor specific compilation flags to config.h
+
+Mon Sep 1 18:03:28 2008 +0300 Yevgeny Kliteynik
+5b7305e772d0a7b37e10b5f295322446c4f134c9
+
+	* opensm/Makefile.am: adding yacc-generated .h file as dependency
+
+Thu Aug 28 15:10:35 2008 -0700 Tim Meier
+c9a13a83940a4fdecbf5fcbac35e16ed829dced6
+
+	* opensm: osm_opensm.c - changed load_plugins() arg to const
+
+Thu Aug 21 17:29:54 2008 +0300 Yevgeny Kliteynik
+a36ecbfc2c5e25e123a5a70fa7486158eac44f40
+
+	* opensm/osm_qos_policy.c: log matched qos criteria
+
+Sun Aug 31 15:57:36 2008 +0300 Sasha Khapyorsky
+025b1b7c9d1b38e501ec2bc5f5c531fd31a38456
+
+	* opensm/osm_qos_policy.c: cosmetic simplification
+
+Thu Aug 21 17:25:15 2008 +0300 Yevgeny Kliteynik
+bd302214877c2b3086beae0f43e6eeeabd94c78f
+
+	* opensm/osm_qos_policy.c: removing some log messages
+
+Wed Aug 20 17:58:42 2008 +0300 Yevgeny Kliteynik
+ce4a49f2d92fa1f09c1a85f205caf1b6c444ed42
+
+	* opensm/osm_state_mgr.c: fixing some typos
+
+Mon Aug 18 14:43:06 2008 -0700 Ira Weiny
+c3a6b874ba76340def43800990ab891a7e632d0d
+
+	* opensm: Add a Node Description check on light sweep.
+
+Mon Aug 18 02:11:11 2008 +0300 Sasha Khapyorsky
+7c4ea06b00a6a06e010a254e2f246aed33d0164a
+
+	* opensm: remove USEGPPLINK hack
+
+Mon Aug 18 02:09:41 2008 +0300 Sasha Khapyorsky
+61fc0d803e53b87e0c7e8eac2a0f898199093c38
+
+	* opensm/config/osmvsel.m4: remove unused osmv_save_ldflags variable
+
+Mon Aug 18 02:06:31 2008 +0300 Sasha Khapyorsky
+07b5b4b5b4e2752a33e3c255f0abe1217c1a7cbf
+
+	* opensm/osm_version.h.in: remove 'extern "C"' braces
+
+Mon Aug 18 22:48:48 2008 +0300 Hal Rosenstock
+4a6744b765c02f1529cadb35fc7512b293f49513
+
+	* osmtest/osmtest.8: Fix log_file option description in man page
+
+Sun Aug 17 18:12:18 2008 +0300 Yevgeny Kliteynik
+d4906128449dc3f321f2f9cb654d82827b37c14d
+
+	* opensm/libvendor/osm_vendor_mlx_sa.c: handling attribute offset of 0
+
+Wed Aug 13 17:35:04 2008 +0300 Yevgeny Kliteynik
+f3a7f9922c589b3ada0b766ed486e8caafbe68ac
+
+	* opensm/osm_ucast_mgr.c: cleaning port_order_list
+
+Thu Aug 7 21:00:21 2008 +0300 Sasha Khapyorsky
+f9df155bedb4b215ae277b03a348528b44a3e035
+
+	* opensm/osm_sa_informinfo.c: consolidate flows
+
+Thu Aug 7 20:50:01 2008 +0300 Sasha Khapyorsky
+c8e6ff60449a7afdcb2ecc60d48e5fc59bdbd005
+
+	* osm_vendor_ibumad_sa: in a log print mad_status in host byte order
+
+Thu Aug 7 20:39:30 2008 +0300 Sasha Khapyorsky
+263f63a222258c3fd8f21fe8faf1f850ebda16b3
+
+	* osmtest: fix qpn encoding in osmtest_informinfo_request()
+
+Thu Jul 31 10:43:38 2008 +0300 Sasha Khapyorsky
+2376844a65c24dbaed1ec81235fa2d0d2db46c87
+
+	* opensm: query remote SMs during light sweep
+
+Wed Aug 6 22:31:16 2008 +0300 Sasha Khapyorsky
+c55f1d7e4cfdb5e4a5c7c840f1fcf6d3082e6c97
+
+	* opensm: redo lex and yacc files generation
+
+Mon Jun 16 03:27:40 2008 +0300 Sasha Khapyorsky
+b34e991b4656bdc84bb2e795c4b62817b8ab09ad
+
+	* opensm: add OSM_EVENT_ID_SUBNET_UP event
+
+Wed Aug 6 16:15:28 2008 +0300 Yevgeny Kliteynik
+55de8dc780c6f2aad06fa417c9a31ea0256e1c26
+
+	* opensm/Makefile.am: add dependency rule
+
+Tue Aug 5 18:41:41 2008 +0300 Yevgeny Kliteynik
+a5c7134500108ad737b090c7688b667fc85fcc6c
+
+	* opensm/Makefile.am: Fix dependency for 'make -j2'
+
+Mon Aug 4 17:38:08 2008 +0300 Sasha Khapyorsky
+a007f6ab4accc49876aa9e6f73a1aab4e4b22813
+
+	* opensm/osm_sm.h: fix comment
+
+Mon Aug 4 17:37:03 2008 +0300 Sasha Khapyorsky
+89cb495607894625fd9223a9b18527fae54b4999
+
+	* opensm: remove osm_sweep_fail_ctrl.[ch] files
+
+Mon Aug 4 17:33:32 2008 +0300 Sasha Khapyorsky
+bb46072037f5df7b2f3e9d8488f7edbcba03c0a1
+
+	* opensm: cleanup osm_sweep_fail_ctrl
+
+Mon Aug 4 17:34:58 2008 +0300 Yevgeny Kliteynik
+5451749fddbb6c7a1625def438ec4496462cb3ed
+
+	* opensm/Makefile.am: fixing compilation error with osm_version.h
+
+Thu Jul 31 20:57:43 2008 +0300 Sasha Khapyorsky
+a635bd9d3aefdcd79de2005c0cef0364088d148f
+
+	* opensm/osm_ucast_lash.c: A couple more conversions to (unsigned) decimal lid format
+
+Mon Aug 4 11:45:38 2008 +0300 Yevgeny Kliteynik
+10b8a31f95880c8006ee5ed42fb4a0f43975c1eb
+
+	* opensm/osm_qos_parser.l: add 'noinput' lexer option to remove compiler warning
+
+Mon Aug 4 10:46:37 2008 +0300 Sasha Khapyorsky
+de07e8f4d251c38ef42a2fd4adc2e865e47bdc0d
+
+	* osmtest/osmt_service.c: fix over bound array access
+
+Mon Aug 4 10:46:37 2008 +0300 Sasha Khapyorsky
+e1a3a1634f6b10f4f591ff63f69adbbed0b97361
+
+	* opensm/osm_sa_class_port_info.c: fix over bound array access
+
+Mon Aug 4 10:38:42 2008 +0300 Sasha Khapyorsky
+beb5d02c0e31adc3b1503b155ee46584edf53c1d
+
+	* opensm/osm_mtree.c: mask unused static function __osm_mtree_dump()
+
+Thu Jul 31 10:39:52 2008 +0300 Sasha Khapyorsky
+2eef15af2c523f699bc9d349e7d18b519ee5b419
+
+	* opensm/osm_sminfo_rcv.c: improve locking
+
+Sun Jun 15 11:49:17 2008 +0300 Sasha Khapyorsky
+a588e513a98dff20ec8d785c1a428d52c9cabaca
+
+	* opensm/event_plugin: plugin API version 2
+
+Wed Jul 30 04:00:40 2008 +0300 Sasha Khapyorsky
+0f64ff244d1f3bc3b5ea0c54cf088dd183f69949
+
+	* opensm: install all OpenSM header files
+
+Wed Jul 30 03:14:43 2008 +0300 Sasha Khapyorsky
+1a36885eaf039eeeea56b3169eb53914754dc56e
+
+	* opensm/include/Makefile.am: don't duplicate header files in EXTRA_DIST
+
+Wed Jul 30 16:08:44 2008 +0300 Sasha Khapyorsky
+7ed529416a49adcbadce179b02ee5812a27e2bca
+
+	* opensm/osm_sminfo_rcv.c: cosmetic
+
+Wed Jul 30 15:30:09 2008 +0300 Sasha Khapyorsky
+f70fdf2121836f086659cab6b18f8aefbc9b183b
+
+	* opensm/osm_state_mgr: trivial changes
+
+Wed Jul 30 15:18:32 2008 +0300 Sasha Khapyorsky
+55c8ad92c32412becbdef830d0c58ca95f2bb12f
+
+	* opensm/osm_state_mgr: fix ERR code in __osm_state_mgr_light_sweep_start()
+
+Wed Jul 30 03:21:27 2008 +0300 Sasha Khapyorsky
+417ac5b0754a6f04dfd56df7c1007ed86a41da1e
+
+	* opensm/*/Makefile.am: sort header file list by name
+
+Wed Jul 30 02:21:23 2008 +0300 Hal Rosenstock
+9d91feed0a81a220afae9a9975eece097de6d705
+
+	* OpenSM: More conversion to (unsiged) decimal lid format
+
+Wed Jul 30 02:17:06 2008 +0300 Sasha Khapyorsky
+101e38593f754219c97dcc7b9795a3262b23c2d6
+
+	* opensm/osm_helper: remove some empty lines
+
+Wed Jul 30 02:12:10 2008 +0300 Hal Rosenstock
+8d0928ef9e3df292725f9886d6ba8d9a27f24a98
+
+	* opensm/osm_helper.c: Change lids_per_port to decimal
+
+Wed Jul 30 02:07:36 2008 +0300 Hal Rosenstock
+ca3a2bc3f78cbb901a2eff8e02d12667649978a5
+
+	* opensm/include/opensm/osm_subnet.h: Update some comments
+
+Tue Jul 29 10:48:21 2008 -0700 Al Chu
+c1b35fe853b01411ccb3d99266f655c320e4ebda
+
+	* opensm: fix instruction typo in config file
+
+Tue Jul 29 10:47:13 2008 -0700 Al Chu
+f7ff0228b5fba1d57372c23ffa089d3ffc52ca73
+
+	* opensm: rename ucast_file and ucast_dump_file to lfts_file
+
+Sat Jun 21 18:01:46 2008 +0300 Sasha Khapyorsky
+4d90267e42df0f36dcba2f55cee924cfd060749f
+
+	* opensm: add osm_version field to osm_opensm_t object
+
+Mon Jul 28 15:54:59 2008 -0400 Hal Rosenstock
+186177be1cb58584cdce57cccb2ea9d712d3a337
+
+	* opensm/osm_lid_mgr.c: Cosmetic format change
+
+Mon Jul 28 09:54:16 2008 -0400 Hal Rosenstock
+fe3f6ac345cea4265aaa5663cb3d02dd3593690a
+
+	* opensm/osm_lid_mgr.c: Convert lid range prints to decimal
+
+Mon Jul 28 09:54:07 2008 -0400 Hal Rosenstock
+1b4f2e6a907fa95c5d442f4b4a2a326ca5814d67
+
+	* complib/cl_event_wheel.c: Fix some printf typos
+
+Mon Jul 28 19:38:12 2008 +0300 Sasha Khapyorsky
+f806574c497838481c839c4f6da8e95782d321a7
+
+	* opensm: simplify flow in __osm_state_mgr_light_sweep_start()
+
+Tue Jul 15 14:15:53 2008 +0300 Sasha Khapyorsky
+b4bd8e1b426f4a8fb41d3374150142fe2d722050
+
+	* opensm/libvendor: convert osm_log() to OSM_LOG() macro
+
+Tue Jul 15 14:15:53 2008 +0300 Sasha Khapyorsky
+3133de86834328b800f5aa8cac277b82e4d6d660
+
+	* opensm/osmtest: convert osm_log() to OSM_LOG() macro
+
+Sun Jul 13 12:18:11 2008 +0300 Sasha Khapyorsky
+038edff11935b4a288a6b6bb4d5599904bd1ce25
+
+	* opensm: remove osm_log_is_active() check
+
+Mon Jun 30 08:01:53 2008 +0300 Sasha Khapyorsky
+afd980fc04bb45545dcaf3d3b8ada8b4069cfb24
+
+	* opensm/OSM_LOG(): wrap osm_log call with log level check
+
+Sun Jul 27 21:39:29 2008 +0300 Sasha Khapyorsky
+dd8b38394aea0c1fc6fbfd9e30c3b88047dcef5a
+
+	* opensm/*/Makefile.am: remove explicit -lpthread and -ldl flags from Makefile.am
+
+Sun Jul 27 15:55:51 2008 +0300 Doug Ledford
+7fa10a08642684e6c64b2d0a5bda5c61e7a3f19a
+
+	* opensm: remove -rpath from LDFLAGS
+
+Sun Jul 27 07:43:07 2008 -0400 Hal Rosenstock
+a08c24572c12c90ebe3e1aead904a44d13c97df6
+
+	* opensm/osm_inform.c: Fix compile warning
+
+Sat Jul 26 20:05:22 2008 +0300 Keshetti Mahesh
+19887d3b3a32b11d09637194e5c14bf9b8a70aa4
+
+	* opensm/osm_ucast_lash: find_port_from_lid() function is not used
+
+Sun Jul 27 09:52:21 2008 +0300 Sasha Khapyorsky
+6b29a015feb01bd2f7c62171f638e14f624f3554
+
+	* opensm/osm_ucast_updn: move and rename __osm_updn_find_root_nodes_by_min_hop()
+
+Sun Jul 27 09:47:58 2008 +0300 Sasha Khapyorsky
+9988c48e08f763aad65f9e9a95c033eed0afd288
+
+	* opensm/osm_ucast_updn: remove some debug logging
+
+Sat Jul 26 19:55:09 2008 +0300 Sasha Khapyorsky
+a7687e763f2e0701e52021d7fa1fc175ea4eaefb
+
+	* opensm/osm_ucast_lash: remove an invalid error log
+
+Sat Jul 26 19:32:39 2008 +0300 Keshetti Mahesh
+061046c10ff4dba208eda51ad98b8958a9d51bb3
+
+	* opensm/osm_ucast_lash.c: remove unused variables
+
+Sat Jul 26 21:44:39 2008 +0300 Sasha Khapyorsky
+f44c8e177325a23d4b84725acfaf894ba9138e9d
+
+	* opensm/osm_sa_mcmember_record: fix uninitilized variable use
+
+Sat Jul 26 18:40:44 2008 +0300 Sasha Khapyorsky
+b5f2f37faeb5889aafa25b0b305944e3595a4fc2
+
+	* opensm/configure.in: don't touch CFLAGS directly
+
+Thu Jul 24 10:11:13 2008 -0700 Ira Weiny
+ededbebbbc90d85b524eb437ca4281ac482dfe7b
+
+	* opensm: Add ib_trap_str function
+
+Wed Jul 9 04:27:28 2008 +0300 Sasha Khapyorsky
+7564b226d529e0a13d2d80d06ca8c0b2e3c93d14
+
+	* opensm/osm_helper.c: trivial simplifications
+
+Mon Jun 30 04:51:26 2008 +0300 Sasha Khapyorsky
+eaa765437573b4ce25738522fc956a98c33fef05
+
+	* opensm/osm_log: osl_log() speedup
+
+Mon Jun 30 04:46:07 2008 +0300 Sasha Khapyorsky
+89cbb9f5db90cb6882bceb83d269fd731ff9f90b
+
+	* opensm/osm_log: reverse log level check flow
+
+Wed Jul 9 01:11:51 2008 +0300 Doug Ledford
+6c5b135ae5efeabeae5278b7b268142b82634bf2
+
+	* opensm/*/Makefile.am: remove install-exec-hook
+
+Thu Jul 24 12:54:10 2008 -0400 Hal Rosenstock
+a46a4d1053c41b97ffb4af4f1345b538230f8b6c
+
+	* opensm/osm_qos_parser.y: Eliminate bison warning
+
+Thu Jul 24 12:54:02 2008 -0400 Hal Rosenstock
+02afd38a4e25a6c9b5c89a64b97240aba234150d
+
+	* opensm/osm_console_io.c: Eliminate compile warnings
+
+Thu Jul 24 19:41:54 2008 +0300 Sasha Khapyorsky
+f496bb2258903ec21d4ef5682f90eee83c2caa91
+
+	* opensm: minor: move GID print buffer definitions under nearest condition
+
+Thu Jul 10 17:44:10 2008 -0700 Ira Weiny
+88d412ba22fa2f7797288e318fa1fcae59d6da81
+
+	* OpenSM: convert GID prints to use inet_ntop
+
+Thu Jul 10 06:17:24 2008 -0700 Hal Rosenstock
+97a5666560be128ecdb69b888cecc6010300bc62
+
+	* opensm/osm_rand_fwd_tbl.h: Cosmetic changes
+
+Thu Jul 10 06:05:18 2008 -0700 Hal Rosenstock
+ab049bc9e0b76a57b37c87f52025b03ba007f6a8
+
+	* opensm/osm_lin_fwd_tbl.h: Cosmetic changes
+
+Tue Jul 24 15:27:10 2035 +0300 Keshetti Mahesh
+c25c6661c33af4fe16be609569ef6ace8f546058
+
+	* complib: trivial change in description of cl_list_insert_tail function
+
+Sat Jun 28 04:24:32 2008 +0300 Sasha Khapyorsky
+64f1f55b2d490010bbdc86e7715efd8c6ec4521f
+
+	* opensm: improve port_prof_ignore handling
+
+Thu Jun 26 11:12:55 2008 +0300 Sasha Khapyorsky
+d063e941079cc8d9519dafc5e5a06bda6bc12cdc
+
+	* opensm: speedup and improve ipv6 snm handling
+
+Mon Jun 30 03:59:30 2008 +0300 Sasha Khapyorsky
+322e1e8cc0f5210f6866b893b78de10dd799b1e8
+
+	* opensm/osm_sa_lft_record: pass block parameter in host byte order
+
+Mon Jun 30 03:57:37 2008 +0300 Sasha Khapyorsky
+c0b4d48d45f01e8467c540a2fe51be1446fbf3a7
+
+	* opensm/sa: remove local *get_port_by_guid() wrappers
+
+Mon Jun 30 02:33:02 2008 +0300 Sasha Khapyorsky
+63788715e6417ea2a46b3083076eb1b41425ae9b
+
+	* opensm/osm_sa_lft_record: validate LFT block number
+
+Mon Jul 7 14:25:52 2008 -0700 Al Chu
+fdcb387cbdcf6c2f6f66553c8d8c0dbab71083b4
+
+	* opensm: reroute console option
+
+** Version: opensm-3.2.2
+
+Tue Jul 8 07:22:02 2008 +0300 Sasha Khapyorsky
+a129c1c979721b7299cb6ad64859a71a9af171a4
+
+	* management: bump management versions
+
+Tue Jul 8 17:04:52 2008 -0700 Tim Meier
+612088635ce78fb58b2b8cfcd5983105c6ad4c19
+
+	* opensm: osm_subnet.c - added console loopback mode to opts file & parser
+
+Sun Jul 6 23:07:38 2008 +0300 Sasha Khapyorsky
+32d3390d755a6226ac4a4f1cd340c6eae0f22244
+
+	* management: revert configure.in update configure.in on 'make dist'
+
+Tue Jul 1 11:46:51 2008 -0700 Al Chu
+c9bcb1056be9a394935af5a090775e5bb5a35109
+
+	* Fix comment typo
+
+Tue Jul 1 10:54:01 2008 -0700 Al Chu
+7587ea37b512a9ba2322f563ac4cf2f848a7e0ac
+
+	* fix true/false usage
+
+Mon Jun 30 11:52:01 2008 +0300 Yevgeny Kliteynik
+d5f9093f8dc0fabc46c50928db5513c4f965a0ab
+
+	* opensm/osm_state_mgr.c: fixing log message
+
+Mon Jun 30 04:44:22 2008 +0300 Sasha Khapyorsky
+58b57ae3eb061158be0387328f8e5f1da8106da7
+
+	* opensm/osm_log: formatting changes
+
+Mon Jun 30 03:44:26 2008 +0300 Sasha Khapyorsky
+99aaca081528c9b954f1fecb24d42e9e81847ffe
+
+	* opensm: trivial formatting fixes
+
+Mon Jun 30 02:26:47 2008 +0300 Sasha Khapyorsky
+2f75562c0b6b0bf376fddc4dd7f423d96f699909
+
+	* opensm/osm_sa_lft_record: trivial formatting fixes
+
+Sun Jun 29 04:43:57 2008 +0300 Sasha Khapyorsky
+8d0cef24efd4e9d00eb1b189947d035a7e1bdc69
+
+	* opensm: fix snprintf() usage
+
+Sun Jun 29 04:43:06 2008 +0300 Sasha Khapyorsky
+7ff6e3753bb3f334575b26e1228631e701b55d00
+
+	* opensm: minor snprintf() usage improvements
+
+Sat Jun 28 16:17:08 2008 +0300 Sasha Khapyorsky
+2f00875166ce24b3fb2039b052a274b2d95c428d
+
+	* opensm/osm_log.h: trivial formatting in comments
+
+Fri Jun 27 10:48:58 2008 -0700 Hal Rosenstock
+2a79a99b198b5f0d943aeb1f7d8e7dd508130bd2
+
+	* opensm/osm_port_profile: Handle all possible ports
+
+Fri Jun 27 08:14:46 2008 -0700 Hal Rosenstock
+3a4c95bda09328ebc75ecd1fc1efffa3e1842251
+
+	* opensm: Convert unicast LIDs in long messages from hex to decimal
+
+Thu Jun 26 14:36:43 2008 -0700 Hal Rosenstock
+d058d95f3a0ff2b8b6790d973e12980761bda597
+
+	* opensm/osm_mcast_mgr.c: Only send MCG delete notice if not previously done
+
+Thu Jun 26 11:00:14 2008 -0700 Hal Rosenstock
+9a48e495e8737e3d5c9c2d98f3b260299ca39fe2
+
+	* opensm/man/opensm.8.in: Clarify ignore-guids file format
+
+Thu Jun 26 07:07:51 2008 -0700 Hal Rosenstock
+afb00e0a51493e8bfc944a1a3a6f96f54bb1f1b7
+
+	* osm_port_profile: Change some variable names for consistency
+
+Thu Jun 26 07:08:25 2008 -0700 Hal Rosenstock
+fa1de7242f46c48d808ebf0e394d50ecc6e0c87b
+
+	* opensm/include/opensm/osm_port.h: Commentary change
+
+Wed Jun 25 08:16:59 2008 -0700 Hal Rosenstock
+56a3fbbcac0623ca92be1b1399ff6baf27ce967d
+
+	* opensm/include/opensm/osm_port_profile.h: Cosmetic formatting changes
+
+Wed Jun 25 13:04:38 2008 +0300 Sasha Khapyorsky
+dbc62923cc09561a137fd6303c0ef839b84e243c
+
+	* opensm: workaround CL_ASSERT() failure with port_order_list qlist
+
+Wed Jun 25 23:45:19 2008 +0300 Sasha Khapyorsky
+a7aeebd9c731fa0be3945f9806e90ab4170f303c
+
+	* opensm/man: add -F. --config option to OpenSM man page
+
+Wed Jun 25 23:08:11 2008 +0300 Sasha Khapyorsky
+bfac93e5b88847cfe5444e81ed5b74b7f0a6faf7
+
+	* opensm: --create-config <file-name> command line option
+
+Wed Jun 25 23:30:56 2008 +0300 Sasha Khapyorsky
+2aa72ca5a203c727446ec5080cc73b67f75bcf97
+
+	* opensm/configure.in: fix HAVE_DEFAULT_OPENSM_CONFIG_FILE define generation
+
+Wed Jun 25 16:17:10 2008 +0300 Sasha Khapyorsky
+1f184cf466583e106546b7283e7e7e92df415a1d
+
+	* opensm: add --version command line option
+
+Wed Jun 25 16:51:04 2008 +0300 Vincent Ficet
+585b6019ab0a44390bd3bb6ab0cb4f44788d133a
+
+	* opensm: fix wrong port_guid initialization
+
+Wed Jun 25 06:03:06 2008 +0300 Sasha Khapyorsky
+5863032fc15ce12c8bf91232946c34119e36d020
+
+	* opensm/osm_subnet.h: comments formatting
+
+Mon Jun 23 13:24:28 2008 +0300 Sasha Khapyorsky
+d8e75668e726c0277492b90276a37625c933b992
+
+	* opensm/osm_ucast_mgr: some code consolidation and cleanup
+
+Mon Jun 23 13:20:26 2008 +0300 Sasha Khapyorsky
+d1ce91659c4cb4f44af763e00ed3709cb84c33a0
+
+	* opensm/complib: cl_item_obj macro
+
+Wed Jun 25 04:46:13 2008 +0300 Sasha Khapyorsky
+df681bdf54f2d836af871d037c192b6111ffae0c
+
+	* opensm: trivial rename max_unicast_lid_ho and max_multicast_lid_ho
+
+Wed Jun 25 04:29:32 2008 +0300 Sasha Khapyorsky
+56072cc82a6789dd9ab366203678b577f7380087
+
+	* opensm: merge all __get_mgrp_by_mlid() instances
+
+Wed Jun 25 03:54:48 2008 +0300 Sasha Khapyorsky
+33b6746282ff91dfd9282c93cd0dc1b6a5dc6082
+
+	* opensm/osm_sa_mcmember_record: cleanup __get_new_mlid() function
+
+Wed Jun 25 03:43:30 2008 +0300 Sasha Khapyorsky
+36f1d593c1cfabb562ef77a4ebde0fc517b3e565
+
+	* opensm/osm_subnet: rename field mgrp_mlid_tbl to mgroups
+
+Tue Jun 24 16:28:48 2008 -0700 Hal Rosenstock
+654ca595ad4a92065c7489a6ab7413c2a15a916a
+
+	* opensm: Convert mgrp_mlid_tbl into array
+
+Sun Jun 22 04:50:06 2008 -0700 Hal Rosenstock
+6dd053a4fe06079c397b6e450383c6a4eb74f081
+
+	* opensm/osm_sw_info_rcv.c: Cosmetic formatting change
+
+Tue Jun 24 11:12:38 2008 -0700 Hal Rosenstock
+8d57aa6a49379d4358275b695776ce6f529301b9
+
+	* opensm/include/opensm/osm_port_profile.h: Cosmetic formatting changes
+
+Tue Jun 24 07:27:13 2008 -0700 Hal Rosenstock
+26abbb9291aa787de975dddcb100b36aa33977a7
+
+	* opensm/include/complib/cl_fleximap.h: Improve cl_pfn_fmap_cmp_t PARAMETERS comments
+
+Tue Jun 24 16:04:04 2008 +0300 Sasha Khapyorsky
+3dc9d1cd185bf177acafa294764b1d5d00e3f6ca
+
+	* opensm_ucast_mgr: add node name and port number to the logging
+
+Mon Jun 23 13:25:08 2008 -0700 Al Chu
+77a3d0390d9ec515c18647008e7cf6b762d97314
+
+	* implement guid_routing_order_file
+
+Mon Jun 23 13:25:06 2008 -0700 Al Chu
+6e9c5054da2305508b7f0da07106f721562d51c0
+
+	* rearch __osm_ucast_mgr_process_tbl() usage
+
+Mon Jun 23 13:25:02 2008 -0700 Al Chu
+08a945131dd0b089f57e07b79f69191a568cb7a1
+
+	* add guid_routing_order_file option
+
+Sun Jun 22 15:13:44 2008 +0300 Sasha Khapyorsky
+7679c46cca2c40ea4a5d0f370908b5f086a56dae
+
+	* cmoplib/*.h: trivial: remove empty lines in structure definitions
+
+Tue Jun 24 06:04:43 2008 +0300 Sasha Khapyorsky
+a729795f2db3c0230d08d4d7b62d64d76d7dcb8a
+
+	* opensm: fix compilation error with --enable-debug
+
+Fri Jun 13 23:34:40 2008 +0300 Sasha Khapyorsky
+48702f1a681df7886e98e03a4c2d50239f447110
+
+	* opensm: support for multiple event plugins
+
+Fri Jun 13 23:21:23 2008 +0300 Sasha Khapyorsky
+a777763fecef2cc3ab5164bd5b348fb5fcaefe7f
+
+	* opensm: move event_plugin from perfmgr to opensm
+
+Fri Jun 13 15:03:46 2008 +0300 Sasha Khapyorsky
+bc73030982eac9570e5c2bce0350060b48bdd861
+
+	* opensm/config: allow space separated strings as values
+
+Sat Jun 14 15:39:58 2008 +0300 Sasha Khapyorsky
+13e1827031cfcf3b5d84daf0a798729a2900a21c
+
+	* opensm/perfmgr: move event_db_dump_file to common OpenSM dump dir
+
+Fri Jun 20 15:21:37 2008 -0700 Hal Rosenstock
+d24951e2370ff0b1fb3e5300a4f68c1c56db30b5
+
+	* opensm/osm_lid_mgr.c: Fix off by 1 issue with max_lid
+
+Fri Jun 20 11:59:09 2008 -0700 Hal Rosenstock
+3174bbdedce692351c96d3f7a385c6e279815e4d
+
+	* opensm/osm_sw_info_rcv.c: Cosmetic formatting changes
+
+Fri Jun 20 11:57:39 2008 -0700 Hal Rosenstock
+52eb3ecf33693db87c1b55c317f3d12b44929789
+
+	* opensm/osm_sa_mcmember_record.c: Fix some off by 1 issues related to max_multicast_lid_ho
+
+Fri Jun 20 07:34:38 2008 -0700 Hal Rosenstock
+10a9c0df0d131cebb86e7e52b30789a209b39d48
+
+	* opensm/osm_subnet.h: Cosmetic formatting changes
+
+Fri Jun 20 07:24:43 2008 -0700 Hal Rosenstock
+68a2fdbd61f18c5a95d0c0d59ef1548baebe79d3
+
+	* opensm/osm_switch: Cosmetic formatting changes
+
+Fri Jun 20 06:56:53 2008 -0700 Hal Rosenstock
+af46480439c0587078fc10d059c629a8558aee61
+
+	* opensm/osm_port.c: Cosmetic commentary changes
+
+Wed Jun 18 07:09:40 2008 -0700 Hal Rosenstock
+69c51f220f181a3e4a413a7031f0e2f1f806672b
+
+	* opensm/include/osm_mtree.h: Eliminate unneeded include
+
+Wed Jun 18 07:04:20 2008 -0700 Hal Rosenstock
+9cc5ce7774a483243131f8556db9b7bdaa0d69dc
+
+	* opensm/include/osm_prefix_route.h: Support C++ inclusion
+
+Wed Jun 18 06:44:54 2008 -0700 Hal Rosenstock
+f8753846fba326d3573e710021892c4a995f4608
+
+	* opensm/include/osm_db.h: Fix some typos
+
+Wed Jun 18 06:44:50 2008 -0700 Hal Rosenstock
+7792c20d46bfe73e6763b23eb0c72c826e2aa88b
+
+	* opensm/include/osm_port.h: Eliminate some unneeded includes
+
+Wed Jun 18 13:56:56 2008 +0300 Sasha Khapyorsky
+6e38b2175f79ff6208e9868d4db061f9cb708676
+
+	* opensm/osm_ucast_ftree.c: trivial: remove OSM_LOG_EXIT
+
+Sun Jun 15 16:49:00 2008 +0300 Sasha Khapyorsky
+4a2b95c8d62bc2e68d936234a2214124ff54b62d
+
+	* opensm: make osm_perfmgr_db.* content dependent on PerfMgr availability
+
+Mon Jun 16 12:28:41 2008 +0300 Sasha Khapyorsky
+21adbd886bb063b7e0480c1c596d34115ba4f1e5
+
+	* opensm: replace inclusion of osm_vendor.h by osm_vendor_api.h
+
+Sun Jun 15 11:26:26 2008 +0300 Sasha Khapyorsky
+370fee787f0e64c4148e43eccb4e1431ab5d5288
+
+	* opensm: rename 'struct _osm_*_t' to 'struct osm_*'
+
+Sun Jun 15 21:31:26 2008 +0300 Sasha Khapyorsky
+7deb52591c66598597b97dff8c9691745a305d7f
+
+	* osm_vendor_select.h: make OSM_VENDOR_INTF_OPENIB to be default
+
+Tue Jun 17 14:09:29 2008 +0300 Yevgeny Kliteynik
+07fefc066b20b813942636cc251d5969a7ccb52c
+
+	* opensm/man/opensm.8.in: TRIVIAL addition in fat-tree description
+
+Tue Jun 17 06:42:56 2008 -0700 Hal Rosenstock
+f6ac0ee5d671a987752ff70c3ade23078da4515b
+
+	* opensm/osm_lid_mgr.c: Cosmetic formatting changes
+
+Tue Jun 17 06:02:59 2008 -0700 Hal Rosenstock
+2cc1097661f8930f21bc206c0a0f684a82b8452a
+
+	* opensm/osm_mcast_mgr.c: Cosmetic comment format change
+
+Tue Jun 17 05:58:01 2008 -0700 Hal Rosenstock
+a930f708ba6444f0557951764f72778bcff1941b
+
+	* opensm/osm_sa_mcmember_record.c: Cosmetic changes
+
+Tue Jun 17 05:06:44 2008 -0700 Hal Rosenstock
+6add4d28cfa4a1abb45df781f57523eebddd2922
+
+	* opensm/include/opensm/osm_multicast.h: Cosmetic changes
+
+Mon Jun 16 16:14:00 2008 +0300 Yevgeny Kliteynik
+39de5fe7c8f086e50d0377e8f7da8680a21b03a4
+
+	* opensm/osm_qos_parser.y: TRIVIAL addition in log message
+
+Mon Jun 16 06:07:51 2008 -0700 Hal Rosenstock
+fa9b337759e0ecf4a19a0e214683a77fced81dfd
+
+	* opensm/osm_sa_mcmember_record.c: Some error message improvements
+
+Mon Jun 16 08:55:48 2008 +0300 Sasha Khapyorsky
+caee6497151bf48d8b575d690f7b6f776f7f2221
+
+	* opensm/osm_subnet.h: remove some not used typedefs
+
+Mon Jun 16 08:30:05 2008 +0300 Sasha Khapyorsky
+065cdf639e7b80eef73c6d7ff4b734061b03b6d1
+
+	* opensm/osm_console: use osm_get_switch_by_guid()
+
+Sun Jun 15 11:35:40 2008 +0300 Sasha Khapyorsky
+2e3724584de962d7ecc99d55a3ddf6fdc9d33e43
+
+	* opensm/inculde/*.h: remove empty lines in type definitions
+
+Sun Jun 15 14:45:02 2008 +0300 Sasha Khapyorsky
+fcaf815088f6546fcb316f20c62f6b3fc7d7603f
+
+	* opensm/osm_console.c: fix guid parsing
+
+Sun Jun 15 14:43:54 2008 +0300 Sasha Khapyorsky
+feaa068bad8ef7d8cf0515ed8ff8e320287302d7
+
+	* opensm/osm_concole.c: trivial: break comment long lines
+
+Fri Jun 13 16:04:56 2008 +0300 Sasha Khapyorsky
+3b7ac019b2325bab47a74fcf9ba0c02892d51d88
+
+	* opensm: consolidate config parser logging code
+
+Sat Jun 7 20:38:22 2008 +0300 Sasha Khapyorsky
+f33836775c444f5df72b19aa713588ab64841898
+
+	* opensm: preserve base lid routes
+
+Sat Jun 7 02:09:19 2008 +0300 Sasha Khapyorsky
+d1b71f0aee61e661321732284af151f3ae2e8077
+
+	* opensm: move remote guids counting to ucast_mgr
+
+Sat Jun 14 06:01:26 2008 -0700 Hal Rosenstock
+95fdcf7a6876f7f5378b2e01a9a5c7a4e63bbee8
+
+	* opensm/osm_subnet.c: Fix typo
+
+Fri Jun 13 10:35:55 2008 -0700 Hal Rosenstock
+393b0a09da13261e58d62d84165aa184cb82b253
+
+	* opensm/man/opensm.8.in: Update consolidate_ipv6_snm_req description
+
+Fri Jun 13 10:28:29 2008 -0700 Hal Rosenstock
+5bc6f560067f23a923184a3c133755d0b66f2627
+
+	* opensm/osm_sa_mcmember_record.c: When consolidating SNM, need separate group per PKey
+
+Sat Jun 14 15:28:18 2008 +0300 Sasha Khapyorsky
+514299808345a1a905f1275b891e2a7401b8ddfc
+
+	* opensm: replace "(null)" string with null_str variable
+
+Thu Jun 12 11:02:48 2008 -0700 Hal Rosenstock
+fa01d03cf2869cf2adc6efca9bf75858f33bea01
+
+	* opensm/osm_sa_mcmember_record.c: Breakup some long lines
+
+Thu Jun 12 06:35:58 2008 -0700 Hal Rosenstock
+cdb458874db4cc8918aeffb0605971aedeede48c
+
+	* opensm/osm_trap_rcv.c: Break up some long comment lines
+
+Thu Jun 12 06:35:56 2008 -0700 Hal Rosenstock
+e449f3d83079b5bdd1123f934ccd3fe30400339e
+
+	* opensm/osm_sa_path_record.c: Break up some long OSM_LOG lines
+
+Tue Jun 10 15:59:22 2008 +0300 Sasha Khapyorsky
+84bcf9a5efb98a212375daf89ec5596beda82bdc
+
+	* opensm: state default SM_Key value change in usage and man
+
+Thu May 22 17:15:45 2008 +0300 Sasha Khapyorsky
+93052f92fcecfa18fdf7befb2079b2e5dc80755b
+
+	* opensm: fix OSM_DEFAULT_SM_KEY byte order
+
+Wed Jun 11 08:55:39 2008 -0700 Hal Rosenstock
+fd8b3281f6c039e4bd4bd9cc165f73969e7512e0
+
+	* opensm/osm_lin_fwd_tbl.c: Minor change to __osm_lin_tbl_compute_obj_size
+
+Wed Jun 11 10:54:29 2008 -0700 Hal Rosenstock
+ebc70a60a1409e77d2e14d7ca09ca1bfea8b400a
+
+	* OpenSM/libvendor/osm_vendor_ibumad_sa.c: Eliminate unneeded define
+
+Wed Jun 11 12:47:34 2008 -0700 Hal Rosenstock
+427d9b313d1865271bdc87623068ae9058f5f4a4
+
+	* OpenSM/include/osm_port_profile.h: Fix some typos
+
+Wed Jun 11 11:27:17 2008 -0700 Hal Rosenstock
+295e3faed70514f6d6d145a1458442df3862c529
+
+	* OpenSM/include/opensm: Fix some commentary typos
+
+Tue Jun 10 07:25:59 2008 -0700 Hal Rosenstock
+cdab26ab42e395ec6c4fe942a5aec9c4c5f10afe
+
+	* opensm/include/iba/ib_types.h: Fix comment
+
+Sun Jun 8 18:56:04 2008 +0300 Sasha Khapyorsky
+804b032b71807e58f9b9d0253f30bf95f614e39e
+
+	* opensm/configure.in: remove AM_MAINTAINER_MODE
+
+Mon Jun 9 09:20:17 2008 -0700 Hal Rosenstock
+6f22d6fb26b84c470183c5519e873580eab5c2d0
+
+	* OpenSM/osm_sa_path_record.c: Add some information to some error log messages
+
+Mon Jun 9 07:44:27 2008 -0700 Hal Rosenstock
+baebc2f4f4b895451667dd18d719c017587981ec
+
+	* OpenSM/osm_sa_mcmember_record.c: Cosmetic change to error log message
+
+Mon Jun 9 06:24:26 2008 -0700 Hal Rosenstock
+1f250b65171a505219c16311218449ca9ec1d9a5
+
+	* OpenSM/osm_sa_portinfo_record.c: Cosmetic comment change
+
+Mon Jun 9 06:24:20 2008 -0700 Hal Rosenstock
+e5bb8d4ddc86ade07c5b29f482d3c8a414692f58
+
+	* opensm/libvendor/osm_vendor_ibumad_sa.c: Cosmetic changes
+
+Sat Jun 7 23:24:57 2008 +0300 Sasha Khapyorsky
+f5598b4e7aa86ab9ebf4ff7e2e9cd3889ea2117a
+
+	* opensm: improve log messages in __osm_state_mgr_check_tbl_consistency()
+
+Sun Jun 8 06:16:14 2008 +0300 Sasha Khapyorsky
+d69c5e8f18821a0e48ffbf03526927c54d06ac3f
+
+	* opensm: remove some vestigial comments and RCS keywords
+
+Sat Jun 7 10:30:46 2008 -0700 Hal Rosenstock
+a1e596a471e3fca5676f4c09529af9434b96583a
+
+	* OpenSM: Remove some vestigial comments
+
+Sat Jun 7 06:03:28 2008 -0700 Hal Rosenstock
+cd1569106d154ef754dd1621aef676c09be0e9ae
+
+	* OpenSM/osm_sa_mcmember_record.c: Comment reformatting
+
+Wed Jun 4 05:44:27 2008 -0700 Hal Rosenstock
+9b36a7e64dd267d33603793c5ca8bd7cc3d6a0e8
+
+	* opensm/osm_port.c: Eliminate potential NULL pointer dereferences
+
+Wed Jun 4 04:37:57 2008 -0700 Hal Rosenstock
+574f7984de8f22a8f1c0bc5098bf7c67b0d57ca1
+
+	* opensm/osm_pkey.c: Eliminate potential NULL pointer dereference
+
+Wed Jun 4 04:37:16 2008 -0700 Hal Rosenstock
+2aa1adc9755594f1466d78468c4c7ecef37fa49e
+
+	* opensm/osm_ucast_ftree.c: Eliminate unnecessary check in __osm_ftree_sw_tbl_element_create
+
+Wed Jun 4 04:37:00 2008 -0700 Hal Rosenstock
+27ed4e2e33af32a9ef78e584eb8ec5b0ad78f84e
+
+	* opensm/osm_sa_mcmember_record.c: Minor logic change in __get_new_mlid
+
+Sun Jun 1 01:08:05 2008 +0300 Sasha Khapyorsky
+e17972e1bb94a603ea14c9c434ad023ea64f14a0
+
+	* opensm: remove osm_log reference from osm_mad_pool object
+
+Mon Jun 2 07:00:39 2008 -0700 Hal Rosenstock
+474dd65172d917a0b3e0ede8d3ce8bde8846a8b5
+
+	* OpenSM/osm_sa_mcmember_record.c: Validate some more MGID bits for IPv6 SNM
+
+Mon Jun 2 10:05:17 2008 -0700 Hal Rosenstock
+457cd4ba18bbedb3929a4b54cad7c4037b16a1fc
+
+	* opensm/osm_lin_fwd_tbl.c: Eliminate potential NULL pointer dereference
+
+Mon Jun 2 23:30:36 2008 +0300 Sasha Khapyorsky
+3a1b21808d40a3501c26f9154e5c731db16dbc52
+
+	* opensm/osm_lid_mgr.c: indentation fixes
+
+Mon Jun 2 07:25:29 2008 -0700 Hal Rosenstock
+48ddf2c309023d1a253bf740593a8af33411f19c
+
+	* opensm/osm_lid_mgr.c: Eliminate some potential NULL pointer dereferences
+
+Mon Jun 2 07:00:29 2008 -0700 Hal Rosenstock
+120ef0f5123f028a59b142edfbd9987f40ba9896
+
+	* OpenSM release notes: Update to 3.1.11
+
+Sat May 31 10:31:57 2008 -0700 Hal Rosenstock
+7300de84f208492286fbc13be7ede192899a8959
+
+	* OpenSM/osm_sa_mcmember_record.c: Collapse all scopes when consolidating IPv6 SNM
+
+Fri May 30 11:07:15 2008 -0700 Hal Rosenstock
+915c5a3946d1b84f59d0c6d6ea53051ca7e8b873
+
+	* opensm/osm_subnet.c: Change comment for IPv6 SNM in options file
+
+Fri May 30 04:07:57 2008 -0700 Hal Rosenstock
+aafc2fc467339597ed95f5cbb4bdfb1aa484dc43
+
+	* OpenSM: Add another HP OUI to recognized vendor IDs
+
+Thu May 29 12:25:10 2008 -0700 Hal Rosenstock
+e5bae1558c940fb0c07e5b2d61c01b5d35da4e02
+
+	* opensm/main.c: Minor change to long option for consolidate_ipv6_snm_req
+
+Thu May 29 12:25:07 2008 -0700 Hal Rosenstock
+3fe1bd0367ddc8788823b8c26a2bdea9ce46465a
+
+	* opensm/osm_sa_mcmember_record.c: Improve log message and some comments relating to SNM
+
+Thu May 29 06:22:52 2008 -0700 Hal Rosenstock
+cdb772bb0ad611f2351f0eec8b32203d014876b1
+
+	* management: Support separate SA and SM keys as clarified in IBA 1.2.1
+
+Mon Mar 31 00:59:12 2008 +0300 Sasha Khapyorsky
+2f7273110bc5df3920e5746e817d3a81b8597c93
+
+	* opensm: use OSM_DEFAULT_CONFIG_FILE as config file
+
+Sun Mar 30 21:46:09 2008 +0300 Sasha Khapyorsky
+e61ccf5407114b28bc674af108d478f9e7580513
+
+	* opensm: option to specify config file
+
+Sun Mar 30 20:47:34 2008 +0300 Sasha Khapyorsky
+6ab6746b091b9e1d829a3a52c338bcca7b226b49
+
+	* opensm: config file functions return int
+
+Sun Mar 30 20:27:25 2008 +0300 Sasha Khapyorsky
+1dde03e8f7b09f6f6a72fa7822175ace422870a1
+
+	* opensm: pass file name as parameter to config parser funcs
+
+Fri May 23 11:40:54 2008 +0300 Sasha Khapyorsky
+17d618f13481d39032e6c95d6d9fda0c4b5c905a
+
+	* opensm/scripts: remove opensm.conf usage
+
+Fri May 23 11:09:39 2008 +0300 Sasha Khapyorsky
+3ccb3a6904dc7194eca0bbae6e455edbd57f437b
+
+	* opensm/scripts: remove not used opensmd template
+
+Thu May 22 17:43:34 2008 +0300 Sasha Khapyorsky
+3620842af3e3a1ee499d3a83edbc5d009ef698b2
+
+	* opensm/scripts/opensm.init.in: fix status command
+
+Mon May 19 17:00:58 2008 +0300 Sasha Khapyorsky
+650811e201158d0f54da915305276e430f5b7d96
+
+	* opensm: write all OpenSM options to cache file
+
+Mon May 19 15:37:03 2008 +0300 Sasha Khapyorsky
+cb0759cef0bb09309f3400c433fd5c497b7a4f39
+
+	* opensm: port_prof_ignore_file option
+
+Mon May 19 15:12:45 2008 +0300 Sasha Khapyorsky
+1a175cf98150bd7930c2e89f5b7c11f65ef735f7
+
+	* opensm: remove unused pfn_ui_* callback options
+
+Mon May 19 15:00:57 2008 +0300 Sasha Khapyorsky
+c5e29b6f137dfbe28b042c5bef6a4720f9a0d301
+
+	* opensm: merge disable_multicast and no_multicast_option options
+
+Fri May 16 13:16:16 2008 -0700 Hal Rosenstock
+b6c3408be7d63620f9d1f9c8ce7d3908b64eb52f
+
+	* OpenSM/doc/QoS_management_in_OpenSM.txt: Remove mention of OFED
+
+Fri May 16 13:13:52 2008 -0700 Hal Rosenstock
+ae3f62857417537b4f4b860fa901aca93a3a079c
+
+	* OpenSM/doc/modular_routing.txt: Fix typo
+
+Thu May 15 13:27:23 2008 -0700 Ira Weiny
+3f270054602fed5c54e3f80d9563177568926464
+
+	* OpenSM: Add a Performance Manager HOWTO to the docs and the dist
+
+Thu May 15 13:27:21 2008 -0700 Ira Weiny
+4f39aa9c52b19e87f49749bfdff6d2e9e9d4015f
+
+	* OpenSM: Fix rpm build, <sysconfdir>/opensm/opensm.conf failed to install
+
+Thu May 15 12:08:30 2008 +0300 Yevgeny Kliteynik
+890d890861fe4f4780cdf43c62ab9e8faffed903
+
+	* opensm/ib_types.h: fixing some wrong comments
+
+Thu May 15 10:03:02 2008 +0300 Yevgeny Kliteynik
+0474af218256510d073cbda5be7df1a0193e1c31
+
+	* opensm/ib_types.h: cosmetics - µsec t o usec
+
+Thu May 15 09:04:33 2008 +0300 Sasha Khapyorsky
+1b134db8c1c84c2cf6d67bee11d9835b1d2d7b28
+
+	* opensm/doc/current-routing.txt: add DOR algorithm reference
+
+Tue May 6 07:33:26 2008 -0700 Hal Rosenstock
+58808bd39feedc341b8b2affdecae9f5e119c35c
+
+	* OpenSM: Add QoS_management_in_OpenSM.txt to opensm/doc directory
+
+Tue May 13 23:59:44 2008 +0000 Sasha Khapyorsky
+1e0b9a5d85cfc78d96669450bd3857ca8717239d
+
+	* opensm/osm_lid_mgr.c: cosmetic
+
+Thu Apr 24 18:16:57 2008 -0700 Ira Weiny
+d26423dcdaf0b2ad20047a92f517b0c8a1ca2959
+
+	* opensm/opensm/osm_lid_mgr.c: set "send_set" when setting rereg bit
+
+Tue May 13 14:15:22 2008 +0300 Yevgeny Kliteynik
+d445680ceb555d58245d01c5f1574630e056a512
+
+	* opensm/osm_state_mgr.c: fix segmentation fault
+
+Tue Apr 22 14:06:01 2008 -0700 Ira Weiny
+3a8d399a9031ad2818b6ce94625ed373732cc566
+
+	* opensm/configure.in: Fix the QOS and prefix routes config file default locations
+
+Tue Apr 15 15:05:53 2008 -0700 Al Chu
+a77ad37dc85ddb0cf00a6c0c14376e234d9cf109
+
+	* ids_guid_file manpage entry
+
+Sat Apr 5 04:48:34 2008 +0300 Sasha Khapyorsky
+0557a149d6b77f0a11c48ef2a3c9ae8f517f1e59
+
+	* opensm/osm_base.h: fix typo
+
+Thu Apr 3 14:30:54 2008 -0700 Ira Weiny
+05c9b995a8582daf67413cc2189f43b0919538fb
+
+	* opensm/opensm/osm_perfmgr.c: change log level of counter overflow message
+
+** Version: opensm-3.2.1
+
+Thu Apr 3 22:52:03 2008 +0300 Sasha Khapyorsky
+3b7a07a8d2b00bac60678a6fc199d09fd682fb2f
+
+	* opensm: add osm_console_io.h to EXTRA_DIST list
+
+Thu Apr 3 20:07:55 2008 +0300 Sasha Khapyorsky
+9938c95a9676d2f653f52593d126d5e2df68ceb0
+
+	* management: bump all versions
+
+Tue Apr 1 17:51:22 2008 +0300 Sasha Khapyorsky
+0f79b8f67811008e6f92222e395d0c1bb49eca95
+
+	* opensm/osm_base.h: use OPENSM_COFNIG_DIR in config files paths definitions
+
+Tue Apr 1 17:42:05 2008 +0300 Sasha Khapyorsky
+90d71686512bea43ef649498328d351b3528ce05
+
+	* opensm/configure.in: make prefix routes config file configurable
+
+Tue Apr 1 16:48:21 2008 +0300 Sasha Khapyorsky
+6514759806eb87357959bc48f7027459dc40d0f1
+
+	* opensm/configure.in: replace CONF_DIR config var by OSM_CONFIG_DIR
+
+Mon Mar 31 01:54:02 2008 +0300 Sasha Khapyorsky
+3d58bd6c063c77fd579c4bda772e23d18921dabf
+
+	* opensm/configure.in: improve readability of configured config files
+
+Sun Mar 30 17:07:52 2008 +0300 Sasha Khapyorsky
+e7f7443d5f487ba1c25f03c8ced4857db0032aa1
+
+	* complib/nodenamemap: merge file parsers
+
+Sun Mar 30 15:53:39 2008 +0300 Sasha Khapyorsky
+5811a4e20c82d76102203b73e6939481977cf565
+
+	* opensm: make formats of node map names and up/down guid ids files identical
+
+Tue Apr 1 15:45:50 2008 +0300 Sasha Khapyorsky
+443901c5d8f160d71cb0ee64f21c3150d1768f0b
+
+	* opensm/scripts/opensmd.in: fix typo
+
+Sun Mar 30 21:58:39 2008 +0300 Sasha Khapyorsky
+8687f60d0248bd08c3794fa64009d40a73d1250d
+
+	* opensm/configure.in: fix typo
+
+Sun Mar 30 18:48:53 2008 +0300 Sasha Khapyorsky
+7ec7f4c0970778918c3f6c0a2bda5918fda1d85f
+
+	* opensm: remove duplicated osm_subn_set_default_opt() prototype
+
+Wed Mar 26 01:32:13 2008 +0200 Sasha Khapyorsky
+cf99e2513845ccbd0c244f004d65f155f093fc68
+
+	* opensm/updn: --ids_guid_file - node guids to ids map
+
+Tue Mar 25 17:56:57 2008 +0200 Sasha Khapyorsky
+606c40cd5c5060f55fafa8d5861964a13ee2b4bb
+
+	* opensm: remove unused osm_ucast_mgr_read_guid_file()
+
+Tue Mar 25 17:50:25 2008 +0200 Sasha Khapyorsky
+ebd918711a6f2ccf1f9e12b570f6885a24673e26
+
+	* opensm/ftree: use parse_node_map() for guids file processing
+
+Tue Mar 25 17:05:58 2008 +0200 Sasha Khapyorsky
+ab05e7d319bd73f0c4a104d49f70321b8bb6112e
+
+	* opensm/updn: update root nodes at each run
+
+Tue Mar 25 04:44:19 2008 +0200 Sasha Khapyorsky
+7a7aadb4932a649891c39db01f806db33d850564
+
+	* opensm/updn: use parse_node_map() for root node guids file processing
+
+Tue Mar 25 04:37:11 2008 +0200 Sasha Khapyorsky
+1d575fbf26f4c3456d7bc955fc93c39c58a47302
+
+	* complib/nodenamemap: add generic parse_node_map() function
+
+Wed Mar 26 19:05:22 2008 +0200 Sasha Khapyorsky
+599a343543698ef13c21be590a0ccc79f3107a9b
+
+	* opensm: update copyright dates after recent changes
+
+Wed Mar 26 17:50:40 2008 +0200 Sasha Khapyorsky
+7add9df3cc2a0cd670f4316925a7a1c78ec18247
+
+	* opensm: remove not used osm_log_printf() function
+
+Wed Mar 26 17:45:45 2008 +0200 Sasha Khapyorsky
+1041fae3b9863b35467032583bcf65700b1b420a
+
+	* opensm: unify dumpers, use fprintf() every there
+
+Wed Mar 26 16:19:01 2008 +0200 Sasha Khapyorsky
+ba7a93fe8638dc7692165c42e84700f8c0695369
+
+	* opensm/updn: dump used root nodes guid
+
+Wed Mar 26 16:14:06 2008 +0200 Sasha Khapyorsky
+5e09f6cf60ff6f7e137eb703bfb9297624819b1d
+
+	* opensm: osm_dump_qmap_to_file() function
+
+Wed Mar 5 13:28:37 2008 +0200 Sasha Khapyorsky
+0f736f61e19f0c103b17ae38799e06e01dc40177
+
+	* opensm: send trap 64 only after new ports are in ACTIVE state.
+
+Wed Mar 26 18:41:37 2008 +0200 Sasha Khapyorsky
+f2fff7aec0a3cd5063b8b2cdf461c3f14b795bf0
+
+	* opensm: switch LFTs incremental update fix
+
+Wed Mar 26 17:31:21 2008 -0700 Al Chu
+7080cb08e65047f94f671f85dcd434fdc00ebf5a
+
+	* opens: fix trivial ftree comments
+
+Wed Mar 26 16:09:07 2008 +0200 Sasha Khapyorsky
+dd4f0bc1fa025b6e801a7206fe543007cbb4de55
+
+	* opensm: trivial: fix in commented functions
+
+Mon Mar 24 16:49:12 2008 +0200 Yevgeny Kliteynik
+80d6087746ee327e78a7516ed0e823c23ae92232
+
+	* opensm/QoS: setting SL in the IPoIB MCast groups
+
+Tue Mar 25 13:54:48 2008 +0200 Dotan Barak
+d6ef804689fc9643de8e99ed67a4b3c96c7bb17f
+
+	* management: Remove extraneous semicolon from several files
+
+Tue Mar 25 02:08:14 2008 +0000 Sasha Khapyorsky
+d81d7dd6850df0a6450e471b84e8d172fe418cb2
+
+	* opensm/osm_trap_rcv: remove unused variable
+
+Mon Mar 17 23:16:51 2008 +0200 Sasha Khapyorsky
+88fdab25281bb4f541af0eabb5df4dc4122359b8
+
+	* opensm: minor memory leak fix
+
+Mon Mar 24 09:37:09 2008 +0000 Sasha Khapyorsky
+c3674c177cce552a8e73ef203ac5004fc75b6c09
+
+	* opensm/osm_mcast_mgr: limit spanning tree creation recursion to max hops (64)
+
+Mon Mar 24 09:13:44 2008 +0000 Sasha Khapyorsky
+89218d4b3bc5f7d6442d13db685673573e205644
+
+	* opensm: updn/connect_roots: preserve connectivity to root nodes
+
+Mon Mar 24 01:38:05 2008 +0200 Yevgeny Kliteynik
+6dce14a1f6ff50488ab6de2a597b299e38b66b00
+
+	* OpenSM release notes
+
+Mon Mar 24 01:01:01 2008 +0200 Yevgeny Kliteynik
+1d7eaaab39f28cbd29b81faa8eb25b5df9e04271
+
+	* opensm/osm_partition.h: trivial - fixing pkey order in struct
+
+Sat Mar 22 07:35:52 2008 -0700 Hal Rosenstock
+4a35d296faaf8f3a073d8d576ad0216df1ec036b
+
+	* OpenSM release notes: Add in new QLogic HCAs
+
+Fri Mar 21 15:51:22 2008 -0700 Ira Weiny
+c4642e95b33117a5a71d5d838dd39c02ebf541a9
+
+	* opensm/opensm/osm_trap_rcv.c: respond to new trap 144 node description update flag
+
+Thu Mar 20 07:39:01 2008 -0700 Hal Rosenstock
+cd72cdee7009e7018337f0d5f3430b29fdd040f6
+
+	* opensm/doc/partition-config.txt: Update default file name
+
+Thu Mar 20 07:34:55 2008 -0700 Hal Rosenstock
+4cabe307eafd581144b0359cb0e6902b29aabf8d
+
+	* OpenSM release notes: Add byacc as alternative to bison for qos parser
+
+Wed Mar 19 09:36:49 2008 -0700 Ira Weiny
+04ee3fb8a5e0ed753d63860ceea0fbe4188779e1
+
+	* Ensure ownership of the /etc/opensm directory
+
+Wed Mar 19 07:35:04 2008 -0700 Hal Rosenstock
+78eb38812c656f20307d24aefef11f17dc135682
+
+	* OpenSM/osm_subnet.c: Cosmetic changes to options file
+
+Tue Mar 18 07:19:24 2008 -0700 Hal Rosenstock
+0359bbdd77d7096e373c8c1db66e389a2d384464
+
+	* OpenSM release notes: Clarify QoS firmware support
+
+Fri Mar 14 07:13:58 2008 -0700 Hal Rosenstock
+3911d455b630fa3f2b903be71ea05c1bdccf7f1d
+
+	* opensm/osm_sw_info_rcv.c: Clarify LinearFDBTop correction log message
+
+Thu Mar 13 14:55:30 2008 -0700 Al Chu
+32ce561346be104a39344648fd2c91d5a3a3252d
+
+	* opensm: add lidbalance command to console
+
+Wed Mar 12 10:23:35 2008 -0700 Ira Weiny
+0683ab8d65574871ec7cbb852cb432bbda47125e
+
+	* opensm/include/iba/ib_types.h: update Notice DataDetails for Trap 144 to 1.2.1
+
+Wed Mar 12 14:10:15 2008 -0700 Ira Weiny
+9c92d792af370221a2e8f80ce52238fe88c057d6
+
+	* opensm/include/iba/ib_types.h: fix DataDetails definitions based on 1.2 and 1.2.1 specification
+
+Thu Mar 13 14:32:30 2008 -0700 Albert L. Chu
+5be29d3cde9f8b577b7d5567e7d635af76709cef
+
+	* handle routers in switchbalance console command
+
+Wed Mar 12 15:37:23 2008 -0700 Al Chu
+9a569ca574608f18dd419f9f3d2f520b1770416b
+
+	* Opensm: switchbalance console option
+
+Mon Mar 10 17:18:59 2008 -0700 Al Chu
+b21206ce6918de31a4d32c716831409df9eb1694
+
+	* Opensm: minor code cleanup
+
+Mon Mar 10 17:01:16 2008 +0200 Yevgeny Kliteynik
+5fa2bccc61c053ede23972423094d876d4fdf178
+
+	* opensm/configure.in: make lex/yacc presence mandatory
+
+Mon Mar 10 16:56:23 2008 +0200 Yevgeny Kliteynik
+ce46870d307bc780cf51296d8728376a5ad2729e
+
+	* opensm/osm_qos_parser: fixed compilation on byacc
+
+Sun Mar 9 14:27:19 2008 +0200 Yevgeny Kliteynik
+941345e44c82990286df7bf05797680a3aa14926
+
+	* opensm/osm_subnet.{c,h}: osm_get_port_by_guid takes guid in network order
+
+Sat Mar 8 04:05:11 2008 +0200 Sasha Khapyorsky
+30bec4816ce7f9f8a9e40c492c73cafe7c319604
+
+	* opensm: in UP/DOWN algo compare GUID values in host byte order
+
+Sat Mar 8 04:01:50 2008 +0200 Sasha Khapyorsky
+c07cd5bf0e8163728e3ff332bdae6849d65b7880
+
+	* opensm/osm_ucast_updn.c: decrease noisy ranking debug prints
+
+Sat Mar 8 03:57:55 2008 +0200 Sasha Khapyorsky
+dec9303a8e5dc4298e33a0e439668e0611ea1300
+
+	* opensm/osm_dump: dump fixes
+
+Sun Mar 9 16:51:27 2008 +0200 Sasha Khapyorsky
+ff615dafb2f6384ec0902e8dfa4817d0044015da
+
+	* opensm/osm_switch.h: use tab instead of space charaters
+
+Sun Mar 9 16:50:46 2008 +0200 Sasha Khapyorsky
+bbf4b01826970385db3d558f9e156ea466688311
+
+	* opensm/osm_ucast_mgr: make error code uniq
+
+Mon Mar 3 15:08:44 2008 -0800 Al Chu
+fe13902f7f1d11c8a64214188d7665493236c89b
+
+	* opensm: multi lid routing balancing for updn/minhop
+
+Wed Mar 5 16:24:23 2008 +0000 Sasha Khapyorsky
+75f3f457f6a5dc98fd8af6171ef349a8d803e269
+
+	* opensm: release notes update
+
+Thu Mar 6 03:49:13 2008 +0200 Sasha Khapyorsky
+4e5986fcb13f4f7ee454e65f695e90cc91b82a31
+
+	* opensm/osm_sw_info_rcv.c: cosmetic formatting fix
+
+Sun Mar 2 07:46:59 2008 -0800 Albert Chu
+998679a3f0b3c1622eb04e72ccbd367ae4960789
+
+	* opensm: enforce routing paths rebalancing on switch reconnection (part 2)
+
+Sat Mar 1 17:49:55 2008 +0200 Sasha Khapyorsky
+c75d5f2f6d98b1833eb2c9cb71d02bb325935eed
+
+	* opensm: enforce routing paths rebalancing on switch reconnection
+
+Sun Mar 2 19:47:56 2008 +0000 Sasha Khapyorsky
+a1ff38ebbcc617eaf61cece06a4196fb665bae8a
+
+	* opensm: set SA attribute offset to 0 when no records are returned
+
+Sun Mar 2 19:37:03 2008 +0000 Sasha Khapyorsky
+70bdee883a224cb6f2f040429f2b15e8bb85c9c8
+
+	* opensm: rename osm_sa_vendor_send() to osm_sa_send()
+
+Sun Mar 2 18:45:37 2008 +0000 Sasha Khapyorsky
+3ce42a513f99949b88009f0feae85c399c39b5b2
+
+	* opensm: consolidate SA response sending code over SA processors
+
+Mon Mar 3 06:11:57 2008 -0800 Hal Rosenstock
+45ccdf2031b3f0268a5d3dbd88dee3799ba8b02e
+
+	* OpenSM: Set packet life time to subnet timeout option rather than default
+
+Sun Mar 2 19:23:40 2008 +0000 Sasha Khapyorsky
+000025adefcf53cc7bad6cc14b9208b5b7150777
+
+	* libvendor/osm_vendor_ibumad_sa.c: cosmetic
+
+Sun Mar 2 04:36:34 2008 +0200 Sasha Khapyorsky
+43c20ee5bc2cbdf723d09fb004d176545ec4c609
+
+	* opensm/osm_sa_service_record.c: remove unneeded braces
+
+Sun Mar 2 00:33:37 2008 +0200 Sasha Khapyorsky
+3172d112d17ce73f1d82a05499d28eb30435af66
+
+	* opensm: cosmetic code clean in SA area
+
+Sat Mar 1 22:21:09 2008 +0200 Sasha Khapyorsky
+3daabe950db11615cd9e9690df3fc2de2bd8b3ef
+
+	* opensm: move osm_sa_send_error() to osm_sa.c file
+
+Sat Mar 1 22:13:54 2008 +0200 Sasha Khapyorsky
+7700897bb4bea8305ca014fab16ebf0050cb4dd2
+
+	* opensm: consolidate osm_sa_vendor_send() status check
+
+Wed Feb 20 14:27:01 2008 -0800 Timothy A. Meier
+eb08a2d4a0b31bc4a77e0bc214db2a70e555281f
+
+	* opensm: console split console into two modules
+
+Mon Feb 25 10:31:43 2008 -0800 Ira Weiny
+d0a68616f83a83e550e903a9cca103e40de37266
+
+	* opensm/libvendor/osm_vendor_ibumad.c: Add environment variable control for OSM_UMAD_MAX_PENDING
+
+Wed Feb 27 17:13:52 2008 +0200 Yevgeny Kliteynik
+aea844aa85665026b4242fd7fc54d4dabafec9ee
+
+	* opensm/man: added -Y/--qos_policy_file option to OSM man
+
+Tue Feb 26 00:11:02 2008 +0200 Yevgeny Kliteynik
+7014e530eb25c5e0be497a32b45040c9a4978876
+
+	* opensm/doc: fixing version in release notes
+
+Mon Feb 25 10:38:57 2008 +0200 Yevgeny Kliteynik
+6cbff6ad57a310fab0f799de22e43613b7e4a83e
+
+	* opensm/scripts: Fixing location of generated opensm.init script
+
+Sun Feb 24 20:45:02 2008 +0200 Sasha Khapyorsky
+3c1a127181bcbf8ad98fd61af5c40505cf11beec
+
+	* opensm/doc: rename OpenSM Release notes to 3.1.10
+
+Sun Feb 24 20:05:26 2008 +0200 Sasha Khapyorsky
+0046b5fe89ba519c6f20e4142a59c714e025aa56
+
+	* opensm/scripts: make configurable scripts
+
+Sun Feb 24 19:30:48 2008 +0200 Sasha Khapyorsky
+4620cf6216030f0b07e6524e7e2768f69ba552a3
+
+	* opensm/scripts: rename all opensm scripts as *.in
+
+Sun Feb 24 14:11:12 2008 +0000 Sasha Khapyorsky
+22ca16aa77c79548e2823e1c6783beb6a52cbc4f
+
+	* opensm: rename OpenSM startup script to opensmd
+
+Sun Feb 24 14:10:51 2008 +0200 Sasha Khapyorsky
+4875cae9e38189c4a2e6e91995375eee108fb17f
+
+	* opensm/osm_switch.c: comment typo fixing
+
+Fri Feb 22 21:14:20 2008 +0200 Sasha Khapyorsky
+cdf2c50a6217108e811d3cb85226ab6347154c2f
+
+	* opensm/osm_vendor_ibumad: simplify put_madw() prototype
+
+Fri Feb 22 21:07:50 2008 +0200 Sasha Khapyorsky
+764d6b080140ccf8a8d2dcb47c117354f48efa53
+
+	* opensm/libvendor: use CL_HTON64() macro for constant conversion
+
+Fri Feb 22 20:32:49 2008 +0200 Sasha Khapyorsky
+e509b0e896f964c0b5cf78d97d8528f7958f14d6
+
+	* opensm/osm_sa_slvl_record.c: fix typo in log print
+
+Wed Feb 20 17:39:21 2008 -0800 Al Chu
+2ba60380284c982f9b4a252742233b200f51328e
+
+	* note cbb means constant bisection bandwidth
+
+Thu Feb 21 23:27:10 2008 +0200 Sasha Khapyorsky
+666543ad83b973daa571a682e2dbc73588204ffd
+
+	* opensm: check p_physp for null before using
+
+Thu Feb 21 23:10:13 2008 +0200 Sasha Khapyorsky
+c6943052b12e1969f5b824adad37eaee6de76ce4
+
+	* opensm: fix potential core dumps
+
+Thu Feb 21 22:30:29 2008 +0200 Sasha Khapyorsky
+1851f2d1fa7761044cacacad4b2466354840cc7b
+
+	* opensm/osm_sa_pkey_record: fix typo
+
+Wed Feb 20 14:02:47 2008 -0800 Ira Weiny
+2ab7f1e2d5dd2f5c49f4610319502f1d4bcbce7b
+
+	* opensm/libvendor/osm_vendor_ibumad.c: add transaction ID printing to error messages
+
+Thu Feb 21 07:07:45 2008 +0000 Sasha Khapyorsky
+c310ba438dd88d3889d74ed1efbb0db115cd0023
+
+	* opensm/osm_node: trivial code consolidation
+
+Wed Feb 20 14:02:45 2008 -0800 Ira Weiny
+acab6ac8bda3dcd9cd8827d3584186caf206140f
+
+	* Fix 2 potential core dumps now that osm_node_get_physp_ptr can return NULL
+
+Wed Feb 20 14:02:44 2008 -0800 Ira Weiny
+392468227a49a11b4659f38feed9847316faa414
+
+	* opensm/libvendor/osm_vendor_ibumad.c: Fix print of Transaction ID
+
+Wed Feb 20 14:07:21 2008 +0200 Sasha Khapyorsky
+a9b4fbb879dd1a4bdf13b29ec40516072ba5b1dc
+
+	* opensm/doc: Remove list of ofed-1.2 bug fixes from OpenSM Release notes.
+
+Wed Feb 20 03:02:02 2008 +0200 Sasha Khapyorsky
+82e0b4967ce46f21dbc9154be22a81c353b5c3f5
+
+	* opensm: Release Notes for 3.1.9
+
+Sat Feb 16 19:33:18 2008 +0200 Sasha Khapyorsky
+c1390230e439ed6ad9092bb2d23a8b920c390017
+
+	* opensm: convert to OSM_LOG() macro
+
+Fri Feb 15 19:26:09 2008 +0200 Sasha Khapyorsky
+f799077875c771b6547fc4fc023b165a16efd7d6
+
+	* opensm/osm_log: OSM_LOG() macro
+
+Mon Feb 4 13:55:53 2008 +0200 Sasha Khapyorsky
+e8a68348f046592d0a8b5eeabec8fe8cc1f79171
+
+	* opensm: drop unused parameter in OSM_LOG_ENTER macro
+
+Fri Feb 15 15:25:02 2008 +0000 Sasha Khapyorsky
+4dfdd7aa1263d232f786d11c0db6879c3f105f1e
+
+	* opensm/osm_console.c: fix unused func warning
+
+Fri Feb 15 15:18:06 2008 +0000 Sasha Khapyorsky
+b766a7fa009605654e9fbd99fffd9e88102a2081
+
+	* opensm/osm_console.c: indentation fixes
+
+Thu Feb 14 16:15:20 2008 -0800 Timothy A. Meier
+0cbef8f7f9a73af9fc80e5af4d9bda1ec3e76006
+
+	* opensm:osm_console cleanup, rename, reorg, no new functionality
+
+Thu Feb 14 11:29:19 2008 +0200 Sasha Khapyorsky
+ed903c867de36491e0959056a1de2d91f964b726
+
+	* opensm: label indentation fixes
+
+Thu Feb 14 11:20:36 2008 +0200 Sasha Khapyorsky
+ceaf836ef5bde84de4a0813d48d77211e62106e5
+
+	* opensm: indentation fixes
+
+Thu Feb 14 10:56:14 2008 +0200 Sasha Khapyorsky
+3500bf9649e227548474f4c2fc989fda5ea7e2e4
+
+	* opensm/osm_sm_state_mgr: remove unused function
+
+Wed Feb 13 11:59:12 2008 +0200 Sasha Khapyorsky
+966ff70dc46fb96b260a929494f8830deab2fafe
+
+	* opensm/osm_helper.c: make some static
+
+Sat Feb 9 20:10:03 2008 +0200 Sasha Khapyorsky
+fbab9ac91a93a3303dd2c5b7598f20c636cd14b7
+
+	* opensm/osm_sminfo_rcv.c: comments fixing
+
+Mon Feb 4 10:03:24 2008 +0200 Sasha Khapyorsky
+d1494edf2629688a67ffe4985bc81a5114e077ec
+
+	* opensm: indentation fixes
+
+Mon Feb 4 09:58:44 2008 +0200 Sasha Khapyorsky
+d2b4367e4b7586778576939dc2d9dedf5c7c90cb
+
+	* opensm: remove unused header files
+
+Mon Feb 4 09:56:05 2008 +0200 Sasha Khapyorsky
+914583d6fd32031b30de26486e94def815fc1270
+
+	* opensm: kill drop_mgr, link_mgr and mcast_mgr SM sub-objects
+
+Mon Feb 4 09:25:08 2008 +0200 Sasha Khapyorsky
+891987b639202cc410e787020c91c61e13a0fcbd
+
+	* opensm: remove redundant moving_to_master flag
+
+** Version: opensm-3.2.0
+
+Mon Feb 11 20:17:54 2008 +0200 Sasha Khapyorsky
+a90c4a13f6beadeef9962cc8275a48db6d512ddf
+
+	* management: bump versions in master branch
+
+Mon Feb 4 07:56:36 2008 +0200 Sasha Khapyorsky
+7744c8a699480ea11e003b4f8952e53cb157e066
+
+	* opensm: cleanup sm->state field
+
+Sun Feb 3 17:16:15 2008 +0200 Sasha Khapyorsky
+2e30cadc854b90e6f7a7c93477cb8e6ee367f690
+
+	* opensm: remove unused header files
+
+Sun Feb 3 16:47:58 2008 +0200 Sasha Khapyorsky
+bbf219143be000da8c82110d437edd75dd785472
+
+	* opensm: kill osm_sm_state_mgr sub-object
+
+Sun Feb 3 15:22:12 2008 +0200 Sasha Khapyorsky
+99462cc880879bf849f1e7d79a4da2e898212c0f
+
+	* opensm: consolidate SM state logging code
+
+Sun Feb 3 15:00:18 2008 +0200 Sasha Khapyorsky
+e6b118dc06c5459fbd73ed400ce48cc4bad6d3df
+
+	* opensm/osm_log: add STRICT_OSM_LOG_FORMAT attr for osm_log_printf()
+
+Sat Feb 2 16:52:39 2008 +0200 Sasha Khapyorsky
+7ca2609fe7601da321148962b20f81065d5902c4
+
+	* opensm: cleanup IB_SMINFO_STATE_INIT
+
+Sat Feb 2 16:01:44 2008 +0200 Sasha Khapyorsky
+55508a10200e7274e249242f21b63f7cce9f4e95
+
+	* opensm/osm_state_mgr: use osm_log_msg_box()
+
+Fri Feb 1 19:11:29 2008 +0200 Sasha Khapyorsky
+1c12c01017ca08f3cb6e4a3e07724735e7e3e310
+
+	* opensm: consolidate message "box" logging code
+
+Wed Jan 30 20:26:56 2008 +0000 Sasha Khapyorsky
+9dd5abf4be4386a52d952ac3232e5187a746b33e
+
+	* opensm: kill osm_state_mgr object
+
+Wed Jan 30 19:38:15 2008 +0000 Sasha Khapyorsky
+0b2277702fc31effe640c9d76514135ffc719318
+
+	* opensm/osm_mcast_mgr: OSM_SIGNAL_NONE is not in use anymore
+
+Fri Feb 8 13:44:13 2008 -0800 Ira Weiny
+f72cb9b92997f3e803a96d718bd5e44a4dfefbd1
+
+	* opensm/opensm/osm_console.c: fix seg fault when running "portstatus ca" in the console
+
+Wed Jan 30 19:42:38 2008 +0000 Sasha Khapyorsky
+55f1595d2822206839c1dd401ddcaf2121747867
+
+	* opensm: fix comment
+
+Wed Jan 30 18:09:53 2008 +0000 Sasha Khapyorsky
+cbcc355c227d980e08a16262df36178e363aa1dd
+
+	* opensm: OpenSM state machine rework
+
+Mon Jan 28 03:10:18 2008 +0200 Sasha Khapyorsky
+230068a7d9c7febea5f5f8c734b5c90618f57520
+
+	* opensm: wait_for_pending_transaction() generalization
+
+Sun Feb 3 16:11:35 2008 +0200 Sasha Khapyorsky
+5c607bb2b29b3da95c44d1620e706ac3eb88c8de
+
+	* opensm/osm_trap_rcv.c: SM object reference cleanup
+
+Thu Feb 7 23:49:31 2008 +0000 Sasha Khapyorsky
+f48e9dcd895edf22f0dc021ddd6877e243b0ca75
+
+	* opensm: fix indentation in main.c and osm_console.c
+
+Mon Feb 4 14:49:34 2008 -0800 Tim Meier
+2ca6cc29e174e2de0b567309d648f54c4bf40659
+
+	* opensm: osm_console - cleanup in preparation for adding OpenSSL option
+
+Fri Feb 1 16:43:47 2008 -0800 Tim Meier
+d0a7ccd9748df05b7870f3620970175d0cb543bb
+
+	* opensm: separated current loop in main into its own function
+
+Wed Feb 6 12:57:40 2008 +0000 Sasha Khapyorsky
+cb5d3dee79a9feb748a3acee5a1078c9f89903bb
+
+	* opensm: scripts/opensmd - fix opensm path.
+
+Mon Feb 4 13:22:27 2008 -0800 Ira Weiny
+dff5dd48f634c69d6874ce1d64d30e5494331616
+
+	* Add node name map, partition config, and QOS policy config files to the "FILES" section of man page.
+
+Mon Feb 4 14:19:02 2008 -0800 Ira K. Weiny
+2429047dfd1b3ffa97da43115d8db53f2ca513c6
+
+	* Update man page for configurable partition and prefix-routes file
+
+Mon Feb 4 14:14:23 2008 -0800 Ira K. Weiny
+889a6aa7dcf10c7f5ba056d8204cdcbf3e05f848
+
+	* Move opensm.8 man page in prep for making config file changes.
+
+Sun Feb 3 11:49:31 2008 +0200 Yevgeny Kliteynik
+950c47d3715faf3cf97bab65a96f3a132394e968
+
+	* opensm/osm_ucast_ftree.c: cosmetics
+
+Sun Feb 3 11:16:33 2008 +0200 Yevgeny Kliteynik
+b95121cac76eb3ff5adc641e1e2b2a1fdb4a9c07
+
+	* opensm/osm_ucast_ftree.c: do load-leveling of non-CN routes
+
+Tue Jan 29 09:24:40 2008 -0600 Dale Purdy
+9c62c0f591fc30a25cbdbd0a38c6e0b1080df231
+
+	* error in osm_ucast_ftree.c
+
+Sat Dec 1 22:05:12 2007 +0200 Sasha Khapyorsky
+4a31e57f7e8794fd5d2310be6505ca074f6d8122
+
+	* opensm/perfmgr: add support for non-pthread systems
+
+Mon Jan 28 02:35:43 2008 +0200 Sasha Khapyorsky
+6587a5bd96cb22768009e6671ec10b65fdc25e2c
+
+	* opensm/perfmgr: break perfmgr discovery if osm_exit_flag is on
+
+Mon Jan 28 02:31:47 2008 +0200 Sasha Khapyorsky
+0a99e7ea15f23052d601a0ac0ec252fba2562779
+
+	* opensm/perfmgr: wakeup perfmgr discover only after NO_PENDING_TRANSACTION was signaled
+
+Mon Jan 28 20:26:32 2008 +0000 Sasha Khapyorsky
+80b67c1a278bf563b7ed720ff24f931f023f319c
+
+	* opensm/perfmgr: remove unused label - fix compilation warning
+
+Mon Jan 28 10:13:42 2008 -0800 Hal Rosenstock
+12c6042c6e886e2815708be823dfbc2574565a6a
+
+	* opensm/osm_perfmgr.c: If redirection requested but disabled, don't rerequest
+
+Mon Jan 28 10:13:35 2008 -0800 Hal Rosenstock
+b8fd0554a2686f32b421d03fa17f574d08be39db
+
+	* opensm/osm_perfmgr.c: Fix duplicated error code
+
+Mon Jan 28 10:13:28 2008 -0800 Hal Rosenstock
+dda403be21c4e2e6e132a295544b1bab0583ac94
+
+	* opensm/osm_subnet.c: Better clarity in opensm.opts file for perfmgr_redir
+
+Mon Jan 28 20:02:34 2008 +0000 Sasha Khapyorsky
+f6bb381474c4fa3eaee8874310fa6ab20af074bb
+
+	* opensm: --consolidate_ipv6_snm_req usage formatting fix
+
+Sun Jan 27 23:45:59 2008 +0200 Sasha Khapyorsky
+05ec8878a89a745da8daa650d5dec5aca2684057
+
+	* opensm: remove unused states and sm signals
+
+Mon Jan 28 13:47:06 2008 +0200 Yevgeny Kliteynik
+1dab45377650166623b559443113576b3b0c197a
+
+	* opensm: osm_version.h not found
+
+Mon Jan 28 01:07:09 2008 +0200 Yevgeny Kliteynik
+ae2b6d4ddc13b5fa616ec82cf71649c0ef7717bf
+
+	* opensm/osm_ucast_ftree.c: ignore port 0 and loopbacks on swithces
+
+Wed Dec 5 17:08:38 2007 +0200 Sasha Khapyorsky
+2629766f7592ffc4573db3be7e769d682f3a1887
+
+	* opensm: merge force_immediate/delayed_heavy_sweep flags
+
+Sun Jan 27 18:05:07 2008 +0200 Sasha Khapyorsky
+e6d745597a21e82cc5a8cb4a67676680642d512c
+
+	* opensm: remove osm_physp_get_mod_pkey_tbl()
+
+Sun Dec 16 00:46:59 2007 +0200 Sasha Khapyorsky
+19f511799ef2f070033fc78dbc0416f70edc6600
+
+	* opensm: cleanup osm_physp_is_valid() use
+
+Sat Dec 15 15:35:35 2007 +0200 Sasha Khapyorsky
+a5ffe1b95f601cc8687f8ee35f91c04f2d6c9dac
+
+	* opensm: remove some unneeded assertions
+
+Sat Dec 15 15:26:43 2007 +0200 Sasha Khapyorsky
+c8cc316d1e47a3815a97f7e8c9010ee35d576813
+
+	* opensm: simplify osm_port_t setup procedure
+
+Wed Jan 16 04:41:10 2008 +0200 Sasha Khapyorsky
+cfaa52ecbcef769632d9da4be8d2f26e65956fdc
+
+	* opensm: rename field pkey to pkey_ix in gsi part of mad address
+
+Sun Jan 27 08:01:40 2008 -0800 Hal Rosenstock
+8548607164844669d3ec836fe1ef822b4e3ce45a
+
+	* management: Update License: field in management spec files
+
+Sun Jan 27 12:29:23 2008 +0200 Yevgeny Kliteynik
+9f8d93ab9af17ae6f31fe108f594f0632cfd0825
+
+	* opensm/QoS: fixing RDS handling in QoS policy
+
+Sat Jan 26 22:40:41 2008 +0200 Sasha Khapyorsky
+a96df9545fe5d490ac118961e14a6a0e403ecd5d
+
+	* opensm: remove trailing whitespaces
+
+Thu Jan 24 14:01:29 2008 -0800 Ira Weiny
+c56d31f369f7edfc97814a20198a2fd0f69be384
+
+	* opensm/opensm/osm_subnet.c: update valid force_link_speed values to v1.2.1 of the spec
+
+Thu Jan 24 12:28:46 2008 -0800 Timothy A. Meier
+9a8b231011b0a7a2ab9e5f3ac6c87b32b2777914
+
+	* opensm: osm_subnet.c log and print the path of the cached option file
+
+Thu Jan 24 10:59:19 2008 -0800 Ira Weiny
+b62326e7f0672f79bae859b2eaffdaba17d9d434
+
+	* opensm/scripts/redhat-opensm.init: fix starting opensm when using daemon mode
+
+Thu Jan 24 17:35:27 2008 +0000 Sasha Khapyorsky
+d54fc5adbf10dc9a18f9f568ac8e358742958695
+
+	* opensm/opensm.spec: install scripts/sldd.sh
+
+Thu Jan 24 17:34:17 2008 +0000 Sasha Khapyorsky
+f4e3c8d138f1f3aed76081183b911d8d9b9315a3
+
+	* opensm/scripts: fix sldd.sh paths
+
+Wed Jan 23 12:40:28 2008 -0800 Ira Weiny
+64fe35094397136a18a9fc943623225c9c784ff3
+
+	* opensm/opensm/osm_subnet.c: add a comment of valid "force_link_speed" values
+
+Sat Jan 19 20:37:58 2008 +0200 Sasha Khapyorsky
+17044c0e092601aa9bed25bae2e1eec5ac35dbd5
+
+	* opensm/lash: fix possible segfault in osm_get_lash_sl()
+
+Wed Jan 16 21:16:25 2008 +0000 Sasha Khapyorsky
+eb2ba35601b022743231539514cdb9e79e0c4cb6
+
+	* opensm/opensm.spec.in: add Obsoletes rule
+
+Wed Jan 16 16:01:50 2008 +0200 Yevgeny Kliteynik
+5b6d59d5f78615018d2e5d8d8c12242c027b442c
+
+	* opensm/scripts: fixing MAXSMPS values to the right default
+
+Wed Jan 16 15:57:26 2008 +0200 Yevgeny Kliteynik
+d8d0d7fbfacf56c2cf3ac9336cb5d4553f3dabbb
+
+	* opensm/scripts: removing trailing blanks
+
+Tue Jan 15 15:34:46 2008 -0800 Ira Weiny
+60106698e368b86fac77cb930310abaf8eb470ee
+
+	* Fix spelling of "consolidate"
+
+Tue Jan 15 14:49:05 2008 -0800 Ira Weiny
+88f4f7eea9286326acc89c2d5123dfc36ae3c916
+
+	* Fix logic '{' around consolidate_ipv6_snm_req introduced by "patch cleanup"
+
+Tue Jan 15 18:15:36 2008 +0000 Sasha Khapyorsky
+30f008f56f9373a6d58355ffd6d9d68a2bd9893c
+
+	* opensm/perfmgr: use pkey at index 0
+
+Tue Jan 15 15:10:26 2008 +0200 Yevgeny Kliteynik
+b99bdc2a6570f11e88fb11579f4331f8d0080bcb
+
+	* opensm/osm_ucast_ftree.c: cosmetics in log messages
+
+Tue Jan 15 15:04:40 2008 +0200 Yevgeny Kliteynik
+a77194e66a7271bb5e71eb2c20fadc9b0bf7ac0b
+
+	* opensm/osm_ucast_ftree.c: fixing coredump in fat-tree routing
+
+Tue Jan 15 00:06:49 2008 +0000 Sasha Khapyorsky
+8d0352cecb244ff452566fb4dab47dd1d2a462f4
+
+	* opensm/osm_sa_mcmember_record.c: cosmetic changes
+
+Mon Jan 14 11:45:30 2008 -0800 Ira Weiny
+c7f14d074e3d95528e55a2dc173d49ae67e0d1cf
+
+	* Add option to Special Case the IPv6 Solicited Node Multicast address into a single Mcast Group
+
+Mon Jan 14 11:45:28 2008 -0800 Ira Weiny
+9f46c6a606a398ce98059d4275ccfdf0201182b3
+
+	* Removed unused and commented out var.
+
+Mon Jan 14 23:44:57 2008 +0000 Sasha Khapyorsky
+362e9039a67a7683ba2ae629aaecef3ae6b596c0
+
+	* opensm/osm_sa.h: indentation fixes
+
+Mon Jan 14 23:43:22 2008 +0000 Sasha Khapyorsky
+13e57f7a2d215e76d5d02479466490d4bbb12f5b
+
+	* opensm/osm_sa_mcmember_record.c: unique error code
+
+Mon Jan 14 11:45:27 2008 -0800 Ira Weiny
+c9fca773473e3bc466c95b68661e448c33ef1f7a
+
+	* Consolidate the 2 __get_mgrp_by_mgid functions into one global function which actually takes a mgid and returns a mgrp.
+
+Sun Jan 13 19:28:34 2008 +0000 Sasha Khapyorsky
+3505432bdc47f3b999e6a8fe310785f0d552f898
+
+	* opensm/vendor: use valid pkey index value for gsi mads
+
+Wed Jan 9 21:54:25 2008 +0200 Sasha Khapyorsky
+de8c1e89ed6851350609f78c798ed3ebb918ecc7
+
+	* opensm/osm_sa_slvl_record: fix overflow crash
+
+Wed Jan 9 20:01:15 2008 +0200 Sasha Khapyorsky
+d691b90cfbbfcfd7dfc9ea2c9de09d9d42d1e7ef
+
+	* opensm/osm_sa_slvl_record: remove unused variable
+
+Tue Jan 8 22:52:32 2008 +0200 Sasha Khapyorsky
+3e1ec845d4cbb7a2d46d0e58d68c965742c0256f
+
+	* opensm/vendor: filter out non-IB devices in osm_vendor_get_all_port_attr()
+
+Wed Jan 9 10:35:01 2008 -0800 Ira Weiny
+4fc09aee1b1a2654f77b760a9aa2bf0849a94ae2
+
+	* Fix perfmgr enable in spec file.
+
+Wed Jan 9 15:18:19 2008 +0200 Yevgeny Kliteynik
+0af00a7b36b0f7a9319185e9a348569be31f2dc1
+
+	* opensm/osm_mcast_mgr.c: fixing a seg. fault in processing mcast groups
+
+Mon Jan 7 17:13:56 2008 +0200 Yevgeny Kliteynik
+51c1313bb3ffd9ce38c453b94733c74614cfed8d
+
+	* opensm/osm_qos_policy.c: trivial fix in passing wrong pointer
+
+Mon Jan 7 02:25:17 2008 +0200 Sasha Khapyorsky
+5bd0cdee79d9ce2c954f17ea0c2de674b9d2764c
+
+	* osmtest: remove unused error.h file
+
+Sat Dec 1 04:13:45 2007 +0200 Sasha Khapyorsky
+536ddff426a187bc0214293c06a2d944b88d2778
+
+	* opensm: remove unused header files
+
+Sat Dec 1 04:10:25 2007 +0200 Sasha Khapyorsky
+a9ca2db5aa4a7f1161dc930e19caaf2857c33024
+
+	* opensm: cleanup dummy SM req and resp objects
+
+Sat Dec 1 03:21:22 2007 +0200 Sasha Khapyorsky
+53c2caf02d4262447845f8c584100e8669278e8b
+
+	* opensm: unify SM managers initializers
+
+Mon Jan 7 04:49:52 2008 +0200 Sasha Khapyorsky
+a5cdb2affabeff22513056d64d8b79af7bb58bd7
+
+	* opensm/opensm/Makefile.am: fix version update rule
+
+Mon Jan 7 01:40:19 2008 +0200 Sasha Khapyorsky
+19c4eaec7b49e28088810791be8c5ab7ae5dd917
+
+	* opensm/Makefile.am: update configure.in version on 'make dist'
+
+Mon Jan 7 01:23:16 2008 +0200 Sasha Khapyorsky
+15e25f39126e88208f7b65f353e20e7d202756a9
+
+	* opensm: update OpenSM version according to the tree state
+
+Sun Jan 6 21:33:44 2008 +0200 Sasha Khapyorsky
+c44889dc9190ac0ec7ce6852c2b64e15c01c388b
+
+	* management/*/Makefile.am: fix ChangeLog generation rule
+
+Sat Dec 1 00:14:46 2007 +0200 Sasha Khapyorsky
+819c91f84f4242eb6ead13d79800c43255f663f6
+
+	* opensm: remove not used osm_sa_*.h header files
+
+Sat Dec 1 00:06:02 2007 +0200 Sasha Khapyorsky
+45b95f959983d18eeb5dc3c94db7bb32453ba7b6
+
+	* opensm: cleanup SA related osm_*_rcv_t objects
+
+Tue Nov 13 05:48:17 2007 +0200 Sasha Khapyorsky
+05b142661686a2eb5ef8df587276026f42af355d
+
+	* opensm: remove unneeded *_rcv.h header files
+
+Tue Nov 13 05:45:37 2007 +0200 Sasha Khapyorsky
+7d88bba73abb9a730e4717353a2524c4300b7f11
+
+	* opensm: cleanup SM related _rcv_t objects
+
+Sat Dec 1 00:43:50 2007 +0200 Sasha Khapyorsky
+84ff47789da981c17eaf73a126d3336ccfde1395
+
+	* complib: clean unused cl_qlockpool primitives
+
+Tue Nov 27 19:58:19 2007 +0200 Sasha Khapyorsky
+604d7300f713908d3d0332ca514b58f950ecdebf
+
+	* opensm: use malloc instead of cl_qlock_pool in osm_mad_pool.c
+
+Tue Nov 27 17:34:02 2007 +0200 Sasha Khapyorsky
+af88550c1de0c91735fb0b87adc09587bbafacd9
+
+	* opensm: use malloc instead of cl_qlock_pool in SA processors
+
+Thu Jan 3 04:03:59 2008 -0800 Hal Rosenstock
+383bb4fe9523d107c21a73b81f2abd43464d6dc4
+
+	* opensm/osm_subnet.(h c): Cosmetic changes to some options descriptions
+
+Thu Jan 3 09:44:46 2008 +0200 Sasha Khapyorsky
+ffbd1a76737a2cf39c890bddbfd1bacd607a22ba
+
+	* management: bump versions
+
+Mon Dec 17 15:44:59 2007 +0200 Yevgeny Kliteynik
+fbd482e3a5b9cac9400145e00ae13cefef264bd9
+
+	* opensm: osm_state_mgr.c - stop idle queue processing if heavy sweep requested
+
+Wed Dec 26 21:23:11 2007 +0200 Sasha Khapyorsky
+8e3ce475a32bb218a0e70cd3da32597011d5c31d
+
+	* opensm: mcast mgr improvements
+
+Sat Dec 29 21:02:49 2007 +0200 Sasha Khapyorsky
+0ace8a836b32d6b9a3eb654566f7c83cce79b54d
+
+	* opensm: Revert "opensm/osm_pkey_mgr.c: setting only outbound partition enforcement on switch"
+
+Tue Dec 25 14:29:47 2007 +0200 Yevgeny Kliteynik
+1230d7011a98a11585b5425014f5801a08ea10b9
+
+	* opensm/osm_pkey_mgr.c: setting only outbound partition enforcement on switch
+
+Sat Dec 22 16:15:50 2007 +0200 Sasha Khapyorsky
+d60473e8491f8e453bdd185c80b9ac3ffa6e42b6
+
+	* opensm/updn: rename __osm_subn_calc_up_down_min_hop_table()
+
+Sat Dec 22 15:57:13 2007 +0200 Sasha Khapyorsky
+4ffa499513d51e2151c422f459559a5e4a7e18b2
+
+	* opensm/updn: report fallback properly
+
+Sat Dec 22 15:44:47 2007 +0200 Sasha Khapyorsky
+3b38909dda72d10d2911346c8003f5f5dffaef0b
+
+	* opensm: some micro-optimizations
+
+Sat Dec 15 01:30:18 2007 +0200 Sasha Khapyorsky
+4798aa30892e39c1101f4f854bb35948d02ce1e2
+
+	* opensm: make some functions statics
+
+Sat Dec 15 01:09:42 2007 +0200 Sasha Khapyorsky
+5674ae09729f2c8bc29cb9511f2de7ced91f1dad
+
+	* opensm/osm_helper: make some functions static
+
+Fri Dec 14 23:27:02 2007 +0200 Sasha Khapyorsky
+0ebb39c4a9b7628698dc0552cda8996fca5f7e53
+
+	* opensm: make some functions static
+
+Sat Dec 15 00:57:09 2007 +0200 Sasha Khapyorsky
+0cbddac8eefecded3130e106e82d3ffe78e5e86c
+
+	* complib: make __cl_thread_wrapper() static
+
+Fri Dec 21 18:32:28 2007 +0200 Sasha Khapyorsky
+583e55bd41eebe151c12fbfd5aa412a34db73ea5
+
+	* manangement: kill __WORDSIZE macro checks
+
+Sat Dec 22 15:31:46 2007 +0200 Sasha Khapyorsky
+0158cb8a7eeefdd353772a9fcabde690d78db0ef
+
+	* opensm: indentation fixes
+
+Tue Dec 18 16:41:38 2007 -0800 Al Chu
+cad5ac438a4d5be21235befd899995141fc07fc9
+
+	* OpenSM: Fix incorrect identification of routing engine used
+
+Tue Dec 18 16:41:34 2007 -0800 Al Chu
+d3160df8a77ab52e57e0844345573b7c22ebb370
+
+	* OpenSM: Fix incorrect reporting of routing engine used
+
+Tue Dec 18 16:41:32 2007 -0800 Al Chu
+1145b539627718c37c5843efbf5bb3f6ab83ba30
+
+	* OpenSM: osm routing engine type
+
+Mon Dec 17 17:30:14 2007 -0800 Ira Weiny
+2a88f63bb9c93b1829851828942033bbeb846769
+
+	* opensm: Add "perfmgr print_counters node" to the console to print individual values
+
+Sun Dec 16 00:25:43 2007 +0200 Sasha Khapyorsky
+335b090aa0d40c90ae636ba9d63fea4fddc7ab96
+
+	* opensm: remove useless osm_node_get_remote_type()
+
+Thu Dec 13 16:35:41 2007 +0200 Sasha Khapyorsky
+61a7c1276c4e5d6e9a8367aca9d45ce19f0edb84
+
+	* opensm/osm_event_plugin.h: add names to structures
+
+Thu Dec 13 15:10:12 2007 +0200 Sasha Khapyorsky
+060a0750d30e9689a08c6572a96c3444c18244cb
+
+	* opensm: rename __osm_epi_plugin_t to osm_event_plugin_t
+
+Mon Dec 17 15:20:43 2007 -0800 Al Chu
+91459f2c7bf8bc1f63c0e854e93652239f48d198
+
+	* OpenSM: Fix comment typo.
+
+Tue Dec 18 15:12:15 2007 +0200 Yevgeny Kliteynik
+39a80efbfd69896dd8bf2c8fed6d7b5f2d64c8dc
+
+	* opensm/osm_pkey_mgr.c: trivial fix in log message
+
+Sat Dec 15 15:22:10 2007 +0200 Sasha Khapyorsky
+53d64b8d3879c1bd14672eff2164f0cf7a38fc46
+
+	* opensm/osm_node_new: move p_node->print_desc setup
+
+Sat Dec 15 14:23:56 2007 +0200 Sasha Khapyorsky
+c9503fd17a9f91d3e99d50c319d71c93f6681c12
+
+	* opensm/osm_port_info_rcv: node instead of port as parameter for osm_pi_rcv_process_set()
+
+Thu Dec 13 03:47:48 2007 +0200 Sasha Khapyorsky
+c4d3618654367c7241e12a9de344fa93b054080b
+
+	* opensm: recover only for base LID values >= 0xc000
+
+Thu Dec 13 04:35:53 2007 +0200 Sasha Khapyorsky
+badcb22f46f4c3407c621e4b4242f90a6d453004
+
+	* opensm/Makefile: remove opensm_CXXFLAGS
+
+Thu Dec 13 04:25:45 2007 +0200 Sasha Khapyorsky
+a10dc4ca3dbffeb867c2cb07eacc813503a140ed
+
+	* opensm: remove old style code formatters
+
+Thu Dec 13 03:47:48 2007 +0200 Sasha Khapyorsky
+1c84f1a30e884972dcf059cf43f6f86a7eb5a1e9
+
+	* opensm: don't zero base LID when invalid value is received
+
+Thu Dec 13 00:44:09 2007 +0200 Sasha Khapyorsky
+750ebce76363684374123c030e41cb89fa51a8e8
+
+	* opensm/config/osmvsel.m4: update LDADD variable, not LDFLAGS
+
+Tue Dec 11 17:39:24 2007 +0200 Yevgeny Kliteynik
+37b9529da7cdc12e836102a04a0541da744703e1
+
+	* opensm: QoS policy - fixing pkey range implementation
+
+Tue Dec 11 17:36:43 2007 +0200 Yevgeny Kliteynik
+6f8847091fafb0fecf1856a2d23e8ba9115774ed
+
+	* opensm: fixing coredump in QoS policy pkey validation
+
+Wed Dec 12 17:52:04 2007 +0200 Yevgeny Kliteynik
+61d10e99588a9ab93873584a62ea6b6356eed759
+
+	* opensm: trivial change of log message
+
+Tue Dec 11 15:11:57 2007 +0000 Sasha Khapyorsky
+f46d276436176752b4371f11fc53b3b24f4f0638
+
+	* opensm/libvendor: indentation fixes
+
+Mon Dec 10 04:23:40 2007 -0800 Hal Rosenstock
+ed71838c16c346119bff2a2879e02e1f9ef3b2f3
+
+	* opensm/libvendor/osm_vendor_ibumad_sa.c: In __osmv_sa_mad_rcv_cb, handle attribute offset of 0
+
+Tue Dec 11 14:40:01 2007 +0000 Sasha Khapyorsky
+305f4c9964cbd13c521f10235c8190a3b499f659
+
+	* opensm/osm_ucast_updn.c: indentation fixes
+
+Mon Dec 10 16:39:37 2007 -0800 Al Chu
+cb567d37538e1700ab5906a8766903f2e7c464b3
+
+	* OpenSM: Fix error return corner case
+
+Sat Dec 8 00:46:58 2007 +0200 Sasha Khapyorsky
+12d0c6d12b918d7956ec6af673fa52c897436119
+
+	* opensm/lash: cosmetic
+
+Sat Dec 8 00:29:41 2007 +0200 Sasha Khapyorsky
+45667a27f528814d1ac01d4f052d93f452c6c477
+
+	* opensm/lash: fix wrong allocation size
+
+Wed Dec 5 21:24:42 2007 +0200 Sasha Khapyorsky
+4d0056bd723f796bbc79944044f50a1afd714045
+
+	* opensm: minor cleaning
+
+Wed Dec 5 00:31:43 2007 +0200 Sasha Khapyorsky
+d7e150a5c56e95c4bd2c3e01745adef98f2daee3
+
+	* opensm: remove unused osm_port_lid_category_t enum
+
+Wed Dec 5 21:28:40 2007 +0200 Sasha Khapyorsky
+49ed32bcb2776d1c1b420379486b5899ab97a81a
+
+	* opensm: don't break name_map using when routing_engine was not found.
+
+Tue Dec 4 12:55:27 2007 -0800 Albert L. Chu
+06b000174e5817e4f6c1b7fd11c4adf001cdbbb5
+
+	* change 'min-hop' to 'minhop' for consistency with routing engine input
+
+Tue Dec 4 09:36:45 2007 -0800 Albert L. Chu
+3f0557a9eb6700d2ed023db48898f8ca5d9f76e0
+
+	* support minhop as a routing engine input
+
+Wed Dec 5 17:28:40 2007 +0200 Yevgeny Kliteynik
+cc1f8f244f4ec2dd8c20c00096e0b16fbbe27c7c
+
+	* opensm: printing to stderr note about error in QoS policy file
+
+Tue Dec 4 17:04:11 2007 +0200 Yevgeny Kliteynik
+c7a1985bc7fd3f108b4e35bced8f571d1038214d
+
+	* opensm: Fixing broken logic in 'process world' part of LinkRecord processing
+
+Tue Dec 4 01:37:57 2007 +0000 Sasha Khapyorsky
+f10ca384acd5f3dd1331747e4cf8e7346154d9e2
+
+	* opensm: fix lmc_mask bit order in osm_sa_link_record.c
+
+Mon Dec 3 17:16:55 2007 +0200 Yevgeny Kliteynik
+bca723ec62e9add9bc4bfd1536abfb50490e0a29
+
+	* opensm: adding missing comparison by to_lid/from_lid in LinkRecord processing
+
+Sun Dec 2 14:13:47 2007 +0200 Yevgeny Kliteynik
+937b1f3b46bb83be535d8df99c502bd0fad209c0
+
+	* opensm: Remove unnecessary ntoh and hton conversions in LinkRecord processing
+
+Sat Dec 1 04:32:00 2007 +0200 Sasha Khapyorsky
+4aeec893700c49d7151cd3581fe8f62f53a485bf
+
+	* opensm: remove testability_mode option
+
+Sat Dec 1 01:14:34 2007 +0200 Sasha Khapyorsky
+df114deb158b7247096431c487efe640f51f77ec
+
+	* opensm: make osm_pkey_get_tables static
+
+Sat Dec 1 00:30:11 2007 +0200 Sasha Khapyorsky
+4e31bbee1e6646efe91ccbd5c19a72a84d43d06a
+
+	* opensm: cosmetic fixes
+
+Fri Nov 30 17:59:55 2007 +0200 Sasha Khapyorsky
+d5f97ed5561364595797ec41e720a040858d67cb
+
+	* opensm: move OpenSM constants from osm_sa_mcmember-record.h to osm_base.h
+
+Fri Nov 30 17:52:46 2007 +0200 Sasha Khapyorsky
+fe24980a16fc734e55088e4645b0ddc75a0f29c2
+
+	* opensm: move IBA constants from osm_sa_mcmember_record.h to ib_types.h
+
+Fri Nov 30 05:33:29 2007 +0200 Sasha Khapyorsky
+603af282f66e39dc6e33796690fc342f98f9d973
+
+	* opensm: remove unused flag
+
+Tue Nov 27 20:16:24 2007 +0200 Sasha Khapyorsky
+3d7c943f30c150729874deede83e76f5b14650f9
+
+	* opensm: move vendor specific header files to include/vendor
+
+Thu Nov 29 19:37:20 2007 -0800 Ira Weiny
+18768044cea24b1d31930b3db92978ded86e2054
+
+	* opensm/opensm/osm_perfmgr_db.c: fix clearing previous count when "out of band"
+
+Thu Nov 29 19:36:34 2007 -0800 Ira Weiny
+6e2d2e83d4737cb20a9931c2ca899b62f02a54ed
+
+	* opensm/opensm/osm_event_plugin.c: remove duplicate header include
+
+Thu Nov 29 19:36:06 2007 -0800 Ira Weiny
+01b44439845acecb715e244ac2a7d532165b7986
+
+	* opensm/opensm/osm_event_plugin.c: clean up version check error message a bit
+
+Thu Nov 29 19:35:40 2007 -0800 Ira Weiny
+aca7277cc34713e4d4a2d5522255697350d3c872
+
+	* opensm/include/opensm/osm_event_plugin.h: fix comment
+
+Thu Nov 29 10:58:46 2007 -0700 Rolf Manderscheid
+10b81992808baae41721b2ef1e68e7d3cce5d933
+
+	* opensm: allow multiple scopes in a partition
+
+Mon Nov 26 08:12:10 2007 -0800 Hal Rosenstock
+13960715e866ca91ffe830045b6b0d735f6b4daf
+
+	* OpenSM/libvendor/osm_vendor_ibumad.c: Make error code in osm_log message unique
+
+Mon Nov 26 11:15:56 2007 -0800 Al Chu
+9766332b1b2e2b83bf5e24b862349acfa575bc82
+
+	* osm cache file extra info patch
+
+Tue Nov 20 00:03:05 2007 +0200 Sasha Khapyorsky
+0af1270dbd7669791962bc9962197dcc0f74710e
+
+	* opensm: version 3.1.7
+
+Mon Nov 19 20:12:07 2007 +0000 Sasha Khapyorsky
+fb43984b37ae6c804e5ddee97089239a9751049a
+
+	* opensm: use OPENSM_CONFIG_DIR for prefix-routes file definition
+
+Mon Nov 19 20:07:05 2007 +0000 Sasha Khapyorsky
+0315adbd0a00ec3ef44afe6394f1532dabbe7b5c
+
+	* opensm/configure: add OPENSM_CONFIG_DIR variable
+
+Fri Nov 16 01:08:40 2007 -0700 Rolf Manderscheid
+6f1cf3968db1e3a5ca5a55e3f71957bfc02ed004
+
+	* opensm: support multiple routers in a subnet
+
+Mon Nov 19 15:04:42 2007 +0200 Yevgeny Kliteynik
+e9d0a507fe996bf883f33b5c740418cc7b7a91f7
+
+	* osm: QoS - adding simplified syntax for policy definition
+
+Mon Nov 19 15:02:23 2007 +0200 Yevgeny Kliteynik
+720dc51ccb693f4c4ce2ddde5855e1081a81ba98
+
+	* osm: Using new format of QoS parser error function
+
+Mon Nov 19 14:44:14 2007 +0200 Yevgeny Kliteynik
+2c8e3d89ca94164d97abae30698f0074f2d8983c
+
+	* osm: broken logic when scanning subnet for PIR request
+
+Mon Nov 19 14:34:27 2007 +0200 Yevgeny Kliteynik
+f4146a45615b0ce91683ca32ed0f99482d50143a
+
+	* osm: improving error reporting function of the QoS parser
+
+Sun Nov 18 18:47:44 2007 +0000 Sasha Khapyorsky
+1ee037f8da1340614838182543a506d832d367dc
+
+	* opensm/vendor: be sure that node has IB type
+
+Sun Nov 18 15:04:00 2007 +0200 Yevgeny Kliteynik
+7cf8db205505875a1eb7cc14ee614a6928d95123
+
+	* osm: cosmetics - removing obsolete comment
+
+Sun Nov 18 14:02:47 2007 +0200 Yevgeny Kliteynik
+c575341a89e484b93504a7fbe71740ee6be75889
+
+	* osm: moving call to QoS policy file parser to osm_qos_setup()
+
+Sun Nov 18 13:59:01 2007 +0200 Yevgeny Kliteynik
+5a68c447fbed0d07cbe42cf825484d65c034a5ea
+
+	* osm: use OSM_DEFAULT_PARTITION_CONFIG_FILE instead of hard-coded string
+
+Thu Nov 15 22:11:52 2007 +0200 Sasha Khapyorsky
+a0fa413a77260768422a8187c055092d343c326c
+
+	* opensm/libvendor: remove __osmv_get_lid_and_sm_lid_by_port_guid()
+
+Thu Nov 15 21:59:52 2007 +0200 Sasha Khapyorsky
+561cab95b6533143ef0b7ba81f43083b6401216b
+
+	* opensm/osmtest: update port chooser
+
+Thu Nov 15 12:20:11 2007 +0200 Sasha Khapyorsky
+d15e855c82cf5ca3ffcf6c3fb9f58c1628890ecb
+
+	* opensm: no interactive games in daemon mode
+
+Thu Nov 15 11:16:56 2007 +0200 Sasha Khapyorsky
+4ac22018ca47184711c4f89b18513a530f91a5f2
+
+	* opensm/osmtest: adopt to osm_vendor_get_all_port_attr() changes
+
+Thu Nov 15 11:14:52 2007 +0200 Sasha Khapyorsky
+c3bbc694a8fd8bbabdc529a7cb792dd88ebf8ee1
+
+	* opensm/main: merge gen2 code in get_port_guid()
+
+Thu Nov 15 08:59:56 2007 +0200 Sasha Khapyorsky
+c63cbdf2505e86064bd42f90f7928802675e96ae
+
+	* libvendor: osm_vendor_get_all_port_attr() rework
+
+Thu Nov 15 19:32:34 2007 +0200 Sasha Khapyorsky
+f00cbf5d498fc214dc2a238acf842523300575d5
+
+	* opensm/libvendor: make statics
+
+Thu Nov 15 10:49:23 2007 +0200 Sasha Khapyorsky
+5afd8ae28a7aeb3d5899bce5d80fb9b0310dfb2b
+
+	* opensm/vendor: handle guid = 0 with osm_vendor_bind()
+
+Thu Nov 15 10:31:44 2007 +0200 Sasha Khapyorsky
+dccd95dd10aa14866fc5f228d08275512d7ea3f7
+
+	* opensm/libvendor: fix umad_port leak
+
+Thu Nov 15 10:23:32 2007 +0200 Sasha Khapyorsky
+88dded78acb415457ea2740d7942cfd20c423e03
+
+	* opensm/libvendor: remove not used umad_ca field
+
+Thu Nov 15 16:58:27 2007 +0200 Yevgeny Kliteynik
+e9e176ec822a0e1c9acbaf2e35e640f8a1f5d1d2
+
+	* osm: remove unused 'is_ipoib' parameter when adding mcast group
+
+Thu Nov 15 15:22:29 2007 +0200 Yevgeny Kliteynik
+10d79899ce7b7cadf126a4451159a70a56ca7265
+
+	* osm: fixing memory leak in node description
+
+Thu Nov 15 13:58:46 2007 +0200 Yevgeny Kliteynik
+6b9ce86feda959a12bd916355b72510894cc3179
+
+	* osm: fixing memory leak in QoS policy
+
+Thu Nov 15 00:33:37 2007 +0200 Sasha Khapyorsky
+9ca9d6636e3fd82dc2c82f504781568f533b7853
+
+	* opensm/man/opensm.8: remove utf-8 characters
+
+Thu Nov 15 00:16:39 2007 +0200 Sasha Khapyorsky
+4e30d60d8bec88096989d2aa5f60ed260df2ff79
+
+	* opensm/doc: remove utf-8 characters from text files
+
+Thu Nov 15 00:16:03 2007 +0200 Sasha Khapyorsky
+99f18dab9f295d78fd5d1f352025e3e87a269de9
+
+	* opensm/man: break long lines, remove utf-8 characters
+
+Wed Nov 14 23:30:00 2007 +0200 Sasha Khapyorsky
+44daedb551e631450719800b044f7cc4d66d0ebf
+
+	* opensm/main.c: trivial cosmetic improvements
+
+Wed Nov 14 23:01:56 2007 +0200 Sasha Khapyorsky
+b30ce679d59e0c28dae9f8b678219f0901c88e22
+
+	* opensm: merge redhat-opensm.conf and opensm.conf
+
+Wed Nov 14 23:00:34 2007 +0200 Sasha Khapyorsky
+2f7c31dfc6d1849e26c051d4275885ee23ba963a
+
+	* opensm/scripts/opensm.conf: fix log file name in comment
+
+Wed Nov 14 20:28:12 2007 +0200 Sasha Khapyorsky
+a41b06837fb50628a929050ceabc6b442271f7fd
+
+	* opensm: update default config names in man pages and doc
+
+Tue Nov 13 16:09:08 2007 -0800 Ira Weiny
+ee18b398c637a01f3ce5db6d84c71a6cd0fe3dbb
+
+	* opensm/config/osmvsel.m4: Convert help strings to AC_HELP_STRING
+
+Tue Nov 13 16:09:00 2007 -0800 Ira Weiny
+8fbb38a1e3a754bbaeadd1b96c6bc5acb4eac429
+
+	* Add --with-partitions-conf to configure
+
+Tue Nov 13 16:08:48 2007 -0800 Ira Weiny
+f16b5064f935f54aaf2c555ed2a380029f684d25
+
+	* Add --with-qos-policy-conf to configure
+
+Tue Nov 13 16:08:44 2007 -0800 Ira Weiny
+e82fba1b494e076fe4c37e54102d5ad9b5eaf3a0
+
+	* opensm/configure.in: remove unecessary comment
+
+Tue Nov 13 16:08:41 2007 -0800 Ira Weiny
+c72cbbe797019757f8c56ebcfdb7a1efcb82e1ac
+
+	* Add the default in the with-node-name-map help string
+
+Tue Nov 13 16:08:36 2007 -0800 Ira Weiny
+33922b7f02218b46d342b12c61f17daca1b6b685
+
+	* Add option to change the default "opensm" dir under sysconfdir as the config dir
+
+Tue Nov 13 16:08:04 2007 -0800 Ira Weiny
+790c31018f12f9c3621a3438287427ade85ded2e
+
+	* Break out a "CONF_DIR" variable in configure to base other config files on.
+
+Sun Nov 11 17:49:36 2007 +0200 Sasha Khapyorsky
+3a0b5d563f45242471de550c3000bd2ee2d83eeb
+
+	* opensm/osm_link_mgr: use return status when PortInfo is updated
+
+Sun Nov 11 13:15:09 2007 +0200 Sasha Khapyorsky
+ea9f147482148292bc69096458658ed681921b0a
+
+	* opensm: eliminate some unneeded PortInfo Set requests
+
+Sun Nov 11 12:36:50 2007 +0200 Sasha Khapyorsky
+f2d8a83157764f7a389602f2fe34c1bbd9d7a3ae
+
+	* opensm: fix PortInfo update issues.
+
+Tue Nov 13 04:41:11 2007 -0800 Hal Rosenstock
+cf31aa25739d05f693fdff4fbd8203f122fda861
+
+	* OpenSM/osm_subnet.c: Cosmetic format changes to opensm.opts file
+
+Tue Nov 13 04:14:26 2007 +0200 Sasha Khapyorsky
+5bc2a38ffa20fa3c9d358555aa1debf23c37a0ba
+
+	* opensmd script: fix opensm path
+
+Tue Nov 13 04:13:53 2007 +0200 Sasha Khapyorsky
+85814ffe0ff5eb543920ec9970664610ce95f4e2
+
+	* opensm.init: startup script fixes
+
+Tue Nov 13 01:40:07 2007 +0200 Sasha Khapyorsky
+20015cd364b4417b036d9ef038fb0b2d2faed533
+
+	* opensm/Makefile: add libopensm -> opensm dependency
+
+Sun Nov 11 19:10:57 2007 +0200 Sasha Khapyorsky
+d9c5eae93ec49e7c1202d9b3f562b3c0efc8437e
+
+	* opensm/osm_sa_portinfo_record: cosmetic
+
+Sun Nov 11 17:43:51 2007 +0200 Sasha Khapyorsky
+825689e141883d0b18bb7180c615e13418efc008
+
+	* opensm/osm_lid_mgr: cosmetic
+
+Sat Nov 10 16:49:26 2007 +0200 Sasha Khapyorsky
+feac52d7329b48bc403ddcf4b4e45b58c9f4b215
+
+	* opensm: PortInfo set decision flow simplification
+
+Sat Nov 10 15:14:55 2007 +0200 Sasha Khapyorsky
+f8aae603ba716242761e8cbed1c610c1fe91616e
+
+	* opensm: simplify PortInfo.LinkSpeed setup flow
+
+Sun Nov 11 09:38:32 2007 +0200 Sasha Khapyorsky
+458de3213429a13178415524d7567c9860b309ef
+
+	* opensm: remove prototypes of non-existing *_is_inited() funcs
+
+Fri Nov 9 14:01:33 2007 +0200 Sasha Khapyorsky
+97acc0ff1fe6edbb449a09d43eedb7c2c7fe8e22
+
+	* opensm/osm_log.h: fix indentation, update copyrights
+
+Thu Nov 8 16:18:41 2007 -0800 Tim Meier
+2d1b6398821d4d6d777ded1a062af5dede172fb6
+
+	* opensm: osm_log - added the log message type to the message
+
+Wed Nov 7 19:16:03 2007 -0800 Ira Weiny
+fd9edb9f4e151f8b98b06fc765f70743edd666d1
+
+	* Specify a default node-name-map of <sysconfdir>/ib-node-name-map
+
+Wed Nov 7 18:58:23 2007 -0800 Ira Weiny
+3e3db06bad6ba8cea955c670ec8490b723d388fd
+
+	* opensm/opensm/osm_state_mgr.c: update log messages with node names
+
+Wed Nov 7 18:58:22 2007 -0800 Ira Weiny
+ea71eabb0ac1f0db36f6936cf223263ce7ca99b2
+
+	* use the monitored node's redirect information for this get_lid call because it is now available
+
+Wed Nov 7 18:58:21 2007 -0800 Ira Weiny
+6eb4528a0c0e7f70b34a38a825875b8eb9fcbee9
+
+	* Use monitored map lookup to get the name of the node for recieved mad processing in perfmgr
+
+Wed Nov 7 18:58:20 2007 -0800 Ira Weiny
+55fc794b529c4f9f00fef1f634d7e999dca6164b
+
+	* Maintain a name of the node in the monitored node structure for log messages.
+
+Fri Nov 9 12:54:26 2007 +0200 Sasha Khapyorsky
+79d5202860fb72bcb80c8889bc60ca963d63756e
+
+	* opensm/osm_perfmgr: more log name fixes
+
+Wed Nov 7 18:58:19 2007 -0800 Ira Weiny
+faadf93a02ab9cb11fe82dae97323835cbd21764
+
+	* Fix log messages in perfmgr to use "perfmgr" in name, _not_ "pm"
+
+Thu Nov 8 15:47:22 2007 +0200 Sasha Khapyorsky
+8b2c166d75b10a8fc9fe1b51ba2e7880c9520113
+
+	* opensm: print error details when OpenSM opt cache file open fails
+
+Tue Nov 6 19:08:38 2007 +0200 Sasha Khapyorsky
+4c9d30176ee2f2d83e2ad4f789a6800510fadb44
+
+	* opensm: version 3.1.6
+
+Tue Nov 6 19:03:53 2007 +0200 Sasha Khapyorsky
+677a3f5185c0c1c0c023bbea63e3e177599ebf33
+
+	* opensm/complib: bump library version
+
+Thu Nov 1 20:15:31 2007 -0700 Ira Weiny
+043bfd4d27fa13032205f36ae333162be7cd20c2
+
+	* Add node_name_map_name to opts file.
+
+Thu Nov 1 19:41:37 2007 -0700 Ira K. Weiny
+24c9a7d08b7c5c95e72d108a4fb6b8cefe6c0bf8
+
+	* Add node-name-map support to OpenSM; using the "default" map.
+
+Thu Nov 1 19:29:02 2007 -0700 Ira K. Weiny
+e2d0f2f8cfd63e1ac6b994a98ee67aa08626c8ff
+
+	* Change node name map implementation to use qmap in memory storage
+
+Thu Nov 1 20:15:08 2007 -0700 Ira Weiny
+a2f8073f501f981bb93bd68b8eb0d2779dae176a
+
+	* Move nodenamemap out of infiniband-diags into libosmcomp
+
+Thu Nov 1 08:06:37 2007 +0200 Sasha Khapyorsky
+10ade3a818d8ee8d73a61514931d67d00e07a837
+
+	* opensm/osm_vendor_ibumad: fix set_bit() func
+
+Mon Oct 15 20:41:33 2007 +0200 Sasha Khapyorsky
+1e96371673564df6bcec86fbf8b28485c52cf012
+
+	* management: changed method_mask type in user_mad interface
+
+Thu Nov 1 11:01:04 2007 +0200 Sasha Khapyorsky
+1f48ada263e5fcc69a3924e49c966f5dead6427b
+
+	* opensm/osm_indent: add indentation for labels
+
+Sun Oct 28 12:50:30 2007 +0200 Yevgeny Kliteynik
+61c015bdbf1da61ecd095cdd2b958d362c35ec3b
+
+	* osm: adding missing dependency in the makefile
+
+Thu Oct 25 11:43:46 2007 -0700 Ira Weiny
+0ca9a4c4d7c2043fa462ebc80e5cd31ae356a228
+
+	* Allow for a special value of "(null)" in the opts file.
+
+Tue Oct 23 11:03:32 2007 +0200 Yevgeny Kliteynik
+7af86c730d093878aa1dd34da05d092abf502530
+
+	* osm: QoS - adding CPI:CapabilityMask2 and turning on QOS_SUPPORTED bit
+
+Mon Oct 22 13:05:08 2007 +0200 Sasha Khapyorsky
+13e40daaaad7914d8f75fd796395b622c0ad5e87
+
+	* opensm/osm_ucast_mgr: trivial improvements
+
+Mon Oct 22 12:58:22 2007 +0200 Sasha Khapyorsky
+fb192ba10fd4639ca65c7a5bdc83754ff23c3f27
+
+	* opensm/osm_switch.c: indentation fixes
+
+Sun Oct 21 16:40:21 2007 +0200 Dale Purdy
+ab54783898b7b92d817d64439c93970cb529a018
+
+	* opensm: DOR (Dimension Order Routing) routing engine
+
+Mon Oct 22 17:11:39 2007 +0200 Sasha Khapyorsky
+225f853f28a24ae3774ffc3c542bc7a0e47161e3
+
+	* opensm/osm_ucast_lash: remove unused function
+
+Sun Oct 21 10:04:22 2007 +0200 Yevgeny Kliteynik
+42f12cae033565e6ed64b3243ffd470fbdec7229
+
+	* osm: QoS - parsing port names
+
+Thu Oct 18 19:11:21 2007 +0200 Sasha Khapyorsky
+c8737b80a10cce3704b605c192570ffee34d8fca
+
+	* opensm/lash: remove debug printfs - speed-up algorithm
+
+Thu Oct 18 16:06:06 2007 +0200 Sasha Khapyorsky
+72146186b4bb24616077eaeb1311616162dba36c
+
+	* opensm/vendor: use umad_get_issm_path() in osm_vendor_set_sm()
+
+Tue Oct 16 08:57:31 2007 +0200 Yevgeny Kliteynik
+1c4ecb188ac8191c171d3eb65243ba7b6303a927
+
+	* osm: Adding two SA MAD class-specific status values
+
+Tue Oct 16 00:44:52 2007 +0200 Yevgeny Kliteynik
+499135949af7f9a27d9ff4b510f30dd473673201
+
+	* osm: QoS parser - adding support for quoted string
+
+Mon Oct 15 15:19:18 2007 +0200 Sasha Khapyorsky
+25ea06fdee53a3451e800caf2c5a697a0c6a8db1
+
+	* opensm: only warning if no lid matrix or lft file given
+
+Wed Oct 3 14:05:03 2007 -0700 Tim Meier
+7600b47d665db779d9a157d821dcb36ccab0acd4
+
+	* opensm: osm_console.h replaced string literals with macro definitions
+
+Sun Oct 14 11:03:29 2007 +0200 Yevgeny Kliteynik
+28291a41bcf834560403eef61639cc1b0087e368
+
+	* osm: QoS - bug in opening policy file
+
+Tue Oct 9 01:05:03 2007 +0200 Sasha Khapyorsky
+3832b414f8ac07155e1a7e325cbd958c8e050d0b
+
+	* opensm: move osm_state_mgr dumpers to osm_dump.c
+
+Mon Oct 8 15:24:31 2007 +0200 Sasha Khapyorsky
+be25f8586bd4deeb6606f701364e8806129e903d
+
+	* opensm/osm_state_mgr_report: trivial simplifications
+
+Mon Oct 8 15:02:54 2007 +0200 Sasha Khapyorsky
+02016535a485bac3510cddce862172d59357ab03
+
+	* opensm: report message fix
+
+Tue Oct 9 11:00:38 2007 +0200 Yevgeny Kliteynik
+10781fded34e90040aa56049ee279a2494803ccd
+
+	* osm: QoS - fixing memory leaks
+
+Tue Oct 2 20:48:18 2007 +0200 Sasha Khapyorsky
+755d42596839f4c39b2c3f83a7dd03f3a74ce452
+
+	* opensm/osm_console.c: indentation fixes
+
+Mon Oct 1 15:56:02 2007 -0700 Tim Meier
+42c6acfe137e8c659c9ba3613ec97abbbffec4e2
+
+	* opensm: osm_console.c added a version command
+
+Mon Oct 1 15:13:42 2007 -0700 Ira Weiny
+5c00fd7b7ed2721593e77917a9df773119ddfc0f
+
+	* opensm/include/opensm/osm_perfmgr.h: fix the signaling of a sweep when the perfmgr is enabled.
+
+Mon Oct 1 15:13:41 2007 -0700 Ira Weiny
+25249da409ab616ef68aac102688de1d0d4ab532
+
+	* opensm/include/opensm/osm_perfmgr.h: fix the signaling of a sweep when the sweep time is changed in the console.
+
+Mon Oct 1 15:13:39 2007 -0700 Ira Weiny
+dc29bd78deca455e7c7e052a61054c8f1a8167b5
+
+	* opensm/opensm/osm_perfmgr.c: fix memory leak
+
+Mon Oct 1 15:13:37 2007 -0700 Ira Weiny
+377983f1771f41453b571a8aaabd5b49c99bbb97
+
+	* Add the event plugin name to the console output if a plugin is loaded.
+
+Mon Oct 1 19:42:25 2007 +0200 Sasha Khapyorsky
+ac279ad1c07a46721b84368183abc7d5585249e6
+
+	* opensm/opensm.spec.in: fix chkconfig command in %preun scriptlet
+
+Tue Sep 25 00:30:00 2007 +0200 Yevgeny Kliteynik
+69139fe1ebda1b6358564d43d61e05fca6d25c62
+
+	* osm: QoS parser - adding pkey in port groups
+
+Tue Sep 25 00:23:39 2007 +0200 Yevgeny Kliteynik
+a6b397ac549ce2f6e960106655fb69a2fc8a4868
+
+	* osm/osm_sa_path_record: trivial cosmetic chage
+
+Fri Sep 21 17:40:10 2007 +0200 Sasha Khapyorsky
+96cd11ab2db9bdfb354aae510ec1b23155f0947d
+
+	* opensm: osm_version.h is generated by ./configure
+
+Thu Sep 20 19:40:13 2007 +0200 Sasha Khapyorsky
+244f8d962cd0eb32e8fa79e2527387c781a2bc1d
+
+	* opensm: update version to 3.1.5
+
+Thu Sep 20 18:04:12 2007 +0200 Sasha Khapyorsky
+86b1fc2f5af59719d7abb3664dfe7c7bf3cca009
+
+	* management/*/*.spec.in: change Source field to OFA paths
+
+Wed Sep 19 21:29:08 2007 +0200 Sasha Khapyorsky
+31c976c710f1e20ce98bd5b9beb3bdf5b8c2513a
+
+	* opensm/osm_sa_(multi)path_record: various fixes
+
+Wed Sep 19 21:01:52 2007 +0200 Sasha Khapyorsky
+19c25ed32bc86c90e6be27ef224d00f8e541a354
+
+	* opensm/osm_sa_mcmember_record.c: fix uninitilized proxy_join usage
+
+Wed Sep 19 20:32:37 2007 +0200 Sasha Khapyorsky
+9f119b94a0913c6f48911154c2c2c903db2e7436
+
+	* opensm/osm_vl15intf.c: uninitialized var usage fix
+
+Wed Sep 19 20:32:37 2007 +0200 Sasha Khapyorsky
+1387ce47d4118afca9fc31b0d6af752308bc1ee6
+
+	* opensm/osm_ucast_ftree.c: potentially uninitialized vars usage fix
+
+Wed Sep 19 06:00:55 2007 -0700 Hal Rosenstock
+67fe50b6f2fde7b0cc88709ca18d91cfd6d721c7
+
+	* OpenSM/osm_ucast_ftree.c: Possible NULL ptr seg fault
+
+Wed Sep 19 06:00:46 2007 -0700 Hal Rosenstock
+030dc172eeb67a564152a3d8487e879c1e4b4c3b
+
+	* OpenSM/osm_mcast_mgr.c: Possible NULL ptr seg fault
+
+Wed Sep 19 03:37:03 2007 +0200 Sasha Khapyorsky
+953ad27c97a90695bce2a4aeebd610f6e8573787
+
+	* management/*/configure: RELEASE and TARBALL for spec files
+
+Wed Sep 19 03:28:43 2007 +0200 Sasha Khapyorsky
+72ecd0ffca527bd242338ec88f797ffd44157ef4
+
+	* management/*/Makefile.am: clean dist-hook target
+
+Wed Sep 19 03:03:17 2007 +0200 Sasha Khapyorsky
+77a787f1c5c08f5cf94238d05d134ef0a59f064a
+
+	* opensm/Makefile.am: generate ChangeLog on 'make dist'
+
+Wed Sep 19 02:00:08 2007 +0200 Sasha Khapyorsky
+f43eb75bd116fa0187ef0abf23fa80a8acfd3249
+
+	* management/*/*.spec.in: don't run autogen.sh
+
+Wed Sep 19 01:29:39 2007 +0200 Sasha Khapyorsky
+ffc358af5c6d1fde296dde42078b0e2c34a4c922
+
+	* opensm/Makefile.am: more 'make dist' fixes
+
+Tue Sep 18 08:32:25 2007 -0700 Hal Rosenstock
+ade0224e3d2661a2bd9ca538d900192b484a5010
+
+	* OpenSM: Trivial comment changes and other cleanup
+
+Tue Sep 18 04:34:41 2007 -0700 Hal Rosenstock
+1f7685afc64c6ed758b774c671aaac421520d548
+
+	* OpenSM/man: Update email contact info
+
+Tue Sep 18 16:03:14 2007 +0200 Sasha Khapyorsky
+a47a98074561cd5f41ca5bdae383a8c1fb54f3ae
+
+	* opensm: recent indentation fixes
+
+Tue Sep 11 11:04:16 2007 -0700 Hal Rosenstock
+31f72bc1ff4447c2b97de10351a67ded3876020f
+
+	* OpenSM: Improve QP0 and QP1 counter accounting
+
+Mon Sep 17 16:59:58 2007 -0700 Hal Rosenstock
+5344f09f1656f221dfbea1a297396a0fc5318b68
+
+	* OpenSM/main.c: Fix compile error
+
+Tue Sep 11 11:03:58 2007 -0700 Hal Rosenstock
+160870b527ef5b5c5a3c484259a2852aa0a43eee
+
+	* OpenSM/console: Support loopback in -console option
+
+Tue Sep 18 00:23:44 2007 +0200 Yevgeny Kliteynik
+c4d3d828663100264362e23b9c8bdfb46399a02b
+
+	* osm: QoS parser - checking allocation status
+
+Mon Sep 17 21:23:27 2007 +0200 Yevgeny Kliteynik
+0d67bbd511f1fd4b62d3066799c9befdb9c65336
+
+	* osm: QoS - reworked node types in port group
+
+Mon Sep 17 21:22:26 2007 +0200 Yevgeny Kliteynik
+0e35a31b28c595f89a022e4fc8b802b68d755876
+
+	* osm: QoS - replace guid ranges and partition list by port map
+
+Mon Sep 17 21:09:55 2007 +0200 Yevgeny Kliteynik
+6f8f70e8b84b0041ac92511fc45b2afe23e707e8
+
+	* osm: TrapRepress was failing for mkey != 0
+
+Mon Sep 17 21:06:06 2007 +0200 Yevgeny Kliteynik
+84d4a2bb6f848cae7eceb0d37938f33b9e4c52c2
+
+	* osm: mkey lease period description in options file
+
+Mon Sep 17 20:53:30 2007 +0200 Sasha Khapyorsky
+1454292a6b45c0324bce3b5720e545361931e915
+
+	* opensm and all: fix Source field in spec.in files.
+
+Mon Sep 17 20:43:26 2007 +0200 Sasha Khapyorsky
+d2d357334026d4d7c579a2e44d257105a7a0646c
+
+	* opensm: fix iba/*.h installation path
+
+Sun Sep 16 18:47:46 2007 +0200 Sasha Khapyorsky
+b07df69cf286bff64d785fede009812c2dc5daa4
+
+	* opensm/ptrn_config: decrease verbosity for SL overwrite log message
+
+Tue Sep 11 16:01:29 2007 +0300 Yevgeny Kliteynik
+9d56daf8248345d1d8ba0b42e773c1282c99a3be
+
+	* osm: QoS - changing 'no_qos' option to 'qos'
+
+Sun Sep 9 18:01:20 2007 +0300 Yevgeny Kliteynik
+84c2cd6a507a0edad1b8355db3b4d07d517d781b
+
+	* osm: QoS - MultiPathRecord selection according to QoS level
+
+Fri Sep 14 14:29:59 2007 +0300 Sasha Khapyorsky
+a136bc4f93daaa9a3717381bac1f954935de4bcc
+
+	* opensm: build improvements
+
+Sat Sep 15 14:41:27 2007 +0300 Sasha Khapyorsky
+30b1b76a63859f6edf1cc96e5ae5699052a425f6
+
+	* opensm: fix broken make dist
+
+Fri Sep 14 18:56:31 2007 +0300 Sasha Khapyorsky
+04817d2a1e3189e728931e72f7bf22415fb4787f
+
+	* opensm: remove obsolete configure.in and spec.in files
+
+Fri Sep 14 18:51:55 2007 +0300 Sasha Khapyorsky
+413e968d89ca038c5d589fc58d8adb42c99d7f80
+
+	* opensm: configure scripts merge
+
+Tue Sep 4 20:52:49 2007 +0300 Sasha Khapyorsky
+a1c565ebf5ed95deef8fa8f52ad63c31385fd610
+
+	* opensm/autogen.sh: remove autogen.sh from opensm subdirectories
+
+Sun Sep 9 15:57:42 2007 +0300 Yevgeny Kliteynik
+8033ccf86f7bb224806566fb58860e3b17709158
+
+	* osm: bugfix - IB_PR_COMPMASK was used in MPR
+
+Fri Sep 7 03:38:41 2007 +0300 Yevgeny Kliteynik
+c36f4dfad3576c94d87f061eb64b8a67accb195e
+
+	* osm: QoS: selecting PathRecord according to QoS policy
+
+Fri Sep 7 03:38:04 2007 +0300 Yevgeny Kliteynik
+7309fa5540e65da32c936031b37a40b008b33112
+
+	* osm: QoS - support for MPR in qos policy
+
+Fri Sep 7 03:36:15 2007 +0300 Yevgeny Kliteynik
+84d6f9c950d50be657676b9b5ac4e5fb601604b6
+
+	* osm: QoS - adding subnet to qos policy and adding wrapper that returns qos level
+
+Tue Sep 4 23:18:18 2007 +0300 Yevgeny Kliteynik
+7b37c1aab95defaf49a25fd14ae00a73e15960ce
+
+	* osm: QoS - fixing access to ServiceID field of MultiPathRecord
+
+Tue Sep 4 18:17:07 2007 +0300 Yevgeny Kliteynik
+c56ac22000e6951154d8f3cd5db952fc9a63d56c
+
+	* osm: QoS - adding new QoS fields to MultiPathRecord
+
+Tue Sep 4 18:16:58 2007 +0300 Sasha Khapyorsky
+a6f833ea3cbe7367494d4475e0db61e1fc544c27
+
+	* include/complib: cosmetic formatting changes
+
+Fri Aug 31 13:14:02 2007 +0300 Sasha Khapyorsky
+591e397957da2d938c14c6ab15e60fad36dfbdc5
+
+	* opensm/complib: cl_event cosmetic cleanup
+
+Thu Aug 23 18:37:00 2007 +0300 Sasha Khapyorsky
+a0d7a0ff18ce1794ea60495762761fc88ddc5bed
+
+	* opensm/perfmgr: PerfMgr for SM standby and inactive states
+
+Wed Aug 29 00:44:52 2007 +0300 Sasha Khapyorsky
+8296399baa083e58171cf96ceb1a2e82ebae8fe6
+
+	* opensm: timer driven periodic sweep
+
+Tue Sep 4 15:49:36 2007 +0300 Yevgeny Kliteynik
+1829aa61ee3a2bd47df935cc984d68139a110d94
+
+	* osm: QoS - fixing ServiceID and PKey bug in match rules
+
+Fri Aug 31 15:09:23 2007 -0700 Ira Weiny
+ced6b8225789d1940e07cdf4588abbcfec7f9765
+
+	* opensm/opensm/Makefile.am : add osm_event_plugin.h to the installed
+
+Sun Sep 2 02:45:56 2007 +0300 Sasha Khapyorsky
+426fa29f74fc1bca7cac3265ed070fff54e20911
+
+	* opensm/osm_prtn.c: indentation fixes
+
+Fri Aug 31 10:13:59 2007 -0600 Rolf Manderscheid
+f03b42281a4fca17271e0baeb0817eebd725bce9
+
+	* opensm: set hop limit when creating ipoib multicast groups
+
+Fri Aug 31 16:16:46 2007 -0700 Ira Weiny
+631e583e2df453416f348b2380d2a9556da5e405
+
+	* osm: QoS parser - fixing yacc command
+
+Wed Aug 29 15:34:03 2007 +0300 Sasha Khapyorsky
+cc45c4b810a4de06ef03bdff400767aa6394bf28
+
+	* opensm/osm_vendor_ibumad.c: send error callback only when reponse is expected
+
+Thu Aug 30 11:55:42 2007 -0600 Rolf Manderscheid
+d623f9d6c8ecf51bd729cf514dccfa506432e073
+
+	* opensm: set scope according to configuration for ipoib multicast groups
+
+Thu Aug 30 18:39:47 2007 +0300 Yevgeny Kliteynik
+8afea7d9f26fe182d26684314ff80a84bdde54cb
+
+	* osm: QoS parser - fixing yacc command
+
+Wed Aug 29 09:07:45 2007 -0400 Hal Rosenstock
+8f831d177db1d61da4739bbdfffc9247f18f6dfd
+
+	* Opensm/Makefile.am: Change for flex version 2.5.4
+
+Wed Aug 29 14:18:06 2007 +0300 Sasha Khapyorsky
+517990ec8708b3d389e89232e12df6cb556fbb5a
+
+	* opensm: drop CL_ASSERT() for non-existing var
+
+Sun Aug 26 19:25:47 2007 +0300 Sasha Khapyorsky
+0b7ee4609aa4ae16ea8031c8fb5086156f09060b
+
+	* opensm: serialize osm_state_mgr_process()
+
+Tue Aug 28 18:11:35 2007 +0300 Yevgeny Kliteynik
+8f14ab01f3f7bc2889b219e1dc5b1e846f8e35e5
+
+	* osm: QoS - destroy qos_policy when destroying subnet
+
+Tue Aug 28 17:49:46 2007 +0300 Yevgeny Kliteynik
+5fde4be5dfeec4f43ef63986bb4c7d0455166a74
+
+	* osm: QoS - remove 'yyunput' compilation warning
+
+Tue Aug 28 20:21:46 2007 +0300 Sasha Khapyorsky
+7733a95f4e110ac97a7c1dc3ba02ddf17c65c913
+
+	* opensm: cleanup signal.h inclusions
+
+Tue Aug 28 19:25:47 2007 +0300 Sasha Khapyorsky
+20bea55b8c51f429c675339926270bdc83adefe2
+
+	* opensm/osm_base.h: trivial formatting improvements
+
+Wed Aug 29 03:35:39 2007 +0300 Sasha Khapyorsky
+1ef7712bbf28650786e333734063dbcac89706ae
+
+	* opensm/osm_vendor_mlx_txn.c: update cl_event_wheel_init() usage
+
+Tue Aug 28 15:54:20 2007 +0300 Sasha Khapyorsky
+e2659541597c781e8c929448f7c3fae91e9893c7
+
+	* opensm/configure.in: return lex and yacc deps back.
+
+Tue Aug 28 15:54:20 2007 +0300 Sasha Khapyorsky
+11225ce93cc03b27a12549799260ae1cee961e32
+
+	* opensm/configure.in: drop lex and yacc.
+
+Tue Aug 28 02:11:46 2007 +0300 Yevgeny Kliteynik
+ec6e028e058f827f214af355fce945f5cd87ae5f
+
+	* osm: QoS - reading policy file
+
+Tue Aug 28 02:11:28 2007 +0300 Yevgeny Kliteynik
+e4d52f5991bf9b3b73b691d86fc436f4cfe8d0e1
+
+	* osm: QoS - compiling policy file parser
+
+Tue Aug 28 02:10:59 2007 +0300 Yevgeny Kliteynik
+212c495cfbdcf078c6096ccf9abd30ab60b319f3
+
+	* osm: QoS - adding QoS policy options
+
+Tue Aug 28 02:10:36 2007 +0300 Yevgeny Kliteynik
+f2d248cc3f7adb1dc543275ca88695a6d9538005
+
+	* osm: QoS - rename static find_prtn_by_name() to non-static
+
+Tue Aug 28 02:09:50 2007 +0300 Yevgeny Kliteynik
+8c0b9457e28ba41cdf020399954febffda7098c4
+
+	* osm: QoS policy C & H files
+
+Tue Aug 28 02:09:06 2007 +0300 Yevgeny Kliteynik
+0c975371046a53d06e5dfd34b1861e9269ae2c94
+
+	* osm: QoS - policy file parser Lex & Yacc
+
+Sun Aug 26 09:38:40 2007 +0300 Sasha Khapyorsky
+dcbb165a191c03494b3d83e2f3381ccc3d31462b
+
+	* opensm/complib: remove osm_log usage from complib's API
+
+Fri Aug 24 19:44:17 2007 +0300 Sasha Khapyorsky
+4384959eb8d87e779f7d43a51681441871f73807
+
+	* complib: remove osm_log() calls
+
+Thu Aug 23 18:36:15 2007 +0300 Sasha Khapyorsky
+84fb1417e5666a6932c2055cdfe49f04586e53e9
+
+	* opensm/libvendor: add complib to the linker line
+
+Thu Aug 23 15:29:02 2007 +0300 Sasha Khapyorsky
+687e04428373b3f5cd8b454cedd7b37bc79d00b7
+
+	* opensm: add --perfmgr to usage
+
+Thu Aug 23 09:51:13 2007 +0300 Sasha Khapyorsky
+dd68aa6263b6e080f28554860450cabe76c7baef
+
+	* opensm/include/iba/ib_types.h: trivial formatting changes
+
+Sun Aug 19 09:42:15 2007 +0300 Sasha Khapyorsky
+929eab21fb3a6aa79feb4140302419feba63a98d
+
+	* opensm/perfmgr: trivial changes
+
+Wed Aug 22 17:09:47 2007 -0700 Ira Weiny
+86b37bbbc6e127de0413e29f36ec0d262510715e
+
+	* opensm configure: add perf-mgr-profile option and clean up "#if 0" debug code
+
+Wed Aug 22 16:55:35 2007 -0700 Ira Weiny
+61c721a18aec85dbe25d630fd61c10a5e9bb5148
+
+	* opensm/opensm/osm_perfmgr.c: remove unused status variable.
+
+Tue Aug 21 14:44:58 2007 +0300 Yevgeny Kliteynik
+7004b249b0daef22f5a496c52e84f636f2ee8530
+
+	* osm: QoS - adding new PathRecord fields
+
+Sun Aug 19 01:45:21 2007 +0300 Sasha Khapyorsky
+94f2fb569d029fc9060493df5189dfec35ff0398
+
+	* opensm: fix outstanding mad counters tracking
+
+Mon Aug 20 12:20:05 2007 +0300 Sasha Khapyorsky
+b5608b629085fd462b41739e659d6f9ef1ffa7a2
+
+	* opensm/osm_vendor_ibumad.c: indent fixes
+
+Mon Aug 20 12:17:02 2007 +0300 Sasha Khapyorsky
+6e567ad8c5247554271d83732b55d86f1e12938d
+
+	* opensm/osm_vendor_ibumad.c: typo fix
+
+Sun Aug 19 01:11:40 2007 +0300 Sasha Khapyorsky
+076352268c3ddcbb42bb745d102d8b95b4c6e7b8
+
+	* opensm/osm_ucast_ftree.c: remove unused funcs
+
+Sun Aug 19 01:10:24 2007 +0300 Sasha Khapyorsky
+e00f1dfe4c45d12b5a9362d305f17d76bf82267c
+
+	* opensm/osm_sm_mad_ctrl.c: cosmetic
+
+Sat Aug 18 21:59:42 2007 +0300 Sasha Khapyorsky
+37dfddc2a234fe21629e185a38432a93b5fd51d0
+
+	* opensm/osm_ucast_ftree.c: make some func static
+
+Sat Aug 18 21:54:47 2007 +0300 Sasha Khapyorsky
+43d52f31765cc33cc616af5c326e93cd0376e882
+
+	* opensm: indentation changes
+
+Sat Aug 18 21:02:50 2007 +0300 Sasha Khapyorsky
+6686890c9c56847ac74835da3bcfdb31998f0b99
+
+	* opensm/osm_ucast_lash.c: minor changes
+
+Fri Aug 17 07:14:40 2007 +0300 Sasha Khapyorsky
+47460486d9f302ff202e0184b0805f76b3c7e113
+
+	* osmtest: indentation changes
+
+Fri Aug 17 06:58:45 2007 +0300 Sasha Khapyorsky
+acfb60d546fa81e4af7c46749b7569f00a648244
+
+	* opensm/osmeventplugin: indentation changes
+
+Fri Aug 17 06:48:59 2007 +0300 Sasha Khapyorsky
+04b003be6dabbd3a21279c41ead0fcf70782e3a9
+
+	* opensm: make some funcs static
+
+Fri Aug 17 06:24:12 2007 +0300 Sasha Khapyorsky
+49e89b7e0433fd408fb8a939bece8347c004592e
+
+	* opensm/osm_sa_patch_record.c: trivial changes
+
+Fri Aug 17 06:15:47 2007 +0300 Sasha Khapyorsky
+246ab27cd22b40036512ae75ffbd31ad4f68fd8b
+
+	* opensm: indentation changes
+
+Fri Aug 17 06:00:14 2007 +0300 Sasha Khapyorsky
+0a2b712e9c042962d6b245c1f518487be685bcd8
+
+	* opensm: cosmetic changes
+
+Fri Aug 17 04:52:40 2007 +0300 Sasha Khapyorsky
+3e7cd649d2a8f3ec792a1ead4717f6ee4ddeb088
+
+	* opensm: indentation changes
+
+Fri Aug 17 04:40:05 2007 +0300 Sasha Khapyorsky
+34e19259803489e93bd366ec20c684129f907445
+
+	* opensm/osm_link_mgr.c: cosmetic changes
+
+Fri Aug 17 04:09:27 2007 +0300 Sasha Khapyorsky
+bf341f927b12edce0ec3c22ed0031617e71d5ef0
+
+	* opensm: cosmetic changes
+
+Fri Aug 17 03:03:22 2007 +0300 Sasha Khapyorsky
+0dd8a24400f91eb7a7fb0ac2d2ad237836c36b8d
+
+	* opensm: indentation changes
+
+Fri Aug 17 02:49:27 2007 +0300 Sasha Khapyorsky
+c11329a3c0593cbb0ec6943e671dce4c132ba3a1
+
+	* opensm/osm_trap_rcv.c: cosmetic changes
+
+Fri Aug 17 02:33:47 2007 +0300 Sasha Khapyorsky
+88fd5fbb7469b433e1f0b50bd54c059f93a62420
+
+	* opensm: cosmetic changes
+
+Thu Aug 16 23:30:22 2007 +0300 Sasha Khapyorsky
+bec4279e7012dee59b55339076c1da084b48cb01
+
+	* opensm/osm_vl15intf.c: trivial code reordering
+
+Thu Aug 16 23:14:05 2007 +0300 Sasha Khapyorsky
+2b73f5c0c8ae8b1a6d42f131fea6c548d469ac7c
+
+	* opensm/osm_vl15intf.c: indentation changes
+
+Thu Aug 16 22:51:46 2007 +0300 Sasha Khapyorsky
+51fdc2b72e64374a4d39cd390a194ae78f94e10d
+
+	* opensm/osm_vl15intf.c: trivial changes
+
+Thu Aug 16 22:23:30 2007 +0300 Sasha Khapyorsky
+8dfbf5e21066d6a94bcf71dac7b44fee499e1e0c
+
+	* opensm/osm_sm_mad_ctrl.c: trivial changes
+
+Thu Aug 16 20:58:42 2007 +0300 Sasha Khapyorsky
+c49937022e085be7265bd346c310011804c3cc47
+
+	* opensm/osm_subnet.c: trivial naming changes
+
+Thu Aug 16 20:46:32 2007 +0300 Sasha Khapyorsky
+abd298104b347226bb0138f5002daac83e92a7ca
+
+	* opensm/osm_subnet.c: indentation changes
+
+Thu Aug 16 19:23:32 2007 +0300 Sasha Khapyorsky
+88708bc7a579bd0634217f96c500d790042e4bd1
+
+	* opensm/opensm: indentation changes
+
+Thu Aug 16 15:00:02 2007 -0700 Ira Weiny
+953e099699fcdfe96f94ba553c05351d3093b9c7
+
+	* osm_perfmgr.c: Fix extra port being added to num_ports
+
+Tue Aug 14 19:41:02 2007 +0300 Sasha Khapyorsky
+e6b7142f66a74e7f29343df96baee5d8477686f9
+
+	* opensm/include/opensm: indentation changes
+
+Tue Aug 14 19:41:02 2007 +0300 Sasha Khapyorsky
+7785e3d03340b5bdfa61cb415c8d8bc387a21d97
+
+	* opensm/libvendor: indentation changes
+
+Wed Aug 15 23:44:31 2007 +0300 Sasha Khapyorsky
+a393c46e663f8600c2e73fabef5bb8b05d5ee088
+
+	* opensm/include/vendor: indentation fixes
+
+Wed Aug 15 23:49:17 2007 +0300 Sasha Khapyorsky
+f814d3a9da17b3029672760030bcc82e040bcb74
+
+	* opensm/libvendor: syntax fixes
+
+Tue Aug 14 19:41:02 2007 +0300 Sasha Khapyorsky
+c6beb05c86f39742f81c69a7b21c22318878dac0
+
+	* complib: indentation changes
+
+Tue Aug 14 18:23:36 2007 +0300 Sasha Khapyorsky
+50403cf2bf37900ff4940b1d2f551587626ef516
+
+	* opensm/include/ida: indentation changes
+
+Tue Aug 14 17:53:08 2007 +0300 Sasha Khapyorsky
+0732bf4a07c071641e2a706eda686f049fc23bca
+
+	* opensm: remove light_sweep_physp_list list
+
+Tue Aug 14 16:21:48 2007 -0700 Ira Weiny
+eedad68940cadfd0d3c8ca8788b95a6d9094d7b2
+
+	* Fix the osm_epi_node_id_t structure name.
+
+Mon Aug 13 00:33:19 2007 +0300 Sasha Khapyorsky
+188a349b2021ce4b22900b287f6657dbf574e175
+
+	* complib: indentation changes in header files
+
+Sun Aug 12 19:17:03 2007 +0300 Sasha Khapyorsky
+1918519f197e2a59116e068dd4868ffcc3f2de3f
+
+	* opensm: cleanup in report_duplicated_guid()
+
+Sun Aug 12 18:36:55 2007 +0300 Sasha Khapyorsky
+57ca74a717a288e4ecfb61ebd74456bebccdd452
+
+	* opensm: resweep instead of exit when duplicated guid suspected
+
+Sun Aug 12 03:38:12 2007 +0300 Sasha Khapyorsky
+3c33465c298cd642ee89de4e153123bc7747665d
+
+	* opensm: duplicated GUID/moved port detection improvements
+
+Sat Aug 11 01:53:19 2007 +0300 Sasha Khapyorsky
+1ac40cbbd9ebb76e1665134e73950c8388e0300a
+
+	* opensm: move duplicated guid reporting to separate function.
+
+Sat Aug 11 22:20:30 2007 +0300 Sasha Khapyorsky
+444d31e29d48b86a92351bbbfc51acf11eb80756
+
+	* opensm: discovery if new sweep was requested
+
+Sun Aug 12 23:28:44 2007 +0300 Sasha Khapyorsky
+059157b873b5e0cf1aa2d3548a483418ed00696c
+
+	* opensm: is_new osm_port_t field instead of new_ports_list
+
+Sun Aug 12 14:22:45 2007 +0300 Sasha Khapyorsky
+e3cb6e1385f41d166adad5dda373887a08dfd392
+
+	* opensm/osm_node_info: fix in printing
+
+Tue Aug 7 19:43:41 2007 +0300 Sasha Khapyorsky
+71038ff99b76698264cc0df4a87315315721ec17
+
+	* opensm: descrease default HoQLife value for leaf ports.
+
+Tue Aug 7 00:05:08 2007 +0300 Yevgeny Kliteynik
+793216e6eba4cbc76c3996c4ab414cd1a802f76e
+
+	* osm: default leaf vl_stall and head_of_queue_life counters
+
+Sun Aug 5 18:57:58 2007 +0300 Sasha Khapyorsky
+290885564b99e6bf74290210429bb3ed448bdfc0
+
+	* opensm: remove unused variable
+
+Sun Aug 5 18:56:46 2007 +0300 Sasha Khapyorsky
+6c24dbb4a28b04cd52a809f7f3ecfd991d585bfd
+
+	* opensm: wrong variable memset()
+
+Sat Aug 4 19:52:12 2007 +0300 Sasha Khapyorsky
+251a77ed4ec1750641ee4bbd3b892623bfc0400e
+
+	* opensm/osm_port.c: make some func static
+
+Fri Aug 3 19:37:54 2007 +0300 Sasha Khapyorsky
+becba138569cf6cfdd0ff85f53273008dc06ffad
+
+	* opensm/osm_node_info_rcv.c: sprintf usage improvements
+
+Wed Aug 1 17:18:17 2007 +0300 Sasha Khapyorsky
+806fc043ace242126d5fb21d5ec503b933067cc7
+
+	* opensm/osm_node_info_rcv.c: cosmetic formatting stuff
+
+Wed Aug 1 15:24:59 2007 +0300 Sasha Khapyorsky
+d71fbd9ffee2a8069e518ad1fdc4c5df97477da8
+
+	* opensm: loopback connection handling
+
+Thu Aug 2 16:10:19 2007 +0300 Yevgeny Kliteynik
+3d171f0c8cc5e6843ae80245174fbdfef531d285
+
+	* osm: cosmetics - removing trailing blanks
+
+Tue Jul 31 14:27:42 2007 +0300 Sasha Khapyorsky
+519383edad1493ccb5875554e01601da7975007e
+
+	* opensm: report new ports before handover mastership
+
+Tue Jul 31 18:04:14 2007 +0300 Sasha Khapyorsky
+7a19bcc1bce8a6b1b11b3fd5a94456f24c33b6aa
+
+	* opensm: remove lft setup hack
+
+Tue Jul 31 18:16:01 2007 +0300 Sasha Khapyorsky
+31df60de58150c71ead16ddd73cd35f18b8b035f
+
+	* opensm: remove some CL_ASSERT() in __osm_ni_set_links()
+
+Mon Jul 30 15:54:11 2007 -0400 Hal Rosenstock
+0feb6a98d049dbf14615b5d9d34ef8116caef5d5
+
+	* OpenSM/include/iba/ib_types.h: Some comment fixes
+
+Fri Jul 27 07:38:19 2007 +0300 Sasha Khapyorsky
+03d742ea26eeb9ddb1909195886ae58bab47cb3c
+
+	* opensm: cosmetic and formatting changes
+
+Fri Jul 27 07:11:29 2007 +0300 Sasha Khapyorsky
+e499c345c3a4152b9c0b0e8485472dc0e2c36ca9
+
+	* opensm: router creation code consolidation
+
+Fri Jul 27 00:59:42 2007 +0300 Sasha Khapyorsky
+c0ba7125010710a746a95a55297826bb7a53ee98
+
+	* opensm: dumpers improvements
+
+Thu Jul 26 06:28:47 2007 +0300 Sasha Khapyorsky
+dfedfd06331a734269d136d60da417e3fef16291
+
+	* opensm: remove static __some_hop_count_set var
+
+Thu Jul 26 03:49:40 2007 +0300 Sasha Khapyorsky
+d67b047690cbc744e543c0ee90ada96110b2bf25
+
+	* opensm: don't fetch LFTs initially
+
+Thu Jul 26 03:39:28 2007 +0300 Sasha Khapyorsky
+85148f4c1044618225f7d5aa33919680f7bc75be
+
+	* opensm: remove reassign_lfts configuration parameter
+
+Wed Jul 25 02:46:48 2007 +0300 Sasha Khapyorsky
+113974ce47c872698a6ee2e5b54d57f663f0072b
+
+	* opensm: handle port and switch tables update over handover
+
+Sun Jul 22 21:01:32 2007 +0300 Sasha Khapyorsky
+eb130c0d9f0cf7ea6dc45a23eba51524f03d69e9
+
+	* opensm: detect port external reset and flush cached tables
+
+Sun Jul 22 21:01:32 2007 +0300 Sasha Khapyorsky
+48f585922974d2ac92bb3e7c4ceb06fa37800c46
+
+	* opensm: detect fast switch reset and force LFT update
+
+Thu Jul 26 13:53:07 2007 -0400 Hal Rosenstock
+7d83ab401b1995dd7479bf0e9fcd65c748ec3b98
+
+	* OpenSM: More changes from osm.log to opensm.log
+
+Thu Jul 26 10:25:30 2007 -0400 Hal Rosenstock
+e06e70d6c3e12372f275c7f3840379f94e2dabbe
+
+	* OpenSM/osm_port.c: Fix opvls and neighbormtu when remote port invalid
+
+Fri Jul 27 02:03:13 2007 +0300 Hal Rosenstock
+901e6bddc93db018a44931b973c21ce9dcc6a0df
+
+	* OpenSM/include/iba/ib_types.h: Fix comment
+
+Tue Jul 24 09:41:51 2007 -0700 Ira K. Weiny
+766b596ec3494af9f1ec3a548e00e74ffba841d3
+
+	* Supress trying to load the "NONE" plugin if the default is not configured in
+
+Tue Jul 24 20:33:16 2007 +0300 Sasha Khapyorsky
+0398b9de9157218f8340fbe384bf114eead2c377
+
+	* opensm: trivial formatting changes in osm_port.h
+
+Fri Jun 22 02:16:44 2007 +0300 Sasha Khapyorsky
+56fe7d5cfbb7bbb7448b281322171181a2dce740
+
+	* opensm/osm_indent: go closer to opensm-coding-style.txt
+
+Sun Jul 22 01:05:02 2007 +0300 Sasha Khapyorsky
+e8e8c67367a597f7a2cb44fca94f52f9799dc079
+
+	* opensm: set PortInfo:LinkSpeed in link_mgr only
+
+Thu Jul 19 16:03:55 2007 +0300 Sasha Khapyorsky
+4404d1a61cd6a85a4e8b1e1b6b0c174d2d8a60f7
+
+	* opensm: VLHighLimit update during initial (in sweep) link_mgr call
+
+Wed Jul 18 19:31:49 2007 +0300 Eitan Zahavi
+54e76617617f0017535d66a8e93c64626a337620
+
+	* opensm: Bug in coding trying to set vl_arb_high_limit
+
+Thu Jul 19 07:26:20 2007 +0300 Sasha Khapyorsky
+6aa232f182d1d4d72c8f92752a67fd166fb768d1
+
+	* opensm: remove trailing whitespaces
+
+Thu Jul 19 07:23:39 2007 +0300 Sasha Khapyorsky
+e8a4cdb93eee63ef28c51b920a803ebeea8d2d89
+
+	* opensm/osmtest: remove trailing whitespaces
+
+Thu Jul 19 07:21:30 2007 +0300 Sasha Khapyorsky
+87b5f91de6a363dcbb6d6c1dbc91dd5e45c22ede
+
+	* opensm/vendor: clean trailing whitespaces
+
+Thu Jul 19 07:18:02 2007 +0300 Sasha Khapyorsky
+b6db389a0ec61b5791066f4427fbc8abdf79e976
+
+	* opensm/include/iba: clean trailing whitespaces
+
+Thu Jul 19 07:15:50 2007 +0300 Sasha Khapyorsky
+30806d1ea5d11b420c5366a216282abfb1314293
+
+	* opensm/complib: clean trailing whitespaces
+
+Sun Jul 15 06:43:20 2007 -0400 Hal Rosenstock
+093d19214b670227e216def94875981407b9d951
+
+	* OpenSM: Change force_link_speed to allow for local policy and more flexibility
+
+Sun Jul 15 14:56:32 2007 +0300 Yevgeny Kliteynik
+6bd3d1844ad096aac36bfeb8fc0826e77c2670d1
+
+	* osm: some improvements to fat-tree routing
+
+Thu Jul 12 11:56:08 2007 -0400 Sasha Khapyorsky
+5764e8a528a7d6bbfe41c42e9ddcb4e09bb45e50
+
+	* OpenSM/osm_ucast_updn.c: Root detector function simplification
+
+Thu Jul 12 09:37:50 2007 -0400 Hal Rosenstock
+8f9c8281777d211f319acaa0a938b10da6612362
+
+	* OpenSM/include/opensm/osm_version.h: Bump version to 3.1.4 to distinguish from version used for opensm-3.1.1 release
+
+Wed Jul 11 09:27:27 2007 -0400 Hal Rosenstock
+f01f03212091aa20c21b205d5aa5440d45bbfc0b
+
+	* OpenSM/configure.in: Updated to version 3.1.1
+
+Wed Jul 11 09:26:22 2007 -0400 Hal Rosenstock
+ce402cc75418a534fc6ae640d4c1b3d8ef10b68d
+
+	* OpenSM/libvendor: Updated to version 2.2.1
+
+Wed Jul 11 09:25:41 2007 -0400 Hal Rosenstock
+4cc79dc92b8e0774a2e74d211d0f4a108579221f
+
+	* OpenSM/opensm: Updated to version 2.2.1
+
+Wed Jul 11 09:24:46 2007 -0400 Hal Rosenstock
+0957e9b19f68d4741d60db2600c776f68e630aa5
+
+	* OpenSM/complib: Updated to version 2.2.1
+
+Wed Jul 11 09:23:32 2007 -0400 Hal Rosenstock
+039580ea8892c31c7f5ca39a06f732b56a24968b
+
+	* OpenSM/include/configure.in: Updated to version 2.2.1
+
+Tue Jul 10 15:06:48 2007 -0400 Hal Rosenstock
+b992499f2849643b8076fd9fa75add6a741c792e
+
+	* OpenSM/osm_ucast_updn.c: Cosmetic change to osm_log message
+
+Tue Jul 10 15:03:27 2007 -0400 Sasha Khapyorsky
+8be9b909e3029a3c2c3fe48a5f530d1ec791ca3e
+
+	* OpenSM/osm_ucast_updn.c: up/down root switches detector fix
+
+Tue Jul 10 11:59:57 2007 -0400 Hal Rosenstock
+211d4674acc834de14751eab5c5d021cb384e4c7
+
+	* OpenSM/osm_port.c: Cosmetic change to osm_log message
+
+Tue Jul 10 11:54:36 2007 -0400 Hal Rosenstock
+76ddc0393538079f45b4d6b78d176d58f5b6c5ff
+
+	* OpenSM: Cosmetic changes to some osm_log messages
+
+Tue Jul 10 10:17:05 2007 -0400 Hal Rosenstock
+67b0ea3719e442cfa6c9b6f23189b1fa435f65a9
+
+	* OpenSM/osm_port_info_rcv.c: Fix commentary typo
+
+Tue Jul 10 09:43:53 2007 -0400 Hal Rosenstock
+b458d7b58c7ed44f7dc53d5fd7b114af7e02cef0
+
+	* libvendor/ChangeLog: Add log entry for Sean'c osm_vendor_ibumad.c change to umad_set_pkey call to use pkey_index 0 rather than pkey
+
+Tue Jul 10 09:40:57 2007 -0400 Sean Hefty
+54681126de42a641f80900aff9ac609efca18ffc
+
+	* OpenSM/libvendor/osm_vendor_ibumad.c: Use pkey index, rather than pkey with libibumad
+
+Tue Jul 10 09:08:16 2007 -0400 Hal Rosenstock
+70d3c90c7b2f2344061dc69dcf9890657ed7ba11
+
+	* PerfMgr: Add option to disable redirection information saving
+
+Tue Jul 10 08:18:31 2007 -0400 Hal Rosenstock
+0115e00b4f62851aa6a017e4e71bf807551b7b63
+
+	* PerfMgr: Clear redirection on send timeout
+
+Tue Jul 10 07:19:38 2007 -0400 Hal Rosenstock
+d60b552d1c08e9684975285f384cdddc17274dae
+
+	* OpenSM/osm_trap_rcv.c: Commentary change
+
+Tue Jul 10 06:24:13 2007 -0400 Hal Rosenstock
+938d1cb01680dc4b736f156fe6c62b267054da4d
+
+	* PerfMgr: Cosmetic change to osm_log message
+
+Mon Jul 9 19:13:18 2007 -0400 Hal Rosenstock
+a8744daaaf3b16a8827eda9684eeefe24b97af9d
+
+	* OpenSM/include/iba/ib_types.h: Add define for IB_PORT_PHYS_STATE_NO_CHANGE
+
+Mon Jul 9 16:42:20 2007 -0400 Ira K. Weiny
+d6092e760bf89d55f1d37a3a3183f93e1281acd4
+
+	* PerfMgr: Remove notice report hooks
+
+Mon Jul 9 15:35:20 2007 -0400 Hal Rosenstock
+76e98ec9c7ab671697667a98a05b1492ef6b14dc
+
+	* OpenSM/osm_port.c: Cosmetic changes
+
+Mon Jul 9 14:46:19 2007 -0400 Hal Rosenstock
+389e609aca70ad8b3c660a7f9877577e16fe6178
+
+	* OpenSM/osm_trap_rcv.c: Commentary change
+
+Mon Jul 9 14:43:11 2007 -0400 Hal Rosenstock
+48cd717061232b425a4ef6753ce9e4c3ebf178b8
+
+	* OpenSM/osm_trap_rcv.c: Commentary change
+
+Mon Jul 9 14:37:55 2007 -0400 Hal Rosenstock
+b13b21462a9679f8e619855c4c5e0fd4af654966
+
+	* PerfMgr: Query enhanced switch port 0 for PortCounters
+
+Mon Jul 9 13:15:42 2007 -0400 Hal Rosenstock
+05b8baf921b830ff8210dc54411d027ddefba1b7
+
+	* OpenSM/osm_perfmgr.c: Commentary change
+
+Mon Jul 9 09:28:17 2007 -0400 Hal Rosenstock
+1b7a816e5f4536e0060a2b35451413e42f34f6c5
+
+	* OpenSM/include/configure.in: Bump version to 2.2.0
+
+Mon Jul 9 09:04:46 2007 -0400 Hal Rosenstock
+872e62eba997b54804b23730486a4fde5c2678c3
+
+	* OpenSM/include/opensm/osm_version.h: Bump version to 3.1.3 for initial release off master
+
+Mon Jul 9 06:58:34 2007 -0400 Yevgeny Kliteynik
+a54fbec431a561e5f9c196b1cf69d4b8ef538a47
+
+	* OpenSM: Update doc with root and compute nodes options for fat-tree
+
+Mon Jul 9 06:54:56 2007 -0400 Yevgeny Kliteynik
+72c1876c2f49ed9cce851ab97e1471bac4330337
+
+	* OpenSM: Remove trailing blanks in doc/current-routing.txt and man/opensm.8
+
+Sun Jul 8 18:14:26 2007 -0400 Yevgeny Kliteynik
+5226841443915f52362ff0bbe76fd5b757005045
+
+	* OpenSM/osm_ucast_ftree.c: Enhance fat tree routing for non pure trees
+
+Sun Jul 8 05:03:51 2007 -0400 Yevgeny Kliteynik
+99f2d5c26f6f0a1f7c70ee736d723751eb9b9b3f
+
+	* OpenSM/osm_ucast_ftree.c: Cosmetic change to remove trailing blanks
+
+Sat Jul 7 06:48:37 2007 -0400 Hal Rosenstock
+2a96be86c722847b408343408dc9557f17e2455d
+
+	* PerfMgr: Handle LID redirection by PMA
+
+Fri Jul 6 12:38:42 2007 -0400 Ira K. Weiny
+341a97cab021d5d2284a7bc2d2233cc91cda0a13
+
+	* OpenSM/osmeventplugin/configure.in: Remove unneeded check for thread library
+
+Fri Jul 6 09:59:07 2007 -0400 Hal Rosenstock
+c2034a01b061c25d0407e2f370d04762eb8289f2
+
+	* OpenSM/osm_perfmgr.c: Add dest_qp parameter to osm_perfmgr_send_pc_mad and in osm_perfmgr_check_overflow, check status and issue osm_log error message if osm_perfmgr_send_pc_mad fails
+
+Fri Jul 6 08:55:25 2007 -0400 Hal Rosenstock
+6574fb7006ce569fc5202cff7fb41ab0632fda88
+
+	* OpenSM/osm_perfmgr.c: Cosmetic changes
+
+Fri Jul 6 07:22:28 2007 -0400 Hal Rosenstock
+2a40478ed4542d4159e2c842e6dfd8dd6548bc19
+
+	* OpenSM: Handle "babbling" ports
+
+Fri Jul 6 07:19:16 2007 -0400 Hal Rosenstock
+69acd5cce022e66fa3a8ef6e24007d29ee1da4e8
+
+	* OpenSM/osm_perfmgr.c: Cosmetic changes
+
+Thu Jul 5 14:33:34 2007 -0400 Hal Rosenstock
+ec03590aecd214550c75b7daaf2e3afe7174bfda
+
+	* OpenSM/include/opensm/osm_madw.h: Comment out query_start in osm_perfmgr_context_t as not currently used in PerfMgr
+
+Thu Jul 5 13:55:23 2007 -0400 Hal Rosenstock
+ea3248ae29ee38517bc5b20d4d43b73cee449ccb
+
+	* OpenSM/osm_port.c: Commentary change
+
+Thu Jul 5 12:51:17 2007 -0400 Hal Rosenstock
+79b98f0d4a00c638bc9a37de7ab8310e654a3989
+
+	* OpenSM/osm_node.c: Commentary change
+
+Thu Jul 5 08:38:15 2007 -0400 Yevgeny Kliteynik
+8a4e47542eac22ef767f7ab8a2b3164d663e4776
+
+	* OpenSM/osm_ucast_mgr.c: Fix bug in dumping opensm.fdbs
+
+Wed Jul 4 07:48:44 2007 -0400 Hal Rosenstock
+6c45f0b8c6e960220fda8161781e4c7a4e072b66
+
+	* OpenSM/osm_perfmgr.c: Cosmetic changes
+
+Wed Jul 4 07:33:16 2007 -0400 Hal Rosenstock
+7d1fed5dd1a655022779087abca7d145ef6c71da
+
+	* OpenSM/osm_perfmgr.c: Cosmetic formatting changes
+
+Wed Jul 4 07:26:09 2007 -0400 Hal Rosenstock
+f0fc5fe5f61dbbd48a1cf7393b97e5ea739ff7c5
+
+	* OpenSM/osm_perfmgr.c: Cosmetic changes
+
+Wed Jul 4 07:18:45 2007 -0400 Hal Rosenstock
+2cae2f20280215a70a3e91a4f730bc0bc0b83605
+
+	* OpenSM/include/opensm/osm_perfmgr.h: Cosmetic changes
+
+Tue Jul 3 17:27:48 2007 -0400 Hal Rosenstock
+768ac8bfa744b38c66168dfc4aed7c50b73af05d
+
+	* OpenSM/osm_perfmgr.c: In osm_pc_rcv_process, convert endian of redirection parameters in osm_log message
+
+Tue Jul 3 17:20:37 2007 -0400 Hal Rosenstock
+0db3a2a77614043906b7b4cc5f7ba621d339a9f3
+
+	* OpenSM/osm_perfmgr.c: Add RedirectQP into redirection osm_log message in osm_pc_rcv_process
+
+Tue Jul 3 15:17:27 2007 -0400 Hal Rosenstock
+df023de6f47f5849aeeb7c6fadf74ff302bc33b7
+
+	* OpenSM/osm_perfmgr.c: In osm_pc_rcv_process, indicate redirect LID and GID when redirection received. Also, prepare for redirect LID implementation.
+
+Tue Jul 3 10:50:30 2007 -0400 Hal Rosenstock
+4c61d29e2eb367bb46814ff56254ae22f7f1d68a
+
+	* OpenSM/PerfMgr: Rename ib_perfmgr_mad_t to ib_perfmgt_mad_t
+
+Tue Jul 3 10:43:47 2007 -0400 Hal Rosenstock
+1e8e105c89e68c610a80cc11d58ea446865544f6
+
+	* OpenSM/include/opensm/osm_madw.h: Fix commentary typo
+
+Tue Jul 3 10:42:43 2007 -0400 Hal Rosenstock
+c644d8dc005222a452696a619642cc72e3c2d93b
+
+	* OpenSM/include/iba/ib_types.h: Fix commentary typo
+
+Tue Jul 3 10:27:56 2007 -0400 Hal Rosenstock
+ea5b036f06ef6a4465db0022d5549334ab2f19a5
+
+	* OpenSM/osm_perfmgr.c: In osm_pc_rcv_process, some comments and minor change to osm_log message around redirection
+
+Tue Jul 3 10:20:52 2007 -0400 Hal Rosenstock
+a46c3db38fed731122cf0eb37c8ba5eab8404367
+
+	* OpenSM/osm_perfmgr.c: In osm_pc_rcv_process, add MAD status to osm_log message
+
+Tue Jul 3 09:38:58 2007 -0400 Hal Rosenstock
+1883d2610bb5614b77a32155cdb426c94167ca9e
+
+	* OpenSM/osm_perfmgr.c: Cosmetic commentary changes
+
+Tue Jul 3 09:30:29 2007 -0400 Hal Rosenstock
+1ca113b57a3eb8c0ccb793b886bc67f415e232d8
+
+	* OpenSM/osm_perfmgr.c: Cosmetic formatting changes
+
+Tue Jul 3 09:00:06 2007 -0400 Hal Rosenstock
+e25a113eeda077b187ea407e6c71d685b681cf88
+
+	* OpenSM/osm_perfmgr.c: Cosmetic changes
+
+Tue Jul 3 08:54:24 2007 -0400 Hal Rosenstock
+9d70d2ca2bc725f76772ea6a8fe621a05a4defd0
+
+	* OpenSM/osm_perfmgr.c: Cosmetic commentary changes
+
+Tue Jul 3 08:47:40 2007 -0400 Hal Rosenstock
+16328dcef34ea08aa91e4237c469888f756b6831
+
+	* PerfMgr: Eliminate unneeded num_ports
+
+Tue Jul 3 07:15:21 2007 -0400 Hal Rosenstock
+ecedf928b80070a6eb3f0389508ee8afa0d17ac0
+
+	* OpenSM/osm_perfmgr.c: Cosmetic formatting changes
+
+Tue Jul 3 07:03:45 2007 -0400 Hal Rosenstock
+873ab84946ccbc8744010867313eb915c08dc162
+
+	* OpenSM/osm_perfmgr.c: Cosmetic changes
+
+Mon Jul 2 09:09:59 2007 -0400 Sasha Khapyorsky
+91485898e6431889c5e79a0f7d6995f7780df333
+
+	* OpenSM: Use osm_get_node/port_by_guid() functions
+
+Sun Jul 1 07:39:41 2007 -0400 Hal Rosenstock
+735bb724d577006dcabaf2ce6c6e240669d3e847
+
+	* OpenSM/osm_subnet.c: Cosmetic change
+
+Mon Jun 25 12:44:09 2007 -0400 Hal Rosenstock
+0760168f7cbdb56071dba6bac7155f3997e94210
+
+	* OpenSM/include/opensm/osm_req.h: Cosmetic changes
+
+Mon Jun 25 12:43:40 2007 -0400 Hal Rosenstock
+b0cb8e867ad5cad8473d0eb7752b156710dae2f4
+
+	* OpenSM/include/opensm/osm_resp.h: Cosmetic changes
+
+Mon Jun 25 12:34:46 2007 -0400 Hal Rosenstock
+2dcb2629b839bdd239a28b1120f4007f393dbabd
+
+	* OpenSM/include/opensm/osm_lid_mgr.h: Added comment for missing field
+
+Mon Jun 25 12:34:12 2007 -0400 Hal Rosenstock
+9d67be9da2334285da105b10468de40c6730db11
+
+	* OpenSM/include/opensm/osm_link_mgr.h: Cosmetic changes
+
+Mon Jun 25 10:56:58 2007 -0400 Hal Rosenstock
+b0a47943cbeedbe0e114738278d7f3ee4e281734
+
+	* OpenSM/osm_link_mgr.c: Cosmetic commentary changes
+
+Mon Jun 25 10:56:41 2007 -0400 Hal Rosenstock
+7502a466c6d363782e22393a08cd6dd37ef34d69
+
+	* OpenSM/osm_lid_mgr.c: Cosmetic commentary changes
+
+Mon Jun 25 10:12:14 2007 -0400 Hal Rosenstock
+6e3571a8b1e492958873f43b437f68c1f5bf7178
+
+	* OpenSM/osm_trap_rcv.c: Cosmetic change to currently commented out osm_log message
+
+Mon Jun 25 09:44:24 2007 -0400 Hal Rosenstock
+15fcd5ae0700b90c3f44e20b25cd9a01fecd6815
+
+	* OpenSM/osm_subnet.c: Fix comment in opensm.opts file relative to excessive buffer overrun trap number
+
+Mon Jun 25 08:44:43 2007 -0400 Hal Rosenstock
+999b2a82f5038a3ade621af1dc175800abf22b31
+
+	* OpenSM/complib/cl_event_wheel.c: Fix some typos in printfs when __CL_EVENT_WHEEL_TEST__ defined
+
+Mon Jun 25 08:41:37 2007 -0400 Hal Rosenstock
+bec6b363ef407ed96ebcc4665905511dc8fb2892
+
+	* OpenSM/osm_trap_rcv.c: Various cosmetic changes including to some osm_log messages
+
+Mon Jun 25 08:40:32 2007 -0400 Hal Rosenstock
+f7a86524d9b81e94ecf183212c78ec67174a2d89
+
+	* OpenSM/osm_switch.c: Cosmetic formatting change
+
+Mon Jun 25 08:40:07 2007 -0400 Hal Rosenstock
+7d311049fe50563b2675bc727bc4f62a624deb33
+
+	* OpenSM/osm_state_mgr.c: Cosmetic formatting change
+
+Mon Jun 25 07:25:54 2007 -0400 Hal Rosenstock
+610adc778b7f76830283438bfc2c0f63c0154a49
+
+	* OpenSM/osm_port.c: Cosmetic formatting change
+
+Mon Jun 25 07:25:06 2007 -0400 Hal Rosenstock
+7b005408257ed6ce51e48ea9b2d1fd78c6de2adf
+
+	* OpenSM/include/opensm/osm_base.h: Commentary change
+
+Fri Jun 22 07:04:08 2007 -0400 Sasha Khapyorsky
+83cb1688c7af377943edcc2a93c97e38244678bd
+
+	* OpenSM/updn: --conect_roots option
+
+Thu Jun 21 13:26:54 2007 -0400 Hal Rosenstock
+fc49da4d61ef7ba3c9d18f511be6b320a1026ef9
+
+	* OpenSM/man/opensm.8: Updated man page for --root_guid_file (rather than --add_guid_file) and -u/--cn_guid_file options from Yevgeny
+
+Thu Jun 21 12:43:31 2007 -0400 Yevgeny Kliteynik
+407e8c26031d29c6bef4dac4898fd72a16d23a4f
+
+	* OpenSM: Add root_guid_file and cn_guid_file OpenSM options
+
+Wed Jun 20 13:50:14 2007 -0400 Hal Rosenstock
+7650bede7ce16cc2c12b67384556396a876da24a
+
+	* OpenSM/osm_helper.c: Add 3LeafNetworks and Xsigo to osm_get_manufacturer_str
+
+Wed Jun 20 12:09:28 2007 -0400 Hal Rosenstock
+04ce63272ea7e4fa8e3a4dda760fe10986183ee3
+
+	* OpenSM/complib/libosmcomp.map: Add get_next map functions as global
+
+Wed Jun 20 11:41:08 2007 -0400 Hal Rosenstock
+f4df3bc28bf546043d6b9153cd6a3134b60a677c
+
+	* OpenSM/complib/ChangeLog: Add log entry for Todd's change to add get_next functions to the various maps
+
+Wed Jun 20 11:38:37 2007 -0400 Todd Rimmer
+99acdc8a81fddb4d1c841df80e96837b5ddc186c
+
+	* OpenSM/complib/cl_*map: Add get_next functions to the various maps
+
+Wed Jun 20 11:25:39 2007 -0400 Hal Rosenstock
+2b06f72a6bcab55d765e3fe1b1645c61a8e8ae1e
+
+	* OpenSM/osm_lid_mgr.c: In __osm_lid_mgr_set_physp_pi, add GUID and port number into some debug osm_log messages
+
+Wed Jun 20 10:38:29 2007 -0400 Hal Rosenstock
+a62d0a4d08afd0d83af4897b71fe650e6b18435b
+
+	* OpenSM/osm_sminfo_rcv.c: In __osm_sminfo_rcv_process_set_response, decode SMInfo attribute for additional debug information
+
+Wed Jun 20 10:07:12 2007 -0400 Hal Rosenstock
+860e80e5bcb7f3bea4113faa74fda8328b41baa3
+
+	* OpenSM/osm_sminfo_rcv.c: Commentary change
+
+Wed Jun 20 09:27:33 2007 -0400 Todd Rimmer
+a6ec7209bf0279b329d897d64264fdcc465cfebb
+
+	* OpenSM/include/complib/cl_fleximap.h: In cl_fmap_remove_all, make sure the count field is properly maintained     Signed-off-by: Todd Rimmer <todd.rimmer at qlogic.com> Signed-off-by: Hal Rosenstock <halr at voltaire.com>
+
+Wed Jun 20 06:35:31 2007 -0400 Hal Rosenstock
+2e93de50aae7162a748f3262b8355a685fa54866
+
+	* OpenSM/osm_perfmgr_db.c: Cosmetic formatting changes
+
+Wed Jun 20 06:18:21 2007 -0400 Hal Rosenstock
+95ad48c0d54bf2f154f20eadfd31f835742758a1
+
+	* OpenSM/include/complib/cl_(map qmap fleximap).h: Cosmetic changes
+
+Tue Jun 19 17:58:56 2007 -0400 Todd Rimmer
+0d35ee64b7892b6092d8d0724b1cc5559e6556b9
+
+	* OpenSM/include/complib/cl_qmap.h: In cl_qmap_remove_all, make sure the count field is properly maintained
+
+Tue Jun 19 16:41:29 2007 -0400 Hal Rosenstock
+20e76d4af93821c1502b8cfda8faba640463324b
+
+	* OpenSM/osm_perfmgr.c: In osm_perfmgr_check_overflow, reset previous reading so set doesn't cause erroneous out of band clear indication
+
+Tue Jun 19 15:51:38 2007 -0400 Hal Rosenstock
+af6526d3780d1d1356adb559687f97643b383cf7
+
+	* OpenSM/osm_perfmgr.c: Cosmetic changes
+
+Tue Jun 19 15:18:41 2007 -0400 Hal Rosenstock
+dae8028bacec01056cb2b3eb9385ce07fe4de55e
+
+	* OpenSM/osm_perfmgr.c: Cosmetic formatting change
+
+Tue Jun 19 15:15:53 2007 -0400 Hal Rosenstock
+cff628a92e5932eb0d914c833cda3536b427d5c9
+
+	* PerfMgr: Cosmetic changes to some osm_log messages
+
+Tue Jun 19 14:20:05 2007 -0400 Ira K. Weiny
+373efa7a05910321041a44020637f3b88555a149
+
+	* PerfMgr: Removed no longer needed eventdb
+
+Tue Jun 19 14:02:18 2007 -0400 Ira K. Weiny
+c7641f8afe994f3d8efd5aa21850706585bb6748
+
+	* PerfMgr: Convert "eventdb" to be a default event plugin which is optional.
+
+Tue Jun 19 13:20:39 2007 -0400 Hal Rosenstock
+3cf6b2ac2ce88f4d761c19f0eba8a50e90ce570a
+
+	* OpenSM/include/complib/cl_threadpool.h: Eliminate compile warning with cl_threadpool.c introduced by previous change
+
+Tue Jun 19 10:44:36 2007 -0400 Ira K. Weiny
+111dd52d1da75ea802888e8424d59ff1459e4319
+
+	* PerfMgr: Move database of port counter data into new PerfMgr DB object.
+
+Tue Jun 19 10:05:18 2007 -0400 Ira K. Weiny
+61353c444fee3acb52e2350c03cbce22d70d9402
+
+	* PerfMgr: Change prefix of perfmgr_edb (event db) functions to perfmgr_db
+
+Tue Jun 19 09:57:45 2007 -0400 Ira K. Weiny
+d63d426746213fe5fbc3a187612bc28de0025261
+
+	* OpenSM/PerfMgr: Remove no longer needed osm_event_db.c and osm_event_db.h as they are renamed to osm_perfmgr_db.c and osm_perfmgr_db.h
+
+Tue Jun 19 09:55:25 2007 -0400 Ira K. Weiny
+8f81e72a3b57e0efdba816e774130dfcbf616572
+
+	* OpenSM/include/Makefile.am: PerfMgr header file name change to go along with previous commit
+
+Tue Jun 19 09:53:54 2007 -0400 Ira K. Weiny
+6a472fbe9048edce8cb8388b977db9b78ba58c03
+
+	* OpenSM/PerfMgr: Rename osm_event_db.* to osm_perfmgr_db.* in preparation for plugin change
+
+Sat Jun 16 10:49:13 2007 -0400 Hal Rosenstock
+f7000edf9fe109991fdb53f419e63e3e33212127
+
+	* OpenSM/osm_lid_mgr.c: Cosmetic commentary change
+
+Sat Jun 16 10:15:12 2007 -0400 Hal Rosenstock
+04f3e90ad0bf5217a4046e96804b0a1b2ed28755
+
+	* OpenSM/include/opensm/osm_base.h: Cosmetic change
+
+Fri Jun 15 13:21:57 2007 -0400 Yevgeny Kliteynik
+767914efd21e78137d08daacc81e7c31fbd645d7
+
+	* OpenSM/osm_ucast_ftree.c: If fat-tree failed, osm should fall back to default routing
+
+Fri Jun 15 13:07:43 2007 -0400 Hal Rosenstock
+c9525e7ecd20c56eab17ec59ea5f6d1528597112
+
+	* OpenSM/complib/ChangeLog: Add log entry for Sasha's thread pool rework
+
+Fri Jun 15 13:07:05 2007 -0400 Sasha Khapyorsky
+530f4996dbc35ab2fffe808c86fa4434b65769bc
+
+	* OpenSM/complib: thread_pool rework
+
+Fri Jun 15 12:35:31 2007 -0400 Hal Rosenstock
+cbd3c9dca2aa7e23f93127e503604125cc8ef440
+
+	* OpenSM/opensm/ChangeLog: Add log entry for Sasha's previous fix to osm_helper.c for PortInfo:CapMask printing when CapMask is 0
+
+Fri Jun 15 12:33:54 2007 -0400 Sasha Khapyorsky
+441c0dc08533a2c9fc72bf9c29d7a495e67cb28d
+
+	* OpenSM/osm_helper.c: Fix PortInfo:CapMask printing when CapMask is 0
+
+Wed Jun 13 14:16:50 2007 -0400 Sasha Khapyorsky
+e073df42c09b6a1bfdc5f1b4d0c3d1546f308e8e
+
+	* OpenSM/osmtest/osmt_multicast.c: Add missing include file
+
+Wed Jun 13 13:25:29 2007 -0400 Hal Rosenstock
+468dc2a2501c0d49453e94207a882582f9e412a5
+
+	* OpenSM/complib/ChangeLog: Updated log entry for Sasha's previous change to modify include/Makefile.am for header files removed
+
+Wed Jun 13 13:23:48 2007 -0400 Sasha Khapyorsky
+6aed0c6eba942276210d5c75315021033a96a3a6
+
+	* OpenSM/complib: Additional changes for removal of unused complib stuff
+
+Wed Jun 13 12:22:32 2007 -0400 Ira K. Weiny
+e9f6dd2356ef1b0d794c3533df6cecc6e6433a52
+
+	* OpenSM/osm_console.c: Clear up the dump_counters option of the perfmgr.
+
+Wed Jun 13 11:16:37 2007 -0400 Hal Rosenstock
+e46aa2b4a33a07e4fa794ef02c1d748cd47fcbab
+
+	* OpenSM/osm_perfmgr.c: Minor change to move osm_log message prior to obtaining lock so locked time is less
+
+Wed Jun 13 10:11:07 2007 -0400 Hal Rosenstock
+f7b0b7177c50f0b15264205f65301526383a8810
+
+	* OpenSM/complib: Remove unneeded (previously deprecated) cl_mem* files
+
+Wed Jun 13 10:04:50 2007 -0400 Hal Rosenstock
+947d15eafeeab83ccf5a879fd7da9c8a78c692da
+
+	* OpenSM/complib: Remove deprecated memory allocation routines
+
+Wed Jun 13 09:17:11 2007 -0400 Hal Rosenstock
+72fb44d408d581d322cd4b2bc68d24d7e98c2509
+
+	* OpenSM/complib: Update version info fori previous API removals
+
+Wed Jun 13 08:32:09 2007 -0400 Hal Rosenstock
+e070d441b0de7ec8cd236ba14a9ba04d84051654
+
+	* OpenSM/complib/ChangeLog: Add log entry from Yevgeny's change to remove unused cl_perf and cl_async_proc
+
+Wed Jun 13 08:29:32 2007 -0400 Yevgeny Kliteynik
+1cbb6e3b74ab0468a8aedcb0dbaf7ed072a1495e
+
+	* OpenSM/complib: Remove unused cl_perf and cl_async_proc
+
+Tue Jun 12 11:34:57 2007 -0400 Hal Rosenstock
+b43a63773336a79c277f8d992ecef4fa352341ef
+
+	* OpenSM/osm_perfmgr.c: Cosmetic changes
+
+Tue Jun 12 11:26:42 2007 -0400 Hal Rosenstock
+c1a4c5f89e4df5c8b19dfe437f528e005ae2edc5
+
+	* OpenSM/osm_sminfo_rcv.c: Commentary changes
+
+Tue Jun 12 11:25:26 2007 -0400 Hal Rosenstock
+cb16e8a1195f9f491264b89eab455dfc4952208e
+
+	* OpenSM/osm_sa_mcmember_record.c: Commentary change
+
+Tue Jun 12 09:48:19 2007 -0400 Hal Rosenstock
+00262062a50aa21bfe6624f0cf1180142b9f035f
+
+	* OpenSM/osm_perfmgr.c: Start to handle redirection
+
+Tue Jun 12 08:37:41 2007 -0400 Hal Rosenstock
+4a33f09a4e90a2c79832cdcb8bee9f3efec94132
+
+	* OpenSM/osm_sa_class_port_info.c: Commentary change
+
+Tue Jun 12 07:40:33 2007 -0400 Hal Rosenstock
+3d524ab28891758afdf8558cd793318d4e2e13d2
+
+	* OpenSM/osm_perfmgr.c: Cosmetic changes to some osm_log messages
+
+Tue Jun 12 07:28:22 2007 -0400 Hal Rosenstock
+f8af24b0be6ba504d89611ec6038c7b37a0c7cc9
+
+	* OpenSM/osm_sa_class_port_info.c: Eliminate unneeded assignment and variable
+
+Tue Jun 12 07:01:48 2007 -0400 Hal Rosenstock
+65d643da8d8a8d68e443ebd5782830725c0ca16c
+
+	* OpenSM/include/opensm/osm_madw.h: Commentary change
+
+Tue Jun 12 06:55:18 2007 -0400 Hal Rosenstock
+db51ae0d00f3d01ac4903b8357b903fe0ea9d23b
+
+	* OpenSM/include/iba/ib_types.h: Cosmetic formatting change
+
+Tue Jun 12 06:38:21 2007 -0400 Hal Rosenstock
+52fd3169669f786c4bef5e69518236c3196e6f5d
+
+	* OpenSM/osm_perfmgr.c: Cosmetic formatting change
+
+Mon Jun 11 18:57:47 2007 -0400 Yevgeny Kliteynik
+70ad4a2f8f89257a8f4c56271a2a9b9ad06d05d2
+
+	* OpenSM/osm_ucast_updn.c: Make up/dn ranking code more intuitive
+
+Mon Jun 11 11:22:33 2007 -0400 Sasha Khapyorsky
+4ace1d9466d5ec124df76f278b610866dd43a36a
+
+	* OpenSM: Remove no longer used state_step_mode
+
+Mon Jun 11 11:17:23 2007 -0400 Hal Rosenstock
+9af500c7e2399e37c32d9559e33e6b0391a42c69
+
+	* OpenSM/opensm/ChangeLog: Add log entry for Sasha's previous change to remove OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTEDi from __osm_sm_mgr_signal_str
+
+Mon Jun 11 11:08:39 2007 -0400 Sasha Khapyorsky
+33bdc41214064c7aac1ec3aa5140126e0c3d0215
+
+	* OpenSM: Clean unused OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED
+
+Mon Jun 11 10:56:12 2007 -0400 Yevgeny Kliteynik
+6b5d79d82a370d234c796631da2d41afd214afb4
+
+	* OpenSM/osm_ucast_mgr.c: Trivial bug fix in osm_ucast_mgr_read_guid_file
+
+Mon Jun 11 09:20:20 2007 -0400 Yevgeny Kliteynik
+b41e23e60f4c95af861161847055acf16ef9f4c9
+
+	* OpenSM: Generalize reading of guids from file in ucast_mgr
+
+Mon Jun 11 09:16:11 2007 -0400 Hal Rosenstock
+b9edfbc5360b7c2a0b3e245dfd6c0eb8e7ccaf19
+
+	* OpenSM/man/opensm.8: Cosmetic formatting change
+
+Mon Jun 11 08:49:25 2007 -0400 Hal Rosenstock
+08d180a04a5a58f0aad8b344e7069c0b33db0790
+
+	* OpenSM/main.c: Cosmetic formatting change
+
+Mon Jun 11 06:44:07 2007 -0400 Hal Rosenstock
+b117621ac6e1162d2a528bafde0e0f4923655eed
+
+	* OpenSM/man/opensm.8: Add reference for up/down algorithm
+
+Mon Jun 11 06:36:50 2007 -0400 Hal Rosenstock
+a441979c20b426babfccb91eab4d45a71710cf45
+
+	* OpenSM/man/opensm.8: Cosmetic formatting change
+
+Fri Jun 8 11:27:49 2007 -0400 Hal Rosenstock
+828b4c89a44227f6679cb9fe8d347114e1ae346b
+
+	* OpenSM/osm_(port_info_rcv opensm).c: Restore changes to set PortInfo:CapabilityMask IsSM when sm_inactive as it does respond to SubnGet/Sets of SMInfo (so this is better)
+
+Fri Jun 8 10:58:55 2007 -0400 Hal Rosenstock
+874c2e28180ff91a88ff742de600e33622051f96
+
+	* OpenSM/man/opensm.8: More tweaks to inactive option
+
+Fri Jun 8 10:51:51 2007 -0400 Hal Rosenstock
+6a36fc232cb5fdb4b4659813d0bafbea89b5b051
+
+	* libvendor/ChangeLog: Cosmetic change
+
+Fri Jun 8 05:48:48 2007 -0400 Hal Rosenstock
+4c62451c9a5d85ffa252baa31b4dde5a47a6c1cb
+
+	* OpenSM/osm_opensm.c: In osm_opensm_destroy, only clear the issm bit in PortInfo:CapabilityMask if it were previously set (e.g. sm_inactive is not invoked)
+
+Fri Jun 8 05:47:28 2007 -0400 Hal Rosenstock
+f7105fba6dde4810cc2f96ecea7dd5562dd6f5d9
+
+	* OpenSM/osm_port_info_rcv.c: Cosmetic change to previous change
+
+Fri Jun 8 05:40:42 2007 -0400 Hal Rosenstock
+79df208c49c887938b6cf750929d162af80fe4cf
+
+	* OpenSM/osm_port_info_rcv.c: In __osm_pi_rcv_process_endport, don't set issm bit in PortInfo:CapabilityMask if sm_inactive
+
+Thu Jun 7 16:29:47 2007 -0400 Hal Rosenstock
+e3d2b4568678a262b6060b7a8d551f4fc00cf70b
+
+	* OpenSM/osm_perfmgr.c: Cosmetic changes to some osm_log messages Also, fixed some typos, comments, and other cosmetic changes
+
+Thu Jun 7 11:52:15 2007 -0400 Hal Rosenstock
+50937204c0a480a1aab0b1b7008989a87a2a4545
+
+	* OpenSM/man/opensm.8: Indicate inactive is not yet supported by performance manager
+
+Thu Jun 7 11:42:25 2007 -0400 Hal Rosenstock
+9128f1f9dc51f362e417db57918a0accebcaee59
+
+	* OpenSM/osm_perfmgr.c: Cosmetic changes
+
+Thu Jun 7 11:39:27 2007 -0400 Hal Rosenstock
+a673bf39b06e42b72799515f8aa1dc25a2fef7a1
+
+	* OpenSM/man/opensm.8: Cosmetic change to --inactive description
+
+Thu Jun 7 10:39:46 2007 -0400 Hal Rosenstock
+d69599a93d985b4156ec0c179f9b2743565363c4
+
+	* OpenSM/osm_perfmgr.c: Cosmetic change to osm_log message
+
+Thu Jun 7 10:27:44 2007 -0400 Hal Rosenstock
+df23d39ba7b5c1aed44749b50c0e46e60f1f6423
+
+	* OpenSM/man/opensm.8: Add more explanation on use of --inactive
+
+Wed Jun 6 12:41:48 2007 -0400 Sasha Khapyorsky
+adb664ad87285e4a1b71b1e8a41554e12b26dc45
+
+	* OpenSM/osm_(helper state_mgr).c: More optimally define manufacturer strings so as not to put extra space in .text
+
+Wed Jun 6 10:32:45 2007 -0400 Hal Rosenstock
+12a3ed278f0e4f121970cfd63331d1ceedc2bb82
+
+	* OpenSM/osm_helper.c: Add Sun to osm_get_manufacturer_str
+
+Wed Jun 6 08:58:06 2007 -0400 Yevgeny Kliteynik
+b71117f501aa4b8a1d20a600c2d8c684eaa9d74f
+
+	* OpenSM/osm_vendor_mlx.h: Fix broken compilation when osm_vendor is Mellanox simulator
+
+Wed Jun 6 07:12:48 2007 -0400 Hal Rosenstock
+0febff17365fead912125f5615681b3780aff9be
+
+	* OpenSM/osm_state_mgr.c: Updated one compliance identifier for IBA 1.2
+
+Wed Jun 6 06:52:03 2007 -0400 Hal Rosenstock
+a509fa5815d89b52508541bd5fe17d36e693ac0c
+
+	* OpenSM/osm_state_mgr.c: Cosmetic changes (osm_log messages, comments, etc.)
+
+Wed Jun 6 06:51:17 2007 -0400 Hal Rosenstock
+1d5f30629e17b10b944a746b8c9c640b3ef87348
+
+	* OpenSM/osm_sm_state_mgr.c: Fixed typo in osm_log message
+
+Wed Jun 6 06:50:46 2007 -0400 Hal Rosenstock
+48c61babe98e7fde875398b91aaa5f3e2975738b
+
+	* OpenSM/osm_sminfo_rcv.c: Updated a couple of IBA 1.2 vol 1 references
+
+Tue Jun 5 13:24:54 2007 -0400 Sasha Khapyorsky
+ff1870747ff5083f53bd976dc9540584a0ee58da
+
+	* OpenSM: Protect SMInfo response
+
+Mon Jun 4 11:53:18 2007 -0400 Hal Rosenstock
+59f02c2ad325b25a9869fe179935af9c5ae35a3c
+
+	* OpenSM/opensm/ChangeLog: Add log entry for previous change to add 8x to __osm_lwa_str_fixed_width
+
+Mon Jun 4 09:20:14 2007 -0400 Hal Rosenstock
+38bf0b4a108b8f2578546dd23496622390fddd4a
+
+	* OpenSM/osm_helper.c: Add 8x to __osm_lwa_str_fixed_width
+
+Sat Jun 2 09:16:40 2007 -0400 Hal Rosenstock
+c1cd6dff299f121a40605cb821dbb2ea7dbc320e
+
+	* OpenSM/complib/configure.in: Bumped version to 2.1.3 (in sync with ofed_1_2)
+
+Sat Jun 2 09:03:11 2007 -0400 Hal Rosenstock
+245e44150e0b4e5b9a04a81c63c78f255cee6e17
+
+	* OpenSM/doc/opensm_release_notes_openib-3.0.13.txt: Updated for 3.0.13 with SMInfo self check fix
+
+Sat Jun 2 08:56:35 2007 -0400 Hal Rosenstock
+b6f502e88a9d112776a85af4e2ff40ac99a82fb9
+
+	* OpenSM/doc: Renamed opensm_release_notes_openib-3.0.12.txt to opensm_release_notes_openib-3.0.13.txt for version change
+
+Thu May 31 19:05:14 2007 -0400 Sasha Khapyorsky
+16966658bf3120ef967728686350aae76e275b9c
+
+	* OpenSM/osm_sminfo_rcv.c: Mutex cleanup fix
+
+Thu May 31 18:24:06 2007 -0400 Sasha Khapyorsky
+d55c104ebd0d9993276259d5d31a0cffdd9ca626
+
+	* OpenSM/osm_sminfo_rcv.c: Add SMInfo self query check
+
+Thu May 31 18:14:10 2007 -0400 Sasha Khapyorsky
+20d69e689844d835f1f958ce2f565d6c030cb66d
+
+	* OpenSM/osm_link_mgr.c: Fewer iterations in osm_link_mgr_process() loop
+
+Thu May 31 17:42:16 2007 -0400 Sasha Khapyorsky
+597d08b6d72f79f21daf3cb0a2ddc4bf51fb5bf9
+
+	* OpenSM: Cleanup discovery count functions
+
+Thu May 31 12:33:39 2007 -0400 Hal Rosenstock
+98727475be36e49d130081f46242a567adb5ac72
+
+	* management/*.spec: Remove *.spec files from management git repo as committed files. They are generated files.
+
+Thu May 31 11:41:16 2007 -0400 Hal Rosenstock
+4c3855711c1a35ab29ae22f26afee5f9e7f38175
+
+	* management/*.spec: Latest daily versions of .spec files (prior to removing these due to build changes)
+
+Thu May 31 09:58:54 2007 -0400 Hal Rosenstock
+f93ee06884f8130ef04cf07a6fca2d6c8653da21
+
+	* OpenSM/(complib/libosmcomp eventdb/libibeventdb libvendor/libosmvendor).spec.in: Change Source and Url to openfabrics rather than openib
+
+Thu May 31 08:43:01 2007 -0400 Hal Rosenstock
+9344460e473333cc332260a6f9b073bcd89664fa
+
+	* OpenSM/osm_perfmgr.c: Added error numbers to OSM_LOG_ERROR osm_log messages
+
+Thu May 31 08:34:11 2007 -0400 Hal Rosenstock
+0955d88825752cc22715f1a4c7487935f890ad30
+
+	* OpenSM/osm_console.c: Added error numbers to OSM_LOG_ERROR osm_log messages
+
+Thu May 31 06:47:43 2007 -0400 Hal Rosenstock
+8c1e82f23bc6528a7456649d7287afdae3fb7aca
+
+	* OpenSM/README: Changed for move from bin to sbin
+
+Wed May 30 23:58:24 2007 -0400 Sasha Khapyorsky
+db0c46436df0fead42da65c920126ef994e1006a
+
+	* OpenSM: osm_node_get_physp_ptr() usage fixes
+
+Wed May 30 21:00:41 2007 -0400 Ira K. Weiny
+8fb2c2095f16c2e8ac833f62dc9d374df24dca05
+
+	* OpenSM/osm_console.c: Add outstanding queries and the set max to the perfmgr console command
+
+Wed May 30 20:57:00 2007 -0400 Ira K. Weiny
+1f87b83cdbffae755d177394bff53eaea78240d2
+
+	* OpenSM: Make PerfMgr's max outstanding queries configurable
+
+Wed May 30 18:53:08 2007 -0400 Sasha Khapyorsky
+4d2c2bf7e6d4d6023113dace243b2b7662acc8d6
+
+	* OpenSM/man/opensm.8: Indicate default priority
+
+Wed May 30 18:47:30 2007 -0400 Ira K. Weiny
+869cfd87c9a94a917f7f3a705620c6d18200ba61
+
+	* OpenSM/man/opensm.8: Add perfmgr command line options to opensm man page
+
+Wed May 30 18:46:05 2007 -0400 Ira K. Weiny
+24c150a04a952c7175de257829abdba82a324024
+
+	* OpenSM/main.c: Add perfmgr command line options
+
+Wed May 30 16:55:58 2007 -0400 Ira K. Weiny
+b22b70ab5ec38e118c83f18bba4fba288a75450e
+
+	* OpenSM/main.c: Fix short options so they do not conflict with long options
+
+Wed May 30 16:45:24 2007 -0400 Ira K. Weiny
+9e3daf3876cc591bd5c2a8443bf1be7994ed6ec3
+
+	* OpenSM/include/opensm/osm_perfmgr.h: Signal an immediate sweep when the user enables the perfmgr
+
+Wed May 30 15:50:42 2007 -0400 Hal Rosenstock
+cd5b815b943635b15d71a0aeda76e2639eda543a
+
+	* OpenSM/osm_drop_mgr.c: Cosmetic change to osm_log message
+
+Wed May 30 15:44:48 2007 -0400 Hal Rosenstock
+2e60ed70395b84c40eb5a83272a7d52026683e9e
+
+	* OpenSM/osm_drop_mgr.c: Cosmetic changes
+
+Wed May 30 15:42:15 2007 -0400 Sasha Khapyorsky
+778765694333ec8bcf65bb9d87a7a8e44dd217a6
+
+	* OpenSM/osm_drop_mgr.c: Clean only associated with port physical obj
+
+Wed May 30 13:57:06 2007 -0400 Ira K. Weiny
+2f10c0858fac921a8d8b5770f4a18537d1cdd8c5
+
+	* OpenSM/include/iba/ib_types.h: Fix NOTICE macros to convert from host to network byte order.
+
+Wed May 30 13:46:49 2007 -0400 Ira K. Weiny
+fdc2ea226ea4a21843c6341b283069140b9a2cf0
+
+	* OpenSM/include/iba/ib_types.h: Change macros to convert from "host" byte order to "network" byte order rather than the other way around
+
+Wed May 30 07:30:09 2007 -0400 Hal Rosenstock
+5764880000e9dd77a9bb378e9fa02ebdfb8759a1
+
+	* OpenSM/osm_console.c: Cosmetic change to perfmgr help
+
+Wed May 30 07:22:00 2007 -0400 Ira K. Weiny
+2f5a0b53bea7dd9d9afeb278890e1bcb20423372
+
+	* OpenSM/osm_console.c: Add PerfMgr status to status command
+
+Wed May 30 07:13:16 2007 -0400 Ira K. Weiny
+42ab38b7fdc12d70706d55a4df651efff198a634
+
+	* OpenSM/osm_perfmgr.c: Pause PerfMgr thread indefinitely if the max number of outstanding PerfMgr queries exceeds the threshold
+
+Wed May 30 07:09:04 2007 -0400 Ira K. Weiny
+7d3bd6fb9f2efff8083f3787396a2630c1eae136
+
+	* OpenSM/include/opensm/osm_perfmgr.h: Clean up formatting of perfmgr object
+
+Wed May 30 07:05:13 2007 -0400 Ira K. Weiny
+c3a9ae030376906f0180dff2d8bbd8b651db4be1
+
+	* OpenSM/PerfMgr: Add sweep state to the perfmgr object
+
+Wed May 30 06:34:06 2007 -0400 Sasha Khapyorsky
+e24d9fcf933086f4ac0767cd213ae27a12f88ca8
+
+	* OpenSM/osm_console.c: portstatus command is only for initialized ports
+
+Tue May 29 17:15:04 2007 -0400 Hal Rosenstock
+7af01643caaecc9ecfc01d371c5a860709048b71
+
+	* OpenSM/osm_sa_informinfo.c: Cosmetic formatting changes
+
+Tue May 29 08:24:21 2007 -0400 Hal Rosenstock
+275d8f49b915568f5b5adc7419e54ff31375561e
+
+	* OpenSM/man/opensm.8: Add mention of performance manager (as experimental)
+
+Tue May 29 08:01:56 2007 -0400 Hal Rosenstock
+51466ceb785c786cc1d7d76232d6f2cf8f50c317
+
+	* OpenSM/include/opensm/osm_perfmgr.h: Change OSM_PERFMGR_DEFAULT_DUMP_FILE from osm_port_counters.log to opensm_port_counters.log
+
+Sun May 27 08:08:38 2007 -0400 Sasha Khapyorsky
+660fea26361b316bf97cf30dc8f9553ad945b15e
+
+	* OpenSM/osm_perfmgr.c: In __osm_perfmgr_query_counters, check for physp valid prior to obtaining LID (and handle this) to prevent assertion
+
+Sat May 26 13:44:28 2007 -0400 Hal Rosenstock
+71d3f3b4dc55f24fbab4b4c2bfdea9b4ae6f3911
+
+	* OpenSM/osm_subnet.(h c): Cosmetic changes
+
+Sat May 26 13:27:03 2007 -0400 Hal Rosenstock
+7c96ef20fe980f5d57b7f91b5e3adbe4c3efa0c2
+
+	* OpenSM: Change qp1_ stats to sa_ stats
+
+Sat May 26 13:25:12 2007 -0400 Hal Rosenstock
+b4f89b27e4d46b9022a8b773ade1e525dfcf4bea
+
+	* OpenSM/osm_perfmgr.c: Cosmetic changes
+
+Sat May 26 11:52:03 2007 -0400 Hal Rosenstock
+f947306378174b300a9da79fbe9e21cdd7be7a22
+
+	* OpenSM/osm_perfmgr.c: In __collect_guids, handle malloc failure
+
+Sat May 26 11:32:44 2007 -0400 Ira K. Weiny
+cff35777fbf1e5f285d0f2d2d20c92e2dfde2041
+
+	* OpenSM: Initial Perf Manager
+
+Sat May 26 10:29:11 2007 -0400 Hal Rosenstock
+2d0f7df1ef0e231a124c8e28099275dcc02349ef
+
+	* OpenSM: Cosmetic formatting changes to osm_vl15intf.c and osm_sa.c
+
+Wed May 23 21:09:13 2007 -0400 Ira K. Weiny
+8a7b6397220c86737655f9562ec9739f301088ef
+
+	* OpenSM/opensm.spec.in: Move osmtest from bin to sbin
+
+Wed May 23 17:00:24 2007 -0400 Hal Rosenstock
+cb3fa582b33239d93b011c27e865b5c851e25838
+
+	* OpenSM/osm_pkey*.c: Cosmetic formatting changes
+
+Tue May 22 14:53:34 2007 -0400 Ira K. Weiny
+5fe7eede3f9430f7fb4ab4bf2b799deb1fb005e4
+
+	* OpenSM/osm_console.c: Add locking around the subnet port_lid_tbl in the querylid console command
+
+Tue May 22 07:05:51 2007 -0400 Hal Rosenstock
+c563c929da173d6c46694f9afde907b80b4088d7
+
+	* OpenSM/doc/opensm_release_notes_openib-3.0.12.txt: Remove isSMdisabled change
+
+Mon May 21 14:13:55 2007 -0400 Yevgeny Kliteynik
+573e65ff47a0b008cebd09d973c96073b61efe7a
+
+	* OpenSM/osm_ucast_updn.c: Up/down optimization - improved ranking
+
+Mon May 21 13:59:05 2007 -0400 Yevgeny Kliteynik
+efeaa1329523207dcca54c68d0fcea9b83e077f1
+
+	* OpenSM/osm_drop_mgr.c: Fix core dump in drop manager
+
+Mon May 21 13:03:18 2007 -0400 Ira K. Weiny
+eb52f7d50575b0f16cfbdc352c1510cb26c44897
+
+	* OpenSM/osm_console.c: Add portstatus command to the console
+
+Mon May 21 12:43:42 2007 -0400 Ira K. Weiny
+bbca13d23ed15a148230fb6d90d4fd1501cab20f
+
+	* OpenSM/osm_console.c: Add querylid command to the console
+
+Wed May 16 14:26:08 2007 -0400 Hal Rosenstock
+1524f0ce2319020fada1b562b08fd121abbea3a4
+
+	* OpenSM/include/Makefile.am: Changes for new ib_cm_types.h header file
+
+Wed May 16 14:25:24 2007 -0400 Hal Rosenstock
+e1314cfd3a557b88ba645b6c3e62d1d2b6a41c7b
+
+	* OpenSM/ib_types.h: Remove CM definitions as now in ib_cm_types.h
+
+Wed May 16 14:24:40 2007 -0400 Hal Rosenstock
+46d94f9a9d05d9f2a90d166f4f0c570eb1b22320
+
+	* OpenSM/ib_cm_types.h: Move CM definitions from ib_types.h
+
+Wed May 16 07:09:21 2007 -0400 Philippe Gregoire
+01eddebbe1fdeb1b6528b27a7219417df88f9a51
+
+	* OpenSM/man/opensm.8: Add defmember partition feature description to man page.
+
+Wed May 16 07:08:16 2007 -0400 Philippe Gregoire
+0b93504f5a192bf5e2cf09b3080fb93c40871f43
+
+	* OpenSM/osm_prtn_config.c: Add default membership (limited or full) to partition syntax.
+
+Wed May 16 06:58:01 2007 -0400 Hal Rosenstock
+4cafe406680ff3085ac46bc721e064da5842a8f8
+
+	* OpenSM/doc/opensm_release_notes_openib-3.0.12.txt: Updated for 3.0.12 with up/down fix
+
+Tue May 15 12:56:25 2007 -0400 Hal Rosenstock
+dcf8e3381470f1e391607419f30a610c0c46e329
+
+	* OpenSM/doc/opensm_release_notes_openib-3.0.12.txt: Updated for 3.0.12 with up/down fix
+
+Tue May 15 12:44:49 2007 -0400 Philippe Gregoire
+89f0b2bfafc56774ca4f00d8616804a69ce0cd6b
+
+	* OpenSM/man/opensm.8: Improve man page readability.
+
+Tue May 15 11:52:25 2007 -0400 Hal Rosenstock
+61fe1e15899e9774f8f361e2d60e47980eb5a81e
+
+	* osmtest/Makefile.am: Move osmtest from bin to sbin (like opensm)
+
+Tue May 15 11:51:30 2007 -0400 Albert L. Chu
+9d745ce74564aeceff336010bb220e1bc5fcedb3
+
+	* OpenSM/osm_subnet.c: Add QoS verification checks
+
+Tue May 15 11:37:37 2007 -0400 Albert L. Chu
+d4f8e2a7cf95517b9e476cff34cf7cbd774557e6
+
+	* OpenSM: Use macros for QoS defaults
+
+Tue May 15 11:28:19 2007 -0400 Yevgeny Kliteynik
+a1bb7d1d3ef95a5bb149b2e73cfd667ab2558616
+
+	* OpenSM/osm_subnet.c: Fix error message when failed opening cached options file
+
+Tue May 15 11:18:04 2007 -0400 Hal Rosenstock
+4e5e724f7d6af9d1418eb9cefa7c6b8e16ebe178
+
+	* OpenSM/man/opensm.8: Updated date on OpenSM man page
+
+Tue May 15 10:57:58 2007 -0400 Hal Rosenstock
+bc5708f0e6254083ce56fe3ddda5e19475ff7a7b
+
+	* OpenSM/include/opensm/osm_version.h: Bump version to 3.1.1 to signify reorganization of management/opensm
+
+Tue May 15 10:07:35 2007 -0400 Hal Rosenstock
+9f02ef4c97b21093415196dfdebdf64f725a4711
+
+	* opensm/doc/opensm_release_notes_openib-3.0.9.txt: Removed as this is superceeded by opensm_release_notes_openib-3.0.11.txt and is an artifact of the merge which didn't handle this well
+
+Tue May 15 09:26:48 2007 -0400 Hal Rosenstock
+37691eaa3fa18f753408d57d418730ba9d771888
+
+	* Merge branch 'master' of git://staging.openfabrics.org/~halr/management
+
+Thu Apr 12 16:52:49 2007 -0400 Hal Rosenstock
+b60ac60a2033f3a514d5e57823e455dd156c01c2
+
+	* Diags: Renamed openib-diags to infiniband-diags Also, some other changes based on this (openib-diags.spec.in moved to infiniband-diags.spec.in, openib-diags.spec moved to infiniband-diags.spec, and Makefile.am changed for this)
+
+Thu Apr 5 09:13:47 2007 -0400 Hal Rosenstock
+a65068c56fdc888259bdcb7f66cc43d171904196
+
+	* Merge git://git.openfabrics.org/~dledford/management into doug/rpm
+
+Wed Apr 4 16:48:21 2007 -0400 Doug Ledford
+43ebb5238885b217f50f98bf248a9c9238bfd1ff
+
+	* Merge branch 'master' of git://git.openfabrics.org/~halr/management into rpm_cleanups
+
+Wed Apr 4 16:05:55 2007 -0400 Doug Ledford
+8342f1962b538fb2d49898e7cf5981a4ff8d5bf7
+
+	* opensm only looks in /etc/ofa for config files now, so don't conditionalize confdir.  Also, make the Red Hat test work on versions prior to RHEL5 by testing /etc/redhat-release (which is a file on RHEL and a symlink to fedora-release on Fedora).
+
+Wed Apr 4 15:29:25 2007 -0400 Doug Ledford
+071bab887b6783f8e86c0f57f0d40e8852beefd3
+
+	* Update all opensm created files to use the name opensm instead of osm
+
+Wed Apr 4 14:49:55 2007 -0400 Doug Ledford
+e3e9d5ceb71af574302c6af756ca5fd45884a9c2
+
+	* Fix a bug related to condrestart...need to NULL out pid before testing against  in start()
+
+Wed Apr 4 14:10:49 2007 -0400 Doug Ledford
+2f28a34e150b38c7d852bbb5f42cf979e9112fa0
+
+	* Start swithing the names of log files and dump files to opensm*
+
+Wed Apr 4 13:10:53 2007 -0400 Doug Ledford
+5944928c5a91c29469875ba51bb30f5c88a937f2
+
+	* Oops, need to install opensm.conf as opensm.conf or else init script exits
+
+Wed Apr 4 12:47:18 2007 -0400 Doug Ledford
+964d58c213ab9d9fd8a4bce15274e2d73b26aea9
+
+	* Move opensm to /usr/sbin, create /var/cache/opensm during install so rpm can track it
+
+Wed Apr 4 12:09:27 2007 -0400 Doug Ledford
+5d913e5a843f8609d6a5cdbf5440ebfd05f27481
+
+	* RPM doesn't like variables with dots in their name
+
+Wed Apr 4 11:20:46 2007 -0400 Doug Ledford
+9511dafccaaf507e1675b8b5ece30a2ba8fff2ba
+
+	* Change all references of /var/cache/osm to /var/cache/opensm
+
+Wed Apr 4 10:58:40 2007 -0400 Doug Ledford
+42517cdfa9fb2a69ef95ee160e9db38f6e1b0a7b
+
+	* Add Red Hat specific config files and use the right one based upon rpm tags
+
+Wed Apr 4 10:55:16 2007 -0400 Doug Ledford
+beb873e7bab6196bb9dcdbfae20c397a475cf0ab
+
+	* Make file name match convention of others in this directory
+
+Wed Apr 4 10:43:14 2007 -0400 Doug Ledford
+7ac786c2df4bd82b4cf620527e349753b03e98b8
+
+	* Add a logrotate script to opensm
+
+Wed Apr 4 08:58:38 2007 -0400 Doug Ledford
+fea4cabd50af96bbfa645b09051a59e887839300
+
+	* OpenSM.conf: move log file to /var/log by default, rename log to opensm.log and cache dir name to opensm
+
+Wed Apr 4 08:54:52 2007 -0400 Doug Ledford
+78fe659fbd8fac7a214e63356d80670d196219cc
+
+	* Move these files over with the rest
+
+Tue Apr 3 16:47:44 2007 -0400 Doug Ledford
+89ddbd7d3ea94d9d52ac2cbd5604d3d7c4c64710
+
+	* Version change in spec files
+
+Tue Apr 3 16:08:34 2007 -0400 Doug Ledford
+2083dddae00a58cd5c34723ae95d2c827b725d0c
+
+	* Merge of upstream master into rpm_cleanups
+
+Tue Apr 3 15:07:31 2007 -0400 Doug Ledford
+606e9b196fff73f5eeae24b7e26d1b8faff919d8
+
+	* Update to correct list address
+
+Tue Apr 3 15:01:19 2007 -0400 Doug Ledford
+6856fff91c5ec9b886e332d46bd6402e7b1c1692
+
+	* Move osm to opensm and diags to openib-diags so their name matches the rpm
diff --git a/Makefile.am b/Makefile.am
index 2287edd..e6fd74a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,26 +7,21 @@ ACLOCAL_AMFLAGS = -I config
 
 # we should provide a hint for other apps about the build mode of this project
 install-exec-hook:
-	mkdir -p $(DESTDIR)/$(includedir)
-if DEBUG
-	echo "define osm_build_type \"debug\"" > $(DESTDIR)/$(includedir)/infiniband/opensm/osm_build_id.h
-else
-	echo "define osm_build_type \"free\"" > $(DESTDIR)/$(includedir)/infiniband/opensm/osm_build_id.h
-endif
 	$(top_srcdir)/config/install-sh -m 755 -d $(DESTDIR)/$(sysconfdir)/init.d
 	cp $(top_builddir)/scripts/opensm.init $(DESTDIR)/$(sysconfdir)/init.d/opensmd
 	chmod 755 $(DESTDIR)/$(sysconfdir)/init.d/opensmd
 
 
-man_MANS = man/opensm.8 man/osmtest.8
+man_MANS = man/opensm.8 man/osmtest.8 man/torus-2QoS.8 man/torus-2QoS.conf.5
 
 various_scripts = $(wildcard scripts/*)
 docs = doc/performance-manager-HOWTO.txt doc/QoS_management_in_OpenSM.txt \
-	doc/opensm_release_notes-3.2.txt
+	doc/partition-config.txt doc/opensm-sriov.txt \
+	doc/opensm_release_notes-3.3.txt
 
 EXTRA_DIST = autogen.sh opensm.spec $(various_scripts) $(man_MANS) $(docs)
 
 dist-hook: $(EXTRA_DIST)
-	if [ -x $(top_srcdir)/../gen_chlog.sh ] ; then \
-		cd $(top_srcdir)/.. ; ./gen_chlog.sh $(PACKAGE) > $(distdir)/ChangeLog ; cd - ; \
+	if [ -x $(top_srcdir)/gen_chlog.sh ] ; then \
+		cd $(top_srcdir); ./gen_chlog.sh > $(distdir)/ChangeLog ; cd - ; \
 	fi
diff --git a/Makefile.in b/Makefile.in
index d708faa..412454d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,8 +16,9 @@
 @SET_MAKE@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -38,6 +40,8 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
 	$(top_srcdir)/include/opensm/osm_config.h.in \
 	$(top_srcdir)/include/opensm/osm_version.h.in \
 	$(top_srcdir)/man/opensm.8.in \
+	$(top_srcdir)/man/torus-2QoS.8.in \
+	$(top_srcdir)/man/torus-2QoS.conf.5.in \
 	$(top_srcdir)/scripts/opensm.init.in \
 	$(top_srcdir)/scripts/redhat-opensm.init.in \
 	$(top_srcdir)/scripts/sldd.sh.in AUTHORS COPYING ChangeLog \
@@ -45,12 +49,8 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
 	config/depcomp config/install-sh config/ltmain.sh \
 	config/missing config/ylwrap
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
-	$(top_srcdir)/config/ltoptions.m4 \
-	$(top_srcdir)/config/ltsugar.m4 \
-	$(top_srcdir)/config/ltversion.m4 \
-	$(top_srcdir)/config/lt~obsolete.m4 \
-	$(top_srcdir)/config/osmvsel.m4 $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/osmvsel.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -58,9 +58,11 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/include/config.h \
 	$(top_builddir)/include/opensm/osm_config.h
-CONFIG_CLEAN_FILES = man/opensm.8 scripts/opensm.init \
+CONFIG_CLEAN_FILES = man/opensm.8 man/torus-2QoS.8 \
+	man/torus-2QoS.conf.5 scripts/opensm.init \
 	scripts/redhat-opensm.init scripts/sldd.sh \
 	include/opensm/osm_version.h opensm.spec
+CONFIG_CLEAN_VPATH_FILES =
 SOURCES =
 DIST_SOURCES =
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
@@ -70,24 +72,84 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+man5dir = $(mandir)/man5
+am__installdirs = "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"
 man8dir = $(mandir)/man8
-am__installdirs = "$(DESTDIR)$(man8dir)"
 NROFF = nroff
 MANS = $(man_MANS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir dist dist-all distcheck
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
 am__remove_distdir = \
-  { test ! -d $(distdir) \
-    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
-         && rm -fr $(distdir); }; }
+  if test -d "$(distdir)"; then \
+    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+      && rm -rf "$(distdir)" \
+      || { sleep 5 && rm -rf "$(distdir)"; }; \
+  else :; fi
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
 DIST_ARCHIVES = $(distdir).tar.gz
 GZIP_ENV = --best
 distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
 distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -105,6 +167,7 @@ CYGPATH_W = @CYGPATH_W@
 DEFAULT_EVENT_PLUGIN = @DEFAULT_EVENT_PLUGIN@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -131,6 +194,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -149,9 +213,11 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PARTITION_CONFIG_FILE = @PARTITION_CONFIG_FILE@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PER_MOD_LOGGING_FILE = @PER_MOD_LOGGING_FILE@
 PREFIX_ROUTES_FILE = @PREFIX_ROUTES_FILE@
 QOS_POLICY_FILE = @QOS_POLICY_FILE@
 RANLIB = @RANLIB@
@@ -161,6 +227,7 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
 TARBALL = @TARBALL@
+TORUS2QOS_CONF_FILE = @TORUS2QOS_CONF_FILE@
 VERSION = @VERSION@
 YACC = @YACC@
 YFLAGS = @YFLAGS@
@@ -170,6 +237,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -202,7 +270,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -223,30 +290,31 @@ top_srcdir = @top_srcdir@
 SUBDIRS = complib libvendor opensm osmtest include $(DEFAULT_EVENT_PLUGIN)
 DIST_SUBDIRS = complib libvendor opensm osmtest include osmeventplugin
 ACLOCAL_AMFLAGS = -I config
-man_MANS = man/opensm.8 man/osmtest.8
+man_MANS = man/opensm.8 man/osmtest.8 man/torus-2QoS.8 man/torus-2QoS.conf.5
 various_scripts = $(wildcard scripts/*)
 docs = doc/performance-manager-HOWTO.txt doc/QoS_management_in_OpenSM.txt \
-	doc/opensm_release_notes-3.2.txt
+	doc/partition-config.txt doc/opensm-sriov.txt \
+	doc/opensm_release_notes-3.3.txt
 
 EXTRA_DIST = autogen.sh opensm.spec $(various_scripts) $(man_MANS) $(docs)
 all: all-recursive
 
 .SUFFIXES:
-am--refresh:
+am--refresh: Makefile
 	@:
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
-	      cd $(srcdir) && $(AUTOMAKE) --foreign  \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
+	      $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
 		&& exit 0; \
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -262,21 +330,20 @@ $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENC
 	$(SHELL) ./config.status --recheck
 
 $(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(srcdir) && $(AUTOCONF)
+	$(am__cd) $(srcdir) && $(AUTOCONF)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+	$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
 
 include/opensm/osm_config.h: include/opensm/stamp-h2
-	@if test ! -f $@; then \
-	  rm -f include/opensm/stamp-h2; \
-	  $(MAKE) $(AM_MAKEFLAGS) include/opensm/stamp-h2; \
-	else :; fi
+	@if test ! -f $@; then rm -f include/opensm/stamp-h2; else :; fi
+	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) include/opensm/stamp-h2; else :; fi
 
 include/opensm/stamp-h2: $(top_srcdir)/include/opensm/osm_config.h.in $(top_builddir)/config.status
 	@rm -f include/opensm/stamp-h2
 	cd $(top_builddir) && $(SHELL) ./config.status include/opensm/osm_config.h
 $(top_srcdir)/include/opensm/osm_config.h.in:  $(am__configure_deps) 
-	cd $(top_srcdir) && $(AUTOHEADER)
+	($(am__cd) $(top_srcdir) && $(AUTOHEADER))
 	rm -f include/opensm/stamp-h2
 	touch $@
 
@@ -284,6 +351,10 @@ distclean-hdr:
 	-rm -f include/opensm/osm_config.h include/opensm/stamp-h2
 man/opensm.8: $(top_builddir)/config.status $(top_srcdir)/man/opensm.8.in
 	cd $(top_builddir) && $(SHELL) ./config.status $@
+man/torus-2QoS.8: $(top_builddir)/config.status $(top_srcdir)/man/torus-2QoS.8.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+man/torus-2QoS.conf.5: $(top_builddir)/config.status $(top_srcdir)/man/torus-2QoS.conf.5.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
 scripts/opensm.init: $(top_builddir)/config.status $(top_srcdir)/scripts/opensm.init.in
 	cd $(top_builddir) && $(SHELL) ./config.status $@
 scripts/redhat-opensm.init: $(top_builddir)/config.status $(top_srcdir)/scripts/redhat-opensm.init.in
@@ -303,51 +374,78 @@ clean-libtool:
 
 distclean-libtool:
 	-rm -f libtool config.lt
-install-man8: $(man8_MANS) $(man_MANS)
+install-man5: $(man_MANS)
+	@$(NORMAL_INSTALL)
+	test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)"
+	@list=''; test -n "$(man5dir)" || exit 0; \
+	{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.5[a-z]*$$/p'; \
+	} | while read p; do \
+	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; echo "$$p"; \
+	done | \
+	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+	sed 'N;N;s,\n, ,g' | { \
+	list=; while read file base inst; do \
+	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
+	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \
+	  fi; \
+	done; \
+	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+	while read files; do \
+	  test -z "$$files" || { \
+	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \
+	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \
+	done; }
+
+uninstall-man5:
+	@$(NORMAL_UNINSTALL)
+	@list=''; test -n "$(man5dir)" || exit 0; \
+	files=`{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.5[a-z]*$$/p'; \
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+	dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir)
+install-man8: $(man_MANS)
 	@$(NORMAL_INSTALL)
 	test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
-	@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
-	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
-	for i in $$l2; do \
-	  case "$$i" in \
-	    *.8*) list="$$list $$i" ;; \
-	  esac; \
+	@list=''; test -n "$(man8dir)" || exit 0; \
+	{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.8[a-z]*$$/p'; \
+	} | while read p; do \
+	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; echo "$$p"; \
+	done | \
+	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+	sed 'N;N;s,\n, ,g' | { \
+	list=; while read file base inst; do \
+	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
+	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
+	  fi; \
 	done; \
-	for i in $$list; do \
-	  if test -f $$i; then file=$$i; \
-	  else file=$(srcdir)/$$i; fi; \
-	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
-	  case "$$ext" in \
-	    8*) ;; \
-	    *) ext='8' ;; \
-	  esac; \
-	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
-	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
-	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
-	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \
-	done
+	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+	while read files; do \
+	  test -z "$$files" || { \
+	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \
+	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \
+	done; }
+
 uninstall-man8:
 	@$(NORMAL_UNINSTALL)
-	@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
-	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
-	for i in $$l2; do \
-	  case "$$i" in \
-	    *.8*) list="$$list $$i" ;; \
-	  esac; \
-	done; \
-	for i in $$list; do \
-	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
-	  case "$$ext" in \
-	    8*) ;; \
-	    *) ext='8' ;; \
-	  esac; \
-	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
-	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
-	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-	  echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \
-	  rm -f "$(DESTDIR)$(man8dir)/$$inst"; \
-	done
+	@list=''; test -n "$(man8dir)" || exit 0; \
+	files=`{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.8[a-z]*$$/p'; \
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+	dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -356,7 +454,7 @@ uninstall-man8:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -373,7 +471,7 @@ $(RECURSIVE_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
@@ -381,7 +479,7 @@ $(RECURSIVE_TARGETS):
 	fi; test -z "$$fail"
 
 $(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -407,16 +505,16 @@ $(RECURSIVE_CLEAN_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
 	done
 ctags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
 	done
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -431,7 +529,7 @@ tags: TAGS
 
 TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
@@ -443,7 +541,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test ! -f $$subdir/TAGS || \
-	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
@@ -452,36 +550,54 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
 distdir: $(DISTFILES)
+	@list='$(MANS)'; if test -n "$$list"; then \
+	  list=`for p in $$list; do \
+	    if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	    if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+	  if test -n "$$list" && \
+	    grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+	    echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
+	    grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/         /' >&2; \
+	    echo "       to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+	    echo "       typically \`make maintainer-clean' will remove them" >&2; \
+	    exit 1; \
+	  else :; fi; \
+	else :; fi
 	$(am__remove_distdir)
-	test -d $(distdir) || mkdir $(distdir)
+	test -d "$(distdir)" || mkdir "$(distdir)"
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -497,29 +613,44 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test -d "$(distdir)/$$subdir" \
 	    || $(MKDIR_P) "$(distdir)/$$subdir" \
 	    || exit 1; \
-	    distdir=`$(am__cd) $(distdir) && pwd`; \
-	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
-	    (cd $$subdir && \
+	  fi; \
+	done
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$top_distdir" \
-	        distdir="$$distdir/$$subdir" \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
 		am__remove_distdir=: \
 		am__skip_length_check=: \
+		am__skip_mode_fix=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -527,23 +658,33 @@ distdir: $(DISTFILES)
 	$(MAKE) $(AM_MAKEFLAGS) \
 	  top_distdir="$(top_distdir)" distdir="$(distdir)" \
 	  dist-hook
-	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+	-test -n "$(am__skip_mode_fix)" \
+	|| find "$(distdir)" -type d ! -perm -755 \
+		-exec chmod u+rwx,go+rx {} \; -o \
 	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
-	|| chmod -R a+r $(distdir)
+	|| chmod -R a+r "$(distdir)"
 dist-gzip: distdir
 	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
 	$(am__remove_distdir)
 
 dist-bzip2: distdir
-	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+	$(am__remove_distdir)
+
+dist-lzip: distdir
+	tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
 	$(am__remove_distdir)
 
 dist-lzma: distdir
 	tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
 	$(am__remove_distdir)
 
+dist-xz: distdir
+	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+	$(am__remove_distdir)
+
 dist-tarZ: distdir
 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
 	$(am__remove_distdir)
@@ -567,15 +708,19 @@ dist dist-all: distdir
 distcheck: dist
 	case '$(DIST_ARCHIVES)' in \
 	*.tar.gz*) \
-	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
-	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
 	*.tar.lzma*) \
-	  unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+	  lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
+	*.tar.lz*) \
+	  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
+	*.tar.xz*) \
+	  xz -dc $(distdir).tar.xz | $(am__untar) ;;\
 	*.tar.Z*) \
 	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
 	*.shar.gz*) \
-	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
 	esac
@@ -583,10 +728,13 @@ distcheck: dist
 	mkdir $(distdir)/_build
 	mkdir $(distdir)/_inst
 	chmod a-w $(distdir)
+	test -d $(distdir)/_build || exit 0; \
 	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
 	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
-	  && cd $(distdir)/_build \
+	  && am__cwd=`pwd` \
+	  && $(am__cd) $(distdir)/_build \
 	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
@@ -607,14 +755,24 @@ distcheck: dist
 	  && rm -rf "$$dc_destdir" \
 	  && $(MAKE) $(AM_MAKEFLAGS) dist \
 	  && rm -rf $(DIST_ARCHIVES) \
-	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+	  && cd "$$am__cwd" \
+	  || exit 1
 	$(am__remove_distdir)
 	@(echo "$(distdir) archives ready for distribution: "; \
 	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
 	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
 distuninstallcheck:
-	@cd $(distuninstallcheck_dir) \
-	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+	@test -n '$(distuninstallcheck_dir)' || { \
+	  echo 'ERROR: trying to run $@ with an empty' \
+	       '$$(distuninstallcheck_dir)' >&2; \
+	  exit 1; \
+	}; \
+	$(am__cd) '$(distuninstallcheck_dir)' || { \
+	  echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+	  exit 1; \
+	}; \
+	test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
 	   || { echo "ERROR: files left after uninstall:" ; \
 	        if test -n "$(DESTDIR)"; then \
 	          echo "  (check DESTDIR support)"; \
@@ -635,7 +793,7 @@ check: check-recursive
 all-am: Makefile $(MANS)
 installdirs: installdirs-recursive
 installdirs-am:
-	for dir in "$(DESTDIR)$(man8dir)"; do \
+	for dir in "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-recursive
@@ -648,16 +806,22 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -678,6 +842,8 @@ dvi-am:
 
 html: html-recursive
 
+html-am:
+
 info: info-recursive
 
 info-am:
@@ -686,20 +852,29 @@ install-data-am: install-man
 
 install-dvi: install-dvi-recursive
 
+install-dvi-am:
+
 install-exec-am:
 	@$(NORMAL_INSTALL)
 	$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
-
 install-html: install-html-recursive
 
+install-html-am:
+
 install-info: install-info-recursive
 
-install-man: install-man8
+install-info-am:
+
+install-man: install-man5 install-man8
 
 install-pdf: install-pdf-recursive
 
+install-pdf-am:
+
 install-ps: install-ps-recursive
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
@@ -722,42 +897,41 @@ ps-am:
 
 uninstall-am: uninstall-man
 
-uninstall-man: uninstall-man8
+uninstall-man: uninstall-man5 uninstall-man8
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
-	install-exec-am install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+	install-am install-exec-am install-strip tags-recursive
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am am--refresh check check-am clean clean-generic \
 	clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
-	dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-zip \
-	distcheck distclean distclean-generic distclean-hdr \
-	distclean-libtool distclean-tags distcleancheck distdir \
-	distuninstallcheck dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-exec-hook \
-	install-html install-html-am install-info install-info-am \
-	install-man install-man8 install-pdf install-pdf-am install-ps \
-	install-ps-am install-strip installcheck installcheck-am \
-	installdirs installdirs-am maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
-	uninstall uninstall-am uninstall-man uninstall-man8
+	dist-gzip dist-hook dist-lzip dist-lzma dist-shar dist-tarZ \
+	dist-xz dist-zip distcheck distclean distclean-generic \
+	distclean-hdr distclean-libtool distclean-tags distcleancheck \
+	distdir distuninstallcheck dvi dvi-am html html-am info \
+	info-am install install-am install-data install-data-am \
+	install-dvi install-dvi-am install-exec install-exec-am \
+	install-exec-hook install-html install-html-am install-info \
+	install-info-am install-man install-man5 install-man8 \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am tags tags-recursive uninstall uninstall-am \
+	uninstall-man uninstall-man5 uninstall-man8
 
 
 # we should provide a hint for other apps about the build mode of this project
 install-exec-hook:
-	mkdir -p $(DESTDIR)/$(includedir)
- at DEBUG_TRUE@	echo "define osm_build_type \"debug\"" > $(DESTDIR)/$(includedir)/infiniband/opensm/osm_build_id.h
- at DEBUG_FALSE@	echo "define osm_build_type \"free\"" > $(DESTDIR)/$(includedir)/infiniband/opensm/osm_build_id.h
 	$(top_srcdir)/config/install-sh -m 755 -d $(DESTDIR)/$(sysconfdir)/init.d
 	cp $(top_builddir)/scripts/opensm.init $(DESTDIR)/$(sysconfdir)/init.d/opensmd
 	chmod 755 $(DESTDIR)/$(sysconfdir)/init.d/opensmd
 
 dist-hook: $(EXTRA_DIST)
-	if [ -x $(top_srcdir)/../gen_chlog.sh ] ; then \
-		cd $(top_srcdir)/.. ; ./gen_chlog.sh $(PACKAGE) > $(distdir)/ChangeLog ; cd - ; \
+	if [ -x $(top_srcdir)/gen_chlog.sh ] ; then \
+		cd $(top_srcdir); ./gen_chlog.sh > $(distdir)/ChangeLog ; cd - ; \
 	fi
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/aclocal.m4 b/aclocal.m4
index 0551697..53bf10f 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,7 +1,8 @@
-# generated automatically by aclocal 1.10.2 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.3 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
+# Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -13,28 +14,8622 @@
 
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],,
-[m4_warning([this file was generated for autoconf 2.63.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
+[m4_warning([this file was generated for autoconf 2.68.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])
 
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+m4_define([_LT_COPYING], [dnl
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 57 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+       [m4_default([$3],
+		   [m4_fatal([Libtool version $1 or higher is required],
+		             63)])],
+       [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+  *\ * | *\	*)
+    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
+_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
+dnl
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    _LT_PATH_MAGIC
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME.  Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+	[m4_ifval([$1], [$1], [$2])])
+    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+    m4_ifval([$4],
+	[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+    lt_dict_add_subkey([lt_decl_dict], [$2],
+	[tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+  [0], [m4_fatal([$0: too few arguments: $#])],
+  [1], [m4_fatal([$0: too few arguments: $#: $1])],
+  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+     m4_if([$2], [],
+	   m4_quote(lt_decl_varnames),
+	m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+			lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'.  VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly.  In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+#    # Some comment about what VAR is for.
+#    visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+					   [description])))[]dnl
+m4_pushdef([_libtool_name],
+    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+    [0], [_libtool_name=[$]$1],
+    [1], [_libtool_name=$lt_[]$1],
+    [2], [_libtool_name=$lt_[]$1],
+    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'.  Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+	dnl If the libtool generation code has been placed in $CONFIG_LT,
+	dnl instead of duplicating it all over again into config.status,
+	dnl then we will have config.status run $CONFIG_LT later, so it
+	dnl needs to know what name is stored there:
+        [AC_CONFIG_COMMANDS([libtool],
+            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+    dnl If the libtool generation code is destined for config.status,
+    dnl expand the accumulated commands and init code now:
+    [AC_CONFIG_COMMANDS([libtool],
+        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable.  If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins.  After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script.  The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+lt_cl_silent=false
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+  echo
+  AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+  -h, --help      print this help, then exit
+  -V, --version   print version number, then exit
+  -q, --quiet     do not print progress messages
+  -d, --debug     don't remove temporary files
+
+Report bugs to <bug-libtool at gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2011 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+  case $[1] in
+    --version | --v* | -V )
+      echo "$lt_cl_version"; exit 0 ;;
+    --help | --h* | -h )
+      echo "$lt_cl_help"; exit 0 ;;
+    --debug | --d* | -d )
+      debug=: ;;
+    --quiet | --q* | --silent | --s* | -q )
+      lt_cl_silent=: ;;
+
+    -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+    *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+  esac
+  shift
+done
+
+if $lt_cl_silent; then
+  exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure.  Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+lt_cl_success=:
+test "$silent" = yes &&
+  lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars.  Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+  m4_if(_LT_TAG, [C], [
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+  _LT_PROG_LTMAIN
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  _LT_PROG_REPLACE_SHELLFNS
+
+   mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+  [C],			[_LT_LANG(C)],
+  [C++],		[_LT_LANG(CXX)],
+  [Go],			[_LT_LANG(GO)],
+  [Java],		[_LT_LANG(GCJ)],
+  [Fortran 77],		[_LT_LANG(F77)],
+  [Fortran],		[_LT_LANG(FC)],
+  [Windows Resource],	[_LT_LANG(RC)],
+  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+    [_LT_LANG($1)],
+    [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+  [LT_SUPPORTED_TAG([$1])dnl
+  m4_append([_LT_TAGS], [$1 ])dnl
+  m4_define([_LT_LANG_]$1[_enabled], [])dnl
+  _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+m4_ifndef([AC_PROG_GO], [
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+m4_defun([AC_PROG_GO],
+[AC_LANG_PUSH(Go)dnl
+AC_ARG_VAR([GOC],     [Go compiler command])dnl
+AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOL(GOC, gccgo)
+if test -z "$GOC"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
+  fi
+fi
+if test -z "$GOC"; then
+  AC_CHECK_PROG(GOC, gccgo, gccgo, false)
+fi
+])#m4_defun
+])#m4_ifndef
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+  [LT_LANG(CXX)],
+  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+  [LT_LANG(F77)],
+  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+  [LT_LANG(FC)],
+  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+  [LT_LANG(GCJ)],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+    [LT_LANG(GCJ)],
+    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+      [LT_LANG(GCJ)],
+      [m4_ifdef([AC_PROG_GCJ],
+	[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([A][M_PROG_GCJ],
+	[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([LT_PROG_GCJ],
+	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([AC_PROG_GO],
+  [LT_LANG(GO)],
+  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+  [LT_LANG(RC)],
+  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+  case $host_os in
+    rhapsody* | darwin*)
+    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+    AC_CHECK_TOOL([LIPO], [lipo], [:])
+    AC_CHECK_TOOL([OTOOL], [otool], [:])
+    AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+    _LT_DECL([], [DSYMUTIL], [1],
+      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+    _LT_DECL([], [NMEDIT], [1],
+      [Tool to change global to local symbols on Mac OS X])
+    _LT_DECL([], [LIPO], [1],
+      [Tool to manipulate fat objects and archives on Mac OS X])
+    _LT_DECL([], [OTOOL], [1],
+      [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+    _LT_DECL([], [OTOOL64], [1],
+      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+      [lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+	# By default we will add the -single_module flag. You can override
+	# by either setting the environment variable LT_MULTI_MODULE
+	# non-empty at configure time, or by adding -multi_module to the
+	# link flags.
+	rm -rf libconftest.dylib*
+	echo "int foo(void){return 1;}" > conftest.c
+	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+	# If there is a non-empty error log, and "single_module"
+	# appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+	  cat conftest.err >&AS_MESSAGE_LOG_FD
+	# Otherwise, if the output was created with a 0 exit code from
+	# the compiler, it worked.
+	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+	  lt_cv_apple_cc_single_mod=yes
+	else
+	  cat conftest.err >&AS_MESSAGE_LOG_FD
+	fi
+	rm -rf libconftest.dylib*
+	rm -f conftest.*
+      fi])
+
+    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+      [lt_cv_ld_exported_symbols_list],
+      [lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+	[lt_cv_ld_exported_symbols_list=yes],
+	[lt_cv_ld_exported_symbols_list=no])
+	LDFLAGS="$save_LDFLAGS"
+    ])
+
+    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+      [lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -s conftest.err && $GREP force_load conftest.err; then
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+    ])
+    case $host_os in
+    rhapsody* | darwin1.[[012]])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	10.[[012]]*)
+	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	10.*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES([TAG])
+# ---------------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+  m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_automatic, $1)=yes
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
+                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
+  else
+    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  fi
+  _LT_TAGVAR(link_all_deplibs, $1)=yes
+  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    m4_if([$1], [CXX],
+[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+    fi
+],[])
+  else
+  _LT_TAGVAR(ld_shlibs, $1)=no
+  fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+  lt_aix_libpath_sed='[
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }]'
+  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi],[])
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+  fi
+  ])
+  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*" 
+}
+
+case "$ECHO" in
+  printf*) AC_MSG_RESULT([printf]) ;;
+  print*) AC_MSG_RESULT([print -r]) ;;
+  *) AC_MSG_RESULT([cat]) ;;
+esac
+
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test "X`printf %s $ECHO`" = "X$ECHO" \
+      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[  --with-sysroot[=DIR] Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted.  We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   AC_MSG_RESULT([${with_sysroot}])
+   AC_MSG_ERROR([The sysroot must be an absolute path.])
+   ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+  [AS_HELP_STRING([--disable-libtool-lock],
+    [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
+	;;
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
+	;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_i386_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_i386"
+	    ;;
+	  ppc64-*linux*|powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_x86_64_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  ppc*-*linux*|powerpc*-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*)
+        case $host in
+        i?86-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD="${LD-ld}_sol2"
+        fi
+        ;;
+      *)
+	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+  [lt_cv_ar_at_file=no
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+     [echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+      AC_TRY_EVAL([lt_ar_try])
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	AC_TRY_EVAL([lt_ar_try])
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+     ])
+  ])
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+  [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[_LT_PROG_AR
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+    [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+    [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+    [Whether to use a lock for old archive extraction])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$5], , :, [$5])
+else
+    m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                  [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$4], , :, [$4])
+else
+    m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[	 ]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+    [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+[#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}]
+_LT_EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+    ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+	  [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+	  lt_cv_dlopen_self_static, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+	 [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+	 [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+	 [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+	[Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+         [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+  [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+    [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+    fi
+    ;;
+  *)
+    AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+	[], [
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[[4-9]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+m4_if([$1], [],[
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[23]].*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2.*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[[3-9]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux # correct to gnu/linux during the next big refactor
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+    [lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+	 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+	 [lt_cv_shlibpath_overrides_runpath=yes])])
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+    ])
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Add ABI-specific directories to the system library path.
+  sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux # correct to gnu/linux during the next big refactor
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+    [Variables whose values should be saved in libtool wrapper scripts and
+    restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+    [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+    [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+    [[List of archive names.  First name is the real one, the rest are links.
+    The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+    [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+    [Permission mode override for installation of shared libraries])
+_LT_DECL([], [postinstall_cmds], [2],
+    [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+    [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+    [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+    [[As "finish_cmds", except a single script fragment to be evaled but
+    not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+    [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+    [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+    [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="m4_if([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+	 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
+
+AC_ARG_WITH([gnu-ld],
+    [AS_HELP_STRING([--with-gnu-ld],
+	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[[4-9]]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[[45]]*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[[3-9]]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+    [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+    [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+    [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
+  AC_SUBST([DUMPBIN])
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+  [lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+  cat conftest.out >&AS_MESSAGE_LOG_FD
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+    [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+  [lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*])
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  case $cc_basename in
+  nvcc*)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+  esac
+
+  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+	[Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK ['"\
+"     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx]"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT@&t at _DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT@&t at _DLSYM_CONST
+#else
+# define LT@&t at _DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+	  cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+LT@&t at _DLSYM_CONST struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+    [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+    [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+    [lt_cv_sys_global_symbol_to_c_name_address], [1],
+    [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+    [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+    [Specify filename containing input files for $NM])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+m4_if([$1], [CXX], [
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[[4-9]]*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	else
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+      mingw* | cygwin* | os2* | pw32* | cegcc*)
+	# This hack is so that the source file can tell whether it is being
+	# built for inclusion in a dll (and should export symbols for example).
+	m4_if([$1], [GCJ], [],
+	  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+	;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    ;;
+	  ecpc* )
+	    # old Intel C++ for x86_64 which still supported -KPIC.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  icpc* )
+	    # Intel C++, used to be incompatible with GCC.
+	    # ICC 10 doesn't accept -KPIC any more.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  pgCC* | pgcpp*)
+	    # Portland Group C++ compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+	    # IBM XL 8.0, 9.0 on PPC and BlueGene
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd*)
+	;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+	;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+      if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
+      fi
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+	;;
+      nagfor*)
+	# NAG Fortran compiler
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	  ;;
+	*Sun\ C*)
+	  # Sun C 5.9
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  ;;
+        *Intel*\ [[CF]]*Compiler*)
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	  ;;
+	*Portland\ Group*)
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    rdos*)
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+	[Additional compiler flags for building library objects])
+
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+	[How to pass a linker flag through the compiler])
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+	[Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  case $host_os in
+  aix[[4-9]]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    # Also, AIX nm treats weak defined symbols like other global defined
+    # symbols, whereas GNU nm marks them as "W".
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+    ;;
+  cygwin* | mingw* | cegcc*)
+    case $cc_basename in
+    cl*)
+      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+      ;;
+    *)
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+      ;;
+    esac
+    ;;
+  *)
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+    ;;
+  esac
+], [
+  runpath_var=
+  _LT_TAGVAR(allow_undefined_flag, $1)=
+  _LT_TAGVAR(always_export_symbols, $1)=no
+  _LT_TAGVAR(archive_cmds, $1)=
+  _LT_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_TAGVAR(compiler_needs_object, $1)=no
+  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(hardcode_automatic, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_TAGVAR(inherit_rpath, $1)=no
+  _LT_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_TAGVAR(module_cmds, $1)=
+  _LT_TAGVAR(module_expsym_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  _LT_TAGVAR(ld_shlibs, $1)=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+	  *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[[3-9]]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=no
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    haiku*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    interix[[3-9]]*)
+      _LT_TAGVAR(hardcode_direct, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=' $pic_flag'
+	tmp_sharedflag='-shared'
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	lf95*)				# Lahey Fortran 8.1
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+	  tmp_sharedflag='--shared' ;;
+	xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	  tmp_sharedflag='-qmkshrobj'
+	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	esac
+	_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	    echo "local: *; };" >> $output_objdir/$libname.ver~
+	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+	case $cc_basename in
+	xlf* | bgf* | bgxlf* | mpixlf*)
+	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+	  if test "x$supports_anon_versioning" = xyes; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	      echo "local: *; };" >> $output_objdir/$libname.ver~
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	  fi
+	  ;;
+	esac
+      else
+        _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	_LT_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix[[4-9]]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	  for ld_flag in $LDFLAGS; do
+	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	    aix_use_runtimelinking=yes
+	    break
+	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_TAGVAR(archive_cmds, $1)=''
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	  # We have reworked collect2
+	  :
+	  else
+	  # We have old collect2
+	  _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        _LT_SYS_MODULE_PATH_AIX([$1])
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	  _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 _LT_SYS_MODULE_PATH_AIX([$1])
+	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  fi
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[[45]]*)
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	_LT_TAGVAR(always_export_symbols, $1)=yes
+	_LT_TAGVAR(file_list_spec, $1)='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	# FIXME: Should let the user specify the lib program.
+	_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	;;
+      esac
+      ;;
+
+    darwin* | rhapsody*)
+      _LT_DARWIN_LINKER_FEATURES($1)
+      ;;
+
+    dgux*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2.*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	_LT_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	m4_if($1, [], [
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  _LT_LINKER_OPTION([if $CC understands -b],
+	    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+	    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+	  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  ;;
+	*)
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+	# This should be the same for all languages, so no per-tag cache variable.
+	AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+	  [lt_cv_irix_exported_symbol],
+	  [save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   AC_LINK_IFELSE(
+	     [AC_LANG_SOURCE(
+	        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+			      [C++], [[int foo (void) { return 0; }]],
+			      [Fortran 77], [[
+      subroutine foo
+      end]],
+			      [Fortran], [[
+      subroutine foo
+      end]])])],
+	      [lt_cv_irix_exported_symbol=yes],
+	      [lt_cv_irix_exported_symbol=no])
+           LDFLAGS="$save_LDFLAGS"])
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(inherit_rpath, $1)=yes
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	     ;;
+	   *)
+	     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+	fi
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    os2*)
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+        ;;
+	motorola)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	_LT_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+    [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+	[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+	[$RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+	if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+	  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+	  _LT_TAGVAR(allow_undefined_flag, $1)=
+	  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+	  then
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	  else
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  fi
+	  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+	])
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+    [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+    [enable_shared_with_static_runtimes], [0],
+    [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+    [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+    [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+    [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+    [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+    [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+    [Commands used to build a loadable module if different from building
+    a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+    [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+    [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+    [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+    [Flag to hardcode $libdir into a binary during linking.
+    This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+    [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary and the resulting library dependency is
+    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+    library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+    [Set to "yes" if building a shared library automatically hardcodes DIR
+    into the library and all subsequent libraries and executables linked
+    against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+    [Set to yes if linker adds runtime paths of dependent libraries
+    to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+    [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [always_export_symbols], [0],
+    [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+    [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+    [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+    [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+    [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+    [Commands necessary for finishing linking programs])
+_LT_TAGDECL([], [file_list_spec], [1],
+    [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl    [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_SYS_DYNAMIC_LINKER($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+  LT_SYS_DLOPEN_SELF
+  _LT_CMD_STRIPLIB
+
+  # Report which library types will actually be built
+  AC_MSG_CHECKING([if libtool supports shared libraries])
+  AC_MSG_RESULT([$can_build_shared])
+
+  AC_MSG_CHECKING([whether to build shared libraries])
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[[4-9]]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  AC_MSG_RESULT([$enable_shared])
+
+  AC_MSG_CHECKING([whether to build static libraries])
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  AC_MSG_RESULT([$enable_static])
+
+  _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+else
+  _lt_caught_CXX_error=yes
+fi
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_CFLAGS=$CFLAGS
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  CFLAGS=$CXXFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+    else
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+      LT_PATH_LD
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+	  $GREP 'no-whole-archive' > /dev/null; then
+          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          _LT_TAGVAR(whole_archive_flag_spec, $1)=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+    _LT_TAGVAR(ld_shlibs, $1)=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+      aix[[4-9]]*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	    for ld_flag in $LDFLAGS; do
+	      case $ld_flag in
+	      *-brtl*)
+	        aix_use_runtimelinking=yes
+	        break
+	        ;;
+	      esac
+	    done
+	    ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        _LT_TAGVAR(archive_cmds, $1)=''
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[[012]]|aix4.[[012]].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	    # We have reworked collect2
+	    :
+	  else
+	    # We have old collect2
+	    _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	    # It fails to find uninstalled libraries when the uninstalled
+	    # path is not listed in the libpath.  Setting hardcode_minus_L
+	    # to unsupported forces relinking
+	    _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+          esac
+          shared_flag='-shared'
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag="$shared_flag "'${wl}-G'
+	  fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	  # chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+          else
+	    if test "$aix_use_runtimelinking" = yes; then
+	      shared_flag='${wl}-G'
+	    else
+	      shared_flag='${wl}-bM:SRE'
+	    fi
+          fi
+        fi
+
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+	# export.
+        _LT_TAGVAR(always_export_symbols, $1)=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          _LT_SYS_MODULE_PATH_AIX([$1])
+          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	    _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+	    # Determine the default libpath from the value encoded in an
+	    # empty executable.
+	    _LT_SYS_MODULE_PATH_AIX([$1])
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	    # Warning - without using the other run time loading flags,
+	    # -berok will link without error, but may produce a broken library.
+	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	    if test "$with_gnu_ld" = yes; then
+	      # We only use this code for GNU lds that support --whole-archive.
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    else
+	      # Exported symbols can be pulled into shared objects from archives
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	    fi
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	    # This is similar to how AIX traditionally builds its shared
+	    # libraries.
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	  # support --undefined.  This deserves some investigation.  FIXME
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+	  # FIXME: insert proper C++ library support
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	  ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+	case $GXX,$cc_basename in
+	,cl* | no,cl*)
+	  # Native MSVC
+	  # hardcode_libdir_flag_spec is actually meaningless, as there is
+	  # no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=yes
+	  _LT_TAGVAR(file_list_spec, $1)='@'
+	  # Tell ltmain to make .lib files, not .a files.
+	  libext=lib
+	  # Tell ltmain to make .dll files, not .so files.
+	  shrext_cmds=".dll"
+	  # FIXME: Setting linknames here is a bad hack.
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	    else
+	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	    fi~
+	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	    linknames='
+	  # The linker will not automatically build a static lib if we build a DLL.
+	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	  # Don't use ranlib
+	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	    lt_tool_outputfile="@TOOL_OUTPUT@"~
+	    case $lt_outputfile in
+	      *.exe|*.EXE) ;;
+	      *)
+		lt_outputfile="$lt_outputfile.exe"
+		lt_tool_outputfile="$lt_tool_outputfile.exe"
+		;;
+	    esac~
+	    func_to_tool_file "$lt_outputfile"~
+	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	      $RM "$lt_outputfile.manifest";
+	    fi'
+	  ;;
+	*)
+	  # g++
+	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+	  # as there is no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=no
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	    # If the export-symbols file already is a .def file (1st line
+	    # is EXPORTS), use it as is; otherwise, prepend...
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      cp $export_symbols $output_objdir/$soname.def;
+	    else
+	      echo EXPORTS > $output_objdir/$soname.def;
+	      cat $export_symbols >> $output_objdir/$soname.def;
+	    fi~
+	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	  ;;
+	esac
+	;;
+      darwin* | rhapsody*)
+        _LT_DARWIN_LINKER_FEATURES($1)
+	;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          ghcx*)
+	    # Green Hills C++ Compiler
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      freebsd2.*)
+        # C++ shared libraries reported to be fairly broken before
+	# switch to ELF
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      freebsd-elf*)
+        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      haiku*)
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        ;;
+
+      hpux9*)
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+				             # but as the default
+				             # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            _LT_TAGVAR(ld_shlibs, $1)=no
+            ;;
+          aCC*)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              _LT_TAGVAR(ld_shlibs, $1)=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+	      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            _LT_TAGVAR(hardcode_direct, $1)=no
+            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+            ;;
+          *)
+            _LT_TAGVAR(hardcode_direct, $1)=yes
+            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+					         # but as the default
+					         # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          aCC*)
+	    case $host_cpu in
+	      hppa*64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      ia64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      *)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	    esac
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test $with_gnu_ld = no; then
+	        case $host_cpu in
+	          hppa*64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          ia64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          *)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	        esac
+	      fi
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      interix[[3-9]]*)
+	_LT_TAGVAR(hardcode_direct, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+	# Instead, shared libraries are loaded at an image base (0x10000000 by
+	# default) and relocated if they conflict, which is a slow very memory
+	# consuming and fragmenting process.  To avoid this, we pick a random,
+	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+	    # SGI C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test "$with_gnu_ld" = no; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	      else
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+	      fi
+	    fi
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+	    ;;
+        esac
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(inherit_rpath, $1)=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+	    ;;
+	  icpc* | ecpc* )
+	    # Intel C++
+	    with_gnu_ld=yes
+	    # version 8.0 and above of icpc choke on multiply defined symbols
+	    # if we add $predep_objects and $postdep_objects, however 7.1 and
+	    # earlier do not add the objects themselves.
+	    case `$CC -V 2>&1` in
+	      *"Version 7."*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	      *)  # Version 8.0 or newer
+	        tmp_idyn=
+	        case $host_cpu in
+		  ia64*) tmp_idyn=' -i_dynamic';;
+		esac
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	    esac
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+	    case `$CC -V` in
+	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+		$RANLIB $oldlib'
+	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    *) # Version 6 and above use weak symbols
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+	  cxx*)
+	    # Compaq C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	    runpath_var=LD_RUN_PATH
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+	    ;;
+	  xl* | mpixl* | bgxl*)
+	    # IBM XL 8.0 on PPC, with GNU ld
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    if test "x$supports_anon_versioning" = xyes; then
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+		echo "local: *; };" >> $output_objdir/$libname.ver~
+		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	    fi
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	      _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+	      # Not sure whether something based on
+	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	      # would be better.
+	      output_verbose_link_cmd='func_echo_all'
+
+	      # Archives containing C++ object files must be created using
+	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	      # necessary to make sure instantiated templates are included
+	      # in the archive.
+	      _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	  *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	esac
+	;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+	  wlarc=
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	fi
+	# Workaround some broken pre-1.5 toolchains
+	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+	;;
+
+      *nto* | *qnx*)
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+	;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      openbsd*)
+	if test -f /usr/libexec/ld.so; then
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+	  fi
+	  output_verbose_link_cmd=func_echo_all
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Archives containing C++ object files must be created using
+	    # the KAI C++ compiler.
+	    case $host in
+	      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+	      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+	    esac
+	    ;;
+          RCC*)
+	    # Rational C++ 2.4.1
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          cxx*)
+	    case $host in
+	      osf3*)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+		;;
+	      *)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	          echo "-hidden">> $lib.exp~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $RM $lib.exp'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+		;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+	  *)
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	      case $host in
+	        osf3*)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	        *)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	      esac
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	      # Commands to make compiler produce verbose output that lists
+	      # what "hidden" libraries, object files and flags are used when
+	      # linking a shared library.
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+	    # Sun C++ 4.x
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          lcc*)
+	    # Lucid
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	    case $host_os in
+	      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	      *)
+		# The compiler driver will combine and reorder linker options,
+		# but understands `-z linker_flag'.
+	        # Supported since Solaris 2.6 (maybe 2.5.1?)
+		_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	        ;;
+	    esac
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+	    output_verbose_link_cmd='func_echo_all'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	    ;;
+          gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	    # The C++ compiler must be used to create the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    # GNU C++ compiler with Solaris linker
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      else
+	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	        # platform.
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      fi
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+	      case $host_os in
+		solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+		*)
+		  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+		  ;;
+	      esac
+	    fi
+	    ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+	# Note: We can NOT use -z defs as we might desire, because we do not
+	# link with -lc, and that would cause any symbols used from libc to
+	# always be unresolved, which means just about no library would
+	# ever link correctly.  If we're not using GNU ld we use -z text
+	# though, which does catch some bad symbols but isn't as heavy-handed
+	# as -z defs.
+	_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+	_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+	_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+	_LT_TAGVAR(link_all_deplibs, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+	runpath_var='LD_RUN_PATH'
+
+	case $cc_basename in
+          CC*)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
+	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+	      '"$_LT_TAGVAR(reload_cmds, $1)"
+	    ;;
+	  *)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+	    # NonStop-UX NCC 3.20
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+    esac
+
+    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+    _LT_TAGVAR(GCC, $1)="$GXX"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+  case ${2} in
+  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+_LT_EOF
+], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
+package foo
+func foo() {
+}
+_LT_EOF
+])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
+esac
+
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case ${prev}${p} in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+	 prev=$p
+	 continue
+       fi
+
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
+       if test "$pre_test_object_deps_done" = no; then
+	 case ${prev} in
+	 -L | -R)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+	   else
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+	   _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+	 else
+	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+	 fi
+       fi
+       prev=
+       ;;
+
+    *.lto.$objext) ;; # Ignore GCC LTO objects
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+	   _LT_TAGVAR(predep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+	 fi
+       else
+	 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+	   _LT_TAGVAR(postdep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_TAGVAR(predep_objects,$1)=
+  _LT_TAGVAR(postdep_objects,$1)=
+  _LT_TAGVAR(postdeps,$1)=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC* | sunCC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+    [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+    [Dependencies to place before and after the objects being linked to
+    create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+    [The library search path used internally by the compiler when linking
+    a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${F77-"f77"}
+  CFLAGS=$FFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+  GCC=$G77
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$G77"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC="$lt_save_CC"
+  CFLAGS="$lt_save_CFLAGS"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${FC-"f95"}
+  CFLAGS=$FCFLAGS
+  compiler=$CC
+  GCC=$ac_cv_fc_compiler_gnu
+
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_GO_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Go compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GO_CONFIG],
+[AC_REQUIRE([LT_PROG_GO])dnl
+AC_LANG_SAVE
+
+# Source file extension for Go test sources.
+ac_ext=go
+
+# Object file extension for compiled Go test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="package main; func main() { }"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='package main; func main() { }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GOC-"gccgo"}
+CFLAGS=$GOFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# Go did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GO_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+CFLAGS=
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+  :
+  _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+    [AC_CHECK_TOOL(GCJ, gcj,)
+      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+      AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_GO
+# ----------
+AC_DEFUN([LT_PROG_GO],
+[AC_CHECK_TOOL(GOC, gccgo,)
+])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
+# ------------------------------------------------------
+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
+m4_defun([_LT_PROG_FUNCTION_REPLACE],
+[dnl {
+sed -e '/^$1 ()$/,/^} # $1 /c\
+$1 ()\
+{\
+m4_bpatsubsts([$2], [$], [\\], [^\([	 ]\)], [\\\1])
+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+])
+
+
+# _LT_PROG_REPLACE_SHELLFNS
+# -------------------------
+# Replace existing portable implementations of several shell functions with
+# equivalent extended shell implementations where those features are available..
+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
+[if test x"$xsi_shell" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
+    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+    # positional parameters, so assign one to ordinary parameter first.
+    func_stripname_result=${3}
+    func_stripname_result=${func_stripname_result#"${1}"}
+    func_stripname_result=${func_stripname_result%"${2}"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
+    func_split_long_opt_name=${1%%=*}
+    func_split_long_opt_arg=${1#*=}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
+    func_split_short_opt_arg=${1#??}
+    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
+    case ${1} in
+      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+      *)    func_lo2o_result=${1} ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
+
+  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
+
+  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
+    func_quote_for_eval "${2}"
+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
+    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
+fi
+])
+
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine which file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+         [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+         [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
+
+# Helper functions for option handling.                    -*- Autoconf -*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+#   Inc.
+#   Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 7 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+		      [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+  dnl
+  dnl Simply set some default values (i.e off) if boolean options were not
+  dnl specified:
+  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+  ])
+  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+  ])
+  dnl
+  dnl If no reference was made to various pairs of opposing options, then
+  dnl we run the default mode handler for the pair.  For example, if neither
+  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl archives by default:
+  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+  		   [_LT_ENABLE_FAST_INSTALL])
+  ])
+])# _LT_SET_OPTIONS
+
+
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [1], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+	[Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+	[Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+	 [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+	IFS="$lt_save_ifs"
+	if test "X$lt_pkg" = "X$lt_p"; then
+	  pic_mode=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+		 [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+		 [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+		 [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+		 [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+		 [m4_define([_LTDL_TYPE], [convenience])])
+
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+	     [m4_foreach([_Lt_suffix],
+		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+		 [lt_append([$1], [$2], [$3])$4],
+		 [$5])],
+	  [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+	[$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
+
+# ltversion.m4 -- version numbers			-*- Autoconf -*-
+#
+#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# @configure_input@
+
+# serial 3337 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.4.2])
+m4_define([LT_PACKAGE_REVISION], [1.3337])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.4.2'
+macro_revision='1.3337'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
+
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 5 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else.  This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],	[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP],		[AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],	[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
+# Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_AUTOMAKE_VERSION(VERSION)
 # ----------------------------
 # Automake X.Y traces this macro to ensure aclocal.m4 has been
 # generated from the m4 files accompanying Automake X.Y.
 # (This private macro should not be called outside this file.)
 AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.10'
+[am__api_version='1.11'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.10.2], [],
+m4_if([$1], [1.11.3], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -50,19 +8645,21 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.10.2])dnl
+[AM_AUTOMAKE_VERSION([1.11.3])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
@@ -110,14 +8707,14 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 8
+# serial 9
 
 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
 # -------------------------------------
@@ -130,6 +8727,7 @@ AC_SUBST([$1_TRUE])dnl
 AC_SUBST([$1_FALSE])dnl
 _AM_SUBST_NOTMAKE([$1_TRUE])dnl
 _AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
 if $2; then
   $1_TRUE=
   $1_FALSE='#'
@@ -143,14 +8741,14 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-# Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
+# 2010, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 9
+# serial 12
 
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -190,6 +8788,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
   # instance it was reported that on HP-UX the gcc test will end up
   # making a dummy file named `D' -- because `-MD' means `put the output
   # in D'.
+  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -207,6 +8806,16 @@ AC_CACHE_CHECK([dependency style of $depcc],
   if test "$am_compiler_list" = ""; then
      am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
   fi
+  am__universal=false
+  m4_case([$1], [CC],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac],
+    [CXX],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac])
+
   for depmode in $am_compiler_list; do
     # Setup a source with many dependencies, because some compilers
     # like to wrap large dependency lists on column 80 (with \), and
@@ -224,7 +8833,17 @@ AC_CACHE_CHECK([dependency style of $depcc],
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
     case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
     nosideeffect)
       # after this tag, mechanisms are not by side-effect, so they'll
       # only be used when explicitly requested
@@ -234,19 +8853,23 @@ AC_CACHE_CHECK([dependency style of $depcc],
 	break
       fi
       ;;
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
     none) break ;;
     esac
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
-    # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.
     if depmode=$depmode \
-       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       source=sub/conftest.c object=$am__obj \
        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
          >/dev/null 2>conftest.err &&
        grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
       # icc doesn't choke on unknown options, it will just issue warnings
       # or remarks (even with -Werror).  So we grep stderr for any message
@@ -295,10 +8918,13 @@ AC_DEFUN([AM_DEP_TRACK],
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
+  am__nodep='_no'
 fi
 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
 AC_SUBST([AMDEPBACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
 ])
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
@@ -310,59 +8936,61 @@ _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-#serial 4
+#serial 5
 
 # _AM_OUTPUT_DEPENDENCY_COMMANDS
 # ------------------------------
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
-[# Autoconf 2.62 quotes --file arguments for eval, but not when files
-# are listed without --file.  Let's play safe and only enable the eval
-# if we detect the quoting.
-case $CONFIG_FILES in
-*\'*) eval set x "$CONFIG_FILES" ;;
-*)   set x $CONFIG_FILES ;;
-esac
-shift
-for mf
-do
-  # Strip MF so we end up with the name of the file.
-  mf=`echo "$mf" | sed -e 's/:.*$//'`
-  # Check whether this is an Automake generated Makefile or not.
-  # We used to match only the files named `Makefile.in', but
-  # some people rename them; so instead we look at the file content.
-  # Grep'ing the first line is not enough: some people post-process
-  # each Makefile.in and add a new line on top of each file to say so.
-  # Grep'ing the whole file is not good either: AIX grep has a line
-  # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-    dirpart=`AS_DIRNAME("$mf")`
-  else
-    continue
-  fi
-  # Extract the definition of DEPDIR, am__include, and am__quote
-  # from the Makefile without running `make'.
-  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-  test -z "$DEPDIR" && continue
-  am__include=`sed -n 's/^am__include = //p' < "$mf"`
-  test -z "am__include" && continue
-  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-  # When using ansi2knr, U may be empty or an underscore; expand it
-  U=`sed -n 's/^U = //p' < "$mf"`
-  # Find all dependency output files, they are included files with
-  # $(DEPDIR) in their names.  We invoke sed twice because it is the
-  # simplest approach to changing $(DEPDIR) to its actual value in the
-  # expansion.
-  for file in `sed -n "
-    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
-    # Make sure the directory exists.
-    test -f "$dirpart/$file" && continue
-    fdir=`AS_DIRNAME(["$file"])`
-    AS_MKDIR_P([$dirpart/$fdir])
-    # echo "creating $dirpart/$file"
-    echo '# dummy' > "$dirpart/$file"
+[{
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named `Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`AS_DIRNAME("$mf")`
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running `make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # When using ansi2knr, U may be empty or an underscore; expand it
+    U=`sed -n 's/^U = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`AS_DIRNAME(["$file"])`
+      AS_MKDIR_P([$dirpart/$fdir])
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
+    done
   done
-done
+}
 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
 
 
@@ -382,13 +9010,13 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 # Do all the work for Automake.                             -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008 Free Software Foundation, Inc.
+# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 13
+# serial 16
 
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
@@ -405,7 +9033,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 # arguments mandatory, and then we can depend on a new Autoconf
 # release and drop the old call support.
 AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.60])dnl
+[AC_PREREQ([2.62])dnl
 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
 dnl the ones we care about.
 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
@@ -456,8 +9084,8 @@ AM_MISSING_PROG(AUTOCONF, autoconf)
 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
 AM_MISSING_PROG(AUTOHEADER, autoheader)
 AM_MISSING_PROG(MAKEINFO, makeinfo)
-AM_PROG_INSTALL_SH
-AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
 AC_REQUIRE([AM_PROG_MKDIR_P])dnl
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
@@ -465,24 +9093,37 @@ AC_REQUIRE([AC_PROG_AWK])dnl
 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
 _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
-              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
-	      		     [_AM_PROG_TAR([v7])])])
+	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+			     [_AM_PROG_TAR([v7])])])
 _AM_IF_OPTION([no-dependencies],,
 [AC_PROVIDE_IFELSE([AC_PROG_CC],
-                  [_AM_DEPENDENCIES(CC)],
-                  [define([AC_PROG_CC],
-                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+		  [_AM_DEPENDENCIES(CC)],
+		  [define([AC_PROG_CC],
+			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_CXX],
-                  [_AM_DEPENDENCIES(CXX)],
-                  [define([AC_PROG_CXX],
-                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+		  [_AM_DEPENDENCIES(CXX)],
+		  [define([AC_PROG_CXX],
+			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
-                  [_AM_DEPENDENCIES(OBJC)],
-                  [define([AC_PROG_OBJC],
-                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+		  [_AM_DEPENDENCIES(OBJC)],
+		  [define([AC_PROG_OBJC],
+			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
 ])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
 ])
 
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
 
 # When config.status generates a header, we must update the stamp-h file.
 # This file resides in the same directory as the config header
@@ -505,18 +9146,28 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
+# Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_PROG_INSTALL_SH
 # ------------------
 # Define $install_sh.
 AC_DEFUN([AM_PROG_INSTALL_SH],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
 AC_SUBST(install_sh)])
 
 # Copyright (C) 2003, 2005  Free Software Foundation, Inc.
@@ -542,13 +9193,13 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 3
+# serial 4
 
 # AM_MAKE_INCLUDE()
 # -----------------
@@ -557,7 +9208,7 @@ AC_DEFUN([AM_MAKE_INCLUDE],
 [am_make=${MAKE-make}
 cat > confinc << 'END'
 am__doit:
-	@echo done
+	@echo this is the am__doit target
 .PHONY: am__doit
 END
 # If we don't find an include directive, just comment out the code.
@@ -567,24 +9218,24 @@ am__quote=
 _am_result=none
 # First try GNU make style include.
 echo "include confinc" > confmf
-# We grep out `Entering directory' and `Leaving directory'
-# messages which can occur if `w' ends up in MAKEFLAGS.
-# In particular we don't look at `^make:' because GNU make might
-# be invoked under some other name (usually "gmake"), in which
-# case it prints its new name instead of `make'.
-if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
-   am__include=include
-   am__quote=
-   _am_result=GNU
-fi
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
+esac
 # Now try BSD make style include.
 if test "$am__include" = "#"; then
    echo '.include "confinc"' > confmf
-   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
-      am__include=.include
-      am__quote="\""
-      _am_result=BSD
-   fi
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
 fi
 AC_SUBST([am__include])
 AC_SUBST([am__quote])
@@ -594,14 +9245,14 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
+# serial 6
 
 # AM_MISSING_PROG(NAME, PROGRAM)
 # ------------------------------
@@ -618,7 +9269,14 @@ AC_SUBST($1)])
 AC_DEFUN([AM_MISSING_HAS_RUN],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
 AC_REQUIRE_AUX_FILE([missing])dnl
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
 # Use eval to expand $SHELL
 if eval "$MISSING --run true"; then
   am_missing_run="$MISSING --run "
@@ -628,12 +9286,15 @@ else
 fi
 ])
 
-# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
+# Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_PROG_MKDIR_P
 # ---------------
 # Check for `mkdir -p'.
@@ -656,13 +9317,14 @@ esac
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
+# Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
+# serial 5
 
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
@@ -670,13 +9332,13 @@ AC_DEFUN([_AM_MANGLE_OPTION],
 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
 
 # _AM_SET_OPTION(NAME)
-# ------------------------------
+# --------------------
 # Set option NAME.  Presently that only means defining a flag for this option.
 AC_DEFUN([_AM_SET_OPTION],
 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
 
 # _AM_SET_OPTIONS(OPTIONS)
-# ----------------------------------
+# ------------------------
 # OPTIONS is a space-separated list of Automake options.
 AC_DEFUN([_AM_SET_OPTIONS],
 [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
@@ -689,14 +9351,14 @@ AC_DEFUN([_AM_IF_OPTION],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
+# serial 5
 
 # AM_SANITY_CHECK
 # ---------------
@@ -705,16 +9367,29 @@ AC_DEFUN([AM_SANITY_CHECK],
 # Just in case
 sleep 1
 echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[[\\\"\#\$\&\'\`$am_lf]]*)
+    AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
+    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
 # Do `set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
    if test "$[*]" = "X"; then
       # -L didn't work.
-      set X `ls -t $srcdir/configure conftest.file`
+      set X `ls -t "$srcdir/configure" conftest.file`
    fi
    rm -f conftest.file
    if test "$[*]" != "X $srcdir/configure conftest.file" \
@@ -739,12 +9414,14 @@ Check your system clock])
 fi
 AC_MSG_RESULT(yes)])
 
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_PROG_INSTALL_STRIP
 # ---------------------
 # One issue with vendor `install' (even GNU) is that you can't
@@ -767,21 +9444,28 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 3
+
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
 # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
 # This macro is traced by Automake.
 AC_DEFUN([_AM_SUBST_NOTMAKE])
 
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -803,10 +9487,11 @@ AC_DEFUN([_AM_SUBST_NOTMAKE])
 # a tarball read from stdin.
 #     $(am__untar) < result.tar
 AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility.
-AM_MISSING_PROG([AMTAR], [tar])
+[# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
 m4_if([$1], [v7],
-     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
      [m4_case([$1], [ustar],, [pax],,
               [m4_fatal([Unknown tar format])])
 AC_MSG_CHECKING([how to create a $1 tar archive])
@@ -875,9 +9560,4 @@ AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
-m4_include([config/libtool.m4])
-m4_include([config/ltoptions.m4])
-m4_include([config/ltsugar.m4])
-m4_include([config/ltversion.m4])
-m4_include([config/lt~obsolete.m4])
 m4_include([config/osmvsel.m4])
diff --git a/complib/Makefile.am b/complib/Makefile.am
index 6f2f203..3ee90e8 100644
--- a/complib/Makefile.am
+++ b/complib/Makefile.am
@@ -70,11 +70,6 @@ libosmcompinclude_HEADERS = $(srcdir)/../include/complib/cl_atomic.h \
 	$(srcdir)/../include/complib/cl_timer_osd.h \
 	$(srcdir)/../include/complib/cl_types.h \
 	$(srcdir)/../include/complib/cl_types_osd.h \
-	$(srcdir)/../include/complib/cl_threadpool.h \
-	$(srcdir)/../include/complib/cl_timer.h \
-	$(srcdir)/../include/complib/cl_timer_osd.h \
-	$(srcdir)/../include/complib/cl_types.h \
-	$(srcdir)/../include/complib/cl_types_osd.h \
 	$(srcdir)/../include/complib/cl_vector.h
 
 # headers are distributed as part of the include dir
diff --git a/complib/Makefile.in b/complib/Makefile.in
index e2e4bf3..5bb147a 100644
--- a/complib/Makefile.in
+++ b/complib/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -17,8 +18,9 @@
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -37,27 +39,44 @@ subdir = complib
 DIST_COMMON = $(libosmcompinclude_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in ChangeLog
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
-	$(top_srcdir)/config/ltoptions.m4 \
-	$(top_srcdir)/config/ltsugar.m4 \
-	$(top_srcdir)/config/ltversion.m4 \
-	$(top_srcdir)/config/lt~obsolete.m4 \
-	$(top_srcdir)/config/osmvsel.m4 $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/osmvsel.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/include/config.h \
 	$(top_builddir)/include/opensm/osm_config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(libdir)" \
 	"$(DESTDIR)$(libosmcompincludedir)"
-libLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(lib_LTLIBRARIES)
 libosmcomp_la_LIBADD =
 am_libosmcomp_la_OBJECTS = libosmcomp_la-cl_complib.lo \
@@ -76,6 +95,7 @@ libosmcomp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/include -I$(top_builddir)/include/opensm
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
+am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
@@ -87,7 +107,6 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(libosmcomp_la_SOURCES)
 DIST_SOURCES = $(libosmcomp_la_SOURCES)
-libosmcompincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(libosmcompinclude_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -108,6 +127,7 @@ CYGPATH_W = @CYGPATH_W@
 DEFAULT_EVENT_PLUGIN = @DEFAULT_EVENT_PLUGIN@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -134,6 +154,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -152,9 +173,11 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PARTITION_CONFIG_FILE = @PARTITION_CONFIG_FILE@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PER_MOD_LOGGING_FILE = @PER_MOD_LOGGING_FILE@
 PREFIX_ROUTES_FILE = @PREFIX_ROUTES_FILE@
 QOS_POLICY_FILE = @QOS_POLICY_FILE@
 RANLIB = @RANLIB@
@@ -164,6 +187,7 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
 TARBALL = @TARBALL@
+TORUS2QOS_CONF_FILE = @TORUS2QOS_CONF_FILE@
 VERSION = @VERSION@
 YACC = @YACC@
 YFLAGS = @YFLAGS@
@@ -173,6 +197,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -205,7 +230,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -279,11 +303,6 @@ libosmcompinclude_HEADERS = $(srcdir)/../include/complib/cl_atomic.h \
 	$(srcdir)/../include/complib/cl_timer_osd.h \
 	$(srcdir)/../include/complib/cl_types.h \
 	$(srcdir)/../include/complib/cl_types_osd.h \
-	$(srcdir)/../include/complib/cl_threadpool.h \
-	$(srcdir)/../include/complib/cl_timer.h \
-	$(srcdir)/../include/complib/cl_timer_osd.h \
-	$(srcdir)/../include/complib/cl_types.h \
-	$(srcdir)/../include/complib/cl_types_osd.h \
 	$(srcdir)/../include/complib/cl_vector.h
 
 
@@ -302,9 +321,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  complib/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  complib/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign complib/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign complib/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -322,23 +341,28 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
 	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
-	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	list2=; for p in $$list; do \
 	  if test -f $$p; then \
-	    f=$(am__strip_dir) \
-	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
-	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	    list2="$$list2 $$p"; \
 	  else :; fi; \
-	done
+	done; \
+	test -z "$$list2" || { \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+	}
 
 uninstall-libLTLIBRARIES:
 	@$(NORMAL_UNINSTALL)
-	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
-	  p=$(am__strip_dir) \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	for p in $$list; do \
+	  $(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
 	done
 
 clean-libLTLIBRARIES:
@@ -349,7 +373,7 @@ clean-libLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libosmcomp.la: $(libosmcomp_la_OBJECTS) $(libosmcomp_la_DEPENDENCIES) 
+libosmcomp.la: $(libosmcomp_la_OBJECTS) $(libosmcomp_la_DEPENDENCIES) $(EXTRA_libosmcomp_la_DEPENDENCIES) 
 	$(libosmcomp_la_LINK) -rpath $(libdir) $(libosmcomp_la_OBJECTS) $(libosmcomp_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -378,143 +402,143 @@ distclean-compile:
 
 .c.o:
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 
 .c.lo:
 @am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
 libosmcomp_la-cl_complib.lo: cl_complib.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_complib.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_complib.Tpo -c -o libosmcomp_la-cl_complib.lo `test -f 'cl_complib.c' || echo '$(srcdir)/'`cl_complib.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_complib.Tpo $(DEPDIR)/libosmcomp_la-cl_complib.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_complib.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_complib.Tpo -c -o libosmcomp_la-cl_complib.lo `test -f 'cl_complib.c' || echo '$(srcdir)/'`cl_complib.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_complib.Tpo $(DEPDIR)/libosmcomp_la-cl_complib.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_complib.c' object='libosmcomp_la-cl_complib.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_complib.lo `test -f 'cl_complib.c' || echo '$(srcdir)/'`cl_complib.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_complib.lo `test -f 'cl_complib.c' || echo '$(srcdir)/'`cl_complib.c
 
 libosmcomp_la-cl_dispatcher.lo: cl_dispatcher.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_dispatcher.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_dispatcher.Tpo -c -o libosmcomp_la-cl_dispatcher.lo `test -f 'cl_dispatcher.c' || echo '$(srcdir)/'`cl_dispatcher.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_dispatcher.Tpo $(DEPDIR)/libosmcomp_la-cl_dispatcher.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_dispatcher.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_dispatcher.Tpo -c -o libosmcomp_la-cl_dispatcher.lo `test -f 'cl_dispatcher.c' || echo '$(srcdir)/'`cl_dispatcher.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_dispatcher.Tpo $(DEPDIR)/libosmcomp_la-cl_dispatcher.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_dispatcher.c' object='libosmcomp_la-cl_dispatcher.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_dispatcher.lo `test -f 'cl_dispatcher.c' || echo '$(srcdir)/'`cl_dispatcher.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_dispatcher.lo `test -f 'cl_dispatcher.c' || echo '$(srcdir)/'`cl_dispatcher.c
 
 libosmcomp_la-cl_event.lo: cl_event.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_event.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_event.Tpo -c -o libosmcomp_la-cl_event.lo `test -f 'cl_event.c' || echo '$(srcdir)/'`cl_event.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_event.Tpo $(DEPDIR)/libosmcomp_la-cl_event.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_event.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_event.Tpo -c -o libosmcomp_la-cl_event.lo `test -f 'cl_event.c' || echo '$(srcdir)/'`cl_event.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_event.Tpo $(DEPDIR)/libosmcomp_la-cl_event.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_event.c' object='libosmcomp_la-cl_event.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_event.lo `test -f 'cl_event.c' || echo '$(srcdir)/'`cl_event.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_event.lo `test -f 'cl_event.c' || echo '$(srcdir)/'`cl_event.c
 
 libosmcomp_la-cl_event_wheel.lo: cl_event_wheel.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_event_wheel.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_event_wheel.Tpo -c -o libosmcomp_la-cl_event_wheel.lo `test -f 'cl_event_wheel.c' || echo '$(srcdir)/'`cl_event_wheel.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_event_wheel.Tpo $(DEPDIR)/libosmcomp_la-cl_event_wheel.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_event_wheel.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_event_wheel.Tpo -c -o libosmcomp_la-cl_event_wheel.lo `test -f 'cl_event_wheel.c' || echo '$(srcdir)/'`cl_event_wheel.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_event_wheel.Tpo $(DEPDIR)/libosmcomp_la-cl_event_wheel.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_event_wheel.c' object='libosmcomp_la-cl_event_wheel.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_event_wheel.lo `test -f 'cl_event_wheel.c' || echo '$(srcdir)/'`cl_event_wheel.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_event_wheel.lo `test -f 'cl_event_wheel.c' || echo '$(srcdir)/'`cl_event_wheel.c
 
 libosmcomp_la-cl_list.lo: cl_list.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_list.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_list.Tpo -c -o libosmcomp_la-cl_list.lo `test -f 'cl_list.c' || echo '$(srcdir)/'`cl_list.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_list.Tpo $(DEPDIR)/libosmcomp_la-cl_list.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_list.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_list.Tpo -c -o libosmcomp_la-cl_list.lo `test -f 'cl_list.c' || echo '$(srcdir)/'`cl_list.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_list.Tpo $(DEPDIR)/libosmcomp_la-cl_list.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_list.c' object='libosmcomp_la-cl_list.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_list.lo `test -f 'cl_list.c' || echo '$(srcdir)/'`cl_list.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_list.lo `test -f 'cl_list.c' || echo '$(srcdir)/'`cl_list.c
 
 libosmcomp_la-cl_log.lo: cl_log.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_log.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_log.Tpo -c -o libosmcomp_la-cl_log.lo `test -f 'cl_log.c' || echo '$(srcdir)/'`cl_log.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_log.Tpo $(DEPDIR)/libosmcomp_la-cl_log.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_log.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_log.Tpo -c -o libosmcomp_la-cl_log.lo `test -f 'cl_log.c' || echo '$(srcdir)/'`cl_log.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_log.Tpo $(DEPDIR)/libosmcomp_la-cl_log.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_log.c' object='libosmcomp_la-cl_log.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_log.lo `test -f 'cl_log.c' || echo '$(srcdir)/'`cl_log.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_log.lo `test -f 'cl_log.c' || echo '$(srcdir)/'`cl_log.c
 
 libosmcomp_la-cl_map.lo: cl_map.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_map.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_map.Tpo -c -o libosmcomp_la-cl_map.lo `test -f 'cl_map.c' || echo '$(srcdir)/'`cl_map.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_map.Tpo $(DEPDIR)/libosmcomp_la-cl_map.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_map.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_map.Tpo -c -o libosmcomp_la-cl_map.lo `test -f 'cl_map.c' || echo '$(srcdir)/'`cl_map.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_map.Tpo $(DEPDIR)/libosmcomp_la-cl_map.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_map.c' object='libosmcomp_la-cl_map.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_map.lo `test -f 'cl_map.c' || echo '$(srcdir)/'`cl_map.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_map.lo `test -f 'cl_map.c' || echo '$(srcdir)/'`cl_map.c
 
 libosmcomp_la-cl_pool.lo: cl_pool.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_pool.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_pool.Tpo -c -o libosmcomp_la-cl_pool.lo `test -f 'cl_pool.c' || echo '$(srcdir)/'`cl_pool.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_pool.Tpo $(DEPDIR)/libosmcomp_la-cl_pool.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_pool.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_pool.Tpo -c -o libosmcomp_la-cl_pool.lo `test -f 'cl_pool.c' || echo '$(srcdir)/'`cl_pool.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_pool.Tpo $(DEPDIR)/libosmcomp_la-cl_pool.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_pool.c' object='libosmcomp_la-cl_pool.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_pool.lo `test -f 'cl_pool.c' || echo '$(srcdir)/'`cl_pool.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_pool.lo `test -f 'cl_pool.c' || echo '$(srcdir)/'`cl_pool.c
 
 libosmcomp_la-cl_ptr_vector.lo: cl_ptr_vector.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_ptr_vector.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_ptr_vector.Tpo -c -o libosmcomp_la-cl_ptr_vector.lo `test -f 'cl_ptr_vector.c' || echo '$(srcdir)/'`cl_ptr_vector.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_ptr_vector.Tpo $(DEPDIR)/libosmcomp_la-cl_ptr_vector.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_ptr_vector.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_ptr_vector.Tpo -c -o libosmcomp_la-cl_ptr_vector.lo `test -f 'cl_ptr_vector.c' || echo '$(srcdir)/'`cl_ptr_vector.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_ptr_vector.Tpo $(DEPDIR)/libosmcomp_la-cl_ptr_vector.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_ptr_vector.c' object='libosmcomp_la-cl_ptr_vector.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_ptr_vector.lo `test -f 'cl_ptr_vector.c' || echo '$(srcdir)/'`cl_ptr_vector.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_ptr_vector.lo `test -f 'cl_ptr_vector.c' || echo '$(srcdir)/'`cl_ptr_vector.c
 
 libosmcomp_la-cl_spinlock.lo: cl_spinlock.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_spinlock.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_spinlock.Tpo -c -o libosmcomp_la-cl_spinlock.lo `test -f 'cl_spinlock.c' || echo '$(srcdir)/'`cl_spinlock.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_spinlock.Tpo $(DEPDIR)/libosmcomp_la-cl_spinlock.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_spinlock.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_spinlock.Tpo -c -o libosmcomp_la-cl_spinlock.lo `test -f 'cl_spinlock.c' || echo '$(srcdir)/'`cl_spinlock.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_spinlock.Tpo $(DEPDIR)/libosmcomp_la-cl_spinlock.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_spinlock.c' object='libosmcomp_la-cl_spinlock.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_spinlock.lo `test -f 'cl_spinlock.c' || echo '$(srcdir)/'`cl_spinlock.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_spinlock.lo `test -f 'cl_spinlock.c' || echo '$(srcdir)/'`cl_spinlock.c
 
 libosmcomp_la-cl_statustext.lo: cl_statustext.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_statustext.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_statustext.Tpo -c -o libosmcomp_la-cl_statustext.lo `test -f 'cl_statustext.c' || echo '$(srcdir)/'`cl_statustext.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_statustext.Tpo $(DEPDIR)/libosmcomp_la-cl_statustext.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_statustext.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_statustext.Tpo -c -o libosmcomp_la-cl_statustext.lo `test -f 'cl_statustext.c' || echo '$(srcdir)/'`cl_statustext.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_statustext.Tpo $(DEPDIR)/libosmcomp_la-cl_statustext.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_statustext.c' object='libosmcomp_la-cl_statustext.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_statustext.lo `test -f 'cl_statustext.c' || echo '$(srcdir)/'`cl_statustext.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_statustext.lo `test -f 'cl_statustext.c' || echo '$(srcdir)/'`cl_statustext.c
 
 libosmcomp_la-cl_thread.lo: cl_thread.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_thread.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_thread.Tpo -c -o libosmcomp_la-cl_thread.lo `test -f 'cl_thread.c' || echo '$(srcdir)/'`cl_thread.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_thread.Tpo $(DEPDIR)/libosmcomp_la-cl_thread.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_thread.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_thread.Tpo -c -o libosmcomp_la-cl_thread.lo `test -f 'cl_thread.c' || echo '$(srcdir)/'`cl_thread.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_thread.Tpo $(DEPDIR)/libosmcomp_la-cl_thread.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_thread.c' object='libosmcomp_la-cl_thread.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_thread.lo `test -f 'cl_thread.c' || echo '$(srcdir)/'`cl_thread.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_thread.lo `test -f 'cl_thread.c' || echo '$(srcdir)/'`cl_thread.c
 
 libosmcomp_la-cl_threadpool.lo: cl_threadpool.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_threadpool.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_threadpool.Tpo -c -o libosmcomp_la-cl_threadpool.lo `test -f 'cl_threadpool.c' || echo '$(srcdir)/'`cl_threadpool.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_threadpool.Tpo $(DEPDIR)/libosmcomp_la-cl_threadpool.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_threadpool.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_threadpool.Tpo -c -o libosmcomp_la-cl_threadpool.lo `test -f 'cl_threadpool.c' || echo '$(srcdir)/'`cl_threadpool.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_threadpool.Tpo $(DEPDIR)/libosmcomp_la-cl_threadpool.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_threadpool.c' object='libosmcomp_la-cl_threadpool.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_threadpool.lo `test -f 'cl_threadpool.c' || echo '$(srcdir)/'`cl_threadpool.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_threadpool.lo `test -f 'cl_threadpool.c' || echo '$(srcdir)/'`cl_threadpool.c
 
 libosmcomp_la-cl_timer.lo: cl_timer.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_timer.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_timer.Tpo -c -o libosmcomp_la-cl_timer.lo `test -f 'cl_timer.c' || echo '$(srcdir)/'`cl_timer.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_timer.Tpo $(DEPDIR)/libosmcomp_la-cl_timer.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_timer.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_timer.Tpo -c -o libosmcomp_la-cl_timer.lo `test -f 'cl_timer.c' || echo '$(srcdir)/'`cl_timer.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_timer.Tpo $(DEPDIR)/libosmcomp_la-cl_timer.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_timer.c' object='libosmcomp_la-cl_timer.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_timer.lo `test -f 'cl_timer.c' || echo '$(srcdir)/'`cl_timer.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_timer.lo `test -f 'cl_timer.c' || echo '$(srcdir)/'`cl_timer.c
 
 libosmcomp_la-cl_vector.lo: cl_vector.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_vector.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_vector.Tpo -c -o libosmcomp_la-cl_vector.lo `test -f 'cl_vector.c' || echo '$(srcdir)/'`cl_vector.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_vector.Tpo $(DEPDIR)/libosmcomp_la-cl_vector.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_vector.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_vector.Tpo -c -o libosmcomp_la-cl_vector.lo `test -f 'cl_vector.c' || echo '$(srcdir)/'`cl_vector.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_vector.Tpo $(DEPDIR)/libosmcomp_la-cl_vector.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_vector.c' object='libosmcomp_la-cl_vector.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_vector.lo `test -f 'cl_vector.c' || echo '$(srcdir)/'`cl_vector.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_vector.lo `test -f 'cl_vector.c' || echo '$(srcdir)/'`cl_vector.c
 
 libosmcomp_la-ib_statustext.lo: ib_statustext.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-ib_statustext.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-ib_statustext.Tpo -c -o libosmcomp_la-ib_statustext.lo `test -f 'ib_statustext.c' || echo '$(srcdir)/'`ib_statustext.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-ib_statustext.Tpo $(DEPDIR)/libosmcomp_la-ib_statustext.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-ib_statustext.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-ib_statustext.Tpo -c -o libosmcomp_la-ib_statustext.lo `test -f 'ib_statustext.c' || echo '$(srcdir)/'`ib_statustext.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-ib_statustext.Tpo $(DEPDIR)/libosmcomp_la-ib_statustext.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='ib_statustext.c' object='libosmcomp_la-ib_statustext.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-ib_statustext.lo `test -f 'ib_statustext.c' || echo '$(srcdir)/'`ib_statustext.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-ib_statustext.lo `test -f 'ib_statustext.c' || echo '$(srcdir)/'`ib_statustext.c
 
 libosmcomp_la-cl_nodenamemap.lo: cl_nodenamemap.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_nodenamemap.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_nodenamemap.Tpo -c -o libosmcomp_la-cl_nodenamemap.lo `test -f 'cl_nodenamemap.c' || echo '$(srcdir)/'`cl_nodenamemap.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmcomp_la-cl_nodenamemap.Tpo $(DEPDIR)/libosmcomp_la-cl_nodenamemap.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -MT libosmcomp_la-cl_nodenamemap.lo -MD -MP -MF $(DEPDIR)/libosmcomp_la-cl_nodenamemap.Tpo -c -o libosmcomp_la-cl_nodenamemap.lo `test -f 'cl_nodenamemap.c' || echo '$(srcdir)/'`cl_nodenamemap.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmcomp_la-cl_nodenamemap.Tpo $(DEPDIR)/libosmcomp_la-cl_nodenamemap.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='cl_nodenamemap.c' object='libosmcomp_la-cl_nodenamemap.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_nodenamemap.lo `test -f 'cl_nodenamemap.c' || echo '$(srcdir)/'`cl_nodenamemap.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmcomp_la_CFLAGS) $(CFLAGS) -c -o libosmcomp_la-cl_nodenamemap.lo `test -f 'cl_nodenamemap.c' || echo '$(srcdir)/'`cl_nodenamemap.c
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -524,20 +548,21 @@ clean-libtool:
 install-libosmcompincludeHEADERS: $(libosmcompinclude_HEADERS)
 	@$(NORMAL_INSTALL)
 	test -z "$(libosmcompincludedir)" || $(MKDIR_P) "$(DESTDIR)$(libosmcompincludedir)"
-	@list='$(libosmcompinclude_HEADERS)'; for p in $$list; do \
+	@list='$(libosmcompinclude_HEADERS)'; test -n "$(libosmcompincludedir)" || list=; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(libosmcompincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libosmcompincludedir)/$$f'"; \
-	  $(libosmcompincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libosmcompincludedir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libosmcompincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(libosmcompincludedir)" || exit $$?; \
 	done
 
 uninstall-libosmcompincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(libosmcompinclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(libosmcompincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(libosmcompincludedir)/$$f"; \
-	done
+	@list='$(libosmcompinclude_HEADERS)'; test -n "$(libosmcompincludedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(libosmcompincludedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -551,7 +576,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -559,29 +584,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -602,13 +632,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -629,16 +663,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -660,6 +700,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -668,18 +710,28 @@ install-data-am: install-libosmcompincludeHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am: install-libLTLIBRARIES
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
@@ -721,6 +773,7 @@ uninstall-am: uninstall-libLTLIBRARIES \
 	uninstall-am uninstall-libLTLIBRARIES \
 	uninstall-libosmcompincludeHEADERS
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/complib/cl_complib.c b/complib/cl_complib.c
index 2449d9d..286306d 100644
--- a/complib/cl_complib.c
+++ b/complib/cl_complib.c
@@ -49,11 +49,9 @@
  *  Prototypes
  */
 
-extern
- cl_status_t __cl_timer_prov_create(void);
+extern cl_status_t __cl_timer_prov_create(void);
 
-extern
-void __cl_timer_prov_destroy(void);
+extern void __cl_timer_prov_destroy(void);
 
 cl_spinlock_t cl_atomic_spinlock;
 
diff --git a/complib/cl_dispatcher.c b/complib/cl_dispatcher.c
index b0a0a76..6736d67 100644
--- a/complib/cl_dispatcher.c
+++ b/complib/cl_dispatcher.c
@@ -118,8 +118,6 @@ void __cl_disp_worker(IN void *context)
 	cl_spinlock_release(&p_disp->lock);
 }
 
-/********************************************************************
- ********************************************************************/
 void cl_disp_construct(IN cl_dispatcher_t * const p_disp)
 {
 	CL_ASSERT(p_disp);
@@ -131,8 +129,6 @@ void cl_disp_construct(IN cl_dispatcher_t * const p_disp)
 	cl_qpool_construct(&p_disp->msg_pool);
 }
 
-/********************************************************************
- ********************************************************************/
 void cl_disp_shutdown(IN cl_dispatcher_t * const p_disp)
 {
 	CL_ASSERT(p_disp);
@@ -148,8 +144,6 @@ void cl_disp_shutdown(IN cl_dispatcher_t * const p_disp)
 		free(cl_qlist_remove_head(&p_disp->reg_list));
 }
 
-/********************************************************************
- ********************************************************************/
 void cl_disp_destroy(IN cl_dispatcher_t * const p_disp)
 {
 	CL_ASSERT(p_disp);
@@ -161,11 +155,9 @@ void cl_disp_destroy(IN cl_dispatcher_t * const p_disp)
 	cl_ptr_vector_destroy(&p_disp->reg_vec);
 }
 
-/********************************************************************
- ********************************************************************/
-cl_status_t
-cl_disp_init(IN cl_dispatcher_t * const p_disp,
-	     IN const uint32_t thread_count, IN const char *const name)
+cl_status_t cl_disp_init(IN cl_dispatcher_t * const p_disp,
+			 IN const uint32_t thread_count,
+			 IN const char *const name)
 {
 	cl_status_t status;
 
@@ -203,13 +195,11 @@ cl_disp_init(IN cl_dispatcher_t * const p_disp,
 	return (status);
 }
 
-/********************************************************************
- ********************************************************************/
-cl_disp_reg_handle_t
-cl_disp_register(IN cl_dispatcher_t * const p_disp,
-		 IN const cl_disp_msgid_t msg_id,
-		 IN cl_pfn_msgrcv_cb_t pfn_callback OPTIONAL,
-		 IN const void *const context OPTIONAL)
+cl_disp_reg_handle_t cl_disp_register(IN cl_dispatcher_t * const p_disp,
+				      IN const cl_disp_msgid_t msg_id,
+				      IN cl_pfn_msgrcv_cb_t pfn_callback
+				      OPTIONAL,
+				      IN const void *const context OPTIONAL)
 {
 	cl_disp_reg_info_t *p_reg;
 	cl_status_t status;
@@ -259,8 +249,6 @@ cl_disp_register(IN cl_dispatcher_t * const p_disp,
 	return (p_reg);
 }
 
-/********************************************************************
- ********************************************************************/
 void cl_disp_unregister(IN const cl_disp_reg_handle_t handle)
 {
 	cl_disp_reg_info_t *p_reg;
@@ -297,14 +285,11 @@ void cl_disp_unregister(IN const cl_disp_reg_handle_t handle)
 	cl_spinlock_release(&p_disp->lock);
 }
 
-/********************************************************************
- ********************************************************************/
-cl_status_t
-cl_disp_post(IN const cl_disp_reg_handle_t handle,
-	     IN const cl_disp_msgid_t msg_id,
-	     IN const void *const p_data,
-	     IN cl_pfn_msgdone_cb_t pfn_callback OPTIONAL,
-	     IN const void *const context OPTIONAL)
+cl_status_t cl_disp_post(IN const cl_disp_reg_handle_t handle,
+			 IN const cl_disp_msgid_t msg_id,
+			 IN const void *const p_data,
+			 IN cl_pfn_msgdone_cb_t pfn_callback OPTIONAL,
+			 IN const void *const context OPTIONAL)
 {
 	cl_disp_reg_info_t *p_src_reg = (cl_disp_reg_info_t *) handle;
 	cl_disp_reg_info_t *p_dest_reg;
@@ -357,10 +342,9 @@ cl_disp_post(IN const cl_disp_reg_handle_t handle,
 	return (CL_SUCCESS);
 }
 
-void
-cl_disp_get_queue_status(IN const cl_disp_reg_handle_t handle,
-			 OUT uint32_t * p_num_queued_msgs,
-			 OUT uint64_t * p_last_msg_queue_time_ms)
+void cl_disp_get_queue_status(IN const cl_disp_reg_handle_t handle,
+			      OUT uint32_t * p_num_queued_msgs,
+			      OUT uint64_t * p_last_msg_queue_time_ms)
 {
 	cl_dispatcher_t *p_disp = ((cl_disp_reg_info_t *) handle)->p_disp;
 
diff --git a/complib/cl_event.c b/complib/cl_event.c
index d14b2f4..27b4ae5 100644
--- a/complib/cl_event.c
+++ b/complib/cl_event.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -49,8 +49,8 @@ void cl_event_construct(IN cl_event_t * p_event)
 	p_event->state = CL_UNINITIALIZED;
 }
 
-cl_status_t
-cl_event_init(IN cl_event_t * const p_event, IN const boolean_t manual_reset)
+cl_status_t cl_event_init(IN cl_event_t * const p_event,
+			  IN const boolean_t manual_reset)
 {
 	CL_ASSERT(p_event);
 
@@ -62,7 +62,7 @@ cl_event_init(IN cl_event_t * const p_event, IN const boolean_t manual_reset)
 	p_event->manual_reset = manual_reset;
 	p_event->state = CL_INITIALIZED;
 
-	return (CL_SUCCESS);
+	return CL_SUCCESS;
 }
 
 void cl_event_destroy(IN cl_event_t * const p_event)
@@ -94,7 +94,7 @@ cl_status_t cl_event_signal(IN cl_event_t * const p_event)
 
 	pthread_mutex_unlock(&p_event->mutex);
 
-	return (CL_SUCCESS);
+	return CL_SUCCESS;
 }
 
 cl_status_t cl_event_reset(IN cl_event_t * const p_event)
@@ -106,12 +106,12 @@ cl_status_t cl_event_reset(IN cl_event_t * const p_event)
 	p_event->signaled = FALSE;
 	pthread_mutex_unlock(&p_event->mutex);
 
-	return (CL_SUCCESS);
+	return CL_SUCCESS;
 }
 
-cl_status_t
-cl_event_wait_on(IN cl_event_t * const p_event,
-		 IN const uint32_t wait_us, IN const boolean_t interruptible)
+cl_status_t cl_event_wait_on(IN cl_event_t * const p_event,
+			     IN const uint32_t wait_us,
+			     IN const boolean_t interruptible)
 {
 	cl_status_t status;
 	int wait_ret;
@@ -129,28 +129,29 @@ cl_event_wait_on(IN cl_event_t * const p_event,
 			p_event->signaled = FALSE;
 
 		pthread_mutex_unlock(&p_event->mutex);
-		return (CL_SUCCESS);
+		return CL_SUCCESS;
 	}
 
 	/* If just testing the state, return CL_TIMEOUT. */
 	if (wait_us == 0) {
 		pthread_mutex_unlock(&p_event->mutex);
-		return (CL_TIMEOUT);
+		return CL_TIMEOUT;
 	}
 
 	if (wait_us == EVENT_NO_TIMEOUT) {
 		/* Wait for condition variable to be signaled or broadcast. */
-		if (pthread_cond_wait
-		    (&p_event->condvar, &p_event->mutex))
+		if (pthread_cond_wait(&p_event->condvar, &p_event->mutex))
 			status = CL_NOT_DONE;
 		else
 			status = CL_SUCCESS;
 	} else {
 		/* Get the current time */
 		if (gettimeofday(&curtime, NULL) == 0) {
-			timeout.tv_sec = curtime.tv_sec + (wait_us / 1000000);
-			timeout.tv_nsec =
+			unsigned long n_sec =
 			    (curtime.tv_usec + (wait_us % 1000000)) * 1000;
+			timeout.tv_sec = curtime.tv_sec + (wait_us / 1000000)
+			    + (n_sec / 1000000000);
+			timeout.tv_nsec = n_sec % 1000000000;
 
 			wait_ret = pthread_cond_timedwait(&p_event->condvar,
 							  &p_event->mutex,
@@ -163,13 +164,12 @@ cl_event_wait_on(IN cl_event_t * const p_event,
 				status = CL_TIMEOUT;
 			else
 				status = CL_NOT_DONE;
-		} else {
+		} else
 			status = CL_ERROR;
-		}
 	}
 	if (!p_event->manual_reset)
 		p_event->signaled = FALSE;
 
 	pthread_mutex_unlock(&p_event->mutex);
-	return (status);
+	return status;
 }
diff --git a/complib/cl_event_wheel.c b/complib/cl_event_wheel.c
index ca06882..2557c40 100644
--- a/complib/cl_event_wheel.c
+++ b/complib/cl_event_wheel.c
@@ -42,11 +42,10 @@
 #include <complib/cl_event_wheel.h>
 #include <complib/cl_debug.h>
 
-#define CL_DBG(fmt, arg...)
+#define CL_DBG(fmt, ...)
 
-static cl_status_t
-__event_will_age_before(IN const cl_list_item_t * const p_list_item,
-			IN void *context)
+static cl_status_t __event_will_age_before(IN const cl_list_item_t *
+					   const p_list_item, IN void *context)
 {
 	uint64_t aging_time = *((uint64_t *) context);
 	cl_event_wheel_reg_info_t *p_event;
@@ -195,8 +194,7 @@ void cl_event_wheel_construct(IN cl_event_wheel_t * const p_event_wheel)
 	cl_timer_construct(&(p_event_wheel->timer));
 }
 
-cl_status_t
-cl_event_wheel_init(IN cl_event_wheel_t * const p_event_wheel)
+cl_status_t cl_event_wheel_init(IN cl_event_wheel_t * const p_event_wheel)
 {
 	cl_status_t cl_status = CL_SUCCESS;
 
@@ -215,9 +213,8 @@ cl_event_wheel_init(IN cl_event_wheel_t * const p_event_wheel)
 	return cl_status;
 }
 
-cl_status_t
-cl_event_wheel_init_ex(IN cl_event_wheel_t * const p_event_wheel,
-		       IN cl_spinlock_t * p_external_lock)
+cl_status_t cl_event_wheel_init_ex(IN cl_event_wheel_t * const p_event_wheel,
+				   IN cl_spinlock_t * p_external_lock)
 {
 	cl_status_t cl_status;
 
@@ -232,7 +229,7 @@ cl_event_wheel_init_ex(IN cl_event_wheel_t * const p_event_wheel,
 void cl_event_wheel_dump(IN cl_event_wheel_t * const p_event_wheel)
 {
 	cl_list_item_t *p_list_item;
-	cl_event_wheel_reg_info_t *p_event;
+	cl_event_wheel_reg_info_t __attribute__((__unused__)) *p_event;
 
 	p_list_item = cl_qlist_head(&p_event_wheel->events_wheel);
 
@@ -285,12 +282,11 @@ void cl_event_wheel_destroy(IN cl_event_wheel_t * const p_event_wheel)
 	cl_spinlock_destroy(&(p_event_wheel->lock));
 }
 
-cl_status_t
-cl_event_wheel_reg(IN cl_event_wheel_t * const p_event_wheel,
-		   IN const uint64_t key,
-		   IN const uint64_t aging_time_usec,
-		   IN cl_pfn_event_aged_cb_t pfn_callback,
-		   IN void *const context)
+cl_status_t cl_event_wheel_reg(IN cl_event_wheel_t * const p_event_wheel,
+			       IN const uint64_t key,
+			       IN const uint64_t aging_time_usec,
+			       IN cl_pfn_event_aged_cb_t pfn_callback,
+			       IN void *const context)
 {
 	cl_event_wheel_reg_info_t *p_event;
 	uint64_t timeout;
@@ -336,8 +332,7 @@ cl_event_wheel_reg(IN cl_event_wheel_t * const p_event_wheel,
 
 	CL_DBG("cl_event_wheel_reg: Registering event key:0x%" PRIx64
 	       " aging in %u [msec]\n", p_event->key,
-	       (uint32_t) ((p_event->aging_time -
-			    cl_get_time_stamp()) / 1000));
+	       (uint32_t) ((p_event->aging_time - cl_get_time_stamp()) / 1000));
 
 	/* If the list is empty - need to start the timer */
 	if (cl_is_qlist_empty(&p_event_wheel->events_wheel)) {
@@ -401,8 +396,8 @@ Exit:
 	return cl_status;
 }
 
-void
-cl_event_wheel_unreg(IN cl_event_wheel_t * const p_event_wheel, IN uint64_t key)
+void cl_event_wheel_unreg(IN cl_event_wheel_t * const p_event_wheel,
+			  IN uint64_t key)
 {
 	cl_event_wheel_reg_info_t *p_event;
 	cl_map_item_t *p_map_item;
@@ -437,9 +432,8 @@ cl_event_wheel_unreg(IN cl_event_wheel_t * const p_event_wheel, IN uint64_t key)
 	cl_spinlock_release(&p_event_wheel->lock);
 }
 
-uint32_t
-cl_event_wheel_num_regs(IN cl_event_wheel_t * const p_event_wheel,
-			IN uint64_t key)
+uint32_t cl_event_wheel_num_regs(IN cl_event_wheel_t * const p_event_wheel,
+				 IN uint64_t key)
 {
 
 	cl_event_wheel_reg_info_t *p_event;
@@ -447,8 +441,7 @@ cl_event_wheel_num_regs(IN cl_event_wheel_t * const p_event_wheel,
 	uint32_t num_regs = 0;
 
 	/* try to find the key in the map */
-	CL_DBG("cl_event_wheel_num_regs: Looking for key:0x%"
-	       PRIx64 "\n", key);
+	CL_DBG("cl_event_wheel_num_regs: Looking for key:0x%" PRIx64 "\n", key);
 
 	cl_spinlock_acquire(&p_event_wheel->lock);
 	p_map_item = cl_qmap_get(&p_event_wheel->events_map, key);
diff --git a/complib/cl_list.c b/complib/cl_list.c
index 8129c61..87ebc71 100644
--- a/complib/cl_list.c
+++ b/complib/cl_list.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2005,2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -49,16 +49,12 @@
 #define FREE_ITEM_GROW_SIZE		10
 
 /******************************************************************************
-*******************************************************************************
-**************													   ************
-**************			 IMPLEMENTATION OF QUICK LIST			   ************
-**************													   ************
-*******************************************************************************
+ IMPLEMENTATION OF QUICK LIST
 ******************************************************************************/
-void
-cl_qlist_insert_array_head(IN cl_qlist_t * const p_list,
-			   IN cl_list_item_t * const p_array,
-			   IN uint32_t item_count, IN const uint32_t item_size)
+void cl_qlist_insert_array_head(IN cl_qlist_t * const p_list,
+				IN cl_list_item_t * const p_array,
+				IN uint32_t item_count,
+				IN const uint32_t item_size)
 {
 	cl_list_item_t *p_item;
 
@@ -85,10 +81,10 @@ cl_qlist_insert_array_head(IN cl_qlist_t * const p_list,
 	}
 }
 
-void
-cl_qlist_insert_array_tail(IN cl_qlist_t * const p_list,
-			   IN cl_list_item_t * const p_array,
-			   IN uint32_t item_count, IN const uint32_t item_size)
+void cl_qlist_insert_array_tail(IN cl_qlist_t * const p_list,
+				IN cl_list_item_t * const p_array,
+				IN uint32_t item_count,
+				IN const uint32_t item_size)
 {
 	cl_list_item_t *p_item;
 
@@ -110,9 +106,8 @@ cl_qlist_insert_array_tail(IN cl_qlist_t * const p_list,
 	}
 }
 
-void
-cl_qlist_insert_list_head(IN cl_qlist_t * const p_dest_list,
-			  IN cl_qlist_t * const p_src_list)
+void cl_qlist_insert_list_head(IN cl_qlist_t * const p_dest_list,
+			       IN cl_qlist_t * const p_src_list)
 {
 #if defined( _DEBUG_ )
 	cl_list_item_t *p_item;
@@ -163,9 +158,8 @@ cl_qlist_insert_list_head(IN cl_qlist_t * const p_dest_list,
 	__cl_qlist_reset(p_src_list);
 }
 
-void
-cl_qlist_insert_list_tail(IN cl_qlist_t * const p_dest_list,
-			  IN cl_qlist_t * const p_src_list)
+void cl_qlist_insert_list_tail(IN cl_qlist_t * const p_dest_list,
+			       IN cl_qlist_t * const p_src_list)
 {
 #if defined( _DEBUG_ )
 	cl_list_item_t *p_item;
@@ -216,9 +210,8 @@ cl_qlist_insert_list_tail(IN cl_qlist_t * const p_dest_list,
 	__cl_qlist_reset(p_src_list);
 }
 
-boolean_t
-cl_is_item_in_qlist(IN const cl_qlist_t * const p_list,
-		    IN const cl_list_item_t * const p_list_item)
+boolean_t cl_is_item_in_qlist(IN const cl_qlist_t * const p_list,
+			      IN const cl_list_item_t * const p_list_item)
 {
 	const cl_list_item_t *p_temp;
 
@@ -298,10 +291,9 @@ cl_list_item_t *cl_qlist_find_prev(IN const cl_qlist_t * const p_list,
 	return (p_found_item);
 }
 
-void
-cl_qlist_apply_func(IN const cl_qlist_t * const p_list,
-		    IN cl_pfn_qlist_apply_t pfn_func,
-		    IN const void *const context)
+void cl_qlist_apply_func(IN const cl_qlist_t * const p_list,
+			 IN cl_pfn_qlist_apply_t pfn_func,
+			 IN const void *const context)
 {
 	cl_list_item_t *p_list_item;
 
@@ -317,11 +309,10 @@ cl_qlist_apply_func(IN const cl_qlist_t * const p_list,
 	}
 }
 
-void
-cl_qlist_move_items(IN cl_qlist_t * const p_src_list,
-		    IN cl_qlist_t * const p_dest_list,
-		    IN cl_pfn_qlist_find_t pfn_func,
-		    IN const void *const context)
+void cl_qlist_move_items(IN cl_qlist_t * const p_src_list,
+			 IN cl_qlist_t * const p_dest_list,
+			 IN cl_pfn_qlist_find_t pfn_func,
+			 IN const void *const context)
 {
 	cl_list_item_t *p_current_item, *p_next;
 
@@ -347,11 +338,7 @@ cl_qlist_move_items(IN cl_qlist_t * const p_src_list,
 }
 
 /******************************************************************************
-*******************************************************************************
-**************													   ************
-**************			 IMPLEMENTATION OF LIST					   ************
-**************													   ************
-*******************************************************************************
+ IMPLEMENTATION OF LIST
 ******************************************************************************/
 void cl_list_construct(IN cl_list_t * const p_list)
 {
@@ -387,9 +374,8 @@ void cl_list_destroy(IN cl_list_t * const p_list)
 	cl_qpool_destroy(&p_list->list_item_pool);
 }
 
-static cl_status_t
-cl_list_find_cb(IN const cl_list_item_t * const p_list_item,
-		IN void *const context)
+static cl_status_t cl_list_find_cb(IN const cl_list_item_t * const p_list_item,
+				   IN void *const context)
 {
 	CL_ASSERT(p_list_item);
 
@@ -399,9 +385,8 @@ cl_list_find_cb(IN const cl_list_item_t * const p_list_item,
 	return (CL_NOT_FOUND);
 }
 
-cl_status_t
-cl_list_remove_object(IN cl_list_t * const p_list,
-		      IN const void *const p_object)
+cl_status_t cl_list_remove_object(IN cl_list_t * const p_list,
+				  IN const void *const p_object)
 {
 	cl_list_item_t *p_list_item;
 
@@ -421,9 +406,8 @@ cl_list_remove_object(IN cl_list_t * const p_list,
 	return (CL_NOT_FOUND);
 }
 
-boolean_t
-cl_is_object_in_list(IN const cl_list_t * const p_list,
-		     IN const void *const p_object)
+boolean_t cl_is_object_in_list(IN const cl_list_t * const p_list,
+			       IN const void *const p_object)
 {
 	CL_ASSERT(p_list);
 	CL_ASSERT(cl_is_qpool_inited(&p_list->list_item_pool));
@@ -433,13 +417,14 @@ cl_is_object_in_list(IN const cl_list_t * const p_list,
 		!= cl_qlist_end(&p_list->list));
 }
 
-cl_status_t
-cl_list_insert_array_head(IN cl_list_t * const p_list,
-			  IN const void *const p_array,
-			  IN uint32_t item_count, IN const uint32_t item_size)
+cl_status_t cl_list_insert_array_head(IN cl_list_t * const p_list,
+				      IN const void *const p_array,
+				      IN uint32_t item_count,
+				      IN const uint32_t item_size)
 {
 	cl_status_t status;
 	void *p_object;
+	uint32_t items_remain = item_count;
 
 	CL_ASSERT(p_list);
 	CL_ASSERT(cl_is_qpool_inited(&p_list->list_item_pool));
@@ -455,11 +440,11 @@ cl_list_insert_array_head(IN cl_list_t * const p_list,
 	p_object = ((uint8_t *) p_array + (item_size * (item_count - 1)));
 
 	/* Continue to add all items to the list. */
-	while (item_count--) {
+	while (items_remain--) {
 		status = cl_list_insert_head(p_list, p_object);
 		if (status != CL_SUCCESS) {
 			/* Remove all items that have been inserted. */
-			while (item_count++ < item_count)
+			while (items_remain++ < (item_count - 1))
 				cl_list_remove_head(p_list);
 			return (status);
 		}
@@ -471,13 +456,14 @@ cl_list_insert_array_head(IN cl_list_t * const p_list,
 	return (CL_SUCCESS);
 }
 
-cl_status_t
-cl_list_insert_array_tail(IN cl_list_t * const p_list,
-			  IN const void *const p_array,
-			  IN uint32_t item_count, IN const uint32_t item_size)
+cl_status_t cl_list_insert_array_tail(IN cl_list_t * const p_list,
+				      IN const void *const p_array,
+				      IN uint32_t item_count,
+				      IN const uint32_t item_size)
 {
 	cl_status_t status;
 	void *p_object;
+	uint32_t items_remain = item_count;
 
 	CL_ASSERT(p_list);
 	CL_ASSERT(cl_is_qpool_inited(&p_list->list_item_pool));
@@ -489,11 +475,11 @@ cl_list_insert_array_tail(IN cl_list_t * const p_list,
 	p_object = (void *)p_array;
 
 	/* Continue to add all items to the list. */
-	while (item_count--) {
+	while (items_remain--) {
 		status = cl_list_insert_tail(p_list, p_object);
 		if (status != CL_SUCCESS) {
 			/* Remove all items that have been inserted. */
-			while (item_count++ < item_count)
+			while (items_remain++ < (item_count - 1))
 				cl_list_remove_tail(p_list);
 			return (status);
 		}
@@ -505,10 +491,9 @@ cl_list_insert_array_tail(IN cl_list_t * const p_list,
 	return (CL_SUCCESS);
 }
 
-cl_list_iterator_t
-cl_list_find_from_head(IN const cl_list_t * const p_list,
-		       IN cl_pfn_list_find_t pfn_func,
-		       IN const void *const context)
+cl_list_iterator_t cl_list_find_from_head(IN const cl_list_t * const p_list,
+					  IN cl_pfn_list_find_t pfn_func,
+					  IN const void *const context)
 {
 	cl_status_t status;
 	cl_list_iterator_t itor;
@@ -532,10 +517,9 @@ cl_list_find_from_head(IN const cl_list_t * const p_list,
 	return (itor);
 }
 
-cl_list_iterator_t
-cl_list_find_from_tail(IN const cl_list_t * const p_list,
-		       IN cl_pfn_list_find_t pfn_func,
-		       IN const void *const context)
+cl_list_iterator_t cl_list_find_from_tail(IN const cl_list_t * const p_list,
+					  IN cl_pfn_list_find_t pfn_func,
+					  IN const void *const context)
 {
 	cl_status_t status;
 	cl_list_iterator_t itor;
@@ -559,10 +543,9 @@ cl_list_find_from_tail(IN const cl_list_t * const p_list,
 	return (itor);
 }
 
-void
-cl_list_apply_func(IN const cl_list_t * const p_list,
-		   IN cl_pfn_list_apply_t pfn_func,
-		   IN const void *const context)
+void cl_list_apply_func(IN const cl_list_t * const p_list,
+			IN cl_pfn_list_apply_t pfn_func,
+			IN const void *const context)
 {
 	cl_list_iterator_t itor;
 
diff --git a/complib/cl_log.c b/complib/cl_log.c
index a2a1372..c63cf74 100644
--- a/complib/cl_log.c
+++ b/complib/cl_log.c
@@ -55,11 +55,10 @@
  */
 #define CL_LOG_DATA_SIZE	(CL_MAX_LOG_DATA + (CL_MAX_LOG_DATA/4))
 
-void
-cl_log_event(IN const char *const name,
-	     IN const cl_log_type_t type,
-	     IN const char *const message,
-	     IN const void *const p_data OPTIONAL, IN const uint32_t data_len)
+void cl_log_event(IN const char *const name, IN const cl_log_type_t type,
+		  IN const char *const message,
+		  IN const void *const p_data OPTIONAL,
+		  IN const uint32_t data_len)
 {
 	int priority, i;
 	char data[CL_LOG_DATA_SIZE];
diff --git a/complib/cl_map.c b/complib/cl_map.c
index c0e44be..81426ee 100644
--- a/complib/cl_map.c
+++ b/complib/cl_map.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -68,11 +68,7 @@
 #include <complib/cl_fleximap.h>
 
 /******************************************************************************
-*******************************************************************************
-**************													   ************
-**************			 IMPLEMENTATION OF QUICK MAP			   ************
-**************													   ************
-*******************************************************************************
+ IMPLEMENTATION OF QUICK MAP
 ******************************************************************************/
 
 /*
@@ -128,8 +124,8 @@ static cl_map_item_t **__cl_map_get_parent_ptr_to_item(IN cl_map_item_t *
  *	     / \			   / \
  *	    X   Y			  X   Y
  */
-static void
-__cl_map_rot_left(IN cl_qmap_t * const p_map, IN cl_map_item_t * const p_item)
+static void __cl_map_rot_left(IN cl_qmap_t * const p_map,
+			      IN cl_map_item_t * const p_item)
 {
 	cl_map_item_t **pp_root;
 
@@ -174,8 +170,8 @@ __cl_map_rot_left(IN cl_qmap_t * const p_map, IN cl_map_item_t * const p_item)
  *	     / \				      / \
  *	    X   Y				     X   Y
  */
-static void
-__cl_map_rot_right(IN cl_qmap_t * const p_map, IN cl_map_item_t * const p_item)
+static void __cl_map_rot_right(IN cl_qmap_t * const p_map,
+			       IN cl_map_item_t * const p_item)
 {
 	cl_map_item_t **pp_root;
 
@@ -274,10 +270,9 @@ cl_map_item_t *cl_qmap_get_next(IN const cl_qmap_t * const p_map,
 	return (p_item_found);
 }
 
-void
-cl_qmap_apply_func(IN const cl_qmap_t * const p_map,
-		   IN cl_pfn_qmap_apply_t pfn_func,
-		   IN const void *const context)
+void cl_qmap_apply_func(IN const cl_qmap_t * const p_map,
+			IN cl_pfn_qmap_apply_t pfn_func,
+			IN const void *const context)
 {
 	cl_map_item_t *p_map_item;
 
@@ -296,8 +291,8 @@ cl_qmap_apply_func(IN const cl_qmap_t * const p_map,
 /*
  * Balance a tree starting at a given item back to the root.
  */
-static void
-__cl_map_ins_bal(IN cl_qmap_t * const p_map, IN cl_map_item_t * p_item)
+static void __cl_map_ins_bal(IN cl_qmap_t * const p_map,
+			     IN cl_map_item_t * p_item)
 {
 	cl_map_item_t *p_grand_uncle;
 
@@ -437,8 +432,8 @@ cl_map_item_t *cl_qmap_insert(IN cl_qmap_t * const p_map,
 	return (p_item);
 }
 
-static void
-__cl_map_del_bal(IN cl_qmap_t * const p_map, IN cl_map_item_t * p_item)
+static void __cl_map_del_bal(IN cl_qmap_t * const p_map,
+			     IN cl_map_item_t * p_item)
 {
 	cl_map_item_t *p_uncle;
 
@@ -502,8 +497,8 @@ __cl_map_del_bal(IN cl_qmap_t * const p_map, IN cl_map_item_t * p_item)
 	p_item->color = CL_MAP_BLACK;
 }
 
-void
-cl_qmap_remove_item(IN cl_qmap_t * const p_map, IN cl_map_item_t * const p_item)
+void cl_qmap_remove_item(IN cl_qmap_t * const p_map,
+			 IN cl_map_item_t * const p_item)
 {
 	cl_map_item_t *p_child, *p_del_item;
 
@@ -597,9 +592,8 @@ cl_map_item_t *cl_qmap_remove(IN cl_qmap_t * const p_map, IN const uint64_t key)
 	return (p_item);
 }
 
-void
-cl_qmap_merge(OUT cl_qmap_t * const p_dest_map,
-	      IN OUT cl_qmap_t * const p_src_map)
+void cl_qmap_merge(OUT cl_qmap_t * const p_dest_map,
+		   IN OUT cl_qmap_t * const p_src_map)
 {
 	cl_map_item_t *p_item, *p_item2, *p_next;
 
@@ -628,12 +622,12 @@ cl_qmap_merge(OUT cl_qmap_t * const p_dest_map,
 	}
 }
 
-static void
-__cl_qmap_delta_move(IN OUT cl_qmap_t * const p_dest,
-		     IN OUT cl_qmap_t * const p_src,
-		     IN OUT cl_map_item_t ** const pp_item)
+static void __cl_qmap_delta_move(IN OUT cl_qmap_t * const p_dest,
+				 IN OUT cl_qmap_t * const p_src,
+				 IN OUT cl_map_item_t ** const pp_item)
 {
-	cl_map_item_t *p_temp, *p_next;
+	cl_map_item_t __attribute__((__unused__)) *p_temp;
+	cl_map_item_t *p_next;
 
 	/*
 	 * Get the next item so that we can ensure that pp_item points to
@@ -649,10 +643,9 @@ __cl_qmap_delta_move(IN OUT cl_qmap_t * const p_dest,
 	(*pp_item) = p_next;
 }
 
-void
-cl_qmap_delta(IN OUT cl_qmap_t * const p_map1,
-	      IN OUT cl_qmap_t * const p_map2,
-	      OUT cl_qmap_t * const p_new, OUT cl_qmap_t * const p_old)
+void cl_qmap_delta(IN OUT cl_qmap_t * const p_map1,
+		   IN OUT cl_qmap_t * const p_map2,
+		   OUT cl_qmap_t * const p_new, OUT cl_qmap_t * const p_old)
 {
 	cl_map_item_t *p_item1, *p_item2;
 	uint64_t key1, key2;
@@ -692,11 +685,7 @@ cl_qmap_delta(IN OUT cl_qmap_t * const p_map1,
 }
 
 /******************************************************************************
-*******************************************************************************
-**************													   ************
-**************				IMPLEMENTATION OF MAP				   ************
-**************													   ************
-*******************************************************************************
+ IMPLEMENTATION OF MAP
 ******************************************************************************/
 
 #define MAP_GROW_SIZE 32
@@ -788,8 +777,8 @@ void *cl_map_get_next(IN const cl_map_t * const p_map, IN const uint64_t key)
 	return (cl_qmap_obj(PARENT_STRUCT(p_item, cl_map_obj_t, item)));
 }
 
-void
-cl_map_remove_item(IN cl_map_t * const p_map, IN const cl_map_iterator_t itor)
+void cl_map_remove_item(IN cl_map_t * const p_map,
+			IN const cl_map_iterator_t itor)
 {
 	CL_ASSERT(itor->p_map == &p_map->qmap);
 
@@ -838,8 +827,8 @@ void cl_map_remove_all(IN cl_map_t * const p_map)
 	}
 }
 
-cl_status_t
-cl_map_merge(OUT cl_map_t * const p_dest_map, IN OUT cl_map_t * const p_src_map)
+cl_status_t cl_map_merge(OUT cl_map_t * const p_dest_map,
+			 IN OUT cl_map_t * const p_src_map)
 {
 	cl_status_t status = CL_SUCCESS;
 	cl_map_iterator_t itor, next;
@@ -877,12 +866,12 @@ cl_map_merge(OUT cl_map_t * const p_dest_map, IN OUT cl_map_t * const p_src_map)
 	return (CL_SUCCESS);
 }
 
-static void
-__cl_map_revert(IN OUT cl_map_t * const p_map1,
-		IN OUT cl_map_t * const p_map2,
-		IN OUT cl_map_t * const p_new, IN OUT cl_map_t * const p_old)
+static void __cl_map_revert(IN OUT cl_map_t * const p_map1,
+			    IN OUT cl_map_t * const p_map2,
+			    IN OUT cl_map_t * const p_new,
+			    IN OUT cl_map_t * const p_old)
 {
-	cl_status_t status;
+	cl_status_t __attribute__((__unused__)) status;
 
 	/* Restore the initial state. */
 	status = cl_map_merge(p_map1, p_old);
@@ -891,10 +880,9 @@ __cl_map_revert(IN OUT cl_map_t * const p_map1,
 	CL_ASSERT(status == CL_SUCCESS);
 }
 
-static cl_status_t
-__cl_map_delta_move(OUT cl_map_t * const p_dest,
-		    IN OUT cl_map_t * const p_src,
-		    IN OUT cl_map_iterator_t * const p_itor)
+static cl_status_t __cl_map_delta_move(OUT cl_map_t * const p_dest,
+				       IN OUT cl_map_t * const p_src,
+				       IN OUT cl_map_iterator_t * const p_itor)
 {
 	cl_map_iterator_t next;
 	void *p_obj, *p_obj2;
@@ -924,10 +912,9 @@ __cl_map_delta_move(OUT cl_map_t * const p_dest,
 	return (CL_SUCCESS);
 }
 
-cl_status_t
-cl_map_delta(IN OUT cl_map_t * const p_map1,
-	     IN OUT cl_map_t * const p_map2,
-	     OUT cl_map_t * const p_new, OUT cl_map_t * const p_old)
+cl_status_t cl_map_delta(IN OUT cl_map_t * const p_map1,
+			 IN OUT cl_map_t * const p_map2,
+			 OUT cl_map_t * const p_new, OUT cl_map_t * const p_old)
 {
 	cl_map_iterator_t itor1, itor2;
 	uint64_t key1, key2;
@@ -999,11 +986,7 @@ cl_map_delta(IN OUT cl_map_t * const p_map1,
 }
 
 /******************************************************************************
-*******************************************************************************
-**************													   ************
-**************			 IMPLEMENTATION OF FLEXI MAP			   ************
-**************													   ************
-*******************************************************************************
+ IMPLEMENTATION OF FLEXI MAP
 ******************************************************************************/
 
 /*
@@ -1059,8 +1042,8 @@ static cl_fmap_item_t **__cl_fmap_get_parent_ptr_to_item(IN cl_fmap_item_t *
  *	     / \			   / \
  *	    X   Y			  X   Y
  */
-static void
-__cl_fmap_rot_left(IN cl_fmap_t * const p_map, IN cl_fmap_item_t * const p_item)
+static void __cl_fmap_rot_left(IN cl_fmap_t * const p_map,
+			       IN cl_fmap_item_t * const p_item)
 {
 	cl_fmap_item_t **pp_root;
 
@@ -1105,9 +1088,8 @@ __cl_fmap_rot_left(IN cl_fmap_t * const p_map, IN cl_fmap_item_t * const p_item)
  *	     / \				      / \
  *	    X   Y				     X   Y
  */
-static void
-__cl_fmap_rot_right(IN cl_fmap_t * const p_map,
-		    IN cl_fmap_item_t * const p_item)
+static void __cl_fmap_rot_right(IN cl_fmap_t * const p_map,
+				IN cl_fmap_item_t * const p_item)
 {
 	cl_fmap_item_t **pp_root;
 
@@ -1163,11 +1145,12 @@ void cl_fmap_init(IN cl_fmap_t * const p_map, IN cl_pfn_fmap_cmp_t pfn_compare)
 	cl_fmap_remove_all(p_map);
 }
 
-cl_fmap_item_t *cl_fmap_get(IN const cl_fmap_t * const p_map,
-			    IN const void *const p_key)
+cl_fmap_item_t *cl_fmap_match(IN const cl_fmap_t * const p_map,
+			      IN const void *const p_key,
+			      IN cl_pfn_fmap_cmp_t pfn_compare)
 {
 	cl_fmap_item_t *p_item;
-	intn_t cmp;
+	int cmp;
 
 	CL_ASSERT(p_map);
 	CL_ASSERT(p_map->state == CL_INITIALIZED);
@@ -1175,7 +1158,8 @@ cl_fmap_item_t *cl_fmap_get(IN const cl_fmap_t * const p_map,
 	p_item = __cl_fmap_root(p_map);
 
 	while (p_item != &p_map->nil) {
-		cmp = p_map->pfn_compare(p_key, p_item->p_key);
+		cmp = pfn_compare ? pfn_compare(p_key, p_item->p_key) :
+			p_map->pfn_compare(p_key, p_item->p_key);
 
 		if (!cmp)
 			break;	/* just right */
@@ -1189,12 +1173,18 @@ cl_fmap_item_t *cl_fmap_get(IN const cl_fmap_t * const p_map,
 	return (p_item);
 }
 
+cl_fmap_item_t *cl_fmap_get(IN const cl_fmap_t * const p_map,
+			    IN const void *const p_key)
+{
+	return cl_fmap_match(p_map, p_key, p_map->pfn_compare);
+}
+
 cl_fmap_item_t *cl_fmap_get_next(IN const cl_fmap_t * const p_map,
 				 IN const void *const p_key)
 {
 	cl_fmap_item_t *p_item;
 	cl_fmap_item_t *p_item_found;
-	intn_t cmp;
+	int cmp;
 
 	CL_ASSERT(p_map);
 	CL_ASSERT(p_map->state == CL_INITIALIZED);
@@ -1216,10 +1206,9 @@ cl_fmap_item_t *cl_fmap_get_next(IN const cl_fmap_t * const p_map,
 	return (p_item_found);
 }
 
-void
-cl_fmap_apply_func(IN const cl_fmap_t * const p_map,
-		   IN cl_pfn_fmap_apply_t pfn_func,
-		   IN const void *const context)
+void cl_fmap_apply_func(IN const cl_fmap_t * const p_map,
+			IN cl_pfn_fmap_apply_t pfn_func,
+			IN const void *const context)
 {
 	cl_fmap_item_t *p_fmap_item;
 
@@ -1238,8 +1227,8 @@ cl_fmap_apply_func(IN const cl_fmap_t * const p_map,
 /*
  * Balance a tree starting at a given item back to the root.
  */
-static void
-__cl_fmap_ins_bal(IN cl_fmap_t * const p_map, IN cl_fmap_item_t * p_item)
+static void __cl_fmap_ins_bal(IN cl_fmap_t * const p_map,
+			      IN cl_fmap_item_t * p_item)
 {
 	cl_fmap_item_t *p_grand_uncle;
 
@@ -1293,7 +1282,7 @@ cl_fmap_item_t *cl_fmap_insert(IN cl_fmap_t * const p_map,
 			       IN cl_fmap_item_t * const p_item)
 {
 	cl_fmap_item_t *p_insert_at, *p_comp_item;
-	intn_t cmp = 0;
+	int cmp = 0;
 
 	CL_ASSERT(p_map);
 	CL_ASSERT(p_map->state == CL_INITIALIZED);
@@ -1382,8 +1371,8 @@ cl_fmap_item_t *cl_fmap_insert(IN cl_fmap_t * const p_map,
 	return (p_item);
 }
 
-static void
-__cl_fmap_del_bal(IN cl_fmap_t * const p_map, IN cl_fmap_item_t * p_item)
+static void __cl_fmap_del_bal(IN cl_fmap_t * const p_map,
+			      IN cl_fmap_item_t * p_item)
 {
 	cl_fmap_item_t *p_uncle;
 
@@ -1447,9 +1436,8 @@ __cl_fmap_del_bal(IN cl_fmap_t * const p_map, IN cl_fmap_item_t * p_item)
 	p_item->color = CL_MAP_BLACK;
 }
 
-void
-cl_fmap_remove_item(IN cl_fmap_t * const p_map,
-		    IN cl_fmap_item_t * const p_item)
+void cl_fmap_remove_item(IN cl_fmap_t * const p_map,
+			 IN cl_fmap_item_t * const p_item)
 {
 	cl_fmap_item_t *p_child, *p_del_item;
 
@@ -1541,9 +1529,8 @@ cl_fmap_item_t *cl_fmap_remove(IN cl_fmap_t * const p_map,
 	return (p_item);
 }
 
-void
-cl_fmap_merge(OUT cl_fmap_t * const p_dest_map,
-	      IN OUT cl_fmap_t * const p_src_map)
+void cl_fmap_merge(OUT cl_fmap_t * const p_dest_map,
+		   IN OUT cl_fmap_t * const p_src_map)
 {
 	cl_fmap_item_t *p_item, *p_item2, *p_next;
 
@@ -1572,12 +1559,12 @@ cl_fmap_merge(OUT cl_fmap_t * const p_dest_map,
 	}
 }
 
-static void
-__cl_fmap_delta_move(IN OUT cl_fmap_t * const p_dest,
-		     IN OUT cl_fmap_t * const p_src,
-		     IN OUT cl_fmap_item_t ** const pp_item)
+static void __cl_fmap_delta_move(IN OUT cl_fmap_t * const p_dest,
+				 IN OUT cl_fmap_t * const p_src,
+				 IN OUT cl_fmap_item_t ** const pp_item)
 {
-	cl_fmap_item_t *p_temp, *p_next;
+	cl_fmap_item_t __attribute__((__unused__)) *p_temp;
+	cl_fmap_item_t *p_next;
 
 	/*
 	 * Get the next item so that we can ensure that pp_item points to
@@ -1593,13 +1580,12 @@ __cl_fmap_delta_move(IN OUT cl_fmap_t * const p_dest,
 	(*pp_item) = p_next;
 }
 
-void
-cl_fmap_delta(IN OUT cl_fmap_t * const p_map1,
-	      IN OUT cl_fmap_t * const p_map2,
-	      OUT cl_fmap_t * const p_new, OUT cl_fmap_t * const p_old)
+void cl_fmap_delta(IN OUT cl_fmap_t * const p_map1,
+		   IN OUT cl_fmap_t * const p_map2,
+		   OUT cl_fmap_t * const p_new, OUT cl_fmap_t * const p_old)
 {
 	cl_fmap_item_t *p_item1, *p_item2;
-	intn_t cmp;
+	int cmp;
 
 	CL_ASSERT(p_map1);
 	CL_ASSERT(p_map2);
diff --git a/complib/cl_nodenamemap.c b/complib/cl_nodenamemap.c
index 04f6bbf..a99d46d 100644
--- a/complib/cl_nodenamemap.c
+++ b/complib/cl_nodenamemap.c
@@ -60,12 +60,11 @@ static int map_name(void *cxt, uint64_t guid, char *p)
 		return -1;
 	item->guid = guid;
 	item->name = strdup(p);
-	cl_qmap_insert(map, item->guid, (cl_map_item_t *)item);
+	cl_qmap_insert(map, item->guid, (cl_map_item_t *) item);
 	return 0;
 }
 
-nn_map_t *
-open_node_name_map(char *node_name_map)
+nn_map_t *open_node_name_map(char *node_name_map)
 {
 	nn_map_t *map;
 
@@ -77,7 +76,7 @@ open_node_name_map(char *node_name_map)
 			return NULL;
 #else
 		return NULL;
-#endif /* HAVE_DEFAULT_NODENAME_MAP */
+#endif				/* HAVE_DEFAULT_NODENAME_MAP */
 	}
 
 	map = malloc(sizeof(*map));
@@ -89,33 +88,31 @@ open_node_name_map(char *node_name_map)
 		fprintf(stderr,
 			"WARNING failed to open node name map \"%s\" (%s)\n",
 			node_name_map, strerror(errno));
-			close_node_name_map(map);
-			return NULL;
+		close_node_name_map(map);
+		return NULL;
 	}
 
 	return map;
 }
 
-void
-close_node_name_map(nn_map_t *map)
+void close_node_name_map(nn_map_t * map)
 {
 	name_map_item_t *item = NULL;
 
 	if (!map)
 		return;
 
-	item = (name_map_item_t *)cl_qmap_head(map);
-	while (item != (name_map_item_t *)cl_qmap_end(map)) {
-		item = (name_map_item_t *)cl_qmap_remove(map, item->guid);
+	item = (name_map_item_t *) cl_qmap_head(map);
+	while (item != (name_map_item_t *) cl_qmap_end(map)) {
+		item = (name_map_item_t *) cl_qmap_remove(map, item->guid);
 		free(item->name);
 		free(item);
-		item = (name_map_item_t *)cl_qmap_head(map);
+		item = (name_map_item_t *) cl_qmap_head(map);
 	}
 	free(map);
 }
 
-char *
-remap_node_name(nn_map_t *map, uint64_t target_guid, char *nodedesc)
+char *remap_node_name(nn_map_t * map, uint64_t target_guid, char *nodedesc)
 {
 	char *rc = NULL;
 	name_map_item_t *item = NULL;
@@ -123,8 +120,8 @@ remap_node_name(nn_map_t *map, uint64_t target_guid, char *nodedesc)
 	if (!map)
 		goto done;
 
-	item = (name_map_item_t *)cl_qmap_get(map, target_guid);
-	if (item != (name_map_item_t *)cl_qmap_end(map))
+	item = (name_map_item_t *) cl_qmap_get(map, target_guid);
+	if (item != (name_map_item_t *) cl_qmap_end(map))
 		rc = strdup(item->name);
 
 done:
@@ -133,8 +130,7 @@ done:
 	return (rc);
 }
 
-char *
-clean_nodedesc(char *nodedesc)
+char *clean_nodedesc(char *nodedesc)
 {
 	int i = 0;
 
@@ -149,7 +145,7 @@ clean_nodedesc(char *nodedesc)
 }
 
 int parse_node_map(const char *file_name,
-		   int (*create)(void *, uint64_t, char *), void *cxt)
+		   int (*create) (void *, uint64_t, char *), void *cxt)
 {
 	char line[256];
 	FILE *f;
diff --git a/complib/cl_pool.c b/complib/cl_pool.c
index 0790304..6248688 100644
--- a/complib/cl_pool.c
+++ b/complib/cl_pool.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -64,16 +64,14 @@ void cl_qcpool_construct(IN cl_qcpool_t * const p_pool)
 	p_pool->state = CL_UNINITIALIZED;
 }
 
-cl_status_t
-cl_qcpool_init(IN cl_qcpool_t * const p_pool,
-	       IN const size_t min_size,
-	       IN const size_t max_size,
-	       IN const size_t grow_size,
-	       IN const size_t * const component_sizes,
-	       IN const uint32_t num_components,
-	       IN cl_pfn_qcpool_init_t pfn_initializer OPTIONAL,
-	       IN cl_pfn_qcpool_dtor_t pfn_destructor OPTIONAL,
-	       IN const void *const context)
+cl_status_t cl_qcpool_init(IN cl_qcpool_t * const p_pool,
+			   IN const size_t min_size, IN const size_t max_size,
+			   IN const size_t grow_size,
+			   IN const size_t * const component_sizes,
+			   IN const uint32_t num_components,
+			   IN cl_pfn_qcpool_init_t pfn_initializer OPTIONAL,
+			   IN cl_pfn_qcpool_dtor_t pfn_destructor OPTIONAL,
+			   IN const void *const context)
 {
 	cl_status_t status;
 	uint32_t i;
@@ -130,7 +128,7 @@ cl_qcpool_init(IN cl_qcpool_t * const p_pool,
 		 * are aligned on a natural boundary.
 		 */
 		p_pool->component_sizes[i] =
-		    ROUNDUP(p_pool->component_sizes[i], sizeof(uintn_t));
+		    ROUNDUP(p_pool->component_sizes[i], sizeof(uintptr_t));
 	}
 
 	p_pool->max_objects = max_size ? max_size : ~(size_t) 0;
@@ -383,11 +381,10 @@ cl_pool_item_t *cl_qcpool_get_tail(IN cl_qcpool_t * const p_pool)
  * Callback to translate quick composite to quick grow pool
  * initializer callback.
  */
-static cl_status_t
-__cl_qpool_init_cb(IN void **const p_comp_array,
-		   IN const uint32_t num_components,
-		   IN void *const context,
-		   OUT cl_pool_item_t ** const pp_pool_item)
+static cl_status_t __cl_qpool_init_cb(IN void **const p_comp_array,
+				      IN const uint32_t num_components,
+				      IN void *const context,
+				      OUT cl_pool_item_t ** const pp_pool_item)
 {
 	cl_qpool_t *p_pool = (cl_qpool_t *) context;
 
@@ -405,9 +402,8 @@ __cl_qpool_init_cb(IN void **const p_comp_array,
  * Callback to translate quick composite to quick grow pool
  * destructor callback.
  */
-static void
-__cl_qpool_dtor_cb(IN const cl_pool_item_t * const p_pool_item,
-		   IN void *const context)
+static void __cl_qpool_dtor_cb(IN const cl_pool_item_t * const p_pool_item,
+			       IN void *const context)
 {
 	cl_qpool_t *p_pool = (cl_qpool_t *) context;
 
@@ -424,15 +420,13 @@ void cl_qpool_construct(IN cl_qpool_t * const p_pool)
 	cl_qcpool_construct(&p_pool->qcpool);
 }
 
-cl_status_t
-cl_qpool_init(IN cl_qpool_t * const p_pool,
-	      IN const size_t min_size,
-	      IN const size_t max_size,
-	      IN const size_t grow_size,
-	      IN const size_t object_size,
-	      IN cl_pfn_qpool_init_t pfn_initializer OPTIONAL,
-	      IN cl_pfn_qpool_dtor_t pfn_destructor OPTIONAL,
-	      IN const void *const context)
+cl_status_t cl_qpool_init(IN cl_qpool_t * const p_pool,
+			  IN const size_t min_size, IN const size_t max_size,
+			  IN const size_t grow_size,
+			  IN const size_t object_size,
+			  IN cl_pfn_qpool_init_t pfn_initializer OPTIONAL,
+			  IN cl_pfn_qpool_dtor_t pfn_destructor OPTIONAL,
+			  IN const void *const context)
 {
 	cl_status_t status;
 
@@ -459,11 +453,10 @@ cl_qpool_init(IN cl_qpool_t * const p_pool,
  * Callback to translate quick composite to compsite pool
  * initializer callback.
  */
-static cl_status_t
-__cl_cpool_init_cb(IN void **const p_comp_array,
-		   IN const uint32_t num_components,
-		   IN void *const context,
-		   OUT cl_pool_item_t ** const pp_pool_item)
+static cl_status_t __cl_cpool_init_cb(IN void **const p_comp_array,
+				      IN const uint32_t num_components,
+				      IN void *const context,
+				      OUT cl_pool_item_t ** const pp_pool_item)
 {
 	cl_cpool_t *p_pool = (cl_cpool_t *) context;
 	cl_pool_obj_t *p_pool_obj;
@@ -501,9 +494,8 @@ __cl_cpool_init_cb(IN void **const p_comp_array,
  * Callback to translate quick composite to composite pool
  * destructor callback.
  */
-static void
-__cl_cpool_dtor_cb(IN const cl_pool_item_t * const p_pool_item,
-		   IN void *const context)
+static void __cl_cpool_dtor_cb(IN const cl_pool_item_t * const p_pool_item,
+			       IN void *const context)
 {
 	cl_cpool_t *p_pool = (cl_cpool_t *) context;
 
@@ -525,16 +517,14 @@ void cl_cpool_construct(IN cl_cpool_t * const p_pool)
 	cl_qcpool_construct(&p_pool->qcpool);
 }
 
-cl_status_t
-cl_cpool_init(IN cl_cpool_t * const p_pool,
-	      IN const size_t min_size,
-	      IN const size_t max_size,
-	      IN const size_t grow_size,
-	      IN size_t * const component_sizes,
-	      IN const uint32_t num_components,
-	      IN cl_pfn_cpool_init_t pfn_initializer OPTIONAL,
-	      IN cl_pfn_cpool_dtor_t pfn_destructor OPTIONAL,
-	      IN const void *const context)
+cl_status_t cl_cpool_init(IN cl_cpool_t * const p_pool,
+			  IN const size_t min_size, IN const size_t max_size,
+			  IN const size_t grow_size,
+			  IN size_t * const component_sizes,
+			  IN const uint32_t num_components,
+			  IN cl_pfn_cpool_init_t pfn_initializer OPTIONAL,
+			  IN cl_pfn_cpool_dtor_t pfn_destructor OPTIONAL,
+			  IN const void *const context)
 {
 	cl_status_t status;
 
@@ -569,11 +559,10 @@ cl_cpool_init(IN cl_cpool_t * const p_pool,
 /*
  * Callback to translate quick composite to grow pool constructor callback.
  */
-static cl_status_t
-__cl_pool_init_cb(IN void **const pp_obj,
-		  IN const uint32_t count,
-		  IN void *const context,
-		  OUT cl_pool_item_t ** const pp_pool_item)
+static cl_status_t __cl_pool_init_cb(IN void **const pp_obj,
+				     IN const uint32_t count,
+				     IN void *const context,
+				     OUT cl_pool_item_t ** const pp_pool_item)
 {
 	cl_pool_t *p_pool = (cl_pool_t *) context;
 	cl_pool_obj_t *p_pool_obj;
@@ -611,9 +600,8 @@ __cl_pool_init_cb(IN void **const pp_obj,
 /*
  * Callback to translate quick composite to grow pool destructor callback.
  */
-static void
-__cl_pool_dtor_cb(IN const cl_pool_item_t * const p_pool_item,
-		  IN void *const context)
+static void __cl_pool_dtor_cb(IN const cl_pool_item_t * const p_pool_item,
+			      IN void *const context)
 {
 	cl_pool_t *p_pool = (cl_pool_t *) context;
 
@@ -635,15 +623,12 @@ void cl_pool_construct(IN cl_pool_t * const p_pool)
 	cl_qcpool_construct(&p_pool->qcpool);
 }
 
-cl_status_t
-cl_pool_init(IN cl_pool_t * const p_pool,
-	     IN const size_t min_size,
-	     IN const size_t max_size,
-	     IN const size_t grow_size,
-	     IN const size_t object_size,
-	     IN cl_pfn_pool_init_t pfn_initializer OPTIONAL,
-	     IN cl_pfn_pool_dtor_t pfn_destructor OPTIONAL,
-	     IN const void *const context)
+cl_status_t cl_pool_init(IN cl_pool_t * const p_pool, IN const size_t min_size,
+			 IN const size_t max_size, IN const size_t grow_size,
+			 IN const size_t object_size,
+			 IN cl_pfn_pool_init_t pfn_initializer OPTIONAL,
+			 IN cl_pfn_pool_dtor_t pfn_destructor OPTIONAL,
+			 IN const void *const context)
 {
 	cl_status_t status;
 	size_t total_size;
diff --git a/complib/cl_ptr_vector.c b/complib/cl_ptr_vector.c
index c34316e..36db4db 100644
--- a/complib/cl_ptr_vector.c
+++ b/complib/cl_ptr_vector.c
@@ -56,9 +56,9 @@ void cl_ptr_vector_construct(IN cl_ptr_vector_t * const p_vector)
 	p_vector->state = CL_UNINITIALIZED;
 }
 
-cl_status_t
-cl_ptr_vector_init(IN cl_ptr_vector_t * const p_vector,
-		   IN const size_t min_size, IN const size_t grow_size)
+cl_status_t cl_ptr_vector_init(IN cl_ptr_vector_t * const p_vector,
+			       IN const size_t min_size,
+			       IN const size_t grow_size)
 {
 	cl_status_t status = CL_SUCCESS;
 
@@ -101,9 +101,8 @@ void cl_ptr_vector_destroy(IN cl_ptr_vector_t * const p_vector)
 	p_vector->state = CL_UNINITIALIZED;
 }
 
-cl_status_t
-cl_ptr_vector_at(IN const cl_ptr_vector_t * const p_vector,
-		 IN const size_t index, OUT void **const p_element)
+cl_status_t cl_ptr_vector_at(IN const cl_ptr_vector_t * const p_vector,
+			     IN const size_t index, OUT void **const p_element)
 {
 	CL_ASSERT(p_vector);
 	CL_ASSERT(p_vector->state == CL_INITIALIZED);
@@ -116,9 +115,9 @@ cl_ptr_vector_at(IN const cl_ptr_vector_t * const p_vector,
 	return (CL_SUCCESS);
 }
 
-cl_status_t
-cl_ptr_vector_set(IN cl_ptr_vector_t * const p_vector,
-		  IN const size_t index, IN const void *const element)
+cl_status_t cl_ptr_vector_set(IN cl_ptr_vector_t * const p_vector,
+			      IN const size_t index,
+			      IN const void *const element)
 {
 	cl_status_t status;
 
@@ -165,9 +164,8 @@ void *cl_ptr_vector_remove(IN cl_ptr_vector_t * const p_vector,
 	return ((void *)element);
 }
 
-cl_status_t
-cl_ptr_vector_set_capacity(IN cl_ptr_vector_t * const p_vector,
-			   IN const size_t new_capacity)
+cl_status_t cl_ptr_vector_set_capacity(IN cl_ptr_vector_t * const p_vector,
+				       IN const size_t new_capacity)
 {
 	void *p_new_ptr_array;
 
@@ -205,9 +203,8 @@ cl_ptr_vector_set_capacity(IN cl_ptr_vector_t * const p_vector,
 	return (CL_SUCCESS);
 }
 
-cl_status_t
-cl_ptr_vector_set_size(IN cl_ptr_vector_t * const p_vector,
-		       IN const size_t size)
+cl_status_t cl_ptr_vector_set_size(IN cl_ptr_vector_t * const p_vector,
+				   IN const size_t size)
 {
 	cl_status_t status;
 	size_t new_capacity;
@@ -241,9 +238,8 @@ cl_ptr_vector_set_size(IN cl_ptr_vector_t * const p_vector,
 	return (CL_SUCCESS);
 }
 
-cl_status_t
-cl_ptr_vector_set_min_size(IN cl_ptr_vector_t * const p_vector,
-			   IN const size_t min_size)
+cl_status_t cl_ptr_vector_set_min_size(IN cl_ptr_vector_t * const p_vector,
+				       IN const size_t min_size)
 {
 	CL_ASSERT(p_vector);
 	CL_ASSERT(p_vector->state == CL_INITIALIZED);
@@ -257,10 +253,9 @@ cl_ptr_vector_set_min_size(IN cl_ptr_vector_t * const p_vector,
 	return (CL_SUCCESS);
 }
 
-void
-cl_ptr_vector_apply_func(IN const cl_ptr_vector_t * const p_vector,
-			 IN cl_pfn_ptr_vec_apply_t pfn_callback,
-			 IN const void *const context)
+void cl_ptr_vector_apply_func(IN const cl_ptr_vector_t * const p_vector,
+			      IN cl_pfn_ptr_vec_apply_t pfn_callback,
+			      IN const void *const context)
 {
 	size_t i;
 
@@ -273,10 +268,9 @@ cl_ptr_vector_apply_func(IN const cl_ptr_vector_t * const p_vector,
 			     (void *)context);
 }
 
-size_t
-cl_ptr_vector_find_from_start(IN const cl_ptr_vector_t * const p_vector,
-			      IN cl_pfn_ptr_vec_find_t pfn_callback,
-			      IN const void *const context)
+size_t cl_ptr_vector_find_from_start(IN const cl_ptr_vector_t * const p_vector,
+				     IN cl_pfn_ptr_vec_find_t pfn_callback,
+				     IN const void *const context)
 {
 	size_t i;
 
@@ -294,10 +288,9 @@ cl_ptr_vector_find_from_start(IN const cl_ptr_vector_t * const p_vector,
 	return (i);
 }
 
-size_t
-cl_ptr_vector_find_from_end(IN const cl_ptr_vector_t * const p_vector,
-			    IN cl_pfn_ptr_vec_find_t pfn_callback,
-			    IN const void *const context)
+size_t cl_ptr_vector_find_from_end(IN const cl_ptr_vector_t * const p_vector,
+				   IN cl_pfn_ptr_vec_find_t pfn_callback,
+				   IN const void *const context)
 {
 	size_t i;
 
@@ -309,7 +302,8 @@ cl_ptr_vector_find_from_end(IN const cl_ptr_vector_t * const p_vector,
 
 	while (i) {
 		/* Invoke the callback for the current element. */
-		if (pfn_callback(i, (void *)p_vector->p_ptr_array[--i],
+		i--;
+		if (pfn_callback(i, (void *)p_vector->p_ptr_array[i],
 				 (void *)context) == CL_SUCCESS) {
 			return (i);
 		}
diff --git a/complib/cl_thread.c b/complib/cl_thread.c
index ab1a329..e416466 100644
--- a/complib/cl_thread.c
+++ b/complib/cl_thread.c
@@ -66,10 +66,10 @@ void cl_thread_construct(IN cl_thread_t * const p_thread)
 	p_thread->osd.state = CL_UNINITIALIZED;
 }
 
-cl_status_t
-cl_thread_init(IN cl_thread_t * const p_thread,
-	       IN cl_pfn_thread_callback_t pfn_callback,
-	       IN const void *const context, IN const char *const name)
+cl_status_t cl_thread_init(IN cl_thread_t * const p_thread,
+			   IN cl_pfn_thread_callback_t pfn_callback,
+			   IN const void *const context,
+			   IN const char *const name)
 {
 	int ret;
 
diff --git a/complib/cl_threadpool.c b/complib/cl_threadpool.c
index 3f6c0a4..0f6498b 100644
--- a/complib/cl_threadpool.c
+++ b/complib/cl_threadpool.c
@@ -72,11 +72,10 @@ static void *thread_pool_routine(void *context)
 	return NULL;
 }
 
-cl_status_t
-cl_thread_pool_init(IN cl_thread_pool_t * const p_thread_pool,
-		    IN unsigned count,
-		    IN void (*pfn_callback) (void *),
-		    IN void *context, IN const char *const name)
+cl_status_t cl_thread_pool_init(IN cl_thread_pool_t * const p_thread_pool,
+				IN unsigned count,
+				IN void (*pfn_callback) (void *),
+				IN void *context, IN const char *const name)
 {
 	int i;
 
@@ -106,7 +105,7 @@ cl_thread_pool_init(IN cl_thread_pool_t * const p_thread_pool,
 
 	for (i = 0; i < count; i++) {
 		if (pthread_create(&p_thread_pool->tid[i], NULL,
-				   thread_pool_routine, p_thread_pool) < 0) {
+				   thread_pool_routine, p_thread_pool) != 0) {
 			cl_thread_pool_destroy(p_thread_pool);
 			return CL_INSUFFICIENT_RESOURCES;
 		}
diff --git a/complib/cl_timer.c b/complib/cl_timer.c
index 41b669f..92b8102 100644
--- a/complib/cl_timer.c
+++ b/complib/cl_timer.c
@@ -212,10 +212,9 @@ void cl_timer_construct(IN cl_timer_t * const p_timer)
 	p_timer->state = CL_UNINITIALIZED;
 }
 
-cl_status_t
-cl_timer_init(IN cl_timer_t * const p_timer,
-	      IN cl_pfn_timer_callback_t pfn_callback,
-	      IN const void *const context)
+cl_status_t cl_timer_init(IN cl_timer_t * const p_timer,
+			  IN cl_pfn_timer_callback_t pfn_callback,
+			  IN const void *const context)
 {
 	CL_ASSERT(p_timer);
 	CL_ASSERT(pfn_callback);
@@ -259,9 +258,8 @@ void cl_timer_destroy(IN cl_timer_t * const p_timer)
 /*
  * Return TRUE if timeout value 1 is earlier than timeout value 2.
  */
-static __inline boolean_t
-__cl_timer_is_earlier(IN struct timespec *p_timeout1,
-		      IN struct timespec *p_timeout2)
+static __inline boolean_t __cl_timer_is_earlier(IN struct timespec *p_timeout1,
+						IN struct timespec *p_timeout2)
 {
 	return ((p_timeout1->tv_sec < p_timeout2->tv_sec) ||
 		((p_timeout1->tv_sec == p_timeout2->tv_sec) &&
@@ -273,9 +271,8 @@ __cl_timer_is_earlier(IN struct timespec *p_timeout1,
  * the context.  Both the list item and the context are pointers to
  * a cl_timer_t structure with valid timeouts.
  */
-static cl_status_t
-__cl_timer_find(IN const cl_list_item_t * const p_list_item,
-		IN void *const context)
+static cl_status_t __cl_timer_find(IN const cl_list_item_t * const p_list_item,
+				   IN void *const context)
 {
 	cl_timer_t *p_in_list;
 	cl_timer_t *p_new;
@@ -297,12 +294,28 @@ __cl_timer_find(IN const cl_list_item_t * const p_list_item,
 	return (CL_NOT_FOUND);
 }
 
-cl_status_t
-cl_timer_start(IN cl_timer_t * const p_timer, IN const uint32_t time_ms)
+/*
+ * Calculate 'struct timespec' value that is the
+ * current time plus the 'time_ms' milliseconds.
+ */
+static __inline void __cl_timer_calculate(IN const uint32_t time_ms,
+					  OUT struct timespec * const p_timer)
+{
+	struct timeval curtime, deltatime, endtime;
+
+	gettimeofday(&curtime, NULL);
+
+	deltatime.tv_sec = time_ms / 1000;
+	deltatime.tv_usec = (time_ms % 1000) * 1000;
+	timeradd(&curtime, &deltatime, &endtime);
+	p_timer->tv_sec = endtime.tv_sec;
+	p_timer->tv_nsec = endtime.tv_usec * 1000;
+}
+
+cl_status_t cl_timer_start(IN cl_timer_t * const p_timer,
+			   IN const uint32_t time_ms)
 {
-	struct timeval curtime;
 	cl_list_item_t *p_list_item;
-	uint32_t delta_time = time_ms;
 
 	CL_ASSERT(p_timer);
 	CL_ASSERT(p_timer->state == CL_INITIALIZED);
@@ -316,20 +329,7 @@ cl_timer_start(IN cl_timer_t * const p_timer, IN const uint32_t time_ms)
 		cl_qlist_remove_item(&gp_timer_prov->queue,
 				     &p_timer->list_item);
 
-	/* Get the current time */
-#ifndef timerclear
-#define	timerclear(tvp)		(tvp)->tv_sec = (time_t)0, (tvp)->tv_usec = 0L
-#endif
-	timerclear(&curtime);
-	gettimeofday(&curtime, NULL);
-
-	/* do not do 0 wait ! */
-	/* if (delta_time < 1000.0) {delta_time = 1000;} */
-
-	/* Calculate the timeout. */
-	p_timer->timeout.tv_sec = curtime.tv_sec + (delta_time / 1000);
-	p_timer->timeout.tv_nsec =
-	    (curtime.tv_usec + ((delta_time % 1000) * 1000)) * 1000;
+	__cl_timer_calculate(time_ms, &p_timer->timeout);
 
 	/* Add the timer to the queue. */
 	if (cl_is_qlist_empty(&gp_timer_prov->queue)) {
@@ -385,10 +385,9 @@ void cl_timer_stop(IN cl_timer_t * const p_timer)
 	pthread_mutex_unlock(&gp_timer_prov->mutex);
 }
 
-cl_status_t
-cl_timer_trim(IN cl_timer_t * const p_timer, IN const uint32_t time_ms)
+cl_status_t cl_timer_trim(IN cl_timer_t * const p_timer,
+			  IN const uint32_t time_ms)
 {
-	struct timeval curtime;
 	struct timespec newtime;
 	cl_status_t status;
 
@@ -397,13 +396,7 @@ cl_timer_trim(IN cl_timer_t * const p_timer, IN const uint32_t time_ms)
 
 	pthread_mutex_lock(&gp_timer_prov->mutex);
 
-	/* Get the current time */
-	timerclear(&curtime);
-	gettimeofday(&curtime, NULL);
-
-	/* Calculate the timeout. */
-	newtime.tv_sec = curtime.tv_sec + (time_ms / 1000);
-	newtime.tv_nsec = (curtime.tv_usec + ((time_ms % 1000) * 1000)) * 1000;
+	__cl_timer_calculate(time_ms, &newtime);
 
 	if (p_timer->timer_state == CL_TIMER_QUEUED) {
 		/* If the old time is earlier, do not trim it.  Just return. */
@@ -426,7 +419,6 @@ uint64_t cl_get_time_stamp(void)
 	uint64_t tstamp;
 	struct timeval tv;
 
-	timerclear(&tv);
 	gettimeofday(&tv, NULL);
 
 	/* Convert the time of day into a microsecond timestamp. */
@@ -439,7 +431,6 @@ uint32_t cl_get_time_stamp_sec(void)
 {
 	struct timeval tv;
 
-	timerclear(&tv);
 	gettimeofday(&tv, NULL);
 
 	return (tv.tv_sec);
diff --git a/complib/cl_vector.c b/complib/cl_vector.c
index d9bcf34..f309a09 100644
--- a/complib/cl_vector.c
+++ b/complib/cl_vector.c
@@ -70,9 +70,9 @@
  *	None
  *
  */
-static void
-cl_vector_copy_general(OUT void *const p_dest,
-		       IN const void *const p_src, IN const size_t size)
+static void cl_vector_copy_general(OUT void *const p_dest,
+				   IN const void *const p_src,
+				   IN const size_t size)
 {
 	memcpy(p_dest, p_src, size);
 }
@@ -93,9 +93,8 @@ cl_vector_copy_general(OUT void *const p_dest,
  *	None
  *
  */
-static void
-cl_vector_copy8(OUT void *const p_dest,
-		IN const void *const p_src, IN const size_t size)
+static void cl_vector_copy8(OUT void *const p_dest,
+			    IN const void *const p_src, IN const size_t size)
 {
 	CL_ASSERT(size == sizeof(uint8_t));
 	UNUSED_PARAM(size);
@@ -119,9 +118,8 @@ cl_vector_copy8(OUT void *const p_dest,
  *	None
  *
  */
-void
-cl_vector_copy16(OUT void *const p_dest,
-		 IN const void *const p_src, IN const size_t size)
+void cl_vector_copy16(OUT void *const p_dest,
+		      IN const void *const p_src, IN const size_t size)
 {
 	CL_ASSERT(size == sizeof(uint16_t));
 	UNUSED_PARAM(size);
@@ -145,9 +143,8 @@ cl_vector_copy16(OUT void *const p_dest,
  *	None
  *
  */
-void
-cl_vector_copy32(OUT void *const p_dest,
-		 IN const void *const p_src, IN const size_t size)
+void cl_vector_copy32(OUT void *const p_dest,
+		      IN const void *const p_src, IN const size_t size)
 {
 	CL_ASSERT(size == sizeof(uint32_t));
 	UNUSED_PARAM(size);
@@ -171,9 +168,8 @@ cl_vector_copy32(OUT void *const p_dest,
  *	None
  *
  */
-void
-cl_vector_copy64(OUT void *const p_dest,
-		 IN const void *const p_src, IN const size_t size)
+void cl_vector_copy64(OUT void *const p_dest,
+		      IN const void *const p_src, IN const size_t size)
 {
 	CL_ASSERT(size == sizeof(uint64_t));
 	UNUSED_PARAM(size);
@@ -190,14 +186,12 @@ void cl_vector_construct(IN cl_vector_t * const p_vector)
 	p_vector->state = CL_UNINITIALIZED;
 }
 
-cl_status_t
-cl_vector_init(IN cl_vector_t * const p_vector,
-	       IN const size_t min_size,
-	       IN const size_t grow_size,
-	       IN const size_t element_size,
-	       IN cl_pfn_vec_init_t pfn_init OPTIONAL,
-	       IN cl_pfn_vec_dtor_t pfn_dtor OPTIONAL,
-	       IN const void *const context)
+cl_status_t cl_vector_init(IN cl_vector_t * const p_vector,
+			   IN const size_t min_size, IN const size_t grow_size,
+			   IN const size_t element_size,
+			   IN cl_pfn_vec_init_t pfn_init OPTIONAL,
+			   IN cl_pfn_vec_dtor_t pfn_dtor OPTIONAL,
+			   IN const void *const context)
 {
 	cl_status_t status = CL_SUCCESS;
 
@@ -291,9 +285,8 @@ void cl_vector_destroy(IN cl_vector_t * const p_vector)
 	p_vector->state = CL_UNINITIALIZED;
 }
 
-cl_status_t
-cl_vector_at(IN const cl_vector_t * const p_vector,
-	     IN const size_t index, OUT void *const p_element)
+cl_status_t cl_vector_at(IN const cl_vector_t * const p_vector,
+			 IN const size_t index, OUT void *const p_element)
 {
 	CL_ASSERT(p_vector);
 	CL_ASSERT(p_vector->state == CL_INITIALIZED);
@@ -306,9 +299,8 @@ cl_vector_at(IN const cl_vector_t * const p_vector,
 	return (CL_SUCCESS);
 }
 
-cl_status_t
-cl_vector_set(IN cl_vector_t * const p_vector,
-	      IN const size_t index, IN void *const p_element)
+cl_status_t cl_vector_set(IN cl_vector_t * const p_vector,
+			  IN const size_t index, IN void *const p_element)
 {
 	cl_status_t status;
 	void *p_dest;
@@ -338,9 +330,8 @@ cl_vector_set(IN cl_vector_t * const p_vector,
 	return (CL_SUCCESS);
 }
 
-cl_status_t
-cl_vector_set_capacity(IN cl_vector_t * const p_vector,
-		       IN const size_t new_capacity)
+cl_status_t cl_vector_set_capacity(IN cl_vector_t * const p_vector,
+				   IN const size_t new_capacity)
 {
 	size_t new_elements;
 	size_t alloc_size;
@@ -406,8 +397,8 @@ cl_vector_set_capacity(IN cl_vector_t * const p_vector,
 	return (CL_SUCCESS);
 }
 
-cl_status_t
-cl_vector_set_size(IN cl_vector_t * const p_vector, IN const size_t size)
+cl_status_t cl_vector_set_size(IN cl_vector_t * const p_vector,
+			       IN const size_t size)
 {
 	cl_status_t status;
 	size_t new_capacity;
@@ -478,9 +469,8 @@ cl_vector_set_size(IN cl_vector_t * const p_vector, IN const size_t size)
 	return (CL_SUCCESS);
 }
 
-cl_status_t
-cl_vector_set_min_size(IN cl_vector_t * const p_vector,
-		       IN const size_t min_size)
+cl_status_t cl_vector_set_min_size(IN cl_vector_t * const p_vector,
+				   IN const size_t min_size)
 {
 	CL_ASSERT(p_vector);
 	CL_ASSERT(p_vector->state == CL_INITIALIZED);
@@ -494,10 +484,9 @@ cl_vector_set_min_size(IN cl_vector_t * const p_vector,
 	return (CL_SUCCESS);
 }
 
-void
-cl_vector_apply_func(IN const cl_vector_t * const p_vector,
-		     IN cl_pfn_vec_apply_t pfn_callback,
-		     IN const void *const context)
+void cl_vector_apply_func(IN const cl_vector_t * const p_vector,
+			  IN cl_pfn_vec_apply_t pfn_callback,
+			  IN const void *const context)
 {
 	size_t i;
 	void *p_element;
@@ -512,10 +501,9 @@ cl_vector_apply_func(IN const cl_vector_t * const p_vector,
 	}
 }
 
-size_t
-cl_vector_find_from_start(IN const cl_vector_t * const p_vector,
-			  IN cl_pfn_vec_find_t pfn_callback,
-			  IN const void *const context)
+size_t cl_vector_find_from_start(IN const cl_vector_t * const p_vector,
+				 IN cl_pfn_vec_find_t pfn_callback,
+				 IN const void *const context)
 {
 	size_t i;
 	void *p_element;
@@ -533,10 +521,9 @@ cl_vector_find_from_start(IN const cl_vector_t * const p_vector,
 	return (i);
 }
 
-size_t
-cl_vector_find_from_end(IN const cl_vector_t * const p_vector,
-			IN cl_pfn_vec_find_t pfn_callback,
-			IN const void *const context)
+size_t cl_vector_find_from_end(IN const cl_vector_t * const p_vector,
+			       IN cl_pfn_vec_find_t pfn_callback,
+			       IN const void *const context)
 {
 	size_t i;
 	void *p_element;
diff --git a/complib/libosmcomp.map b/complib/libosmcomp.map
index 788eb2a..52410cc 100644
--- a/complib/libosmcomp.map
+++ b/complib/libosmcomp.map
@@ -66,6 +66,7 @@ OSMCOMP_2.3 {
 		cl_map_merge;
 		cl_map_delta;
 		cl_fmap_init;
+		cl_fmap_match;
 		cl_fmap_get;
 		cl_fmap_get_next;
 		cl_fmap_apply_func;
diff --git a/complib/libosmcomp.ver b/complib/libosmcomp.ver
index f076585..59a0860 100644
--- a/complib/libosmcomp.ver
+++ b/complib/libosmcomp.ver
@@ -6,4 +6,4 @@
 # API_REV - advance on any added API
 # RUNNING_REV - advance any change to the vendor files
 # AGE - number of backward versions the API still supports
-LIBVERSION=2:4:0
+LIBVERSION=3:6:0
diff --git a/config/config.guess b/config/config.guess
index 202f698..49ba16f 100755
--- a/config/config.guess
+++ b/config/config.guess
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-#   Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011, 2012 Free Software Foundation, Inc.
 
-timestamp='2008-09-28'
+timestamp='2012-01-01'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -27,16 +27,16 @@ timestamp='2008-09-28'
 # the same distribution terms that you use for the rest of that program.
 
 
-# Originally written by Per Bothner <per at bothner.com>.
-# Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches at gnu.org> and include a ChangeLog
+# entry.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
 # exits with 0.  Otherwise, it exits with 1.
 #
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -56,8 +56,9 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -139,29 +140,12 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
-if [ "${UNAME_SYSTEM}" = "Linux" ] ; then
-	eval $set_cc_for_build
-	cat << EOF > $dummy.c
-	#include <features.h>
-	#ifdef __UCLIBC__
-	# ifdef __UCLIBC_CONFIG_VERSION__
-	LIBC=uclibc __UCLIBC_CONFIG_VERSION__
-	# else
-	LIBC=uclibc
-	# endif
-	#else
-	LIBC=gnu
-	#endif
-EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'`
-fi
-
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
 	# switched to ELF, *-*-netbsd* would select the old
 	# object file format.  This provides both forward
@@ -187,7 +171,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-			| grep __ELF__ >/dev/null
+			| grep -q __ELF__
 		then
 		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
 		    # Return netbsd for either.  FIX?
@@ -197,7 +181,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		fi
 		;;
 	    *)
-	        os=netbsd
+		os=netbsd
 		;;
 	esac
 	# The OS release
@@ -240,7 +224,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
 		;;
 	*5.*)
-	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
 		;;
 	esac
 	# According to Compaq, /usr/sbin/psrinfo has been available on
@@ -286,7 +270,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
 	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	exit ;;
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+	exitcode=$?
+	trap '' 0
+	exit $exitcode ;;
     Alpha\ *:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# Should we change UNAME_MACHINE based on the output of uname instead
@@ -312,7 +299,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	echo s390-ibm-zvmoe
 	exit ;;
     *:OS400:*:*)
-        echo powerpc-ibm-os400
+	echo powerpc-ibm-os400
 	exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
@@ -341,14 +328,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	case `/usr/bin/uname -p` in
 	    sparc) echo sparc-icl-nx7; exit ;;
 	esac ;;
+    s390x:SunOS:*:*)
+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
     sun4H:SunOS:5.*:*)
 	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+	echo i386-pc-auroraux${UNAME_RELEASE}
+	exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
-	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	eval $set_cc_for_build
+	SUN_ARCH="i386"
+	# If there is a compiler, see if it is configured for 64-bit objects.
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+	# This test works for both compilers.
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		SUN_ARCH="x86_64"
+	    fi
+	fi
+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     sun4*:SunOS:6*:*)
 	# According to config.sub, this is the proper way to canonicalize
@@ -392,23 +398,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     # MiNT.  But MiNT is downward compatible to TOS, so this should
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint${UNAME_RELEASE}
 	exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
 	echo m68k-atari-mint${UNAME_RELEASE}
-        exit ;;
+	exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint${UNAME_RELEASE}
 	exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-        echo m68k-milan-mint${UNAME_RELEASE}
-        exit ;;
+	echo m68k-milan-mint${UNAME_RELEASE}
+	exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-        echo m68k-hades-mint${UNAME_RELEASE}
-        exit ;;
+	echo m68k-hades-mint${UNAME_RELEASE}
+	exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
-        exit ;;
+	echo m68k-unknown-mint${UNAME_RELEASE}
+	exit ;;
     m68k:machten:*:*)
 	echo m68k-apple-machten${UNAME_RELEASE}
 	exit ;;
@@ -478,8 +484,8 @@ EOF
 	echo m88k-motorola-sysv3
 	exit ;;
     AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	# DG/UX returns AViiON for all architectures
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
 	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
 	then
 	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@@ -492,7 +498,7 @@ EOF
 	else
 	    echo i586-dg-dgux${UNAME_RELEASE}
 	fi
- 	exit ;;
+	exit ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
 	echo m88k-dolphin-sysv3
 	exit ;;
@@ -549,7 +555,7 @@ EOF
 		echo rs6000-ibm-aix3.2
 	fi
 	exit ;;
-    *:AIX:*:[456])
+    *:AIX:*:[4567])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
@@ -592,52 +598,52 @@ EOF
 	    9000/[678][0-9][0-9])
 		if [ -x /usr/bin/getconf ]; then
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-                    case "${sc_cpu_version}" in
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-                      532)                      # CPU_PA_RISC2_0
-                        case "${sc_kernel_bits}" in
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
+		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+		    case "${sc_cpu_version}" in
+		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+		      532)                      # CPU_PA_RISC2_0
+			case "${sc_kernel_bits}" in
+			  32) HP_ARCH="hppa2.0n" ;;
+			  64) HP_ARCH="hppa2.0w" ;;
 			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
+			esac ;;
+		    esac
 		fi
 		if [ "${HP_ARCH}" = "" ]; then
 		    eval $set_cc_for_build
-		    sed 's/^              //' << EOF >$dummy.c
+		    sed 's/^		//' << EOF >$dummy.c
 
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
+		#define _HPUX_SOURCE
+		#include <stdlib.h>
+		#include <unistd.h>
 
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
+		int main ()
+		{
+		#if defined(_SC_KERNEL_BITS)
+		    long bits = sysconf(_SC_KERNEL_BITS);
+		#endif
+		    long cpu  = sysconf (_SC_CPU_VERSION);
 
-                  switch (cpu)
-              	{
-              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-              	case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-              	    switch (bits)
-              		{
-              		case 64: puts ("hppa2.0w"); break;
-              		case 32: puts ("hppa2.0n"); break;
-              		default: puts ("hppa2.0"); break;
-              		} break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-              	    puts ("hppa2.0"); break;
-              #endif
-              	default: puts ("hppa1.0"); break;
-              	}
-                  exit (0);
-              }
+		    switch (cpu)
+			{
+			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+			case CPU_PA_RISC2_0:
+		#if defined(_SC_KERNEL_BITS)
+			    switch (bits)
+				{
+				case 64: puts ("hppa2.0w"); break;
+				case 32: puts ("hppa2.0n"); break;
+				default: puts ("hppa2.0"); break;
+				} break;
+		#else  /* !defined(_SC_KERNEL_BITS) */
+			    puts ("hppa2.0"); break;
+		#endif
+			default: puts ("hppa1.0"); break;
+			}
+		    exit (0);
+		}
 EOF
 		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
@@ -657,7 +663,7 @@ EOF
 	    # => hppa64-hp-hpux11.23
 
 	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
-		grep __LP64__ >/dev/null
+		grep -q __LP64__
 	    then
 		HP_ARCH="hppa2.0w"
 	    else
@@ -728,22 +734,22 @@ EOF
 	exit ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
 	echo c1-convex-bsd
-        exit ;;
+	exit ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
 	else echo c2-convex-bsd
 	fi
-        exit ;;
+	exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
 	echo c34-convex-bsd
-        exit ;;
+	exit ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
 	echo c38-convex-bsd
-        exit ;;
+	exit ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
 	echo c4-convex-bsd
-        exit ;;
+	exit ;;
     CRAY*Y-MP:*:*:*)
 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
@@ -767,14 +773,14 @@ EOF
 	exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit ;;
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
     5000:UNIX_System_V:4.*:*)
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
-        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@@ -786,13 +792,12 @@ EOF
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
-	case ${UNAME_MACHINE} in
-	    pc98)
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case ${UNAME_PROCESSOR} in
 	    amd64)
 		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    *)
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	esac
 	exit ;;
     i*:CYGWIN*:*)
@@ -801,19 +806,22 @@ EOF
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
+    i*:MSYS*:*)
+	echo ${UNAME_MACHINE}-pc-msys
+	exit ;;
     i*:windows32*:*)
-    	# uname -m includes "-pc" on this system.
-    	echo ${UNAME_MACHINE}-mingw32
+	# uname -m includes "-pc" on this system.
+	echo ${UNAME_MACHINE}-mingw32
 	exit ;;
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
-    *:Interix*:[3456]*)
-    	case ${UNAME_MACHINE} in
+    *:Interix*:*)
+	case ${UNAME_MACHINE} in
 	    x86)
 		echo i586-pc-interix${UNAME_RELEASE}
 		exit ;;
-	    EM64T | authenticamd | genuineintel)
+	    authenticamd | genuineintel | EM64T)
 		echo x86_64-unknown-interix${UNAME_RELEASE}
 		exit ;;
 	    IA64)
@@ -823,6 +831,9 @@ EOF
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
 	exit ;;
+    8664:Windows_NT:*)
+	echo x86_64-pc-mks
+	exit ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -852,203 +863,137 @@ EOF
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+	esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
     arm*:Linux:*:*)
 	eval $set_cc_for_build
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
 	    | grep -q __ARM_EABI__
 	then
-	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	    echo ${UNAME_MACHINE}-unknown-linux-gnu
 	else
-	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
+	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+		| grep -q __ARM_PCS_VFP
+	    then
+		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	    else
+		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+	    fi
 	fi
 	exit ;;
     avr32*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     cris:Linux:*:*)
-	echo cris-axis-linux-${LIBC}
+	echo ${UNAME_MACHINE}-axis-linux-gnu
 	exit ;;
     crisv32:Linux:*:*)
-	echo crisv32-axis-linux-${LIBC}
+	echo ${UNAME_MACHINE}-axis-linux-gnu
 	exit ;;
     frv:Linux:*:*)
-    	echo frv-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    hexagon:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	LIBC=gnu
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
 	exit ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
-    mips:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#undef CPU
-	#undef mips
-	#undef mipsel
-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mipsel
-	#else
-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips
-	#else
-	CPU=
-	#endif
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
-	;;
-    mips64:Linux:*:*)
+    mips:Linux:*:* | mips64:Linux:*:*)
 	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
 	#undef CPU
-	#undef mips64
-	#undef mips64el
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
 	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mips64el
+	CPU=${UNAME_MACHINE}el
 	#else
 	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips64
+	CPU=${UNAME_MACHINE}
 	#else
 	CPU=
 	#endif
 	#endif
 EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
     or32:Linux:*:*)
-	echo or32-unknown-linux-${LIBC}
-	exit ;;
-    ppc:Linux:*:*)
-	echo powerpc-unknown-linux-${LIBC}
-	exit ;;
-    ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-${LIBC}
-	exit ;;
-    alpha:Linux:*:*)
-	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-	  EV5)   UNAME_MACHINE=alphaev5 ;;
-	  EV56)  UNAME_MACHINE=alphaev56 ;;
-	  PCA56) UNAME_MACHINE=alphapca56 ;;
-	  PCA57) UNAME_MACHINE=alphapca56 ;;
-	  EV6)   UNAME_MACHINE=alphaev6 ;;
-	  EV67)  UNAME_MACHINE=alphaev67 ;;
-	  EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
-	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
-	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     padre:Linux:*:*)
 	echo sparc-unknown-linux-gnu
 	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
-	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
-	  *)    echo hppa-unknown-linux-${LIBC} ;;
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
 	esac
 	exit ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-${LIBC}
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
 	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux
 	exit ;;
     sh64*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    tile*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     vax:Linux:*:*)
-	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
+	echo ${UNAME_MACHINE}-dec-linux-gnu
 	exit ;;
     x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     xtensa*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
-    i*86:Linux:*:*)
-	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us. cd to the root directory to prevent
-	# problems with other programs or directories called `ld' in the path.
-	# Set LC_ALL=C to ensure ld outputs messages in English.
-	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
-			 | sed -ne '/supported targets:/!d
-				    s/[ 	][ 	]*/ /g
-				    s/.*supported targets: *//
-				    s/ .*//
-				    p'`
-        case "$ld_supported_targets" in
-	  elf32-i386)
-		TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}"
-		;;
-	  a.out-i386-linux)
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout"
-		exit ;;
-	  "")
-		# Either a pre-BFD a.out linker (linux-gnuoldld) or
-		# one that does not give us useful --help.
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld"
-		exit ;;
-	esac
-	# This should get integrated into the C code below, but now we hack
-	if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi
-	# Determine whether the default compiler is a.out or elf
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#include <features.h>
-	#ifdef __ELF__
-	# ifdef __GLIBC__
-	#  if __GLIBC__ >= 2
-	LIBC=gnu
-	#  else
-	LIBC=gnulibc1
-	#  endif
-	# else
-	LIBC=gnulibc1
-	# endif
-	#else
-	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-	LIBC=gnu
-	#else
-	LIBC=gnuaout
-	#endif
-	#endif
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^LIBC/{
-		s: ::g
-		p
-	    }'`"
-	test x"${LIBC}" != x && {
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-		exit
-	}
-	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
-	;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
 	# earlier versions are messed up and put the nodename in both
@@ -1056,11 +1001,11 @@ EOF
 	echo i386-sequent-sysv4
 	exit ;;
     i*86:UNIX_SV:4.2MP:2.*)
-        # Unixware is an offshoot of SVR4, but it has its own version
-        # number series starting with 2...
-        # I am not positive that other SVR4 systems won't match this,
+	# Unixware is an offshoot of SVR4, but it has its own version
+	# number series starting with 2...
+	# I am not positive that other SVR4 systems won't match this,
 	# I just have to hope.  -- rms.
-        # Use sysv4.2uw... so that sysv4* matches it.
+	# Use sysv4.2uw... so that sysv4* matches it.
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
 	exit ;;
     i*86:OS/2:*:*)
@@ -1077,7 +1022,7 @@ EOF
     i*86:syllable:*:*)
 	echo ${UNAME_MACHINE}-pc-syllable
 	exit ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
 	echo i386-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
     i*86:*DOS:*:*)
@@ -1092,7 +1037,7 @@ EOF
 	fi
 	exit ;;
     i*86:*:5:[678]*)
-    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	# UnixWare 7.x, OpenUNIX and OpenServer 6.
 	case `/bin/uname -X | grep "^Machine"` in
 	    *486*)	     UNAME_MACHINE=i486 ;;
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
@@ -1120,10 +1065,13 @@ EOF
 	exit ;;
     pc:*:*:*)
 	# Left here for compatibility:
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i386.
-	echo i386-pc-msdosdjgpp
-        exit ;;
+	# uname -m prints for DJGPP always 'pc', but it prints nothing about
+	# the processor, so we play safe by assuming i586.
+	# Note: whatever this is, it MUST be the same as what config.sub
+	# prints for the "djgpp" host, or else GDB configury will decide that
+	# this is a cross-build.
+	echo i586-pc-msdosdjgpp
+	exit ;;
     Intel:Mach:3*:*)
 	echo i386-pc-mach3
 	exit ;;
@@ -1158,8 +1106,18 @@ EOF
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
 	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && { echo i486-ncr-sysv4; exit; } ;;
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+	OS_REL='.3'
+	test -r /etc/.relid \
+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
 	echo m68k-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
@@ -1172,7 +1130,7 @@ EOF
     rs6000:LynxOS:2.*:*)
 	echo rs6000-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
 	echo powerpc-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
     SM[BE]S:UNIX_SV:*:*)
@@ -1192,10 +1150,10 @@ EOF
 		echo ns32k-sni-sysv
 	fi
 	exit ;;
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                      # says <Richard.M.Bartel at ccMail.Census.GOV>
-        echo i586-unisys-sysv4
-        exit ;;
+    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+			# says <Richard.M.Bartel at ccMail.Census.GOV>
+	echo i586-unisys-sysv4
+	exit ;;
     *:UNIX_System_V:4*:FTX*)
 	# From Gerald Hewes <hewes at openmarket.com>.
 	# How about differentiating between stratus architectures? -djm
@@ -1221,11 +1179,11 @@ EOF
 	exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
-	        echo mips-nec-sysv${UNAME_RELEASE}
+		echo mips-nec-sysv${UNAME_RELEASE}
 	else
-	        echo mips-unknown-sysv${UNAME_RELEASE}
+		echo mips-unknown-sysv${UNAME_RELEASE}
 	fi
-        exit ;;
+	exit ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
 	echo powerpc-be-beos
 	exit ;;
@@ -1265,6 +1223,16 @@ EOF
     *:Darwin:*:*)
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
 	case $UNAME_PROCESSOR in
+	    i386)
+		eval $set_cc_for_build
+		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		      grep IS_64BIT_ARCH >/dev/null
+		  then
+		      UNAME_PROCESSOR="x86_64"
+		  fi
+		fi ;;
 	    unknown) UNAME_PROCESSOR=powerpc ;;
 	esac
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@@ -1280,6 +1248,9 @@ EOF
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit ;;
+    NEO-?:NONSTOP_KERNEL:*:*)
+	echo neo-tandem-nsk${UNAME_RELEASE}
+	exit ;;
     NSE-?:NONSTOP_KERNEL:*:*)
 	echo nse-tandem-nsk${UNAME_RELEASE}
 	exit ;;
@@ -1325,13 +1296,13 @@ EOF
 	echo pdp10-unknown-its
 	exit ;;
     SEI:*:*:SEIUX)
-        echo mips-sei-seiux${UNAME_RELEASE}
+	echo mips-sei-seiux${UNAME_RELEASE}
 	exit ;;
     *:DragonFly:*:*)
 	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
 	exit ;;
     *:*VMS:*:*)
-    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	UNAME_MACHINE=`(uname -p) 2>/dev/null`
 	case "${UNAME_MACHINE}" in
 	    A*) echo alpha-dec-vms ; exit ;;
 	    I*) echo ia64-dec-vms ; exit ;;
@@ -1346,6 +1317,9 @@ EOF
     i*86:rdos:*:*)
 	echo ${UNAME_MACHINE}-pc-rdos
 	exit ;;
+    i*86:AROS:*:*)
+	echo ${UNAME_MACHINE}-pc-aros
+	exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1368,11 +1342,11 @@ main ()
 #include <sys/param.h>
   printf ("m68k-sony-newsos%s\n",
 #ifdef NEWSOS4
-          "4"
+	"4"
 #else
-	  ""
+	""
 #endif
-         ); exit (0);
+	); exit (0);
 #endif
 #endif
 
diff --git a/config/config.sub b/config/config.sub
index 66f218c..d6b6b3c 100755
--- a/config/config.sub
+++ b/config/config.sub
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-#   Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011, 2012 Free Software Foundation, Inc.
 
-timestamp='2008-09-08'
+timestamp='2012-01-01'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -32,13 +32,16 @@ timestamp='2008-09-08'
 
 
 # Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# diff and a properly formatted GNU ChangeLog entry.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
 # If it is invalid, we print an error message on stderr and exit with code 1.
 # Otherwise, we print the canonical config type on stdout and succeed.
 
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
 # that are meaningful with *any* GNU software.
@@ -72,8 +75,9 @@ Report bugs and patches to <config-patches at gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -120,8 +124,10 @@ esac
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
-  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -148,10 +154,13 @@ case $os in
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray)
+	-apple | -axis | -knuth | -cray | -microblaze)
 		os=
 		basic_machine=$1
 		;;
+	-bluegene*)
+		os=-cnk
+		;;
 	-sim | -cisco | -oki | -wec | -winbond)
 		os=
 		basic_machine=$1
@@ -166,10 +175,10 @@ case $os in
 		os=-chorusos
 		basic_machine=$1
 		;;
- 	-chorusrdb)
- 		os=-chorusrdb
+	-chorusrdb)
+		os=-chorusrdb
 		basic_machine=$1
- 		;;
+		;;
 	-hiux*)
 		os=-hiuxwe2
 		;;
@@ -242,13 +251,18 @@ case $basic_machine in
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+        | be32 | be64 \
 	| bfin \
 	| c4x | clipper \
-	| d10v | d30v | dlx | dsp16xx | dvp \
+	| d10v | d30v | dlx | dsp16xx \
+	| epiphany \
 	| fido | fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| hexagon \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
+	| le32 | le64 \
+	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
 	| maxq | mb | microblaze | mcore | mep | metag \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
@@ -270,29 +284,42 @@ case $basic_machine in
 	| mipsisa64sr71k | mipsisa64sr71kel \
 	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
+	| moxie \
 	| mt \
 	| msp430 \
+	| nds32 | nds32le | nds32be \
 	| nios | nios2 \
 	| ns16k | ns32k \
+	| open8 \
 	| or32 \
 	| pdp10 | pdp11 | pj | pjl \
-	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| powerpc | powerpc64 | powerpc64le | powerpcle \
 	| pyramid \
+	| rl78 | rx \
 	| score \
-	| sh | sh[1234] | sh[24]a | sh[24]a*eb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-	| spu | strongarm \
-	| tahoe | thumb | tic4x | tic80 | tron \
-	| v850 | v850e \
+	| spu \
+	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+	| ubicom32 \
+	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
 	| we32k \
-	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
 		basic_machine=$basic_machine-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12)
-		# Motorola 68HC11/12.
+	c54x)
+		basic_machine=tic54x-unknown
+		;;
+	c55x)
+		basic_machine=tic55x-unknown
+		;;
+	c6x)
+		basic_machine=tic6x-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
 		basic_machine=$basic_machine-unknown
 		os=-none
 		;;
@@ -302,6 +329,18 @@ case $basic_machine in
 		basic_machine=mt-unknown
 		;;
 
+	strongarm | thumb | xscale)
+		basic_machine=arm-unknown
+		;;
+
+	xscaleeb)
+		basic_machine=armeb-unknown
+		;;
+
+	xscaleel)
+		basic_machine=armel-unknown
+		;;
+
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
@@ -321,19 +360,23 @@ case $basic_machine in
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* \
 	| clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| hexagon-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
+	| le32-* | le64-* \
+	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
@@ -355,24 +398,29 @@ case $basic_machine in
 	| mmix-* \
 	| mt-* \
 	| msp430-* \
+	| nds32-* | nds32le-* | nds32be-* \
 	| nios-* | nios2-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
+	| open8-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
 	| pyramid-* \
-	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]a*eb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| rl78-* | romp-* | rs6000-* | rx-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
-	| tahoe-* | thumb-* \
-	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| tahoe-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tile*-* \
 	| tron-* \
-	| v850-* | v850e-* | vax-* \
+	| ubicom32-* \
+	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+	| vax-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
 	| ymp-* \
 	| z8k-* | z80-*)
@@ -397,7 +445,7 @@ case $basic_machine in
 		basic_machine=a29k-amd
 		os=-udi
 		;;
-    	abacus)
+	abacus)
 		basic_machine=abacus-unknown
 		;;
 	adobe68k)
@@ -443,6 +491,10 @@ case $basic_machine in
 		basic_machine=m68k-apollo
 		os=-bsd
 		;;
+	aros)
+		basic_machine=i386-pc
+		os=-aros
+		;;
 	aux)
 		basic_machine=m68k-apple
 		os=-aux
@@ -459,11 +511,24 @@ case $basic_machine in
 		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
 		os=-linux
 		;;
+	bluegene*)
+		basic_machine=powerpc-ibm
+		os=-cnk
+		;;
+	c54x-*)
+		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c55x-*)
+		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c6x-*)
+		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	c90)
 		basic_machine=c90-cray
 		os=-unicos
 		;;
-        cegcc)
+	cegcc)
 		basic_machine=arm-unknown
 		os=-cegcc
 		;;
@@ -495,7 +560,7 @@ case $basic_machine in
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16)
+	cr16 | cr16-*)
 		basic_machine=cr16-unknown
 		os=-elf
 		;;
@@ -653,7 +718,6 @@ case $basic_machine in
 	i370-ibm* | ibm*)
 		basic_machine=i370-ibm
 		;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
 	i*86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
@@ -711,6 +775,9 @@ case $basic_machine in
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
+	microblaze)
+		basic_machine=microblaze-xilinx
+		;;
 	mingw32)
 		basic_machine=i386-pc
 		os=-mingw32
@@ -726,24 +793,6 @@ case $basic_machine in
 		basic_machine=m68k-atari
 		os=-mint
 		;;
-	mipsEE* | ee | ps2)
-		basic_machine=mips64r5900el-scei
-		case $os in
-		    -linux*)
-			;;
-		    *)
-			os=-elf
-			;;
-		esac
-		;;
-	iop)
-		basic_machine=mipsel-scei
-		os=-irx
-		;;
-	dvp)
-		basic_machine=dvp-scei
-		os=-elf
-		;;
 	mips3*-*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
 		;;
@@ -765,10 +814,18 @@ case $basic_machine in
 	ms1-*)
 		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
 		;;
+	msys)
+		basic_machine=i386-pc
+		os=-msys
+		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
 		;;
+	nacl)
+		basic_machine=le32-unknown
+		os=-nacl
+		;;
 	ncr3000)
 		basic_machine=i486-ncr
 		os=-sysv4
@@ -833,6 +890,12 @@ case $basic_machine in
 	np1)
 		basic_machine=np1-gould
 		;;
+	neo-tandem)
+		basic_machine=neo-tandem
+		;;
+	nse-tandem)
+		basic_machine=nse-tandem
+		;;
 	nsr-tandem)
 		basic_machine=nsr-tandem
 		;;
@@ -915,9 +978,10 @@ case $basic_machine in
 		;;
 	power)	basic_machine=power-ibm
 		;;
-	ppc)	basic_machine=powerpc-unknown
+	ppc | ppcbe)	basic_machine=powerpc-unknown
 		;;
-	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+	ppc-* | ppcbe-*)
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ppcle | powerpclittle | ppc-le | powerpc-little)
 		basic_machine=powerpcle-unknown
@@ -1011,6 +1075,9 @@ case $basic_machine in
 		basic_machine=i860-stratus
 		os=-sysv4
 		;;
+	strongarm-* | thumb-*)
+		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	sun2)
 		basic_machine=m68000-sun
 		;;
@@ -1067,20 +1134,8 @@ case $basic_machine in
 		basic_machine=t90-cray
 		os=-unicos
 		;;
-	tic54x | c54x*)
-		basic_machine=tic54x-unknown
-		os=-coff
-		;;
-	tic55x | c55x*)
-		basic_machine=tic55x-unknown
-		os=-coff
-		;;
-	tic6x | c6x*)
-		basic_machine=tic6x-unknown
-		os=-coff
-		;;
 	tile*)
-		basic_machine=tile-unknown
+		basic_machine=$basic_machine-unknown
 		os=-linux-gnu
 		;;
 	tx39)
@@ -1150,6 +1205,9 @@ case $basic_machine in
 	xps | xps100)
 		basic_machine=xps100-honeywell
 		;;
+	xscale-* | xscalee[bl]-*)
+		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+		;;
 	ymp)
 		basic_machine=ymp-cray
 		os=-unicos
@@ -1200,7 +1258,7 @@ case $basic_machine in
 	we32k)
 		basic_machine=we32k-att
 		;;
-	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		;;
 	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@@ -1247,9 +1305,12 @@ esac
 if [ x"$os" != x"" ]
 then
 case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
+	# First match some system type aliases
+	# that might get confused with valid system types.
 	# -solaris* is a basic system type, with this one exception.
+	-auroraux)
+		os=-auroraux
+		;;
 	-solaris1 | -solaris1.*)
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
 		;;
@@ -1270,10 +1331,11 @@ case $os in
 	# Each alternative MUST END IN A *, to match a version number.
 	# -sysv* is not here because it comes later, after sysvr4.
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
-	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+	      | -sym* | -kopensolaris* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* \
+	      | -aos* | -aros* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
@@ -1283,8 +1345,9 @@ case $os in
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-android* \
+	      | -linux-newlib* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1292,7 +1355,7 @@ case $os in
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -irx*)
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1331,7 +1394,7 @@ case $os in
 	-opened*)
 		os=-openedition
 		;;
-        -os400*)
+	-os400*)
 		os=-os400
 		;;
 	-wince*)
@@ -1380,7 +1443,7 @@ case $os in
 	-sinix*)
 		os=-sysv4
 		;;
-        -tpf*)
+	-tpf*)
 		os=-tpf
 		;;
 	-triton*)
@@ -1425,6 +1488,8 @@ case $os in
 	-dicos*)
 		os=-dicos
 		;;
+	-nacl*)
+		;;
 	-none)
 		;;
 	*)
@@ -1447,10 +1512,10 @@ else
 # system, and we'll never get to this point.
 
 case $basic_machine in
-        score-*)
+	score-*)
 		os=-elf
 		;;
-        spu-*)
+	spu-*)
 		os=-elf
 		;;
 	*-acorn)
@@ -1462,8 +1527,17 @@ case $basic_machine in
 	arm*-semi)
 		os=-aout
 		;;
-        c4x-* | tic4x-*)
-        	os=-coff
+	c4x-* | tic4x-*)
+		os=-coff
+		;;
+	tic54x-*)
+		os=-coff
+		;;
+	tic55x-*)
+		os=-coff
+		;;
+	tic6x-*)
+		os=-coff
 		;;
 	# This must come before the *-dec entry.
 	pdp10-*)
@@ -1483,14 +1557,11 @@ case $basic_machine in
 		;;
 	m68000-sun)
 		os=-sunos3
-		# This also exists in the configure program, but was not the
-		# default.
-		# os=-sunos4
 		;;
 	m68*-cisco)
 		os=-aout
 		;;
-        mep-*)
+	mep-*)
 		os=-elf
 		;;
 	mips*-cisco)
@@ -1517,7 +1588,7 @@ case $basic_machine in
 	*-ibm)
 		os=-aix
 		;;
-    	*-knuth)
+	*-knuth)
 		os=-mmixware
 		;;
 	*-wec)
@@ -1622,7 +1693,7 @@ case $basic_machine in
 			-sunos*)
 				vendor=sun
 				;;
-			-aix*)
+			-cnk*|-aix*)
 				vendor=ibm
 				;;
 			-beos*)
diff --git a/config/depcomp b/config/depcomp
index e5f9736..bd0ac08 100755
--- a/config/depcomp
+++ b/config/depcomp
@@ -1,10 +1,10 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2007-03-29.01
+scriptversion=2011-12-04.11; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
-# Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
+# 2011 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -17,9 +17,7 @@ scriptversion=2007-03-29.01
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -46,7 +44,7 @@ Environment variables:
   object      Object file output by `PROGRAMS ARGS'.
   DEPDIR      directory where to store dependencies.
   depfile     Dependency file to output.
-  tmpdepfile  Temporary file to use when outputing dependencies.
+  tmpdepfile  Temporary file to use when outputting dependencies.
   libtool     Whether libtool is used (yes/no).
 
 Report bugs to <bug-automake at gnu.org>.
@@ -87,6 +85,23 @@ if test "$depmode" = dashXmstdout; then
    depmode=dashmstdout
 fi
 
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+   # This is just like msvisualcpp but w/o cygpath translation.
+   # Just convert the backslash-escaped backslashes to single forward
+   # slashes to satisfy depend.m4
+   cygpath_u='sed s,\\\\,/,g'
+   depmode=msvisualcpp
+fi
+
+if test "$depmode" = msvc7msys; then
+   # This is just like msvc7 but w/o cygpath translation.
+   # Just convert the backslash-escaped backslashes to single forward
+   # slashes to satisfy depend.m4
+   cygpath_u='sed s,\\\\,/,g'
+   depmode=msvc7
+fi
+
 case "$depmode" in
 gcc3)
 ## gcc 3 implements dependency tracking that does exactly what
@@ -151,10 +166,12 @@ gcc)
 ' < "$tmpdepfile" |
 ## Some versions of gcc put a space before the `:'.  On the theory
 ## that the space means something, we add a space to the output as
-## well.
+## well.  hp depmode also adds that space, but also prefixes the VPATH
+## to the object.  Take care to not repeat it in the output.
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+    sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+      | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -192,14 +209,14 @@ sgi)
 ' < "$tmpdepfile" \
     | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
     tr '
-' ' ' >> $depfile
-    echo >> $depfile
+' ' ' >> "$depfile"
+    echo >> "$depfile"
 
     # The second pass generates a dummy entry for each header file.
     tr ' ' '
 ' < "$tmpdepfile" \
    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
-   >> $depfile
+   >> "$depfile"
   else
     # The sourcefile does not contain any dependencies, so just
     # store a dummy comment line, to avoid errors with the Makefile
@@ -328,7 +345,12 @@ hp2)
   if test -f "$tmpdepfile"; then
     sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
     # Add `dependent.h:' lines.
-    sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+    sed -ne '2,${
+	       s/^ *//
+	       s/ \\*$//
+	       s/$/:/
+	       p
+	     }' "$tmpdepfile" >> "$depfile"
   else
     echo "#dummy" > "$depfile"
   fi
@@ -393,6 +415,52 @@ tru64)
    rm -f "$tmpdepfile"
    ;;
 
+msvc7)
+  if test "$libtool" = yes; then
+    showIncludes=-Wc,-showIncludes
+  else
+    showIncludes=-showIncludes
+  fi
+  "$@" $showIncludes > "$tmpdepfile"
+  stat=$?
+  grep -v '^Note: including file: ' "$tmpdepfile"
+  if test "$stat" = 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  # The first sed program below extracts the file names and escapes
+  # backslashes for cygpath.  The second sed program outputs the file
+  # name when reading, but also accumulates all include files in the
+  # hold buffer in order to output them again at the end.  This only
+  # works with sed implementations that can handle large buffers.
+  sed < "$tmpdepfile" -n '
+/^Note: including file:  *\(.*\)/ {
+  s//\1/
+  s/\\/\\\\/g
+  p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/	\1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+  s/.*/	/
+  G
+  p
+}' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvc7msys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
 #nosideeffect)
   # This comment above is used by automake to tell side-effect
   # dependency tracking mechanisms from slower ones.
@@ -404,7 +472,7 @@ dashmstdout)
 
   # Remove the call to Libtool.
   if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
+    while test "X$1" != 'X--mode=compile'; do
       shift
     done
     shift
@@ -455,36 +523,45 @@ makedepend)
   "$@" || exit $?
   # Remove any Libtool call
   if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
+    while test "X$1" != 'X--mode=compile'; do
       shift
     done
     shift
   fi
   # X makedepend
   shift
-  cleared=no
-  for arg in "$@"; do
+  cleared=no eat=no
+  for arg
+  do
     case $cleared in
     no)
       set ""; shift
       cleared=yes ;;
     esac
+    if test $eat = yes; then
+      eat=no
+      continue
+    fi
     case "$arg" in
     -D*|-I*)
       set fnord "$@" "$arg"; shift ;;
     # Strip any option that makedepend may not understand.  Remove
     # the object too, otherwise makedepend will parse it as a source file.
+    -arch)
+      eat=yes ;;
     -*|$object)
       ;;
     *)
       set fnord "$@" "$arg"; shift ;;
     esac
   done
-  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  obj_suffix=`echo "$object" | sed 's/^.*\././'`
   touch "$tmpdepfile"
   ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
   rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
+  # makedepend may prepend the VPATH from the source file name to the object.
+  # No need to regex-escape $object, excess matching of '.' is harmless.
+  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
   sed '1,2d' "$tmpdepfile" | tr ' ' '
 ' | \
 ## Some versions of the HPUX 10.20 sed can't process this invocation
@@ -500,7 +577,7 @@ cpp)
 
   # Remove the call to Libtool.
   if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
+    while test "X$1" != 'X--mode=compile'; do
       shift
     done
     shift
@@ -538,13 +615,27 @@ cpp)
 
 msvisualcpp)
   # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout, regardless of -o,
-  # because we must use -o when running libtool.
+  # always write the preprocessed file to stdout.
   "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
   IFS=" "
   for arg
   do
     case "$arg" in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
     "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
 	set fnord "$@"
 	shift
@@ -557,16 +648,23 @@ msvisualcpp)
 	;;
     esac
   done
-  "$@" -E |
-  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  "$@" -E 2>/dev/null |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
   echo "	" >> "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
+msvcmsys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
 none)
   exec "$@"
   ;;
@@ -585,5 +683,6 @@ exit 0
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
diff --git a/config/install-sh b/config/install-sh
index a5897de..a9244eb 100755
--- a/config/install-sh
+++ b/config/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2006-12-25.00
+scriptversion=2011-01-19.21; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -156,6 +156,10 @@ while test $# -ne 0; do
     -s) stripcmd=$stripprog;;
 
     -t) dst_arg=$2
+	# Protect names problematic for `test' and other utilities.
+	case $dst_arg in
+	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
+	esac
 	shift;;
 
     -T) no_target_directory=true;;
@@ -186,6 +190,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
     fi
     shift # arg
     dst_arg=$arg
+    # Protect names problematic for `test' and other utilities.
+    case $dst_arg in
+      -* | [=\(\)!]) dst_arg=./$dst_arg;;
+    esac
   done
 fi
 
@@ -200,7 +208,11 @@ if test $# -eq 0; then
 fi
 
 if test -z "$dir_arg"; then
-  trap '(exit $?); exit' 1 2 13 15
+  do_exit='(exit $ret); exit $ret'
+  trap "ret=129; $do_exit" 1
+  trap "ret=130; $do_exit" 2
+  trap "ret=141; $do_exit" 13
+  trap "ret=143; $do_exit" 15
 
   # Set umask so as not to create temps with too-generous modes.
   # However, 'strip' requires both read and write access to temps.
@@ -228,9 +240,9 @@ fi
 
 for src
 do
-  # Protect names starting with `-'.
+  # Protect names problematic for `test' and other utilities.
   case $src in
-    -*) src=./$src;;
+    -* | [=\(\)!]) src=./$src;;
   esac
 
   if test -n "$dir_arg"; then
@@ -252,12 +264,7 @@ do
       echo "$0: no destination specified." >&2
       exit 1
     fi
-
     dst=$dst_arg
-    # Protect names starting with `-'.
-    case $dst in
-      -*) dst=./$dst;;
-    esac
 
     # If destination is a directory, append the input filename; won't work
     # if double slashes aren't ignored.
@@ -385,7 +392,7 @@ do
 
       case $dstdir in
 	/*) prefix='/';;
-	-*) prefix='./';;
+	[-=\(\)!]*) prefix='./';;
 	*)  prefix='';;
       esac
 
@@ -403,7 +410,7 @@ do
 
       for d
       do
-	test -z "$d" && continue
+	test X"$d" = X && continue
 
 	prefix=$prefix$d
 	if test -d "$prefix"; then
@@ -515,5 +522,6 @@ done
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
diff --git a/config/libtool.m4 b/config/libtool.m4
deleted file mode 100644
index 2f42cf8..0000000
--- a/config/libtool.m4
+++ /dev/null
@@ -1,7370 +0,0 @@
-# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
-#
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
-#   Written by Gordon Matzigkeit, 1996
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-m4_define([_LT_COPYING], [dnl
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
-#   Written by Gordon Matzigkeit, 1996
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
-#
-# GNU Libtool is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
-# obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-])
-
-# serial 56 LT_INIT
-
-
-# LT_PREREQ(VERSION)
-# ------------------
-# Complain and exit if this libtool version is less that VERSION.
-m4_defun([LT_PREREQ],
-[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
-       [m4_default([$3],
-		   [m4_fatal([Libtool version $1 or higher is required],
-		             63)])],
-       [$2])])
-
-
-# _LT_CHECK_BUILDDIR
-# ------------------
-# Complain if the absolute build directory name contains unusual characters
-m4_defun([_LT_CHECK_BUILDDIR],
-[case `pwd` in
-  *\ * | *\	*)
-    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
-esac
-])
-
-
-# LT_INIT([OPTIONS])
-# ------------------
-AC_DEFUN([LT_INIT],
-[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
-AC_BEFORE([$0], [LT_LANG])dnl
-AC_BEFORE([$0], [LT_OUTPUT])dnl
-AC_BEFORE([$0], [LTDL_INIT])dnl
-m4_require([_LT_CHECK_BUILDDIR])dnl
-
-dnl Autoconf doesn't catch unexpanded LT_ macros by default:
-m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
-m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
-dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
-dnl unless we require an AC_DEFUNed macro:
-AC_REQUIRE([LTOPTIONS_VERSION])dnl
-AC_REQUIRE([LTSUGAR_VERSION])dnl
-AC_REQUIRE([LTVERSION_VERSION])dnl
-AC_REQUIRE([LTOBSOLETE_VERSION])dnl
-m4_require([_LT_PROG_LTMAIN])dnl
-
-dnl Parse OPTIONS
-_LT_SET_OPTIONS([$0], [$1])
-
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ltmain"
-
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-AC_SUBST(LIBTOOL)dnl
-
-_LT_SETUP
-
-# Only expand once:
-m4_define([LT_INIT])
-])# LT_INIT
-
-# Old names:
-AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
-AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
-dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
-
-
-# _LT_CC_BASENAME(CC)
-# -------------------
-# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
-m4_defun([_LT_CC_BASENAME],
-[for cc_temp in $1""; do
-  case $cc_temp in
-    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
-    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
-])
-
-
-# _LT_FILEUTILS_DEFAULTS
-# ----------------------
-# It is okay to use these file commands and assume they have been set
-# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
-m4_defun([_LT_FILEUTILS_DEFAULTS],
-[: ${CP="cp -f"}
-: ${MV="mv -f"}
-: ${RM="rm -f"}
-])# _LT_FILEUTILS_DEFAULTS
-
-
-# _LT_SETUP
-# ---------
-m4_defun([_LT_SETUP],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-_LT_DECL([], [host_alias], [0], [The host system])dnl
-_LT_DECL([], [host], [0])dnl
-_LT_DECL([], [host_os], [0])dnl
-dnl
-_LT_DECL([], [build_alias], [0], [The build system])dnl
-_LT_DECL([], [build], [0])dnl
-_LT_DECL([], [build_os], [0])dnl
-dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([LT_PATH_LD])dnl
-AC_REQUIRE([LT_PATH_NM])dnl
-dnl
-AC_REQUIRE([AC_PROG_LN_S])dnl
-test -z "$LN_S" && LN_S="ln -s"
-_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
-dnl
-AC_REQUIRE([LT_CMD_MAX_LEN])dnl
-_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
-_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
-dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_CHECK_SHELL_FEATURES])dnl
-m4_require([_LT_CMD_RELOAD])dnl
-m4_require([_LT_CHECK_MAGIC_METHOD])dnl
-m4_require([_LT_CMD_OLD_ARCHIVE])dnl
-m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
-
-_LT_CONFIG_LIBTOOL_INIT([
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes INIT.
-if test -n "\${ZSH_VERSION+set}" ; then
-   setopt NO_GLOB_SUBST
-fi
-])
-if test -n "${ZSH_VERSION+set}" ; then
-   setopt NO_GLOB_SUBST
-fi
-
-_LT_CHECK_OBJDIR
-
-m4_require([_LT_TAG_COMPILER])dnl
-_LT_PROG_ECHO_BACKSLASH
-
-case $host_os in
-aix3*)
-  # AIX sometimes has problems with the GCC collect2 program.  For some
-  # reason, if we set the COLLECT_NAMES environment variable, the problems
-  # vanish in a puff of smoke.
-  if test "X${COLLECT_NAMES+set}" != Xset; then
-    COLLECT_NAMES=
-    export COLLECT_NAMES
-  fi
-  ;;
-esac
-
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\([["`\\]]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
-# Global variables:
-ofile=libtool
-can_build_shared=yes
-
-# All known linkers require a `.a' archive for static linking (except MSVC,
-# which needs '.lib').
-libext=a
-
-with_gnu_ld="$lt_cv_prog_gnu_ld"
-
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
-
-# Set sane defaults for various variables
-test -z "$CC" && CC=cc
-test -z "$LTCC" && LTCC=$CC
-test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
-test -z "$LD" && LD=ld
-test -z "$ac_objext" && ac_objext=o
-
-_LT_CC_BASENAME([$compiler])
-
-# Only perform the check for file, if the check method requires it
-test -z "$MAGIC_CMD" && MAGIC_CMD=file
-case $deplibs_check_method in
-file_magic*)
-  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
-    _LT_PATH_MAGIC
-  fi
-  ;;
-esac
-
-# Use C for the default configuration in the libtool script
-LT_SUPPORTED_TAG([CC])
-_LT_LANG_C_CONFIG
-_LT_LANG_DEFAULT_CONFIG
-_LT_CONFIG_COMMANDS
-])# _LT_SETUP
-
-
-# _LT_PROG_LTMAIN
-# ---------------
-# Note that this code is called both from `configure', and `config.status'
-# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
-# `config.status' has no value for ac_aux_dir unless we are using Automake,
-# so we pass a copy along to make sure it has a sensible value anyway.
-m4_defun([_LT_PROG_LTMAIN],
-[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
-_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
-ltmain="$ac_aux_dir/ltmain.sh"
-])# _LT_PROG_LTMAIN
-
-
-## ------------------------------------- ##
-## Accumulate code for creating libtool. ##
-## ------------------------------------- ##
-
-# So that we can recreate a full libtool script including additional
-# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
-# in macros and then make a single call at the end using the `libtool'
-# label.
-
-
-# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
-# ----------------------------------------
-# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
-m4_define([_LT_CONFIG_LIBTOOL_INIT],
-[m4_ifval([$1],
-          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
-                     [$1
-])])])
-
-# Initialize.
-m4_define([_LT_OUTPUT_LIBTOOL_INIT])
-
-
-# _LT_CONFIG_LIBTOOL([COMMANDS])
-# ------------------------------
-# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
-m4_define([_LT_CONFIG_LIBTOOL],
-[m4_ifval([$1],
-          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
-                     [$1
-])])])
-
-# Initialize.
-m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
-
-
-# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
-# -----------------------------------------------------
-m4_defun([_LT_CONFIG_SAVE_COMMANDS],
-[_LT_CONFIG_LIBTOOL([$1])
-_LT_CONFIG_LIBTOOL_INIT([$2])
-])
-
-
-# _LT_FORMAT_COMMENT([COMMENT])
-# -----------------------------
-# Add leading comment marks to the start of each line, and a trailing
-# full-stop to the whole comment if one is not present already.
-m4_define([_LT_FORMAT_COMMENT],
-[m4_ifval([$1], [
-m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
-              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
-)])
-
-
-
-## ------------------------ ##
-## FIXME: Eliminate VARNAME ##
-## ------------------------ ##
-
-
-# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
-# -------------------------------------------------------------------
-# CONFIGNAME is the name given to the value in the libtool script.
-# VARNAME is the (base) name used in the configure script.
-# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
-# VARNAME.  Any other value will be used directly.
-m4_define([_LT_DECL],
-[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
-    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
-	[m4_ifval([$1], [$1], [$2])])
-    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
-    m4_ifval([$4],
-	[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
-    lt_dict_add_subkey([lt_decl_dict], [$2],
-	[tagged?], [m4_ifval([$5], [yes], [no])])])
-])
-
-
-# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
-# --------------------------------------------------------
-m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
-
-
-# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
-# ------------------------------------------------
-m4_define([lt_decl_tag_varnames],
-[_lt_decl_filter([tagged?], [yes], $@)])
-
-
-# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
-# ---------------------------------------------------------
-m4_define([_lt_decl_filter],
-[m4_case([$#],
-  [0], [m4_fatal([$0: too few arguments: $#])],
-  [1], [m4_fatal([$0: too few arguments: $#: $1])],
-  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
-  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
-  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
-])
-
-
-# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
-# --------------------------------------------------
-m4_define([lt_decl_quote_varnames],
-[_lt_decl_filter([value], [1], $@)])
-
-
-# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
-# ---------------------------------------------------
-m4_define([lt_decl_dquote_varnames],
-[_lt_decl_filter([value], [2], $@)])
-
-
-# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
-# ---------------------------------------------------
-m4_define([lt_decl_varnames_tagged],
-[m4_assert([$# <= 2])dnl
-_$0(m4_quote(m4_default([$1], [[, ]])),
-    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
-    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
-m4_define([_lt_decl_varnames_tagged],
-[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
-
-
-# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
-# ------------------------------------------------
-m4_define([lt_decl_all_varnames],
-[_$0(m4_quote(m4_default([$1], [[, ]])),
-     m4_if([$2], [],
-	   m4_quote(lt_decl_varnames),
-	m4_quote(m4_shift($@))))[]dnl
-])
-m4_define([_lt_decl_all_varnames],
-[lt_join($@, lt_decl_varnames_tagged([$1],
-			lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
-])
-
-
-# _LT_CONFIG_STATUS_DECLARE([VARNAME])
-# ------------------------------------
-# Quote a variable value, and forward it to `config.status' so that its
-# declaration there will have the same value as in `configure'.  VARNAME
-# must have a single quote delimited value for this to work.
-m4_define([_LT_CONFIG_STATUS_DECLARE],
-[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`'])
-
-
-# _LT_CONFIG_STATUS_DECLARATIONS
-# ------------------------------
-# We delimit libtool config variables with single quotes, so when
-# we write them to config.status, we have to be sure to quote all
-# embedded single quotes properly.  In configure, this macro expands
-# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
-#
-#    <var>='`$ECHO "X$<var>" | $Xsed -e "$delay_single_quote_subst"`'
-m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
-[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
-    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
-
-
-# _LT_LIBTOOL_TAGS
-# ----------------
-# Output comment and list of tags supported by the script
-m4_defun([_LT_LIBTOOL_TAGS],
-[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
-available_tags="_LT_TAGS"dnl
-])
-
-
-# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
-# -----------------------------------
-# Extract the dictionary values for VARNAME (optionally with TAG) and
-# expand to a commented shell variable setting:
-#
-#    # Some comment about what VAR is for.
-#    visible_name=$lt_internal_name
-m4_define([_LT_LIBTOOL_DECLARE],
-[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
-					   [description])))[]dnl
-m4_pushdef([_libtool_name],
-    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
-m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
-    [0], [_libtool_name=[$]$1],
-    [1], [_libtool_name=$lt_[]$1],
-    [2], [_libtool_name=$lt_[]$1],
-    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
-m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
-])
-
-
-# _LT_LIBTOOL_CONFIG_VARS
-# -----------------------
-# Produce commented declarations of non-tagged libtool config variables
-# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
-# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
-# section) are produced by _LT_LIBTOOL_TAG_VARS.
-m4_defun([_LT_LIBTOOL_CONFIG_VARS],
-[m4_foreach([_lt_var],
-    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
-    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
-
-
-# _LT_LIBTOOL_TAG_VARS(TAG)
-# -------------------------
-m4_define([_LT_LIBTOOL_TAG_VARS],
-[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
-    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
-
-
-# _LT_TAGVAR(VARNAME, [TAGNAME])
-# ------------------------------
-m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
-
-
-# _LT_CONFIG_COMMANDS
-# -------------------
-# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
-# variables for single and double quote escaping we saved from calls
-# to _LT_DECL, we can put quote escaped variables declarations
-# into `config.status', and then the shell code to quote escape them in
-# for loops in `config.status'.  Finally, any additional code accumulated
-# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
-m4_defun([_LT_CONFIG_COMMANDS],
-[AC_PROVIDE_IFELSE([LT_OUTPUT],
-	dnl If the libtool generation code has been placed in $CONFIG_LT,
-	dnl instead of duplicating it all over again into config.status,
-	dnl then we will have config.status run $CONFIG_LT later, so it
-	dnl needs to know what name is stored there:
-        [AC_CONFIG_COMMANDS([libtool],
-            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
-    dnl If the libtool generation code is destined for config.status,
-    dnl expand the accumulated commands and init code now:
-    [AC_CONFIG_COMMANDS([libtool],
-        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
-])#_LT_CONFIG_COMMANDS
-
-
-# Initialize.
-m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
-[
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-sed_quote_subst='$sed_quote_subst'
-double_quote_subst='$double_quote_subst'
-delay_variable_subst='$delay_variable_subst'
-_LT_CONFIG_STATUS_DECLARATIONS
-LTCC='$LTCC'
-LTCFLAGS='$LTCFLAGS'
-compiler='$compiler_DEFAULT'
-
-# Quote evaled strings.
-for var in lt_decl_all_varnames([[ \
-]], lt_decl_quote_varnames); do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
-    *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
-      ;;
-    *)
-      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
-      ;;
-    esac
-done
-
-# Double-quote double-evaled strings.
-for var in lt_decl_all_varnames([[ \
-]], lt_decl_dquote_varnames); do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
-    *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
-      ;;
-    *)
-      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
-      ;;
-    esac
-done
-
-# Fix-up fallback echo if it was mangled by the above quoting rules.
-case \$lt_ECHO in
-*'\\\[$]0 --fallback-echo"')dnl "
-  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\`
-  ;;
-esac
-
-_LT_OUTPUT_LIBTOOL_INIT
-])
-
-
-# LT_OUTPUT
-# ---------
-# This macro allows early generation of the libtool script (before
-# AC_OUTPUT is called), incase it is used in configure for compilation
-# tests.
-AC_DEFUN([LT_OUTPUT],
-[: ${CONFIG_LT=./config.lt}
-AC_MSG_NOTICE([creating $CONFIG_LT])
-cat >"$CONFIG_LT" <<_LTEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate a libtool stub with the current configuration.
-
-lt_cl_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_LTEOF
-
-cat >>"$CONFIG_LT" <<\_LTEOF
-AS_SHELL_SANITIZE
-_AS_PREPARE
-
-exec AS_MESSAGE_FD>&1
-exec AS_MESSAGE_LOG_FD>>config.log
-{
-  echo
-  AS_BOX([Running $as_me.])
-} >&AS_MESSAGE_LOG_FD
-
-lt_cl_help="\
-\`$as_me' creates a local libtool stub from the current configuration,
-for use in further configure time tests before the real libtool is
-generated.
-
-Usage: $[0] [[OPTIONS]]
-
-  -h, --help      print this help, then exit
-  -V, --version   print version number, then exit
-  -q, --quiet     do not print progress messages
-  -d, --debug     don't remove temporary files
-
-Report bugs to <bug-libtool at gnu.org>."
-
-lt_cl_version="\
-m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
-m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
-configured by $[0], generated by m4_PACKAGE_STRING.
-
-Copyright (C) 2008 Free Software Foundation, Inc.
-This config.lt script is free software; the Free Software Foundation
-gives unlimited permision to copy, distribute and modify it."
-
-while test $[#] != 0
-do
-  case $[1] in
-    --version | --v* | -V )
-      echo "$lt_cl_version"; exit 0 ;;
-    --help | --h* | -h )
-      echo "$lt_cl_help"; exit 0 ;;
-    --debug | --d* | -d )
-      debug=: ;;
-    --quiet | --q* | --silent | --s* | -q )
-      lt_cl_silent=: ;;
-
-    -*) AC_MSG_ERROR([unrecognized option: $[1]
-Try \`$[0] --help' for more information.]) ;;
-
-    *) AC_MSG_ERROR([unrecognized argument: $[1]
-Try \`$[0] --help' for more information.]) ;;
-  esac
-  shift
-done
-
-if $lt_cl_silent; then
-  exec AS_MESSAGE_FD>/dev/null
-fi
-_LTEOF
-
-cat >>"$CONFIG_LT" <<_LTEOF
-_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
-_LTEOF
-
-cat >>"$CONFIG_LT" <<\_LTEOF
-AC_MSG_NOTICE([creating $ofile])
-_LT_OUTPUT_LIBTOOL_COMMANDS
-AS_EXIT(0)
-_LTEOF
-chmod +x "$CONFIG_LT"
-
-# configure is writing to config.log, but config.lt does its own redirection,
-# appending to config.log, which fails on DOS, as config.log is still kept
-# open by configure.  Here we exec the FD to /dev/null, effectively closing
-# config.log, so it can be properly (re)opened and appended to by config.lt.
-if test "$no_create" != yes; then
-  lt_cl_success=:
-  test "$silent" = yes &&
-    lt_config_lt_args="$lt_config_lt_args --quiet"
-  exec AS_MESSAGE_LOG_FD>/dev/null
-  $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
-  exec AS_MESSAGE_LOG_FD>>config.log
-  $lt_cl_success || AS_EXIT(1)
-fi
-])# LT_OUTPUT
-
-
-# _LT_CONFIG(TAG)
-# ---------------
-# If TAG is the built-in tag, create an initial libtool script with a
-# default configuration from the untagged config vars.  Otherwise add code
-# to config.status for appending the configuration named by TAG from the
-# matching tagged config vars.
-m4_defun([_LT_CONFIG],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-_LT_CONFIG_SAVE_COMMANDS([
-  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
-  m4_if(_LT_TAG, [C], [
-    # See if we are running on zsh, and set the options which allow our
-    # commands through without removal of \ escapes.
-    if test -n "${ZSH_VERSION+set}" ; then
-      setopt NO_GLOB_SUBST
-    fi
-
-    cfgfile="${ofile}T"
-    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
-    $RM "$cfgfile"
-
-    cat <<_LT_EOF >> "$cfgfile"
-#! $SHELL
-
-# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-_LT_COPYING
-_LT_LIBTOOL_TAGS
-
-# ### BEGIN LIBTOOL CONFIG
-_LT_LIBTOOL_CONFIG_VARS
-_LT_LIBTOOL_TAG_VARS
-# ### END LIBTOOL CONFIG
-
-_LT_EOF
-
-  case $host_os in
-  aix3*)
-    cat <<\_LT_EOF >> "$cfgfile"
-# AIX sometimes has problems with the GCC collect2 program.  For some
-# reason, if we set the COLLECT_NAMES environment variable, the problems
-# vanish in a puff of smoke.
-if test "X${COLLECT_NAMES+set}" != Xset; then
-  COLLECT_NAMES=
-  export COLLECT_NAMES
-fi
-_LT_EOF
-    ;;
-  esac
-
-  _LT_PROG_LTMAIN
-
-  # We use sed instead of cat because bash on DJGPP gets confused if
-  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
-  # text mode, it properly converts lines to CR/LF.  This bash problem
-  # is reportedly fixed, but why not run on old versions too?
-  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  _LT_PROG_XSI_SHELLFNS
-
-  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  mv -f "$cfgfile" "$ofile" ||
-    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
-  chmod +x "$ofile"
-],
-[cat <<_LT_EOF >> "$ofile"
-
-dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
-dnl in a comment (ie after a #).
-# ### BEGIN LIBTOOL TAG CONFIG: $1
-_LT_LIBTOOL_TAG_VARS(_LT_TAG)
-# ### END LIBTOOL TAG CONFIG: $1
-_LT_EOF
-])dnl /m4_if
-],
-[m4_if([$1], [], [
-    PACKAGE='$PACKAGE'
-    VERSION='$VERSION'
-    TIMESTAMP='$TIMESTAMP'
-    RM='$RM'
-    ofile='$ofile'], [])
-])dnl /_LT_CONFIG_SAVE_COMMANDS
-])# _LT_CONFIG
-
-
-# LT_SUPPORTED_TAG(TAG)
-# ---------------------
-# Trace this macro to discover what tags are supported by the libtool
-# --tag option, using:
-#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
-AC_DEFUN([LT_SUPPORTED_TAG], [])
-
-
-# C support is built-in for now
-m4_define([_LT_LANG_C_enabled], [])
-m4_define([_LT_TAGS], [])
-
-
-# LT_LANG(LANG)
-# -------------
-# Enable libtool support for the given language if not already enabled.
-AC_DEFUN([LT_LANG],
-[AC_BEFORE([$0], [LT_OUTPUT])dnl
-m4_case([$1],
-  [C],			[_LT_LANG(C)],
-  [C++],		[_LT_LANG(CXX)],
-  [Java],		[_LT_LANG(GCJ)],
-  [Fortran 77],		[_LT_LANG(F77)],
-  [Fortran],		[_LT_LANG(FC)],
-  [Windows Resource],	[_LT_LANG(RC)],
-  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
-    [_LT_LANG($1)],
-    [m4_fatal([$0: unsupported language: "$1"])])])dnl
-])# LT_LANG
-
-
-# _LT_LANG(LANGNAME)
-# ------------------
-m4_defun([_LT_LANG],
-[m4_ifdef([_LT_LANG_]$1[_enabled], [],
-  [LT_SUPPORTED_TAG([$1])dnl
-  m4_append([_LT_TAGS], [$1 ])dnl
-  m4_define([_LT_LANG_]$1[_enabled], [])dnl
-  _LT_LANG_$1_CONFIG($1)])dnl
-])# _LT_LANG
-
-
-# _LT_LANG_DEFAULT_CONFIG
-# -----------------------
-m4_defun([_LT_LANG_DEFAULT_CONFIG],
-[AC_PROVIDE_IFELSE([AC_PROG_CXX],
-  [LT_LANG(CXX)],
-  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
-
-AC_PROVIDE_IFELSE([AC_PROG_F77],
-  [LT_LANG(F77)],
-  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
-
-AC_PROVIDE_IFELSE([AC_PROG_FC],
-  [LT_LANG(FC)],
-  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
-
-dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
-dnl pulling things in needlessly.
-AC_PROVIDE_IFELSE([AC_PROG_GCJ],
-  [LT_LANG(GCJ)],
-  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
-    [LT_LANG(GCJ)],
-    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
-      [LT_LANG(GCJ)],
-      [m4_ifdef([AC_PROG_GCJ],
-	[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
-       m4_ifdef([A][M_PROG_GCJ],
-	[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
-       m4_ifdef([LT_PROG_GCJ],
-	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
-
-AC_PROVIDE_IFELSE([LT_PROG_RC],
-  [LT_LANG(RC)],
-  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
-])# _LT_LANG_DEFAULT_CONFIG
-
-# Obsolete macros:
-AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
-AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
-AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
-AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
-dnl AC_DEFUN([AC_LIBTOOL_F77], [])
-dnl AC_DEFUN([AC_LIBTOOL_FC], [])
-dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
-
-
-# _LT_TAG_COMPILER
-# ----------------
-m4_defun([_LT_TAG_COMPILER],
-[AC_REQUIRE([AC_PROG_CC])dnl
-
-_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
-_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
-_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
-_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
-
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
-
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
-
-# Allow CC to be a program name with arguments.
-compiler=$CC
-])# _LT_TAG_COMPILER
-
-
-# _LT_COMPILER_BOILERPLATE
-# ------------------------
-# Check for compiler boilerplate output or warnings with
-# the simple compiler test code.
-m4_defun([_LT_COMPILER_BOILERPLATE],
-[m4_require([_LT_DECL_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$RM conftest*
-])# _LT_COMPILER_BOILERPLATE
-
-
-# _LT_LINKER_BOILERPLATE
-# ----------------------
-# Check for linker boilerplate output or warnings with
-# the simple link test code.
-m4_defun([_LT_LINKER_BOILERPLATE],
-[m4_require([_LT_DECL_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$RM -r conftest*
-])# _LT_LINKER_BOILERPLATE
-
-# _LT_REQUIRED_DARWIN_CHECKS
-# -------------------------
-m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
-  case $host_os in
-    rhapsody* | darwin*)
-    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
-    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
-    AC_CHECK_TOOL([LIPO], [lipo], [:])
-    AC_CHECK_TOOL([OTOOL], [otool], [:])
-    AC_CHECK_TOOL([OTOOL64], [otool64], [:])
-    _LT_DECL([], [DSYMUTIL], [1],
-      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
-    _LT_DECL([], [NMEDIT], [1],
-      [Tool to change global to local symbols on Mac OS X])
-    _LT_DECL([], [LIPO], [1],
-      [Tool to manipulate fat objects and archives on Mac OS X])
-    _LT_DECL([], [OTOOL], [1],
-      [ldd/readelf like tool for Mach-O binaries on Mac OS X])
-    _LT_DECL([], [OTOOL64], [1],
-      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
-
-    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
-      [lt_cv_apple_cc_single_mod=no
-      if test -z "${LT_MULTI_MODULE}"; then
-	# By default we will add the -single_module flag. You can override
-	# by either setting the environment variable LT_MULTI_MODULE
-	# non-empty at configure time, or by adding -multi_module to the
-	# link flags.
-	rm -rf libconftest.dylib*
-	echo "int foo(void){return 1;}" > conftest.c
-	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
--dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
-	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
-        _lt_result=$?
-	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
-	  lt_cv_apple_cc_single_mod=yes
-	else
-	  cat conftest.err >&AS_MESSAGE_LOG_FD
-	fi
-	rm -rf libconftest.dylib*
-	rm -f conftest.*
-      fi])
-    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
-      [lt_cv_ld_exported_symbols_list],
-      [lt_cv_ld_exported_symbols_list=no
-      save_LDFLAGS=$LDFLAGS
-      echo "_main" > conftest.sym
-      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
-      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-	[lt_cv_ld_exported_symbols_list=yes],
-	[lt_cv_ld_exported_symbols_list=no])
-	LDFLAGS="$save_LDFLAGS"
-    ])
-    case $host_os in
-    rhapsody* | darwin1.[[012]])
-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
-    darwin1.*)
-      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-    darwin*) # darwin 5.x on
-      # if running on 10.5 or later, the deployment target defaults
-      # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it?
-      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
-	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-	10.[[012]]*)
-	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-	10.*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-      esac
-    ;;
-  esac
-    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
-      _lt_dar_single_mod='$single_module'
-    fi
-    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
-      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
-    else
-      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
-    fi
-    if test "$DSYMUTIL" != ":"; then
-      _lt_dsymutil='~$DSYMUTIL $lib || :'
-    else
-      _lt_dsymutil=
-    fi
-    ;;
-  esac
-])
-
-
-# _LT_DARWIN_LINKER_FEATURES
-# --------------------------
-# Checks for linker and compiler features on darwin
-m4_defun([_LT_DARWIN_LINKER_FEATURES],
-[
-  m4_require([_LT_REQUIRED_DARWIN_CHECKS])
-  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-  _LT_TAGVAR(hardcode_direct, $1)=no
-  _LT_TAGVAR(hardcode_automatic, $1)=yes
-  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  _LT_TAGVAR(whole_archive_flag_spec, $1)=''
-  _LT_TAGVAR(link_all_deplibs, $1)=yes
-  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
-  case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
-     *) _lt_dar_can_shared=$GCC ;;
-  esac
-  if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=echo
-    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-    m4_if([$1], [CXX],
-[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
-      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
-      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
-    fi
-],[])
-  else
-  _LT_TAGVAR(ld_shlibs, $1)=no
-  fi
-])
-
-# _LT_SYS_MODULE_PATH_AIX
-# -----------------------
-# Links a minimal program and checks the executable
-# for the system default hardcoded library path. In most cases,
-# this is /usr/lib:/lib, but when the MPI compilers are used
-# the location of the communication and MPI libs are included too.
-# If we don't find anything, use the default library path according
-# to the aix ld manual.
-m4_defun([_LT_SYS_MODULE_PATH_AIX],
-[m4_require([_LT_DECL_SED])dnl
-AC_LINK_IFELSE(AC_LANG_PROGRAM,[
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi],[])
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
-])# _LT_SYS_MODULE_PATH_AIX
-
-
-# _LT_SHELL_INIT(ARG)
-# -------------------
-m4_define([_LT_SHELL_INIT],
-[ifdef([AC_DIVERSION_NOTICE],
-	     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
-	 [AC_DIVERT_PUSH(NOTICE)])
-$1
-AC_DIVERT_POP
-])# _LT_SHELL_INIT
-
-
-# _LT_PROG_ECHO_BACKSLASH
-# -----------------------
-# Add some code to the start of the generated configure script which
-# will find an echo command which doesn't interpret backslashes.
-m4_defun([_LT_PROG_ECHO_BACKSLASH],
-[_LT_SHELL_INIT([
-# Check that we are running under the correct shell.
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-case X$lt_ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
-  ;;
-esac
-
-ECHO=${lt_ECHO-echo}
-if test "X[$]1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X[$]1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
-  # Yippee, $ECHO works!
-  :
-else
-  # Restart under the correct shell.
-  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
-fi
-
-if test "X[$]1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<_LT_EOF
-[$]*
-_LT_EOF
-  exit 0
-fi
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$lt_ECHO"; then
-  if test "X${echo_test_string+set}" != Xset; then
-    # find a string as large as possible, as long as the shell can cope with it
-    for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
-      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
-      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
-	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
-      then
-        break
-      fi
-    done
-  fi
-
-  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-     test "X$echo_testing_string" = "X$echo_test_string"; then
-    :
-  else
-    # The Solaris, AIX, and Digital Unix default echo programs unquote
-    # backslashes.  This makes it impossible to quote backslashes using
-    #   echo "$something" | sed 's/\\/\\\\/g'
-    #
-    # So, first we look for a working echo in the user's PATH.
-
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for dir in $PATH /usr/ucb; do
-      IFS="$lt_save_ifs"
-      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
-         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        ECHO="$dir/echo"
-        break
-      fi
-    done
-    IFS="$lt_save_ifs"
-
-    if test "X$ECHO" = Xecho; then
-      # We didn't find a better echo, so look for alternatives.
-      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        # This shell has a builtin print -r that does the trick.
-        ECHO='print -r'
-      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
-	   test "X$CONFIG_SHELL" != X/bin/ksh; then
-        # If we have ksh, try running configure again with it.
-        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-        export ORIGINAL_CONFIG_SHELL
-        CONFIG_SHELL=/bin/ksh
-        export CONFIG_SHELL
-        exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
-      else
-        # Try using printf.
-        ECHO='printf %s\n'
-        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	  # Cool, printf works
-	  :
-        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
-	  export CONFIG_SHELL
-	  SHELL="$CONFIG_SHELL"
-	  export SHELL
-	  ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
-        elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
-        else
-	  # maybe with a smaller string...
-	  prev=:
-
-	  for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
-	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
-	    then
-	      break
-	    fi
-	    prev="$cmd"
-	  done
-
-	  if test "$prev" != 'sed 50q "[$]0"'; then
-	    echo_test_string=`eval $prev`
-	    export echo_test_string
-	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
-	  else
-	    # Oops.  We lost completely, so just stick with echo.
-	    ECHO=echo
-	  fi
-        fi
-      fi
-    fi
-  fi
-fi
-
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-lt_ECHO=$ECHO
-if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
-   lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
-fi
-
-AC_SUBST(lt_ECHO)
-])
-_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
-_LT_DECL([], [ECHO], [1],
-    [An echo program that does not interpret backslashes])
-])# _LT_PROG_ECHO_BACKSLASH
-
-
-# _LT_ENABLE_LOCK
-# ---------------
-m4_defun([_LT_ENABLE_LOCK],
-[AC_ARG_ENABLE([libtool-lock],
-  [AS_HELP_STRING([--disable-libtool-lock],
-    [avoid locking (might break parallel builds)])])
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
-
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case $host in
-ia64-*-hpux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.$ac_objext` in
-      *ELF-32*)
-	HPUX_IA64_MODE="32"
-	;;
-      *ELF-64*)
-	HPUX_IA64_MODE="64"
-	;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-*-*-irix6*)
-  # Find out which ABI we are using.
-  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    if test "$lt_cv_prog_gnu_ld" = yes; then
-      case `/usr/bin/file conftest.$ac_objext` in
-	*32-bit*)
-	  LD="${LD-ld} -melf32bsmip"
-	  ;;
-	*N32*)
-	  LD="${LD-ld} -melf32bmipn32"
-	  ;;
-	*64-bit*)
-	  LD="${LD-ld} -melf64bmip"
-	;;
-      esac
-    else
-      case `/usr/bin/file conftest.$ac_objext` in
-	*32-bit*)
-	  LD="${LD-ld} -32"
-	  ;;
-	*N32*)
-	  LD="${LD-ld} -n32"
-	  ;;
-	*64-bit*)
-	  LD="${LD-ld} -64"
-	  ;;
-      esac
-    fi
-  fi
-  rm -rf conftest*
-  ;;
-
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
-s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.o` in
-      *32-bit*)
-	case $host in
-	  x86_64-*kfreebsd*-gnu)
-	    LD="${LD-ld} -m elf_i386_fbsd"
-	    ;;
-	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_i386"
-	    ;;
-	  ppc64-*linux*|powerpc64-*linux*)
-	    LD="${LD-ld} -m elf32ppclinux"
-	    ;;
-	  s390x-*linux*)
-	    LD="${LD-ld} -m elf_s390"
-	    ;;
-	  sparc64-*linux*)
-	    LD="${LD-ld} -m elf32_sparc"
-	    ;;
-	esac
-	;;
-      *64-bit*)
-	case $host in
-	  x86_64-*kfreebsd*-gnu)
-	    LD="${LD-ld} -m elf_x86_64_fbsd"
-	    ;;
-	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_x86_64"
-	    ;;
-	  ppc*-*linux*|powerpc*-*linux*)
-	    LD="${LD-ld} -m elf64ppc"
-	    ;;
-	  s390*-*linux*|s390*-*tpf*)
-	    LD="${LD-ld} -m elf64_s390"
-	    ;;
-	  sparc*-*linux*)
-	    LD="${LD-ld} -m elf64_sparc"
-	    ;;
-	esac
-	;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-
-*-*-sco3.2v5*)
-  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
-  SAVE_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -belf"
-  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
-    [AC_LANG_PUSH(C)
-     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
-     AC_LANG_POP])
-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
-    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
-    CFLAGS="$SAVE_CFLAGS"
-  fi
-  ;;
-sparc*-*solaris*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.o` in
-    *64-bit*)
-      case $lt_cv_prog_gnu_ld in
-      yes*) LD="${LD-ld} -m elf64_sparc" ;;
-      *)
-	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
-	  LD="${LD-ld} -64"
-	fi
-	;;
-      esac
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-esac
-
-need_locks="$enable_libtool_lock"
-])# _LT_ENABLE_LOCK
-
-
-# _LT_CMD_OLD_ARCHIVE
-# -------------------
-m4_defun([_LT_CMD_OLD_ARCHIVE],
-[AC_CHECK_TOOL(AR, ar, false)
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
-_LT_DECL([], [AR], [1], [The archiver])
-_LT_DECL([], [AR_FLAGS], [1])
-
-AC_CHECK_TOOL(STRIP, strip, :)
-test -z "$STRIP" && STRIP=:
-_LT_DECL([], [STRIP], [1], [A symbol stripping program])
-
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-test -z "$RANLIB" && RANLIB=:
-_LT_DECL([], [RANLIB], [1],
-    [Commands used to install an old-style archive])
-
-# Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
-old_postinstall_cmds='chmod 644 $oldlib'
-old_postuninstall_cmds=
-
-if test -n "$RANLIB"; then
-  case $host_os in
-  openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
-    ;;
-  *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
-    ;;
-  esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
-fi
-_LT_DECL([], [old_postinstall_cmds], [2])
-_LT_DECL([], [old_postuninstall_cmds], [2])
-_LT_TAGDECL([], [old_archive_cmds], [2],
-    [Commands used to build an old-style archive])
-])# _LT_CMD_OLD_ARCHIVE
-
-
-# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
-# ----------------------------------------------------------------
-# Check whether the given compiler option works
-AC_DEFUN([_LT_COMPILER_OPTION],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_SED])dnl
-AC_CACHE_CHECK([$1], [$2],
-  [$2=no
-   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$3"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       $2=yes
-     fi
-   fi
-   $RM conftest*
-])
-
-if test x"[$]$2" = xyes; then
-    m4_if([$5], , :, [$5])
-else
-    m4_if([$6], , :, [$6])
-fi
-])# _LT_COMPILER_OPTION
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
-
-
-# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-#                  [ACTION-SUCCESS], [ACTION-FAILURE])
-# ----------------------------------------------------
-# Check whether the given linker option works
-AC_DEFUN([_LT_LINKER_OPTION],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_SED])dnl
-AC_CACHE_CHECK([$1], [$2],
-  [$2=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS $3"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The linker can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test -s conftest.err; then
-       # Append any errors to the config.log.
-       cat conftest.err 1>&AS_MESSAGE_LOG_FD
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         $2=yes
-       fi
-     else
-       $2=yes
-     fi
-   fi
-   $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
-])
-
-if test x"[$]$2" = xyes; then
-    m4_if([$4], , :, [$4])
-else
-    m4_if([$5], , :, [$5])
-fi
-])# _LT_LINKER_OPTION
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
-
-
-# LT_CMD_MAX_LEN
-#---------------
-AC_DEFUN([LT_CMD_MAX_LEN],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-# find the maximum length of command line arguments
-AC_MSG_CHECKING([the maximum length of command line arguments])
-AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
-  i=0
-  teststring="ABCD"
-
-  case $build_os in
-  msdosdjgpp*)
-    # On DJGPP, this test can blow up pretty badly due to problems in libc
-    # (any single argument exceeding 2000 bytes causes a buffer overrun
-    # during glob expansion).  Even if it were fixed, the result of this
-    # check would be larger than it should be.
-    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
-    ;;
-
-  gnu*)
-    # Under GNU Hurd, this test is not required because there is
-    # no limit to the length of command line arguments.
-    # Libtool will interpret -1 as no limit whatsoever
-    lt_cv_sys_max_cmd_len=-1;
-    ;;
-
-  cygwin* | mingw* | cegcc*)
-    # On Win9x/ME, this test blows up -- it succeeds, but takes
-    # about 5 minutes as the teststring grows exponentially.
-    # Worse, since 9x/ME are not pre-emptively multitasking,
-    # you end up with a "frozen" computer, even though with patience
-    # the test eventually succeeds (with a max line length of 256k).
-    # Instead, let's just punt: use the minimum linelength reported by
-    # all of the supported platforms: 8192 (on NT/2K/XP).
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
-  amigaos*)
-    # On AmigaOS with pdksh, this test takes hours, literally.
-    # So we just punt and use a minimum line length of 8192.
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
-  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
-    # This has been around since 386BSD, at least.  Likely further.
-    if test -x /sbin/sysctl; then
-      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
-    elif test -x /usr/sbin/sysctl; then
-      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
-    else
-      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
-    fi
-    # And add a safety zone
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
-    ;;
-
-  interix*)
-    # We know the value 262144 and hardcode it with a safety zone (like BSD)
-    lt_cv_sys_max_cmd_len=196608
-    ;;
-
-  osf*)
-    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
-    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
-    # nice to cause kernel panics so lets avoid the loop below.
-    # First set a reasonable default.
-    lt_cv_sys_max_cmd_len=16384
-    #
-    if test -x /sbin/sysconfig; then
-      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
-        *1*) lt_cv_sys_max_cmd_len=-1 ;;
-      esac
-    fi
-    ;;
-  sco3.2v5*)
-    lt_cv_sys_max_cmd_len=102400
-    ;;
-  sysv5* | sco5v6* | sysv4.2uw2*)
-    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
-    if test -n "$kargmax"; then
-      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[	 ]]//'`
-    else
-      lt_cv_sys_max_cmd_len=32768
-    fi
-    ;;
-  *)
-    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
-    if test -n "$lt_cv_sys_max_cmd_len"; then
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
-    else
-      # Make teststring a little bigger before we do anything with it.
-      # a 1K string should be a reasonable start.
-      for i in 1 2 3 4 5 6 7 8 ; do
-        teststring=$teststring$teststring
-      done
-      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
-      # If test is not a shell built-in, we'll probably end up computing a
-      # maximum length that is only half of the actual maximum length, but
-      # we can't tell.
-      while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
-	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
-	      test $i != 17 # 1/2 MB should be enough
-      do
-        i=`expr $i + 1`
-        teststring=$teststring$teststring
-      done
-      # Only check the string length outside the loop.
-      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
-      teststring=
-      # Add a significant safety factor because C++ compilers can tack on
-      # massive amounts of additional arguments before passing them to the
-      # linker.  It appears as though 1/2 is a usable value.
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
-    fi
-    ;;
-  esac
-])
-if test -n $lt_cv_sys_max_cmd_len ; then
-  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
-else
-  AC_MSG_RESULT(none)
-fi
-max_cmd_len=$lt_cv_sys_max_cmd_len
-_LT_DECL([], [max_cmd_len], [0],
-    [What is the maximum length of a command?])
-])# LT_CMD_MAX_LEN
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
-
-
-# _LT_HEADER_DLFCN
-# ----------------
-m4_defun([_LT_HEADER_DLFCN],
-[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
-])# _LT_HEADER_DLFCN
-
-
-# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
-#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
-# ----------------------------------------------------------------
-m4_defun([_LT_TRY_DLOPEN_SELF],
-[m4_require([_LT_HEADER_DLFCN])dnl
-if test "$cross_compiling" = yes; then :
-  [$4]
-else
-  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-  lt_status=$lt_dlunknown
-  cat > conftest.$ac_ext <<_LT_EOF
-[#line __oline__ "configure"
-#include "confdefs.h"
-
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <stdio.h>
-
-#ifdef RTLD_GLOBAL
-#  define LT_DLGLOBAL		RTLD_GLOBAL
-#else
-#  ifdef DL_GLOBAL
-#    define LT_DLGLOBAL		DL_GLOBAL
-#  else
-#    define LT_DLGLOBAL		0
-#  endif
-#endif
-
-/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
-   find out it does not work in some platform. */
-#ifndef LT_DLLAZY_OR_NOW
-#  ifdef RTLD_LAZY
-#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
-#  else
-#    ifdef DL_LAZY
-#      define LT_DLLAZY_OR_NOW		DL_LAZY
-#    else
-#      ifdef RTLD_NOW
-#        define LT_DLLAZY_OR_NOW	RTLD_NOW
-#      else
-#        ifdef DL_NOW
-#          define LT_DLLAZY_OR_NOW	DL_NOW
-#        else
-#          define LT_DLLAZY_OR_NOW	0
-#        endif
-#      endif
-#    endif
-#  endif
-#endif
-
-void fnord() { int i=42;}
-int main ()
-{
-  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
-  int status = $lt_dlunknown;
-
-  if (self)
-    {
-      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
-      /* dlclose (self); */
-    }
-  else
-    puts (dlerror ());
-
-  return status;
-}]
-_LT_EOF
-  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
-    lt_status=$?
-    case x$lt_status in
-      x$lt_dlno_uscore) $1 ;;
-      x$lt_dlneed_uscore) $2 ;;
-      x$lt_dlunknown|x*) $3 ;;
-    esac
-  else :
-    # compilation failed
-    $3
-  fi
-fi
-rm -fr conftest*
-])# _LT_TRY_DLOPEN_SELF
-
-
-# LT_SYS_DLOPEN_SELF
-# ------------------
-AC_DEFUN([LT_SYS_DLOPEN_SELF],
-[m4_require([_LT_HEADER_DLFCN])dnl
-if test "x$enable_dlopen" != xyes; then
-  enable_dlopen=unknown
-  enable_dlopen_self=unknown
-  enable_dlopen_self_static=unknown
-else
-  lt_cv_dlopen=no
-  lt_cv_dlopen_libs=
-
-  case $host_os in
-  beos*)
-    lt_cv_dlopen="load_add_on"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
-    ;;
-
-  mingw* | pw32* | cegcc*)
-    lt_cv_dlopen="LoadLibrary"
-    lt_cv_dlopen_libs=
-    ;;
-
-  cygwin*)
-    lt_cv_dlopen="dlopen"
-    lt_cv_dlopen_libs=
-    ;;
-
-  darwin*)
-  # if libdl is installed we need to link against it
-    AC_CHECK_LIB([dl], [dlopen],
-		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
-    lt_cv_dlopen="dyld"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
-    ])
-    ;;
-
-  *)
-    AC_CHECK_FUNC([shl_load],
-	  [lt_cv_dlopen="shl_load"],
-      [AC_CHECK_LIB([dld], [shl_load],
-	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
-	[AC_CHECK_FUNC([dlopen],
-	      [lt_cv_dlopen="dlopen"],
-	  [AC_CHECK_LIB([dl], [dlopen],
-		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
-	    [AC_CHECK_LIB([svld], [dlopen],
-		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
-	      [AC_CHECK_LIB([dld], [dld_link],
-		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
-	      ])
-	    ])
-	  ])
-	])
-      ])
-    ;;
-  esac
-
-  if test "x$lt_cv_dlopen" != xno; then
-    enable_dlopen=yes
-  else
-    enable_dlopen=no
-  fi
-
-  case $lt_cv_dlopen in
-  dlopen)
-    save_CPPFLAGS="$CPPFLAGS"
-    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
-
-    save_LDFLAGS="$LDFLAGS"
-    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
-
-    save_LIBS="$LIBS"
-    LIBS="$lt_cv_dlopen_libs $LIBS"
-
-    AC_CACHE_CHECK([whether a program can dlopen itself],
-	  lt_cv_dlopen_self, [dnl
-	  _LT_TRY_DLOPEN_SELF(
-	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
-	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
-    ])
-
-    if test "x$lt_cv_dlopen_self" = xyes; then
-      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
-      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
-	  lt_cv_dlopen_self_static, [dnl
-	  _LT_TRY_DLOPEN_SELF(
-	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
-	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
-      ])
-    fi
-
-    CPPFLAGS="$save_CPPFLAGS"
-    LDFLAGS="$save_LDFLAGS"
-    LIBS="$save_LIBS"
-    ;;
-  esac
-
-  case $lt_cv_dlopen_self in
-  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
-  *) enable_dlopen_self=unknown ;;
-  esac
-
-  case $lt_cv_dlopen_self_static in
-  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
-  *) enable_dlopen_self_static=unknown ;;
-  esac
-fi
-_LT_DECL([dlopen_support], [enable_dlopen], [0],
-	 [Whether dlopen is supported])
-_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
-	 [Whether dlopen of programs is supported])
-_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
-	 [Whether dlopen of statically linked programs is supported])
-])# LT_SYS_DLOPEN_SELF
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
-
-
-# _LT_COMPILER_C_O([TAGNAME])
-# ---------------------------
-# Check to see if options -c and -o are simultaneously supported by compiler.
-# This macro does not hard code the compiler like AC_PROG_CC_C_O.
-m4_defun([_LT_COMPILER_C_O],
-[m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_TAG_COMPILER])dnl
-AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
-  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
-  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
-   $RM -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
-     fi
-   fi
-   chmod u+w . 2>&AS_MESSAGE_LOG_FD
-   $RM conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
-   $RM out/* && rmdir out
-   cd ..
-   $RM -r conftest
-   $RM conftest*
-])
-_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
-	[Does compiler simultaneously support -c and -o options?])
-])# _LT_COMPILER_C_O
-
-
-# _LT_COMPILER_FILE_LOCKS([TAGNAME])
-# ----------------------------------
-# Check to see if we can do hard links to lock some files if needed
-m4_defun([_LT_COMPILER_FILE_LOCKS],
-[m4_require([_LT_ENABLE_LOCK])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-_LT_COMPILER_C_O([$1])
-
-hard_links="nottested"
-if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
-  # do not overwrite the value of need_locks provided by the user
-  AC_MSG_CHECKING([if we can lock with hard links])
-  hard_links=yes
-  $RM conftest*
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  touch conftest.a
-  ln conftest.a conftest.b 2>&5 || hard_links=no
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  AC_MSG_RESULT([$hard_links])
-  if test "$hard_links" = no; then
-    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
-    need_locks=warn
-  fi
-else
-  need_locks=no
-fi
-_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
-])# _LT_COMPILER_FILE_LOCKS
-
-
-# _LT_CHECK_OBJDIR
-# ----------------
-m4_defun([_LT_CHECK_OBJDIR],
-[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
-[rm -f .libs 2>/dev/null
-mkdir .libs 2>/dev/null
-if test -d .libs; then
-  lt_cv_objdir=.libs
-else
-  # MS-DOS does not allow filenames that begin with a dot.
-  lt_cv_objdir=_libs
-fi
-rmdir .libs 2>/dev/null])
-objdir=$lt_cv_objdir
-_LT_DECL([], [objdir], [0],
-         [The name of the directory that contains temporary libtool files])dnl
-m4_pattern_allow([LT_OBJDIR])dnl
-AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
-  [Define to the sub-directory in which libtool stores uninstalled libraries.])
-])# _LT_CHECK_OBJDIR
-
-
-# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
-# --------------------------------------
-# Check hardcoding attributes.
-m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
-[AC_MSG_CHECKING([how to hardcode library paths into programs])
-_LT_TAGVAR(hardcode_action, $1)=
-if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
-   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
-   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
-
-  # We can hardcode non-existent directories.
-  if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
-     # If the only mechanism to avoid hardcoding is shlibpath_var, we
-     # have to relink, otherwise we might link with an installed library
-     # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
-     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
-    # Linking always hardcodes the temporary library directory.
-    _LT_TAGVAR(hardcode_action, $1)=relink
-  else
-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
-    _LT_TAGVAR(hardcode_action, $1)=immediate
-  fi
-else
-  # We cannot hardcode anything, or else we can only hardcode existing
-  # directories.
-  _LT_TAGVAR(hardcode_action, $1)=unsupported
-fi
-AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
-
-if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
-   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
-  # Fast installation is not supported
-  enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
-  # Fast installation is not necessary
-  enable_fast_install=needless
-fi
-_LT_TAGDECL([], [hardcode_action], [0],
-    [How to hardcode a shared library path into an executable])
-])# _LT_LINKER_HARDCODE_LIBPATH
-
-
-# _LT_CMD_STRIPLIB
-# ----------------
-m4_defun([_LT_CMD_STRIPLIB],
-[m4_require([_LT_DECL_EGREP])
-striplib=
-old_striplib=
-AC_MSG_CHECKING([whether stripping libraries is possible])
-if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
-  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
-  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  AC_MSG_RESULT([yes])
-else
-# FIXME - insert some real tests, host_os isn't really good enough
-  case $host_os in
-  darwin*)
-    if test -n "$STRIP" ; then
-      striplib="$STRIP -x"
-      old_striplib="$STRIP -S"
-      AC_MSG_RESULT([yes])
-    else
-      AC_MSG_RESULT([no])
-    fi
-    ;;
-  *)
-    AC_MSG_RESULT([no])
-    ;;
-  esac
-fi
-_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
-_LT_DECL([], [striplib], [1])
-])# _LT_CMD_STRIPLIB
-
-
-# _LT_SYS_DYNAMIC_LINKER([TAG])
-# -----------------------------
-# PORTME Fill in your ld.so characteristics
-m4_defun([_LT_SYS_DYNAMIC_LINKER],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_OBJDUMP])dnl
-m4_require([_LT_DECL_SED])dnl
-AC_MSG_CHECKING([dynamic linker characteristics])
-m4_if([$1],
-	[], [
-if test "$GCC" = yes; then
-  case $host_os in
-    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
-    *) lt_awk_arg="/^libraries:/" ;;
-  esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
-    # if the path contains ";" then we assume it to be the separator
-    # otherwise default to the standard path separator (i.e. ":") - it is
-    # assumed that no part of a normal pathname contains ";" but that should
-    # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
-  # Ok, now we have the path, separated by spaces, we can step through it
-  # and add multilib dir if necessary.
-  lt_tmp_lt_search_path_spec=
-  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
-  for lt_sys_path in $lt_search_path_spec; do
-    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
-      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
-    else
-      test -d "$lt_sys_path" && \
-	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
-    fi
-  done
-  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
-BEGIN {RS=" "; FS="/|\n";} {
-  lt_foo="";
-  lt_count=0;
-  for (lt_i = NF; lt_i > 0; lt_i--) {
-    if ($lt_i != "" && $lt_i != ".") {
-      if ($lt_i == "..") {
-        lt_count++;
-      } else {
-        if (lt_count == 0) {
-          lt_foo="/" $lt_i lt_foo;
-        } else {
-          lt_count--;
-        }
-      }
-    }
-  }
-  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
-  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
-}'`
-  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
-else
-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-fi])
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-shrext_cmds=".so"
-postinstall_cmds=
-postuninstall_cmds=
-finish_cmds=
-finish_eval=
-shlibpath_var=
-shlibpath_overrides_runpath=unknown
-version_type=none
-dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib"
-need_lib_prefix=unknown
-hardcode_into_libs=no
-
-# when you set need_version to no, make sure it does not cause -set_version
-# flags to be left without arguments
-need_version=unknown
-
-case $host_os in
-aix3*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
-  shlibpath_var=LIBPATH
-
-  # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
-  ;;
-
-aix[[4-9]]*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
-    # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
-    shlibpath_var=LD_LIBRARY_PATH
-  else
-    # With GCC up to 2.95.x, collect2 would create an import file
-    # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
-    # development snapshots of GCC prior to 3.0.
-    case $host_os in
-      aix4 | aix4.[[01]] | aix4.[[01]].*)
-      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
-	   echo ' yes '
-	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
-	:
-      else
-	can_build_shared=no
-      fi
-      ;;
-    esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
-    # soname into executable. Probably we can add versioning support to
-    # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
-      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
-      # instead of lib<name>.a to let people know that these are not
-      # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    else
-      # We preserve .a as extension for shared libraries through AIX4.2
-      # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
-    fi
-    shlibpath_var=LIBPATH
-  fi
-  ;;
-
-amigaos*)
-  case $host_cpu in
-  powerpc)
-    # Since July 2007 AmigaOS4 officially supports .so libraries.
-    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    ;;
-  m68k)
-    library_names_spec='$libname.ixlibrary $libname.a'
-    # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
-    ;;
-  esac
-  ;;
-
-beos*)
-  library_names_spec='${libname}${shared_ext}'
-  dynamic_linker="$host_os ld.so"
-  shlibpath_var=LIBRARY_PATH
-  ;;
-
-bsdi[[45]]*)
-  version_type=linux
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
-  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
-  # the default ld.so.conf also contains /usr/contrib/lib and
-  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
-  # libtool to hard-code these into programs
-  ;;
-
-cygwin* | mingw* | pw32* | cegcc*)
-  version_type=windows
-  shrext_cmds=".dll"
-  need_version=no
-  need_lib_prefix=no
-
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
-    library_names_spec='$libname.dll.a'
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname~
-      chmod a+x \$dldir/$dlname~
-      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
-        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
-      fi'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-
-    case $host_os in
-    cygwin*)
-      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
-      ;;
-    mingw* | cegcc*)
-      # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    ;;
-
-  *)
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    ;;
-  esac
-  dynamic_linker='Win32 ld.exe'
-  # FIXME: first we should search . and the directory the executable is in
-  shlibpath_var=PATH
-  ;;
-
-darwin* | rhapsody*)
-  dynamic_linker="$host_os dyld"
-  version_type=darwin
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
-  shlibpath_overrides_runpath=yes
-  shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
-m4_if([$1], [],[
-  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
-  ;;
-
-dgux*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
-
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
-freebsd* | dragonfly*)
-  # DragonFly does not have aout.  When/if they implement a new
-  # versioning mechanism, adjust this.
-  if test -x /usr/bin/objformat; then
-    objformat=`/usr/bin/objformat`
-  else
-    case $host_os in
-    freebsd[[123]]*) objformat=aout ;;
-    *) objformat=elf ;;
-    esac
-  fi
-  # Handle Gentoo/FreeBSD as it was Linux
-  case $host_vendor in
-    gentoo)
-      version_type=linux ;;
-    *)
-      version_type=freebsd-$objformat ;;
-  esac
-
-  case $version_type in
-    freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-      need_version=no
-      need_lib_prefix=no
-      ;;
-    freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
-      need_version=yes
-      ;;
-    linux)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-      soname_spec='${libname}${release}${shared_ext}$major'
-      need_lib_prefix=no
-      need_version=no
-      ;;
-  esac
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_os in
-  freebsd2*)
-    shlibpath_overrides_runpath=yes
-    ;;
-  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
-  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
-    shlibpath_overrides_runpath=no
-    hardcode_into_libs=yes
-    ;;
-  *) # from 4.6 on, and DragonFly
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  esac
-  ;;
-
-gnu*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  hardcode_into_libs=yes
-  ;;
-
-hpux9* | hpux10* | hpux11*)
-  # Give a soname corresponding to the major version so that dld.sl refuses to
-  # link against other versions.
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  case $host_cpu in
-  ia64*)
-    shrext_cmds='.so'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.so"
-    shlibpath_var=LD_LIBRARY_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
-      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
-    else
-      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
-    fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-  hppa*64*)
-    shrext_cmds='.sl'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-  *)
-    shrext_cmds='.sl'
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=SHLIB_PATH
-    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    ;;
-  esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
-  postinstall_cmds='chmod 555 $lib'
-  ;;
-
-interix[[3-9]]*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-irix5* | irix6* | nonstopux*)
-  case $host_os in
-    nonstopux*) version_type=nonstopux ;;
-    *)
-	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
-	else
-		version_type=irix
-	fi ;;
-  esac
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
-  case $host_os in
-  irix5* | nonstopux*)
-    libsuff= shlibsuff=
-    ;;
-  *)
-    case $LD in # libtool.m4 will add one of these switches to LD
-    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
-      libsuff= shlibsuff= libmagic=32-bit;;
-    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
-      libsuff=32 shlibsuff=N32 libmagic=N32;;
-    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
-      libsuff=64 shlibsuff=64 libmagic=64-bit;;
-    *) libsuff= shlibsuff= libmagic=never-match;;
-    esac
-    ;;
-  esac
-  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
-  shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-  hardcode_into_libs=yes
-  ;;
-
-# No shared lib support for Linux oldld, aout, or coff.
-linux*oldld* | linux*aout* | linux*coff*)
-  dynamic_linker=no
-  ;;
-
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  # Some binutils ld are patched to set DT_RUNPATH
-  save_LDFLAGS=$LDFLAGS
-  save_libdir=$libdir
-  eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
-       LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-    [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
-       [shlibpath_overrides_runpath=yes])])
-  LDFLAGS=$save_LDFLAGS
-  libdir=$save_libdir
-
-  # This implies no fast_install, which is unacceptable.
-  # Some rework will be needed to allow for fast_install
-  # before this can be enabled.
-  hardcode_into_libs=yes
-
-  # Append ld.so.conf contents to the search path
-  if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
-  fi
-
-  # We used to test for /lib/ld.so.1 and disable shared libraries on
-  # powerpc, because MkLinux only supported shared libraries with the
-  # GNU dynamic linker.  Since this was broken with cross compilers,
-  # most powerpc-linux boxes support dynamic linking these days and
-  # people can always --disable-shared, the test was removed, and we
-  # assume the GNU/Linux dynamic linker is in use.
-  dynamic_linker='GNU/Linux ld.so'
-  ;;
-
-netbsd*)
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-    dynamic_linker='NetBSD (a.out) ld.so'
-  else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    dynamic_linker='NetBSD ld.elf_so'
-  fi
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  ;;
-
-newsos6)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  ;;
-
-*nto* | *qnx*)
-  version_type=qnx
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='ldqnx.so'
-  ;;
-
-openbsd*)
-  version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
-  need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
-    *)				need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[[89]] | openbsd2.[[89]].*)
-	shlibpath_overrides_runpath=no
-	;;
-      *)
-	shlibpath_overrides_runpath=yes
-	;;
-      esac
-  else
-    shlibpath_overrides_runpath=yes
-  fi
-  ;;
-
-os2*)
-  libname_spec='$name'
-  shrext_cmds=".dll"
-  need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
-  dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
-  ;;
-
-osf3* | osf4* | osf5*)
-  version_type=osf
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
-  ;;
-
-rdos*)
-  dynamic_linker=no
-  ;;
-
-solaris*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  # ldd complains unless libraries are executable
-  postinstall_cmds='chmod +x $lib'
-  ;;
-
-sunos4*)
-  version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
-    need_lib_prefix=no
-  fi
-  need_version=yes
-  ;;
-
-sysv4 | sysv4.3*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_vendor in
-    sni)
-      shlibpath_overrides_runpath=no
-      need_lib_prefix=no
-      runpath_var=LD_RUN_PATH
-      ;;
-    siemens)
-      need_lib_prefix=no
-      ;;
-    motorola)
-      need_lib_prefix=no
-      need_version=no
-      shlibpath_overrides_runpath=no
-      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
-      ;;
-  esac
-  ;;
-
-sysv4*MP*)
-  if test -d /usr/nec ;then
-    version_type=linux
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
-    shlibpath_var=LD_LIBRARY_PATH
-  fi
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
-    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
-  else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    case $host_os in
-      sco3.2v5*)
-        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
-	;;
-    esac
-  fi
-  sys_lib_dlsearch_path_spec='/usr/lib'
-  ;;
-
-tpf*)
-  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-uts4*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
-
-*)
-  dynamic_linker=no
-  ;;
-esac
-AC_MSG_RESULT([$dynamic_linker])
-test "$dynamic_linker" = no && can_build_shared=no
-
-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
-  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
-fi
-
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-fi
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-fi
-
-_LT_DECL([], [variables_saved_for_relink], [1],
-    [Variables whose values should be saved in libtool wrapper scripts and
-    restored at link time])
-_LT_DECL([], [need_lib_prefix], [0],
-    [Do we need the "lib" prefix for modules?])
-_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
-_LT_DECL([], [version_type], [0], [Library versioning type])
-_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
-_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
-_LT_DECL([], [shlibpath_overrides_runpath], [0],
-    [Is shlibpath searched before the hard-coded library search path?])
-_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
-_LT_DECL([], [library_names_spec], [1],
-    [[List of archive names.  First name is the real one, the rest are links.
-    The last name is the one that the linker finds with -lNAME]])
-_LT_DECL([], [soname_spec], [1],
-    [[The coded name of the library, if different from the real name]])
-_LT_DECL([], [postinstall_cmds], [2],
-    [Command to use after installation of a shared archive])
-_LT_DECL([], [postuninstall_cmds], [2],
-    [Command to use after uninstallation of a shared archive])
-_LT_DECL([], [finish_cmds], [2],
-    [Commands used to finish a libtool library installation in a directory])
-_LT_DECL([], [finish_eval], [1],
-    [[As "finish_cmds", except a single script fragment to be evaled but
-    not shown]])
-_LT_DECL([], [hardcode_into_libs], [0],
-    [Whether we should hardcode library paths into libraries])
-_LT_DECL([], [sys_lib_search_path_spec], [2],
-    [Compile-time system search path for libraries])
-_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
-    [Run-time system search path for libraries])
-])# _LT_SYS_DYNAMIC_LINKER
-
-
-# _LT_PATH_TOOL_PREFIX(TOOL)
-# --------------------------
-# find a file program which can recognize shared library
-AC_DEFUN([_LT_PATH_TOOL_PREFIX],
-[m4_require([_LT_DECL_EGREP])dnl
-AC_MSG_CHECKING([for $1])
-AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
-[case $MAGIC_CMD in
-[[\\/*] |  ?:[\\/]*])
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
-  ;;
-*)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-dnl $ac_dummy forces splitting on constant user-supplied paths.
-dnl POSIX.2 word splitting is done only on the output of word expansions,
-dnl not every word.  This closes a longstanding sh security hole.
-  ac_dummy="m4_if([$2], , $PATH, [$2])"
-  for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$1; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
-      if test -n "$file_magic_test_file"; then
-	case $deplibs_check_method in
-	"file_magic "*)
-	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
-	    $EGREP "$file_magic_regex" > /dev/null; then
-	    :
-	  else
-	    cat <<_LT_EOF 1>&2
-
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such.  This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem.  Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool at gnu.org
-
-_LT_EOF
-	  fi ;;
-	esac
-      fi
-      break
-    fi
-  done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
-  ;;
-esac])
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
-  AC_MSG_RESULT($MAGIC_CMD)
-else
-  AC_MSG_RESULT(no)
-fi
-_LT_DECL([], [MAGIC_CMD], [0],
-	 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
-])# _LT_PATH_TOOL_PREFIX
-
-# Old name:
-AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
-
-
-# _LT_PATH_MAGIC
-# --------------
-# find a file program which can recognize a shared library
-m4_defun([_LT_PATH_MAGIC],
-[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
-if test -z "$lt_cv_path_MAGIC_CMD"; then
-  if test -n "$ac_tool_prefix"; then
-    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
-  else
-    MAGIC_CMD=:
-  fi
-fi
-])# _LT_PATH_MAGIC
-
-
-# LT_PATH_LD
-# ----------
-# find the pathname to the GNU or non-GNU linker
-AC_DEFUN([LT_PATH_LD],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_DECL_EGREP])dnl
-
-AC_ARG_WITH([gnu-ld],
-    [AS_HELP_STRING([--with-gnu-ld],
-	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
-    [test "$withval" = no || with_gnu_ld=yes],
-    [with_gnu_ld=no])dnl
-
-ac_prog=ld
-if test "$GCC" = yes; then
-  # Check if gcc -print-prog-name=ld gives a path.
-  AC_MSG_CHECKING([for ld used by $CC])
-  case $host in
-  *-*-mingw*)
-    # gcc leaves a trailing carriage return which upsets mingw
-    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
-  *)
-    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
-  esac
-  case $ac_prog in
-    # Accept absolute paths.
-    [[\\/]]* | ?:[[\\/]]*)
-      re_direlt='/[[^/]][[^/]]*/\.\./'
-      # Canonicalize the pathname of ld
-      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
-      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
-	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
-      done
-      test -z "$LD" && LD="$ac_prog"
-      ;;
-  "")
-    # If it fails, then pretend we aren't using GCC.
-    ac_prog=ld
-    ;;
-  *)
-    # If it is relative, then search for the first ld in PATH.
-    with_gnu_ld=unknown
-    ;;
-  esac
-elif test "$with_gnu_ld" = yes; then
-  AC_MSG_CHECKING([for GNU ld])
-else
-  AC_MSG_CHECKING([for non-GNU ld])
-fi
-AC_CACHE_VAL(lt_cv_path_LD,
-[if test -z "$LD"; then
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  for ac_dir in $PATH; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
-      lt_cv_path_LD="$ac_dir/$ac_prog"
-      # Check to see if the program is GNU ld.  I'd rather use --version,
-      # but apparently some variants of GNU ld only accept -v.
-      # Break only if it was the GNU/non-GNU ld that we prefer.
-      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
-      *GNU* | *'with BFD'*)
-	test "$with_gnu_ld" != no && break
-	;;
-      *)
-	test "$with_gnu_ld" != yes && break
-	;;
-      esac
-    fi
-  done
-  IFS="$lt_save_ifs"
-else
-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
-  AC_MSG_RESULT($LD)
-else
-  AC_MSG_RESULT(no)
-fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-_LT_PATH_LD_GNU
-AC_SUBST([LD])
-
-_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
-])# LT_PATH_LD
-
-# Old names:
-AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
-AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_PROG_LD], [])
-dnl AC_DEFUN([AC_PROG_LD], [])
-
-
-# _LT_PATH_LD_GNU
-#- --------------
-m4_defun([_LT_PATH_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
-[# I'd rather use --version here, but apparently some GNU lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
-  lt_cv_prog_gnu_ld=yes
-  ;;
-*)
-  lt_cv_prog_gnu_ld=no
-  ;;
-esac])
-with_gnu_ld=$lt_cv_prog_gnu_ld
-])# _LT_PATH_LD_GNU
-
-
-# _LT_CMD_RELOAD
-# --------------
-# find reload flag for linker
-#   -- PORTME Some linkers may need a different reload flag.
-m4_defun([_LT_CMD_RELOAD],
-[AC_CACHE_CHECK([for $LD option to reload object files],
-  lt_cv_ld_reload_flag,
-  [lt_cv_ld_reload_flag='-r'])
-reload_flag=$lt_cv_ld_reload_flag
-case $reload_flag in
-"" | " "*) ;;
-*) reload_flag=" $reload_flag" ;;
-esac
-reload_cmds='$LD$reload_flag -o $output$reload_objs'
-case $host_os in
-  darwin*)
-    if test "$GCC" = yes; then
-      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
-    else
-      reload_cmds='$LD$reload_flag -o $output$reload_objs'
-    fi
-    ;;
-esac
-_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl
-_LT_DECL([], [reload_cmds], [2])dnl
-])# _LT_CMD_RELOAD
-
-
-# _LT_CHECK_MAGIC_METHOD
-# ----------------------
-# how to check for library dependencies
-#  -- PORTME fill in with the dynamic library characteristics
-m4_defun([_LT_CHECK_MAGIC_METHOD],
-[m4_require([_LT_DECL_EGREP])
-m4_require([_LT_DECL_OBJDUMP])
-AC_CACHE_CHECK([how to recognize dependent libraries],
-lt_cv_deplibs_check_method,
-[lt_cv_file_magic_cmd='$MAGIC_CMD'
-lt_cv_file_magic_test_file=
-lt_cv_deplibs_check_method='unknown'
-# Need to set the preceding variable on all platforms that support
-# interlibrary dependencies.
-# 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
-# 'pass_all' -- all dependencies passed with no checks.
-# 'test_compile' -- check by making test program.
-# 'file_magic [[regex]]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given extended regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
-
-case $host_os in
-aix[[4-9]]*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-beos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-bsdi[[45]]*)
-  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
-  lt_cv_file_magic_cmd='/usr/bin/file -L'
-  lt_cv_file_magic_test_file=/shlib/libc.so
-  ;;
-
-cygwin*)
-  # func_win32_libid is a shell function defined in ltmain.sh
-  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-  lt_cv_file_magic_cmd='func_win32_libid'
-  ;;
-
-mingw* | pw32*)
-  # Base MSYS/MinGW do not provide the 'file' command needed by
-  # func_win32_libid shell function, so use a weaker test based on 'objdump',
-  # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
-    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-    lt_cv_file_magic_cmd='func_win32_libid'
-  else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
-    lt_cv_file_magic_cmd='$OBJDUMP -f'
-  fi
-  ;;
-
-cegcc)
-  # use the weaker test based on 'objdump'. See mingw*.
-  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
-  lt_cv_file_magic_cmd='$OBJDUMP -f'
-  ;;
-
-darwin* | rhapsody*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-freebsd* | dragonfly*)
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
-    case $host_cpu in
-    i*86 )
-      # Not sure whether the presence of OpenBSD here was a mistake.
-      # Let's accept both of them until this is cleared up.
-      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
-      lt_cv_file_magic_cmd=/usr/bin/file
-      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
-      ;;
-    esac
-  else
-    lt_cv_deplibs_check_method=pass_all
-  fi
-  ;;
-
-gnu*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-hpux10.20* | hpux11*)
-  lt_cv_file_magic_cmd=/usr/bin/file
-  case $host_cpu in
-  ia64*)
-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
-    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
-    ;;
-  hppa*64*)
-    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
-    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
-    ;;
-  *)
-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
-    lt_cv_file_magic_test_file=/usr/lib/libc.sl
-    ;;
-  esac
-  ;;
-
-interix[[3-9]]*)
-  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
-  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
-  ;;
-
-irix5* | irix6* | nonstopux*)
-  case $LD in
-  *-32|*"-32 ") libmagic=32-bit;;
-  *-n32|*"-n32 ") libmagic=N32;;
-  *-64|*"-64 ") libmagic=64-bit;;
-  *) libmagic=never-match;;
-  esac
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-netbsd*)
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
-  else
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
-  fi
-  ;;
-
-newos6*)
-  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
-  lt_cv_file_magic_cmd=/usr/bin/file
-  lt_cv_file_magic_test_file=/usr/lib/libnls.so
-  ;;
-
-*nto* | *qnx*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-openbsd*)
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
-  else
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
-  fi
-  ;;
-
-osf3* | osf4* | osf5*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-rdos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-solaris*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-sysv4 | sysv4.3*)
-  case $host_vendor in
-  motorola)
-    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
-    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
-    ;;
-  ncr)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  sequent)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
-    ;;
-  sni)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
-    lt_cv_file_magic_test_file=/lib/libc.so
-    ;;
-  siemens)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  pc)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  esac
-  ;;
-
-tpf*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-esac
-])
-file_magic_cmd=$lt_cv_file_magic_cmd
-deplibs_check_method=$lt_cv_deplibs_check_method
-test -z "$deplibs_check_method" && deplibs_check_method=unknown
-
-_LT_DECL([], [deplibs_check_method], [1],
-    [Method to check whether dependent libraries are shared objects])
-_LT_DECL([], [file_magic_cmd], [1],
-    [Command to use when deplibs_check_method == "file_magic"])
-])# _LT_CHECK_MAGIC_METHOD
-
-
-# LT_PATH_NM
-# ----------
-# find the pathname to a BSD- or MS-compatible name lister
-AC_DEFUN([LT_PATH_NM],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
-[if test -n "$NM"; then
-  # Let the user override the test.
-  lt_cv_path_NM="$NM"
-else
-  lt_nm_to_check="${ac_tool_prefix}nm"
-  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
-    lt_nm_to_check="$lt_nm_to_check nm"
-  fi
-  for lt_tmp_nm in $lt_nm_to_check; do
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
-      IFS="$lt_save_ifs"
-      test -z "$ac_dir" && ac_dir=.
-      tmp_nm="$ac_dir/$lt_tmp_nm"
-      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
-	# Check to see if the nm accepts a BSD-compat flag.
-	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
-	#   nm: unknown option "B" ignored
-	# Tru64's nm complains that /dev/null is an invalid object file
-	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
-	*/dev/null* | *'Invalid file or object type'*)
-	  lt_cv_path_NM="$tmp_nm -B"
-	  break
-	  ;;
-	*)
-	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
-	  */dev/null*)
-	    lt_cv_path_NM="$tmp_nm -p"
-	    break
-	    ;;
-	  *)
-	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
-	    continue # so that we can try to find one that supports BSD flags
-	    ;;
-	  esac
-	  ;;
-	esac
-      fi
-    done
-    IFS="$lt_save_ifs"
-  done
-  : ${lt_cv_path_NM=no}
-fi])
-if test "$lt_cv_path_NM" != "no"; then
-  NM="$lt_cv_path_NM"
-else
-  # Didn't find any BSD compatible name lister, look for dumpbin.
-  AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
-  AC_SUBST([DUMPBIN])
-  if test "$DUMPBIN" != ":"; then
-    NM="$DUMPBIN"
-  fi
-fi
-test -z "$NM" && NM=nm
-AC_SUBST([NM])
-_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
-
-AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
-  [lt_cv_nm_interface="BSD nm"
-  echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
-  (eval "$ac_compile" 2>conftest.err)
-  cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
-  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
-  cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
-  cat conftest.out >&AS_MESSAGE_LOG_FD
-  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
-    lt_cv_nm_interface="MS dumpbin"
-  fi
-  rm -f conftest*])
-])# LT_PATH_NM
-
-# Old names:
-AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
-AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_PROG_NM], [])
-dnl AC_DEFUN([AC_PROG_NM], [])
-
-
-# LT_LIB_M
-# --------
-# check for math library
-AC_DEFUN([LT_LIB_M],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-LIBM=
-case $host in
-*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
-  # These system don't have libm, or don't need it
-  ;;
-*-ncr-sysv4.3*)
-  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
-  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
-  ;;
-*)
-  AC_CHECK_LIB(m, cos, LIBM="-lm")
-  ;;
-esac
-AC_SUBST([LIBM])
-])# LT_LIB_M
-
-# Old name:
-AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_CHECK_LIBM], [])
-
-
-# _LT_COMPILER_NO_RTTI([TAGNAME])
-# -------------------------------
-m4_defun([_LT_COMPILER_NO_RTTI],
-[m4_require([_LT_TAG_COMPILER])dnl
-
-_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
-
-if test "$GCC" = yes; then
-  _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
-
-  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
-    lt_cv_prog_compiler_rtti_exceptions,
-    [-fno-rtti -fno-exceptions], [],
-    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
-fi
-_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
-	[Compiler flag to turn off builtin functions])
-])# _LT_COMPILER_NO_RTTI
-
-
-# _LT_CMD_GLOBAL_SYMBOLS
-# ----------------------
-m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([LT_PATH_NM])dnl
-AC_REQUIRE([LT_PATH_LD])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_TAG_COMPILER])dnl
-
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-AC_MSG_CHECKING([command to parse $NM output from $compiler object])
-AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
-[
-# These are sane defaults that work on at least a few old systems.
-# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
-
-# Character class describing NM global symbol codes.
-symcode='[[BCDEGRST]]'
-
-# Regexp to match symbols that can be accessed directly from C.
-sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
-
-# Define system-specific variables.
-case $host_os in
-aix*)
-  symcode='[[BCDT]]'
-  ;;
-cygwin* | mingw* | pw32* | cegcc*)
-  symcode='[[ABCDGISTW]]'
-  ;;
-hpux*)
-  if test "$host_cpu" = ia64; then
-    symcode='[[ABCDEGRST]]'
-  fi
-  ;;
-irix* | nonstopux*)
-  symcode='[[BCDEGRST]]'
-  ;;
-osf*)
-  symcode='[[BCDEGQRST]]'
-  ;;
-solaris*)
-  symcode='[[BDRT]]'
-  ;;
-sco3.2v5*)
-  symcode='[[DT]]'
-  ;;
-sysv4.2uw2*)
-  symcode='[[DT]]'
-  ;;
-sysv5* | sco5v6* | unixware* | OpenUNIX*)
-  symcode='[[ABDT]]'
-  ;;
-sysv4)
-  symcode='[[DFNSTU]]'
-  ;;
-esac
-
-# If we're using GNU nm, then use its standard symbol codes.
-case `$NM -V 2>&1` in
-*GNU* | *'with BFD'*)
-  symcode='[[ABCDGIRSTW]]' ;;
-esac
-
-# Transform an extracted symbol line into a proper C declaration.
-# Some systems (esp. on ia64) link data and code symbols differently,
-# so use this general approach.
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
-
-# Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
-
-# Handle CRLF in mingw tool chain
-opt_cr=
-case $build_os in
-mingw*)
-  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
-  ;;
-esac
-
-# Try without a prefix underscore, then with it.
-for ac_symprfx in "" "_"; do
-
-  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
-  symxfrm="\\1 $ac_symprfx\\2 \\2"
-
-  # Write the raw and C identifiers.
-  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-    # Fake it for dumpbin and say T for any non-static function
-    # and D for any global variable.
-    # Also find C++ and __fastcall symbols from MSVC++,
-    # which start with @ or ?.
-    lt_cv_sys_global_symbol_pipe="$AWK ['"\
-"     {last_section=section; section=\$ 3};"\
-"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
-"     \$ 0!~/External *\|/{next};"\
-"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
-"     {if(hide[section]) next};"\
-"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
-"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
-"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
-"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
-"     ' prfx=^$ac_symprfx]"
-  else
-    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
-  fi
-
-  # Check to see that the pipe works correctly.
-  pipe_works=no
-
-  rm -f conftest*
-  cat > conftest.$ac_ext <<_LT_EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(void);
-void nm_test_func(void){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
-_LT_EOF
-
-  if AC_TRY_EVAL(ac_compile); then
-    # Now try to grab the symbols.
-    nlist=conftest.nm
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
-      # Try sorting and uniquifying the output.
-      if sort "$nlist" | uniq > "$nlist"T; then
-	mv -f "$nlist"T "$nlist"
-      else
-	rm -f "$nlist"T
-      fi
-
-      # Make sure that we snagged all the symbols we need.
-      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
-	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
-	  cat <<_LT_EOF > conftest.$ac_ext
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-_LT_EOF
-	  # Now generate the symbol file.
-	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
-
-	  cat <<_LT_EOF >> conftest.$ac_ext
-
-/* The mapping between symbol names and symbols.  */
-const struct {
-  const char *name;
-  void       *address;
-}
-lt__PROGRAM__LTX_preloaded_symbols[[]] =
-{
-  { "@PROGRAM@", (void *) 0 },
-_LT_EOF
-	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
-	  cat <<\_LT_EOF >> conftest.$ac_ext
-  {0, (void *) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
-  return lt__PROGRAM__LTX_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-_LT_EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_save_LIBS="$LIBS"
-	  lt_save_CFLAGS="$CFLAGS"
-	  LIBS="conftstm.$ac_objext"
-	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
-	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
-	    pipe_works=yes
-	  fi
-	  LIBS="$lt_save_LIBS"
-	  CFLAGS="$lt_save_CFLAGS"
-	else
-	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
-	fi
-      else
-	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
-      fi
-    else
-      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
-    fi
-  else
-    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
-    cat conftest.$ac_ext >&5
-  fi
-  rm -rf conftest* conftst*
-
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$pipe_works" = yes; then
-    break
-  else
-    lt_cv_sys_global_symbol_pipe=
-  fi
-done
-])
-if test -z "$lt_cv_sys_global_symbol_pipe"; then
-  lt_cv_sys_global_symbol_to_cdecl=
-fi
-if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
-  AC_MSG_RESULT(failed)
-else
-  AC_MSG_RESULT(ok)
-fi
-
-_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
-    [Take the output of nm and produce a listing of raw symbols and C names])
-_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
-    [Transform the output of nm in a proper C declaration])
-_LT_DECL([global_symbol_to_c_name_address],
-    [lt_cv_sys_global_symbol_to_c_name_address], [1],
-    [Transform the output of nm in a C name address pair])
-_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
-    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
-    [Transform the output of nm in a C name address pair when lib prefix is needed])
-]) # _LT_CMD_GLOBAL_SYMBOLS
-
-
-# _LT_COMPILER_PIC([TAGNAME])
-# ---------------------------
-m4_defun([_LT_COMPILER_PIC],
-[m4_require([_LT_TAG_COMPILER])dnl
-_LT_TAGVAR(lt_prog_compiler_wl, $1)=
-_LT_TAGVAR(lt_prog_compiler_pic, $1)=
-_LT_TAGVAR(lt_prog_compiler_static, $1)=
-
-AC_MSG_CHECKING([for $compiler option to produce PIC])
-m4_if([$1], [CXX], [
-  # C++ specific cases for pic, static, wl, etc.
-  if test "$GXX" = yes; then
-    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-
-    case $host_os in
-    aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-        ;;
-      m68k)
-            # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
-            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
-        ;;
-      esac
-      ;;
-
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-    mingw* | cygwin* | os2* | pw32* | cegcc*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      m4_if([$1], [GCJ], [],
-	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
-      ;;
-    *djgpp*)
-      # DJGPP does not support shared libraries at all
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
-      ;;
-    interix[[3-9]]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
-      fi
-      ;;
-    hpux*)
-      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
-      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
-      # sets the default TLS model and affects inlining.
-      case $host_cpu in
-      hppa*64*)
-	;;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	;;
-      esac
-      ;;
-    *qnx* | *nto*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-      ;;
-    *)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-      ;;
-    esac
-  else
-    case $host_os in
-      aix[[4-9]]*)
-	# All AIX code is PIC.
-	if test "$host_cpu" = ia64; then
-	  # AIX 5 now supports IA64 processor
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	else
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
-	fi
-	;;
-      chorus*)
-	case $cc_basename in
-	cxch68*)
-	  # Green Hills C++ Compiler
-	  # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
-	  ;;
-	esac
-	;;
-      dgux*)
-	case $cc_basename in
-	  ec++*)
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    ;;
-	  ghcx*)
-	    # Green Hills C++ Compiler
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      freebsd* | dragonfly*)
-	# FreeBSD uses GNU C++
-	;;
-      hpux9* | hpux10* | hpux11*)
-	case $cc_basename in
-	  CC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-	    if test "$host_cpu" != ia64; then
-	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	    fi
-	    ;;
-	  aCC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-	    case $host_cpu in
-	    hppa*64*|ia64*)
-	      # +Z the default
-	      ;;
-	    *)
-	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	      ;;
-	    esac
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      interix*)
-	# This is c89, which is MS Visual C++ (no shared libs)
-	# Anyone wants to do a port?
-	;;
-      irix5* | irix6* | nonstopux*)
-	case $cc_basename in
-	  CC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    # CC pic flag -KPIC is the default.
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      linux* | k*bsd*-gnu)
-	case $cc_basename in
-	  KCC*)
-	    # KAI C++ Compiler
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	    ;;
-	  ecpc* )
-	    # old Intel C++ for x86_64 which still supported -KPIC.
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-	    ;;
-	  icpc* )
-	    # Intel C++, used to be incompatible with GCC.
-	    # ICC 10 doesn't accept -KPIC any more.
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-	    ;;
-	  pgCC* | pgcpp*)
-	    # Portland Group C++ compiler
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	  cxx*)
-	    # Compaq C++
-	    # Make sure the PIC flag is empty.  It appears that all Alpha
-	    # Linux and Compaq Tru64 Unix objects are PIC.
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    ;;
-	  xlc* | xlC*)
-	    # IBM XL 8.0 on PPC
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
-	    ;;
-	  *)
-	    case `$CC -V 2>&1 | sed 5q` in
-	    *Sun\ C*)
-	      # Sun C++ 5.9
-	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	      ;;
-	    esac
-	    ;;
-	esac
-	;;
-      lynxos*)
-	;;
-      m88k*)
-	;;
-      mvs*)
-	case $cc_basename in
-	  cxx*)
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      netbsd*)
-	;;
-      *qnx* | *nto*)
-        # QNX uses GNU C++, but need to define -shared option too, otherwise
-        # it will coredump.
-        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-        ;;
-      osf3* | osf4* | osf5*)
-	case $cc_basename in
-	  KCC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
-	    ;;
-	  RCC*)
-	    # Rational C++ 2.4.1
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  cxx*)
-	    # Digital/Compaq C++
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    # Make sure the PIC flag is empty.  It appears that all Alpha
-	    # Linux and Compaq Tru64 Unix objects are PIC.
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      psos*)
-	;;
-      solaris*)
-	case $cc_basename in
-	  CC*)
-	    # Sun C++ 4.2, 5.x and Centerline C++
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	    ;;
-	  gcx*)
-	    # Green Hills C++ Compiler
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      sunos4*)
-	case $cc_basename in
-	  CC*)
-	    # Sun C++ 4.x
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	  lcc*)
-	    # Lucid
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-	case $cc_basename in
-	  CC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	esac
-	;;
-      tandem*)
-	case $cc_basename in
-	  NCC*)
-	    # NonStop-UX NCC 3.20
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      vxworks*)
-	;;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-	;;
-    esac
-  fi
-],
-[
-  if test "$GCC" = yes; then
-    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-
-    case $host_os in
-      aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-        ;;
-      m68k)
-            # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
-            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
-        ;;
-      esac
-      ;;
-
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      m4_if([$1], [GCJ], [],
-	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
-      ;;
-
-    hpux*)
-      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
-      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
-      # sets the default TLS model and affects inlining.
-      case $host_cpu in
-      hppa*64*)
-	# +Z the default
-	;;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	;;
-      esac
-      ;;
-
-    interix[[3-9]]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
-
-    msdosdjgpp*)
-      # Just because we use GCC doesn't mean we suddenly get shared libraries
-      # on systems that don't support them.
-      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      enable_shared=no
-      ;;
-
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
-      fi
-      ;;
-
-    *)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-      ;;
-    esac
-  else
-    # PORTME Check for flag to pass linker flags through the system compiler.
-    case $host_os in
-    aix*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      else
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
-      fi
-      ;;
-
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      m4_if([$1], [GCJ], [],
-	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-
-    hpux9* | hpux10* | hpux11*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	;;
-      esac
-      # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-      ;;
-
-    irix5* | irix6* | nonstopux*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # PIC (with -KPIC) is the default.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    linux* | k*bsd*-gnu)
-      case $cc_basename in
-      # old Intel for x86_64 which still supported -KPIC.
-      ecc*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-        ;;
-      # icc used to be incompatible with GCC.
-      # ICC 10 doesn't accept -KPIC any more.
-      icc* | ifort*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-        ;;
-      # Lahey Fortran 8.1.
-      lf95*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
-	;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
-        # Portland Group compilers (*not* the Pentium gcc compiler,
-	# which looks to be a dead project)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-        ;;
-      ccc*)
-        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-        # All Alpha code is PIC.
-        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-        ;;
-      xl*)
-	# IBM XL C 8.0/Fortran 10.1 on PPC
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
-	;;
-      *)
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
-	  ;;
-	esac
-	;;
-      esac
-      ;;
-
-    newsos6)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-      ;;
-
-    osf3* | osf4* | osf5*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # All OSF/1 code is PIC.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    rdos*)
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    solaris*)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      case $cc_basename in
-      f77* | f90* | f95*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
-      esac
-      ;;
-
-    sunos4*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    sysv4 | sysv4.2uw2* | sysv4.3*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec ;then
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    unicos*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      ;;
-
-    uts4*)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    *)
-      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      ;;
-    esac
-  fi
-])
-case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
-  *djgpp*)
-    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
-    ;;
-  *)
-    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
-    ;;
-esac
-AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
-_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
-	[How to pass a linker flag through the compiler])
-
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
-  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
-    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
-    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
-    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
-     "" | " "*) ;;
-     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
-     esac],
-    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
-     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
-fi
-_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
-	[Additional compiler flags for building library objects])
-
-#
-# Check to make sure the static flag actually works.
-#
-wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
-_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
-  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
-  $lt_tmp_static_flag,
-  [],
-  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
-_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
-	[Compiler flag to prevent dynamic linking])
-])# _LT_COMPILER_PIC
-
-
-# _LT_LINKER_SHLIBS([TAGNAME])
-# ----------------------------
-# See if the linker supports building shared libraries.
-m4_defun([_LT_LINKER_SHLIBS],
-[AC_REQUIRE([LT_PATH_LD])dnl
-AC_REQUIRE([LT_PATH_NM])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
-m4_require([_LT_TAG_COMPILER])dnl
-AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
-m4_if([$1], [CXX], [
-  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  case $host_os in
-  aix[[4-9]]*)
-    # If we're using GNU nm, then we don't want the "-C" option.
-    # -C means demangle to AIX nm, but means don't demangle with GNU nm
-    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-    else
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-    fi
-    ;;
-  pw32*)
-    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
-  ;;
-  cygwin* | mingw* | cegcc*)
-    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
-  ;;
-  *)
-    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  ;;
-  esac
-  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-], [
-  runpath_var=
-  _LT_TAGVAR(allow_undefined_flag, $1)=
-  _LT_TAGVAR(always_export_symbols, $1)=no
-  _LT_TAGVAR(archive_cmds, $1)=
-  _LT_TAGVAR(archive_expsym_cmds, $1)=
-  _LT_TAGVAR(compiler_needs_object, $1)=no
-  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
-  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  _LT_TAGVAR(hardcode_automatic, $1)=no
-  _LT_TAGVAR(hardcode_direct, $1)=no
-  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
-  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
-  _LT_TAGVAR(hardcode_libdir_separator, $1)=
-  _LT_TAGVAR(hardcode_minus_L, $1)=no
-  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  _LT_TAGVAR(inherit_rpath, $1)=no
-  _LT_TAGVAR(link_all_deplibs, $1)=unknown
-  _LT_TAGVAR(module_cmds, $1)=
-  _LT_TAGVAR(module_expsym_cmds, $1)=
-  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
-  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
-  _LT_TAGVAR(thread_safe_flag_spec, $1)=
-  _LT_TAGVAR(whole_archive_flag_spec, $1)=
-  # include_expsyms should be a list of space-separated symbols to be *always*
-  # included in the symbol list
-  _LT_TAGVAR(include_expsyms, $1)=
-  # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
-  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
-  # platforms (ab)use it in PIC code, but their linkers get confused if
-  # the symbol is explicitly referenced.  Since portable code cannot
-  # rely on this symbol name, it's probably fine to never include it in
-  # preloaded symbol tables.
-  # Exclude shared library initialization/finalization symbols.
-dnl Note also adjust exclude_expsyms for C++ above.
-  extract_expsyms_cmds=
-
-  case $host_os in
-  cygwin* | mingw* | pw32* | cegcc*)
-    # FIXME: the MSVC++ port hasn't been tested in a loooong time
-    # When not using gcc, we currently assume that we are using
-    # Microsoft Visual C++.
-    if test "$GCC" != yes; then
-      with_gnu_ld=no
-    fi
-    ;;
-  interix*)
-    # we just hope/assume this is gcc and not c89 (= MSVC++)
-    with_gnu_ld=yes
-    ;;
-  openbsd*)
-    with_gnu_ld=no
-    ;;
-  esac
-
-  _LT_TAGVAR(ld_shlibs, $1)=yes
-  if test "$with_gnu_ld" = yes; then
-    # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
-
-    # Set some defaults for GNU ld with shared library support. These
-    # are reset later if shared libraries are not supported. Putting them
-    # here allows them to be overridden if necessary.
-    runpath_var=LD_RUN_PATH
-    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-    # ancient GNU ld didn't support --whole-archive et. al.
-    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
-      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-    else
-      _LT_TAGVAR(whole_archive_flag_spec, $1)=
-    fi
-    supports_anon_versioning=no
-    case `$LD -v 2>&1` in
-      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
-      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
-      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
-      *\ 2.11.*) ;; # other 2.11 versions
-      *) supports_anon_versioning=yes ;;
-    esac
-
-    # See if GNU ld supports shared libraries.
-    case $host_os in
-    aix[[3-9]]*)
-      # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	cat <<_LT_EOF 1>&2
-
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
-
-_LT_EOF
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            _LT_TAGVAR(archive_expsym_cmds, $1)=''
-        ;;
-      m68k)
-            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-            _LT_TAGVAR(hardcode_minus_L, $1)=yes
-        ;;
-      esac
-      ;;
-
-    beos*)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	# support --undefined.  This deserves some investigation.  FIXME
-	_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    cygwin* | mingw* | pw32* | cegcc*)
-      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-      # as there is no search path for DLLs.
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(always_export_symbols, $1)=no
-      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
-
-      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	# If the export-symbols file already is a .def file (1st line
-	# is EXPORTS), use it as is; otherwise, prepend...
-	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	  cp $export_symbols $output_objdir/$soname.def;
-	else
-	  echo EXPORTS > $output_objdir/$soname.def;
-	  cat $export_symbols >> $output_objdir/$soname.def;
-	fi~
-	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    interix[[3-9]]*)
-      _LT_TAGVAR(hardcode_direct, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-      # Instead, shared libraries are loaded at an image base (0x10000000 by
-      # default) and relocated if they conflict, which is a slow very memory
-      # consuming and fragmenting process.  To avoid this, we pick a random,
-      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      ;;
-
-    gnu* | linux* | tpf* | k*bsd*-gnu)
-      tmp_diet=no
-      if test "$host_os" = linux-dietlibc; then
-	case $cc_basename in
-	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
-	esac
-      fi
-      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
-	 && test "$tmp_diet" = no
-      then
-	tmp_addflag=
-	tmp_sharedflag='-shared'
-	case $cc_basename,$host_cpu in
-        pgcc*)				# Portland Group C compiler
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag'
-	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag -Mnomain' ;;
-	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
-	  tmp_addflag=' -i_dynamic' ;;
-	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
-	  tmp_addflag=' -i_dynamic -nofor_main' ;;
-	ifc* | ifort*)			# Intel Fortran compiler
-	  tmp_addflag=' -nofor_main' ;;
-	lf95*)				# Lahey Fortran 8.1
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
-	  tmp_sharedflag='--shared' ;;
-	xl[[cC]]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
-	  tmp_sharedflag='-qmkshrobj'
-	  tmp_addflag= ;;
-	esac
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)			# Sun C 5.9
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
-	  _LT_TAGVAR(compiler_needs_object, $1)=yes
-	  tmp_sharedflag='-G' ;;
-	*Sun\ F*)			# Sun Fortran 8.3
-	  tmp_sharedflag='-G' ;;
-	esac
-	_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-
-        if test "x$supports_anon_versioning" = xyes; then
-          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	    echo "local: *; };" >> $output_objdir/$libname.ver~
-	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-        fi
-
-	case $cc_basename in
-	xlf*)
-	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-	  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
-	  if test "x$supports_anon_versioning" = xyes; then
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
-	  fi
-	  ;;
-	esac
-      else
-        _LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    netbsd*)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
-	wlarc=
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      fi
-      ;;
-
-    solaris*)
-      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	cat <<_LT_EOF 1>&2
-
-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
-*** create shared libraries on Solaris systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.9.1 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
-      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
-      case `$LD -v 2>&1` in
-        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	cat <<_LT_EOF 1>&2
-
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
-	;;
-	*)
-	  # For security reasons, it is highly recommended that you always
-	  # use absolute paths for naming shared libraries, and exclude the
-	  # DT_RUNPATH tag from executables and libraries.  But doing so
-	  # requires that you compile everything twice, which is a pain.
-	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-	  else
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	  fi
-	;;
-      esac
-      ;;
-
-    sunos4*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      wlarc=
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-    esac
-
-    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
-      runpath_var=
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
-      _LT_TAGVAR(whole_archive_flag_spec, $1)=
-    fi
-  else
-    # PORTME fill in a description of your system's linker (not GNU ld)
-    case $host_os in
-    aix3*)
-      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(always_export_symbols, $1)=yes
-      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
-      # Note: this linker hardcodes the directories in LIBPATH if there
-      # are no directories specified by -L.
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
-	# Neither direct hardcoding nor static linking is supported with a
-	# broken collect2.
-	_LT_TAGVAR(hardcode_direct, $1)=unsupported
-      fi
-      ;;
-
-    aix[[4-9]]*)
-      if test "$host_cpu" = ia64; then
-	# On IA64, the linker does run time linking by default, so we don't
-	# have to do anything special.
-	aix_use_runtimelinking=no
-	exp_sym_flag='-Bexport'
-	no_entry_flag=""
-      else
-	# If we're using GNU nm, then we don't want the "-C" option.
-	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-	else
-	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-	fi
-	aix_use_runtimelinking=no
-
-	# Test if we are trying to use run time linking or normal
-	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
-	# need to do runtime linking.
-	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
-	  for ld_flag in $LDFLAGS; do
-	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
-	    aix_use_runtimelinking=yes
-	    break
-	  fi
-	  done
-	  ;;
-	esac
-
-	exp_sym_flag='-bexport'
-	no_entry_flag='-bnoentry'
-      fi
-
-      # When large executables or shared objects are built, AIX ld can
-      # have problems creating the table of contents.  If linking a library
-      # or program results in "error TOC overflow" add -mminimal-toc to
-      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
-
-      _LT_TAGVAR(archive_cmds, $1)=''
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
-
-      if test "$GCC" = yes; then
-	case $host_os in aix4.[[012]]|aix4.[[012]].*)
-	# We only want to do this on AIX 4.2 and lower, the check
-	# below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
-	  if test -f "$collect2name" &&
-	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
-	  then
-	  # We have reworked collect2
-	  :
-	  else
-	  # We have old collect2
-	  _LT_TAGVAR(hardcode_direct, $1)=unsupported
-	  # It fails to find uninstalled libraries when the uninstalled
-	  # path is not listed in the libpath.  Setting hardcode_minus_L
-	  # to unsupported forces relinking
-	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	  _LT_TAGVAR(hardcode_libdir_separator, $1)=
-	  fi
-	  ;;
-	esac
-	shared_flag='-shared'
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag="$shared_flag "'${wl}-G'
-	fi
-      else
-	# not using gcc
-	if test "$host_cpu" = ia64; then
-	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-	# chokes on -Wl,-G. The following line is correct:
-	  shared_flag='-G'
-	else
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag='${wl}-G'
-	  else
-	    shared_flag='${wl}-bM:SRE'
-	  fi
-	fi
-      fi
-
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
-      # It seems that -bexpall does not export symbols beginning with
-      # underscore (_), so it is better to generate a list of symbols to export.
-      _LT_TAGVAR(always_export_symbols, $1)=yes
-      if test "$aix_use_runtimelinking" = yes; then
-	# Warning - without using the other runtime loading flags (-brtl),
-	# -berok will link without error, but may produce a broken library.
-	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
-        # Determine the default libpath from the value encoded in an
-        # empty executable.
-        _LT_SYS_MODULE_PATH_AIX
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-      else
-	if test "$host_cpu" = ia64; then
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
-	  _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-	else
-	 # Determine the default libpath from the value encoded in an
-	 # empty executable.
-	 _LT_SYS_MODULE_PATH_AIX
-	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-	  # Warning - without using the other run time loading flags,
-	  # -berok will link without error, but may produce a broken library.
-	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-	  # This is similar to how AIX traditionally builds its shared libraries.
-	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-	fi
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            _LT_TAGVAR(archive_expsym_cmds, $1)=''
-        ;;
-      m68k)
-            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-            _LT_TAGVAR(hardcode_minus_L, $1)=yes
-        ;;
-      esac
-      ;;
-
-    bsdi[[45]]*)
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
-      ;;
-
-    cygwin* | mingw* | pw32* | cegcc*)
-      # When not using gcc, we currently assume that we are using
-      # Microsoft Visual C++.
-      # hardcode_libdir_flag_spec is actually meaningless, as there is
-      # no search path for DLLs.
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-      # FIXME: Should let the user specify the lib program.
-      _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
-      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-      ;;
-
-    darwin* | rhapsody*)
-      _LT_DARWIN_LINKER_FEATURES($1)
-      ;;
-
-    dgux*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    freebsd1*)
-      _LT_TAGVAR(ld_shlibs, $1)=no
-      ;;
-
-    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
-    # support.  Future versions do this automatically, but an explicit c++rt0.o
-    # does not break anything, and helps significantly (at the cost of a little
-    # extra space).
-    freebsd2.2*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    hpux9*)
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-
-      # hardcode_minus_L: Not really in the search PATH,
-      # but as the default location of the library.
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-      ;;
-
-    hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      if test "$with_gnu_ld" = no; then
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
-	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
-	_LT_TAGVAR(hardcode_direct, $1)=yes
-	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	# hardcode_minus_L: Not really in the search PATH,
-	# but as the default location of the library.
-	_LT_TAGVAR(hardcode_minus_L, $1)=yes
-      fi
-      ;;
-
-    hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	case $host_cpu in
-	hppa*64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      else
-	case $host_cpu in
-	hppa*64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      fi
-      if test "$with_gnu_ld" = no; then
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	case $host_cpu in
-	hppa*64*|ia64*)
-	  _LT_TAGVAR(hardcode_direct, $1)=no
-	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	  ;;
-	*)
-	  _LT_TAGVAR(hardcode_direct, $1)=yes
-	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-
-	  # hardcode_minus_L: Not really in the search PATH,
-	  # but as the default location of the library.
-	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
-	  ;;
-	esac
-      fi
-      ;;
-
-    irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	# Try to use the -exported_symbol ld option, if it does not
-	# work, assume that -exports_file does not work either and
-	# implicitly export all symbols.
-        save_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-        AC_LINK_IFELSE(int foo(void) {},
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-        )
-        LDFLAGS="$save_LDFLAGS"
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
-      fi
-      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_TAGVAR(inherit_rpath, $1)=yes
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
-    netbsd*)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
-      fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    newsos6)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *nto* | *qnx*)
-      ;;
-
-    openbsd*)
-      if test -f /usr/libexec/ld.so; then
-	_LT_TAGVAR(hardcode_direct, $1)=yes
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	else
-	  case $host_os in
-	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
-	     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	     ;;
-	   *)
-	     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	     ;;
-	  esac
-	fi
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    os2*)
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
-      ;;
-
-    osf3*)
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-      fi
-      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      ;;
-
-    osf4* | osf5*)	# as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      else
-	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
-
-	# Both c and cxx compiler support -rpath directly
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-      fi
-      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      ;;
-
-    solaris*)
-      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
-      if test "$GCC" = yes; then
-	wlarc='${wl}'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-      else
-	case `$CC -V 2>&1` in
-	*"Compilers 5.0"*)
-	  wlarc=''
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
-	  ;;
-	*)
-	  wlarc='${wl}'
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-	  ;;
-	esac
-      fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      case $host_os in
-      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-      *)
-	# The compiler driver will combine and reorder linker options,
-	# but understands `-z linker_flag'.  GCC discards it without `$wl',
-	# but is careful enough not to reorder.
-	# Supported since Solaris 2.6 (maybe 2.5.1?)
-	if test "$GCC" = yes; then
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	else
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
-	fi
-	;;
-      esac
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
-    sunos4*)
-      if test "x$host_vendor" = xsequent; then
-	# Use $CC to link under sequent, because it throws in some extra .o
-	# files that make .init and .fini sections work.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    sysv4)
-      case $host_vendor in
-	sni)
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
-	;;
-	siemens)
-	  ## LD is ld it makes a PLAMLIB
-	  ## CC just makes a GrossModule.
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
-	  _LT_TAGVAR(hardcode_direct, $1)=no
-        ;;
-	motorola)
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
-	;;
-      esac
-      runpath_var='LD_RUN_PATH'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    sysv4.3*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	runpath_var=LD_RUN_PATH
-	hardcode_runpath_var=yes
-	_LT_TAGVAR(ld_shlibs, $1)=yes
-      fi
-      ;;
-
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      runpath_var='LD_RUN_PATH'
-
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
-
-    sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
-      # link with -lc, and that would cause any symbols used from libc to
-      # always be unresolved, which means just about no library would
-      # ever link correctly.  If we're not using GNU ld we use -z text
-      # though, which does catch some bad symbols but isn't as heavy-handed
-      # as -z defs.
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
-      runpath_var='LD_RUN_PATH'
-
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
-
-    uts4*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *)
-      _LT_TAGVAR(ld_shlibs, $1)=no
-      ;;
-    esac
-
-    if test x$host_vendor = xsni; then
-      case $host in
-      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
-	;;
-      esac
-    fi
-  fi
-])
-AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
-test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
-_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
-
-_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
-_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
-_LT_DECL([], [extract_expsyms_cmds], [2],
-    [The commands to extract the exported symbol list from a shared archive])
-
-#
-# Do we need to explicitly link libc?
-#
-case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
-x|xyes)
-  # Assume -lc should be added
-  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
-    case $_LT_TAGVAR(archive_cmds, $1) in
-    *'~'*)
-      # FIXME: we may have to deal with multi-command sequences.
-      ;;
-    '$CC '*)
-      # Test whether the compiler implicitly links with -lc since on some
-      # systems, -lgcc has to come before -lc. If gcc already passes -lc
-      # to ld, don't add -lc before -lgcc.
-      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
-      $RM conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
-	pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
-        _LT_TAGVAR(allow_undefined_flag, $1)=
-        if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
-        then
-	  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-        else
-	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-        fi
-        _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $RM conftest*
-      AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])
-      ;;
-    esac
-  fi
-  ;;
-esac
-
-_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
-    [Whether or not to add -lc for building shared libraries])
-_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
-    [enable_shared_with_static_runtimes], [0],
-    [Whether or not to disallow shared libs when runtime libs are static])
-_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
-    [Compiler flag to allow reflexive dlopens])
-_LT_TAGDECL([], [whole_archive_flag_spec], [1],
-    [Compiler flag to generate shared objects directly from archives])
-_LT_TAGDECL([], [compiler_needs_object], [1],
-    [Whether the compiler copes with passing no objects directly])
-_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
-    [Create an old-style archive from a shared archive])
-_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
-    [Create a temporary old-style archive to link instead of a shared archive])
-_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
-_LT_TAGDECL([], [archive_expsym_cmds], [2])
-_LT_TAGDECL([], [module_cmds], [2],
-    [Commands used to build a loadable module if different from building
-    a shared archive.])
-_LT_TAGDECL([], [module_expsym_cmds], [2])
-_LT_TAGDECL([], [with_gnu_ld], [1],
-    [Whether we are building with GNU ld or not])
-_LT_TAGDECL([], [allow_undefined_flag], [1],
-    [Flag that allows shared libraries with undefined symbols to be built])
-_LT_TAGDECL([], [no_undefined_flag], [1],
-    [Flag that enforces no undefined symbols])
-_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
-    [Flag to hardcode $libdir into a binary during linking.
-    This must work even if $libdir does not exist])
-_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
-    [[If ld is used when linking, flag to hardcode $libdir into a binary
-    during linking.  This must work even if $libdir does not exist]])
-_LT_TAGDECL([], [hardcode_libdir_separator], [1],
-    [Whether we need a single "-rpath" flag with a separated argument])
-_LT_TAGDECL([], [hardcode_direct], [0],
-    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
-    DIR into the resulting binary])
-_LT_TAGDECL([], [hardcode_direct_absolute], [0],
-    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
-    DIR into the resulting binary and the resulting library dependency is
-    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
-    library is relocated])
-_LT_TAGDECL([], [hardcode_minus_L], [0],
-    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
-    into the resulting binary])
-_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
-    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
-    into the resulting binary])
-_LT_TAGDECL([], [hardcode_automatic], [0],
-    [Set to "yes" if building a shared library automatically hardcodes DIR
-    into the library and all subsequent libraries and executables linked
-    against it])
-_LT_TAGDECL([], [inherit_rpath], [0],
-    [Set to yes if linker adds runtime paths of dependent libraries
-    to runtime path list])
-_LT_TAGDECL([], [link_all_deplibs], [0],
-    [Whether libtool must link a program against all its dependency libraries])
-_LT_TAGDECL([], [fix_srcfile_path], [1],
-    [Fix the shell variable $srcfile for the compiler])
-_LT_TAGDECL([], [always_export_symbols], [0],
-    [Set to "yes" if exported symbols are required])
-_LT_TAGDECL([], [export_symbols_cmds], [2],
-    [The commands to list exported symbols])
-_LT_TAGDECL([], [exclude_expsyms], [1],
-    [Symbols that should not be listed in the preloaded symbols])
-_LT_TAGDECL([], [include_expsyms], [1],
-    [Symbols that must always be exported])
-_LT_TAGDECL([], [prelink_cmds], [2],
-    [Commands necessary for linking programs (against libraries) with templates])
-_LT_TAGDECL([], [file_list_spec], [1],
-    [Specify filename containing input files])
-dnl FIXME: Not yet implemented
-dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
-dnl    [Compiler flag to generate thread safe objects])
-])# _LT_LINKER_SHLIBS
-
-
-# _LT_LANG_C_CONFIG([TAG])
-# ------------------------
-# Ensure that the configuration variables for a C compiler are suitably
-# defined.  These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_C_CONFIG],
-[m4_require([_LT_DECL_EGREP])dnl
-lt_save_CC="$CC"
-AC_LANG_PUSH(C)
-
-# Source file extension for C test sources.
-ac_ext=c
-
-# Object file extension for compiled C test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}'
-
-_LT_TAG_COMPILER
-# Save the default compiler, since it gets overwritten when the other
-# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
-compiler_DEFAULT=$CC
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-## CAVEAT EMPTOR:
-## There is no encapsulation within the following macros, do not change
-## the running order or otherwise move them around unless you know exactly
-## what you are doing...
-if test -n "$compiler"; then
-  _LT_COMPILER_NO_RTTI($1)
-  _LT_COMPILER_PIC($1)
-  _LT_COMPILER_C_O($1)
-  _LT_COMPILER_FILE_LOCKS($1)
-  _LT_LINKER_SHLIBS($1)
-  _LT_SYS_DYNAMIC_LINKER($1)
-  _LT_LINKER_HARDCODE_LIBPATH($1)
-  LT_SYS_DLOPEN_SELF
-  _LT_CMD_STRIPLIB
-
-  # Report which library types will actually be built
-  AC_MSG_CHECKING([if libtool supports shared libraries])
-  AC_MSG_RESULT([$can_build_shared])
-
-  AC_MSG_CHECKING([whether to build shared libraries])
-  test "$can_build_shared" = "no" && enable_shared=no
-
-  # On AIX, shared libraries and static libraries use the same namespace, and
-  # are all built from PIC.
-  case $host_os in
-  aix3*)
-    test "$enable_shared" = yes && enable_static=no
-    if test -n "$RANLIB"; then
-      archive_cmds="$archive_cmds~\$RANLIB \$lib"
-      postinstall_cmds='$RANLIB $lib'
-    fi
-    ;;
-
-  aix[[4-9]]*)
-    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-      test "$enable_shared" = yes && enable_static=no
-    fi
-    ;;
-  esac
-  AC_MSG_RESULT([$enable_shared])
-
-  AC_MSG_CHECKING([whether to build static libraries])
-  # Make sure either enable_shared or enable_static is yes.
-  test "$enable_shared" = yes || enable_static=yes
-  AC_MSG_RESULT([$enable_static])
-
-  _LT_CONFIG($1)
-fi
-AC_LANG_POP
-CC="$lt_save_CC"
-])# _LT_LANG_C_CONFIG
-
-
-# _LT_PROG_CXX
-# ------------
-# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++
-# compiler, we have our own version here.
-m4_defun([_LT_PROG_CXX],
-[
-pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])
-AC_PROG_CXX
-if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
-    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
-    (test "X$CXX" != "Xg++"))) ; then
-  AC_PROG_CXXCPP
-else
-  _lt_caught_CXX_error=yes
-fi
-popdef([AC_MSG_ERROR])
-])# _LT_PROG_CXX
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([_LT_PROG_CXX], [])
-
-
-# _LT_LANG_CXX_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for a C++ compiler are suitably
-# defined.  These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_CXX_CONFIG],
-[AC_REQUIRE([_LT_PROG_CXX])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_EGREP])dnl
-
-AC_LANG_PUSH(C++)
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_TAGVAR(allow_undefined_flag, $1)=
-_LT_TAGVAR(always_export_symbols, $1)=no
-_LT_TAGVAR(archive_expsym_cmds, $1)=
-_LT_TAGVAR(compiler_needs_object, $1)=no
-_LT_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_TAGVAR(hardcode_direct, $1)=no
-_LT_TAGVAR(hardcode_direct_absolute, $1)=no
-_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
-_LT_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_TAGVAR(hardcode_minus_L, $1)=no
-_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-_LT_TAGVAR(hardcode_automatic, $1)=no
-_LT_TAGVAR(inherit_rpath, $1)=no
-_LT_TAGVAR(module_cmds, $1)=
-_LT_TAGVAR(module_expsym_cmds, $1)=
-_LT_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(no_undefined_flag, $1)=
-_LT_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for C++ test sources.
-ac_ext=cpp
-
-# Object file extension for compiled C++ test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# No sense in running all these tests if we already determined that
-# the CXX compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_caught_CXX_error" != yes; then
-  # Code to be used in simple compile tests
-  lt_simple_compile_test_code="int some_variable = 0;"
-
-  # Code to be used in simple link tests
-  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
-
-  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
-  _LT_TAG_COMPILER
-
-  # save warnings/boilerplate of simple test code
-  _LT_COMPILER_BOILERPLATE
-  _LT_LINKER_BOILERPLATE
-
-  # Allow CC to be a program name with arguments.
-  lt_save_CC=$CC
-  lt_save_LD=$LD
-  lt_save_GCC=$GCC
-  GCC=$GXX
-  lt_save_with_gnu_ld=$with_gnu_ld
-  lt_save_path_LD=$lt_cv_path_LD
-  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
-    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
-  else
-    $as_unset lt_cv_prog_gnu_ld
-  fi
-  if test -n "${lt_cv_path_LDCXX+set}"; then
-    lt_cv_path_LD=$lt_cv_path_LDCXX
-  else
-    $as_unset lt_cv_path_LD
-  fi
-  test -z "${LDCXX+set}" || LD=$LDCXX
-  CC=${CXX-"c++"}
-  compiler=$CC
-  _LT_TAGVAR(compiler, $1)=$CC
-  _LT_CC_BASENAME([$compiler])
-
-  if test -n "$compiler"; then
-    # We don't want -fno-exception when compiling C++ code, so set the
-    # no_builtin_flag separately
-    if test "$GXX" = yes; then
-      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
-    else
-      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
-    fi
-
-    if test "$GXX" = yes; then
-      # Set up default GNU C++ configuration
-
-      LT_PATH_LD
-
-      # Check if GNU C++ uses GNU ld as the underlying linker, since the
-      # archiving commands below assume that GNU ld is being used.
-      if test "$with_gnu_ld" = yes; then
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-
-        # If archive_cmds runs LD, not CC, wlarc should be empty
-        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
-        #     investigate it a little bit more. (MM)
-        wlarc='${wl}'
-
-        # ancient GNU ld didn't support --whole-archive et. al.
-        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
-	  $GREP 'no-whole-archive' > /dev/null; then
-          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-        else
-          _LT_TAGVAR(whole_archive_flag_spec, $1)=
-        fi
-      else
-        with_gnu_ld=no
-        wlarc=
-
-        # A generic and very simple default shared library creation
-        # command for GNU C++ for the case where it uses the native
-        # linker, instead of GNU ld.  If possible, this setting should
-        # overridden to take advantage of the native linker features on
-        # the platform it is being used on.
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-      fi
-
-      # Commands to make compiler produce verbose output that lists
-      # what "hidden" libraries, object files and flags are used when
-      # linking a shared library.
-      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
-
-    else
-      GXX=no
-      with_gnu_ld=no
-      wlarc=
-    fi
-
-    # PORTME: fill in a description of your system's C++ link characteristics
-    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
-    _LT_TAGVAR(ld_shlibs, $1)=yes
-    case $host_os in
-      aix3*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-      aix[[4-9]]*)
-        if test "$host_cpu" = ia64; then
-          # On IA64, the linker does run time linking by default, so we don't
-          # have to do anything special.
-          aix_use_runtimelinking=no
-          exp_sym_flag='-Bexport'
-          no_entry_flag=""
-        else
-          aix_use_runtimelinking=no
-
-          # Test if we are trying to use run time linking or normal
-          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
-          # need to do runtime linking.
-          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
-	    for ld_flag in $LDFLAGS; do
-	      case $ld_flag in
-	      *-brtl*)
-	        aix_use_runtimelinking=yes
-	        break
-	        ;;
-	      esac
-	    done
-	    ;;
-          esac
-
-          exp_sym_flag='-bexport'
-          no_entry_flag='-bnoentry'
-        fi
-
-        # When large executables or shared objects are built, AIX ld can
-        # have problems creating the table of contents.  If linking a library
-        # or program results in "error TOC overflow" add -mminimal-toc to
-        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
-
-        _LT_TAGVAR(archive_cmds, $1)=''
-        _LT_TAGVAR(hardcode_direct, $1)=yes
-        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-        _LT_TAGVAR(link_all_deplibs, $1)=yes
-        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
-
-        if test "$GXX" = yes; then
-          case $host_os in aix4.[[012]]|aix4.[[012]].*)
-          # We only want to do this on AIX 4.2 and lower, the check
-          # below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
-	  if test -f "$collect2name" &&
-	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
-	  then
-	    # We have reworked collect2
-	    :
-	  else
-	    # We have old collect2
-	    _LT_TAGVAR(hardcode_direct, $1)=unsupported
-	    # It fails to find uninstalled libraries when the uninstalled
-	    # path is not listed in the libpath.  Setting hardcode_minus_L
-	    # to unsupported forces relinking
-	    _LT_TAGVAR(hardcode_minus_L, $1)=yes
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	    _LT_TAGVAR(hardcode_libdir_separator, $1)=
-	  fi
-          esac
-          shared_flag='-shared'
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag="$shared_flag "'${wl}-G'
-	  fi
-        else
-          # not using gcc
-          if test "$host_cpu" = ia64; then
-	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-	  # chokes on -Wl,-G. The following line is correct:
-	  shared_flag='-G'
-          else
-	    if test "$aix_use_runtimelinking" = yes; then
-	      shared_flag='${wl}-G'
-	    else
-	      shared_flag='${wl}-bM:SRE'
-	    fi
-          fi
-        fi
-
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
-        # It seems that -bexpall does not export symbols beginning with
-        # underscore (_), so it is better to generate a list of symbols to
-	# export.
-        _LT_TAGVAR(always_export_symbols, $1)=yes
-        if test "$aix_use_runtimelinking" = yes; then
-          # Warning - without using the other runtime loading flags (-brtl),
-          # -berok will link without error, but may produce a broken library.
-          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
-          # Determine the default libpath from the value encoded in an empty
-          # executable.
-          _LT_SYS_MODULE_PATH_AIX
-          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-        else
-          if test "$host_cpu" = ia64; then
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
-	    _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-          else
-	    # Determine the default libpath from the value encoded in an
-	    # empty executable.
-	    _LT_SYS_MODULE_PATH_AIX
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-	    # Warning - without using the other run time loading flags,
-	    # -berok will link without error, but may produce a broken library.
-	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	    # Exported symbols can be pulled into shared objects from archives
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-	    # This is similar to how AIX traditionally builds its shared
-	    # libraries.
-	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-          fi
-        fi
-        ;;
-
-      beos*)
-	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	  # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	  # support --undefined.  This deserves some investigation.  FIXME
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	else
-	  _LT_TAGVAR(ld_shlibs, $1)=no
-	fi
-	;;
-
-      chorus*)
-        case $cc_basename in
-          *)
-	  # FIXME: insert proper C++ library support
-	  _LT_TAGVAR(ld_shlibs, $1)=no
-	  ;;
-        esac
-        ;;
-
-      cygwin* | mingw* | pw32* | cegcc*)
-        # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-        # as there is no search path for DLLs.
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-        _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-        _LT_TAGVAR(always_export_symbols, $1)=no
-        _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-
-        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-          # If the export-symbols file already is a .def file (1st line
-          # is EXPORTS), use it as is; otherwise, prepend...
-          _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	    cp $export_symbols $output_objdir/$soname.def;
-          else
-	    echo EXPORTS > $output_objdir/$soname.def;
-	    cat $export_symbols >> $output_objdir/$soname.def;
-          fi~
-          $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-        else
-          _LT_TAGVAR(ld_shlibs, $1)=no
-        fi
-        ;;
-      darwin* | rhapsody*)
-        _LT_DARWIN_LINKER_FEATURES($1)
-	;;
-
-      dgux*)
-        case $cc_basename in
-          ec++*)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          ghcx*)
-	    # Green Hills C++ Compiler
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-        esac
-        ;;
-
-      freebsd[[12]]*)
-        # C++ shared libraries reported to be fairly broken before
-	# switch to ELF
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-
-      freebsd-elf*)
-        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-        ;;
-
-      freebsd* | dragonfly*)
-        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
-        # conventions
-        _LT_TAGVAR(ld_shlibs, $1)=yes
-        ;;
-
-      gnu*)
-        ;;
-
-      hpux9*)
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-        _LT_TAGVAR(hardcode_direct, $1)=yes
-        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
-				             # but as the default
-				             # location of the library.
-
-        case $cc_basename in
-          CC*)
-            # FIXME: insert proper C++ library support
-            _LT_TAGVAR(ld_shlibs, $1)=no
-            ;;
-          aCC*)
-            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-            # Commands to make compiler produce verbose output that lists
-            # what "hidden" libraries, object files and flags are used when
-            # linking a shared library.
-            #
-            # There doesn't appear to be a way to prevent this compiler from
-            # explicitly linking system object files so we need to strip them
-            # from the output so that they don't get included in the library
-            # dependencies.
-            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
-            ;;
-          *)
-            if test "$GXX" = yes; then
-              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-            else
-              # FIXME: insert proper C++ library support
-              _LT_TAGVAR(ld_shlibs, $1)=no
-            fi
-            ;;
-        esac
-        ;;
-
-      hpux10*|hpux11*)
-        if test $with_gnu_ld = no; then
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	  _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-          case $host_cpu in
-            hppa*64*|ia64*)
-              ;;
-            *)
-	      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-              ;;
-          esac
-        fi
-        case $host_cpu in
-          hppa*64*|ia64*)
-            _LT_TAGVAR(hardcode_direct, $1)=no
-            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-            ;;
-          *)
-            _LT_TAGVAR(hardcode_direct, $1)=yes
-            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
-					         # but as the default
-					         # location of the library.
-            ;;
-        esac
-
-        case $cc_basename in
-          CC*)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          aCC*)
-	    case $host_cpu in
-	      hppa*64*)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	        ;;
-	      ia64*)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	        ;;
-	      *)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	        ;;
-	    esac
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    #
-	    # There doesn't appear to be a way to prevent this compiler from
-	    # explicitly linking system object files so we need to strip them
-	    # from the output so that they don't get included in the library
-	    # dependencies.
-	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
-	    ;;
-          *)
-	    if test "$GXX" = yes; then
-	      if test $with_gnu_ld = no; then
-	        case $host_cpu in
-	          hppa*64*)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	            ;;
-	          ia64*)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	            ;;
-	          *)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	            ;;
-	        esac
-	      fi
-	    else
-	      # FIXME: insert proper C++ library support
-	      _LT_TAGVAR(ld_shlibs, $1)=no
-	    fi
-	    ;;
-        esac
-        ;;
-
-      interix[[3-9]]*)
-	_LT_TAGVAR(hardcode_direct, $1)=no
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-	# Instead, shared libraries are loaded at an image base (0x10000000 by
-	# default) and relocated if they conflict, which is a slow very memory
-	# consuming and fragmenting process.  To avoid this, we pick a random,
-	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-	;;
-      irix5* | irix6*)
-        case $cc_basename in
-          CC*)
-	    # SGI C++
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-
-	    # Archives containing C++ object files must be created using
-	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
-	    # necessary to make sure instantiated templates are included
-	    # in the archive.
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
-	    ;;
-          *)
-	    if test "$GXX" = yes; then
-	      if test "$with_gnu_ld" = no; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	      else
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
-	      fi
-	    fi
-	    _LT_TAGVAR(link_all_deplibs, $1)=yes
-	    ;;
-        esac
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-        _LT_TAGVAR(inherit_rpath, $1)=yes
-        ;;
-
-      linux* | k*bsd*-gnu)
-        case $cc_basename in
-          KCC*)
-	    # Kuck and Associates, Inc. (KAI) C++ Compiler
-
-	    # KCC will only create a shared library if the output file
-	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
-	    # to its proper name (with version) after linking.
-	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    #
-	    # There doesn't appear to be a way to prevent this compiler from
-	    # explicitly linking system object files so we need to strip them
-	    # from the output so that they don't get included in the library
-	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
-
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-
-	    # Archives containing C++ object files must be created using
-	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
-	    ;;
-	  icpc* | ecpc* )
-	    # Intel C++
-	    with_gnu_ld=yes
-	    # version 8.0 and above of icpc choke on multiply defined symbols
-	    # if we add $predep_objects and $postdep_objects, however 7.1 and
-	    # earlier do not add the objects themselves.
-	    case `$CC -V 2>&1` in
-	      *"Version 7."*)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-		;;
-	      *)  # Version 8.0 or newer
-	        tmp_idyn=
-	        case $host_cpu in
-		  ia64*) tmp_idyn=' -i_dynamic';;
-		esac
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-		;;
-	    esac
-	    _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	    ;;
-          pgCC* | pgcpp*)
-            # Portland Group C++ compiler
-	    case `$CC -V` in
-	    *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*)
-	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
-		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
-	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
-		$RANLIB $oldlib'
-	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
-	      ;;
-	    *) # Version 6 will use weak symbols
-	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
-	      ;;
-	    esac
-
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
-            ;;
-	  cxx*)
-	    # Compaq C++
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
-
-	    runpath_var=LD_RUN_PATH
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    #
-	    # There doesn't appear to be a way to prevent this compiler from
-	    # explicitly linking system object files so we need to strip them
-	    # from the output so that they don't get included in the library
-	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
-	    ;;
-	  xl*)
-	    # IBM XL 8.0 on PPC, with GNU ld
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    if test "x$supports_anon_versioning" = xyes; then
-	      _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-		echo "local: *; };" >> $output_objdir/$libname.ver~
-		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-	    fi
-	    ;;
-	  *)
-	    case `$CC -V 2>&1 | sed 5q` in
-	    *Sun\ C*)
-	      # Sun C++ 5.9
-	      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
-	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
-	      _LT_TAGVAR(compiler_needs_object, $1)=yes
-
-	      # Not sure whether something based on
-	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
-	      # would be better.
-	      output_verbose_link_cmd='echo'
-
-	      # Archives containing C++ object files must be created using
-	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
-	      # necessary to make sure instantiated templates are included
-	      # in the archive.
-	      _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
-	      ;;
-	    esac
-	    ;;
-	esac
-	;;
-
-      lynxos*)
-        # FIXME: insert proper C++ library support
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	;;
-
-      m88k*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-	;;
-
-      mvs*)
-        case $cc_basename in
-          cxx*)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-	  *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-	esac
-	;;
-
-      netbsd*)
-        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
-	  wlarc=
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	  _LT_TAGVAR(hardcode_direct, $1)=yes
-	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	fi
-	# Workaround some broken pre-1.5 toolchains
-	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
-	;;
-
-      *nto* | *qnx*)
-        _LT_TAGVAR(ld_shlibs, $1)=yes
-	;;
-
-      openbsd2*)
-        # C++ shared libraries are fairly broken
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	;;
-
-      openbsd*)
-	if test -f /usr/libexec/ld.so; then
-	  _LT_TAGVAR(hardcode_direct, $1)=yes
-	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-	  fi
-	  output_verbose_link_cmd=echo
-	else
-	  _LT_TAGVAR(ld_shlibs, $1)=no
-	fi
-	;;
-
-      osf3* | osf4* | osf5*)
-        case $cc_basename in
-          KCC*)
-	    # Kuck and Associates, Inc. (KAI) C++ Compiler
-
-	    # KCC will only create a shared library if the output file
-	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
-	    # to its proper name (with version) after linking.
-	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	    # Archives containing C++ object files must be created using
-	    # the KAI C++ compiler.
-	    case $host in
-	      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
-	      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
-	    esac
-	    ;;
-          RCC*)
-	    # Rational C++ 2.4.1
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          cxx*)
-	    case $host in
-	      osf3*)
-	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-		;;
-	      *)
-	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
-	          echo "-hidden">> $lib.exp~
-	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
-	          $RM $lib.exp'
-	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-		;;
-	    esac
-
-	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    #
-	    # There doesn't appear to be a way to prevent this compiler from
-	    # explicitly linking system object files so we need to strip them
-	    # from the output so that they don't get included in the library
-	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
-	    ;;
-	  *)
-	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	      case $host in
-	        osf3*)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-		  ;;
-	        *)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-		  ;;
-	      esac
-
-	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	      # Commands to make compiler produce verbose output that lists
-	      # what "hidden" libraries, object files and flags are used when
-	      # linking a shared library.
-	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
-
-	    else
-	      # FIXME: insert proper C++ library support
-	      _LT_TAGVAR(ld_shlibs, $1)=no
-	    fi
-	    ;;
-        esac
-        ;;
-
-      psos*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-
-      sunos4*)
-        case $cc_basename in
-          CC*)
-	    # Sun C++ 4.x
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          lcc*)
-	    # Lucid
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-        esac
-        ;;
-
-      solaris*)
-        case $cc_basename in
-          CC*)
-	    # Sun C++ 4.2, 5.x and Centerline C++
-            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
-	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
-
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	    case $host_os in
-	      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-	      *)
-		# The compiler driver will combine and reorder linker options,
-		# but understands `-z linker_flag'.
-	        # Supported since Solaris 2.6 (maybe 2.5.1?)
-		_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
-	        ;;
-	    esac
-	    _LT_TAGVAR(link_all_deplibs, $1)=yes
-
-	    output_verbose_link_cmd='echo'
-
-	    # Archives containing C++ object files must be created using
-	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
-	    # necessary to make sure instantiated templates are included
-	    # in the archive.
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
-	    ;;
-          gcx*)
-	    # Green Hills C++ Compiler
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-
-	    # The C++ compiler must be used to create the archive.
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
-	    ;;
-          *)
-	    # GNU C++ compiler with Solaris linker
-	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
-	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
-
-	        # Commands to make compiler produce verbose output that lists
-	        # what "hidden" libraries, object files and flags are used when
-	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
-	      else
-	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
-	        # platform.
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
-
-	        # Commands to make compiler produce verbose output that lists
-	        # what "hidden" libraries, object files and flags are used when
-	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
-	      fi
-
-	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
-	      case $host_os in
-		solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-		*)
-		  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-		  ;;
-	      esac
-	    fi
-	    ;;
-        esac
-        ;;
-
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      runpath_var='LD_RUN_PATH'
-
-      case $cc_basename in
-        CC*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-      esac
-      ;;
-
-      sysv5* | sco3.2v5* | sco5v6*)
-	# Note: We can NOT use -z defs as we might desire, because we do not
-	# link with -lc, and that would cause any symbols used from libc to
-	# always be unresolved, which means just about no library would
-	# ever link correctly.  If we're not using GNU ld we use -z text
-	# though, which does catch some bad symbols but isn't as heavy-handed
-	# as -z defs.
-	_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-	_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
-	_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
-	_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-	_LT_TAGVAR(link_all_deplibs, $1)=yes
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
-	runpath_var='LD_RUN_PATH'
-
-	case $cc_basename in
-          CC*)
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    ;;
-	  *)
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    ;;
-	esac
-      ;;
-
-      tandem*)
-        case $cc_basename in
-          NCC*)
-	    # NonStop-UX NCC 3.20
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-        esac
-        ;;
-
-      vxworks*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-
-      *)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-    esac
-
-    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
-    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
-    _LT_TAGVAR(GCC, $1)="$GXX"
-    _LT_TAGVAR(LD, $1)="$LD"
-
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    _LT_SYS_HIDDEN_LIBDEPS($1)
-    _LT_COMPILER_PIC($1)
-    _LT_COMPILER_C_O($1)
-    _LT_COMPILER_FILE_LOCKS($1)
-    _LT_LINKER_SHLIBS($1)
-    _LT_SYS_DYNAMIC_LINKER($1)
-    _LT_LINKER_HARDCODE_LIBPATH($1)
-
-    _LT_CONFIG($1)
-  fi # test -n "$compiler"
-
-  CC=$lt_save_CC
-  LDCXX=$LD
-  LD=$lt_save_LD
-  GCC=$lt_save_GCC
-  with_gnu_ld=$lt_save_with_gnu_ld
-  lt_cv_path_LDCXX=$lt_cv_path_LD
-  lt_cv_path_LD=$lt_save_path_LD
-  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
-  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
-fi # test "$_lt_caught_CXX_error" != yes
-
-AC_LANG_POP
-])# _LT_LANG_CXX_CONFIG
-
-
-# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
-# ---------------------------------
-# Figure out "hidden" library dependencies from verbose
-# compiler output when linking a shared library.
-# Parse the compiler output and extract the necessary
-# objects, libraries and library flags.
-m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-# Dependencies to place before and after the object being linked:
-_LT_TAGVAR(predep_objects, $1)=
-_LT_TAGVAR(postdep_objects, $1)=
-_LT_TAGVAR(predeps, $1)=
-_LT_TAGVAR(postdeps, $1)=
-_LT_TAGVAR(compiler_lib_search_path, $1)=
-
-dnl we can't use the lt_simple_compile_test_code here,
-dnl because it contains code intended for an executable,
-dnl not a library.  It's possible we should let each
-dnl tag define a new lt_????_link_test_code variable,
-dnl but it's only used here...
-m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
-int a;
-void foo (void) { a = 0; }
-_LT_EOF
-], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
-class Foo
-{
-public:
-  Foo (void) { a = 0; }
-private:
-  int a;
-};
-_LT_EOF
-], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
-      subroutine foo
-      implicit none
-      integer*4 a
-      a=0
-      return
-      end
-_LT_EOF
-], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
-      subroutine foo
-      implicit none
-      integer a
-      a=0
-      return
-      end
-_LT_EOF
-], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
-public class foo {
-  private int a;
-  public void bar (void) {
-    a = 0;
-  }
-};
-_LT_EOF
-])
-dnl Parse the compiler output and extract the necessary
-dnl objects, libraries and library flags.
-if AC_TRY_EVAL(ac_compile); then
-  # Parse the compiler output and extract the necessary
-  # objects, libraries and library flags.
-
-  # Sentinel used to keep track of whether or not we are before
-  # the conftest object file.
-  pre_test_object_deps_done=no
-
-  for p in `eval "$output_verbose_link_cmd"`; do
-    case $p in
-
-    -L* | -R* | -l*)
-       # Some compilers place space between "-{L,R}" and the path.
-       # Remove the space.
-       if test $p = "-L" ||
-          test $p = "-R"; then
-	 prev=$p
-	 continue
-       else
-	 prev=
-       fi
-
-       if test "$pre_test_object_deps_done" = no; then
-	 case $p in
-	 -L* | -R*)
-	   # Internal compiler library paths should come after those
-	   # provided the user.  The postdeps already come after the
-	   # user supplied libs so there is no need to process them.
-	   if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
-	     _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
-	   else
-	     _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
-	   fi
-	   ;;
-	 # The "-l" case would never come before the object being
-	 # linked, so don't bother handling this case.
-	 esac
-       else
-	 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
-	   _LT_TAGVAR(postdeps, $1)="${prev}${p}"
-	 else
-	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
-	 fi
-       fi
-       ;;
-
-    *.$objext)
-       # This assumes that the test object file only shows up
-       # once in the compiler output.
-       if test "$p" = "conftest.$objext"; then
-	 pre_test_object_deps_done=yes
-	 continue
-       fi
-
-       if test "$pre_test_object_deps_done" = no; then
-	 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
-	   _LT_TAGVAR(predep_objects, $1)="$p"
-	 else
-	   _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
-	 fi
-       else
-	 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
-	   _LT_TAGVAR(postdep_objects, $1)="$p"
-	 else
-	   _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
-	 fi
-       fi
-       ;;
-
-    *) ;; # Ignore the rest.
-
-    esac
-  done
-
-  # Clean up.
-  rm -f a.out a.exe
-else
-  echo "libtool.m4: error: problem compiling $1 test program"
-fi
-
-$RM -f confest.$objext
-
-# PORTME: override above test on systems where it is broken
-m4_if([$1], [CXX],
-[case $host_os in
-interix[[3-9]]*)
-  # Interix 3.5 installs completely hosed .la files for C++, so rather than
-  # hack all around it, let's just trust "g++" to DTRT.
-  _LT_TAGVAR(predep_objects,$1)=
-  _LT_TAGVAR(postdep_objects,$1)=
-  _LT_TAGVAR(postdeps,$1)=
-  ;;
-
-linux*)
-  case `$CC -V 2>&1 | sed 5q` in
-  *Sun\ C*)
-    # Sun C++ 5.9
-
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-
-solaris*)
-  case $cc_basename in
-  CC*)
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-
-    # Adding this requires a known-good setup of shared libraries for
-    # Sun compiler versions before 5.6, else PIC objects from an old
-    # archive will be linked into the output, leading to subtle bugs.
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-esac
-])
-
-case " $_LT_TAGVAR(postdeps, $1) " in
-*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
-esac
- _LT_TAGVAR(compiler_lib_search_dirs, $1)=
-if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
- _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
-fi
-_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
-    [The directories searched by this compiler when creating a shared library])
-_LT_TAGDECL([], [predep_objects], [1],
-    [Dependencies to place before and after the objects being linked to
-    create a shared library])
-_LT_TAGDECL([], [postdep_objects], [1])
-_LT_TAGDECL([], [predeps], [1])
-_LT_TAGDECL([], [postdeps], [1])
-_LT_TAGDECL([], [compiler_lib_search_path], [1],
-    [The library search path used internally by the compiler when linking
-    a shared library])
-])# _LT_SYS_HIDDEN_LIBDEPS
-
-
-# _LT_PROG_F77
-# ------------
-# Since AC_PROG_F77 is broken, in that it returns the empty string
-# if there is no fortran compiler, we have our own version here.
-m4_defun([_LT_PROG_F77],
-[
-pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes])
-AC_PROG_F77
-if test -z "$F77" || test "X$F77" = "Xno"; then
-  _lt_disable_F77=yes
-fi
-popdef([AC_MSG_ERROR])
-])# _LT_PROG_F77
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([_LT_PROG_F77], [])
-
-
-# _LT_LANG_F77_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for a Fortran 77 compiler are
-# suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_F77_CONFIG],
-[AC_REQUIRE([_LT_PROG_F77])dnl
-AC_LANG_PUSH(Fortran 77)
-
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_TAGVAR(allow_undefined_flag, $1)=
-_LT_TAGVAR(always_export_symbols, $1)=no
-_LT_TAGVAR(archive_expsym_cmds, $1)=
-_LT_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_TAGVAR(hardcode_direct, $1)=no
-_LT_TAGVAR(hardcode_direct_absolute, $1)=no
-_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
-_LT_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_TAGVAR(hardcode_minus_L, $1)=no
-_LT_TAGVAR(hardcode_automatic, $1)=no
-_LT_TAGVAR(inherit_rpath, $1)=no
-_LT_TAGVAR(module_cmds, $1)=
-_LT_TAGVAR(module_expsym_cmds, $1)=
-_LT_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(no_undefined_flag, $1)=
-_LT_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for f77 test sources.
-ac_ext=f
-
-# Object file extension for compiled f77 test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# No sense in running all these tests if we already determined that
-# the F77 compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_disable_F77" != yes; then
-  # Code to be used in simple compile tests
-  lt_simple_compile_test_code="\
-      subroutine t
-      return
-      end
-"
-
-  # Code to be used in simple link tests
-  lt_simple_link_test_code="\
-      program t
-      end
-"
-
-  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
-  _LT_TAG_COMPILER
-
-  # save warnings/boilerplate of simple test code
-  _LT_COMPILER_BOILERPLATE
-  _LT_LINKER_BOILERPLATE
-
-  # Allow CC to be a program name with arguments.
-  lt_save_CC="$CC"
-  lt_save_GCC=$GCC
-  CC=${F77-"f77"}
-  compiler=$CC
-  _LT_TAGVAR(compiler, $1)=$CC
-  _LT_CC_BASENAME([$compiler])
-  GCC=$G77
-  if test -n "$compiler"; then
-    AC_MSG_CHECKING([if libtool supports shared libraries])
-    AC_MSG_RESULT([$can_build_shared])
-
-    AC_MSG_CHECKING([whether to build shared libraries])
-    test "$can_build_shared" = "no" && enable_shared=no
-
-    # On AIX, shared libraries and static libraries use the same namespace, and
-    # are all built from PIC.
-    case $host_os in
-      aix3*)
-        test "$enable_shared" = yes && enable_static=no
-        if test -n "$RANLIB"; then
-          archive_cmds="$archive_cmds~\$RANLIB \$lib"
-          postinstall_cmds='$RANLIB $lib'
-        fi
-        ;;
-      aix[[4-9]]*)
-	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-	  test "$enable_shared" = yes && enable_static=no
-	fi
-        ;;
-    esac
-    AC_MSG_RESULT([$enable_shared])
-
-    AC_MSG_CHECKING([whether to build static libraries])
-    # Make sure either enable_shared or enable_static is yes.
-    test "$enable_shared" = yes || enable_static=yes
-    AC_MSG_RESULT([$enable_static])
-
-    _LT_TAGVAR(GCC, $1)="$G77"
-    _LT_TAGVAR(LD, $1)="$LD"
-
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    _LT_COMPILER_PIC($1)
-    _LT_COMPILER_C_O($1)
-    _LT_COMPILER_FILE_LOCKS($1)
-    _LT_LINKER_SHLIBS($1)
-    _LT_SYS_DYNAMIC_LINKER($1)
-    _LT_LINKER_HARDCODE_LIBPATH($1)
-
-    _LT_CONFIG($1)
-  fi # test -n "$compiler"
-
-  GCC=$lt_save_GCC
-  CC="$lt_save_CC"
-fi # test "$_lt_disable_F77" != yes
-
-AC_LANG_POP
-])# _LT_LANG_F77_CONFIG
-
-
-# _LT_PROG_FC
-# -----------
-# Since AC_PROG_FC is broken, in that it returns the empty string
-# if there is no fortran compiler, we have our own version here.
-m4_defun([_LT_PROG_FC],
-[
-pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes])
-AC_PROG_FC
-if test -z "$FC" || test "X$FC" = "Xno"; then
-  _lt_disable_FC=yes
-fi
-popdef([AC_MSG_ERROR])
-])# _LT_PROG_FC
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([_LT_PROG_FC], [])
-
-
-# _LT_LANG_FC_CONFIG([TAG])
-# -------------------------
-# Ensure that the configuration variables for a Fortran compiler are
-# suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_FC_CONFIG],
-[AC_REQUIRE([_LT_PROG_FC])dnl
-AC_LANG_PUSH(Fortran)
-
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_TAGVAR(allow_undefined_flag, $1)=
-_LT_TAGVAR(always_export_symbols, $1)=no
-_LT_TAGVAR(archive_expsym_cmds, $1)=
-_LT_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_TAGVAR(hardcode_direct, $1)=no
-_LT_TAGVAR(hardcode_direct_absolute, $1)=no
-_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
-_LT_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_TAGVAR(hardcode_minus_L, $1)=no
-_LT_TAGVAR(hardcode_automatic, $1)=no
-_LT_TAGVAR(inherit_rpath, $1)=no
-_LT_TAGVAR(module_cmds, $1)=
-_LT_TAGVAR(module_expsym_cmds, $1)=
-_LT_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(no_undefined_flag, $1)=
-_LT_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for fc test sources.
-ac_ext=${ac_fc_srcext-f}
-
-# Object file extension for compiled fc test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# No sense in running all these tests if we already determined that
-# the FC compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_disable_FC" != yes; then
-  # Code to be used in simple compile tests
-  lt_simple_compile_test_code="\
-      subroutine t
-      return
-      end
-"
-
-  # Code to be used in simple link tests
-  lt_simple_link_test_code="\
-      program t
-      end
-"
-
-  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
-  _LT_TAG_COMPILER
-
-  # save warnings/boilerplate of simple test code
-  _LT_COMPILER_BOILERPLATE
-  _LT_LINKER_BOILERPLATE
-
-  # Allow CC to be a program name with arguments.
-  lt_save_CC="$CC"
-  lt_save_GCC=$GCC
-  CC=${FC-"f95"}
-  compiler=$CC
-  GCC=$ac_cv_fc_compiler_gnu
-
-  _LT_TAGVAR(compiler, $1)=$CC
-  _LT_CC_BASENAME([$compiler])
-
-  if test -n "$compiler"; then
-    AC_MSG_CHECKING([if libtool supports shared libraries])
-    AC_MSG_RESULT([$can_build_shared])
-
-    AC_MSG_CHECKING([whether to build shared libraries])
-    test "$can_build_shared" = "no" && enable_shared=no
-
-    # On AIX, shared libraries and static libraries use the same namespace, and
-    # are all built from PIC.
-    case $host_os in
-      aix3*)
-        test "$enable_shared" = yes && enable_static=no
-        if test -n "$RANLIB"; then
-          archive_cmds="$archive_cmds~\$RANLIB \$lib"
-          postinstall_cmds='$RANLIB $lib'
-        fi
-        ;;
-      aix[[4-9]]*)
-	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-	  test "$enable_shared" = yes && enable_static=no
-	fi
-        ;;
-    esac
-    AC_MSG_RESULT([$enable_shared])
-
-    AC_MSG_CHECKING([whether to build static libraries])
-    # Make sure either enable_shared or enable_static is yes.
-    test "$enable_shared" = yes || enable_static=yes
-    AC_MSG_RESULT([$enable_static])
-
-    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
-    _LT_TAGVAR(LD, $1)="$LD"
-
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    _LT_SYS_HIDDEN_LIBDEPS($1)
-    _LT_COMPILER_PIC($1)
-    _LT_COMPILER_C_O($1)
-    _LT_COMPILER_FILE_LOCKS($1)
-    _LT_LINKER_SHLIBS($1)
-    _LT_SYS_DYNAMIC_LINKER($1)
-    _LT_LINKER_HARDCODE_LIBPATH($1)
-
-    _LT_CONFIG($1)
-  fi # test -n "$compiler"
-
-  GCC=$lt_save_GCC
-  CC="$lt_save_CC"
-fi # test "$_lt_disable_FC" != yes
-
-AC_LANG_POP
-])# _LT_LANG_FC_CONFIG
-
-
-# _LT_LANG_GCJ_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for the GNU Java Compiler compiler
-# are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_GCJ_CONFIG],
-[AC_REQUIRE([LT_PROG_GCJ])dnl
-AC_LANG_SAVE
-
-# Source file extension for Java test sources.
-ac_ext=java
-
-# Object file extension for compiled Java test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_TAG_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-lt_save_GCC=$GCC
-GCC=yes
-CC=${GCJ-"gcj"}
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_TAGVAR(LD, $1)="$LD"
-_LT_CC_BASENAME([$compiler])
-
-# GCJ did not exist at the time GCC didn't implicitly link libc in.
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-
-## CAVEAT EMPTOR:
-## There is no encapsulation within the following macros, do not change
-## the running order or otherwise move them around unless you know exactly
-## what you are doing...
-if test -n "$compiler"; then
-  _LT_COMPILER_NO_RTTI($1)
-  _LT_COMPILER_PIC($1)
-  _LT_COMPILER_C_O($1)
-  _LT_COMPILER_FILE_LOCKS($1)
-  _LT_LINKER_SHLIBS($1)
-  _LT_LINKER_HARDCODE_LIBPATH($1)
-
-  _LT_CONFIG($1)
-fi
-
-AC_LANG_RESTORE
-
-GCC=$lt_save_GCC
-CC="$lt_save_CC"
-])# _LT_LANG_GCJ_CONFIG
-
-
-# _LT_LANG_RC_CONFIG([TAG])
-# -------------------------
-# Ensure that the configuration variables for the Windows resource compiler
-# are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_RC_CONFIG],
-[AC_REQUIRE([LT_PROG_RC])dnl
-AC_LANG_SAVE
-
-# Source file extension for RC test sources.
-ac_ext=rc
-
-# Object file extension for compiled RC test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
-
-# Code to be used in simple link tests
-lt_simple_link_test_code="$lt_simple_compile_test_code"
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_TAG_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-lt_save_GCC=$GCC
-GCC=
-CC=${RC-"windres"}
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
-
-if test -n "$compiler"; then
-  :
-  _LT_CONFIG($1)
-fi
-
-GCC=$lt_save_GCC
-AC_LANG_RESTORE
-CC="$lt_save_CC"
-])# _LT_LANG_RC_CONFIG
-
-
-# LT_PROG_GCJ
-# -----------
-AC_DEFUN([LT_PROG_GCJ],
-[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
-  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
-    [AC_CHECK_TOOL(GCJ, gcj,)
-      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
-      AC_SUBST(GCJFLAGS)])])[]dnl
-])
-
-# Old name:
-AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
-
-
-# LT_PROG_RC
-# ----------
-AC_DEFUN([LT_PROG_RC],
-[AC_CHECK_TOOL(RC, windres,)
-])
-
-# Old name:
-AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([LT_AC_PROG_RC], [])
-
-
-# _LT_DECL_EGREP
-# --------------
-# If we don't have a new enough Autoconf to choose the best grep
-# available, choose the one first in the user's PATH.
-m4_defun([_LT_DECL_EGREP],
-[AC_REQUIRE([AC_PROG_EGREP])dnl
-AC_REQUIRE([AC_PROG_FGREP])dnl
-test -z "$GREP" && GREP=grep
-_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
-_LT_DECL([], [EGREP], [1], [An ERE matcher])
-_LT_DECL([], [FGREP], [1], [A literal string matcher])
-dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
-AC_SUBST([GREP])
-])
-
-
-# _LT_DECL_OBJDUMP
-# --------------
-# If we don't have a new enough Autoconf to choose the best objdump
-# available, choose the one first in the user's PATH.
-m4_defun([_LT_DECL_OBJDUMP],
-[AC_CHECK_TOOL(OBJDUMP, objdump, false)
-test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
-AC_SUBST([OBJDUMP])
-])
-
-
-# _LT_DECL_SED
-# ------------
-# Check for a fully-functional sed program, that truncates
-# as few characters as possible.  Prefer GNU sed if found.
-m4_defun([_LT_DECL_SED],
-[AC_PROG_SED
-test -z "$SED" && SED=sed
-Xsed="$SED -e 1s/^X//"
-_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
-_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
-    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
-])# _LT_DECL_SED
-
-m4_ifndef([AC_PROG_SED], [
-############################################################
-# NOTE: This macro has been submitted for inclusion into   #
-#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
-#  a released version of Autoconf we should remove this    #
-#  macro and use it instead.                               #
-############################################################
-
-m4_defun([AC_PROG_SED],
-[AC_MSG_CHECKING([for a sed that does not truncate output])
-AC_CACHE_VAL(lt_cv_path_SED,
-[# Loop through the user's path and test for sed and gsed.
-# Then use that list of sed's as ones to test for truncation.
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for lt_ac_prog in sed gsed; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
-        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
-      fi
-    done
-  done
-done
-IFS=$as_save_IFS
-lt_ac_max=0
-lt_ac_count=0
-# Add /usr/xpg4/bin/sed as it is typically found on Solaris
-# along with /bin/sed that truncates output.
-for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
-  test ! -f $lt_ac_sed && continue
-  cat /dev/null > conftest.in
-  lt_ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
-  # Check for GNU sed and select it if it is found.
-  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
-    lt_cv_path_SED=$lt_ac_sed
-    break
-  fi
-  while true; do
-    cat conftest.in conftest.in >conftest.tmp
-    mv conftest.tmp conftest.in
-    cp conftest.in conftest.nl
-    echo >>conftest.nl
-    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
-    cmp -s conftest.out conftest.nl || break
-    # 10000 chars as input seems more than enough
-    test $lt_ac_count -gt 10 && break
-    lt_ac_count=`expr $lt_ac_count + 1`
-    if test $lt_ac_count -gt $lt_ac_max; then
-      lt_ac_max=$lt_ac_count
-      lt_cv_path_SED=$lt_ac_sed
-    fi
-  done
-done
-])
-SED=$lt_cv_path_SED
-AC_SUBST([SED])
-AC_MSG_RESULT([$SED])
-])#AC_PROG_SED
-])#m4_ifndef
-
-# Old name:
-AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([LT_AC_PROG_SED], [])
-
-
-# _LT_CHECK_SHELL_FEATURES
-# ------------------------
-# Find out whether the shell is Bourne or XSI compatible,
-# or has some other useful features.
-m4_defun([_LT_CHECK_SHELL_FEATURES],
-[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
-# Try some XSI features
-xsi_shell=no
-( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,, \
-    && eval 'test $(( 1 + 1 )) -eq 2 \
-    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
-  && xsi_shell=yes
-AC_MSG_RESULT([$xsi_shell])
-_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
-
-AC_MSG_CHECKING([whether the shell understands "+="])
-lt_shell_append=no
-( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
-    >/dev/null 2>&1 \
-  && lt_shell_append=yes
-AC_MSG_RESULT([$lt_shell_append])
-_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
-
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  lt_unset=unset
-else
-  lt_unset=false
-fi
-_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
-
-# test EBCDIC or ASCII
-case `echo X|tr X '\101'` in
- A) # ASCII based system
-    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
-  lt_SP2NL='tr \040 \012'
-  lt_NL2SP='tr \015\012 \040\040'
-  ;;
- *) # EBCDIC based system
-  lt_SP2NL='tr \100 \n'
-  lt_NL2SP='tr \r\n \100\100'
-  ;;
-esac
-_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
-_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
-])# _LT_CHECK_SHELL_FEATURES
-
-
-# _LT_PROG_XSI_SHELLFNS
-# ---------------------
-# Bourne and XSI compatible variants of some useful shell functions.
-m4_defun([_LT_PROG_XSI_SHELLFNS],
-[case $xsi_shell in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result="${1##*/}"
-}
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-  func_basename_result="${1##*/}"
-}
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-func_stripname ()
-{
-  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-  # positional parameters, so assign one to ordinary parameter first.
-  func_stripname_result=${3}
-  func_stripname_result=${func_stripname_result#"${1}"}
-  func_stripname_result=${func_stripname_result%"${2}"}
-}
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=${1%%=*}
-  func_opt_split_arg=${1#*=}
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  case ${1} in
-    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-    *)    func_lo2o_result=${1} ;;
-  esac
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=${1%.*}.lo
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=$(( $[*] ))
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=${#1}
-}
-
-_LT_EOF
-    ;;
-  *) # Bourne compatible functions.
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
-
-dnl func_dirname_and_basename
-dnl A portable version of this function is already defined in general.m4sh
-dnl so there is no need for it here.
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-  case ${2} in
-    .*) func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
-    *)  func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
-  esac
-}
-
-# sed scripts:
-my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
-my_sed_long_arg='1s/^-[[^=]]*=//'
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
-  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'`
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=`expr "$[@]"`
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len`
-}
-
-_LT_EOF
-esac
-
-case $lt_shell_append in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$[1]+=\$[2]"
-}
-_LT_EOF
-    ;;
-  *)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$[1]=\$$[1]\$[2]"
-}
-
-_LT_EOF
-    ;;
-  esac
-])
diff --git a/config/ltmain.sh b/config/ltmain.sh
old mode 100755
new mode 100644
index 0634c4b..63ae69d
--- a/config/ltmain.sh
+++ b/config/ltmain.sh
@@ -1,9 +1,9 @@
-# Generated from ltmain.m4sh.
 
-# ltmain.sh (GNU libtool) 2.2.6
+# libtool (GNU libtool) 2.4.2
 # Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 # This is free software; see the source for copying conditions.  There is NO
 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
@@ -32,50 +32,57 @@
 #
 # Provide generalized library-building support services.
 #
-#     --config             show all configuration variables
-#     --debug              enable verbose shell tracing
-# -n, --dry-run            display commands without modifying any files
-#     --features           display basic configuration information and exit
-#     --mode=MODE          use operation mode MODE
-#     --preserve-dup-deps  don't remove duplicate dependency libraries
-#     --quiet, --silent    don't print informational messages
-#     --tag=TAG            use configuration variables from tag TAG
-# -v, --verbose            print informational messages (default)
-#     --version            print version information
-# -h, --help               print short or long help message
+#       --config             show all configuration variables
+#       --debug              enable verbose shell tracing
+#   -n, --dry-run            display commands without modifying any files
+#       --features           display basic configuration information and exit
+#       --mode=MODE          use operation mode MODE
+#       --preserve-dup-deps  don't remove duplicate dependency libraries
+#       --quiet, --silent    don't print informational messages
+#       --no-quiet, --no-silent
+#                            print informational messages (default)
+#       --no-warn            don't display warning messages
+#       --tag=TAG            use configuration variables from tag TAG
+#   -v, --verbose            print more informational messages than default
+#       --no-verbose         don't print the extra informational messages
+#       --version            print version information
+#   -h, --help, --help-all   print short, long, or detailed help message
 #
 # MODE must be one of the following:
 #
-#       clean              remove files from the build directory
-#       compile            compile a source file into a libtool object
-#       execute            automatically set library path, then run a program
-#       finish             complete the installation of libtool libraries
-#       install            install libraries or executables
-#       link               create a library or an executable
-#       uninstall          remove libraries from an installed directory
+#         clean              remove files from the build directory
+#         compile            compile a source file into a libtool object
+#         execute            automatically set library path, then run a program
+#         finish             complete the installation of libtool libraries
+#         install            install libraries or executables
+#         link               create a library or an executable
+#         uninstall          remove libraries from an installed directory
 #
-# MODE-ARGS vary depending on the MODE.
+# MODE-ARGS vary depending on the MODE.  When passed as first option,
+# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
 #
 # When reporting a bug, please describe a test case to reproduce it and
 # include the following information:
 #
-#       host-triplet:	$host
-#       shell:		$SHELL
-#       compiler:		$LTCC
-#       compiler flags:		$LTCFLAGS
-#       linker:		$LD (gnu? $with_gnu_ld)
-#       $progname:		(GNU libtool) 2.2.6
-#       automake:		$automake_version
-#       autoconf:		$autoconf_version
+#         host-triplet:	$host
+#         shell:		$SHELL
+#         compiler:		$LTCC
+#         compiler flags:		$LTCFLAGS
+#         linker:		$LD (gnu? $with_gnu_ld)
+#         $progname:	(GNU libtool) 2.4.2
+#         automake:	$automake_version
+#         autoconf:	$autoconf_version
 #
 # Report bugs to <bug-libtool at gnu.org>.
+# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
+# General help using GNU software: <http://www.gnu.org/gethelp/>.
 
-PROGRAM=ltmain.sh
+PROGRAM=libtool
 PACKAGE=libtool
-VERSION=2.2.6
+VERSION=2.4.2
 TIMESTAMP=""
-package_revision=1.3012
+package_revision=1.3337
 
 # Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
@@ -91,10 +98,15 @@ fi
 BIN_SH=xpg4; export BIN_SH # for Tru64
 DUALCASE=1; export DUALCASE # for MKS sh
 
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
 # NLS nuisances: We save the old values to restore during execute mode.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
 lt_user_locale=
 lt_safe_locale=
 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
@@ -107,24 +119,28 @@ do
 	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
 	fi"
 done
+LC_ALL=C
+LANGUAGE=C
+export LANGUAGE LC_ALL
 
 $lt_unset CDPATH
 
 
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
 
 
 
 : ${CP="cp -f"}
-: ${ECHO="echo"}
-: ${EGREP="/usr/bin/grep -E"}
-: ${FGREP="/usr/bin/grep -F"}
-: ${GREP="/usr/bin/grep"}
-: ${LN_S="ln -s"}
+test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
 : ${MAKE="make"}
 : ${MKDIR="mkdir"}
 : ${MV="mv -f"}
 : ${RM="rm -f"}
-: ${SED="/opt/local/bin/gsed"}
 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
 : ${Xsed="$SED -e 1s/^X//"}
 
@@ -144,6 +160,27 @@ IFS=" 	$lt_nl"
 dirname="s,/[^/]*$,,"
 basename="s,^.*/,,"
 
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+    func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
+    if test "X$func_dirname_result" = "X${1}"; then
+      func_dirname_result="${3}"
+    else
+      func_dirname_result="$func_dirname_result${2}"
+    fi
+} # func_dirname may be replaced by extended shell implementation
+
+
+# func_basename file
+func_basename ()
+{
+    func_basename_result=`$ECHO "${1}" | $SED "$basename"`
+} # func_basename may be replaced by extended shell implementation
+
+
 # func_dirname_and_basename file append nondir_replacement
 # perform func_basename and func_dirname in a single function
 # call:
@@ -158,33 +195,183 @@ basename="s,^.*/,,"
 # those functions but instead duplicate the functionality here.
 func_dirname_and_basename ()
 {
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+    # Extract subdirectory from the argument.
+    func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
+    if test "X$func_dirname_result" = "X${1}"; then
+      func_dirname_result="${3}"
+    else
+      func_dirname_result="$func_dirname_result${2}"
+    fi
+    func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
+} # func_dirname_and_basename may be replaced by extended shell implementation
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+    case ${2} in
+      .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+      *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+    esac
+} # func_stripname may be replaced by extended shell implementation
+
+
+# These SED scripts presuppose an absolute path with a trailing slash.
+pathcar='s,^/\([^/]*\).*$,\1,'
+pathcdr='s,^/[^/]*,,'
+removedotparts=':dotsl
+		s@/\./@/@g
+		t dotsl
+		s,/\.$,/,'
+collapseslashes='s@/\{1,\}@/@g'
+finalslash='s,/*$,/,'
+
+# func_normal_abspath PATH
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+#             value returned in "$func_normal_abspath_result"
+func_normal_abspath ()
+{
+  # Start from root dir and reassemble the path.
+  func_normal_abspath_result=
+  func_normal_abspath_tpath=$1
+  func_normal_abspath_altnamespace=
+  case $func_normal_abspath_tpath in
+    "")
+      # Empty path, that just means $cwd.
+      func_stripname '' '/' "`pwd`"
+      func_normal_abspath_result=$func_stripname_result
+      return
+    ;;
+    # The next three entries are used to spot a run of precisely
+    # two leading slashes without using negated character classes;
+    # we take advantage of case's first-match behaviour.
+    ///*)
+      # Unusual form of absolute path, do nothing.
+    ;;
+    //*)
+      # Not necessarily an ordinary path; POSIX reserves leading '//'
+      # and for example Cygwin uses it to access remote file shares
+      # over CIFS/SMB, so we conserve a leading double slash if found.
+      func_normal_abspath_altnamespace=/
+    ;;
+    /*)
+      # Absolute path, do nothing.
+    ;;
+    *)
+      # Relative path, prepend $cwd.
+      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+    ;;
+  esac
+  # Cancel out all the simple stuff to save iterations.  We also want
+  # the path to end with a slash for ease of parsing, so make sure
+  # there is one (and only one) here.
+  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
+  while :; do
+    # Processed it all yet?
+    if test "$func_normal_abspath_tpath" = / ; then
+      # If we ascended to the root using ".." the result may be empty now.
+      if test -z "$func_normal_abspath_result" ; then
+        func_normal_abspath_result=/
+      fi
+      break
+    fi
+    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcar"`
+    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcdr"`
+    # Figure out what to do with it
+    case $func_normal_abspath_tcomponent in
+      "")
+        # Trailing empty path component, ignore it.
+      ;;
+      ..)
+        # Parent dir; strip last assembled component from result.
+        func_dirname "$func_normal_abspath_result"
+        func_normal_abspath_result=$func_dirname_result
+      ;;
+      *)
+        # Actual path component, append it.
+        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
+      ;;
+    esac
+  done
+  # Restore leading double-slash if one was found on entry.
+  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
 }
 
-# Generated shell functions inserted here.
+# func_relative_path SRCDIR DSTDIR
+# generates a relative path from SRCDIR to DSTDIR, with a trailing
+# slash if non-empty, suitable for immediately appending a filename
+# without needing to append a separator.
+#             value returned in "$func_relative_path_result"
+func_relative_path ()
+{
+  func_relative_path_result=
+  func_normal_abspath "$1"
+  func_relative_path_tlibdir=$func_normal_abspath_result
+  func_normal_abspath "$2"
+  func_relative_path_tbindir=$func_normal_abspath_result
+
+  # Ascend the tree starting from libdir
+  while :; do
+    # check if we have found a prefix of bindir
+    case $func_relative_path_tbindir in
+      $func_relative_path_tlibdir)
+        # found an exact match
+        func_relative_path_tcancelled=
+        break
+        ;;
+      $func_relative_path_tlibdir*)
+        # found a matching prefix
+        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+        func_relative_path_tcancelled=$func_stripname_result
+        if test -z "$func_relative_path_result"; then
+          func_relative_path_result=.
+        fi
+        break
+        ;;
+      *)
+        func_dirname $func_relative_path_tlibdir
+        func_relative_path_tlibdir=${func_dirname_result}
+        if test "x$func_relative_path_tlibdir" = x ; then
+          # Have to descend all the way to the root!
+          func_relative_path_result=../$func_relative_path_result
+          func_relative_path_tcancelled=$func_relative_path_tbindir
+          break
+        fi
+        func_relative_path_result=../$func_relative_path_result
+        ;;
+    esac
+  done
 
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
+  # Now calculate path; take care to avoid doubling-up slashes.
+  func_stripname '' '/' "$func_relative_path_result"
+  func_relative_path_result=$func_stripname_result
+  func_stripname '/' '/' "$func_relative_path_tcancelled"
+  if test "x$func_stripname_result" != x ; then
+    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
+  fi
+
+  # Normalisation. If bindir is libdir, return empty string,
+  # else relative path ending with a slash; either way, target
+  # file name can be directly appended.
+  if test ! -z "$func_relative_path_result"; then
+    func_stripname './' '' "$func_relative_path_result/"
+    func_relative_path_result=$func_stripname_result
+  fi
+}
 
 # The name of this program:
-# In the unlikely event $progname began with a '-', it would play havoc with
-# func_echo (imagine progname=-n), so we prepend ./ in that case:
 func_dirname_and_basename "$progpath"
 progname=$func_basename_result
-case $progname in
-  -*) progname=./$progname ;;
-esac
 
 # Make sure we have an absolute path for reexecution:
 case $progpath in
@@ -196,7 +383,7 @@ case $progpath in
      ;;
   *)
      save_IFS="$IFS"
-     IFS=:
+     IFS=${PATH_SEPARATOR-:}
      for progdir in $PATH; do
        IFS="$save_IFS"
        test -x "$progdir/$progname" && break
@@ -215,6 +402,15 @@ sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
 # Same as above, but do not quote variable references.
 double_quote_subst='s/\(["`\\]\)/\\\1/g'
 
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
+
+# Sed substitution that converts a w32 file name or path
+# which contains forward slashes, into one that contains
+# (escaped) backslashes.  A very naive implementation.
+lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+
 # Re-`\' parameter expansions in output of double_quote_subst that were
 # `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
 # in input to double_quote_subst, that '$' was protected from expansion.
@@ -243,7 +439,7 @@ opt_warning=:
 # name if it has been set yet.
 func_echo ()
 {
-    $ECHO "$progname${mode+: }$mode: $*"
+    $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
 }
 
 # func_verbose arg...
@@ -258,18 +454,25 @@ func_verbose ()
     :
 }
 
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*"
+}
+
 # func_error arg...
 # Echo program name prefixed message to standard error.
 func_error ()
 {
-    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
+    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
 }
 
 # func_warning arg...
 # Echo program name prefixed warning message to standard error.
 func_warning ()
 {
-    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
+    $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
 
     # bash bug again:
     :
@@ -326,9 +529,9 @@ func_mkdir_p ()
         case $my_directory_path in */*) ;; *) break ;; esac
 
         # ...otherwise throw away the child directory and loop
-        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
+        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
       done
-      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
+      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
 
       save_mkdir_p_IFS="$IFS"; IFS=':'
       for my_dir in $my_dir_list; do
@@ -378,7 +581,7 @@ func_mktempdir ()
         func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
     fi
 
-    $ECHO "X$my_tmpdir" | $Xsed
+    $ECHO "$my_tmpdir"
 }
 
 
@@ -392,7 +595,7 @@ func_quote_for_eval ()
 {
     case $1 in
       *[\\\`\"\$]*)
-	func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
+	func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
       *)
         func_quote_for_eval_unquoted_result="$1" ;;
     esac
@@ -419,7 +622,7 @@ func_quote_for_expand ()
 {
     case $1 in
       *[\\\`\"]*)
-	my_arg=`$ECHO "X$1" | $Xsed \
+	my_arg=`$ECHO "$1" | $SED \
 	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
       *)
         my_arg="$1" ;;
@@ -488,15 +691,39 @@ func_show_eval_locale ()
     fi
 }
 
-
-
+# func_tr_sh
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result.  All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+  case $1 in
+  [0-9]* | *[!a-zA-Z0-9_]*)
+    func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
+    ;;
+  * )
+    func_tr_sh_result=$1
+    ;;
+  esac
+}
 
 
 # func_version
 # Echo version message to standard output and exit.
 func_version ()
 {
-    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
+    $opt_debug
+
+    $SED -n '/(C)/!b go
+	:more
+	/\./!{
+	  N
+	  s/\n# / /
+	  b more
+	}
+	:go
+	/^# '$PROGRAM' (GNU /,/# warranty; / {
         s/^# //
 	s/^# *$//
         s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
@@ -509,22 +736,28 @@ func_version ()
 # Echo short help message to standard output and exit.
 func_usage ()
 {
-    $SED -n '/^# Usage:/,/# -h/ {
+    $opt_debug
+
+    $SED -n '/^# Usage:/,/^#  *.*--help/ {
         s/^# //
 	s/^# *$//
 	s/\$progname/'$progname'/
 	p
     }' < "$progpath"
-    $ECHO
+    echo
     $ECHO "run \`$progname --help | more' for full usage"
     exit $?
 }
 
-# func_help
-# Echo long help message to standard output and exit.
+# func_help [NOEXIT]
+# Echo long help message to standard output and exit,
+# unless 'noexit' is passed as argument.
 func_help ()
 {
+    $opt_debug
+
     $SED -n '/^# Usage:/,/# Report bugs to/ {
+	:print
         s/^# //
 	s/^# *$//
 	s*\$progname*'$progname'*
@@ -534,11 +767,18 @@ func_help ()
 	s*\$LTCFLAGS*'"$LTCFLAGS"'*
 	s*\$LD*'"$LD"'*
 	s/\$with_gnu_ld/'"$with_gnu_ld"'/
-	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
-	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
+	s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
+	s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
 	p
-     }' < "$progpath"
-    exit $?
+	d
+     }
+     /^# .* home page:/b print
+     /^# General help using/b print
+     ' < "$progpath"
+    ret=$?
+    if test -z "$1"; then
+      exit $ret
+    fi
 }
 
 # func_missing_arg argname
@@ -546,70 +786,106 @@ func_help ()
 # exit_cmd.
 func_missing_arg ()
 {
-    func_error "missing argument for $1"
+    $opt_debug
+
+    func_error "missing argument for $1."
     exit_cmd=exit
 }
 
-exit_cmd=:
 
+# func_split_short_opt shortopt
+# Set func_split_short_opt_name and func_split_short_opt_arg shell
+# variables after splitting SHORTOPT after the 2nd character.
+func_split_short_opt ()
+{
+    my_sed_short_opt='1s/^\(..\).*$/\1/;q'
+    my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
+
+    func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
+    func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
+} # func_split_short_opt may be replaced by extended shell implementation
 
 
+# func_split_long_opt longopt
+# Set func_split_long_opt_name and func_split_long_opt_arg shell
+# variables after splitting LONGOPT at the `=' sign.
+func_split_long_opt ()
+{
+    my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
+    my_sed_long_arg='1s/^--[^=]*=//'
+
+    func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
+    func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
+} # func_split_long_opt may be replaced by extended shell implementation
+
+exit_cmd=:
+
 
 
-# Check that we have a working $ECHO.
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
-  # Yippee, $ECHO works!
-  :
-else
-  # Restart under the correct shell, and then maybe $ECHO will work.
-  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
-fi
-# Same for EGREP, and just to be sure, do LTCC as well
-if test "x$EGREP" = x ; then
-    EGREP=egrep
-fi
-if test "x$LTCC" = x ; then
-    LTCC=${CC-gcc}
-fi
 
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<EOF
-$*
-EOF
-  exit $EXIT_SUCCESS
-fi
 
 magic="%%%MAGIC variable%%%"
 magic_exe="%%%MAGIC EXE variable%%%"
 
 # Global variables.
-# $mode is unset
 nonopt=
-execute_dlfiles=
 preserve_args=
 lo2o="s/\\.lo\$/.${objext}/"
 o2lo="s/\\.${objext}\$/.lo/"
 extracted_archives=
 extracted_serial=0
 
-opt_dry_run=false
-opt_duplicate_deps=false
-opt_silent=false
-opt_debug=:
-
 # If this variable is set in any of the actions, the command in it
 # will be execed at the end.  This prevents here-documents from being
 # left over by shells.
 exec_cmd=
 
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+    eval "${1}=\$${1}\${2}"
+} # func_append may be replaced by extended shell implementation
+
+# func_append_quoted var value
+# Quote VALUE and append to the end of shell variable VAR, separated
+# by a space.
+func_append_quoted ()
+{
+    func_quote_for_eval "${2}"
+    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
+} # func_append_quoted may be replaced by extended shell implementation
+
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+    func_arith_result=`expr "${@}"`
+} # func_arith may be replaced by extended shell implementation
+
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+    func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
+} # func_len may be replaced by extended shell implementation
+
+
+# func_lo2o object
+func_lo2o ()
+{
+    func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+} # func_lo2o may be replaced by extended shell implementation
+
+
+# func_xform libobj-or-source
+func_xform ()
+{
+    func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
+} # func_xform may be replaced by extended shell implementation
+
+
 # func_fatal_configuration arg...
 # Echo program name prefixed message to standard error, followed by
 # a configuration failure hint, and exit.
@@ -643,16 +919,16 @@ func_config ()
 # Display the features supported by this script.
 func_features ()
 {
-    $ECHO "host: $host"
+    echo "host: $host"
     if test "$build_libtool_libs" = yes; then
-      $ECHO "enable shared libraries"
+      echo "enable shared libraries"
     else
-      $ECHO "disable shared libraries"
+      echo "disable shared libraries"
     fi
     if test "$build_old_libs" = yes; then
-      $ECHO "enable static libraries"
+      echo "enable static libraries"
     else
-      $ECHO "disable static libraries"
+      echo "disable static libraries"
     fi
 
     exit $?
@@ -699,117 +975,209 @@ func_enable_tag ()
   esac
 }
 
-# Parse options once, thoroughly.  This comes as soon as possible in
-# the script to make things like `libtool --version' happen quickly.
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
 {
+  if test "$package_revision" != "$macro_revision"; then
+    if test "$VERSION" != "$macro_version"; then
+      if test -z "$macro_version"; then
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      else
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      fi
+    else
+      cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+    fi
 
-  # Shorthand for --mode=foo, only valid as the first argument
-  case $1 in
-  clean|clea|cle|cl)
-    shift; set dummy --mode clean ${1+"$@"}; shift
-    ;;
-  compile|compil|compi|comp|com|co|c)
-    shift; set dummy --mode compile ${1+"$@"}; shift
-    ;;
-  execute|execut|execu|exec|exe|ex|e)
-    shift; set dummy --mode execute ${1+"$@"}; shift
-    ;;
-  finish|finis|fini|fin|fi|f)
-    shift; set dummy --mode finish ${1+"$@"}; shift
-    ;;
-  install|instal|insta|inst|ins|in|i)
-    shift; set dummy --mode install ${1+"$@"}; shift
-    ;;
-  link|lin|li|l)
-    shift; set dummy --mode link ${1+"$@"}; shift
-    ;;
-  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
-    shift; set dummy --mode uninstall ${1+"$@"}; shift
-    ;;
-  esac
+    exit $EXIT_MISMATCH
+  fi
+}
 
-  # Parse non-mode specific arguments:
-  while test "$#" -gt 0; do
+
+# Shorthand for --mode=foo, only valid as the first argument
+case $1 in
+clean|clea|cle|cl)
+  shift; set dummy --mode clean ${1+"$@"}; shift
+  ;;
+compile|compil|compi|comp|com|co|c)
+  shift; set dummy --mode compile ${1+"$@"}; shift
+  ;;
+execute|execut|execu|exec|exe|ex|e)
+  shift; set dummy --mode execute ${1+"$@"}; shift
+  ;;
+finish|finis|fini|fin|fi|f)
+  shift; set dummy --mode finish ${1+"$@"}; shift
+  ;;
+install|instal|insta|inst|ins|in|i)
+  shift; set dummy --mode install ${1+"$@"}; shift
+  ;;
+link|lin|li|l)
+  shift; set dummy --mode link ${1+"$@"}; shift
+  ;;
+uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+  shift; set dummy --mode uninstall ${1+"$@"}; shift
+  ;;
+esac
+
+
+
+# Option defaults:
+opt_debug=:
+opt_dry_run=false
+opt_config=false
+opt_preserve_dup_deps=false
+opt_features=false
+opt_finish=false
+opt_help=false
+opt_help_all=false
+opt_silent=:
+opt_warning=:
+opt_verbose=:
+opt_silent=false
+opt_verbose=false
+
+
+# Parse options once, thoroughly.  This comes as soon as possible in the
+# script to make things like `--version' happen as quickly as we can.
+{
+  # this just eases exit handling
+  while test $# -gt 0; do
     opt="$1"
     shift
-
     case $opt in
-      --config)		func_config					;;
-
-      --debug)		preserve_args="$preserve_args $opt"
+      --debug|-x)	opt_debug='set -x'
 			func_echo "enabling shell trace mode"
-			opt_debug='set -x'
 			$opt_debug
 			;;
-
-      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
-			execute_dlfiles="$execute_dlfiles $1"
-			shift
+      --dry-run|--dryrun|-n)
+			opt_dry_run=:
 			;;
-
-      --dry-run | -n)	opt_dry_run=:					;;
-      --features)       func_features					;;
-      --finish)		mode="finish"					;;
-
-      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
-			case $1 in
-			  # Valid mode arguments:
-			  clean)	;;
-			  compile)	;;
-			  execute)	;;
-			  finish)	;;
-			  install)	;;
-			  link)		;;
-			  relink)	;;
-			  uninstall)	;;
-
-			  # Catch anything else as an error
-			  *) func_error "invalid argument for $opt"
-			     exit_cmd=exit
-			     break
-			     ;;
-		        esac
-
-			mode="$1"
+      --config)
+			opt_config=:
+func_config
+			;;
+      --dlopen|-dlopen)
+			optarg="$1"
+			opt_dlopen="${opt_dlopen+$opt_dlopen
+}$optarg"
 			shift
 			;;
-
       --preserve-dup-deps)
-			opt_duplicate_deps=:				;;
-
-      --quiet|--silent)	preserve_args="$preserve_args $opt"
-			opt_silent=:
+			opt_preserve_dup_deps=:
 			;;
-
-      --verbose| -v)	preserve_args="$preserve_args $opt"
+      --features)
+			opt_features=:
+func_features
+			;;
+      --finish)
+			opt_finish=:
+set dummy --mode finish ${1+"$@"}; shift
+			;;
+      --help)
+			opt_help=:
+			;;
+      --help-all)
+			opt_help_all=:
+opt_help=': help-all'
+			;;
+      --mode)
+			test $# = 0 && func_missing_arg $opt && break
+			optarg="$1"
+			opt_mode="$optarg"
+case $optarg in
+  # Valid mode arguments:
+  clean|compile|execute|finish|install|link|relink|uninstall) ;;
+
+  # Catch anything else as an error
+  *) func_error "invalid argument for $opt"
+     exit_cmd=exit
+     break
+     ;;
+esac
+			shift
+			;;
+      --no-silent|--no-quiet)
 			opt_silent=false
+func_append preserve_args " $opt"
 			;;
-
-      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
-			preserve_args="$preserve_args $opt $1"
-			func_enable_tag "$1"	# tagname is set here
+      --no-warning|--no-warn)
+			opt_warning=false
+func_append preserve_args " $opt"
+			;;
+      --no-verbose)
+			opt_verbose=false
+func_append preserve_args " $opt"
+			;;
+      --silent|--quiet)
+			opt_silent=:
+func_append preserve_args " $opt"
+        opt_verbose=false
+			;;
+      --verbose|-v)
+			opt_verbose=:
+func_append preserve_args " $opt"
+opt_silent=false
+			;;
+      --tag)
+			test $# = 0 && func_missing_arg $opt && break
+			optarg="$1"
+			opt_tag="$optarg"
+func_append preserve_args " $opt $optarg"
+func_enable_tag "$optarg"
 			shift
 			;;
 
+      -\?|-h)		func_usage				;;
+      --help)		func_help				;;
+      --version)	func_version				;;
+
       # Separate optargs to long options:
-      -dlopen=*|--mode=*|--tag=*)
-			func_opt_split "$opt"
-			set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
+      --*=*)
+			func_split_long_opt "$opt"
+			set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
 			shift
 			;;
 
-      -\?|-h)		func_usage					;;
-      --help)		opt_help=:					;;
-      --version)	func_version					;;
-
-      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
-
-      *)		nonopt="$opt"
-			break
+      # Separate non-argument short options:
+      -\?*|-h*|-n*|-v*)
+			func_split_short_opt "$opt"
+			set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
+			shift
 			;;
+
+      --)		break					;;
+      -*)		func_fatal_help "unrecognized option \`$opt'" ;;
+      *)		set dummy "$opt" ${1+"$@"};	shift; break  ;;
     esac
   done
 
+  # Validate options:
+
+  # save first non-option argument
+  if test "$#" -gt 0; then
+    nonopt="$opt"
+    shift
+  fi
+
+  # preserve --debug
+  test "$opt_debug" = : || func_append preserve_args " --debug"
 
   case $host in
     *cygwin* | *mingw* | *pw32* | *cegcc*)
@@ -817,82 +1185,44 @@ func_enable_tag ()
       opt_duplicate_compiler_generated_deps=:
       ;;
     *)
-      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
+      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
       ;;
   esac
 
-  # Having warned about all mis-specified options, bail out if
-  # anything was wrong.
-  $exit_cmd $EXIT_FAILURE
-}
+  $opt_help || {
+    # Sanity checks first:
+    func_check_version_match
 
-# func_check_version_match
-# Ensure that we are using m4 macros, and libtool script from the same
-# release of libtool.
-func_check_version_match ()
-{
-  if test "$package_revision" != "$macro_revision"; then
-    if test "$VERSION" != "$macro_version"; then
-      if test -z "$macro_version"; then
-        cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from an older release.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
-      else
-        cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
-      fi
-    else
-      cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
-$progname: but the definition of this LT_INIT comes from revision $macro_revision.
-$progname: You should recreate aclocal.m4 with macros from revision $package_revision
-$progname: of $PACKAGE $VERSION and run autoconf again.
-_LT_EOF
+    if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+      func_fatal_configuration "not configured to build any kind of library"
     fi
 
-    exit $EXIT_MISMATCH
-  fi
-}
-
+    # Darwin sucks
+    eval std_shrext=\"$shrext_cmds\"
 
-## ----------- ##
-##    Main.    ##
-## ----------- ##
-
-$opt_help || {
-  # Sanity checks first:
-  func_check_version_match
-
-  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
-    func_fatal_configuration "not configured to build any kind of library"
-  fi
+    # Only execute mode is allowed to have -dlopen flags.
+    if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
+      func_error "unrecognized option \`-dlopen'"
+      $ECHO "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
 
-  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
+    # Change the help message to a mode-specific one.
+    generic_help="$help"
+    help="Try \`$progname --help --mode=$opt_mode' for more information."
+  }
 
 
-  # Darwin sucks
-  eval std_shrext=\"$shrext_cmds\"
+  # Bail if the options were screwed
+  $exit_cmd $EXIT_FAILURE
+}
 
 
-  # Only execute mode is allowed to have -dlopen flags.
-  if test -n "$execute_dlfiles" && test "$mode" != execute; then
-    func_error "unrecognized option \`-dlopen'"
-    $ECHO "$help" 1>&2
-    exit $EXIT_FAILURE
-  fi
 
-  # Change the help message to a mode-specific one.
-  generic_help="$help"
-  help="Try \`$progname --help --mode=$mode' for more information."
-}
 
+## ----------- ##
+##    Main.    ##
+## ----------- ##
 
 # func_lalib_p file
 # True iff FILE is a libtool `.la' library or `.lo' object file.
@@ -957,12 +1287,9 @@ func_ltwrapper_executable_p ()
 # temporary ltwrapper_script.
 func_ltwrapper_scriptname ()
 {
-    func_ltwrapper_scriptname_result=""
-    if func_ltwrapper_executable_p "$1"; then
-	func_dirname_and_basename "$1" "" "."
-	func_stripname '' '.exe' "$func_basename_result"
-	func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
-    fi
+    func_dirname_and_basename "$1" "" "."
+    func_stripname '' '.exe' "$func_basename_result"
+    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
 }
 
 # func_ltwrapper_p file
@@ -1008,6 +1335,37 @@ func_source ()
 }
 
 
+# func_resolve_sysroot PATH
+# Replace a leading = in PATH with a sysroot.  Store the result into
+# func_resolve_sysroot_result
+func_resolve_sysroot ()
+{
+  func_resolve_sysroot_result=$1
+  case $func_resolve_sysroot_result in
+  =*)
+    func_stripname '=' '' "$func_resolve_sysroot_result"
+    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
+    ;;
+  esac
+}
+
+# func_replace_sysroot PATH
+# If PATH begins with the sysroot, replace it with = and
+# store the result into func_replace_sysroot_result.
+func_replace_sysroot ()
+{
+  case "$lt_sysroot:$1" in
+  ?*:"$lt_sysroot"*)
+    func_stripname "$lt_sysroot" '' "$1"
+    func_replace_sysroot_result="=$func_stripname_result"
+    ;;
+  *)
+    # Including no sysroot.
+    func_replace_sysroot_result=$1
+    ;;
+  esac
+}
+
 # func_infer_tag arg
 # Infer tagged configuration to use if any are available and
 # if one wasn't chosen via the "--tag" command line option.
@@ -1020,13 +1378,15 @@ func_infer_tag ()
     if test -n "$available_tags" && test -z "$tagname"; then
       CC_quoted=
       for arg in $CC; do
-        func_quote_for_eval "$arg"
-	CC_quoted="$CC_quoted $func_quote_for_eval_result"
+	func_append_quoted CC_quoted "$arg"
       done
+      CC_expanded=`func_echo_all $CC`
+      CC_quoted_expanded=`func_echo_all $CC_quoted`
       case $@ in
       # Blanks in the command may have been stripped by the calling shell,
       # but not from the CC environment variable when configure was run.
-      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
+      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
       # Blanks at the start of $base_compile will cause this to fail
       # if we don't check for them as well.
       *)
@@ -1037,11 +1397,13 @@ func_infer_tag ()
 	    CC_quoted=
 	    for arg in $CC; do
 	      # Double-quote args containing other shell metacharacters.
-	      func_quote_for_eval "$arg"
-	      CC_quoted="$CC_quoted $func_quote_for_eval_result"
+	      func_append_quoted CC_quoted "$arg"
 	    done
+	    CC_expanded=`func_echo_all $CC`
+	    CC_quoted_expanded=`func_echo_all $CC_quoted`
 	    case "$@ " in
-	      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
+	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
 	      # The compiler in the base compile command matches
 	      # the one in the tagged configuration.
 	      # Assume this is the tagged configuration we want.
@@ -1104,6 +1466,486 @@ EOF
     }
 }
 
+
+##################################################
+# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
+##################################################
+
+# func_convert_core_file_wine_to_w32 ARG
+# Helper function used by file name conversion functions when $build is *nix,
+# and $host is mingw, cygwin, or some other w32 environment. Relies on a
+# correctly configured wine environment available, with the winepath program
+# in $build's $PATH.
+#
+# ARG is the $build file name to be converted to w32 format.
+# Result is available in $func_convert_core_file_wine_to_w32_result, and will
+# be empty on error (or when ARG is empty)
+func_convert_core_file_wine_to_w32 ()
+{
+  $opt_debug
+  func_convert_core_file_wine_to_w32_result="$1"
+  if test -n "$1"; then
+    # Unfortunately, winepath does not exit with a non-zero error code, so we
+    # are forced to check the contents of stdout. On the other hand, if the
+    # command is not found, the shell will set an exit code of 127 and print
+    # *an error message* to stdout. So we must check for both error code of
+    # zero AND non-empty stdout, which explains the odd construction:
+    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
+    if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
+      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
+        $SED -e "$lt_sed_naive_backslashify"`
+    else
+      func_convert_core_file_wine_to_w32_result=
+    fi
+  fi
+}
+# end: func_convert_core_file_wine_to_w32
+
+
+# func_convert_core_path_wine_to_w32 ARG
+# Helper function used by path conversion functions when $build is *nix, and
+# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
+# configured wine environment available, with the winepath program in $build's
+# $PATH. Assumes ARG has no leading or trailing path separator characters.
+#
+# ARG is path to be converted from $build format to win32.
+# Result is available in $func_convert_core_path_wine_to_w32_result.
+# Unconvertible file (directory) names in ARG are skipped; if no directory names
+# are convertible, then the result may be empty.
+func_convert_core_path_wine_to_w32 ()
+{
+  $opt_debug
+  # unfortunately, winepath doesn't convert paths, only file names
+  func_convert_core_path_wine_to_w32_result=""
+  if test -n "$1"; then
+    oldIFS=$IFS
+    IFS=:
+    for func_convert_core_path_wine_to_w32_f in $1; do
+      IFS=$oldIFS
+      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
+      if test -n "$func_convert_core_file_wine_to_w32_result" ; then
+        if test -z "$func_convert_core_path_wine_to_w32_result"; then
+          func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
+        else
+          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
+        fi
+      fi
+    done
+    IFS=$oldIFS
+  fi
+}
+# end: func_convert_core_path_wine_to_w32
+
+
+# func_cygpath ARGS...
+# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
+# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
+# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
+# (2), returns the Cygwin file name or path in func_cygpath_result (input
+# file name or path is assumed to be in w32 format, as previously converted
+# from $build's *nix or MSYS format). In case (3), returns the w32 file name
+# or path in func_cygpath_result (input file name or path is assumed to be in
+# Cygwin format). Returns an empty string on error.
+#
+# ARGS are passed to cygpath, with the last one being the file name or path to
+# be converted.
+#
+# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
+# environment variable; do not put it in $PATH.
+func_cygpath ()
+{
+  $opt_debug
+  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
+    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
+    if test "$?" -ne 0; then
+      # on failure, ensure result is empty
+      func_cygpath_result=
+    fi
+  else
+    func_cygpath_result=
+    func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
+  fi
+}
+#end: func_cygpath
+
+
+# func_convert_core_msys_to_w32 ARG
+# Convert file name or path ARG from MSYS format to w32 format.  Return
+# result in func_convert_core_msys_to_w32_result.
+func_convert_core_msys_to_w32 ()
+{
+  $opt_debug
+  # awkward: cmd appends spaces to result
+  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
+    $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+}
+#end: func_convert_core_msys_to_w32
+
+
+# func_convert_file_check ARG1 ARG2
+# Verify that ARG1 (a file name in $build format) was converted to $host
+# format in ARG2. Otherwise, emit an error message, but continue (resetting
+# func_to_host_file_result to ARG1).
+func_convert_file_check ()
+{
+  $opt_debug
+  if test -z "$2" && test -n "$1" ; then
+    func_error "Could not determine host file name corresponding to"
+    func_error "  \`$1'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback:
+    func_to_host_file_result="$1"
+  fi
+}
+# end func_convert_file_check
+
+
+# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
+# Verify that FROM_PATH (a path in $build format) was converted to $host
+# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
+# func_to_host_file_result to a simplistic fallback value (see below).
+func_convert_path_check ()
+{
+  $opt_debug
+  if test -z "$4" && test -n "$3"; then
+    func_error "Could not determine the host path corresponding to"
+    func_error "  \`$3'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback.  This is a deliberately simplistic "conversion" and
+    # should not be "improved".  See libtool.info.
+    if test "x$1" != "x$2"; then
+      lt_replace_pathsep_chars="s|$1|$2|g"
+      func_to_host_path_result=`echo "$3" |
+        $SED -e "$lt_replace_pathsep_chars"`
+    else
+      func_to_host_path_result="$3"
+    fi
+  fi
+}
+# end func_convert_path_check
+
+
+# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
+# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
+# and appending REPL if ORIG matches BACKPAT.
+func_convert_path_front_back_pathsep ()
+{
+  $opt_debug
+  case $4 in
+  $1 ) func_to_host_path_result="$3$func_to_host_path_result"
+    ;;
+  esac
+  case $4 in
+  $2 ) func_append func_to_host_path_result "$3"
+    ;;
+  esac
+}
+# end func_convert_path_front_back_pathsep
+
+
+##################################################
+# $build to $host FILE NAME CONVERSION FUNCTIONS #
+##################################################
+# invoked via `$to_host_file_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# Result will be available in $func_to_host_file_result.
+
+
+# func_to_host_file ARG
+# Converts the file name ARG from $build format to $host format. Return result
+# in func_to_host_file_result.
+func_to_host_file ()
+{
+  $opt_debug
+  $to_host_file_cmd "$1"
+}
+# end func_to_host_file
+
+
+# func_to_tool_file ARG LAZY
+# converts the file name ARG from $build format to toolchain format. Return
+# result in func_to_tool_file_result.  If the conversion in use is listed
+# in (the comma separated) LAZY, no conversion takes place.
+func_to_tool_file ()
+{
+  $opt_debug
+  case ,$2, in
+    *,"$to_tool_file_cmd",*)
+      func_to_tool_file_result=$1
+      ;;
+    *)
+      $to_tool_file_cmd "$1"
+      func_to_tool_file_result=$func_to_host_file_result
+      ;;
+  esac
+}
+# end func_to_tool_file
+
+
+# func_convert_file_noop ARG
+# Copy ARG to func_to_host_file_result.
+func_convert_file_noop ()
+{
+  func_to_host_file_result="$1"
+}
+# end func_convert_file_noop
+
+
+# func_convert_file_msys_to_w32 ARG
+# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_file_result.
+func_convert_file_msys_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_to_host_file_result="$func_convert_core_msys_to_w32_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_w32
+
+
+# func_convert_file_cygwin_to_w32 ARG
+# Convert file name ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_file_cygwin_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
+    # LT_CYGPATH in this case.
+    func_to_host_file_result=`cygpath -m "$1"`
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_cygwin_to_w32
+
+
+# func_convert_file_nix_to_w32 ARG
+# Convert file name ARG from *nix to w32 format.  Requires a wine environment
+# and a working winepath. Returns result in func_to_host_file_result.
+func_convert_file_nix_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_file_wine_to_w32 "$1"
+    func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_w32
+
+
+# func_convert_file_msys_to_cygwin ARG
+# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_file_msys_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_msys_to_w32_result"
+    func_to_host_file_result="$func_cygpath_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_cygwin
+
+
+# func_convert_file_nix_to_cygwin ARG
+# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
+# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
+# in func_to_host_file_result.
+func_convert_file_nix_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
+    func_convert_core_file_wine_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
+    func_to_host_file_result="$func_cygpath_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_cygwin
+
+
+#############################################
+# $build to $host PATH CONVERSION FUNCTIONS #
+#############################################
+# invoked via `$to_host_path_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# The result will be available in $func_to_host_path_result.
+#
+# Path separators are also converted from $build format to $host format.  If
+# ARG begins or ends with a path separator character, it is preserved (but
+# converted to $host format) on output.
+#
+# All path conversion functions are named using the following convention:
+#   file name conversion function    : func_convert_file_X_to_Y ()
+#   path conversion function         : func_convert_path_X_to_Y ()
+# where, for any given $build/$host combination the 'X_to_Y' value is the
+# same.  If conversion functions are added for new $build/$host combinations,
+# the two new functions must follow this pattern, or func_init_to_host_path_cmd
+# will break.
+
+
+# func_init_to_host_path_cmd
+# Ensures that function "pointer" variable $to_host_path_cmd is set to the
+# appropriate value, based on the value of $to_host_file_cmd.
+to_host_path_cmd=
+func_init_to_host_path_cmd ()
+{
+  $opt_debug
+  if test -z "$to_host_path_cmd"; then
+    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
+    to_host_path_cmd="func_convert_path_${func_stripname_result}"
+  fi
+}
+
+
+# func_to_host_path ARG
+# Converts the path ARG from $build format to $host format. Return result
+# in func_to_host_path_result.
+func_to_host_path ()
+{
+  $opt_debug
+  func_init_to_host_path_cmd
+  $to_host_path_cmd "$1"
+}
+# end func_to_host_path
+
+
+# func_convert_path_noop ARG
+# Copy ARG to func_to_host_path_result.
+func_convert_path_noop ()
+{
+  func_to_host_path_result="$1"
+}
+# end func_convert_path_noop
+
+
+# func_convert_path_msys_to_w32 ARG
+# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_path_result.
+func_convert_path_msys_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from ARG.  MSYS
+    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
+    # and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result="$func_convert_core_msys_to_w32_result"
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_msys_to_w32
+
+
+# func_convert_path_cygwin_to_w32 ARG
+# Convert path ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_path_cygwin_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_cygwin_to_w32
+
+
+# func_convert_path_nix_to_w32 ARG
+# Convert path ARG from *nix to w32 format.  Requires a wine environment and
+# a working winepath.  Returns result in func_to_host_file_result.
+func_convert_path_nix_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_nix_to_w32
+
+
+# func_convert_path_msys_to_cygwin ARG
+# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_path_msys_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
+    func_to_host_path_result="$func_cygpath_result"
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
+}
+# end func_convert_path_msys_to_cygwin
+
+
+# func_convert_path_nix_to_cygwin ARG
+# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
+# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
+# func_to_host_file_result.
+func_convert_path_nix_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from
+    # ARG. msys behavior is inconsistent here, cygpath turns them
+    # into '.;' and ';.', and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
+    func_to_host_path_result="$func_cygpath_result"
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
+}
+# end func_convert_path_nix_to_cygwin
+
+
 # func_mode_compile arg...
 func_mode_compile ()
 {
@@ -1144,12 +1986,12 @@ func_mode_compile ()
 	  ;;
 
 	-pie | -fpie | -fPIE)
-          pie_flag="$pie_flag $arg"
+          func_append pie_flag " $arg"
 	  continue
 	  ;;
 
 	-shared | -static | -prefer-pic | -prefer-non-pic)
-	  later="$later $arg"
+	  func_append later " $arg"
 	  continue
 	  ;;
 
@@ -1170,15 +2012,14 @@ func_mode_compile ()
 	  save_ifs="$IFS"; IFS=','
 	  for arg in $args; do
 	    IFS="$save_ifs"
-	    func_quote_for_eval "$arg"
-	    lastarg="$lastarg $func_quote_for_eval_result"
+	    func_append_quoted lastarg "$arg"
 	  done
 	  IFS="$save_ifs"
 	  func_stripname ' ' '' "$lastarg"
 	  lastarg=$func_stripname_result
 
 	  # Add the arguments to base_compile.
-	  base_compile="$base_compile $lastarg"
+	  func_append base_compile " $lastarg"
 	  continue
 	  ;;
 
@@ -1194,8 +2035,7 @@ func_mode_compile ()
       esac    #  case $arg_mode
 
       # Aesthetically quote the previous argument.
-      func_quote_for_eval "$lastarg"
-      base_compile="$base_compile $func_quote_for_eval_result"
+      func_append_quoted base_compile "$lastarg"
     done # for arg
 
     case $arg_mode in
@@ -1220,7 +2060,7 @@ func_mode_compile ()
     *.[cCFSifmso] | \
     *.ada | *.adb | *.ads | *.asm | \
     *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
-    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
+    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
       func_xform "$libobj"
       libobj=$func_xform_result
       ;;
@@ -1295,7 +2135,7 @@ func_mode_compile ()
     # Calculate the filename of the output object if compiler does
     # not support -o with -c
     if test "$compiler_c_o" = no; then
-      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
       lockfile="$output_obj.lock"
     else
       output_obj=
@@ -1326,17 +2166,16 @@ compiler."
 	$opt_dry_run || $RM $removelist
 	exit $EXIT_FAILURE
       fi
-      removelist="$removelist $output_obj"
+      func_append removelist " $output_obj"
       $ECHO "$srcfile" > "$lockfile"
     fi
 
     $opt_dry_run || $RM $removelist
-    removelist="$removelist $lockfile"
+    func_append removelist " $lockfile"
     trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
 
-    if test -n "$fix_srcfile_path"; then
-      eval srcfile=\"$fix_srcfile_path\"
-    fi
+    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
+    srcfile=$func_to_tool_file_result
     func_quote_for_eval "$srcfile"
     qsrcfile=$func_quote_for_eval_result
 
@@ -1356,7 +2195,7 @@ compiler."
 
       if test -z "$output_obj"; then
 	# Place PIC objects in $objdir
-	command="$command -o $lobj"
+	func_append command " -o $lobj"
       fi
 
       func_show_eval_locale "$command"	\
@@ -1403,11 +2242,11 @@ compiler."
 	command="$base_compile $qsrcfile $pic_flag"
       fi
       if test "$compiler_c_o" = yes; then
-	command="$command -o $obj"
+	func_append command " -o $obj"
       fi
 
       # Suppress compiler output if we already did a PIC compilation.
-      command="$command$suppress_output"
+      func_append command "$suppress_output"
       func_show_eval_locale "$command" \
         '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
 
@@ -1452,13 +2291,13 @@ compiler."
 }
 
 $opt_help || {
-test "$mode" = compile && func_mode_compile ${1+"$@"}
+  test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
 }
 
 func_mode_help ()
 {
     # We need to display help for each of the modes.
-    case $mode in
+    case $opt_mode in
       "")
         # Generic help is extracted from the usage comments
         # at the start of this file.
@@ -1489,10 +2328,11 @@ This mode accepts the following additional options:
 
   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
   -no-suppress      do not suppress compiler output for multiple passes
-  -prefer-pic       try to building PIC objects only
-  -prefer-non-pic   try to building non-PIC objects only
+  -prefer-pic       try to build PIC objects only
+  -prefer-non-pic   try to build non-PIC objects only
   -shared           do not build a \`.o' file suitable for static linking
   -static           only build a \`.o' file suitable for static linking
+  -Wc,FLAG          pass FLAG directly to the compiler
 
 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
 from the given SOURCEFILE.
@@ -1545,7 +2385,7 @@ either the \`install' or \`cp' program.
 
 The following components of INSTALL-COMMAND are treated specially:
 
-  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
+  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
 
 The rest of the components are interpreted as arguments to that command (only
 BSD-compatible install options are recognized)."
@@ -1565,6 +2405,8 @@ The following components of LINK-COMMAND are treated specially:
 
   -all-static       do not do any dynamic linking at all
   -avoid-version    do not add a version suffix if possible
+  -bindir BINDIR    specify path to binaries directory (for systems where
+                    libraries must be found in the PATH setting at runtime)
   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
@@ -1593,6 +2435,11 @@ The following components of LINK-COMMAND are treated specially:
   -version-info CURRENT[:REVISION[:AGE]]
                     specify library version info [each variable defaults to 0]
   -weak LIBNAME     declare that the target provides the LIBNAME interface
+  -Wc,FLAG
+  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
+  -Wl,FLAG
+  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
+  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
 
 All other options (arguments beginning with \`-') are ignored.
 
@@ -1626,18 +2473,44 @@ Otherwise, only FILE itself is deleted using RM."
         ;;
 
       *)
-        func_fatal_help "invalid operation mode \`$mode'"
+        func_fatal_help "invalid operation mode \`$opt_mode'"
         ;;
     esac
 
-    $ECHO
+    echo
     $ECHO "Try \`$progname --help' for more information about other modes."
-
-    exit $?
 }
 
-  # Now that we've collected a possible --mode arg, show help if necessary
-  $opt_help && func_mode_help
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+  if test "$opt_help" = :; then
+    func_mode_help
+  else
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+	func_mode_help
+      done
+    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+	echo
+	func_mode_help
+      done
+    } |
+    sed '1d
+      /^When reporting/,/^Report/{
+	H
+	d
+      }
+      $x
+      /information about other modes/d
+      /more detailed .*MODE/d
+      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+  fi
+  exit $?
+fi
 
 
 # func_mode_execute arg...
@@ -1650,13 +2523,16 @@ func_mode_execute ()
       func_fatal_help "you must specify a COMMAND"
 
     # Handle -dlopen flags immediately.
-    for file in $execute_dlfiles; do
+    for file in $opt_dlopen; do
       test -f "$file" \
 	|| func_fatal_help "\`$file' is not a file"
 
       dir=
       case $file in
       *.la)
+	func_resolve_sysroot "$file"
+	file=$func_resolve_sysroot_result
+
 	# Check to see that this really is a libtool archive.
 	func_lalib_unsafe_p "$file" \
 	  || func_fatal_help "\`$lib' is not a valid libtool archive"
@@ -1678,7 +2554,7 @@ func_mode_execute ()
 	dir="$func_dirname_result"
 
 	if test -f "$dir/$objdir/$dlname"; then
-	  dir="$dir/$objdir"
+	  func_append dir "/$objdir"
 	else
 	  if test ! -f "$dir/$dlname"; then
 	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
@@ -1719,7 +2595,7 @@ func_mode_execute ()
     for file
     do
       case $file in
-      -*) ;;
+      -* | *.la | *.lo ) ;;
       *)
 	# Do a test to see if this is really a libtool program.
 	if func_ltwrapper_script_p "$file"; then
@@ -1735,8 +2611,7 @@ func_mode_execute ()
 	;;
       esac
       # Quote arguments (to preserve shell metacharacters).
-      func_quote_for_eval "$file"
-      args="$args $func_quote_for_eval_result"
+      func_append_quoted args "$file"
     done
 
     if test "X$opt_dry_run" = Xfalse; then
@@ -1761,29 +2636,66 @@ func_mode_execute ()
       # Display what would be done.
       if test -n "$shlibpath_var"; then
 	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
-	$ECHO "export $shlibpath_var"
+	echo "export $shlibpath_var"
       fi
       $ECHO "$cmd$args"
       exit $EXIT_SUCCESS
     fi
 }
 
-test "$mode" = execute && func_mode_execute ${1+"$@"}
+test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
 
 
 # func_mode_finish arg...
 func_mode_finish ()
 {
     $opt_debug
-    libdirs="$nonopt"
+    libs=
+    libdirs=
     admincmds=
 
-    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
-      for dir
-      do
-	libdirs="$libdirs $dir"
-      done
+    for opt in "$nonopt" ${1+"$@"}
+    do
+      if test -d "$opt"; then
+	func_append libdirs " $opt"
+
+      elif test -f "$opt"; then
+	if func_lalib_unsafe_p "$opt"; then
+	  func_append libs " $opt"
+	else
+	  func_warning "\`$opt' is not a valid libtool archive"
+	fi
+
+      else
+	func_fatal_error "invalid argument \`$opt'"
+      fi
+    done
+
+    if test -n "$libs"; then
+      if test -n "$lt_sysroot"; then
+        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
+        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
+      else
+        sysroot_cmd=
+      fi
 
+      # Remove sysroot references
+      if $opt_dry_run; then
+        for lib in $libs; do
+          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
+        done
+      else
+        tmpdir=`func_mktempdir`
+        for lib in $libs; do
+	  sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+	    > $tmpdir/tmp-la
+	  mv -f $tmpdir/tmp-la $lib
+	done
+        ${RM}r "$tmpdir"
+      fi
+    fi
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
       for libdir in $libdirs; do
 	if test -n "$finish_cmds"; then
 	  # Do each command in the finish commands.
@@ -1793,7 +2705,7 @@ func_mode_finish ()
 	if test -n "$finish_eval"; then
 	  # Do the single finish_eval.
 	  eval cmds=\"$finish_eval\"
-	  $opt_dry_run || eval "$cmds" || admincmds="$admincmds
+	  $opt_dry_run || eval "$cmds" || func_append admincmds "
        $cmds"
 	fi
       done
@@ -1802,53 +2714,55 @@ func_mode_finish ()
     # Exit here if they wanted silent mode.
     $opt_silent && exit $EXIT_SUCCESS
 
-    $ECHO "X----------------------------------------------------------------------" | $Xsed
-    $ECHO "Libraries have been installed in:"
-    for libdir in $libdirs; do
-      $ECHO "   $libdir"
-    done
-    $ECHO
-    $ECHO "If you ever happen to want to link against installed libraries"
-    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
-    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
-    $ECHO "flag during linking and do at least one of the following:"
-    if test -n "$shlibpath_var"; then
-      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
-      $ECHO "     during execution"
-    fi
-    if test -n "$runpath_var"; then
-      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
-      $ECHO "     during linking"
-    fi
-    if test -n "$hardcode_libdir_flag_spec"; then
-      libdir=LIBDIR
-      eval flag=\"$hardcode_libdir_flag_spec\"
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      echo "----------------------------------------------------------------------"
+      echo "Libraries have been installed in:"
+      for libdir in $libdirs; do
+	$ECHO "   $libdir"
+      done
+      echo
+      echo "If you ever happen to want to link against installed libraries"
+      echo "in a given directory, LIBDIR, you must either use libtool, and"
+      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+      echo "flag during linking and do at least one of the following:"
+      if test -n "$shlibpath_var"; then
+	echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+	echo "     during execution"
+      fi
+      if test -n "$runpath_var"; then
+	echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+	echo "     during linking"
+      fi
+      if test -n "$hardcode_libdir_flag_spec"; then
+	libdir=LIBDIR
+	eval flag=\"$hardcode_libdir_flag_spec\"
+
+	$ECHO "   - use the \`$flag' linker flag"
+      fi
+      if test -n "$admincmds"; then
+	$ECHO "   - have your system administrator run these commands:$admincmds"
+      fi
+      if test -f /etc/ld.so.conf; then
+	echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+      fi
+      echo
 
-      $ECHO "   - use the \`$flag' linker flag"
-    fi
-    if test -n "$admincmds"; then
-      $ECHO "   - have your system administrator run these commands:$admincmds"
-    fi
-    if test -f /etc/ld.so.conf; then
-      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+      echo "See any operating system documentation about shared libraries for"
+      case $host in
+	solaris2.[6789]|solaris2.1[0-9])
+	  echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+	  echo "pages."
+	  ;;
+	*)
+	  echo "more information, such as the ld(1) and ld.so(8) manual pages."
+	  ;;
+      esac
+      echo "----------------------------------------------------------------------"
     fi
-    $ECHO
-
-    $ECHO "See any operating system documentation about shared libraries for"
-    case $host in
-      solaris2.[6789]|solaris2.1[0-9])
-        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
-	$ECHO "pages."
-	;;
-      *)
-        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
-        ;;
-    esac
-    $ECHO "X----------------------------------------------------------------------" | $Xsed
     exit $EXIT_SUCCESS
 }
 
-test "$mode" = finish && func_mode_finish ${1+"$@"}
+test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
 
 
 # func_mode_install arg...
@@ -1859,7 +2773,7 @@ func_mode_install ()
     # install_prog (especially on Windows NT).
     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
        # Allow the use of GNU shtool's install command.
-       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
+       case $nonopt in *shtool*) :;; *) false;; esac; then
       # Aesthetically quote it.
       func_quote_for_eval "$nonopt"
       install_prog="$func_quote_for_eval_result "
@@ -1873,7 +2787,12 @@ func_mode_install ()
     # The real first argument should be the name of the installation program.
     # Aesthetically quote it.
     func_quote_for_eval "$arg"
-    install_prog="$install_prog$func_quote_for_eval_result"
+    func_append install_prog "$func_quote_for_eval_result"
+    install_shared_prog=$install_prog
+    case " $install_prog " in
+      *[\\\ /]cp\ *) install_cp=: ;;
+      *) install_cp=false ;;
+    esac
 
     # We need to accept at least all the BSD install flags.
     dest=
@@ -1883,10 +2802,12 @@ func_mode_install ()
     install_type=
     isdir=no
     stripme=
+    no_mode=:
     for arg
     do
+      arg2=
       if test -n "$dest"; then
-	files="$files $dest"
+	func_append files " $dest"
 	dest=$arg
 	continue
       fi
@@ -1894,10 +2815,9 @@ func_mode_install ()
       case $arg in
       -d) isdir=yes ;;
       -f)
-	case " $install_prog " in
-	*[\\\ /]cp\ *) ;;
-	*) prev=$arg ;;
-	esac
+	if $install_cp; then :; else
+	  prev=$arg
+	fi
 	;;
       -g | -m | -o)
 	prev=$arg
@@ -1911,6 +2831,10 @@ func_mode_install ()
       *)
 	# If the previous option needed an argument, then skip it.
 	if test -n "$prev"; then
+	  if test "x$prev" = x-m && test -n "$install_override_mode"; then
+	    arg2=$install_override_mode
+	    no_mode=false
+	  fi
 	  prev=
 	else
 	  dest=$arg
@@ -1921,7 +2845,11 @@ func_mode_install ()
 
       # Aesthetically quote the argument.
       func_quote_for_eval "$arg"
-      install_prog="$install_prog $func_quote_for_eval_result"
+      func_append install_prog " $func_quote_for_eval_result"
+      if test -n "$arg2"; then
+	func_quote_for_eval "$arg2"
+      fi
+      func_append install_shared_prog " $func_quote_for_eval_result"
     done
 
     test -z "$install_prog" && \
@@ -1930,6 +2858,13 @@ func_mode_install ()
     test -n "$prev" && \
       func_fatal_help "the \`$prev' option requires an argument"
 
+    if test -n "$install_override_mode" && $no_mode; then
+      if $install_cp; then :; else
+	func_quote_for_eval "$install_override_mode"
+	func_append install_shared_prog " -m $func_quote_for_eval_result"
+      fi
+    fi
+
     if test -z "$files"; then
       if test -z "$dest"; then
 	func_fatal_help "no file or destination specified"
@@ -1984,10 +2919,13 @@ func_mode_install ()
       case $file in
       *.$libext)
 	# Do the static libraries later.
-	staticlibs="$staticlibs $file"
+	func_append staticlibs " $file"
 	;;
 
       *.la)
+	func_resolve_sysroot "$file"
+	file=$func_resolve_sysroot_result
+
 	# Check to see that this really is a libtool archive.
 	func_lalib_unsafe_p "$file" \
 	  || func_fatal_help "\`$file' is not a valid libtool archive"
@@ -2001,23 +2939,23 @@ func_mode_install ()
 	if test "X$destdir" = "X$libdir"; then
 	  case "$current_libdirs " in
 	  *" $libdir "*) ;;
-	  *) current_libdirs="$current_libdirs $libdir" ;;
+	  *) func_append current_libdirs " $libdir" ;;
 	  esac
 	else
 	  # Note the libdir as a future libdir.
 	  case "$future_libdirs " in
 	  *" $libdir "*) ;;
-	  *) future_libdirs="$future_libdirs $libdir" ;;
+	  *) func_append future_libdirs " $libdir" ;;
 	  esac
 	fi
 
 	func_dirname "$file" "/" ""
 	dir="$func_dirname_result"
-	dir="$dir$objdir"
+	func_append dir "$objdir"
 
 	if test -n "$relink_command"; then
 	  # Determine the prefix the user has applied to our future dir.
-	  inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
+	  inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
 
 	  # Don't allow the user to place us outside of our expected
 	  # location b/c this prevents finding dependent libraries that
@@ -2030,9 +2968,9 @@ func_mode_install ()
 
 	  if test -n "$inst_prefix_dir"; then
 	    # Stick the inst_prefix_dir data into the link command.
-	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 	  else
-	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
+	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 	  fi
 
 	  func_warning "relinking \`$file'"
@@ -2050,7 +2988,7 @@ func_mode_install ()
 	  test -n "$relink_command" && srcname="$realname"T
 
 	  # Install the shared library and build the symlinks.
-	  func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
+	  func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
 	      'exit $?'
 	  tstripme="$stripme"
 	  case $host_os in
@@ -2090,7 +3028,7 @@ func_mode_install ()
 	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
 
 	# Maybe install the static library, too.
-	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+	test -n "$old_library" && func_append staticlibs " $dir/$old_library"
 	;;
 
       *.lo)
@@ -2190,7 +3128,7 @@ func_mode_install ()
 	    if test -f "$lib"; then
 	      func_source "$lib"
 	    fi
-	    libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
 	    if test -n "$libdir" && test ! -f "$libfile"; then
 	      func_warning "\`$lib' has not been installed in \`$libdir'"
 	      finalize=no
@@ -2209,7 +3147,7 @@ func_mode_install ()
 		file="$func_basename_result"
 	        outputname="$tmpdir/$file"
 	        # Replace the output file specification.
-	        relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+	        relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
 
 	        $opt_silent || {
 	          func_quote_for_expand "$relink_command"
@@ -2228,7 +3166,7 @@ func_mode_install ()
 	    }
 	  else
 	    # Install the binary that we compiled earlier.
-	    file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+	    file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
 	  fi
 	fi
 
@@ -2264,11 +3202,13 @@ func_mode_install ()
 
       # Set up the ranlib parameters.
       oldlib="$destdir/$name"
+      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+      tool_oldlib=$func_to_tool_file_result
 
       func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
 
       if test -n "$stripme" && test -n "$old_striplib"; then
-	func_show_eval "$old_striplib $oldlib" 'exit $?'
+	func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
       fi
 
       # Do each command in the postinstall commands.
@@ -2287,7 +3227,7 @@ func_mode_install ()
     fi
 }
 
-test "$mode" = install && func_mode_install ${1+"$@"}
+test "$opt_mode" = install && func_mode_install ${1+"$@"}
 
 
 # func_generate_dlsyms outputname originator pic_p
@@ -2330,6 +3270,22 @@ func_generate_dlsyms ()
 extern \"C\" {
 #endif
 
+#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+#endif
+
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
 /* External symbol declarations for the compiler. */\
 "
 
@@ -2339,10 +3295,11 @@ extern \"C\" {
 	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
 
 	  # Add our own program objects to the symbol list.
-	  progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	  progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
 	  for progfile in $progfiles; do
-	    func_verbose "extracting global C symbols from \`$progfile'"
-	    $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
+	    func_to_tool_file "$progfile" func_convert_file_msys_to_w32
+	    func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
+	    $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
 	  done
 
 	  if test -n "$exclude_expsyms"; then
@@ -2378,7 +3335,7 @@ extern \"C\" {
 	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
 	      eval '$MV "$nlist"T "$nlist"'
 	      case $host in
-	        *cygwin | *mingw* | *cegcc* )
+	        *cygwin* | *mingw* | *cegcc* )
 	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 	          ;;
@@ -2391,10 +3348,52 @@ extern \"C\" {
 	  func_verbose "extracting global C symbols from \`$dlprefile'"
 	  func_basename "$dlprefile"
 	  name="$func_basename_result"
-	  $opt_dry_run || {
-	    eval '$ECHO ": $name " >> "$nlist"'
-	    eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
-	  }
+          case $host in
+	    *cygwin* | *mingw* | *cegcc* )
+	      # if an import library, we need to obtain dlname
+	      if func_win32_import_lib_p "$dlprefile"; then
+	        func_tr_sh "$dlprefile"
+	        eval "curr_lafile=\$libfile_$func_tr_sh_result"
+	        dlprefile_dlbasename=""
+	        if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
+	          # Use subshell, to avoid clobbering current variable values
+	          dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
+	          if test -n "$dlprefile_dlname" ; then
+	            func_basename "$dlprefile_dlname"
+	            dlprefile_dlbasename="$func_basename_result"
+	          else
+	            # no lafile. user explicitly requested -dlpreopen <import library>.
+	            $sharedlib_from_linklib_cmd "$dlprefile"
+	            dlprefile_dlbasename=$sharedlib_from_linklib_result
+	          fi
+	        fi
+	        $opt_dry_run || {
+	          if test -n "$dlprefile_dlbasename" ; then
+	            eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
+	          else
+	            func_warning "Could not compute DLL name from $name"
+	            eval '$ECHO ": $name " >> "$nlist"'
+	          fi
+	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
+	            $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
+	        }
+	      else # not an import lib
+	        $opt_dry_run || {
+	          eval '$ECHO ": $name " >> "$nlist"'
+	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	        }
+	      fi
+	    ;;
+	    *)
+	      $opt_dry_run || {
+	        eval '$ECHO ": $name " >> "$nlist"'
+	        func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	        eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	      }
+	    ;;
+          esac
 	done
 
 	$opt_dry_run || {
@@ -2422,36 +3421,19 @@ extern \"C\" {
 	  if test -f "$nlist"S; then
 	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
 	  else
-	    $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
+	    echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
 	  fi
 
-	  $ECHO >> "$output_objdir/$my_dlsyms" "\
+	  echo >> "$output_objdir/$my_dlsyms" "\
 
 /* The mapping between symbol names and symbols.  */
 typedef struct {
   const char *name;
   void *address;
 } lt_dlsymlist;
-"
-	  case $host in
-	  *cygwin* | *mingw* | *cegcc* )
-	    $ECHO >> "$output_objdir/$my_dlsyms" "\
-/* DATA imports from DLLs on WIN32 con't be const, because
-   runtime relocations are performed -- see ld's documentation
-   on pseudo-relocs.  */"
-	    lt_dlsym_const= ;;
-	  *osf5*)
-	    echo >> "$output_objdir/$my_dlsyms" "\
-/* This system does not cope well with relocations in const data */"
-	    lt_dlsym_const= ;;
-	  *)
-	    lt_dlsym_const=const ;;
-	  esac
-
-	  $ECHO >> "$output_objdir/$my_dlsyms" "\
-extern $lt_dlsym_const lt_dlsymlist
+extern LT_DLSYM_CONST lt_dlsymlist
 lt_${my_prefix}_LTX_preloaded_symbols[];
-$lt_dlsym_const lt_dlsymlist
+LT_DLSYM_CONST lt_dlsymlist
 lt_${my_prefix}_LTX_preloaded_symbols[] =
 {\
   { \"$my_originator\", (void *) 0 },"
@@ -2464,7 +3446,7 @@ lt_${my_prefix}_LTX_preloaded_symbols[] =
 	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
 	    ;;
 	  esac
-	  $ECHO >> "$output_objdir/$my_dlsyms" "\
+	  echo >> "$output_objdir/$my_dlsyms" "\
   {0, (void *) 0}
 };
 
@@ -2491,7 +3473,7 @@ static const void *lt_preloaded_setup() {
 	  # linked before any other PIC object.  But we must not use
 	  # pic_flag when linking with -static.  The problem exists in
 	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
-	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	  *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
 	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
 	  *-*-hpux*)
 	    pic_flag_for_symtable=" $pic_flag"  ;;
@@ -2507,7 +3489,7 @@ static const void *lt_preloaded_setup() {
 	for arg in $LTCFLAGS; do
 	  case $arg in
 	  -pie | -fpie | -fPIE) ;;
-	  *) symtab_cflags="$symtab_cflags $arg" ;;
+	  *) func_append symtab_cflags " $arg" ;;
 	  esac
 	done
 
@@ -2522,16 +3504,16 @@ static const void *lt_preloaded_setup() {
 	case $host in
 	*cygwin* | *mingw* | *cegcc* )
 	  if test -f "$output_objdir/$my_outputname.def"; then
-	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
-	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
 	  else
-	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 	  fi
 	  ;;
 	*)
-	  compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-	  finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	  compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 	  ;;
 	esac
 	;;
@@ -2545,8 +3527,8 @@ static const void *lt_preloaded_setup() {
       # really was required.
 
       # Nullify the symbol file.
-      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
-      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
+      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
     fi
 }
 
@@ -2556,6 +3538,7 @@ static const void *lt_preloaded_setup() {
 # Need a lot of goo to handle *both* DLLs and import libs
 # Has to be a shell function in order to 'eat' the argument
 # that is supplied when $file_magic_command is called.
+# Despite the name, also deal with 64 bit binaries.
 func_win32_libid ()
 {
   $opt_debug
@@ -2566,9 +3549,11 @@ func_win32_libid ()
     win32_libid_type="x86 archive import"
     ;;
   *ar\ archive*) # could be an import, or static
+    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
-       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
-      win32_nmres=`eval $NM -f posix -A $1 |
+       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+      func_to_tool_file "$1" func_convert_file_msys_to_w32
+      win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
 	$SED -n -e '
 	    1,100{
 		/ I /{
@@ -2597,6 +3582,131 @@ func_win32_libid ()
   $ECHO "$win32_libid_type"
 }
 
+# func_cygming_dll_for_implib ARG
+#
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib ()
+{
+  $opt_debug
+  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
+}
+
+# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
+#
+# The is the core of a fallback implementation of a
+# platform-specific function to extract the name of the
+# DLL associated with the specified import library LIBNAME.
+#
+# SECTION_NAME is either .idata$6 or .idata$7, depending
+# on the platform and compiler that created the implib.
+#
+# Echos the name of the DLL associated with the
+# specified import library.
+func_cygming_dll_for_implib_fallback_core ()
+{
+  $opt_debug
+  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
+  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
+    $SED '/^Contents of section '"$match_literal"':/{
+      # Place marker at beginning of archive member dllname section
+      s/.*/====MARK====/
+      p
+      d
+    }
+    # These lines can sometimes be longer than 43 characters, but
+    # are always uninteresting
+    /:[	 ]*file format pe[i]\{,1\}-/d
+    /^In archive [^:]*:/d
+    # Ensure marker is printed
+    /^====MARK====/p
+    # Remove all lines with less than 43 characters
+    /^.\{43\}/!d
+    # From remaining lines, remove first 43 characters
+    s/^.\{43\}//' |
+    $SED -n '
+      # Join marker and all lines until next marker into a single line
+      /^====MARK====/ b para
+      H
+      $ b para
+      b
+      :para
+      x
+      s/\n//g
+      # Remove the marker
+      s/^====MARK====//
+      # Remove trailing dots and whitespace
+      s/[\. \t]*$//
+      # Print
+      /./p' |
+    # we now have a list, one entry per line, of the stringified
+    # contents of the appropriate section of all members of the
+    # archive which possess that section. Heuristic: eliminate
+    # all those which have a first or second character that is
+    # a '.' (that is, objdump's representation of an unprintable
+    # character.) This should work for all archives with less than
+    # 0x302f exports -- but will fail for DLLs whose name actually
+    # begins with a literal '.' or a single character followed by
+    # a '.'.
+    #
+    # Of those that remain, print the first one.
+    $SED -e '/^\./d;/^.\./d;q'
+}
+
+# func_cygming_gnu_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is a GNU/binutils-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_gnu_implib_p ()
+{
+  $opt_debug
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
+  test -n "$func_cygming_gnu_implib_tmp"
+}
+
+# func_cygming_ms_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is an MS-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_ms_implib_p ()
+{
+  $opt_debug
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
+  test -n "$func_cygming_ms_implib_tmp"
+}
+
+# func_cygming_dll_for_implib_fallback ARG
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+#
+# This fallback implementation is for use when $DLLTOOL
+# does not support the --identify-strict option.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib_fallback ()
+{
+  $opt_debug
+  if func_cygming_gnu_implib_p "$1" ; then
+    # binutils import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
+  elif func_cygming_ms_implib_p "$1" ; then
+    # ms-generated import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
+  else
+    # unknown
+    sharedlib_from_linklib_result=""
+  fi
+}
 
 
 # func_extract_an_archive dir oldlib
@@ -2605,7 +3715,18 @@ func_extract_an_archive ()
     $opt_debug
     f_ex_an_ar_dir="$1"; shift
     f_ex_an_ar_oldlib="$1"
-    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
+    if test "$lock_old_archive_extraction" = yes; then
+      lockfile=$f_ex_an_ar_oldlib.lock
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+	func_echo "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    fi
+    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
+		   'stat=$?; rm -f "$lockfile"; exit $stat'
+    if test "$lock_old_archive_extraction" = yes; then
+      $opt_dry_run || rm -f "$lockfile"
+    fi
     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
      :
     else
@@ -2676,7 +3797,7 @@ func_extract_archives ()
 	    darwin_file=
 	    darwin_files=
 	    for darwin_file in $darwin_filelist; do
-	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
 	      $LIPO -create -output "$darwin_file" $darwin_files
 	    done # $darwin_filelist
 	    $RM -rf unfat-$$
@@ -2691,25 +3812,30 @@ func_extract_archives ()
         func_extract_an_archive "$my_xdir" "$my_xabs"
 	;;
       esac
-      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
     done
 
     func_extract_archives_result="$my_oldobjs"
 }
 
 
-
-# func_emit_wrapper_part1 [arg=no]
+# func_emit_wrapper [arg=no]
 #
-# Emit the first part of a libtool wrapper script on stdout.
-# For more information, see the description associated with
-# func_emit_wrapper(), below.
-func_emit_wrapper_part1 ()
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable.  Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take.  If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory.  This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
 {
-	func_emit_wrapper_part1_arg1=no
-	if test -n "$1" ; then
-	  func_emit_wrapper_part1_arg1=$1
-	fi
+	func_emit_wrapper_arg1=${1-no}
 
 	$ECHO "\
 #! $SHELL
@@ -2725,7 +3851,6 @@ func_emit_wrapper_part1 ()
 
 # Sed substitution that helps us do robust quoting.  It backslashifies
 # metacharacters that are still active within double-quoted strings.
-Xsed='${SED} -e 1s/^X//'
 sed_quote_subst='$sed_quote_subst'
 
 # Be Bourne compatible
@@ -2756,31 +3881,135 @@ if test \"\$libtool_install_magic\" = \"$magic\"; then
 else
   # When we are sourced in execute mode, \$file and \$ECHO are already set.
   if test \"\$libtool_execute_magic\" != \"$magic\"; then
-    ECHO=\"$qecho\"
-    file=\"\$0\"
-    # Make sure echo works.
-    if test \"X\$1\" = X--no-reexec; then
-      # Discard the --no-reexec flag, and continue.
-      shift
-    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
-      # Yippee, \$ECHO works!
-      :
-    else
-      # Restart under the correct shell, and then maybe \$ECHO will work.
-      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
-    fi
-  fi\
+    file=\"\$0\""
+
+    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
+    $ECHO "\
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+    ECHO=\"$qECHO\"
+  fi
+
+# Very basic option parsing. These options are (a) specific to
+# the libtool wrapper, (b) are identical between the wrapper
+# /script/ and the wrapper /executable/ which is used only on
+# windows platforms, and (c) all begin with the string "--lt-"
+# (application programs are unlikely to have options which match
+# this pattern).
+#
+# There are only two supported options: --lt-debug and
+# --lt-dump-script. There is, deliberately, no --lt-help.
+#
+# The first argument to this parsing function should be the
+# script's $0 value, followed by "$@".
+lt_option_debug=
+func_parse_lt_options ()
+{
+  lt_script_arg0=\$0
+  shift
+  for lt_opt
+  do
+    case \"\$lt_opt\" in
+    --lt-debug) lt_option_debug=1 ;;
+    --lt-dump-script)
+        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
+        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
+        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
+        cat \"\$lt_dump_D/\$lt_dump_F\"
+        exit 0
+      ;;
+    --lt-*)
+        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
+        exit 1
+      ;;
+    esac
+  done
+
+  # Print the debug banner immediately:
+  if test -n \"\$lt_option_debug\"; then
+    echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+  fi
+}
+
+# Used when --lt-debug. Prints its arguments to stdout
+# (redirection is the responsibility of the caller)
+func_lt_dump_args ()
+{
+  lt_dump_args_N=1;
+  for lt_arg
+  do
+    \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
+    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
+  done
+}
+
+# Core function for launching the target application
+func_exec_program_core ()
+{
 "
-	$ECHO "\
+  case $host in
+  # Backslashes separate directories on plain windows
+  *-*-mingw | *-*-os2* | *-cegcc*)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+    ;;
+
+  *)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+    ;;
+  esac
+  $ECHO "\
+      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+      exit 1
+}
+
+# A function to encapsulate launching the target application
+# Strips options in the --lt-* namespace from \$@ and
+# launches target application with the remaining arguments.
+func_exec_program ()
+{
+  case \" \$* \" in
+  *\\ --lt-*)
+    for lt_wr_arg
+    do
+      case \$lt_wr_arg in
+      --lt-*) ;;
+      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+      esac
+      shift
+    done ;;
+  esac
+  func_exec_program_core \${1+\"\$@\"}
+}
+
+  # Parse options
+  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
 
   # Find the directory that this script lives in.
-  thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
 
   # Follow symbolic links until we get to the real thisdir.
-  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
   while test -n \"\$file\"; do
-    destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
 
     # If there was a directory component, then change thisdir.
     if test \"x\$destdir\" != \"x\$file\"; then
@@ -2790,30 +4019,13 @@ else
       esac
     fi
 
-    file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
-    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
   done
-"
-}
-# end: func_emit_wrapper_part1
-
-# func_emit_wrapper_part2 [arg=no]
-#
-# Emit the second part of a libtool wrapper script on stdout.
-# For more information, see the description associated with
-# func_emit_wrapper(), below.
-func_emit_wrapper_part2 ()
-{
-	func_emit_wrapper_part2_arg1=no
-	if test -n "$1" ; then
-	  func_emit_wrapper_part2_arg1=$1
-	fi
-
-	$ECHO "\
 
   # Usually 'no', except on cygwin/mingw when embedded into
   # the cwrapper.
-  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
   if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
     # special case for '.'
     if test \"\$thisdir\" = \".\"; then
@@ -2821,7 +4033,7 @@ func_emit_wrapper_part2 ()
     fi
     # remove .libs from thisdir
     case \"\$thisdir\" in
-    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
+    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
     $objdir )   thisdir=. ;;
     esac
   fi
@@ -2876,6 +4088,18 @@ func_emit_wrapper_part2 ()
 
   if test -f \"\$progdir/\$program\"; then"
 
+	# fixup the dll searchpath if we need to.
+	#
+	# Fix the DLL searchpath if we need to.  Do this before prepending
+	# to shlibpath, because on Windows, both are PATH and uninstalled
+	# libraries must come first.
+	if test -n "$dllsearchpath"; then
+	  $ECHO "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
 	# Export our shlibpath_var if we have one.
 	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
 	  $ECHO "\
@@ -2884,254 +4108,29 @@ func_emit_wrapper_part2 ()
 
     # Some systems cannot cope with colon-terminated $shlibpath_var
     # The second colon is a workaround for a bug in BeOS R4 sed
-    $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
 
     export $shlibpath_var
 "
 	fi
 
-	# fixup the dll searchpath if we need to.
-	if test -n "$dllsearchpath"; then
-	  $ECHO "\
-    # Add the dll search path components to the executable PATH
-    PATH=$dllsearchpath:\$PATH
-"
-	fi
-
 	$ECHO "\
     if test \"\$libtool_execute_magic\" != \"$magic\"; then
       # Run the actual program with our arguments.
-"
-	case $host in
-	# Backslashes separate directories on plain windows
-	*-*-mingw | *-*-os2* | *-cegcc*)
-	  $ECHO "\
-      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
-	  ;;
-
-	*)
-	  $ECHO "\
-      exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
-	  ;;
-	esac
-	$ECHO "\
-      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
-      exit 1
+      func_exec_program \${1+\"\$@\"}
     fi
   else
     # The program doesn't exist.
     \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
     \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
-    $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
     exit 1
   fi
 fi\
 "
 }
-# end: func_emit_wrapper_part2
 
 
-# func_emit_wrapper [arg=no]
-#
-# Emit a libtool wrapper script on stdout.
-# Don't directly open a file because we may want to
-# incorporate the script contents within a cygwin/mingw
-# wrapper executable.  Must ONLY be called from within
-# func_mode_link because it depends on a number of variables
-# set therein.
-#
-# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
-# variable will take.  If 'yes', then the emitted script
-# will assume that the directory in which it is stored is
-# the $objdir directory.  This is a cygwin/mingw-specific
-# behavior.
-func_emit_wrapper ()
-{
-	func_emit_wrapper_arg1=no
-	if test -n "$1" ; then
-	  func_emit_wrapper_arg1=$1
-	fi
-
-	# split this up so that func_emit_cwrapperexe_src
-	# can call each part independently.
-	func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
-	func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
-}
-
-
-# func_to_host_path arg
-#
-# Convert paths to host format when used with build tools.
-# Intended for use with "native" mingw (where libtool itself
-# is running under the msys shell), or in the following cross-
-# build environments:
-#    $build          $host
-#    mingw (msys)    mingw  [e.g. native]
-#    cygwin          mingw
-#    *nix + wine     mingw
-# where wine is equipped with the `winepath' executable.
-# In the native mingw case, the (msys) shell automatically
-# converts paths for any non-msys applications it launches,
-# but that facility isn't available from inside the cwrapper.
-# Similar accommodations are necessary for $host mingw and
-# $build cygwin.  Calling this function does no harm for other
-# $host/$build combinations not listed above.
-#
-# ARG is the path (on $build) that should be converted to
-# the proper representation for $host. The result is stored
-# in $func_to_host_path_result.
-func_to_host_path ()
-{
-  func_to_host_path_result="$1"
-  if test -n "$1" ; then
-    case $host in
-      *mingw* )
-        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
-        case $build in
-          *mingw* ) # actually, msys
-            # awkward: cmd appends spaces to result
-            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
-            func_to_host_path_tmp1=`( cmd //c echo "$1" |\
-              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
-            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          *cygwin* )
-            func_to_host_path_tmp1=`cygpath -w "$1"`
-            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          * )
-            # Unfortunately, winepath does not exit with a non-zero
-            # error code, so we are forced to check the contents of
-            # stdout. On the other hand, if the command is not
-            # found, the shell will set an exit code of 127 and print
-            # *an error message* to stdout. So we must check for both
-            # error code of zero AND non-empty stdout, which explains
-            # the odd construction:
-            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
-            if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
-              func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
-                $SED -e "$lt_sed_naive_backslashify"`
-            else
-              # Allow warning below.
-              func_to_host_path_result=""
-            fi
-            ;;
-        esac
-        if test -z "$func_to_host_path_result" ; then
-          func_error "Could not determine host path corresponding to"
-          func_error "  '$1'"
-          func_error "Continuing, but uninstalled executables may not work."
-          # Fallback:
-          func_to_host_path_result="$1"
-        fi
-        ;;
-    esac
-  fi
-}
-# end: func_to_host_path
-
-# func_to_host_pathlist arg
-#
-# Convert pathlists to host format when used with build tools.
-# See func_to_host_path(), above. This function supports the
-# following $build/$host combinations (but does no harm for
-# combinations not listed here):
-#    $build          $host
-#    mingw (msys)    mingw  [e.g. native]
-#    cygwin          mingw
-#    *nix + wine     mingw
-#
-# Path separators are also converted from $build format to
-# $host format. If ARG begins or ends with a path separator
-# character, it is preserved (but converted to $host format)
-# on output.
-#
-# ARG is a pathlist (on $build) that should be converted to
-# the proper representation on $host. The result is stored
-# in $func_to_host_pathlist_result.
-func_to_host_pathlist ()
-{
-  func_to_host_pathlist_result="$1"
-  if test -n "$1" ; then
-    case $host in
-      *mingw* )
-        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
-        # Remove leading and trailing path separator characters from
-        # ARG. msys behavior is inconsistent here, cygpath turns them
-        # into '.;' and ';.', and winepath ignores them completely.
-        func_to_host_pathlist_tmp2="$1"
-        # Once set for this call, this variable should not be
-        # reassigned. It is used in tha fallback case.
-        func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
-          $SED -e 's|^:*||' -e 's|:*$||'`
-        case $build in
-          *mingw* ) # Actually, msys.
-            # Awkward: cmd appends spaces to result.
-            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
-            func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
-              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
-            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          *cygwin* )
-            func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
-            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          * )
-            # unfortunately, winepath doesn't convert pathlists
-            func_to_host_pathlist_result=""
-            func_to_host_pathlist_oldIFS=$IFS
-            IFS=:
-            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
-              IFS=$func_to_host_pathlist_oldIFS
-              if test -n "$func_to_host_pathlist_f" ; then
-                func_to_host_path "$func_to_host_pathlist_f"
-                if test -n "$func_to_host_path_result" ; then
-                  if test -z "$func_to_host_pathlist_result" ; then
-                    func_to_host_pathlist_result="$func_to_host_path_result"
-                  else
-                    func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
-                  fi
-                fi
-              fi
-              IFS=:
-            done
-            IFS=$func_to_host_pathlist_oldIFS
-            ;;
-        esac
-        if test -z "$func_to_host_pathlist_result" ; then
-          func_error "Could not determine the host path(s) corresponding to"
-          func_error "  '$1'"
-          func_error "Continuing, but uninstalled executables may not work."
-          # Fallback. This may break if $1 contains DOS-style drive
-          # specifications. The fix is not to complicate the expression
-          # below, but for the user to provide a working wine installation
-          # with winepath so that path translation in the cross-to-mingw
-          # case works properly.
-          lt_replace_pathsep_nix_to_dos="s|:|;|g"
-          func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
-            $SED -e "$lt_replace_pathsep_nix_to_dos"`
-        fi
-        # Now, add the leading and trailing path separators back
-        case "$1" in
-          :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
-            ;;
-        esac
-        case "$1" in
-          *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
-            ;;
-        esac
-        ;;
-    esac
-  fi
-}
-# end: func_to_host_pathlist
-
 # func_emit_cwrapperexe_src
 # emit the source code for a wrapper executable on stdout
 # Must ONLY be called from within func_mode_link because
@@ -3148,31 +4147,23 @@ func_emit_cwrapperexe_src ()
 
    This wrapper executable should never be moved out of the build directory.
    If it is, it will not operate correctly.
-
-   Currently, it simply execs the wrapper *script* "$SHELL $output",
-   but could eventually absorb all of the scripts functionality and
-   exec $objdir/$outputname directly.
 */
 EOF
 	    cat <<"EOF"
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_DEPRECATE 1
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #ifdef _MSC_VER
 # include <direct.h>
 # include <process.h>
 # include <io.h>
-# define setmode _setmode
 #else
 # include <unistd.h>
 # include <stdint.h>
 # ifdef __CYGWIN__
 #  include <io.h>
-#  define HAVE_SETENV
-#  ifdef __STRICT_ANSI__
-char *realpath (const char *, char *);
-int putenv (char *);
-int setenv (const char *, const char *, int);
-#  endif
 # endif
 #endif
 #include <malloc.h>
@@ -3184,6 +4175,44 @@ int setenv (const char *, const char *, int);
 #include <fcntl.h>
 #include <sys/stat.h>
 
+/* declarations of non-ANSI functions */
+#if defined(__MINGW32__)
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined(__CYGWIN__)
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined (other platforms) ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined(_MSC_VER)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+# define S_IXUSR _S_IEXEC
+# ifndef _INTPTR_T_DEFINED
+#  define _INTPTR_T_DEFINED
+#  define intptr_t int
+# endif
+#elif defined(__MINGW32__)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+#elif defined(__CYGWIN__)
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined (other platforms) ... */
+#endif
+
 #if defined(PATH_MAX)
 # define LT_PATHMAX PATH_MAX
 #elif defined(MAXPATHLEN)
@@ -3199,14 +4228,7 @@ int setenv (const char *, const char *, int);
 # define S_IXGRP 0
 #endif
 
-#ifdef _MSC_VER
-# define S_IXUSR _S_IEXEC
-# define stat _stat
-# ifndef _INTPTR_T_DEFINED
-#  define intptr_t int
-# endif
-#endif
-
+/* path handling portability macros */
 #ifndef DIR_SEPARATOR
 # define DIR_SEPARATOR '/'
 # define PATH_SEPARATOR ':'
@@ -3237,10 +4259,6 @@ int setenv (const char *, const char *, int);
 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 #endif /* PATH_SEPARATOR_2 */
 
-#ifdef __CYGWIN__
-# define FOPEN_WB "wb"
-#endif
-
 #ifndef FOPEN_WB
 # define FOPEN_WB "w"
 #endif
@@ -3253,22 +4271,13 @@ int setenv (const char *, const char *, int);
   if (stale) { free ((void *) stale); stale = 0; } \
 } while (0)
 
-#undef LTWRAPPER_DEBUGPRINTF
-#if defined DEBUGWRAPPER
-# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
-static void
-ltwrapper_debugprintf (const char *fmt, ...)
-{
-    va_list args;
-    va_start (args, fmt);
-    (void) vfprintf (stderr, fmt, args);
-    va_end (args);
-}
+#if defined(LT_DEBUGWRAPPER)
+static int lt_debug = 1;
 #else
-# define LTWRAPPER_DEBUGPRINTF(args)
+static int lt_debug = 0;
 #endif
 
-const char *program_name = NULL;
+const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
 
 void *xmalloc (size_t num);
 char *xstrdup (const char *string);
@@ -3278,41 +4287,27 @@ char *chase_symlinks (const char *pathspec);
 int make_executable (const char *path);
 int check_executable (const char *path);
 char *strendzap (char *str, const char *pat);
-void lt_fatal (const char *message, ...);
+void lt_debugprintf (const char *file, int line, const char *fmt, ...);
+void lt_fatal (const char *file, int line, const char *message, ...);
+static const char *nonnull (const char *s);
+static const char *nonempty (const char *s);
 void lt_setenv (const char *name, const char *value);
 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
-void lt_opt_process_env_set (const char *arg);
-void lt_opt_process_env_prepend (const char *arg);
-void lt_opt_process_env_append (const char *arg);
-int lt_split_name_value (const char *arg, char** name, char** value);
 void lt_update_exe_path (const char *name, const char *value);
 void lt_update_lib_path (const char *name, const char *value);
-
-static const char *script_text_part1 =
-EOF
-
-	    func_emit_wrapper_part1 yes |
-	        $SED -e 's/\([\\"]\)/\\\1/g' \
-	             -e 's/^/  "/' -e 's/$/\\n"/'
-	    echo ";"
-	    cat <<EOF
-
-static const char *script_text_part2 =
+char **prepare_spawn (char **argv);
+void lt_dump_script (FILE *f);
 EOF
-	    func_emit_wrapper_part2 yes |
-	        $SED -e 's/\([\\"]\)/\\\1/g' \
-	             -e 's/^/  "/' -e 's/$/\\n"/'
-	    echo ";"
 
 	    cat <<EOF
-const char * MAGIC_EXE = "$magic_exe";
+volatile const char * MAGIC_EXE = "$magic_exe";
 const char * LIB_PATH_VARNAME = "$shlibpath_var";
 EOF
 
 	    if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
-              func_to_host_pathlist "$temp_rpath"
+              func_to_host_path "$temp_rpath"
 	      cat <<EOF
-const char * LIB_PATH_VALUE   = "$func_to_host_pathlist_result";
+const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
 EOF
 	    else
 	      cat <<"EOF"
@@ -3321,10 +4316,10 @@ EOF
 	    fi
 
 	    if test -n "$dllsearchpath"; then
-              func_to_host_pathlist "$dllsearchpath:"
+              func_to_host_path "$dllsearchpath:"
 	      cat <<EOF
 const char * EXE_PATH_VARNAME = "PATH";
-const char * EXE_PATH_VALUE   = "$func_to_host_pathlist_result";
+const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
 EOF
 	    else
 	      cat <<"EOF"
@@ -3347,24 +4342,10 @@ EOF
 	    cat <<"EOF"
 
 #define LTWRAPPER_OPTION_PREFIX         "--lt-"
-#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
 
-static const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
-
 static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
-
-static const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
-static const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX "env-set";
-  /* argument is putenv-style "foo=bar", value of foo is set to bar */
-
-static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
-static const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX "env-prepend";
-  /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
-
-static const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
-static const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX "env-append";
-  /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
+static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
 
 int
 main (int argc, char *argv[])
@@ -3381,10 +4362,13 @@ main (int argc, char *argv[])
   int i;
 
   program_name = (char *) xstrdup (base_name (argv[0]));
-  LTWRAPPER_DEBUGPRINTF (("(main) argv[0]      : %s\n", argv[0]));
-  LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
+  newargz = XMALLOC (char *, argc + 1);
 
-  /* very simple arg parsing; don't want to rely on getopt */
+  /* very simple arg parsing; don't want to rely on getopt
+   * also, copy all non cwrapper options to newargz, except
+   * argz[0], which is handled differently
+   */
+  newargc=0;
   for (i = 1; i < argc; i++)
     {
       if (strcmp (argv[i], dumpscript_opt) == 0)
@@ -3398,25 +4382,57 @@ EOF
 	      esac
 
 	    cat <<"EOF"
-	  printf ("%s", script_text_part1);
-	  printf ("%s", script_text_part2);
+	  lt_dump_script (stdout);
 	  return 0;
 	}
+      if (strcmp (argv[i], debug_opt) == 0)
+	{
+          lt_debug = 1;
+          continue;
+	}
+      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
+        {
+          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+             namespace, but it is not one of the ones we know about and
+             have already dealt with, above (inluding dump-script), then
+             report an error. Otherwise, targets might begin to believe
+             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+             namespace. The first time any user complains about this, we'll
+             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+             or a configure.ac-settable value.
+           */
+          lt_fatal (__FILE__, __LINE__,
+		    "unrecognized %s option: '%s'",
+                    ltwrapper_option_prefix, argv[i]);
+        }
+      /* otherwise ... */
+      newargz[++newargc] = xstrdup (argv[i]);
     }
+  newargz[++newargc] = NULL;
+
+EOF
+	    cat <<EOF
+  /* The GNU banner must be the first non-error debug message */
+  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
+EOF
+	    cat <<"EOF"
+  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
 
-  newargz = XMALLOC (char *, argc + 1);
   tmp_pathspec = find_executable (argv[0]);
   if (tmp_pathspec == NULL)
-    lt_fatal ("Couldn't find %s", argv[0]);
-  LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
-			  tmp_pathspec));
+    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (before symlink chase) at: %s\n",
+		  tmp_pathspec);
 
   actual_cwrapper_path = chase_symlinks (tmp_pathspec);
-  LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
-			  actual_cwrapper_path));
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (after symlink chase) at: %s\n",
+		  actual_cwrapper_path);
   XFREE (tmp_pathspec);
 
-  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
+  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
   strendzap (actual_cwrapper_path, actual_cwrapper_name);
 
   /* wrapper name transforms */
@@ -3434,8 +4450,9 @@ EOF
   target_name = tmp_pathspec;
   tmp_pathspec = 0;
 
-  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
-			  target_name));
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(main) libtool target name: %s\n",
+		  target_name);
 EOF
 
 	    cat <<EOF
@@ -3485,80 +4502,19 @@ EOF
 
   lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
   lt_setenv ("DUALCASE", "1");  /* for MSK sh */
-  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
+     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
+     because on Windows, both *_VARNAMEs are PATH but uninstalled
+     libraries must come first. */
   lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
 
-  newargc=0;
-  for (i = 1; i < argc; i++)
-    {
-      if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
-        {
-          if (argv[i][env_set_opt_len] == '=')
-            {
-              const char *p = argv[i] + env_set_opt_len + 1;
-              lt_opt_process_env_set (p);
-            }
-          else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
-            {
-              lt_opt_process_env_set (argv[++i]); /* don't copy */
-            }
-          else
-            lt_fatal ("%s missing required argument", env_set_opt);
-          continue;
-        }
-      if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
-        {
-          if (argv[i][env_prepend_opt_len] == '=')
-            {
-              const char *p = argv[i] + env_prepend_opt_len + 1;
-              lt_opt_process_env_prepend (p);
-            }
-          else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
-            {
-              lt_opt_process_env_prepend (argv[++i]); /* don't copy */
-            }
-          else
-            lt_fatal ("%s missing required argument", env_prepend_opt);
-          continue;
-        }
-      if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
-        {
-          if (argv[i][env_append_opt_len] == '=')
-            {
-              const char *p = argv[i] + env_append_opt_len + 1;
-              lt_opt_process_env_append (p);
-            }
-          else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
-            {
-              lt_opt_process_env_append (argv[++i]); /* don't copy */
-            }
-          else
-            lt_fatal ("%s missing required argument", env_append_opt);
-          continue;
-        }
-      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
-        {
-          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
-             namespace, but it is not one of the ones we know about and
-             have already dealt with, above (inluding dump-script), then
-             report an error. Otherwise, targets might begin to believe
-             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
-             namespace. The first time any user complains about this, we'll
-             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
-             or a configure.ac-settable value.
-           */
-          lt_fatal ("Unrecognized option in %s namespace: '%s'",
-                    ltwrapper_option_prefix, argv[i]);
-        }
-      /* otherwise ... */
-      newargz[++newargc] = xstrdup (argv[i]);
-    }
-  newargz[++newargc] = NULL;
-
-  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
+  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
+		  nonnull (lt_argv_zero));
   for (i = 0; i < newargc; i++)
     {
-      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
+      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
+		      i, nonnull (newargz[i]));
     }
 
 EOF
@@ -3567,11 +4523,14 @@ EOF
 	      mingw*)
 		cat <<"EOF"
   /* execv doesn't actually work on mingw as expected on unix */
+  newargz = prepare_spawn (newargz);
   rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
   if (rval == -1)
     {
       /* failed to start process */
-      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
+      lt_debugprintf (__FILE__, __LINE__,
+		      "(main) failed to launch target \"%s\": %s\n",
+		      lt_argv_zero, nonnull (strerror (errno)));
       return 127;
     }
   return rval;
@@ -3593,7 +4552,7 @@ xmalloc (size_t num)
 {
   void *p = (void *) malloc (num);
   if (!p)
-    lt_fatal ("Memory exhausted");
+    lt_fatal (__FILE__, __LINE__, "memory exhausted");
 
   return p;
 }
@@ -3627,8 +4586,8 @@ check_executable (const char *path)
 {
   struct stat st;
 
-  LTWRAPPER_DEBUGPRINTF (("(check_executable)  : %s\n",
-			  path ? (*path ? path : "EMPTY!") : "NULL!"));
+  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
+                  nonempty (path));
   if ((!path) || (!*path))
     return 0;
 
@@ -3645,8 +4604,8 @@ make_executable (const char *path)
   int rval = 0;
   struct stat st;
 
-  LTWRAPPER_DEBUGPRINTF (("(make_executable)   : %s\n",
-			  path ? (*path ? path : "EMPTY!") : "NULL!"));
+  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
+                  nonempty (path));
   if ((!path) || (!*path))
     return 0;
 
@@ -3672,8 +4631,8 @@ find_executable (const char *wrapper)
   int tmp_len;
   char *concat_name;
 
-  LTWRAPPER_DEBUGPRINTF (("(find_executable)   : %s\n",
-			  wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
+  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
+                  nonempty (wrapper));
 
   if ((wrapper == NULL) || (*wrapper == '\0'))
     return NULL;
@@ -3726,7 +4685,8 @@ find_executable (const char *wrapper)
 		{
 		  /* empty path: current directory */
 		  if (getcwd (tmp, LT_PATHMAX) == NULL)
-		    lt_fatal ("getcwd failed");
+		    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+                              nonnull (strerror (errno)));
 		  tmp_len = strlen (tmp);
 		  concat_name =
 		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
@@ -3751,7 +4711,8 @@ find_executable (const char *wrapper)
     }
   /* Relative path | not found in path: prepend cwd */
   if (getcwd (tmp, LT_PATHMAX) == NULL)
-    lt_fatal ("getcwd failed");
+    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+              nonnull (strerror (errno)));
   tmp_len = strlen (tmp);
   concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
   memcpy (concat_name, tmp, tmp_len);
@@ -3777,8 +4738,9 @@ chase_symlinks (const char *pathspec)
   int has_symlinks = 0;
   while (strlen (tmp_pathspec) && !has_symlinks)
     {
-      LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
-			      tmp_pathspec));
+      lt_debugprintf (__FILE__, __LINE__,
+		      "checking path component for symlinks: %s\n",
+		      tmp_pathspec);
       if (lstat (tmp_pathspec, &s) == 0)
 	{
 	  if (S_ISLNK (s.st_mode) != 0)
@@ -3800,8 +4762,9 @@ chase_symlinks (const char *pathspec)
 	}
       else
 	{
-	  char *errstr = strerror (errno);
-	  lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
+	  lt_fatal (__FILE__, __LINE__,
+		    "error accessing file \"%s\": %s",
+		    tmp_pathspec, nonnull (strerror (errno)));
 	}
     }
   XFREE (tmp_pathspec);
@@ -3814,7 +4777,8 @@ chase_symlinks (const char *pathspec)
   tmp_pathspec = realpath (pathspec, buf);
   if (tmp_pathspec == 0)
     {
-      lt_fatal ("Could not follow symlinks for %s", pathspec);
+      lt_fatal (__FILE__, __LINE__,
+		"could not follow symlinks for %s", pathspec);
     }
   return xstrdup (tmp_pathspec);
 #endif
@@ -3840,11 +4804,25 @@ strendzap (char *str, const char *pat)
   return str;
 }
 
+void
+lt_debugprintf (const char *file, int line, const char *fmt, ...)
+{
+  va_list args;
+  if (lt_debug)
+    {
+      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
+      va_start (args, fmt);
+      (void) vfprintf (stderr, fmt, args);
+      va_end (args);
+    }
+}
+
 static void
-lt_error_core (int exit_status, const char *mode,
+lt_error_core (int exit_status, const char *file,
+	       int line, const char *mode,
 	       const char *message, va_list ap)
 {
-  fprintf (stderr, "%s: %s: ", program_name, mode);
+  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
   vfprintf (stderr, message, ap);
   fprintf (stderr, ".\n");
 
@@ -3853,20 +4831,32 @@ lt_error_core (int exit_status, const char *mode,
 }
 
 void
-lt_fatal (const char *message, ...)
+lt_fatal (const char *file, int line, const char *message, ...)
 {
   va_list ap;
   va_start (ap, message);
-  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
   va_end (ap);
 }
 
+static const char *
+nonnull (const char *s)
+{
+  return s ? s : "(null)";
+}
+
+static const char *
+nonempty (const char *s)
+{
+  return (s && !*s) ? "(empty)" : nonnull (s);
+}
+
 void
 lt_setenv (const char *name, const char *value)
 {
-  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
-                          (name ? name : "<NULL>"),
-                          (value ? value : "<NULL>")));
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_setenv) setting '%s' to '%s'\n",
+                  nonnull (name), nonnull (value));
   {
 #ifdef HAVE_SETENV
     /* always make a copy, for consistency with !HAVE_SETENV */
@@ -3911,95 +4901,12 @@ lt_extend_str (const char *orig_value, const char *add, int to_end)
   return new_value;
 }
 
-int
-lt_split_name_value (const char *arg, char** name, char** value)
-{
-  const char *p;
-  int len;
-  if (!arg || !*arg)
-    return 1;
-
-  p = strchr (arg, (int)'=');
-
-  if (!p)
-    return 1;
-
-  *value = xstrdup (++p);
-
-  len = strlen (arg) - strlen (*value);
-  *name = XMALLOC (char, len);
-  strncpy (*name, arg, len-1);
-  (*name)[len - 1] = '\0';
-
-  return 0;
-}
-
-void
-lt_opt_process_env_set (const char *arg)
-{
-  char *name = NULL;
-  char *value = NULL;
-
-  if (lt_split_name_value (arg, &name, &value) != 0)
-    {
-      XFREE (name);
-      XFREE (value);
-      lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
-    }
-
-  lt_setenv (name, value);
-  XFREE (name);
-  XFREE (value);
-}
-
-void
-lt_opt_process_env_prepend (const char *arg)
-{
-  char *name = NULL;
-  char *value = NULL;
-  char *new_value = NULL;
-
-  if (lt_split_name_value (arg, &name, &value) != 0)
-    {
-      XFREE (name);
-      XFREE (value);
-      lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
-    }
-
-  new_value = lt_extend_str (getenv (name), value, 0);
-  lt_setenv (name, new_value);
-  XFREE (new_value);
-  XFREE (name);
-  XFREE (value);
-}
-
-void
-lt_opt_process_env_append (const char *arg)
-{
-  char *name = NULL;
-  char *value = NULL;
-  char *new_value = NULL;
-
-  if (lt_split_name_value (arg, &name, &value) != 0)
-    {
-      XFREE (name);
-      XFREE (value);
-      lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
-    }
-
-  new_value = lt_extend_str (getenv (name), value, 1);
-  lt_setenv (name, new_value);
-  XFREE (new_value);
-  XFREE (name);
-  XFREE (value);
-}
-
 void
 lt_update_exe_path (const char *name, const char *value)
 {
-  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
-                          (name ? name : "<NULL>"),
-                          (value ? value : "<NULL>")));
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
 
   if (name && *name && value && *value)
     {
@@ -4018,9 +4925,9 @@ lt_update_exe_path (const char *name, const char *value)
 void
 lt_update_lib_path (const char *name, const char *value)
 {
-  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
-                          (name ? name : "<NULL>"),
-                          (value ? value : "<NULL>")));
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
 
   if (name && *name && value && *value)
     {
@@ -4030,11 +4937,158 @@ lt_update_lib_path (const char *name, const char *value)
     }
 }
 
+EOF
+	    case $host_os in
+	      mingw*)
+		cat <<"EOF"
+
+/* Prepares an argument vector before calling spawn().
+   Note that spawn() does not by itself call the command interpreter
+     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
+      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+         GetVersionEx(&v);
+         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
+      }) ? "cmd.exe" : "command.com").
+   Instead it simply concatenates the arguments, separated by ' ', and calls
+   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
+   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
+   special way:
+   - Space and tab are interpreted as delimiters. They are not treated as
+     delimiters if they are surrounded by double quotes: "...".
+   - Unescaped double quotes are removed from the input. Their only effect is
+     that within double quotes, space and tab are treated like normal
+     characters.
+   - Backslashes not followed by double quotes are not special.
+   - But 2*n+1 backslashes followed by a double quote become
+     n backslashes followed by a double quote (n >= 0):
+       \" -> "
+       \\\" -> \"
+       \\\\\" -> \\"
+ */
+#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+char **
+prepare_spawn (char **argv)
+{
+  size_t argc;
+  char **new_argv;
+  size_t i;
+
+  /* Count number of arguments.  */
+  for (argc = 0; argv[argc] != NULL; argc++)
+    ;
+
+  /* Allocate new argument vector.  */
+  new_argv = XMALLOC (char *, argc + 1);
+
+  /* Put quoted arguments into the new argument vector.  */
+  for (i = 0; i < argc; i++)
+    {
+      const char *string = argv[i];
+
+      if (string[0] == '\0')
+	new_argv[i] = xstrdup ("\"\"");
+      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
+	{
+	  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
+	  size_t length;
+	  unsigned int backslashes;
+	  const char *s;
+	  char *quoted_string;
+	  char *p;
+
+	  length = 0;
+	  backslashes = 0;
+	  if (quote_around)
+	    length++;
+	  for (s = string; *s != '\0'; s++)
+	    {
+	      char c = *s;
+	      if (c == '"')
+		length += backslashes + 1;
+	      length++;
+	      if (c == '\\')
+		backslashes++;
+	      else
+		backslashes = 0;
+	    }
+	  if (quote_around)
+	    length += backslashes + 1;
+
+	  quoted_string = XMALLOC (char, length + 1);
+
+	  p = quoted_string;
+	  backslashes = 0;
+	  if (quote_around)
+	    *p++ = '"';
+	  for (s = string; *s != '\0'; s++)
+	    {
+	      char c = *s;
+	      if (c == '"')
+		{
+		  unsigned int j;
+		  for (j = backslashes + 1; j > 0; j--)
+		    *p++ = '\\';
+		}
+	      *p++ = c;
+	      if (c == '\\')
+		backslashes++;
+	      else
+		backslashes = 0;
+	    }
+	  if (quote_around)
+	    {
+	      unsigned int j;
+	      for (j = backslashes; j > 0; j--)
+		*p++ = '\\';
+	      *p++ = '"';
+	    }
+	  *p = '\0';
+
+	  new_argv[i] = quoted_string;
+	}
+      else
+	new_argv[i] = (char *) string;
+    }
+  new_argv[argc] = NULL;
+
+  return new_argv;
+}
+EOF
+		;;
+	    esac
 
+            cat <<"EOF"
+void lt_dump_script (FILE* f)
+{
+EOF
+	    func_emit_wrapper yes |
+	      $SED -n -e '
+s/^\(.\{79\}\)\(..*\)/\1\
+\2/
+h
+s/\([\\"]\)/\\\1/g
+s/$/\\n/
+s/\([^\n]*\).*/  fputs ("\1", f);/p
+g
+D'
+            cat <<"EOF"
+}
 EOF
 }
 # end: func_emit_cwrapperexe_src
 
+# func_win32_import_lib_p ARG
+# True if ARG is an import lib, as indicated by $file_magic_cmd
+func_win32_import_lib_p ()
+{
+    $opt_debug
+    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
+    *import*) : ;;
+    *) false ;;
+    esac
+}
+
 # func_mode_link arg...
 func_mode_link ()
 {
@@ -4079,6 +5133,7 @@ func_mode_link ()
     new_inherited_linker_flags=
 
     avoid_version=no
+    bindir=
     dlfiles=
     dlprefiles=
     dlself=no
@@ -4171,6 +5226,11 @@ func_mode_link ()
 	esac
 
 	case $prev in
+	bindir)
+	  bindir="$arg"
+	  prev=
+	  continue
+	  ;;
 	dlfiles|dlprefiles)
 	  if test "$preload" = no; then
 	    # Add the symbol object into the linking commands.
@@ -4202,9 +5262,9 @@ func_mode_link ()
 	    ;;
 	  *)
 	    if test "$prev" = dlfiles; then
-	      dlfiles="$dlfiles $arg"
+	      func_append dlfiles " $arg"
 	    else
-	      dlprefiles="$dlprefiles $arg"
+	      func_append dlprefiles " $arg"
 	    fi
 	    prev=
 	    continue
@@ -4228,7 +5288,7 @@ func_mode_link ()
 	    *-*-darwin*)
 	      case "$deplibs " in
 		*" $qarg.ltframework "*) ;;
-		*) deplibs="$deplibs $qarg.ltframework" # this is fixed later
+		*) func_append deplibs " $qarg.ltframework" # this is fixed later
 		   ;;
 	      esac
 	      ;;
@@ -4247,7 +5307,7 @@ func_mode_link ()
 	    moreargs=
 	    for fil in `cat "$save_arg"`
 	    do
-#	      moreargs="$moreargs $fil"
+#	      func_append moreargs " $fil"
 	      arg=$fil
 	      # A libtool-controlled object.
 
@@ -4276,7 +5336,7 @@ func_mode_link ()
 
 		  if test "$prev" = dlfiles; then
 		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		      dlfiles="$dlfiles $pic_object"
+		      func_append dlfiles " $pic_object"
 		      prev=
 		      continue
 		    else
@@ -4288,7 +5348,7 @@ func_mode_link ()
 		  # CHECK ME:  I think I busted this.  -Ossama
 		  if test "$prev" = dlprefiles; then
 		    # Preload the old-style object.
-		    dlprefiles="$dlprefiles $pic_object"
+		    func_append dlprefiles " $pic_object"
 		    prev=
 		  fi
 
@@ -4358,12 +5418,12 @@ func_mode_link ()
 	  if test "$prev" = rpath; then
 	    case "$rpath " in
 	    *" $arg "*) ;;
-	    *) rpath="$rpath $arg" ;;
+	    *) func_append rpath " $arg" ;;
 	    esac
 	  else
 	    case "$xrpath " in
 	    *" $arg "*) ;;
-	    *) xrpath="$xrpath $arg" ;;
+	    *) func_append xrpath " $arg" ;;
 	    esac
 	  fi
 	  prev=
@@ -4375,28 +5435,28 @@ func_mode_link ()
 	  continue
 	  ;;
 	weak)
-	  weak_libs="$weak_libs $arg"
+	  func_append weak_libs " $arg"
 	  prev=
 	  continue
 	  ;;
 	xcclinker)
-	  linker_flags="$linker_flags $qarg"
-	  compiler_flags="$compiler_flags $qarg"
+	  func_append linker_flags " $qarg"
+	  func_append compiler_flags " $qarg"
 	  prev=
 	  func_append compile_command " $qarg"
 	  func_append finalize_command " $qarg"
 	  continue
 	  ;;
 	xcompiler)
-	  compiler_flags="$compiler_flags $qarg"
+	  func_append compiler_flags " $qarg"
 	  prev=
 	  func_append compile_command " $qarg"
 	  func_append finalize_command " $qarg"
 	  continue
 	  ;;
 	xlinker)
-	  linker_flags="$linker_flags $qarg"
-	  compiler_flags="$compiler_flags $wl$qarg"
+	  func_append linker_flags " $qarg"
+	  func_append compiler_flags " $wl$qarg"
 	  prev=
 	  func_append compile_command " $wl$qarg"
 	  func_append finalize_command " $wl$qarg"
@@ -4432,6 +5492,11 @@ func_mode_link ()
 	continue
 	;;
 
+      -bindir)
+	prev=bindir
+	continue
+	;;
+
       -dlopen)
 	prev=dlfiles
 	continue
@@ -4482,15 +5547,16 @@ func_mode_link ()
 	;;
 
       -L*)
-	func_stripname '-L' '' "$arg"
-	dir=$func_stripname_result
-	if test -z "$dir"; then
+	func_stripname "-L" '' "$arg"
+	if test -z "$func_stripname_result"; then
 	  if test "$#" -gt 0; then
 	    func_fatal_error "require no space between \`-L' and \`$1'"
 	  else
 	    func_fatal_error "need path for \`-L' option"
 	  fi
 	fi
+	func_resolve_sysroot "$func_stripname_result"
+	dir=$func_resolve_sysroot_result
 	# We need an absolute path.
 	case $dir in
 	[\\/]* | [A-Za-z]:[\\/]*) ;;
@@ -4502,24 +5568,30 @@ func_mode_link ()
 	  ;;
 	esac
 	case "$deplibs " in
-	*" -L$dir "*) ;;
+	*" -L$dir "* | *" $arg "*)
+	  # Will only happen for absolute or sysroot arguments
+	  ;;
 	*)
-	  deplibs="$deplibs -L$dir"
-	  lib_search_path="$lib_search_path $dir"
+	  # Preserve sysroot, but never include relative directories
+	  case $dir in
+	    [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
+	    *) func_append deplibs " -L$dir" ;;
+	  esac
+	  func_append lib_search_path " $dir"
 	  ;;
 	esac
 	case $host in
 	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-	  testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
 	  case :$dllsearchpath: in
 	  *":$dir:"*) ;;
 	  ::) dllsearchpath=$dir;;
-	  *) dllsearchpath="$dllsearchpath:$dir";;
+	  *) func_append dllsearchpath ":$dir";;
 	  esac
 	  case :$dllsearchpath: in
 	  *":$testbindir:"*) ;;
 	  ::) dllsearchpath=$testbindir;;
-	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  *) func_append dllsearchpath ":$testbindir";;
 	  esac
 	  ;;
 	esac
@@ -4529,7 +5601,7 @@ func_mode_link ()
       -l*)
 	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
 	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
 	    # These systems don't actually have a C or math library (as such)
 	    continue
 	    ;;
@@ -4543,7 +5615,7 @@ func_mode_link ()
 	    ;;
 	  *-*-rhapsody* | *-*-darwin1.[012])
 	    # Rhapsody C and math libraries are in the System framework
-	    deplibs="$deplibs System.ltframework"
+	    func_append deplibs " System.ltframework"
 	    continue
 	    ;;
 	  *-*-sco3.2v5* | *-*-sco5v6*)
@@ -4563,7 +5635,7 @@ func_mode_link ()
 	   ;;
 	 esac
 	fi
-	deplibs="$deplibs $arg"
+	func_append deplibs " $arg"
 	continue
 	;;
 
@@ -4575,21 +5647,22 @@ func_mode_link ()
       # Tru64 UNIX uses -model [arg] to determine the layout of C++
       # classes, name mangling, and exception handling.
       # Darwin uses the -arch flag to determine output architecture.
-      -model|-arch|-isysroot)
-	compiler_flags="$compiler_flags $arg"
+      -model|-arch|-isysroot|--sysroot)
+	func_append compiler_flags " $arg"
 	func_append compile_command " $arg"
 	func_append finalize_command " $arg"
 	prev=xcompiler
 	continue
 	;;
 
-      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
-	compiler_flags="$compiler_flags $arg"
+      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+	func_append compiler_flags " $arg"
 	func_append compile_command " $arg"
 	func_append finalize_command " $arg"
 	case "$new_inherited_linker_flags " in
 	    *" $arg "*) ;;
-	    * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
+	    * ) func_append new_inherited_linker_flags " $arg" ;;
 	esac
 	continue
 	;;
@@ -4656,13 +5729,17 @@ func_mode_link ()
 	# We need an absolute path.
 	case $dir in
 	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	=*)
+	  func_stripname '=' '' "$dir"
+	  dir=$lt_sysroot$func_stripname_result
+	  ;;
 	*)
 	  func_fatal_error "only absolute run-paths are allowed"
 	  ;;
 	esac
 	case "$xrpath " in
 	*" $dir "*) ;;
-	*) xrpath="$xrpath $dir" ;;
+	*) func_append xrpath " $dir" ;;
 	esac
 	continue
 	;;
@@ -4715,8 +5792,8 @@ func_mode_link ()
 	for flag in $args; do
 	  IFS="$save_ifs"
           func_quote_for_eval "$flag"
-	  arg="$arg $wl$func_quote_for_eval_result"
-	  compiler_flags="$compiler_flags $func_quote_for_eval_result"
+	  func_append arg " $func_quote_for_eval_result"
+	  func_append compiler_flags " $func_quote_for_eval_result"
 	done
 	IFS="$save_ifs"
 	func_stripname ' ' '' "$arg"
@@ -4731,9 +5808,9 @@ func_mode_link ()
 	for flag in $args; do
 	  IFS="$save_ifs"
           func_quote_for_eval "$flag"
-	  arg="$arg $wl$func_quote_for_eval_result"
-	  compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
-	  linker_flags="$linker_flags $func_quote_for_eval_result"
+	  func_append arg " $wl$func_quote_for_eval_result"
+	  func_append compiler_flags " $wl$func_quote_for_eval_result"
+	  func_append linker_flags " $func_quote_for_eval_result"
 	done
 	IFS="$save_ifs"
 	func_stripname ' ' '' "$arg"
@@ -4761,23 +5838,27 @@ func_mode_link ()
 	arg="$func_quote_for_eval_result"
 	;;
 
-      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
-      # -r[0-9][0-9]* specifies the processor on the SGI compiler
-      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
-      # +DA*, +DD* enable 64-bit mode on the HP compiler
-      # -q* pass through compiler args for the IBM compiler
-      # -m*, -t[45]*, -txscale* pass through architecture-specific
-      # compiler args for GCC
-      # -F/path gives path to uninstalled frameworks, gcc on darwin
-      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
-      # @file GCC response files
+      # Flags to be passed through unchanged, with rationale:
+      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
+      # -r[0-9][0-9]*        specify processor for the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
+      # +DA*, +DD*           enable 64-bit mode for the HP compiler
+      # -q*                  compiler args for the IBM compiler
+      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
+      # -F/path              path to uninstalled frameworks, gcc on darwin
+      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
+      # @file                GCC response files
+      # -tp=*                Portland pgcc target processor selection
+      # --sysroot=*          for sysroot support
+      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
         func_quote_for_eval "$arg"
 	arg="$func_quote_for_eval_result"
         func_append compile_command " $arg"
         func_append finalize_command " $arg"
-        compiler_flags="$compiler_flags $arg"
+        func_append compiler_flags " $arg"
         continue
         ;;
 
@@ -4789,7 +5870,7 @@ func_mode_link ()
 
       *.$objext)
 	# A standard object.
-	objs="$objs $arg"
+	func_append objs " $arg"
 	;;
 
       *.lo)
@@ -4820,7 +5901,7 @@ func_mode_link ()
 
 	    if test "$prev" = dlfiles; then
 	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		dlfiles="$dlfiles $pic_object"
+		func_append dlfiles " $pic_object"
 		prev=
 		continue
 	      else
@@ -4832,7 +5913,7 @@ func_mode_link ()
 	    # CHECK ME:  I think I busted this.  -Ossama
 	    if test "$prev" = dlprefiles; then
 	      # Preload the old-style object.
-	      dlprefiles="$dlprefiles $pic_object"
+	      func_append dlprefiles " $pic_object"
 	      prev=
 	    fi
 
@@ -4877,24 +5958,25 @@ func_mode_link ()
 
       *.$libext)
 	# An archive.
-	deplibs="$deplibs $arg"
-	old_deplibs="$old_deplibs $arg"
+	func_append deplibs " $arg"
+	func_append old_deplibs " $arg"
 	continue
 	;;
 
       *.la)
 	# A libtool-controlled library.
 
+	func_resolve_sysroot "$arg"
 	if test "$prev" = dlfiles; then
 	  # This library was specified with -dlopen.
-	  dlfiles="$dlfiles $arg"
+	  func_append dlfiles " $func_resolve_sysroot_result"
 	  prev=
 	elif test "$prev" = dlprefiles; then
 	  # The library was specified with -dlpreopen.
-	  dlprefiles="$dlprefiles $arg"
+	  func_append dlprefiles " $func_resolve_sysroot_result"
 	  prev=
 	else
-	  deplibs="$deplibs $arg"
+	  func_append deplibs " $func_resolve_sysroot_result"
 	fi
 	continue
 	;;
@@ -4932,7 +6014,7 @@ func_mode_link ()
 
     if test -n "$shlibpath_var"; then
       # get the directories listed in $shlibpath_var
-      eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
     else
       shlib_search_path=
     fi
@@ -4941,6 +6023,8 @@ func_mode_link ()
 
     func_dirname "$output" "/" ""
     output_objdir="$func_dirname_result$objdir"
+    func_to_tool_file "$output_objdir/"
+    tool_output_objdir=$func_to_tool_file_result
     # Create the object directory.
     func_mkdir_p "$output_objdir"
 
@@ -4961,12 +6045,12 @@ func_mode_link ()
     # Find all interdependent deplibs by searching for libraries
     # that are linked more than once (e.g. -la -lb -la)
     for deplib in $deplibs; do
-      if $opt_duplicate_deps ; then
+      if $opt_preserve_dup_deps ; then
 	case "$libs " in
-	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	*" $deplib "*) func_append specialdeplibs " $deplib" ;;
 	esac
       fi
-      libs="$libs $deplib"
+      func_append libs " $deplib"
     done
 
     if test "$linkmode" = lib; then
@@ -4979,9 +6063,9 @@ func_mode_link ()
       if $opt_duplicate_compiler_generated_deps; then
 	for pre_post_dep in $predeps $postdeps; do
 	  case "$pre_post_deps " in
-	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+	  *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
 	  esac
-	  pre_post_deps="$pre_post_deps $pre_post_dep"
+	  func_append pre_post_deps " $pre_post_dep"
 	done
       fi
       pre_post_deps=
@@ -5048,17 +6132,19 @@ func_mode_link ()
 	for lib in $dlprefiles; do
 	  # Ignore non-libtool-libs
 	  dependency_libs=
+	  func_resolve_sysroot "$lib"
 	  case $lib in
-	  *.la)	func_source "$lib" ;;
+	  *.la)	func_source "$func_resolve_sysroot_result" ;;
 	  esac
 
 	  # Collect preopened libtool deplibs, except any this library
 	  # has declared as weak libs
 	  for deplib in $dependency_libs; do
-            deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
+	    func_basename "$deplib"
+            deplib_base=$func_basename_result
 	    case " $weak_libs " in
 	    *" $deplib_base "*) ;;
-	    *) deplibs="$deplibs $deplib" ;;
+	    *) func_append deplibs " $deplib" ;;
 	    esac
 	  done
 	done
@@ -5074,16 +6160,17 @@ func_mode_link ()
 	lib=
 	found=no
 	case $deplib in
-	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
 	  if test "$linkmode,$pass" = "prog,link"; then
 	    compile_deplibs="$deplib $compile_deplibs"
 	    finalize_deplibs="$deplib $finalize_deplibs"
 	  else
-	    compiler_flags="$compiler_flags $deplib"
+	    func_append compiler_flags " $deplib"
 	    if test "$linkmode" = lib ; then
 		case "$new_inherited_linker_flags " in
 		    *" $deplib "*) ;;
-		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+		    * ) func_append new_inherited_linker_flags " $deplib" ;;
 		esac
 	    fi
 	  fi
@@ -5168,7 +6255,7 @@ func_mode_link ()
 	    if test "$linkmode" = lib ; then
 		case "$new_inherited_linker_flags " in
 		    *" $deplib "*) ;;
-		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+		    * ) func_append new_inherited_linker_flags " $deplib" ;;
 		esac
 	    fi
 	  fi
@@ -5181,7 +6268,8 @@ func_mode_link ()
 	    test "$pass" = conv && continue
 	    newdependency_libs="$deplib $newdependency_libs"
 	    func_stripname '-L' '' "$deplib"
-	    newlib_search_path="$newlib_search_path $func_stripname_result"
+	    func_resolve_sysroot "$func_stripname_result"
+	    func_append newlib_search_path " $func_resolve_sysroot_result"
 	    ;;
 	  prog)
 	    if test "$pass" = conv; then
@@ -5195,7 +6283,8 @@ func_mode_link ()
 	      finalize_deplibs="$deplib $finalize_deplibs"
 	    fi
 	    func_stripname '-L' '' "$deplib"
-	    newlib_search_path="$newlib_search_path $func_stripname_result"
+	    func_resolve_sysroot "$func_stripname_result"
+	    func_append newlib_search_path " $func_resolve_sysroot_result"
 	    ;;
 	  *)
 	    func_warning "\`-L' is ignored for archives/objects"
@@ -5206,17 +6295,21 @@ func_mode_link ()
 	-R*)
 	  if test "$pass" = link; then
 	    func_stripname '-R' '' "$deplib"
-	    dir=$func_stripname_result
+	    func_resolve_sysroot "$func_stripname_result"
+	    dir=$func_resolve_sysroot_result
 	    # Make sure the xrpath contains only unique directories.
 	    case "$xrpath " in
 	    *" $dir "*) ;;
-	    *) xrpath="$xrpath $dir" ;;
+	    *) func_append xrpath " $dir" ;;
 	    esac
 	  fi
 	  deplibs="$deplib $deplibs"
 	  continue
 	  ;;
-	*.la) lib="$deplib" ;;
+	*.la)
+	  func_resolve_sysroot "$deplib"
+	  lib=$func_resolve_sysroot_result
+	  ;;
 	*.$libext)
 	  if test "$pass" = conv; then
 	    deplibs="$deplib $deplibs"
@@ -5234,7 +6327,7 @@ func_mode_link ()
 		match_pattern*)
 		  set dummy $deplibs_check_method; shift
 		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
-		  if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
+		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
 		    | $EGREP "$match_pattern_regex" > /dev/null; then
 		    valid_a_lib=yes
 		  fi
@@ -5244,15 +6337,15 @@ func_mode_link ()
 		;;
 	      esac
 	      if test "$valid_a_lib" != yes; then
-		$ECHO
+		echo
 		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
-		$ECHO "*** I have the capability to make that library automatically link in when"
-		$ECHO "*** you link to this library.  But I can only do this if you have a"
-		$ECHO "*** shared version of the library, which you do not appear to have"
-		$ECHO "*** because the file extensions .$libext of this argument makes me believe"
-		$ECHO "*** that it is just a static archive that I should not use here."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because the file extensions .$libext of this argument makes me believe"
+		echo "*** that it is just a static archive that I should not use here."
 	      else
-		$ECHO
+		echo
 		$ECHO "*** Warning: Linking the shared library $output against the"
 		$ECHO "*** static library $deplib is not portable!"
 		deplibs="$deplib $deplibs"
@@ -5279,11 +6372,11 @@ func_mode_link ()
 	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 	      # If there is no dlopen support or we're linking statically,
 	      # we need to preload.
-	      newdlprefiles="$newdlprefiles $deplib"
+	      func_append newdlprefiles " $deplib"
 	      compile_deplibs="$deplib $compile_deplibs"
 	      finalize_deplibs="$deplib $finalize_deplibs"
 	    else
-	      newdlfiles="$newdlfiles $deplib"
+	      func_append newdlfiles " $deplib"
 	    fi
 	  fi
 	  continue
@@ -5325,20 +6418,20 @@ func_mode_link ()
 
 	# Convert "-framework foo" to "foo.ltframework"
 	if test -n "$inherited_linker_flags"; then
-	  tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
+	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
 	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
 	    case " $new_inherited_linker_flags " in
 	      *" $tmp_inherited_linker_flag "*) ;;
-	      *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
+	      *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
 	    esac
 	  done
 	fi
-	dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 	if test "$linkmode,$pass" = "lib,link" ||
 	   test "$linkmode,$pass" = "prog,scan" ||
 	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
-	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
-	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+	  test -n "$dlopen" && func_append dlfiles " $dlopen"
+	  test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
 	fi
 
 	if test "$pass" = conv; then
@@ -5349,20 +6442,20 @@ func_mode_link ()
 	      func_fatal_error "cannot find name of link library for \`$lib'"
 	    fi
 	    # It is a libtool convenience library, so add in its objects.
-	    convenience="$convenience $ladir/$objdir/$old_library"
-	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
+	    func_append convenience " $ladir/$objdir/$old_library"
+	    func_append old_convenience " $ladir/$objdir/$old_library"
 	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
 	    func_fatal_error "\`$lib' is not a convenience library"
 	  fi
 	  tmp_libs=
 	  for deplib in $dependency_libs; do
 	    deplibs="$deplib $deplibs"
-	    if $opt_duplicate_deps ; then
+	    if $opt_preserve_dup_deps ; then
 	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
 	      esac
 	    fi
-	    tmp_libs="$tmp_libs $deplib"
+	    func_append tmp_libs " $deplib"
 	  done
 	  continue
 	fi # $pass = conv
@@ -5370,9 +6463,15 @@ func_mode_link ()
 
 	# Get the name of the library we link against.
 	linklib=
-	for l in $old_library $library_names; do
-	  linklib="$l"
-	done
+	if test -n "$old_library" &&
+	   { test "$prefer_static_libs" = yes ||
+	     test "$prefer_static_libs,$installed" = "built,no"; }; then
+	  linklib=$old_library
+	else
+	  for l in $old_library $library_names; do
+	    linklib="$l"
+	  done
+	fi
 	if test -z "$linklib"; then
 	  func_fatal_error "cannot find name of link library for \`$lib'"
 	fi
@@ -5389,9 +6488,9 @@ func_mode_link ()
 	    # statically, we need to preload.  We also need to preload any
 	    # dependent libraries so libltdl's deplib preloader doesn't
 	    # bomb out in the load deplibs phase.
-	    dlprefiles="$dlprefiles $lib $dependency_libs"
+	    func_append dlprefiles " $lib $dependency_libs"
 	  else
-	    newdlfiles="$newdlfiles $lib"
+	    func_append newdlfiles " $lib"
 	  fi
 	  continue
 	fi # $pass = dlopen
@@ -5413,14 +6512,14 @@ func_mode_link ()
 
 	# Find the relevant object directory and library name.
 	if test "X$installed" = Xyes; then
-	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	  if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 	    func_warning "library \`$lib' was moved."
 	    dir="$ladir"
 	    absdir="$abs_ladir"
 	    libdir="$abs_ladir"
 	  else
-	    dir="$libdir"
-	    absdir="$libdir"
+	    dir="$lt_sysroot$libdir"
+	    absdir="$lt_sysroot$libdir"
 	  fi
 	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
 	else
@@ -5428,12 +6527,12 @@ func_mode_link ()
 	    dir="$ladir"
 	    absdir="$abs_ladir"
 	    # Remove this search path later
-	    notinst_path="$notinst_path $abs_ladir"
+	    func_append notinst_path " $abs_ladir"
 	  else
 	    dir="$ladir/$objdir"
 	    absdir="$abs_ladir/$objdir"
 	    # Remove this search path later
-	    notinst_path="$notinst_path $abs_ladir"
+	    func_append notinst_path " $abs_ladir"
 	  fi
 	fi # $installed = yes
 	func_stripname 'lib' '.la' "$laname"
@@ -5444,20 +6543,46 @@ func_mode_link ()
 	  if test -z "$libdir" && test "$linkmode" = prog; then
 	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
 	  fi
-	  # Prefer using a static library (so that no silly _DYNAMIC symbols
-	  # are required to link).
-	  if test -n "$old_library"; then
-	    newdlprefiles="$newdlprefiles $dir/$old_library"
-	    # Keep a list of preopened convenience libraries to check
-	    # that they are being used correctly in the link pass.
-	    test -z "$libdir" && \
-		dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
-	  # Otherwise, use the dlname, so that lt_dlopen finds it.
-	  elif test -n "$dlname"; then
-	    newdlprefiles="$newdlprefiles $dir/$dlname"
-	  else
-	    newdlprefiles="$newdlprefiles $dir/$linklib"
-	  fi
+	  case "$host" in
+	    # special handling for platforms with PE-DLLs.
+	    *cygwin* | *mingw* | *cegcc* )
+	      # Linker will automatically link against shared library if both
+	      # static and shared are present.  Therefore, ensure we extract
+	      # symbols from the import library if a shared library is present
+	      # (otherwise, the dlopen module name will be incorrect).  We do
+	      # this by putting the import library name into $newdlprefiles.
+	      # We recover the dlopen module name by 'saving' the la file
+	      # name in a special purpose variable, and (later) extracting the
+	      # dlname from the la file.
+	      if test -n "$dlname"; then
+	        func_tr_sh "$dir/$linklib"
+	        eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
+	        func_append newdlprefiles " $dir/$linklib"
+	      else
+	        func_append newdlprefiles " $dir/$old_library"
+	        # Keep a list of preopened convenience libraries to check
+	        # that they are being used correctly in the link pass.
+	        test -z "$libdir" && \
+	          func_append dlpreconveniencelibs " $dir/$old_library"
+	      fi
+	    ;;
+	    * )
+	      # Prefer using a static library (so that no silly _DYNAMIC symbols
+	      # are required to link).
+	      if test -n "$old_library"; then
+	        func_append newdlprefiles " $dir/$old_library"
+	        # Keep a list of preopened convenience libraries to check
+	        # that they are being used correctly in the link pass.
+	        test -z "$libdir" && \
+	          func_append dlpreconveniencelibs " $dir/$old_library"
+	      # Otherwise, use the dlname, so that lt_dlopen finds it.
+	      elif test -n "$dlname"; then
+	        func_append newdlprefiles " $dir/$dlname"
+	      else
+	        func_append newdlprefiles " $dir/$linklib"
+	      fi
+	    ;;
+	  esac
 	fi # $pass = dlpreopen
 
 	if test -z "$libdir"; then
@@ -5475,7 +6600,7 @@ func_mode_link ()
 
 
 	if test "$linkmode" = prog && test "$pass" != link; then
-	  newlib_search_path="$newlib_search_path $ladir"
+	  func_append newlib_search_path " $ladir"
 	  deplibs="$lib $deplibs"
 
 	  linkalldeplibs=no
@@ -5488,7 +6613,8 @@ func_mode_link ()
 	  for deplib in $dependency_libs; do
 	    case $deplib in
 	    -L*) func_stripname '-L' '' "$deplib"
-	         newlib_search_path="$newlib_search_path $func_stripname_result"
+	         func_resolve_sysroot "$func_stripname_result"
+	         func_append newlib_search_path " $func_resolve_sysroot_result"
 		 ;;
 	    esac
 	    # Need to link against all dependency_libs?
@@ -5499,12 +6625,12 @@ func_mode_link ()
 	      # or/and link against static libraries
 	      newdependency_libs="$deplib $newdependency_libs"
 	    fi
-	    if $opt_duplicate_deps ; then
+	    if $opt_preserve_dup_deps ; then
 	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
 	      esac
 	    fi
-	    tmp_libs="$tmp_libs $deplib"
+	    func_append tmp_libs " $deplib"
 	  done # for deplib
 	  continue
 	fi # $linkmode = prog...
@@ -5519,7 +6645,7 @@ func_mode_link ()
 	      # Make sure the rpath contains only unique directories.
 	      case "$temp_rpath:" in
 	      *"$absdir:"*) ;;
-	      *) temp_rpath="$temp_rpath$absdir:" ;;
+	      *) func_append temp_rpath "$absdir:" ;;
 	      esac
 	    fi
 
@@ -5531,7 +6657,7 @@ func_mode_link ()
 	    *)
 	      case "$compile_rpath " in
 	      *" $absdir "*) ;;
-	      *) compile_rpath="$compile_rpath $absdir"
+	      *) func_append compile_rpath " $absdir" ;;
 	      esac
 	      ;;
 	    esac
@@ -5540,7 +6666,7 @@ func_mode_link ()
 	    *)
 	      case "$finalize_rpath " in
 	      *" $libdir "*) ;;
-	      *) finalize_rpath="$finalize_rpath $libdir"
+	      *) func_append finalize_rpath " $libdir" ;;
 	      esac
 	      ;;
 	    esac
@@ -5565,12 +6691,12 @@ func_mode_link ()
 	  case $host in
 	  *cygwin* | *mingw* | *cegcc*)
 	      # No point in relinking DLLs because paths are not encoded
-	      notinst_deplibs="$notinst_deplibs $lib"
+	      func_append notinst_deplibs " $lib"
 	      need_relink=no
 	    ;;
 	  *)
 	    if test "$installed" = no; then
-	      notinst_deplibs="$notinst_deplibs $lib"
+	      func_append notinst_deplibs " $lib"
 	      need_relink=yes
 	    fi
 	    ;;
@@ -5587,7 +6713,7 @@ func_mode_link ()
 	    fi
 	  done
 	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
-	    $ECHO
+	    echo
 	    if test "$linkmode" = prog; then
 	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
 	    else
@@ -5605,7 +6731,7 @@ func_mode_link ()
 	    *)
 	      case "$compile_rpath " in
 	      *" $absdir "*) ;;
-	      *) compile_rpath="$compile_rpath $absdir"
+	      *) func_append compile_rpath " $absdir" ;;
 	      esac
 	      ;;
 	    esac
@@ -5614,7 +6740,7 @@ func_mode_link ()
 	    *)
 	      case "$finalize_rpath " in
 	      *" $libdir "*) ;;
-	      *) finalize_rpath="$finalize_rpath $libdir"
+	      *) func_append finalize_rpath " $libdir" ;;
 	      esac
 	      ;;
 	    esac
@@ -5668,7 +6794,7 @@ func_mode_link ()
 	    linklib=$newlib
 	  fi # test -n "$old_archive_from_expsyms_cmds"
 
-	  if test "$linkmode" = prog || test "$mode" != relink; then
+	  if test "$linkmode" = prog || test "$opt_mode" != relink; then
 	    add_shlibpath=
 	    add_dir=
 	    add=
@@ -5690,9 +6816,9 @@ func_mode_link ()
 		      if test "X$dlopenmodule" != "X$lib"; then
 			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
 			if test -z "$old_library" ; then
-			  $ECHO
-			  $ECHO "*** And there doesn't seem to be a static archive available"
-			  $ECHO "*** The link will probably fail, sorry"
+			  echo
+			  echo "*** And there doesn't seem to be a static archive available"
+			  echo "*** The link will probably fail, sorry"
 			else
 			  add="$dir/$old_library"
 			fi
@@ -5719,12 +6845,12 @@ func_mode_link ()
 	         test "$hardcode_direct_absolute" = no; then
 		add="$dir/$linklib"
 	      elif test "$hardcode_minus_L" = yes; then
-		add_dir="-L$dir"
+		add_dir="-L$absdir"
 		# Try looking first in the location we're being installed to.
 		if test -n "$inst_prefix_dir"; then
 		  case $libdir in
 		    [\\/]*)
-		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		      func_append add_dir " -L$inst_prefix_dir$libdir"
 		      ;;
 		  esac
 		fi
@@ -5746,7 +6872,7 @@ func_mode_link ()
 	    if test -n "$add_shlibpath"; then
 	      case :$compile_shlibpath: in
 	      *":$add_shlibpath:"*) ;;
-	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+	      *) func_append compile_shlibpath "$add_shlibpath:" ;;
 	      esac
 	    fi
 	    if test "$linkmode" = prog; then
@@ -5760,13 +6886,13 @@ func_mode_link ()
 		 test "$hardcode_shlibpath_var" = yes; then
 		case :$finalize_shlibpath: in
 		*":$libdir:"*) ;;
-		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+		*) func_append finalize_shlibpath "$libdir:" ;;
 		esac
 	      fi
 	    fi
 	  fi
 
-	  if test "$linkmode" = prog || test "$mode" = relink; then
+	  if test "$linkmode" = prog || test "$opt_mode" = relink; then
 	    add_shlibpath=
 	    add_dir=
 	    add=
@@ -5780,7 +6906,7 @@ func_mode_link ()
 	    elif test "$hardcode_shlibpath_var" = yes; then
 	      case :$finalize_shlibpath: in
 	      *":$libdir:"*) ;;
-	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+	      *) func_append finalize_shlibpath "$libdir:" ;;
 	      esac
 	      add="-l$name"
 	    elif test "$hardcode_automatic" = yes; then
@@ -5797,7 +6923,7 @@ func_mode_link ()
 	      if test -n "$inst_prefix_dir"; then
 		case $libdir in
 		  [\\/]*)
-		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		    func_append add_dir " -L$inst_prefix_dir$libdir"
 		    ;;
 		esac
 	      fi
@@ -5832,21 +6958,21 @@ func_mode_link ()
 
 	    # Just print a warning and add the library to dependency_libs so
 	    # that the program can be linked against the static library.
-	    $ECHO
+	    echo
 	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
-	    $ECHO "*** I have the capability to make that library automatically link in when"
-	    $ECHO "*** you link to this library.  But I can only do this if you have a"
-	    $ECHO "*** shared version of the library, which you do not appear to have."
+	    echo "*** I have the capability to make that library automatically link in when"
+	    echo "*** you link to this library.  But I can only do this if you have a"
+	    echo "*** shared version of the library, which you do not appear to have."
 	    if test "$module" = yes; then
-	      $ECHO "*** But as you try to build a module library, libtool will still create "
-	      $ECHO "*** a static module, that should work as long as the dlopening application"
-	      $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      echo "*** But as you try to build a module library, libtool will still create "
+	      echo "*** a static module, that should work as long as the dlopening application"
+	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
 	      if test -z "$global_symbol_pipe"; then
-		$ECHO
-		$ECHO "*** However, this would only work if libtool was able to extract symbol"
-		$ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
-		$ECHO "*** not find such a program.  So, this module is probably useless."
-		$ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
+		echo
+		echo "*** However, this would only work if libtool was able to extract symbol"
+		echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		echo "*** not find such a program.  So, this module is probably useless."
+		echo "*** \`nm' from GNU binutils and a full rebuild may help."
 	      fi
 	      if test "$build_old_libs" = no; then
 		build_libtool_libs=module
@@ -5874,37 +7000,46 @@ func_mode_link ()
 	           temp_xrpath=$func_stripname_result
 		   case " $xrpath " in
 		   *" $temp_xrpath "*) ;;
-		   *) xrpath="$xrpath $temp_xrpath";;
+		   *) func_append xrpath " $temp_xrpath";;
 		   esac;;
-	      *) temp_deplibs="$temp_deplibs $libdir";;
+	      *) func_append temp_deplibs " $libdir";;
 	      esac
 	    done
 	    dependency_libs="$temp_deplibs"
 	  fi
 
-	  newlib_search_path="$newlib_search_path $absdir"
+	  func_append newlib_search_path " $absdir"
 	  # Link against this library
 	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
 	  # ... and its dependency_libs
 	  tmp_libs=
 	  for deplib in $dependency_libs; do
 	    newdependency_libs="$deplib $newdependency_libs"
-	    if $opt_duplicate_deps ; then
+	    case $deplib in
+              -L*) func_stripname '-L' '' "$deplib"
+                   func_resolve_sysroot "$func_stripname_result";;
+              *) func_resolve_sysroot "$deplib" ;;
+            esac
+	    if $opt_preserve_dup_deps ; then
 	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      *" $func_resolve_sysroot_result "*)
+                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
 	      esac
 	    fi
-	    tmp_libs="$tmp_libs $deplib"
+	    func_append tmp_libs " $func_resolve_sysroot_result"
 	  done
 
 	  if test "$link_all_deplibs" != no; then
 	    # Add the search paths of all dependency libraries
 	    for deplib in $dependency_libs; do
+	      path=
 	      case $deplib in
 	      -L*) path="$deplib" ;;
 	      *.la)
+	        func_resolve_sysroot "$deplib"
+	        deplib=$func_resolve_sysroot_result
 	        func_dirname "$deplib" "" "."
-		dir="$func_dirname_result"
+		dir=$func_dirname_result
 		# We need an absolute path.
 		case $dir in
 		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
@@ -5931,8 +7066,8 @@ func_mode_link ()
                       if test -z "$darwin_install_name"; then
                           darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
                       fi
-		      compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
-		      linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
+		      func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+		      func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
 		      path=
 		    fi
 		  fi
@@ -5965,7 +7100,7 @@ func_mode_link ()
 	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
 	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
 	else
-	  compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 	fi
       fi
       dependency_libs="$newdependency_libs"
@@ -5982,7 +7117,7 @@ func_mode_link ()
 	  for dir in $newlib_search_path; do
 	    case "$lib_search_path " in
 	    *" $dir "*) ;;
-	    *) lib_search_path="$lib_search_path $dir" ;;
+	    *) func_append lib_search_path " $dir" ;;
 	    esac
 	  done
 	  newlib_search_path=
@@ -6040,10 +7175,10 @@ func_mode_link ()
 	    -L*)
 	      case " $tmp_libs " in
 	      *" $deplib "*) ;;
-	      *) tmp_libs="$tmp_libs $deplib" ;;
+	      *) func_append tmp_libs " $deplib" ;;
 	      esac
 	      ;;
-	    *) tmp_libs="$tmp_libs $deplib" ;;
+	    *) func_append tmp_libs " $deplib" ;;
 	    esac
 	  done
 	  eval $var=\"$tmp_libs\"
@@ -6059,7 +7194,7 @@ func_mode_link ()
 	  ;;
 	esac
 	if test -n "$i" ; then
-	  tmp_libs="$tmp_libs $i"
+	  func_append tmp_libs " $i"
 	fi
       done
       dependency_libs=$tmp_libs
@@ -6100,7 +7235,7 @@ func_mode_link ()
       # Now set the variables for building old libraries.
       build_libtool_libs=no
       oldlibs="$output"
-      objs="$objs$old_deplibs"
+      func_append objs "$old_deplibs"
       ;;
 
     lib)
@@ -6133,10 +7268,10 @@ func_mode_link ()
 	if test "$deplibs_check_method" != pass_all; then
 	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
 	else
-	  $ECHO
+	  echo
 	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
 	  $ECHO "*** objects $objs is not portable!"
-	  libobjs="$libobjs $objs"
+	  func_append libobjs " $objs"
 	fi
       fi
 
@@ -6195,13 +7330,14 @@ func_mode_link ()
 	  # which has an extra 1 added just for fun
 	  #
 	  case $version_type in
+	  # correct linux to gnu/linux during the next big refactor
 	  darwin|linux|osf|windows|none)
 	    func_arith $number_major + $number_minor
 	    current=$func_arith_result
 	    age="$number_minor"
 	    revision="$number_revision"
 	    ;;
-	  freebsd-aout|freebsd-elf|sunos)
+	  freebsd-aout|freebsd-elf|qnx|sunos)
 	    current="$number_major"
 	    revision="$number_minor"
 	    age="0"
@@ -6311,7 +7447,7 @@ func_mode_link ()
 	  versuffix="$major.$revision"
 	  ;;
 
-	linux)
+	linux) # correct to gnu/linux during the next big refactor
 	  func_arith $current - $age
 	  major=.$func_arith_result
 	  versuffix="$major.$age.$revision"
@@ -6334,7 +7470,7 @@ func_mode_link ()
 	  done
 
 	  # Make executables depend on our current version.
-	  verstring="$verstring:${current}.0"
+	  func_append verstring ":${current}.0"
 	  ;;
 
 	qnx)
@@ -6402,10 +7538,10 @@ func_mode_link ()
       fi
 
       func_generate_dlsyms "$libname" "$libname" "yes"
-      libobjs="$libobjs $symfileobj"
+      func_append libobjs " $symfileobj"
       test "X$libobjs" = "X " && libobjs=
 
-      if test "$mode" != relink; then
+      if test "$opt_mode" != relink; then
 	# Remove our outputs, but don't remove object files since they
 	# may have been created when compiling PIC objects.
 	removelist=
@@ -6421,7 +7557,7 @@ func_mode_link ()
 		   continue
 		 fi
 	       fi
-	       removelist="$removelist $p"
+	       func_append removelist " $p"
 	       ;;
 	    *) ;;
 	  esac
@@ -6432,27 +7568,28 @@ func_mode_link ()
 
       # Now set the variables for building old libraries.
       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
-	oldlibs="$oldlibs $output_objdir/$libname.$libext"
+	func_append oldlibs " $output_objdir/$libname.$libext"
 
 	# Transform .lo files to .o files.
-	oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
       fi
 
       # Eliminate all temporary directories.
       #for path in $notinst_path; do
-      #	lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
-      #	deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
-      #	dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
+      #	lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
+      #	deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
+      #	dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
       #done
 
       if test -n "$xrpath"; then
 	# If the user specified any rpath flags, then add them.
 	temp_xrpath=
 	for libdir in $xrpath; do
-	  temp_xrpath="$temp_xrpath -R$libdir"
+	  func_replace_sysroot "$libdir"
+	  func_append temp_xrpath " -R$func_replace_sysroot_result"
 	  case "$finalize_rpath " in
 	  *" $libdir "*) ;;
-	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  *) func_append finalize_rpath " $libdir" ;;
 	  esac
 	done
 	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
@@ -6466,7 +7603,7 @@ func_mode_link ()
       for lib in $old_dlfiles; do
 	case " $dlprefiles $dlfiles " in
 	*" $lib "*) ;;
-	*) dlfiles="$dlfiles $lib" ;;
+	*) func_append dlfiles " $lib" ;;
 	esac
       done
 
@@ -6476,19 +7613,19 @@ func_mode_link ()
       for lib in $old_dlprefiles; do
 	case "$dlprefiles " in
 	*" $lib "*) ;;
-	*) dlprefiles="$dlprefiles $lib" ;;
+	*) func_append dlprefiles " $lib" ;;
 	esac
       done
 
       if test "$build_libtool_libs" = yes; then
 	if test -n "$rpath"; then
 	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
 	    # these systems don't actually have a c library (as such)!
 	    ;;
 	  *-*-rhapsody* | *-*-darwin1.[012])
 	    # Rhapsody C library is in the System framework
-	    deplibs="$deplibs System.ltframework"
+	    func_append deplibs " System.ltframework"
 	    ;;
 	  *-*-netbsd*)
 	    # Don't link with libc until the a.out ld.so is fixed.
@@ -6505,7 +7642,7 @@ func_mode_link ()
 	  *)
 	    # Add libc to deplibs on all other systems if necessary.
 	    if test "$build_libtool_need_lc" = "yes"; then
-	      deplibs="$deplibs -lc"
+	      func_append deplibs " -lc"
 	    fi
 	    ;;
 	  esac
@@ -6554,7 +7691,7 @@ EOF
 		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		  case " $predeps $postdeps " in
 		  *" $i "*)
-		    newdeplibs="$newdeplibs $i"
+		    func_append newdeplibs " $i"
 		    i=""
 		    ;;
 		  esac
@@ -6565,21 +7702,21 @@ EOF
 		  set dummy $deplib_matches; shift
 		  deplib_match=$1
 		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		    newdeplibs="$newdeplibs $i"
+		    func_append newdeplibs " $i"
 		  else
 		    droppeddeps=yes
-		    $ECHO
+		    echo
 		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-		    $ECHO "*** I have the capability to make that library automatically link in when"
-		    $ECHO "*** you link to this library.  But I can only do this if you have a"
-		    $ECHO "*** shared version of the library, which I believe you do not have"
-		    $ECHO "*** because a test_compile did reveal that the linker did not use it for"
-		    $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
+		    echo "*** I have the capability to make that library automatically link in when"
+		    echo "*** you link to this library.  But I can only do this if you have a"
+		    echo "*** shared version of the library, which I believe you do not have"
+		    echo "*** because a test_compile did reveal that the linker did not use it for"
+		    echo "*** its dynamic dependency list that programs get resolved with at runtime."
 		  fi
 		fi
 		;;
 	      *)
-		newdeplibs="$newdeplibs $i"
+		func_append newdeplibs " $i"
 		;;
 	      esac
 	    done
@@ -6597,7 +7734,7 @@ EOF
 		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		    case " $predeps $postdeps " in
 		    *" $i "*)
-		      newdeplibs="$newdeplibs $i"
+		      func_append newdeplibs " $i"
 		      i=""
 		      ;;
 		    esac
@@ -6608,29 +7745,29 @@ EOF
 		    set dummy $deplib_matches; shift
 		    deplib_match=$1
 		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		      newdeplibs="$newdeplibs $i"
+		      func_append newdeplibs " $i"
 		    else
 		      droppeddeps=yes
-		      $ECHO
+		      echo
 		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-		      $ECHO "*** I have the capability to make that library automatically link in when"
-		      $ECHO "*** you link to this library.  But I can only do this if you have a"
-		      $ECHO "*** shared version of the library, which you do not appear to have"
-		      $ECHO "*** because a test_compile did reveal that the linker did not use this one"
-		      $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
+		      echo "*** I have the capability to make that library automatically link in when"
+		      echo "*** you link to this library.  But I can only do this if you have a"
+		      echo "*** shared version of the library, which you do not appear to have"
+		      echo "*** because a test_compile did reveal that the linker did not use this one"
+		      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 		    fi
 		  fi
 		else
 		  droppeddeps=yes
-		  $ECHO
+		  echo
 		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
-		  $ECHO "*** make it link in!  You will probably need to install it or some"
-		  $ECHO "*** library that it depends on before this library will be fully"
-		  $ECHO "*** functional.  Installing it before continuing would be even better."
+		  echo "*** make it link in!  You will probably need to install it or some"
+		  echo "*** library that it depends on before this library will be fully"
+		  echo "*** functional.  Installing it before continuing would be even better."
 		fi
 		;;
 	      *)
-		newdeplibs="$newdeplibs $i"
+		func_append newdeplibs " $i"
 		;;
 	      esac
 	    done
@@ -6647,15 +7784,27 @@ EOF
 	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		case " $predeps $postdeps " in
 		*" $a_deplib "*)
-		  newdeplibs="$newdeplibs $a_deplib"
+		  func_append newdeplibs " $a_deplib"
 		  a_deplib=""
 		  ;;
 		esac
 	      fi
 	      if test -n "$a_deplib" ; then
 		libname=`eval "\\$ECHO \"$libname_spec\""`
+		if test -n "$file_magic_glob"; then
+		  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
+		else
+		  libnameglob=$libname
+		fi
+		test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
 		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  if test "$want_nocaseglob" = yes; then
+		    shopt -s nocaseglob
+		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+		    $nocaseglob
+		  else
+		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+		  fi
 		  for potent_lib in $potential_libs; do
 		      # Follow soft links.
 		      if ls -lLd "$potent_lib" 2>/dev/null |
@@ -6672,13 +7821,13 @@ EOF
 			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
 			case $potliblink in
 			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
-			*) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+			*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
 			esac
 		      done
 		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
 			 $SED -e 10q |
 			 $EGREP "$file_magic_regex" > /dev/null; then
-			newdeplibs="$newdeplibs $a_deplib"
+			func_append newdeplibs " $a_deplib"
 			a_deplib=""
 			break 2
 		      fi
@@ -6687,12 +7836,12 @@ EOF
 	      fi
 	      if test -n "$a_deplib" ; then
 		droppeddeps=yes
-		$ECHO
+		echo
 		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-		$ECHO "*** I have the capability to make that library automatically link in when"
-		$ECHO "*** you link to this library.  But I can only do this if you have a"
-		$ECHO "*** shared version of the library, which you do not appear to have"
-		$ECHO "*** because I did check the linker path looking for a file starting"
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
 		if test -z "$potlib" ; then
 		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
 		else
@@ -6703,7 +7852,7 @@ EOF
 	      ;;
 	    *)
 	      # Add a -L argument.
-	      newdeplibs="$newdeplibs $a_deplib"
+	      func_append newdeplibs " $a_deplib"
 	      ;;
 	    esac
 	  done # Gone through all deplibs.
@@ -6719,7 +7868,7 @@ EOF
 	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		case " $predeps $postdeps " in
 		*" $a_deplib "*)
-		  newdeplibs="$newdeplibs $a_deplib"
+		  func_append newdeplibs " $a_deplib"
 		  a_deplib=""
 		  ;;
 		esac
@@ -6730,9 +7879,9 @@ EOF
 		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 		  for potent_lib in $potential_libs; do
 		    potlib="$potent_lib" # see symlink-check above in file_magic test
-		    if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
+		    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
 		       $EGREP "$match_pattern_regex" > /dev/null; then
-		      newdeplibs="$newdeplibs $a_deplib"
+		      func_append newdeplibs " $a_deplib"
 		      a_deplib=""
 		      break 2
 		    fi
@@ -6741,12 +7890,12 @@ EOF
 	      fi
 	      if test -n "$a_deplib" ; then
 		droppeddeps=yes
-		$ECHO
+		echo
 		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-		$ECHO "*** I have the capability to make that library automatically link in when"
-		$ECHO "*** you link to this library.  But I can only do this if you have a"
-		$ECHO "*** shared version of the library, which you do not appear to have"
-		$ECHO "*** because I did check the linker path looking for a file starting"
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
 		if test -z "$potlib" ; then
 		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
 		else
@@ -6757,32 +7906,32 @@ EOF
 	      ;;
 	    *)
 	      # Add a -L argument.
-	      newdeplibs="$newdeplibs $a_deplib"
+	      func_append newdeplibs " $a_deplib"
 	      ;;
 	    esac
 	  done # Gone through all deplibs.
 	  ;;
 	none | unknown | *)
 	  newdeplibs=""
-	  tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
-	      -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
+	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
 	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 	    for i in $predeps $postdeps ; do
 	      # can't use Xsed below, because $i might contain '/'
-	      tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
+	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
 	    done
 	  fi
-	  if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[	 ]//g' |
-	     $GREP . >/dev/null; then
-	    $ECHO
+	  case $tmp_deplibs in
+	  *[!\	\ ]*)
+	    echo
 	    if test "X$deplibs_check_method" = "Xnone"; then
-	      $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
+	      echo "*** Warning: inter-library dependencies are not supported in this platform."
 	    else
-	      $ECHO "*** Warning: inter-library dependencies are not known to be supported."
+	      echo "*** Warning: inter-library dependencies are not known to be supported."
 	    fi
-	    $ECHO "*** All declared inter-library dependencies are being dropped."
+	    echo "*** All declared inter-library dependencies are being dropped."
 	    droppeddeps=yes
-	  fi
+	    ;;
+	  esac
 	  ;;
 	esac
 	versuffix=$versuffix_save
@@ -6794,23 +7943,23 @@ EOF
 	case $host in
 	*-*-rhapsody* | *-*-darwin1.[012])
 	  # On Rhapsody replace the C library with the System framework
-	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
 	  ;;
 	esac
 
 	if test "$droppeddeps" = yes; then
 	  if test "$module" = yes; then
-	    $ECHO
-	    $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
+	    echo
+	    echo "*** Warning: libtool could not satisfy all declared inter-library"
 	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
-	    $ECHO "*** a static module, that should work as long as the dlopening"
-	    $ECHO "*** application is linked with the -dlopen flag."
+	    echo "*** a static module, that should work as long as the dlopening"
+	    echo "*** application is linked with the -dlopen flag."
 	    if test -z "$global_symbol_pipe"; then
-	      $ECHO
-	      $ECHO "*** However, this would only work if libtool was able to extract symbol"
-	      $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
-	      $ECHO "*** not find such a program.  So, this module is probably useless."
-	      $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
+	      echo
+	      echo "*** However, this would only work if libtool was able to extract symbol"
+	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      echo "*** not find such a program.  So, this module is probably useless."
+	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
 	    fi
 	    if test "$build_old_libs" = no; then
 	      oldlibs="$output_objdir/$libname.$libext"
@@ -6820,16 +7969,16 @@ EOF
 	      build_libtool_libs=no
 	    fi
 	  else
-	    $ECHO "*** The inter-library dependencies that have been dropped here will be"
-	    $ECHO "*** automatically added whenever a program is linked with this library"
-	    $ECHO "*** or is declared to -dlopen it."
+	    echo "*** The inter-library dependencies that have been dropped here will be"
+	    echo "*** automatically added whenever a program is linked with this library"
+	    echo "*** or is declared to -dlopen it."
 
 	    if test "$allow_undefined" = no; then
-	      $ECHO
-	      $ECHO "*** Since this library must not contain undefined symbols,"
-	      $ECHO "*** because either the platform does not support them or"
-	      $ECHO "*** it was explicitly requested with -no-undefined,"
-	      $ECHO "*** libtool will only create a static version of it."
+	      echo
+	      echo "*** Since this library must not contain undefined symbols,"
+	      echo "*** because either the platform does not support them or"
+	      echo "*** it was explicitly requested with -no-undefined,"
+	      echo "*** libtool will only create a static version of it."
 	      if test "$build_old_libs" = no; then
 		oldlibs="$output_objdir/$libname.$libext"
 		build_libtool_libs=module
@@ -6846,9 +7995,9 @@ EOF
       # Time to change all our "foo.ltframework" stuff back to "-framework foo"
       case $host in
 	*-*-darwin*)
-	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 	  ;;
       esac
 
@@ -6861,7 +8010,7 @@ EOF
 	*)
 	  case " $deplibs " in
 	  *" -L$path/$objdir "*)
-	    new_libs="$new_libs -L$path/$objdir" ;;
+	    func_append new_libs " -L$path/$objdir" ;;
 	  esac
 	  ;;
 	esac
@@ -6871,10 +8020,10 @@ EOF
 	-L*)
 	  case " $new_libs " in
 	  *" $deplib "*) ;;
-	  *) new_libs="$new_libs $deplib" ;;
+	  *) func_append new_libs " $deplib" ;;
 	  esac
 	  ;;
-	*) new_libs="$new_libs $deplib" ;;
+	*) func_append new_libs " $deplib" ;;
 	esac
       done
       deplibs="$new_libs"
@@ -6886,15 +8035,22 @@ EOF
 
       # Test again, we may have decided not to build it any more
       if test "$build_libtool_libs" = yes; then
+	# Remove ${wl} instances when linking with ld.
+	# FIXME: should test the right _cmds variable.
+	case $archive_cmds in
+	  *\$LD\ *) wl= ;;
+        esac
 	if test "$hardcode_into_libs" = yes; then
 	  # Hardcode the library paths
 	  hardcode_libdirs=
 	  dep_rpath=
 	  rpath="$finalize_rpath"
-	  test "$mode" != relink && rpath="$compile_rpath$rpath"
+	  test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
 	  for libdir in $rpath; do
 	    if test -n "$hardcode_libdir_flag_spec"; then
 	      if test -n "$hardcode_libdir_separator"; then
+		func_replace_sysroot "$libdir"
+		libdir=$func_replace_sysroot_result
 		if test -z "$hardcode_libdirs"; then
 		  hardcode_libdirs="$libdir"
 		else
@@ -6903,18 +8059,18 @@ EOF
 		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 		    ;;
 		  *)
-		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		    func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
 		    ;;
 		  esac
 		fi
 	      else
 		eval flag=\"$hardcode_libdir_flag_spec\"
-		dep_rpath="$dep_rpath $flag"
+		func_append dep_rpath " $flag"
 	      fi
 	    elif test -n "$runpath_var"; then
 	      case "$perm_rpath " in
 	      *" $libdir "*) ;;
-	      *) perm_rpath="$perm_rpath $libdir" ;;
+	      *) func_append perm_rpath " $libdir" ;;
 	      esac
 	    fi
 	  done
@@ -6922,17 +8078,13 @@ EOF
 	  if test -n "$hardcode_libdir_separator" &&
 	     test -n "$hardcode_libdirs"; then
 	    libdir="$hardcode_libdirs"
-	    if test -n "$hardcode_libdir_flag_spec_ld"; then
-	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
-	    else
-	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
-	    fi
+	    eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
 	  fi
 	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
 	    # We should set the runpath_var.
 	    rpath=
 	    for dir in $perm_rpath; do
-	      rpath="$rpath$dir:"
+	      func_append rpath "$dir:"
 	    done
 	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
 	  fi
@@ -6940,7 +8092,7 @@ EOF
 	fi
 
 	shlibpath="$finalize_shlibpath"
-	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
 	if test -n "$shlibpath"; then
 	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
 	fi
@@ -6966,18 +8118,18 @@ EOF
 	linknames=
 	for link
 	do
-	  linknames="$linknames $link"
+	  func_append linknames " $link"
 	done
 
 	# Use standard objects if they are pic
-	test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
 	test "X$libobjs" = "X " && libobjs=
 
 	delfiles=
 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
 	  export_symbols="$output_objdir/$libname.uexp"
-	  delfiles="$delfiles $export_symbols"
+	  func_append delfiles " $export_symbols"
 	fi
 
 	orig_export_symbols=
@@ -7008,13 +8160,45 @@ EOF
 	    $opt_dry_run || $RM $export_symbols
 	    cmds=$export_symbols_cmds
 	    save_ifs="$IFS"; IFS='~'
-	    for cmd in $cmds; do
+	    for cmd1 in $cmds; do
 	      IFS="$save_ifs"
-	      eval cmd=\"$cmd\"
-	      func_len " $cmd"
-	      len=$func_len_result
-	      if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	      # Take the normal branch if the nm_file_list_spec branch
+	      # doesn't work or if tool conversion is not needed.
+	      case $nm_file_list_spec~$to_tool_file_cmd in
+		*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
+		  try_normal_branch=yes
+		  eval cmd=\"$cmd1\"
+		  func_len " $cmd"
+		  len=$func_len_result
+		  ;;
+		*)
+		  try_normal_branch=no
+		  ;;
+	      esac
+	      if test "$try_normal_branch" = yes \
+		 && { test "$len" -lt "$max_cmd_len" \
+		      || test "$max_cmd_len" -le -1; }
+	      then
+		func_show_eval "$cmd" 'exit $?'
+		skipped_export=false
+	      elif test -n "$nm_file_list_spec"; then
+		func_basename "$output"
+		output_la=$func_basename_result
+		save_libobjs=$libobjs
+		save_output=$output
+		output=${output_objdir}/${output_la}.nm
+		func_to_tool_file "$output"
+		libobjs=$nm_file_list_spec$func_to_tool_file_result
+		func_append delfiles " $output"
+		func_verbose "creating $NM input file list: $output"
+		for obj in $save_libobjs; do
+		  func_to_tool_file "$obj"
+		  $ECHO "$func_to_tool_file_result"
+		done > "$output"
+		eval cmd=\"$cmd1\"
 		func_show_eval "$cmd" 'exit $?'
+		output=$save_output
+		libobjs=$save_libobjs
 		skipped_export=false
 	      else
 		# The command line is too long to execute in one step.
@@ -7036,7 +8220,7 @@ EOF
 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	  tmp_export_symbols="$export_symbols"
 	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-	  $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+	  $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
 	fi
 
 	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
@@ -7048,7 +8232,7 @@ EOF
 	  # global variables. join(1) would be nice here, but unfortunately
 	  # isn't a blessed tool.
 	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-	  delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+	  func_append delfiles " $export_symbols $output_objdir/$libname.filter"
 	  export_symbols=$output_objdir/$libname.def
 	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
 	fi
@@ -7058,7 +8242,7 @@ EOF
 	  case " $convenience " in
 	  *" $test_deplib "*) ;;
 	  *)
-	    tmp_deplibs="$tmp_deplibs $test_deplib"
+	    func_append tmp_deplibs " $test_deplib"
 	    ;;
 	  esac
 	done
@@ -7078,21 +8262,21 @@ EOF
 	    test "X$libobjs" = "X " && libobjs=
 	  else
 	    gentop="$output_objdir/${outputname}x"
-	    generated="$generated $gentop"
+	    func_append generated " $gentop"
 
 	    func_extract_archives $gentop $convenience
-	    libobjs="$libobjs $func_extract_archives_result"
+	    func_append libobjs " $func_extract_archives_result"
 	    test "X$libobjs" = "X " && libobjs=
 	  fi
 	fi
 
 	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
 	  eval flag=\"$thread_safe_flag_spec\"
-	  linker_flags="$linker_flags $flag"
+	  func_append linker_flags " $flag"
 	fi
 
 	# Make a backup of the uninstalled library when relinking
-	if test "$mode" = relink; then
+	if test "$opt_mode" = relink; then
 	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
 	fi
 
@@ -7137,7 +8321,8 @@ EOF
 	    save_libobjs=$libobjs
 	  fi
 	  save_output=$output
-	  output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
+	  func_basename "$output"
+	  output_la=$func_basename_result
 
 	  # Clear the reloadable object creation command queue and
 	  # initialize k to one.
@@ -7150,13 +8335,16 @@ EOF
 	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
 	    output=${output_objdir}/${output_la}.lnkscript
 	    func_verbose "creating GNU ld script: $output"
-	    $ECHO 'INPUT (' > $output
+	    echo 'INPUT (' > $output
 	    for obj in $save_libobjs
 	    do
-	      $ECHO "$obj" >> $output
+	      func_to_tool_file "$obj"
+	      $ECHO "$func_to_tool_file_result" >> $output
 	    done
-	    $ECHO ')' >> $output
-	    delfiles="$delfiles $output"
+	    echo ')' >> $output
+	    func_append delfiles " $output"
+	    func_to_tool_file "$output"
+	    output=$func_to_tool_file_result
 	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
 	    output=${output_objdir}/${output_la}.lnk
 	    func_verbose "creating linker input file list: $output"
@@ -7170,10 +8358,12 @@ EOF
 	    fi
 	    for obj
 	    do
-	      $ECHO "$obj" >> $output
+	      func_to_tool_file "$obj"
+	      $ECHO "$func_to_tool_file_result" >> $output
 	    done
-	    delfiles="$delfiles $output"
-	    output=$firstobj\"$file_list_spec$output\"
+	    func_append delfiles " $output"
+	    func_to_tool_file "$output"
+	    output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
 	  else
 	    if test -n "$save_libobjs"; then
 	      func_verbose "creating reloadable object files..."
@@ -7197,17 +8387,19 @@ EOF
 		  # command to the queue.
 		  if test "$k" -eq 1 ; then
 		    # The first file doesn't have a previous command to add.
-		    eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+		    reload_objs=$objlist
+		    eval concat_cmds=\"$reload_cmds\"
 		  else
 		    # All subsequent reloadable object files will link in
 		    # the last one created.
-		    eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
+		    reload_objs="$objlist $last_robj"
+		    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
 		  fi
 		  last_robj=$output_objdir/$output_la-${k}.$objext
 		  func_arith $k + 1
 		  k=$func_arith_result
 		  output=$output_objdir/$output_la-${k}.$objext
-		  objlist=$obj
+		  objlist=" $obj"
 		  func_len " $last_robj"
 		  func_arith $len0 + $func_len_result
 		  len=$func_arith_result
@@ -7217,11 +8409,12 @@ EOF
 	      # reloadable object file.  All subsequent reloadable object
 	      # files will link in the last one created.
 	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	      eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+	      reload_objs="$objlist $last_robj"
+	      eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
 	      if test -n "$last_robj"; then
 	        eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
 	      fi
-	      delfiles="$delfiles $output"
+	      func_append delfiles " $output"
 
 	    else
 	      output=
@@ -7255,7 +8448,7 @@ EOF
 		lt_exit=$?
 
 		# Restore the uninstalled library and exit
-		if test "$mode" = relink; then
+		if test "$opt_mode" = relink; then
 		  ( cd "$output_objdir" && \
 		    $RM "${realname}T" && \
 		    $MV "${realname}U" "$realname" )
@@ -7276,7 +8469,7 @@ EOF
 	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	      tmp_export_symbols="$export_symbols"
 	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-	      $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+	      $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
 	    fi
 
 	    if test -n "$orig_export_symbols"; then
@@ -7288,7 +8481,7 @@ EOF
 	      # global variables. join(1) would be nice here, but unfortunately
 	      # isn't a blessed tool.
 	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-	      delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+	      func_append delfiles " $export_symbols $output_objdir/$libname.filter"
 	      export_symbols=$output_objdir/$libname.def
 	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
 	    fi
@@ -7329,10 +8522,10 @@ EOF
 	# Add any objects from preloaded convenience libraries
 	if test -n "$dlprefiles"; then
 	  gentop="$output_objdir/${outputname}x"
-	  generated="$generated $gentop"
+	  func_append generated " $gentop"
 
 	  func_extract_archives $gentop $dlprefiles
-	  libobjs="$libobjs $func_extract_archives_result"
+	  func_append libobjs " $func_extract_archives_result"
 	  test "X$libobjs" = "X " && libobjs=
 	fi
 
@@ -7348,7 +8541,7 @@ EOF
 	    lt_exit=$?
 
 	    # Restore the uninstalled library and exit
-	    if test "$mode" = relink; then
+	    if test "$opt_mode" = relink; then
 	      ( cd "$output_objdir" && \
 	        $RM "${realname}T" && \
 		$MV "${realname}U" "$realname" )
@@ -7360,7 +8553,7 @@ EOF
 	IFS="$save_ifs"
 
 	# Restore the uninstalled library and exit
-	if test "$mode" = relink; then
+	if test "$opt_mode" = relink; then
 	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
 
 	  if test -n "$convenience"; then
@@ -7441,18 +8634,21 @@ EOF
       if test -n "$convenience"; then
 	if test -n "$whole_archive_flag_spec"; then
 	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
-	  reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
+	  reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
 	else
 	  gentop="$output_objdir/${obj}x"
-	  generated="$generated $gentop"
+	  func_append generated " $gentop"
 
 	  func_extract_archives $gentop $convenience
 	  reload_conv_objs="$reload_objs $func_extract_archives_result"
 	fi
       fi
 
+      # If we're not building shared, we need to use non_pic_objs
+      test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
+
       # Create the old-style object.
-      reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
 
       output="$obj"
       func_execute_cmds "$reload_cmds" 'exit $?'
@@ -7512,8 +8708,8 @@ EOF
       case $host in
       *-*-rhapsody* | *-*-darwin1.[012])
 	# On Rhapsody replace the C library is the System framework
-	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
-	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
+	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
 	;;
       esac
 
@@ -7524,14 +8720,14 @@ EOF
 	if test "$tagname" = CXX ; then
 	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
 	    10.[0123])
-	      compile_command="$compile_command ${wl}-bind_at_load"
-	      finalize_command="$finalize_command ${wl}-bind_at_load"
+	      func_append compile_command " ${wl}-bind_at_load"
+	      func_append finalize_command " ${wl}-bind_at_load"
 	    ;;
 	  esac
 	fi
 	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
-	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 	;;
       esac
 
@@ -7545,7 +8741,7 @@ EOF
 	*)
 	  case " $compile_deplibs " in
 	  *" -L$path/$objdir "*)
-	    new_libs="$new_libs -L$path/$objdir" ;;
+	    func_append new_libs " -L$path/$objdir" ;;
 	  esac
 	  ;;
 	esac
@@ -7555,17 +8751,17 @@ EOF
 	-L*)
 	  case " $new_libs " in
 	  *" $deplib "*) ;;
-	  *) new_libs="$new_libs $deplib" ;;
+	  *) func_append new_libs " $deplib" ;;
 	  esac
 	  ;;
-	*) new_libs="$new_libs $deplib" ;;
+	*) func_append new_libs " $deplib" ;;
 	esac
       done
       compile_deplibs="$new_libs"
 
 
-      compile_command="$compile_command $compile_deplibs"
-      finalize_command="$finalize_command $finalize_deplibs"
+      func_append compile_command " $compile_deplibs"
+      func_append finalize_command " $finalize_deplibs"
 
       if test -n "$rpath$xrpath"; then
 	# If the user specified any rpath flags, then add them.
@@ -7573,7 +8769,7 @@ EOF
 	  # This is the magic to use -rpath.
 	  case "$finalize_rpath " in
 	  *" $libdir "*) ;;
-	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  *) func_append finalize_rpath " $libdir" ;;
 	  esac
 	done
       fi
@@ -7592,18 +8788,18 @@ EOF
 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 		;;
 	      *)
-		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
 		;;
 	      esac
 	    fi
 	  else
 	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    rpath="$rpath $flag"
+	    func_append rpath " $flag"
 	  fi
 	elif test -n "$runpath_var"; then
 	  case "$perm_rpath " in
 	  *" $libdir "*) ;;
-	  *) perm_rpath="$perm_rpath $libdir" ;;
+	  *) func_append perm_rpath " $libdir" ;;
 	  esac
 	fi
 	case $host in
@@ -7612,12 +8808,12 @@ EOF
 	  case :$dllsearchpath: in
 	  *":$libdir:"*) ;;
 	  ::) dllsearchpath=$libdir;;
-	  *) dllsearchpath="$dllsearchpath:$libdir";;
+	  *) func_append dllsearchpath ":$libdir";;
 	  esac
 	  case :$dllsearchpath: in
 	  *":$testbindir:"*) ;;
 	  ::) dllsearchpath=$testbindir;;
-	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  *) func_append dllsearchpath ":$testbindir";;
 	  esac
 	  ;;
 	esac
@@ -7643,18 +8839,18 @@ EOF
 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 		;;
 	      *)
-		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
 		;;
 	      esac
 	    fi
 	  else
 	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    rpath="$rpath $flag"
+	    func_append rpath " $flag"
 	  fi
 	elif test -n "$runpath_var"; then
 	  case "$finalize_perm_rpath " in
 	  *" $libdir "*) ;;
-	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+	  *) func_append finalize_perm_rpath " $libdir" ;;
 	  esac
 	fi
       done
@@ -7668,8 +8864,8 @@ EOF
 
       if test -n "$libobjs" && test "$build_old_libs" = yes; then
 	# Transform all the library objects into standard objects.
-	compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-	finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
       fi
 
       func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
@@ -7681,15 +8877,15 @@ EOF
 
       wrappers_required=yes
       case $host in
+      *cegcc* | *mingw32ce*)
+        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
+        wrappers_required=no
+        ;;
       *cygwin* | *mingw* )
         if test "$build_libtool_libs" != yes; then
           wrappers_required=no
         fi
         ;;
-      *cegcc)
-        # Disable wrappers for cegcc, we are cross compiling anyway.
-        wrappers_required=no
-        ;;
       *)
         if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
           wrappers_required=no
@@ -7698,13 +8894,19 @@ EOF
       esac
       if test "$wrappers_required" = no; then
 	# Replace the output file specification.
-	compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
 	link_command="$compile_command$compile_rpath"
 
 	# We have no uninstalled library dependencies, so finalize right now.
 	exit_status=0
 	func_show_eval "$link_command" 'exit_status=$?'
 
+	if test -n "$postlink_cmds"; then
+	  func_to_tool_file "$output"
+	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	  func_execute_cmds "$postlink_cmds" 'exit $?'
+	fi
+
 	# Delete the generated files.
 	if test -f "$output_objdir/${outputname}S.${objext}"; then
 	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
@@ -7727,7 +8929,7 @@ EOF
 	  # We should set the runpath_var.
 	  rpath=
 	  for dir in $perm_rpath; do
-	    rpath="$rpath$dir:"
+	    func_append rpath "$dir:"
 	  done
 	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
 	fi
@@ -7735,7 +8937,7 @@ EOF
 	  # We should set the runpath_var.
 	  rpath=
 	  for dir in $finalize_perm_rpath; do
-	    rpath="$rpath$dir:"
+	    func_append rpath "$dir:"
 	  done
 	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
 	fi
@@ -7745,11 +8947,18 @@ EOF
 	# We don't need to create a wrapper script.
 	link_command="$compile_var$compile_command$compile_rpath"
 	# Replace the output file specification.
-	link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
 	# Delete the old output file.
 	$opt_dry_run || $RM $output
 	# Link the executable and exit
 	func_show_eval "$link_command" 'exit $?'
+
+	if test -n "$postlink_cmds"; then
+	  func_to_tool_file "$output"
+	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	  func_execute_cmds "$postlink_cmds" 'exit $?'
+	fi
+
 	exit $EXIT_SUCCESS
       fi
 
@@ -7764,7 +8973,7 @@ EOF
 	if test "$fast_install" != no; then
 	  link_command="$finalize_var$compile_command$finalize_rpath"
 	  if test "$fast_install" = yes; then
-	    relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+	    relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
 	  else
 	    # fast_install is set to needless
 	    relink_command=
@@ -7776,13 +8985,19 @@ EOF
       fi
 
       # Replace the output file specification.
-      link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
 
       # Delete the old output files.
       $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
 
       func_show_eval "$link_command" 'exit $?'
 
+      if test -n "$postlink_cmds"; then
+	func_to_tool_file "$output_objdir/$outputname"
+	postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	func_execute_cmds "$postlink_cmds" 'exit $?'
+      fi
+
       # Now create the wrapper script.
       func_verbose "creating $output"
 
@@ -7800,18 +9015,7 @@ EOF
 	  fi
 	done
 	relink_command="(cd `pwd`; $relink_command)"
-	relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
-      fi
-
-      # Quote $ECHO for shipping.
-      if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
-	case $progpath in
-	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
-	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
-	esac
-	qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
-      else
-	qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
+	relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
       fi
 
       # Only actually do things if not in dry run mode.
@@ -7891,7 +9095,7 @@ EOF
 	else
 	  oldobjs="$old_deplibs $non_pic_objects"
 	  if test "$preload" = yes && test -f "$symfileobj"; then
-	    oldobjs="$oldobjs $symfileobj"
+	    func_append oldobjs " $symfileobj"
 	  fi
 	fi
 	addlibs="$old_convenience"
@@ -7899,10 +9103,10 @@ EOF
 
       if test -n "$addlibs"; then
 	gentop="$output_objdir/${outputname}x"
-	generated="$generated $gentop"
+	func_append generated " $gentop"
 
 	func_extract_archives $gentop $addlibs
-	oldobjs="$oldobjs $func_extract_archives_result"
+	func_append oldobjs " $func_extract_archives_result"
       fi
 
       # Do each command in the archive commands.
@@ -7913,10 +9117,10 @@ EOF
 	# Add any objects from preloaded convenience libraries
 	if test -n "$dlprefiles"; then
 	  gentop="$output_objdir/${outputname}x"
-	  generated="$generated $gentop"
+	  func_append generated " $gentop"
 
 	  func_extract_archives $gentop $dlprefiles
-	  oldobjs="$oldobjs $func_extract_archives_result"
+	  func_append oldobjs " $func_extract_archives_result"
 	fi
 
 	# POSIX demands no paths to be encoded in archives.  We have
@@ -7932,9 +9136,9 @@ EOF
 	    done | sort | sort -uc >/dev/null 2>&1); then
 	  :
 	else
-	  $ECHO "copying selected object files to avoid basename conflicts..."
+	  echo "copying selected object files to avoid basename conflicts..."
 	  gentop="$output_objdir/${outputname}x"
-	  generated="$generated $gentop"
+	  func_append generated " $gentop"
 	  func_mkdir_p "$gentop"
 	  save_oldobjs=$oldobjs
 	  oldobjs=
@@ -7958,18 +9162,30 @@ EOF
 		esac
 	      done
 	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
-	      oldobjs="$oldobjs $gentop/$newobj"
+	      func_append oldobjs " $gentop/$newobj"
 	      ;;
-	    *) oldobjs="$oldobjs $obj" ;;
+	    *) func_append oldobjs " $obj" ;;
 	    esac
 	  done
 	fi
+	func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+	tool_oldlib=$func_to_tool_file_result
 	eval cmds=\"$old_archive_cmds\"
 
 	func_len " $cmds"
 	len=$func_len_result
 	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 	  cmds=$old_archive_cmds
+	elif test -n "$archiver_list_spec"; then
+	  func_verbose "using command file archive linking..."
+	  for obj in $oldobjs
+	  do
+	    func_to_tool_file "$obj"
+	    $ECHO "$func_to_tool_file_result"
+	  done > $output_objdir/$libname.libcmd
+	  func_to_tool_file "$output_objdir/$libname.libcmd"
+	  oldobjs=" $archiver_list_spec$func_to_tool_file_result"
+	  cmds=$old_archive_cmds
 	else
 	  # the command line is too long to link in one step, link in parts
 	  func_verbose "using piecewise archive linking..."
@@ -8043,7 +9259,7 @@ EOF
       done
       # Quote the link command for shipping.
       relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
-      relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
       if test "$hardcode_automatic" = yes ; then
 	relink_command=
       fi
@@ -8063,56 +9279,23 @@ EOF
 	      *.la)
 		func_basename "$deplib"
 		name="$func_basename_result"
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		func_resolve_sysroot "$deplib"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$deplib' is not a valid libtool archive"
-		if test "x$EGREP" = x ; then
-			EGREP=egrep
-		fi
-		# We do not want portage's install root ($D) present.  Check only for
-		# this if the .la is being installed.
-		if test "$installed" = yes && test "$D"; then
-		  eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
-		else
-		  mynewdependency_lib="$libdir/$name"
-		fi
-		# Do not add duplicates
-		if test "$mynewdependency_lib"; then
-		  my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
-		  if test -z "$my_little_ninja_foo_1"; then
-		    newdependency_libs="$newdependency_libs $mynewdependency_lib"
-		  fi
-		fi
+		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
 		;;
-		  *)
-		if test "$installed" = yes; then
-		  # Rather use S=WORKDIR if our version of portage supports it.
-		  # This is because some ebuild (gcc) do not use $S as buildroot.
-		  if test "$PWORKDIR"; then
-		    S="$PWORKDIR"
-		  fi
-		  # We do not want portage's build root ($S) present.
-		  my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
-		  # We do not want portage's install root ($D) present.
-		  my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
-		  if test -n "$my_little_ninja_foo_2" && test "$S"; then
-		    mynewdependency_lib=""
-		  elif test -n "$my_little_ninja_foo_3" && test "$D"; then
-		    eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
-		  else
-		    mynewdependency_lib="$deplib"
-		  fi
-		else
-		  mynewdependency_lib="$deplib"
-		fi
-		# Do not add duplicates
-		if test "$mynewdependency_lib"; then
-		  my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
-		  if test -z "$my_little_ninja_foo_4"; then
-			newdependency_libs="$newdependency_libs $mynewdependency_lib"
-		  fi
-		fi
+	      -L*)
+		func_stripname -L '' "$deplib"
+		func_replace_sysroot "$func_stripname_result"
+		func_append newdependency_libs " -L$func_replace_sysroot_result"
+		;;
+	      -R*)
+		func_stripname -R '' "$deplib"
+		func_replace_sysroot "$func_stripname_result"
+		func_append newdependency_libs " -R$func_replace_sysroot_result"
 		;;
+	      *) func_append newdependency_libs " $deplib" ;;
 	      esac
 	    done
 	    dependency_libs="$newdependency_libs"
@@ -8126,9 +9309,9 @@ EOF
 		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$lib' is not a valid libtool archive"
-		newdlfiles="$newdlfiles $libdir/$name"
+		func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
 		;;
-	      *) newdlfiles="$newdlfiles $lib" ;;
+	      *) func_append newdlfiles " $lib" ;;
 	      esac
 	    done
 	    dlfiles="$newdlfiles"
@@ -8145,7 +9328,7 @@ EOF
 		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$lib' is not a valid libtool archive"
-		newdlprefiles="$newdlprefiles $libdir/$name"
+		func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
 		;;
 	      esac
 	    done
@@ -8157,7 +9340,7 @@ EOF
 		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 		*) abs=`pwd`"/$lib" ;;
 	      esac
-	      newdlfiles="$newdlfiles $abs"
+	      func_append newdlfiles " $abs"
 	    done
 	    dlfiles="$newdlfiles"
 	    newdlprefiles=
@@ -8166,20 +9349,34 @@ EOF
 		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 		*) abs=`pwd`"/$lib" ;;
 	      esac
-	      newdlprefiles="$newdlprefiles $abs"
+	      func_append newdlprefiles " $abs"
 	    done
 	    dlprefiles="$newdlprefiles"
 	  fi
 	  $RM $output
 	  # place dlname in correct position for cygwin
+	  # In fact, it would be nice if we could use this code for all target
+	  # systems that can't hard-code library paths into their executables
+	  # and that have no shared library path variable independent of PATH,
+	  # but it turns out we can't easily determine that from inspecting
+	  # libtool variables, so we have to hard-code the OSs to which it
+	  # applies here; at the moment, that means platforms that use the PE
+	  # object format with DLL files.  See the long comment at the top of
+	  # tests/bindir.at for full details.
 	  tdlname=$dlname
 	  case $host,$output,$installed,$module,$dlname in
-	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+	      # If a -bindir argument was supplied, place the dll there.
+	      if test "x$bindir" != x ;
+	      then
+		func_relative_path "$install_libdir" "$bindir"
+		tdlname=$func_relative_path_result$dlname
+	      else
+		# Otherwise fall back on heuristic.
+		tdlname=../bin/$dlname
+	      fi
+	      ;;
 	  esac
-	  # Do not add duplicates
-	  if test "$installed" = yes && test "$D"; then
-	    install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
-	  fi
 	  $ECHO > $output "\
 # $outputname - a libtool library file
 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
@@ -8237,7 +9434,7 @@ relink_command=\"$relink_command\""
     exit $EXIT_SUCCESS
 }
 
-{ test "$mode" = link || test "$mode" = relink; } &&
+{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
     func_mode_link ${1+"$@"}
 
 
@@ -8257,9 +9454,9 @@ func_mode_uninstall ()
     for arg
     do
       case $arg in
-      -f) RM="$RM $arg"; rmforce=yes ;;
-      -*) RM="$RM $arg" ;;
-      *) files="$files $arg" ;;
+      -f) func_append RM " $arg"; rmforce=yes ;;
+      -*) func_append RM " $arg" ;;
+      *) func_append files " $arg" ;;
       esac
     done
 
@@ -8268,24 +9465,23 @@ func_mode_uninstall ()
 
     rmdirs=
 
-    origobjdir="$objdir"
     for file in $files; do
       func_dirname "$file" "" "."
       dir="$func_dirname_result"
       if test "X$dir" = X.; then
-	objdir="$origobjdir"
+	odir="$objdir"
       else
-	objdir="$dir/$origobjdir"
+	odir="$dir/$objdir"
       fi
       func_basename "$file"
       name="$func_basename_result"
-      test "$mode" = uninstall && objdir="$dir"
+      test "$opt_mode" = uninstall && odir="$dir"
 
-      # Remember objdir for removal later, being careful to avoid duplicates
-      if test "$mode" = clean; then
+      # Remember odir for removal later, being careful to avoid duplicates
+      if test "$opt_mode" = clean; then
 	case " $rmdirs " in
-	  *" $objdir "*) ;;
-	  *) rmdirs="$rmdirs $objdir" ;;
+	  *" $odir "*) ;;
+	  *) func_append rmdirs " $odir" ;;
 	esac
       fi
 
@@ -8311,18 +9507,17 @@ func_mode_uninstall ()
 
 	  # Delete the libtool libraries and symlinks.
 	  for n in $library_names; do
-	    rmfiles="$rmfiles $objdir/$n"
+	    func_append rmfiles " $odir/$n"
 	  done
-	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+	  test -n "$old_library" && func_append rmfiles " $odir/$old_library"
 
-	  case "$mode" in
+	  case "$opt_mode" in
 	  clean)
-	    case "  $library_names " in
-	    # "  " in the beginning catches empty $dlname
+	    case " $library_names " in
 	    *" $dlname "*) ;;
-	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
+	    *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
 	    esac
-	    test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+	    test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
 	    ;;
 	  uninstall)
 	    if test -n "$library_names"; then
@@ -8350,19 +9545,19 @@ func_mode_uninstall ()
 	  # Add PIC object to the list of files to remove.
 	  if test -n "$pic_object" &&
 	     test "$pic_object" != none; then
-	    rmfiles="$rmfiles $dir/$pic_object"
+	    func_append rmfiles " $dir/$pic_object"
 	  fi
 
 	  # Add non-PIC object to the list of files to remove.
 	  if test -n "$non_pic_object" &&
 	     test "$non_pic_object" != none; then
-	    rmfiles="$rmfiles $dir/$non_pic_object"
+	    func_append rmfiles " $dir/$non_pic_object"
 	  fi
 	fi
 	;;
 
       *)
-	if test "$mode" = clean ; then
+	if test "$opt_mode" = clean ; then
 	  noexename=$name
 	  case $file in
 	  *.exe)
@@ -8372,7 +9567,7 @@ func_mode_uninstall ()
 	    noexename=$func_stripname_result
 	    # $file with .exe has already been added to rmfiles,
 	    # add $file without .exe
-	    rmfiles="$rmfiles $file"
+	    func_append rmfiles " $file"
 	    ;;
 	  esac
 	  # Do a test to see if this is a libtool program.
@@ -8381,7 +9576,7 @@ func_mode_uninstall ()
 	      func_ltwrapper_scriptname "$file"
 	      relink_command=
 	      func_source $func_ltwrapper_scriptname_result
-	      rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
+	      func_append rmfiles " $func_ltwrapper_scriptname_result"
 	    else
 	      relink_command=
 	      func_source $dir/$noexename
@@ -8389,12 +9584,12 @@ func_mode_uninstall ()
 
 	    # note $name still contains .exe if it was in $file originally
 	    # as does the version of $file that was added into $rmfiles
-	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+	    func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
 	    if test "$fast_install" = yes && test -n "$relink_command"; then
-	      rmfiles="$rmfiles $objdir/lt-$name"
+	      func_append rmfiles " $odir/lt-$name"
 	    fi
 	    if test "X$noexename" != "X$name" ; then
-	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+	      func_append rmfiles " $odir/lt-${noexename}.c"
 	    fi
 	  fi
 	fi
@@ -8402,7 +9597,6 @@ func_mode_uninstall ()
       esac
       func_show_eval "$RM $rmfiles" 'exit_status=1'
     done
-    objdir="$origobjdir"
 
     # Try to remove the ${objdir}s in the directories where we deleted files
     for dir in $rmdirs; do
@@ -8414,16 +9608,16 @@ func_mode_uninstall ()
     exit $exit_status
 }
 
-{ test "$mode" = uninstall || test "$mode" = clean; } &&
+{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
     func_mode_uninstall ${1+"$@"}
 
-test -z "$mode" && {
+test -z "$opt_mode" && {
   help="$generic_help"
   func_fatal_help "you must specify a MODE"
 }
 
 test -z "$exec_cmd" && \
-  func_fatal_help "invalid operation mode \`$mode'"
+  func_fatal_help "invalid operation mode \`$opt_mode'"
 
 if test -n "$exec_cmd"; then
   eval exec "$exec_cmd"
diff --git a/config/ltoptions.m4 b/config/ltoptions.m4
deleted file mode 100644
index 34151a3..0000000
--- a/config/ltoptions.m4
+++ /dev/null
@@ -1,368 +0,0 @@
-# Helper functions for option handling.                    -*- Autoconf -*-
-#
-#   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
-#   Written by Gary V. Vaughan, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 6 ltoptions.m4
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
-
-
-# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
-# ------------------------------------------
-m4_define([_LT_MANGLE_OPTION],
-[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
-
-
-# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
-# ---------------------------------------
-# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
-# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
-# saved as a flag.
-m4_define([_LT_SET_OPTION],
-[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
-m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
-        _LT_MANGLE_DEFUN([$1], [$2]),
-    [m4_warning([Unknown $1 option `$2'])])[]dnl
-])
-
-
-# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
-# ------------------------------------------------------------
-# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
-m4_define([_LT_IF_OPTION],
-[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
-
-
-# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
-# -------------------------------------------------------
-# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
-# are set.
-m4_define([_LT_UNLESS_OPTIONS],
-[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
-	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
-		      [m4_define([$0_found])])])[]dnl
-m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
-])[]dnl
-])
-
-
-# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
-# ----------------------------------------
-# OPTION-LIST is a space-separated list of Libtool options associated
-# with MACRO-NAME.  If any OPTION has a matching handler declared with
-# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
-# the unknown option and exit.
-m4_defun([_LT_SET_OPTIONS],
-[# Set options
-m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
-    [_LT_SET_OPTION([$1], _LT_Option)])
-
-m4_if([$1],[LT_INIT],[
-  dnl
-  dnl Simply set some default values (i.e off) if boolean options were not
-  dnl specified:
-  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
-  ])
-  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
-  ])
-  dnl
-  dnl If no reference was made to various pairs of opposing options, then
-  dnl we run the default mode handler for the pair.  For example, if neither
-  dnl `shared' nor `disable-shared' was passed, we enable building of shared
-  dnl archives by default:
-  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
-  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
-  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
-  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
-  		   [_LT_ENABLE_FAST_INSTALL])
-  ])
-])# _LT_SET_OPTIONS
-
-
-## --------------------------------- ##
-## Macros to handle LT_INIT options. ##
-## --------------------------------- ##
-
-# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
-# -----------------------------------------
-m4_define([_LT_MANGLE_DEFUN],
-[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
-
-
-# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
-# -----------------------------------------------
-m4_define([LT_OPTION_DEFINE],
-[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
-])# LT_OPTION_DEFINE
-
-
-# dlopen
-# ------
-LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
-])
-
-AU_DEFUN([AC_LIBTOOL_DLOPEN],
-[_LT_SET_OPTION([LT_INIT], [dlopen])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `dlopen' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
-
-
-# win32-dll
-# ---------
-# Declare package support for building win32 dll's.
-LT_OPTION_DEFINE([LT_INIT], [win32-dll],
-[enable_win32_dll=yes
-
-case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
-  AC_CHECK_TOOL(AS, as, false)
-  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-  AC_CHECK_TOOL(OBJDUMP, objdump, false)
-  ;;
-esac
-
-test -z "$AS" && AS=as
-_LT_DECL([], [AS],      [0], [Assembler program])dnl
-
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
-
-test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
-])# win32-dll
-
-AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-_LT_SET_OPTION([LT_INIT], [win32-dll])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `win32-dll' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
-
-
-# _LT_ENABLE_SHARED([DEFAULT])
-# ----------------------------
-# implement the --enable-shared flag, and supports the `shared' and
-# `disable-shared' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_SHARED],
-[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([shared],
-    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
-	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_shared=yes ;;
-    no) enable_shared=no ;;
-    *)
-      enable_shared=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_shared=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
-
-    _LT_DECL([build_libtool_libs], [enable_shared], [0],
-	[Whether or not to build shared libraries])
-])# _LT_ENABLE_SHARED
-
-LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
-
-# Old names:
-AC_DEFUN([AC_ENABLE_SHARED],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
-])
-
-AC_DEFUN([AC_DISABLE_SHARED],
-[_LT_SET_OPTION([LT_INIT], [disable-shared])
-])
-
-AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
-AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_ENABLE_SHARED], [])
-dnl AC_DEFUN([AM_DISABLE_SHARED], [])
-
-
-
-# _LT_ENABLE_STATIC([DEFAULT])
-# ----------------------------
-# implement the --enable-static flag, and support the `static' and
-# `disable-static' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_STATIC],
-[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([static],
-    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
-	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_static=yes ;;
-    no) enable_static=no ;;
-    *)
-     enable_static=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_static=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
-
-    _LT_DECL([build_old_libs], [enable_static], [0],
-	[Whether or not to build static libraries])
-])# _LT_ENABLE_STATIC
-
-LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
-
-# Old names:
-AC_DEFUN([AC_ENABLE_STATIC],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
-])
-
-AC_DEFUN([AC_DISABLE_STATIC],
-[_LT_SET_OPTION([LT_INIT], [disable-static])
-])
-
-AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
-AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_ENABLE_STATIC], [])
-dnl AC_DEFUN([AM_DISABLE_STATIC], [])
-
-
-
-# _LT_ENABLE_FAST_INSTALL([DEFAULT])
-# ----------------------------------
-# implement the --enable-fast-install flag, and support the `fast-install'
-# and `disable-fast-install' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_FAST_INSTALL],
-[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([fast-install],
-    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
-    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_fast_install=yes ;;
-    no) enable_fast_install=no ;;
-    *)
-      enable_fast_install=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_fast_install=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
-
-_LT_DECL([fast_install], [enable_fast_install], [0],
-	 [Whether or not to optimize for fast installation])dnl
-])# _LT_ENABLE_FAST_INSTALL
-
-LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
-
-# Old names:
-AU_DEFUN([AC_ENABLE_FAST_INSTALL],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `fast-install' option into LT_INIT's first parameter.])
-])
-
-AU_DEFUN([AC_DISABLE_FAST_INSTALL],
-[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `disable-fast-install' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
-dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
-
-
-# _LT_WITH_PIC([MODE])
-# --------------------
-# implement the --with-pic flag, and support the `pic-only' and `no-pic'
-# LT_INIT options.
-# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
-m4_define([_LT_WITH_PIC],
-[AC_ARG_WITH([pic],
-    [AS_HELP_STRING([--with-pic],
-	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
-    [pic_mode="$withval"],
-    [pic_mode=default])
-
-test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
-
-_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
-])# _LT_WITH_PIC
-
-LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
-LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
-
-# Old name:
-AU_DEFUN([AC_LIBTOOL_PICMODE],
-[_LT_SET_OPTION([LT_INIT], [pic-only])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `pic-only' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
-
-## ----------------- ##
-## LTDL_INIT Options ##
-## ----------------- ##
-
-m4_define([_LTDL_MODE], [])
-LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
-		 [m4_define([_LTDL_MODE], [nonrecursive])])
-LT_OPTION_DEFINE([LTDL_INIT], [recursive],
-		 [m4_define([_LTDL_MODE], [recursive])])
-LT_OPTION_DEFINE([LTDL_INIT], [subproject],
-		 [m4_define([_LTDL_MODE], [subproject])])
-
-m4_define([_LTDL_TYPE], [])
-LT_OPTION_DEFINE([LTDL_INIT], [installable],
-		 [m4_define([_LTDL_TYPE], [installable])])
-LT_OPTION_DEFINE([LTDL_INIT], [convenience],
-		 [m4_define([_LTDL_TYPE], [convenience])])
diff --git a/config/ltsugar.m4 b/config/ltsugar.m4
deleted file mode 100644
index 9000a05..0000000
--- a/config/ltsugar.m4
+++ /dev/null
@@ -1,123 +0,0 @@
-# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
-#
-# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
-# Written by Gary V. Vaughan, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 6 ltsugar.m4
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
-
-
-# lt_join(SEP, ARG1, [ARG2...])
-# -----------------------------
-# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
-# associated separator.
-# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
-# versions in m4sugar had bugs.
-m4_define([lt_join],
-[m4_if([$#], [1], [],
-       [$#], [2], [[$2]],
-       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
-m4_define([_lt_join],
-[m4_if([$#$2], [2], [],
-       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
-
-
-# lt_car(LIST)
-# lt_cdr(LIST)
-# ------------
-# Manipulate m4 lists.
-# These macros are necessary as long as will still need to support
-# Autoconf-2.59 which quotes differently.
-m4_define([lt_car], [[$1]])
-m4_define([lt_cdr],
-[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
-       [$#], 1, [],
-       [m4_dquote(m4_shift($@))])])
-m4_define([lt_unquote], $1)
-
-
-# lt_append(MACRO-NAME, STRING, [SEPARATOR])
-# ------------------------------------------
-# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
-# Note that neither SEPARATOR nor STRING are expanded; they are appended
-# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
-# No SEPARATOR is output if MACRO-NAME was previously undefined (different
-# than defined and empty).
-#
-# This macro is needed until we can rely on Autoconf 2.62, since earlier
-# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
-m4_define([lt_append],
-[m4_define([$1],
-	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
-
-
-
-# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
-# ----------------------------------------------------------
-# Produce a SEP delimited list of all paired combinations of elements of
-# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
-# has the form PREFIXmINFIXSUFFIXn.
-# Needed until we can rely on m4_combine added in Autoconf 2.62.
-m4_define([lt_combine],
-[m4_if(m4_eval([$# > 3]), [1],
-       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
-[[m4_foreach([_Lt_prefix], [$2],
-	     [m4_foreach([_Lt_suffix],
-		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
-	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
-
-
-# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
-# -----------------------------------------------------------------------
-# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
-# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
-m4_define([lt_if_append_uniq],
-[m4_ifdef([$1],
-	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
-		 [lt_append([$1], [$2], [$3])$4],
-		 [$5])],
-	  [lt_append([$1], [$2], [$3])$4])])
-
-
-# lt_dict_add(DICT, KEY, VALUE)
-# -----------------------------
-m4_define([lt_dict_add],
-[m4_define([$1($2)], [$3])])
-
-
-# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
-# --------------------------------------------
-m4_define([lt_dict_add_subkey],
-[m4_define([$1($2:$3)], [$4])])
-
-
-# lt_dict_fetch(DICT, KEY, [SUBKEY])
-# ----------------------------------
-m4_define([lt_dict_fetch],
-[m4_ifval([$3],
-	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
-    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
-
-
-# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
-# -----------------------------------------------------------------
-m4_define([lt_if_dict_fetch],
-[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
-	[$5],
-    [$6])])
-
-
-# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
-# --------------------------------------------------------------
-m4_define([lt_dict_filter],
-[m4_if([$5], [], [],
-  [lt_join(m4_quote(m4_default([$4], [[, ]])),
-           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
-		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
-])
diff --git a/config/ltversion.m4 b/config/ltversion.m4
deleted file mode 100644
index b8e154f..0000000
--- a/config/ltversion.m4
+++ /dev/null
@@ -1,23 +0,0 @@
-# ltversion.m4 -- version numbers			-*- Autoconf -*-
-#
-#   Copyright (C) 2004 Free Software Foundation, Inc.
-#   Written by Scott James Remnant, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# Generated from ltversion.in.
-
-# serial 3012 ltversion.m4
-# This file is part of GNU Libtool
-
-m4_define([LT_PACKAGE_VERSION], [2.2.6])
-m4_define([LT_PACKAGE_REVISION], [1.3012])
-
-AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.2.6'
-macro_revision='1.3012'
-_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
-_LT_DECL(, macro_revision, 0)
-])
diff --git a/config/lt~obsolete.m4 b/config/lt~obsolete.m4
deleted file mode 100644
index 637bb20..0000000
--- a/config/lt~obsolete.m4
+++ /dev/null
@@ -1,92 +0,0 @@
-# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
-#
-#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
-#   Written by Scott James Remnant, 2004.
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 4 lt~obsolete.m4
-
-# These exist entirely to fool aclocal when bootstrapping libtool.
-#
-# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
-# which have later been changed to m4_define as they aren't part of the
-# exported API, or moved to Autoconf or Automake where they belong.
-#
-# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
-# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
-# using a macro with the same name in our local m4/libtool.m4 it'll
-# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
-# and doesn't know about Autoconf macros at all.)
-#
-# So we provide this file, which has a silly filename so it's always
-# included after everything else.  This provides aclocal with the
-# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
-# because those macros already exist, or will be overwritten later.
-# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
-#
-# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
-# Yes, that means every name once taken will need to remain here until
-# we give up compatibility with versions before 1.7, at which point
-# we need to keep only those names which we still refer to.
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
-
-m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
-m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
-m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
-m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
-m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
-m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
-m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
-m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
-m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
-m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
-m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
-m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
-m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
-m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
-m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
-m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
-m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
-m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
-m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
-m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
-m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
-m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
-m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
-m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
-m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
-m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
-m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
-m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
-m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
-m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
-m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
-m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
-m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
-m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
-m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
-m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
-m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
-m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
-m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
-m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
-m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
-m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
-m4_ifndef([AC_LIBTOOL_RC],		[AC_DEFUN([AC_LIBTOOL_RC])])
-m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
-m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
-m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
-m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
-m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
-m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
-m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
-m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
diff --git a/config/missing b/config/missing
index 1c8ff70..86a8fc3 100755
--- a/config/missing
+++ b/config/missing
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
 
-scriptversion=2006-05-10.23
+scriptversion=2012-01-06.13; # UTC
 
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
-#   Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 # Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
@@ -18,9 +18,7 @@ scriptversion=2006-05-10.23
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -86,9 +84,11 @@ Supported PROGRAM values:
   help2man     touch the output file
   lex          create \`lex.yy.c', if possible, from existing .c
   makeinfo     touch the output file
-  tar          try tar, gnutar, gtar, then tar without non-portable flags
   yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
 
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
 Send bug reports to <bug-automake at gnu.org>."
     exit $?
     ;;
@@ -106,23 +106,21 @@ Send bug reports to <bug-automake at gnu.org>."
 
 esac
 
+# normalize program name to check for.
+program=`echo "$1" | sed '
+  s/^gnu-//; t
+  s/^gnu//; t
+  s/^g//; t'`
+
 # Now exit if we have it, but it failed.  Also exit now if we
 # don't have it and --version was passed (most likely to detect
-# the program).
+# the program).  This is about non-GNU programs, so use $1 not
+# $program.
 case $1 in
-  lex|yacc)
+  lex*|yacc*)
     # Not GNU programs, they don't have --version.
     ;;
 
-  tar)
-    if test -n "$run"; then
-       echo 1>&2 "ERROR: \`tar' requires --run"
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       exit 1
-    fi
-    ;;
-
   *)
     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
        # We have it, but it failed.
@@ -138,7 +136,7 @@ esac
 
 # If it does not exist, or fails to run (possibly an outdated version),
 # try to emulate it.
-case $1 in
+case $program in
   aclocal*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
@@ -148,7 +146,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     touch aclocal.m4
     ;;
 
-  autoconf)
+  autoconf*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`${configure_ac}'.  You might want to install the
@@ -157,7 +155,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     touch configure
     ;;
 
-  autoheader)
+  autoheader*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`acconfig.h' or \`${configure_ac}'.  You might want
@@ -187,7 +185,7 @@ WARNING: \`$1' is $msg.  You should only need it if
 	   while read f; do touch "$f"; done
     ;;
 
-  autom4te)
+  autom4te*)
     echo 1>&2 "\
 WARNING: \`$1' is needed, but is $msg.
          You might have modified some files without having the
@@ -210,7 +208,7 @@ WARNING: \`$1' is needed, but is $msg.
     fi
     ;;
 
-  bison|yacc)
+  bison*|yacc*)
     echo 1>&2 "\
 WARNING: \`$1' $msg.  You should only need it if
          you modified a \`.y' file.  You may need the \`Bison' package
@@ -218,7 +216,7 @@ WARNING: \`$1' $msg.  You should only need it if
          \`Bison' from any GNU archive site."
     rm -f y.tab.c y.tab.h
     if test $# -ne 1; then
-        eval LASTARG="\${$#}"
+        eval LASTARG=\${$#}
 	case $LASTARG in
 	*.y)
 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
@@ -240,7 +238,7 @@ WARNING: \`$1' $msg.  You should only need it if
     fi
     ;;
 
-  lex|flex)
+  lex*|flex*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified a \`.l' file.  You may need the \`Flex' package
@@ -248,7 +246,7 @@ WARNING: \`$1' is $msg.  You should only need it if
          \`Flex' from any GNU archive site."
     rm -f lex.yy.c
     if test $# -ne 1; then
-        eval LASTARG="\${$#}"
+        eval LASTARG=\${$#}
 	case $LASTARG in
 	*.l)
 	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
@@ -263,7 +261,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     fi
     ;;
 
-  help2man)
+  help2man*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
 	 you modified a dependency of a manual page.  You may need the
@@ -277,11 +275,11 @@ WARNING: \`$1' is $msg.  You should only need it if
     else
 	test -z "$file" || exec >$file
 	echo ".ab help2man is required to generate this page"
-	exit 1
+	exit $?
     fi
     ;;
 
-  makeinfo)
+  makeinfo*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified a \`.texi' or \`.texinfo' file, or any other file
@@ -310,41 +308,6 @@ WARNING: \`$1' is $msg.  You should only need it if
     touch $file
     ;;
 
-  tar)
-    shift
-
-    # We have already tried tar in the generic part.
-    # Look for gnutar/gtar before invocation to avoid ugly error
-    # messages.
-    if (gnutar --version > /dev/null 2>&1); then
-       gnutar "$@" && exit 0
-    fi
-    if (gtar --version > /dev/null 2>&1); then
-       gtar "$@" && exit 0
-    fi
-    firstarg="$1"
-    if shift; then
-	case $firstarg in
-	*o*)
-	    firstarg=`echo "$firstarg" | sed s/o//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-	case $firstarg in
-	*h*)
-	    firstarg=`echo "$firstarg" | sed s/h//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-    fi
-
-    echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
-         You may want to install GNU tar or Free paxutils, or check the
-         command line arguments."
-    exit 1
-    ;;
-
   *)
     echo 1>&2 "\
 WARNING: \`$1' is needed, and is $msg.
@@ -363,5 +326,6 @@ exit 0
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
diff --git a/config/osmvsel.m4 b/config/osmvsel.m4
index c7798cc..6c98c07 100644
--- a/config/osmvsel.m4
+++ b/config/osmvsel.m4
@@ -64,8 +64,8 @@ with_sim="/usr")
 dnl based on the with_osmv we can try the vendor flag
 if test $with_osmv = "openib"; then
    AC_DEFINE(OSM_VENDOR_INTF_OPENIB, 1, [Define as 1 for OpenIB vendor])
-   OSMV_INCLUDES="-I\$(srcdir)/../include -I\$(srcdir)/../../libibcommon/include -I\$(srcdir)/../../libibumad/include -I\$(includedir)"
-   OSMV_LDADD="-L\$(abs_srcdir)/../../libibumad/.libs -L\$(abs_srcdir)/../../libibcommon/.libs -L\$(libdir) -libumad -libcommon"
+   OSMV_INCLUDES="-I\$(srcdir)/../include -I\$(srcdir)/../../libibumad/include -I\$(includedir)"
+   OSMV_LDADD="-L\$(abs_srcdir)/../../libibumad/.libs -L\$(libdir) -libumad"
 
    if test "x$with_umad_libs" != "x"; then
       OSMV_LDADD="-L$with_umad_libs $OSMV_LDADD"
@@ -178,40 +178,63 @@ fi
 # --- END OPENIB_APP_OSMV_CHECK_HEADER ---
 ]) dnl OPENIB_APP_OSMV_CHECK_HEADER
 
-dnl Check if they want the socket console
+dnl Check for socket console support
 AC_DEFUN([OPENIB_OSM_CONSOLE_SOCKET_SEL], [
 # --- BEGIN OPENIB_OSM_CONSOLE_SOCKET_SEL ---
 
+dnl Console over a loopback socket is default if libwrap is available
+AC_ARG_ENABLE(console-loopback,
+[  --enable-console-loopback Enable a console socket on the loopback interface, requires tcp_wrappers (default yes)],
+[case $enableval in
+     yes) console_loopback=yes ;;
+     no)  console_loopback=no ;;
+   esac],
+   console_loopback=yes)
+
+if test $console_loopback = yes; then
+AC_CHECK_LIB(wrap, request_init, [], [console_loopback=no
+		AC_MSG_WARN(libwrap is missing. setting console_loopback=no)])
+fi
+if test $console_loopback = yes; then
+  AC_DEFINE(ENABLE_OSM_CONSOLE_LOOPBACK,
+	    1,
+	    [Define as 1 if you want to enable a loopback console])
+fi
+
 dnl Console over a socket connection
 AC_ARG_ENABLE(console-socket,
-[  --enable-console-socket Enable a console socket, requires tcp_wrappers (default no)],
+[  --enable-console-socket Enable a console socket, requires --enable-console-loopback (default no)],
 [case $enableval in
      yes) console_socket=yes ;;
      no)  console_socket=no ;;
    esac],
    console_socket=no)
 if test $console_socket = yes; then
-  AC_CHECK_LIB(wrap, request_init, [],
- 	AC_MSG_ERROR([request_init() not found. console-socket requires libwrap.]))
+  if test $console_loopback = no; then
+    AC_MSG_ERROR([--enable-console-socket requires --enable-console-loopback])
+  fi
   AC_DEFINE(ENABLE_OSM_CONSOLE_SOCKET,
 	    1,
 	    [Define as 1 if you want to enable a console on a socket connection])
 fi
+
 # --- END OPENIB_OSM_CONSOLE_SOCKET_SEL ---
 ]) dnl OPENIB_OSM_CONSOLE_SOCKET_SEL
 
+
+
 dnl Check if they want the PerfMgr
 AC_DEFUN([OPENIB_OSM_PERF_MGR_SEL], [
 # --- BEGIN OPENIB_OSM_PERF_MGR_SEL ---
 
 dnl enable the perf-mgr
 AC_ARG_ENABLE(perf-mgr,
-[  --enable-perf-mgr Enable the performance manager (default no)],
+[  --enable-perf-mgr Enable the performance manager (default yes)],
    [case $enableval in
      yes) perf_mgr=yes ;;
      no)  perf_mgr=no ;;
    esac],
-   perf_mgr=no)
+   perf_mgr=yes)
 AC_ARG_ENABLE(perf-mgr-profile,
 [  --enable-perf-mgr-profile Enable the performance manager profiling (default no)],
 	[case $enableval in
diff --git a/config/ylwrap b/config/ylwrap
index 7278b6a..9253635 100755
--- a/config/ylwrap
+++ b/config/ylwrap
@@ -1,10 +1,10 @@
 #! /bin/sh
 # ylwrap - wrapper for lex/yacc invocations.
 
-scriptversion=2007-11-22.22
+scriptversion=2011-08-25.18; # UTC
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
-# 2007  Free Software Foundation, Inc.
+# 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
 #
 # Written by Tom Tromey <tromey at cygnus.com>.
 #
@@ -19,9 +19,7 @@ scriptversion=2007-11-22.22
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -101,7 +99,11 @@ esac
 # FIXME: add hostname here for parallel makes that run commands on
 # other machines.  But that might take us over the 14-char limit.
 dirname=ylwrap$$
-trap "cd '`pwd`'; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
+do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret'
+trap "ret=129; $do_exit" 1
+trap "ret=130; $do_exit" 2
+trap "ret=141; $do_exit" 13
+trap "ret=143; $do_exit" 15
 mkdir $dirname || exit 1
 
 cd $dirname
@@ -135,19 +137,19 @@ if test $ret -eq 0; then
     # Handle y_tab.c and y_tab.h output by DOS
     if test $y_tab_nodot = "yes"; then
       if test $from = "y.tab.c"; then
-    	from="y_tab.c"
+        from="y_tab.c"
       else
-    	if test $from = "y.tab.h"; then
-    	  from="y_tab.h"
-    	fi
+        if test $from = "y.tab.h"; then
+          from="y_tab.h"
+        fi
       fi
     fi
     if test -f "$from"; then
       # If $2 is an absolute path name, then just use that,
       # otherwise prepend `../'.
       case "$2" in
-    	[\\/]* | ?:[\\/]*) target="$2";;
-    	*) target="../$2";;
+        [\\/]* | ?:[\\/]*) target="$2";;
+        *) target="../$2";;
       esac
 
       # We do not want to overwrite a header file if it hasn't
@@ -157,8 +159,8 @@ if test $ret -eq 0; then
       # Makefile.  Divert the output of all other files to a temporary
       # file so we can compare them to existing versions.
       if test $first = no; then
-	realtarget="$target"
-	target="tmp-`echo $target | sed s/.*[\\/]//g`"
+        realtarget="$target"
+        target="tmp-`echo $target | sed s/.*[\\/]//g`"
       fi
       # Edit out `#line' or `#' directives.
       #
@@ -182,10 +184,10 @@ if test $ret -eq 0; then
 
       # Check whether header files must be updated.
       if test $first = no; then
-	if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
-	  echo "$2" is unchanged
-	  rm -f "$target"
-	else
+        if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
+          echo "$2" is unchanged
+          rm -f "$target"
+        else
           echo updating "$2"
           mv -f "$target" "$realtarget"
         fi
@@ -219,5 +221,6 @@ exit $ret
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
diff --git a/configure b/configure
index 4e59ab4..800421c 100755
--- a/configure
+++ b/configure
@@ -1,20 +1,24 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for opensm 3.2.6_20090317.
+# Generated by GNU Autoconf 2.68 for opensm 3.3.15.
+#
+# Report bugs to <linux-rdma at vger.kernel.org>.
 #
-# Report bugs to <general at lists.openfabrics.org>.
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
+#
+#
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
@@ -22,23 +26,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
 esac
-
 fi
 
 
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
 as_nl='
 '
 export as_nl
@@ -46,7 +42,13 @@ export as_nl
 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
   as_echo='printf %s\n'
   as_echo_n='printf %s'
 else
@@ -57,7 +59,7 @@ else
     as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
     as_echo_n_body='eval
       arg=$1;
-      case $arg in
+      case $arg in #(
       *"$as_nl"*)
 	expr "X$arg" : "X\\(.*\\)$as_nl";
 	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
@@ -80,13 +82,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
   }
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
 
 # IFS
 # We need space, tab and new line, in precisely that order.  Quoting is
@@ -96,15 +91,16 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
+as_myself=
+case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
 IFS=$as_save_IFS
 
      ;;
@@ -116,12 +112,16 @@ if test "x$as_myself" = x; then
 fi
 if test ! -f "$as_myself"; then
   $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
+  exit 1
 fi
 
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
 done
 PS1='$ '
 PS2='> '
@@ -133,330 +133,315 @@ export LC_ALL
 LANGUAGE=C
 export LANGUAGE
 
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-
 # CDPATH.
-$as_unset CDPATH
-
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
 if test "x$CONFIG_SHELL" = x; then
-  if (eval ":") 2>/dev/null; then
-  as_have_required=yes
+  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
 else
-  as_have_required=no
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
 fi
-
-  if test $as_have_required = yes &&	 (eval ":
-(as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
 
 exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+  exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+
+  test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+      || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
 else
-  exitcode=1
-  echo positional parameters were not saved.
+  as_have_required=no
 fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
 
-test \$exitcode = 0) || { (exit 1); exit 1; }
-
-(
-  as_lineno_1=\$LINENO
-  as_lineno_2=\$LINENO
-  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
-  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
-  :
 else
-  as_candidate_shells=
-    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  case $as_dir in
+  as_found=:
+  case $as_dir in #(
 	 /*)
 	   for as_base in sh bash ksh sh5; do
-	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+	     # Try only shells that exist, to save several forks.
+	     as_shell=$as_dir/$as_base
+	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
 	   done;;
        esac
+  as_found=false
 done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
 IFS=$as_save_IFS
 
 
-      for as_shell in $as_candidate_shells $SHELL; do
-	 # Try only shells that exist, to save several forks.
-	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-		{ ("$as_shell") 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
+      if test "x$CONFIG_SHELL" != x; then :
+  # We cannot yet assume a decent shell, so we have to provide a
+	# neutralization value for shells without unset; and this also
+	# works around shells that cannot unset nonexistent variables.
+	# Preserve -v and -x to the replacement shell.
+	BASH_ENV=/dev/null
+	ENV=/dev/null
+	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+	export CONFIG_SHELL
+	case $- in # ((((
+	  *v*x* | *x*v* ) as_opts=-vx ;;
+	  *v* ) as_opts=-v ;;
+	  *x* ) as_opts=-x ;;
+	  * ) as_opts= ;;
+	esac
+	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
 fi
 
-
-:
-_ASEOF
-}; then
-  CONFIG_SHELL=$as_shell
-	       as_have_required=yes
-	       if { "$as_shell" 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+  else
+    $as_echo "$0: Please tell bug-autoconf at gnu.org and
+$0: linux-rdma at vger.kernel.org about your system, including
+$0: any error possibly output before this message. Then
+$0: install a modern shell, or manually run the script
+$0: under such a shell if you do have one."
+  fi
+  exit 1
 fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
 
-
-:
-(as_func_return () {
-  (exit $1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
 }
+as_unset=as_fn_unset
 
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
 
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
 
-if as_func_ret_success; then
-  :
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
 else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
-  :
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
 else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
-  break
-fi
-
-fi
-
-      done
-
-      if test "x$CONFIG_SHELL" != x; then
-  for as_var in BASH_ENV ENV
-	do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-	done
-	export CONFIG_SHELL
-	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
-
-    if test $as_have_required = no; then
-  echo This script requires a shell more modern than all the
-      echo shells that I found on your system.  Please install a
-      echo modern shell, or manually run the script under such a
-      echo shell if you do have one.
-      { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
 
 
-(eval "as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
 
-exitcode=0
-if as_func_success; then
-  :
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
 else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
+  as_expr=false
 fi
 
-if as_func_ret_success; then
-  :
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
 else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
+  as_basename=false
 fi
 
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
 else
-  exitcode=1
-  echo positional parameters were not saved.
+  as_dirname=false
 fi
 
-test \$exitcode = 0") || {
-  echo No shell found that supports shell functions.
-  echo Please tell bug-autoconf at gnu.org about your system,
-  echo including any error possibly output before this message.
-  echo This can help us improve future autoconf versions.
-  echo Configuration will now proceed without shell functions.
-}
-
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
 
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
 
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
 
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
   sed -n '
     p
     /[$]LINENO/=
@@ -473,40 +458,28 @@ test \$exitcode = 0") || {
       s/-\n.*//
     ' >$as_me.lineno &&
   chmod +x "$as_me.lineno" ||
-    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
   # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
 
 ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
+case `echo -n x` in #(((((
 -n*)
-  case `echo 'x\c'` in
+  case `echo 'xy\c'` in
   *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
   esac;;
 *)
   ECHO_N='-n';;
 esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
 
 rm -f conf$$ conf$$.exe conf$$.file
 if test -d conf$$.dir; then
@@ -536,7 +509,7 @@ rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
 
 if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
+  as_mkdir_p='mkdir -p "$as_dir"'
 else
   test -d ./-p && rmdir ./-p
   as_mkdir_p=false
@@ -555,10 +528,10 @@ else
       if test -d "$1"; then
 	test -d "$1/.";
       else
-	case $1 in
+	case $1 in #(
 	-*)set "./$1";;
 	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
 	???[sx]*):;;*)false;;esac;fi
     '\'' sh
   '
@@ -571,161 +544,14 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 # Sed expression to map a string onto a valid variable name.
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
-
-
-
-# Check that we are running under the correct shell.
 SHELL=${CONFIG_SHELL-/bin/sh}
 
-case X$lt_ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
-  ;;
-esac
-
-ECHO=${lt_ECHO-echo}
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
-  # Yippee, $ECHO works!
-  :
-else
-  # Restart under the correct shell.
-  exec $SHELL "$0" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<_LT_EOF
-$*
-_LT_EOF
-  exit 0
-fi
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$lt_ECHO"; then
-  if test "X${echo_test_string+set}" != Xset; then
-    # find a string as large as possible, as long as the shell can cope with it
-    for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
-      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
-      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
-	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
-      then
-        break
-      fi
-    done
-  fi
-
-  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-     test "X$echo_testing_string" = "X$echo_test_string"; then
-    :
-  else
-    # The Solaris, AIX, and Digital Unix default echo programs unquote
-    # backslashes.  This makes it impossible to quote backslashes using
-    #   echo "$something" | sed 's/\\/\\\\/g'
-    #
-    # So, first we look for a working echo in the user's PATH.
-
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for dir in $PATH /usr/ucb; do
-      IFS="$lt_save_ifs"
-      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
-         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        ECHO="$dir/echo"
-        break
-      fi
-    done
-    IFS="$lt_save_ifs"
-
-    if test "X$ECHO" = Xecho; then
-      # We didn't find a better echo, so look for alternatives.
-      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        # This shell has a builtin print -r that does the trick.
-        ECHO='print -r'
-      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
-	   test "X$CONFIG_SHELL" != X/bin/ksh; then
-        # If we have ksh, try running configure again with it.
-        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-        export ORIGINAL_CONFIG_SHELL
-        CONFIG_SHELL=/bin/ksh
-        export CONFIG_SHELL
-        exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
-      else
-        # Try using printf.
-        ECHO='printf %s\n'
-        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	  # Cool, printf works
-	  :
-        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
-	  export CONFIG_SHELL
-	  SHELL="$CONFIG_SHELL"
-	  export SHELL
-	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
-        elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
-        else
-	  # maybe with a smaller string...
-	  prev=:
-
-	  for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
-	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
-	    then
-	      break
-	    fi
-	    prev="$cmd"
-	  done
-
-	  if test "$prev" != 'sed 50q "$0"'; then
-	    echo_test_string=`eval $prev`
-	    export echo_test_string
-	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
-	  else
-	    # Oops.  We lost completely, so just stick with echo.
-	    ECHO=echo
-	  fi
-        fi
-      fi
-    fi
-  fi
-fi
-
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-lt_ECHO=$ECHO
-if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
-   lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
-fi
-
-
 
-
-exec 7<&0 </dev/null 6>&1
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
 
 # Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
 # so uname gets run too.
 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
 
@@ -740,14 +566,14 @@ cross_compiling=no
 subdirs=
 MFLAGS=
 MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
 
 # Identity of this package.
 PACKAGE_NAME='opensm'
 PACKAGE_TARNAME='opensm'
-PACKAGE_VERSION='3.2.6_20090317'
-PACKAGE_STRING='opensm 3.2.6_20090317'
-PACKAGE_BUGREPORT='general at lists.openfabrics.org'
+PACKAGE_VERSION='3.3.15'
+PACKAGE_STRING='opensm 3.3.15'
+PACKAGE_BUGREPORT='linux-rdma at vger.kernel.org'
+PACKAGE_URL=''
 
 ac_unique_file="opensm/osm_opensm.c"
 # Factoring default headers for most tests.
@@ -786,7 +612,9 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='LTLIBOBJS
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
 LIBOBJS
 OSMV_INCLUDES
 OSMV_LDADD
@@ -799,7 +627,9 @@ OSMV_GEN1_TRUE
 OSMV_VAPI_FALSE
 OSMV_VAPI_TRUE
 DEFAULT_EVENT_PLUGIN
+PER_MOD_LOGGING_FILE
 PREFIX_ROUTES_FILE
+TORUS2QOS_CONF_FILE
 QOS_POLICY_FILE
 PARTITION_CONFIG_FILE
 NODENAMEMAPFILE
@@ -823,9 +653,11 @@ OTOOL
 LIPO
 NMEDIT
 DSYMUTIL
-lt_ECHO
+MANIFEST_TOOL
 RANLIB
+ac_ct_AR
 AR
+DLLTOOL
 OBJDUMP
 LN_S
 NM
@@ -848,6 +680,7 @@ LIBTOOL
 am__fastdepCC_FALSE
 am__fastdepCC_TRUE
 CCDEPMODE
+am__nodep
 AMDEPBACKSLASH
 AMDEP_FALSE
 AMDEP_TRUE
@@ -916,6 +749,7 @@ bindir
 program_transform_name
 prefix
 exec_prefix
+PACKAGE_URL
 PACKAGE_BUGREPORT
 PACKAGE_STRING
 PACKAGE_VERSION
@@ -932,9 +766,11 @@ enable_static
 with_pic
 enable_fast_install
 with_gnu_ld
+with_sysroot
 enable_libtool_lock
 enable_debug
 enable_libcheck
+enable_console_loopback
 enable_console_socket
 enable_perf_mgr
 enable_perf_mgr_profile
@@ -944,6 +780,7 @@ with_node_name_map
 with_partitions_conf
 with_qos_policy_conf
 with_prefix_routes_conf
+with_per_module_logging_conf
 enable_default_event_plugin
 with_osmv
 with_umad_prefix
@@ -1024,8 +861,9 @@ do
   fi
 
   case $ac_option in
-  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
-  *)	ac_optarg=yes ;;
+  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *=)   ac_optarg= ;;
+  *)    ac_optarg=yes ;;
   esac
 
   # Accept the important Cygnus configure options, so we can diagnose typos.
@@ -1070,8 +908,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error $? "invalid feature name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1097,8 +934,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error $? "invalid feature name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1302,8 +1138,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error $? "invalid package name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1319,8 +1154,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error $? "invalid package name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1350,17 +1184,17 @@ do
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
     x_libraries=$ac_optarg ;;
 
-  -*) { $as_echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; }
+  -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
     ;;
 
   *=*)
     ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
-   { (exit 1); exit 1; }; }
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+    esac
     eval $ac_envvar=\$ac_optarg
     export $ac_envvar ;;
 
@@ -1369,7 +1203,7 @@ Try \`$0 --help' for more information." >&2
     $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
     ;;
 
   esac
@@ -1377,15 +1211,13 @@ done
 
 if test -n "$ac_prev"; then
   ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  { $as_echo "$as_me: error: missing argument to $ac_option" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "missing argument to $ac_option"
 fi
 
 if test -n "$ac_unrecognized_opts"; then
   case $enable_option_checking in
     no) ;;
-    fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2
-   { (exit 1); exit 1; }; } ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
     *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
   esac
 fi
@@ -1408,8 +1240,7 @@ do
     [\\/$]* | ?:[\\/]* )  continue;;
     NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
   esac
-  { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
 done
 
 # There might be people who depend on the old broken behavior: `$host'
@@ -1423,8 +1254,8 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used." >&2
+    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1439,11 +1270,9 @@ test "$silent" = yes && exec 6>/dev/null
 ac_pwd=`pwd` && test -n "$ac_pwd" &&
 ac_ls_di=`ls -di .` &&
 ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  { $as_echo "$as_me: error: working directory cannot be determined" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "working directory cannot be determined"
 test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "pwd does not report name of working directory"
 
 
 # Find the source files, if location was not specified.
@@ -1482,13 +1311,11 @@ else
 fi
 if test ! -r "$srcdir/$ac_unique_file"; then
   test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
 fi
 ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
 ac_abs_confdir=`(
-	cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
-   { (exit 1); exit 1; }; }
+	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
 	pwd)`
 # When building in place, set srcdir=.
 if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1514,7 +1341,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures opensm 3.2.6_20090317 to adapt to many kinds of systems.
+\`configure' configures opensm 3.3.15 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1528,7 +1355,7 @@ Configuration:
       --help=short        display options specific to this package
       --help=recursive    display the short help of all the included packages
   -V, --version           display version information and exit
-  -q, --quiet, --silent   do not print \`checking...' messages
+  -q, --quiet, --silent   do not print \`checking ...' messages
       --cache-file=FILE   cache test results in FILE [disabled]
   -C, --config-cache      alias for \`--cache-file=config.cache'
   -n, --no-create         do not create output files
@@ -1584,7 +1411,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of opensm 3.2.6_20090317:";;
+     short | recursive ) echo "Configuration of opensm 3.3.15:";;
    esac
   cat <<\_ACEOF
 
@@ -1601,17 +1428,20 @@ Optional Features:
   --disable-libtool-lock  avoid locking (might break parallel builds)
   --enable-debug          Turn on debugging
   --disable-libcheck      do not test for presence of ib libraries
-  --enable-console-socket Enable a console socket, requires tcp_wrappers (default no)
-  --enable-perf-mgr Enable the performance manager (default no)
+  --enable-console-loopback Enable a console socket on the loopback interface, requires tcp_wrappers (default yes)
+  --enable-console-socket Enable a console socket, requires --enable-console-loopback (default no)
+  --enable-perf-mgr Enable the performance manager (default yes)
   --enable-perf-mgr-profile Enable the performance manager profiling (default no)
   --enable-default-event-plugin  Enable a default event plugin "osmeventplugin" (default no)
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-pic              try to use only PIC/non-PIC objects [default=use
+  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-sysroot=DIR Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).
   --with-opensm-conf-sub-dir=dir
                           define a directory name for opensm's conf files
                           <sysconfdir>/<dir> (default "opensm")
@@ -1630,6 +1460,9 @@ Optional Packages:
   --with-prefix-routes-conf=file
                           define a Prefix Routes config file (default is
                           prefix-routes.conf)
+  --with-per-module-logging-conf=file
+                          define a Per Module Logging config file (default is
+                          per-module-logging.conf)
   --with-osmv=<type>      define the osm vendor type to build
   --with-umad-prefix=<dir>
                           define the dir used as prefix for ibumad
@@ -1646,11 +1479,12 @@ Some influential environment variables:
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
               nonstandard directory <lib dir>
   LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
   CPP         C preprocessor
-  YACC        The `Yet Another C Compiler' implementation to use. Defaults to
-              the first program found out of: `bison -y', `byacc', `yacc'.
+  YACC        The `Yet Another Compiler Compiler' implementation to use.
+              Defaults to the first program found out of: `bison -y', `byacc',
+              `yacc'.
   YFLAGS      The list of arguments that will be passed by default to $YACC.
               This script will default YFLAGS to the empty string to avoid a
               default value of `-d' given by some make applications.
@@ -1658,7 +1492,7 @@ Some influential environment variables:
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
-Report bugs to <general at lists.openfabrics.org>.
+Report bugs to <linux-rdma at vger.kernel.org>.
 _ACEOF
 ac_status=$?
 fi
@@ -1718,25 +1552,434 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
   done
 fi
 
-test -n "$ac_init_help" && exit $ac_status
-if $ac_init_version; then
-  cat <<\_ACEOF
-opensm configure 3.2.6_20090317
-generated by GNU Autoconf 2.63
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
-  exit
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+opensm configure 3.3.15
+generated by GNU Autoconf 2.68
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+	 return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+	    return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if eval \${$3+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ----------------------------------------- ##
+## Report this to linux-rdma at vger.kernel.org ##
+## ----------------------------------------- ##"
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by opensm $as_me 3.2.6_20090317, which was
-generated by GNU Autoconf 2.63.  Invocation command line was
+It was created by opensm $as_me 3.3.15, which was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
 
@@ -1772,8 +2015,8 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  $as_echo "PATH: $as_dir"
-done
+    $as_echo "PATH: $as_dir"
+  done
 IFS=$as_save_IFS
 
 } >&5
@@ -1810,9 +2053,9 @@ do
       ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
     case $ac_pass in
-    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
     2)
-      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      as_fn_append ac_configure_args1 " '$ac_arg'"
       if test $ac_must_keep_next = true; then
 	ac_must_keep_next=false # Got value, back to normal.
       else
@@ -1828,13 +2071,13 @@ do
 	  -* ) ac_must_keep_next=true ;;
 	esac
       fi
-      ac_configure_args="$ac_configure_args '$ac_arg'"
+      as_fn_append ac_configure_args " '$ac_arg'"
       ;;
     esac
   done
 done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
 
 # When interrupted or exit'd, cleanup temporary files, and complete
 # config.log.  We remove comments because anyway the quotes in there
@@ -1846,11 +2089,9 @@ trap 'exit_status=$?
   {
     echo
 
-    cat <<\_ASBOX
-## ---------------- ##
+    $as_echo "## ---------------- ##
 ## Cache variables. ##
-## ---------------- ##
-_ASBOX
+## ---------------- ##"
     echo
     # The following way of writing the cache mishandles newlines in values,
 (
@@ -1859,13 +2100,13 @@ _ASBOX
     case $ac_val in #(
     *${as_nl}*)
       case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       esac
       case $ac_var in #(
       _ | IFS | as_nl) ;; #(
       BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) $as_unset $ac_var ;;
+      *) { eval $ac_var=; unset $ac_var;} ;;
       esac ;;
     esac
   done
@@ -1884,11 +2125,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
 )
     echo
 
-    cat <<\_ASBOX
-## ----------------- ##
+    $as_echo "## ----------------- ##
 ## Output variables. ##
-## ----------------- ##
-_ASBOX
+## ----------------- ##"
     echo
     for ac_var in $ac_subst_vars
     do
@@ -1901,11 +2140,9 @@ _ASBOX
     echo
 
     if test -n "$ac_subst_files"; then
-      cat <<\_ASBOX
-## ------------------- ##
+      $as_echo "## ------------------- ##
 ## File substitutions. ##
-## ------------------- ##
-_ASBOX
+## ------------------- ##"
       echo
       for ac_var in $ac_subst_files
       do
@@ -1919,11 +2156,9 @@ _ASBOX
     fi
 
     if test -s confdefs.h; then
-      cat <<\_ASBOX
-## ----------- ##
+      $as_echo "## ----------- ##
 ## confdefs.h. ##
-## ----------- ##
-_ASBOX
+## ----------- ##"
       echo
       cat confdefs.h
       echo
@@ -1937,46 +2172,53 @@ _ASBOX
     exit $exit_status
 ' 0
 for ac_signal in 1 2 13 15; do
-  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
 done
 ac_signal=0
 
 # confdefs.h avoids OS command line length limits that DEFS can exceed.
 rm -f -r conftest* confdefs.h
 
+$as_echo "/* confdefs.h */" > confdefs.h
+
 # Predefined preprocessor variables.
 
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_NAME "$PACKAGE_NAME"
 _ACEOF
 
-
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_TARNAME "$PACKAGE_TARNAME"
 _ACEOF
 
-
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_VERSION "$PACKAGE_VERSION"
 _ACEOF
 
-
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_STRING "$PACKAGE_STRING"
 _ACEOF
 
-
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
 _ACEOF
 
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
 
 # Let the site file select an alternate cache file if it wants to.
 # Prefer an explicitly selected file to automatically selected ones.
 ac_site_file1=NONE
 ac_site_file2=NONE
 if test -n "$CONFIG_SITE"; then
-  ac_site_file1=$CONFIG_SITE
+  # We do not want a PATH search for config.site.
+  case $CONFIG_SITE in #((
+    -*)  ac_site_file1=./$CONFIG_SITE;;
+    */*) ac_site_file1=$CONFIG_SITE;;
+    *)   ac_site_file1=./$CONFIG_SITE;;
+  esac
 elif test "x$prefix" != xNONE; then
   ac_site_file1=$prefix/share/config.site
   ac_site_file2=$prefix/etc/config.site
@@ -1987,19 +2229,23 @@ fi
 for ac_site_file in "$ac_site_file1" "$ac_site_file2"
 do
   test "x$ac_site_file" = xNONE && continue
-  if test -r "$ac_site_file"; then
-    { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
 $as_echo "$as_me: loading site script $ac_site_file" >&6;}
     sed 's/^/| /' "$ac_site_file" >&5
-    . "$ac_site_file"
+    . "$ac_site_file" \
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
   fi
 done
 
 if test -r "$cache_file"; then
-  # Some versions of bash will fail to source /dev/null (special
-  # files actually), so we avoid doing that.
-  if test -f "$cache_file"; then
-    { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
 $as_echo "$as_me: loading cache $cache_file" >&6;}
     case $cache_file in
       [\\/]* | ?:[\\/]* ) . "$cache_file";;
@@ -2007,7 +2253,7 @@ $as_echo "$as_me: loading cache $cache_file" >&6;}
     esac
   fi
 else
-  { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
 $as_echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
@@ -2022,11 +2268,11 @@ for ac_var in $ac_precious_vars; do
   eval ac_new_val=\$ac_env_${ac_var}_value
   case $ac_old_set,$ac_new_set in
     set,)
-      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,set)
-      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,);;
@@ -2036,17 +2282,17 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
 	ac_old_val_w=`echo x $ac_old_val`
 	ac_new_val_w=`echo x $ac_new_val`
 	if test "$ac_old_val_w" != "$ac_new_val_w"; then
-	  { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
 	  ac_cache_corrupted=:
 	else
-	  { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
 	  eval $ac_var=\$ac_old_val
 	fi
-	{ $as_echo "$as_me:$LINENO:   former value:  \`$ac_old_val'" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
 $as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
-	{ $as_echo "$as_me:$LINENO:   current value: \`$ac_new_val'" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
 $as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
       fi;;
   esac
@@ -2058,43 +2304,20 @@ $as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
     esac
     case " $ac_configure_args " in
       *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
-      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
     esac
   fi
 done
 if $ac_cache_corrupted; then
-  { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-  { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
 fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -2121,9 +2344,7 @@ for ac_dir in config "$srcdir"/config; do
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&5
-$as_echo "$as_me: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5
 fi
 
 # These three variables are undocumented and unsupported,
@@ -2135,9 +2356,10 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
 ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 
 
+
 ac_config_headers="$ac_config_headers include/config.h include/opensm/osm_config.h"
 
-am__api_version='1.10'
+am__api_version='1.11'
 
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
@@ -2153,10 +2375,10 @@ am__api_version='1.10'
 # OS/2's system install, which has a completely different semantic
 # ./install, which can be erroneously created by make from ./install.sh.
 # Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
 $as_echo_n "checking for a BSD-compatible install... " >&6; }
 if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
+if ${ac_cv_path_install+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2164,11 +2386,11 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
-  ./ | .// | /cC/* | \
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
   /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
   /usr/ucb/* ) ;;
   *)
     # OSF1 and SCO ODT 3.0 have their own names for install.
@@ -2205,7 +2427,7 @@ case $as_dir/ in
     ;;
 esac
 
-done
+  done
 IFS=$as_save_IFS
 
 rm -rf conftest.one conftest.two conftest.dir
@@ -2221,7 +2443,7 @@ fi
     INSTALL=$ac_install_sh
   fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
 $as_echo "$INSTALL" >&6; }
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
@@ -2232,21 +2454,34 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
-{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
 $as_echo_n "checking whether build environment is sane... " >&6; }
 # Just in case
 sleep 1
 echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[\\\"\#\$\&\'\`$am_lf]*)
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+  *[\\\"\#\$\&\'\`$am_lf\ \	]*)
+    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+esac
+
 # Do `set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
    if test "$*" = "X"; then
       # -L didn't work.
-      set X `ls -t $srcdir/configure conftest.file`
+      set X `ls -t "$srcdir/configure" conftest.file`
    fi
    rm -f conftest.file
    if test "$*" != "X $srcdir/configure conftest.file" \
@@ -2256,11 +2491,8 @@ if (
       # if, for instance, CONFIG_SHELL is bash and it inherits a
       # broken ls alias from the environment.  This has actually
       # happened.  Such a system could not be considered "sane".
-      { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&5
-$as_echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&2;}
-   { (exit 1); exit 1; }; }
+      as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" "$LINENO" 5
    fi
 
    test "$2" = conftest.file
@@ -2269,13 +2501,10 @@ then
    # Ok.
    :
 else
-   { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files!
-Check your system clock" >&5
-$as_echo "$as_me: error: newly created file is older than distributed files!
-Check your system clock" >&2;}
-   { (exit 1); exit 1; }; }
+   as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
 fi
-{ $as_echo "$as_me:$LINENO: result: yes" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 test "$program_prefix" != NONE &&
   program_transform_name="s&^&$program_prefix&;$program_transform_name"
@@ -2290,20 +2519,136 @@ program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
 # expand $ac_aux_dir to an absolute path
 am_aux_dir=`cd $ac_aux_dir && pwd`
 
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
 # Use eval to expand $SHELL
 if eval "$MISSING --run true"; then
   am_missing_run="$MISSING --run "
 else
   am_missing_run=
-  { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
 if test -z "$MKDIR_P"; then
-  if test "${ac_cv_path_mkdir+set}" = set; then
+  if ${ac_cv_path_mkdir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2311,7 +2656,7 @@ for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in mkdir gmkdir; do
+    for ac_prog in mkdir gmkdir; do
 	 for ac_exec_ext in '' $ac_executable_extensions; do
 	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
 	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
@@ -2323,11 +2668,12 @@ do
 	   esac
 	 done
        done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 
+  test -d ./--version && rmdir ./--version
   if test "${ac_cv_path_mkdir+set}" = set; then
     MKDIR_P="$ac_cv_path_mkdir -p"
   else
@@ -2335,11 +2681,10 @@ fi
     # value for MKDIR_P within a source directory, because that will
     # break other packages using the cache if that directory is
     # removed, or if the value is a relative name.
-    test -d ./--version && rmdir ./--version
     MKDIR_P="$ac_install_sh -d"
   fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
 $as_echo "$MKDIR_P" >&6; }
 
 mkdir_p="$MKDIR_P"
@@ -2352,9 +2697,9 @@ for ac_prog in gawk mawk nawk awk
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then
+if ${ac_cv_prog_AWK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
@@ -2365,24 +2710,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_AWK="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 AWK=$ac_cv_prog_AWK
 if test -n "$AWK"; then
-  { $as_echo "$as_me:$LINENO: result: $AWK" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
 $as_echo "$AWK" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -2390,11 +2735,11 @@ fi
   test -n "$AWK" && break
 done
 
-{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
@@ -2402,7 +2747,7 @@ SHELL = /bin/sh
 all:
 	@echo '@@@%%%=$(MAKE)=@@@%%%'
 _ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
 case `${MAKE-make} -f conftest.make 2>/dev/null` in
   *@@@%%%=?*=@@@%%%*)
     eval ac_cv_prog_make_${ac_make}_set=yes;;
@@ -2412,11 +2757,11 @@ esac
 rm -f conftest.make
 fi
 if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
   SET_MAKE=
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
   SET_MAKE="MAKE=${MAKE-make}"
 fi
@@ -2436,9 +2781,7 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then
   am__isrc=' -I$(srcdir)'
   # test to see if srcdir already configured
   if test -f $srcdir/config.status; then
-    { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
-$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
   fi
 fi
 
@@ -2454,7 +2797,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='opensm'
- VERSION='3.2.6_20090317'
+ VERSION='3.3.15'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2474,123 +2817,21 @@ ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
 AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
 
 
-AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
-
-
-AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
-
-
-MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
-
-install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
-
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
-# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-if test "$cross_compiling" != no; then
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$STRIP"; then
-  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
-  { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_STRIP"; then
-  ac_ct_STRIP=$STRIP
-  # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_STRIP"; then
-  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_STRIP="strip"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
-if test -n "$ac_ct_STRIP"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-$as_echo "$ac_ct_STRIP" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_STRIP" = x; then
-    STRIP=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    STRIP=$ac_ct_STRIP
-  fi
-else
-  STRIP="$ac_cv_prog_STRIP"
-fi
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
 
-fi
-INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
-# Always define AMTAR for backward compatibility.
-
-AMTAR=${AMTAR-"${am_missing_run}tar"}
+# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
 
-am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
 
 
 
@@ -2603,9 +2844,7 @@ TARBALL=${TARBALL:-${PACKAGE}-${VERSION}.tar.gz}
 
 
 
-cat >>confdefs.h <<\_ACEOF
-#define _OSM_CONFIG_H_ 1
-_ACEOF
+$as_echo "#define _OSM_CONFIG_H_ 1" >>confdefs.h
 
 
 ac_ext=c
@@ -2615,11 +2854,11 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
@@ -2627,7 +2866,7 @@ SHELL = /bin/sh
 all:
 	@echo '@@@%%%=$(MAKE)=@@@%%%'
 _ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
 case `${MAKE-make} -f conftest.make 2>/dev/null` in
   *@@@%%%=?*=@@@%%%*)
     eval ac_cv_prog_make_${ac_make}_set=yes;;
@@ -2637,11 +2876,11 @@ esac
 rm -f conftest.make
 fi
 if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
   SET_MAKE=
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
   SET_MAKE="MAKE=${MAKE-make}"
 fi
@@ -2654,9 +2893,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -2667,24 +2906,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
 $as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -2694,9 +2933,9 @@ if test -z "$ac_cv_prog_CC"; then
   ac_ct_CC=$CC
   # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -2707,24 +2946,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CC="gcc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
 $as_echo "$ac_ct_CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -2733,7 +2972,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -2747,9 +2986,9 @@ if test -z "$CC"; then
           if test -n "$ac_tool_prefix"; then
     # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -2760,24 +2999,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
 $as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -2787,9 +3026,9 @@ fi
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -2801,18 +3040,18 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
      fi
     ac_cv_prog_CC="cc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 if test $ac_prog_rejected = yes; then
@@ -2831,10 +3070,10 @@ fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
 $as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -2846,9 +3085,9 @@ if test -z "$CC"; then
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -2859,24 +3098,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
 $as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -2890,9 +3129,9 @@ if test -z "$CC"; then
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -2903,24 +3142,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
 $as_echo "$ac_ct_CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -2933,7 +3172,7 @@ done
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -2944,57 +3183,37 @@ fi
 fi
 
 
-test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
 
 # Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
 set X $ac_compile
 ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
 
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3010,8 +3229,8 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
 ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
 
 # The possible output files:
@@ -3027,17 +3246,17 @@ do
 done
 rm -f $ac_rmfiles
 
-if { (ac_try="$ac_link_default"
+if { { ac_try="$ac_link_default"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_link_default") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
   # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
 # So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
 # in a Makefile.  We should not override ac_cv_exeext if it was cached,
@@ -3054,7 +3273,7 @@ do
 	# certainly right.
 	break;;
     *.* )
-        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
 	then :; else
 	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
 	fi
@@ -3073,84 +3292,41 @@ test "$ac_cv_exeext" = no && ac_cv_exeext=
 else
   ac_file=''
 fi
-
-{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-if test -z "$ac_file"; then
-  $as_echo "$as_me: failed program was:" >&5
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 fi
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
 ac_exeext=$ac_cv_exeext
 
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
-  if { ac_try='./$ac_file'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-    cross_compiling=no
-  else
-    if test "$cross_compiling" = maybe; then
-	cross_compiling=yes
-    else
-	{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-    fi
-  fi
-fi
-{ $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
 rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
 ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
 $as_echo_n "checking for suffix of executables... " >&6; }
-if { (ac_try="$ac_link"
+if { { ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
   # If both `conftest.exe' and `conftest' are `present' (well, observable)
 # catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
 # work properly (i.e., refer to `conftest.exe'), while it won't with
@@ -3165,32 +3341,83 @@ for ac_file in conftest.exe conftest conftest.*; do
   esac
 done
 else
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
 fi
-
-rm -f conftest$ac_cv_exeext
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
 $as_echo "$ac_cv_exeext" >&6; }
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
 ac_exeext=$EXEEXT
-{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
 $as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then
+if ${ac_cv_objext+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3202,17 +3429,17 @@ main ()
 }
 _ACEOF
 rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
+if { { ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_compile") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
   for ac_file in conftest.o conftest.obj conftest.*; do
   test -f "$ac_file" || continue;
   case $ac_file in
@@ -3225,31 +3452,23 @@ else
   $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
 fi
-
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
 $as_echo "$ac_cv_objext" >&6; }
 OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
-{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
+if ${ac_cv_c_compiler_gnu+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3263,37 +3482,16 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_compiler_gnu=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_compiler_gnu=no
+  ac_compiler_gnu=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
 $as_echo "$ac_cv_c_compiler_gnu" >&6; }
 if test $ac_compiler_gnu = yes; then
   GCC=yes
@@ -3302,20 +3500,16 @@ else
 fi
 ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then
+if ${ac_cv_prog_cc_g+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
    ac_c_werror_flag=yes
    ac_cv_prog_cc_g=no
    CFLAGS="-g"
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3326,35 +3520,11 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_prog_cc_g=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	CFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3365,36 +3535,12 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_compile "$LINENO"; then :
 
-	ac_c_werror_flag=$ac_save_c_werror_flag
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
 	 CFLAGS="-g"
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3405,42 +3551,17 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_prog_cc_g=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    ac_c_werror_flag=$ac_save_c_werror_flag
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
 $as_echo "$ac_cv_prog_cc_g" >&6; }
 if test "$ac_test_CFLAGS" = set; then
   CFLAGS=$ac_save_CFLAGS
@@ -3457,18 +3578,14 @@ else
     CFLAGS=
   fi
 fi
-{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
+if ${ac_cv_prog_cc_c89+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
 ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
@@ -3525,32 +3642,9 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
 	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
 do
   CC="$ac_save_CC $ac_arg"
-  rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_prog_cc_c89=$ac_arg
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
 rm -f core conftest.err conftest.$ac_objext
   test "x$ac_cv_prog_cc_c89" != "xno" && break
 done
@@ -3561,17 +3655,19 @@ fi
 # AC_CACHE_VAL
 case "x$ac_cv_prog_cc_c89" in
   x)
-    { $as_echo "$as_me:$LINENO: result: none needed" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
 $as_echo "none needed" >&6; } ;;
   xno)
-    { $as_echo "$as_me:$LINENO: result: unsupported" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
 $as_echo "unsupported" >&6; } ;;
   *)
     CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
 esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
 
+fi
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -3586,50 +3682,51 @@ ac_config_commands="$ac_config_commands depfiles"
 am_make=${MAKE-make}
 cat > confinc << 'END'
 am__doit:
-	@echo done
+	@echo this is the am__doit target
 .PHONY: am__doit
 END
 # If we don't find an include directive, just comment out the code.
-{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
 $as_echo_n "checking for style of include used by $am_make... " >&6; }
 am__include="#"
 am__quote=
 _am_result=none
 # First try GNU make style include.
 echo "include confinc" > confmf
-# We grep out `Entering directory' and `Leaving directory'
-# messages which can occur if `w' ends up in MAKEFLAGS.
-# In particular we don't look at `^make:' because GNU make might
-# be invoked under some other name (usually "gmake"), in which
-# case it prints its new name instead of `make'.
-if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
-   am__include=include
-   am__quote=
-   _am_result=GNU
-fi
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
+esac
 # Now try BSD make style include.
 if test "$am__include" = "#"; then
    echo '.include "confinc"' > confmf
-   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
-      am__include=.include
-      am__quote="\""
-      _am_result=BSD
-   fi
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
 fi
 
 
-{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
 $as_echo "$_am_result" >&6; }
 rm -f confinc confmf
 
 # Check whether --enable-dependency-tracking was given.
-if test "${enable_dependency_tracking+set}" = set; then
+if test "${enable_dependency_tracking+set}" = set; then :
   enableval=$enable_dependency_tracking;
 fi
 
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
+  am__nodep='_no'
 fi
  if test "x$enable_dependency_tracking" != xno; then
   AMDEP_TRUE=
@@ -3643,9 +3740,9 @@ fi
 
 depcc="$CC"   am_compiler_list=
 
-{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
 $as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -3654,6 +3751,7 @@ else
   # instance it was reported that on HP-UX the gcc test will end up
   # making a dummy file named `D' -- because `-MD' means `put the output
   # in D'.
+  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -3671,6 +3769,11 @@ else
   if test "$am_compiler_list" = ""; then
      am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
   fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
+
   for depmode in $am_compiler_list; do
     # Setup a source with many dependencies, because some compilers
     # like to wrap large dependency lists on column 80 (with \), and
@@ -3688,7 +3791,17 @@ else
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
     case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
     nosideeffect)
       # after this tag, mechanisms are not by side-effect, so they'll
       # only be used when explicitly requested
@@ -3698,19 +3811,23 @@ else
 	break
       fi
       ;;
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
     none) break ;;
     esac
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
-    # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.
     if depmode=$depmode \
-       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       source=sub/conftest.c object=$am__obj \
        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
          >/dev/null 2>conftest.err &&
        grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
       # icc doesn't choke on unknown options, it will just issue warnings
       # or remarks (even with -Werror).  So we grep stderr for any message
@@ -3734,7 +3851,7 @@ else
 fi
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
 
@@ -3751,14 +3868,14 @@ fi
 
 case `pwd` in
   *\ * | *\	*)
-    { $as_echo "$as_me:$LINENO: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
 esac
 
 
 
-macro_version='2.2.6'
-macro_revision='1.3012'
+macro_version='2.4.2'
+macro_revision='1.3337'
 
 
 
@@ -3776,35 +3893,27 @@ ltmain="$ac_aux_dir/ltmain.sh"
 
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
 
-{ $as_echo "$as_me:$LINENO: checking build system type" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
 $as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then
+if ${ac_cv_build+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_build_alias=$build_alias
 test "x$ac_build_alias" = x &&
   ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
 test "x$ac_build_alias" = x &&
-  { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
 $as_echo "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-$as_echo "$as_me: error: invalid value of canonical build" >&2;}
-   { (exit 1); exit 1; }; };;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
 esac
 build=$ac_cv_build
 ac_save_IFS=$IFS; IFS='-'
@@ -3820,46 +3929,111 @@ IFS=$ac_save_IFS
 case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
 
-{ $as_echo "$as_me:$LINENO: checking host system type" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
 $as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then
+if ${ac_cv_host+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test "x$host_alias" = x; then
   ac_cv_host=$ac_cv_build
 else
   ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
 
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-$as_echo "$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-$as_echo "$as_me: error: invalid value of canonical host" >&2;}
-   { (exit 1); exit 1; }; };;
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO ""
+}
+
+case "$ECHO" in
+  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
 esac
-host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
-{ $as_echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if test "${ac_cv_path_SED+set}" = set; then
+if ${ac_cv_path_SED+:} false; then :
   $as_echo_n "(cached) " >&6
 else
             ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
@@ -3867,7 +4041,7 @@ else
        ac_script="$ac_script$as_nl$ac_script"
      done
      echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
-     $as_unset ac_script || ac_script=
+     { ac_script=; unset ac_script;}
      if test -z "$SED"; then
   ac_path_SED_found=false
   # Loop through the user's path and test for each of PROGNAME-LIST
@@ -3876,7 +4050,7 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in sed gsed; do
+    for ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
       { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
@@ -3896,7 +4070,7 @@ case `"$ac_path_SED" --version 2>&1` in
     $as_echo '' >> "conftest.nl"
     "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
     if test $ac_count -gt ${ac_path_SED_max-0}; then
       # Best one so far, save it but keep looking for a better one
       ac_cv_path_SED="$ac_path_SED"
@@ -3911,19 +4085,17 @@ esac
       $ac_path_SED_found && break 3
     done
   done
-done
+  done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_SED"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable sed could be found in \$PATH" >&5
-$as_echo "$as_me: error: no acceptable sed could be found in \$PATH" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
   fi
 else
   ac_cv_path_SED=$SED
 fi
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
 $as_echo "$ac_cv_path_SED" >&6; }
  SED="$ac_cv_path_SED"
   rm -f conftest.sed
@@ -3941,9 +4113,9 @@ Xsed="$SED -e 1s/^X//"
 
 
 
-{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
+if ${ac_cv_path_GREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$GREP"; then
@@ -3954,7 +4126,7 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in grep ggrep; do
+    for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
       { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
@@ -3974,7 +4146,7 @@ case `"$ac_path_GREP" --version 2>&1` in
     $as_echo 'GREP' >> "conftest.nl"
     "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
     if test $ac_count -gt ${ac_path_GREP_max-0}; then
       # Best one so far, save it but keep looking for a better one
       ac_cv_path_GREP="$ac_path_GREP"
@@ -3989,26 +4161,24 @@ esac
       $ac_path_GREP_found && break 3
     done
   done
-done
+  done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_GREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_GREP=$GREP
 fi
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
 $as_echo "$ac_cv_path_GREP" >&6; }
  GREP="$ac_cv_path_GREP"
 
 
-{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
 $as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
+if ${ac_cv_path_EGREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -4022,7 +4192,7 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in egrep; do
+    for ac_prog in egrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
       { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
@@ -4042,7 +4212,7 @@ case `"$ac_path_EGREP" --version 2>&1` in
     $as_echo 'EGREP' >> "conftest.nl"
     "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
     if test $ac_count -gt ${ac_path_EGREP_max-0}; then
       # Best one so far, save it but keep looking for a better one
       ac_cv_path_EGREP="$ac_path_EGREP"
@@ -4057,12 +4227,10 @@ esac
       $ac_path_EGREP_found && break 3
     done
   done
-done
+  done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_EGREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_EGREP=$EGREP
@@ -4070,14 +4238,14 @@ fi
 
    fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
 $as_echo "$ac_cv_path_EGREP" >&6; }
  EGREP="$ac_cv_path_EGREP"
 
 
-{ $as_echo "$as_me:$LINENO: checking for fgrep" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
 $as_echo_n "checking for fgrep... " >&6; }
-if test "${ac_cv_path_FGREP+set}" = set; then
+if ${ac_cv_path_FGREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
@@ -4091,7 +4259,7 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in fgrep; do
+    for ac_prog in fgrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
       { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
@@ -4111,7 +4279,7 @@ case `"$ac_path_FGREP" --version 2>&1` in
     $as_echo 'FGREP' >> "conftest.nl"
     "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
     if test $ac_count -gt ${ac_path_FGREP_max-0}; then
       # Best one so far, save it but keep looking for a better one
       ac_cv_path_FGREP="$ac_path_FGREP"
@@ -4126,12 +4294,10 @@ esac
       $ac_path_FGREP_found && break 3
     done
   done
-done
+  done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_FGREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_FGREP=$FGREP
@@ -4139,7 +4305,7 @@ fi
 
    fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_FGREP" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
 $as_echo "$ac_cv_path_FGREP" >&6; }
  FGREP="$ac_cv_path_FGREP"
 
@@ -4165,7 +4331,7 @@ test -z "$GREP" && GREP=grep
 
 
 # Check whether --with-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then
+if test "${with_gnu_ld+set}" = set; then :
   withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
 else
   with_gnu_ld=no
@@ -4174,7 +4340,7 @@ fi
 ac_prog=ld
 if test "$GCC" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
-  { $as_echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
 $as_echo_n "checking for ld used by $CC... " >&6; }
   case $host in
   *-*-mingw*)
@@ -4204,13 +4370,13 @@ $as_echo_n "checking for ld used by $CC... " >&6; }
     ;;
   esac
 elif test "$with_gnu_ld" = yes; then
-  { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
 $as_echo_n "checking for GNU ld... " >&6; }
 else
-  { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
 $as_echo_n "checking for non-GNU ld... " >&6; }
 fi
-if test "${lt_cv_path_LD+set}" = set; then
+if ${lt_cv_path_LD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
@@ -4241,18 +4407,16 @@ fi
 
 LD="$lt_cv_path_LD"
 if test -n "$LD"; then
-  { $as_echo "$as_me:$LINENO: result: $LD" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
 $as_echo "$LD" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
-$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
-   { (exit 1); exit 1; }; }
-{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if test "${lt_cv_prog_gnu_ld+set}" = set; then
+if ${lt_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU lds only accept -v.
@@ -4265,7 +4429,7 @@ case `$LD -v 2>&1 </dev/null` in
   ;;
 esac
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
 $as_echo "$lt_cv_prog_gnu_ld" >&6; }
 with_gnu_ld=$lt_cv_prog_gnu_ld
 
@@ -4277,9 +4441,9 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
 
 
 
-{ $as_echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
-if test "${lt_cv_path_NM+set}" = set; then
+if ${lt_cv_path_NM+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$NM"; then
@@ -4326,20 +4490,23 @@ else
   : ${lt_cv_path_NM=no}
 fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
 $as_echo "$lt_cv_path_NM" >&6; }
 if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in dumpbin "link -dump"
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DUMPBIN+set}" = set; then
+if ${ac_cv_prog_DUMPBIN+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$DUMPBIN"; then
@@ -4350,24 +4517,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 DUMPBIN=$ac_cv_prog_DUMPBIN
 if test -n "$DUMPBIN"; then
-  { $as_echo "$as_me:$LINENO: result: $DUMPBIN" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
 $as_echo "$DUMPBIN" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4377,13 +4544,13 @@ fi
 fi
 if test -z "$DUMPBIN"; then
   ac_ct_DUMPBIN=$DUMPBIN
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  for ac_prog in dumpbin "link -dump"
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_DUMPBIN"; then
@@ -4394,24 +4561,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
 if test -n "$ac_ct_DUMPBIN"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
 $as_echo "$ac_ct_DUMPBIN" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4424,7 +4591,7 @@ done
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -4432,6 +4599,15 @@ esac
   fi
 fi
 
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
 
   if test "$DUMPBIN" != ":"; then
     NM="$DUMPBIN"
@@ -4444,44 +4620,44 @@ test -z "$NM" && NM=nm
 
 
 
-{ $as_echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
 $as_echo_n "checking the name lister ($NM) interface... " >&6; }
-if test "${lt_cv_nm_interface+set}" = set; then
+if ${lt_cv_nm_interface+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:4454: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4457: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4460: output\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
   fi
   rm -f conftest*
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
 $as_echo "$lt_cv_nm_interface" >&6; }
 
-{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
 $as_echo_n "checking whether ln -s works... " >&6; }
 LN_S=$as_ln_s
 if test "$LN_S" = "ln -s"; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
 $as_echo "no, using $LN_S" >&6; }
 fi
 
 # find the maximum length of command line arguments
-{ $as_echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
 $as_echo_n "checking the maximum length of command line arguments... " >&6; }
-if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+if ${lt_cv_sys_max_cmd_len+:} false; then :
   $as_echo_n "(cached) " >&6
 else
     i=0
@@ -4514,6 +4690,11 @@ else
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -4539,6 +4720,11 @@ else
     lt_cv_sys_max_cmd_len=196608
     ;;
 
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
   osf*)
     # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
     # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
@@ -4578,8 +4764,8 @@ else
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
-	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
@@ -4599,10 +4785,10 @@ else
 fi
 
 if test -n $lt_cv_sys_max_cmd_len ; then
-  { $as_echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
 $as_echo "$lt_cv_sys_max_cmd_len" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: none" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
 $as_echo "none" >&6; }
 fi
 max_cmd_len=$lt_cv_sys_max_cmd_len
@@ -4616,27 +4802,27 @@ max_cmd_len=$lt_cv_sys_max_cmd_len
 : ${MV="mv -f"}
 : ${RM="rm -f"}
 
-{ $as_echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
 # Try some XSI features
 xsi_shell=no
 ( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,, \
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
     && eval 'test $(( 1 + 1 )) -eq 2 \
     && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
   && xsi_shell=yes
-{ $as_echo "$as_me:$LINENO: result: $xsi_shell" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
 $as_echo "$xsi_shell" >&6; }
 
 
-{ $as_echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
 lt_shell_append=no
 ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
     >/dev/null 2>&1 \
   && lt_shell_append=yes
-{ $as_echo "$as_me:$LINENO: result: $lt_shell_append" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
 $as_echo "$lt_shell_append" >&6; }
 
 
@@ -4671,14 +4857,88 @@ esac
 
 
 
-{ $as_echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+
+fi
+
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+
+fi
+
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
 $as_echo_n "checking for $LD option to reload object files... " >&6; }
-if test "${lt_cv_ld_reload_flag+set}" = set; then
+if ${lt_cv_ld_reload_flag+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_ld_reload_flag='-r'
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
 $as_echo "$lt_cv_ld_reload_flag" >&6; }
 reload_flag=$lt_cv_ld_reload_flag
 case $reload_flag in
@@ -4687,6 +4947,11 @@ case $reload_flag in
 esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
   darwin*)
     if test "$GCC" = yes; then
       reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
@@ -4707,9 +4972,9 @@ esac
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
 set dummy ${ac_tool_prefix}objdump; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJDUMP+set}" = set; then
+if ${ac_cv_prog_OBJDUMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OBJDUMP"; then
@@ -4720,24 +4985,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 OBJDUMP=$ac_cv_prog_OBJDUMP
 if test -n "$OBJDUMP"; then
-  { $as_echo "$as_me:$LINENO: result: $OBJDUMP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
 $as_echo "$OBJDUMP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4747,9 +5012,9 @@ if test -z "$ac_cv_prog_OBJDUMP"; then
   ac_ct_OBJDUMP=$OBJDUMP
   # Extract the first word of "objdump", so it can be a program name with args.
 set dummy objdump; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OBJDUMP"; then
@@ -4760,24 +5025,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_OBJDUMP="objdump"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
 if test -n "$ac_ct_OBJDUMP"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
 $as_echo "$ac_ct_OBJDUMP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4786,7 +5051,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -4806,9 +5071,9 @@ test -z "$OBJDUMP" && OBJDUMP=objdump
 
 
 
-{ $as_echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
 $as_echo_n "checking how to recognize dependent libraries... " >&6; }
-if test "${lt_cv_deplibs_check_method+set}" = set; then
+if ${lt_cv_deplibs_check_method+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_file_magic_cmd='$MAGIC_CMD'
@@ -4850,16 +5115,18 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
     lt_cv_file_magic_cmd='$OBJDUMP -f'
   fi
   ;;
 
-cegcc)
+cegcc*)
   # use the weaker test based on 'objdump'. See mingw*.
   lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
   lt_cv_file_magic_cmd='$OBJDUMP -f'
@@ -4889,6 +5156,10 @@ gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
 hpux10.20* | hpux11*)
   lt_cv_file_magic_cmd=/usr/bin/file
   case $host_cpu in
@@ -4897,11 +5168,11 @@ hpux10.20* | hpux11*)
     lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
     ;;
   hppa*64*)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
     lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
     ;;
   *)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
     lt_cv_file_magic_test_file=/usr/lib/libc.sl
     ;;
   esac
@@ -4922,8 +5193,8 @@ irix5* | irix6* | nonstopux*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -5002,8 +5273,23 @@ tpf*)
 esac
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
 $as_echo "$lt_cv_deplibs_check_method" >&6; }
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -5019,12 +5305,166 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
 
 
 
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+  ac_ct_DLLTOOL=$DLLTOOL
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DLLTOOL"; then
+  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_DLLTOOL" = x; then
+    DLLTOOL="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DLLTOOL=$ac_ct_DLLTOOL
+  fi
+else
+  DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+
+
+
+
+
+
 if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+  for ac_prog in ar
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AR+set}" = set; then
+if ${ac_cv_prog_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AR"; then
@@ -5035,36 +5475,40 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AR="${ac_tool_prefix}ar"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 AR=$ac_cv_prog_AR
 if test -n "$AR"; then
-  { $as_echo "$as_me:$LINENO: result: $AR" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
 $as_echo "$AR" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
+    test -n "$AR" && break
+  done
 fi
-if test -z "$ac_cv_prog_AR"; then
+if test -z "$AR"; then
   ac_ct_AR=$AR
-  # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+  for ac_prog in ar
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_AR"; then
@@ -5075,48 +5519,108 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_AR="ar"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_ac_ct_AR="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_AR=$ac_cv_prog_ac_ct_AR
 if test -n "$ac_ct_AR"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
 $as_echo "$ac_ct_AR" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
+
+  test -n "$ac_ct_AR" && break
+done
+
   if test "x$ac_ct_AR" = x; then
     AR="false"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     AR=$ac_ct_AR
   fi
-else
-  AR="$ac_cv_prog_AR"
 fi
 
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ar_at_file=no
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+      { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
 
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
 
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
 
 
 
@@ -5127,9 +5631,9 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
 set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then
+if ${ac_cv_prog_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
@@ -5140,24 +5644,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 STRIP=$ac_cv_prog_STRIP
 if test -n "$STRIP"; then
-  { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
 $as_echo "$STRIP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -5167,9 +5671,9 @@ if test -z "$ac_cv_prog_STRIP"; then
   ac_ct_STRIP=$STRIP
   # Extract the first word of "strip", so it can be a program name with args.
 set dummy strip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
@@ -5180,24 +5684,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_STRIP="strip"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
 if test -n "$ac_ct_STRIP"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
 $as_echo "$ac_ct_STRIP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -5206,7 +5710,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -5226,9 +5730,9 @@ test -z "$STRIP" && STRIP=:
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then
+if ${ac_cv_prog_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$RANLIB"; then
@@ -5239,24 +5743,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 RANLIB=$ac_cv_prog_RANLIB
 if test -n "$RANLIB"; then
-  { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
 $as_echo "$RANLIB" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -5266,9 +5770,9 @@ if test -z "$ac_cv_prog_RANLIB"; then
   ac_ct_RANLIB=$RANLIB
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_RANLIB"; then
@@ -5279,24 +5783,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
 if test -n "$ac_ct_RANLIB"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
 $as_echo "$ac_ct_RANLIB" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -5305,7 +5809,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -5330,15 +5834,27 @@ old_postuninstall_cmds=
 if test -n "$RANLIB"; then
   case $host_os in
   openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
     ;;
   *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
     ;;
   esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
 fi
 
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
 
 
 
@@ -5383,9 +5899,9 @@ compiler=$CC
 
 
 # Check for command to grab the raw symbol name followed by C symbol from nm.
-{ $as_echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
-if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -5446,8 +5962,8 @@ esac
 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -5471,6 +5987,7 @@ for ac_symprfx in "" "_"; do
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK '"\
 "     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
@@ -5483,6 +6000,7 @@ for ac_symprfx in "" "_"; do
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
   fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
 
   # Check to see that the pipe works correctly.
   pipe_works=no
@@ -5501,18 +6019,18 @@ void nm_test_func(void){}
 int main(){nm_test_var='a';nm_test_func();return(0);}
 _LT_EOF
 
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
-  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s "$nlist"; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s "$nlist"; then
       # Try sorting and uniquifying the output.
       if sort "$nlist" | uniq > "$nlist"T; then
 	mv -f "$nlist"T "$nlist"
@@ -5524,6 +6042,18 @@ _LT_EOF
       if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
 	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
 	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -5535,7 +6065,7 @@ _LT_EOF
 	  cat <<_LT_EOF >> conftest.$ac_ext
 
 /* The mapping between symbol names and symbols.  */
-const struct {
+LT_DLSYM_CONST struct {
   const char *name;
   void       *address;
 }
@@ -5561,19 +6091,19 @@ static const void *lt_preloaded_setup() {
 _LT_EOF
 	  # Now try linking the two files.
 	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_save_LIBS="$LIBS"
-	  lt_save_CFLAGS="$CFLAGS"
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
 	  LIBS="conftstm.$ac_objext"
 	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
-	  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s conftest${ac_exeext}; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext}; then
 	    pipe_works=yes
 	  fi
-	  LIBS="$lt_save_LIBS"
-	  CFLAGS="$lt_save_CFLAGS"
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
 	else
 	  echo "cannot find nm_test_func in $nlist" >&5
 	fi
@@ -5603,13 +6133,28 @@ if test -z "$lt_cv_sys_global_symbol_pipe"; then
   lt_cv_sys_global_symbol_to_cdecl=
 fi
 if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
-  { $as_echo "$as_me:$LINENO: result: failed" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
 $as_echo "failed" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: ok" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
 $as_echo "ok" >&6; }
 fi
 
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
+
+
+
+
+
+
+
+
 
 
 
@@ -5628,12 +6173,45 @@ fi
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
+
+# Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+  withval=$with_sysroot;
+else
+  with_sysroot=no
+fi
+
+
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+   as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+   ;;
+esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
+
 
 
 
 
 # Check whether --enable-libtool-lock was given.
-if test "${enable_libtool_lock+set}" = set; then
+if test "${enable_libtool_lock+set}" = set; then :
   enableval=$enable_libtool_lock;
 fi
 
@@ -5645,11 +6223,11 @@ case $host in
 ia64-*-hpux*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
     case `/usr/bin/file conftest.$ac_objext` in
       *ELF-32*)
 	HPUX_IA64_MODE="32"
@@ -5663,12 +6241,12 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5666 "configure"' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
     if test "$lt_cv_prog_gnu_ld" = yes; then
       case `/usr/bin/file conftest.$ac_objext` in
 	*32-bit*)
@@ -5702,11 +6280,11 @@ x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
     case `/usr/bin/file conftest.o` in
       *32-bit*)
 	case $host in
@@ -5755,9 +6333,9 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
-  { $as_echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
 $as_echo_n "checking whether the C compiler needs -belf... " >&6; }
-if test "${lt_cv_cc_needs_belf+set}" = set; then
+if ${lt_cv_cc_needs_belf+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=c
@@ -5766,11 +6344,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-     cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -5781,38 +6355,13 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   lt_cv_cc_needs_belf=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	lt_cv_cc_needs_belf=no
+  lt_cv_cc_needs_belf=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
      ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -5820,25 +6369,38 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
 $as_echo "$lt_cv_cc_needs_belf" >&6; }
   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
     CFLAGS="$SAVE_CFLAGS"
   fi
   ;;
-sparc*-*solaris*)
+*-*solaris*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
     case `/usr/bin/file conftest.o` in
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
-      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      yes*)
+        case $host in
+        i?86-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD="${LD-ld}_sol2"
+        fi
+        ;;
       *)
 	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
 	  LD="${LD-ld} -64"
@@ -5854,15 +6416,132 @@ esac
 
 need_locks="$enable_libtool_lock"
 
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$MANIFEST_TOOL"; then
+  ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+  ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+  # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_MANIFEST_TOOL"; then
+  ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_MANIFEST_TOOL" = x; then
+    MANIFEST_TOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+  fi
+else
+  MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
+
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&5
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+
+
+
+
+
 
   case $host_os in
     rhapsody* | darwin*)
     if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
 set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DSYMUTIL+set}" = set; then
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$DSYMUTIL"; then
@@ -5873,24 +6552,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 DSYMUTIL=$ac_cv_prog_DSYMUTIL
 if test -n "$DSYMUTIL"; then
-  { $as_echo "$as_me:$LINENO: result: $DSYMUTIL" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
 $as_echo "$DSYMUTIL" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -5900,9 +6579,9 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then
   ac_ct_DSYMUTIL=$DSYMUTIL
   # Extract the first word of "dsymutil", so it can be a program name with args.
 set dummy dsymutil; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_DSYMUTIL"; then
@@ -5913,24 +6592,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
 if test -n "$ac_ct_DSYMUTIL"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
 $as_echo "$ac_ct_DSYMUTIL" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -5939,7 +6618,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -5952,9 +6631,9 @@ fi
     if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
 set dummy ${ac_tool_prefix}nmedit; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_NMEDIT+set}" = set; then
+if ${ac_cv_prog_NMEDIT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$NMEDIT"; then
@@ -5965,24 +6644,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 NMEDIT=$ac_cv_prog_NMEDIT
 if test -n "$NMEDIT"; then
-  { $as_echo "$as_me:$LINENO: result: $NMEDIT" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
 $as_echo "$NMEDIT" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -5992,9 +6671,9 @@ if test -z "$ac_cv_prog_NMEDIT"; then
   ac_ct_NMEDIT=$NMEDIT
   # Extract the first word of "nmedit", so it can be a program name with args.
 set dummy nmedit; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_NMEDIT"; then
@@ -6005,24 +6684,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_NMEDIT="nmedit"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
 if test -n "$ac_ct_NMEDIT"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
 $as_echo "$ac_ct_NMEDIT" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6031,7 +6710,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -6044,9 +6723,9 @@ fi
     if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
 set dummy ${ac_tool_prefix}lipo; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_LIPO+set}" = set; then
+if ${ac_cv_prog_LIPO+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$LIPO"; then
@@ -6057,24 +6736,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 LIPO=$ac_cv_prog_LIPO
 if test -n "$LIPO"; then
-  { $as_echo "$as_me:$LINENO: result: $LIPO" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
 $as_echo "$LIPO" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6084,9 +6763,9 @@ if test -z "$ac_cv_prog_LIPO"; then
   ac_ct_LIPO=$LIPO
   # Extract the first word of "lipo", so it can be a program name with args.
 set dummy lipo; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_LIPO"; then
@@ -6097,24 +6776,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_LIPO="lipo"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
 if test -n "$ac_ct_LIPO"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_LIPO" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
 $as_echo "$ac_ct_LIPO" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6123,7 +6802,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -6136,9 +6815,9 @@ fi
     if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
 set dummy ${ac_tool_prefix}otool; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL+set}" = set; then
+if ${ac_cv_prog_OTOOL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OTOOL"; then
@@ -6149,24 +6828,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 OTOOL=$ac_cv_prog_OTOOL
 if test -n "$OTOOL"; then
-  { $as_echo "$as_me:$LINENO: result: $OTOOL" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
 $as_echo "$OTOOL" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6176,9 +6855,9 @@ if test -z "$ac_cv_prog_OTOOL"; then
   ac_ct_OTOOL=$OTOOL
   # Extract the first word of "otool", so it can be a program name with args.
 set dummy otool; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OTOOL"; then
@@ -6189,24 +6868,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_OTOOL="otool"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
 if test -n "$ac_ct_OTOOL"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
 $as_echo "$ac_ct_OTOOL" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6215,7 +6894,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -6228,9 +6907,9 @@ fi
     if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
 set dummy ${ac_tool_prefix}otool64; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL64+set}" = set; then
+if ${ac_cv_prog_OTOOL64+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OTOOL64"; then
@@ -6241,24 +6920,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 OTOOL64=$ac_cv_prog_OTOOL64
 if test -n "$OTOOL64"; then
-  { $as_echo "$as_me:$LINENO: result: $OTOOL64" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
 $as_echo "$OTOOL64" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6268,9 +6947,9 @@ if test -z "$ac_cv_prog_OTOOL64"; then
   ac_ct_OTOOL64=$OTOOL64
   # Extract the first word of "otool64", so it can be a program name with args.
 set dummy otool64; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OTOOL64"; then
@@ -6281,24 +6960,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_OTOOL64="otool64"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
 if test -n "$ac_ct_OTOOL64"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL64" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
 $as_echo "$ac_ct_OTOOL64" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6307,7 +6986,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -6343,9 +7022,9 @@ fi
 
 
 
-    { $as_echo "$as_me:$LINENO: checking for -single_module linker flag" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
 $as_echo_n "checking for -single_module linker flag... " >&6; }
-if test "${lt_cv_apple_cc_single_mod+set}" = set; then
+if ${lt_cv_apple_cc_single_mod+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_apple_cc_single_mod=no
@@ -6361,7 +7040,13 @@ else
 	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
 	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
         _lt_result=$?
-	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	# If there is a non-empty error log, and "single_module"
+	# appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+	  cat conftest.err >&5
+	# Otherwise, if the output was created with a 0 exit code from
+	# the compiler, it worked.
+	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
 	  lt_cv_apple_cc_single_mod=yes
 	else
 	  cat conftest.err >&5
@@ -6370,22 +7055,19 @@ else
 	rm -f conftest.*
       fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
 $as_echo "$lt_cv_apple_cc_single_mod" >&6; }
-    { $as_echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
-if test "${lt_cv_ld_exported_symbols_list+set}" = set; then
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_ld_exported_symbols_list=no
       save_LDFLAGS=$LDFLAGS
       echo "_main" > conftest.sym
       LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -6396,43 +7078,53 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   lt_cv_ld_exported_symbols_list=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	lt_cv_ld_exported_symbols_list=no
+  lt_cv_ld_exported_symbols_list=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 	LDFLAGS="$save_LDFLAGS"
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+      echo "$AR cru libconftest.a conftest.o" >&5
+      $AR cru libconftest.a conftest.o 2>&5
+      echo "$RANLIB libconftest.a" >&5
+      $RANLIB libconftest.a 2>&5
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -s conftest.err && $GREP force_load conftest.err; then
+	cat conftest.err >&5
+      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&5
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
     case $host_os in
     rhapsody* | darwin1.[012])
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
@@ -6460,7 +7152,7 @@ $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
     else
       _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
     fi
-    if test "$DSYMUTIL" != ":"; then
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -6473,14 +7165,14 @@ ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
 $as_echo_n "checking how to run the C preprocessor... " >&6; }
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then
+  if ${ac_cv_prog_CPP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -6495,11 +7187,7 @@ do
   # <limits.h> exists even on freestanding compilers.
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #ifdef __STDC__
 # include <limits.h>
@@ -6508,78 +7196,34 @@ cat >>conftest.$ac_ext <<_ACEOF
 #endif
 		     Syntax error
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_cpp "$LINENO"; then :
 
+else
   # Broken: fails on valid input.
 continue
 fi
-
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+if ac_fn_c_try_cpp "$LINENO"; then :
   # Broken: success on invalid input.
 continue
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
   # Passes both tests.
 ac_preproc_ok=:
 break
 fi
-
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
   break
 fi
 
@@ -6591,7 +7235,7 @@ fi
 else
   ac_cv_prog_CPP=$CPP
 fi
-{ $as_echo "$as_me:$LINENO: result: $CPP" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
 $as_echo "$CPP" >&6; }
 ac_preproc_ok=false
 for ac_c_preproc_warn_flag in '' yes
@@ -6602,11 +7246,7 @@ do
   # <limits.h> exists even on freestanding compilers.
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #ifdef __STDC__
 # include <limits.h>
@@ -6615,87 +7255,40 @@ cat >>conftest.$ac_ext <<_ACEOF
 #endif
 		     Syntax error
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_cpp "$LINENO"; then :
 
+else
   # Broken: fails on valid input.
 continue
 fi
-
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+if ac_fn_c_try_cpp "$LINENO"; then :
   # Broken: success on invalid input.
 continue
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
   # Passes both tests.
 ac_preproc_ok=:
 break
 fi
-
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  :
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
 else
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 
 ac_ext=c
@@ -6705,16 +7298,12 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
+if ${ac_cv_header_stdc+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
 #include <stdarg.h>
@@ -6729,48 +7318,23 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_header_stdc=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_header_stdc=no
+  ac_cv_header_stdc=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <string.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then
-  :
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
 else
   ac_cv_header_stdc=no
 fi
@@ -6780,18 +7344,14 @@ fi
 
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then
-  :
+  $EGREP "free" >/dev/null 2>&1; then :
+
 else
   ac_cv_header_stdc=no
 fi
@@ -6801,14 +7361,10 @@ fi
 
 if test $ac_cv_header_stdc = yes; then
   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   :
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ctype.h>
 #include <stdlib.h>
@@ -6835,118 +7391,33 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_run "$LINENO"; then :
 
-( exit $ac_status )
-ac_cv_header_stdc=no
+else
+  ac_cv_header_stdc=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
 $as_echo "$ac_cv_header_stdc" >&6; }
 if test $ac_cv_header_stdc = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
 
 # On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
 for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
 		  inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -6956,62 +7427,13 @@ fi
 done
 
 
-
 for ac_header in dlfcn.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+do :
+  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_DLFCN_H 1
 _ACEOF
 
 fi
@@ -7020,6 +7442,8 @@ done
 
 
 
+
+
 # Set options
 
 
@@ -7031,7 +7455,7 @@ done
 
 
             # Check whether --enable-shared was given.
-if test "${enable_shared+set}" = set; then
+if test "${enable_shared+set}" = set; then :
   enableval=$enable_shared; p=${PACKAGE-default}
     case $enableval in
     yes) enable_shared=yes ;;
@@ -7062,7 +7486,7 @@ fi
 
 
   # Check whether --enable-static was given.
-if test "${enable_static+set}" = set; then
+if test "${enable_static+set}" = set; then :
   enableval=$enable_static; p=${PACKAGE-default}
     case $enableval in
     yes) enable_static=yes ;;
@@ -7094,8 +7518,23 @@ fi
 
 
 # Check whether --with-pic was given.
-if test "${with_pic+set}" = set; then
-  withval=$with_pic; pic_mode="$withval"
+if test "${with_pic+set}" = set; then :
+  withval=$with_pic; lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+	IFS="$lt_save_ifs"
+	if test "X$lt_pkg" = "X$lt_p"; then
+	  pic_mode=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
 else
   pic_mode=default
 fi
@@ -7110,7 +7549,7 @@ test -z "$pic_mode" && pic_mode=default
 
 
   # Check whether --enable-fast-install was given.
-if test "${enable_fast_install+set}" = set; then
+if test "${enable_fast_install+set}" = set; then :
   enableval=$enable_fast_install; p=${PACKAGE-default}
     case $enableval in
     yes) enable_fast_install=yes ;;
@@ -7172,6 +7611,11 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
 
 
+
+
+
+
+
 test -z "$LN_S" && LN_S="ln -s"
 
 
@@ -7191,9 +7635,9 @@ if test -n "${ZSH_VERSION+set}" ; then
    setopt NO_GLOB_SUBST
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for objdir" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
 $as_echo_n "checking for objdir... " >&6; }
-if test "${lt_cv_objdir+set}" = set; then
+if ${lt_cv_objdir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   rm -f .libs 2>/dev/null
@@ -7206,7 +7650,7 @@ else
 fi
 rmdir .libs 2>/dev/null
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
 $as_echo "$lt_cv_objdir" >&6; }
 objdir=$lt_cv_objdir
 
@@ -7221,19 +7665,6 @@ _ACEOF
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
 case $host_os in
 aix3*)
   # AIX sometimes has problems with the GCC collect2 program.  For some
@@ -7246,23 +7677,6 @@ aix3*)
   ;;
 esac
 
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
 # Global variables:
 ofile=libtool
 can_build_shared=yes
@@ -7291,7 +7705,7 @@ for cc_temp in $compiler""; do
     *) break;;
   esac
 done
-cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
 
 
 # Only perform the check for file, if the check method requires it
@@ -7299,9 +7713,9 @@ test -z "$MAGIC_CMD" && MAGIC_CMD=file
 case $deplibs_check_method in
 file_magic*)
   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
-    { $as_echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
@@ -7352,10 +7766,10 @@ fi
 
 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
 if test -n "$MAGIC_CMD"; then
-  { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
 $as_echo "$MAGIC_CMD" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -7365,9 +7779,9 @@ fi
 
 if test -z "$lt_cv_path_MAGIC_CMD"; then
   if test -n "$ac_tool_prefix"; then
-    { $as_echo "$as_me:$LINENO: checking for file" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
 $as_echo_n "checking for file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
@@ -7418,10 +7832,10 @@ fi
 
 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
 if test -n "$MAGIC_CMD"; then
-  { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
 $as_echo "$MAGIC_CMD" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -7491,20 +7905,21 @@ _lt_linker_boilerplate=`cat conftest.err`
 $RM -r conftest*
 
 
-## CAVEAT EMPTOR:
-## There is no encapsulation within the following macros, do not change
-## the running order or otherwise move them around unless you know exactly
-## what you are doing...
 if test -n "$compiler"; then
 
 lt_prog_compiler_no_builtin_flag=
 
 if test "$GCC" = yes; then
-  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+  case $cc_basename in
+  nvcc*)
+    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+  *)
+    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+  esac
 
-  { $as_echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
-if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_rtti_exceptions=no
@@ -7520,15 +7935,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7523: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7527: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_rtti_exceptions=yes
@@ -7537,7 +7952,7 @@ else
    $RM conftest*
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
 
 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
@@ -7557,8 +7972,6 @@ fi
 lt_prog_compiler_pic=
 lt_prog_compiler_static=
 
-{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
   if test "$GCC" = yes; then
     lt_prog_compiler_wl='-Wl,'
@@ -7606,6 +8019,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-fno-common'
       ;;
 
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static=
+      ;;
+
     hpux*)
       # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
       # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
@@ -7648,6 +8067,15 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-fPIC'
       ;;
     esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      lt_prog_compiler_wl='-Xlinker '
+      if test -n "$lt_prog_compiler_pic"; then
+        lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
+      fi
+      ;;
+    esac
   else
     # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
@@ -7689,7 +8117,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_static='-non_shared'
       ;;
 
-    linux* | k*bsd*-gnu)
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
       case $cc_basename in
       # old Intel for x86_64 which still supported -KPIC.
       ecc*)
@@ -7710,7 +8138,13 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 	lt_prog_compiler_pic='--shared'
 	lt_prog_compiler_static='--static'
 	;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
+      nagfor*)
+	# NAG Fortran compiler
+	lt_prog_compiler_wl='-Wl,-Wl,,'
+	lt_prog_compiler_pic='-PIC'
+	lt_prog_compiler_static='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
 	# which looks to be a dead project)
 	lt_prog_compiler_wl='-Wl,'
@@ -7722,25 +8156,40 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
         # All Alpha code is PIC.
         lt_prog_compiler_static='-non_shared'
         ;;
-      xl*)
-	# IBM XL C 8.0/Fortran 10.1 on PPC
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
 	lt_prog_compiler_wl='-Wl,'
 	lt_prog_compiler_pic='-qpic'
 	lt_prog_compiler_static='-qstaticlink'
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl=''
+	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Qoption ld '
+	  ;;
 	*Sun\ C*)
 	  # Sun C 5.9
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
 	  lt_prog_compiler_wl='-Wl,'
 	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  lt_prog_compiler_pic='-KPIC'
+        *Intel*\ [CF]*Compiler*)
+	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_pic='-fPIC'
+	  lt_prog_compiler_static='-static'
+	  ;;
+	*Portland\ Group*)
+	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_pic='-fpic'
 	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl=''
 	  ;;
 	esac
 	;;
@@ -7772,7 +8221,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-KPIC'
       lt_prog_compiler_static='-Bstatic'
       case $cc_basename in
-      f77* | f90* | f95*)
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
 	lt_prog_compiler_wl='-Qoption ld ';;
       *)
 	lt_prog_compiler_wl='-Wl,';;
@@ -7829,21 +8278,25 @@ case $host_os in
     lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
     ;;
 esac
-{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
-$as_echo "$lt_prog_compiler_pic" >&6; }
-
-
-
-
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
 
 #
 # Check to make sure the PIC flag actually works.
 #
 if test -n "$lt_prog_compiler_pic"; then
-  { $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
-if test "${lt_cv_prog_compiler_pic_works+set}" = set; then
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_pic_works=no
@@ -7859,15 +8312,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7862: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7866: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_pic_works=yes
@@ -7876,7 +8329,7 @@ else
    $RM conftest*
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
 
 if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
@@ -7896,13 +8349,18 @@ fi
 
 
 
+
+
+
+
+
 #
 # Check to make sure the static flag actually works.
 #
 wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
-{ $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
-if test "${lt_cv_prog_compiler_static_works+set}" = set; then
+if ${lt_cv_prog_compiler_static_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_static_works=no
@@ -7915,7 +8373,7 @@ else
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&5
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          lt_cv_prog_compiler_static_works=yes
@@ -7928,7 +8386,7 @@ else
    LDFLAGS="$save_LDFLAGS"
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
 $as_echo "$lt_cv_prog_compiler_static_works" >&6; }
 
 if test x"$lt_cv_prog_compiler_static_works" = xyes; then
@@ -7943,9 +8401,9 @@ fi
 
 
 
-  { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+if ${lt_cv_prog_compiler_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o=no
@@ -7964,16 +8422,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7967: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7971: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -7990,7 +8448,7 @@ else
    $RM conftest*
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
 $as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
 
@@ -7998,9 +8456,9 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
 
 
-  { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+if ${lt_cv_prog_compiler_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o=no
@@ -8019,16 +8477,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8022: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8026: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -8045,7 +8503,7 @@ else
    $RM conftest*
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
 $as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
 
@@ -8054,7 +8512,7 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 hard_links="nottested"
 if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
   # do not overwrite the value of need_locks provided by the user
-  { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
 $as_echo_n "checking if we can lock with hard links... " >&6; }
   hard_links=yes
   $RM conftest*
@@ -8062,10 +8520,10 @@ $as_echo_n "checking if we can lock with hard links... " >&6; }
   touch conftest.a
   ln conftest.a conftest.b 2>&5 || hard_links=no
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { $as_echo "$as_me:$LINENO: result: $hard_links" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
 $as_echo "$hard_links" >&6; }
   if test "$hard_links" = no; then
-    { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
     need_locks=warn
   fi
@@ -8078,7 +8536,7 @@ fi
 
 
 
-  { $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
 
   runpath_var=
@@ -8094,7 +8552,6 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   hardcode_direct=no
   hardcode_direct_absolute=no
   hardcode_libdir_flag_spec=
-  hardcode_libdir_flag_spec_ld=
   hardcode_libdir_separator=
   hardcode_minus_L=no
   hardcode_shlibpath_var=unsupported
@@ -8141,7 +8598,33 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   esac
 
   ld_shlibs=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
   if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+	  *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
@@ -8159,6 +8642,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     fi
     supports_anon_versioning=no
     case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
       *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
       *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
       *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
@@ -8174,11 +8658,12 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
 	ld_shlibs=no
 	cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** Warning: the GNU linker, at least up to release 2.19, is reported
 *** to be unable to reliably create shared libraries on AIX.
 *** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
 
 _LT_EOF
       fi
@@ -8214,10 +8699,12 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
       # as there is no search path for DLLs.
       hardcode_libdir_flag_spec='-L$libdir'
+      export_dynamic_flag_spec='${wl}--export-all-symbols'
       allow_undefined_flag=unsupported
       always_export_symbols=no
       enable_shared_with_static_runtimes=yes
-      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
         archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -8235,6 +8722,11 @@ _LT_EOF
       fi
       ;;
 
+    haiku*)
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      link_all_deplibs=yes
+      ;;
+
     interix[3-9]*)
       hardcode_direct=no
       hardcode_shlibpath_var=no
@@ -8250,7 +8742,7 @@ _LT_EOF
       archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
-    gnu* | linux* | tpf* | k*bsd*-gnu)
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
       tmp_diet=no
       if test "$host_os" = linux-dietlibc; then
 	case $cc_basename in
@@ -8260,15 +8752,16 @@ _LT_EOF
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
 	 && test "$tmp_diet" = no
       then
-	tmp_addflag=
+	tmp_addflag=' $pic_flag'
 	tmp_sharedflag='-shared'
 	case $cc_basename,$host_cpu in
         pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag'
 	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
 	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
@@ -8279,13 +8772,17 @@ _LT_EOF
 	lf95*)				# Lahey Fortran 8.1
 	  whole_archive_flag_spec=
 	  tmp_sharedflag='--shared' ;;
-	xl[cC]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
+	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
 	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
+	  ;;
 	esac
 	case `$CC -V 2>&1 | sed 5q` in
 	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  compiler_needs_object=yes
 	  tmp_sharedflag='-G' ;;
 	*Sun\ F*)			# Sun Fortran 8.3
@@ -8301,17 +8798,16 @@ _LT_EOF
         fi
 
 	case $cc_basename in
-	xlf*)
+	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
-	  hardcode_libdir_flag_spec=
-	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
-	  archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
 	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
 	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
@@ -8325,8 +8821,8 @@ _LT_EOF
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
       else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -8344,8 +8840,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -8391,8 +8887,8 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -8432,8 +8928,10 @@ _LT_EOF
       else
 	# If we're using GNU nm, then we don't want the "-C" option.
 	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
 	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	else
 	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	fi
@@ -8520,11 +9018,13 @@ _LT_EOF
 	allow_undefined_flag='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+        if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -8535,54 +9035,34 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
 
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
 fi
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
 
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+  aix_libpath=$lt_cv_aix_libpath_
+fi
 
         hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
       else
 	if test "$host_cpu" = ia64; then
 	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
@@ -8591,11 +9071,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 	else
 	 # Determine the default libpath from the value encoded in an
 	 # empty executable.
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+	 if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -8603,62 +9085,47 @@ main ()
 {
 
   ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
 
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
 
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+  aix_libpath=$lt_cv_aix_libpath_
+fi
 
 	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
 	  # Warning - without using the other run time loading flags,
 	  # -berok will link without error, but may produce a broken library.
 	  no_undefined_flag=' ${wl}-bernotok'
 	  allow_undefined_flag=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  whole_archive_flag_spec='$convenience'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    whole_archive_flag_spec='$convenience'
+	  fi
 	  archive_cmds_need_lc=yes
 	  # This is similar to how AIX traditionally builds its shared libraries.
 	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
@@ -8690,20 +9157,64 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
-      hardcode_libdir_flag_spec=' '
-      allow_undefined_flag=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      old_archive_from_new_cmds='true'
-      # FIXME: Should let the user specify the lib program.
-      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      fix_srcfile_path='`cygpath -w "$srcfile"`'
-      enable_shared_with_static_runtimes=yes
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	always_export_symbols=yes
+	file_list_spec='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+	enable_shared_with_static_runtimes=yes
+	exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+	export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	old_postinstall_cmds='chmod 644 $oldlib'
+	postlink_cmds='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	old_archive_from_new_cmds='true'
+	# FIXME: Should let the user specify the lib program.
+	old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	enable_shared_with_static_runtimes=yes
+	;;
+      esac
       ;;
 
     darwin* | rhapsody*)
@@ -8713,7 +9224,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
   hardcode_direct=no
   hardcode_automatic=yes
   hardcode_shlibpath_var=unsupported
-  whole_archive_flag_spec=''
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
+  else
+    whole_archive_flag_spec=''
+  fi
   link_all_deplibs=yes
   allow_undefined_flag="$_lt_dar_allow_undefined"
   case $cc_basename in
@@ -8721,7 +9237,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=echo
+    output_verbose_link_cmd=func_echo_all
     archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
@@ -8739,10 +9255,6 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       hardcode_shlibpath_var=no
       ;;
 
-    freebsd1*)
-      ld_shlibs=no
-      ;;
-
     # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
     # support.  Future versions do this automatically, but an explicit c++rt0.o
     # does not break anything, and helps significantly (at the cost of a little
@@ -8755,7 +9267,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
+    freebsd2.*)
       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       hardcode_direct=yes
       hardcode_minus_L=yes
@@ -8764,7 +9276,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
     freebsd* | dragonfly*)
-      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
       hardcode_shlibpath_var=no
@@ -8772,7 +9284,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     hpux9*)
       if test "$GCC" = yes; then
-	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       else
 	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       fi
@@ -8787,14 +9299,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       ;;
 
     hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
 	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
       if test "$with_gnu_ld" = no; then
 	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-	hardcode_libdir_flag_spec_ld='+b $libdir'
 	hardcode_libdir_separator=:
 	hardcode_direct=yes
 	hardcode_direct_absolute=yes
@@ -8806,16 +9317,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       ;;
 
     hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
 	case $host_cpu in
 	hppa*64*)
 	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       else
@@ -8827,7 +9338,46 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler__b=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS -b"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler__b=yes
+       fi
+     else
+       lt_cv_prog_compiler__b=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+    archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
 	  ;;
 	esac
       fi
@@ -8855,52 +9405,39 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     irix5* | irix6* | nonstopux*)
       if test "$GCC" = yes; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	# Try to use the -exported_symbol ld option, if it does not
 	# work, assume that -exports_file does not work either and
 	# implicitly export all symbols.
-        save_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-        cat >conftest.$ac_ext <<_ACEOF
-int foo(void) {}
+	# This should be the same for all languages, so no per-tag cache variable.
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int foo (void) { return 0; }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_irix_exported_symbol=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
+  lt_cv_irix_exported_symbol=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-        LDFLAGS="$save_LDFLAGS"
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+           LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
       else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -8962,17 +9499,17 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       hardcode_libdir_flag_spec='-L$libdir'
       hardcode_minus_L=yes
       allow_undefined_flag=unsupported
-      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
       old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
       ;;
 
     osf3*)
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -8982,13 +9519,13 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
     osf4* | osf5*)	# as osf3* with the addition of -msym flag
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
 	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	hardcode_libdir_flag_spec='-rpath $libdir'
@@ -9001,9 +9538,9 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       no_undefined_flag=' -z defs'
       if test "$GCC" = yes; then
 	wlarc='${wl}'
-	archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
@@ -9152,7 +9689,7 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
     fi
   fi
 
-{ $as_echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
 $as_echo "$ld_shlibs" >&6; }
 test "$ld_shlibs" = no && can_build_shared=no
 
@@ -9189,46 +9726,52 @@ x|xyes)
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-      $RM conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$lt_prog_compiler_wl
-	pic_flag=$lt_prog_compiler_pic
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$allow_undefined_flag
-        allow_undefined_flag=
-        if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$lt_prog_compiler_wl
+	  pic_flag=$lt_prog_compiler_pic
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$allow_undefined_flag
+	  allow_undefined_flag=
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
   (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-        then
-	  archive_cmds_need_lc=no
-        else
-	  archive_cmds_need_lc=yes
-        fi
-        allow_undefined_flag=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $RM conftest*
-      { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
-$as_echo "$archive_cmds_need_lc" >&6; }
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	  then
+	    lt_cv_archive_cmds_need_lc=no
+	  else
+	    lt_cv_archive_cmds_need_lc=yes
+	  fi
+	  allow_undefined_flag=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
       ;;
     esac
   fi
@@ -9386,12 +9929,7 @@ esac
 
 
 
-
-
-
-
-
-  { $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
 $as_echo_n "checking dynamic linker characteristics... " >&6; }
 
 if test "$GCC" = yes; then
@@ -9399,16 +9937,23 @@ if test "$GCC" = yes; then
     darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
     *) lt_awk_arg="/^libraries:/" ;;
   esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
   # Ok, now we have the path, separated by spaces, we can step through it
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
@@ -9421,7 +9966,7 @@ if test "$GCC" = yes; then
 	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
-  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
 BEGIN {RS=" "; FS="/|\n";} {
   lt_foo="";
   lt_count=0;
@@ -9441,7 +9986,13 @@ BEGIN {RS=" "; FS="/|\n";} {
   if (lt_foo != "") { lt_freq[lt_foo]++; }
   if (lt_freq[lt_foo] == 1) { print lt_foo; }
 }'`
-  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 fi
@@ -9467,7 +10018,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -9476,7 +10027,7 @@ aix3*)
   ;;
 
 aix[4-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -9529,7 +10080,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
@@ -9541,7 +10092,7 @@ beos*)
   ;;
 
 bsdi[45]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -9560,8 +10111,9 @@ cygwin* | mingw* | pw32* | cegcc*)
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -9582,36 +10134,83 @@ cygwin* | mingw* | pw32* | cegcc*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
       library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
     ;;
 
   *)
+    # Assume MSVC wrapper
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
     ;;
   esac
-  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -9632,7 +10231,7 @@ darwin* | rhapsody*)
   ;;
 
 dgux*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -9640,10 +10239,6 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -9651,18 +10246,11 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[123]*) objformat=aout ;;
+    freebsd[23].*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
-  # Handle Gentoo/FreeBSD as it was Linux
-  case $host_vendor in
-    gentoo)
-      version_type=linux ;;
-    *)
-      version_type=freebsd-$objformat ;;
-  esac
-
+  version_type=freebsd-$objformat
   case $version_type in
     freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
@@ -9673,16 +10261,10 @@ freebsd* | dragonfly*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
       need_version=yes
       ;;
-    linux)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-      soname_spec='${libname}${release}${shared_ext}$major'
-      need_lib_prefix=no
-      need_version=no
-      ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2*)
+  freebsd2.*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[01]* | freebsdelf3.[01]*)
@@ -9702,12 +10284,26 @@ freebsd* | dragonfly*)
   ;;
 
 gnu*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -9753,12 +10349,14 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='${libname}${release}${shared_ext}$major'
     ;;
   esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
   postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
   ;;
 
 interix[3-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -9774,7 +10372,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
+		version_type=linux # correct to gnu/linux during the next big refactor
 	else
 		version_type=irix
 	fi ;;
@@ -9811,9 +10409,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
-  version_type=linux
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -9821,16 +10419,17 @@ linux* | k*bsd*-gnu)
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
+
   # Some binutils ld are patched to set DT_RUNPATH
-  save_LDFLAGS=$LDFLAGS
-  save_libdir=$libdir
-  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
-       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -9841,53 +10440,33 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then
-  shlibpath_overrides_runpath=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  lt_cv_shlibpath_overrides_runpath=yes
 fi
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
 
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-  LDFLAGS=$save_LDFLAGS
-  libdir=$save_libdir
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
 
   # This implies no fast_install, which is unacceptable.
   # Some rework will be needed to allow for fast_install
   # before this can be enabled.
   hardcode_into_libs=yes
 
+  # Add ABI-specific directories to the system library path.
+  sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
+
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+
   fi
 
   # We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -9918,7 +10497,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -9987,7 +10566,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -10012,7 +10591,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -10036,7 +10615,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux
+    version_type=linux # correct to gnu/linux during the next big refactor
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -10067,7 +10646,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -10077,7 +10656,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -10087,7 +10666,7 @@ uts4*)
   dynamic_linker=no
   ;;
 esac
-{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
 $as_echo "$dynamic_linker" >&6; }
 test "$dynamic_linker" = no && can_build_shared=no
 
@@ -10189,7 +10768,12 @@ fi
 
 
 
-  { $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
 $as_echo_n "checking how to hardcode library paths into programs... " >&6; }
 hardcode_action=
 if test -n "$hardcode_libdir_flag_spec" ||
@@ -10214,7 +10798,7 @@ else
   # directories.
   hardcode_action=unsupported
 fi
-{ $as_echo "$as_me:$LINENO: result: $hardcode_action" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
 $as_echo "$hardcode_action" >&6; }
 
 if test "$hardcode_action" = relink ||
@@ -10257,113 +10841,17 @@ else
     lt_cv_dlopen_libs=
     ;;
 
-  darwin*)
-  # if libdl is installed we need to link against it
-    { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_dl_dlopen=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_dl_dlopen=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
-else
-
-    lt_cv_dlopen="dyld"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
-
-fi
-
-    ;;
-
-  *)
-    { $as_echo "$as_me:$LINENO: checking for shl_load" >&5
-$as_echo_n "checking for shl_load... " >&6; }
-if test "${ac_cv_func_shl_load+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define shl_load innocuous_shl_load
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char shl_load (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef shl_load
+  darwin*)
+  # if libdl is installed we need to link against it
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
@@ -10371,72 +10859,51 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char shl_load ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_shl_load || defined __stub___shl_load
-choke me
-#endif
-
+char dlopen ();
 int
 main ()
 {
-return shl_load ();
+return dlopen ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_shl_load=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_func_shl_load=no
+  ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
-$as_echo "$ac_cv_func_shl_load" >&6; }
-if test "x$ac_cv_func_shl_load" = x""yes; then
+
+    ;;
+
+  *)
+    ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = xyes; then :
   lt_cv_dlopen="shl_load"
 else
-  { $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
 $as_echo_n "checking for shl_load in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+if ${ac_cv_lib_dld_shl_load+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -10454,145 +10921,32 @@ return shl_load ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_dld_shl_load=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_dld_shl_load=no
+  ac_cv_lib_dld_shl_load=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
 $as_echo "$ac_cv_lib_dld_shl_load" >&6; }
-if test "x$ac_cv_lib_dld_shl_load" = x""yes; then
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
   lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
 else
-  { $as_echo "$as_me:$LINENO: checking for dlopen" >&5
-$as_echo_n "checking for dlopen... " >&6; }
-if test "${ac_cv_func_dlopen+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define dlopen innocuous_dlopen
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char dlopen (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef dlopen
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_dlopen || defined __stub___dlopen
-choke me
-#endif
-
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_dlopen=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_func_dlopen=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
-$as_echo "$ac_cv_func_dlopen" >&6; }
-if test "x$ac_cv_func_dlopen" = x""yes; then
+  ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen"
 else
-  { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+if ${ac_cv_lib_dl_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -10610,57 +10964,28 @@ return dlopen ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_dl_dlopen=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_dl_dlopen=no
+  ac_cv_lib_dl_dlopen=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
-  { $as_echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
 $as_echo_n "checking for dlopen in -lsvld... " >&6; }
-if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+if ${ac_cv_lib_svld_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsvld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -10678,57 +11003,28 @@ return dlopen ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_svld_dlopen=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_svld_dlopen=no
+  ac_cv_lib_svld_dlopen=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
 $as_echo "$ac_cv_lib_svld_dlopen" >&6; }
-if test "x$ac_cv_lib_svld_dlopen" = x""yes; then
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
 else
-  { $as_echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
 $as_echo_n "checking for dld_link in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+if ${ac_cv_lib_dld_dld_link+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -10746,43 +11042,18 @@ return dld_link ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_dld_dld_link=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_dld_dld_link=no
+  ac_cv_lib_dld_dld_link=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
 $as_echo "$ac_cv_lib_dld_dld_link" >&6; }
-if test "x$ac_cv_lib_dld_dld_link" = x""yes; then
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
   lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
 fi
 
@@ -10821,9 +11092,9 @@ fi
     save_LIBS="$LIBS"
     LIBS="$lt_cv_dlopen_libs $LIBS"
 
-    { $as_echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
 $as_echo_n "checking whether a program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self+set}" = set; then
+if ${lt_cv_dlopen_self+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   	  if test "$cross_compiling" = yes; then :
@@ -10832,7 +11103,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10835 "configure"
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10873,7 +11144,13 @@ else
 #  endif
 #endif
 
-void fnord() { int i=42;}
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -10882,7 +11159,11 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
       /* dlclose (self); */
     }
   else
@@ -10891,11 +11172,11 @@ int main ()
   return status;
 }
 _LT_EOF
-  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
     (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
     case x$lt_status in
@@ -10912,14 +11193,14 @@ rm -fr conftest*
 
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
 $as_echo "$lt_cv_dlopen_self" >&6; }
 
     if test "x$lt_cv_dlopen_self" = xyes; then
       wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
-      { $as_echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self_static+set}" = set; then
+if ${lt_cv_dlopen_self_static+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   	  if test "$cross_compiling" = yes; then :
@@ -10928,7 +11209,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10931 "configure"
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10969,7 +11250,13 @@ else
 #  endif
 #endif
 
-void fnord() { int i=42;}
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -10978,7 +11265,11 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
       /* dlclose (self); */
     }
   else
@@ -10987,11 +11278,11 @@ int main ()
   return status;
 }
 _LT_EOF
-  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
     (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
     case x$lt_status in
@@ -11008,7 +11299,7 @@ rm -fr conftest*
 
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
 $as_echo "$lt_cv_dlopen_self_static" >&6; }
     fi
 
@@ -11047,12 +11338,12 @@ fi
 
 striplib=
 old_striplib=
-{ $as_echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
 $as_echo_n "checking whether stripping libraries is possible... " >&6; }
 if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
   test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
   test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
 # FIXME - insert some real tests, host_os isn't really good enough
@@ -11061,15 +11352,15 @@ else
     if test -n "$STRIP" ; then
       striplib="$STRIP -x"
       old_striplib="$STRIP -S"
-      { $as_echo "$as_me:$LINENO: result: yes" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
     else
-      { $as_echo "$as_me:$LINENO: result: no" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
     fi
     ;;
   *)
-    { $as_echo "$as_me:$LINENO: result: no" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
     ;;
   esac
@@ -11087,12 +11378,12 @@ fi
 
 
   # Report which library types will actually be built
-  { $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
 $as_echo_n "checking if libtool supports shared libraries... " >&6; }
-  { $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
 $as_echo "$can_build_shared" >&6; }
 
-  { $as_echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
 $as_echo_n "checking whether to build shared libraries... " >&6; }
   test "$can_build_shared" = "no" && enable_shared=no
 
@@ -11113,14 +11404,14 @@ $as_echo_n "checking whether to build shared libraries... " >&6; }
     fi
     ;;
   esac
-  { $as_echo "$as_me:$LINENO: result: $enable_shared" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
 $as_echo "$enable_shared" >&6; }
 
-  { $as_echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
 $as_echo_n "checking whether to build static libraries... " >&6; }
   # Make sure either enable_shared or enable_static is yes.
   test "$enable_shared" = yes || enable_static=yes
-  { $as_echo "$as_me:$LINENO: result: $enable_static" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
 $as_echo "$enable_static" >&6; }
 
 
@@ -11133,137 +11424,47 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-CC="$lt_save_CC"
-
-
-
-
-
-
-
-
-
-
-
-
-
-        ac_config_commands="$ac_config_commands libtool"
-
-
-
-
-# Only expand once:
-
-
-# Find a good install program.  We prefer a C program (faster),
-# so one script is as good as another.  But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-# Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-$as_echo_n "checking for a BSD-compatible install... " >&6; }
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
-  ./ | .// | /cC/* | \
-  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
-  /usr/ucb/* ) ;;
-  *)
-    # OSF1 and SCO ODT 3.0 have their own names for install.
-    # Don't use installbsd from OSF since it installs stuff as root
-    # by default.
-    for ac_prog in ginstall scoinst install; do
-      for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
-	  if test $ac_prog = install &&
-	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-	    # AIX install.  It has an incompatible calling convention.
-	    :
-	  elif test $ac_prog = install &&
-	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-	    # program-specific install script used by HP pwplus--don't use.
-	    :
-	  else
-	    rm -rf conftest.one conftest.two conftest.dir
-	    echo one > conftest.one
-	    echo two > conftest.two
-	    mkdir conftest.dir
-	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
-	      test -s conftest.one && test -s conftest.two &&
-	      test -s conftest.dir/conftest.one &&
-	      test -s conftest.dir/conftest.two
-	    then
-	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-	      break 3
-	    fi
-	  fi
-	fi
-      done
-    done
-    ;;
-esac
-
-done
-IFS=$as_save_IFS
+CC="$lt_save_CC"
 
-rm -rf conftest.one conftest.two conftest.dir
 
-fi
-  if test "${ac_cv_path_install+set}" = set; then
-    INSTALL=$ac_cv_path_install
-  else
-    # As a last resort, use the slow shell script.  Don't cache a
-    # value for INSTALL within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the value is a relative name.
-    INSTALL=$ac_install_sh
-  fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
-$as_echo "$INSTALL" >&6; }
 
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
 
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
-{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5
+
+
+
+
+
+
+
+
+
+        ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
 $as_echo_n "checking whether ln -s works... " >&6; }
 LN_S=$as_ln_s
 if test "$LN_S" = "ln -s"; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
 $as_echo "no, using $LN_S" >&6; }
 fi
 
-{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
@@ -11271,7 +11472,7 @@ SHELL = /bin/sh
 all:
 	@echo '@@@%%%=$(MAKE)=@@@%%%'
 _ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
 case `${MAKE-make} -f conftest.make 2>/dev/null` in
   *@@@%%%=?*=@@@%%%*)
     eval ac_cv_prog_make_${ac_make}_set=yes;;
@@ -11281,11 +11482,11 @@ esac
 rm -f conftest.make
 fi
 if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
   SET_MAKE=
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
   SET_MAKE="MAKE=${MAKE-make}"
 fi
@@ -11294,9 +11495,9 @@ for ac_prog in 'bison -y' byacc
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_YACC+set}" = set; then
+if ${ac_cv_prog_YACC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$YACC"; then
@@ -11307,24 +11508,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_YACC="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 YACC=$ac_cv_prog_YACC
 if test -n "$YACC"; then
-  { $as_echo "$as_me:$LINENO: result: $YACC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5
 $as_echo "$YACC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -11337,9 +11538,9 @@ for ac_prog in flex lex
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_LEX+set}" = set; then
+if ${ac_cv_prog_LEX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$LEX"; then
@@ -11350,24 +11551,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_LEX="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 LEX=$ac_cv_prog_LEX
 if test -n "$LEX"; then
-  { $as_echo "$as_me:$LINENO: result: $LEX" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5
 $as_echo "$LEX" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -11396,20 +11597,20 @@ main (void)
   return ! yylex () + ! yywrap ();
 }
 _ACEOF
-{ (ac_try="$LEX conftest.l"
+{ { ac_try="$LEX conftest.l"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$LEX conftest.l") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ $as_echo "$as_me:$LINENO: checking lex output file root" >&5
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5
 $as_echo_n "checking lex output file root... " >&6; }
-if test "${ac_cv_prog_lex_root+set}" = set; then
+if ${ac_cv_prog_lex_root+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -11418,19 +11619,17 @@ if test -f lex.yy.c; then
 elif test -f lexyy.c; then
   ac_cv_prog_lex_root=lexyy
 else
-  { { $as_echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5
-$as_echo "$as_me: error: cannot find output from $LEX; giving up" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5
 fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5
 $as_echo "$ac_cv_prog_lex_root" >&6; }
 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
 
 if test -z "${LEXLIB+set}"; then
-  { $as_echo "$as_me:$LINENO: checking lex library" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5
 $as_echo_n "checking lex library... " >&6; }
-if test "${ac_cv_lib_lex+set}" = set; then
+if ${ac_cv_lib_lex+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -11438,55 +11637,29 @@ else
     ac_cv_lib_lex='none needed'
     for ac_lib in '' -lfl -ll; do
       LIBS="$ac_lib $ac_save_LIBS"
-      cat >conftest.$ac_ext <<_ACEOF
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 `cat $LEX_OUTPUT_ROOT.c`
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_lex=$ac_lib
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
       test "$ac_cv_lib_lex" != 'none needed' && break
     done
     LIBS=$ac_save_LIBS
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_lex" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5
 $as_echo "$ac_cv_lib_lex" >&6; }
   test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
 fi
 
 
-{ $as_echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5
 $as_echo_n "checking whether yytext is a pointer... " >&6; }
-if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then
+if ${ac_cv_prog_lex_yytext_pointer+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # POSIX says lex can declare yytext either as a pointer or an array; the
@@ -11495,52 +11668,25 @@ else
 ac_cv_prog_lex_yytext_pointer=no
 ac_save_LIBS=$LIBS
 LIBS="$LEXLIB $ac_save_LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#define YYTEXT_POINTER 1
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+  #define YYTEXT_POINTER 1
 `cat $LEX_OUTPUT_ROOT.c`
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_prog_lex_yytext_pointer=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_save_LIBS
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5
 $as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; }
 if test $ac_cv_prog_lex_yytext_pointer = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define YYTEXT_POINTER 1
-_ACEOF
+$as_echo "#define YYTEXT_POINTER 1" >>confdefs.h
 
 fi
 rm -f conftest.l $LEX_OUTPUT_ROOT.c
@@ -11551,9 +11697,9 @@ for ac_prog in $YACC
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog__YACC_+set}" = set; then
+if ${ac_cv_prog__YACC_+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$_YACC_"; then
@@ -11564,24 +11710,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog__YACC_="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 _YACC_=$ac_cv_prog__YACC_
 if test -n "$_YACC_"; then
-  { $as_echo "$as_me:$LINENO: result: $_YACC_" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_YACC_" >&5
 $as_echo "$_YACC_" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -11592,18 +11738,16 @@ test -n "$_YACC_" || _YACC_="none"
 
 if test "$_YACC_" = "none"
 then
-  { { $as_echo "$as_me:$LINENO: error: No bison/byacc/yacc found." >&5
-$as_echo "$as_me: error: No bison/byacc/yacc found." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "No bison/byacc/yacc found." "$LINENO" 5
 fi
 
 for ac_prog in $LEX
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog__LEX_+set}" = set; then
+if ${ac_cv_prog__LEX_+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$_LEX_"; then
@@ -11614,24 +11758,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog__LEX_="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 _LEX_=$ac_cv_prog__LEX_
 if test -n "$_LEX_"; then
-  { $as_echo "$as_me:$LINENO: result: $_LEX_" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_LEX_" >&5
 $as_echo "$_LEX_" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -11642,24 +11786,17 @@ test -n "$_LEX_" || _LEX_="none"
 
 if test "$_LEX_" = "none"
 then
-  { { $as_echo "$as_me:$LINENO: error: No flex/lex found." >&5
-$as_echo "$as_me: error: No flex/lex found." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "No flex/lex found." "$LINENO" 5
 fi
 
-
-{ $as_echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lpthread" >&5
 $as_echo_n "checking for pthread_mutex_init in -lpthread... " >&6; }
-if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then
+if ${ac_cv_lib_pthread_pthread_mutex_init+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpthread  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -11677,43 +11814,18 @@ return pthread_mutex_init ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_pthread_pthread_mutex_init=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_pthread_pthread_mutex_init=no
+  ac_cv_lib_pthread_pthread_mutex_init=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5
 $as_echo "$ac_cv_lib_pthread_pthread_mutex_init" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_mutex_init" = x""yes; then
+if test "x$ac_cv_lib_pthread_pthread_mutex_init" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBPTHREAD 1
 _ACEOF
@@ -11721,24 +11833,17 @@ _ACEOF
   LIBS="-lpthread $LIBS"
 
 else
-  { { $as_echo "$as_me:$LINENO: error: pthread_mutex_init() not found.  libosmcomp requires libpthread." >&5
-$as_echo "$as_me: error: pthread_mutex_init() not found.  libosmcomp requires libpthread." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "pthread_mutex_init() not found.  libosmcomp requires libpthread." "$LINENO" 5
 fi
 
-
-{ $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+if ${ac_cv_lib_dl_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -11756,43 +11861,18 @@ return dlopen ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_dl_dlopen=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_dl_dlopen=no
+  ac_cv_lib_dl_dlopen=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBDL 1
 _ACEOF
@@ -11800,22 +11880,16 @@ _ACEOF
   LIBS="-ldl $LIBS"
 
 else
-  { { $as_echo "$as_me:$LINENO: error: dlopen() not found. OpenSM requires libdl." >&5
-$as_echo "$as_me: error: dlopen() not found. OpenSM requires libdl." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "dlopen() not found. OpenSM requires libdl." "$LINENO" 5
 fi
 
 
-{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
 $as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if test "${ac_cv_c_const+set}" = set; then
+if ${ac_cv_c_const+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -11862,327 +11936,90 @@ main ()
   { /* AIX XL C 1.02.0.0 rejects this saying
        "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
     struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
-  }
-  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
-    const int foo = 10;
-    if (!foo) return 0;
-  }
-  return !cs[0] && !zero.x;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_c_const=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_c_const=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-$as_echo "$ac_cv_c_const" >&6; }
-if test $ac_cv_c_const = no; then
-
-cat >>confdefs.h <<\_ACEOF
-#define const /**/
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for inline" >&5
-$as_echo_n "checking for inline... " >&6; }
-if test "${ac_cv_c_inline+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_c_inline=no
-for ac_kw in inline __inline__ __inline; do
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifndef __cplusplus
-typedef int foo_t;
-static $ac_kw foo_t static_foo () {return 0; }
-$ac_kw foo_t foo () {return 0; }
-#endif
-
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_c_inline=$ac_kw
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  test "$ac_cv_c_inline" != no && break
-done
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
-$as_echo "$ac_cv_c_inline" >&6; }
-
-
-case $ac_cv_c_inline in
-  inline | yes) ;;
-  *)
-    case $ac_cv_c_inline in
-      no) ac_val=;;
-      *) ac_val=$ac_cv_c_inline;;
-    esac
-    cat >>confdefs.h <<_ACEOF
-#ifndef __cplusplus
-#define inline $ac_val
-#endif
-_ACEOF
-    ;;
-esac
-
-{ $as_echo "$as_me:$LINENO: checking for pid_t" >&5
-$as_echo_n "checking for pid_t... " >&6; }
-if test "${ac_cv_type_pid_t+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_type_pid_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (pid_t))
-       return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((pid_t)))
-	  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_type_pid_t=yes
-fi
+    struct s *b; b->j = 5;
+  }
+  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+    const int foo = 10;
+    if (!foo) return 0;
+  }
+  return !cs[0] && !zero.x;
+#endif
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_const=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
+  ac_cv_c_const=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
-$as_echo "$ac_cv_type_pid_t" >&6; }
-if test "x$ac_cv_type_pid_t" = x""yes; then
-  :
-else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
 
-cat >>confdefs.h <<_ACEOF
-#define pid_t int
-_ACEOF
+$as_echo "#define const /**/" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for size_t" >&5
-$as_echo_n "checking for size_t... " >&6; }
-if test "${ac_cv_type_size_t+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if ${ac_cv_c_inline+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_type_size_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (size_t))
-       return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((size_t)))
-	  return 0;
-  ;
-  return 0;
-}
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+  inline | yes) ;;
+  *)
+    case $ac_cv_c_inline in
+      no) ac_val=;;
+      *) ac_val=$ac_cv_c_inline;;
+    esac
+    cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+    ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_type_size_t=yes
-fi
+ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
+if test "x$ac_cv_type_pid_t" = xyes; then :
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
 
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-$as_echo "$ac_cv_type_size_t" >&6; }
-if test "x$ac_cv_type_size_t" = x""yes; then
-  :
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
 else
 
 cat >>confdefs.h <<_ACEOF
@@ -12191,16 +12028,12 @@ _ACEOF
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
-if test "${ac_cv_header_time+set}" = set; then
+if ${ac_cv_header_time+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <sys/types.h>
 #include <sys/time.h>
@@ -12215,54 +12048,27 @@ return 0;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_header_time=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_header_time=no
+  ac_cv_header_time=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
 $as_echo "$ac_cv_header_time" >&6; }
 if test $ac_cv_header_time = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define TIME_WITH_SYS_TIME 1
-_ACEOF
+$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
-if test "${ac_cv_struct_tm+set}" = set; then
+if ${ac_cv_struct_tm+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <sys/types.h>
 #include <time.h>
@@ -12277,54 +12083,27 @@ struct tm tm;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_struct_tm=time.h
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_struct_tm=sys/time.h
+  ac_cv_struct_tm=sys/time.h
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5
 $as_echo "$ac_cv_struct_tm" >&6; }
 if test $ac_cv_struct_tm = sys/time.h; then
 
-cat >>confdefs.h <<\_ACEOF
-#define TM_IN_SYS_TIME 1
-_ACEOF
+$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for working volatile" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5
 $as_echo_n "checking for working volatile... " >&6; }
-if test "${ac_cv_c_volatile+set}" = set; then
+if ${ac_cv_c_volatile+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -12338,48 +12117,25 @@ return !x && !y;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_c_volatile=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_c_volatile=no
+  ac_cv_c_volatile=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5
 $as_echo "$ac_cv_c_volatile" >&6; }
 if test $ac_cv_c_volatile = no; then
 
-cat >>confdefs.h <<\_ACEOF
-#define volatile /**/
-_ACEOF
+$as_echo "#define volatile /**/" >>confdefs.h
 
 fi
 
 
-{ $as_echo "$as_me:$LINENO: checking whether ld accepts --version-script" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ld accepts --version-script" >&5
 $as_echo_n "checking whether ld accepts --version-script... " >&6; }
-if test "${ac_cv_version_script+set}" = set; then
+if ${ac_cv_version_script+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then
@@ -12388,7 +12144,7 @@ else
 	ac_cv_version_script=no
 fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_version_script" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_version_script" >&5
 $as_echo "$ac_cv_version_script" >&6; }
  if test "$ac_cv_version_script" = "yes"; then
   HAVE_LD_VERSION_SCRIPT_TRUE=
@@ -12400,13 +12156,11 @@ fi
 
 
 # Check whether --enable-debug was given.
-if test "${enable_debug+set}" = set; then
+if test "${enable_debug+set}" = set; then :
   enableval=$enable_debug; case "${enableval}" in
 	yes) debug=true ;;
 	no)  debug=false ;;
-	*) { { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-debug" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-debug" >&2;}
-   { (exit 1); exit 1; }; } ;;
+	*) as_fn_error $? "bad value ${enableval} for --enable-debug" "$LINENO" 5 ;;
 esac
 else
   debug=false
@@ -12414,9 +12168,7 @@ fi
 
 if test x$debug = xtrue ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define OSM_DEBUG 1
-_ACEOF
+$as_echo "#define OSM_DEBUG 1" >>confdefs.h
 
 fi
  if test x$debug = xtrue; then
@@ -12429,7 +12181,7 @@ fi
 
 
 # Check whether --enable-libcheck was given.
-if test "${enable_libcheck+set}" = set; then
+if test "${enable_libcheck+set}" = set; then :
   enableval=$enable_libcheck; if test x$enableval = xno ; then
 	disable_libcheck=yes
 fi
@@ -12439,30 +12191,26 @@ fi
 
 # --- BEGIN OPENIB_OSM_CONSOLE_SOCKET_SEL ---
 
-# Check whether --enable-console-socket was given.
-if test "${enable_console_socket+set}" = set; then
-  enableval=$enable_console_socket; case $enableval in
-     yes) console_socket=yes ;;
-     no)  console_socket=no ;;
+# Check whether --enable-console-loopback was given.
+if test "${enable_console_loopback+set}" = set; then :
+  enableval=$enable_console_loopback; case $enableval in
+     yes) console_loopback=yes ;;
+     no)  console_loopback=no ;;
    esac
 else
-  console_socket=no
+  console_loopback=yes
 fi
 
-if test $console_socket = yes; then
 
-{ $as_echo "$as_me:$LINENO: checking for request_init in -lwrap" >&5
+if test $console_loopback = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for request_init in -lwrap" >&5
 $as_echo_n "checking for request_init in -lwrap... " >&6; }
-if test "${ac_cv_lib_wrap_request_init+set}" = set; then
+if ${ac_cv_lib_wrap_request_init+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lwrap  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -12480,43 +12228,18 @@ return request_init ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_wrap_request_init=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_wrap_request_init=no
+  ac_cv_lib_wrap_request_init=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_wrap_request_init" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_wrap_request_init" >&5
 $as_echo "$ac_cv_lib_wrap_request_init" >&6; }
-if test "x$ac_cv_lib_wrap_request_init" = x""yes; then
+if test "x$ac_cv_lib_wrap_request_init" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBWRAP 1
 _ACEOF
@@ -12524,17 +12247,37 @@ _ACEOF
   LIBS="-lwrap $LIBS"
 
 else
-  { { $as_echo "$as_me:$LINENO: error: request_init() not found. console-socket requires libwrap." >&5
-$as_echo "$as_me: error: request_init() not found. console-socket requires libwrap." >&2;}
-   { (exit 1); exit 1; }; }
+  console_loopback=no
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libwrap is missing. setting console_loopback=no" >&5
+$as_echo "$as_me: WARNING: libwrap is missing. setting console_loopback=no" >&2;}
 fi
 
+fi
+if test $console_loopback = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define ENABLE_OSM_CONSOLE_SOCKET 1
-_ACEOF
+$as_echo "#define ENABLE_OSM_CONSOLE_LOOPBACK 1" >>confdefs.h
+
+fi
+
+# Check whether --enable-console-socket was given.
+if test "${enable_console_socket+set}" = set; then :
+  enableval=$enable_console_socket; case $enableval in
+     yes) console_socket=yes ;;
+     no)  console_socket=no ;;
+   esac
+else
+  console_socket=no
+fi
+
+if test $console_socket = yes; then
+  if test $console_loopback = no; then
+    as_fn_error $? "--enable-console-socket requires --enable-console-loopback" "$LINENO" 5
+  fi
+
+$as_echo "#define ENABLE_OSM_CONSOLE_SOCKET 1" >>confdefs.h
 
 fi
+
 # --- END OPENIB_OSM_CONSOLE_SOCKET_SEL ---
 
 
@@ -12542,17 +12285,17 @@ fi
 # --- BEGIN OPENIB_OSM_PERF_MGR_SEL ---
 
 # Check whether --enable-perf-mgr was given.
-if test "${enable_perf_mgr+set}" = set; then
+if test "${enable_perf_mgr+set}" = set; then :
   enableval=$enable_perf_mgr; case $enableval in
      yes) perf_mgr=yes ;;
      no)  perf_mgr=no ;;
    esac
 else
-  perf_mgr=no
+  perf_mgr=yes
 fi
 
 # Check whether --enable-perf-mgr-profile was given.
-if test "${enable_perf_mgr_profile+set}" = set; then
+if test "${enable_perf_mgr_profile+set}" = set; then :
   enableval=$enable_perf_mgr_profile; case $enableval in
 	yes) perf_mgr_profile=yes ;;
 	no)  perf_mgr_profile=no ;;
@@ -12563,15 +12306,11 @@ fi
 
 if test $perf_mgr = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define ENABLE_OSM_PERF_MGR 1
-_ACEOF
+$as_echo "#define ENABLE_OSM_PERF_MGR 1" >>confdefs.h
 
   if test $perf_mgr_profile = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define ENABLE_OSM_PERF_MGR_PROFILE 1
-_ACEOF
+$as_echo "#define ENABLE_OSM_PERF_MGR_PROFILE 1" >>confdefs.h
 
   fi
 fi
@@ -12582,11 +12321,11 @@ conf_dir_tmp1="`eval echo ${sysconfdir} | sed 's/^NONE/$ac_default_prefix/'`"
 SYS_CONFIG_DIR="`eval echo $conf_dir_tmp1`"
 
 OPENSM_CONFIG_SUB_DIR=opensm
-{ $as_echo "$as_me:$LINENO: checking for --with-opensm-conf-sub-dir" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-opensm-conf-sub-dir" >&5
 $as_echo_n "checking for --with-opensm-conf-sub-dir... " >&6; }
 
 # Check whether --with-opensm-conf-sub-dir was given.
-if test "${with_opensm_conf_sub_dir+set}" = set; then
+if test "${with_opensm_conf_sub_dir+set}" = set; then :
   withval=$with_opensm_conf_sub_dir;  case "$withval" in
     no)
         ;;
@@ -12600,7 +12339,7 @@ fi
 
 
 OPENSM_CONFIG_DIR=$SYS_CONFIG_DIR/$OPENSM_CONFIG_SUB_DIR
-{ $as_echo "$as_me:$LINENO: result: $OPENSM_CONFIG_DIR" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OPENSM_CONFIG_DIR" >&5
 $as_echo "$OPENSM_CONFIG_DIR" >&6; }
 
 cat >>confdefs.h <<_ACEOF
@@ -12610,11 +12349,11 @@ _ACEOF
 
 
 OPENSM_CONFIG_FILE=opensm.conf
-{ $as_echo "$as_me:$LINENO: checking for --with-opensm-conf-file " >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-opensm-conf-file " >&5
 $as_echo_n "checking for --with-opensm-conf-file ... " >&6; }
 
 # Check whether --with-opensm-conf-file was given.
-if test "${with_opensm_conf_file+set}" = set; then
+if test "${with_opensm_conf_file+set}" = set; then :
   withval=$with_opensm_conf_file;  case "$withval" in
     no)
         ;;
@@ -12625,7 +12364,7 @@ if test "${with_opensm_conf_file+set}" = set; then
 
 fi
 
-{ $as_echo "$as_me:$LINENO: result: ${OPENSM_CONFIG_FILE}" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${OPENSM_CONFIG_FILE}" >&5
 $as_echo "${OPENSM_CONFIG_FILE}" >&6; }
 
 cat >>confdefs.h <<_ACEOF
@@ -12635,11 +12374,11 @@ _ACEOF
 
 
 NODENAMEMAPFILE=ib-node-name-map
-{ $as_echo "$as_me:$LINENO: checking for --with-node-name-map " >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-node-name-map " >&5
 $as_echo_n "checking for --with-node-name-map ... " >&6; }
 
 # Check whether --with-node-name-map was given.
-if test "${with_node_name_map+set}" = set; then
+if test "${with_node_name_map+set}" = set; then :
   withval=$with_node_name_map;  case "$withval" in
     no)
         ;;
@@ -12650,7 +12389,7 @@ if test "${with_node_name_map+set}" = set; then
 
 fi
 
-{ $as_echo "$as_me:$LINENO: result: $NODENAMEMAPFILE" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $NODENAMEMAPFILE" >&5
 $as_echo "$NODENAMEMAPFILE" >&6; }
 
 cat >>confdefs.h <<_ACEOF
@@ -12660,11 +12399,11 @@ _ACEOF
 
 
 PARTITION_CONFIG_FILE=partitions.conf
-{ $as_echo "$as_me:$LINENO: checking for --with-partitions-conf" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-partitions-conf" >&5
 $as_echo_n "checking for --with-partitions-conf... " >&6; }
 
 # Check whether --with-partitions-conf was given.
-if test "${with_partitions_conf+set}" = set; then
+if test "${with_partitions_conf+set}" = set; then :
   withval=$with_partitions_conf;  case "$withval" in
     no)
         ;;
@@ -12675,7 +12414,7 @@ if test "${with_partitions_conf+set}" = set; then
 
 fi
 
-{ $as_echo "$as_me:$LINENO: result: $PARTITION_CONFIG_FILE" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PARTITION_CONFIG_FILE" >&5
 $as_echo "$PARTITION_CONFIG_FILE" >&6; }
 
 cat >>confdefs.h <<_ACEOF
@@ -12685,11 +12424,11 @@ _ACEOF
 
 
 QOS_POLICY_FILE=qos-policy.conf
-{ $as_echo "$as_me:$LINENO: checking for --with-qos-policy-conf" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-qos-policy-conf" >&5
 $as_echo_n "checking for --with-qos-policy-conf... " >&6; }
 
 # Check whether --with-qos-policy-conf was given.
-if test "${with_qos_policy_conf+set}" = set; then
+if test "${with_qos_policy_conf+set}" = set; then :
   withval=$with_qos_policy_conf;  case "$withval" in
     no)
         ;;
@@ -12700,7 +12439,7 @@ if test "${with_qos_policy_conf+set}" = set; then
 
 fi
 
-{ $as_echo "$as_me:$LINENO: result: $QOS_POLICY_FILE" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $QOS_POLICY_FILE" >&5
 $as_echo "$QOS_POLICY_FILE" >&6; }
 
 cat >>confdefs.h <<_ACEOF
@@ -12709,12 +12448,15 @@ _ACEOF
 
 
 
+TORUS2QOS_CONF_FILE=torus-2QoS.conf
+
+
 PREFIX_ROUTES_FILE=prefix-routes.conf
-{ $as_echo "$as_me:$LINENO: checking for --with-prefix-routes-conf" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-prefix-routes-conf" >&5
 $as_echo_n "checking for --with-prefix-routes-conf... " >&6; }
 
 # Check whether --with-prefix-routes-conf was given.
-if test "${with_prefix_routes_conf+set}" = set; then
+if test "${with_prefix_routes_conf+set}" = set; then :
   withval=$with_prefix_routes_conf;  case "$withval" in
     no)
         ;;
@@ -12725,7 +12467,7 @@ if test "${with_prefix_routes_conf+set}" = set; then
 
 fi
 
-{ $as_echo "$as_me:$LINENO: result: $PREFIX_ROUTES_FILE" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PREFIX_ROUTES_FILE" >&5
 $as_echo "$PREFIX_ROUTES_FILE" >&6; }
 
 cat >>confdefs.h <<_ACEOF
@@ -12734,11 +12476,36 @@ _ACEOF
 
 
 
+PER_MOD_LOGGING_FILE=per-module-logging.conf
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-per-module-logging-conf" >&5
+$as_echo_n "checking for --with-per-module-logging-conf... " >&6; }
+
+# Check whether --with-per-module-logging.conf was given.
+if test "${with_per_module_logging_conf+set}" = set; then :
+  withval=$with_per_module_logging_conf;  case "$withval" in
+    no)
+        ;;
+    *)
+        PER_MOD_LOGGING_FILE=$withval
+        ;;
+    esac
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PER_MOD_LOGGING_FILE" >&5
+$as_echo "$PER_MOD_LOGGING_FILE" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DEFAULT_PER_MOD_LOGGING_FILE "$OPENSM_CONFIG_DIR/$PER_MOD_LOGGING_FILE"
+_ACEOF
+
+
+
 
 # --- BEGIN OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL ---
 
 # Check whether --enable-default-event-plugin was given.
-if test "${enable_default_event_plugin+set}" = set; then
+if test "${enable_default_event_plugin+set}" = set; then :
   enableval=$enable_default_event_plugin; case $enableval in
      yes) default_event_plugin=yes ;;
      no)  default_event_plugin=no ;;
@@ -12749,9 +12516,7 @@ fi
 
 if test $default_event_plugin = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define ENABLE_OSM_DEFAULT_EVENT_PLUGIN 1
-_ACEOF
+$as_echo "#define ENABLE_OSM_DEFAULT_EVENT_PLUGIN 1" >>confdefs.h
 
   DEFAULT_EVENT_PLUGIN=osmeventplugin
 else
@@ -12767,8 +12532,8 @@ fi
 
 
 # Check whether --with-osmv was given.
-if test "${with_osmv+set}" = set; then
-  withval=$with_osmv; { $as_echo "$as_me:$LINENO: Using OSM Vendor Type:$with_osmv" >&5
+if test "${with_osmv+set}" = set; then :
+  withval=$with_osmv; { $as_echo "$as_me:${as_lineno-$LINENO}: Using OSM Vendor Type:$with_osmv" >&5
 $as_echo "$as_me: Using OSM Vendor Type:$with_osmv" >&6;}
 else
   with_osmv="openib"
@@ -12777,8 +12542,8 @@ fi
 
 
 # Check whether --with-umad-prefix was given.
-if test "${with_umad_prefix+set}" = set; then
-  withval=$with_umad_prefix; { $as_echo "$as_me:$LINENO: Using ibumad installation prefix:$with_umad_prefix" >&5
+if test "${with_umad_prefix+set}" = set; then :
+  withval=$with_umad_prefix; { $as_echo "$as_me:${as_lineno-$LINENO}: Using ibumad installation prefix:$with_umad_prefix" >&5
 $as_echo "$as_me: Using ibumad installation prefix:$with_umad_prefix" >&6;}
 else
   with_umad_prefix=""
@@ -12787,8 +12552,8 @@ fi
 
 
 # Check whether --with-umad-includes was given.
-if test "${with_umad_includes+set}" = set; then
-  withval=$with_umad_includes; { $as_echo "$as_me:$LINENO: Using ibumad includes from:$with_umad_includes" >&5
+if test "${with_umad_includes+set}" = set; then :
+  withval=$with_umad_includes; { $as_echo "$as_me:${as_lineno-$LINENO}: Using ibumad includes from:$with_umad_includes" >&5
 $as_echo "$as_me: Using ibumad includes from:$with_umad_includes" >&6;}
 else
   with_umad_includes=""
@@ -12803,8 +12568,8 @@ fi
 
 
 # Check whether --with-umad-libs was given.
-if test "${with_umad_libs+set}" = set; then
-  withval=$with_umad_libs; { $as_echo "$as_me:$LINENO: Using ibumad libs from:$with_umad_libs" >&5
+if test "${with_umad_libs+set}" = set; then :
+  withval=$with_umad_libs; { $as_echo "$as_me:${as_lineno-$LINENO}: Using ibumad libs from:$with_umad_libs" >&5
 $as_echo "$as_me: Using ibumad libs from:$with_umad_libs" >&6;}
 else
   with_umad_libs=""
@@ -12823,8 +12588,8 @@ fi
 
 
 # Check whether --with-sim was given.
-if test "${with_sim+set}" = set; then
-  withval=$with_sim; { $as_echo "$as_me:$LINENO: Using Simulator from:$with_sim" >&5
+if test "${with_sim+set}" = set; then :
+  withval=$with_sim; { $as_echo "$as_me:${as_lineno-$LINENO}: Using Simulator from:$with_sim" >&5
 $as_echo "$as_me: Using Simulator from:$with_sim" >&6;}
 else
   with_sim="/usr"
@@ -12833,12 +12598,10 @@ fi
 
 if test $with_osmv = "openib"; then
 
-cat >>confdefs.h <<\_ACEOF
-#define OSM_VENDOR_INTF_OPENIB 1
-_ACEOF
+$as_echo "#define OSM_VENDOR_INTF_OPENIB 1" >>confdefs.h
 
-   OSMV_INCLUDES="-I\$(srcdir)/../include -I\$(srcdir)/../../libibcommon/include -I\$(srcdir)/../../libibumad/include -I\$(includedir)"
-   OSMV_LDADD="-L\$(abs_srcdir)/../../libibumad/.libs -L\$(abs_srcdir)/../../libibcommon/.libs -L\$(libdir) -libumad -libcommon"
+   OSMV_INCLUDES="-I\$(srcdir)/../include -I\$(srcdir)/../../libibumad/include -I\$(includedir)"
+   OSMV_LDADD="-L\$(abs_srcdir)/../../libibumad/.libs -L\$(libdir) -libumad"
 
    if test "x$with_umad_libs" != "x"; then
       OSMV_LDADD="-L$with_umad_libs $OSMV_LDADD"
@@ -12848,23 +12611,17 @@ _ACEOF
       OSMV_INCLUDES="-I$with_umad_includes $OSMV_INCLUDES"
    fi
 
-cat >>confdefs.h <<\_ACEOF
-#define DUAL_SIDED_RMPP 1
-_ACEOF
+$as_echo "#define DUAL_SIDED_RMPP 1" >>confdefs.h
 
 elif test $with_osmv = "sim" ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define OSM_VENDOR_INTF_SIM 1
-_ACEOF
+$as_echo "#define OSM_VENDOR_INTF_SIM 1" >>confdefs.h
 
    OSMV_INCLUDES="-I$with_sim/include -I\$(srcdir)/../include"
    OSMV_LDADD="-L$with_sim/lib -libmscli"
 elif test $with_osmv = "gen1"; then
 
-cat >>confdefs.h <<\_ACEOF
-#define OSM_VENDOR_INTF_TS 1
-_ACEOF
+$as_echo "#define OSM_VENDOR_INTF_TS 1" >>confdefs.h
 
 
    if test -z $MTHOME; then
@@ -12890,23 +12647,17 @@ _ACEOF
       fi
    fi
    if test $osmv_found = 0; then
-      { { $as_echo "$as_me:$LINENO: error: Fail to find gen1 include files dir" >&5
-$as_echo "$as_me: error: Fail to find gen1 include files dir" >&2;}
-   { (exit 1); exit 1; }; }
+      as_fn_error $? "Fail to find gen1 include files dir" "$LINENO" 5
    fi
    OSMV_LDADD="-L/usr/local/ibgd/driver/infinihost/lib -lvapi -lmosal -lmtl_common -lmpga"
 elif test $with_osmv = "vapi"; then
 
-cat >>confdefs.h <<\_ACEOF
-#define OSM_VENDOR_INTF_MTL 1
-_ACEOF
+$as_echo "#define OSM_VENDOR_INTF_MTL 1" >>confdefs.h
 
    OSMV_INCLUDES="-I/usr/mellanox/include -I/usr/include -I\$(srcdir)/../include"
    OSMV_LDADD="-L/usr/lib -L/usr/mellanox/lib -lib_mgt -lvapi -lmosal -lmtl_common -lmpga"
 else
-   { { $as_echo "$as_me:$LINENO: error: Invalid Vendor Type provided:$with_osmv should be either openib,sim,gen1" >&5
-$as_echo "$as_me: error: Invalid Vendor Type provided:$with_osmv should be either openib,sim,gen1" >&2;}
-   { (exit 1); exit 1; }; }
+   as_fn_error $? "Invalid Vendor Type provided:$with_osmv should be either openib,sim,gen1" "$LINENO" 5
 fi
 
  if test $with_osmv = "vapi"; then
@@ -12942,178 +12693,36 @@ else
 fi
 
 
-cat >>confdefs.h <<\_ACEOF
-#define VENDOR_RMPP_SUPPORT 1
-_ACEOF
-
-
-
-
-
-# --- END OPENIB_APP_OSMV_SEL ---
-
-
-
-# --- BEGIN OPENIB_APP_OSMV_CHECK_HEADER ---
-
-if test "$disable_libcheck" != "yes"; then
- if test $with_osmv = "openib"; then
-   osmv_headers=infiniband/umad.h
- elif test $with_osmv = "sim" ; then
-   osmv_headers=ibmgtsim/ibms_client_api.h
- elif test $with_osmv = "gen1"; then
-   osmv_headers=
- elif test $with_osmv = "vapi"; then
-   osmv_headers=vapi.h
- else
-   { { $as_echo "$as_me:$LINENO: error: OSM Vendor Type not defined: please make sure OPENIB_APP_OSMV SEL is run before CHECK_HEADER" >&5
-$as_echo "$as_me: error: OSM Vendor Type not defined: please make sure OPENIB_APP_OSMV SEL is run before CHECK_HEADER" >&2;}
-   { (exit 1); exit 1; }; }
- fi
- if test "x$osmv_headers" != "x"; then
-
-for ac_header in $osmv_headers
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
+$as_echo "#define VENDOR_RMPP_SUPPORT 1" >>confdefs.h
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
-fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## -------------------------------------------- ##
-## Report this to general at lists.openfabrics.org ##
-## -------------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+# --- END OPENIB_APP_OSMV_SEL ---
 
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+
+
+# --- BEGIN OPENIB_APP_OSMV_CHECK_HEADER ---
+
+if test "$disable_libcheck" != "yes"; then
+ if test $with_osmv = "openib"; then
+   osmv_headers=infiniband/umad.h
+ elif test $with_osmv = "sim" ; then
+   osmv_headers=ibmgtsim/ibms_client_api.h
+ elif test $with_osmv = "gen1"; then
+   osmv_headers=
+ elif test $with_osmv = "vapi"; then
+   osmv_headers=vapi.h
+ else
+   as_fn_error $? "OSM Vendor Type not defined: please make sure OPENIB_APP_OSMV SEL is run before CHECK_HEADER" "$LINENO" 5
+ fi
+ if test "x$osmv_headers" != "x"; then
+   for ac_header in $osmv_headers
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -13132,19 +12741,14 @@ if test "$disable_libcheck" != "yes"; then
 
   if test $with_osmv = "openib"; then
    LDADD="$LDADD $OSMV_LDADD"
-
-{ $as_echo "$as_me:$LINENO: checking for umad_init in -libumad" >&5
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for umad_init in -libumad" >&5
 $as_echo_n "checking for umad_init in -libumad... " >&6; }
-if test "${ac_cv_lib_ibumad_umad_init+set}" = set; then
+if ${ac_cv_lib_ibumad_umad_init+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-libumad  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -13162,43 +12766,18 @@ return umad_init ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_ibumad_umad_init=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_ibumad_umad_init=no
+  ac_cv_lib_ibumad_umad_init=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ibumad_umad_init" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ibumad_umad_init" >&5
 $as_echo "$ac_cv_lib_ibumad_umad_init" >&6; }
-if test "x$ac_cv_lib_ibumad_umad_init" = x""yes; then
+if test "x$ac_cv_lib_ibumad_umad_init" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBIBUMAD 1
 _ACEOF
@@ -13206,58 +12785,44 @@ _ACEOF
   LIBS="-libumad $LIBS"
 
 else
-  { { $as_echo "$as_me:$LINENO: error: umad_init() not found. libosmvendor of type openib requires libibumad." >&5
-$as_echo "$as_me: error: umad_init() not found. libosmvendor of type openib requires libibumad." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "umad_init() not found. libosmvendor of type openib requires libibumad." "$LINENO" 5
 fi
 
  elif test $with_osmv = "sim" ; then
    LDFLAGS="$LDFLAGS -L$with_sim/lib"
    as_ac_File=`$as_echo "ac_cv_file_$with_sim/lib/libibmscli.a" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $with_sim/lib/libibmscli.a" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $with_sim/lib/libibmscli.a" >&5
 $as_echo_n "checking for $with_sim/lib/libibmscli.a... " >&6; }
-if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_File+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   test "$cross_compiling" = yes &&
-  { { $as_echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-$as_echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
 if test -r "$with_sim/lib/libibmscli.a"; then
   eval "$as_ac_File=yes"
 else
   eval "$as_ac_File=no"
 fi
 fi
-ac_res=`eval 'as_val=${'$as_ac_File'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_File
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_File'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  :
+if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
+
 else
-  { { $as_echo "$as_me:$LINENO: error: ibms_bind() not found. libosmvendor of type sim requires libibmscli." >&5
-$as_echo "$as_me: error: ibms_bind() not found. libosmvendor of type sim requires libibmscli." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "ibms_bind() not found. libosmvendor of type sim requires libibmscli." "$LINENO" 5
 fi
 
  elif test $with_osmv = "gen1"; then
    LDFLAGS="$LDFLAGS -L$MTHOME/lib -L$MTHOME/lib64 -lmosal -lmtl_common -lmpga"
-
-{ $as_echo "$as_me:$LINENO: checking for vipul_init in -lvapi" >&5
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for vipul_init in -lvapi" >&5
 $as_echo_n "checking for vipul_init in -lvapi... " >&6; }
-if test "${ac_cv_lib_vapi_vipul_init+set}" = set; then
+if ${ac_cv_lib_vapi_vipul_init+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lvapi  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -13275,43 +12840,18 @@ return vipul_init ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_vapi_vipul_init=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_vapi_vipul_init=no
+  ac_cv_lib_vapi_vipul_init=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_vapi_vipul_init" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_vapi_vipul_init" >&5
 $as_echo "$ac_cv_lib_vapi_vipul_init" >&6; }
-if test "x$ac_cv_lib_vapi_vipul_init" = x""yes; then
+if test "x$ac_cv_lib_vapi_vipul_init" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBVAPI 1
 _ACEOF
@@ -13319,21 +12859,17 @@ _ACEOF
   LIBS="-lvapi $LIBS"
 
 else
-  { { $as_echo "$as_me:$LINENO: error: vipul_init() not found. libosmvendor of type gen1 requires libvapi." >&5
-$as_echo "$as_me: error: vipul_init() not found. libosmvendor of type gen1 requires libvapi." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "vipul_init() not found. libosmvendor of type gen1 requires libvapi." "$LINENO" 5
 fi
 
  elif test $with_osmv != "vapi"; then
-   { { $as_echo "$as_me:$LINENO: error: OSM Vendor Type not defined: please make sure OPENIB_APP_OSMV SEL is run before CHECK_LIB" >&5
-$as_echo "$as_me: error: OSM Vendor Type not defined: please make sure OPENIB_APP_OSMV SEL is run before CHECK_LIB" >&2;}
-   { (exit 1); exit 1; }; }
+   as_fn_error $? "OSM Vendor Type not defined: please make sure OPENIB_APP_OSMV SEL is run before CHECK_LIB" "$LINENO" 5
  fi
 fi
 # --- END OPENIB_APP_OSMV_CHECK_LIB ---
 
 
-ac_config_files="$ac_config_files man/opensm.8 scripts/opensm.init scripts/redhat-opensm.init scripts/sldd.sh"
+ac_config_files="$ac_config_files man/opensm.8 man/torus-2QoS.8 man/torus-2QoS.conf.5 scripts/opensm.init scripts/redhat-opensm.init scripts/sldd.sh"
 
 
 ac_config_files="$ac_config_files include/opensm/osm_version.h Makefile include/Makefile complib/Makefile libvendor/Makefile opensm/Makefile osmeventplugin/Makefile osmtest/Makefile opensm.spec"
@@ -13365,13 +12901,13 @@ _ACEOF
     case $ac_val in #(
     *${as_nl}*)
       case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       esac
       case $ac_var in #(
       _ | IFS | as_nl) ;; #(
       BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) $as_unset $ac_var ;;
+      *) { eval $ac_var=; unset $ac_var;} ;;
       esac ;;
     esac
   done
@@ -13379,8 +12915,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
   (set) 2>&1 |
     case $as_nl`(ac_space=' '; set) 2>&1` in #(
     *${as_nl}ac_space=\ *)
-      # `set' does not quote correctly, so add quotes (double-quote
-      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      # `set' does not quote correctly, so add quotes: double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \.
       sed -n \
 	"s/'/'\\\\''/g;
 	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
@@ -13402,12 +12938,23 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      :end' >>confcache
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
-    test "x$cache_file" != "x/dev/null" &&
-      { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+    if test "x$cache_file" != "x/dev/null"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
 $as_echo "$as_me: updating cache $cache_file" >&6;}
-    cat confcache >$cache_file
+      if test ! -f "$cache_file" || test -h "$cache_file"; then
+	cat confcache >"$cache_file"
+      else
+        case $cache_file in #(
+        */* | ?:*)
+	  mv -f confcache "$cache_file"$$ &&
+	  mv -f "$cache_file"$$ "$cache_file" ;; #(
+        *)
+	  mv -f confcache "$cache_file" ;;
+	esac
+      fi
+    fi
   else
-    { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
   fi
 fi
@@ -13421,84 +12968,70 @@ DEFS=-DHAVE_CONFIG_H
 
 ac_libobjs=
 ac_ltlibobjs=
+U=
 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
   # 1. Remove the extension, and $U if already installed.
   ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
   ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
   # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
   #    will be set to the directory where LIBOBJS objects are built.
-  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
-  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
 done
 LIBOBJS=$ac_libobjs
 
 LTLIBOBJS=$ac_ltlibobjs
 
 
+ if test -n "$EXEEXT"; then
+  am__EXEEXT_TRUE=
+  am__EXEEXT_FALSE='#'
+else
+  am__EXEEXT_TRUE='#'
+  am__EXEEXT_FALSE=
+fi
+
 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${HAVE_LD_VERSION_SCRIPT_TRUE}" && test -z "${HAVE_LD_VERSION_SCRIPT_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_LD_VERSION_SCRIPT\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"HAVE_LD_VERSION_SCRIPT\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"HAVE_LD_VERSION_SCRIPT\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${DEBUG_TRUE}" && test -z "${DEBUG_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"DEBUG\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"DEBUG\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"DEBUG\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${OSMV_VAPI_TRUE}" && test -z "${OSMV_VAPI_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"OSMV_VAPI\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"OSMV_VAPI\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"OSMV_VAPI\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${OSMV_GEN1_TRUE}" && test -z "${OSMV_GEN1_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"OSMV_GEN1\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"OSMV_GEN1\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"OSMV_GEN1\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${OSMV_SIM_TRUE}" && test -z "${OSMV_SIM_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"OSMV_SIM\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"OSMV_SIM\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"OSMV_SIM\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${OSMV_OPENIB_TRUE}" && test -z "${OSMV_OPENIB_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"OSMV_OPENIB\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"OSMV_OPENIB\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"OSMV_OPENIB\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
 #! $SHELL
 # Generated by $as_me.
 # Run this file to recreate the current configuration.
@@ -13508,17 +13041,18 @@ cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 debug=false
 ac_cs_recheck=false
 ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
@@ -13526,23 +13060,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
 esac
-
 fi
 
 
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
 as_nl='
 '
 export as_nl
@@ -13550,7 +13076,13 @@ export as_nl
 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
   as_echo='printf %s\n'
   as_echo_n='printf %s'
 else
@@ -13561,7 +13093,7 @@ else
     as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
     as_echo_n_body='eval
       arg=$1;
-      case $arg in
+      case $arg in #(
       *"$as_nl"*)
 	expr "X$arg" : "X\\(.*\\)$as_nl";
 	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
@@ -13584,13 +13116,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
   }
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
 
 # IFS
 # We need space, tab and new line, in precisely that order.  Quoting is
@@ -13600,15 +13125,16 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
+as_myself=
+case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
 IFS=$as_save_IFS
 
      ;;
@@ -13620,12 +13146,16 @@ if test "x$as_myself" = x; then
 fi
 if test ! -f "$as_myself"; then
   $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
+  exit 1
 fi
 
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
 done
 PS1='$ '
 PS2='> '
@@ -13637,7 +13167,89 @@ export LC_ALL
 LANGUAGE=C
 export LANGUAGE
 
-# Required to use basename.
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
 if expr a : '\(a\)' >/dev/null 2>&1 &&
    test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
@@ -13651,8 +13263,12 @@ else
   as_basename=false
 fi
 
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
 
-# Name of the executable.
 as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
 	 X"$0" : 'X\(//\)$' \| \
@@ -13672,106 +13288,103 @@ $as_echo X/"$0" |
 	  }
 	  s/.*/./; q'`
 
-# CDPATH.
-$as_unset CDPATH
-
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
-
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
 
 ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
+case `echo -n x` in #(((((
 -n*)
-  case `echo 'x\c'` in
+  case `echo 'xy\c'` in
   *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
   esac;;
 *)
   ECHO_N='-n';;
 esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
 else
-  as_expr=false
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
+else
+  as_ln_s='cp -p'
 fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
 
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
-  if ln -s conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s='ln -s'
-    # ... but there are two gotchas:
-    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
-    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
-  elif ln conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s=ln
-  else
-    as_ln_s='cp -p'
-  fi
-else
-  as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
 
+} # as_fn_mkdir_p
 if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
+  as_mkdir_p='mkdir -p "$as_dir"'
 else
   test -d ./-p && rmdir ./-p
   as_mkdir_p=false
@@ -13790,10 +13403,10 @@ else
       if test -d "$1"; then
 	test -d "$1/.";
       else
-	case $1 in
+	case $1 in #(
 	-*)set "./$1";;
 	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
 	???[sx]*):;;*)false;;esac;fi
     '\'' sh
   '
@@ -13808,13 +13421,19 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
 exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
 
-# Save the log message, to keep $[0] and so on meaningful, and to
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by opensm $as_me 3.2.6_20090317, which was
-generated by GNU Autoconf 2.63.  Invocation command line was
+This file was extended by opensm $as_me 3.3.15, which was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -13846,13 +13465,15 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration.  Unless the files
+and actions are specified as TAGs, all are instantiated by default.
 
-Usage: $0 [OPTION]... [FILE]...
+Usage: $0 [OPTION]... [TAG]...
 
   -h, --help       print this help, then exit
   -V, --version    print version number and configuration settings, then exit
+      --config     print configuration, then exit
   -q, --quiet, --silent
                    do not print progress messages
   -d, --debug      don't remove temporary files
@@ -13871,16 +13492,17 @@ $config_headers
 Configuration commands:
 $config_commands
 
-Report bugs to <bug-autoconf at gnu.org>."
+Report bugs to <linux-rdma at vger.kernel.org>."
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-opensm config.status 3.2.6_20090317
-configured by $0, generated by GNU Autoconf 2.63,
-  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+opensm config.status 3.3.15
+configured by $0, generated by GNU Autoconf 2.68,
+  with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2008 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -13898,11 +13520,16 @@ ac_need_defaults=:
 while test $# != 0
 do
   case $1 in
-  --*=*)
+  --*=?*)
     ac_option=`expr "X$1" : 'X\([^=]*\)='`
     ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
     ac_shift=:
     ;;
+  --*=)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=
+    ac_shift=:
+    ;;
   *)
     ac_option=$1
     ac_optarg=$2
@@ -13916,27 +13543,29 @@ do
     ac_cs_recheck=: ;;
   --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
     $as_echo "$ac_cs_version"; exit ;;
+  --config | --confi | --conf | --con | --co | --c )
+    $as_echo "$ac_cs_config"; exit ;;
   --debug | --debu | --deb | --de | --d | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
     $ac_shift
     case $ac_optarg in
     *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    '') as_fn_error $? "missing file argument" ;;
     esac
-    CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
+    as_fn_append CONFIG_FILES " '$ac_optarg'"
     ac_need_defaults=false;;
   --header | --heade | --head | --hea )
     $ac_shift
     case $ac_optarg in
     *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
-    CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'"
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
     ac_need_defaults=false;;
   --he | --h)
     # Conflict between --help and --header
-    { $as_echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; };;
+    as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
   --help | --hel | -h )
     $as_echo "$ac_cs_usage"; exit ;;
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
@@ -13944,11 +13573,10 @@ Try \`$0 --help' for more information." >&2
     ac_cs_silent=: ;;
 
   # This is an error.
-  -*) { $as_echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; } ;;
+  -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
 
-  *) ac_config_targets="$ac_config_targets $1"
+  *) as_fn_append ac_config_targets " $1"
      ac_need_defaults=false ;;
 
   esac
@@ -13999,131 +13627,154 @@ AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
 sed_quote_subst='$sed_quote_subst'
 double_quote_subst='$double_quote_subst'
 delay_variable_subst='$delay_variable_subst'
-macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
-macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
-enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
-pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
-enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
-host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
-host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
-host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
-build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
-build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
-build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
-SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
-Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
-GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
-EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
-FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
-LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
-NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
-LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
-max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
-ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
-exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
-lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
-lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
-lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
-reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
-reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
-deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
-file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
-AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
-AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
-RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
-old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
-CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
-GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
-SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
-ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
-MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
-need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
-DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
-NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
-LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
-libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
-shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
-export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
-allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
-inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
-link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
-fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
-always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
-export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
-variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
-need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
-version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
-runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
-libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
-soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
-old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
-striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
 
 LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
 compiler='$compiler_DEFAULT'
 
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
 # Quote evaled strings.
-for var in SED \
+for var in SHELL \
+ECHO \
+PATH_SEPARATOR \
+SED \
 GREP \
 EGREP \
 FGREP \
@@ -14136,8 +13787,13 @@ reload_flag \
 OBJDUMP \
 deplibs_check_method \
 file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+DLLTOOL \
+sharedlib_from_linklib_cmd \
 AR \
 AR_FLAGS \
+archiver_list_spec \
 STRIP \
 RANLIB \
 CC \
@@ -14147,14 +13803,14 @@ lt_cv_sys_global_symbol_pipe \
 lt_cv_sys_global_symbol_to_cdecl \
 lt_cv_sys_global_symbol_to_c_name_address \
 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
-SHELL \
-ECHO \
+nm_file_list_spec \
 lt_prog_compiler_no_builtin_flag \
-lt_prog_compiler_wl \
 lt_prog_compiler_pic \
+lt_prog_compiler_wl \
 lt_prog_compiler_static \
 lt_cv_prog_compiler_c_o \
 need_locks \
+MANIFEST_TOOL \
 DSYMUTIL \
 NMEDIT \
 LIPO \
@@ -14168,9 +13824,7 @@ with_gnu_ld \
 allow_undefined_flag \
 no_undefined_flag \
 hardcode_libdir_flag_spec \
-hardcode_libdir_flag_spec_ld \
 hardcode_libdir_separator \
-fix_srcfile_path \
 exclude_expsyms \
 include_expsyms \
 file_list_spec \
@@ -14178,12 +13832,13 @@ variables_saved_for_relink \
 libname_spec \
 library_names_spec \
 soname_spec \
+install_override_mode \
 finish_eval \
 old_striplib \
 striplib; do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -14205,14 +13860,15 @@ module_cmds \
 module_expsym_cmds \
 export_symbols_cmds \
 prelink_cmds \
+postlink_cmds \
 postinstall_cmds \
 postuninstall_cmds \
 finish_cmds \
 sys_lib_search_path_spec \
 sys_lib_dlsearch_path_spec; do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -14220,12 +13876,6 @@ sys_lib_dlsearch_path_spec; do
     esac
 done
 
-# Fix-up fallback echo if it was mangled by the above quoting rules.
-case \$lt_ECHO in
-*'\\\$0 --fallback-echo"')  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
-  ;;
-esac
-
 ac_aux_dir='$ac_aux_dir'
 xsi_shell='$xsi_shell'
 lt_shell_append='$lt_shell_append'
@@ -14259,6 +13909,8 @@ do
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
     "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
     "man/opensm.8") CONFIG_FILES="$CONFIG_FILES man/opensm.8" ;;
+    "man/torus-2QoS.8") CONFIG_FILES="$CONFIG_FILES man/torus-2QoS.8" ;;
+    "man/torus-2QoS.conf.5") CONFIG_FILES="$CONFIG_FILES man/torus-2QoS.conf.5" ;;
     "scripts/opensm.init") CONFIG_FILES="$CONFIG_FILES scripts/opensm.init" ;;
     "scripts/redhat-opensm.init") CONFIG_FILES="$CONFIG_FILES scripts/redhat-opensm.init" ;;
     "scripts/sldd.sh") CONFIG_FILES="$CONFIG_FILES scripts/sldd.sh" ;;
@@ -14272,9 +13924,7 @@ do
     "osmtest/Makefile") CONFIG_FILES="$CONFIG_FILES osmtest/Makefile" ;;
     "opensm.spec") CONFIG_FILES="$CONFIG_FILES opensm.spec" ;;
 
-  *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
-   { (exit 1); exit 1; }; };;
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
 done
 
@@ -14297,26 +13947,24 @@ fi
 # after its creation but before its name has been assigned to `$tmp'.
 $debug ||
 {
-  tmp=
+  tmp= ac_tmp=
   trap 'exit_status=$?
-  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+  : "${ac_tmp:=$tmp}"
+  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
 ' 0
-  trap '{ (exit 1); exit 1; }' 1 2 13 15
+  trap 'as_fn_exit 1' 1 2 13 15
 }
 # Create a (secure) tmp directory for tmp files.
 
 {
   tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -n "$tmp" && test -d "$tmp"
+  test -d "$tmp"
 }  ||
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
-} ||
-{
-   $as_echo "$as_me: cannot create a temporary directory in ." >&2
-   { (exit 1); exit 1; }
-}
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -14324,7 +13972,13 @@ $debug ||
 if test -n "$CONFIG_FILES"; then
 
 
-ac_cr='
'
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+  eval ac_cr=\$\'\\r\'
+fi
 ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
 if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
   ac_cs_awk_cr='\\r'
@@ -14332,7 +13986,7 @@ else
   ac_cs_awk_cr=$ac_cr
 fi
 
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
 _ACEOF
 
 
@@ -14341,24 +13995,18 @@ _ACEOF
   echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
   echo "_ACEOF"
 } >conf$$subs.sh ||
-  { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
-ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   . ./conf$$subs.sh ||
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
 
   ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
   if test $ac_delim_n = $ac_delim_num; then
     break
   elif $ac_last_try; then
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -14366,7 +14014,7 @@ done
 rm -f conf$$subs.sh
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
 _ACEOF
 sed -n '
 h
@@ -14380,7 +14028,7 @@ s/'"$ac_delim"'$//
 t delim
 :nl
 h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
 t more1
 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
 p
@@ -14394,7 +14042,7 @@ s/.\{148\}//
 t nl
 :delim
 h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
 t more2
 s/["\\]/\\&/g; s/^/"/; s/$/"/
 p
@@ -14414,7 +14062,7 @@ t delim
 rm -f conf$$subs.awk
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
   for (key in S) S_is_set[key] = 1
   FS = ""
 
@@ -14446,23 +14094,29 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
   sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
 else
   cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
-  || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
-$as_echo "$as_me: error: could not setup config files machinery" >&2;}
-   { (exit 1); exit 1; }; }
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
 # trailing colons and then remove the whole line if VPATH becomes empty
 # (actually we leave an empty line to preserve line numbers).
 if test "x$srcdir" = x.; then
-  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[	 ]*\):*/\1/
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=[	 ]*/{
+h
+s///
+s/^/:/
+s/[	 ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
 s/:*$//
+x
+s/\(=[	 ]*\).*/\1/
+G
+s/\n//
 s/^[^=]*=[	 ]*$//
 }'
 fi
@@ -14474,7 +14128,7 @@ fi # test -n "$CONFIG_FILES"
 # No need to generate them if there are no CONFIG_HEADERS.
 # This happens for instance with `./config.status Makefile'.
 if test -n "$CONFIG_HEADERS"; then
-cat >"$tmp/defines.awk" <<\_ACAWK ||
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
 BEGIN {
 _ACEOF
 
@@ -14486,13 +14140,11 @@ _ACEOF
 # handling of long lines.
 ac_delim='%!_!# '
 for ac_last_try in false false :; do
-  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
-  if test -z "$ac_t"; then
+  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_tt"; then
     break
   elif $ac_last_try; then
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -14577,9 +14229,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-  { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5
-$as_echo "$as_me: error: could not setup config headers machinery" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
 fi # test -n "$CONFIG_HEADERS"
 
 
@@ -14592,9 +14242,7 @@ do
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
-$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
-   { (exit 1); exit 1; }; };;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -14613,7 +14261,7 @@ $as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
     for ac_f
     do
       case $ac_f in
-      -) ac_f="$tmp/stdin";;
+      -) ac_f="$ac_tmp/stdin";;
       *) # Look for the file first in the build tree, then in the source tree
 	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
 	 # because $ac_f cannot contain `:'.
@@ -14622,12 +14270,10 @@ $as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
-   { (exit 1); exit 1; }; };;
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
-      ac_file_inputs="$ac_file_inputs '$ac_f'"
+      as_fn_append ac_file_inputs " '$ac_f'"
     done
 
     # Let's still pretend it is `configure' which instantiates (i.e., don't
@@ -14638,7 +14284,7 @@ $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
 	`' by configure.'
     if test x"$ac_file" != x-; then
       configure_input="$ac_file.  $configure_input"
-      { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
 $as_echo "$as_me: creating $ac_file" >&6;}
     fi
     # Neutralize special characters interpreted by sed in replacement strings.
@@ -14650,10 +14296,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}
     esac
 
     case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; } ;;
+    *:-:* | *:-) cat >"$ac_tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
     esac
     ;;
   esac
@@ -14681,47 +14325,7 @@ $as_echo X"$ac_file" |
 	    q
 	  }
 	  s/.*/./; q'`
-  { as_dir="$ac_dir"
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_dir" : 'X\(//\)[^/]' \| \
-	 X"$as_dir" : 'X\(//\)$' \| \
-	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
+  as_dir="$ac_dir"; as_fn_mkdir_p
   ac_builddir=.
 
 case "$ac_dir" in
@@ -14778,7 +14382,6 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # If the template does not know about datarootdir, expand it.
 # FIXME: This hack should be removed a few years after 2.60.
 ac_datarootdir_hack=; ac_datarootdir_seen=
-
 ac_sed_dataroot='
 /datarootdir/ {
   p
@@ -14788,12 +14391,11 @@ ac_sed_dataroot='
 /@docdir@/p
 /@infodir@/p
 /@localedir@/p
-/@mandir@/p
-'
+/@mandir@/p'
 case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
 *datarootdir*) ac_datarootdir_seen=yes;;
 *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
@@ -14803,7 +14405,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
   s&@infodir@&$infodir&g
   s&@localedir@&$localedir&g
   s&@mandir@&$mandir&g
-    s&\\\${datarootdir}&$datarootdir&g' ;;
+  s&\\\${datarootdir}&$datarootdir&g' ;;
 esac
 _ACEOF
 
@@ -14831,27 +14433,24 @@ s&@INSTALL@&$ac_INSTALL&;t t
 s&@MKDIR_P@&$ac_MKDIR_P&;t t
 $ac_datarootdir_hack
 "
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
-  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
-  { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&5
+  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
+      "$ac_tmp/out"`; test -z "$ac_out"; } &&
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&2;}
+which seems to be undefined.  Please make sure it is defined" >&2;}
 
-  rm -f "$tmp/stdin"
+  rm -f "$ac_tmp/stdin"
   case $ac_file in
-  -) cat "$tmp/out" && rm -f "$tmp/out";;
-  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
   esac \
-  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
   :H)
   #
@@ -14860,27 +14459,21 @@ $as_echo "$as_me: error: could not create $ac_file" >&2;}
   if test x"$ac_file" != x-; then
     {
       $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
-    } >"$tmp/config.h" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
-    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
-      { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+    } >"$ac_tmp/config.h" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
-      mv "$tmp/config.h" "$ac_file" \
-	|| { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+      mv "$ac_tmp/config.h" "$ac_file" \
+	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5
-$as_echo "$as_me: error: could not create -" >&2;}
-   { (exit 1); exit 1; }; }
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error $? "could not create -" "$LINENO" 5
   fi
 # Compute "$ac_file"'s index in $config_headers.
 _am_arg="$ac_file"
@@ -14918,34 +14511,35 @@ $as_echo X"$_am_arg" |
 	  s/.*/./; q'`/stamp-h$_am_stamp_count
  ;;
 
-  :C)  { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5
+  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
 $as_echo "$as_me: executing $ac_file commands" >&6;}
  ;;
   esac
 
 
   case $ac_file$ac_mode in
-    "depfiles":C) test x"$AMDEP_TRUE" != x"" || # Autoconf 2.62 quotes --file arguments for eval, but not when files
-# are listed without --file.  Let's play safe and only enable the eval
-# if we detect the quoting.
-case $CONFIG_FILES in
-*\'*) eval set x "$CONFIG_FILES" ;;
-*)   set x $CONFIG_FILES ;;
-esac
-shift
-for mf
-do
-  # Strip MF so we end up with the name of the file.
-  mf=`echo "$mf" | sed -e 's/:.*$//'`
-  # Check whether this is an Automake generated Makefile or not.
-  # We used to match only the files named `Makefile.in', but
-  # some people rename them; so instead we look at the file content.
-  # Grep'ing the first line is not enough: some people post-process
-  # each Makefile.in and add a new line on top of each file to say so.
-  # Grep'ing the whole file is not good either: AIX grep has a line
-  # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-    dirpart=`$as_dirname -- "$mf" ||
+    "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named `Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`$as_dirname -- "$mf" ||
 $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 	 X"$mf" : 'X\(//\)[^/]' \| \
 	 X"$mf" : 'X\(//\)$' \| \
@@ -14968,28 +14562,28 @@ $as_echo X"$mf" |
 	    q
 	  }
 	  s/.*/./; q'`
-  else
-    continue
-  fi
-  # Extract the definition of DEPDIR, am__include, and am__quote
-  # from the Makefile without running `make'.
-  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-  test -z "$DEPDIR" && continue
-  am__include=`sed -n 's/^am__include = //p' < "$mf"`
-  test -z "am__include" && continue
-  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-  # When using ansi2knr, U may be empty or an underscore; expand it
-  U=`sed -n 's/^U = //p' < "$mf"`
-  # Find all dependency output files, they are included files with
-  # $(DEPDIR) in their names.  We invoke sed twice because it is the
-  # simplest approach to changing $(DEPDIR) to its actual value in the
-  # expansion.
-  for file in `sed -n "
-    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
-    # Make sure the directory exists.
-    test -f "$dirpart/$file" && continue
-    fdir=`$as_dirname -- "$file" ||
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running `make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # When using ansi2knr, U may be empty or an underscore; expand it
+    U=`sed -n 's/^U = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`$as_dirname -- "$file" ||
 $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 	 X"$file" : 'X\(//\)[^/]' \| \
 	 X"$file" : 'X\(//\)$' \| \
@@ -15012,51 +14606,12 @@ $as_echo X"$file" |
 	    q
 	  }
 	  s/.*/./; q'`
-    { as_dir=$dirpart/$fdir
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_dir" : 'X\(//\)[^/]' \| \
-	 X"$as_dir" : 'X\(//\)$' \| \
-	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-      test -d "$as_dir" && break
+      as_dir=$dirpart/$fdir; as_fn_mkdir_p
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
     done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
-    # echo "creating $dirpart/$file"
-    echo '# dummy' > "$dirpart/$file"
   done
-done
+}
  ;;
     "libtool":C)
 
@@ -15079,7 +14634,8 @@ done
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -15127,6 +14683,15 @@ pic_mode=$pic_mode
 # Whether or not to optimize for fast installation.
 fast_install=$enable_fast_install
 
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# The PATH separator for the build system.
+PATH_SEPARATOR=$lt_PATH_SEPARATOR
+
 # The host system.
 host_alias=$host_alias
 host=$host
@@ -15176,9 +14741,11 @@ SP2NL=$lt_lt_SP2NL
 # turn newlines into spaces.
 NL2SP=$lt_lt_NL2SP
 
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
 
 # An object symbol dumper.
 OBJDUMP=$lt_OBJDUMP
@@ -15186,13 +14753,30 @@ OBJDUMP=$lt_OBJDUMP
 # Method to check whether dependent libraries are shared objects.
 deplibs_check_method=$lt_deplibs_check_method
 
-# Command to use when deplibs_check_method == "file_magic".
+# Command to use when deplibs_check_method = "file_magic".
 file_magic_cmd=$lt_file_magic_cmd
 
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
 # The archiver.
 AR=$lt_AR
+
+# Flags to create an archive.
 AR_FLAGS=$lt_AR_FLAGS
 
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
 # A symbol stripping program.
 STRIP=$lt_STRIP
 
@@ -15201,6 +14785,9 @@ RANLIB=$lt_RANLIB
 old_postinstall_cmds=$lt_old_postinstall_cmds
 old_postuninstall_cmds=$lt_old_postuninstall_cmds
 
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
 # A C compiler.
 LTCC=$lt_CC
 
@@ -15219,14 +14806,14 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
 # Transform the output of nm in a C name address pair when lib prefix is needed.
 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
 
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
 
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
 
-# An echo program that does not interpret backslashes.
-ECHO=$lt_ECHO
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
 
 # Used to examine libraries when file_magic_cmd begins with "file".
 MAGIC_CMD=$MAGIC_CMD
@@ -15234,6 +14821,9 @@ MAGIC_CMD=$MAGIC_CMD
 # Must we lock files when doing compilation?
 need_locks=$lt_need_locks
 
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
 DSYMUTIL=$lt_DSYMUTIL
 
@@ -15290,6 +14880,9 @@ library_names_spec=$lt_library_names_spec
 # The coded name of the library, if different from the real name.
 soname_spec=$lt_soname_spec
 
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
 # Command to use after installation of a shared archive.
 postinstall_cmds=$lt_postinstall_cmds
 
@@ -15329,6 +14922,10 @@ striplib=$lt_striplib
 # The linker used to build libraries.
 LD=$lt_LD
 
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
 # Commands used to build an old-style archive.
 old_archive_cmds=$lt_old_archive_cmds
 
@@ -15341,12 +14938,12 @@ with_gcc=$GCC
 # Compiler flag to turn off builtin functions.
 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
 
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl
-
 # Additional compiler flags for building library objects.
 pic_flag=$lt_lt_prog_compiler_pic
 
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
 # Compiler flag to prevent dynamic linking.
 link_static_flag=$lt_lt_prog_compiler_static
 
@@ -15396,10 +14993,6 @@ no_undefined_flag=$lt_no_undefined_flag
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
 
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
-
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator
 
@@ -15433,9 +15026,6 @@ inherit_rpath=$inherit_rpath
 # Whether libtool must link a program against all its dependency libraries.
 link_all_deplibs=$link_all_deplibs
 
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
-
 # Set to "yes" if exported symbols are required.
 always_export_symbols=$always_export_symbols
 
@@ -15451,6 +15041,9 @@ include_expsyms=$lt_include_expsyms
 # Commands necessary for linking programs (against libraries) with templates.
 prelink_cmds=$lt_prelink_cmds
 
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
 # Specify filename containing input files.
 file_list_spec=$lt_file_list_spec
 
@@ -15483,212 +15076,169 @@ ltmain="$ac_aux_dir/ltmain.sh"
   # if finds mixed CR/LF and LF-only lines.  Since sed operates in
   # text mode, it properly converts lines to CR/LF.  This bash problem
   # is reportedly fixed, but why not run on old versions too?
-  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  case $xsi_shell in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result="${1##*/}"
-}
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-  func_basename_result="${1##*/}"
-}
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-func_stripname ()
-{
-  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-  # positional parameters, so assign one to ordinary parameter first.
-  func_stripname_result=${3}
-  func_stripname_result=${func_stripname_result#"${1}"}
-  func_stripname_result=${func_stripname_result%"${2}"}
-}
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=${1%%=*}
-  func_opt_split_arg=${1#*=}
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  case ${1} in
-    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-    *)    func_lo2o_result=${1} ;;
-  esac
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=${1%.*}.lo
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=$(( $* ))
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=${#1}
-}
-
-_LT_EOF
-    ;;
-  *) # Bourne compatible functions.
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
-
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-  case ${2} in
-    .*) func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
-    *)  func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
-  esac
-}
-
-# sed scripts:
-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
-my_sed_long_arg='1s/^-[^=]*=//'
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
-  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=`expr "$@"`
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
-}
-
-_LT_EOF
-esac
-
-case $lt_shell_append in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1+=\$2"
-}
-_LT_EOF
-    ;;
-  *)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1=\$$1\$2"
-}
-
-_LT_EOF
-    ;;
-  esac
-
-
-  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  mv -f "$cfgfile" "$ofile" ||
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  if test x"$xsi_shell" = xyes; then
+  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\    # positional parameters, so assign one to ordinary parameter first.\
+\    func_stripname_result=${3}\
+\    func_stripname_result=${func_stripname_result#"${1}"}\
+\    func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\    func_split_long_opt_name=${1%%=*}\
+\    func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\    func_split_short_opt_arg=${1#??}\
+\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\    case ${1} in\
+\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\      *)    func_lo2o_result=${1} ;;\
+\    esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+    func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+    func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+    func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+    eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\    func_quote_for_eval "${2}"\
+\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+   mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
 
@@ -15698,15 +15248,12 @@ _LT_EOF
 done # for ac_tag
 
 
-{ (exit 0); exit 0; }
+as_fn_exit 0
 _ACEOF
-chmod +x $CONFIG_STATUS
 ac_clean_files=$ac_clean_files_save
 
 test $ac_write_fail = 0 ||
-  { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
 
 
 # configure is writing to config.log, and then calls config.status.
@@ -15727,10 +15274,10 @@ if test "$no_create" != yes; then
   exec 5>>config.log
   # Use ||, not &&, to avoid exiting from the if with $? = 1, which
   # would make configure fail if this is the last instruction.
-  $ac_cs_success || { (exit 1); exit 1; }
+  $ac_cs_success || as_fn_exit 1
 fi
 if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
-  { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
diff --git a/configure.in b/configure.in
index 74e2d69..e48c066 100644
--- a/configure.in
+++ b/configure.in
@@ -1,9 +1,10 @@
 dnl Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.57)
-AC_INIT(opensm, 3.2.6_20090317, general at lists.openfabrics.org)
+AC_INIT(opensm, 3.3.15, linux-rdma at vger.kernel.org)
 AC_CONFIG_SRCDIR([opensm/osm_opensm.c])
 AC_CONFIG_AUX_DIR(config)
+AC_CONFIG_MACRO_DIR(config)
 AC_CONFIG_HEADERS(include/config.h include/opensm/osm_config.h)
 AM_INIT_AUTOMAKE
 
@@ -196,6 +197,10 @@ AC_DEFINE_UNQUOTED(HAVE_DEFAULT_QOS_POLICY_FILE,
 	[Define a QOS policy config file])
 AC_SUBST(QOS_POLICY_FILE)
 
+dnl For now, this does not need to be configurable
+TORUS2QOS_CONF_FILE=torus-2QoS.conf
+AC_SUBST(TORUS2QOS_CONF_FILE)
+
 dnl Check for a different prefix-routes file
 PREFIX_ROUTES_FILE=prefix-routes.conf
 AC_MSG_CHECKING(for --with-prefix-routes-conf)
@@ -216,6 +221,26 @@ AC_DEFINE_UNQUOTED(HAVE_DEFAULT_PREFIX_ROUTES_FILE,
 	[Define a Prefix Routes config file])
 AC_SUBST(PREFIX_ROUTES_FILE)
 
+dnl Check for a different per-module-logging file
+PER_MOD_LOGGING_FILE=per-module-logging.conf
+AC_MSG_CHECKING(for --with-per-module-logging-conf)
+AC_ARG_WITH(per-module-logging.conf,
+    AC_HELP_STRING([--with-per-module-logging-conf=file],
+                   [define a Per Module Logging config file (default is per-module-logging.conf)]),
+    [ case "$withval" in
+    no)
+        ;;
+    *)
+        PER_MOD_LOGGING_FILE=$withval
+        ;;
+    esac ]
+)
+AC_MSG_RESULT($PER_MOD_LOGGING_FILE)
+AC_DEFINE_UNQUOTED(HAVE_DEFAULT_PER_MOD_LOGGING_FILE,
+        ["$OPENSM_CONFIG_DIR/$PER_MOD_LOGGING_FILE"],
+        [Define a Per Module Logging config file])
+AC_SUBST(PER_MOD_LOGGING_FILE)
+
 dnl select example event plugin or not
 OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL
 
@@ -226,7 +251,7 @@ dnl Checks for headers and libraries
 OPENIB_APP_OSMV_CHECK_HEADER
 OPENIB_APP_OSMV_CHECK_LIB
 
-AC_CONFIG_FILES([man/opensm.8 scripts/opensm.init scripts/redhat-opensm.init scripts/sldd.sh])
+AC_CONFIG_FILES([man/opensm.8 man/torus-2QoS.8 man/torus-2QoS.conf.5 scripts/opensm.init scripts/redhat-opensm.init scripts/sldd.sh])
 
 dnl Create the following Makefiles
 AC_OUTPUT([include/opensm/osm_version.h Makefile include/Makefile complib/Makefile libvendor/Makefile opensm/Makefile osmeventplugin/Makefile osmtest/Makefile opensm.spec])
diff --git a/doc/QoS_management_in_OpenSM.txt b/doc/QoS_management_in_OpenSM.txt
index 8c9915f..c104c1d 100644
--- a/doc/QoS_management_in_OpenSM.txt
+++ b/doc/QoS_management_in_OpenSM.txt
@@ -292,6 +292,9 @@ Match rules include:
  - any ULP/application with a specific Service ID in the PR/MPR query
  - any ULP/application with a specific PKey in the PR/MPR query
  - any ULP/application with a specific target IB port GUID in the PR/MPR query
+ - any ULP/application with a specific source IB port GUID in the PR/MPR query
+ - any ULP/application with a specific source or target IB port GUID in the
+   PR/MPR query
 
 Since any section of the policy file is optional, as long as basic rules of
 the file are kept (such as no referring to nonexisting port group, having
@@ -332,6 +335,12 @@ Below is an example of simplified QoS policy with all the possible keywords:
                                           # a specified IB port GUID
         any, target-port-guid 0x0ABC-0xFFFFF : 6 # match any PR/MPR query with
                                           # a specific target port GUID
+        any, source-port-guid 0x5678  : 7 # match any PR/MPR query with
+                                          # a specific source port
+                                          # GUID
+	any, source-target-port-guid 0x9abcd : 8 # match any PR/MPR query with
+					  # a specific source or target port
+					  # GUID
     end-qos-ulps
 
 
diff --git a/doc/opensm-sriov.txt b/doc/opensm-sriov.txt
new file mode 100644
index 0000000..bbdff48
--- /dev/null
+++ b/doc/opensm-sriov.txt
@@ -0,0 +1,154 @@
+OpenSM SRIOV (Alias GUID) Support
+12/9/11
+
+Overview
+
+In order to support virtualized environments, alias GUID support is added to OpenSM.
+This support allows an SA client to add and remove additional port GUIDs based on
+SubAdmSet/SubAdmDelete of GUIDInfoRecord. A set with a GUID of 0 in a valid GUIDInfoRecord
+index as indicated by the component mask indicates that the additional GUID is to
+be SM assigned. The OpenIB OUI (0x001405), along with a configured byte and a
+pseudorandom number is currently used for this algorithm (which may be changed in the future).
+
+Most SA queries are updated to handle alias GUIDs as part of any GID specified inside
+the query. These include SA path record, multipath record, multicast record, and service record.
+There are only a few SA queries (InformInfoRecord, InformInfo) that are not currently updated
+for alias GUID support.
+
+In terms of the IBA spec, alias GUIDs are termed additional port GUIDs.
+
+
+IBA 1.2.1 Volume 1 Changes for Alias GUID Support
+
+The following are MgtWG WG APPROVED spec changes to IBA 1.2.1 volume 1 relative to this support:
+
+RefID 4704
+15.2.5.18 GUIDInfoRecord p. 932 line 14
+Table 213 GUIDInfoRecord
+
+An entity that wishes to add or remove additional port GUIDs can do so using the SubnAdmSet() and SubnAdmDelete() methods
+with the GUIDInfoRecord attribute. This causes the SM to set the updated GUIDs in the specified port via the SM GUIDInfo attribute.
+
+SubnAdmSet() method is used to add additional port GUIDs. SubnAdmDelete() method is used to remove previously added additional
+port GUIDs.
+
+o15-0.x.y: If SA supports additional port GUIDs, then both SubAdmSet(GUIDInfoRecord) and SubnAdmDelete(GUIDInfoRecord) are
+supported.
+
+o15-0.x.y: If SA supports additional port GUIDs, the component mask for SubAdmSet(GUIDInfoRecord) and
+SubnAdmDelete(GUIDInfoRecord) is required to include both LID and block number. If the component mask does not include both of
+these, SA shall return an error status of ERR_REQ_INSUFFICIENT_COMPONENTS in its response to the corresponding method.
+
+o15-0.x.y: If SA supports additional port GUIDs, for a SubAdmSet(GUIDInfoRecord), the component mask indicates which GUID indices
+are to be set. A GUID can either be added or replaced. A GUID of 0 indicates that the GUID for this index is to be assigned by
+the SM.
+
+o15-0.x.y: If SA supports additional port GUIDs, for a SubAdmDelete(GUIDInfoRecord), the component mask indicates which GUID
+indices are to be removed.
+
+o15-0.x.y: If SA supports additional port GUIDs, the SA shall return an error status of ERR_REQ_INVALID to any attempt to set
+or delete block number 0 index 0.
+
+
+RefID 4705
+p.899 line 26 15.2.4
+Table 188 SA-Specific Optional Capabilities
+
+<add table entry:>
+IsAdditionalGUIDsSupported | CM2 | 5 | If this value is 1, SA shall support the ability to add and remove additional port GUIDs
+                                       via SubAdmSet/SubnAdmDelete(GUIDInfoRecord) as described in
+                                       <ref to 15.2.5.18 GUIDInfoRecord>
+
+
+RefID 4706
+p.904 line 21 15.2.5.1
+Table 192 Subnet Administration Attribute / Method Map
+
+<Add an "X" to the "Set" and "Delete" columns for GUIDInfoRecord>
+<Add footnote "b" to GUIDInfoRecord where footnote "b" is as shown below:>
+b: SubAdmSet and SubAdmDelete of GUIDInfoRecord are supported if SA:ClassPortInfo.CapabilityMask2 indicates
+IsAdditionalGUIDsSupported.
+
+RefID 4714
+Clarify GUID 0 in SA Set GUIDInfoRecord response
+p.932 line 14 15.2.18
+
+<change:>
+o15-0.x.y: If SA supports additional port GUIDs, for a SubAdmSet(GUIDInfoRecord), the component mask indicates which GUID indices
+are to be set. A GUID can either be added or replaced. A GUID of 0 indicates that the GUID for this index is to be assigned by
+the SM.
+
+<to:>
+o15-0.x.y: If SA supports additional port GUIDs, for a SubAdmSet(GUIDInfoRecord), the component mask indicates which GUID indices
+are to be set. A GUID can either be added or replaced. In the request, a GUID of 0 indicates that the GUID for this index is to
+be assigned by the SM. In the response, a GUID of 0 indicates that the GUID requested for this index was not accepted by the SA.
+
+RefID 4776
+SM GUIDInfo initialization
+
+<change:>
+GUIDInfo Description
+
+The requirements for setting additional
+
+GUIDs are beyond the scope of the specification.
+
+
+<to:>
+<none>
+
+
+OpenSM SRIOV Configuration
+
+Some new options were added for SRIOV configuration of OpenSM.
+
+1. Allow both pkeys
+-W or --allow_both_pkeys on the command line or
+allow_both_pkeys TRUE
+in the options file. Default is false.
+
+allow_both_pkeys indicates whether both full and
+limited membership on the same partition is allowed or not.
+
+In order to support allow_both_pkeys, the partition file syntax is
+extended with "both" flag (in addition to "full" and "limited").
+
+defmember=full|limited|both
+or
+[PortGUID[=full|=limited|=both]]
+
+2. SM assigned GUID byte
+sm_assigned_guid
+in the options file. Default is 0.
+
+An SM assigned GUID byte is added as a configuration option
+where an alias GUID is formed from OpenFabrics OUI
+followed by 40 bits xy 00 ab cd ef where xy is the SM assigned guid byte
+and ab cd ef is an SM autogenerated 24 bits.
+
+The SM assigned GUID byte should be configured as subnet unique.
+
+Also, the algorithm to obtain a "unique" SM assigned GUID is changing from
+being based on a static monatomically incrementing counter for the SM
+autogenerated part (like SA MCMemberRecord SM assigned MGIDs).
+The number of retries to find an unused GUID is currently hardcoded at 1000.
+
+Note that it is not a current requirement to maintain SM assigned GUIDs across OpenSM
+failover. Note also that on reregistration, a host may reregister the previously SM
+assigned GUID.
+
+
+Operational Notes
+
+Duplicated alias GUIDs are detected against alias and physical GUIDs and result in
+rejection of such registrations.
+
+When a port is dropped, any alias GUID registrations are removed. These are
+reregistered by client reregistration mechanism. The exception
+to this is service registrations as these are not currently reregistered by
+the ULPs/applications that use them.
+
+Futures
+
+1. An alias GUID enforcement feature to which physical ports are allowed to request which
+alias GUIDs.
diff --git a/doc/opensm_release_notes-3.2.txt b/doc/opensm_release_notes-3.2.txt
deleted file mode 100644
index f530b95..0000000
--- a/doc/opensm_release_notes-3.2.txt
+++ /dev/null
@@ -1,626 +0,0 @@
-                        OpenSM Release Notes 3.2
-                       =============================
-
-Version: OpenSM 3.2.x
-Repo:    git://git.openfabrics.org/~sashak/management.git
-Date:    Mar 2009
-
-1 Overview
-----------
-This document describes the contents of the OpenSM 3.2 release.
-OpenSM is an InfiniBand compliant Subnet Manager and Administration,
-and runs on top of OpenIB. The OpenSM version for this release
-is opensm-3.2.6
-
-This document includes the following sections:
-1 This Overview section (describing new features and software
-  dependencies)
-2 Known Issues And Limitations
-3 Unsupported IB compliance statements
-4 Bug Fixes
-5 Main Verification Flows
-6 Qualified Software Stacks and Devices
-
-1.1 Major New Features
-
-* Cached Routing
-  OpenSM provides an optional unicast routing cache (enabled by '-A' or
-  '--ucast_cache' options). When enabled, unicast routing cache prevents
-  routing recalculation (which is a heavy task in a large cluster) when
-  there was no topology change detected during the heavy sweep, or when
-  the topology change does not require new routing calculation, e.g. when
-  one or more CAs/RTRs/leaf switches going down, or one or more of these
-  nodes coming back after being down.
-
-* Routing Chaining
-  Routing chaining is the ability to configure the order in which routing
-  algorithms are applied in opensm, i.e. '-R ftree,updn,minhop' - try
-  using ftree routing. If ftree fails, try updn. If updn fails, try
-  minhop.
-
-* IPv6 Solicited Node Multicast addresses consolidation
-  When this mode is used (enabled with --consolidate_ipv6_snm_req option)
-  OpenSM will map all IPv6 Solicited Node Multicast address join requests
-  into a single Multicast group with address ff10:601b::1:ff00:0. In this
-  way limited MLID space is saved. This IBA noncompliant feature is very
-  useful with large (~> 1024 nodes) clusters.
-
-* OpenSM sweep state machine rework
-  Huge and buggy OpenSM sweep state machine was fully rewritten in safer
-  and more effective synchronous manner.
-
-* Multi lid routing balancing for updn/minhop routing algorithms
-  When LMC > 0 is used OpenSM will ensure to generate routing paths via
-  different switches and when possible chassis.
-
-* Preserve base lid routes when LMC > 0
-  When LMC > 0 is used OpenSM will preserve routing paths for base lids
-  as it would be with LMC = 0. In this way traffic on each LID level is
-  not affected by LMC changes.
-
-* Ordered routing paths balancing
-  This adds ability to predefine the port order in which routing paths
-  balancing is performed by OpenSM. Helps to improve performance
-  dramatically (40-50%) for applications with known communication
-  pattern. Activated with --guid_routing_order_file command line option.
-
-* Unified OpenSM configuration
-  Now there is "conventional" config file instead of hidden option cache
-  file (opensm.opts). OpenSM will find this in a default place (consult
-  man page for exact value) or the file name can be specified with '-F'
-  command line option. Also there is an option ('-c') to generate config
-  file template.
-
-* Query remote SMs during light sweep
-  Master OpenSM will query remote standby SMs periodically to catch its
-  possible state changes and react accordingly (as required by IBA spec).
-
-* Predefined port ids for Up/Down algorithm
-  This is useful as Up/Down fine tuning tool - the algorithm will use
-  predefined port IDs instead of GUIDs for its decision about direction.
-  Activated with --ids_guid_file command line option.
-
-* Improved plugin API version 2.
-  Now OpenSM will provide to plugins the access to all data structures.
-  This make it possible to implement powerful multi purpose plugins. All
-  OpenSM header files are installed now and specific configuration/build
-  options are exported via generated osm_config.h header file.
-
-* Many code improvements, optimizations and cleanups
-
-* Automatic daily snapshots generation.
-  This is is not a "feature", but simplifies the access to recent OpenSM
-  bits.
-
-1.2 Minor New Features:
-
-* Cleanup cl_qlock_pool memory allocator - speedup memory allocations
-
-* Support for configurable (via OSM_UMAD_MAX_PENDING environment variable)
-  size of pending MADs pool.
-
-* Set packet life time to subnet timeout option rather than default
-
-* Enforce routing paths rebalancing on switch reconnection
-
-* In Up/Down routing algorithm compare GUID values in host byte order
-
-* Add 'switchbalance' and 'lidbalance' commands for OpenSM console
-
-* Respond to new trap 144 node description update flag
-
-* Add '--connect_roots' command line options. This preserves connectivity
-  between root nodes in Up/Down routing algorithm
-
-* Setting SL in the IPoIB MCast groups in accordance with QoS policy
-
-* Dump auto detected root node guids in Up/Down routing algorithm
-
-* Unify OpenSM dumpers code
-
-* Unify various guid files parsers - add generic nodenamemap style parser
-
-* When root node guids were provided in file update the list on each
-  Up/Down run
-
-* During ./configure show values of configuration dirs and files
-
-* Make prefix routes config file name configurable
-
-* Add a Performance Manager HOWTO to the docs and the dist
-
-* Support separate SA and SM keys as clarified in IBA 1.2.1
-
-* Remove AM_MAINTAINER_MODE in ./configure
-
-* Make vendor type OSM_VENDOR_INTF_OPENIB (libibumad) to be default
-
-* Build osm_perfmgr_db.* content only when PerfMgr is enabled.
-
-* Move PerfMgr event_db_dump_file to common OpenSM dump dir
-
-* Allow space separated strings as values in OpenSM config
-
-* Support for multiple event plugins
-
-* Add '--version' command line option
-
-* Add '--create-config <file-name>' command line option
-
-* Speedup and simplify logging code
-
-* Speedup multicast processing in SA DB
-
-* In log messages convert unicast LIDs from hex to decimal format and
-  GIDs from hex to IPv6 address format
-
-* Handle all possible ports in "ignore-guids" file
-
-* Add 'reroute' console command
-
-* Remove many install-exec-hook from Makefiles
-
-* Some cleanups in LASH routing algorithm code
-
-* In Makefiles remove -rpath and explicit -lpthread, -ldl from LDFLAGS
-  (move to configurator)
-
-* Install all OpenSM header files
-
-* Improve locking in SM Info receiver
-
-* Add new OSM_EVENT_ID_SUBNET_UP event for plugins
-
-* Redo lex and yacc files generation in conventional way
-
-* Add a missing Node Description check on light sweep.
-
-* Move vendor specific compilation defines from command to generated
-  config.h file
-
-* Provide useful error message when log file opening fails
-
-* Add generated osm_config.h file with OpenSM specific defines
-
-* Display port number in decimal in log messages
-
-* Replace osm_vendor_select.h by generated osm_config.h
-
-* Unify options listing in OpenSM usage message
-
-* LFT buffers handling simplification
-
-* Add 'dump_conf' console command
-
-* OpenSM performs sweep on SIGCONT (coming out of suspend).
-
-* When our SM is in Standby state and its priority is increased
-  (via console command), notify master SM by sending Trap 144.
-
-* When entering standby state (after discovery) notify master SM
-  with Trap 144.
-
-* support more PortInfo:CapabilityMask bits
-
-* When babbling port policy is on disable the port with the least hop
-  count.
-
-1.3 Library API Changes
-
-  None
-
-1.4 Software Dependencies
-
-OpenSM depends on the installation of either OFED 1.x, OpenIB gen2 (e.g.
-IBG2 distribution), OpenIB gen1 (e.g. IBGD distribution), or Mellanox
-VAPI stacks. The qualified driver versions are provided in Table 2,
-"Qualified IB Stacks".
-
-Also, building of QoS manager policy file parser requires flex, and either
-bison or byacc installed.
-
-1.5 Supported Devices Firmware
-
-The main task of OpenSM is to initialize InfiniBand devices. The
-qualified devices and their corresponding firmware versions
-are listed in Table 3.
-
-2 Known Issues And Limitations
-------------------------------
-
-* No Service / Key associations:
-  There is no way to manage Service access by Keys.
-
-* No SM to SM SMDB synchronization:
-  Puts the burden of re-registering services, multicast groups, and
-  inform-info on the client application (or IB access layer core).
-
-3 Unsupported IB Compliance Statements
---------------------------------------
-The following section lists all the IB compliance statements which
-OpenSM does not support. Please refer to the IB specification for detailed
-information regarding each compliance statement.
-
-* C14-22 (Authentication):
-  M_Key M_KeyProtectBits and M_KeyLeasePeriod shall be set in one
-  SubnSet method. As a work-around, an OpenSM option is provided for
-  defining the protect bits.
-
-* C14-67 (Authentication):
-  On SubnGet(SMInfo) and SubnSet(SMInfo) - if M_Key is not zero then
-  the SM shall generate a SubnGetResp if the M_Key matches, or
-  silently drop the packet if M_Key does not match.
-
-* C15-0.1.23.4 (Authentication):
-  InformInfoRecords shall always be provided with the QPN set to 0,
-  except for the case of a trusted request, in which case the actual
-  subscriber QPN shall be returned.
-
-* o13-17.1.2 (Event-FWD):
-  If no permission to forward, the subscription should be removed and
-  no further forwarding should occur.
-
-* C14-24.1.1.5 and C14-62.1.1.22 (Initialization):
-  GUIDInfo - SM should enable assigning Port GUIDInfo.
-
-* C14-44 (Initialization):
-  If the SM discovers that it is missing an M_Key to update CA/RT/SW,
-  it should notify the higher level.
-
-* C14-62.1.1.12 (Initialization):
-  PortInfo:M_Key - Set the M_Key to a node based random value.
-
-* C14-62.1.1.13 (Initialization):
-  PortInfo:P_KeyProtectBits - set according to an optional policy.
-
-* C14-62.1.1.24 (Initialization):
-  SwitchInfo:DefaultPort - should be configured for random FDB.
-
-* C14-62.1.1.32 (Initialization):
-  RandomForwardingTable should be configured.
-
-* o15-0.1.12 (Multicast):
-  If the JoinState is SendOnlyNonMember = 1 (only), then the endport
-  should join as sender only.
-
-* o15-0.1.8 (Multicast):
-  If a request for creating an MCG with fields that cannot be met,
-  return ERR_REQ_INVALID (currently ignores SL and FlowLabelTClass).
-
-* C15-0.1.8.6 (SA-Query):
-  Respond to SubnAdmGetTraceTable - this is an optional attribute.
-
-* C15-0.1.13 Services:
-  Reject ServiceRecord create, modify or delete if the given
-  ServiceP_Key does not match the one included in the ServiceGID port
-  and the port that sent the request.
-
-* C15-0.1.14 (Services):
-  Provide means to associate service name and ServiceKeys.
-
-4 Bug Fixes
------------
-
-4.1 Major Bug Fixes
-
-* Set SA attribute offset to 0 when no records are returned
-
-* Send trap 64 only after new ports are in ACTIVE state.
-
-* Fix in sending client reregistration bit
-
-* Fix default OpenSM SM (and SA) Key byte order
-
-* Fix in sending Multicast groups creation/deletion notification (Traps
-  66,67)
-
-* Don't startup automatically on SuSE based systems
-
-* Discovery bug, where some ports were leaved unlinked (without remote side).
-
-4.2 Other Bug Fixes
-
-* opensm/osm_console.c: fix seg fault when running "portstatus ca" in
-  the console
-
-* opensm: fix potential core dumps where osm_node_get_physp_ptr can
-  return NULL
-
-* opensm/osm_mcast_mgr: limit spanning tree creation recursion to value
-  of max hops (64)
-
-* opensm: switch LFTs incremental update fix
-
-* opensm/osm_state_mgr.c: fix segmentation fault
-
-* opensm: eliminate some potential NULL pointer dereferences
-
-* opensm/osm_console.c: fix guid parsing
-
-* opensm: fix off by 1 issue with max_lid and max_multicat_lid_ho
-
-* opensm: fix potentially wrong port_guid initialization
-
-* opensm/configure.in: fix wrong HAVE_DEFAULT_OPENSM_CONFIG_FILE define
-  generation
-
-* opensm: fix snprintf() usage
-
-* opensm/osm_sa_lft_record: validate LFT block number
-
-* opensm/osm_sa_lft_record: pass block parameter in host byte order
-
-* opensm/include/Makefile.am: don't duplicate header files in EXTRA_DIST
-
-* opensm/osm_sa_class_port_info.c: fix over bound array access
-
-* osmtest/osmt_service.c: fix over bound array access
-
-* osmtest: fix qpn encoding in osmtest_informinfo_request()
-
-* opensm/osm_vendor_mlx_sa.c: handling attribute offset of 0
-
-* opensm: fix segfault corner case when osm_console_init fails
-
-* opensm/console: close console socket on cleanup path
-
-* opensm/osm_ucast_lash: fix buffer overflow
-
-* opensm: fix broken IPv6 SNM consolidation code
-
-* opensm/osm_sa_lft_record.c: fix block number encoding byte order
-
-* opensm/osm_sa: fix memory leak in SA responder
-
-* opensm/osm_mcast_mgr: fix memory leak
-
-* opensm: fix qos config parsing bugs
-
-* opensm/osm_mcast_tbl.c: fix sending invalid MF block due to max mlid
-  overflow
-
-* opensm: log_max_size config parameter in MB
-
-* opensm/osm_ucast_lash: fix extra memory allocations
-
-* opensm: fix race in main OpenSM flow
-
-* opensm/ftree: fix GUID check against cn_guid_file
-
-* opensm/ftree: save FLT buffers memory allocations
-
-* opensm/osm_sa_link_record.c: prevent potential endless recursion
-
-* opensm: remove SM from sm_guid_tbl when IsSM port capability flag is
-  not set
-
-* opensm: fix QoS config bug
-
-* opensm: don't reassign zeroed params from config file
-
-* opensm: update LFTs when entering master
-
-* opensm: invalidate routing cache when entering master state
-
-* opensm/osm_port_info_rcv.c: don't clear sw->need_update if port 0 is active
-
-* Other less critical or visible bugs were also fixed.
-
-5 Main Verification Flows
--------------------------
-
-OpenSM verification is run using the following activities:
-* osmtest - a stand-alone program
-* ibmgtsim (IB management simulator) based - a set of flows that
-  simulate clusters, inject errors and verify OpenSM capability to
-  respond and bring up the network correctly.
-* small cluster regression testing - where the SM is used on back to
-  back or single switch configurations. The regression includes
-  multiple OpenSM dedicated tests.
-* cluster testing - when we run OpenSM to setup a large cluster, perform
-  hand-off, reboots and reconnects, verify routing correctness and SA
-  responsiveness at the ULP level (IPoIB and SDP).
-
-5.1 osmtest
-
-osmtest is an automated verification tool used for OpenSM
-testing. Its verification flows are described by list below.
-
-* Inventory File: Obtain and verify all port info, node info, link and path
-  records parameters.
-
-* Service Record:
-   - Register new service
-   - Register another service (with a lease period)
-   - Register another service (with service p_key set to zero)
-   - Get all services by name
-   - Delete the first service
-   - Delete the third service
-   - Added bad flows of get/delete  non valid service
-   - Add / Get same service with different data
-   - Add / Get / Delete by different component  mask values (services
-     by Name & Key / Name & Data / Name & Id / Id only )
-
-* Multicast Member Record:
-   - Query of existing Groups (IPoIB)
-   - BAD Join with insufficient comp mask (o15.0.1.3)
-   - Create given MGID=0 (o15.0.1.4)
-   - Create given MGID=0xFF12A01C,FE800000,00000000,12345678 (o15.0.1.4)
-   - Create BAD MGID=0xFA. (o15.0.1.6)
-   - Create BAD MGID=0xFF12A01B w/ link-local not set (o15.0.1.6)
-   - New MGID with invalid join state (o15.0.1.9)
-   - Retry of existing MGID - See JoinState update (o15.0.1.11)
-   - BAD RATE when connecting to existing MGID (o15.0.1.13)
-   - Partial JoinState delete request - removing FullMember (o15.0.1.14)
-   - Full Delete of a group (o15.0.1.14)
-   - Verify Delete by trying to Join deleted group (o15.0.1.14)
-   - BAD Delete of IPoIB membership (no prev join) (o15.0.1.15)
-
-* GUIDInfo Record:
-   - All GUIDInfoRecords in subnet are obtained
-
-* MultiPathRecord:
-   - Perform some compliant and noncompliant MultiPathRecord requests
-   - Validation is via status in responses and IB analyzer
-
-* PKeyTableRecord:
-  - Perform some compliant and noncompliant PKeyTableRecord queries
-  - Validation is via status in responses and IB analyzer
-
-* LinearForwardingTableRecord:
-  - Perform some compliant and noncompliant LinearForwardingTableRecord queries
-  - Validation is via status in responses and IB analyzer
-
-* Event Forwarding: Register for trap forwarding using reports
-   - Send a trap and wait for report
-   - Unregister non-existing
-
-* Trap 64/65 Flow: Register to Trap 64-65, create traps (by
-  disconnecting/connecting ports) and wait for report, then unregister.
-
-* Stress Test: send PortInfoRecord queries, both single and RMPP and
-  check for the rate of responses as well as their validity.
-
-
-5.2 IB Management Simulator OpenSM Test Flows:
-
-The simulator provides ability to simulate the SM handling of virtual
-topologies that are not limited to actual lab equipment availability.
-OpenSM was simulated to bring up clusters of up to 10,000 nodes. Daily
-regressions use smaller (16 and 128 nodes clusters).
-
-The following test flows are run on the IB management simulator:
-
-* Stability:
-  Up to 12 links from the fabric are randomly selected to drop packets
-  at drop rates up to 90%. The SM is required to succeed in bringing the
-  fabric up. The resulting routing is verified to be correct as well.
-
-* LID Manager:
-  Using LMC = 2 the fabric is initialized with LIDs. Faults such as
-  zero LID, Duplicated LID, non-aligned (to LMC) LIDs are
-  randomly assigned to various nodes and other errors are randomly
-  output to the guid2lid cache file. The SM sweep is run 5 times and
-  after each iteration a complete verification is made to ensure that all
-  LIDs that could possibly be maintained are kept, as well as that all nodes
-  were assigned a legal LID range.
-
-* Multicast Routing:
-  Nodes randomly join the 0xc000 group and eventually the
-  resulting routing is verified for completeness and adherence to
-  Up/Down routing rules.
-
-* osmtest:
-  The complete osmtest flow as described in the previous table is run on
-  the simulated fabrics.
-
-* Stress Test:
-  This flow merges fabric, LID and stability issues with continuous
-  PathRecord, ServiceRecord and Multicast Join/Leave activity to
-  stress the SM/SA during continuous sweeps. InformInfo Set/Delete/Get
-  were added to the test such both existing and non existing nodes
-  perform them in random order.
-
-5.3 OpenSM Regression
-
-Using a back-to-back or single switch connection, the following set of
-tests is run nightly on the stacks described in table 2. The included
-tests are:
-
-* Stress Testing: Flood the SA with queries from multiple channel
-  adapters to check the robustness of the entire stack up to the SA.
-
-* Dynamic Changes: Dynamic Topology changes, through randomly
-  dropping SMP packets, used to test OpenSM adaptation to an unstable
-  network & verify DB correctness.
-
-* Trap Injection: This flow injects traps to the SM and verifies that it
-  handles them gracefully.
-
-* SA Query Test: This test exhaustively checks the SA responses to all
-  possible single component mask. To do that the test examines the
-  entire set of records the SA can provide, classifies them by their
-  field values and then selects every field (using component mask and a
-  value) and verifies that the response matches the expected set of records.
-  A random selection using multiple component mask bits is also performed.
-
-5.4 Cluster testing:
-
-Cluster testing is usually run before a distribution release. It
-involves real hardware setups of 16 to 32 nodes (or more if a beta site
-is available). Each test is validated by running all-to-all ping through the IB
-interface. The test procedure includes:
-
-* Cluster bringup
-
-* Hand-off between 2 or 3 SM's while performing:
-  - Node reboots
-  - Switch power cycles (disconnecting the SM's)
-
-* Unresponsive port detection and recovery
-
-* osmtest from multiple nodes
-
-* Trap injection and recovery
-
-
-6 Qualified Software Stacks and Devices
----------------------------------------
-
-OpenSM Compatibility
---------------------
-Note that OpenSM version 3.2.1 and earlier used a value of 1 in host
-byte order for the default SM_Key, so there is a compatibility issue
-with these earlier versions of OpenSM when the 3.2.2 or later version
-is running on a little endian machine. This affects SM handover as well
-as SA queries (saquery tool in infiniband-diags).
-
-
-Table 2 - Qualified IB Stacks
-=============================
-
-Stack                                    | Version
------------------------------------------|--------------------------
-OFED                                     |   1.4
-OFED                                     |   1.3
-OFED                                     |   1.2
-OFED                                     |   1.1
-OFED                                     |   1.0
-OpenIB Gen2 (IBG2 distribution)          |   1.0
-OpenIB Gen1 (IBGD distribution)          |   1.8.0
-VAPI (Mellanox InfiniBand HCA Driver)    |   3.2 and later
-
-Table 3 - Qualified Devices and Corresponding Firmware
-======================================================
-
-Mellanox
-Device                              |   FW versions
-------------------------------------|-------------------------------
-InfiniScale                         | fw-43132  5.2.000 (and later)
-InfiniScale III                     | fw-47396  0.5.000 (and later)
-InfiniScale IV                      | fw-48436  7.1.000 (and later)
-InfiniHost                          | fw-23108  3.5.000 (and later)
-InfiniHost III Lx                   | fw-25204  1.2.000 (and later)
-InfiniHost III Ex (InfiniHost Mode) | fw-25208  4.8.200 (and later)
-InfiniHost III Ex (MemFree Mode)    | fw-25218  5.3.000 (and later)
-ConnectX IB                         | fw-25408  2.3.000 (and later)
-
-QLogic/PathScale
-Device  |   Note
---------|-----------------------------------------------------------
-iPath   | QHT6040 (PathScale InfiniPath HT-460)
-iPath   | QHT6140 (PathScale InfiniPath HT-465)
-iPath   | QLE6140 (PathScale InfiniPath PE-880)
-iPath   | QLE7240
-iPath   | QLE7280
-
-Note 1: OpenSM does not run on an IBM Galaxy (eHCA) as it does not expose
-QP0 and QP1. However, it does support it as a device on the subnet.
-
-Note 2: QoS firmware and Mellanox devices
-
-HCAs: QoS supported by ConnectX. QoS-enabled FW release is 2_5_000 and
-later.
-
-Switches: QoS supported by InfiniScale III
-Any InfiniScale III FW that is supported by OpenSM supports QoS.
diff --git a/doc/opensm_release_notes-3.3.txt b/doc/opensm_release_notes-3.3.txt
new file mode 100644
index 0000000..6440c51
--- /dev/null
+++ b/doc/opensm_release_notes-3.3.txt
@@ -0,0 +1,1164 @@
+                        OpenSM Release Notes 3.3
+                       =============================
+
+Version: OpenSM 3.3.x
+Repo:    git://git.openfabrics.org/~alexnetes/opensm.git
+Date:    Aug 2012
+
+1 Overview
+----------
+This document describes the contents of the OpenSM 3.3 release.
+OpenSM is an InfiniBand compliant Subnet Manager and Administration,
+and runs on top of OpenIB. The OpenSM version for this release
+is opensm-3.3.15.
+
+This document includes the following sections:
+1 This Overview section (describing new features and software
+  dependencies)
+2 Known Issues And Limitations
+3 Unsupported IB compliance statements
+4 Bug Fixes
+5 Main Verification Flows
+6 Qualified Software Stacks and Devices
+
+1.1 Major New Features
+
+* Mesh Analysis for LASH routing algorithm.
+  The performance of LASH can be improved by preconditioning the mesh in
+  cases where there are multiple links connecting switches and also in
+  cases where the switches are not cabled consistently.
+  Activated with --do_mesh_analysis command line and config file option.
+
+* Reloadable OpenSM configuration (preliminary implemented)
+  This is possible now to reload OpenSM configuration parameters on the
+  fly without restarting.
+
+* Routing paths sorted balancing (for UpDown and MinHops)
+  This sorts the port order in which routing paths balancing is performed
+  by OpenSM. Helps to improve performance dramatically (40-50%) for most
+  popular application communication patterns.
+  To overwrite this behavior use --guid_routing_order_file command line
+  option.
+
+* Weighted Lid Matrices calculation (for UpDown, MinHop and DOR).
+  This low level routing fine-tuning feature provides the means to
+  define a weighting factor per port for customizing the least weight
+  hops for the routing. Custom weights are provided using file specified
+  with '--hop_weights_file' command line option.
+
+* I/O nodes connectivity (for FatTree).
+  This provides possibility to define the set of I/O nodes for the
+  Fat-Tree routing algorithm. I/O nodes are non-CN nodes allowed to use
+  up to N (specified using --max_reverse_hops) switches the wrong way
+  around to improve connectivity. I/O nodes list is provided using file
+  and --io_guid_file command line option.
+
+* MGID to MLID compression - infrastructure for many MGIDs to single MLID
+  compression. This becomes helpful when number of multicast groups
+  exceeds subnet's MLID routing capability (normally 1024 groups). In such
+  cases many multicast groups (MGID) can be routed using same MLID value.
+
+* Torus-2QoS unicast routing algorithm - a DOR-based routing algorithm
+  specialized for 2D/3D torus topologies. Torus-2QoS provides deadlock-free
+  routing while supporting two quality of service (QoS) levels. In addition
+  it is able to route around multiple failed fabric links or a single failed
+  fabric switch without introducing deadlocks, and without changing path SL
+  values granted before the failure.
+
+* DNUP Unicast routing algorithm - similar to UPDN but allows routing in
+  fabrics which have some CA nodes attached closer to the roots than some
+  switch nodes.
+
+* SSSP Unicast routing algorithm - SSSP unicast routing algorithm - a
+  single-source-shortest-path routing algorithm, which globally balances the
+  number of routes per link to optimize link utilization. This routing
+  algorithm has no restrictions in terms of the underlying topology.
+
+* DFSSSP unicast routing algorithm - a deadlock-free single-source-
+  shortest-path routing, which uses the SSSP algorithm as the base to optimize
+  link utilization and uses Infiniband virtual lanes (SL) to provide deadlock-
+  freedom.
+
+* SRIOV (Alias GUID) Support - In order to support virtualized environments,
+  alias GUID support is added to OpenSM. This support allows an SA client to
+  add and remove additional port GUIDs based on SubAdmSet/SubAdmDelete of
+  GUIDInfoRecord.
+
+* Extended speed support
+  This provides support for FDR and EDR speeds.
+
+* Congestion control support
+
+* Many code improvements, optimizations and cleanups.
+
+* Windows support (early stage).
+
+1.2 Minor New Features:
+
+7e6bdef opensm/man/opensm.8.in: Add section for MKey support
+aebe678 opensm: Add support for multicast service records
+5509234 opensm/scripts/sldd.sh: Update to support guid2mkey/neighbors
+2ae1477 opensm: Ensure sweep interval/mkey lease are sensibly set
+cefe79b opensm: Check for valid mkey protection level in config file
+8fa0d2c opensm: Add neighboring link cache file
+5088d08 opensm: Log errors on SubnGet timeouts
+9eed9c6 opensm: Add support for setting mkey protection levels
+5c4157d opensm: Add locking where necessary around osm_req_*
+2f74f34 opensm: Allow recovery of subnets with misset mkeys
+e5dc557 opensm: Add guid2mkey cache file support
+3659b37 opensm/osm_sa_class_port_info.c: Indicate support for PortInfo CapMask2
+	matching in SA ClassPortInfo:CapabilityMask2
+8016d3b opensm/osm_base.h: Add some SA ClassPortInfo CapabilityMask2 bits
+1a31c44 opensm/osm_perfmgr.c: Use non conflicting error codes in log messages
+03a75d0 opensm/osm_sa_path_record.c: Restore osm_get_path_params functionality
+a9340cf opensm: Support (null) being specified for per_module_logging_file
+	option
+00375aa opensm/osm_perfmgr.c: Eliminate compile warning
+7868c98 opensm: Remove unused per_module_logging option
+49c460b Call drop manager before checking for other Master SM in the fabric
+c0604f3 Increase p_port->discovery_count only when received PortInfo for port 0
+	of the switch
+24b30d2 opensm/osm_node_info_rcv.c: Handle non-compliant SMA gracefully
+a4f2689 opensm/osm_vendor_ibumad: Add management class into match criteria
+4be6375 opensm/osm_sa*.c: Log requester port GUID at DEBUG level
+4cca51d opensm/osm_sa_mcmember_record.c: Log requester port GUID at DEBUG level
+15b3eae opensm/osm_sa_path_record.c: Log requester port GUID at DEBUG level
+0b580ca opensm/osm_sa_path_record.c: Add debug logging to
+	pr_match_mgrp_attributes
+ed4b7fb opensm/osm_sa_mcmember_record.c: In mcmr_rcv_join_mgrp, add MGID to log
+	message
+872dae4 opensm/osm_sa_mcmember_record.c: Dump MCMemberRecord in mcmr_query_mgrp
+71f2ce7 Sending SL2VL and VLARB SET MADs in distributed manner
+f07bcc1 opensm/osm_subnet.c: Cosmetic formatting change
+c823a5b opensm/osm_link_mgr.c: Set PortInfo:PortState to LinkDown when remote
+	port isn't accessible
+ab88df6 Add support to reread configuration file when stacked in rediscovery
+	loop.
+67c9bae opensm: Move per_mod_log_tbl array from subn to log structure
+2cbd9f5 opensm/cl_atomic_osd.h: Cosmetic formatting change
+cd63dec opensm/osm_helper.c: Add CapabilityMask2 to notice dump for trap 144
+9205812 opensm/ib_types.h: Add CapabilityMask2 to notice for trap 144
+25de706 opensm/osm_sa_path_record.c: Add missing end-of-line in the log message
+3551530 opensm/osm_trap_rcv.c: Remove vestigial comment
+067d217 opensm/osm_inform.c: Make log message format consistent for error
+	messages
+759b82a opensm/osm_trap_rcv.c: Add better logging for traps 257 and 258
+b806657 opensm/osm_sa_mad_ctrl.c: Eliminate commented out code line
+a851693 opensm/perfmgr: add logging of error counters
+52fa659 opensm/console: add perfmgr "print_errors" (pe) console command.
+a832ce2 opensm/console: Add human readable output for perfmgr data counters
+77a1756 opensm/console: add abreviations for perfmgr commands
+aca9a07 opensm/console; add port option to perfmgr print_counters
+00628cc opensm/console: add "print all" to print_counters console command
+f5de9b5 opensm: perfmgr mark inactive nodes in perfmgr db
+ff06340 opensm: perfmgr delete "inactive" nodes from the DB
+059d8f4 opensm/console: protect against 0 entered for the perfmgr sweep_time
+cc86607 opensm/perfmgr: Add config option to ignore Channel Adapters.
+91f0c00 opensm/osm_node_info_rcv.c: In ni_rcv_process_existing_ca_or_router,
+	handle error
+c930a23 opensm/osm_subnet.c: Indicate lmc and lmc_esp0 are not changeable
+	"on the fly"
+7825e67 opensm/libopensm.map: Removed unimplemented routine
+7de7b04 opensm/main.c: Handle daemon mode with guid specified as 0 more
+	gracefully
+9478fbf opensm/osm_subnet.c: Support MLNX ExtendedPortInfo for ConnectIB device
+f8fc334 opensm/osm_node_info_rec.c: Also handle non compliant SMA in
+	ni_rcv_process_existing
+b4a481d opensm: Eliminate unneeded field in DR path structure
+01bc8c9 opensm/osm_state_mgr.c: Force subn->need_update when coming out of
+	STANDBY
+276be8b opensm: Dump info functions update for per module logging
+64b512a opensm/osm_vendor_ibumad.c: Make binding log message clearer
+e70c8c1 opensm: Add enum for FILE_ID for per module logging
+2a2db8c opensm: Add per module logging support
+e21b106 opensm: Cosmetic changes
+3ddb2e3 opensm: Add partition manager configuration doc to docs
+9586649 opensm/opensm_release_notes-3.3.txt: Update Unsupported IB Compliance
+	Statements
+826b5c4 opensm/osm_ucast_dfsssp.c: Use osm_log_is_active
+b2cad9d opensm/complib/cl_fleximap.h: Cosmetic changes
+322a310 opensm/osm_ucast_ftree.c: Add a couple of asserts
+e3a946d opensm: Add FDR10 support
+6cea3df opensm/osm_sa_portinfo_record.c: Add SA PortInfoRecord support
+	for CapabilityMask2 matching
+9ac7eeb opensm: Add infrastructure support for CapabilityMask2 field in
+	PortInfo
+8bc7c30 opensm: make loopback console compile on by default.
+566b462 opensm/ib_types.h: Update SA PortInfoRecord component masks
+480de4a opensm: Use forward extensible and safer way to compare mkey_lmc
+	field in PortInfo attribute
+22ca966 opensm: enable perfmgr build by default
+4250c59 opensm: perfmgr only run sweep timer when enabled
+1810672 Support scatter ports
+dd21107 Support port shifting
+1c2a298 OpenSM torus routing order list
+b92d21f opensm: Create all directories in database path on Windows
+83b6752 opensm/osm_subnet.c: In osm_subn_destroy, delete service records
+0fc8124 opensm: Add OSM_VENDOR_ID_OPENIB support
+c0d8b56 opensm/osm_sa_node_record.c: In nr_rcv_create_nr, only set some
+	variables when needed
+9acaba0 opensm/osm_helper.c: Add some missing fields to
+	osm_dump_portinfo_record
+8a43aea Allow comma in plugin names parsing
+cdf227c opensm: Proper mfttop initialization when starting/restarting
+cde0c0d opensm: Convert remaining helper routines for GID printing format
+bc5743c opensm: Add support for MaxCreditHint and LinkRoundTripLatency to
+	osm_dump_port_info
+6cd34ab opensm: Add Dell to known vendor list
+003d6bd opensm: Add more info for traps 144 and 256-259 in osm_dump_notice
+5b0c5de opensm/osm_ucat_ftree.c Enhance min hops counters usage
+0715b92 ib_types.h: Add ib_switch_info_get_state_opt_sl2vlmapping routine
+2ddba79 opensm: Remove some __ and __osm_ prefixes
+ea0691f opensm/iba/ib_types.h: Add PortXmit/RcvDataSL PerfMgt attributes
+9c79be5 ib_types.h: Adding BKEY violation trap (259)
+c608ea6 opensm: Add and utilize ib_gid_is_notzero routine
+b639e64 opensm: Handle trap repress on trap 144 generation
+b034205 Add pkey table support to osm_get_all_port_attr
+876605b opensm/ib_types.h: Add attribute ID for PortCountersExtended
+aae3bbc opensm: PortInfo requests for discovered switches
+0147b09 opensm/osm_lid_mgr: use single array for used_lids
+a9225b0 opensm/Makefile.am: remove osm_build_id.h junk file generation
+8e3a57d opensm/osm_console.c: Add list of SMs to status command
+3d664b9 opensm/osm_console.c : Added dump_portguid function to console to
+	generate a list of port guids matching one or more regexps
+85b35bc opensm/osm_helper.c: print port number as decimal
+8674cb7 opensm: sort port order for routing by switch loads
+80c0d48 opensm: rescan config file even in standby
+8b7aa5e opensm/osm_subnet.c enable log_max_size opt update
+8558ee5 opensm/include/iba/ib_types.h: Add xmit_wait for PortCounters
+ecde2f7 opensm/osm_subnet.c support subnet configuration rescan and update
+58c45e4 opensm/osm_log.c save log_max_size in subnet opt in MB
+cf88e93 opensm: Add new partition keyword for all hca, switches and routers
+4bfd4e0 opensm: remove libibcommon build dependencies
+3718fc4 opensm/event_plugin: link opensm with -rdynamic flag
+587ce14 opensm/osm_inform.c report IB traps to plugin
+ced5a6e opensm/opensm/osm_console.c: move reporting of plugins to "status"
+	command.
+696aca2 opensm: Add configurable retries for transactions
+0d932ff opensm/osm_sa_mcmember_record.c: optimization in zero mgid comparison
+254c2ef opensm/osm_sm_mad_ctrl.c: In sm_mad_ctrl_send_err_cb, set init
+	failure on PKeyTable and QoS initialization failure
+83bd10a opensm: Reduce heap consumption by multicast routing tables (MFTs)
+cd33bc5 opensm: Add some additional HP vendor IDs/OUIs
+f78ec3a opensm/osm_mcast_tbl.(h c): Make max_mlid_ho be maximum MLID configured
+2d13530 opensm: Add infrastructure support for PortInfo
+	IsMulticastPkeyTrapSuppressionSupported
+3ace760 opensm: Reduce heap consumption by unicast routing tables (LFTs)
+eec568e osmtest: Add SA get PathRecord stress test
+aabc476 opensm: Add infrastructure support for more newly allocated PortInfo
+	CapabilityMask bits
+c83c331 opensm: improve multicast re-routing requests processing
+46db92f opensm: Parallelize (Stripe) MFT sets across switches
+00c6a6e opensm: Parallelize (Stripe) LFT sets across switches
+e21c651 opensm/osm_base.h: Add new SA ClassPortInfo:CapabilityMask2 bit
+	allocations
+09056b1 opensm/ib_types.h: Add CounterSelect2 field to PortCounters attribute
+6a63003 opensm: Add ability to configure SMSL
+25f071f opensm/lash: Set minimum VL for LASH to use
+622d853 opensm/osm_ucast_ftree.cd: Added support for same level links
+8146ba7 opensm: Add new Sun vendor ID
+1d7dd18 opensm/osm_ucast_ftree.c: Enhanced Fat-Tree algorithm
+e07a2f1 Add LMC support to DOR routing
+1acfe8a opensm: Add SuperMicro to list of recognized vendors
+f02f40e opensm: implement 'connect_roots' option in fat-tree routing
+748d41e opensm SA DB dump/restore: added option to dump SA DB on every sweep
+b03a95e complib/cl_fleximap: add cl_fmap_match() function
+b7a8a87 opensm/include/iba/ib_types.h: adding Congestion Control definitions
+fa356f8 opensm: Add support for optimized SLtoVLMappingTable programming
+8aaae91 Dimension port order file support
+7662eec opensm: Add option to specify prefix to syslog messages
+2382cf3 opensm: Add update_desc command to opensm console
+7cbe193 opensm: toggle sweeping V3
+6f61d8f opensm/osmeventplugin: added new events to monitor SM
+84cf603 opensm/main.c: force stdout to be line-buffered
+b3bb0ab opensm/osm_dump.c: Dump SL2VL tables if routing engine might have
+	modified them
+8a08719 opensm/osm_dump.c: dump SL2VL tables in debug verbosity level when
+	QoS is on
+fc908c9 opensm/osm_sa_multipath_record.c: Add mtu validation if supplied
+687e1f8 opensm/osm_sa_mcmember_record.c: Add mtu validation if supplied
+76f5b09 opensm/osm_sa_path_record.c: Add mtu validation if supplied
+9f38fae opensm/osm_helper: Add ib_mtu_is_valid
+655230b opensm/osm_sa_multipath_record.c: Add rate validation if supplied
+cb1484d opensm/osm_sa_mcmember_record.c: Add rate validation if supplied
+485d068 opensm/osm_sa_path_record.c: Add rate validation if supplied
+300f4d9 opensm/osm_helper: Add ib_rate_is_valid
+9b50961 opensm: Change osm_routing_engine struct to not use C++ reserved word
+c9c0aa6 opensm/man/torus-2QoS.conf.5.in: Update portgroup_max_ports section
+3c97f06 opensm: Add the precreation of multicast groups
+a9b9f09 opensm/osm_sminfo_rcv.c: Handle SMP status
+1190c15 opensm/osm_switch.c: In osm_switch_set_hops, return, error when port_num is invalid
+3d149db Changed sl_path API to include slid and dlid only
+6cfb0eb Optimized and deadlock-free routing algorithm for InfiniBand
+45f93ec opensm: Add additional IBM vendor ID/OUI
+c386eb2 opensm/osm_state_mgr.c: Cosmetic change to log message
+703e596 opensm: Add support for partition enforcement types to accomodate IBA extended link speeds
+a2a03a8 Check block_num validity in set_guidinfo() and del_guidinfo() requests
+e6ec61f end error resoponse to invalid LID in GUIDInfo request
+7fce500 opensm/Makefile.am: Add doc/opensm-sriov.txt to docs
+264aeb1 opensm: Add documentation for SRIOV support
+c639832 opensm: Enhance osm_physp_share_this_pkey for allow_both_pkeys policy
+b17b63c opensm: When allowing both pkeys, on a switch external, (peer) port eliminate limited pkey when full pkey with same base is present
+a758da2 opensm: Add command line option for allow_both_pkeys
+f412de3 opensm: Update partition documentation and man page for (allowing) both (limited and full) memberships in the same partition
+726ce6a Support allowing both full and limited members of same partition
+4ccf32f opensm/PKeyMgr: Support pkey index reuse when there are no longer any previously unused indices available
+eb375a6 opensm/osm_pkey_mgr.c: Detect pkey table overflow in pkey_mgr_update_port
+411e742 opensm/PkeyMgr: Don't change end port pkey index when simultaneously adding and removing partitions
+15e7223 opensm/osm_sa_guidinfo_record.c: In set_guidinfo, better SM reassigned guid handing
+e79b725 opensm: Handle SubnSet GUIDInfo asynchronously from GUIDInfoRecord handling
+96c741d opensm: Some cosmetic formatting changes
+1d5e370 opensm/osm_sa_guidinfo_record.c: Better status for SA response
+efd3ba2 opensm/osm_sa.c: Change log level of message
+db8b7da opensm/osm_sa_service_record.c: Alias GUID support
+5330986 opensm/osm_sa_multipath_record.c: Add support for alias GUIDs
+44168c9 opensm/osm_sa_guidinfo_record.c: In del_guidinfo, validate guid not in use
+63eb65b opensm: Add multicast support for alias GUIDs
+700d15f opensm/osm_sa_path_record.c: Add support for alias GUIDs
+f818387 opensm/osm_sa_guidinfo_record.c: Use OSM_VENDOR_ID_OPENIB define rather than IB_OPENIB_OUI
+97e360e opensm: Dump/load SA GUIDInfoRecords
+fe74f1d opensm: Make SA assigned guids persistent across port down/up events
+eb8f1d9 opensm: Add support for alias GUIDs
+b3b1861 opensm: osm_subnet.c: Updated patch to add error-reporting to the parsing of opensm.conf
+cd8a708 opensm/man/opensm.8.in: Add description for OSM_LOG_SYS logging flag
+1308e5c opensm/osm_console.c: Add display of FDR10 ports to portstatus_parse
+f4722b0 opensm: Reset client reregistration when receiving handover
+
+1.3 Library API Changes
+
+  None
+
+1.4 Software Dependencies
+
+OpenSM depends on the installation of libibumad package (distributed as
+part of OFA IB management together with OpenSM) and IB stack presence,
+in particular libibumad uses user_mad kernel interface ('ib_umad' kernel
+module). The qualified driver versions are provided in Table 2,
+"Qualified IB Stacks".
+
+Also, building of QoS manager policy file parser requires flex, and either
+bison or byacc installed.
+
+1.5 Supported Devices Firmware
+
+The main task of OpenSM is to initialize InfiniBand devices. The
+qualified devices and their corresponding firmware versions
+are listed in Table 3.
+
+2 Known Issues And Limitations
+------------------------------
+
+* No Service / Key associations:
+  There is no way to manage Service access by Keys.
+
+* No SM to SM SMDB synchronization:
+  Puts the burden of re-registering services, multicast groups, and
+  inform-info on the client application (or IB access layer core).
+
+3 Unsupported IB Compliance Statements
+--------------------------------------
+The following section lists all the IB compliance statements which
+OpenSM does not support. Please refer to the IB specification for detailed
+information regarding each compliance statement.
+
+* C14-22 (Authentication):
+  M_Key M_KeyProtectBits and M_KeyLeasePeriod shall be set in one
+  SubnSet method. As a work-around, an OpenSM option is provided for
+  defining the protect bits.
+
+* C14-67 (Authentication):
+  On SubnGet(SMInfo) and SubnSet(SMInfo) - if M_Key is not zero then
+  the SM shall generate a SubnGetResp if the M_Key matches, or
+  silently drop the packet if M_Key does not match.
+
+* C15-0.1.23.4 (Authentication):
+  InformInfoRecords shall always be provided with the QPN set to 0,
+  except for the case of a trusted request, in which case the actual
+  subscriber QPN shall be returned.
+
+* o13-17.1.2 (Event-FWD):
+  If no permission to forward, the subscription should be removed and
+  no further forwarding should occur.
+
+* C14-44 (Initialization):
+  If the SM discovers that it is missing an M_Key to update CA/RT/SW,
+  it should notify the higher level.
+
+* C14-62.1.1.12 (Initialization):
+  PortInfo:M_Key - Set the M_Key to a node based random value.
+
+* C14-62.1.1.13 (Initialization):
+  PortInfo:M_KeyProtectBits - set according to an optional policy.
+
+* C14-62.1.1.24 (Initialization):
+  SwitchInfo:DefaultPort - should be configured for random FDB.
+
+* C14-62.1.1.32 (Initialization):
+  RandomForwardingTable should be configured.
+
+* o15-0.1.12 (Multicast):
+  If the JoinState is SendOnlyNonMember = 1 (only), then the endport
+  should join as sender only.
+
+* o15-0.1.8 (Multicast):
+  If a request for creating an MCG with fields that cannot be met,
+  return ERR_REQ_INVALID (currently ignores SL and FlowLabelTClass).
+
+* C15-0.1.8.6 (SA-Query):
+  Respond to SubnAdmGetTraceTable - this is an optional attribute.
+
+* C15-0.1.13 Services:
+  Reject ServiceRecord create, modify or delete if the given
+  ServiceP_Key does not match the one included in the ServiceGID port
+  and the port that sent the request.
+
+* C15-0.1.14 (Services):
+  Provide means to associate service name and ServiceKeys.
+
+4 Bug Fixes
+-----------
+
+4.1 Major Bug Fixes
+
+a322f51 Skip TID 0 on 32 bit wraparound for SMP, SA and PerfMgt queries
+cded9af Fix transaction id casting
+3585f8b opensm: Fix crash found with ucast cache
+74e12d9 opensm: fix part_enforce parameter parsing crash
+647a98e Fixed crash in sm_state_mgr_send_master_sm_info_req() during fabric
+	merge
+63ebd0d Fix crash in ucast cache when chain of switches connected back at once
+	to the fabric
+3b21d6f Fix crash in ucast cache when ucast cache invalidates after updating
+	one of the switches
+5654e22 Fix invalid error check, which lead to segfault
+7bf7482 fix segfault corner case w/ updn routing and LMC > 0
+18990fa opensm: set IS_SM bit during opensm init
+3551389 fix local port smlid in osm_send_trap144()
+a6de48d opensm/osm_link_mgr.c initialize SMSL
+82df467 opensm/osm_req.c: Shouldn't reveal port's MKey on Trap method
+45ebff9 opensm/osm_console_io.h: Modify osm_console_exit so only the
+	connection is killed, not the socket
+d10660a opensm/osm_req.c: In osm_send_trap144, set producer type according
+	to node type
+8a2d2dd opensm/osm_node_info_rcv.c: create physp for the newly discovered
+	port of the known node
+39b241f opensm/lid_mgr: fix duplicated lid assignment
+b44c398 opensm: invalidate routing cache when entering master state
+595f2e3 opensm: update LFTs when entering master
+8406c65 opensm: fix port chooser
+fa90512 opensm/osm_vendor_*_sa: fix incompatibility with QLogic SM
+7ec9f7c opensm: discard multicast SA PR with wildcard DGID
+5cdb53f opensm/osm_sa_node_record.c use comp mask to match by LID or GUID
+55f9772 opensm: Return single PathRecord for SubnAdmGet with DGID/SGID wild
+	carded
+5ec0b5f opensm: compress IPV6 SNM groups to use a single MLID
+26e7e83 opensm/osm_lid_mgr: fix couple of duplicate LIDs bugs
+fedc419 opensm: Multicast root switch calculation
+6772fdb opensm: Fix sl2vl configuration
+dd3470f complib/cl_timer.c: fixing cl_timer calculation
+ae1bcdd opensm/osm_lid_mgr.c: Allow switch lids to be non LMC aligned
+593547e Wrong handling of MC create and delete traps
+4c822b0 opensm/osm_prtn.c: removing TopSpin hack
+8214e2a opensm: Add support for SwitchInfo:MulticastFDBTop
+1e544ba opensm: fixed memory leak in multicast spanning tree calculation
+0456b3f Fixed multicast groups reconfiguration during heawy sweep
+9ad844f Fix ucast cache crash, when switch doesn't have valid phys ports
+07aa9fa opensm: fix crash in osm_ucast_mgr
+076bd38 opensm/osm_ucast_cache.c: fix crash in ucast cache when switch with lid 0 dropped
+
+4.2 Other Bug Fixes
+
+740c22b opensm/include/opensm/osm_log.h: Fix commentary cut 'n paste error
+13ebee4 opensm/osm_subnet.c: Fixed ftree/updn configuration failure when
+	root_guid_file points to non-existing file
+8a9d267 opensm: fix locking in osm_guid_mgr_process
+4d682bb opensm: Fix pthread_create() return value checks
+63c6609 opensm/osm_port.h: Fix commentary typo
+3e4e00b opensm/osmtest: fix osmtest ignores timeout parameter
+68b1d92 opensm: perfmgr fix dump_counters
+9d16039 opensm/perfmgr: fix endian conversion of PortCounters
+324f269 opensm/osm_sa_inform_info.c: Fix some error log messages
+1d5213a opensm/osm_madw.h: Fix a couple of cut 'n paste commentary errors
+3fc662d opensm/torus-2QoS: Fix some typos in documentation
+048c66e Fixed Multicast precreation parsing
+086d611 Fixes in SL2VL table distribution algorithm
+7d9f0c9 Fix deadlock between sminfo_set_req() and osm_sm_state_mgr()
+69741e6 Fix base port0 sl2vl mapping optimization
+bcda38e Fix SL2VL configuration
+7e39542 Fix pre-creation of MC group with MGID containing P_Key
+20e1a46 opensm/osm_congestion_control.c: Fix initialization hex string
+a59072d opensm/osm_congestion_control.c: Skip TID 0 on 32 bit wraparound
+7d18662 osmtest/osmtest.c: Fix permission
+e7d4574 opensm/perfmgr: update new error codes to '54' prefix
+e17dae6 opensm/osm_sa_portinfo_record.c: In pir_rcv_new_pir, fix switch port 0 physp
+93b2f56 libvendor/osm_vendor_ibumad.c: fix unused-but-set warning
+cda58af fixed unsused-but-set warning for DEBUG variables
+e881d0e opensm/osmtest/osmt_multicast.: Fix typo in log message
+203f3c6 opensm/osm_switch.c: Fix compile warnings
+67c2538 opensm/man/opensm.8.in: Fix some typos
+7338efc opensm/osmtest/osmtest.c: Fix endian in some log messages
+67063ca opensm/libvendor: Fix compile warnings on 64 bit machines when building --with-osmv=sim
+a8c209c opensm: fixed port order configuration in torus routing engine
+7359cfc opensm/osm_ucast_mgr.c: Fix some issues found by Coverity
+0150ab9 opensm/osm_ucast_ftree.c: Fix some issues found by Coverity
+267a08f opensm/osm_pkey_mgr.c: Fix cast
+12f772d opensm: Fix some OSM_SIGNAL and OSM_SM_SIGNAL numbering
+c29c4f1 opensm/osm_sa_service_record.c: Fix minor memory leak
+f936f8b opensm: fix strtoull error handling
+0292ae2 opensm: fixed segfault when enable qos on fabric with no switches
+619fa64 osmtest/osmt_multicast.c: Fixed another insufficient component case
+1618803 opensm/osm_sa.c: Fix commentary typo
+c98fec9 opensm/osm_subnet.c: Fix description of max_msg_fifo_timeout
+0a3839f osmtest/osmtest.c: Fix trap flow not implemented log message
+f08479a opensm/osm_base.h: Fix a commentary typo
+ae966f6 osmtest/osmt_multicast.c: Fix some typos
+8a3b5b9 osmtest/osmt_multicast.c: Fixed some error codes in OSM_LOG messages
+c90953d osmtest/osmt_multicast.c: Fixed a couple of typos in OSM_LOG messages
+f7f1ead opensm/osm_sa_mcmember_record.c: Fix handling of invalid PKey
+65d3e4f opensm/osm_pkey_mgr.c: Fix commentary typo
+34d61cc opensm/perfmgr: fix overflow processing
+77d79b4 opensm: fixed potential null variable dereferencing in libvendor
+350c6e4 opensm: fixed potential memory leak in osm_ucast_ftree()
+e206872 opensm: Fixed debug message in osm_vendor_send()
+1b3e93e opensm: fixed sizeof of pointer allocation in osm_ucast_lash()
+f0b915a Fix SANodeRecord.nodeInfo.localPortNum
+3332658 opensm: fixed memory leak in multicast spanning tree calculation
+e4525b1 opensm: fixed indentation and decreased verbosity of RMPP length message
+10ac4c1 Fix compile warning introduced by patch "fixed getline pointer allocation free in osm_console_io"
+bf23d7c opensm: fixed getline pointer allocation free in osm_console_io
+54b1583 Makefile: ChangeLog and version generation script path fix
+4911e0b performance-manager-HOWTO.txt: Indicate master state
+86ccaa4 opensm/osm_pkey_mgr.c: Fix pkey endian in log message
+b79b079 opensm.8.in: Add mention of backing documentation for QoS policy
+	file and performance manager
+b4d92af opensm/osm_perfmgr.c: Eliminate duplicated error number
+a10b57a opensm/osm_ucast_ftree.c: lids are always handled in host order
+44273a2 opensm/osm_ucast_ftree.c: fixing bug in indexing
+5cd98f7 Fix further bugs around console closure and clean up code.
+6b34339 opensm/osm_opensm.c: add newline to log message
+68c241c send trap144 when local priority is higher than master priority
+6462999 opensm/osm_inform.c: In __osm_send_report, make sure p_report_madw
+	valid before using
+9b8561a opensm/console: Fixed osm_console poll to handle POLLHUP
+91d0700 osm_vendor_ibumad.c: In clear_madw, fix tid endian in message
+5a5136b osm_switch.h : Fixed wrong comment about return value of
+	osm_switch_set_hops
+c1ec8c0 osm_ucast_ftree.c: Removed useless initialization on switch indexes
+418d01f opensm/osm_helper.c: use single buffer in osm_dump_dr_smp()
+2c9153c opensm/osm_helper.c: consolidate dr path printing code
+048c447 opensm/osm_helper.c: return then log is inactive
+dd3ef0c opensm: Return error status when cl_disp_register fails
+0143bf7 opensm/osm_perfmgr.c: Improve assert in osm_pc_rcv_process
+6622504 osm_perfmgr.c: In osm_perfmgr_shutdown, add missing cl_disp_unregister
+7b66dee opensm: remove unneeded anymore physp initializations
+f11274a opensm/partition-config.txt: Update for defmember feature
+d240e7d opensm/osm_sm_state_mgr.c: Remove unneeded return statement
+898fb8c opensm: Improve some snprintf uses
+6820e63 opensm/osm_sa_link_record.c: improve get_base_lid()
+64c8d31 opensm: initialize all switch ports
+555fae8 opensm/sweep: add log message before lid assignment
+8e22307 opensm/console: Enhance perfmgr print_counters for better nodenames
+b9721a1 opensm/osm_console.c: Improve perfmgr print_counters error message
+4d8dc72 opensm/osm_inform.c: Fix sense of zero GID compare in __match_inf_rec
+a98dd82 opensm/main.c: remove enable_stack_dump() call
+db6d51e opensm/osm_subnet: fix crash in qos string config parameters reloading
+e5111c8 opensm: proper config file rescan
+e5295b2 opensm: pre-scan command line for config file option
+e2f549e opensm/osm_console.c: Eliminate some extraneous parentheses
+0a265dc opensm/console: dump_portguid - don't duplicate matched guids
+540fefb opensm/console: dump_portguid command fixes
+d96202c opensm/osm_console.c: Add missing command in help_perfmgr
+ae1bd3c opensm/osm_helper.c: Add port counters to __osm_disp_msg_str
+1d38b31 opensm/osm_ucast_mgr.c: Add error numbers for some OSM_LOG prin
+156c749 opensm: fix structure definition for trap 257-258
+5c09f4a opensm/osm_state_mgr.c: small bug in scanning lid table
+72a2fa2 opensm/osm_sa.c: fixing SA MAD dump
+539a4d3 opensm/osm_ucast_ftree.c Fixed bad init value for down port index
+6690833 opensm/ftree: simplify root guids setup.
+90e3291 opensm/ftree: cleanup ftree_sw_tbl_element_t use
+c07d245 opensm/qos_config: no invalid option message on default values
+b382ad8 opensm: avoid memory leaks on config parameters reloading
+45f57ce opensm/osm_ucast_ftree.c: Fixed bug on index port incrementation
+3d618aa opensm/osm_subnet.c: break matching when config parameter already found
+44d98e3 opensm/osm_subnet.c: clean_val() remove trailing quotation
+173010a opensm/doc/perf-manager-arch.txt: Fix some commentary typos
+83bf6c5 opensm/osm_subnet.c fix parse functions for big endian machines
+6b9a1e9 opensm/PerfMgr: Primarily fix enhanced switch port 0 perf manager
+	operation
+4f79a17 opensm/osm_perfmgr.c: In osm_perfmgr_init, eliminate memory leak
+	on error
+22da81f opensm/osm_ucast_ftree.c: fix full topology dump
+aa25fcb opensm/osm_port_info_rcv.c: don't clear sw->need_update if port 0
+	is active
+003bd4b opensm/osm_subnet.c Fix memory leak for QOS string parameters.
+9cbbab2 opensm/opensm.spec: fix event plugin config options
+996e8f6 OpenSM: update osmeventplugin example for the new TRAP event.
+67f4c07 opensm/lash: simplify some memory allocations
+3e6bcdb opensm/lash: fix memory leaks
+3ff97b9 opensm/vendor: save some stack memory
+ccc7621 opensm/osm_ucast_ftree.c: fixing errors in comments
+1a802b3 Corrected incoherency in __osm_ftree_fabric_route_to_non_cns comments
+85a7e54 opensm/osm_sm.c: fix MC group creation in race condition
+aad1af2 opensm/osm_trap_rcv.c: Improvements in log_trap_info()
+f619d67 opensm/osm_trap_rcv.c: Minor reorganization of trap_rcv_process_request
+084335b opensm/link_mgr: verify port's lid
+d525931 opensm/osm_vendor_ibumad: Use OSM_UMAD_MAX_AGENTS rather than
+	UMAD_CA_MAX_AGENTS
+f342c62 opensm/osm_sa.c: don't ignore failure in osm_mgrp_add_port()
+587fda4 osmtest/osmt_multicast.c: fix strict aliasing breakage warning
+6931f3e opensm: make subnet's max mlid update implementation independent
+30f1acd osm_ucast_ftree.c missing reset of ca_ports
+ac04779 opensm: fix LFT allocation size
+a7838d0 opensm/osm_ucast_cache: reduce OSM_LOG_INFO debug printouts
+c027335 opensm/osm_ucast_updn.c: Further reduction in cas_per_sw allocation
+e8ee292 opensm/opensm/osm_subnet.c: adjust buffer to ensure a '\n' is printed
+84d9830 opensm/osm_ucast_updn.c: Reduce temporary allocation of cas_per_sw
+347ad64 opensm/ib_types.h: Mask off client rereg bit in set_client_rereg
+c2ab189 opensm/osm_state_mgr.c: in cleanup_switch() check only relevant
+	LFT part
+40c93d3 use transportable constant attributes
+c8fa71a osmtest -code cleanup - use strncasecmp()
+770704a opensm/osm_mcast_mgr.c: In mcast_mgr_set_mft_block, fix node GUID
+	in log message
+3d20f82 opensm/osm_sa_path_record.c: separate router guid resolution code
+27ea3c8 opensm: fix gcc-4.4.1 warnings
+c88bfd3 opensm/osm_lid_mgr.c: Fix typo in OSM_LOG message
+a9ea08c opensm/osm_mesh.c: Add dump_mesh routine at OSM_LOG_DEBUG level
+bc2a61e C++ style coding does not compile
+6647600 opensm: remove meanless 'const' keywords in APIs
+323a74f opensm/osm_qos_parser_y.y: fix endless loop
+0121a81 opensm: fix endless looping in mcast_mgr
+696c022 opensm: fix some obvious -Wsign-compare warnings
+b91e3c3 opensm/osm_get_port_by_lid(): don't bother with lmc
+ca582df opensm/osm_get_port_by_lid(): speedup a port lookup
+fd846ee opensm/osm_mesh.c: simplify compare_switches() function
+fe20080 osm_sa.c - void * arithmetic causes problems
+220130f osm_helper.c use explicit value for struct init
+0168ece use standard varargs syntax in macro OSM_LOG()
+180b335 update functions to match .h prototypes
+9240ef4 opensm/osm_ucast_lash: fix use after free bug
+6f1a21a opensm: osm_get_port_by_lid() helper
+c9e2818 opensm/osm_sa_path_record.c: validate multicast membership
+225dcf5 opensm/osm_mesh.c: Remove edges in lash matrix
+4dd928b opensm/osm_sa_mcmember_record.c: clean uninitialized variable use
+c48f0bc opensm/osm_perfmgr_db.c: Fix memory leak of db nodes
+82d3585 opensm/osm_notice.c: move logging code to separate function
+9557f60 opensm/osm_inform.c: For traps 64-67, use GID from DataDetails in
+	log message
+e2e78d9 opensm/opensm.8.in: Indicate default rule for Default partition
+08c5beb opensm/osm_sa_node_record.c: dump NodeInfo with debug verbosity
+1fe88f0 opensm/multicast: merge mcm_port and mcm_info
+ba75747 opensm/multicast: consolidate port addition/removing code
+5e61ab8 opensm: port object reference in mcm ports list
+5c5dacf opensm: fix uninitialized return value in osm_sm_mcgrp_leave()
+7cfe18d osm_ucast_ftree.c: Removed reverse_hop parameters from
+	fabric_route_upgoing_by_going_down
+aa7fb47 opensm/multicast: kill mc group to_be_deleted flag
+a4910fe opensm/osm_mcast_mgr.c: multicast routing by mlid - renaming
+1d14060 opensm/multicast: remove change id tracking
+5a84951 opensm: use mgrp pointer as osm_sm_mcgrp_join/leave() parameter
+d8e3ff5 opensm: use mgrp pointer in port mcm_info
+0631cd3 opensm doc: Indicated limited (rather than partial) partition
+	membership
+1010535 opensm/osm_ucast_lash.c: In lash_core, return status -1 for all errors
+942e20f opensm/osm_helper.c: Add SM priority changed into trap 144 description
+2372999 opensm/osm_ucast_mgr: better lft setup
+e268b32 opensm/osm_helper.c: Only change method when > rather than >=
+9309e8c complib/cl_event.c: change nanosec var type long
+d93b126 opensm/complib: account for nsec overflow in timeout values
+ef4c8ac opensm/osm_qos_policy.c: matching PR query to QoS level with pkey
+c93b58b opensm: fixing some data types in osm_req_get/set
+2b89177 opensm/libvendor/osm_vendor_ibumad.c: Handle umad_alloc failure in
+	osm_vendor_get
+2cba163 opensm/osm_helper.c: In osm_dump_dr_smp, fix endian of status
+47397e3 opensm/osm_sm_mad_ctrl.c: Fix endian of status in error message
+e83b7ca opensm/osm_mesh.c: Reorder switches for lash
+9256239 opensm/osm_trap_rcv.c: Validate trap is 144 before checking for
+	NodeDescription changed
+011d9ca opensm/osm_ucast_lash.c: Handle calloc failure in generate_cdg_for_sp
+59964d7 opensm: fixing handling of opt.max_wire_smps
+f4e3cd0 opensm/osm_ucast_lash.c: Directly call calloc/free rather than
+	create/delete_cdg
+5a208bd opensm/osm_ucast_lash.c: Added error numbers to some error log messages
+3b80d10 opensm/osm_helper.c: fix printing trap 258 details
+f682fe0 opensm: do not configure MFTs when mcast support is disabled
+cc42095 opensm/osm_sm_mad_ctrl.c: In sm_mad_ctrl_send_err_cb, indicate
+	failed attribute
+aebf215 opensm/osm_ucast_lash.c: Remove osm_mesh_node_delete call from
+	switch_delete
+1ef4694 opensm/osm_path.h: In osm_dr_path_init, only copy needed part of path
+c594a2d opensm: osm_dr_path_extend can fail due to invalid hop count
+46e5668 opensm/osm_lash: Fix use after free problem in osm_mesh_node_delete
+81841dc opensm/osm_ucast_lash.c: Handle malloc failures better
+2801203 opensm: remove extra "0x" from debug message.
+88821d2 opensm/main.c: Display SMSL when specified
+f814dcd opensm/osm_subnet.c: Format lash_start_vl consistent with other
+	uint8 items
+66669c9 opensm/main.c: Display LASH start VL when specified
+31bb0a7 opensm/osm_mcst_mgr.c: check number of switches only once
+75e672c opensm: find MC group by MGID using fleximap
+2b7260d Clarify the syntax of the hop_weights_file
+e6f0070 opensm/osm_mesh.c: Improve VL utilization
+27497a0 opensm/osm_ucast_ftree.c Fix assert comparing number of CAs to CN ports
+3b98131 opensm/osm_qos_policy.c: Use proper size in malloc in
+	osm_qos_policy_vlarb_scope_create
+e6f367d opensm/osm_ucast_ftree.c: Made error numbers unique in some log
+	messages
+83261a8 osm_ucast_ftree.c Count number of hops instead of calculating it
+7bdf4ff opensm/osm_sa_(path multipath)_record.c: Fix typo in a couple of
+	log messages
+0f8ed87 opensm/osm_ucast_mgr.c: Add error numbers to some error log messages
+0b5ccb4 complib/Makefile.am: prevent file duplications
+e0b8ec9 opensm/osm_sminfo_rcv.c: clean type of smi_rcv_process_get_sm()
+4d01005 opensm: sweep component processors return status value
+6ad8d78 opensm/libvendor/osm_vendor_(ibumad mlx)_sa.c: Handle malloc
+	failure in __osmv_send_sa_req
+cf97ebf opensm/osm_ucast_lash.(h c): Replace memory allocation by array
+957461c opensm/osm_sa.c add attribute and component mask to error message
+5d339a1 osm_dump.c dump port if lft is set up
+518083d osm_port.c: check if op_vls = 0 before max_op_vls comparison
+b6964cb opensm/osm_port.c: Change log level of Invalid OP_VLS 0 message
+	to VERBOSE
+b27568c opensm/PerfMgr: Reduce host name length
+bc495c0 opensm/osm_lid_mgr.c bug in opensm LID assignment
+5a466fd opensm/osm_perfmgr_db.c: Remove unneeded initialization in
+	perfmgr_db_print_by_name
+57cf328 opensm/osm_ucast_ftree.c Increase the size of the hop table
+8323cf1 opensm/PerfMgr: Remove some underbars from internal names
+65b1c15 opensm: Changes to spec and make files for updated release notes
+cd226c7 OpenSM: include/vendor/osm_vendor.h - Replaced #elif with no
+	condition by #else
+9f8bd4a management: Fixed custom_release in SPEC files
+c0b8207 opensm/PerfMgr: Change redir_tbl_size to num_ports for better clarity
+596bb08 opensm/osm_sa.c: check for SA DB file only if requested
+2f2bd4e opensm SA DB dump/restore: load SA DB only once
+4abcbf2 opensm: Added print_desc to various log messages
+5e3d235 opensm/osm_vendor_ibumad.c: Move error info into single message
+8e5ca10 opensm/libvendor//osm_vendor_ibumad_sa.c: uninitialized fields
+d13c2b6 opensm/osm_sm_mad_ctrl.c Changes to some error messages
+f79d315 opensm/osm_sm_mad_ctrl.c: Add missing call to return mad to mad pool
+150a9b1 opensm/osm_sa_mcmember_record.c: print mcast join/create failures in
+	VERBOSE instead of DEBUG level
+9b7882a opensm/osm_vendor_ibumad.c: Change LID format to decimal in log message
+5256c43 opensm/osm_vendor_mlx: fix compilation error
+93db10d opensm/osm_vendor_mlx_txn.c: eliminate bunch of compilation warnings
+156fdc1 opensm/osm_helper.c Log format changes
+7a55434 opensm/osm_ucast_ftree.c Changed log level
+a1694de opensm/osm_state_mgr.c Added more info to some error messages
+fdec20a opensm/osm_trap_rcv.c: Eliminate heavy sweep on receipt of trap 145
+13a32a7 opensm - standardize on a single Windows #define - take #2
+b236a10 opensm/osm_db_files.c: kill useless malloc() castings
+4ba0c26 opensm/osm_db_files.c: add '/' path delimited
+e3b98a5 opensm/osm_sm_mad_ctrl.c: Fix qp0_mads_accounting
+dbbe5b3 opensm/osm_subnet.c: fixing bug in dumping options file
+f22856a opensm/osm_ucast_mgr.c: fix memory leak
+0d5f0b6 opensm: osm_get_mgrp_by_mgid() helper
+e3c044a osm_sa_mcmember_record.c: pass MCM Record data to mlid allocator
+3dda2dc opensm/osm_sa_member_record.c: mlid independent MGID generator
+1f95a3c opensm/osm_sa_mcmember_record.c: move mgid allocation code
+b78add1 complib: replace intn_t types by C99 intptr_t
+a864fd3 osmtest/osmt_mtl_regular_qp.c: cleaning uintn_t use
+9e01318 opensm/osm_console.c: make const functions
+f8c4c3e opensm/osm_mgrp_new(): add subnet db insertion
+80da047 complib/fleximap: make compar callback to return int
+bf7fe2d opensm: cleanup intn_t uses
+0862bba opensm/main.c: opensm cannot be killed while asking for port guid
+2b70193 opensm/complib: bug in cl_list_insert_array_head/tail functions
+4764199 opensm - use C99 transportable data type for pointer storage
+a9c326c opensm/osm_state_mgr.c: do not probe remote side of port 0
+4945706 opensm/osm_mcast_mgr.c: fix return value on alloc_mfts() failures
+8312a24 OpenSM: Fix unused variable compiler warning.
+ab8f0a3 opensm/partition: keep multicast group pointer
+a817430 opensm: Only clear SMP beyond end of PortInfo attribute
+52fb6f2 opensm/osm_switch.h: Remove dead osm_switch_get_physp_ptr routine
+aa6d932 opensm/osm_mcast_tbl.c: In osm_mcast_tbl_clear_mlid, use memset to
+	clear port mask entry
+2ad846b opensm/osm_trap_rcv.c: use source_lid and port_num for logging
+b9d7756 opensm/osm_mcast_tbl: Fix size of port mask table array
+11c0a9b opensm/main.c: Use strtoul rather than strtol for parsing transaction
+	timeout
+0608af9 opensm/osm_sm_mad_ctrl.c: In sm_mad_ctrl_send_err_cb, revert setting
+	of init failure on QoS initialization failures
+c6b4d4a opensm/osm_vendor_ibumad.c: Add transaction ID to osm_vendor_send
+	log message
+520af84 opensm/osm_sa_path_record.c: don't set dgid pointer for local subnet
+4a878fb opensm/osm_mcast_mgr.c: fix osm_mcast_mgr_compute_max_hops for
+	managed switch
+7c48590 opensm/osm_log.c: add OSM_LOG_SYS to default flags
+89f7cb6 opensm/osm_lid_mgr: use 'first_time_master_sweep' flag
+0cb7fab opensm: conversion to osm_get_port_by_lid()
+9d14fc0 opensm/osm_lid_mgr.c: fix memory leak
+c364aa1 opensm/opensm.init.in: fix install warning on SLES11
+1010c9c opensm/osm_sa_path_record.c: livelock in pr_rcv_get_path_parms
+4b2cd5e opensm/vendor: fix portguids array size
+52bf5b2 opensm/osm_subnet.c: fixing some options to not "hot-swappable"
+8900da0 opensm/osm_subnet.{c,h}: passing options to the event plugins
+051c57f Delete port only after GID OUT trap was sent
+d4ebf7e opensm/complib/cl_passivelock.h: remove unneeded casting
+8fdb17c opensm/complib/cl_types.h: convert cl_status_t to int
+fd7fb1e opensm/osm_mcast_mgr.c: preserve root switch calculation functionality
+fcb0f3a opensm/osm_mcast_mgr.c: code simplifications
+444f559 opensm/osm_mcast_mgr.c: fix bug in MC root switch calculation
+041ebcb opensm/osm_mcast_mgr.c: remove redundant casting
+3717f53 opensm/osm_sa_pkey_record.c: optimize port selection logic
+48352be opensm/osm_mcast_mgr.c: fix memory leak
+f3cf83f opensm/complib/cl_ptr_vector.c: fix bug/compiler warning
+27c8ebd opensm/osm_subnet.h: remove redundant function definition
+f296938 opensm/osm_vl_arb_rcv.c: fix double mutex release bug
+00bc48e opensm/osm_port_info_rcv.c: fix compilation warning
+8823800 opensm/osm_sa.{c,h}: osm_sa_db_file_dump() return values
+f4581f3 opensm/osm_qos.c: Fix typo in OSM_LOG message
+e3c790a opensm/osm_update_node_desc(): minor prototype improvement
+3cc68cb opensm/osm_vl_arb_rcv.c: Dump table after validating block number
+7dbb96e opensm SA DB: dump only if modified
+fa2106d opensm/osm_sa_infrominfo.c: fixes and simplifications in lid range check
+051a1dd opensm/osm_qos.c: split switch external and end ports setup
+a6c0189 opensm/osm_qos.c: merge SL2VL mapping capability check
+3fe8efe opensm/osm_slvl_map_rcv.c: verify port number values received from
+	network
+88c372c opensm/osm_slvl_map_rcv.c: fix mutex double release bug
+d282093 opensm/osm_slvl_map_rcv.c: fix port parsing on BE machine
+8e9dbd3 osm_sa_path_record.c: use PR DGID by reference
+7c9d375 osm_sa_path_record.c: separate mutlicast processing code
+cb2d18e opensm/osm_sa_path_record.c: MGID must be specified explicitly
+bd3932b opensm/osm_mcast_mgr.c: strip log-only variable
+9d93de3 opensm/osm_pkey_mgr.c: Eliminate unneeded parameter from pkey_mgr_get_physp_max_blocks API
+5f49472 opensm/include/osm_helper.h: Eliminate some duplicate declarations
+e8ddcd4 opensm/osm_opensm.c: no report when SM is exiting
+77ce7c8 complib/cl_timer: remove not needed timeval initializations
+490aae2 opensm/osm_helper.c: Add some missing message names to disp_msg_str
+d678a21 opensm: Modify OSM_LOG_SYS messages
+4cfb481 opensm: Fix wrong messages in MC delete flow
+5b82f92 opensm/osm_req.c: In osm_send_trap144, eliminate redundant clear of m_key in smp
+9bf64dc opensm/osm_qos.c: Eliminate unneeded endport SL to VL setup
+34b536c opensm/osm_sa_path_record.c: adding wrapper for pr_rcv_get_path_parms()
+237b5d1 opensm/osm_mcast_mgr.c: Only route MLIDs with more than 1 member
+a72db14 opensm/osm_trap_rcv.c: No need for heavy sweep when just NodeDescription changes
+ea9a768 opensm/osmtest.c: fix bug in getting attr offset
+a3dec3a iba/ib_types.h: remove assertion in ib_get_attr_offset()
+6bc032a return no path when path does not exist
+1592ae9 opensm: Better handling of non responsive SMAs
+a69f01b opensm/osm_perfmgr.c: Remove unnecessary lock reference from Performance Manager object
+167ade2 opensm: fixing compilation issues in some header files
+e1c253e opensm/qos.c: Revert port ranges for calls to sl2vl_update_table().
+0689f49 opensm/libvendor Reduce stack consumption
+59056c7 opensm - address windows env issues
+ff14200 opensm/osm_sa_multipath_record.c: livelock in mpr_rcv_get_path_parms
+3f23d83 opensm/osm_sa_path_record.c: Add error code to newly added log message
+7fc6cd3 ib_types.h add debug assert
+4fd4ca3 osmtest - use helper function
+6fdc20a opensm/complib use portable macro syntax
+bf23d7c opensm: fixed getline pointer allocation free in osm_console_io
+74867c7 Add node/port/qos information to some error messages
+31a617d replace (long*)(long) casting with transportable data type (uintptr_t)
+8da7521 opensm/st.c: fix potential core dumps
+6a30911 opensm/osm_console.c: fix memory and file descriptor leaks
+696f12c opensm/osm_qos_parser_y.y: fixing bunch of memory leaks on invalid values
+3a7b97c opensm/osm_ucast_file.c: closing file descriptor in error path
+b4575c5 opensm/osm_pkey_mgr.c: fixing small memory leak
+dc0695f opensm/osm_ucast_lash.c: small bug in calculating allocated size
+3c9604b opensm/osm_ucast_ftree.c: fixing another memory leak at error path
+4460990 opensm/osm_ucast_ftree.c: fix small memory leak in error path
+857cd6c opensm/osm_trap_rcv.c: fix possible core dump
+b74bef5 opensm/osm_trap_rcv.c: No need to check for sweep for trap 145
+81dade3 opensm/osm_ucast_ftree: When roots are not connected, update hop count but not lft
+acf2337 osmtest/osmt_service.c: In osmt_run_service_records_flow, add missing status
+6db7f4a opensm/osm_state_mgr.c: Don't signal DISCOVER to SM state machine when already DISCOVERING
+28693c5 Fix autotools to include the necessary M4 files
+c1c8730 osm_vl15intf.c: fixing use-after-free coredump
+3353f9b opensm/osm_helper.c: use ARR_SIZE macro instead of hardcoded values
+2da9849 osmtest/osmt_slvl_vl_arb.c: handling fopen() failure
+f48d5ea opensm/osm_db_files.c: malloc() return value run-time check
+ea3ef82 opensm/osm_db_files.c: fix small memory leak
+f4a5174 opensm/osm_subnet.c: fixing small bug in error path
+c18ef23 opensm/osm_mesh.c: fixing a bug in compare_switches()
+83b74cd opensm/osm_helper.c: fix potential overrun of the array
+85c0ac9 osmtest/osmtest.c: handle timeouts in PR stress test
+ebb2c84 opensm/osm_node_info_rcv.c: move p_physp declaration under code block
+5c88113 opensm/osm_node_info_rcv.c: remove useless code line
+866d939 opensm/osm_sa_vlarb_record.c: removed unused variable
+15a8770 opensm/osm_sa_pkey_record.c: removing unused variable
+8f002b7 opensm/osm_pkey.c: removing unused function
+9c0fa2f opensm/osm_sminfo_rcv.c: removing unused variable
+d3f060a opensm/osm_mtree.c: removing useless 'if' statement
+bbef64a libvendor/osm_vendor_mlx_sa.c: remove useless "if" statement
+2da02b5 libvendor/osm_vendor_ibumad_sa.c: remove useless "if" statement
+435dde0 opensm/sa: simplify osm_mcmr_rcv_find_or_create_new_mgrp() function call
+e7a872d opensm/osm_qos_policy.c: change a log message
+ffbe7d0 opensm: Cause status of unicast routing attempt to propogate to callers of osm_ucast_mgr_process().
+673877a opensm: Make mcast_mgr_purge_tree() available outside osm_mcast_mgr.c.
+b135687 opensm: Track the minimum value in the fabric of data VLs supported.
+7c1ee64 opensm: Fix typo in routing section in man page and doc
+d206011 opensm/osmtest/osmtest.c: inventory file parsing bugfix
+e01121a fixed deprecated conversion from string constant to char* warning
+a7ba101 opensm/main.c: Change size parameter in setvbuf call from 0 to BUFSIZ
+2a92554 opensm/osmtest/osmt_multicast.c: Fix multicast flow failures on pkey validation
+364e65b opensm/osm_dump.c: Fix FDR10 speed dumping
+80e11b9 osmtest/osmt_multicast.c: Fix check of partial JoinState delete request - removing NonMember (o15.0.1.14)
+78e1e4e osmtest/osmt_multicast.c: Fix check of BAD RATE when connecting to existing MGID (o15.0.1.13)
+e94e972 osmtest/osmt_multicast.c: Fix first MGID=0 MC group creation case
+daedad7 opensm/osmtest/osmt_multicast.c: Fix an unrealistic rate case
+110ae10 opensm: fixed segfault in osm_destroy
+d666205 opensm/osm_prtn.c: Fix typo in log message
+f3ccb45 opensm: Remove duplicate definition of IB_MAD_STATUS_CLASS_MASK
+917070c Move no_fallback_routing_engine from osm_subn_opt_t to osm_opensm_t.
+d71a924 Free memory from osm_subn_opt_t when osm_subn_t destroyed
+1b75fa4 Remove duplicate initialization of scatter_ports
+b5f4570 Do not load configs from the default config file and specified config file
+f24a089 Fix memleak and segfault
+247d0d8 Fix IPoIB broadcast group creation on non-default Pkey
+78d86bd opensm/osm_subnet.c: Trivial optimization to code flow in subn_verify_sl2vl
+6bb41e3 opensm/complib/cl_atomic.h: Commentary changes
+28ee7b9 opensm/osm_sa_class_port_info.c: Conditionalize setting of OSM_CAP2_IS_MCAST_TOP_SUPPORTED
+29e59a2 Removed unused parameter "ib_mad_addr" from umad_reciever()
+63ad0bb opensm/osmeventplugin/src/osmeventplugin.c: Output LIDs in decimal
+17967c2 opensm/osm_switch.h: Fix commentary typo
+6d3e223 opensm/osm_perfmgr.c: Enhance send error log message
+08abcd4 opensm/osm_sa_mad_ctrl.c: Enhance send error log message
+13f3e0f opensm/libvendor/osm_vendor_ibumad.c: Fix DR path printing on send timeouts
+0dfd760 Fix suggest parentheses around operand warning
+ad2dbf8 Support source-target-port-guid QoS policy configuration with ULP 'any'
+080e3ad Support source-port-guid QoS policy configuration with ULP 'any'
+49777a9 Fix typo in qos-ulps parsing comment
+bcfe1b9 opensm/osm_torus.c: Use "OpenSM standard" error codes
+683397d Fix use of GNU old-style field designator extension
+719fcd4 Fix use of logical && with constant operand; switch to bitwise &
+6bc87bd opensm: fix search common pkeys
+a6ac5e3 opensm/osm_drop_mgr.c: GID out trap fix
+7717505 opensm/osm_pkey_mgr.c: fix segfault when trying to access not allocated block
+eb90efd include/opensm/osm_subnet.h: fix comment typos
+0a315e3 opensm/include/iba/ib_types.h: fix comment typos and errors
+125baa0 opensm/opensm.8.in: Fix cut 'n paste error
+f0d14d2 opensm/osm_ucast_ftree.c: Fix some typos
+841096f opensm: Fix opensm handover/relinquish corner case
+bf420ac opensm/osm_helper.c: Fix commentary typo
+2be999c opensm: fixed description in osm_routing_engine
+cf3d185 gen_chlog.sh: fixed version ordering
+8d49c5d opensm/osm_sa_guidinfo_record.c: Fix locking
+8d764b8 Fix continous looping when clearing accum_pkeys table
+32500a6 opensm/osm_link_mgr.c: Fix sending PortInfo Set for ports supporting extended speed
+e24ff39 Fix Pkey enforcement configuration
+041e47a Fix PathRecord reply to be the same for allow_both_pkeys ON and OFF
+3c9b81d OpenSM/osm_prtn_config.c: Fix non-initialized pointer usage
+28a40a2 Fix logging messages about op_vls and mtu mismatch
+5e672a6 Fix memory leak on dfsssp_context_destroy()
+
+* Other less critical or visible bugs were also fixed.
+
+5 Main Verification Flows
+-------------------------
+
+OpenSM verification is run using the following activities:
+* osmtest - a stand-alone program
+* ibmgtsim (IB management simulator) based - a set of flows that
+  simulate clusters, inject errors and verify OpenSM capability to
+  respond and bring up the network correctly.
+* small cluster regression testing - where the SM is used on back to
+  back or single switch configurations. The regression includes
+  multiple OpenSM dedicated tests.
+* cluster testing - when we run OpenSM to setup a large cluster, perform
+  hand-off, reboots and reconnects, verify routing correctness and SA
+  responsiveness at the ULP level (IPoIB and SDP).
+
+5.1 osmtest
+
+osmtest is an automated verification tool used for OpenSM
+testing. Its verification flows are described by list below.
+
+* Inventory File: Obtain and verify all port info, node info, link and path
+  records parameters.
+
+* Service Record:
+   - Register new service
+   - Register another service (with a lease period)
+   - Register another service (with service p_key set to zero)
+   - Get all services by name
+   - Delete the first service
+   - Delete the third service
+   - Added bad flows of get/delete  non valid service
+   - Add / Get same service with different data
+   - Add / Get / Delete by different component  mask values (services
+     by Name & Key / Name & Data / Name & Id / Id only )
+
+* Multicast Member Record:
+   - Query of existing Groups (IPoIB)
+   - BAD Join with insufficient comp mask (o15.0.1.3)
+   - Create given MGID=0 (o15.0.1.4)
+   - Create given MGID=0xFF12A01C,FE800000,00000000,12345678 (o15.0.1.4)
+   - Create BAD MGID=0xFA. (o15.0.1.6)
+   - Create BAD MGID=0xFF12A01B w/ link-local not set (o15.0.1.6)
+   - New MGID with invalid join state (o15.0.1.9)
+   - Retry of existing MGID - See JoinState update (o15.0.1.11)
+   - BAD RATE when connecting to existing MGID (o15.0.1.13)
+   - Partial JoinState delete request - removing FullMember (o15.0.1.14)
+   - Full Delete of a group (o15.0.1.14)
+   - Verify Delete by trying to Join deleted group (o15.0.1.14)
+   - BAD Delete of IPoIB membership (no prev join) (o15.0.1.15)
+
+* GUIDInfo Record:
+   - All GUIDInfoRecords in subnet are obtained
+
+* MultiPathRecord:
+   - Perform some compliant and noncompliant MultiPathRecord requests
+   - Validation is via status in responses and IB analyzer
+
+* PKeyTableRecord:
+  - Perform some compliant and noncompliant PKeyTableRecord queries
+  - Validation is via status in responses and IB analyzer
+
+* LinearForwardingTableRecord:
+  - Perform some compliant and noncompliant LinearForwardingTableRecord queries
+  - Validation is via status in responses and IB analyzer
+
+* Event Forwarding: Register for trap forwarding using reports
+   - Send a trap and wait for report
+   - Unregister non-existing
+
+* Trap 64/65 Flow: Register to Trap 64-65, create traps (by
+  disconnecting/connecting ports) and wait for report, then unregister.
+
+* Stress Test: send PortInfoRecord queries, both single and RMPP and
+  check for the rate of responses as well as their validity.
+
+
+5.2 IB Management Simulator OpenSM Test Flows:
+
+The simulator provides ability to simulate the SM handling of virtual
+topologies that are not limited to actual lab equipment availability.
+OpenSM was simulated to bring up clusters of up to 10,000 nodes. Daily
+regressions use smaller (16 and 128 nodes clusters).
+
+The following test flows are run on the IB management simulator:
+
+* Stability:
+  Up to 12 links from the fabric are randomly selected to drop packets
+  at drop rates up to 90%. The SM is required to succeed in bringing the
+  fabric up. The resulting routing is verified to be correct as well.
+
+* LID Manager:
+  Using LMC = 2 the fabric is initialized with LIDs. Faults such as
+  zero LID, Duplicated LID, non-aligned (to LMC) LIDs are
+  randomly assigned to various nodes and other errors are randomly
+  output to the guid2lid cache file. The SM sweep is run 5 times and
+  after each iteration a complete verification is made to ensure that all
+  LIDs that could possibly be maintained are kept, as well as that all nodes
+  were assigned a legal LID range.
+
+* Multicast Routing:
+  Nodes randomly join the 0xc000 group and eventually the
+  resulting routing is verified for completeness and adherence to
+  Up/Down routing rules.
+
+* osmtest:
+  The complete osmtest flow as described in the previous table is run on
+  the simulated fabrics.
+
+* Stress Test:
+  This flow merges fabric, LID and stability issues with continuous
+  PathRecord, ServiceRecord and Multicast Join/Leave activity to
+  stress the SM/SA during continuous sweeps. InformInfo Set/Delete/Get
+  were added to the test such both existing and non existing nodes
+  perform them in random order.
+
+5.3 OpenSM Regression
+
+Using a back-to-back or single switch connection, the following set of
+tests is run nightly on the stacks described in table 2. The included
+tests are:
+
+* Stress Testing: Flood the SA with queries from multiple channel
+  adapters to check the robustness of the entire stack up to the SA.
+
+* Dynamic Changes: Dynamic Topology changes, through randomly
+  dropping SMP packets, used to test OpenSM adaptation to an unstable
+  network & verify DB correctness.
+
+* Trap Injection: This flow injects traps to the SM and verifies that it
+  handles them gracefully.
+
+* SA Query Test: This test exhaustively checks the SA responses to all
+  possible single component mask. To do that the test examines the
+  entire set of records the SA can provide, classifies them by their
+  field values and then selects every field (using component mask and a
+  value) and verifies that the response matches the expected set of records.
+  A random selection using multiple component mask bits is also performed.
+
+5.4 Cluster testing:
+
+Cluster testing is usually run before a distribution release. It
+involves real hardware setups of 16 to 32 nodes (or more if a beta site
+is available). Each test is validated by running all-to-all ping through the IB
+interface. The test procedure includes:
+
+* Cluster bringup
+
+* Hand-off between 2 or 3 SM's while performing:
+  - Node reboots
+  - Switch power cycles (disconnecting the SM's)
+
+* Unresponsive port detection and recovery
+
+* osmtest from multiple nodes
+
+* Trap injection and recovery
+
+
+6 Qualified Software Stacks and Devices
+---------------------------------------
+
+OpenSM Compatibility
+--------------------
+Note that OpenSM version 3.2.1 and earlier used a value of 1 in host
+byte order for the default SM_Key, so there is a compatibility issue
+with these earlier versions of OpenSM when the 3.2.2 or later version
+is running on a little endian machine. This affects SM handover as well
+as SA queries (saquery tool in infiniband-diags).
+
+
+Table 2 - Qualified IB Stacks
+=============================
+
+Stack                                    | Version
+-----------------------------------------|--------------------------
+The main stream Linux kernel             |   2.6.x
+OFED                                     |   1.5,1.5.x
+OFED                                     |   1.4
+OFED                                     |   1.3
+OFED                                     |   1.2
+OFED                                     |   1.1
+OFED                                     |   1.0
+
+Table 3 - Qualified Devices and Corresponding Firmware
+======================================================
+
+Mellanox
+Device                              |   FW versions
+------------------------------------|-------------------------------
+InfiniScale                         | fw-43132  5.2.000 (and later)
+InfiniScale III                     | fw-47396  0.5.000 (and later)
+InfiniScale IV                      | fw-48436  7.1.000 (and later)
+InfiniHost                          | fw-23108  3.5.000 (and later)
+InfiniHost III Lx                   | fw-25204  1.2.000 (and later)
+InfiniHost III Ex (InfiniHost Mode) | fw-25208  4.8.200 (and later)
+InfiniHost III Ex (MemFree Mode)    | fw-25218  5.3.000 (and later)
+ConnectX IB                         | fw-25408  2.3.000 (and later)
+
+QLogic/PathScale
+Device  |   Note
+--------|-----------------------------------------------------------
+iPath   | QHT6040 (PathScale InfiniPath HT-460)
+iPath   | QHT6140 (PathScale InfiniPath HT-465)
+iPath   | QLE6140 (PathScale InfiniPath PE-880)
+iPath   | QLE7240
+iPath   | QLE7280
+
+Note 1: OpenSM does not run on an IBM Galaxy (eHCA) as it does not expose
+QP0 and QP1. However, it does support it as a device on the subnet.
+
+Note 2: QoS firmware and Mellanox devices
+
+HCAs: QoS supported by ConnectX. QoS-enabled FW release is 2_5_000 and
+later.
+
+Switches: QoS supported by InfiniScale III
+Any InfiniScale III FW that is supported by OpenSM supports QoS.
diff --git a/doc/partition-config.txt b/doc/partition-config.txt
new file mode 100644
index 0000000..f49d473
--- /dev/null
+++ b/doc/partition-config.txt
@@ -0,0 +1,176 @@
+OpenSM Partition configuration
+===============================
+
+The default name of OpenSM partitions configuration file is
+'$(OPENSM_CONFIG_DIR)/partitions.conf' (where $(OPENSM_CONFIG_DIR) is set at
+configure time and defaults to ${sysconfdir}/opensm). The default may be
+changed at run time by using the --Pconfig (-P) option with OpenSM.
+
+The default partition will be created by OpenSM unconditionally even
+when partition configuration file does not exist or cannot be accessed.
+
+The default partition has P_Key value 0x7fff. OpenSM's port will always
+have full membership in default partition. All other end ports will have
+full membership if the partition configuration file is not found or cannot
+be accessed, or limited membership if the file exists and can be accessed
+but there is no rule for the Default partition.
+
+Effectively, this amounts to the same as if one of the following rules
+below appear in the partition configuration file:
+In the case of no rule for the Default partition:
+Default=0x7fff : ALL=limited, SELF=full ;
+In the case of no partition configuration file or file cannot be accessed:
+Default=0x7fff : ALL=full ;
+
+
+File Format
+===========
+
+Comments:
+
+Line content followed after \'#\' character is comment and ignored by
+parser.
+
+General file format:
+
+<Partition Definition>:[<newline>]<Partition Properties>;
+
+     Partition Definition:
+       [PartitionName][=PKey][,ipoib_bc_flags][,defmember=full|limited|both]
+
+        PartitionName  - string, will be used with logging. When omitted
+                         empty string will be used.
+        PKey           - P_Key value for this partition. Only low 15 bits will
+                         be used. When omitted will be autogenerated.
+        ipoib_bc_flags - used to indicate/specify IPoIB capability of this partition.
+
+        defmember=full|limited|both - specifies default membership for port guid
+                         list. Default is limited.
+
+     ipoib_bc_flags:
+        ipoib_flag|[mgroup_flag]*
+
+        ipoib_flag - indicates that this partition may be used for IPoIB, as
+		     a result the IPoIB broadcast group will be created with
+		     the flags given, if any.
+
+     Partition Properties:
+       [<Port list>|<MCast Group>]* | <Port list>
+
+     Port list:
+        <Port Specifier>[,<Port Specifier>]
+
+     Port Specifier:
+        <PortGUID>[=[full|limited|both]]
+
+        PortGUID         - GUID of partition member EndPort. Hexadecimal
+                           numbers should start from 0x, decimal numbers
+                           are accepted too.
+        full or          - indicates full and/or limited membership for this port. When
+        limited or         omitted (or unrecognized) limited membership is assumed.
+        both               Both indicates both full and limited membership for this port.
+
+     MCast Group:
+        mgid=gid[,mgroup_flag]*<newline>
+
+	            - gid specified is verified to be a Multicast address
+		      IP groups are verified to match the rate and mtu of the
+		      broadcast group.  The P_Key bits of the mgid for IP
+		      groups are verified to either match the P_Key specified
+		      in by "Partition Definition" or if they are 0x0000 the
+		      P_Key will be copied into those bits.
+
+     mgroup_flag:
+        rate=<val>  - specifies rate for this MC group
+                      (default is 3 (10GBps))
+        mtu=<val>   - specifies MTU for this MC group
+                      (default is 4 (2048))
+        sl=<val>    - specifies SL for this MC group
+                      (default is 0)
+        scope=<val> - specifies scope for this MC group
+                      (default is 2 (link local)).  Multiple scope settings
+                      are permitted for a partition.
+		      NOTE: This overwrites the scope nibble of the specified
+			    mgid.  Furthermore specifying multiple scope
+			    settings will result in multiple MC groups
+			    being created.
+        qkey=<val>      - specifies the Q_Key for this MC group
+                          (default: 0x0b1b for IP groups, 0 for other groups)
+                          WARNING: changing this for the broadcast group may
+			           break IPoIB on client nodes!!!
+        tclass=<val>    - specifies tclass for this MC group
+                          (default is 0)
+        FlowLabel=<val> - specifies FlowLabel for this MC group
+                          (default is 0)
+
+     newline: '\n'
+
+
+Note that values for rate, mtu, and scope, for both partitions and multicast
+groups, should be specified as defined in the IBTA specification (for example,
+mtu=4 for 2048).
+
+There are several useful keywords for PortGUID definition:
+
+ - 'ALL' means all end ports in this subnet.
+ - 'ALL_CAS' means all Channel Adapter end ports in this subnet.
+ - 'ALL_SWITCHES' means all Switch end ports in this subnet.
+ - 'ALL_ROUTERS' means all Router end ports in this subnet.
+ - 'SELF' means subnet manager's port.
+
+Empty list means no ports in this partition.
+
+
+
+Notes:
+-----
+
+White space is permitted between delimiters ('=', ',',':',';').
+
+PartitionName does not need to be unique, PKey does need to be unique.
+If PKey is repeated then those partition configurations will be merged
+and first PartitionName will be used (see also next note).
+
+It is possible to split partition configuration in more than one
+definition, but then PKey should be explicitly specified (otherwise
+different PKey values will be generated for those definitions).
+
+
+
+Examples:
+--------
+
+ Default=0x7fff : ALL, SELF=full ;
+ Default=0x7fff : ALL, ALL_SWITCHES=full, SELF=full ;
+
+ NewPartition , ipoib : 0x123456=full, 0x3456789034=limi, 0x2134af2306 ;
+
+ YetAnotherOne = 0x300 : SELF=full ;
+ YetAnotherOne = 0x300 : ALL=limited ;
+
+ ShareIO = 0x80 , defmember=full : 0x123451, 0x123452;
+ # 0x123453, 0x123454 will be limited
+ ShareIO = 0x80 : 0x123453, 0x123454, 0x123455=full;
+ # 0x123456, 0x123457 will be limited
+ ShareIO = 0x80 : defmember=limited : 0x123456, 0x123457, 0x123458=full;
+ ShareIO = 0x80 , defmember=full : 0x123459, 0x12345a;
+ ShareIO = 0x80 , defmember=full : 0x12345b, 0x12345c=limited, 0x12345d;
+
+ # multicast groups added to default
+ Default=0x7fff,ipoib:
+        mgid=ff12:401b::0707,sl=1 # random IPv4 group
+        mgid=ff12:601b::16    # MLDv2-capable routers
+        mgid=ff12:401b::16    # IGMP
+        mgid=ff12:601b::2     # All routers
+        mgid=ff12::1,sl=1,Q_Key=0xDEADBEEF,rate=3,mtu=2 # random group
+        ALL=full;
+
+
+Note:
+----
+
+The following rule is equivalent to how OpenSM used to run prior to the
+partition manager:
+
+Default=0x7fff,ipoib:ALL=full;
+
diff --git a/doc/performance-manager-HOWTO.txt b/doc/performance-manager-HOWTO.txt
index 0b35e5f..11f4185 100644
--- a/doc/performance-manager-HOWTO.txt
+++ b/doc/performance-manager-HOWTO.txt
@@ -10,7 +10,7 @@ the subnet and stores them internally in OpenSM.
 Some of the features of the performance manager are:
 
 	1) Collect port data and error counters per v1.2 spec and store in
-	   64bit internal counts.
+	   64 bit internal counts.
 	2) Automatic reset of counters when they reach approximatly 3/4 full.
 	   (While not guarenteeing that counts will not be missed this does
 	   keep counts incrementing as best as possible given the current
@@ -19,12 +19,13 @@ Some of the features of the performance manager are:
 	   errors.
 	4) Automatically detects "outside" resets of counters and adjusts to
 	   continue collecting data.
-	5) Can be run when OpenSM is in standby or inactive states.
+	5) Can be run when OpenSM is in standby or inactive states in
+	   addition to master state.
 
 Known issues are:
 
 	1) Data counters will be lost on high data rate links.  Sweeping the
-	   fabric fast enough for a DDR link is not practical.
+	   fabric fast enough for even a DDR link is not practical.
 	2) Default partition support only.
 
 
@@ -147,7 +148,7 @@ collected.  You can then use that data as appropriate.
 
 An example plugin can be configured at compile time using the
 "--enable-default-event-plugin" option on the configure line.  This plugin is
-very simple.  It logs "events" recieved from the performance manager to a log
-file.  I don't recomend using this directly but rather use it as a templat to
+very simple.  It logs "events" received from the performance manager to a log
+file.  I don't recommend using this directly but rather use it as a template to
 create your own plugin.
 
diff --git a/include/Makefile.in b/include/Makefile.in
index 20cfc1d..1f453f0 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -17,6 +18,7 @@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -35,17 +37,14 @@ subdir = include
 DIST_COMMON = $(nobase_pkginclude_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in $(srcdir)/config.h.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
-	$(top_srcdir)/config/ltoptions.m4 \
-	$(top_srcdir)/config/ltsugar.m4 \
-	$(top_srcdir)/config/ltversion.m4 \
-	$(top_srcdir)/config/lt~obsolete.m4 \
-	$(top_srcdir)/config/osmvsel.m4 $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/osmvsel.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = config.h $(top_builddir)/include/opensm/osm_config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 SOURCES =
 DIST_SOURCES =
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
@@ -60,16 +59,64 @@ am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pkgincludedir)"
-nobase_pkgincludeHEADERS_INSTALL = $(install_sh_DATA)
 HEADERS = $(nobase_pkginclude_HEADERS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
 pkgincludedir = $(includedir)/infiniband
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -87,6 +134,7 @@ CYGPATH_W = @CYGPATH_W@
 DEFAULT_EVENT_PLUGIN = @DEFAULT_EVENT_PLUGIN@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -113,6 +161,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -131,9 +180,11 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PARTITION_CONFIG_FILE = @PARTITION_CONFIG_FILE@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PER_MOD_LOGGING_FILE = @PER_MOD_LOGGING_FILE@
 PREFIX_ROUTES_FILE = @PREFIX_ROUTES_FILE@
 QOS_POLICY_FILE = @QOS_POLICY_FILE@
 RANLIB = @RANLIB@
@@ -143,6 +194,7 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
 TARBALL = @TARBALL@
+TORUS2QOS_CONF_FILE = @TORUS2QOS_CONF_FILE@
 VERSION = @VERSION@
 YACC = @YACC@
 YFLAGS = @YFLAGS@
@@ -152,6 +204,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -184,7 +237,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -242,9 +294,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  include/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  include/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign include/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -262,18 +314,17 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 config.h: stamp-h1
-	@if test ! -f $@; then \
-	  rm -f stamp-h1; \
-	  $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
-	else :; fi
+	@if test ! -f $@; then rm -f stamp-h1; else :; fi
+	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
 
 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
 	@rm -f stamp-h1
 	cd $(top_builddir) && $(SHELL) ./config.status include/config.h
 $(srcdir)/config.h.in:  $(am__configure_deps) 
-	cd $(top_srcdir) && $(AUTOHEADER)
+	($(am__cd) $(top_srcdir) && $(AUTOHEADER))
 	rm -f stamp-h1
 	touch $@
 
@@ -288,22 +339,24 @@ clean-libtool:
 install-nobase_pkgincludeHEADERS: $(nobase_pkginclude_HEADERS)
 	@$(NORMAL_INSTALL)
 	test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
-	@$(am__vpath_adj_setup) \
-	list='$(nobase_pkginclude_HEADERS)'; for p in $$list; do \
-	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  $(am__vpath_adj) \
-	  echo " $(nobase_pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  $(nobase_pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \
+	@list='$(nobase_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	$(am__nobase_list) | while read dir files; do \
+	  xfiles=; for file in $$files; do \
+	    if test -f "$$file"; then xfiles="$$xfiles $$file"; \
+	    else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \
+	  test -z "$$xfiles" || { \
+	    test "x$$dir" = x. || { \
+	      echo "$(MKDIR_P) '$(DESTDIR)$(pkgincludedir)/$$dir'"; \
+	      $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)/$$dir"; }; \
+	    echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(pkgincludedir)/$$dir'"; \
+	    $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(pkgincludedir)/$$dir" || exit $$?; }; \
 	done
 
 uninstall-nobase_pkgincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@$(am__vpath_adj_setup) \
-	list='$(nobase_pkginclude_HEADERS)'; for p in $$list; do \
-	  $(am__vpath_adj) \
-	  echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \
-	done
+	@list='$(nobase_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	$(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
+	dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -312,7 +365,7 @@ uninstall-nobase_pkgincludeHEADERS:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -329,7 +382,7 @@ $(RECURSIVE_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
@@ -337,7 +390,7 @@ $(RECURSIVE_TARGETS):
 	fi; test -z "$$fail"
 
 $(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -363,16 +416,16 @@ $(RECURSIVE_CLEAN_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
 	done
 ctags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
 	done
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -387,7 +440,7 @@ tags: TAGS
 
 TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
@@ -399,7 +452,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test ! -f $$subdir/TAGS || \
-	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
 	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
@@ -408,29 +461,34 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -451,29 +509,44 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test -d "$(distdir)/$$subdir" \
 	    || $(MKDIR_P) "$(distdir)/$$subdir" \
 	    || exit 1; \
-	    distdir=`$(am__cd) $(distdir) && pwd`; \
-	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
-	    (cd $$subdir && \
+	  fi; \
+	done
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$top_distdir" \
-	        distdir="$$distdir/$$subdir" \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
 		am__remove_distdir=: \
 		am__skip_length_check=: \
+		am__skip_mode_fix=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -496,16 +569,22 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -524,6 +603,8 @@ dvi-am:
 
 html: html-recursive
 
+html-am:
+
 info: info-recursive
 
 info-am:
@@ -532,18 +613,28 @@ install-data-am: install-nobase_pkgincludeHEADERS
 
 install-dvi: install-dvi-recursive
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-recursive
 
+install-html-am:
+
 install-info: install-info-recursive
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-recursive
 
+install-pdf-am:
+
 install-ps: install-ps-recursive
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
@@ -564,8 +655,8 @@ ps-am:
 
 uninstall-am: uninstall-nobase_pkgincludeHEADERS
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
-	install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
+	ctags-recursive install-am install-strip tags-recursive
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am check check-am clean clean-generic clean-libtool \
@@ -582,6 +673,7 @@ uninstall-am: uninstall-nobase_pkgincludeHEADERS
 	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
 	uninstall uninstall-am uninstall-nobase_pkgincludeHEADERS
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/include/complib/cl_atomic.h b/include/complib/cl_atomic.h
index 92620ee..ba21442 100644
--- a/include/complib/cl_atomic.h
+++ b/include/complib/cl_atomic.h
@@ -87,8 +87,7 @@ int32_t cl_atomic_inc(IN atomic32_t * const p_value);
 *	synchronization mechanisms in multi-threaded environments.
 *
 * SEE ALSO
-*	Atomic Operations, cl_atomic_dec, cl_atomic_add, cl_atomic_sub,
-*	cl_atomic_xchg, cl_atomic_comp_xchg
+*	Atomic Operations, cl_atomic_dec, cl_atomic_add, cl_atomic_sub
 *********/
 
 /****f* Component Library: Atomic Operations/cl_atomic_dec
@@ -118,8 +117,7 @@ int32_t cl_atomic_dec(IN atomic32_t * const p_value);
 *	synchronization mechanisms in multi-threaded environments.
 *
 * SEE ALSO
-*	Atomic Operations, cl_atomic_inc, cl_atomic_add, cl_atomic_sub,
-*	cl_atomic_xchg, cl_atomic_comp_xchg
+*	Atomic Operations, cl_atomic_inc, cl_atomic_add, cl_atomic_sub
 *********/
 
 /****f* Component Library: Atomic Operations/cl_atomic_add
@@ -153,8 +151,7 @@ cl_atomic_add(IN atomic32_t * const p_value, IN const int32_t increment);
 *	synchronization mechanisms in multi-threaded environments.
 *
 * SEE ALSO
-*	Atomic Operations, cl_atomic_inc, cl_atomic_dec, cl_atomic_sub,
-*	cl_atomic_xchg, cl_atomic_comp_xchg
+*	Atomic Operations, cl_atomic_inc, cl_atomic_dec, cl_atomic_sub
 *********/
 
 /****f* Component Library: Atomic Operations/cl_atomic_sub
@@ -188,8 +185,7 @@ cl_atomic_sub(IN atomic32_t * const p_value, IN const int32_t decrement);
 *	synchronization mechanisms in multi-threaded environments.
 *
 * SEE ALSO
-*	Atomic Operations, cl_atomic_inc, cl_atomic_dec, cl_atomic_add,
-*	cl_atomic_xchg, cl_atomic_comp_xchg
+*	Atomic Operations, cl_atomic_inc, cl_atomic_dec, cl_atomic_add
 *********/
 
 END_C_DECLS
diff --git a/include/complib/cl_atomic_osd.h b/include/complib/cl_atomic_osd.h
index ac14f8a..4df9618 100644
--- a/include/complib/cl_atomic_osd.h
+++ b/include/complib/cl_atomic_osd.h
@@ -52,7 +52,9 @@
 #  define END_C_DECLS
 #endif				/* __cplusplus */
 
-BEGIN_C_DECLS extern cl_spinlock_t cl_atomic_spinlock;
+BEGIN_C_DECLS
+
+extern cl_spinlock_t cl_atomic_spinlock;
 
 static inline int32_t cl_atomic_inc(IN atomic32_t * const p_value)
 {
diff --git a/include/complib/cl_fleximap.h b/include/complib/cl_fleximap.h
index 0af8766..89bc7c0 100644
--- a/include/complib/cl_fleximap.h
+++ b/include/complib/cl_fleximap.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -181,7 +181,7 @@ typedef struct _cl_fmap_item {
 *
 * SYNOPSIS
 */
-typedef intn_t
+typedef int
     (*cl_pfn_fmap_cmp_t) (IN const void *const p_key1,
 			  IN const void *const p_key2);
 /*
@@ -462,8 +462,8 @@ static inline cl_fmap_item_t *cl_fmap_head(IN const cl_fmap_t * const p_map)
 /*
 * PARAMETERS
 *	p_map
-*		[in] Pointer to a cl_fmap_t structure whose item with the lowest key
-*		is returned.
+*		[in] Pointer to a cl_fmap_t structure whose item with the lowest
+*		key is returned.
 *
 * RETURN VALUES
 *	Pointer to the map item with the lowest key in the flexi map.
@@ -601,7 +601,7 @@ cl_fmap_item_t *cl_fmap_insert(IN cl_fmap_t * const p_map,
 *		[in] Pointer to the key value to assign to the item.  Storage
 *		for the key must be persistant, as only the pointer is stored.
 *		Users are responsible for maintaining the validity of key
-*		 pointers while they are in use.
+*		pointers while they are in use.
 *
 *	p_item
 *		[in] Pointer to a cl_fmap_item_t stucture to insert into the flexi map.
@@ -619,6 +619,42 @@ cl_fmap_item_t *cl_fmap_insert(IN cl_fmap_t * const p_map,
 *	Flexi Map, cl_fmap_remove, cl_fmap_item_t
 *********/
 
+/****f* Component Library: Flexi Map/cl_fmap_match
+* NAME
+*	cl_fmap_match
+*
+* DESCRIPTION
+*	The cl_fmap_match function returns the map item matching a key.
+*
+* SYNOPSIS
+*/
+cl_fmap_item_t *cl_fmap_match(IN const cl_fmap_t * const p_map,
+			      IN const void *const p_key,
+			      IN cl_pfn_fmap_cmp_t pfn_compare);
+/*
+* PARAMETERS
+*	p_map
+*		[in] Pointer to a cl_fmap_t structure from which to retrieve the
+*		item with the specified key.
+*
+*	p_key
+*		[in] Pointer to a key value used to search for the desired map item.
+*
+*	pfn_compare
+*		[in] Pointer to a compare function to invoke to compare the
+*		keys of items in the map. Passing NULL here makes such call
+*		to be equivalent to using cl_fmap_get().
+*
+* RETURN VALUES
+*	Pointer to the map item matching the desired key value.
+*
+*	Pointer to the map end if there was no item matching the desired key
+*	value stored in the flexi map.
+*
+* SEE ALSO
+*	Flexi Map, cl_fmap_remove, cl_fmap_get
+*********/
+
 /****f* Component Library: Flexi Map/cl_fmap_get
 * NAME
 *	cl_fmap_get
@@ -657,8 +693,8 @@ cl_fmap_item_t *cl_fmap_get(IN const cl_fmap_t * const p_map,
 *	cl_fmap_get_next
 *
 * DESCRIPTION
-*	The cl_fmap_get_next function returns the first map item associated with a
-*	key > the key specified.
+*	The cl_fmap_get_next function returns the first map item associated with
+*	a key > the key specified.
 *
 * SYNOPSIS
 */
@@ -708,7 +744,7 @@ cl_fmap_remove_item(IN cl_fmap_t * const p_map,
 *	This function does not return a value.
 *
 *	In a debug build, cl_fmap_remove_item asserts that the item being
-*	removed es in the specified map.
+*	removed is in the specified map.
 *
 * NOTES
 *	Removes the map item pointed to by p_item from its flexi map.
diff --git a/include/complib/cl_nodenamemap.h b/include/complib/cl_nodenamemap.h
index 9b2ada4..97984b1 100644
--- a/include/complib/cl_nodenamemap.h
+++ b/include/complib/cl_nodenamemap.h
@@ -56,8 +56,7 @@ typedef cl_qmap_t nn_map_t;
  */
 nn_map_t *open_node_name_map(char *node_name_map);
 void  close_node_name_map(nn_map_t *map);
-char *remap_node_name(nn_map_t *map, uint64_t target_guid,
-			char *nodedesc);
+char *remap_node_name(nn_map_t *map, uint64_t target_guid, char *nodedesc);
 	/* NOTE: parameter "nodedesc" may be modified here. */
 int parse_node_map(const char *file_name,
 		   int (*create)(void *, uint64_t, char *), void *cxt);
diff --git a/include/complib/cl_passivelock.h b/include/complib/cl_passivelock.h
index bafd339..0fad6ef 100644
--- a/include/complib/cl_passivelock.h
+++ b/include/complib/cl_passivelock.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -196,7 +196,7 @@ static inline cl_status_t cl_plock_init(IN cl_plock_t * const p_lock)
 	cl_status_t status;
 
 	CL_ASSERT(p_lock);
-	status = (cl_status_t) pthread_rwlock_init(&p_lock->lock, NULL);
+	status = pthread_rwlock_init(&p_lock->lock, NULL);
 	if (status)
 		return CL_ERROR;
 	p_lock->state = CL_INITIALIZED;
@@ -234,11 +234,11 @@ static inline cl_status_t cl_plock_init(IN cl_plock_t * const p_lock)
 */
 static inline void cl_plock_acquire(IN cl_plock_t * const p_lock)
 {
-	cl_status_t status;
+	cl_status_t __attribute__((unused)) status;
 	CL_ASSERT(p_lock);
 	CL_ASSERT(p_lock->state == CL_INITIALIZED);
 
-	status = (cl_status_t) pthread_rwlock_rdlock(&p_lock->lock);
+	status = pthread_rwlock_rdlock(&p_lock->lock);
 	CL_ASSERT(status == 0);
 }
 
@@ -266,12 +266,12 @@ static inline void cl_plock_acquire(IN cl_plock_t * const p_lock)
 */
 static inline void cl_plock_excl_acquire(IN cl_plock_t * const p_lock)
 {
-	cl_status_t status;
+	cl_status_t __attribute__((unused)) status;
 
 	CL_ASSERT(p_lock);
 	CL_ASSERT(p_lock->state == CL_INITIALIZED);
 
-	status = (cl_status_t) pthread_rwlock_wrlock(&p_lock->lock);
+	status = pthread_rwlock_wrlock(&p_lock->lock);
 	CL_ASSERT(status == 0);
 }
 
@@ -299,11 +299,11 @@ static inline void cl_plock_excl_acquire(IN cl_plock_t * const p_lock)
 */
 static inline void cl_plock_release(IN cl_plock_t * const p_lock)
 {
-	cl_status_t status;
+	cl_status_t __attribute__((unused)) status;
 	CL_ASSERT(p_lock);
 	CL_ASSERT(p_lock->state == CL_INITIALIZED);
 
-	status = (cl_status_t) pthread_rwlock_unlock(&p_lock->lock);
+	status = pthread_rwlock_unlock(&p_lock->lock);
 	CL_ASSERT(status == 0);
 }
 
diff --git a/include/complib/cl_ptr_vector.h b/include/complib/cl_ptr_vector.h
index d4af0fe..c767f31 100644
--- a/include/complib/cl_ptr_vector.h
+++ b/include/complib/cl_ptr_vector.h
@@ -254,7 +254,7 @@ cl_ptr_vector_init(IN cl_ptr_vector_t * const p_vector,
 *	p_vector
 *		[in] Pointer to a cl_ptr_vector_t structure to inititalize.
 *
-*	initial_size
+*	min_size
 *		[in] Initial number of elements.
 *
 *	grow_size
diff --git a/include/complib/cl_types.h b/include/complib/cl_types.h
index 84f629d..a773e51 100644
--- a/include/complib/cl_types.h
+++ b/include/complib/cl_types.h
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -89,7 +89,7 @@ typedef uint64_t net64_t;
 *	The offsetof macro returns the offset of a member within a structure.
 *
 * SYNOPSIS
-*	uintn_t
+*	uintptr_t
 *	offsetof(
 *		IN TYPE,
 *		IN MEMBER );
@@ -110,7 +110,7 @@ typedef uint64_t net64_t;
 *	PARENT_STRUCT
 *********/
 #ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((uintn_t) &((TYPE *)0)->MEMBER)
+#define offsetof(TYPE, MEMBER) ((uintptr_t) &((TYPE *)0)->MEMBER)
 #endif
 
 /****d* Component Library: Pointer Manipulation/PARENT_STRUCT
@@ -245,14 +245,6 @@ typedef uint64_t net64_t;
 *	net64_t
 *		64-bit network byte order value.
 *
-*	intn_t
-*		Signed natural sized integer.  32-bit on a 32-bit platform, 64-bit on
-*		a 64-bit platform.
-*
-*	uintn_t
-*		Unsigned natural sized integer.  32-bit on a 32-bit platform, 64-bit on
-*		a 64-bit platform.
-*
 *	boolean_t
 *		integral sized.  Set to TRUE or FALSE and used in logical expressions.
 *
@@ -271,31 +263,30 @@ typedef uint64_t net64_t;
 *
 * SYNOPSIS
 */
-typedef enum _cl_status {
-	CL_SUCCESS = 0,
-	CL_ERROR,
-	CL_INVALID_STATE,
-	CL_INVALID_OPERATION,
-	CL_INVALID_SETTING,
-	CL_INVALID_PARAMETER,
-	CL_INSUFFICIENT_RESOURCES,
-	CL_INSUFFICIENT_MEMORY,
-	CL_INVALID_PERMISSION,
-	CL_COMPLETED,
-	CL_NOT_DONE,
-	CL_PENDING,
-	CL_TIMEOUT,
-	CL_CANCELED,
-	CL_REJECT,
-	CL_OVERRUN,
-	CL_NOT_FOUND,
-	CL_UNAVAILABLE,
-	CL_BUSY,
-	CL_DISCONNECT,
-	CL_DUPLICATE,
+#define CL_SUCCESS                 0
+#define CL_ERROR                   1
+#define CL_INVALID_STATE           2
+#define CL_INVALID_OPERATION       3
+#define CL_INVALID_SETTING         4
+#define CL_INVALID_PARAMETER       5
+#define CL_INSUFFICIENT_RESOURCES  6
+#define CL_INSUFFICIENT_MEMORY     7
+#define CL_INVALID_PERMISSION      8
+#define CL_COMPLETED               9
+#define CL_NOT_DONE               10
+#define CL_PENDING                11
+#define CL_TIMEOUT                12
+#define CL_CANCELED               13
+#define CL_REJECT                 14
+#define CL_OVERRUN                15
+#define CL_NOT_FOUND              16
+#define CL_UNAVAILABLE            17
+#define CL_BUSY                   18
+#define CL_DISCONNECT             19
+#define CL_DUPLICATE              20
+#define CL_STATUS_COUNT           21 /* should be the last value */
 
-	CL_STATUS_COUNT		/* should be the last value */
-} cl_status_t;
+typedef int cl_status_t;
 /*
 * SEE ALSO
 *	Data Types, CL_STATUS_MSG
diff --git a/include/complib/cl_types_osd.h b/include/complib/cl_types_osd.h
index d12aa4c..ce1a452 100644
--- a/include/complib/cl_types_osd.h
+++ b/include/complib/cl_types_osd.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -37,8 +37,7 @@
  * Abstract:
  *	Defines sized datatypes for Linux User mode
  *  exported sizes are int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t
- *  int64_t, uint64_t. uintn_t is a polymorphic type, size is native size and
- *  also size of the pointer.
+ *  int64_t, uint64_t.
  */
 
 #ifndef _CL_TYPES_OSD_H_
@@ -73,8 +72,6 @@ BEGIN_C_DECLS
 /*
  * Types not explicitly defined are native to the platform.
  */
-typedef unsigned long uintn_t;
-typedef long intn_t;
 typedef int boolean_t;
 typedef volatile int32_t atomic32_t;
 
diff --git a/include/complib/cl_vector.h b/include/complib/cl_vector.h
index 11c45f8..f66172b 100644
--- a/include/complib/cl_vector.h
+++ b/include/complib/cl_vector.h
@@ -393,7 +393,7 @@ cl_vector_init(IN cl_vector_t * const p_vector,
 *	p_vector
 *		[in] Pointer to a cl_vector_t structure to inititalize.
 *
-*	initial_size
+*	min_size
 *		[in] Initial number of elements.
 *
 *	grow_size
diff --git a/include/config.h.in b/include/config.h.in
index 49af898..1053319 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -3,6 +3,9 @@
 /* Define as 1 if you want Dual Sided RMPP Support */
 #undef DUAL_SIDED_RMPP
 
+/* Define as 1 if you want to enable a loopback console */
+#undef ENABLE_OSM_CONSOLE_LOOPBACK
+
 /* Define as 1 if you want to enable a console on a socket connection */
 #undef ENABLE_OSM_CONSOLE_SOCKET
 
@@ -24,6 +27,9 @@
 /* Define a Partition config file */
 #undef HAVE_DEFAULT_PARTITION_CONFIG_FILE
 
+/* Define a Per Module Logging config file */
+#undef HAVE_DEFAULT_PER_MOD_LOGGING_FILE
+
 /* Define a Prefix Routes config file */
 #undef HAVE_DEFAULT_PREFIX_ROUTES_FILE
 
@@ -112,6 +118,9 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
diff --git a/include/iba/ib_cm_types.h b/include/iba/ib_cm_types.h
index c1fbfaf..061f47b 100644
--- a/include/iba/ib_cm_types.h
+++ b/include/iba/ib_cm_types.h
@@ -36,7 +36,7 @@
 #if !defined(__IB_CM_TYPES_H__)
 #define __IB_CM_TYPES_H__
 
-#ifndef WIN32
+#ifndef __WIN__
 
 #include <iba/ib_types.h>
 
@@ -199,5 +199,5 @@ typedef uint16_t ib_sidr_status_t;
 #define IB_SIDR_UNSUPPORTED_VER				5
 
 END_C_DECLS
-#endif				/* ndef WIN32 */
+#endif				/* ndef __WIN__ */
 #endif				/* __IB_CM_TYPES_H__ */
diff --git a/include/iba/ib_types.h b/include/iba/ib_types.h
index 0f9d110..c8d51ca 100644
--- a/include/iba/ib_types.h
+++ b/include/iba/ib_types.h
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -49,7 +50,7 @@
 #endif				/* __cplusplus */
 
 BEGIN_C_DECLS
-#if defined( WIN32 ) || defined( _WIN64 )
+#if defined( __WIN__ )
 #if defined( EXPORT_AL_SYMBOLS )
 #define OSM_EXPORT	__declspec(dllexport)
 #else
@@ -260,7 +261,7 @@ BEGIN_C_DECLS
 *	IB_MC_SCOPE_*
 *
 * DESCRIPTION
-*	Scope component definitions from IBA 1.2 (Table 3 p. 146)
+*	Scope component definitions from IBA 1.2.1 (Table 3 p. 148)
 */
 #define IB_MC_SCOPE_LINK_LOCAL		0x2
 #define IB_MC_SCOPE_SITE_LOCAL		0x5
@@ -531,6 +532,17 @@ BEGIN_C_DECLS
 */
 #define IB_MCLASS_BIS 0x12
 /**********/
+/****d* IBA Base: Constants/IB_MCLASS_CC
+* NAME
+*	IB_MCLASS_CC
+*
+* DESCRIPTION
+*	Management Class, Congestion Control (A10.4.1)
+*
+* SOURCE
+*/
+#define IB_MCLASS_CC 0x21
+/**********/
 /****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MIN
 * NAME
 *	IB_MCLASS_VENDOR_HIGH_RANGE_MIN
@@ -1029,6 +1041,42 @@ static inline boolean_t OSM_API ib_class_is_rmpp(IN const uint8_t class_code)
 #define IB_MAD_ATTR_PORT_CNTRS				(CL_HTON16(0x0012))
 /**********/
 
+/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_CNTRS_EXT
+* NAME
+*       IB_MAD_ATTR_PORT_CNTRS_EXT
+*
+* DESCRIPTION
+*       PortCountersExtended attribute (16.1.4)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_PORT_CNTRS_EXT			(CL_HTON16(0x001D))
+/**********/
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_XMIT_DATA_SL
+* NAME
+*	IB_MAD_ATTR_PORT_XMIT_DATA_SL
+*
+* DESCRIPTION
+*	PortXmitDataSL attribute (A13.6.4)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_PORT_XMIT_DATA_SL			(CL_HTON16(0x0036))
+/**********/
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_RCV_DATA_SL
+* NAME
+*	IB_MAD_ATTR_PORT_RCV_DATA_SL
+*
+* DESCRIPTION
+*	PortRcvDataSL attribute (A13.6.4)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_PORT_RCV_DATA_SL			(CL_HTON16(0x0037))
+/**********/
+
 /****d* IBA Base: Constants/IB_MAD_ATTR_GUID_INFO
 * NAME
 *	IB_MAD_ATTR_GUID_INFO
@@ -1233,6 +1281,18 @@ static inline boolean_t OSM_API ib_class_is_rmpp(IN const uint8_t class_code)
 #define IB_MAD_ATTR_LED_INFO				(CL_HTON16(0x0031))
 /**********/
 
+/****d* IBA Base: Constants/IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO
+* NAME
+*	IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO
+*
+* DESCRIPTION
+*	Vendor specific SM attribute (14.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO		(CL_HTON16(0xFF90))
+/**********/
+
 /****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_RECORD
 * NAME
 *	IB_MAD_ATTR_SERVICE_RECORD
@@ -1484,6 +1544,102 @@ static inline boolean_t OSM_API ib_class_is_rmpp(IN const uint8_t class_code)
 #define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD	(CL_HTON16(0x003B))
 /**********/
 
+/****d* IBA Base: Constants/IB_MAD_ATTR_CONG_INFO
+* NAME
+*	IB_MAD_ATTR_CONG_INFO
+*
+* DESCRIPTION
+*	CongestionInfo attribute (A10.4.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_CONG_INFO				(CL_HTON16(0x0011))
+/**********/
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_CONG_KEY_INFO
+* NAME
+*	IB_MAD_ATTR_CONG_KEY_INFO
+*
+* DESCRIPTION
+*	CongestionKeyInfo attribute (A10.4.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_CONG_KEY_INFO			(CL_HTON16(0x0012))
+/**********/
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_CONG_LOG
+* NAME
+*	IB_MAD_ATTR_CONG_LOG
+*
+* DESCRIPTION
+*	CongestionLog attribute (A10.4.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_CONG_LOG				(CL_HTON16(0x0013))
+/**********/
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_SW_CONG_SETTING
+* NAME
+*	IB_MAD_ATTR_SW_CONG_SETTING
+*
+* DESCRIPTION
+*	SwitchCongestionSetting attribute (A10.4.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_SW_CONG_SETTING			(CL_HTON16(0x0014))
+/**********/
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_SW_PORT_CONG_SETTING
+* NAME
+*	IB_MAD_ATTR_SW_PORT_CONG_SETTING
+*
+* DESCRIPTION
+*	SwitchPortCongestionSetting attribute (A10.4.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_SW_PORT_CONG_SETTING		(CL_HTON16(0x0015))
+/**********/
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_CA_CONG_SETTING
+* NAME
+*	IB_MAD_ATTR_CA_CONG_SETTING
+*
+* DESCRIPTION
+*	CACongestionSetting attribute (A10.4.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_CA_CONG_SETTING			(CL_HTON16(0x0016))
+/**********/
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_CC_TBL
+* NAME
+*	IB_MAD_ATTR_CC_TBL
+*
+* DESCRIPTION
+*	CongestionControlTable attribute (A10.4.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_CC_TBL				(CL_HTON16(0x0017))
+/**********/
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_TIME_STAMP
+* NAME
+*	IB_MAD_ATTR_TIME_STAMP
+*
+* DESCRIPTION
+*	TimeStamp attribute (A10.4.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_TIME_STAMP				(CL_HTON16(0x0018))
+/**********/
+
 /****d* IBA Base: Constants/IB_NODE_TYPE_CA
 * NAME
 *	IB_NODE_TYPE_CA
@@ -2073,10 +2229,7 @@ static inline boolean_t OSM_API ib_pkey_is_full_member(IN const ib_net16_t pkey)
 */
 static inline boolean_t OSM_API ib_pkey_is_invalid(IN const ib_net16_t pkey)
 {
-	if (ib_pkey_get_base(pkey) == 0x0000)
-		return TRUE;
-
-	return FALSE;
+	return ib_pkey_get_base(pkey) == 0x0000 ? TRUE : FALSE;
 }
 
 /*
@@ -2106,15 +2259,11 @@ typedef union _ib_gid {
 	struct _ib_gid_unicast {
 		ib_gid_prefix_t prefix;
 		ib_net64_t interface_id;
-
 	} PACK_SUFFIX unicast;
-
 	struct _ib_gid_multicast {
 		uint8_t header[2];
 		uint8_t raw_group_id[14];
-
 	} PACK_SUFFIX multicast;
-
 } PACK_SUFFIX ib_gid_t;
 #include <complib/cl_packoff.h>
 /*
@@ -2359,7 +2508,6 @@ typedef struct _ib_path_rec {
 	uint8_t pkt_life;
 	uint8_t preference;
 	uint8_t resv2[6];
-
 } PACK_SUFFIX ib_path_rec_t;
 #include <complib/cl_packoff.h>
 /*
@@ -2386,7 +2534,7 @@ typedef struct _ib_path_rec {
 *		Another global routing parameter.
 *
 *	num_path
-*     Reversible path - 1 bit to say if path is reversible.
+*		Reversible path - 1 bit to say if path is reversible.
 *		num_path [6:0] In queries, maximum number of paths to return.
 *		In responses, undefined.
 *
@@ -2533,7 +2681,7 @@ typedef struct _ib_path_rec {
 /* Port Info Record Component Masks */
 #define IB_PIR_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
 #define IB_PIR_COMPMASK_PORTNUM          (CL_HTON64(((uint64_t)1)<<1))
-#define IB_PIR_COMPMASK_RESV1            (CL_HTON64(((uint64_t)1)<<2))
+#define IB_PIR_COMPMASK_OPTIONS		 (CL_HTON64(((uint64_t)1)<<2))
 #define IB_PIR_COMPMASK_MKEY             (CL_HTON64(((uint64_t)1)<<3))
 #define IB_PIR_COMPMASK_GIDPRE           (CL_HTON64(((uint64_t)1)<<4))
 #define IB_PIR_COMPMASK_BASELID          (CL_HTON64(((uint64_t)1)<<5))
@@ -2574,12 +2722,21 @@ typedef struct _ib_path_rec {
 #define IB_PIR_COMPMASK_PKEYVIO          (CL_HTON64(((uint64_t)1)<<40))
 #define IB_PIR_COMPMASK_QKEYVIO          (CL_HTON64(((uint64_t)1)<<41))
 #define IB_PIR_COMPMASK_GUIDCAP          (CL_HTON64(((uint64_t)1)<<42))
-#define IB_PIR_COMPMASK_RESV3            (CL_HTON64(((uint64_t)1)<<43))
-#define IB_PIR_COMPMASK_SUBNTO           (CL_HTON64(((uint64_t)1)<<44))
-#define IB_PIR_COMPMASK_RESV4            (CL_HTON64(((uint64_t)1)<<45))
-#define IB_PIR_COMPMASK_RESPTIME         (CL_HTON64(((uint64_t)1)<<46))
-#define IB_PIR_COMPMASK_LOCALPHYERR      (CL_HTON64(((uint64_t)1)<<47))
-#define IB_PIR_COMPMASK_OVERRUNERR       (CL_HTON64(((uint64_t)1)<<48))
+#define IB_PIR_COMPMASK_CLIENTREREG	 (CL_HTON64(((uint64_t)1)<<43))
+#define IB_PIR_COMPMASK_RESV3            (CL_HTON64(((uint64_t)1)<<44))
+#define IB_PIR_COMPMASK_SUBNTO           (CL_HTON64(((uint64_t)1)<<45))
+#define IB_PIR_COMPMASK_RESV4            (CL_HTON64(((uint64_t)1)<<46))
+#define IB_PIR_COMPMASK_RESPTIME         (CL_HTON64(((uint64_t)1)<<47))
+#define IB_PIR_COMPMASK_LOCALPHYERR      (CL_HTON64(((uint64_t)1)<<48))
+#define IB_PIR_COMPMASK_OVERRUNERR       (CL_HTON64(((uint64_t)1)<<49))
+#define IB_PIR_COMPMASK_MAXCREDHINT	 (CL_HTON64(((uint64_t)1)<<50))
+#define IB_PIR_COMPMASK_RESV5		 (CL_HTON64(((uint64_t)1)<<51))
+#define IB_PIR_COMPMASK_LINKRTLAT	 (CL_HTON64(((uint64_t)1)<<52))
+#define IB_PIR_COMPMASK_CAPMASK2	 (CL_HTON64(((uint64_t)1)<<53))
+#define IB_PIR_COMPMASK_LINKSPDEXTACT	 (CL_HTON64(((uint64_t)1)<<54))
+#define IB_PIR_COMPMASK_LINKSPDEXTSUPP	 (CL_HTON64(((uint64_t)1)<<55))
+#define IB_PIR_COMPMASK_RESV7		 (CL_HTON64(((uint64_t)1)<<56))
+#define IB_PIR_COMPMASK_LINKSPDEXTENAB	 (CL_HTON64(((uint64_t)1)<<57))
 
 /* Multicast Member Record Component Masks */
 #define IB_MCR_COMPMASK_GID         (CL_HTON64(((uint64_t)1)<<0))
@@ -2716,8 +2873,7 @@ ib_path_rec_init_local(IN ib_path_rec_t * const p_rec,
 	p_rec->tclass = 0;
 	p_rec->service_id = 0;
 
-	*((uint32_t *) p_rec->resv2) = 0;
-	*((uint16_t *) p_rec->resv2 + 2) = 0;
+	memset(p_rec->resv2, 0, sizeof(p_rec->resv2));
 }
 
 /*
@@ -2738,7 +2894,7 @@ ib_path_rec_init_local(IN ib_path_rec_t * const p_rec,
 *		[in] LID of source port.
 *
 *	num_path
-*     [in] Reversible path - 1 bit to say if path is reversible.
+*		[in] Reversible path - 1 bit to say if path is reversible.
 *		num_path [6:0] In queries, maximum number of paths to return.
 *		In responses, undefined.
 *
@@ -3037,6 +3193,14 @@ ib_path_rec_rate(IN const ib_path_rec_t * const p_rec)
 *		8: 60 Gb/sec.
 *		9: 80 Gb/sec.
 *		10: 120 Gb/sec.
+*		11: 14 Gb/sec.
+*		12: 56 Gb/sec.
+*		13: 112 Gb/sec.
+*		14: 168 Gb/sec.
+*		15: 25 Gb/sec.
+*		16: 100 Gb/sec.
+*		17: 200 Gb/sec.
+*		18: 300 Gb/sec.
 *		others: reserved
 *
 * NOTES
@@ -3230,6 +3394,23 @@ ib_path_rec_hop_limit(IN const ib_path_rec_t * const p_rec)
 #define IB_CLASS_CAP_GETSET					0x0002
 /*********/
 
+/****s* IBA Base: Constants/IB_CLASS_ENH_PORT0_CC_MASK
+* NAME
+*	IB_CLASS_ENH_PORT0_CC_MASK
+*
+* DESCRIPTION
+*	ClassPortInfo CapabilityMask bits.
+*	Switch only: This bit will be set if the EnhacedPort0
+*	supports CA Congestion Control (A10.4.3.1).
+*
+* SEE ALSO
+*	ib_class_port_info_t
+*
+* SOURCE
+*/
+#define IB_CLASS_ENH_PORT0_CC_MASK			0x0100
+/*********/
+
 /****s* IBA Base: Constants/IB_CLASS_RESP_TIME_MASK
 * NAME
 *	IB_CLASS_RESP_TIME_MASK
@@ -3252,7 +3433,6 @@ ib_path_rec_hop_limit(IN const ib_path_rec_t * const p_rec)
 *
 * DESCRIPTION
 *	IBA defined ClassPortInfo attribute (13.4.8.1)
-*	route between two end-points on a subnet.
 *
 * SYNOPSIS
 */
@@ -3274,7 +3454,6 @@ typedef struct _ib_class_port_info {
 	ib_net16_t trap_pkey;
 	ib_net32_t trap_hop_qp;
 	ib_net32_t trap_qkey;
-
 } PACK_SUFFIX ib_class_port_info_t;
 #include <complib/cl_packoff.h>
 /*
@@ -3292,10 +3471,10 @@ typedef struct _ib_class_port_info {
 *		Maximum expected response time and additional
 *		supported capabilities of this management class.
 *
-*	redr_gid
+*	redir_gid
 *		GID to use for redirection, or zero
 *
-*	recdir_tc_sl_fl
+*	redir_tc_sl_fl
 *		Traffic class, service level and flow label the requester
 *		should use if the service is redirected.
 *
@@ -3336,6 +3515,12 @@ typedef struct _ib_class_port_info {
 *
 *********/
 
+#define IB_PM_ALL_PORT_SELECT			(CL_HTON16(((uint16_t)1)<<8))
+#define IB_PM_EXT_WIDTH_SUPPORTED		(CL_HTON16(((uint16_t)1)<<9))
+#define IB_PM_EXT_WIDTH_NOIETF_SUP		(CL_HTON16(((uint16_t)1)<<10))
+#define IB_PM_SAMPLES_ONLY_SUP			(CL_HTON16(((uint16_t)1)<<11))
+#define IB_PM_PC_XMIT_WAIT_SUP			(CL_HTON16(((uint16_t)1)<<12))
+
 /****f* IBA Base: Types/ib_class_set_resp_time_val
 * NAME
 *	ib_class_set_resp_time_val
@@ -3480,7 +3665,6 @@ typedef struct _ib_sm_info {
 	ib_net64_t sm_key;
 	ib_net32_t act_count;
 	uint8_t pri_state;
-
 } PACK_SUFFIX ib_sm_info_t;
 #include <complib/cl_packoff.h>
 /*
@@ -3626,15 +3810,12 @@ typedef struct _ib_mad {
 #include <complib/cl_packon.h>
 typedef struct _ib_rmpp_mad {
 	ib_mad_t common_hdr;
-
 	uint8_t rmpp_version;
 	uint8_t rmpp_type;
 	uint8_t rmpp_flags;
 	uint8_t rmpp_status;
-
 	ib_net32_t seg_num;
 	ib_net32_t paylen_newwin;
-
 } PACK_SUFFIX ib_rmpp_mad_t;
 #include <complib/cl_packoff.h>
 /*
@@ -3752,7 +3933,8 @@ ib_mad_init_response(IN const ib_mad_t * const p_req_mad,
 *	ib_mad_is_response
 *
 * DESCRIPTION
-*	Returns TRUE if the MAD is a response ('R' bit set),
+*	Returns TRUE if the MAD is a response ('R' bit set)
+*	or if the MAD is a TRAP REPRESS,
 *	FALSE otherwise.
 *
 * SYNOPSIS
@@ -3761,8 +3943,8 @@ static inline boolean_t OSM_API
 ib_mad_is_response(IN const ib_mad_t * const p_mad)
 {
 	CL_ASSERT(p_mad);
-	return ((p_mad->method & IB_MAD_METHOD_RESP_MASK) ==
-		IB_MAD_METHOD_RESP_MASK);
+	return (p_mad->method & IB_MAD_METHOD_RESP_MASK ||
+		p_mad->method == IB_MAD_METHOD_TRAP_REPRESS);
 }
 
 /*
@@ -3908,7 +4090,6 @@ typedef struct _ib_smp {
 	uint8_t data[IB_SMP_DATA_SIZE];
 	uint8_t initial_path[IB_SUBNET_PATH_HOPS_MAX];
 	uint8_t return_path[IB_SUBNET_PATH_HOPS_MAX];
-
 } PACK_SUFFIX ib_smp_t;
 #include <complib/cl_packoff.h>
 /*
@@ -4065,7 +4246,7 @@ static inline boolean_t OSM_API ib_smp_is_d(IN const ib_smp_t * const p_smp)
 *
 * TODO
 *	This is too big for inlining, but leave it here for now
-*	since there is not yet another convient spot.
+*	since there is not yet another convenient spot.
 *
 * SYNOPSIS
 */
@@ -4195,7 +4376,6 @@ typedef struct _ib_node_info {
 	ib_net16_t device_id;
 	ib_net32_t revision;
 	ib_net32_t port_num_vendor_id;
-
 } PACK_SUFFIX ib_node_info_t;
 #include <complib/cl_packoff.h>
 /************/
@@ -4223,22 +4403,16 @@ typedef struct _ib_sa_mad {
 	ib_net16_t attr_id;
 	ib_net16_t resv1;
 	ib_net32_t attr_mod;
-
 	uint8_t rmpp_version;
 	uint8_t rmpp_type;
 	uint8_t rmpp_flags;
 	uint8_t rmpp_status;
-
 	ib_net32_t seg_num;
 	ib_net32_t paylen_newwin;
-
 	ib_net64_t sm_key;
-
 	ib_net16_t attr_offset;
 	ib_net16_t resv3;
-
 	ib_net64_t comp_mask;
-
 	uint8_t data[IB_SA_DATA_SIZE];
 } PACK_SUFFIX ib_sa_mad_t;
 #include <complib/cl_packoff.h>
@@ -4297,7 +4471,7 @@ ib_sa_mad_get_payload_ptr(IN const ib_sa_mad_t * const p_sa_mad)
 *	ib_node_info_get_local_port_num
 *
 * DESCRIPTION
-*	Gets a the local port number from the NodeInfo attribute.
+*	Gets the local port number from the NodeInfo attribute.
 *
 * SYNOPSIS
 */
@@ -4357,11 +4531,10 @@ ib_node_info_get_vendor_id(IN const ib_node_info_t * const p_ni)
 
 #include <complib/cl_packon.h>
 typedef struct _ib_node_desc {
-	// Node String is an array of UTF-8 character that
-	// describes the node in text format
+	// Node String is an array of UTF-8 characters
+	// that describe the node in text format
 	// Note that this string is NOT NULL TERMINATED!
 	uint8_t description[IB_NODE_DESCRIPTION_SIZE];
-
 } PACK_SUFFIX ib_node_desc_t;
 #include <complib/cl_packoff.h>
 
@@ -4372,7 +4545,6 @@ typedef struct _ib_node_record_t {
 	ib_node_info_t node_info;
 	ib_node_desc_t node_desc;
 	uint8_t pad[4];
-
 } PACK_SUFFIX ib_node_record_t;
 #include <complib/cl_packoff.h>
 
@@ -4400,7 +4572,7 @@ typedef struct _ib_port_info {
 	uint8_t link_width_active;
 	uint8_t state_info1;	/* LinkSpeedSupported and PortState */
 	uint8_t state_info2;	/* PortPhysState and LinkDownDefaultState */
-	uint8_t mkey_lmc;
+	uint8_t mkey_lmc;	/* M_KeyProtectBits and LMC */
 	uint8_t link_speed;	/* LinkSpeedEnabled and LinkSpeedActive */
 	uint8_t mtu_smsl;
 	uint8_t vl_cap;		/* VLCap and InitType */
@@ -4414,11 +4586,14 @@ typedef struct _ib_port_info {
 	ib_net16_t p_key_violations;
 	ib_net16_t q_key_violations;
 	uint8_t guid_cap;
-	uint8_t subnet_timeout;	/* cli_rereg(1b), resrv(
-				   2b), timeout(5b) */
-	uint8_t resp_time_value;
-	uint8_t error_threshold;
-
+	uint8_t subnet_timeout;	/* cli_rereg(1b), mcast_pkey_trap_suppr(1b), reserv(1b), timeout(5b) */
+	uint8_t resp_time_value; /* reserv(3b), rtv(5b) */
+	uint8_t error_threshold; /* local phy errors(4b), overrun errors(4b) */
+	ib_net16_t max_credit_hint;
+	ib_net32_t link_rt_latency; /* reserv(8b), link round trip lat(24b) */
+	ib_net16_t capability_mask2;
+	uint8_t link_speed_ext;	/* LinkSpeedExtActive and LinkSpeedExtSupported */
+	uint8_t link_speed_ext_enabled; /* reserv(3b), LinkSpeedExtEnabled(5b) */
 } PACK_SUFFIX ib_port_info_t;
 #include <complib/cl_packoff.h>
 /************/
@@ -4458,8 +4633,8 @@ typedef struct _ib_port_info {
 #define IB_PORT_CAP_HAS_SYS_IMG_GUID  (CL_HTON32(0x00000800))
 #define IB_PORT_CAP_HAS_PKEY_SW_EXT_PORT_TRAP (CL_HTON32(0x00001000))
 #define IB_PORT_CAP_RESV13        (CL_HTON32(0x00002000))
-#define IB_PORT_CAP_RESV14        (CL_HTON32(0x00004000))
-#define IB_PORT_CAP_RESV15        (CL_HTON32(0x00008000))
+#define IB_PORT_CAP_HAS_EXT_SPEEDS  (CL_HTON32(0x00004000))
+#define IB_PORT_CAP_HAS_CAP_MASK2 (CL_HTON32(0x00008000))
 #define IB_PORT_CAP_HAS_COM_MGT   (CL_HTON32(0x00010000))
 #define IB_PORT_CAP_HAS_SNMP      (CL_HTON32(0x00020000))
 #define IB_PORT_CAP_REINIT        (CL_HTON32(0x00040000))
@@ -4472,10 +4647,10 @@ typedef struct _ib_port_info {
 #define IB_PORT_CAP_HAS_CLIENT_REREG (CL_HTON32(0x02000000))
 #define IB_PORT_CAP_HAS_OTHER_LOCAL_CHANGES_NTC (CL_HTON32(0x04000000))
 #define IB_PORT_CAP_HAS_LINK_SPEED_WIDTH_PAIRS_TBL (CL_HTON32(0x08000000))
-#define IB_PORT_CAP_RESV28        (CL_HTON32(0x10000000))
-#define IB_PORT_CAP_RESV29        (CL_HTON32(0x20000000))
-#define IB_PORT_CAP_RESV30        (CL_HTON32(0x40000000))
-#define IB_PORT_CAP_RESV31        (CL_HTON32(0x80000000))
+#define IB_PORT_CAP_HAS_VEND_MADS (CL_HTON32(0x10000000))
+#define IB_PORT_CAP_HAS_MCAST_PKEY_TRAP_SUPPRESS (CL_HTON32(0x20000000))
+#define IB_PORT_CAP_HAS_MCAST_FDB_TOP (CL_HTON32(0x40000000))
+#define IB_PORT_CAP_HAS_HIER_INFO (CL_HTON32(0x80000000))
 
 /****f* IBA Base: Types/ib_port_info_get_port_state
 * NAME
@@ -4912,6 +5087,11 @@ ib_port_info_get_link_speed_active(IN const ib_port_info_t * const p_pi)
 #define IB_LINK_SPEED_ACTIVE_2_5		1
 #define IB_LINK_SPEED_ACTIVE_5			2
 #define IB_LINK_SPEED_ACTIVE_10			4
+#define IB_LINK_SPEED_EXT_ACTIVE_NONE		0
+#define IB_LINK_SPEED_EXT_ACTIVE_14		1
+#define IB_LINK_SPEED_EXT_ACTIVE_25		2
+#define IB_LINK_SPEED_EXT_DISABLE		30
+#define IB_LINK_SPEED_EXT_SET_LSES		31
 
 /* following v1 ver1.2 p901 */
 #define IB_PATH_RECORD_RATE_2_5_GBS		2
@@ -4923,9 +5103,20 @@ ib_port_info_get_link_speed_active(IN const ib_port_info_t * const p_pi)
 #define IB_PATH_RECORD_RATE_60_GBS		8
 #define IB_PATH_RECORD_RATE_80_GBS		9
 #define IB_PATH_RECORD_RATE_120_GBS		10
+#define IB_PATH_RECORD_RATE_14_GBS		11
+#define IB_PATH_RECORD_RATE_56_GBS		12
+#define IB_PATH_RECORD_RATE_112_GBS		13
+#define IB_PATH_RECORD_RATE_168_GBS		14
+#define IB_PATH_RECORD_RATE_25_GBS		15
+#define IB_PATH_RECORD_RATE_100_GBS		16
+#define IB_PATH_RECORD_RATE_200_GBS		17
+#define IB_PATH_RECORD_RATE_300_GBS		18
 
 #define IB_MIN_RATE    IB_PATH_RECORD_RATE_2_5_GBS
-#define IB_MAX_RATE    IB_PATH_RECORD_RATE_120_GBS
+#define IB_MAX_RATE    IB_PATH_RECORD_RATE_300_GBS
+
+static inline uint8_t OSM_API
+ib_port_info_get_link_speed_ext_active(IN const ib_port_info_t * const p_pi);
 
 /****f* IBA Base: Types/ib_port_info_compute_rate
 * NAME
@@ -4937,10 +5128,67 @@ ib_port_info_get_link_speed_active(IN const ib_port_info_t * const p_pi)
 * SYNOPSIS
 */
 static inline uint8_t OSM_API
-ib_port_info_compute_rate(IN const ib_port_info_t * const p_pi)
+ib_port_info_compute_rate(IN const ib_port_info_t * const p_pi,
+			  IN const int extended)
 {
 	uint8_t rate = 0;
 
+	if (extended) {
+		switch (ib_port_info_get_link_speed_ext_active(p_pi)) {
+		case IB_LINK_SPEED_EXT_ACTIVE_14:
+			switch (p_pi->link_width_active) {
+			case IB_LINK_WIDTH_ACTIVE_1X:
+				rate = IB_PATH_RECORD_RATE_14_GBS;
+				break;
+
+			case IB_LINK_WIDTH_ACTIVE_4X:
+				rate = IB_PATH_RECORD_RATE_56_GBS;
+				break;
+
+			case IB_LINK_WIDTH_ACTIVE_8X:
+				rate = IB_PATH_RECORD_RATE_112_GBS;
+				break;
+
+			case IB_LINK_WIDTH_ACTIVE_12X:
+				rate = IB_PATH_RECORD_RATE_168_GBS;
+				break;
+
+			default:
+				rate = IB_PATH_RECORD_RATE_14_GBS;
+				break;
+			}
+			break;
+		case IB_LINK_SPEED_EXT_ACTIVE_25:
+			switch (p_pi->link_width_active) {
+			case IB_LINK_WIDTH_ACTIVE_1X:
+				rate = IB_PATH_RECORD_RATE_25_GBS;
+				break;
+
+			case IB_LINK_WIDTH_ACTIVE_4X:
+				rate = IB_PATH_RECORD_RATE_100_GBS;
+				break;
+
+			case IB_LINK_WIDTH_ACTIVE_8X:
+				rate = IB_PATH_RECORD_RATE_200_GBS;
+				break;
+
+			case IB_LINK_WIDTH_ACTIVE_12X:
+				rate = IB_PATH_RECORD_RATE_300_GBS;
+				break;
+
+			default:
+				rate = IB_PATH_RECORD_RATE_25_GBS;
+				break;
+			}
+			break;
+		/* IB_LINK_SPEED_EXT_ACTIVE_NONE and any others */
+		default:
+			break;
+		}
+		if (rate)
+			return rate;
+	}
+
 	switch (ib_port_info_get_link_speed_active(p_pi)) {
 	case IB_LINK_SPEED_ACTIVE_2_5:
 		switch (p_pi->link_width_active) {
@@ -5024,6 +5272,9 @@ ib_port_info_compute_rate(IN const ib_port_info_t * const p_pi)
 *	p_pi
 *		[in] Pointer to a PortInfo attribute.
 *
+*	extended
+*		[in] Indicates whether or not to use extended link speeds.
+*
 * RETURN VALUES
 *	Returns the encoded value for the link speed supported.
 *
@@ -5264,7 +5515,7 @@ ib_port_info_set_timeout(IN ib_port_info_t * const p_pi,
 {
 	CL_ASSERT(timeout <= 0x1F);
 	p_pi->subnet_timeout =
-	    (uint8_t) ((p_pi->subnet_timeout & 0x80) | (timeout & 0x1F));
+	    (uint8_t) ((p_pi->subnet_timeout & 0xE0) | (timeout & 0x1F));
 }
 
 /*
@@ -5298,8 +5549,7 @@ ib_port_info_set_client_rereg(IN ib_port_info_t * const p_pi,
 {
 	CL_ASSERT(client_rereg <= 0x1);
 	p_pi->subnet_timeout =
-	    (uint8_t) ((p_pi->
-			subnet_timeout & 0x1F) | ((client_rereg << 7) & 0x80));
+	    (uint8_t) ((p_pi->subnet_timeout & 0x7F) | (client_rereg << 7));
 }
 
 /*
@@ -5318,19 +5568,23 @@ ib_port_info_set_client_rereg(IN ib_port_info_t * const p_pi,
 * SEE ALSO
 *********/
 
-/****f* IBA Base: Types/ib_port_info_get_timeout
+/****f* IBA Base: Types/ib_port_info_set_mcast_pkey_trap_suppress
 * NAME
-*	ib_port_info_get_timeout
+*	ib_port_info_set_mcast_pkey_trap_suppress
 *
 * DESCRIPTION
-*	Gets the encoded subnet timeout value in the PortInfo attribute.
+*	Sets the encoded multicast pkey trap suppression enabled bit value
+*	in the PortInfo attribute.
 *
 * SYNOPSIS
 */
-static inline uint8_t OSM_API
-ib_port_info_get_timeout(IN ib_port_info_t const *p_pi)
+static inline void OSM_API
+ib_port_info_set_mcast_pkey_trap_suppress(IN ib_port_info_t * const p_pi,
+					  IN const uint8_t trap_suppress)
 {
-	return (p_pi->subnet_timeout & 0x1F);
+	CL_ASSERT(trap_suppress <= 0x1);
+	p_pi->subnet_timeout =
+	    (uint8_t) ((p_pi->subnet_timeout & 0xBF) | (trap_suppress << 6));
 }
 
 /*
@@ -5338,27 +5592,31 @@ ib_port_info_get_timeout(IN ib_port_info_t const *p_pi)
 *	p_pi
 *		[in] Pointer to a PortInfo attribute.
 *
+*	trap_suppress
+*		[in] Multicast pkey trap suppression enabled value to set
+*		     (either 1 or 0).
+*
 * RETURN VALUES
-*	The encoded timeout value
+*	None.
 *
 * NOTES
 *
 * SEE ALSO
 *********/
 
-/****f* IBA Base: Types/ib_port_info_get_client_rereg
+/****f* IBA Base: Types/ib_port_info_get_timeout
 * NAME
-*	ib_port_info_get_client_rereg
+*	ib_port_info_get_timeout
 *
 * DESCRIPTION
-*	Gets the encoded client reregistration bit value in the PortInfo attribute.
+*	Gets the encoded subnet timeout value in the PortInfo attribute.
 *
 * SYNOPSIS
 */
 static inline uint8_t OSM_API
-ib_port_info_get_client_rereg(IN ib_port_info_t const *p_pi)
+ib_port_info_get_timeout(IN ib_port_info_t const *p_pi)
 {
-	return ((p_pi->subnet_timeout & 0x80) >> 7);
+	return (p_pi->subnet_timeout & 0x1F);
 }
 
 /*
@@ -5367,29 +5625,26 @@ ib_port_info_get_client_rereg(IN ib_port_info_t const *p_pi)
 *		[in] Pointer to a PortInfo attribute.
 *
 * RETURN VALUES
-*	Client reregistration value (either 1 or 0).
+*	The encoded timeout value
 *
 * NOTES
 *
 * SEE ALSO
 *********/
 
-/****f* IBA Base: Types/ib_port_info_set_hoq_lifetime
+/****f* IBA Base: Types/ib_port_info_get_link_speed_ext_active
 * NAME
-*	ib_port_info_set_hoq_lifetime
+*	ib_port_info_get_link_speed_ext_active
 *
 * DESCRIPTION
-*	Sets the Head of Queue Lifetime for which a packet can live in the head
-*  of VL queue
+*	Gets the encoded LinkSpeedExtActive value in the PortInfo attribute.
 *
 * SYNOPSIS
 */
-static inline void OSM_API
-ib_port_info_set_hoq_lifetime(IN ib_port_info_t * const p_pi,
-			      IN const uint8_t hoq_life)
+static inline uint8_t OSM_API
+ib_port_info_get_link_speed_ext_active(IN const ib_port_info_t * const p_pi)
 {
-	p_pi->vl_stall_life = (uint8_t) ((hoq_life & 0x1f) |
-					 (p_pi->vl_stall_life & 0xe0));
+	return ((p_pi->link_speed_ext & 0xF0) >> 4);
 }
 
 /*
@@ -5397,31 +5652,27 @@ ib_port_info_set_hoq_lifetime(IN ib_port_info_t * const p_pi,
 *	p_pi
 *		[in] Pointer to a PortInfo attribute.
 *
-*	hoq_life
-*		[in] Encoded lifetime value to set
-*
 * RETURN VALUES
-*	None.
+*	The encoded LinkSpeedExtActive value
 *
 * NOTES
 *
 * SEE ALSO
 *********/
 
-/****f* IBA Base: Types/ib_port_info_get_hoq_lifetime
+/****f* IBA Base: Types/ib_port_info_get_link_speed_ext_sup
 * NAME
-*	ib_port_info_get_hoq_lifetime
+*	ib_port_info_get_link_speed_ext_sup
 *
 * DESCRIPTION
-*	Gets the Head of Queue Lifetime for which a packet can live in the head
-*  of VL queue
+*	Returns the encoded value for the link speed extended supported.
 *
 * SYNOPSIS
 */
 static inline uint8_t OSM_API
-ib_port_info_get_hoq_lifetime(IN const ib_port_info_t * const p_pi)
+ib_port_info_get_link_speed_ext_sup(IN const ib_port_info_t * const p_pi)
 {
-	return ((uint8_t) (p_pi->vl_stall_life & 0x1f));
+	return (p_pi->link_speed_ext & 0x0F);
 }
 
 /*
@@ -5430,29 +5681,26 @@ ib_port_info_get_hoq_lifetime(IN const ib_port_info_t * const p_pi)
 *		[in] Pointer to a PortInfo attribute.
 *
 * RETURN VALUES
-*     Encoded lifetime value
+*	The encoded LinkSpeedExtSupported value
 *
 * NOTES
 *
 * SEE ALSO
 *********/
 
-/****f* IBA Base: Types/ib_port_info_set_vl_stall_count
+/****f* IBA Base: Types/ib_port_info_get_link_speed_ext_enabled
 * NAME
-*	ib_port_info_set_vl_stall_count
+*	ib_port_info_get_link_speed_ext_enabled
 *
 * DESCRIPTION
-*	Sets the VL Stall Count which define the number of contiguous
-*  HLL (hoq) drops that will put the VL into stalled mode.
+*	Gets the encoded LinkSpeedExtEnabled value in the PortInfo attribute.
 *
 * SYNOPSIS
 */
-static inline void OSM_API
-ib_port_info_set_vl_stall_count(IN ib_port_info_t * const p_pi,
-				IN const uint8_t vl_stall_count)
+static inline uint8_t OSM_API
+ib_port_info_get_link_speed_ext_enabled(IN const ib_port_info_t * const p_pi)
 {
-	p_pi->vl_stall_life = (uint8_t) ((p_pi->vl_stall_life & 0x1f) |
-					 ((vl_stall_count << 5) & 0xe0));
+        return (p_pi->link_speed_ext_enabled & 0x1F);
 }
 
 /*
@@ -5460,31 +5708,29 @@ ib_port_info_set_vl_stall_count(IN ib_port_info_t * const p_pi,
 *	p_pi
 *		[in] Pointer to a PortInfo attribute.
 *
-*	vl_stall_count
-*		[in] value to set
-*
 * RETURN VALUES
-*	None.
+*	The encoded LinkSpeedExtEnabled value
 *
 * NOTES
 *
 * SEE ALSO
 *********/
 
-/****f* IBA Base: Types/ib_port_info_get_vl_stall_count
+/****f* IBA Base: Types/ib_port_info_set_link_speed_ext_enabled
 * NAME
-*	ib_port_info_get_vl_stall_count
+*	ib_port_info_set_link_speed_ext_enabled
 *
 * DESCRIPTION
-*	Gets the VL Stall Count which define the number of contiguous
-*  HLL (hoq) drops that will put the VL into stalled mode
+*	Sets the link speed extended enabled value in the PortInfo attribute.
 *
 * SYNOPSIS
 */
-static inline uint8_t OSM_API
-ib_port_info_get_vl_stall_count(IN const ib_port_info_t * const p_pi)
+static inline void OSM_API
+ib_port_info_set_link_speed_ext_enabled(IN ib_port_info_t * const p_pi,
+					IN const uint8_t link_speed_ext_enabled)
 {
-	return ((uint8_t) (p_pi->vl_stall_life & 0xe0) >> 5);
+	CL_ASSERT(link_speed_ext_enabled <= 0x1F);
+	p_pi->link_speed_ext_enabled = link_speed_ext_enabled & 0x1F;
 }
 
 /*
@@ -5492,27 +5738,30 @@ ib_port_info_get_vl_stall_count(IN const ib_port_info_t * const p_pi)
 *	p_pi
 *		[in] Pointer to a PortInfo attribute.
 *
+*	link_speed_ext_enabled
+*		[in] link speed extehded enabled value to set.
+*
 * RETURN VALUES
-*     vl stall count
+*	The encoded LinkSpeedExtEnabled value
 *
 * NOTES
 *
 * SEE ALSO
 *********/
 
-/****f* IBA Base: Types/ib_port_info_get_lmc
+/****f* IBA Base: Types/ib_port_info_get_resp_time_value
 * NAME
-*	ib_port_info_get_lmc
+*	ib_port_info_get_resp_time_value
 *
 * DESCRIPTION
-*	Returns the LMC value assigned to this port.
+*	Gets the encoded resp time value in the PortInfo attribute.
 *
 * SYNOPSIS
 */
 static inline uint8_t OSM_API
-ib_port_info_get_lmc(IN const ib_port_info_t * const p_pi)
+ib_port_info_get_resp_time_value(IN const ib_port_info_t * const p_pi)
 {
-	return ((uint8_t) (p_pi->mkey_lmc & IB_PORT_LMC_MASK));
+	return (p_pi->resp_time_value & 0x1F);
 }
 
 /*
@@ -5521,27 +5770,26 @@ ib_port_info_get_lmc(IN const ib_port_info_t * const p_pi)
 *		[in] Pointer to a PortInfo attribute.
 *
 * RETURN VALUES
-*	Returns the LMC value assigned to this port.
+*	The encoded resp time value
 *
 * NOTES
 *
 * SEE ALSO
 *********/
 
-/****f* IBA Base: Types/ib_port_info_set_lmc
+/****f* IBA Base: Types/ib_port_info_get_client_rereg
 * NAME
-*	ib_port_info_set_lmc
+*	ib_port_info_get_client_rereg
 *
 * DESCRIPTION
-*	Sets the LMC value in the PortInfo attribute.
+*	Gets the encoded client reregistration bit value in the PortInfo attribute.
 *
 * SYNOPSIS
 */
-static inline void OSM_API
-ib_port_info_set_lmc(IN ib_port_info_t * const p_pi, IN const uint8_t lmc)
+static inline uint8_t OSM_API
+ib_port_info_get_client_rereg(IN ib_port_info_t const *p_pi)
 {
-	CL_ASSERT(lmc <= IB_PORT_LMC_MAX);
-	p_pi->mkey_lmc = (uint8_t) ((p_pi->mkey_lmc & 0xF8) | lmc);
+	return ((p_pi->subnet_timeout & 0x80) >> 7);
 }
 
 /*
@@ -5549,30 +5797,28 @@ ib_port_info_set_lmc(IN ib_port_info_t * const p_pi, IN const uint8_t lmc)
 *	p_pi
 *		[in] Pointer to a PortInfo attribute.
 *
-*	lmc
-*		[in] LMC value to set, must be less than 7.
-*
 * RETURN VALUES
-*	None.
+*	Client reregistration value (either 1 or 0).
 *
 * NOTES
 *
 * SEE ALSO
 *********/
 
-/****f* IBA Base: Types/ib_port_info_get_link_speed_enabled
+/****f* IBA Base: Types/ib_port_info_get_mcast_pkey_trap_suppress
 * NAME
-*	ib_port_info_get_link_speed_enabled
+*	ib_port_info_get_mcast_pkey_trap_suppress
 *
 * DESCRIPTION
-*	Returns the link speed enabled value assigned to this port.
+*	Gets the encoded multicast pkey trap suppression enabled bit value
+*	in the PortInfo attribute.
 *
 * SYNOPSIS
 */
 static inline uint8_t OSM_API
-ib_port_info_get_link_speed_enabled(IN const ib_port_info_t * const p_pi)
+ib_port_info_get_mcast_pkey_trap_suppress(IN ib_port_info_t const *p_pi)
 {
-	return ((uint8_t) (p_pi->link_speed & IB_PORT_LINK_SPEED_ENABLED_MASK));
+	return ((p_pi->subnet_timeout & 0x40) >> 6);
 }
 
 /*
@@ -5581,19 +5827,233 @@ ib_port_info_get_link_speed_enabled(IN const ib_port_info_t * const p_pi)
 *		[in] Pointer to a PortInfo attribute.
 *
 * RETURN VALUES
-*	Port state.
+*	Multicast PKey trap suppression enabled value (either 1 or 0).
 *
 * NOTES
 *
 * SEE ALSO
 *********/
 
-/****f* IBA Base: Types/ib_port_info_set_link_speed_enabled
+/****f* IBA Base: Types/ib_port_info_set_hoq_lifetime
 * NAME
-*	ib_port_info_set_link_speed_enabled
+*	ib_port_info_set_hoq_lifetime
 *
 * DESCRIPTION
-*	Sets the link speed enabled value in the PortInfo attribute.
+*	Sets the Head of Queue Lifetime for which a packet can live in the head
+*  of VL queue
+*
+* SYNOPSIS
+*/
+static inline void OSM_API
+ib_port_info_set_hoq_lifetime(IN ib_port_info_t * const p_pi,
+			      IN const uint8_t hoq_life)
+{
+	p_pi->vl_stall_life = (uint8_t) ((hoq_life & 0x1f) |
+					 (p_pi->vl_stall_life & 0xe0));
+}
+
+/*
+* PARAMETERS
+*	p_pi
+*		[in] Pointer to a PortInfo attribute.
+*
+*	hoq_life
+*		[in] Encoded lifetime value to set
+*
+* RETURN VALUES
+*	None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_get_hoq_lifetime
+* NAME
+*	ib_port_info_get_hoq_lifetime
+*
+* DESCRIPTION
+*	Gets the Head of Queue Lifetime for which a packet can live in the head
+*  of VL queue
+*
+* SYNOPSIS
+*/
+static inline uint8_t OSM_API
+ib_port_info_get_hoq_lifetime(IN const ib_port_info_t * const p_pi)
+{
+	return ((uint8_t) (p_pi->vl_stall_life & 0x1f));
+}
+
+/*
+* PARAMETERS
+*	p_pi
+*		[in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*     Encoded lifetime value
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_set_vl_stall_count
+* NAME
+*	ib_port_info_set_vl_stall_count
+*
+* DESCRIPTION
+*	Sets the VL Stall Count which define the number of contiguous
+*  HLL (hoq) drops that will put the VL into stalled mode.
+*
+* SYNOPSIS
+*/
+static inline void OSM_API
+ib_port_info_set_vl_stall_count(IN ib_port_info_t * const p_pi,
+				IN const uint8_t vl_stall_count)
+{
+	p_pi->vl_stall_life = (uint8_t) ((p_pi->vl_stall_life & 0x1f) |
+					 ((vl_stall_count << 5) & 0xe0));
+}
+
+/*
+* PARAMETERS
+*	p_pi
+*		[in] Pointer to a PortInfo attribute.
+*
+*	vl_stall_count
+*		[in] value to set
+*
+* RETURN VALUES
+*	None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_get_vl_stall_count
+* NAME
+*	ib_port_info_get_vl_stall_count
+*
+* DESCRIPTION
+*	Gets the VL Stall Count which define the number of contiguous
+*  HLL (hoq) drops that will put the VL into stalled mode
+*
+* SYNOPSIS
+*/
+static inline uint8_t OSM_API
+ib_port_info_get_vl_stall_count(IN const ib_port_info_t * const p_pi)
+{
+	return ((uint8_t) (p_pi->vl_stall_life & 0xe0) >> 5);
+}
+
+/*
+* PARAMETERS
+*	p_pi
+*		[in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*     vl stall count
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_get_lmc
+* NAME
+*	ib_port_info_get_lmc
+*
+* DESCRIPTION
+*	Returns the LMC value assigned to this port.
+*
+* SYNOPSIS
+*/
+static inline uint8_t OSM_API
+ib_port_info_get_lmc(IN const ib_port_info_t * const p_pi)
+{
+	return ((uint8_t) (p_pi->mkey_lmc & IB_PORT_LMC_MASK));
+}
+
+/*
+* PARAMETERS
+*	p_pi
+*		[in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*	Returns the LMC value assigned to this port.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_set_lmc
+* NAME
+*	ib_port_info_set_lmc
+*
+* DESCRIPTION
+*	Sets the LMC value in the PortInfo attribute.
+*
+* SYNOPSIS
+*/
+static inline void OSM_API
+ib_port_info_set_lmc(IN ib_port_info_t * const p_pi, IN const uint8_t lmc)
+{
+	CL_ASSERT(lmc <= IB_PORT_LMC_MAX);
+	p_pi->mkey_lmc = (uint8_t) ((p_pi->mkey_lmc & 0xF8) | lmc);
+}
+
+/*
+* PARAMETERS
+*	p_pi
+*		[in] Pointer to a PortInfo attribute.
+*
+*	lmc
+*		[in] LMC value to set, must be less than 7.
+*
+* RETURN VALUES
+*	None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_get_link_speed_enabled
+* NAME
+*	ib_port_info_get_link_speed_enabled
+*
+* DESCRIPTION
+*	Returns the link speed enabled value assigned to this port.
+*
+* SYNOPSIS
+*/
+static inline uint8_t OSM_API
+ib_port_info_get_link_speed_enabled(IN const ib_port_info_t * const p_pi)
+{
+	return ((uint8_t) (p_pi->link_speed & IB_PORT_LINK_SPEED_ENABLED_MASK));
+}
+
+/*
+* PARAMETERS
+*	p_pi
+*		[in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*	Port state.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_set_link_speed_enabled
+* NAME
+*	ib_port_info_set_link_speed_enabled
+*
+* DESCRIPTION
+*	Sets the link speed enabled value in the PortInfo attribute.
 *
 * SYNOPSIS
 */
@@ -5775,6 +6235,32 @@ ib_port_info_set_phy_and_overrun_err_thd(IN ib_port_info_t * const p_pi,
 * SEE ALSO
 *********/
 
+/****s* IBA Base: Types/ib_mlnx_ext_port_info_t
+* NAME
+*	ib_mlnx_ext_port_info_t
+*
+* DESCRIPTION
+*	Mellanox ExtendedPortInfo (Vendor specific SM class attribute).
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_mlnx_ext_port_info {
+	uint8_t resvd1[3];
+	uint8_t state_change_enable;
+	uint8_t resvd2[3];
+	uint8_t link_speed_supported;
+	uint8_t resvd3[3];
+	uint8_t link_speed_enabled;
+	uint8_t resvd4[3];
+	uint8_t link_speed_active;
+	uint8_t resvd5[48];
+} PACK_SUFFIX ib_mlnx_ext_port_info_t;
+#include <complib/cl_packoff.h>
+/************/
+
+#define FDR10 0x01
+
 typedef uint8_t ib_svc_name_t[64];
 
 #include <complib/cl_packon.h>
@@ -5790,7 +6276,6 @@ typedef struct _ib_service_record {
 	ib_net16_t service_data16[8];
 	ib_net32_t service_data32[4];
 	ib_net64_t service_data64[2];
-
 } PACK_SUFFIX ib_service_record_t;
 #include <complib/cl_packoff.h>
 
@@ -5798,10 +6283,9 @@ typedef struct _ib_service_record {
 typedef struct _ib_portinfo_record {
 	ib_net16_t lid;
 	uint8_t port_num;
-	uint8_t resv;
+	uint8_t options;
 	ib_port_info_t port_info;
-	uint8_t pad[6];
-
+	uint8_t pad[4];
 } PACK_SUFFIX ib_portinfo_record_t;
 #include <complib/cl_packoff.h>
 
@@ -5812,7 +6296,6 @@ typedef struct _ib_link_record {
 	uint8_t to_port_num;
 	ib_net16_t to_lid;
 	uint8_t pad[2];
-
 } PACK_SUFFIX ib_link_record_t;
 #include <complib/cl_packoff.h>
 
@@ -5822,7 +6305,6 @@ typedef struct _ib_sminfo_record {
 	uint16_t resv0;
 	ib_sm_info_t sm_info;
 	uint8_t pad[7];
-
 } PACK_SUFFIX ib_sminfo_record_t;
 #include <complib/cl_packoff.h>
 
@@ -5886,7 +6368,8 @@ typedef struct _ib_switch_info {
 	ib_net16_t lids_per_port;
 	ib_net16_t enforce_cap;
 	uint8_t flags;
-
+	uint8_t resvd;
+	ib_net16_t mcast_top;
 } PACK_SUFFIX ib_switch_info_t;
 #include <complib/cl_packoff.h>
 /************/
@@ -5896,8 +6379,6 @@ typedef struct _ib_switch_info_record {
 	ib_net16_t lid;
 	uint16_t resv0;
 	ib_switch_info_t switch_info;
-	uint8_t pad[3];
-
 } PACK_SUFFIX ib_switch_info_record_t;
 #include <complib/cl_packoff.h>
 
@@ -5948,32 +6429,30 @@ ib_switch_info_clear_state_change(IN ib_switch_info_t * const p_si)
 
 /*
 * PARAMETERS
-*	p_ni
-*		[in] Pointer to a PortInfo attribute.
+*	p_si
+*		[in] Pointer to a SwitchInfo attribute.
 *
 * RETURN VALUES
-*	Returns the LMC value assigned to this port.
+*	None
 *
 * NOTES
 *
 * SEE ALSO
 *********/
 
-/****f* IBA Base: Types/ib_switch_info_is_enhanced_port0
+/****f* IBA Base: Types/ib_switch_info_get_opt_sl2vlmapping
 * NAME
-*	ib_switch_info_is_enhanced_port0
+*	ib_switch_info_get_state_opt_sl2vlmapping
 *
 * DESCRIPTION
-*	Returns TRUE if the enhancedPort0 bit is on (meaning the switch
-*  port zero supports enhanced functions).
-*  Returns FALSE otherwise.
+*       Returns the value of the optimized SLtoVLMapping programming flag.
 *
 * SYNOPSIS
 */
 static inline boolean_t OSM_API
-ib_switch_info_is_enhanced_port0(IN const ib_switch_info_t * const p_si)
+ib_switch_info_get_opt_sl2vlmapping(IN const ib_switch_info_t * const p_si)
 {
-	return ((p_si->flags & 0x08) == 0x08);
+        return ((p_si->life_state & 0x01) == 0x01);
 }
 
 /*
@@ -5982,28 +6461,57 @@ ib_switch_info_is_enhanced_port0(IN const ib_switch_info_t * const p_si)
 *		[in] Pointer to a SwitchInfo attribute.
 *
 * RETURN VALUES
-*	Returns TRUE if the switch supports enhanced port 0. FALSE otherwise.
+*	Returns the value of the optimized SLtoVLMapping programming flag.
 *
 * NOTES
 *
 * SEE ALSO
 *********/
 
-/****s* IBA Base: Types/ib_guid_info_t
+/****f* IBA Base: Types/ib_switch_info_is_enhanced_port0
 * NAME
-*	ib_guid_info_t
+*	ib_switch_info_is_enhanced_port0
 *
 * DESCRIPTION
-*	IBA defined GuidInfo. (14.2.5.5)
+*	Returns TRUE if the enhancedPort0 bit is on (meaning the switch
+*  port zero supports enhanced functions).
+*  Returns FALSE otherwise.
 *
 * SYNOPSIS
 */
-#define	GUID_TABLE_MAX_ENTRIES		8
-
+static inline boolean_t OSM_API
+ib_switch_info_is_enhanced_port0(IN const ib_switch_info_t * const p_si)
+{
+	return ((p_si->flags & 0x08) == 0x08);
+}
+
+/*
+* PARAMETERS
+*	p_si
+*		[in] Pointer to a SwitchInfo attribute.
+*
+* RETURN VALUES
+*	Returns TRUE if the switch supports enhanced port 0. FALSE otherwise.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****s* IBA Base: Types/ib_guid_info_t
+* NAME
+*	ib_guid_info_t
+*
+* DESCRIPTION
+*	IBA defined GuidInfo. (14.2.5.5)
+*
+* SYNOPSIS
+*/
+#define	GUID_TABLE_MAX_ENTRIES		8
+
 #include <complib/cl_packon.h>
 typedef struct _ib_guid_info {
 	ib_net64_t guid[GUID_TABLE_MAX_ENTRIES];
-
 } PACK_SUFFIX ib_guid_info_t;
 #include <complib/cl_packoff.h>
 /************/
@@ -6116,7 +6624,7 @@ ib_multipath_rec_num_path(IN const ib_multipath_rec_t * const p_rec)
 *
 * SYNOPSIS
 */
-static inline void	OSM_API
+static inline void OSM_API
 ib_multipath_rec_set_sl(
 	IN ib_multipath_rec_t* const p_rec,
 	IN const uint8_t sl )
@@ -6305,10 +6813,10 @@ ib_multipath_rec_mtu_sel(IN const ib_multipath_rec_t * const p_rec)
 
 /****f* IBA Base: Types/ib_multipath_rec_rate
 * NAME
-*       ib_multipath_rec_rate
+*	ib_multipath_rec_rate
 *
 * DESCRIPTION
-*       Get encoded multipath rate.
+*	Get encoded multipath rate.
 *
 * SYNOPSIS
 */
@@ -6320,14 +6828,28 @@ ib_multipath_rec_rate(IN const ib_multipath_rec_t * const p_rec)
 
 /*
 * PARAMETERS
-*       p_rec
-*               [in] Pointer to the multipath record object.
+*	p_rec
+*		[in] Pointer to the multipath record object.
 *
 * RETURN VALUES
-*       Encoded multipath rate.
-*               2: 2.5 Gb/sec.
-*               3: 10 Gb/sec.
-*               4: 30 Gb/sec.
+*	Encoded multipath rate.
+*		2: 2.5 Gb/sec.
+*		3: 10 Gb/sec.
+*		4: 30 Gb/sec.
+*		5: 5 Gb/sec.
+*		6: 20 Gb/sec.
+*		7: 40 Gb/sec.
+*		8: 60 Gb/sec.
+*		9: 80 Gb/sec.
+*		10: 120 Gb/sec.
+*		11: 14 Gb/sec.
+*		12: 56 Gb/sec.
+*		13: 112 Gb/sec.
+*		14: 168 Gb/sec.
+*		15: 25 Gb/sec.
+*		16: 100 Gb/sec.
+*		17: 200 Gb/sec.
+*		18: 300 Gb/sec.
 *               others: reserved
 *
 * NOTES
@@ -6482,7 +7004,6 @@ ib_multipath_rec_service_id(IN const ib_multipath_rec_t * const p_rec)
 #include <complib/cl_packon.h>
 typedef struct _ib_pkey_table {
 	ib_net16_t pkey_entry[IB_NUM_PKEY_ELEMENTS_IN_BLOCK];
-
 } PACK_SUFFIX ib_pkey_table_t;
 #include <complib/cl_packoff.h>
 /************/
@@ -6499,12 +7020,11 @@ typedef struct _ib_pkey_table {
 #include <complib/cl_packon.h>
 typedef struct _ib_pkey_table_record {
 	ib_net16_t lid;		// for CA: lid of port, for switch lid of port 0
-	uint16_t block_num;
+	ib_net16_t block_num;
 	uint8_t port_num;	// for switch: port number, for CA: reserved
 	uint8_t reserved1;
 	uint16_t reserved2;
 	ib_pkey_table_t pkey_tbl;
-
 } PACK_SUFFIX ib_pkey_table_record_t;
 #include <complib/cl_packoff.h>
 /************/
@@ -6543,7 +7063,6 @@ typedef struct _ib_slvl_table_record {
 	uint8_t out_port_num;	// reserved for CAs
 	uint32_t resv;
 	ib_slvl_table_t slvl_tbl;
-
 } PACK_SUFFIX ib_slvl_table_record_t;
 #include <complib/cl_packoff.h>
 /************/
@@ -6565,15 +7084,14 @@ ib_slvl_table_set(IN ib_slvl_table_t * p_slvl_tbl,
 	CL_ASSERT(vl <= 15);
 	CL_ASSERT(sl_index <= 15);
 
-	if (sl_index % 2) {
+	if (sl_index % 2)
 		/* this is an odd sl. Need to update the ls bits */
 		p_slvl_tbl->raw_vl_by_sl[idx] =
 		    (p_slvl_tbl->raw_vl_by_sl[idx] & 0xF0) | vl;
-	} else {
+	else
 		/* this is an even sl. Need to update the ms bits */
 		p_slvl_tbl->raw_vl_by_sl[idx] =
 		    (vl << 4) | (p_slvl_tbl->raw_vl_by_sl[idx] & 0x0F);
-	}
 }
 
 /*
@@ -6611,13 +7129,12 @@ ib_slvl_table_get(IN const ib_slvl_table_t * p_slvl_tbl, IN uint8_t sl_index)
 	uint8_t idx = sl_index / 2;
 	CL_ASSERT(sl_index <= 15);
 
-	if (sl_index % 2) {
+	if (sl_index % 2)
 		/* this is an odd sl. Need to return the ls bits. */
 		return (p_slvl_tbl->raw_vl_by_sl[idx] & 0x0F);
-	} else {
+	else
 		/* this is an even sl. Need to return the ms bits. */
 		return ((p_slvl_tbl->raw_vl_by_sl[idx] & 0xF0) >> 4);
-	}
 }
 
 /*
@@ -6828,7 +7345,6 @@ typedef struct _ib_member_rec {
 	uint8_t proxy_join:1;
 	uint8_t reserved[2];
 	uint8_t pad[4];
-
 } PACK_SUFFIX ib_member_rec_t;
 #include <complib/cl_packoff.h>
 /*
@@ -7101,7 +7617,6 @@ ib_member_set_join_state(IN OUT ib_member_rec_t * p_mc_rec,
 typedef struct _ib_mad_notice_attr	// Total Size calc  Accumulated
 {
 	uint8_t generic_type;	// 1                1
-
 	union _notice_g_or_v {
 		struct _notice_generic	// 5                6
 		{
@@ -7109,54 +7624,46 @@ typedef struct _ib_mad_notice_attr	// Total Size calc  Accumulated
 			ib_net16_t prod_type_lsb;
 			ib_net16_t trap_num;
 		} PACK_SUFFIX generic;
-
 		struct _notice_vend {
 			uint8_t vend_id_msb;
 			ib_net16_t vend_id_lsb;
 			ib_net16_t dev_id;
 		} PACK_SUFFIX vend;
 	} g_or_v;
-
 	ib_net16_t issuer_lid;	// 2                 8
 	ib_net16_t toggle_count;	// 2                 10
-
 	union _data_details	// 54                64
 	{
 		struct _raw_data {
 			uint8_t details[54];
 		} PACK_SUFFIX raw_data;
-
 		struct _ntc_64_67 {
 			uint8_t res[6];
 			ib_gid_t gid;	// the Node or Multicast Group that came in/out
 		} PACK_SUFFIX ntc_64_67;
-
 		struct _ntc_128 {
 			ib_net16_t sw_lid;	// the sw lid of which link state changed
 		} PACK_SUFFIX ntc_128;
-
 		struct _ntc_129_131 {
 			ib_net16_t pad;
 			ib_net16_t lid;	// lid and port number of the violation
 			uint8_t port_num;
 		} PACK_SUFFIX ntc_129_131;
-
 		struct _ntc_144 {
 			ib_net16_t pad1;
 			ib_net16_t lid;             // lid where change occured
 			uint8_t    pad2;            // reserved
 			uint8_t    local_changes;   // 7b reserved 1b local changes
 			ib_net32_t new_cap_mask;    // new capability mask
-			ib_net16_t change_flgs;     // 13b reserved 3b change flags
+			ib_net16_t change_flgs;     // 10b reserved 6b change flags
+			ib_net16_t cap_mask2;
 		} PACK_SUFFIX ntc_144;
-
 		struct _ntc_145 {
 			ib_net16_t pad1;
 			ib_net16_t lid;	// lid where sys guid changed
 			ib_net16_t pad2;
 			ib_net64_t new_sys_guid;	// new system image guid
 		} PACK_SUFFIX ntc_145;
-
 		struct _ntc_256 {	// total: 54
 			ib_net16_t pad1;	// 2
 			ib_net16_t lid;	// 2
@@ -7170,20 +7677,17 @@ typedef struct _ib_mad_notice_attr	// Total Size calc  Accumulated
 			uint8_t dr_trunc_hop;	// 1
 			uint8_t dr_rtn_path[30];	// 30
 		} PACK_SUFFIX ntc_256;
-
 		struct _ntc_257_258	// violation of p/q_key // 49
 		{
 			ib_net16_t pad1;	// 2
 			ib_net16_t lid1;	// 2
 			ib_net16_t lid2;	// 2
-			ib_net32_t key;	// 2
-			uint8_t sl;	// 1
-			ib_net32_t qp1;	// 4
-			ib_net32_t qp2;	// 4
+			ib_net32_t key;	// 4
+			ib_net32_t qp1;	// 4b sl, 4b pad, 24b qp1
+			ib_net32_t qp2;	// 8b pad, 24b qp2
 			ib_gid_t gid1;	// 16
 			ib_gid_t gid2;	// 16
 		} PACK_SUFFIX ntc_257_258;
-
 		struct _ntc_259	// pkey violation from switch 51
 		{
 			ib_net16_t data_valid;	// 2
@@ -7197,11 +7701,32 @@ typedef struct _ib_mad_notice_attr	// Total Size calc  Accumulated
 			ib_net16_t sw_lid;	// 2
 			uint8_t port_no;	// 1
 		} PACK_SUFFIX ntc_259;
-
+		struct _ntc_bkey_259	// bkey violation
+		{
+			ib_net16_t lidaddr;
+			uint8_t method;
+			uint8_t reserved;
+			ib_net16_t attribute_id;
+			ib_net32_t attribute_modifier;
+			ib_net32_t qp;		// qp is low 24 bits
+			ib_net64_t bkey;
+			ib_gid_t gid;
+		} PACK_SUFFIX ntc_bkey_259;
+		struct _ntc_cckey_0	// CC key violation
+		{
+			ib_net16_t slid;     // source LID from offending packet LRH
+			uint8_t method;      // method, from common MAD header
+			uint8_t resv0;
+			ib_net16_t attribute_id; // Attribute ID, from common MAD header
+			ib_net16_t resv1;
+			ib_net32_t attribute_modifier; // Attribute Modif, from common MAD header
+			ib_net32_t qp;       // 8b pad, 24b dest QP from BTH
+			ib_net64_t cc_key;   // CC key of the offending packet
+			ib_gid_t source_gid; // GID from GRH of the offending packet
+			uint8_t padding[14]; // Padding - ignored on read
+		} PACK_SUFFIX ntc_cckey_0;
 	} data_details;
-
 	ib_gid_t issuer_gid;	// 16          80
-
 } PACK_SUFFIX ib_mad_notice_attr_t;
 #include <complib/cl_packoff.h>
 
@@ -7215,6 +7740,8 @@ typedef struct _ib_mad_notice_attr	// Total Size calc  Accumulated
  * Trap 144 masks
  */
 #define TRAP_144_MASK_OTHER_LOCAL_CHANGES      0x01
+#define TRAP_144_MASK_LINK_SPEED_EXT_ENABLE_CHG (CL_HTON16(0x0020))
+#define TRAP_144_MASK_HIERARCHY_INFO_CHANGE    (CL_HTON16(0x0010))
 #define TRAP_144_MASK_SM_PRIORITY_CHANGE       (CL_HTON16(0x0008))
 #define TRAP_144_MASK_LINK_SPEED_ENABLE_CHANGE (CL_HTON16(0x0004))
 #define TRAP_144_MASK_LINK_WIDTH_ENABLE_CHANGE (CL_HTON16(0x0002))
@@ -7489,7 +8016,6 @@ typedef struct _ib_inform_info {
 			uint8_t node_type_msb;
 			ib_net16_t node_type_lsb;
 		} PACK_SUFFIX generic;
-
 		struct _inform_vend {
 			ib_net16_t dev_id;
 			ib_net32_t qpn_resp_time_val;
@@ -7497,9 +8023,7 @@ typedef struct _ib_inform_info {
 			uint8_t vendor_id_msb;
 			ib_net16_t vendor_id_lsb;
 		} PACK_SUFFIX vend;
-
 	} PACK_SUFFIX g_or_v;
-
 } PACK_SUFFIX ib_inform_info_t;
 #include <complib/cl_packoff.h>
 
@@ -7521,7 +8045,6 @@ ib_inform_info_get_qpn_resp_time(IN const ib_net32_t qpn_resp_time_val,
 
 	if (p_qpn)
 		*p_qpn = cl_hton32((tmp & 0xffffff00) >> 8);
-
 	if (p_resp_time_val)
 		*p_resp_time_val = (uint8_t) (tmp & 0x0000001f);
 }
@@ -7671,10 +8194,8 @@ typedef struct _ib_inform_info_record {
 typedef struct _ib_perfmgt_mad {
 	ib_mad_t header;
 	uint8_t resv[40];
-
 #define	IB_PM_DATA_SIZE		192
 	uint8_t data[IB_PM_DATA_SIZE];
-
 } PACK_SUFFIX ib_perfmgt_mad_t;
 #include <complib/cl_packoff.h>
 /*
@@ -7716,14 +8237,15 @@ typedef struct _ib_port_counters {
 	ib_net16_t xmit_discards;
 	uint8_t xmit_constraint_err;
 	uint8_t rcv_constraint_err;
-	uint8_t res1;
+	uint8_t counter_select2;
 	uint8_t link_int_buffer_overrun;
-	ib_net16_t res2;
+	ib_net16_t resv;
 	ib_net16_t vl15_dropped;
 	ib_net32_t xmit_data;
 	ib_net32_t rcv_data;
 	ib_net32_t xmit_pkts;
 	ib_net32_t rcv_pkts;
+	ib_net32_t xmit_wait;
 } PACK_SUFFIX ib_port_counters_t;
 #include <complib/cl_packoff.h>
 
@@ -7844,6 +8366,44 @@ typedef struct _ib_port_samples_result {
 } PACK_SUFFIX ib_port_samples_result_t;
 #include <complib/cl_packoff.h>
 
+/****s* IBA Base: Types/ib_port_xmit_data_sl
+* NAME
+*	ib_port_xmit_data_sl_t
+*
+* DESCRIPTION
+*       IBA defined PortXmitDataSL Attribute. (A13.6.4)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_port_xmit_data_sl {
+	uint8_t reserved;
+	uint8_t port_select;
+	ib_net16_t counter_select;
+	ib_net32_t port_xmit_data_sl[16];
+	uint8_t resv[124];
+} PACK_SUFFIX ib_port_xmit_data_sl_t;
+#include <complib/cl_packoff.h>
+
+/****s* IBA Base: Types/ib_port_rcv_data_sl
+* NAME
+*	ib_port_rcv_data_sl_t
+*
+* DESCRIPTION
+*	IBA defined PortRcvDataSL Attribute. (A13.6.4)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_port_rcv_data_sl {
+	uint8_t reserved;
+	uint8_t port_select;
+	ib_net16_t counter_select;
+	ib_net32_t port_rcv_data_sl[16];
+	uint8_t resv[124];
+} PACK_SUFFIX ib_port_rcv_data_sl_t;
+#include <complib/cl_packoff.h>
+
 /****d* IBA Base: Types/DM_SVC_NAME
 * NAME
 *	DM_SVC_NAME
@@ -7871,10 +8431,8 @@ typedef struct _ib_port_samples_result {
 typedef struct _ib_dm_mad {
 	ib_mad_t header;
 	uint8_t resv[40];
-
 #define	IB_DM_DATA_SIZE		192
 	uint8_t data[IB_DM_DATA_SIZE];
-
 } PACK_SUFFIX ib_dm_mad_t;
 #include <complib/cl_packoff.h>
 /*
@@ -7907,15 +8465,12 @@ typedef struct _ib_iou_info {
 	ib_net16_t change_id;
 	uint8_t max_controllers;
 	uint8_t diag_rom;
-
 #define	IB_DM_CTRL_LIST_SIZE	128
-
 	uint8_t controller_list[IB_DM_CTRL_LIST_SIZE];
 #define	IOC_NOT_INSTALLED		0x0
 #define	IOC_INSTALLED			0x1
 //              Reserved values                         0x02-0xE
 #define	SLOT_DOES_NOT_EXIST		0xF
-
 } PACK_SUFFIX ib_iou_info_t;
 #include <complib/cl_packoff.h>
 /*
@@ -8048,28 +8603,22 @@ ioc_at_slot(IN const ib_iou_info_t * const p_iou_info, IN uint8_t slot)
 #include <complib/cl_packon.h>
 typedef struct _ib_ioc_profile {
 	ib_net64_t ioc_guid;
-
 	ib_net32_t vend_id;
-
 	ib_net32_t dev_id;
 	ib_net16_t dev_ver;
 	ib_net16_t resv2;
-
 	ib_net32_t subsys_vend_id;
 	ib_net32_t subsys_id;
-
 	ib_net16_t io_class;
 	ib_net16_t io_subclass;
 	ib_net16_t protocol;
 	ib_net16_t protocol_ver;
-
 	ib_net32_t resv3;
 	ib_net16_t send_msg_depth;
 	uint8_t resv4;
 	uint8_t rdma_read_depth;
 	ib_net32_t send_msg_size;
 	ib_net32_t rdma_size;
-
 	uint8_t ctrl_ops_cap;
 #define	CTRL_OPS_CAP_ST		0x01
 #define	CTRL_OPS_CAP_SF		0x02
@@ -8079,17 +8628,12 @@ typedef struct _ib_ioc_profile {
 #define	CTRL_OPS_CAP_WF		0x20
 #define	CTRL_OPS_CAP_AT		0x40
 #define	CTRL_OPS_CAP_AF		0x80
-
 	uint8_t resv5;
-
 	uint8_t num_svc_entries;
 #define	MAX_NUM_SVC_ENTRIES	0xff
-
 	uint8_t resv6[9];
-
 #define	CTRL_ID_STRING_LEN	64
 	char id_string[CTRL_ID_STRING_LEN];
-
 } PACK_SUFFIX ib_ioc_profile_t;
 #include <complib/cl_packoff.h>
 /*
@@ -8179,9 +8723,7 @@ ib_ioc_profile_set_vend_id(IN ib_ioc_profile_t * const p_ioc_profile,
 typedef struct _ib_svc_entry {
 #define	MAX_SVC_ENTRY_NAME_LEN		40
 	char name[MAX_SVC_ENTRY_NAME_LEN];
-
 	ib_net64_t id;
-
 } PACK_SUFFIX ib_svc_entry_t;
 #include <complib/cl_packoff.h>
 /*
@@ -8209,7 +8751,6 @@ typedef struct _ib_svc_entry {
 typedef struct _ib_svc_entries {
 #define	SVC_ENTRY_COUNT			4
 	ib_svc_entry_t service_entry[SVC_ENTRY_COUNT];
-
 } PACK_SUFFIX ib_svc_entries_t;
 #include <complib/cl_packoff.h>
 /*
@@ -8230,10 +8771,8 @@ ib_dm_get_slot_lo_hi(IN const ib_net32_t slot_lo_hi,
 
 	if (p_slot)
 		*p_slot = (uint8_t) ((tmp_slot_lo_hi >> 16) & 0x0f);
-
 	if (p_hi)
 		*p_hi = (uint8_t) ((tmp_slot_lo_hi >> 8) & 0xff);
-
 	if (p_lo)
 		*p_lo = (uint8_t) ((tmp_slot_lo_hi >> 0) & 0xff);
 }
@@ -8249,7 +8788,6 @@ typedef struct _ib_ioc_info {
 	ib_net64_t access_key;
 	uint16_t initiators_conf;
 	uint8_t resv[38];
-
 } PACK_SUFFIX ib_ioc_info_t;
 #include <complib/cl_packoff.h>
 
@@ -8271,7 +8809,7 @@ typedef struct _ib_mcast *__ptr64 ib_mcast_handle_t;
 	in order to be compliant with Infinicon ib_types; later we'll change it to support
 	OpenSM ib_types.h */
 
-#ifndef WIN32
+#ifndef __WIN__
 /****d* Access Layer/ib_api_status_t
 * NAME
 *	ib_api_status_t
@@ -8460,8 +8998,8 @@ typedef enum _ib_async_event_t {
 *		alternate path.
 *
 *	IB_AE_LOCAL_FATAL
-*		A catastrophic HCA error occurred which cannot be attributed to any
-*		resource; behavior is indeterminate.
+*		A catastrophic HCA error occurred which cannot be attributed to
+*		any resource; behavior is indeterminate.
 *
 *	IB_AE_PKEY_TRAP
 *		A PKEY violation was detected.  This event is optional.
@@ -8470,15 +9008,15 @@ typedef enum _ib_async_event_t {
 *		A QKEY violation was detected.  This event is optional.
 *
 *	IB_AE_MKEY_TRAP
-*		An MKEY violation was detected.  This event is optional.
+*		A MKEY violation was detected.  This event is optional.
 *
 *	IB_AE_PORT_TRAP
 *		A port capability change was detected.  This event is optional.
 *
 *	IB_AE_SYSIMG_GUID_TRAP
-*		If the system image GUID is supported, this event indicates that the
-*		system image GUID of this HCA has been changed.  This event is
-*		optional.
+*		If the system image GUID is supported, this event indicates that
+*		the system image GUID of this HCA has been changed.  This event
+*		is optional.
 *
 *	IB_AE_BUF_OVERRUN
 *		The number of consecutive flow control update periods with at least
@@ -8578,17 +9116,14 @@ ib_get_async_event_str(IN ib_async_event_t event)
 typedef struct _ib_event_rec {
 	void *context;
 	ib_async_event_t type;
-
 	/* HCA vendor specific event information. */
 	uint64_t vendor_specific;
-
 	/* The following structures are valid only for trap types. */
 	union _trap {
 		struct {
 			uint16_t lid;
 			ib_net64_t port_guid;
 			uint8_t port_num;
-
 			/*
 			 * The following structure is valid only for
 			 * P_KEY, Q_KEY, and M_KEY violation traps.
@@ -8606,15 +9141,10 @@ typedef struct _ib_event_rec {
 				uint32_t dest_qp;
 				ib_gid_t src_gid;
 				ib_gid_t dest_gid;
-
 			} violation;
-
 		} info;
-
 		ib_net64_t sysimg_guid;
-
 	} trap;
-
 } ib_event_rec_t;
 /*******/
 
@@ -8677,7 +9207,6 @@ typedef struct _ib_port_cap {
 	boolean_t reinit;
 	boolean_t ledinfo;
 	boolean_t port_active;
-
 } ib_port_cap_t;
 /*****/
 
@@ -8714,10 +9243,8 @@ typedef struct _ib_port_attr_mod {
 	ib_port_cap_t cap;
 	uint16_t pkey_ctr;
 	uint16_t qkey_ctr;
-
 	ib_init_type_t init_type;
 	ib_net64_t system_image_guid;
-
 } ib_port_attr_mod_t;
 /*
 * SEE ALSO
@@ -8740,21 +9267,16 @@ typedef struct _ib_port_attr {
 	uint64_t max_msg_size;
 	ib_net16_t lid;
 	uint8_t lmc;
-
 	/*
 	 * LinkWidthSupported as defined in PortInfo.  Required to calculate
 	 * inter-packet delay (a.k.a. static rate).
 	 */
 	uint8_t link_width_supported;
-
 	uint16_t max_vls;
-
 	ib_net16_t sm_lid;
 	uint8_t sm_sl;
 	uint8_t link_state;
-
 	ib_init_type_t init_type_reply;	/* Optional */
-
 	/*
 	 * subnet_timeout:
 	 * The maximum expected subnet propagation delay to reach any port on
@@ -8764,11 +9286,9 @@ typedef struct _ib_port_attr {
 	 * timeout = 4.096 microseconds * 2^subnet_timeout
 	 */
 	uint8_t subnet_timeout;
-
 	ib_port_cap_t cap;
 	uint16_t pkey_ctr;
 	uint16_t qkey_ctr;
-
 	uint16_t num_gids;
 	uint16_t num_pkeys;
 	/*
@@ -8777,7 +9297,6 @@ typedef struct _ib_port_attr {
 	 */
 	ib_gid_t *p_gid_table;
 	ib_net16_t *p_pkey_table;
-
 } ib_port_attr_t;
 /*
 * SEE ALSO
@@ -8795,56 +9314,41 @@ typedef struct _ib_port_attr {
 */
 typedef struct _ib_ca_attr {
 	ib_net64_t ca_guid;
-
 	uint32_t vend_id;
 	uint16_t dev_id;
 	uint16_t revision;
 	uint64_t fw_ver;
-
 	/*
 	 * Total size of the ca attributes in bytes
 	 */
 	uint32_t size;
 	uint32_t max_qps;
 	uint32_t max_wrs;
-
 	uint32_t max_sges;
 	uint32_t max_rd_sges;
-
 	uint32_t max_cqs;
 	uint32_t max_cqes;
-
 	uint32_t max_pds;
-
 	uint32_t init_regions;
 	uint64_t init_region_size;
-
 	uint32_t init_windows;
 	uint32_t max_addr_handles;
-
 	uint32_t max_partitions;
-
 	ib_atomic_t atomicity;
-
 	uint8_t max_qp_resp_res;
 	uint8_t max_eec_resp_res;
 	uint8_t max_resp_res;
-
 	uint8_t max_qp_init_depth;
 	uint8_t max_eec_init_depth;
-
 	uint32_t max_eecs;
 	uint32_t max_rdds;
-
 	uint32_t max_ipv6_qps;
 	uint32_t max_ether_qps;
-
 	uint32_t max_mcast_grps;
 	uint32_t max_mcast_qps;
 	uint32_t max_qps_per_mcast_grp;
 	uint32_t max_fmr;
 	uint32_t max_map_per_fmr;
-
 	/*
 	 * local_ack_delay:
 	 * Specifies the maximum time interval between the local CA receiving
@@ -8853,7 +9357,6 @@ typedef struct _ib_ca_attr {
 	 * timeout = 4.096 microseconds * 2^local_ack_delay
 	 */
 	uint8_t local_ack_delay;
-
 	boolean_t bad_pkey_ctr_support;
 	boolean_t bad_qkey_ctr_support;
 	boolean_t raw_mcast_support;
@@ -8867,15 +9370,11 @@ typedef struct _ib_ca_attr {
 	boolean_t port_active_event_support;
 	boolean_t system_image_guid_support;
 	boolean_t hw_agents;
-
 	ib_net64_t system_image_guid;
-
 	uint32_t num_page_sizes;
 	uint8_t num_ports;
-
 	uint32_t *p_page_size;
 	ib_port_attr_t *p_port_attr;
-
 } ib_ca_attr_t;
 /*
 * FIELDS
@@ -9089,23 +9588,18 @@ ib_ca_attr_t *ib_copy_ca_attr(IN ib_ca_attr_t * const p_dest,
 */
 typedef struct _ib_av_attr {
 	uint8_t port_num;
-
 	uint8_t sl;
 	ib_net16_t dlid;
-
 	boolean_t grh_valid;
 	ib_grh_t grh;
 	uint8_t static_rate;
 	uint8_t path_bits;
-
 	struct _av_conn {
 		uint8_t path_mtu;
 		uint8_t local_ack_timeout;
 		uint8_t seq_err_retry_cnt;
 		uint8_t rnr_retry_cnt;
-
 	} conn;
-
 } ib_av_attr_t;
 /*
 * SEE ALSO
@@ -9250,19 +9744,14 @@ typedef enum _ib_apm_state {
 */
 typedef struct _ib_qp_create {
 	ib_qp_type_t qp_type;
-
 	ib_rdd_handle_t h_rdd;
-
 	uint32_t sq_depth;
 	uint32_t rq_depth;
 	uint32_t sq_sge;
 	uint32_t rq_sge;
-
 	ib_cq_handle_t h_sq_cq;
 	ib_cq_handle_t h_rq_cq;
-
 	boolean_t sq_signaled;
-
 } ib_qp_create_t;
 /*
 * FIELDS
@@ -9334,34 +9823,27 @@ typedef struct _ib_qp_attr {
 	ib_qp_type_t qp_type;
 	ib_access_t access_ctrl;
 	uint16_t pkey_index;
-
 	uint32_t sq_depth;
 	uint32_t rq_depth;
 	uint32_t sq_sge;
 	uint32_t rq_sge;
 	uint8_t init_depth;
 	uint8_t resp_res;
-
 	ib_cq_handle_t h_sq_cq;
 	ib_cq_handle_t h_rq_cq;
 	ib_rdd_handle_t h_rdd;
-
 	boolean_t sq_signaled;
-
 	ib_qp_state_t state;
 	ib_net32_t num;
 	ib_net32_t dest_num;
 	ib_net32_t qkey;
-
 	ib_net32_t sq_psn;
 	ib_net32_t rq_psn;
-
 	uint8_t primary_port;
 	uint8_t alternate_port;
 	ib_av_attr_t primary_av;
 	ib_av_attr_t alternate_av;
 	ib_apm_state_t apm_state;
-
 } ib_qp_attr_t;
 /*
 * FIELDS
@@ -9419,7 +9901,6 @@ typedef uint32_t ib_qp_opts_t;
 */
 typedef struct _ib_qp_mod {
 	ib_qp_state_t req_state;
-
 	union _qp_state {
 		struct _qp_reset {
 			/*
@@ -9427,24 +9908,19 @@ typedef struct _ib_qp_mod {
 			 * the time wait state before being reused.
 			 */
 			uint32_t timewait;
-
 		} reset;
-
 		struct _qp_init {
 			ib_qp_opts_t opts;
 			uint8_t primary_port;
 			ib_net32_t qkey;
 			uint16_t pkey_index;
 			ib_access_t access_ctrl;
-
 		} init;
-
 		struct _qp_rtr {
 			ib_net32_t rq_psn;
 			ib_net32_t dest_qp;
 			ib_av_attr_t primary_av;
 			uint8_t resp_res;
-
 			ib_qp_opts_t opts;
 			ib_av_attr_t alternate_av;
 			ib_net32_t qkey;
@@ -9453,9 +9929,7 @@ typedef struct _ib_qp_mod {
 			uint32_t sq_depth;
 			uint32_t rq_depth;
 			uint8_t rnr_nak_timeout;
-
 		} rtr;
-
 		struct _qp_rts {
 			ib_net32_t sq_psn;
 			uint8_t retry_cnt;
@@ -9463,32 +9937,23 @@ typedef struct _ib_qp_mod {
 			uint8_t rnr_nak_timeout;
 			uint8_t local_ack_timeout;
 			uint8_t init_depth;
-
 			ib_qp_opts_t opts;
 			ib_qp_state_t current_state;
 			ib_net32_t qkey;
 			ib_access_t access_ctrl;
 			uint8_t resp_res;
-
 			ib_av_attr_t primary_av;
 			ib_av_attr_t alternate_av;
-
 			uint32_t sq_depth;
 			uint32_t rq_depth;
-
 			ib_apm_state_t apm_state;
 			uint8_t primary_port;
 			uint16_t pkey_index;
-
 		} rts;
-
 		struct _qp_sqd {
 			boolean_t sqd_event;
-
 		} sqd;
-
 	} state;
-
 } ib_qp_mod_t;
 /*
 * SEE ALSO
@@ -9508,7 +9973,6 @@ typedef struct _ib_eec_attr {
 	ib_qp_state_t state;
 	ib_rdd_handle_t h_rdd;
 	ib_net32_t local_eecn;
-
 	ib_net32_t sq_psn;
 	ib_net32_t rq_psn;
 	uint8_t primary_port;
@@ -9520,7 +9984,6 @@ typedef struct _ib_eec_attr {
 	ib_av_attr_t primary_av;
 	ib_av_attr_t alternate_av;
 	ib_apm_state_t apm_state;
-
 } ib_eec_attr_t;
 /*
 * SEE ALSO
@@ -9563,50 +10026,37 @@ typedef uint32_t ib_eec_opts_t;
 */
 typedef struct _ib_eec_mod {
 	ib_qp_state_t req_state;
-
 	union _eec_state {
 		struct _eec_init {
 			uint8_t primary_port;
 			uint16_t pkey_index;
-
 		} init;
-
 		struct _eec_rtr {
 			ib_net32_t rq_psn;
 			ib_net32_t remote_eecn;
 			ib_av_attr_t primary_av;
 			uint8_t resp_res;
-
 			ib_eec_opts_t opts;
 			ib_av_attr_t alternate_av;
 			uint16_t pkey_index;
-
 		} rtr;
-
 		struct _eec_rts {
 			ib_net32_t sq_psn;
 			uint8_t retry_cnt;
 			uint8_t rnr_retry_cnt;
 			uint8_t local_ack_timeout;
 			uint8_t init_depth;
-
 			ib_eec_opts_t opts;
 			ib_av_attr_t alternate_av;
 			ib_apm_state_t apm_state;
-
 			ib_av_attr_t primary_av;
 			uint16_t pkey_index;
 			uint8_t primary_port;
-
 		} rts;
-
 		struct _eec_sqd {
 			boolean_t sqd_event;
-
 		} sqd;
-
 	} state;
-
 } ib_eec_mod_t;
 /*
 * SEE ALSO
@@ -9646,7 +10096,6 @@ typedef struct _ib_local_ds {
 	void *vaddr;
 	uint32_t length;
 	uint32_t lkey;
-
 } ib_local_ds_t;
 /*****/
 
@@ -9728,50 +10177,37 @@ typedef struct _ib_send_wr {
 	uint32_t num_ds;
 	ib_local_ds_t *ds_array;
 	ib_net32_t immediate_data;
-
 	union _send_dgrm {
 		struct _send_ud {
 			ib_net32_t remote_qp;
 			ib_net32_t remote_qkey;
 			ib_av_handle_t h_av;
-
 		} ud;
-
 		struct _send_rd {
 			ib_net32_t remote_qp;
 			ib_net32_t remote_qkey;
 			ib_net32_t eecn;
-
 		} rd;
-
 		struct _send_raw_ether {
 			ib_net16_t dest_lid;
 			uint8_t path_bits;
 			uint8_t sl;
 			uint8_t max_static_rate;
 			ib_net16_t ether_type;
-
 		} raw_ether;
-
 		struct _send_raw_ipv6 {
 			ib_net16_t dest_lid;
 			uint8_t path_bits;
 			uint8_t sl;
 			uint8_t max_static_rate;
-
 		} raw_ipv6;
-
 	} dgrm;
-
 	struct _send_remote_ops {
 		uint64_t vaddr;
 		uint32_t rkey;
-
 		ib_net64_t atomic1;
 		ib_net64_t atomic2;
-
 	} remote_ops;
-
 } ib_send_wr_t;
 /*
 * FIELDS
@@ -9928,13 +10364,10 @@ typedef struct _ib_recv_wr {
 typedef struct _ib_bind_wr {
 	uint64_t wr_id;
 	ib_send_opt_t send_opt;
-
 	ib_mr_handle_t h_mr;
 	ib_access_t access_ctrl;
 	uint32_t current_rkey;
-
 	ib_local_ds_t local_ds;
-
 } ib_bind_wr_t;
 /*
 * FIELDS
@@ -10173,18 +10606,14 @@ typedef struct _ib_wc {
 	struct _ib_wc *p_next;
 	uint64_t wr_id;
 	ib_wc_type_t wc_type;
-
 	uint32_t length;
 	ib_wc_status_t status;
 	uint64_t vendor_specific;
-
 	union _wc_recv {
 		struct _wc_conn {
 			ib_recv_opt_t recv_opt;
 			ib_net32_t immediate_data;
-
 		} conn;
-
 		struct _wc_ud {
 			ib_recv_opt_t recv_opt;
 			ib_net32_t immediate_data;
@@ -10193,9 +10622,7 @@ typedef struct _ib_wc {
 			ib_net16_t remote_lid;
 			uint8_t remote_sl;
 			uint8_t path_bits;
-
 		} ud;
-
 		struct _wc_rd {
 			ib_net32_t remote_eecn;
 			ib_net32_t remote_qp;
@@ -10204,24 +10631,18 @@ typedef struct _ib_wc {
 			uint32_t free_cnt;
 
 		} rd;
-
 		struct _wc_raw_ipv6 {
 			ib_net16_t remote_lid;
 			uint8_t remote_sl;
 			uint8_t path_bits;
-
 		} raw_ipv6;
-
 		struct _wc_raw_ether {
 			ib_net16_t remote_lid;
 			uint8_t remote_sl;
 			uint8_t path_bits;
 			ib_net16_t ether_type;
-
 		} raw_ether;
-
 	} recv;
-
 } ib_wc_t;
 /*
 * FIELDS
@@ -10678,7 +11099,6 @@ typedef struct _ib_ci_op {
 	IN uint32_t buf_size;
 	IN OUT uint32_t num_bytes_ret;
 	IN OUT int32_t status;
-
 } ib_ci_op_t;
 /*
 * FIELDS
@@ -10712,9 +11132,651 @@ typedef struct _ib_ci_op {
 *	on the structure command field or the usage context.
 *****/
 
-END_C_DECLS
-#endif				/* ndef WIN32 */
-#if defined( __WIN__ )
+/****s* IBA Base: Types/ib_cc_mad_t
+* NAME
+*	ib_cc_mad_t
+*
+* DESCRIPTION
+*	IBA defined Congestion Control MAD format. (A10.4.1)
+*
+* SYNOPSIS
+*/
+#define IB_CC_LOG_DATA_SIZE 32
+#define IB_CC_MGT_DATA_SIZE 192
+#define IB_CC_MAD_HDR_SIZE (sizeof(ib_sa_mad_t) - IB_CC_LOG_DATA_SIZE \
+						- IB_CC_MGT_DATA_SIZE)
+
+#include <complib/cl_packon.h>
+typedef struct _ib_cc_mad {
+	ib_mad_t header;
+	ib_net64_t cc_key;
+	uint8_t log_data[IB_CC_LOG_DATA_SIZE];
+	uint8_t mgt_data[IB_CC_MGT_DATA_SIZE];
+} PACK_SUFFIX ib_cc_mad_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*	header
+*		Common MAD header.
+*
+*	cc_key
+*		CC_Key of the Congestion Control MAD.
+*
+*	log_data
+*		Congestion Control log data of the CC MAD.
+*
+*	mgt_data
+*		Congestion Control management data of the CC MAD.
+*
+* SEE ALSO
+* ib_mad_t
+*********/
+
+/****f* IBA Base: Types/ib_cc_mad_get_cc_key
+* NAME
+*	ib_cc_mad_get_cc_key
+*
+* DESCRIPTION
+*	Gets a CC_Key of the CC MAD.
+*
+* SYNOPSIS
+*/
+static inline ib_net64_t OSM_API
+ib_cc_mad_get_cc_key(IN const ib_cc_mad_t * const p_cc_mad)
+{
+	return p_cc_mad->cc_key;
+}
+/*
+* PARAMETERS
+*	p_cc_mad
+*		[in] Pointer to the CC MAD packet.
+*
+* RETURN VALUES
+*	CC_Key of the provided CC MAD packet.
+*
+* NOTES
+*
+* SEE ALSO
+*	ib_cc_mad_t
+*********/
+
+/****f* IBA Base: Types/ib_cc_mad_get_log_data_ptr
+* NAME
+*	ib_cc_mad_get_log_data_ptr
+*
+* DESCRIPTION
+*	Gets a pointer to the CC MAD's log data area.
+*
+* SYNOPSIS
+*/
+static inline void * OSM_API
+ib_cc_mad_get_log_data_ptr(IN const ib_cc_mad_t * const p_cc_mad)
+{
+	return ((void *)p_cc_mad->log_data);
+}
+/*
+* PARAMETERS
+*	p_cc_mad
+*		[in] Pointer to the CC MAD packet.
+*
+* RETURN VALUES
+*	Pointer to CC MAD log data area.
+*
+* NOTES
+*
+* SEE ALSO
+*	ib_cc_mad_t
+*********/
+
+/****f* IBA Base: Types/ib_cc_mad_get_mgt_data_ptr
+* NAME
+*	ib_cc_mad_get_mgt_data_ptr
+*
+* DESCRIPTION
+*	Gets a pointer to the CC MAD's management data area.
+*
+* SYNOPSIS
+*/
+static inline void * OSM_API
+ib_cc_mad_get_mgt_data_ptr(IN const ib_cc_mad_t * const p_cc_mad)
+{
+	return ((void *)p_cc_mad->mgt_data);
+}
+/*
+* PARAMETERS
+*	p_cc_mad
+*		[in] Pointer to the CC MAD packet.
+*
+* RETURN VALUES
+*	Pointer to CC MAD management data area.
+*
+* NOTES
+*
+* SEE ALSO
+*	ib_cc_mad_t
+*********/
+
+/****s* IBA Base: Types/ib_cong_info_t
+* NAME
+*	ib_cong_info_t
+*
+* DESCRIPTION
+*	IBA defined CongestionInfo attribute (A10.4.3.3)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_cong_info {
+	uint8_t cong_info;
+	uint8_t resv;
+	uint8_t ctrl_table_cap;
+} PACK_SUFFIX ib_cong_info_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*	cong_info
+*		Congestion control capabilities of the node.
+*
+*	ctrl_table_cap
+*		Number of 64 entry blocks in the CongestionControlTable.
+*
+* SEE ALSO
+*	ib_cc_mad_t
+*********/
+
+/****s* IBA Base: Types/ib_cong_key_info_t
+* NAME
+*	ib_cong_key_info_t
+*
+* DESCRIPTION
+*	IBA defined CongestionKeyInfo attribute (A10.4.3.4)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_cong_key_info {
+	ib_net64_t cc_key;
+	ib_net16_t protect_bit;
+	ib_net16_t lease_period;
+	ib_net16_t violations;
+} PACK_SUFFIX ib_cong_key_info_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*	cc_key
+*		8-byte CC Key.
+*
+*	protect_bit
+*		Bit 0 is a CC Key Protect Bit, other 15 bits are reserved.
+*
+*	lease_period
+*		How long the CC Key protect bit is to remain non-zero.
+*
+*	violations
+*		Number of received MADs that violated CC Key.
+*
+* SEE ALSO
+*	ib_cc_mad_t
+*********/
+
+/****s* IBA Base: Types/ib_cong_log_event_sw_t
+* NAME
+*	ib_cong_log_event_sw_t
+*
+* DESCRIPTION
+*	IBA defined CongestionLogEvent (SW) entry (A10.4.3.5)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_cong_log_event_sw {
+	ib_net16_t slid;
+	ib_net16_t dlid;
+	ib_net32_t sl;
+	ib_net32_t time_stamp;
+} PACK_SUFFIX ib_cong_log_event_sw_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*	slid
+*		Source LID of congestion event.
+*
+*	dlid
+*		Destination LID of congestion event.
+*
+*	sl
+*		4 bits - SL of congestion event.
+*		rest of the bits are reserved.
+*
+*	time_stamp
+*		Timestamp of congestion event.
+*
+* SEE ALSO
+*	ib_cc_mad_t, ib_cong_log_t
+*********/
+
+/****s* IBA Base: Types/ib_cong_log_event_ca_t
+* NAME
+*	ib_cong_log_event_ca_t
+*
+* DESCRIPTION
+*	IBA defined CongestionLogEvent (CA) entry (A10.4.3.5)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_cong_log_event_ca {
+	ib_net32_t local_qp_resv0;
+	ib_net32_t remote_qp_sl_service_type;
+	ib_net16_t remote_lid;
+	ib_net16_t resv1;
+	ib_net32_t time_stamp;
+} PACK_SUFFIX ib_cong_log_event_ca_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*	resv0_local_qp
+*		bits [31:8] local QP that reached CN threshold.
+*		bits [7:0] reserved.
+*
+*	remote_qp_sl_service_type
+*		bits [31:8] remote QP that is connected to local QP.
+*		bits [7:4] SL of the local QP.
+*		bits [3:0] Service Type of the local QP.
+*
+*	remote_lid
+*		LID of the remote port that is connected to local QP.
+*
+*	time_stamp
+*		Timestamp when threshold reached.
+*
+* SEE ALSO
+*	ib_cc_mad_t, ib_cong_log_t
+*********/
+
+/****s* IBA Base: Types/ib_cong_log_t
+* NAME
+*	ib_cong_log_t
+*
+* DESCRIPTION
+*	IBA defined CongestionLog attribute (A10.4.3.5)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_cong_log {
+	uint8_t log_type;
+	union _log_details
+	{
+		struct _log_sw {
+			uint8_t cong_flags;
+			ib_net16_t event_counter;
+			ib_net32_t time_stamp;
+			uint8_t port_map[32];
+			ib_cong_log_event_sw_t entry_list[15];
+		} PACK_SUFFIX log_sw;
+
+		struct _log_ca {
+			uint8_t cong_flags;
+			ib_net16_t event_counter;
+			ib_net16_t event_map;
+			ib_net16_t resv;
+			ib_net32_t time_stamp;
+			ib_cong_log_event_ca_t log_event[13];
+		} PACK_SUFFIX log_ca;
+
+	} log_details;
+} PACK_SUFFIX ib_cong_log_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*
+*	log_{sw,ca}.log_type
+*		Log type: 0x1 is for Switch, 0x2 is for CA
+*
+*	log_{sw,ca}.cong_flags
+*		Congestion Flags.
+*
+*	log_{sw,ca}.event_counter
+*		Number of events since log last sent.
+*
+*	log_{sw,ca}.time_stamp
+*		Timestamp when log sent.
+*
+*	log_sw.port_map
+*		If a bit set to 1, then the corresponding port
+*		has marked packets with a FECN.
+*		bits 0 and 255 - reserved
+*		bits [254..1] - ports [254..1].
+*
+*	log_sw.entry_list
+*		Array of 13 most recent congestion log events.
+*
+*	log_ca.event_map
+*		array 16 bits, one for each SL.
+*
+*	log_ca.log_event
+*		Array of 13 most recent congestion log events.
+*
+* SEE ALSO
+*	ib_cc_mad_t, ib_cong_log_event_sw_t, ib_cong_log_event_ca_t
+*********/
+
+/****s* IBA Base: Types/ib_sw_cong_setting_t
+* NAME
+*	ib_sw_cong_setting_t
+*
+* DESCRIPTION
+*	IBA defined SwitchCongestionSetting attribute (A10.4.3.6)
+*
+* SYNOPSIS
+*/
+#define IB_CC_PORT_MASK_DATA_SIZE 32
+#include <complib/cl_packon.h>
+typedef struct _ib_sw_cong_setting {
+	ib_net32_t control_map;
+	uint8_t victim_mask[IB_CC_PORT_MASK_DATA_SIZE];
+	uint8_t credit_mask[IB_CC_PORT_MASK_DATA_SIZE];
+	uint8_t threshold_resv;
+	uint8_t packet_size;
+	ib_net16_t cs_threshold_resv;
+	ib_net16_t cs_return_delay;
+	ib_net16_t marking_rate;
+} PACK_SUFFIX ib_sw_cong_setting_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*
+*	control_map
+*		Indicates which components of this attribute are valid
+*
+*	victim_mask
+*		If the bit set to 1, then the port corresponding to
+*		that bit shall mark packets that encounter congestion
+*		with a FECN, whether they are the source or victim
+*		of congestion. (See A10.2.1.1.1)
+*		  bit 0: port 0 (enhanced port 0 only)
+*		  bits [254..1]: ports [254..1]
+*		  bit 255: reserved
+*
+*	credit_mask
+*		If the bit set to 1, then the port corresponding
+*		to that bit shall apply Credit Starvation.
+*		  bit 0: port 0 (enhanced port 0 only)
+*		  bits [254..1]: ports [254..1]
+*		  bit 255: reserved
+*
+*	threshold_resv
+*		bits [7..4] Indicates how aggressive cong. marking should be
+*		bits [3..0] Reserved
+*
+*	packet_size
+*		Any packet less than this size won't be marked with FECN
+*
+*	cs_threshold_resv
+*		bits [15..12] How aggressive Credit Starvation should be
+*		bits [11..0] Reserved
+*
+*	cs_return_delay
+*		Value that controls credit return rate.
+*
+*	marking_rate
+*		The value that provides the mean number of packets
+*		between marking eligible packets with FECN.
+*
+* SEE ALSO
+*	ib_cc_mad_t
+*********/
+
+/****s* IBA Base: Types/ib_sw_port_cong_setting_element_t
+* NAME
+*	ib_sw_port_cong_setting_element_t
+*
+* DESCRIPTION
+*	IBA defined SwitchPortCongestionSettingElement (A10.4.3.7)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_sw_port_cong_setting_element {
+	uint8_t valid_ctrl_type_res_threshold;
+	uint8_t packet_size;
+	ib_net16_t cong_param;
+} PACK_SUFFIX ib_sw_port_cong_setting_element_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*
+*	valid_ctrl_type_res_threshold
+*		bit 7: "Valid"
+*			when set to 1, indicates this switch
+*			port congestion setting element is valid.
+*		bit 6: "Control Type"
+*			Indicates which type of attribute is being set:
+*			0b = Congestion Control parameters are being set.
+*			1b = Credit Starvation parameters are being set.
+*		bits [5..4]: reserved
+*		bits [3..0]: "Threshold"
+*			When Control Type is 0, contains the congestion
+*			threshold value (Threshold) for this port.
+*			When Control Type is 1, contains the credit
+*			starvation threshold (CS_Threshold) value for
+*			this port.
+*
+*	packet_size
+*		When Control Type is 0, this field contains the minimum
+*		size of packets that may be marked with a FECN.
+*		When Control Type is 1, this field is reserved.
+*
+*	cong_parm
+*		When Control Type is 0, this field contains the port
+*		marking_rate.
+*		When Control Type is 1, this field is reserved.
+*
+* SEE ALSO
+*	ib_cc_mad_t, ib_sw_port_cong_setting_t
+*********/
+
+/****d* IBA Base: Types/ib_sw_port_cong_setting_block_t
+* NAME
+*	ib_sw_port_cong_setting_block_t
+*
+* DESCRIPTION
+*	Defines the SwitchPortCongestionSetting Block (A10.4.3.7).
+*
+* SOURCE
+*/
+#define IB_CC_SW_PORT_SETTING_ELEMENTS 32
+typedef ib_sw_port_cong_setting_element_t ib_sw_port_cong_setting_block_t[IB_CC_SW_PORT_SETTING_ELEMENTS];
+/**********/
+
+/****s* IBA Base: Types/ib_sw_port_cong_setting_t
+* NAME
+*	ib_sw_port_cong_setting_t
+*
+* DESCRIPTION
+*	IBA defined SwitchPortCongestionSetting attribute (A10.4.3.7)
+*
+* SYNOPSIS
+*/
+
+#include <complib/cl_packon.h>
+typedef struct _ib_sw_port_cong_setting {
+	ib_sw_port_cong_setting_block_t block;
+} PACK_SUFFIX ib_sw_port_cong_setting_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*
+*	block
+*		SwitchPortCongestionSetting block.
+*
+* SEE ALSO
+*	ib_cc_mad_t, ib_sw_port_cong_setting_element_t
+*********/
+
+/****s* IBA Base: Types/ib_ca_cong_entry_t
+* NAME
+*	ib_ca_cong_entry_t
+*
+* DESCRIPTION
+*	IBA defined CACongestionEntry (A10.4.3.8)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_ca_cong_entry {
+	ib_net16_t ccti_timer;
+	uint8_t ccti_increase;
+	uint8_t trigger_threshold;
+	uint8_t ccti_min;
+	uint8_t resv0;
+	ib_net16_t resv1;
+} PACK_SUFFIX ib_ca_cong_entry_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*
+*	ccti_timer
+*		When the timer expires it will be reset to its specified
+*		value, and 1 will be decremented from the CCTI.
+*
+*	ccti_increase
+*		The number to be added to the table Index (CCTI)
+*		on the receipt of a BECN.
+*
+*	trigger_threshold
+*		When the CCTI is equal to this value, an event
+*		is logged in the CAs cyclic event log.
+*
+*	ccti_min
+*		The minimum value permitted for the CCTI.
+*
+* SEE ALSO
+*	ib_cc_mad_t
+*********/
+
+/****s* IBA Base: Types/ib_ca_cong_setting_t
+* NAME
+*	ib_ca_cong_setting_t
+*
+* DESCRIPTION
+*	IBA defined CACongestionSetting attribute (A10.4.3.8)
+*
+* SYNOPSIS
+*/
+#define IB_CA_CONG_ENTRY_DATA_SIZE 16
+#include <complib/cl_packon.h>
+typedef struct _ib_ca_cong_setting {
+	ib_net16_t port_control;
+	ib_net16_t control_map;
+	ib_ca_cong_entry_t entry_list[IB_CA_CONG_ENTRY_DATA_SIZE];
+} PACK_SUFFIX ib_ca_cong_setting_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*
+*	port_control
+*		Congestion attributes for this port:
+*		  bit0 = 0: QP based CC
+*		  bit0 = 1: SL/Port based CC
+*		All other bits are reserved
+*
+*	control_map
+*		An array of sixteen bits, one for each SL. Each bit indicates
+*		whether or not the corresponding entry is to be modified.
+*
+*	entry_list
+*		List of 16 CACongestionEntries, one per SL.
+*
+* SEE ALSO
+*	ib_cc_mad_t
+*********/
+
+/****s* IBA Base: Types/ib_cc_tbl_entry_t
+* NAME
+*	ib_cc_tbl_entry_t
+*
+* DESCRIPTION
+*	IBA defined CongestionControlTableEntry (A10.4.3.9)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_cc_tbl_entry {
+	ib_net16_t shift_multiplier;
+} PACK_SUFFIX ib_cc_tbl_entry_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*
+*	shift_multiplier
+*		bits [15..14] - CCT Shift
+*		  used when calculating the injection rate delay
+*		bits [13..0] - CCT Multiplier
+*		  used when calculating the injection rate delay
+*
+* SEE ALSO
+*	ib_cc_mad_t
+*********/
+
+/****s* IBA Base: Types/ib_cc_tbl_t
+* NAME
+*	ib_cc_tbl_t
+*
+* DESCRIPTION
+*	IBA defined CongestionControlTable attribute (A10.4.3.9)
+*
+* SYNOPSIS
+*/
+#define IB_CC_TBL_ENTRY_LIST_MAX 64
+#include <complib/cl_packon.h>
+typedef struct _ib_cc_tbl {
+	ib_net16_t ccti_limit;
+	ib_net16_t resv;
+	ib_cc_tbl_entry_t entry_list[IB_CC_TBL_ENTRY_LIST_MAX];
+} PACK_SUFFIX ib_cc_tbl_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*
+*	ccti_limit
+*		Maximum valid CCTI for this table.
+*
+*	entry_list
+*		List of up to 64 CongestionControlTableEntries.
+*
+* SEE ALSO
+*	ib_cc_mad_t
+*********/
+
+/****s* IBA Base: Types/ib_time_stamp_t
+* NAME
+*	ib_time_stamp_t
+*
+* DESCRIPTION
+*	IBA defined TimeStamp attribute (A10.4.3.10)
+*
+* SOURCE
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_time_stamp {
+	ib_net32_t value;
+} PACK_SUFFIX ib_time_stamp_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*
+*	value
+*		Free running clock that provides relative time info
+*		for a device. Time is kept in 1.024 usec units.
+*
+* SEE ALSO
+*	ib_cc_mad_t
+*********/
+
+END_C_DECLS
+#else				/* ndef __WIN__ */
 #include <iba/ib_types_extended.h>
 #endif
 #endif				/* __IB_TYPES_H__ */
diff --git a/include/opensm/osm_attrib_req.h b/include/opensm/osm_attrib_req.h
index e79073b..c9c4886 100644
--- a/include/opensm/osm_attrib_req.h
+++ b/include/opensm/osm_attrib_req.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
diff --git a/include/opensm/osm_base.h b/include/opensm/osm_base.h
index 54df41e..9ae6e9f 100644
--- a/include/opensm/osm_base.h
+++ b/include/opensm/osm_base.h
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -49,12 +50,10 @@
 
 #ifdef __WIN__
 #include <vendor/winosm_common.h>
-#define OSM_CDECL __cdecl
-#else
-#define OSM_CDECL
 #endif
 
 #include <complib/cl_types.h>
+#include <iba/ib_types.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -160,6 +159,17 @@ BEGIN_C_DECLS
 */
 #define OSM_DEFAULT_SL 0
 /********/
+/****s* OpenSM: Base/OSM_DEFAULT_SCATTER_PORTS
+* NAME
+*	OSM_DEFAULT_SCATTER_PORTS
+*
+* DESCRIPTION
+*	Default Scatter Ports value used by OpenSM.
+*
+* SYNOPSIS
+*/
+#define OSM_DEFAULT_SCATTER_PORTS 0
+/********/
 /****s* OpenSM: Base/OSM_DEFAULT_SM_PRIORITY
 * NAME
 *	OSM_DEFAULT_SM_PRIORITY
@@ -183,7 +193,7 @@ BEGIN_C_DECLS
 * SYNOPSIS
 */
 #ifdef __WIN__
-#define OSM_DEFAULT_TMP_DIR GetOsmTempPath()
+#define OSM_DEFAULT_TMP_DIR "%TEMP%\\"
 #else
 #define OSM_DEFAULT_TMP_DIR "/var/log/"
 #endif
@@ -194,14 +204,13 @@ BEGIN_C_DECLS
 *
 * DESCRIPTION
 *	Specifies the default cache directory for the db files.
-*	Note that the directory must appear with "/" ("\\" for windows) at the end.
 *
 * SYNOPSIS
 */
 #ifdef __WIN__
-#define OSM_DEFAULT_CACHE_DIR GetOsmCachePath()
+#define OSM_DEFAULT_CACHE_DIR "%TEMP%"
 #else
-#define OSM_DEFAULT_CACHE_DIR "/var/cache/opensm/"
+#define OSM_DEFAULT_CACHE_DIR "/var/cache/opensm"
 #endif
 /***********/
 /****d* OpenSM: Base/OSM_DEFAULT_LOG_FILE
@@ -214,7 +223,7 @@ BEGIN_C_DECLS
 * SYNOPSIS
 */
 #ifdef __WIN__
-#define OSM_DEFAULT_LOG_FILE strcat(GetOsmTempPath(), "osm.log")
+#define OSM_DEFAULT_LOG_FILE OSM_DEFAULT_TMP_DIR "osm.log"
 #else
 #define OSM_DEFAULT_LOG_FILE "/var/log/opensm.log"
 #endif
@@ -229,15 +238,13 @@ BEGIN_C_DECLS
 *
 * SYNOPSIS
 */
-#ifdef __WIN__
-#define OSM_DEFAULT_CONFIG_FILE strcat(GetOsmCachePath(), "opensm.conf")
-#elif defined(HAVE_DEFAULT_OPENSM_CONFIG_FILE)
+#if defined(HAVE_DEFAULT_OPENSM_CONFIG_FILE)
 #define OSM_DEFAULT_CONFIG_FILE HAVE_DEFAULT_OPENSM_CONFIG_FILE
 #elif defined (OPENSM_CONFIG_DIR)
 #define OSM_DEFAULT_CONFIG_FILE OPENSM_CONFIG_DIR "/opensm.conf"
 #else
 #define OSM_DEFAULT_CONFIG_FILE "/etc/opensm/opensm.conf"
-#endif /* __WIN__ */
+#endif
 /***********/
 
 /****d* OpenSM: Base/OSM_DEFAULT_PARTITION_CONFIG_FILE
@@ -249,15 +256,13 @@ BEGIN_C_DECLS
 *
 * SYNOPSIS
 */
-#ifdef __WIN__
-#define OSM_DEFAULT_PARTITION_CONFIG_FILE strcat(GetOsmCachePath(), "osm-partitions.conf")
-#elif defined(HAVE_DEFAULT_PARTITION_CONFIG_FILE)
+#if defined(HAVE_DEFAULT_PARTITION_CONFIG_FILE)
 #define OSM_DEFAULT_PARTITION_CONFIG_FILE HAVE_DEFAULT_PARTITION_CONFIG_FILE
 #elif defined(OPENSM_CONFIG_DIR)
 #define OSM_DEFAULT_PARTITION_CONFIG_FILE OPENSM_CONFIG_DIR "/partitions.conf"
 #else
 #define OSM_DEFAULT_PARTITION_CONFIG_FILE "/etc/opensm/partitions.conf"
-#endif /* __WIN__ */
+#endif
 /***********/
 
 /****d* OpenSM: Base/OSM_DEFAULT_QOS_POLICY_FILE
@@ -269,14 +274,30 @@ BEGIN_C_DECLS
 *
 * SYNOPSIS
 */
-#ifdef __WIN__
-#define OSM_DEFAULT_QOS_POLICY_FILE strcat(GetOsmCachePath(), "osm-qos-policy.conf")
-#elif defined(HAVE_DEFAULT_QOS_POLICY_FILE)
+#if defined(HAVE_DEFAULT_QOS_POLICY_FILE)
 #define OSM_DEFAULT_QOS_POLICY_FILE HAVE_DEFAULT_QOS_POLICY_FILE
 #elif defined(OPENSM_CONFIG_DIR)
 #define OSM_DEFAULT_QOS_POLICY_FILE OPENSM_CONFIG_DIR "/qos-policy.conf"
 #else
 #define OSM_DEFAULT_QOS_POLICY_FILE "/etc/opensm/qos-policy.conf"
+#endif
+/***********/
+
+/****d* OpenSM: Base/OSM_DEFAULT_TORUS_CONF_FILE
+* NAME
+*	OSM_DEFAULT_TORUS_CONF_FILE
+*
+* DESCRIPTION
+*	Specifies the default file name for extra torus-2QoS configuration
+*
+* SYNOPSIS
+*/
+#ifdef __WIN__
+#define OSM_DEFAULT_TORUS_CONF_FILE strcat(GetOsmCachePath(), "osm-torus-2QoS.conf")
+#elif defined(OPENSM_CONFIG_DIR)
+#define OSM_DEFAULT_TORUS_CONF_FILE OPENSM_CONFIG_DIR "/torus-2QoS.conf"
+#else
+#define OSM_DEFAULT_TORUS_CONF_FILE "/etc/opensm/torus-2QoS.conf"
 #endif /* __WIN__ */
 /***********/
 
@@ -289,9 +310,7 @@ BEGIN_C_DECLS
 *
 * SYNOPSIS
 */
-#ifdef __WIN__
-#define OSM_DEFAULT_PREFIX_ROUTES_FILE strcat(GetOsmCachePath(), "osm-prefix-routes.conf")
-#elif defined(HAVE_DEFAULT_PREFIX_ROUTES_FILE)
+#if defined(HAVE_DEFAULT_PREFIX_ROUTES_FILE)
 #define OSM_DEFAULT_PREFIX_ROUTES_FILE HAVE_DEFAULT_PREFIX_ROUTES_FILE
 #elif defined(OPENSM_CONFIG_DIR)
 #define OSM_DEFAULT_PREFIX_ROUTES_FILE OPENSM_CONFIG_DIR "/prefix-routes.conf"
@@ -300,6 +319,24 @@ BEGIN_C_DECLS
 #endif
 /***********/
 
+/****d* OpenSM: Base/OSM_DEFAULT_PER_MOD_LOGGING_CONF_FILE
+* NAME
+*	OSM_DEFAULT_PER_MOD_LOGGING_CONF_FILE
+*
+* DESCRIPTION
+*	Specifies the default file name for per module logging configuration
+*
+* SYNOPSIS
+*/
+#ifdef __WIN__
+#define OSM_DEFAULT_PER_MOD_LOGGING_CONF_FILE strcat(GetOsmCachePath(), "per-module-logging.conf")
+#elif defined(OPENSM_CONFIG_DIR)
+#define OSM_DEFAULT_PER_MOD_LOGGING_CONF_FILE OPENSM_CONFIG_DIR "/per-module-logging.conf"
+#else
+#define OSM_DEFAULT_PER_MOD_LOGGING_CONF_FILE "/etc/opensm/per-module-logging.conf"
+#endif /* __WIN__ */
+/***********/
+
 /****d* OpenSM: Base/OSM_DEFAULT_SWEEP_INTERVAL_SECS
 * NAME
 *	OSM_DEFAULT_SWEEP_INTERVAL_SECS
@@ -670,7 +707,7 @@ typedef enum _osm_thread_state {
 /***********/
 
 /*
- * OSM_CAP are from Table 117 and C15-0.1.7 Table 186
+ * OSM_CAP are from IBA 1.2.1 Table 117 and Table 188
  */
 
 /****d* OpenSM: Base/OSM_CAP_IS_TRAP_SUP
@@ -778,6 +815,98 @@ typedef enum _osm_thread_state {
 #define OSM_CAP2_IS_QOS_SUPPORTED (1 << 1)
 /***********/
 
+/****d* OpenSM: Base/OSM_CAP2_IS_REVERSE_PATH_PKEY_SUPPPORTED
+* Name
+*	OSM_CAP2_IS_REVERSE_PATH_PKEY_SUPPPORTED
+*
+* DESCRIPTION
+*	Reverse path PKeys indicate in PathRecord responses
+*
+* SYNOPSIS
+*/
+#define OSM_CAP2_IS_REVERSE_PATH_PKEY_SUPPPORTED (1 << 2)
+/***********/
+
+/****d* OpenSM: Base/OSM_CAP2_IS_MCAST_TOP_SUPPORTED
+* Name
+*	OSM_CAP2_IS_MCAST_TOP_SUPPORTED
+*
+* DESCRIPTION
+*       SwitchInfo.MulticastFDBTop is supported
+*
+* SYNOPSIS
+*/
+#define OSM_CAP2_IS_MCAST_TOP_SUPPORTED (1 << 3)
+/***********/
+
+/****d* OpenSM: Base/OSM_CAP2_IS_HIERARCHY_SUPPORTED
+* Name
+*
+* DESCRIPTION
+*	Hierarchy info supported
+*
+* SYNOPSIS
+*/
+#define OSM_CAP2_IS_HIERARCHY_SUPPORTED (1 << 4)
+/***********/
+
+/****d* OpenSM: Base/OSM_CAP2_IS_ALIAS_GUIDS_SUPPORTED
+* Name
+*
+* DESCRIPTION
+*	Alias GUIDs supported
+*
+* SYNOPSIS
+*/
+#define OSM_CAP2_IS_ALIAS_GUIDS_SUPPORTED (1 << 5)
+/***********/
+
+/****d* OpenSM: Base/OSM_CAP2_IS_FULL_PORTINFO_REC_SUPPORTED
+* Name
+*	OSM_CAP2_IS_FULL_PORTINFO_REC_SUPPORTED
+*
+* DESCRIPTION
+*	Full PortInfoRecords supported
+*
+* SYNOPSIS
+*/
+#define OSM_CAP2_IS_FULL_PORTINFO_REC_SUPPORTED (1 << 6)
+/***********/
+
+/****d* OpenSM: Base/OSM_CAP2_IS_EXTENDED_SPEEDS_SUPPORTED
+* Name
+*	OSM_CAP2_IS_EXTENDED_SPEEDS_SUPPORTED
+*
+* DESCRIPTION
+*	Extended Link Speeds supported
+*
+* SYNOPSIS
+*/
+#define OSM_CAP2_IS_EXTENDED_SPEEDS_SUPPORTED (1 << 7)
+/***********/
+
+/****d* OpenSM: Base/OSM_CAP2_IS_MULTICAST_SERVICE_RECS_SUPPORTED
+ * Name
+ *	OSM_CAP2_IS_MULTICAST_SERVICE_RECS_SUPPORTED
+ *
+ * DESCRIPTION
+ *	Multicast Service Records supported
+ *
+ * SYNOPSIS
+ */
+#define OSM_CAP2_IS_MULTICAST_SERVICE_RECS_SUPPORTED (1 << 8)
+
+/****d* OpenSM: Base/OSM_CAP2_IS_PORT_INFO_CAPMASK2_MATCH_SUPPORTED
+ * Name
+ *	OSM_CAP2_IS_PORT_INFO_CAPMASK2_MATCH_SUPPORTED
+ *
+ * DESCRIPTION
+ *	CapMask2 matching for PortInfoRecord supported
+ *
+ * SYNOPSIS
+ */
+#define OSM_CAP2_IS_PORT_INFO_CAPMASK2_MATCH_SUPPORTED (1 << 9)
+
 /****d* OpenSM: Base/osm_signal_t
 * NAME
 *	osm_signal_t
@@ -794,11 +923,8 @@ typedef enum _osm_thread_state {
 #define OSM_SIGNAL_SWEEP			1
 #define OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST	2
 #define OSM_SIGNAL_PERFMGR_SWEEP		3
-#define OSM_SIGNAL_MAX				3
-
-/* status values for sweep managers - can be removed later */
-#define OSM_SIGNAL_DONE		16
-#define OSM_SIGNAL_DONE_PENDING	17
+#define OSM_SIGNAL_GUID_PROCESS_REQUEST		4
+#define OSM_SIGNAL_MAX				5
 
 typedef unsigned int osm_signal_t;
 /***********/
@@ -828,23 +954,6 @@ typedef enum _osm_sm_signal {
 } osm_sm_signal_t;
 /***********/
 
-/****d* OpenSM/osm_mcast_req_type_t
-* NAME
-*	osm_mcast_req_type_t
-*
-* DESCRIPTION
-*	Enumerates the possible signals used by the OSM_MCAST_REQUEST
-*
-* SYNOPSIS
-*/
-typedef enum _osm_mcast_req_type {
-	OSM_MCAST_REQ_TYPE_CREATE,
-	OSM_MCAST_REQ_TYPE_JOIN,
-	OSM_MCAST_REQ_TYPE_LEAVE,
-	OSM_MCAST_REQ_TYPE_SUBNET_CHANGE
-} osm_mcast_req_type_t;
-/***********/
-
 /****s* OpenSM: Base/MAX_GUID_FILE_LINE_LENGTH
 * NAME
 *	MAX_GUID_FILE_LINE_LENGTH
@@ -888,9 +997,20 @@ typedef enum _osm_mcast_req_type {
 #define OSM_VENDOR_ID_HP            0x001708
 #define OSM_VENDOR_ID_RIOWORKS      0x005045
 #define OSM_VENDOR_ID_SUN           0x0003BA
+#define OSM_VENDOR_ID_SUN2          0x002128
 #define OSM_VENDOR_ID_3LEAFNTWKS    0x0016A1
 #define OSM_VENDOR_ID_XSIGO         0x001397
 #define OSM_VENDOR_ID_HP2           0x0018FE
+#define OSM_VENDOR_ID_DELL          0x00188B
+#define OSM_VENDOR_ID_SUPERMICRO    0x003048
+#define OSM_VENDOR_ID_HP3           0x0019BB
+#define OSM_VENDOR_ID_HP4           0x00237D
+#define OSM_VENDOR_ID_OPENIB        0x001405
+#define OSM_VENDOR_ID_IBM2	    0x5CF3FC
+
+/* IPoIB Broadcast Defaults */
+#define OSM_IPOIB_BROADCAST_MGRP_QKEY 0x0b1b
+extern const ib_gid_t osm_ipoib_broadcast_mgid;
 
 /**********/
 
diff --git a/include/opensm/osm_config.h b/include/opensm/osm_config.h
new file mode 100644
index 0000000..418a808
--- /dev/null
+++ b/include/opensm/osm_config.h
@@ -0,0 +1,65 @@
+/* include/opensm/osm_config.h.  Generated from osm_config.h.in by configure.  */
+/* include/osm_config.h.in
+ *
+ * Defines various OpenSM configuration parameters to be used by various
+ * plugins and third party tools.
+ *
+ * NOTE: Defines used in header files MUST be included here to ensure plugin
+ * compatibility.
+ */
+
+#ifndef _OSM_CONFIG_H_
+#define _OSM_CONFIG_H_ 1
+
+/* define 1 if OpenSM build is in a debug mode */
+/* #undef OSM_DEBUG */
+
+/* Define as 1 if you want Dual Sided RMPP Support */
+#define DUAL_SIDED_RMPP 1
+
+/* Define as 1 if you want to enable a console on a socket connection */
+/* #undef ENABLE_OSM_CONSOLE_SOCKET */
+
+/* Define as 1 if you want to enable the event plugin */
+/* #undef ENABLE_OSM_DEFAULT_EVENT_PLUGIN */
+
+/* Define as 1 if you want to enable the performance manager */
+#define ENABLE_OSM_PERF_MGR 1
+
+/* Define as 1 if you want to enable the performance manager profiling code */
+/* #undef ENABLE_OSM_PERF_MGR_PROFILE */
+
+/* Define a default node name map file */
+#define HAVE_DEFAULT_NODENAME_MAP "/usr/local/etc/opensm/ib-node-name-map"
+
+/* Define a default OpenSM config file */
+#define HAVE_DEFAULT_OPENSM_CONFIG_FILE "/usr/local/etc/opensm/opensm.conf"
+
+/* Define a Partition config file */
+#define HAVE_DEFAULT_PARTITION_CONFIG_FILE "/usr/local/etc/opensm/partitions.conf"
+
+/* Define a Prefix Routes config file */
+#define HAVE_DEFAULT_PREFIX_ROUTES_FILE "/usr/local/etc/opensm/prefix-routes.conf"
+
+/* Define a QOS policy config file */
+#define HAVE_DEFAULT_QOS_POLICY_FILE "/usr/local/etc/opensm/qos-policy.conf"
+
+/* Define OpenSM config directory */
+#define OPENSM_CONFIG_DIR "/usr/local/etc/opensm"
+
+/* Define as 1 for vapi vendor */
+/* #undef OSM_VENDOR_INTF_MTL */
+
+/* Define as 1 for OpenIB vendor */
+#define OSM_VENDOR_INTF_OPENIB 1
+
+/* Define as 1 for sim vendor */
+/* #undef OSM_VENDOR_INTF_SIM */
+
+/* Define as 1 for ts vendor */
+/* #undef OSM_VENDOR_INTF_TS */
+
+/* Define as 1 if you want Vendor RMPP Support */
+#define VENDOR_RMPP_SUPPORT 1
+
+#endif /* _OSM_CONFIG_H_ */
diff --git a/include/opensm/osm_congestion_control.h b/include/opensm/osm_congestion_control.h
new file mode 100644
index 0000000..94e4ffb
--- /dev/null
+++ b/include/opensm/osm_congestion_control.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2012 Lawrence Livermore National Lab.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+/*
+ * Abstract:
+ *    OSM Congestion Control types and prototypes
+ *
+ * Author:
+ *    Albert Chu, LLNL
+ */
+
+#ifndef OSM_CONGESTION_CONTROL_H
+#define OSM_CONGESTION_CONTROL_H
+
+#include <iba/ib_types.h>
+#include <complib/cl_types_osd.h>
+#include <complib/cl_dispatcher.h>
+#include <opensm/osm_subnet.h>
+#include <opensm/osm_log.h>
+#include <opensm/osm_sm.h>
+#include <opensm/osm_opensm.h>
+#include <opensm/osm_base.h>
+
+/****s* OpenSM: Base/OSM_DEFAULT_CC_KEY
+ * NAME
+ *       OSM_DEFAULT_CC_KEY
+ *
+ * DESCRIPTION
+ *       Congestion Control Key used by OpenSM.
+ *
+ * SYNOPSIS
+ */
+#define OSM_DEFAULT_CC_KEY 0
+
+#define OSM_CC_DEFAULT_MAX_OUTSTANDING_QUERIES 500
+
+/****s* OpenSM: CongestionControl/osm_congestion_control_t
+*  This object should be treated as opaque and should
+*  be manipulated only through the provided functions.
+*/
+typedef struct osm_congestion_control {
+	struct osm_opensm *osm;
+	osm_subn_t *subn;
+	osm_sm_t *sm;
+	osm_log_t *log;
+	osm_mad_pool_t *mad_pool;
+	atomic32_t trans_id;
+	osm_vendor_t *vendor;
+	osm_bind_handle_t bind_handle;
+	cl_disp_reg_handle_t cc_disp_h;
+	ib_net64_t port_guid;
+	atomic32_t outstanding_mads;
+	atomic32_t outstanding_mads_on_wire;
+	cl_qlist_t mad_queue;
+	cl_spinlock_t mad_queue_lock;
+	cl_event_t cc_poller_wakeup;
+	cl_event_t outstanding_mads_done_event;
+	cl_event_t sig_mads_on_wire_continue;
+	cl_thread_t cc_poller;
+	osm_thread_state_t thread_state;
+	ib_sw_cong_setting_t sw_cong_setting;
+	ib_ca_cong_setting_t ca_cong_setting;
+	ib_cc_tbl_t cc_tbl[OSM_CCT_ENTRY_MAD_BLOCKS];
+	unsigned int cc_tbl_mads;
+} osm_congestion_control_t;
+/*
+* FIELDS
+*       subn
+*             Subnet object for this subnet.
+*
+*       log
+*             Pointer to the log object.
+*
+*       mad_pool
+*             Pointer to the MAD pool.
+*
+*       mad_ctrl
+*             Mad Controller
+*********/
+
+struct osm_opensm;
+
+int osm_congestion_control_setup(struct osm_opensm *osm);
+
+int osm_congestion_control_wait_pending_transactions(struct osm_opensm *osm);
+
+ib_api_status_t osm_congestion_control_init(osm_congestion_control_t * p_cc,
+					    struct osm_opensm *osm,
+					    const osm_subn_opt_t * p_opt);
+
+ib_api_status_t osm_congestion_control_bind(osm_congestion_control_t * p_cc,
+					    ib_net64_t port_guid);
+
+void osm_congestion_control_shutdown(osm_congestion_control_t * p_cc);
+
+void osm_congestion_control_destroy(osm_congestion_control_t * p_cc);
+
+
+#endif				/* ifndef OSM_CONGESTION_CONTROL_H */
diff --git a/include/opensm/osm_console.h b/include/opensm/osm_console.h
index 3ea8fa5..9144ae1 100644
--- a/include/opensm/osm_console.h
+++ b/include/opensm/osm_console.h
@@ -45,7 +45,6 @@
 #endif				/* __cplusplus */
 
 BEGIN_C_DECLS
-// TODO replace p_osm
-void osm_console(osm_opensm_t * p_osm);
+int osm_console(osm_opensm_t * p_osm);
 END_C_DECLS
 #endif				/* _OSM_CONSOLE_H_ */
diff --git a/include/opensm/osm_console_io.h b/include/opensm/osm_console_io.h
index 5fe233d..7bf1313 100644
--- a/include/opensm/osm_console_io.h
+++ b/include/opensm/osm_console_io.h
@@ -45,8 +45,12 @@
 
 #define OSM_DISABLE_CONSOLE      "off"
 #define OSM_LOCAL_CONSOLE        "local"
+#ifdef ENABLE_OSM_CONSOLE_SOCKET
 #define OSM_REMOTE_CONSOLE       "socket"
+#endif
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
 #define OSM_LOOPBACK_CONSOLE     "loopback"
+#endif
 #define OSM_CONSOLE_NAME         "OSM Console"
 
 #define OSM_DEFAULT_CONSOLE      OSM_DISABLE_CONSOLE
@@ -81,9 +85,12 @@ int osm_console_init(osm_subn_opt_t * opt, osm_console_t * p_oct, osm_log_t * p_
 void osm_console_exit(osm_console_t * p_oct, osm_log_t * p_log);
 int is_console_enabled(osm_subn_opt_t *p_opt);
 
-#ifdef ENABLE_OSM_CONSOLE_SOCKET
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
 int cio_open(osm_console_t * p_oct, int new_fd, osm_log_t * p_log);
+int cio_close(osm_console_t * p_oct, osm_log_t * p_log);
 int is_authorized(osm_console_t * p_oct);
+#else
+#define cio_close(c, log)
 #endif
 
 END_C_DECLS
diff --git a/include/opensm/osm_db.h b/include/opensm/osm_db.h
index 56bae31..d05bfa0 100644
--- a/include/opensm/osm_db.h
+++ b/include/opensm/osm_db.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -43,7 +43,8 @@
 
 #include <complib/cl_list.h>
 #include <complib/cl_spinlock.h>
-#include <opensm/osm_log.h>
+
+struct osm_log;
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -118,7 +119,7 @@ typedef struct osm_db_domain {
 */
 typedef struct osm_db {
 	void *p_db_imp;
-	osm_log_t *p_log;
+	struct osm_log *p_log;
 	cl_list_t domains;
 } osm_db_t;
 /*
@@ -144,7 +145,7 @@ typedef struct osm_db {
 *
 * SYNOPSIS
 */
-void osm_db_construct(IN osm_db_t * const p_db);
+void osm_db_construct(IN osm_db_t * p_db);
 /*
 * PARAMETERS
 *	p_db
@@ -166,7 +167,7 @@ void osm_db_construct(IN osm_db_t * const p_db);
 *
 * SYNOPSIS
 */
-void osm_db_destroy(IN osm_db_t * const p_db);
+void osm_db_destroy(IN osm_db_t * p_db);
 /*
 * PARAMETERS
 *	p_db
@@ -185,7 +186,7 @@ void osm_db_destroy(IN osm_db_t * const p_db);
 *
 * SYNOPSIS
 */
-int osm_db_init(IN osm_db_t * const p_db, IN osm_log_t * p_log);
+int osm_db_init(IN osm_db_t * p_db, IN struct osm_log * p_log);
 /*
 * PARAMETERS
 *
@@ -211,8 +212,7 @@ int osm_db_init(IN osm_db_t * const p_db, IN osm_log_t * p_log);
 *
 * SYNOPSIS
 */
-osm_db_domain_t *osm_db_domain_init(IN osm_db_t * const p_db,
-				    IN char *domain_name);
+osm_db_domain_t *osm_db_domain_init(IN osm_db_t * p_db, IN char *domain_name);
 /*
 * PARAMETERS
 *
@@ -344,7 +344,7 @@ int osm_db_keys(IN osm_db_domain_t * p_domain, OUT cl_list_t * p_key_list);
 * SYNOPSIS
 */
 /* lookup value by key */
-char *osm_db_lookup(IN osm_db_domain_t * p_domain, IN char *const p_key);
+char *osm_db_lookup(IN osm_db_domain_t * p_domain, IN char *p_key);
 /*
 * PARAMETERS
 *
@@ -371,9 +371,7 @@ char *osm_db_lookup(IN osm_db_domain_t * p_domain, IN char *const p_key);
 *
 * SYNOPSIS
 */
-int
-osm_db_update(IN osm_db_domain_t * p_domain,
-	      IN char *const p_key, IN char *const p_val);
+int osm_db_update(IN osm_db_domain_t * p_domain, IN char *p_key, IN char *p_val);
 /*
 * PARAMETERS
 *
@@ -405,7 +403,7 @@ osm_db_update(IN osm_db_domain_t * p_domain,
 *
 * SYNOPSIS
 */
-int osm_db_delete(IN osm_db_domain_t * p_domain, IN char *const p_key);
+int osm_db_delete(IN osm_db_domain_t * p_domain, IN char *p_key);
 /*
 * PARAMETERS
 *
diff --git a/include/opensm/osm_db_pack.h b/include/opensm/osm_db_pack.h
index 83861a6..f2d7af2 100644
--- a/include/opensm/osm_db_pack.h
+++ b/include/opensm/osm_db_pack.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -72,7 +72,7 @@ BEGIN_C_DECLS
 *
 * SYNOPSIS
 */
-static inline osm_db_domain_t *osm_db_guid2lid_init(IN osm_db_t * const p_db)
+static inline osm_db_domain_t *osm_db_guid2lid_init(IN osm_db_t * p_db)
 {
 	return (osm_db_domain_init(p_db, "guid2lid"));
 }
@@ -122,9 +122,8 @@ typedef struct osm_db_guid_elem {
 *
 * SYNOPSIS
 */
-int
-osm_db_guid2lid_guids(IN osm_db_domain_t * const p_g2l,
-		      OUT cl_qlist_t * p_guid_list);
+int osm_db_guid2lid_guids(IN osm_db_domain_t * p_g2l,
+			  OUT cl_qlist_t * p_guid_list);
 /*
 * PARAMETERS
 *	p_g2l
@@ -153,10 +152,8 @@ osm_db_guid2lid_guids(IN osm_db_domain_t * const p_g2l,
 *
 * SYNOPSIS
 */
-int
-osm_db_guid2lid_get(IN osm_db_domain_t * const p_g2l,
-		    IN uint64_t guid,
-		    OUT uint16_t * p_min_lid, OUT uint16_t * p_max_lid);
+int osm_db_guid2lid_get(IN osm_db_domain_t * p_g2l, IN uint64_t guid,
+			OUT uint16_t * p_min_lid, OUT uint16_t * p_max_lid);
 /*
 * PARAMETERS
 *	p_g2l
@@ -188,9 +185,8 @@ osm_db_guid2lid_get(IN osm_db_domain_t * const p_g2l,
 *
 * SYNOPSIS
 */
-int
-osm_db_guid2lid_set(IN osm_db_domain_t * const p_g2l,
-		    IN uint64_t guid, IN uint16_t min_lid, IN uint16_t max_lid);
+int osm_db_guid2lid_set(IN osm_db_domain_t * p_g2l, IN uint64_t guid,
+			IN uint16_t min_lid, IN uint16_t max_lid);
 /*
 * PARAMETERS
 *	p_g2l
@@ -222,7 +218,7 @@ osm_db_guid2lid_set(IN osm_db_domain_t * const p_g2l,
 *
 * SYNOPSIS
 */
-int osm_db_guid2lid_delete(IN osm_db_domain_t * const p_g2l, IN uint64_t guid);
+int osm_db_guid2lid_delete(IN osm_db_domain_t * p_g2l, IN uint64_t guid);
 /*
 * PARAMETERS
 *	p_g2l
@@ -239,5 +235,334 @@ int osm_db_guid2lid_delete(IN osm_db_domain_t * const p_g2l, IN uint64_t guid);
 * osm_db_guid2lid_get, osm_db_guid2lid_set
 *********/
 
+/****f* OpenSM: DB-Pack/osm_db_guid2mkey_init
+* NAME
+*	osm_db_guid2mkey_init
+*
+* DESCRIPTION
+*	Initialize a domain for the guid2mkey table
+*
+* SYNOPSIS
+*/
+static inline osm_db_domain_t *osm_db_guid2mkey_init(IN osm_db_t * p_db)
+{
+	return osm_db_domain_init(p_db, "guid2mkey");
+}
+
+/*
+* PARAMETERS
+*	p_db
+*		[in] Pointer to the database object to construct
+*
+* RETURN VALUES
+*	The pointer to the new allocated domain object or NULL.
+*
+* NOTE: DB domains are destroyed by the osm_db_destroy
+*
+* SEE ALSO
+*	Database, osm_db_init, osm_db_destroy
+*********/
+
+/****f* OpenSM: DB-Pack/osm_db_guid2mkey_guids
+* NAME
+*	osm_db_guid2mkey_guids
+*
+* DESCRIPTION
+*	Provides back a list of guid elements.
+*
+* SYNOPSIS
+*/
+int osm_db_guid2mkey_guids(IN osm_db_domain_t * p_g2m,
+			  OUT cl_qlist_t * p_guid_list);
+/*
+* PARAMETERS
+*	p_g2l
+*		[in] Pointer to the guid2mkey domain
+*
+*  p_guid_list
+*     [out] A quick list of guid elements of type osm_db_guid_elem_t
+*
+* RETURN VALUES
+*	0 if successful
+*
+* NOTE: the output qlist should be initialized and each item freed
+*       by the caller, then destroyed.
+*
+* SEE ALSO
+* osm_db_guid2mkey_init, osm_db_guid2mkey_guids, osm_db_guid2mkey_get
+* osm_db_guid2mkey_set, osm_db_guid2mkey_delete
+*********/
+
+/****f* OpenSM: DB-Pack/osm_db_guid2mkey_get
+* NAME
+*	osm_db_guid2mkey_get
+*
+* DESCRIPTION
+*	Get the mkey for the given guid.
+*
+* SYNOPSIS
+*/
+int osm_db_guid2mkey_get(IN osm_db_domain_t * p_g2m, IN uint64_t guid,
+			 OUT uint64_t * p_mkey);
+/*
+* PARAMETERS
+*	p_g2m
+*		[in] Pointer to the guid2mkey domain
+*
+*  guid
+*     [in] The guid to look for
+*
+*  p_mkey
+*     [out] Pointer to the resulting mkey in host order.
+*
+* RETURN VALUES
+*	0 if successful. The lid will be set to 0 if not found.
+*
+* SEE ALSO
+* osm_db_guid2mkey_init, osm_db_guid2mkey_guids
+* osm_db_guid2mkey_set, osm_db_guid2mkey_delete
+*********/
+
+/****f* OpenSM: DB-Pack/osm_db_guid2mkey_set
+* NAME
+*	osm_db_guid2mkey_set
+*
+* DESCRIPTION
+*	Set the mkey for the given guid.
+*
+* SYNOPSIS
+*/
+int osm_db_guid2mkey_set(IN osm_db_domain_t * p_g2m, IN uint64_t guid,
+			 IN uint64_t mkey);
+/*
+* PARAMETERS
+*	p_g2m
+*		[in] Pointer to the guid2mkey domain
+*
+*  guid
+*     [in] The guid to look for
+*
+*  mkey
+*     [in] The mkey value to set, in host order
+*
+* RETURN VALUES
+*	0 if successful
+*
+* SEE ALSO
+* osm_db_guid2mkey_init, osm_db_guid2mkey_guids
+* osm_db_guid2mkey_get, osm_db_guid2mkey_delete
+*********/
+
+/****f* OpenSM: DB-Pack/osm_db_guid2mkey_delete
+* NAME
+*	osm_db_guid2mkey_delete
+*
+* DESCRIPTION
+*	Delete the entry by the given guid
+*
+* SYNOPSIS
+*/
+int osm_db_guid2mkey_delete(IN osm_db_domain_t * p_g2m, IN uint64_t guid);
+/*
+* PARAMETERS
+*	p_g2m
+*		[in] Pointer to the guid2mkey domain
+*
+*  guid
+*     [in] The guid to look for
+*
+* RETURN VALUES
+*	0 if successful otherwise 1
+*
+* SEE ALSO
+* osm_db_guid2mkey_init, osm_db_guid2mkey_guids
+* osm_db_guid2mkey_get, osm_db_guid2mkey_set
+*********/
+
+/****f* OpenSM: DB-Pack/osm_db_neighbor_init
+* NAME
+*	osm_db_neighbor_init
+*
+* DESCRIPTION
+*	Initialize a domain for the neighbors table
+*
+* SYNOPSIS
+*/
+static inline osm_db_domain_t *osm_db_neighbor_init(IN osm_db_t * p_db)
+{
+	return osm_db_domain_init(p_db, "neighbors");
+}
+
+/*
+* PARAMETERS
+*	p_db
+*		[in] Pointer to the database object to construct
+*
+* RETURN VALUES
+*	The pointer to the new allocated domain object or NULL.
+*
+* NOTE: DB domains are destroyed by the osm_db_destroy
+*
+* SEE ALSO
+*	Database, osm_db_init, osm_db_destroy
+*********/
+
+/****f* OpenSM: DB-Pack/osm_db_neighbor_elem
+* NAME
+*	osm_db_neighbor_elem
+*
+* DESCRIPTION
+*	Initialize a domain for the neighbor table
+*
+* SYNOPSIS
+*/
+typedef struct osm_db_neighbor_elem {
+	cl_list_item_t item;
+	uint64_t guid;
+	uint8_t portnum;
+} osm_db_neighbor_elem_t;
+/*
+* FIELDS
+*	item
+*		required for list manipulations
+*
+*  guid
+*  portnum
+*
+************/
+
+/****f* OpenSM: DB-Pack/osm_db_neighbor_guids
+* NAME
+*	osm_db_neighbor_guids
+*
+* DESCRIPTION
+*	Provides back a list of neighbor elements.
+*
+* SYNOPSIS
+*/
+int osm_db_neighbor_guids(IN osm_db_domain_t * p_neighbor,
+			  OUT cl_qlist_t * p_guid_list);
+/*
+* PARAMETERS
+*	p_neighbor
+*		[in] Pointer to the neighbor domain
+*
+*  p_guid_list
+*     [out] A quick list of neighbor elements of type osm_db_neighbor_elem_t
+*
+* RETURN VALUES
+*	0 if successful
+*
+* NOTE: the output qlist should be initialized and each item freed
+*       by the caller, then destroyed.
+*
+* SEE ALSO
+* osm_db_neighbor_init, osm_db_neighbor_guids, osm_db_neighbor_get
+* osm_db_neighbor_set, osm_db_neighbor_delete
+*********/
+
+/****f* OpenSM: DB-Pack/osm_db_neighbor_get
+* NAME
+*	osm_db_neighbor_get
+*
+* DESCRIPTION
+*	Get a neighbor's guid by given guid/port.
+*
+* SYNOPSIS
+*/
+int osm_db_neighbor_get(IN osm_db_domain_t * p_neighbor, IN uint64_t guid1,
+			IN uint8_t port1, OUT uint64_t * p_guid2,
+			OUT uint8_t * p_port2);
+/*
+* PARAMETERS
+*	p_neighbor
+*		[in] Pointer to the neighbor domain
+*
+*  guid1
+*     [in] The guid to look for
+*
+*  port1
+*     [in] The port to look for
+*
+*  p_guid2
+*     [out] Pointer to the resulting guid of the neighboring port.
+*
+*  p_port2
+*     [out] Pointer to the resulting port of the neighboring port.
+*
+* RETURN VALUES
+*	0 if successful. The lid will be set to 0 if not found.
+*
+* SEE ALSO
+* osm_db_neighbor_init, osm_db_neighbor_guids
+* osm_db_neighbor_set, osm_db_neighbor_delete
+*********/
+
+/****f* OpenSM: DB-Pack/osm_db_neighbor_set
+* NAME
+*	osm_db_neighbor_set
+*
+* DESCRIPTION
+*	Set up a relationship between two ports
+*
+* SYNOPSIS
+*/
+int osm_db_neighbor_set(IN osm_db_domain_t * p_neighbor, IN uint64_t guid1,
+			IN uint8_t port1, IN uint64_t guid2, IN uint8_t port2);
+/*
+* PARAMETERS
+*	p_neighbor
+*		[in] Pointer to the neighbor domain
+*
+*  guid1
+*     [in] The first guid in the relationship
+*
+*  port1
+*     [in] The first port in the relationship
+*
+*  guid2
+*     [in] The second guid in the relationship
+*
+*  port2
+*     [in] The second port in the relationship
+*
+* RETURN VALUES
+*	0 if successful
+*
+* SEE ALSO
+* osm_db_neighbor_init, osm_db_neighbor_guids
+* osm_db_neighbor_get, osm_db_neighbor_delete
+*********/
+
+/****f* OpenSM: DB-Pack/osm_db_neighbor_delete
+* NAME
+*	osm_db_neighbor_delete
+*
+* DESCRIPTION
+*	Delete the relationship between two ports
+*
+* SYNOPSIS
+*/
+int osm_db_neighbor_delete(IN osm_db_domain_t * p_neighbor,
+			   IN uint64_t guid, IN uint8_t port);
+/*
+* PARAMETERS
+*	p_neighbor
+*		[in] Pointer to the neighbor domain
+*
+*  guid
+*     [in] The guid to look for
+*
+*  port
+*     [in] The port to look for
+*
+* RETURN VALUES
+*	0 if successful otherwise 1
+*
+* SEE ALSO
+* osm_db_neighbor_init, osm_db_neighbor_guids
+* osm_db_neighbor_get, osm_db_neighbor_set
+*********/
+
 END_C_DECLS
 #endif				/* _OSM_DB_PACK_H_ */
diff --git a/include/opensm/osm_event_plugin.h b/include/opensm/osm_event_plugin.h
index 0922c65..6a99ed9 100644
--- a/include/opensm/osm_event_plugin.h
+++ b/include/opensm/osm_event_plugin.h
@@ -60,7 +60,7 @@ BEGIN_C_DECLS
 *
 *********/
 
-#define OSM_EPI_NODE_NAME_LEN (128)
+#define OSM_EPI_NODE_NAME_LEN (65)
 
 struct osm_opensm;
 /** =========================================================================
@@ -72,6 +72,11 @@ typedef enum {
 	OSM_EVENT_ID_PORT_SELECT,
 	OSM_EVENT_ID_TRAP,
 	OSM_EVENT_ID_SUBNET_UP,
+	OSM_EVENT_ID_HEAVY_SWEEP_START,
+	OSM_EVENT_ID_HEAVY_SWEEP_DONE,
+	OSM_EVENT_ID_UCAST_ROUTING_DONE,
+	OSM_EVENT_ID_STATE_CHANGE,
+	OSM_EVENT_ID_SA_DB_DUMPED,
 	OSM_EVENT_ID_MAX
 } osm_epi_event_id_t;
 
@@ -131,18 +136,6 @@ typedef struct osm_api_ps_event {
 } osm_epi_ps_event_t;
 
 /** =========================================================================
- * Trap events
- */
-typedef struct osm_epi_trap_event {
-	osm_epi_port_id_t port_id;
-	uint8_t type;
-	uint32_t prod_type;
-	uint16_t trap_num;
-	uint16_t issuer_lid;
-	time_t time;
-} osm_epi_trap_event_t;
-
-/** =========================================================================
  * Plugin creators should allocate an object of this type
  *    (named OSM_EVENT_PLUGIN_IMPL_NAME)
  * The version should be set to OSM_EVENT_PLUGIN_INTERFACE_VER
@@ -154,8 +147,8 @@ typedef struct osm_event_plugin {
 	const char *osm_version;
 	void *(*create) (struct osm_opensm *osm);
 	void (*delete) (void *plugin_data);
-	void (*report) (void *plugin_data,
-			osm_epi_event_id_t event_id, void *event_data);
+	void (*report) (void *plugin_data, osm_epi_event_id_t event_id,
+			void *event_data);
 } osm_event_plugin_t;
 
 /** =========================================================================
diff --git a/include/opensm/osm_file_ids.h b/include/opensm/osm_file_ids.h
new file mode 100644
index 0000000..713a0f9
--- /dev/null
+++ b/include/opensm/osm_file_ids.h
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 Mellanox Technologies LTD. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+/*
+ * Abstract:
+ * 	Declaration of osm_file_ids_enum.
+ *	This object is part of the OpenSM family of objects.
+ */
+
+#ifndef _OSM_FILE_ID_H_
+#define _OSM_FILE_ID_H_
+
+#ifdef __cplusplus
+#  define BEGIN_C_DECLS extern "C" {
+#  define END_C_DECLS   }
+#else				/* !__cplusplus */
+#  define BEGIN_C_DECLS
+#  define END_C_DECLS
+#endif				/* __cplusplus */
+
+BEGIN_C_DECLS
+
+/****d* OpenSM: osm_file_ids_enum
+* NAME
+*	osm_file_ids_enum
+*
+* DESCRIPTION
+*	Enumerates all FILE_IDs used for logging support.
+*
+* SYNOPSIS
+*/
+typedef enum _osm_file_ids_enum {
+	OSM_FILE_MAIN_C = 0,
+	OSM_FILE_CONSOLE_C,
+	OSM_FILE_CONSOLE_IO_C,
+	OSM_FILE_DB_FILES_C,
+	OSM_FILE_DB_PACK_C,
+	OSM_FILE_DROP_MGR_C,
+	OSM_FILE_DUMP_C,
+	OSM_FILE_EVENT_PLUGIN_C,
+	OSM_FILE_GUID_INFO_RCV_C,
+	OSM_FILE_GUID_MGR_C,
+	OSM_FILE_HELPER_C,
+	OSM_FILE_INFORM_C,
+	OSM_FILE_LID_MGR_C,
+	OSM_FILE_LIN_FWD_RCV_C,
+	OSM_FILE_LINK_MGR_C,
+	OSM_FILE_LOG_C,
+	OSM_FILE_MAD_POOL_C,
+	OSM_FILE_MCAST_FWD_RCV_C,
+	OSM_FILE_MCAST_MGR_C,
+	OSM_FILE_MCAST_TBL_C,
+	OSM_FILE_MCM_PORT_C,
+	OSM_FILE_MESH_C,
+	OSM_FILE_MLNX_EXT_PORT_INFO_RCV_C,
+	OSM_FILE_MTREE_C,
+	OSM_FILE_MULTICAST_C,
+	OSM_FILE_NODE_C,
+	OSM_FILE_NODE_DESC_RCV_C,
+	OSM_FILE_NODE_INFO_RCV_C,
+	OSM_FILE_OPENSM_C,
+	OSM_FILE_PERFMGR_C,
+	OSM_FILE_PERFMGR_DB_C,
+	OSM_FILE_PKEY_C,
+	OSM_FILE_PKEY_MGR_C,
+	OSM_FILE_PKEY_RCV_C,
+	OSM_FILE_PORT_C,
+	OSM_FILE_PORT_INFO_RCV_C,
+	OSM_FILE_PRTN_C,
+	OSM_FILE_PRTN_CONFIG_C,
+	OSM_FILE_QOS_C,
+	OSM_FILE_QOS_PARSER_L_L,
+	OSM_FILE_QOS_PARSER_Y_Y,
+	OSM_FILE_QOS_POLICY_C,
+	OSM_FILE_REMOTE_SM_C,
+	OSM_FILE_REQ_C,
+	OSM_FILE_RESP_C,
+	OSM_FILE_ROUTER_C,
+	OSM_FILE_SA_C,
+	OSM_FILE_SA_CLASS_PORT_INFO_C,
+	OSM_FILE_SA_GUIDINFO_RECORD_C,
+	OSM_FILE_SA_INFORMINFO_C,
+	OSM_FILE_SA_LFT_RECORD_C,
+	OSM_FILE_SA_LINK_RECORD_C,
+	OSM_FILE_SA_MAD_CTRL_C,
+	OSM_FILE_SA_MCMEMBER_RECORD_C,
+	OSM_FILE_SA_MFT_RECORD_C,
+	OSM_FILE_SA_MULTIPATH_RECORD_C,
+	OSM_FILE_SA_NODE_RECORD_C,
+	OSM_FILE_SA_PATH_RECORD_C,
+	OSM_FILE_SA_PKEY_RECORD_C,
+	OSM_FILE_SA_PORTINFO_RECORD_C,
+	OSM_FILE_SA_SERVICE_RECORD_C,
+	OSM_FILE_SA_SLVL_RECORD_C,
+	OSM_FILE_SA_SMINFO_RECORD_C,
+	OSM_FILE_SA_SW_INFO_RECORD_C,
+	OSM_FILE_SA_VLARB_RECORD_C,
+	OSM_FILE_SERVICE_C,
+	OSM_FILE_SLVL_MAP_RCV_C,
+	OSM_FILE_SM_C,
+	OSM_FILE_SMINFO_RCV_C,
+	OSM_FILE_SM_MAD_CTRL_C,
+	OSM_FILE_SM_STATE_MGR_C,
+	OSM_FILE_STATE_MGR_C,
+	OSM_FILE_SUBNET_C,
+	OSM_FILE_SW_INFO_RCV_C,
+	OSM_FILE_SWITCH_C,
+	OSM_FILE_TORUS_C,
+	OSM_FILE_TRAP_RCV_C,
+	OSM_FILE_UCAST_CACHE_C,
+	OSM_FILE_UCAST_DNUP_C,
+	OSM_FILE_UCAST_FILE_C,
+	OSM_FILE_UCAST_FTREE_C,
+	OSM_FILE_UCAST_LASH_C,
+	OSM_FILE_UCAST_MGR_C,
+	OSM_FILE_UCAST_UPDN_C,
+	OSM_FILE_VENDOR_IBUMAD_C,
+	OSM_FILE_VL15INTF_C,
+	OSM_FILE_VL_ARB_RCV_C,
+	OSM_FILE_ST_C,
+	OSM_FILE_UCAST_DFSSSP_C,
+} osm_file_ids_enum;
+/***********/
+
+END_C_DECLS
+#endif				/* _OSM_FILE_ID_H_ */
diff --git a/include/opensm/osm_pkey_mgr.h b/include/opensm/osm_guid.h
similarity index 67%
rename from include/opensm/osm_pkey_mgr.h
rename to include/opensm/osm_guid.h
index 91587bd..2fa5f7f 100644
--- a/include/opensm/osm_pkey_mgr.h
+++ b/include/opensm/osm_guid.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (c) 2006 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2011 Mellanox Technologies LTD. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -32,17 +31,12 @@
  *
  */
 
-/*
- * Abstract:
- * 	Prototype for osm_pkey_mgr_process() function
- *	This is part of the OpenSM family of objects.
- */
+#ifndef _OSM_GUID_H_
+#define _OSM_GUID_H_
 
-#ifndef _OSM_PKEY_MGR_H_
-#define _OSM_PKEY_MGR_H_
-
-#include <opensm/osm_base.h>
-#include <opensm/osm_opensm.h>
+#include <iba/ib_types.h>
+#include <complib/cl_list.h>
+#include <opensm/osm_sa.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -53,28 +47,20 @@
 #endif				/* __cplusplus */
 
 BEGIN_C_DECLS
-/****f* OpenSM: P_Key Manager/osm_pkey_mgr_process
-* NAME
-*	osm_pkey_mgr_process
-*
-* DESCRIPTION
-*	This function enforces the pkey rules on the SM DB.
-*
-* SYNOPSIS
-*/
-osm_signal_t osm_pkey_mgr_process(IN osm_opensm_t * p_osm);
-/*
-* PARAMETERS
-*	p_osm
-*		[in] Pointer to an osm_opensm_t object.
-*
-* RETURN VALUES
-*	None
-*
-* NOTES
-*
-* SEE ALSO
-*********/
+
+typedef struct osm_guidinfo_work_obj {
+	cl_list_item_t list_item;
+	osm_port_t *p_port;
+	uint8_t block_num;
+} osm_guidinfo_work_obj_t;
+
+osm_guidinfo_work_obj_t *osm_guid_work_obj_new(IN osm_port_t * p_port,
+					       IN uint8_t block_num);
+
+void osm_guid_work_obj_delete(IN osm_guidinfo_work_obj_t * p_wobj);
+
+int osm_queue_guidinfo(IN osm_sa_t *sa, IN osm_port_t *p_port,
+		       IN uint8_t block_num);
 
 END_C_DECLS
-#endif				/* _OSM_PKEY_MGR_H_ */
+#endif				/* _OSM_GUID_H_ */
diff --git a/include/opensm/osm_helper.h b/include/opensm/osm_helper.h
index 9222853..bc4bad3 100644
--- a/include/opensm/osm_helper.h
+++ b/include/opensm/osm_helper.h
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -168,6 +169,37 @@ const char *ib_get_trap_str(uint16_t trap_num);
 *
 *********/
 
+extern const ib_gid_t ib_zero_gid;
+
+/****f* IBA Base: Types/ib_gid_is_notzero
+* NAME
+*	ib_gid_is_notzero
+*
+* DESCRIPTION
+*	Returns a boolean indicating whether or not the GID is zero.
+*
+* SYNOPSIS
+*/
+static inline boolean_t ib_gid_is_notzero(IN const ib_gid_t * p_gid)
+{
+	return memcmp(p_gid, &ib_zero_gid, sizeof(*p_gid));
+}
+
+/*
+* PARAMETERS
+*	p_gid
+*		[in] Pointer to the GID object.
+*
+* RETURN VALUES
+*	Returns TRUE if GID is not zero.
+*	FALSE otherwise.
+*
+* NOTES
+*
+* SEE ALSO
+*	ib_gid_t
+*********/
+
 /****f* OpenSM: Helper/osm_dump_port_info
 * NAME
 *	osm_dump_port_info
@@ -177,12 +209,17 @@ const char *ib_get_trap_str(uint16_t trap_num);
 *
 * SYNOPSIS
 */
-void osm_dump_port_info(IN osm_log_t * const p_log,
-			IN const ib_net64_t node_guid,
-			IN const ib_net64_t port_guid,
-			IN const uint8_t port_num,
-			IN const ib_port_info_t * const p_pi,
-			IN const osm_log_level_t log_level);
+void osm_dump_port_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
+			IN ib_net64_t port_guid, IN uint8_t port_num,
+			IN const ib_port_info_t * p_pi,
+			IN osm_log_level_t log_level);
+
+void osm_dump_port_info_v2(IN osm_log_t * p_log, IN ib_net64_t node_guid,
+			   IN ib_net64_t port_guid, IN uint8_t port_num,
+			   IN const ib_port_info_t * p_pi,
+			   IN const int file_id,
+			   IN osm_log_level_t log_level);
+
 /*
 * PARAMETERS
 *	p_log
@@ -211,89 +248,189 @@ void osm_dump_port_info(IN osm_log_t * const p_log,
 * SEE ALSO
 *********/
 
-void
-osm_dump_path_record(IN osm_log_t * const p_log,
-		     IN const ib_path_rec_t * const p_pr,
-		     IN const osm_log_level_t log_level);
-
-void
-osm_dump_multipath_record(IN osm_log_t * const p_log,
-			  IN const ib_multipath_rec_t * const p_mpr,
-			  IN const osm_log_level_t log_level);
-
-void
-osm_dump_node_record(IN osm_log_t * const p_log,
-		     IN const ib_node_record_t * const p_nr,
-		     IN const osm_log_level_t log_level);
-
-void
-osm_dump_mc_record(IN osm_log_t * const p_log,
-		   IN const ib_member_rec_t * const p_mcmr,
-		   IN const osm_log_level_t log_level);
-
-void
-osm_dump_link_record(IN osm_log_t * const p_log,
-		     IN const ib_link_record_t * const p_lr,
-		     IN const osm_log_level_t log_level);
-
-void
-osm_dump_service_record(IN osm_log_t * const p_log,
-			IN const ib_service_record_t * const p_sr,
-			IN const osm_log_level_t log_level);
-
-void
-osm_dump_portinfo_record(IN osm_log_t * const p_log,
-			 IN const ib_portinfo_record_t * const p_pir,
-			 IN const osm_log_level_t log_level);
-
-void
-osm_dump_guidinfo_record(IN osm_log_t * const p_log,
-			 IN const ib_guidinfo_record_t * const p_gir,
-			 IN const osm_log_level_t log_level);
-
-void
-osm_dump_inform_info(IN osm_log_t * const p_log,
-		     IN const ib_inform_info_t * const p_ii,
-		     IN const osm_log_level_t log_level);
-
-void
-osm_dump_inform_info_record(IN osm_log_t * const p_log,
-			    IN const ib_inform_info_record_t * const p_iir,
-			    IN const osm_log_level_t log_level);
-
-void
-osm_dump_switch_info_record(IN osm_log_t * const p_log,
-			    IN const ib_switch_info_record_t * const p_sir,
-			    IN const osm_log_level_t log_level);
-
-void
-osm_dump_sm_info_record(IN osm_log_t * const p_log,
-			IN const ib_sminfo_record_t * const p_smir,
-			IN const osm_log_level_t log_level);
-
-void
-osm_dump_pkey_block(IN osm_log_t * const p_log,
-		    IN uint64_t port_guid,
-		    IN uint16_t block_num,
-		    IN uint8_t port_num,
-		    IN const ib_pkey_table_t * const p_pkey_tbl,
-		    IN const osm_log_level_t log_level);
-
-void
-osm_dump_slvl_map_table(IN osm_log_t * const p_log,
-			IN uint64_t port_guid,
-			IN uint8_t in_port_num,
-			IN uint8_t out_port_num,
-			IN const ib_slvl_table_t * const p_slvl_tbl,
-			IN const osm_log_level_t log_level);
-
-void
-osm_dump_vl_arb_table(IN osm_log_t * const p_log,
-		      IN uint64_t port_guid,
-		      IN uint8_t block_num,
-		      IN uint8_t port_num,
-		      IN const ib_vl_arb_table_t * const p_vla_tbl,
-		      IN const osm_log_level_t log_level);
+/****f* OpenSM: Helper/osm_dump_guid_info
+* NAME
+*	osm_dump_guid_info
+*
+* DESCRIPTION
+*	Dumps the GUIDInfo attribute to the log.
+*
+* SYNOPSIS
+*/
+void osm_dump_guid_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
+			IN ib_net64_t port_guid, IN uint8_t block_num,
+			IN const ib_guid_info_t * p_gi,
+			IN osm_log_level_t log_level);
+
+void osm_dump_guid_info_v2(IN osm_log_t * p_log, IN ib_net64_t node_guid,
+			   IN ib_net64_t port_guid, IN uint8_t block_num,
+			   IN const ib_guid_info_t * p_gi,
+			   IN const int file_id,
+			   IN osm_log_level_t log_level);
+/*
+* PARAMETERS
+*	p_log
+*		[in] Pointer to the osm_log_t object.
+*
+*	node_guid
+*		[in] Node GUID that owns this port.
+*
+*	port_guid
+*		[in] Port GUID for this port.
+*
+*	block_num
+*		[in] Block number.
+*
+*	p_gi
+*		[in] Pointer to the GUIDInfo attribute.
+*
+*	log_level
+*		[in] Log verbosity level with which to dump the data.
+*
+* RETURN VALUES
+*	None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+void osm_dump_mlnx_ext_port_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
+				 IN ib_net64_t port_guid, IN uint8_t port_num,
+				 IN const ib_mlnx_ext_port_info_t * p_pi,
+				 IN osm_log_level_t log_level);
+
+void osm_dump_mlnx_ext_port_info_v2(IN osm_log_t * p_log, IN ib_net64_t node_guid,
+				    IN ib_net64_t port_guid, IN uint8_t port_num,
+				    IN const ib_mlnx_ext_port_info_t * p_pi,
+				    IN const int file_id,
+				    IN osm_log_level_t log_level);
+
+void osm_dump_path_record(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr,
+			  IN osm_log_level_t log_level);
+
+void osm_dump_path_record_v2(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr,
+			     IN const int file_id, IN osm_log_level_t log_level);
+
+void osm_dump_multipath_record(IN osm_log_t * p_log,
+			       IN const ib_multipath_rec_t * p_mpr,
+			       IN osm_log_level_t log_level);
+
+void osm_dump_multipath_record_v2(IN osm_log_t * p_log,
+				  IN const ib_multipath_rec_t * p_mpr,
+				  IN const int file_id, IN osm_log_level_t log_level);
+
+void osm_dump_node_record(IN osm_log_t * p_log,
+			  IN const ib_node_record_t * p_nr,
+			  IN osm_log_level_t log_level);
+
+void osm_dump_node_record_v2(IN osm_log_t * p_log,
+			     IN const ib_node_record_t * p_nr,
+			     IN const int file_id, IN osm_log_level_t log_level);
+
+void osm_dump_mc_record(IN osm_log_t * p_log, IN const ib_member_rec_t * p_mcmr,
+			IN osm_log_level_t log_level);
+
+void osm_dump_mc_record_v2(IN osm_log_t * p_log, IN const ib_member_rec_t * p_mcmr,
+			   IN const int file_id, IN osm_log_level_t log_level);
+
+void osm_dump_link_record(IN osm_log_t * p_log,
+			  IN const ib_link_record_t * p_lr,
+			  IN osm_log_level_t log_level);
+
+void osm_dump_link_record_v2(IN osm_log_t * p_log,
+			     IN const ib_link_record_t * p_lr,
+			     IN const int file_id, IN osm_log_level_t log_level);
+
+void osm_dump_service_record(IN osm_log_t * p_log,
+			     IN const ib_service_record_t * p_sr,
+			     IN osm_log_level_t log_level);
+
+void osm_dump_service_record_v2(IN osm_log_t * p_log,
+				IN const ib_service_record_t * p_sr,
+				IN const int file_id, IN osm_log_level_t log_level);
+
+void osm_dump_portinfo_record(IN osm_log_t * p_log,
+			      IN const ib_portinfo_record_t * p_pir,
+			      IN osm_log_level_t log_level);
+
+void osm_dump_portinfo_record_v2(IN osm_log_t * p_log,
+				 IN const ib_portinfo_record_t * p_pir,
+				 IN const int file_id, IN osm_log_level_t log_level);
+
+void osm_dump_guidinfo_record(IN osm_log_t * p_log,
+			      IN const ib_guidinfo_record_t * p_gir,
+			      IN osm_log_level_t log_level);
+
+void osm_dump_guidinfo_record_v2(IN osm_log_t * p_log,
+				 IN const ib_guidinfo_record_t * p_gir,
+				 IN const int file_id, IN osm_log_level_t log_level);
+
+void osm_dump_inform_info(IN osm_log_t * p_log,
+			  IN const ib_inform_info_t * p_ii,
+			  IN osm_log_level_t log_level);
+
+void osm_dump_inform_info_v2(IN osm_log_t * p_log,
+			     IN const ib_inform_info_t * p_ii,
+			     IN const int file_id, IN osm_log_level_t log_level);
+
+void osm_dump_inform_info_record(IN osm_log_t * p_log,
+				 IN const ib_inform_info_record_t * p_iir,
+				 IN osm_log_level_t log_level);
+
+void osm_dump_inform_info_record_v2(IN osm_log_t * p_log,
+				    IN const ib_inform_info_record_t * p_iir,
+				    IN const int file_id, IN osm_log_level_t log_level);
+
+void osm_dump_switch_info_record(IN osm_log_t * p_log,
+				 IN const ib_switch_info_record_t * p_sir,
+				 IN osm_log_level_t log_level);
+
+void osm_dump_switch_info_record_v2(IN osm_log_t * p_log,
+				    IN const ib_switch_info_record_t * p_sir,
+				    IN const int file_id, IN osm_log_level_t log_level);
+
+void osm_dump_sm_info_record(IN osm_log_t * p_log,
+			     IN const ib_sminfo_record_t * p_smir,
+			     IN osm_log_level_t log_level);
+
+void osm_dump_sm_info_record_v2(IN osm_log_t * p_log,
+				IN const ib_sminfo_record_t * p_smir,
+				IN const int file_id, IN osm_log_level_t log_level);
+
+void osm_dump_pkey_block(IN osm_log_t * p_log, IN uint64_t port_guid,
+			 IN uint16_t block_num, IN uint8_t port_num,
+			 IN const ib_pkey_table_t * p_pkey_tbl,
+			 IN osm_log_level_t log_level);
+
+void osm_dump_pkey_block_v2(IN osm_log_t * p_log, IN uint64_t port_guid,
+			    IN uint16_t block_num, IN uint8_t port_num,
+			    IN const ib_pkey_table_t * p_pkey_tbl,
+			    IN const int file_id,
+			    IN osm_log_level_t log_level);
+
+void osm_dump_slvl_map_table(IN osm_log_t * p_log, IN uint64_t port_guid,
+			     IN uint8_t in_port_num, IN uint8_t out_port_num,
+			     IN const ib_slvl_table_t * p_slvl_tbl,
+			     IN osm_log_level_t log_level);
+
+void osm_dump_slvl_map_table_v2(IN osm_log_t * p_log, IN uint64_t port_guid,
+				IN uint8_t in_port_num, IN uint8_t out_port_num,
+				IN const ib_slvl_table_t * p_slvl_tbl,
+				IN const int file_id,
+				IN osm_log_level_t log_level);
+
+
+void osm_dump_vl_arb_table(IN osm_log_t * p_log, IN uint64_t port_guid,
+			   IN uint8_t block_num, IN uint8_t port_num,
+			   IN const ib_vl_arb_table_t * p_vla_tbl,
+			   IN osm_log_level_t log_level);
+
+void osm_dump_vl_arb_table_v2(IN osm_log_t * p_log, IN uint64_t port_guid,
+			      IN uint8_t block_num, IN uint8_t port_num,
+			      IN const ib_vl_arb_table_t * p_vla_tbl,
+			      IN const int file_id,
+			      IN osm_log_level_t log_level);
 
 /****f* OpenSM: Helper/osm_dump_port_info
 * NAME
@@ -304,9 +441,14 @@ osm_dump_vl_arb_table(IN osm_log_t * const p_log,
 *
 * SYNOPSIS
 */
-void osm_dump_node_info(IN osm_log_t * const p_log,
-			IN const ib_node_info_t * const p_ni,
-			IN const osm_log_level_t log_level);
+void osm_dump_node_info(IN osm_log_t * p_log,
+			IN const ib_node_info_t * p_ni,
+			IN osm_log_level_t log_level);
+
+void osm_dump_node_info_v2(IN osm_log_t * p_log,
+			   IN const ib_node_info_t * p_ni,
+			   IN const int file_id,
+			   IN osm_log_level_t log_level);
 /*
 * PARAMETERS
 *	p_log
@@ -335,10 +477,12 @@ void osm_dump_node_info(IN osm_log_t * const p_log,
 *
 * SYNOPSIS
 */
-void
-osm_dump_sm_info(IN osm_log_t * const p_log,
-		 IN const ib_sm_info_t * const p_smi,
-		 IN const osm_log_level_t log_level);
+void osm_dump_sm_info(IN osm_log_t * p_log, IN const ib_sm_info_t * p_smi,
+		      IN osm_log_level_t log_level);
+
+void osm_dump_sm_info_v2(IN osm_log_t * p_log, IN const ib_sm_info_t * p_smi,
+			 IN const int file_id, IN osm_log_level_t log_level);
+
 /*
 * PARAMETERS
 *	p_log
@@ -367,10 +511,14 @@ osm_dump_sm_info(IN osm_log_t * const p_log,
 *
 * SYNOPSIS
 */
-void
-osm_dump_switch_info(IN osm_log_t * const p_log,
-		     IN const ib_switch_info_t * const p_si,
-		     IN const osm_log_level_t log_level);
+void osm_dump_switch_info(IN osm_log_t * p_log,
+			  IN const ib_switch_info_t * p_si,
+			  IN osm_log_level_t log_level);
+
+void osm_dump_switch_info_v2(IN osm_log_t * p_log,
+			     IN const ib_switch_info_t * p_si,
+			     IN const int file_id,
+			     IN osm_log_level_t log_level);
 /*
 * PARAMETERS
 *	p_log
@@ -399,10 +547,14 @@ osm_dump_switch_info(IN osm_log_t * const p_log,
 *
 * SYNOPSIS
 */
-void
-osm_dump_notice(IN osm_log_t * const p_log,
-		IN const ib_mad_notice_attr_t * p_ntci,
-		IN const osm_log_level_t log_level);
+void osm_dump_notice(IN osm_log_t * p_log,
+		     IN const ib_mad_notice_attr_t * p_ntci,
+		     IN osm_log_level_t log_level);
+
+void osm_dump_notice_v2(IN osm_log_t * p_log,
+			IN const ib_mad_notice_attr_t * p_ntci,
+			IN const int file_id,
+			IN osm_log_level_t log_level);
 /*
 * PARAMETERS
 *	p_log
@@ -438,28 +590,37 @@ const char *osm_get_disp_msg_str(IN cl_disp_msgid_t msg);
 *		[in] Dispatcher message ID value.
 *
 * RETURN VALUES
-*	Pointer to the message discription string.
+*	Pointer to the message description string.
 *
 * NOTES
 *
 * SEE ALSO
 *********/
 
-void osm_dump_dr_path(IN osm_log_t * const p_log,
-		      IN const osm_dr_path_t * const p_path,
-		      IN const osm_log_level_t level);
+void osm_dump_dr_path(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path,
+		      IN osm_log_level_t level);
+
+void osm_dump_dr_path_v2(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path,
+			 IN const int file_id, IN osm_log_level_t level);
+
+
+void osm_dump_smp_dr_path(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
+			  IN osm_log_level_t level);
+
+void osm_dump_smp_dr_path_v2(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
+			     IN const int file_id, IN osm_log_level_t level);
+
+void osm_dump_dr_smp(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
+		     IN osm_log_level_t level);
 
-void osm_dump_smp_dr_path(IN osm_log_t * const p_log,
-			  IN const ib_smp_t * const p_smp,
-			  IN const osm_log_level_t level);
+void osm_dump_dr_smp_v2(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
+			IN const int file_id, IN osm_log_level_t level);
 
-void osm_dump_dr_smp(IN osm_log_t * const p_log,
-		     IN const ib_smp_t * const p_smp,
-		     IN const osm_log_level_t level);
+void osm_dump_sa_mad(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_smp,
+		     IN osm_log_level_t level);
 
-void osm_dump_sa_mad(IN osm_log_t * const p_log,
-		     IN const ib_sa_mad_t * const p_smp,
-		     IN const osm_log_level_t level);
+void osm_dump_sa_mad_v2(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_smp,
+			IN const int file_id, IN osm_log_level_t level);
 
 /****f* IBA Base: Types/osm_get_sm_signal_str
 * NAME
@@ -477,7 +638,7 @@ const char *osm_get_sm_signal_str(IN osm_signal_t signal);
 *		[in] Signal value
 *
 * RETURN VALUES
-*	Pointer to the signal discription string.
+*	Pointer to the signal description string.
 *
 * NOTES
 *
@@ -488,17 +649,14 @@ const char *osm_get_port_state_str_fixed_width(IN uint8_t port_state);
 
 const char *osm_get_node_type_str_fixed_width(IN uint8_t node_type);
 
-const char *osm_get_manufacturer_str(IN uint64_t const guid_ho);
+const char *osm_get_manufacturer_str(IN uint64_t guid_ho);
 
-const char *osm_get_mtu_str(IN uint8_t const mtu);
+const char *osm_get_mtu_str(IN uint8_t mtu);
 
-const char *osm_get_lwa_str(IN uint8_t const lwa);
+const char *osm_get_lwa_str(IN uint8_t lwa);
 
-const char *osm_get_mtu_str(IN uint8_t const mtu);
-
-const char *osm_get_lwa_str(IN uint8_t const lwa);
-
-const char *osm_get_lsa_str(IN uint8_t const lsa);
+const char *osm_get_lsa_str(IN uint8_t lsa, IN uint8_t lsea, IN uint8_t state,
+			    IN uint8_t fdr10);
 
 /****f* IBA Base: Types/osm_get_sm_mgr_signal_str
 * NAME
@@ -516,7 +674,7 @@ const char *osm_get_sm_mgr_signal_str(IN osm_sm_signal_t signal);
 *		[in] SM manager signal
 *
 * RETURN VALUES
-*	Pointer to the signal discription string.
+*	Pointer to the signal description string.
 *
 * NOTES
 *
@@ -539,7 +697,135 @@ const char *osm_get_sm_mgr_state_str(IN uint16_t state);
 *		[in] SM manager state
 *
 * RETURN VALUES
-*	Pointer to the state discription string.
+*	Pointer to the state description string.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_mtu_is_valid
+* NAME
+*	ib_mtu_is_valid
+*
+* DESCRIPTION
+*	Validates encoded MTU
+*
+* SYNOPSIS
+*/
+int ib_mtu_is_valid(IN const int mtu);
+/*
+* PARAMETERS
+*	mtu
+*		[in] Encoded path mtu.
+*
+* RETURN VALUES
+*	Returns an int indicating mtu is valid (1)
+*	or invalid (0).
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_rate_is_valid
+* NAME
+*	ib_rate_is_valid
+*
+* DESCRIPTION
+*	Validates encoded rate
+*
+* SYNOPSIS
+*/
+int ib_rate_is_valid(IN const int rate);
+/*
+* PARAMETERS
+*	rate
+*		[in] Encoded path rate.
+*
+* RETURN VALUES
+*	Returns an int indicating rate is valid (1)
+*	or invalid (0).
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_path_compare_rates
+* NAME
+*	ib_path_compare_rates
+*
+* DESCRIPTION
+*	Compares the encoded values for two path rates and
+*	return value is based on the ordered comparison of
+*	the path rates (or path rate equivalents).
+*
+* SYNOPSIS
+*/
+int ib_path_compare_rates(IN const int rate1, IN const int rate2);
+
+/*
+* PARAMETERS
+*	rate1
+*		[in] Encoded path rate 1.
+*
+*	rate2
+*		[in] Encoded path rate 2.
+*
+* RETURN VALUES
+*	Returns an int indicating less than (-1), equal to (0), or
+*	greater than (1) rate1 as compared with rate2.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_path_rate_get_prev
+* NAME
+*	ib_path_rate_get_prev
+*
+* DESCRIPTION
+*	Obtains encoded rate for the rate previous to the one requested.
+*
+* SYNOPSIS
+*/
+int ib_path_rate_get_prev(IN const int rate);
+
+/*
+* PARAMETERS
+*	rate
+*		[in] Encoded path rate.
+*
+* RETURN VALUES
+*	Returns an int indicating encoded rate or
+*	0 if none can be found.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_path_rate_get_next
+* NAME
+*	ib_path_rate_get_next
+*
+* DESCRIPTION
+*	Obtains encoded rate for the rate subsequent to the one requested.
+*
+* SYNOPSIS
+*/
+int ib_path_rate_get_next(IN const int rate);
+
+/*
+* PARAMETERS
+*	rate
+*		[in] Encoded path rate.
+*
+* RETURN VALUES
+*	Returns an int indicating encoded rate or
+*	0 if none can be found.
 *
 * NOTES
 *
diff --git a/include/opensm/osm_inform.h b/include/opensm/osm_inform.h
index 1528642..f737441 100644
--- a/include/opensm/osm_inform.h
+++ b/include/opensm/osm_inform.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -155,7 +155,7 @@ osm_infr_t *osm_infr_new(IN const osm_infr_t * p_infr_rec);
 *
 * SYNOPSIS
 */
-void osm_infr_delete(IN osm_infr_t * const p_infr);
+void osm_infr_delete(IN osm_infr_t * p_infr);
 /*
 * PARAMETERS
 *	p_infr
@@ -176,7 +176,7 @@ void osm_infr_delete(IN osm_infr_t * const p_infr);
 */
 osm_infr_t *osm_infr_get_by_rec(IN osm_subn_t const *p_subn,
 				IN osm_log_t * p_log,
-				IN osm_infr_t * const p_infr_rec);
+				IN osm_infr_t * p_infr_rec);
 /*
 * PARAMETERS
 *	p_subn
@@ -194,13 +194,11 @@ osm_infr_t *osm_infr_get_by_rec(IN osm_subn_t const *p_subn,
 *	Inform Record, osm_infr_new, osm_infr_delete
 *********/
 
-void
-osm_infr_insert_to_db(IN osm_subn_t * p_subn,
-		      IN osm_log_t * p_log, IN osm_infr_t * p_infr);
+void osm_infr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
+			   IN osm_infr_t * p_infr);
 
-void
-osm_infr_remove_from_db(IN osm_subn_t * p_subn,
-			IN osm_log_t * p_log, IN osm_infr_t * p_infr);
+void osm_infr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
+			     IN osm_infr_t * p_infr);
 
 /****f* OpenSM: Inform Record/osm_report_notice
 * NAME
@@ -216,9 +214,8 @@ osm_infr_remove_from_db(IN osm_subn_t * p_subn,
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_report_notice(IN osm_log_t * const p_log,
-		  IN osm_subn_t * p_subn, IN ib_mad_notice_attr_t * p_ntc);
+ib_api_status_t osm_report_notice(IN osm_log_t * p_log, IN osm_subn_t * p_subn,
+				  IN ib_mad_notice_attr_t * p_ntc);
 /*
 * PARAMETERS
 *	p_rcv
diff --git a/include/opensm/osm_lid_mgr.h b/include/opensm/osm_lid_mgr.h
index 714ba41..40f0d30 100644
--- a/include/opensm/osm_lid_mgr.h
+++ b/include/opensm/osm_lid_mgr.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -96,10 +96,9 @@ typedef struct osm_lid_mgr {
 	osm_db_t *p_db;
 	osm_log_t *p_log;
 	cl_plock_t *p_lock;
-	boolean_t send_set_reqs;
 	osm_db_domain_t *p_g2l;
-	cl_ptr_vector_t used_lids;
 	cl_qlist_t free_ranges;
+	uint8_t used_lids[IB_LID_UCAST_END_HO + 1];
 } osm_lid_mgr_t;
 /*
 * FIELDS
@@ -118,14 +117,11 @@ typedef struct osm_lid_mgr {
 *	p_lock
 *		Pointer to the serializing lock.
 *
-*	send_set_reqs
-*		Boolean to indicate whether any set requests sent.
-*
 *	p_g2l
 *		Pointer to the database domain storing guid to lid mapping.
 *
 *	used_lids
-*		A vector the maps from the lid to its guid. keeps track of
+*		An array of used lids. keeps track of
 *		existing and non existing mapping of guid->lid
 *
 *	free_ranges
@@ -147,7 +143,7 @@ typedef struct osm_lid_mgr {
 *
 * SYNOPSIS
 */
-void osm_lid_mgr_construct(IN osm_lid_mgr_t * const p_mgr);
+void osm_lid_mgr_construct(IN osm_lid_mgr_t * p_mgr);
 /*
 * PARAMETERS
 *	p_mgr
@@ -177,7 +173,7 @@ void osm_lid_mgr_construct(IN osm_lid_mgr_t * const p_mgr);
 *
 * SYNOPSIS
 */
-void osm_lid_mgr_destroy(IN osm_lid_mgr_t * const p_mgr);
+void osm_lid_mgr_destroy(IN osm_lid_mgr_t * p_mgr);
 /*
 * PARAMETERS
 *	p_mgr
@@ -209,7 +205,7 @@ void osm_lid_mgr_destroy(IN osm_lid_mgr_t * const p_mgr);
 * SYNOPSIS
 */
 ib_api_status_t
-osm_lid_mgr_init(IN osm_lid_mgr_t * const p_mgr, IN struct osm_sm * sm);
+osm_lid_mgr_init(IN osm_lid_mgr_t * p_mgr, IN struct osm_sm * sm);
 /*
 * PARAMETERS
 *	p_mgr
@@ -239,17 +235,14 @@ osm_lid_mgr_init(IN osm_lid_mgr_t * const p_mgr, IN struct osm_sm * sm);
 *
 * SYNOPSIS
 */
-osm_signal_t osm_lid_mgr_process_sm(IN osm_lid_mgr_t * const p_mgr);
+int osm_lid_mgr_process_sm(IN osm_lid_mgr_t * p_mgr);
 /*
 * PARAMETERS
 *	p_mgr
 *		[in] Pointer to an osm_lid_mgr_t object.
 *
 * RETURN VALUES
-*	Returns the appropriate signal to the caller:
-*		OSM_SIGNAL_DONE - operation is complete
-*		OSM_SIGNAL_DONE_PENDING - local operations are complete, but
-*			transactions are still pending on the wire.
+*	Returns 0 on success and non-zero value otherwise.
 *
 * NOTES
 *
@@ -267,17 +260,14 @@ osm_signal_t osm_lid_mgr_process_sm(IN osm_lid_mgr_t * const p_mgr);
 *
 * SYNOPSIS
 */
-osm_signal_t osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * const p_mgr);
+int osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * p_mgr);
 /*
 * PARAMETERS
 *	p_mgr
 *		[in] Pointer to an osm_lid_mgr_t object.
 *
 * RETURN VALUES
-*	Returns the appropriate signal to the caller:
-*		OSM_SIGNAL_DONE - operation is complete
-*		OSM_SIGNAL_DONE_PENDING - local operations are complete, but
-*			transactions are still pending on the wire.
+*	Returns 0 on success and non-zero value otherwise.
 *
 * NOTES
 *
diff --git a/include/opensm/osm_log.h b/include/opensm/osm_log.h
index 20999d9..3247296 100644
--- a/include/opensm/osm_log.h
+++ b/include/opensm/osm_log.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -53,8 +53,10 @@
 
 #ifdef __GNUC__
 #define STRICT_OSM_LOG_FORMAT __attribute__((format(printf, 3, 4)))
+#define STRICT_OSM_LOG_V2_FORMAT __attribute__((format(printf, 4, 5)))
 #else
 #define STRICT_OSM_LOG_FORMAT
+#define STRICT_OSM_LOG_V2_FORMAT
 #endif
 
 #ifdef __cplusplus
@@ -69,12 +71,24 @@ BEGIN_C_DECLS
 #define LOG_ENTRY_SIZE_MAX		4096
 #define BUF_SIZE			LOG_ENTRY_SIZE_MAX
 #define __func__ __FUNCTION__
+#ifdef FILE_ID
+#define OSM_LOG_ENTER( OSM_LOG_PTR ) \
+	osm_log_v2( OSM_LOG_PTR, OSM_LOG_FUNCS, FILE_ID, \
+		    "%s: [\n", __func__);
+#define OSM_LOG_EXIT( OSM_LOG_PTR ) \
+	osm_log_v2( OSM_LOG_PTR, OSM_LOG_FUNCS, FILE_ID, \
+		    "%s: ]\n", __func__);
+#define OSM_LOG_IS_ACTIVE_V2( OSM_LOG_PTR, OSM_LOG_FUNCS ) \
+	osm_log_is_active_v2( OSM_LOG_PTR, OSM_LOG_FUNCS, FILE_ID)
+#else
 #define OSM_LOG_ENTER( OSM_LOG_PTR ) \
 	osm_log( OSM_LOG_PTR, OSM_LOG_FUNCS, \
 		 "%s: [\n", __func__);
 #define OSM_LOG_EXIT( OSM_LOG_PTR ) \
 	osm_log( OSM_LOG_PTR, OSM_LOG_FUNCS, \
 		 "%s: ]\n", __func__);
+#endif
+
 /****h* OpenSM/Log
 * NAME
 *	Log
@@ -102,7 +116,7 @@ typedef uint8_t osm_log_level_t;
 */
 #define OSM_LOG_DEFAULT_LEVEL		OSM_LOG_ERROR | OSM_LOG_INFO
 
-/****s* OpenSM: MAD Wrapper/osm_log_t
+/****s* OpenSM: Log/osm_log_t
 * NAME
 *	osm_log_t
 *
@@ -120,9 +134,87 @@ typedef struct osm_log {
 	boolean_t accum_log_file;
 	boolean_t daemon;
 	char *log_file_name;
+	char *log_prefix;
+	osm_log_level_t per_mod_log_tbl[256];
 } osm_log_t;
 /*********/
 
+#define OSM_LOG_MOD_NAME_MAX	32
+
+/****f* OpenSM: Log/osm_get_log_per_module
+ * NAME
+ *	osm_get_log_per_module
+ *
+ * DESCRIPTION
+ *	This looks up the given file ID in the per module log table.
+ *	NOTE: this code is not thread safe. Need to grab the lock before
+ *	calling it.
+ *
+ * SYNOPSIS
+ */
+osm_log_level_t osm_get_log_per_module(IN osm_log_t * p_log,
+				       IN const int file_id);
+/*
+ * PARAMETERS
+ *	p_log
+ *		[in] Pointer to a Log object to construct.
+ *
+ *	file_id
+ *		[in] File ID for module
+ *
+ * RETURN VALUES
+ *	The log level from the per module logging structure for this file ID.
+ *********/
+
+/****f* OpenSM: Log/osm_set_log_per_module
+ * NAME
+ *	osm_set_log_per_module
+ *
+ * DESCRIPTION
+ *	This sets log level for the given file ID in the per module log table.
+ *	NOTE: this code is not thread safe. Need to grab the lock before
+ *	calling it.
+ *
+ * SYNOPSIS
+ */
+void osm_set_log_per_module(IN osm_log_t * p_log, IN const int file_id,
+			    IN osm_log_level_t level);
+/*
+ * PARAMETERS
+ *	p_log
+ *		[in] Pointer to a Log object to construct.
+ *
+ *	file_id
+ *		[in] File ID for module
+ *
+ *	level
+ *		[in] Log level of the module
+ *
+ * RETURN VALUES
+ *	This function does not return a value.
+ *********/
+
+/****f* OpenSM: Log/osm_reset_log_per_module
+ * NAME
+ *	osm_reset_log_per_module
+ *
+ * DESCRIPTION
+ *	This resets log level for the entire per module log table.
+ *	NOTE: this code is not thread safe. Need to grab the lock before
+ *	calling it.
+ *
+ * SYNOPSIS
+ */
+void osm_reset_log_per_module(IN osm_log_t * p_log);
+/*
+ * PARAMETERS
+ *	p_log
+ *		[in] Pointer to a Log object to construct.
+ *
+ * RETURN VALUES
+ *	This function does not return a value.
+ *********/
+
 /****f* OpenSM: Log/osm_log_construct
 * NAME
 *	osm_log_construct
@@ -132,7 +224,7 @@ typedef struct osm_log {
 *
 * SYNOPSIS
 */
-static inline void osm_log_construct(IN osm_log_t * const p_log)
+static inline void osm_log_construct(IN osm_log_t * p_log)
 {
 	cl_spinlock_construct(&p_log->lock);
 }
@@ -166,7 +258,7 @@ static inline void osm_log_construct(IN osm_log_t * const p_log)
 *
 * SYNOPSIS
 */
-static inline void osm_log_destroy(IN osm_log_t * const p_log)
+static inline void osm_log_destroy(IN osm_log_t * p_log)
 {
 	cl_spinlock_destroy(&p_log->lock);
 	if (p_log->out_port != stdout) {
@@ -206,13 +298,10 @@ static inline void osm_log_destroy(IN osm_log_t * const p_log)
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_log_init_v2(IN osm_log_t * const p_log,
-		IN const boolean_t flush,
-		IN const uint8_t log_flags,
-		IN const char *log_file,
-		IN const unsigned long max_size,
-		IN const boolean_t accum_log_file);
+ib_api_status_t osm_log_init_v2(IN osm_log_t * p_log, IN boolean_t flush,
+				IN uint8_t log_flags, IN const char *log_file,
+				IN unsigned long max_size,
+				IN boolean_t accum_log_file);
 /*
 * PARAMETERS
 *	p_log
@@ -271,19 +360,18 @@ int osm_log_reopen_file(osm_log_t * p_log);
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_log_init(IN osm_log_t * const p_log,
-	     IN const boolean_t flush,
-	     IN const uint8_t log_flags,
-	     IN const char *log_file, IN const boolean_t accum_log_file);
+ib_api_status_t osm_log_init(IN osm_log_t * p_log, IN boolean_t flush,
+			     IN uint8_t log_flags, IN const char *log_file,
+			     IN boolean_t accum_log_file);
 /*
  * Same as osm_log_init_v2() but without max_size parameter
  */
 
-void
-osm_log(IN osm_log_t * const p_log,
-	IN const osm_log_level_t verbosity,
-	IN const char *p_str, ...) STRICT_OSM_LOG_FORMAT;
+void osm_log(IN osm_log_t * p_log, IN osm_log_level_t verbosity,
+	     IN const char *p_str, ...) STRICT_OSM_LOG_FORMAT;
+
+void osm_log_v2(IN osm_log_t * p_log, IN osm_log_level_t verbosity,
+		IN const int file_id, IN const char *p_str, ...) STRICT_OSM_LOG_V2_FORMAT;
 
 /****f* OpenSM: Log/osm_log_get_level
 * NAME
@@ -294,10 +382,9 @@ osm_log(IN osm_log_t * const p_log,
 *
 * SYNOPSIS
 */
-static inline osm_log_level_t
-osm_log_get_level(IN const osm_log_t * const p_log)
+static inline osm_log_level_t osm_log_get_level(IN const osm_log_t * p_log)
 {
-	return (p_log->level);
+	return p_log->level;
 }
 
 /*
@@ -324,8 +411,8 @@ osm_log_get_level(IN const osm_log_t * const p_log)
 *
 * SYNOPSIS
 */
-static inline void
-osm_log_set_level(IN osm_log_t * const p_log, IN const osm_log_level_t level)
+static inline void osm_log_set_level(IN osm_log_t * p_log,
+				     IN osm_log_level_t level)
 {
 	p_log->level = level;
 	osm_log(p_log, OSM_LOG_ALL, "Setting log level to: 0x%02x\n", level);
@@ -359,9 +446,8 @@ osm_log_set_level(IN osm_log_t * const p_log, IN const osm_log_level_t level)
 *
 * SYNOPSIS
 */
-static inline boolean_t
-osm_log_is_active(IN const osm_log_t * const p_log,
-		  IN const osm_log_level_t level)
+static inline boolean_t osm_log_is_active(IN const osm_log_t * p_log,
+					  IN osm_log_level_t level)
 {
 	return ((p_log->level & level) != 0);
 }
@@ -385,18 +471,42 @@ osm_log_is_active(IN const osm_log_t * const p_log,
 *	osm_log_destroy
 *********/
 
+static inline boolean_t osm_log_is_active_v2(IN const osm_log_t * p_log,
+					     IN osm_log_level_t level,
+					     IN const int file_id)
+{
+	if ((p_log->level & level) != 0)
+		return 1;
+	if ((level & p_log->per_mod_log_tbl[file_id]))
+		return 1;
+	return 0;
+}
+
 extern void osm_log_msg_box(osm_log_t *log, osm_log_level_t level,
 			    const char *func_name, const char *msg);
-extern void osm_log_raw(IN osm_log_t * const p_log,
-	    IN const osm_log_level_t verbosity, IN const char *p_buf);
+extern void osm_log_msg_box_v2(osm_log_t *log, osm_log_level_t level,
+			       const int file_id, const char *func_name,
+			       const char *msg);
+extern void osm_log_raw(IN osm_log_t * p_log, IN osm_log_level_t verbosity,
+			IN const char *p_buf);
+
+#ifdef FILE_ID
+#define OSM_LOG(log, level, fmt, ...) do { \
+		if (osm_log_is_active_v2(log, (level), FILE_ID)) \
+			osm_log_v2(log, level, FILE_ID, "%s: " fmt, __func__, ## __VA_ARGS__); \
+	} while (0)
 
-#define OSM_LOG(log, level, fmt, arg...) do { \
+#define OSM_LOG_MSG_BOX(log, level, msg) \
+		osm_log_msg_box_v2(log, level, FILE_ID, __func__, msg)
+#else
+#define OSM_LOG(log, level, fmt, ...) do { \
 		if (osm_log_is_active(log, (level))) \
-			osm_log(log, level, "%s: " fmt, __func__, ##arg); \
+			osm_log(log, level, "%s: " fmt, __func__, ## __VA_ARGS__); \
 	} while (0)
 
 #define OSM_LOG_MSG_BOX(log, level, msg) \
 		osm_log_msg_box(log, level, __func__, msg)
+#endif
 
 #define DBG_CL_LOCK 0
 
diff --git a/include/opensm/osm_mad_pool.h b/include/opensm/osm_mad_pool.h
index 0aa5b46..ccfdd6e 100644
--- a/include/opensm/osm_mad_pool.h
+++ b/include/opensm/osm_mad_pool.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -109,7 +109,7 @@ typedef struct osm_mad_pool {
 *
 * SYNOPSIS
 */
-void osm_mad_pool_construct(IN osm_mad_pool_t * const p_pool);
+void osm_mad_pool_construct(IN osm_mad_pool_t * p_pool);
 /*
 * PARAMETERS
 *	p_pool
@@ -138,7 +138,7 @@ void osm_mad_pool_construct(IN osm_mad_pool_t * const p_pool);
 *
 * SYNOPSIS
 */
-void osm_mad_pool_destroy(IN osm_mad_pool_t * const p_pool);
+void osm_mad_pool_destroy(IN osm_mad_pool_t * p_pool);
 /*
 * PARAMETERS
 *	p_pool
@@ -166,7 +166,7 @@ void osm_mad_pool_destroy(IN osm_mad_pool_t * const p_pool);
 *
 * SYNOPSIS
 */
-ib_api_status_t osm_mad_pool_init(IN osm_mad_pool_t * const p_pool);
+ib_api_status_t osm_mad_pool_init(IN osm_mad_pool_t * p_pool);
 /*
 * PARAMETERS
 *	p_pool
@@ -191,10 +191,10 @@ ib_api_status_t osm_mad_pool_init(IN osm_mad_pool_t * const p_pool);
 *
 * SYNOPSIS
 */
-osm_madw_t *osm_mad_pool_get(IN osm_mad_pool_t * const p_pool,
+osm_madw_t *osm_mad_pool_get(IN osm_mad_pool_t * p_pool,
 			     IN osm_bind_handle_t h_bind,
-			     IN const uint32_t total_size,
-			     IN const osm_mad_addr_t * const p_mad_addr);
+			     IN uint32_t total_size,
+			     IN const osm_mad_addr_t * p_mad_addr);
 /*
 * PARAMETERS
 *	p_pool
@@ -235,8 +235,7 @@ osm_madw_t *osm_mad_pool_get(IN osm_mad_pool_t * const p_pool,
 *
 * SYNOPSIS
 */
-void osm_mad_pool_put(IN osm_mad_pool_t * const p_pool,
-		      IN osm_madw_t * const p_madw);
+void osm_mad_pool_put(IN osm_mad_pool_t * p_pool, IN osm_madw_t * p_madw);
 /*
 * PARAMETERS
 *	p_pool
@@ -266,12 +265,11 @@ void osm_mad_pool_put(IN osm_mad_pool_t * const p_pool,
 *
 * SYNOPSIS
 */
-osm_madw_t *osm_mad_pool_get_wrapper(IN osm_mad_pool_t * const p_pool,
+osm_madw_t *osm_mad_pool_get_wrapper(IN osm_mad_pool_t * p_pool,
 				     IN osm_bind_handle_t h_bind,
-				     IN const uint32_t total_size,
-				     IN const ib_mad_t * const p_mad,
-				     IN const osm_mad_addr_t *
-				     const p_mad_addr);
+				     IN uint32_t total_size,
+				     IN const ib_mad_t * p_mad,
+				     IN const osm_mad_addr_t * p_mad_addr);
 /*
 * PARAMETERS
 *	p_pool
@@ -316,7 +314,7 @@ osm_madw_t *osm_mad_pool_get_wrapper(IN osm_mad_pool_t * const p_pool,
 *
 * SYNOPSIS
 */
-osm_madw_t *osm_mad_pool_get_wrapper_raw(IN osm_mad_pool_t * const p_pool);
+osm_madw_t *osm_mad_pool_get_wrapper_raw(IN osm_mad_pool_t * p_pool);
 /*
 * PARAMETERS
 *	p_pool
@@ -347,9 +345,9 @@ osm_madw_t *osm_mad_pool_get_wrapper_raw(IN osm_mad_pool_t * const p_pool);
 * SYNOPSIS
 */
 static inline uint32_t
-osm_mad_pool_get_outstanding(IN const osm_mad_pool_t * const p_pool)
+osm_mad_pool_get_outstanding(IN const osm_mad_pool_t * p_pool)
 {
-	return (p_pool->mads_out);
+	return p_pool->mads_out;
 }
 
 /*
diff --git a/include/opensm/osm_madw.h b/include/opensm/osm_madw.h
index f47142d..afc3680 100644
--- a/include/opensm/osm_madw.h
+++ b/include/opensm/osm_madw.h
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -76,6 +77,8 @@ typedef struct osm_bind_info {
 	boolean_t is_report_processor;
 	uint32_t send_q_size;
 	uint32_t recv_q_size;
+	uint32_t timeout;
+	uint32_t retries;
 } osm_bind_info_t;
 /*
 * FIELDS
@@ -103,6 +106,12 @@ typedef struct osm_bind_info {
 *	recv_q_size
 *		Receive Queue Size
 *
+*	timeout
+*		Transaction timeout
+*
+*	retries
+*		Number of retries for transaction
+*
 * SEE ALSO
 *********/
 
@@ -176,6 +185,23 @@ typedef struct osm_pi_context {
 } osm_pi_context_t;
 /*********/
 
+/****s* OpenSM: MAD Wrapper/osm_gi_context_t
+* NAME
+*	osm_gi_context_t
+*
+* DESCRIPTION
+*	Context needed by recipient of GUIDInfo attribute.
+*
+* SYNOPSIS
+*/
+typedef struct osm_gi_context {
+	ib_net64_t node_guid;
+	ib_net64_t port_guid;
+	boolean_t set_method;
+	uint8_t port_num;
+} osm_gi_context_t;
+/*********/
+
 /****s* OpenSM: MAD Wrapper/osm_nd_context_t
 * NAME
 *	osm_nd_context_t
@@ -314,6 +340,19 @@ typedef struct osm_perfmgr_context {
 } osm_perfmgr_context_t;
 /*********/
 
+/****s* OpenSM: MAD Wrapper/osm_cc_context_t
+* DESCRIPTION
+*	Context for Congestion Control MADs
+*/
+typedef struct osm_cc_context {
+	ib_net64_t node_guid;
+	ib_net64_t port_guid;
+	uint8_t port;
+	uint8_t mad_method;	/* was this a get or a set */
+	ib_net32_t attr_mod;
+} osm_cc_context_t;
+/*********/
+
 #ifndef OSM_VENDOR_INTF_OPENIB
 /****s* OpenSM: MAD Wrapper/osm_arbitrary_context_t
 * NAME
@@ -343,6 +382,7 @@ typedef struct osm_arbitrary_context {
 typedef union _osm_madw_context {
 	osm_ni_context_t ni_context;
 	osm_pi_context_t pi_context;
+	osm_gi_context_t gi_context;
 	osm_nd_context_t nd_context;
 	osm_si_context_t si_context;
 	osm_lft_context_t lft_context;
@@ -352,6 +392,7 @@ typedef union _osm_madw_context {
 	osm_pkey_context_t pkey_context;
 	osm_vla_context_t vla_context;
 	osm_perfmgr_context_t perfmgr_context;
+	osm_cc_context_t cc_context;
 #ifndef OSM_VENDOR_INTF_OPENIB
 	osm_arbitrary_context_t arb_context;
 #endif
@@ -469,11 +510,10 @@ typedef struct osm_madw {
 *
 * SYNOPSIS
 */
-static inline void
-osm_madw_init(IN osm_madw_t * const p_madw,
-	      IN osm_bind_handle_t h_bind,
-	      IN const uint32_t mad_size,
-	      IN const osm_mad_addr_t * const p_mad_addr)
+static inline void osm_madw_init(IN osm_madw_t * p_madw,
+				 IN osm_bind_handle_t h_bind,
+				 IN uint32_t mad_size,
+				 IN const osm_mad_addr_t * p_mad_addr)
 {
 	memset(p_madw, 0, sizeof(*p_madw));
 	p_madw->h_bind = h_bind;
@@ -513,7 +553,7 @@ osm_madw_init(IN osm_madw_t * const p_madw,
 *
 * SYNOPSIS
 */
-static inline ib_smp_t *osm_madw_get_smp_ptr(IN const osm_madw_t * const p_madw)
+static inline ib_smp_t *osm_madw_get_smp_ptr(IN const osm_madw_t * p_madw)
 {
 	return ((ib_smp_t *) p_madw->p_mad);
 }
@@ -541,8 +581,7 @@ static inline ib_smp_t *osm_madw_get_smp_ptr(IN const osm_madw_t * const p_madw)
 *
 * SYNOPSIS
 */
-static inline ib_sa_mad_t *osm_madw_get_sa_mad_ptr(IN const osm_madw_t *
-						   const p_madw)
+static inline ib_sa_mad_t *osm_madw_get_sa_mad_ptr(IN const osm_madw_t * p_madw)
 {
 	return ((ib_sa_mad_t *) p_madw->p_mad);
 }
@@ -568,7 +607,7 @@ static inline ib_sa_mad_t *osm_madw_get_sa_mad_ptr(IN const osm_madw_t *
 * SYNOPSIS
 */
 static inline ib_perfmgt_mad_t *osm_madw_get_perfmgt_mad_ptr(IN const osm_madw_t
-							     * const p_madw)
+							     * p_madw)
 {
 	return ((ib_perfmgt_mad_t *) p_madw->p_mad);
 }
@@ -587,6 +626,32 @@ static inline ib_perfmgt_mad_t *osm_madw_get_perfmgt_mad_ptr(IN const osm_madw_t
 *	MAD Wrapper object
 *********/
 
+/****f* OpenSM: MAD Wrapper/osm_madw_get_cc_mad_ptr
+* DESCRIPTION
+*	Gets a pointer to the Congestion Control MAD in this MAD wrapper.
+*
+* SYNOPSIS
+*/
+static inline ib_cc_mad_t *osm_madw_get_cc_mad_ptr(IN const osm_madw_t
+						   * p_madw)
+{
+	return ((ib_cc_mad_t *) p_madw->p_mad);
+}
+
+/*
+* PARAMETERS
+*	p_madw
+*		[in] Pointer to an osm_madw_t object.
+*
+* RETURN VALUES
+*	Pointer to the start of the Congestion Control MAD.
+*
+* NOTES
+*
+* SEE ALSO
+*	MAD Wrapper object
+*********/
+
 /****f* OpenSM: MAD Wrapper/osm_madw_get_ni_context_ptr
 * NAME
 *	osm_madw_get_ni_context_ptr
@@ -597,7 +662,7 @@ static inline ib_perfmgt_mad_t *osm_madw_get_perfmgt_mad_ptr(IN const osm_madw_t
 * SYNOPSIS
 */
 static inline osm_ni_context_t *osm_madw_get_ni_context_ptr(IN const osm_madw_t
-							    * const p_madw)
+							    * p_madw)
 {
 	return ((osm_ni_context_t *) & p_madw->context);
 }
@@ -625,7 +690,7 @@ static inline osm_ni_context_t *osm_madw_get_ni_context_ptr(IN const osm_madw_t
 * SYNOPSIS
 */
 static inline osm_pi_context_t *osm_madw_get_pi_context_ptr(IN const osm_madw_t
-							    * const p_madw)
+							    * p_madw)
 {
 	return ((osm_pi_context_t *) & p_madw->context);
 }
@@ -643,6 +708,34 @@ static inline osm_pi_context_t *osm_madw_get_pi_context_ptr(IN const osm_madw_t
 * SEE ALSO
 *********/
 
+/****f* OpenSM: MAD Wrapper/osm_madw_get_gi_context_ptr
+* NAME
+*	osm_madw_get_gi_context_ptr
+*
+* DESCRIPTION
+*	Gets a pointer to the GUIDInfo context in this MAD.
+*
+* SYNOPSIS
+*/
+static inline osm_gi_context_t *osm_madw_get_gi_context_ptr(IN const osm_madw_t
+							    * p_madw)
+{
+	return ((osm_gi_context_t *) & p_madw->context);
+}
+
+/*
+* PARAMETERS
+*	p_madw
+*		[in] Pointer to an osm_madw_t object.
+*
+* RETURN VALUES
+*	Pointer to the start of the context structure.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
 /****f* OpenSM: MAD Wrapper/osm_madw_get_nd_context_ptr
 * NAME
 *	osm_madw_get_nd_context_ptr
@@ -653,7 +746,7 @@ static inline osm_pi_context_t *osm_madw_get_pi_context_ptr(IN const osm_madw_t
 * SYNOPSIS
 */
 static inline osm_nd_context_t *osm_madw_get_nd_context_ptr(IN const osm_madw_t
-							    * const p_madw)
+							    * p_madw)
 {
 	return ((osm_nd_context_t *) & p_madw->context);
 }
@@ -682,7 +775,7 @@ static inline osm_nd_context_t *osm_madw_get_nd_context_ptr(IN const osm_madw_t
 */
 static inline osm_lft_context_t *osm_madw_get_lft_context_ptr(IN const
 							      osm_madw_t *
-							      const p_madw)
+							      p_madw)
 {
 	return ((osm_lft_context_t *) & p_madw->context);
 }
@@ -711,7 +804,7 @@ static inline osm_lft_context_t *osm_madw_get_lft_context_ptr(IN const
 */
 static inline osm_mft_context_t *osm_madw_get_mft_context_ptr(IN const
 							      osm_madw_t *
-							      const p_madw)
+							      p_madw)
 {
 	return ((osm_mft_context_t *) & p_madw->context);
 }
@@ -739,7 +832,7 @@ static inline osm_mft_context_t *osm_madw_get_mft_context_ptr(IN const
 * SYNOPSIS
 */
 static inline osm_si_context_t *osm_madw_get_si_context_ptr(IN const osm_madw_t
-							    * const p_madw)
+							    * p_madw)
 {
 	return ((osm_si_context_t *) & p_madw->context);
 }
@@ -768,7 +861,7 @@ static inline osm_si_context_t *osm_madw_get_si_context_ptr(IN const osm_madw_t
 */
 static inline osm_smi_context_t *osm_madw_get_smi_context_ptr(IN const
 							      osm_madw_t *
-							      const p_madw)
+							      p_madw)
 {
 	return ((osm_smi_context_t *) & p_madw->context);
 }
@@ -797,7 +890,7 @@ static inline osm_smi_context_t *osm_madw_get_smi_context_ptr(IN const
 */
 static inline osm_pkey_context_t *osm_madw_get_pkey_context_ptr(IN const
 								osm_madw_t *
-								const p_madw)
+								p_madw)
 {
 	return ((osm_pkey_context_t *) & p_madw->context);
 }
@@ -826,7 +919,7 @@ static inline osm_pkey_context_t *osm_madw_get_pkey_context_ptr(IN const
 */
 static inline osm_slvl_context_t *osm_madw_get_slvl_context_ptr(IN const
 								osm_madw_t *
-								const p_madw)
+								p_madw)
 {
 	return ((osm_slvl_context_t *) & p_madw->context);
 }
@@ -855,7 +948,7 @@ static inline osm_slvl_context_t *osm_madw_get_slvl_context_ptr(IN const
 */
 static inline osm_vla_context_t *osm_madw_get_vla_context_ptr(IN const
 							      osm_madw_t *
-							      const p_madw)
+							      p_madw)
 {
 	return ((osm_vla_context_t *) & p_madw->context);
 }
@@ -917,7 +1010,7 @@ static inline osm_arbitrary_context_t *osm_madw_get_arbitrary_context_ptr(IN
 * SYNOPSIS
 */
 static inline osm_vend_wrap_t *osm_madw_get_vend_ptr(IN const osm_madw_t *
-						     const p_madw)
+						     p_madw)
 {
 	return ((osm_vend_wrap_t *) & p_madw->vend_wrap);
 }
@@ -935,9 +1028,9 @@ static inline osm_vend_wrap_t *osm_madw_get_vend_ptr(IN const osm_madw_t *
 * SEE ALSO
 *********/
 
-/****f* OpenSM: MAD Wrapper/osm_madw_get_vend_ptr
+/****f* OpenSM: MAD Wrapper/osm_madw_get_bind_handle
 * NAME
-*	osm_madw_get_vend_ptr
+*	osm_madw_get_bind_handle
 *
 * DESCRIPTION
 *	Returns the bind handle associated with this MAD.
@@ -945,7 +1038,7 @@ static inline osm_vend_wrap_t *osm_madw_get_vend_ptr(IN const osm_madw_t *
 * SYNOPSIS
 */
 static inline osm_bind_handle_t
-osm_madw_get_bind_handle(IN const osm_madw_t * const p_madw)
+osm_madw_get_bind_handle(IN const osm_madw_t * p_madw)
 {
 	return ((osm_bind_handle_t) p_madw->h_bind);
 }
@@ -973,7 +1066,7 @@ osm_madw_get_bind_handle(IN const osm_madw_t * const p_madw)
 * SYNOPSIS
 */
 static inline osm_mad_addr_t *osm_madw_get_mad_addr_ptr(IN const osm_madw_t *
-							const p_madw)
+							p_madw)
 {
 	return ((osm_mad_addr_t *) & p_madw->mad_addr);
 }
@@ -1000,7 +1093,7 @@ static inline osm_mad_addr_t *osm_madw_get_mad_addr_ptr(IN const osm_madw_t *
 *
 * SYNOPSIS
 */
-static inline ib_mad_t *osm_madw_get_mad_ptr(IN const osm_madw_t * const p_madw)
+static inline ib_mad_t *osm_madw_get_mad_ptr(IN const osm_madw_t * p_madw)
 {
 	return ((ib_mad_t *) p_madw->p_mad);
 }
@@ -1028,8 +1121,7 @@ static inline ib_mad_t *osm_madw_get_mad_ptr(IN const osm_madw_t * const p_madw)
 *
 * SYNOPSIS
 */
-static inline cl_disp_msgid_t
-osm_madw_get_err_msg(IN const osm_madw_t * const p_madw)
+static inline cl_disp_msgid_t osm_madw_get_err_msg(IN const osm_madw_t * p_madw)
 {
 	return ((cl_disp_msgid_t) p_madw->fail_msg);
 }
@@ -1057,8 +1149,8 @@ osm_madw_get_err_msg(IN const osm_madw_t * const p_madw)
 *
 * SYNOPSIS
 */
-static inline void
-osm_madw_set_mad(IN osm_madw_t * const p_madw, IN const ib_mad_t * const p_mad)
+static inline void osm_madw_set_mad(IN osm_madw_t * p_madw,
+				    IN const ib_mad_t * p_mad)
 {
 	p_madw->p_mad = p_mad;
 }
@@ -1088,9 +1180,8 @@ osm_madw_set_mad(IN osm_madw_t * const p_madw, IN const ib_mad_t * const p_mad)
 *
 * SYNOPSIS
 */
-static inline void
-osm_madw_copy_context(IN osm_madw_t * const p_dest,
-		      IN const osm_madw_t * const p_src)
+static inline void osm_madw_copy_context(IN osm_madw_t * p_dest,
+					 IN const osm_madw_t * p_src)
 {
 	p_dest->context = p_src->context;
 }
diff --git a/include/opensm/osm_mcast_tbl.h b/include/opensm/osm_mcast_tbl.h
index 15b95cf..37e2c26 100644
--- a/include/opensm/osm_mcast_tbl.h
+++ b/include/opensm/osm_mcast_tbl.h
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -74,7 +75,8 @@ typedef struct osm_mcast_fwdbl {
 	int16_t max_block_in_use;
 	uint16_t num_entries;
 	uint16_t max_mlid_ho;
-	uint16_t(*p_mask_tbl)[][IB_MCAST_POSITION_MAX];
+	uint16_t mft_depth;
+	uint16_t(*p_mask_tbl)[][IB_MCAST_POSITION_MAX + 1];
 } osm_mcast_tbl_t;
 /*
 * FIELDS
@@ -95,11 +97,16 @@ typedef struct osm_mcast_fwdbl {
 *		Number of entries in the table (aka number of MLIDs supported).
 *
 *	max_mlid_ho
-*		Maximum MLID value (host order).
+*		Maximum MLID (host order) for the currently allocated multicast
+*		port mask table.
 *
-*	pp_mask_tbl
+*	mft_depth
+*		Number of MLIDs in the currently allocated multicast port mask
+*		table.
+*
+*	p_mask_tbl
 *		Pointer to a two dimensional array of port_masks for this switch.
-*		The first dimension is MLID, the second dimension is mask position.
+*		The first dimension is MLID offset, second dimension is mask position.
 *		This pointer is null for switches that do not support multicast.
 *
 * SEE ALSO
@@ -114,9 +121,8 @@ typedef struct osm_mcast_fwdbl {
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_mcast_tbl_init(IN osm_mcast_tbl_t * const p_tbl,
-		   IN uint8_t const num_ports, IN uint16_t const capacity);
+void osm_mcast_tbl_init(IN osm_mcast_tbl_t * p_tbl, IN uint8_t num_ports,
+			IN uint16_t capacity);
 /*
 * PARAMETERS
 *	num_ports
@@ -127,7 +133,7 @@ osm_mcast_tbl_init(IN osm_mcast_tbl_t * const p_tbl,
 *		by this switch.
 *
 * RETURN VALUE
-*	IB_SUCCESS on success.
+*	None.
 *
 * NOTES
 *
@@ -143,7 +149,7 @@ osm_mcast_tbl_init(IN osm_mcast_tbl_t * const p_tbl,
 *
 * SYNOPSIS
 */
-void osm_mcast_tbl_delete(IN osm_mcast_tbl_t ** const pp_tbl);
+void osm_mcast_tbl_delete(IN osm_mcast_tbl_t ** pp_tbl);
 /*
 * PARAMETERS
 *	pp_tbl
@@ -159,6 +165,33 @@ void osm_mcast_tbl_delete(IN osm_mcast_tbl_t ** const pp_tbl);
 * SEE ALSO
 *********/
 
+/****f* OpenSM: Forwarding Table/osm_mcast_tbl_realloc
+* NAME
+*	osm_mcast_tbl_realloc
+*
+* DESCRIPTION
+*	This function reallocates the multicast port mask table if necessary.
+*
+* SYNOPSIS
+*/
+int osm_mcast_tbl_realloc(IN osm_mcast_tbl_t * p_tbl, IN unsigned mlid_offset);
+/*
+* PARAMETERS
+*
+*	p_tbl
+*		[in] Pointer to the Multicast Forwarding Table object.
+*
+*	mlid_offset
+*		[in] Offset of MLID being accessed.
+*
+* RETURN VALUE
+*	Returns 0 on success and non-zero value otherwise.
+*
+* NOTES
+*
+* SEE ALSO
+*/
+
 /****f* OpenSM: Forwarding Table/osm_mcast_tbl_destroy
 * NAME
 *	osm_mcast_tbl_destroy
@@ -168,7 +201,7 @@ void osm_mcast_tbl_delete(IN osm_mcast_tbl_t ** const pp_tbl);
 *
 * SYNOPSIS
 */
-void osm_mcast_tbl_destroy(IN osm_mcast_tbl_t * const p_tbl);
+void osm_mcast_tbl_destroy(IN osm_mcast_tbl_t * p_tbl);
 /*
 * PARAMETERS
 *	p_tbl
@@ -191,9 +224,8 @@ void osm_mcast_tbl_destroy(IN osm_mcast_tbl_t * const p_tbl);
 *
 * SYNOPSIS
 */
-void
-osm_mcast_tbl_set(IN osm_mcast_tbl_t * const p_tbl,
-		  IN const uint16_t mlid_ho, IN const uint8_t port_num);
+void osm_mcast_tbl_set(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho,
+		       IN uint8_t port_num);
 /*
 * PARAMETERS
 *	p_tbl
@@ -222,9 +254,7 @@ osm_mcast_tbl_set(IN osm_mcast_tbl_t * const p_tbl,
 *
 * SYNOPSIS
 */
-void
-osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * const p_tbl,
-			 IN const uint16_t mlid_ho);
+void osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho);
 /*
 * PARAMETERS
 *	p_tbl
@@ -250,9 +280,8 @@ osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * const p_tbl,
 *
 * SYNOPSIS
 */
-boolean_t
-osm_mcast_tbl_is_port(IN const osm_mcast_tbl_t * const p_tbl,
-		      IN const uint16_t mlid_ho, IN const uint8_t port_num);
+boolean_t osm_mcast_tbl_is_port(IN const osm_mcast_tbl_t * p_tbl,
+				IN uint16_t mlid_ho, IN uint8_t port_num);
 /*
 * PARAMETERS
 *	p_tbl
@@ -281,9 +310,8 @@ osm_mcast_tbl_is_port(IN const osm_mcast_tbl_t * const p_tbl,
 *
 * SYNOPSIS
 */
-boolean_t
-osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * const p_tbl,
-			  IN const uint16_t mlid_ho);
+boolean_t osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * p_tbl,
+				    IN uint16_t mlid_ho);
 /*
 * PARAMETERS
 *	p_tbl
@@ -309,10 +337,10 @@ osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * const p_tbl,
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_mcast_tbl_set_block(IN osm_mcast_tbl_t * const p_tbl,
-			IN const ib_net16_t * const p_block,
-			IN const int16_t block_num, IN const uint8_t position);
+ib_api_status_t osm_mcast_tbl_set_block(IN osm_mcast_tbl_t * p_tbl,
+					IN const ib_net16_t * p_block,
+					IN int16_t block_num,
+					IN uint8_t position);
 /*
 * PARAMETERS
 *	p_tbl
@@ -341,11 +369,9 @@ osm_mcast_tbl_set_block(IN osm_mcast_tbl_t * const p_tbl,
 *
 * SYNOPSIS
 */
-boolean_t
-osm_mcast_tbl_get_block(IN osm_mcast_tbl_t * const p_tbl,
-			IN const int16_t block_num,
-			IN const uint8_t position,
-			OUT ib_net16_t * const p_block);
+boolean_t osm_mcast_tbl_get_block(IN osm_mcast_tbl_t * p_tbl,
+				  IN int16_t block_num, IN uint8_t position,
+				  OUT ib_net16_t * p_block);
 /*
 * PARAMETERS
 *	p_tbl
@@ -380,10 +406,9 @@ osm_mcast_tbl_get_block(IN osm_mcast_tbl_t * const p_tbl,
 *
 * SYNOPSIS
 */
-static inline uint16_t
-osm_mcast_tbl_get_max_block(IN osm_mcast_tbl_t * const p_tbl)
+static inline uint16_t osm_mcast_tbl_get_max_block(IN osm_mcast_tbl_t * p_tbl)
 {
-	return (p_tbl->max_block);
+	return p_tbl->max_block;
 }
 
 /*
@@ -410,7 +435,7 @@ osm_mcast_tbl_get_max_block(IN osm_mcast_tbl_t * const p_tbl)
 * SYNOPSIS
 */
 static inline int16_t
-osm_mcast_tbl_get_max_block_in_use(IN osm_mcast_tbl_t * const p_tbl)
+osm_mcast_tbl_get_max_block_in_use(IN osm_mcast_tbl_t * p_tbl)
 {
 	return (p_tbl->max_block_in_use);
 }
@@ -439,7 +464,7 @@ osm_mcast_tbl_get_max_block_in_use(IN osm_mcast_tbl_t * const p_tbl)
 * SYNOPSIS
 */
 static inline uint8_t
-osm_mcast_tbl_get_max_position(IN osm_mcast_tbl_t * const p_tbl)
+osm_mcast_tbl_get_max_position(IN osm_mcast_tbl_t * p_tbl)
 {
 	return (p_tbl->max_position);
 }
diff --git a/include/opensm/osm_mcm_info.h b/include/opensm/osm_mcm_info.h
deleted file mode 100644
index dec607f..0000000
--- a/include/opensm/osm_mcm_info.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses.  You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- *     Redistribution and use in source and binary forms, with or
- *     without modification, are permitted provided that the following
- *     conditions are met:
- *
- *      - Redistributions of source code must retain the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer.
- *
- *      - Redistributions in binary form must reproduce the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer in the documentation and/or other materials
- *        provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-/*
- * Abstract:
- * 	Declaration of osm_mcm_info_t.
- *	This object represents a Multicast Forwarding Information object.
- *	This object is part of the OpenSM family of objects.
- */
-
-#ifndef _OSM_MCM_INFO_H_
-#define _OSM_MCM_INFO_H_
-
-#include <string.h>
-#include <iba/ib_types.h>
-#include <complib/cl_qlist.h>
-#include <opensm/osm_base.h>
-
-#ifdef __cplusplus
-#  define BEGIN_C_DECLS extern "C" {
-#  define END_C_DECLS   }
-#else				/* !__cplusplus */
-#  define BEGIN_C_DECLS
-#  define END_C_DECLS
-#endif				/* __cplusplus */
-
-BEGIN_C_DECLS
-/****s* OpenSM: Multicast Member Info/osm_mcm_info_t
-* NAME
-*	osm_mcm_info_t
-*
-* DESCRIPTION
-*	Multicast Membership Info object.
-*	This object contains information about a node's membership
-*	in a particular multicast group.
-*
-*	This object should be treated as opaque and should
-*	be manipulated only through the provided functions.
-*
-* SYNOPSIS
-*/
-typedef struct osm_mcm_info {
-	cl_list_item_t list_item;
-	ib_net16_t mlid;
-} osm_mcm_info_t;
-/*
-* FIELDS
-*	list_item
-*		Linkage structure for cl_qlist.  MUST BE FIRST MEMBER!
-*
-*	mlid
-*		MLID of this multicast group.
-*
-* SEE ALSO
-*********/
-
-/****f* OpenSM: Multicast Member Info/osm_mcm_info_new
-* NAME
-*	osm_mcm_info_new
-*
-* DESCRIPTION
-*	Returns an initialized a Multicast Member Info object for use.
-*
-* SYNOPSIS
-*/
-osm_mcm_info_t *osm_mcm_info_new(IN const ib_net16_t mlid);
-/*
-* PARAMETERS
-*	mlid
-*		[in] MLID value for this multicast group.
-*
-* RETURN VALUES
-*	Pointer to an initialized tree node.
-*
-* NOTES
-*
-* SEE ALSO
-*********/
-
-/****f* OpenSM: Multicast Member Info/osm_mcm_info_delete
-* NAME
-*	osm_mcm_info_delete
-*
-* DESCRIPTION
-*	Destroys and deallocates the specified object.
-*
-* SYNOPSIS
-*/
-void osm_mcm_info_delete(IN osm_mcm_info_t * const p_mcm);
-/*
-* PARAMETERS
-*	p_mcm
-*		Pointer to the object to destroy.
-*
-* RETURN VALUES
-*	None.
-*
-* NOTES
-*
-* SEE ALSO
-*********/
-
-END_C_DECLS
-#endif				/* _OSM_MCM_INFO_H_ */
diff --git a/include/opensm/osm_mcm_port.h b/include/opensm/osm_mcm_port.h
index c2b18de..ae0f44f 100644
--- a/include/opensm/osm_mcm_port.h
+++ b/include/opensm/osm_mcm_port.h
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -46,6 +46,7 @@
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
 #include <opensm/osm_base.h>
+#include <opensm/osm_port.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -56,41 +57,41 @@
 #endif				/* __cplusplus */
 
 BEGIN_C_DECLS
+
+struct osm_mgrp;
+
 /****s* OpenSM: MCM Port Object/osm_mcm_port_t
 * NAME
-*   osm_mcm_port_t
+* 	osm_mcm_port_t
 *
 * DESCRIPTION
-*   This object represents a particular	port as a member of a
+* 	This object represents a particular port as a member of a
 *	multicast group.
 *
-*   This object should be treated as opaque and should
-*   be manipulated only through the provided functions.
+*	This object should be treated as opaque and should
+*	be manipulated only through the provided functions.
 *
 * SYNOPSIS
 */
 typedef struct osm_mcm_port {
 	cl_map_item_t map_item;
-	ib_gid_t port_gid;
-	uint8_t scope_state;
-	boolean_t proxy_join;
+	cl_list_item_t list_item;
+	osm_port_t *port;
+	struct osm_mgrp *mgrp;
 } osm_mcm_port_t;
 /*
 * FIELDS
 *	map_item
 *		Map Item for qmap linkage.  Must be first element!!
 *
-*	port_gid
-*		GID of the member port.
+*	list_item
+*		Linkage structure for cl_qlist.
 *
-*	scope_state
-*		???
+*	port
+*		Reference to the parent port
 *
-*	proxy_join
-*		If FALSE - Join was performed by the endport identified
-*		by PortGID. If TRUE - Join was performed on behalf of
-*		the endport identified by PortGID by another port within
-*		the same partition.
+*	mgrp
+*		The pointer to multicast group where this port is member of
 *
 * SEE ALSO
 *	MCM Port Object
@@ -106,19 +107,14 @@ typedef struct osm_mcm_port {
 *
 * SYNOPSIS
 */
-osm_mcm_port_t *osm_mcm_port_new(IN const ib_gid_t * const p_port_gid,
-				 IN const uint8_t scope_state,
-				 IN const boolean_t proxy_join);
+osm_mcm_port_t *osm_mcm_port_new(IN osm_port_t * port, IN struct osm_mgrp *mgrp);
 /*
 * PARAMETERS
-*	p_port_gid
-*		[in] Pointer to the GID of the port to add to the multicast group.
+*	port
+*		[in] Pointer to the port object
 *
-*	scope_state
-*		[in] scope state of the join request
-*
-*  proxy_join
-*     [in] proxy_join state analyzed from the request
+*	mgrp
+*		[in] Pointer to multicast group where this port is joined
 *
 * RETURN VALUES
 *	Pointer to the allocated and initialized MCM Port object.
@@ -139,7 +135,7 @@ osm_mcm_port_t *osm_mcm_port_new(IN const ib_gid_t * const p_port_gid,
 *
 * SYNOPSIS
 */
-void osm_mcm_port_delete(IN osm_mcm_port_t * const p_mcm);
+void osm_mcm_port_delete(IN osm_mcm_port_t * p_mcm);
 /*
 * PARAMETERS
 *	p_mcm
@@ -154,5 +150,110 @@ void osm_mcm_port_delete(IN osm_mcm_port_t * const p_mcm);
 *	MCM Port Object, osm_mcm_port_new
 *********/
 
+/****s* OpenSM: MCM Port Object/osm_mcm_alias_guid_t
+* NAME
+*	osm_mcm_alias_guid_t
+*
+* DESCRIPTION
+*	This object represents an alias guid for a mcm port.
+*
+*	The osm_mcm_alias_guid_t object should be treated as opaque and should
+*	be manipulated only through the provided functions.
+*
+* SYNOPSIS
+*/
+typedef struct osm_mcm_alias_guid {
+	cl_map_item_t map_item;
+	ib_net64_t alias_guid;
+	osm_mcm_port_t *p_base_mcm_port;
+	ib_gid_t port_gid;
+	uint8_t scope_state;
+	boolean_t proxy_join;
+} osm_mcm_alias_guid_t;
+/*
+* FIELDS
+*	map_item
+*		Linkage structure for cl_qmap.  MUST BE FIRST MEMBER!
+*
+*	alias_guid
+*		Alias GUID for port obtained from SM GUIDInfo attribute
+*
+*	p_base_mcm_port
+*		Pointer to osm_mcm_port_t for base port GUID
+*
+*	port_gid
+*		GID of the member port
+*
+*	scope_state
+*
+*	proxy_join
+*		If FALSE - Join was performed by the endport identified
+*		by PortGID. If TRUE - Join was performed on behalf of
+*		the endport identified by PortGID by another port within
+*		the same partition.
+*
+* SEE ALSO
+*	MCM Port, Physical Port, Physical Port Table
+*/
+
+/****f* OpenSM: MCM Port Object/osm_mcm_alias_guid_new
+* NAME
+*	osm_mcm_alias_guid_new
+*
+* DESCRIPTION
+*	This function allocates and initializes an mcm alias guid object.
+*
+* SYNOPSIS
+*/
+osm_mcm_alias_guid_t *osm_mcm_alias_guid_new(IN osm_mcm_port_t *p_base_mcm_port,
+					     IN ib_member_rec_t *mcmr,
+					     IN boolean_t proxy);
+/*
+* PARAMETERS
+*	p_base_mcm_port
+*		[in] Pointer to the mcm port for this base GUID
+*
+*	mcmr
+*		[in] Pointer to MCMember record of the join request
+*
+*	proxy
+*		[in] proxy_join state analyzed from the request
+*
+* RETURN VALUE
+*	Pointer to the initialized mcm alias guid object.
+*
+* NOTES
+*	Allows calling other mcm alias guid methods.
+*
+* SEE ALSO
+*       MCM Port Object
+*********/
+
+/****f* OpenSM: MCM Port Object/osm_mcm_alias_guid_delete
+* NAME
+*	osm_mcm_alias_guid_delete
+*
+* DESCRIPTION
+*	This function destroys and deallocates an mcm alias guid object.
+*
+* SYNOPSIS
+*/
+void osm_mcm_alias_guid_delete(IN OUT osm_mcm_alias_guid_t ** pp_mcm_alias_guid);
+/*
+* PARAMETERS
+*	pp_mcm_alias_guid
+*		[in][out] Pointer to a pointer to an mcm alias guid object to
+*		delete. On return, this pointer is NULL.
+*
+* RETURN VALUE
+*	This function does not return a value.
+*
+* NOTES
+*	Performs any necessary cleanup of the specified mcm alias guid object.
+*
+* SEE ALSO
+*	MCM Port Object
+*********/
+
 END_C_DECLS
 #endif				/* _OSM_MCM_PORT_H_ */
diff --git a/include/complib/cl_nodenamemap.h b/include/opensm/osm_mesh.h
similarity index 54%
copy from include/complib/cl_nodenamemap.h
copy to include/opensm/osm_mesh.h
index 9b2ada4..b9e85bb 100644
--- a/include/complib/cl_nodenamemap.h
+++ b/include/opensm/osm_mesh.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2007 Lawrence Livermore National Lab
+ * Copyright (c) 2008,2009 System Fabric Works, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -32,34 +32,46 @@
  *
  */
 
-#ifndef _CL_NODE_NAME_MAP_H_
-#define _CL_NODE_NAME_MAP_H_
-
-#include <stdio.h>
-#include <stdint.h>
-#include <complib/cl_qmap.h>
+/*
+ * Abstract:
+ *      Declarations for mesh analysis
+ */
 
-/* NOTE: this may modify the parameter "nodedesc". */
-char *clean_nodedesc(char *nodedesc);
+#ifndef OSM_MESH_H
+#define OSM_MESH_H
 
-typedef struct _name_map_item {
-	cl_map_item_t item;
-	uint64_t guid;
-	char *name;
-} name_map_item_t;
+struct _lash;
+struct _switch;
 
-typedef cl_qmap_t nn_map_t;
+/*
+ * per switch to switch link info
+ */
+typedef struct _link {
+	int switch_id;
+	int link_id;
+	int next_port;
+	int num_ports;
+	int ports[0];
+} link_t;
 
-/**
- * Node name map interface.
- * It is OK to pass NULL for the node_name_map[_fp] parameters.
+/*
+ * per switch node mesh info
  */
-nn_map_t *open_node_name_map(char *node_name_map);
-void  close_node_name_map(nn_map_t *map);
-char *remap_node_name(nn_map_t *map, uint64_t target_guid,
-			char *nodedesc);
-	/* NOTE: parameter "nodedesc" may be modified here. */
-int parse_node_map(const char *file_name,
-		   int (*create)(void *, uint64_t, char *), void *cxt);
+typedef struct _mesh_node {
+	int *axes;			/* used to hold and reorder assigned axes */
+	int *coord;			/* mesh coordinates of switch */
+	int **matrix;			/* distances between adjacant switches */
+	int *poly;			/* characteristic polynomial of matrix */
+					/* used as an invariant classification */
+	int dimension;			/* apparent dimension of mesh around node */
+	int temp;			/* temporary holder for distance info */
+	int type;			/* index of node type in mesh_info array */
+	unsigned int num_links;		/* number of 'links' to adjacent switches */
+	link_t *links[0];		/* per link information */
+} mesh_node_t;
+
+void osm_mesh_node_delete(struct _lash *p_lash, struct _switch *sw);
+int osm_mesh_node_create(struct _lash *p_lash, struct _switch *sw);
+int osm_do_mesh_analysis(struct _lash *p_lash);
 
-#endif				/* _CL_NODE_NAME_MAP_H_ */
+#endif
diff --git a/include/opensm/osm_msgdef.h b/include/opensm/osm_msgdef.h
index dbf3e53..b0d92e0 100644
--- a/include/opensm/osm_msgdef.h
+++ b/include/opensm/osm_msgdef.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -130,6 +130,7 @@ enum {
 	OSM_MSG_MAD_NODE_INFO,
 	OSM_MSG_MAD_PORT_INFO,
 	OSM_MSG_MAD_SWITCH_INFO,
+	OSM_MSG_MAD_GUID_INFO,
 	OSM_MSG_MAD_NODE_DESC,
 	OSM_MSG_MAD_NODE_RECORD,
 	OSM_MSG_MAD_PORTINFO_RECORD,
@@ -160,6 +161,8 @@ enum {
 	OSM_MSG_MAD_MULTIPATH_RECORD,
 #endif
 	OSM_MSG_MAD_PORT_COUNTERS,
+	OSM_MSG_MAD_MLNX_EXT_PORT_INFO,
+	OSM_MSG_MAD_CC,
 	OSM_MSG_MAX
 };
 
diff --git a/include/opensm/osm_mtree.h b/include/opensm/osm_mtree.h
index ef696da..32f5179 100644
--- a/include/opensm/osm_mtree.h
+++ b/include/opensm/osm_mtree.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -98,7 +98,7 @@ BEGIN_C_DECLS
 */
 typedef struct osm_mtree_node {
 	cl_map_item_t map_item;
-	osm_switch_t *p_sw;
+	const osm_switch_t *p_sw;
 	uint8_t max_children;
 	struct osm_mtree_node *p_up;
 	struct osm_mtree_node *child_array[1];
@@ -137,7 +137,7 @@ typedef struct osm_mtree_node {
 *
 * SYNOPSIS
 */
-osm_mtree_node_t *osm_mtree_node_new(IN const osm_switch_t * const p_sw);
+osm_mtree_node_t *osm_mtree_node_new(IN const osm_switch_t * p_sw);
 /*
 * PARAMETERS
 *	p_sw
@@ -187,7 +187,7 @@ void osm_mtree_destroy(IN osm_mtree_node_t * p_mtn);
 * SYNOPSIS
 */
 static inline uint8_t
-osm_mtree_node_get_max_children(IN const osm_mtree_node_t * const p_mtn)
+osm_mtree_node_get_max_children(IN const osm_mtree_node_t * p_mtn)
 {
 	return (p_mtn->max_children);
 }
@@ -215,8 +215,8 @@ osm_mtree_node_get_max_children(IN const osm_mtree_node_t * const p_mtn)
 */
 static inline osm_mtree_node_t *osm_mtree_node_get_child(IN const
 							 osm_mtree_node_t *
-							 const p_mtn,
-							 IN const uint8_t child)
+							 p_mtn,
+							 IN uint8_t child)
 {
 	CL_ASSERT(child < p_mtn->max_children);
 	return (p_mtn->child_array[child]);
@@ -247,11 +247,11 @@ static inline osm_mtree_node_t *osm_mtree_node_get_child(IN const
 *
 * SYNOPSIS
 */
-static inline osm_switch_t *osm_mtree_node_get_switch_ptr(IN const
+static inline const osm_switch_t *osm_mtree_node_get_switch_ptr(IN const
 							  osm_mtree_node_t *
-							  const p_mtn)
+							  p_mtn)
 {
-	return (p_mtn->p_sw);
+	return p_mtn->p_sw;
 }
 /*
 * PARAMETERS
diff --git a/include/opensm/osm_multicast.h b/include/opensm/osm_multicast.h
index bd219d1..11d789b 100644
--- a/include/opensm/osm_multicast.h
+++ b/include/opensm/osm_multicast.h
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -45,6 +45,7 @@
 
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
+#include <complib/cl_fleximap.h>
 #include <complib/cl_qlist.h>
 #include <complib/cl_spinlock.h>
 #include <opensm/osm_base.h>
@@ -52,6 +53,7 @@
 #include <opensm/osm_mcm_port.h>
 #include <opensm/osm_subnet.h>
 #include <opensm/osm_log.h>
+#include <opensm/osm_sm.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -81,41 +83,6 @@ BEGIN_C_DECLS
 *	Steve King, Intel
 *
 *********/
-/****s* OpenSM: Multicast Group/osm_mcast_mgr_ctxt_t
-* NAME
-*	osm_mcast_mgr_ctxt_t
-*
-* DESCRIPTION
-*	Struct for passing context arguments to the multicast manager.
-*
-*	The osm_mcast_mgr_ctxt_t object should be treated as opaque and should
-*	be manipulated only through the provided functions.
-*
-* SYNOPSIS
-*/
-typedef struct osm_mcast_mgr_ctxt {
-	cl_list_item_t list_item;
-	ib_net16_t mlid;
-	osm_mcast_req_type_t req_type;
-	ib_net64_t port_guid;
-} osm_mcast_mgr_ctxt_t;
-/*
-* FIELDS
-*
-*	mlid
-*		The network ordered LID of this Multicast Group
-*		(must be >= 0xC000).
-*
-*	req_type
-*		The type of the request that caused this call
-*		(multicast create/join/leave).
-*
-*	port_guid
-*		The port guid of the port that is being added/removed from
-*		the multicast group due to this call.
-*
-* SEE ALSO
-*********/
 
 /****s* OpenSM: Multicast Group/osm_mgrp_t
 * NAME
@@ -130,35 +97,36 @@ typedef struct osm_mcast_mgr_ctxt {
 * SYNOPSIS
 */
 typedef struct osm_mgrp {
-	cl_map_item_t map_item;
+	cl_fmap_item_t map_item;
+	cl_list_item_t list_item;
 	ib_net16_t mlid;
-	osm_mtree_node_t *p_root;
 	cl_qmap_t mcm_port_tbl;
+	cl_qmap_t mcm_alias_port_tbl;
 	ib_member_rec_t mcmember_rec;
 	boolean_t well_known;
-	boolean_t to_be_deleted;
-	uint32_t last_change_id;
-	uint32_t last_tree_id;
 	unsigned full_members;
 } osm_mgrp_t;
 /*
 * FIELDS
 *	map_item
-*		Map Item for qmap linkage.  Must be first element!!
+*		Map Item for fmap linkage.  Must be first element!!
+*
+*	list_item
+*		List item for linkage in osm_mgrp_box's mgrp_list qlist.
 *
 *	mlid
 *		The network ordered LID of this Multicast Group (must be
 *		>= 0xC000).
 *
-*	p_root
-*		Pointer to the root "tree node" in the single spanning tree
-*		for this multicast group.  The nodes of the tree represent
-*		switches.  Member ports are not represented in the tree.
-*
 *	mcm_port_tbl
 *		Table (sorted by port GUID) of osm_mcm_port_t objects
 *		representing the member ports of this multicast group.
 *
+*	mcm_alias_port_tbl
+*		Table (sorted by port alias GUID) of osm_mcm_port_t
+*		objects representing the member ports of this multicast
+*		group.
+*
 *	mcmember_rec
 *		Holds the parameters of the Multicast Group.
 *
@@ -167,50 +135,36 @@ typedef struct osm_mgrp {
 *		is created during the initialization of SM/SA and will be
 *		present even if there are no ports for this group
 *
-*	to_be_deleted
-*		Since groups are deleted only after re-route we need to
-*		track the fact the group is about to be deleted so we can
-*		track the fact a new join is actually a create request.
-*
-*	last_change_id
-*		a counter for the number of changes applied to the group.
-*		This counter shuold be incremented on any modification
-*		to the group: joining or leaving of ports.
-*
-*	last_tree_id
-*		the last change id used for building the current tree.
-*
 * SEE ALSO
 *********/
 
-/****f* OpenSM: Vendor API/osm_mgrp_func_t
+/****s* OpenSM: Multicast Group/osm_mgrp_box_t
 * NAME
-*	osm_mgrp_func_t
+*	osm_mgrp_box_t
 *
 * DESCRIPTION
-*	Callback for the osm_mgrp_apply_func function.
-*	The callback function must not modify the tree linkage.
+*	Multicast structure which holds all multicast groups with same MLID.
 *
 * SYNOPSIS
 */
-typedef void (*osm_mgrp_func_t) (IN const osm_mgrp_t * const p_mgrp,
-				 IN const osm_mtree_node_t * const p_mtn,
-				 IN void *context);
+typedef struct osm_mgrp_box {
+	uint16_t mlid;
+	cl_qlist_t mgrp_list;
+	osm_mtree_node_t *root;
+} osm_mgrp_box_t;
 /*
-* PARAMETERS
-*	p_mgrp
-*		[in] Pointer to the multicast group object.
-*
-*	p_mtn
-*		[in] Pointer to the multicast tree node.
-*
-*	context
-*		[in] User context.
+* FIELDS
+*	mlid
+*		The host ordered LID of this Multicast Group (must be
+*		>= 0xC000).
 *
-* RETURN VALUES
-*	None.
+*	p_root
+*		Pointer to the root "tree node" in the single spanning tree
+*		for this multicast group.  The nodes of the tree represent
+*		switches.  Member ports are not represented in the tree.
 *
-* NOTES
+*	mgrp_list
+*		List of multicast groups (mpgr object) having same MLID value.
 *
 * SEE ALSO
 *********/
@@ -224,12 +178,19 @@ typedef void (*osm_mgrp_func_t) (IN const osm_mgrp_t * const p_mgrp,
 *
 * SYNOPSIS
 */
-osm_mgrp_t *osm_mgrp_new(IN const ib_net16_t mlid);
+osm_mgrp_t *osm_mgrp_new(IN osm_subn_t * subn, IN ib_net16_t mlid,
+			 IN ib_member_rec_t * mcmr);
 /*
 * PARAMETERS
+*	subn
+*		[in] Pointer to osm_subn_t object.
+*
 *	mlid
 *		[in] Multicast LID for this multicast group.
 *
+*	mcmr
+*		[in] MCMember Record for this multicast group.
+*
 * RETURN VALUES
 *	IB_SUCCESS if initialization was successful.
 *
@@ -240,28 +201,36 @@ osm_mgrp_t *osm_mgrp_new(IN const ib_net16_t mlid);
 *	Multicast Group, osm_mgrp_delete
 *********/
 
-/****f* OpenSM: Multicast Group/osm_mgrp_delete
+/*
+ * Need a forward declaration to work around include loop:
+ * osm_sm.h <- osm_multicast.h
+ */
+struct osm_sm;
+
+/****f* OpenSM: Multicast Tree/osm_purge_mtree
 * NAME
-*	osm_mgrp_delete
+*	osm_purge_mtree
 *
 * DESCRIPTION
-*	Destroys and deallocates a Multicast Group.
+*	Frees all the nodes in a multicast spanning tree
 *
 * SYNOPSIS
 */
-void osm_mgrp_delete(IN osm_mgrp_t * const p_mgrp);
+void osm_purge_mtree(IN struct osm_sm * sm, IN osm_mgrp_box_t * mgb);
 /*
 * PARAMETERS
-*	p_mgrp
-*		[in] Pointer to an osm_mgrp_t object.
+*	sm
+*		[in] Pointer to osm_sm_t object.
+*	mgb
+*		[in] Pointer to an osm_mgrp_box_t object.
 *
 * RETURN VALUES
 *	None.
 *
+*
 * NOTES
 *
 * SEE ALSO
-*	Multicast Group, osm_mgrp_new
 *********/
 
 /****f* OpenSM: Multicast Group/osm_mgrp_is_guid
@@ -273,9 +242,8 @@ void osm_mgrp_delete(IN osm_mgrp_t * const p_mgrp);
 *
 * SYNOPSIS
 */
-static inline boolean_t
-osm_mgrp_is_guid(IN const osm_mgrp_t * const p_mgrp,
-		 IN const ib_net64_t port_guid)
+static inline boolean_t osm_mgrp_is_guid(IN const osm_mgrp_t * p_mgrp,
+					 IN ib_net64_t port_guid)
 {
 	return (cl_qmap_get(&p_mgrp->mcm_port_tbl, port_guid) !=
 		cl_qmap_end(&p_mgrp->mcm_port_tbl));
@@ -308,7 +276,7 @@ osm_mgrp_is_guid(IN const osm_mgrp_t * const p_mgrp,
 *
 * SYNOPSIS
 */
-static inline boolean_t osm_mgrp_is_empty(IN const osm_mgrp_t * const p_mgrp)
+static inline boolean_t osm_mgrp_is_empty(IN const osm_mgrp_t * p_mgrp)
 {
 	return (cl_qmap_count(&p_mgrp->mcm_port_tbl) == 0);
 }
@@ -337,9 +305,9 @@ static inline boolean_t osm_mgrp_is_empty(IN const osm_mgrp_t * const p_mgrp)
 *
 * SYNOPSIS
 */
-static inline ib_net16_t osm_mgrp_get_mlid(IN const osm_mgrp_t * const p_mgrp)
+static inline ib_net16_t osm_mgrp_get_mlid(IN const osm_mgrp_t * p_mgrp)
 {
-	return (p_mgrp->mlid);
+	return p_mgrp->mlid;
 }
 
 /*
@@ -366,20 +334,21 @@ static inline ib_net16_t osm_mgrp_get_mlid(IN const osm_mgrp_t * const p_mgrp)
 * SYNOPSIS
 */
 osm_mcm_port_t *osm_mgrp_add_port(osm_subn_t *subn, osm_log_t *log,
-				  IN osm_mgrp_t * const p_mgrp,
-				  IN const ib_gid_t * const p_port_gid,
-				  IN const uint8_t join_state,
-				  IN boolean_t proxy_join);
+				  IN osm_mgrp_t * mgrp, IN osm_port_t *port,
+				  IN ib_member_rec_t *mcmr, IN boolean_t proxy);
 /*
 * PARAMETERS
-*	p_mgrp
+*	mgrp
 *		[in] Pointer to an osm_mgrp_t object to initialize.
 *
-*	p_port_gid
-*		[in] Pointer to the GID of the port to add to the multicast group.
+*	port
+*		[in] Pointer to an osm_port_t object
+*
+*	mcmr
+*		[in] Pointer to MCMember record received for the join
 *
-*	join_state
-*		[in] The join state for this port in the group.
+*	proxy
+*		[in] The proxy join state for this port in the group.
 *
 * RETURN VALUES
 *	IB_SUCCESS
@@ -390,105 +359,85 @@ osm_mcm_port_t *osm_mgrp_add_port(osm_subn_t *subn, osm_log_t *log,
 * SEE ALSO
 *********/
 
-/****f* OpenSM: Multicast Group/osm_mgrp_is_port_present
+/****f* OpenSM: Multicast Group/osm_mgrp_get_mcm_port
 * NAME
-*	osm_mgrp_is_port_present
+*	osm_mgrp_get_mcm_port
 *
 * DESCRIPTION
-*	checks a port from the multicast group.
+*	Finds a port in the multicast group.
 *
 * SYNOPSIS
 */
-
-boolean_t
-osm_mgrp_is_port_present(IN const osm_mgrp_t * const p_mgrp,
-			 IN const ib_net64_t port_guid,
-			 OUT osm_mcm_port_t ** const pp_mcm_port);
+osm_mcm_port_t *osm_mgrp_get_mcm_port(IN const osm_mgrp_t * p_mgrp,
+				      IN ib_net64_t port_guid);
 /*
 * PARAMETERS
 *	p_mgrp
 *		[in] Pointer to an osm_mgrp_t object.
 *
 *	port_guid
-*		[in] Port guid of the departing port.
-*
-*  pp_mcm_port
-*     [out] Pointer to a pointer to osm_mcm_port_t
-*           Updated to the member on success or NULLed
+*		[in] Port guid.
 *
 * RETURN VALUES
-*	TRUE if port present
-*	FALSE if port is not present.
+*	Pointer to the mcm port object when present or NULL otherwise.
 *
 * NOTES
 *
 * SEE ALSO
 *********/
 
-/****f* OpenSM: Multicast Group/osm_mgrp_remove_port
+/****f* OpenSM: Multicast Group/osm_mgrp_get_mcm_alias_guid
 * NAME
-*	osm_mgrp_remove_port
+*	osm_mgrp_get_mcm_alias_guid
 *
 * DESCRIPTION
-*	Removes a port from the multicast group.
+*	Finds an mcm alias GUID in the multicast group based on an alias GUID.
 *
 * SYNOPSIS
 */
-void
-osm_mgrp_delete_port(IN osm_subn_t * const p_subn,
-		     IN osm_log_t * const p_log,
-		     IN osm_mgrp_t * const p_mgrp,
-		     IN const ib_net64_t port_guid);
+osm_mcm_alias_guid_t *osm_mgrp_get_mcm_alias_guid(IN const osm_mgrp_t * p_mgrp,
+						  IN ib_net64_t port_guid);
 /*
 * PARAMETERS
-*
-*  p_subn
-*     [in] Pointer to the subnet object
-*
-*  p_log
-*     [in] The log object pointer
-*
 *	p_mgrp
 *		[in] Pointer to an osm_mgrp_t object.
 *
 *	port_guid
-*		[in] Port guid of the departing port.
+*		[in] Alias port guid.
 *
 * RETURN VALUES
-*	None.
+*	Pointer to the mcm alias GUID object when present or NULL otherwise.
 *
 * NOTES
 *
 * SEE ALSO
 *********/
 
-int osm_mgrp_remove_port(osm_subn_t *subn, osm_log_t *log, osm_mgrp_t *mgrp,
-			 osm_mcm_port_t *mcm, uint8_t join_state);
-
-/****f* OpenSM: Multicast Group/osm_mgrp_apply_func
+/****f* OpenSM: Multicast Group/osm_mgrp_delete_port
 * NAME
-*	osm_mgrp_apply_func
+*	osm_mgrp_delete_port
 *
 * DESCRIPTION
-*	Calls the specified function for each element in the tree.
-*	Elements are passed to the callback function in no particular order.
+*	Removes a port from the multicast group.
 *
 * SYNOPSIS
 */
-void
-osm_mgrp_apply_func(const osm_mgrp_t * const p_mgrp,
-		    osm_mgrp_func_t p_func, void *context);
+void osm_mgrp_delete_port(IN osm_subn_t * subn, IN osm_log_t * log,
+			  IN osm_mgrp_t * mgrp, IN osm_port_t * port);
 /*
 * PARAMETERS
-*	p_mgrp
-*		[in] Pointer to an osm_mgrp_t object.
 *
-*	p_func
-*		[in] Pointer to the users callback function.
+*	subn
+*		[in] Pointer to the subnet object
 *
-*	context
-*		[in] User context passed to the callback function.
+*	log
+*		[in] The log object pointer
 *
+*	mgrp
+*		[in] Pointer to an osm_mgrp_t object.
+*
+*	port
+*		[in] Pointer to an osm_port_t object for the the departing port.
 *
 * RETURN VALUES
 *	None.
@@ -496,8 +445,13 @@ osm_mgrp_apply_func(const osm_mgrp_t * const p_mgrp,
 * NOTES
 *
 * SEE ALSO
-*	Multicast Group
 *********/
 
+void osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
+			  osm_mcm_alias_guid_t * mcm_alias_guid,
+			  ib_member_rec_t * mcmr);
+void osm_mgrp_cleanup(osm_subn_t * subn, osm_mgrp_t * mpgr);
+void osm_mgrp_box_delete(osm_mgrp_box_t *mbox);
+
 END_C_DECLS
 #endif				/* _OSM_MULTICAST_H_ */
diff --git a/include/opensm/osm_node.h b/include/opensm/osm_node.h
index 50b3598..482ed89 100644
--- a/include/opensm/osm_node.h
+++ b/include/opensm/osm_node.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -153,7 +153,7 @@ typedef struct osm_node {
 *
 * SYNOPSIS
 */
-void osm_node_delete(IN OUT osm_node_t ** const p_node);
+void osm_node_delete(IN OUT osm_node_t ** p_node);
 /*
 * PARAMETERS
 *	p_node
@@ -180,7 +180,7 @@ void osm_node_delete(IN OUT osm_node_t ** const p_node);
 *
 * SYNOPSIS
 */
-osm_node_t *osm_node_new(IN const osm_madw_t * const p_madw);
+osm_node_t *osm_node_new(IN const osm_madw_t * p_madw);
 /*
 * PARAMETERS
 *	p_madw
@@ -208,8 +208,8 @@ osm_node_t *osm_node_new(IN const osm_madw_t * const p_madw);
 *
 * SYNOPSIS
 */
-static inline osm_physp_t *osm_node_get_physp_ptr(IN osm_node_t * const p_node,
-						  IN const uint32_t port_num)
+static inline osm_physp_t *osm_node_get_physp_ptr(IN osm_node_t * p_node,
+						  IN uint32_t port_num)
 {
 
 	CL_ASSERT(port_num < p_node->physp_tbl_size);
@@ -245,9 +245,9 @@ static inline osm_physp_t *osm_node_get_physp_ptr(IN osm_node_t * const p_node,
 *
 * SYNOPSIS
 */
-static inline uint8_t osm_node_get_type(IN const osm_node_t * const p_node)
+static inline uint8_t osm_node_get_type(IN const osm_node_t * p_node)
 {
-	return (p_node->node_info.node_type);
+	return p_node->node_info.node_type;
 }
 
 /*
@@ -269,13 +269,16 @@ static inline uint8_t osm_node_get_type(IN const osm_node_t * const p_node)
 *	osm_node_get_num_physp
 *
 * DESCRIPTION
-*	Returns the type of this node.
+*	Returns the number of osm_physp ports allocated for this node.
+*	For switches, it is the number of external physical ports plus
+*	port 0. For CAs and routers, it is the number of external physical
+*	ports plus 1.
 *
 * SYNOPSIS
 */
-static inline uint8_t osm_node_get_num_physp(IN const osm_node_t * const p_node)
+static inline uint8_t osm_node_get_num_physp(IN const osm_node_t * p_node)
 {
-	return ((uint8_t) p_node->physp_tbl_size);
+	return (uint8_t) p_node->physp_tbl_size;
 }
 
 /*
@@ -303,8 +306,8 @@ static inline uint8_t osm_node_get_num_physp(IN const osm_node_t * const p_node)
 *
 * SYNOPSIS
 */
-osm_node_t *osm_node_get_remote_node(IN osm_node_t * const p_node,
-				     IN const uint8_t port_num,
+osm_node_t *osm_node_get_remote_node(IN osm_node_t * p_node,
+				     IN uint8_t port_num,
 				     OUT uint8_t * p_remote_port_num);
 /*
 * PARAMETERS
@@ -339,12 +342,11 @@ osm_node_t *osm_node_get_remote_node(IN osm_node_t * const p_node,
 *
 * SYNOPSIS
 */
-static inline ib_net16_t
-osm_node_get_base_lid(IN const osm_node_t * const p_node,
-		      IN const uint32_t port_num)
+static inline ib_net16_t osm_node_get_base_lid(IN const osm_node_t * p_node,
+					       IN uint32_t port_num)
 {
 	CL_ASSERT(port_num < p_node->physp_tbl_size);
-	return (osm_physp_get_base_lid(&p_node->physp_table[port_num]));
+	return osm_physp_get_base_lid(&p_node->physp_table[port_num]);
 }
 
 /*
@@ -376,9 +378,8 @@ osm_node_get_base_lid(IN const osm_node_t * const p_node,
 *
 * SYNOPSIS
 */
-ib_net16_t
-osm_node_get_remote_base_lid(IN osm_node_t * const p_node,
-			     IN const uint32_t port_num);
+ib_net16_t osm_node_get_remote_base_lid(IN osm_node_t * p_node,
+					IN uint32_t port_num);
 /*
 * PARAMETERS
 *	p_node
@@ -407,11 +408,11 @@ osm_node_get_remote_base_lid(IN osm_node_t * const p_node,
 *
 * SYNOPSIS
 */
-static inline uint8_t
-osm_node_get_lmc(IN const osm_node_t * const p_node, IN const uint32_t port_num)
+static inline uint8_t osm_node_get_lmc(IN const osm_node_t * p_node,
+				       IN uint32_t port_num)
 {
 	CL_ASSERT(port_num < p_node->physp_tbl_size);
-	return (osm_physp_get_lmc(&p_node->physp_table[port_num]));
+	return osm_physp_get_lmc(&p_node->physp_table[port_num]);
 }
 
 /*
@@ -440,9 +441,8 @@ osm_node_get_lmc(IN const osm_node_t * const p_node, IN const uint32_t port_num)
 *
 * SYNOPSIS
 */
-void
-osm_node_init_physp(IN osm_node_t * const p_node,
-		    IN const osm_madw_t * const p_madw);
+void osm_node_init_physp(IN osm_node_t * p_node, uint8_t port_num,
+			 IN const osm_madw_t * p_madw);
 /*
 * PARAMETERS
 *	p_node
@@ -472,10 +472,9 @@ osm_node_init_physp(IN osm_node_t * const p_node,
 *
 * SYNOPSIS
 */
-static inline ib_net64_t
-osm_node_get_node_guid(IN const osm_node_t * const p_node)
+static inline ib_net64_t osm_node_get_node_guid(IN const osm_node_t * p_node)
 {
-	return (p_node->node_info.node_guid);
+	return p_node->node_info.node_guid;
 }
 
 /*
@@ -501,11 +500,8 @@ osm_node_get_node_guid(IN const osm_node_t * const p_node)
 *
 * SYNOPSIS
 */
-void
-osm_node_link(IN osm_node_t * const p_node,
-	      IN const uint8_t port_num,
-	      IN osm_node_t * const p_remote_node,
-	      IN const uint8_t remote_port_num);
+void osm_node_link(IN osm_node_t * p_node, IN uint8_t port_num,
+		   IN osm_node_t * p_remote_node, IN uint8_t remote_port_num);
 /*
 * PARAMETERS
 *	p_node
@@ -540,11 +536,8 @@ osm_node_link(IN osm_node_t * const p_node,
 *
 * SYNOPSIS
 */
-void
-osm_node_unlink(IN osm_node_t * const p_node,
-		IN const uint8_t port_num,
-		IN osm_node_t * const p_remote_node,
-		IN const uint8_t remote_port_num);
+void osm_node_unlink(IN osm_node_t * p_node, IN uint8_t port_num,
+		     IN osm_node_t * p_remote_node, IN uint8_t remote_port_num);
 /*
 * PARAMETERS
 *	p_node
@@ -579,11 +572,9 @@ osm_node_unlink(IN osm_node_t * const p_node,
 *
 * SYNOPSIS
 */
-boolean_t
-osm_node_link_exists(IN osm_node_t * const p_node,
-		     IN const uint8_t port_num,
-		     IN osm_node_t * const p_remote_node,
-		     IN const uint8_t remote_port_num);
+boolean_t osm_node_link_exists(IN osm_node_t * p_node, IN uint8_t port_num,
+			       IN osm_node_t * p_remote_node,
+			       IN uint8_t remote_port_num);
 /*
 * PARAMETERS
 *	p_node
@@ -621,8 +612,7 @@ osm_node_link_exists(IN osm_node_t * const p_node,
 *
 * SYNOPSIS
 */
-boolean_t
-osm_node_has_any_link(IN osm_node_t * const p_node, IN const uint8_t port_num);
+boolean_t osm_node_has_any_link(IN osm_node_t * p_node, IN uint8_t port_num);
 /*
 * PARAMETERS
 *	p_node
@@ -652,11 +642,10 @@ osm_node_has_any_link(IN osm_node_t * const p_node, IN const uint8_t port_num);
 *
 * SYNOPSIS
 */
-boolean_t
-osm_node_link_has_valid_ports(IN osm_node_t * const p_node,
-			      IN const uint8_t port_num,
-			      IN osm_node_t * const p_remote_node,
-			      IN const uint8_t remote_port_num);
+boolean_t osm_node_link_has_valid_ports(IN osm_node_t * p_node,
+					IN uint8_t port_num,
+					IN osm_node_t * p_remote_node,
+					IN uint8_t remote_port_num);
 /*
 * PARAMETERS
 *	p_node
diff --git a/include/opensm/osm_opensm.h b/include/opensm/osm_opensm.h
index c121be4..dbff4f6 100644
--- a/include/opensm/osm_opensm.h
+++ b/include/opensm/osm_opensm.h
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009-2011 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -60,6 +61,7 @@
 #include <opensm/osm_subnet.h>
 #include <opensm/osm_mad_pool.h>
 #include <opensm/osm_vl15intf.h>
+#include <opensm/osm_congestion_control.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -101,10 +103,14 @@ typedef enum _osm_routing_engine_type {
 	OSM_ROUTING_ENGINE_TYPE_NONE = 0,
 	OSM_ROUTING_ENGINE_TYPE_MINHOP,
 	OSM_ROUTING_ENGINE_TYPE_UPDN,
+	OSM_ROUTING_ENGINE_TYPE_DNUP,
 	OSM_ROUTING_ENGINE_TYPE_FILE,
 	OSM_ROUTING_ENGINE_TYPE_FTREE,
 	OSM_ROUTING_ENGINE_TYPE_LASH,
 	OSM_ROUTING_ENGINE_TYPE_DOR,
+	OSM_ROUTING_ENGINE_TYPE_TORUS_2QOS,
+	OSM_ROUTING_ENGINE_TYPE_SSSP,
+	OSM_ROUTING_ENGINE_TYPE_DFSSSP,
 	OSM_ROUTING_ENGINE_TYPE_UNKNOWN
 } osm_routing_engine_type_t;
 /***********/
@@ -120,12 +126,20 @@ typedef enum _osm_routing_engine_type {
 *	added later.
 */
 struct osm_routing_engine {
+	osm_routing_engine_type_t type;
 	const char *name;
 	void *context;
 	int (*build_lid_matrices) (void *context);
 	int (*ucast_build_fwd_tables) (void *context);
 	void (*ucast_dump_tables) (void *context);
-	void (*delete) (void *context);
+	void (*update_sl2vl)(void *context, IN osm_physp_t *port,
+			     IN uint8_t in_port_num, IN uint8_t out_port_num,
+			     IN OUT ib_slvl_table_t *t);
+	uint8_t (*path_sl)(void *context, IN uint8_t path_sl_hint,
+			   IN const ib_net16_t slid, IN const ib_net16_t dlid);
+	ib_api_status_t (*mcast_build_stree)(void *context,
+					     IN OUT osm_mgrp_box_t *mgb);
+	void (*destroy) (void *context);
 	struct osm_routing_engine *next;
 };
 /*
@@ -146,8 +160,24 @@ struct osm_routing_engine {
 *	ucast_dump_tables
 *		The callback for dumping unicast routing tables.
 *
-*	delete
-*		The delete method, may be used for routing engine
+*	update_sl2vl(void *context, IN osm_physp_t *port,
+*		     IN uint8_t in_port_num, IN uint8_t out_port_num,
+*		     OUT ib_slvl_table_t *t)
+*		The callback to allow routing engine input for SL2VL maps.
+*		*port is the phyical port for which the SL2VL map is to be
+*		updated. For switches, in_port_num/out_port_num identify
+*		which part of the SL2VL map to update.  For router/HCA ports,
+*		in_port_num/out_port_num should be ignored.
+*
+*	path_sl
+*		The callback for computing path SL.
+*
+*	mcast_build_stree
+*		The callback for building the spanning tree for multicast
+*		forwarding, called per MLID.
+*
+*	destroy
+*		The destroy method, may be used for routing engine
 *		internals cleanup.
 *
 *	next
@@ -174,6 +204,7 @@ typedef struct osm_opensm {
 #ifdef ENABLE_OSM_PERF_MGR
 	osm_perfmgr_t perfmgr;
 #endif				/* ENABLE_OSM_PERF_MGR */
+	osm_congestion_control_t cc;
 	cl_qlist_t plugin_list;
 	osm_db_t db;
 	osm_mad_pool_t mad_pool;
@@ -183,7 +214,9 @@ typedef struct osm_opensm {
 	cl_dispatcher_t disp;
 	cl_plock_t lock;
 	struct osm_routing_engine *routing_engine_list;
-	osm_routing_engine_type_t routing_engine_used;
+	struct osm_routing_engine *routing_engine_used;
+	struct osm_routing_engine *default_routing_engine;
+	boolean_t no_fallback_routing_engine;
 	osm_stats_t stats;
 	osm_console_t console;
 	nn_map_t *node_name_map;
@@ -231,6 +264,9 @@ typedef struct osm_opensm {
 *	routing_engine_used
 *		Indicates which routing engine was used to route a subnet.
 *
+*	no_fallback_routing_engine
+*		Indicates if default routing engine should not be used.
+*
 *	stats
 *		Open SM statistics block
 *
@@ -246,7 +282,7 @@ typedef struct osm_opensm {
 *
 * SYNOPSIS
 */
-void osm_opensm_construct(IN osm_opensm_t * const p_osm);
+void osm_opensm_construct(IN osm_opensm_t * p_osm);
 /*
 * PARAMETERS
 *	p_osm
@@ -275,7 +311,7 @@ void osm_opensm_construct(IN osm_opensm_t * const p_osm);
 *
 * SYNOPSIS
 */
-void osm_opensm_destroy(IN osm_opensm_t * const p_osm);
+void osm_opensm_destroy(IN osm_opensm_t * p_osm);
 /*
 * PARAMETERS
 *	p_osm
@@ -303,9 +339,8 @@ void osm_opensm_destroy(IN osm_opensm_t * const p_osm);
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_opensm_init(IN osm_opensm_t * const p_osm,
-		IN const osm_subn_opt_t * const p_opt);
+ib_api_status_t osm_opensm_init(IN osm_opensm_t * p_osm,
+				IN const osm_subn_opt_t * p_opt);
 /*
 * PARAMETERS
 *	p_osm
@@ -333,7 +368,7 @@ osm_opensm_init(IN osm_opensm_t * const p_osm,
 *
 * SYNOPSIS
 */
-static inline void osm_opensm_sweep(IN osm_opensm_t * const p_osm)
+static inline void osm_opensm_sweep(IN osm_opensm_t * p_osm)
 {
 	osm_sm_sweep(&p_osm->sm);
 }
@@ -363,9 +398,8 @@ static inline void osm_opensm_sweep(IN osm_opensm_t * const p_osm)
 *
 * SYNOPSIS
 */
-static inline void
-osm_opensm_set_log_flags(IN osm_opensm_t * const p_osm,
-			 IN const osm_log_level_t log_flags)
+static inline void osm_opensm_set_log_flags(IN osm_opensm_t * p_osm,
+					    IN osm_log_level_t log_flags)
 {
 	osm_log_set_level(&p_osm->log, log_flags);
 }
@@ -395,8 +429,7 @@ osm_opensm_set_log_flags(IN osm_opensm_t * const p_osm,
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_opensm_bind(IN osm_opensm_t * const p_osm, IN const ib_net64_t guid);
+ib_api_status_t osm_opensm_bind(IN osm_opensm_t * p_osm, IN ib_net64_t guid);
 /*
 * PARAMETERS
 *	p_osm
@@ -424,11 +457,10 @@ osm_opensm_bind(IN osm_opensm_t * const p_osm, IN const ib_net64_t guid);
 * SYNOPSIS
 */
 static inline cl_status_t
-osm_opensm_wait_for_subnet_up(IN osm_opensm_t * const p_osm,
-			      IN uint32_t const wait_us,
-			      IN boolean_t const interruptible)
+osm_opensm_wait_for_subnet_up(IN osm_opensm_t * p_osm, IN uint32_t wait_us,
+			      IN boolean_t interruptible)
 {
-	return (osm_sm_wait_for_subnet_up(&p_osm->sm, wait_us, interruptible));
+	return osm_sm_wait_for_subnet_up(&p_osm->sm, wait_us, interruptible);
 }
 
 /*
diff --git a/include/opensm/osm_partition.h b/include/opensm/osm_partition.h
index 38acdc9..515e8d5 100644
--- a/include/opensm/osm_partition.h
+++ b/include/opensm/osm_partition.h
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -48,6 +48,7 @@
 #include <complib/cl_map.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_subnet.h>
+#include <opensm/osm_multicast.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -92,11 +93,12 @@ BEGIN_C_DECLS
 typedef struct osm_prtn {
 	cl_map_item_t map_item;
 	ib_net16_t pkey;
-	ib_net16_t mlid;
 	uint8_t sl;
 	cl_map_t full_guid_tbl;
 	cl_map_t part_guid_tbl;
 	char name[32];
+	osm_mgrp_t **mgrps;
+	int nmgrps;
 } osm_prtn_t;
 /*
 * FIELDS
@@ -106,10 +108,6 @@ typedef struct osm_prtn {
 *	pkey
 *		The IBA defined P_KEY of this Partition.
 *
-*	mlid
-*		The network ordered LID of the well known Multicast Group
-*		that was created for this partition.
-*
 *	sl
 *		The Service Level (SL) associated with this Partiton.
 *
@@ -125,6 +123,14 @@ typedef struct osm_prtn {
 *		Name of the Partition as specified in partition
 *		configuration.
 *
+*	mgrps
+*		List of well known Multicast Groups
+*		that were created for this partition (when configured).
+*		This includes the IPoIB broadcast group.
+*
+*	nmgrps
+*		Number of known Multicast Groups.
+*
 * SEE ALSO
 *	Partition
 *********/
@@ -138,7 +144,7 @@ typedef struct osm_prtn {
 *
 * SYNOPSIS
 */
-void osm_prtn_delete(IN OUT osm_prtn_t ** const pp_prtn);
+void osm_prtn_delete(IN osm_subn_t * p_subn, IN OUT osm_prtn_t ** pp_prtn);
 /*
 * PARAMETERS
 *	pp_prtn
@@ -164,7 +170,7 @@ void osm_prtn_delete(IN OUT osm_prtn_t ** const pp_prtn);
 *
 * SYNOPSIS
 */
-osm_prtn_t *osm_prtn_new(IN const char *name, IN const uint16_t pkey);
+osm_prtn_t *osm_prtn_new(IN const char *name, IN uint16_t pkey);
 /*
 * PARAMETERS
 *	name
@@ -192,8 +198,8 @@ osm_prtn_t *osm_prtn_new(IN const char *name, IN const uint16_t pkey);
 *
 * SYNOPSIS
 */
-static inline boolean_t osm_prtn_is_guid(IN const osm_prtn_t * const p_prtn,
-					 IN const ib_net64_t guid)
+static inline boolean_t osm_prtn_is_guid(IN const osm_prtn_t * p_prtn,
+					 IN ib_net64_t guid)
 {
 	return (cl_map_get(&p_prtn->full_guid_tbl, guid) != NULL) ||
 	    (cl_map_get(&p_prtn->part_guid_tbl, guid) != NULL);
@@ -225,8 +231,8 @@ static inline boolean_t osm_prtn_is_guid(IN const osm_prtn_t * const p_prtn,
 *
 * SYNOPSIS
 */
-ib_api_status_t osm_prtn_make_partitions(IN osm_log_t * const p_log,
-					 IN osm_subn_t * const p_subn);
+ib_api_status_t osm_prtn_make_partitions(IN osm_log_t * p_log,
+					 IN osm_subn_t * p_subn);
 /*
 * PARAMETERS
 *	p_log
diff --git a/include/opensm/osm_path.h b/include/opensm/osm_path.h
index 8d65d2c..b69e5f9 100644
--- a/include/opensm/osm_path.h
+++ b/include/opensm/osm_path.h
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -79,7 +80,6 @@ BEGIN_C_DECLS
 * SYNOPSIS
 */
 typedef struct osm_dr_path {
-	osm_bind_handle_t h_bind;
 	uint8_t hop_count;
 	uint8_t path[IB_SUBNET_PATH_HOPS_MAX];
 } osm_dr_path_t;
@@ -106,11 +106,10 @@ typedef struct osm_dr_path {
 *
 * SYNOPSIS
 */
-static inline void osm_dr_path_construct(IN osm_dr_path_t * const p_path)
+static inline void osm_dr_path_construct(IN osm_dr_path_t * p_path)
 {
 	/* The first location in the path array is reserved. */
 	memset(p_path, 0, sizeof(*p_path));
-	p_path->h_bind = OSM_BIND_INVALID_HANDLE;
 }
 
 /*
@@ -145,17 +144,14 @@ static inline void osm_dr_path_construct(IN osm_dr_path_t * const p_path)
 * SYNOPSIS
 */
 static inline void
-osm_dr_path_init(IN osm_dr_path_t * const p_path,
-		 IN const osm_bind_handle_t h_bind,
-		 IN const uint8_t hop_count,
+osm_dr_path_init(IN osm_dr_path_t * p_path, IN uint8_t hop_count,
 		 IN const uint8_t path[IB_SUBNET_PATH_HOPS_MAX])
 {
 	/* The first location in the path array is reserved. */
 	CL_ASSERT(path[0] == 0);
 	CL_ASSERT(hop_count < IB_SUBNET_PATH_HOPS_MAX);
-	p_path->h_bind = h_bind;
 	p_path->hop_count = hop_count;
-	memcpy(p_path->path, path, IB_SUBNET_PATH_HOPS_MAX);
+	memcpy(p_path->path, path, hop_count + 1);
 }
 
 /*
@@ -188,15 +184,18 @@ osm_dr_path_init(IN osm_dr_path_t * const p_path,
 *
 * SYNOPSIS
 */
-static inline void
-osm_dr_path_extend(IN osm_dr_path_t * const p_path, IN const uint8_t port_num)
+static inline int osm_dr_path_extend(IN osm_dr_path_t * p_path,
+				     IN uint8_t port_num)
 {
 	p_path->hop_count++;
-	CL_ASSERT(p_path->hop_count < IB_SUBNET_PATH_HOPS_MAX);
+
+	if (p_path->hop_count >= IB_SUBNET_PATH_HOPS_MAX)
+		return -1;
 	/*
 	   Location 0 in the path array is reserved per IB spec.
 	 */
 	p_path->path[p_path->hop_count] = port_num;
+	return 0;
 }
 
 /*
@@ -207,39 +206,9 @@ osm_dr_path_extend(IN osm_dr_path_t * const p_path, IN const uint8_t port_num)
 *	port_num
 *		[in] Additional port to add to the DR path.
 *
-* RETURN VALUE
-*	None.
-*
-* NOTES
-*
-* SEE ALSO
-*********/
-
-/****f* OpenSM: DR Path/osm_dr_path_get_bind_handle
-* NAME
-*	osm_dr_path_get_bind_handle
-*
-* DESCRIPTION
-*	Gets the bind handle from a path.
-*
-* SYNOPSIS
-*/
-static inline osm_bind_handle_t
-osm_dr_path_get_bind_handle(IN const osm_dr_path_t * const p_path)
-{
-	return (p_path->h_bind);
-}
-
-/*
-* PARAMETERS
-*	p_path
-*		[in] Pointer to a directed route path object to initialize.
-*
-*	port_num
-*		[in] Additional port to add to the DR path.
-*
-* RETURN VALUE
-*	None.
+* RETURN VALUES
+*	0 indicates path was extended.
+*	Other than 0 indicates path was not extended.
 *
 * NOTES
 *
diff --git a/include/opensm/osm_perfmgr.h b/include/opensm/osm_perfmgr.h
index d48d2ee..97fead1 100644
--- a/include/opensm/osm_perfmgr.h
+++ b/include/opensm/osm_perfmgr.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2007 The Regents of the University of California.
- * Copyright (c) 2007-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2007-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2009,2010 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -89,23 +90,31 @@ typedef enum {
 	PERFMGR_SWEEP_SUSPENDED
 } osm_perfmgr_sweep_state_t;
 
-/* Redirection information */
-typedef struct redir {
-	ib_net16_t redir_lid;
-	ib_net32_t redir_qp;
-} redir_t;
+typedef struct monitored_port {
+	uint16_t pkey_ix;
+	ib_net16_t orig_lid;
+	boolean_t redirection;
+	boolean_t valid;
+	/* Redirection fields from ClassPortInfo */
+	ib_gid_t gid;
+	ib_net16_t lid;
+	ib_net16_t pkey;
+	ib_net32_t qp;
+} monitored_port_t;
 
-/* Node to store information about which nodes we are monitoring */
-typedef struct _monitored_node {
+/* Node to store information about nodes being monitored */
+typedef struct monitored_node {
 	cl_map_item_t map_item;
-	struct _monitored_node *next;
+	struct monitored_node *next;
 	uint64_t guid;
+	boolean_t esp0;
 	char *name;
-	uint32_t redir_tbl_size;
-	redir_t redir_port[1];	/* redirection on a per port basis */
-} __monitored_node_t;
+	uint32_t num_ports;
+	monitored_port_t port[1];
+} monitored_node_t;
 
 struct osm_opensm;
+
 /****s* OpenSM: PerfMgr/osm_perfmgr_t
 *  This object should be treated as opaque and should
 *  be manipulated only through the provided functions.
@@ -116,7 +125,6 @@ typedef struct osm_perfmgr {
 	struct osm_opensm *osm;
 	osm_subn_t *subn;
 	osm_sm_t *sm;
-	cl_plock_t *lock;
 	osm_log_t *log;
 	osm_mad_pool_t *mad_pool;
 	atomic32_t trans_id;
@@ -128,10 +136,14 @@ typedef struct osm_perfmgr {
 	uint16_t sweep_time_s;
 	perfmgr_db_t *db;
 	atomic32_t outstanding_queries;	/* this along with sig_query */
-	cl_event_t sig_query;	/* will throttle our querys */
+	cl_event_t sig_query;	/* will throttle our queries */
 	uint32_t max_outstanding_queries;
-	cl_qmap_t monitored_map;	/* map the nodes we are tracking */
-	__monitored_node_t *remove_list;
+	boolean_t ignore_cas;
+	cl_qmap_t monitored_map;	/* map the nodes being tracked */
+	monitored_node_t *remove_list;
+	ib_net64_t port_guid;
+	int16_t local_port;
+	int rm_nodes;
 } osm_perfmgr_t;
 /*
 * FIELDS
@@ -142,61 +154,73 @@ typedef struct osm_perfmgr {
 *	      Pointer to the log object.
 *
 *	mad_pool
-*		Pointer to the MAD pool.
+*	      Pointer to the MAD pool.
 *
 *	mad_ctrl
-*		Mad Controller
+*	      Mad Controller
 *********/
 
 /****f* OpenSM: Creation Functions */
-void osm_perfmgr_shutdown(osm_perfmgr_t * const p_perfmgr);
-void osm_perfmgr_destroy(osm_perfmgr_t * const p_perfmgr);
+void osm_perfmgr_shutdown(osm_perfmgr_t * p_perfmgr);
+void osm_perfmgr_destroy(osm_perfmgr_t * p_perfmgr);
 
 /****f* OpenSM: Inline accessor functions */
 inline static void osm_perfmgr_set_state(osm_perfmgr_t * p_perfmgr,
 					 osm_perfmgr_state_t state)
 {
 	p_perfmgr->state = state;
-	if (state == PERFMGR_STATE_ENABLED)
-		osm_sm_signal(p_perfmgr->sm, OSM_SIGNAL_PERFMGR_SWEEP);
+	if (state == PERFMGR_STATE_ENABLED) {
+		cl_timer_start(&p_perfmgr->sweep_timer, p_perfmgr->sweep_time_s * 1000);
+	} else {
+		cl_timer_stop(&p_perfmgr->sweep_timer);
+	}
+}
+
+inline static osm_perfmgr_state_t osm_perfmgr_get_state(osm_perfmgr_t * perfmgr)
+{
+	return perfmgr->state;
 }
 
-inline static osm_perfmgr_state_t osm_perfmgr_get_state(osm_perfmgr_t
-							  * p_perfmgr)
+inline static void osm_perfmgr_set_rm_nodes(osm_perfmgr_t *perfmgr,
+					    int rm_nodes)
 {
-	return (p_perfmgr->state);
+	perfmgr->rm_nodes = rm_nodes;
+}
+inline static int osm_perfmgr_get_rm_nodes(osm_perfmgr_t *perfmgr)
+{
+	return perfmgr->rm_nodes;
 }
 
-inline static char *osm_perfmgr_get_state_str(osm_perfmgr_t * p_perfmgr)
+inline static const char *osm_perfmgr_get_state_str(osm_perfmgr_t * p_perfmgr)
 {
 	switch (p_perfmgr->state) {
 	case PERFMGR_STATE_DISABLE:
-		return ("Disabled");
+		return "Disabled";
 		break;
 	case PERFMGR_STATE_ENABLED:
-		return ("Enabled");
+		return "Enabled";
 		break;
 	case PERFMGR_STATE_NO_DB:
-		return ("No Database");
+		return "No Database";
 		break;
 	}
-	return ("UNKNOWN");
+	return "UNKNOWN";
 }
 
-inline static char *osm_perfmgr_get_sweep_state_str(osm_perfmgr_t * perfmgr)
+inline static const char *osm_perfmgr_get_sweep_state_str(osm_perfmgr_t * perfmgr)
 {
 	switch (perfmgr->sweep_state) {
 	case PERFMGR_SWEEP_SLEEP:
-		return ("Sleeping");
+		return "Sleeping";
 		break;
 	case PERFMGR_SWEEP_ACTIVE:
-		return ("Active");
+		return "Active";
 		break;
 	case PERFMGR_SWEEP_SUSPENDED:
-		return ("Suspended");
+		return "Suspended";
 		break;
 	}
-	return ("UNKNOWN");
+	return "UNKNOWN";
 }
 
 inline static void osm_perfmgr_set_sweep_time_s(osm_perfmgr_t * p_perfmgr,
@@ -208,24 +232,31 @@ inline static void osm_perfmgr_set_sweep_time_s(osm_perfmgr_t * p_perfmgr,
 
 inline static uint16_t osm_perfmgr_get_sweep_time_s(osm_perfmgr_t * p_perfmgr)
 {
-	return (p_perfmgr->sweep_time_s);
+	return p_perfmgr->sweep_time_s;
+}
+
+inline static unsigned osm_perfmgr_delete_inactive(osm_perfmgr_t * pm)
+{
+	unsigned rc;
+	perfmgr_db_delete_inactive(pm->db, &rc);
+	return (rc);
 }
 
 void osm_perfmgr_clear_counters(osm_perfmgr_t * p_perfmgr);
 void osm_perfmgr_dump_counters(osm_perfmgr_t * p_perfmgr,
 			       perfmgr_db_dump_t dump_type);
-void osm_perfmgr_print_counters(osm_perfmgr_t *pm, char *nodename,
-				FILE *fp);
+void osm_perfmgr_print_counters(osm_perfmgr_t *pm, char *nodename, FILE *fp,
+				char *port, int err_only);
 
-ib_api_status_t osm_perfmgr_bind(osm_perfmgr_t * const p_perfmgr,
-				 const ib_net64_t port_guid);
+ib_api_status_t osm_perfmgr_bind(osm_perfmgr_t * p_perfmgr,
+				 ib_net64_t port_guid);
 
 void osm_perfmgr_process(osm_perfmgr_t * pm);
 
 /****f* OpenSM: PerfMgr/osm_perfmgr_init */
-ib_api_status_t osm_perfmgr_init(osm_perfmgr_t * const perfmgr,
+ib_api_status_t osm_perfmgr_init(osm_perfmgr_t * perfmgr,
 				 struct osm_opensm *osm,
-				 const osm_subn_opt_t * const p_opt);
+				 const osm_subn_opt_t * p_opt);
 /*
 * PARAMETERS
 *	perfmgr
@@ -235,7 +266,7 @@ ib_api_status_t osm_perfmgr_init(osm_perfmgr_t * const perfmgr,
 *		[in] Pointer to the OpenSM object.
 *
 *	p_opt
-*		[in] Starting options
+*		[in] Pointer to the subnet options structure.
 *
 * RETURN VALUES
 *	IB_SUCCESS if the PerfMgr object was initialized successfully.
diff --git a/include/opensm/osm_perfmgr_db.h b/include/opensm/osm_perfmgr_db.h
index c28d5bb..6333692 100644
--- a/include/opensm/osm_perfmgr_db.h
+++ b/include/opensm/osm_perfmgr_db.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2007 The Regents of the University of California.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -108,14 +109,6 @@ typedef struct {
 } perfmgr_db_data_cnt_reading_t;
 
 /** =========================================================================
- * Port select errors
- */
-typedef struct {
-	uint64_t xmit_wait;
-	time_t time;
-} perfmgr_db_ps_reading_t;
-
-/** =========================================================================
  * Dump output options
  */
 typedef enum {
@@ -127,31 +120,34 @@ typedef enum {
  * Port counter object.
  * Store all the port counters for a single port.
  */
-typedef struct _db_port {
+typedef struct db_port {
 	perfmgr_db_err_reading_t err_total;
 	perfmgr_db_err_reading_t err_previous;
 	perfmgr_db_data_cnt_reading_t dc_total;
 	perfmgr_db_data_cnt_reading_t dc_previous;
 	time_t last_reset;
-} _db_port_t;
+	boolean_t valid;
+} db_port_t;
 
 /** =========================================================================
  * group port counters for ports into the nodes
  */
-#define NODE_NAME_SIZE (IB_NODE_DESCRIPTION_SIZE << 1)
-typedef struct _db_node {
+#define NODE_NAME_SIZE (IB_NODE_DESCRIPTION_SIZE + 1)
+typedef struct db_node {
 	cl_map_item_t map_item;	/* must be first */
 	uint64_t node_guid;
-	_db_port_t *ports;
+	boolean_t active;       /* activly being monitored */
+	boolean_t esp0;
+	db_port_t *ports;
 	uint8_t num_ports;
 	char node_name[NODE_NAME_SIZE];
-} _db_node_t;
+} db_node_t;
 
 /** =========================================================================
- * all nodes in the system.
+ * all nodes in the subnet.
  */
-typedef struct _db {
-	cl_qmap_t pc_data;	/* stores type (_db_node_t *) */
+typedef struct perfmgr_db {
+	cl_qmap_t pc_data;	/* stores type (db_node_t *) */
 	cl_plock_t lock;
 	struct osm_perfmgr *perfmgr;
 } perfmgr_db_t;
@@ -163,7 +159,10 @@ perfmgr_db_t *perfmgr_db_construct(struct osm_perfmgr *perfmgr);
 void perfmgr_db_destroy(perfmgr_db_t * db);
 
 perfmgr_db_err_t perfmgr_db_create_entry(perfmgr_db_t * db, uint64_t guid,
-					 uint8_t num_ports, char *node_name);
+					 boolean_t esp0, uint8_t num_ports,
+					 char *node_name);
+perfmgr_db_err_t perfmgr_db_delete_entry(perfmgr_db_t * db, uint64_t guid);
+perfmgr_db_err_t perfmgr_db_delete_inactive(perfmgr_db_t * db, unsigned *cnt);
 
 perfmgr_db_err_t perfmgr_db_add_err_reading(perfmgr_db_t * db, uint64_t guid,
 					    uint8_t port,
@@ -185,11 +184,17 @@ perfmgr_db_err_t perfmgr_db_get_prev_dc(perfmgr_db_t * db, uint64_t guid,
 perfmgr_db_err_t perfmgr_db_clear_prev_dc(perfmgr_db_t * db, uint64_t guid,
 					  uint8_t port);
 
+perfmgr_db_err_t perfmgr_db_mark_active(perfmgr_db_t *db, uint64_t guid,
+					boolean_t active);
+
 void perfmgr_db_clear_counters(perfmgr_db_t * db);
 perfmgr_db_err_t perfmgr_db_dump(perfmgr_db_t * db, char *file,
 				 perfmgr_db_dump_t dump_type);
-void perfmgr_db_print_by_name(perfmgr_db_t * db, char *nodename, FILE *fp);
-void perfmgr_db_print_by_guid(perfmgr_db_t * db, uint64_t guid, FILE *fp);
+void perfmgr_db_print_all(perfmgr_db_t * db, FILE *fp, int err_only);
+void perfmgr_db_print_by_name(perfmgr_db_t * db, char *nodename, FILE *fp,
+			      char *port, int err_only);
+void perfmgr_db_print_by_guid(perfmgr_db_t * db, uint64_t guid, FILE *fp,
+			      char *port, int err_only);
 
 /** =========================================================================
  * helper functions to fill in the various db objects from wire objects
diff --git a/include/opensm/osm_pkey.h b/include/opensm/osm_pkey.h
index aa141b7..54888e6 100644
--- a/include/opensm/osm_pkey.h
+++ b/include/opensm/osm_pkey.h
@@ -1,6 +1,7 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -81,15 +82,21 @@ struct osm_physp;
 * SYNOPSIS
 */
 typedef struct osm_pkeybl {
+	cl_ptr_vector_t accum_pkeys;
 	cl_ptr_vector_t blocks;
 	cl_ptr_vector_t new_blocks;
 	cl_map_t keys;
 	cl_qlist_t pending;
+	uint16_t last_pkey_idx;
 	uint16_t used_blocks;
 	uint16_t max_blocks;
 } osm_pkey_tbl_t;
 /*
 * FIELDS
+*	accum_pkeys
+*		Accumulated pkeys with pkey index. Used to
+*		preserve pkey index.
+*
 *	blocks
 *		The IBA defined blocks of pkey values, updated from the subnet
 *
@@ -211,9 +218,9 @@ void osm_pkey_tbl_destroy(IN osm_pkey_tbl_t * p_pkey_tbl);
 *
 *********/
 
-/****f* OpenSM: osm_pkey_get_num_blocks
+/****f* OpenSM: osm_pkey_tbl_get_num_blocks
 * NAME
-*  osm_pkey_get_num_blocks
+*  osm_pkey_tbl_get_num_blocks
 *
 * DESCRIPTION
 *  Obtain the number of blocks in IB PKey table
@@ -251,7 +258,8 @@ static inline ib_pkey_table_t *osm_pkey_tbl_block_get(const osm_pkey_tbl_t *
 						      uint16_t block)
 {
 	return ((block < cl_ptr_vector_get_size(&p_pkey_tbl->blocks)) ?
-		cl_ptr_vector_get(&p_pkey_tbl->blocks, block) : NULL);
+		(ib_pkey_table_t *)cl_ptr_vector_get(
+		&p_pkey_tbl->blocks, block) : NULL);
 };
 
 /*
@@ -259,7 +267,7 @@ static inline ib_pkey_table_t *osm_pkey_tbl_block_get(const osm_pkey_tbl_t *
 *     [in] Pointer to osm_pkey_tbl_t object.
 *
 *  block
-*     [in] The lock number to get
+*     [in] The block number to get
 *
 * RETURN VALUES
 *  The IB pkey table of that pkey table element
@@ -281,10 +289,62 @@ static inline ib_pkey_table_t *osm_pkey_tbl_new_block_get(const osm_pkey_tbl_t *
 							  p_pkey_tbl,
 							  uint16_t block)
 {
-	return (block < cl_ptr_vector_get_size(&p_pkey_tbl->new_blocks)) ?
-	    cl_ptr_vector_get(&p_pkey_tbl->new_blocks, block) : NULL;
+	return ((block < cl_ptr_vector_get_size(&p_pkey_tbl->new_blocks)) ?
+		(ib_pkey_table_t *)cl_ptr_vector_get(
+		&p_pkey_tbl->new_blocks, block) : NULL);
 };
 
+/****f* OpenSM: osm_pkey_tbl_set_accum_pkeys
+* NAME
+*  osm_pkey_tbl_set_accum_pkeys
+*
+* DESCRIPTION
+*   Stores the given pkey and pkey index in the "accum_pkeys" array
+*
+* SYNOPSIS
+*/
+cl_status_t
+osm_pkey_tbl_set_accum_pkeys(IN osm_pkey_tbl_t * p_pkey_tbl,
+			     IN uint16_t pkey, IN uint16_t pkey_idx);
+/*
+* p_pkey_tbl
+*   [in] Pointer to the PKey table
+*
+* pkey
+*   [in] PKey to store
+*
+* pkey_idx
+*   [in] The overall index
+*
+* RETURN VALUES
+*   CL_SUCCESS if OK
+*   CL_INSUFFICIENT_MEMORY if failed
+*
+*********/
+
+/****f* OpenSM: osm_pkey_tbl_clear_accum_pkeys
+* NAME
+*  osm_pkey_tbl_clear_accum_pkeys
+*
+* DESCRIPTION
+*   Clears the given pkey in the "accum_pkeys" array
+*
+* SYNOPSIS
+*/
+void
+osm_pkey_tbl_clear_accum_pkeys(IN osm_pkey_tbl_t * p_pkey_tbl,
+			       IN uint16_t pkey);
+/*
+* p_pkey_tbl
+*   [in] Pointer to the PKey table
+*
+* pkey
+*   [in] PKey to clear
+*
+* NOTES
+*
+*********/
+
 /****f* OpenSM: osm_pkey_tbl_set_new_entry
 * NAME
 *  osm_pkey_tbl_set_new_entry
@@ -412,10 +472,11 @@ osm_pkey_tbl_get_block_and_idx(IN osm_pkey_tbl_t * p_pkey_tbl,
 */
 ib_api_status_t
 osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl,
-		 IN uint16_t block, IN ib_pkey_table_t * p_tbl);
+		 IN uint16_t block, IN ib_pkey_table_t * p_tbl,
+		 IN boolean_t allow_both_pkeys);
 /*
 *  p_pkey_tbl
-*     [in] Pointer to osm_pkey_tbl_t object.
+*     [in] Pointer to osm_pkey_tbl_t object
 *
 *  block
 *     [in] The block number to set
@@ -423,6 +484,10 @@ osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl,
 *  p_tbl
 *     [in] The IB PKey block to copy to the object
 *
+*  allow_both_pkeys
+*     [in] Whether both full and limited membership on same partition
+*          are allowed
+*
 * RETURN VALUES
 *  IB_SUCCESS or IB_ERROR
 *
@@ -439,9 +504,10 @@ osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl,
 *
 * SYNOPSIS
 */
-boolean_t osm_physp_share_this_pkey(IN const struct osm_physp *const p_physp1,
-				    IN const struct osm_physp *const p_physp2,
-				    IN const ib_net16_t pkey);
+boolean_t osm_physp_share_this_pkey(IN const struct osm_physp * p_physp1,
+				    IN const struct osm_physp * p_physp2,
+				    IN ib_net16_t pkey,
+				    IN boolean_t allow_both_pkeys);
 /*
 * PARAMETERS
 *
@@ -454,6 +520,9 @@ boolean_t osm_physp_share_this_pkey(IN const struct osm_physp *const p_physp1,
 *  pkey
 *     [in] value of P_Key to check.
 *
+*  allow_both_pkeys
+*     [in] whether both pkeys allowed policy is being used.
+*
 * RETURN VALUES
 *  Returns TRUE if the two ports are matching.
 *  FALSE otherwise.
@@ -471,10 +540,9 @@ boolean_t osm_physp_share_this_pkey(IN const struct osm_physp *const p_physp1,
 *
 * SYNOPSIS
 */
-ib_net16_t osm_physp_find_common_pkey(IN const struct osm_physp *const
-				      p_physp1,
-				      IN const struct osm_physp *const
-				      p_physp2);
+ib_net16_t osm_physp_find_common_pkey(IN const struct osm_physp *p_physp1,
+				      IN const struct osm_physp *p_physp2,
+				      IN boolean_t allow_both_pkeys);
 /*
 * PARAMETERS
 *
@@ -484,6 +552,10 @@ ib_net16_t osm_physp_find_common_pkey(IN const struct osm_physp *const
 *  p_physp2
 *     [in] Pointer to an osm_physp_t object.
 *
+*  allow_both_pkeys
+*     [in] Whether both full and limited membership on same partition
+*          are allowed
+*
 * RETURN VALUES
 *  Returns value of first shared P_Key or INVALID P_Key (0x0) if not
 *  found.
@@ -517,8 +589,9 @@ ib_net16_t osm_physp_find_common_pkey(IN const struct osm_physp *const
 * SYNOPSIS
 */
 boolean_t osm_physp_share_pkey(IN osm_log_t * p_log,
-			       IN const struct osm_physp *const p_physp_1,
-			       IN const struct osm_physp *const p_physp_2);
+			       IN const struct osm_physp * p_physp_1,
+			       IN const struct osm_physp * p_physp_2,
+			       IN boolean_t allow_both_pkeys);
 
 /*
 * PARAMETERS
@@ -531,6 +604,10 @@ boolean_t osm_physp_share_pkey(IN osm_log_t * p_log,
 *  p_physp_2
 *     [in] Pointer to an osm_physp_t object.
 *
+*  allow_both_pkeys
+*     [in] Whether both full and limited membership on same partition
+*          are allowed
+*
 * RETURN VALUES
 *  Returns TRUE if the 2 physical ports are matching.
 *  FALSE otherwise.
@@ -564,8 +641,9 @@ boolean_t osm_physp_share_pkey(IN osm_log_t * p_log,
 * SYNOPSIS
 */
 boolean_t osm_port_share_pkey(IN osm_log_t * p_log,
-			      IN const struct osm_port *const p_port_1,
-			      IN const struct osm_port *const p_port_2);
+			      IN const struct osm_port * p_port_1,
+			      IN const struct osm_port * p_port_2,
+			      IN boolean_t allow_both_pkeys);
 
 /*
 * PARAMETERS
@@ -586,65 +664,6 @@ boolean_t osm_port_share_pkey(IN osm_log_t * p_log,
 *
 *********/
 
-/****f* OpenSM: osm_lid_share_pkey
-* NAME
-*  osm_lid_share_pkey
-*
-* DESCRIPTION
-*  Checks if the given lids and port_numbers share a pkey.
-*  The meaning P_Key matching:
-*  10.9.3 :
-*   In the following, let M_P_Key(Message P_Key) be the P_Key in the incoming
-*   packet and E_P_Key(Endnode P_Key) be the P_Key it is being compared against
-*   in the packet's destination endnode.
-*
-*    If:
-*    * neither M_P_Key nor E_P_Key are the invalid P_Key
-*    * and the low-order 15 bits of the M_P_Key match the low order 15
-*      bits of the E_P_Key
-*    * and the high order bit(membership type) of both the M_P_Key and
-*      E_P_Key are not both 0 (i.e., both are not Limited members of
-*      the partition)
-*
-*    then the P_Keys are said to match.
-*
-* SYNOPSIS
-*/
-boolean_t osm_lid_share_pkey(IN osm_log_t * p_log,
-			     IN const struct osm_subn *const p_subn,
-			     IN const ib_net16_t lid1,
-			     IN const uint8_t port_num1,
-			     IN const ib_net16_t lid2,
-			     IN const uint8_t port_num2);
-
-/*
-* PARAMETERS
-*  p_log
-*     [in] Pointer to a log object.
-*
-*  p_subn
-*     [in] Pointer to the subnet object for accessing of the options.
-*
-*  lid1
-*     [in] lid number of first port.
-*
-*  port_num1
-*     [in] port number of first port.
-*
-*  lid2
-*     [in] lid number of second port.
-*
-*  port_num2
-*     [in] port number of second port.
-*
-* RETURN VALUES
-*  Returns TRUE if the 2 physical ports that belong to these lids/port_numbers
-*  are matching. FALSE otherwise.
-*
-* NOTES
-*
-*********/
-
 /****f* OpenSM: osm_physp_has_pkey
 * NAME
 *  osm_physp_has_pkey
@@ -669,9 +688,8 @@ boolean_t osm_lid_share_pkey(IN osm_log_t * p_log,
 *
 * SYNOPSIS
 */
-boolean_t osm_physp_has_pkey(IN osm_log_t * p_log,
-			     IN const ib_net16_t pkey,
-			     IN const struct osm_physp *const p_physp);
+boolean_t osm_physp_has_pkey(IN osm_log_t * p_log, IN ib_net16_t pkey,
+			     IN const struct osm_physp *p_physp);
 
 /*
 * PARAMETERS
diff --git a/include/opensm/osm_port.h b/include/opensm/osm_port.h
index 3dda541..5fc186c 100644
--- a/include/opensm/osm_port.h
+++ b/include/opensm/osm_port.h
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -65,6 +65,8 @@ BEGIN_C_DECLS
 */
 struct osm_port;
 struct osm_node;
+struct osm_mgrp;
+struct osm_sm;
 
 /****h* OpenSM/Physical Port
 * NAME
@@ -103,7 +105,9 @@ struct osm_node;
 */
 typedef struct osm_physp {
 	ib_port_info_t port_info;
+	ib_mlnx_ext_port_info_t ext_port_info;
 	ib_net64_t port_guid;
+	ib_net64_t (*p_guids)[];
 	uint8_t port_num;
 	struct osm_node *p_node;
 	struct osm_physp *p_remote_physp;
@@ -115,16 +119,34 @@ typedef struct osm_physp {
 	osm_pkey_tbl_t pkeys;
 	ib_vl_arb_table_t vl_arb[4];
 	cl_ptr_vector_t slvl_by_port;
+	uint8_t hop_wf;
+	union {
+		struct {
+			ib_sw_cong_setting_t sw_cong_setting;
+		} sw;
+		struct {
+			ib_ca_cong_setting_t ca_cong_setting;
+			ib_cc_tbl_t cc_tbl[OSM_CCT_ENTRY_MAD_BLOCKS];
+		} ca;
+	} cc;
 } osm_physp_t;
 /*
 * FIELDS
 *	port_info
 *		The IBA defined PortInfo data for this port.
 *
+*	ext_port_info
+*		Mellanox vendor specific ExtendedPortInfo data for this port.
+*
 *	port_guid
 *		Port GUID value of this port.  For switches,
 *		all ports share the same GUID value.
 *
+*	p_guids
+*		Pointer to array of GUIDs obtained from GUIDInfo.
+*		This pointer is null for switch physical/external ports
+*		(used for endports only).
+*
 *	port_num
 *		The port number of this port.  The PortInfo also
 *		contains a port_number, but that number is not
@@ -171,6 +193,18 @@ typedef struct osm_physp {
 *		Switches have an entry for every other input port (inc SMA=0).
 *		On CAs only one per port.
 *
+*	hop_wf
+*		Hop weighting factor to be used in the routing.
+*
+*	sw_cong_setting
+*		Physical port switch congestion settings (switches only)
+*
+*	ca_cong_setting
+*		Physical port ca congestion settings (cas only)
+*
+*	cc_tbl
+*		Physical port ca congestion control table (cas only)
+*
 * SEE ALSO
 *	Port
 *********/
@@ -184,7 +218,7 @@ typedef struct osm_physp {
 *
 * SYNOPSIS
 */
-void osm_physp_construct(IN osm_physp_t * const p_physp);
+void osm_physp_construct(IN osm_physp_t * p_physp);
 /*
 * PARAMETERS
 *	p_physp
@@ -208,14 +242,10 @@ void osm_physp_construct(IN osm_physp_t * const p_physp);
 *
 * SYNOPSIS
 */
-void
-osm_physp_init(IN osm_physp_t * const p_physp,
-	       IN const ib_net64_t port_guid,
-	       IN const uint8_t port_num,
-	       IN const struct osm_node *const p_node,
-	       IN const osm_bind_handle_t h_bind,
-	       IN const uint8_t hop_count,
-	       IN const uint8_t * const p_initial_path);
+void osm_physp_init(IN osm_physp_t * p_physp, IN ib_net64_t port_guid,
+		    IN uint8_t port_num, IN const struct osm_node *p_node,
+		    IN osm_bind_handle_t h_bind, IN uint8_t hop_count,
+		    IN const uint8_t * p_initial_path);
 /*
 * PARAMETERS
 *	p_physp
@@ -234,7 +264,7 @@ osm_physp_init(IN osm_physp_t * const p_physp,
 *
 *	h_bind
 *		[in] Bind handle on which this port is accessed.
-*		Caller should use OSM_INVALID_BIND_HANDLE if the bind
+*		Caller should use OSM_BIND_INVALID_HANDLE if the bind
 *		handle to this port is unknown.
 *
 *	hop_count
@@ -263,7 +293,7 @@ osm_physp_init(IN osm_physp_t * const p_physp,
 *
 * SYNOPSIS
 */
-void osm_physp_destroy(IN osm_physp_t * const p_physp);
+void osm_physp_destroy(IN osm_physp_t * p_physp);
 /*
 * PARAMETERS
 *	p_port
@@ -292,7 +322,7 @@ void osm_physp_destroy(IN osm_physp_t * const p_physp);
 *
 * SYNOPSIS
 */
-static inline boolean_t osm_physp_is_valid(IN const osm_physp_t * const p_physp)
+static inline boolean_t osm_physp_is_valid(IN const osm_physp_t * p_physp)
 {
 	CL_ASSERT(p_physp);
 	return (p_physp->port_guid != 0);
@@ -323,11 +353,10 @@ static inline boolean_t osm_physp_is_valid(IN const osm_physp_t * const p_physp)
 *
 * SYNOPSIS
 */
-static inline boolean_t
-osm_physp_is_healthy(IN const osm_physp_t * const p_physp)
+static inline boolean_t osm_physp_is_healthy(IN const osm_physp_t * p_physp)
 {
 	CL_ASSERT(p_physp);
-	return (p_physp->healthy);
+	return p_physp->healthy;
 }
 
 /*
@@ -358,7 +387,7 @@ osm_physp_is_healthy(IN const osm_physp_t * const p_physp)
 *
 * SYNOPSIS
 */
-boolean_t osm_link_is_healthy(IN const osm_physp_t * const p_physp);
+boolean_t osm_link_is_healthy(IN const osm_physp_t * p_physp);
 /*
 * PARAMETERS
 *	p_physp
@@ -385,8 +414,8 @@ boolean_t osm_link_is_healthy(IN const osm_physp_t * const p_physp);
 *
 * SYNOPSIS
 */
-static inline void
-osm_physp_set_health(IN osm_physp_t * const p_physp, IN boolean_t is_healthy)
+static inline void osm_physp_set_health(IN osm_physp_t * p_physp,
+					IN boolean_t is_healthy)
 {
 	CL_ASSERT(p_physp);
 	p_physp->healthy = is_healthy;
@@ -421,24 +450,9 @@ osm_physp_set_health(IN osm_physp_t * const p_physp, IN boolean_t is_healthy)
 *
 * SYNOPSIS
 */
-static inline void
-osm_physp_set_port_info(IN osm_physp_t * const p_physp,
-			IN const ib_port_info_t * const p_pi)
-{
-	CL_ASSERT(p_pi);
-	CL_ASSERT(osm_physp_is_valid(p_physp));
-
-	if (ib_port_info_get_port_state(p_pi) == IB_LINK_DOWN) {
-		/* If PortState is down, only copy PortState */
-		/* and PortPhysicalState per C14-24-2.1 */
-		ib_port_info_set_port_state(&p_physp->port_info, IB_LINK_DOWN);
-		ib_port_info_set_port_phys_state
-		    (ib_port_info_get_port_phys_state(p_pi),
-		     &p_physp->port_info);
-	} else {
-		p_physp->port_info = *p_pi;
-	}
-}
+void osm_physp_set_port_info(IN osm_physp_t * p_physp,
+					   IN const ib_port_info_t * p_pi,
+					   IN const struct osm_sm * p_sm);
 
 /*
 * PARAMETERS
@@ -448,6 +462,9 @@ osm_physp_set_port_info(IN osm_physp_t * const p_physp,
 *	p_pi
 *		[in] Pointer to the IBA defined PortInfo at this port number.
 *
+*	p_sm
+*		[in] Pointer to an osm_sm_t object.
+*
 * RETURN VALUES
 *	This function does not return a value.
 *
@@ -466,11 +483,10 @@ osm_physp_set_port_info(IN osm_physp_t * const p_physp,
 *
 * SYNOPSIS
 */
-void
-osm_physp_set_pkey_tbl(IN osm_log_t * p_log,
-		       IN const osm_subn_t * p_subn,
-		       IN osm_physp_t * const p_physp,
-		       IN ib_pkey_table_t * p_pkey_tbl, IN uint16_t block_num);
+void osm_physp_set_pkey_tbl(IN osm_log_t * p_log, IN const osm_subn_t * p_subn,
+			    IN osm_physp_t * p_physp,
+			    IN ib_pkey_table_t * p_pkey_tbl,
+			    IN uint16_t block_num);
 /*
 * PARAMETERS
 *	p_log
@@ -510,7 +526,7 @@ osm_physp_set_pkey_tbl(IN osm_log_t * p_log,
 * SYNOPSIS
 */
 static inline const osm_pkey_tbl_t *osm_physp_get_pkey_tbl(IN const osm_physp_t
-							   * const p_physp)
+							   * p_physp)
 {
 	CL_ASSERT(osm_physp_is_valid(p_physp));
 	/*
@@ -518,7 +534,7 @@ static inline const osm_pkey_tbl_t *osm_physp_get_pkey_tbl(IN const osm_physp_t
 	   further limited by the size of the P_Key table specified by the
 	   PartitionCap on the node.
 	 */
-	return (&p_physp->pkeys);
+	return &p_physp->pkeys;
 };
 
 /*
@@ -544,15 +560,15 @@ static inline const osm_pkey_tbl_t *osm_physp_get_pkey_tbl(IN const osm_physp_t
 *
 * SYNOPSIS
 */
-static inline void
-osm_physp_set_slvl_tbl(IN osm_physp_t * const p_physp,
-		       IN ib_slvl_table_t * p_slvl_tbl, IN uint8_t in_port_num)
+static inline void osm_physp_set_slvl_tbl(IN osm_physp_t * p_physp,
+					  IN ib_slvl_table_t * p_slvl_tbl,
+					  IN uint8_t in_port_num)
 {
 	ib_slvl_table_t *p_tbl;
 
 	CL_ASSERT(p_slvl_tbl);
 	CL_ASSERT(osm_physp_is_valid(p_physp));
-	p_tbl = cl_ptr_vector_get(&p_physp->slvl_by_port, in_port_num);
+	p_tbl = (ib_slvl_table_t *)cl_ptr_vector_get(&p_physp->slvl_by_port, in_port_num);
 	*p_tbl = *p_slvl_tbl;
 }
 
@@ -587,14 +603,14 @@ osm_physp_set_slvl_tbl(IN osm_physp_t * const p_physp,
 * SYNOPSIS
 */
 static inline ib_slvl_table_t *osm_physp_get_slvl_tbl(IN const osm_physp_t *
-						      const p_physp,
+						      p_physp,
 						      IN uint8_t in_port_num)
 {
 	ib_slvl_table_t *p_tbl;
 
 	CL_ASSERT(osm_physp_is_valid(p_physp));
-	p_tbl = cl_ptr_vector_get(&p_physp->slvl_by_port, in_port_num);
-	return (p_tbl);
+	p_tbl = (ib_slvl_table_t *)cl_ptr_vector_get(&p_physp->slvl_by_port, in_port_num);
+	return p_tbl;
 }
 
 /*
@@ -623,9 +639,9 @@ static inline ib_slvl_table_t *osm_physp_get_slvl_tbl(IN const osm_physp_t *
 *
 * SYNOPSIS
 */
-static inline void
-osm_physp_set_vla_tbl(IN osm_physp_t * const p_physp,
-		      IN ib_vl_arb_table_t * p_vla_tbl, IN uint8_t block_num)
+static inline void osm_physp_set_vla_tbl(IN osm_physp_t * p_physp,
+					 IN ib_vl_arb_table_t * p_vla_tbl,
+					 IN uint8_t block_num)
 {
 	CL_ASSERT(p_vla_tbl);
 	CL_ASSERT(osm_physp_is_valid(p_physp));
@@ -664,13 +680,12 @@ osm_physp_set_vla_tbl(IN osm_physp_t * const p_physp,
 *
 * SYNOPSIS
 */
-static inline ib_vl_arb_table_t *osm_physp_get_vla_tbl(IN osm_physp_t *
-						       const p_physp,
+static inline ib_vl_arb_table_t *osm_physp_get_vla_tbl(IN osm_physp_t * p_physp,
 						       IN uint8_t block_num)
 {
 	CL_ASSERT(osm_physp_is_valid(p_physp));
 	CL_ASSERT((1 <= block_num) && (block_num <= 4));
-	return (&(p_physp->vl_arb[block_num - 1]));
+	return &(p_physp->vl_arb[block_num - 1]);
 }
 
 /*
@@ -700,11 +715,10 @@ static inline ib_vl_arb_table_t *osm_physp_get_vla_tbl(IN osm_physp_t *
 *
 * SYNOPSIS
 */
-static inline osm_physp_t *osm_physp_get_remote(IN const osm_physp_t *
-						const p_physp)
+static inline osm_physp_t *osm_physp_get_remote(IN const osm_physp_t * p_physp)
 {
 	CL_ASSERT(osm_physp_is_valid(p_physp));
-	return (p_physp->p_remote_physp);
+	return p_physp->p_remote_physp;
 }
 
 /*
@@ -731,11 +745,10 @@ static inline osm_physp_t *osm_physp_get_remote(IN const osm_physp_t *
 *
 * SYNOPSIS
 */
-static inline ib_net64_t
-osm_physp_get_port_guid(IN const osm_physp_t * const p_physp)
+static inline ib_net64_t osm_physp_get_port_guid(IN const osm_physp_t * p_physp)
 {
 	CL_ASSERT(osm_physp_is_valid(p_physp));
-	return (p_physp->port_guid);
+	return p_physp->port_guid;
 }
 
 /*
@@ -762,10 +775,10 @@ osm_physp_get_port_guid(IN const osm_physp_t * const p_physp)
 * SYNOPSIS
 */
 static inline ib_net64_t
-osm_physp_get_subnet_prefix(IN const osm_physp_t * const p_physp)
+osm_physp_get_subnet_prefix(IN const osm_physp_t * p_physp)
 {
 	CL_ASSERT(osm_physp_is_valid(p_physp));
-	return (p_physp->port_info.subnet_prefix);
+	return p_physp->port_info.subnet_prefix;
 }
 
 /*
@@ -792,9 +805,8 @@ osm_physp_get_subnet_prefix(IN const osm_physp_t * const p_physp)
 *
 * SYNOPSIS
 */
-static inline boolean_t
-osm_physp_link_exists(IN const osm_physp_t * const p_physp,
-		      IN const osm_physp_t * const p_remote_physp)
+static inline boolean_t osm_physp_link_exists(IN const osm_physp_t * p_physp,
+					      IN const osm_physp_t * p_remote_physp)
 {
 	CL_ASSERT(p_physp);
 	CL_ASSERT(osm_physp_is_valid(p_physp));
@@ -831,9 +843,8 @@ osm_physp_link_exists(IN const osm_physp_t * const p_physp,
 *
 * SYNOPSIS
 */
-static inline void
-osm_physp_link(IN osm_physp_t * const p_physp,
-	       IN osm_physp_t * const p_remote_physp)
+static inline void osm_physp_link(IN osm_physp_t * p_physp,
+				  IN osm_physp_t * p_remote_physp)
 {
 	CL_ASSERT(p_physp);
 	CL_ASSERT(p_remote_physp);
@@ -867,9 +878,8 @@ osm_physp_link(IN osm_physp_t * const p_physp,
 *
 * SYNOPSIS
 */
-static inline void
-osm_physp_unlink(IN osm_physp_t * const p_physp,
-		 IN osm_physp_t * const p_remote_physp)
+static inline void osm_physp_unlink(IN osm_physp_t * p_physp,
+				    IN osm_physp_t * p_remote_physp)
 {
 	CL_ASSERT(p_physp);
 	CL_ASSERT(p_remote_physp);
@@ -905,14 +915,13 @@ osm_physp_unlink(IN osm_physp_t * const p_physp,
 *
 * SYNOPSIS
 */
-static inline boolean_t
-osm_physp_has_any_link(IN const osm_physp_t * const p_physp)
+static inline boolean_t osm_physp_has_any_link(IN const osm_physp_t * p_physp)
 {
 	CL_ASSERT(p_physp);
 	if (osm_physp_is_valid(p_physp))
 		return (p_physp->p_remote_physp != NULL);
 	else
-		return (FALSE);
+		return FALSE;
 }
 
 /*
@@ -939,12 +948,11 @@ osm_physp_has_any_link(IN const osm_physp_t * const p_physp)
 *
 * SYNOPSIS
 */
-static inline uint8_t
-osm_physp_get_port_num(IN const osm_physp_t * const p_physp)
+static inline uint8_t osm_physp_get_port_num(IN const osm_physp_t * p_physp)
 {
 	CL_ASSERT(p_physp);
 	CL_ASSERT(osm_physp_is_valid(p_physp));
-	return (p_physp->port_num);
+	return p_physp->port_num;
 }
 
 /*
@@ -970,11 +978,11 @@ osm_physp_get_port_num(IN const osm_physp_t * const p_physp)
 * SYNOPSIS
 */
 static inline struct osm_node *osm_physp_get_node_ptr(IN const osm_physp_t *
-						       const p_physp)
+						       p_physp)
 {
 	CL_ASSERT(p_physp);
 	CL_ASSERT(osm_physp_is_valid(p_physp));
-	return ((struct osm_node *)p_physp->p_node);
+	return p_physp->p_node;
 }
 
 /*
@@ -999,12 +1007,11 @@ static inline struct osm_node *osm_physp_get_node_ptr(IN const osm_physp_t *
 *
 * SYNOPSIS
 */
-static inline uint8_t
-osm_physp_get_port_state(IN const osm_physp_t * const p_physp)
+static inline uint8_t osm_physp_get_port_state(IN const osm_physp_t * p_physp)
 {
 	CL_ASSERT(p_physp);
 	CL_ASSERT(osm_physp_is_valid(p_physp));
-	return (ib_port_info_get_port_state(&p_physp->port_info));
+	return ib_port_info_get_port_state(&p_physp->port_info);
 }
 
 /*
@@ -1029,12 +1036,11 @@ osm_physp_get_port_state(IN const osm_physp_t * const p_physp)
 *
 * SYNOPSIS
 */
-static inline ib_net16_t
-osm_physp_get_base_lid(IN const osm_physp_t * const p_physp)
+static inline ib_net16_t osm_physp_get_base_lid(IN const osm_physp_t * p_physp)
 {
 	CL_ASSERT(p_physp);
 	CL_ASSERT(osm_physp_is_valid(p_physp));
-	return (p_physp->port_info.base_lid);
+	return p_physp->port_info.base_lid;
 }
 
 /*
@@ -1059,11 +1065,11 @@ osm_physp_get_base_lid(IN const osm_physp_t * const p_physp)
 *
 * SYNOPSIS
 */
-static inline uint8_t osm_physp_get_lmc(IN const osm_physp_t * const p_physp)
+static inline uint8_t osm_physp_get_lmc(IN const osm_physp_t * p_physp)
 {
 	CL_ASSERT(p_physp);
 	CL_ASSERT(osm_physp_is_valid(p_physp));
-	return (ib_port_info_get_lmc(&p_physp->port_info));
+	return ib_port_info_get_lmc(&p_physp->port_info);
 }
 
 /*
@@ -1089,11 +1095,11 @@ static inline uint8_t osm_physp_get_lmc(IN const osm_physp_t * const p_physp)
 * SYNOPSIS
 */
 static inline osm_dr_path_t *osm_physp_get_dr_path_ptr(IN const osm_physp_t *
-						       const p_physp)
+							p_physp)
 {
 	CL_ASSERT(p_physp);
 	CL_ASSERT(osm_physp_is_valid(p_physp));
-	return ((osm_dr_path_t *) & p_physp->dr_path);
+	return (osm_dr_path_t *) & p_physp->dr_path;
 }
 
 /*
@@ -1140,7 +1146,7 @@ static inline osm_dr_path_t *osm_physp_get_dr_path_ptr(IN const osm_physp_t *
 *	osm_port_t
 *
 * DESCRIPTION
-*	This object represents a logical port on a switch, router or end-point.
+*	This object represents a logical port on a switch, router, or CA.
 *
 *	The osm_port_t object should be treated as opaque and should
 *	be manipulated only through the provided functions.
@@ -1165,7 +1171,8 @@ typedef struct osm_port {
 *		Linkage structure for cl_qmap.  MUST BE FIRST MEMBER!
 *
 *	list_item
-*		Linkage structure for cl_qlist. Used by ucast mgr during LFT calculation.
+*		Linkage structure for cl_qlist. Used by ucast mgr during
+*		LFT calculation.
 *
 *	p_node
 *		Points to the Node object that owns this port.
@@ -1201,7 +1208,7 @@ typedef struct osm_port {
 *
 * SYNOPSIS
 */
-void osm_port_delete(IN OUT osm_port_t ** const pp_port);
+void osm_port_delete(IN OUT osm_port_t ** pp_port);
 /*
 * PARAMETERS
 *	pp_port
@@ -1228,11 +1235,11 @@ void osm_port_delete(IN OUT osm_port_t ** const pp_port);
 * SYNOPSIS
 */
 osm_port_t *osm_port_new(IN const ib_node_info_t * p_ni,
-			 IN struct osm_node *const p_parent_node);
+			 IN struct osm_node *p_parent_node);
 /*
 * PARAMETERS
 *	p_ni
-*		[in] Pointer to the NodeInfo attribute relavent for this port.
+*		[in] Pointer to the NodeInfo attribute relevant for this port.
 *
 *	p_parent_node
 *		[in] Pointer to the initialized parent osm_node_t object
@@ -1257,11 +1264,10 @@ osm_port_t *osm_port_new(IN const ib_node_info_t * p_ni,
 *
 * SYNOPSIS
 */
-static inline ib_net16_t
-osm_port_get_base_lid(IN const osm_port_t * const p_port)
+static inline ib_net16_t osm_port_get_base_lid(IN const osm_port_t * p_port)
 {
 	CL_ASSERT(p_port->p_physp && osm_physp_is_valid(p_port->p_physp));
-	return (osm_physp_get_base_lid(p_port->p_physp));
+	return osm_physp_get_base_lid(p_port->p_physp);
 }
 
 /*
@@ -1288,10 +1294,10 @@ osm_port_get_base_lid(IN const osm_port_t * const p_port)
 *
 * SYNOPSIS
 */
-static inline uint8_t osm_port_get_lmc(IN const osm_port_t * const p_port)
+static inline uint8_t osm_port_get_lmc(IN const osm_port_t * p_port)
 {
 	CL_ASSERT(p_port->p_physp && osm_physp_is_valid(p_port->p_physp));
-	return (osm_physp_get_lmc(p_port->p_physp));
+	return osm_physp_get_lmc(p_port->p_physp);
 }
 
 /*
@@ -1317,9 +1323,9 @@ static inline uint8_t osm_port_get_lmc(IN const osm_port_t * const p_port)
 *
 * SYNOPSIS
 */
-static inline ib_net64_t osm_port_get_guid(IN const osm_port_t * const p_port)
+static inline ib_net64_t osm_port_get_guid(IN const osm_port_t * p_port)
 {
-	return (p_port->guid);
+	return p_port->guid;
 }
 
 /*
@@ -1346,10 +1352,9 @@ static inline ib_net64_t osm_port_get_guid(IN const osm_port_t * const p_port)
 *
 * SYNOPSIS
 */
-void
-osm_port_get_lid_range_ho(IN const osm_port_t * const p_port,
-			  OUT uint16_t * const p_min_lid,
-			  OUT uint16_t * const p_max_lid);
+void osm_port_get_lid_range_ho(IN const osm_port_t * p_port,
+			       OUT uint16_t * p_min_lid,
+			       OUT uint16_t * p_max_lid);
 /*
 * PARAMETERS
 *	p_port
@@ -1370,221 +1375,199 @@ osm_port_get_lid_range_ho(IN const osm_port_t * const p_port,
 *	Port
 *********/
 
-/****f* OpenSM: Port/osm_get_port_by_base_lid
+/****f* OpenSM: Physical Port/osm_physp_calc_link_mtu
 * NAME
-*	osm_get_port_by_base_lid
+*	osm_physp_calc_link_mtu
 *
 * DESCRIPTION
-*	Returns a status on whether a Port was able to be
-*	determined based on the LID supplied and if so, return the Port.
+*	Calculate the Port MTU based on current and remote
+*  physical ports MTU CAP values.
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_get_port_by_base_lid(IN const osm_subn_t * const p_subn,
-			 IN const ib_net16_t lid,
-			 IN OUT const osm_port_t ** const pp_port);
+uint8_t osm_physp_calc_link_mtu(IN osm_log_t * p_log,
+				IN const osm_physp_t * p_physp,
+				IN uint8_t current_mtu);
 /*
 * PARAMETERS
-*	p_subn
-*		[in] Pointer to the subnet data structure.
+*	p_log
+*		[in] Pointer to a log object.
 *
-*	lid
-*		[in] LID requested.
+*	p_physp
+*		[in] Pointer to an osm_physp_t object.
 *
-*	pp_port
-*		[in][out] Pointer to pointer to Port object.
+*	current_mtu
+*		[in] Current neighbor mtu on this port
 *
 * RETURN VALUES
-*	IB_SUCCESS
-*	IB_NOT_FOUND
+*	The MTU of the link to be used.
 *
 * NOTES
 *
 * SEE ALSO
-*       Port
+*	PhysPort object
 *********/
 
-/****f* OpenSM: Port/osm_port_add_mgrp
+/****f* OpenSM: Physical Port/osm_physp_calc_link_op_vls
 * NAME
-*	osm_port_add_mgrp
+*	osm_physp_calc_link_op_vls
 *
 * DESCRIPTION
-*	Logically connects a port to a multicast group.
+*	Calculate the Port OP_VLS based on current and remote
+*  physical ports VL CAP values. Allowing user option for a max limit.
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_port_add_mgrp(IN osm_port_t * const p_port, IN const ib_net16_t mlid);
+uint8_t osm_physp_calc_link_op_vls(IN osm_log_t * p_log,
+				   IN const osm_subn_t * p_subn,
+				   IN const osm_physp_t * p_physp,
+				   IN uint8_t current_op_vls);
 /*
 * PARAMETERS
-*	p_port
-*		[in] Pointer to an osm_port_t object.
+*	p_log
+*		[in] Pointer to a log object.
 *
-*	mlid
-*		[in] MLID of the multicast group.
+*	p_subn
+*		[in] Pointer to the subnet object for accessing of the options.
+*
+*	p_physp
+*		[in] Pointer to an osm_physp_t object.
+*
+*	current_op_vls
+*		[in] Current operational VL on the port
 *
 * RETURN VALUES
-*	IB_SUCCESS
-*	IB_INSUFFICIENT_MEMORY
+*	The OP_VLS of the link to be used.
 *
 * NOTES
 *
 * SEE ALSO
-*	Port object
+*  PhysPort object
 *********/
 
-/****f* OpenSM: Port/osm_port_remove_mgrp
+/****f* OpenSM: Physical Port/osm_physp_replace_dr_path_with_alternate_dr_path
 * NAME
-*	osm_port_remove_mgrp
+*	osm_physp_replace_dr_path_with_alternate_dr_path
 *
 * DESCRIPTION
-*	Logically disconnects a port from a multicast group.
+*	Replace the direct route path for the given phys port with an
+*  alternate path going through forien set of phys port.
 *
 * SYNOPSIS
 */
 void
-osm_port_remove_mgrp(IN osm_port_t * const p_port, IN const ib_net16_t mlid);
+osm_physp_replace_dr_path_with_alternate_dr_path(IN osm_log_t * p_log,
+						 IN osm_subn_t const *p_subn,
+						 IN osm_physp_t const *p_physp,
+						 IN osm_bind_handle_t * h_bind);
 /*
 * PARAMETERS
-*	p_port
-*		[in] Pointer to an osm_port_t object.
-*
-*	mlid
-*		[in] MLID of the multicast group.
-*
-* RETURN VALUES
-*	None.
-*
-* NOTES
+*	p_log
+*		[in] Pointer to a log object.
 *
-* SEE ALSO
-*	Port object
-*********/
-
-/****f* OpenSM: Port/osm_port_remove_all_mgrp
-* NAME
-*	osm_port_remove_all_mgrp
+*	p_subn
+*		[in] Pointer to the subnet object for accessing of the options.
 *
-* DESCRIPTION
-*	Logically disconnects a port from all its multicast groups.
+*	p_physp
+*		[in] Pointer to an osm_physp_t object.
 *
-* SYNOPSIS
-*/
-void osm_port_remove_all_mgrp(IN osm_port_t * const p_port);
-/*
-* PARAMETERS
-*	p_port
-*		[in] Pointer to an osm_port_t object.
+*	h_bind
+*		[in] Pointer to osm_bind_handle_t object.
 *
 * RETURN VALUES
-*	None.
+*	NONE
 *
 * NOTES
 *
 * SEE ALSO
-*	Port object
+*	PhysPort object
 *********/
 
-/****f* OpenSM: Physical Port/osm_physp_calc_link_mtu
+/****s* OpenSM: Port/osm_alias_guid_t
 * NAME
-*	osm_physp_calc_link_mtu
+*	osm_alias_guid_t
 *
 * DESCRIPTION
-*	Calculate the Port MTU based on current and remote
-*  physical ports MTU CAP values.
+*	This object represents an alias guid for an endport.
+*
+*	The osm_alias_guid_t object should be treated as opaque and should
+*	be manipulated only through the provided functions.
 *
 * SYNOPSIS
 */
-uint8_t
-osm_physp_calc_link_mtu(IN osm_log_t * p_log, IN const osm_physp_t * p_physp);
+typedef struct osm_alias_guid {
+	cl_map_item_t map_item;
+	ib_net64_t alias_guid;
+	osm_port_t *p_base_port;
+} osm_alias_guid_t;
 /*
-* PARAMETERS
-*	p_log
-*		[in] Pointer to a log object.
-*
-*	p_physp
-*		[in] Pointer to an osm_physp_t object.
+* FIELDS
+*	map_item
+*		Linkage structure for cl_qmap.  MUST BE FIRST MEMBER!
 *
-* RETURN VALUES
-*	The MTU of the link to be used.
+*	alias_guid
+*		Alias GUID for port obtained from SM GUIDInfo attribute
 *
-* NOTES
+*	p_base_port
+*		Pointer to osm_port_t for base port GUID
 *
 * SEE ALSO
-*	PhysPort object
-*********/
+*	Port, Physical Port, Physical Port Table
+*/
 
-/****f* OpenSM: Physical Port/osm_physp_calc_link_op_vls
+/****f* OpenSM: Port/osm_alias_guid_new
 * NAME
-*	osm_physp_calc_link_op_vls
+*	osm_alias_guid_new
 *
 * DESCRIPTION
-*	Calculate the Port OP_VLS based on current and remote
-*  physical ports VL CAP values. Allowing user option for a max limit.
+*	This function allocates and initializes an alias guid object.
 *
 * SYNOPSIS
 */
-uint8_t
-osm_physp_calc_link_op_vls(IN osm_log_t * p_log,
-			   IN const osm_subn_t * p_subn,
-			   IN const osm_physp_t * p_physp);
+osm_alias_guid_t *osm_alias_guid_new(IN const ib_net64_t alias_guid,
+				     IN osm_port_t *p_base_port);
 /*
 * PARAMETERS
-*	p_log
-*		[in] Pointer to a log object.
-*
-*	p_subn
-*		[in] Pointer to the subnet object for accessing of the options.
+*	alias_guid
+*		[in] Alias GUID in network order
 *
-*	p_physp
-*		[in] Pointer to an osm_physp_t object.
+*	p_base_port
+*		[in] Pointer to the port for this base GUID
 *
-* RETURN VALUES
-*	The OP_VLS of the link to be used.
+* RETURN VALUE
+*	Pointer to the initialized alias guid object.
 *
 * NOTES
+*	Allows calling other alias guid methods.
 *
 * SEE ALSO
-*  PhysPort object
+*	Port
 *********/
 
-/****f* OpenSM: Physical Port/osm_physp_replace_dr_path_with_alternate_dr_path
+/****f* OpenSM: Port/osm_alias_guid_delete
 * NAME
-*	osm_physp_replace_dr_path_with_alternate_dr_path
+*	osm_alias_guid_delete
 *
 * DESCRIPTION
-*	Replace the direct route path for the given phys port with an
-*  alternate path going through forien set of phys port.
+*	This function destroys and deallocates an alias guid object.
 *
 * SYNOPSIS
 */
-void
-osm_physp_replace_dr_path_with_alternate_dr_path(IN osm_log_t * p_log,
-						 IN osm_subn_t const *p_subn,
-						 IN osm_physp_t const *p_physp,
-						 IN osm_bind_handle_t * h_bind);
+void osm_alias_guid_delete(IN OUT osm_alias_guid_t ** pp_alias_guid);
 /*
 * PARAMETERS
-*	p_log
-*		[in] Pointer to a log object.
-*
-*	p_subn
-*		[in] Pointer to the subnet object for accessing of the options.
-*
-*	p_physp
-*		[in] Pointer to an osm_physp_t object.
-*
-*	h_bind
-*		[in] Pointer to osm_bind_handle_t object.
+*	pp_alias_guid
+*		[in][out] Pointer to a pointer to an alias guid object to delete.
+*		On return, this pointer is NULL.
 *
-* RETURN VALUES
-*	NONE
+* RETURN VALUE
+*	This function does not return a value.
 *
 * NOTES
+*	Performs any necessary cleanup of the specified alias guid object.
 *
 * SEE ALSO
-*	PhysPort object
+*	Port
 *********/
 
 END_C_DECLS
diff --git a/include/opensm/osm_port_profile.h b/include/opensm/osm_port_profile.h
index fd22719..dc5b426 100644
--- a/include/opensm/osm_port_profile.h
+++ b/include/opensm/osm_port_profile.h
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved.
  *
@@ -129,7 +129,7 @@ typedef long osm_port_mask_t[32 / sizeof(long)];
 *
 * SYNOPSIS
 */
-static inline void osm_port_prof_construct(IN osm_port_profile_t * const p_prof)
+static inline void osm_port_prof_construct(IN osm_port_profile_t * p_prof)
 {
 	CL_ASSERT(p_prof);
 	memset(p_prof, 0, sizeof(*p_prof));
@@ -157,8 +157,7 @@ static inline void osm_port_prof_construct(IN osm_port_profile_t * const p_prof)
 *
 * SYNOPSIS
 */
-static inline void
-osm_port_prof_path_count_inc(IN osm_port_profile_t * const p_prof)
+static inline void osm_port_prof_path_count_inc(IN osm_port_profile_t * p_prof)
 {
 	CL_ASSERT(p_prof);
 	p_prof->num_paths++;
@@ -186,9 +185,9 @@ osm_port_prof_path_count_inc(IN osm_port_profile_t * const p_prof)
 * SYNOPSIS
 */
 static inline uint32_t
-osm_port_prof_path_count_get(IN const osm_port_profile_t * const p_prof)
+osm_port_prof_path_count_get(IN const osm_port_profile_t * p_prof)
 {
-	return (p_prof->num_paths);
+	return p_prof->num_paths;
 }
 /*
 * PARAMETERS
diff --git a/include/opensm/osm_qos_policy.h b/include/opensm/osm_qos_policy.h
index c38624b..53d56cd 100644
--- a/include/opensm/osm_qos_policy.h
+++ b/include/opensm/osm_qos_policy.h
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -172,7 +172,8 @@ boolean_t osm_qos_level_has_pkey(IN const osm_qos_level_t * p_qos_level,
 
 ib_net16_t osm_qos_level_get_shared_pkey(IN const osm_qos_level_t * p_qos_level,
 					 IN const osm_physp_t * p_src_physp,
-					 IN const osm_physp_t * p_dest_physp);
+					 IN const osm_physp_t * p_dest_physp,
+					 IN const boolean_t allow_both_pkeys);
 
 osm_qos_match_rule_t * osm_qos_policy_match_rule_create();
 void osm_qos_policy_match_rule_destroy(osm_qos_match_rule_t * p_match_rule);
@@ -197,7 +198,7 @@ osm_qos_level_t * osm_qos_policy_get_qos_level_by_mpr(
 
 /***************************************************/
 
-int osm_qos_parse_policy_file(IN osm_subn_t * const p_subn);
+int osm_qos_parse_policy_file(IN osm_subn_t * p_subn);
 
 /***************************************************/
 
diff --git a/include/opensm/osm_remote_sm.h b/include/opensm/osm_remote_sm.h
index 4cc980b..e7d52fa 100644
--- a/include/opensm/osm_remote_sm.h
+++ b/include/opensm/osm_remote_sm.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -87,7 +87,6 @@ BEGIN_C_DECLS
 */
 typedef struct osm_remote_sm {
 	cl_map_item_t map_item;
-	const osm_port_t *p_port;
 	ib_sm_info_t smi;
 } osm_remote_sm_t;
 /*
@@ -112,7 +111,7 @@ typedef struct osm_remote_sm {
 *
 * SYNOPSIS
 */
-void osm_remote_sm_construct(IN osm_remote_sm_t * const p_sm);
+void osm_remote_sm_construct(IN osm_remote_sm_t * p_sm);
 /*
 * PARAMETERS
 *	p_sm
@@ -141,7 +140,7 @@ void osm_remote_sm_construct(IN osm_remote_sm_t * const p_sm);
 *
 * SYNOPSIS
 */
-void osm_remote_sm_destroy(IN osm_remote_sm_t * const p_sm);
+void osm_remote_sm_destroy(IN osm_remote_sm_t * p_sm);
 /*
 * PARAMETERS
 *	p_sm
@@ -169,10 +168,7 @@ void osm_remote_sm_destroy(IN osm_remote_sm_t * const p_sm);
 *
 * SYNOPSIS
 */
-void
-osm_remote_sm_init(IN osm_remote_sm_t * const p_sm,
-		   IN const osm_port_t * const p_port,
-		   IN const ib_sm_info_t * const p_smi);
+void osm_remote_sm_init(IN osm_remote_sm_t * p_sm, IN const ib_sm_info_t * p_smi);
 /*
 * PARAMETERS
 *	p_sm
diff --git a/include/opensm/osm_router.h b/include/opensm/osm_router.h
index 4901aca..b551221 100644
--- a/include/opensm/osm_router.h
+++ b/include/opensm/osm_router.h
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -116,7 +116,7 @@ typedef struct osm_router {
 *
 * SYNOPSIS
 */
-void osm_router_delete(IN OUT osm_router_t ** const pp_rtr);
+void osm_router_delete(IN OUT osm_router_t ** pp_rtr);
 /*
 * PARAMETERS
 *	p_rtr
@@ -140,7 +140,7 @@ void osm_router_delete(IN OUT osm_router_t ** const pp_rtr);
 *
 * SYNOPSIS
 */
-osm_router_t *osm_router_new(IN osm_port_t * const p_port);
+osm_router_t *osm_router_new(IN osm_port_t * p_port);
 /*
 * PARAMETERS
 *	p_node
@@ -164,10 +164,9 @@ osm_router_t *osm_router_new(IN osm_port_t * const p_port);
 *
 * SYNOPSIS
 */
-static inline osm_port_t *osm_router_get_port_ptr(IN const osm_router_t *
-						  const p_rtr)
+static inline osm_port_t *osm_router_get_port_ptr(IN const osm_router_t * p_rtr)
 {
-	return (p_rtr->p_port);
+	return p_rtr->p_port;
 }
 
 /*
@@ -193,10 +192,9 @@ static inline osm_port_t *osm_router_get_port_ptr(IN const osm_router_t *
 *
 * SYNOPSIS
 */
-static inline osm_node_t *osm_router_get_node_ptr(IN const osm_router_t *
-						  const p_rtr)
+static inline osm_node_t *osm_router_get_node_ptr(IN const osm_router_t * p_rtr)
 {
-	return (p_rtr->p_port->p_node);
+	return p_rtr->p_port->p_node;
 }
 
 /*
diff --git a/include/opensm/osm_sa.h b/include/opensm/osm_sa.h
index 5a0ae9f..7c1061d 100644
--- a/include/opensm/osm_sa.h
+++ b/include/opensm/osm_sa.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -125,6 +125,7 @@ typedef struct osm_sa {
 	atomic32_t sa_trans_id;
 	osm_sa_mad_ctrl_t mad_ctrl;
 	cl_timer_t sr_timer;
+	boolean_t dirty;
 	cl_disp_reg_handle_t cpi_disp_h;
 	cl_disp_reg_handle_t nr_disp_h;
 	cl_disp_reg_handle_t pir_disp_h;
@@ -178,6 +179,10 @@ typedef struct osm_sa {
 *	mad_ctrl
 *		Mad Controller
 *
+*	dirty
+*		A flag that denotes that SA DB is dirty and needs
+*		to be written to the dump file (if dumping is enabled)
+*
 * SEE ALSO
 *	SM object
 *********/
@@ -191,7 +196,7 @@ typedef struct osm_sa {
 *
 * SYNOPSIS
 */
-void osm_sa_construct(IN osm_sa_t * const p_sa);
+void osm_sa_construct(IN osm_sa_t * p_sa);
 /*
 * PARAMETERS
 *	p_sa
@@ -220,7 +225,7 @@ void osm_sa_construct(IN osm_sa_t * const p_sa);
 *
 * SYNOPSIS
 */
-void osm_sa_shutdown(IN osm_sa_t * const p_sa);
+void osm_sa_shutdown(IN osm_sa_t * p_sa);
 /*
 * PARAMETERS
 *	p_sa
@@ -243,7 +248,7 @@ void osm_sa_shutdown(IN osm_sa_t * const p_sa);
 *
 * SYNOPSIS
 */
-void osm_sa_destroy(IN osm_sa_t * const p_sa);
+void osm_sa_destroy(IN osm_sa_t * p_sa);
 /*
 * PARAMETERS
 *	p_sa
@@ -271,15 +276,12 @@ void osm_sa_destroy(IN osm_sa_t * const p_sa);
 *
 * SYNOPSIS
 */
-ib_api_status_t osm_sa_init(IN osm_sm_t * const p_sm,
-			    IN osm_sa_t * const p_sa,
-			    IN osm_subn_t * const p_subn,
-			    IN osm_vendor_t * const p_vendor,
-			    IN osm_mad_pool_t * const p_mad_pool,
-			    IN osm_log_t * const p_log,
-			    IN osm_stats_t * const p_stats,
-			    IN cl_dispatcher_t * const p_disp,
-			    IN cl_plock_t * const p_lock);
+ib_api_status_t osm_sa_init(IN osm_sm_t * p_sm, IN osm_sa_t * p_sa,
+			    IN osm_subn_t * p_subn, IN osm_vendor_t * p_vendor,
+			    IN osm_mad_pool_t * p_mad_pool,
+			    IN osm_log_t * p_log, IN osm_stats_t * p_stats,
+			    IN cl_dispatcher_t * p_disp,
+			    IN cl_plock_t * p_lock);
 /*
 * PARAMETERS
 *	p_sa
@@ -325,8 +327,7 @@ ib_api_status_t osm_sa_init(IN osm_sm_t * const p_sm,
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_sa_bind(IN osm_sa_t * const p_sa, IN const ib_net64_t port_guid);
+ib_api_status_t osm_sa_bind(IN osm_sa_t * p_sa, IN ib_net64_t port_guid);
 /*
 * PARAMETERS
 *	p_sa
@@ -354,8 +355,8 @@ osm_sa_bind(IN osm_sa_t * const p_sa, IN const ib_net64_t port_guid);
 *
 * SYNOPSIS
 */
-ib_api_status_t osm_sa_send(osm_sa_t *sa, IN osm_madw_t * const p_madw,
-			    IN boolean_t const resp_expected);
+ib_api_status_t osm_sa_send(osm_sa_t *sa, IN osm_madw_t * p_madw,
+			    IN boolean_t resp_expected);
 
 /****f* IBA Base: Types/osm_sa_send_error
 * NAME
@@ -367,8 +368,8 @@ ib_api_status_t osm_sa_send(osm_sa_t *sa, IN osm_madw_t * const p_madw,
 *
 * SYNOPSIS
 */
-void osm_sa_send_error(IN osm_sa_t * sa, IN const osm_madw_t * const p_madw,
-		       IN const ib_net16_t sa_status);
+void osm_sa_send_error(IN osm_sa_t * sa, IN const osm_madw_t * p_madw,
+		       IN ib_net16_t sa_status);
 /*
 * PARAMETERS
 *	sa
@@ -435,7 +436,9 @@ int osm_sa_db_file_dump(struct osm_opensm *p_osm);
 *		[in] Pointer to an osm_opensm_t object.
 *
 * RETURN VALUES
-*	None
+*	 0 if the SA DB was actually dumped
+*	>0 if there was no need to dump the SA DB
+*	<0 if some error occurred.
 *
 *********/
 
@@ -469,28 +472,23 @@ int osm_sa_db_file_load(struct osm_opensm *p_osm);
 * SYNOPSIS
 */
 
-ib_api_status_t
-osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_sa_t * sa,
-				     IN uint64_t comp_mask,
-				     IN ib_member_rec_t *
-				     const p_recvd_mcmember_rec,
-				     OUT osm_mgrp_t ** pp_mgrp);
+osm_mgrp_t *osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_sa_t * sa,
+						 IN ib_net64_t comp_mask,
+						 IN ib_member_rec_t *
+						 p_recvd_mcmember_rec);
 /*
 * PARAMETERS
 *	p_sa
 *		[in] Pointer to an osm_sa_t object.
+*	comp_mask
+*		[in] SA query component mask
 *	p_recvd_mcmember_rec
 *		[in] Received Multicast member record
 *
-*	pp_mgrp
-*		[out] pointer the osm_mgrp_t object
-*
 * RETURN VALUES
-*	IB_SUCCESS, IB_ERROR
+*	The pointer to MC group object found or created, NULL in case of errors
 *
 *********/
 
-osm_mgrp_t *osm_get_mgrp_by_mgid(IN osm_sa_t * sa, IN ib_gid_t * p_mgid);
-
 END_C_DECLS
 #endif				/* _OSM_SA_H_ */
diff --git a/include/opensm/osm_sa_mad_ctrl.h b/include/opensm/osm_sa_mad_ctrl.h
index cc2ac53..00ccbf6 100644
--- a/include/opensm/osm_sa_mad_ctrl.h
+++ b/include/opensm/osm_sa_mad_ctrl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -142,7 +142,7 @@ typedef struct osm_sa_mad_ctrl {
 *
 * SYNOPSIS
 */
-void osm_sa_mad_ctrl_construct(IN osm_sa_mad_ctrl_t * const p_ctrl);
+void osm_sa_mad_ctrl_construct(IN osm_sa_mad_ctrl_t * p_ctrl);
 /*
 * PARAMETERS
 *	p_ctrl
@@ -173,7 +173,7 @@ void osm_sa_mad_ctrl_construct(IN osm_sa_mad_ctrl_t * const p_ctrl);
 *
 * SYNOPSIS
 */
-void osm_sa_mad_ctrl_destroy(IN osm_sa_mad_ctrl_t * const p_ctrl);
+void osm_sa_mad_ctrl_destroy(IN osm_sa_mad_ctrl_t * p_ctrl);
 /*
 * PARAMETERS
 *	p_ctrl
@@ -204,14 +204,14 @@ void osm_sa_mad_ctrl_destroy(IN osm_sa_mad_ctrl_t * const p_ctrl);
 *
 * SYNOPSIS
 */
-ib_api_status_t osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * const p_ctrl,
+ib_api_status_t osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * p_ctrl,
 				     IN struct osm_sa * sa,
-				     IN osm_mad_pool_t * const p_mad_pool,
-				     IN osm_vendor_t * const p_vendor,
-				     IN osm_subn_t * const p_subn,
-				     IN osm_log_t * const p_log,
-				     IN osm_stats_t * const p_stats,
-				     IN cl_dispatcher_t * const p_disp);
+				     IN osm_mad_pool_t * p_mad_pool,
+				     IN osm_vendor_t * p_vendor,
+				     IN osm_subn_t * p_subn,
+				     IN osm_log_t * p_log,
+				     IN osm_stats_t * p_stats,
+				     IN cl_dispatcher_t * p_disp);
 /*
 * PARAMETERS
 *	p_ctrl
@@ -256,9 +256,8 @@ ib_api_status_t osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * const p_ctrl,
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_sa_mad_ctrl_bind(IN osm_sa_mad_ctrl_t * const p_ctrl,
-		     IN const ib_net64_t port_guid);
+ib_api_status_t osm_sa_mad_ctrl_bind(IN osm_sa_mad_ctrl_t * p_ctrl,
+				     IN ib_net64_t port_guid);
 /*
 * PARAMETERS
 *	p_ctrl
@@ -287,7 +286,7 @@ osm_sa_mad_ctrl_bind(IN osm_sa_mad_ctrl_t * const p_ctrl,
 *
 * SYNOPSIS
 */
-ib_api_status_t osm_sa_mad_ctrl_unbind(IN osm_sa_mad_ctrl_t * const p_ctrl);
+ib_api_status_t osm_sa_mad_ctrl_unbind(IN osm_sa_mad_ctrl_t * p_ctrl);
 /*
 * PARAMETERS
 *	p_ctrl
@@ -313,9 +312,9 @@ ib_api_status_t osm_sa_mad_ctrl_unbind(IN osm_sa_mad_ctrl_t * const p_ctrl);
 * SYNOPSIS
 */
 static inline osm_bind_handle_t
-osm_sa_mad_ctrl_get_bind_handle(IN const osm_sa_mad_ctrl_t * const p_ctrl)
+osm_sa_mad_ctrl_get_bind_handle(IN const osm_sa_mad_ctrl_t * p_ctrl)
 {
-	return (p_ctrl->h_bind);
+	return p_ctrl->h_bind;
 }
 
 /*
diff --git a/include/opensm/osm_service.h b/include/opensm/osm_service.h
index 1d97a68..446b888 100644
--- a/include/opensm/osm_service.h
+++ b/include/opensm/osm_service.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -146,9 +146,8 @@ osm_svcr_t *osm_svcr_new(IN const ib_service_record_t * p_svc_rec);
 *
 * SYNOPSIS
 */
-void
-osm_svcr_init(IN osm_svcr_t * const p_svcr,
-	      IN const ib_service_record_t * p_svc_rec);
+void osm_svcr_init(IN osm_svcr_t * p_svcr,
+		   IN const ib_service_record_t * p_svc_rec);
 /*
 * PARAMETERS
 *	p_svc_rec
@@ -169,7 +168,7 @@ osm_svcr_init(IN osm_svcr_t * const p_svcr,
 *
 * SYNOPSIS
 */
-void osm_svcr_delete(IN osm_svcr_t * const p_svcr);
+void osm_svcr_delete(IN osm_svcr_t * p_svcr);
 /*
 * PARAMETERS
 *	p_svc_rec
@@ -181,14 +180,12 @@ void osm_svcr_delete(IN osm_svcr_t * const p_svcr);
 
 osm_svcr_t *osm_svcr_get_by_rid(IN osm_subn_t const *p_subn,
 				IN osm_log_t * p_log,
-				IN ib_service_record_t * const p_svc_rec);
+				IN ib_service_record_t * p_svc_rec);
 
-void
-osm_svcr_insert_to_db(IN osm_subn_t * p_subn,
-		      IN osm_log_t * p_log, IN osm_svcr_t * p_svcr);
-void
-osm_svcr_remove_from_db(IN osm_subn_t * p_subn,
-			IN osm_log_t * p_log, IN osm_svcr_t * p_svcr);
+void osm_svcr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
+			   IN osm_svcr_t * p_svcr);
+void osm_svcr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
+			     IN osm_svcr_t * p_svcr);
 
 END_C_DECLS
 #endif				/* _OSM_SVCR_H_ */
diff --git a/include/opensm/osm_sm.h b/include/opensm/osm_sm.h
index ebe3dc3..710d206 100644
--- a/include/opensm/osm_sm.h
+++ b/include/opensm/osm_sm.h
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -61,6 +61,7 @@
 #include <opensm/osm_port.h>
 #include <opensm/osm_db.h>
 #include <opensm/osm_remote_sm.h>
+#include <opensm/osm_multicast.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -125,14 +126,16 @@ typedef struct osm_sm {
 	cl_dispatcher_t *p_disp;
 	cl_plock_t *p_lock;
 	atomic32_t sm_trans_id;
-	cl_spinlock_t mgrp_lock;
-	cl_qlist_t mgrp_list;
+	uint16_t mlids_init_max;
+	unsigned mlids_req_max;
+	uint8_t *mlids_req;
 	osm_sm_mad_ctrl_t mad_ctrl;
 	osm_lid_mgr_t lid_mgr;
 	osm_ucast_mgr_t ucast_mgr;
 	cl_disp_reg_handle_t sweep_fail_disp_h;
 	cl_disp_reg_handle_t ni_disp_h;
 	cl_disp_reg_handle_t pi_disp_h;
+	cl_disp_reg_handle_t gi_disp_h;
 	cl_disp_reg_handle_t nd_disp_h;
 	cl_disp_reg_handle_t si_disp_h;
 	cl_disp_reg_handle_t lft_disp_h;
@@ -142,6 +145,7 @@ typedef struct osm_sm {
 	cl_disp_reg_handle_t slvl_disp_h;
 	cl_disp_reg_handle_t vla_disp_h;
 	cl_disp_reg_handle_t pkey_disp_h;
+	cl_disp_reg_handle_t mlnx_epi_disp_h;
 } osm_sm_t;
 /*
 * FIELDS
@@ -185,7 +189,7 @@ typedef struct osm_sm {
 *
 * SYNOPSIS
 */
-void osm_sm_construct(IN osm_sm_t * const p_sm);
+void osm_sm_construct(IN osm_sm_t * p_sm);
 /*
 * PARAMETERS
 *	p_sm
@@ -214,7 +218,7 @@ void osm_sm_construct(IN osm_sm_t * const p_sm);
 *
 * SYNOPSIS
 */
-void osm_sm_shutdown(IN osm_sm_t * const p_sm);
+void osm_sm_shutdown(IN osm_sm_t * p_sm);
 /*
 * PARAMETERS
 *	p_sm
@@ -237,7 +241,7 @@ void osm_sm_shutdown(IN osm_sm_t * const p_sm);
 *
 * SYNOPSIS
 */
-void osm_sm_destroy(IN osm_sm_t * const p_sm);
+void osm_sm_destroy(IN osm_sm_t * p_sm);
 /*
 * PARAMETERS
 *	p_sm
@@ -265,16 +269,12 @@ void osm_sm_destroy(IN osm_sm_t * const p_sm);
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_sm_init(IN osm_sm_t * const p_sm,
-	    IN osm_subn_t * const p_subn,
-	    IN osm_db_t * const p_db,
-	    IN osm_vendor_t * const p_vendor,
-	    IN osm_mad_pool_t * const p_mad_pool,
-	    IN osm_vl15_t * const p_vl15,
-	    IN osm_log_t * const p_log,
-	    IN osm_stats_t * const p_stats,
-	    IN cl_dispatcher_t * const p_disp, IN cl_plock_t * const p_lock);
+ib_api_status_t osm_sm_init(IN osm_sm_t * p_sm, IN osm_subn_t * p_subn,
+			    IN osm_db_t * p_db, IN osm_vendor_t * p_vendor,
+			    IN osm_mad_pool_t * p_mad_pool,
+			    IN osm_vl15_t * p_vl15, IN osm_log_t * p_log,
+			    IN osm_stats_t * p_stats,
+			    IN cl_dispatcher_t * p_disp, IN cl_plock_t * p_lock);
 /*
 * PARAMETERS
 *	p_sm
@@ -323,7 +323,7 @@ osm_sm_init(IN osm_sm_t * const p_sm,
 *
 * SYNOPSIS
 */
-void osm_sm_signal(IN osm_sm_t * const p_sm, osm_signal_t signal);
+void osm_sm_signal(IN osm_sm_t * p_sm, osm_signal_t signal);
 /*
 * PARAMETERS
 *	p_sm
@@ -347,7 +347,7 @@ void osm_sm_signal(IN osm_sm_t * const p_sm, osm_signal_t signal);
 *
 * SYNOPSIS
 */
-void osm_sm_sweep(IN osm_sm_t * const p_sm);
+void osm_sm_sweep(IN osm_sm_t * p_sm);
 /*
 * PARAMETERS
 *	p_sm
@@ -371,8 +371,7 @@ void osm_sm_sweep(IN osm_sm_t * const p_sm);
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_sm_bind(IN osm_sm_t * const p_sm, IN const ib_net64_t port_guid);
+ib_api_status_t osm_sm_bind(IN osm_sm_t * p_sm, IN ib_net64_t port_guid);
 /*
 * PARAMETERS
 *	p_sm
@@ -401,13 +400,10 @@ osm_sm_bind(IN osm_sm_t * const p_sm, IN const ib_net64_t port_guid);
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_req_get(IN osm_sm_t * sm,
-	    IN const osm_dr_path_t * const p_path,
-	    IN const uint16_t attr_id,
-	    IN const uint32_t attr_mod,
-	    IN const cl_disp_msgid_t err_msg,
-	    IN const osm_madw_context_t * const p_context);
+ib_api_status_t osm_req_get(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
+			    IN ib_net16_t attr_id, IN ib_net32_t attr_mod,
+			    IN cl_disp_msgid_t err_msg,
+			    IN const osm_madw_context_t * p_context);
 /*
 * PARAMETERS
 *	sm
@@ -438,6 +434,73 @@ osm_req_get(IN osm_sm_t * sm,
 *	The response from the node will be routed through the Dispatcher
 *	to the appropriate receive controller object.
 *********/
+
+/****f* OpenSM: SM/osm_send_req_mad
+* NAME
+*       osm_send_req_mad
+*
+* DESCRIPTION
+*	Starts the process to transmit a preallocated/predefined directed route
+*	Set() request.
+*
+* SYNOPSIS
+*/
+void osm_send_req_mad(IN osm_sm_t * sm, IN osm_madw_t *p_madw);
+/*
+* PARAMETERS
+*	sm
+*		[in] Pointer to an osm_sm_t object.
+*	p_madw
+*		[in] Pointer to a preallocated MAD buffer
+*
+*********/
+
+/***f* OpenSM: SM/osm_prepare_req_set
+* NAME
+*	osm_prepare_req_set
+*
+* DESCRIPTION
+*	Preallocate and fill a directed route Set() MAD w/o sending it.
+*
+* SYNOPSIS
+*/
+osm_madw_t *osm_prepare_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
+				IN const uint8_t * p_payload,
+				IN size_t payload_size, IN ib_net16_t attr_id,
+				IN ib_net32_t attr_mod, IN cl_disp_msgid_t err_msg,
+				IN const osm_madw_context_t * p_context);
+/*
+* PARAMETERS
+*	sm
+*		[in] Pointer to an osm_sm_t object.
+*
+*	p_path
+*		[in] Pointer to the directed route path of the recipient.
+*
+*	p_payload
+*		[in] Pointer to the SMP payload to send.
+*
+*	payload_size
+*		[in] The size of the payload to be copied to the SMP data field.
+*
+*	attr_id
+*		[in] Attribute ID to request.
+*
+*	attr_mod
+*		[in] Attribute modifier for this request.
+*
+*	err_msg
+*		[in] Message id with which to post this MAD if an error occurs.
+*
+*	p_context
+*		[in] Mad wrapper context structure to be copied into the wrapper
+*		     context, and thus visible to the recipient of the response.
+*
+* RETURN VALUES
+*	Pointer the MAD buffer in case of success and NULL in case of failure.
+*
+*********/
+
 /****f* OpenSM: SM/osm_req_set
 * NAME
 *	osm_req_set
@@ -447,15 +510,11 @@ osm_req_get(IN osm_sm_t * sm,
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_req_set(IN osm_sm_t * sm,
-	    IN const osm_dr_path_t * const p_path,
-	    IN const uint8_t * const p_payload,
-	    IN const size_t payload_size,
-	    IN const uint16_t attr_id,
-	    IN const uint32_t attr_mod,
-	    IN const cl_disp_msgid_t err_msg,
-	    IN const osm_madw_context_t * const p_context);
+ib_api_status_t osm_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
+			    IN const uint8_t * p_payload,
+			    IN size_t payload_size, IN ib_net16_t attr_id,
+			    IN ib_net32_t attr_mod, IN cl_disp_msgid_t err_msg,
+			    IN const osm_madw_context_t * p_context);
 /*
 * PARAMETERS
 *	sm
@@ -500,10 +559,10 @@ osm_req_set(IN osm_sm_t * sm,
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_resp_send(IN osm_sm_t * sm,
-	      IN const osm_madw_t * const p_req_madw,
-	      IN const ib_net16_t status, IN const uint8_t * const p_payload);
+ib_api_status_t osm_resp_send(IN osm_sm_t * sm,
+			      IN const osm_madw_t * p_req_madw,
+			      IN ib_net16_t status,
+			      IN const uint8_t * p_payload);
 /*
 * PARAMETERS
 *	p_resp
@@ -524,70 +583,24 @@ osm_resp_send(IN osm_sm_t * sm,
 *
 *********/
 
-/****f* OpenSM: SM/osm_sm_mcgrp_join
+/****f* OpenSM: SM/osm_sm_reroute_mlid
 * NAME
-*	osm_sm_mcgrp_join
+*	osm_sm_reroute_mlid
 *
 * DESCRIPTION
-*	Adds a port to the multicast group.  Creates the multicast group
-*	if necessary.
-*
-*	This function is called by the SA.
+*	Requests (schedules) MLID rerouting
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_sm_mcgrp_join(IN osm_sm_t * const p_sm,
-		  IN const ib_net16_t mlid,
-		  IN const ib_net64_t port_guid,
-		  IN osm_mcast_req_type_t req_type);
-/*
-* PARAMETERS
-*	p_sm
-*		[in] Pointer to an osm_sm_t object.
-*
-*	mlid
-*		[in] Multicast LID
-*
-*	port_guid
-*		[in] Port GUID to add to the group.
-*
-*  req_type
-*     [in] Type of the MC request that caused this join
-*          (MC create/join).
-*
-* RETURN VALUES
-*	None
-*
-* NOTES
-*
-* SEE ALSO
-*********/
+void osm_sm_reroute_mlid(osm_sm_t * sm, ib_net16_t mlid);
 
-/****f* OpenSM: SM/osm_sm_mcgrp_leave
-* NAME
-*	osm_sm_mcgrp_leave
-*
-* DESCRIPTION
-*	Removes a port from the multicast group.
-*
-*	This function is called by the SA.
-*
-* SYNOPSIS
-*/
-ib_api_status_t
-osm_sm_mcgrp_leave(IN osm_sm_t * const p_sm,
-		   IN const ib_net16_t mlid, IN const ib_net64_t port_guid);
 /*
 * PARAMETERS
-*	p_sm
+*	sm
 *		[in] Pointer to an osm_sm_t object.
 *
 *	mlid
-*		[in] Multicast LID
-*
-*	port_guid
-*		[in] Port GUID to remove from the group.
+*		[in] MLID value
 *
 * RETURN VALUES
 *	None
@@ -606,13 +619,11 @@ osm_sm_mcgrp_leave(IN osm_sm_t * const p_sm,
 *
 * SYNOPSIS
 */
-static inline cl_status_t
-osm_sm_wait_for_subnet_up(IN osm_sm_t * const p_sm,
-			  IN uint32_t const wait_us,
-			  IN boolean_t const interruptible)
+static inline cl_status_t osm_sm_wait_for_subnet_up(IN osm_sm_t * p_sm,
+						    IN uint32_t wait_us,
+						    IN boolean_t interruptible)
 {
-	return (cl_event_wait_on(&p_sm->subnet_up_event,
-				 wait_us, interruptible));
+	return cl_event_wait_on(&p_sm->subnet_up_event, wait_us, interruptible);
 }
 
 /*
@@ -651,10 +662,10 @@ osm_sm_wait_for_subnet_up(IN osm_sm_t * const p_sm,
 *
 * SYNOPSIS
 */
-static inline boolean_t
-osm_sm_is_greater_than(IN const uint8_t l_priority,
-		       IN const ib_net64_t l_guid,
-		       IN const uint8_t r_priority, IN const ib_net64_t r_guid)
+static inline boolean_t osm_sm_is_greater_than(IN uint8_t l_priority,
+					       IN ib_net64_t l_guid,
+					       IN uint8_t r_priority,
+					       IN ib_net64_t r_guid)
 {
 	return (l_priority > r_priority
 		|| (l_priority == r_priority
diff --git a/include/opensm/osm_sm_mad_ctrl.h b/include/opensm/osm_sm_mad_ctrl.h
index 1c41168..8969835 100644
--- a/include/opensm/osm_sm_mad_ctrl.h
+++ b/include/opensm/osm_sm_mad_ctrl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -147,7 +147,7 @@ typedef struct osm_sm_mad_ctrl {
 *
 * SYNOPSIS
 */
-void osm_sm_mad_ctrl_construct(IN osm_sm_mad_ctrl_t * const p_ctrl);
+void osm_sm_mad_ctrl_construct(IN osm_sm_mad_ctrl_t * p_ctrl);
 /*
 * PARAMETERS
 *	p_ctrl
@@ -178,7 +178,7 @@ void osm_sm_mad_ctrl_construct(IN osm_sm_mad_ctrl_t * const p_ctrl);
 *
 * SYNOPSIS
 */
-void osm_sm_mad_ctrl_destroy(IN osm_sm_mad_ctrl_t * const p_ctrl);
+void osm_sm_mad_ctrl_destroy(IN osm_sm_mad_ctrl_t * p_ctrl);
 /*
 * PARAMETERS
 *	p_ctrl
@@ -209,16 +209,15 @@ void osm_sm_mad_ctrl_destroy(IN osm_sm_mad_ctrl_t * const p_ctrl);
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_sm_mad_ctrl_init(IN osm_sm_mad_ctrl_t * const p_ctrl,
-		     IN osm_subn_t * const p_subn,
-		     IN osm_mad_pool_t * const p_mad_pool,
-		     IN osm_vl15_t * const p_vl15,
-		     IN osm_vendor_t * const p_vendor,
-		     IN osm_log_t * const p_log,
-		     IN osm_stats_t * const p_stats,
-		     IN cl_plock_t * const p_lock,
-		     IN cl_dispatcher_t * const p_disp);
+ib_api_status_t osm_sm_mad_ctrl_init(IN osm_sm_mad_ctrl_t * p_ctrl,
+				     IN osm_subn_t * p_subn,
+				     IN osm_mad_pool_t * p_mad_pool,
+				     IN osm_vl15_t * p_vl15,
+				     IN osm_vendor_t * p_vendor,
+				     IN osm_log_t * p_log,
+				     IN osm_stats_t * p_stats,
+				     IN cl_plock_t * p_lock,
+				     IN cl_dispatcher_t * p_disp);
 /*
 * PARAMETERS
 *	p_ctrl
@@ -266,9 +265,8 @@ osm_sm_mad_ctrl_init(IN osm_sm_mad_ctrl_t * const p_ctrl,
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_sm_mad_ctrl_bind(IN osm_sm_mad_ctrl_t * const p_ctrl,
-		     IN const ib_net64_t port_guid);
+ib_api_status_t osm_sm_mad_ctrl_bind(IN osm_sm_mad_ctrl_t * p_ctrl,
+				     IN ib_net64_t port_guid);
 /*
 * PARAMETERS
 *	p_ctrl
@@ -298,9 +296,9 @@ osm_sm_mad_ctrl_bind(IN osm_sm_mad_ctrl_t * const p_ctrl,
 * SYNOPSIS
 */
 static inline osm_bind_handle_t
-osm_sm_mad_ctrl_get_bind_handle(IN const osm_sm_mad_ctrl_t * const p_ctrl)
+osm_sm_mad_ctrl_get_bind_handle(IN const osm_sm_mad_ctrl_t * p_ctrl)
 {
-	return (p_ctrl->h_bind);
+	return p_ctrl->h_bind;
 }
 
 /*
diff --git a/include/opensm/osm_subnet.h b/include/opensm/osm_subnet.h
index d97d5f4..803e39c 100644
--- a/include/opensm/osm_subnet.h
+++ b/include/opensm/osm_subnet.h
@@ -1,8 +1,10 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
+ * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -46,11 +48,13 @@
 
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
+#include <complib/cl_fleximap.h>
 #include <complib/cl_map.h>
 #include <complib/cl_ptr_vector.h>
 #include <complib/cl_list.h>
 #include <opensm/osm_base.h>
 #include <opensm/osm_prefix_route.h>
+#include <opensm/osm_db.h>
 #include <stdio.h>
 
 #ifdef __cplusplus
@@ -65,6 +69,23 @@ BEGIN_C_DECLS
 #define OSM_SUBNET_VECTOR_MIN_SIZE			0
 #define OSM_SUBNET_VECTOR_GROW_SIZE			1
 #define OSM_SUBNET_VECTOR_CAPACITY			256
+
+#define OSM_PARTITION_ENFORCE_BOTH			"both"
+#define OSM_PARTITION_ENFORCE_IN			"in"
+#define OSM_PARTITION_ENFORCE_OUT			"out"
+#define OSM_PARTITION_ENFORCE_OFF			"off"
+
+typedef enum _osm_partition_enforce_type_enum {
+	OSM_PARTITION_ENFORCE_TYPE_BOTH,
+	OSM_PARTITION_ENFORCE_TYPE_IN,
+	OSM_PARTITION_ENFORCE_TYPE_OUT,
+	OSM_PARTITION_ENFORCE_TYPE_OFF
+} osm_partition_enforce_type_enum;
+
+/* XXX: not actual max, max we're currently going to support */
+#define OSM_CCT_ENTRY_MAX        128
+#define OSM_CCT_ENTRY_MAD_BLOCKS (OSM_CCT_ENTRY_MAX/64)
+
 struct osm_opensm;
 struct osm_qos_policy;
 
@@ -126,6 +147,91 @@ typedef struct osm_qos_options {
 *
 *********/
 
+/****s* OpenSM: Subnet/osm_cct_entry_t
+* NAME
+*	osm_cct_entry_t
+*
+* DESCRIPTION
+*	Subnet Congestion Control Table entry.  See A10.2.2.1.1 for format details.
+*
+* SYNOPSIS
+*/
+typedef struct osm_cct_entry {
+	uint8_t shift; //Alex: shift 2 bits
+	uint16_t multiplier; //Alex multiplier 14 bits
+} osm_cct_entry_t;
+/*
+* FIELDS
+*
+*	shift
+*		shift field in CCT entry.  See A10.2.2.1.1.
+*
+*	multiplier
+*		multiplier field in CCT entry.  See A10.2.2.1.1.
+*
+*********/
+
+/****s* OpenSM: Subnet/osm_cacongestion_entry_t
+* NAME
+*	osm_cacongestion_entry_t
+*
+* DESCRIPTION
+*	Subnet CA Congestion entry.  See A10.4.3.8.4 for format details.
+*
+* SYNOPSIS
+*/
+typedef struct osm_cacongestion_entry {
+	ib_net16_t ccti_timer; //Alex: ccti_timer and ccti_increase should be replaced
+	uint8_t ccti_increase;
+	uint8_t trigger_threshold;
+	uint8_t ccti_min;
+} osm_cacongestion_entry_t;
+/*
+* FIELDS
+*
+*	ccti_timer
+*		CCTI Timer
+*
+*	ccti_increase
+*		CCTI Increase
+*
+*	trigger_threshold
+*		CCTI trigger for log message
+*
+*	ccti_min
+*		CCTI Minimum
+*
+*********/
+
+/****s* OpenSM: Subnet/osm_cct_t
+* NAME
+*	osm_cct_t
+*
+* DESCRIPTION
+*	Subnet CongestionControlTable.  See A10.4.3.9 for format details.
+*
+* SYNOPSIS
+*/
+typedef struct osm_cct {
+	osm_cct_entry_t entries[OSM_CCT_ENTRY_MAX];
+	unsigned int entries_len;
+	char *input_str;
+} osm_cct_t;
+/*
+* FIELDS
+*
+*	entries
+*		Entries in CCT
+*
+*	entries_len
+*		Length of entries
+*
+*	input_str
+*		Original str input
+*
+*********/
+
+
 /****s* OpenSM: Subnet/osm_subn_opt_t
 * NAME
 *	osm_subn_opt_t
@@ -144,14 +250,20 @@ typedef struct osm_subn_opt {
 	ib_net64_t sa_key;
 	ib_net64_t subnet_prefix;
 	ib_net16_t m_key_lease_period;
+	uint8_t m_key_protect_bits;
 	uint32_t sweep_interval;
 	uint32_t max_wire_smps;
+	uint32_t max_wire_smps2;
+	uint32_t max_smps_timeout;
 	uint32_t transaction_timeout;
+	uint32_t transaction_retries;
 	uint8_t sm_priority;
 	uint8_t lmc;
 	boolean_t lmc_esp0;
 	uint8_t max_op_vls;
 	uint8_t force_link_speed;
+	uint8_t force_link_speed_ext;
+	uint8_t fdr10;
 	boolean_t reassign_lids;
 	boolean_t ignore_other_sm;
 	boolean_t single_thread;
@@ -165,6 +277,7 @@ typedef struct osm_subn_opt {
 	uint8_t leaf_head_of_queue_lifetime;
 	uint8_t local_phy_errors_threshold;
 	uint8_t overrun_errors_threshold;
+	boolean_t use_mfttop;
 	uint32_t sminfo_polling_timeout;
 	uint32_t polling_retry_number;
 	uint32_t max_msg_fifo_timeout;
@@ -175,12 +288,18 @@ typedef struct osm_subn_opt {
 	unsigned long log_max_size;
 	char *partition_config_file;
 	boolean_t no_partition_enforcement;
+	char *part_enforce;
+	osm_partition_enforce_type_enum part_enforce_enum;
+	boolean_t allow_both_pkeys;
+	uint8_t sm_assigned_guid;
 	boolean_t qos;
 	char *qos_policy_file;
 	boolean_t accum_log_file;
 	char *console;
 	uint16_t console_port;
 	char *port_prof_ignore_file;
+	char *hop_weights_file;
+	char *port_search_ordering_file;
 	boolean_t port_profile_switch_nodes;
 	boolean_t sweep_on_trap;
 	char *routing_engine_names;
@@ -190,19 +309,42 @@ typedef struct osm_subn_opt {
 	char *lfts_file;
 	char *root_guid_file;
 	char *cn_guid_file;
+	char *io_guid_file;
+	boolean_t port_shifting;
+	uint32_t scatter_ports;
+	uint16_t max_reverse_hops;
 	char *ids_guid_file;
 	char *guid_routing_order_file;
 	char *sa_db_file;
+	boolean_t sa_db_dump;
+	char *torus_conf_file;
+	boolean_t do_mesh_analysis;
 	boolean_t exit_on_fatal;
 	boolean_t honor_guid2lid_file;
 	boolean_t daemon;
 	boolean_t sm_inactive;
 	boolean_t babbling_port_policy;
+	boolean_t use_optimized_slvl;
 	osm_qos_options_t qos_options;
 	osm_qos_options_t qos_ca_options;
 	osm_qos_options_t qos_sw0_options;
 	osm_qos_options_t qos_swe_options;
 	osm_qos_options_t qos_rtr_options;
+	boolean_t congestion_control;
+	ib_net64_t cc_key;
+	uint32_t cc_max_outstanding_mads;
+	ib_net32_t cc_sw_cong_setting_control_map;
+	uint8_t cc_sw_cong_setting_victim_mask[IB_CC_PORT_MASK_DATA_SIZE];
+	uint8_t cc_sw_cong_setting_credit_mask[IB_CC_PORT_MASK_DATA_SIZE];
+	uint8_t cc_sw_cong_setting_threshold;
+	uint8_t cc_sw_cong_setting_packet_size;
+	uint8_t cc_sw_cong_setting_credit_starvation_threshold;
+	osm_cct_entry_t cc_sw_cong_setting_credit_starvation_return_delay;
+	ib_net16_t cc_sw_cong_setting_marking_rate;
+	ib_net16_t cc_ca_cong_setting_port_control;
+	ib_net16_t cc_ca_cong_setting_control_map;
+	osm_cacongestion_entry_t cc_ca_cong_entries[IB_CA_CONG_ENTRY_DATA_SIZE];
+	osm_cct_t cc_cct;
 	boolean_t enable_quirks;
 	boolean_t no_clients_rereg;
 #ifdef ENABLE_OSM_PERF_MGR
@@ -210,12 +352,21 @@ typedef struct osm_subn_opt {
 	boolean_t perfmgr_redir;
 	uint16_t perfmgr_sweep_time_s;
 	uint32_t perfmgr_max_outstanding_queries;
+	boolean_t perfmgr_ignore_cas;
 	char *event_db_dump_file;
+	int perfmgr_rm_nodes;
+	boolean_t perfmgr_log_errors;
 #endif				/* ENABLE_OSM_PERF_MGR */
 	char *event_plugin_name;
+	char *event_plugin_options;
 	char *node_name_map_name;
 	char *prefix_routes_file;
+	char *log_prefix;
 	boolean_t consolidate_ipv6_snm_req;
+	struct osm_subn_opt *file_opts; /* used for update */
+	uint8_t lash_start_vl;			/* starting vl to use in lash */
+	uint8_t sm_sl;			/* which SL to use for SM/SA communication */
+	char *per_module_logging_file;
 } osm_subn_opt_t;
 /*
 * FIELDS
@@ -248,10 +399,22 @@ typedef struct osm_subn_opt {
 *	max_wire_smps
 *		The maximum number of SMPs sent in parallel.  Default is 4.
 *
+*	max_wire_smps2
+*		The maximum number of timeout SMPs allowed to be outstanding.
+*		Default is same as max_wire_smps which disables the timeout
+*		mechanism.
+*
+*	max_smps_timeout
+*		The wait time in usec for timeout based SMPs.  Default is
+*		timeout * retries.
+*
 *	transaction_timeout
 *		The maximum time in milliseconds allowed for a transaction
 *		to complete.  Default is 200.
 *
+*	transaction_retries
+*		The number of retries for a transaction. Default is 3.
+*
 *	sm_priority
 *		The priority of this SM as specified by the user.  This
 *		value is made available in the SMInfo attribute.
@@ -360,8 +523,8 @@ typedef struct osm_subn_opt {
 *
 *	connect_roots
 *		The option which will enforce root to root connectivity with
-*		up/down routing engine (even if this violates "pure" deadlock
-*		free up/down algorithm)
+*		up/down and fat-tree routing engines (even if this violates
+*		"pure" deadlock free up/down or fat-tree algorithm)
 *
 *	use_ucast_cache
 *		When TRUE enables unicast routing cache.
@@ -382,6 +545,13 @@ typedef struct osm_subn_opt {
 *		Name of the file that contains list of compute node guids that
 *		will be used by fat-tree routing (provided by User)
 *
+*	io_guid_file
+*		Name of the file that contains list of I/O node guids that
+*		will be used by fat-tree routing (provided by User)
+*
+*	port_shifting
+*		This option will turn on port_shifting in routing.
+*
 *	ids_guid_file
 *		Name of the file that contains list of ids which should be
 *		used by Up/Down algorithm instead of node GUIDs
@@ -393,6 +563,14 @@ typedef struct osm_subn_opt {
 *	sa_db_file
 *		Name of the SA database file.
 *
+*	sa_db_dump
+*		When TRUE causes OpenSM to dump SA DB at the end of every
+*		light sweep regardless the current verbosity level.
+*
+*	torus_conf_file
+*		Name of the file with extra configuration info for torus-2QoS
+*		routing engine.
+*
 *	exit_on_fatal
 *		If TRUE (default) - SM will exit on fatal subnet initialization
 *		issues.
@@ -415,6 +593,10 @@ typedef struct osm_subn_opt {
 *	babbling_port_policy
 *		OpenSM will enforce its "babbling" port policy.
 *
+*	use_optimized_slvl
+*		Use optimized SLtoVLMappingTable programming if
+*		device indicates it supports this.
+*
 *	perfmgr
 *		Enable or disable the performance manager
 *
@@ -427,8 +609,11 @@ typedef struct osm_subn_opt {
 *       event_db_dump_file
 *               File to dump the event database to
 *
-*       event_db_plugin
-*               Specify the name of the event plugin
+*       event_plugin_name
+*               Specify the name(s) of the event plugin(s)
+*
+*       event_plugin_options
+*               Options string that would be passed to the plugin(s)
 *
 *	qos_options
 *		Default set of QoS options
@@ -445,12 +630,73 @@ typedef struct osm_subn_opt {
 *	qos_rtr_options
 *		QoS options for router ports
 *
+*	congestion_control
+*		Boolean that specifies whether OpenSM congestion control configuration
+*		should be off or no.
+*
+*	cc_key
+*		CCkey to use when configuring congestion control.
+*
+*	cc_max_outstanding_mads
+*		Max number of outstanding CC mads that can be on the wire.
+*
+*	cc_sw_cong_setting_control_map
+*		Congestion Control Switch Congestion Setting Control Map
+*		configuration setting.
+*
+*	cc_sw_cong_setting_victim_mask
+*		Congestion Control Switch Congestion Setting Victim Mask
+*		configuration setting.
+*
+*	cc_sw_cong_setting_credit_mask
+*		Congestion Control Switch Congestion Setting Credit Mask
+*		configuration setting.
+*
+*	cc_sw_cong_setting_threshold
+*		Congestion Control Switch Congestion Setting Threshold
+*		configuration setting.
+*
+*	cc_sw_cong_setting_packet_size
+*		Congestion Control Switch Congestion Setting Packet Size
+*		configuration setting.
+*
+*	cc_sw_cong_setting_credit_starvation_threshold
+*		Congestion Control Switch Congestion Setting Credit Staraction Threshold
+*		configuration setting.
+*
+*	cc_sw_cong_setting_credit_starvation_return_delay
+*		Congestion Control Switch Congestion Setting Credit Starvation Return Delay
+*		configuration setting.
+*
+*	cc_sw_cong_setting_marking_rate
+*		Congestion Control Switch Congestion Setting Marking Rate
+*		configuration setting.
+*
+*	cc_ca_cong_setting_port_control
+*		Congestion Control CA Congestion Setting Port Control
+*
+*	cc_ca_cong_setting_control_map
+*		Congestion Control CA Congestion Setting Control Map
+
+*	cc_ca_cong_entries
+*		Congestion Control CA Congestion Setting Entries
+*
+*	cc_cct
+*		Congestion Control Table array of entries
+*
 *	enable_quirks
 *		Enable high risk new features and not fully qualified
 *		hardware specific work arounds
 *
 *	no_clients_rereg
-*		When TRUE disables clients reregistration request.
+*		When TRUE disables clients reregistration request
+*
+*	scatter_ports
+*		When not zero, randomize best possible ports chosen
+*		for a route. The value is used as a random key seed.
+*
+*	per_module_logging_file
+*		File name of per module logging configuration.
 *
 * SEE ALSO
 *	Subnet object
@@ -474,16 +720,20 @@ typedef struct osm_subn {
 	cl_qmap_t sw_guid_tbl;
 	cl_qmap_t node_guid_tbl;
 	cl_qmap_t port_guid_tbl;
+	cl_qmap_t alias_port_guid_tbl;
+	cl_qmap_t assigned_guids_tbl;
 	cl_qmap_t rtr_guid_tbl;
 	cl_qlist_t prefix_routes_list;
 	cl_qmap_t prtn_pkey_tbl;
 	cl_qmap_t sm_guid_tbl;
 	cl_qlist_t sa_sr_list;
 	cl_qlist_t sa_infr_list;
+	cl_qlist_t alias_guid_list;
 	cl_ptr_vector_t port_lid_tbl;
 	ib_net16_t master_sm_base_lid;
 	ib_net16_t sm_base_lid;
 	ib_net64_t sm_port_guid;
+	uint8_t last_sm_port_state;
 	uint8_t sm_state;
 	osm_subn_opt_t opt;
 	struct osm_qos_policy *p_qos_policy;
@@ -491,32 +741,38 @@ typedef struct osm_subn {
 	uint16_t max_mcast_lid_ho;
 	uint8_t min_ca_mtu;
 	uint8_t min_ca_rate;
+	uint8_t min_data_vls;
 	boolean_t ignore_existing_lfts;
 	boolean_t subnet_initialization_error;
 	boolean_t force_heavy_sweep;
 	boolean_t force_reroute;
 	boolean_t in_sweep_hop_0;
 	boolean_t first_time_master_sweep;
+	boolean_t set_client_rereg_on_sweep;
 	boolean_t coming_out_of_standby;
+	boolean_t sweeping_enabled;
 	unsigned need_update;
-	void *mgroups[IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO + 1];
+	cl_fmap_t mgrp_mgid_tbl;
+	osm_db_domain_t *p_g2m;
+	osm_db_domain_t *p_neighbor;
+	void *mboxes[IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO + 1];
 } osm_subn_t;
 /*
 * FIELDS
 *	sw_guid_tbl
-*		Container of pointers to all Switch objects in the subent.
+*		Container of pointers to all Switch objects in the subnet.
 *		Indexed by node GUID.
 *
 *	node_guid_tbl
-*		Container of pointers to all Node objects in the subent.
+*		Container of pointers to all Node objects in the subnet.
 *		Indexed by node GUID.
 *
 *	port_guid_tbl
-*		Container of pointers to all Port objects in the subent.
+*		Container of pointers to all Port objects in the subnet.
 *		Indexed by port GUID - network order!
 *
 *	rtr_guid_tbl
-*		Container of pointers to all Router objects in the subent.
+*		Container of pointers to all Router objects in the subnet.
 *		Indexed by node GUID.
 *
 *	prtn_pkey_tbl
@@ -528,7 +784,7 @@ typedef struct osm_subn {
 *		on the subnet.
 *
 *	port_lid_tbl
-*		Container of pointers to all Port objects in the subent.
+*		Container of pointers to all Port objects in the subnet.
 *		Indexed by port LID.
 *
 *	master_sm_base_lid
@@ -540,6 +796,10 @@ typedef struct osm_subn {
 *	sm_port_guid
 *		This SM's own port GUID.
 *
+*	last_sm_port_state
+*		Last state of this SM's port.
+*		0 is down and 1 is up.
+*
 *	sm_state
 *		The high-level state of the SM.  This value is made available
 *		in the SMInfo attribute.
@@ -597,13 +857,20 @@ typedef struct osm_subn {
 *		the sweeping.
 *
 *	first_time_master_sweep
-*		This flag is used for the PortInfo setting. On the first
-*		sweep as master (meaning after moving from Standby|Discovering
-*		state), the SM must send a PortInfoSet to all ports. After
-*		that - we want to minimize the number of PortInfoSet requests
-*		sent, and to send only requests that change the value from
-*		what is updated in the port (or send a first request if this
-*		is a new port). We will set this flag to TRUE when entering
+*		This flag is to indicate the first sweep as master (meaning
+*		after moving from Standby|Discovering state).  The flag is
+*		used to notify some alternate actions that must be done on
+*		the first master sweep.  It may perform some actions indicated
+*		by flags below, such as set_client_rereg_on_sweep.
+*
+*	set_client_rereg_on_sweep
+*		This flag is used for the PortInfo setting client rereg.
+*		When configuring the subnet for the first time, and several
+*		other circumstances, SM must send a PortInfoSet to all ports.
+*		After that - we want to minimize the number of PortInfoSet
+*		requests sent, and to send only requests that change the value
+*		from what is updated in the port (or send a first request if
+*		this is a new port). We will set this flag to TRUE when entering
 *		the master state, and set it back to FALSE at the end of the
 *		drop manager. This is done since at the end of the drop manager
 *		we have updated all the ports that are reachable, and from now
@@ -616,13 +883,51 @@ typedef struct osm_subn {
 *		The flag is set true if the SM state was standby and now
 *		changed to MASTER it is reset at the end of the sweep.
 *
+*	sweeping_enabled
+*		FALSE - sweeping is administratively disabled, all
+*		sweeping is inhibited, TRUE - sweeping is done
+*		normally
+*
 *	need_update
 *		This flag should be on during first non-master heavy
 *		(including pre-master discovery stage)
 *
-*	mgroups
-*		Array of pointers to all Multicast Group objects in the subnet.
-*		Indexed by MLID offset from base MLID.
+*	mgrp_mgid_tbl
+*		Container of pointers to all Multicast group objects in
+*		the subnet. Indexed by MGID.
+*
+*	mboxes
+*		Array of pointers to all Multicast MLID box objects in the
+*		subnet. Indexed by MLID offset from base MLID.
+*
+* SEE ALSO
+*	Subnet object
+*********/
+
+/****s* OpenSM: Subnet/osm_assigned_guids_t
+* NAME
+*	osm_assigned_guids_t
+*
+* DESCRIPTION
+*	SA assigned GUIDs structure.
+*
+* SYNOPSIS
+*/
+typedef struct osm_assigned_guids {
+	cl_map_item_t map_item;
+	ib_net64_t port_guid;
+	ib_net64_t assigned_guid[1];
+} osm_assigned_guids_t;
+/*
+* FIELDS
+*	map_item
+*		Linkage structure for cl_qmap.  MUST BE FIRST MEMBER!
+*
+*	port_guid
+*		Base port GUID.
+*
+*	assigned_guids
+*		Table of persistent SA assigned GUIDs.
 *
 * SEE ALSO
 *	Subnet object
@@ -637,7 +942,7 @@ typedef struct osm_subn {
 *
 * SYNOPSIS
 */
-void osm_subn_construct(IN osm_subn_t * const p_subn);
+void osm_subn_construct(IN osm_subn_t * p_subn);
 /*
 * PARAMETERS
 *	p_subn
@@ -666,7 +971,7 @@ void osm_subn_construct(IN osm_subn_t * const p_subn);
 *
 * SYNOPSIS
 */
-void osm_subn_destroy(IN osm_subn_t * const p_subn);
+void osm_subn_destroy(IN osm_subn_t * p_subn);
 /*
 * PARAMETERS
 *	p_subn
@@ -694,10 +999,9 @@ void osm_subn_destroy(IN osm_subn_t * const p_subn);
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_subn_init(IN osm_subn_t * const p_subn,
-	      IN struct osm_opensm *const p_osm,
-	      IN const osm_subn_opt_t * const p_opt);
+ib_api_status_t osm_subn_init(IN osm_subn_t * p_subn,
+			      IN struct osm_opensm *p_osm,
+			      IN const osm_subn_opt_t * p_opt);
 /*
 * PARAMETERS
 *	p_subn
@@ -738,11 +1042,10 @@ struct osm_mgrp;
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_get_gid_by_mad_addr(IN struct osm_log *p_log,
-			IN const osm_subn_t * p_subn,
-			IN const struct osm_mad_addr *p_mad_addr,
-			OUT ib_gid_t * p_gid);
+ib_api_status_t osm_get_gid_by_mad_addr(IN struct osm_log *p_log,
+					IN const osm_subn_t * p_subn,
+					IN struct osm_mad_addr *p_mad_addr,
+					OUT ib_gid_t * p_gid);
 /*
 * PARAMETERS
 *	p_log
@@ -846,7 +1149,7 @@ struct osm_port *osm_get_port_by_mad_addr(IN struct osm_log *p_log,
 * SYNOPSIS
 */
 struct osm_switch *osm_get_switch_by_guid(IN const osm_subn_t * p_subn,
-					   IN uint64_t guid);
+					  IN uint64_t guid);
 /*
 * PARAMETERS
 *	p_subn
@@ -868,14 +1171,14 @@ struct osm_switch *osm_get_switch_by_guid(IN const osm_subn_t * p_subn,
 *	osm_get_node_by_guid
 *
 * DESCRIPTION
-*	The looks for the given node giud in the subnet table of nodes by guid.
+*	This looks for the given node guid in the subnet table of nodes by guid.
 *  NOTE: this code is not thread safe. Need to grab the lock before
 *  calling it.
 *
 * SYNOPSIS
 */
 struct osm_node *osm_get_node_by_guid(IN osm_subn_t const *p_subn,
-				       IN uint64_t guid);
+				      IN uint64_t guid);
 /*
 * PARAMETERS
 *	p_subn
@@ -897,14 +1200,14 @@ struct osm_node *osm_get_node_by_guid(IN osm_subn_t const *p_subn,
 *	osm_get_port_by_guid
 *
 * DESCRIPTION
-*	The looks for the given port guid in the subnet table of ports by guid.
+*	This looks for the given port guid in the subnet table of ports by guid.
 *  NOTE: this code is not thread safe. Need to grab the lock before
 *  calling it.
 *
 * SYNOPSIS
 */
 struct osm_port *osm_get_port_by_guid(IN osm_subn_t const *p_subn,
-				       IN ib_net64_t guid);
+				      IN ib_net64_t guid);
 /*
 * PARAMETERS
 *	p_subn
@@ -921,69 +1224,251 @@ struct osm_port *osm_get_port_by_guid(IN osm_subn_t const *p_subn,
 *	osm_port_t
 *********/
 
-/****f* OpenSM: Subnet/osm_get_mgrp_by_mlid
+/****f* OpenSM: Port/osm_get_port_by_lid_ho
 * NAME
-*	osm_get_mgrp_by_mlid
+*	osm_get_port_by_lid_ho
 *
 * DESCRIPTION
-*	The looks for the given multicast group in the subnet table by mlid.
-*	NOTE: this code is not thread safe. Need to grab the lock before
-*	calling it.
+*	Returns a pointer of the port object for given lid value.
 *
 * SYNOPSIS
 */
-static inline
-struct osm_mgrp *osm_get_mgrp_by_mlid(osm_subn_t const *p_subn, ib_net16_t mlid)
-{
-	return p_subn->mgroups[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO];
-}
+struct osm_port *osm_get_port_by_lid_ho(const osm_subn_t * subn, uint16_t lid);
+/*
+* PARAMETERS
+*	subn
+*		[in] Pointer to the subnet data structure.
+*
+*	lid
+*		[in] LID requested in hot byte order.
+*
+* RETURN VALUES
+*	The port structure pointer if found. NULL otherwise.
+*
+* SEE ALSO
+*       Subnet object, osm_port_t
+*********/
+
+/****f* OpenSM: Subnet/osm_get_alias_guid_by_guid
+* NAME
+*	osm_get_alias_guid_by_guid
+*
+* DESCRIPTION
+*	This looks for the given port guid in the subnet table of ports by
+*	alias guid.
+*  NOTE: this code is not thread safe. Need to grab the lock before
+*  calling it.
+*
+* SYNOPSIS
+*/
+struct osm_alias_guid *osm_get_alias_guid_by_guid(IN osm_subn_t const *p_subn,
+						  IN ib_net64_t guid);
 /*
 * PARAMETERS
 *	p_subn
 *		[in] Pointer to an osm_subn_t object
 *
-*	mlid
-*		[in] The multicast group mlid in network order
+*	guid
+*		[in] The alias port guid in network order
 *
 * RETURN VALUES
-*	The multicast group structure pointer if found. NULL otherwise.
+*	The alias guid structure pointer if found. NULL otherwise.
+*
+* SEE ALSO
+*	Subnet object, osm_subn_construct, osm_subn_destroy,
+*	osm_alias_guid_t
 *********/
 
-/****f* OpenSM: Helper/osm_get_physp_by_mad_addr
+/****f* OpenSM: Subnet/osm_get_port_by_alias_guid
 * NAME
-*	osm_get_physp_by_mad_addr
+*	osm_get_port_by_alias_guid
 *
 * DESCRIPTION
-*	Looks for the requester physical port in the mad address.
+*	This looks for the given port guid in the subnet table of ports by
+*	alias guid.
+*  NOTE: this code is not thread safe. Need to grab the lock before
+*  calling it.
 *
-* Note: This code is not thread safe. Need to grab the lock before
-* calling it.
+* SYNOPSIS
+*/
+struct osm_port *osm_get_port_by_alias_guid(IN osm_subn_t const *p_subn,
+					    IN ib_net64_t guid);
+/*
+* PARAMETERS
+*	p_subn
+*		[in] Pointer to an osm_subn_t object
+*
+*	guid
+*		[in] The alias port guid in network order
+*
+* RETURN VALUES
+*	The port structure pointer if found. NULL otherwise.
+*
+* SEE ALSO
+*	Subnet object, osm_subn_construct, osm_subn_destroy,
+*	osm_port_t
+*********/
+
+/****f* OpenSM: Port/osm_assigned_guids_new
+* NAME
+*	osm_assigned_guids_new
+*
+* DESCRIPTION
+*	This function allocates and initializes an assigned guids object.
 *
 * SYNOPSIS
 */
-struct osm_physp *osm_get_physp_by_mad_addr(IN struct osm_log *p_log,
-					     IN const osm_subn_t * p_subn,
-					     IN struct osm_mad_addr
-					     *p_mad_addr);
+osm_assigned_guids_t *osm_assigned_guids_new(IN const ib_net64_t port_guid,
+					     IN const uint32_t num_guids);
 /*
 * PARAMETERS
-*	p_log
-*		[in] Pointer to a log object.
+*       port_guid
+*               [in] Base port GUID in network order
+*
+* RETURN VALUE
+*       Pointer to the initialized assigned alias guid object.
+*
+* SEE ALSO
+*	Subnet object, osm_assigned_guids_t, osm_assigned_guids_delete,
+*	osm_get_assigned_guids_by_guid
+*********/
+
+/****f* OpenSM: Port/osm_assigned_guids_delete
+* NAME
+*	osm_assigned_guids_delete
+*
+* DESCRIPTION
+*	This function destroys and deallocates an assigned guids object.
+*
+* SYNOPSIS
+*/
+void osm_assigned_guids_delete(IN OUT osm_assigned_guids_t ** pp_assigned_guids);
+/*
+* PARAMETERS
+*       pp_assigned_guids
+*		[in][out] Pointer to a pointer to an assigned guids object to delete.
+*		On return, this pointer is NULL.
+*
+* RETURN VALUE
+*	This function does not return a value.
 *
+* NOTES
+*	Performs any necessary cleanup of the specified assigned guids object.
+*
+* SEE ALSO
+*	Subnet object, osm_assigned_guids_new, osm_get_assigned_guids_by_guid
+*********/
+
+/****f* OpenSM: Subnet/osm_get_assigned_guids_by_guid
+* NAME
+*	osm_get_assigned_guids_by_guid
+*
+* DESCRIPTION
+*	This looks for the given port guid and returns a pointer
+*	to the guid table of SA assigned alias guids for that port.
+*
+* SYNOPSIS
+*/
+osm_assigned_guids_t *osm_get_assigned_guids_by_guid(IN osm_subn_t const *p_subn,
+						     IN ib_net64_t port_guid);
+/*
+* PARAMETERS
 *	p_subn
-*		[in] Pointer to subnet object.
+*		[in] Pointer to an osm_subn_t object
 *
-*	p_mad_addr
-*		[in] Pointer to mad address object.
+*	port_guid
+*		[in] The base port guid in network order
 *
 * RETURN VALUES
-*	Pointer to requester physical port object if found. Null otherwise.
+*	The osm_assigned_guids structure pointer if found. NULL otherwise.
 *
-* NOTES
+* SEE ALSO
+*	Subnet object, osm_assigned_guids_new, osm_assigned_guids_delete,
+*	osm_assigned_guids_t
+*********/
+
+/****f* OpenSM: Port/osm_get_port_by_lid
+* NAME
+*	osm_get_port_by_lid
+*
+* DESCRIPTION
+*	Returns a pointer of the port object for given lid value.
+*
+* SYNOPSIS
+*/
+static inline struct osm_port *osm_get_port_by_lid(IN osm_subn_t const * subn,
+						   IN ib_net16_t lid)
+{
+	return osm_get_port_by_lid_ho(subn, cl_ntoh16(lid));
+}
+/*
+* PARAMETERS
+*	subn
+*		[in] Pointer to the subnet data structure.
+*
+*	lid
+*		[in] LID requested in network byte order.
+*
+* RETURN VALUES
+*	The port structure pointer if found. NULL otherwise.
 *
 * SEE ALSO
+*       Subnet object, osm_port_t
 *********/
 
+/****f* OpenSM: Subnet/osm_get_mgrp_by_mgid
+* NAME
+*	osm_get_mgrp_by_mgid
+*
+* DESCRIPTION
+*	This looks for the given multicast group in the subnet table by mgid.
+*	NOTE: this code is not thread safe. Need to grab the lock before
+*	calling it.
+*
+* SYNOPSIS
+*/
+struct osm_mgrp *osm_get_mgrp_by_mgid(IN osm_subn_t * subn, IN ib_gid_t * mgid);
+/*
+* PARAMETERS
+*	subn
+*		[in] Pointer to an osm_subn_t object
+*
+*	mgid
+*		[in] The multicast group MGID value
+*
+* RETURN VALUES
+*	The multicast group structure pointer if found. NULL otherwise.
+*********/
+
+/****f* OpenSM: Subnet/osm_get_mbox_by_mlid
+* NAME
+*	osm_get_mbox_by_mlid
+*
+* DESCRIPTION
+*	This looks for the given multicast group in the subnet table by mlid.
+*	NOTE: this code is not thread safe. Need to grab the lock before
+*	calling it.
+*
+* SYNOPSIS
+*/
+static inline struct osm_mgrp_box *osm_get_mbox_by_mlid(osm_subn_t const *p_subn, ib_net16_t mlid)
+{
+	return (struct osm_mgrp_box *)p_subn->mboxes[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO];
+}
+/*
+* PARAMETERS
+*	p_subn
+*		[in] Pointer to an osm_subn_t object
+*
+*	mlid
+*		[in] The multicast group mlid in network order
+*
+* RETURN VALUES
+*	The multicast group structure pointer if found. NULL otherwise.
+*********/
+
+int is_mlnx_ext_port_info_supported(ib_net16_t devid);
+
 /****f* OpenSM: Subnet/osm_subn_set_default_opt
 * NAME
 *	osm_subn_set_default_opt
@@ -993,7 +1478,7 @@ struct osm_physp *osm_get_physp_by_mad_addr(IN struct osm_log *p_log,
 *
 * SYNOPSIS
 */
-void osm_subn_set_default_opt(IN osm_subn_opt_t * const p_opt);
+void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt);
 /*
 * PARAMETERS
 *
@@ -1019,7 +1504,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * const p_opt);
 *
 * SYNOPSIS
 */
-int osm_subn_parse_conf_file(char *conf_file, osm_subn_opt_t * const p_opt);
+int osm_subn_parse_conf_file(char *conf_file, osm_subn_opt_t * p_opt);
 /*
 * PARAMETERS
 *
@@ -1041,7 +1526,7 @@ int osm_subn_parse_conf_file(char *conf_file, osm_subn_opt_t * const p_opt);
 *
 * SYNOPSIS
 */
-int osm_subn_rescan_conf_files(IN osm_subn_t * const p_subn);
+int osm_subn_rescan_conf_files(IN osm_subn_t * p_subn);
 /*
 * PARAMETERS
 *
@@ -1063,7 +1548,7 @@ int osm_subn_rescan_conf_files(IN osm_subn_t * const p_subn);
 *
 * SYNOPSIS
 */
-int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * const p_opt);
+int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opt);
 /*
 * PARAMETERS
 *
@@ -1086,7 +1571,7 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * const p_opt);
 *
 * SYNOPSIS
 */
-int osm_subn_write_conf_file(char *file_name, IN osm_subn_opt_t * const p_opt);
+int osm_subn_write_conf_file(char *file_name, IN osm_subn_opt_t * p_opt);
 /*
 * PARAMETERS
 *
@@ -1100,7 +1585,7 @@ int osm_subn_write_conf_file(char *file_name, IN osm_subn_opt_t * const p_opt);
 *	Assumes the conf file is part of the cache dir which defaults to
 *	OSM_DEFAULT_CACHE_DIR or OSM_CACHE_DIR the name is opensm.opts
 *********/
-int osm_subn_verify_config(osm_subn_opt_t * const p_opt);
+int osm_subn_verify_config(osm_subn_opt_t * p_opt);
 
 END_C_DECLS
 #endif				/* _OSM_SUBNET_H_ */
diff --git a/include/opensm/osm_switch.h b/include/opensm/osm_switch.h
index dbc22e5..de567ad 100644
--- a/include/opensm/osm_switch.h
+++ b/include/opensm/osm_switch.h
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -100,12 +100,19 @@ typedef struct osm_switch {
 	uint16_t num_hops;
 	uint8_t **hops;
 	osm_port_profile_t *p_prof;
+	uint8_t *search_ordering_ports;
 	uint8_t *lft;
 	uint8_t *new_lft;
+	uint16_t lft_size;
 	osm_mcast_tbl_t mcast_tbl;
-	uint32_t discovery_count;
+	int32_t mft_block_num;
+	uint32_t mft_position;
+	unsigned endport_links;
 	unsigned need_update;
 	void *priv;
+	cl_map_item_t mgrp_item;
+	uint32_t num_of_mcm;
+	uint8_t is_mc_member;
 } osm_switch_t;
 /*
 * FIELDS
@@ -144,15 +151,19 @@ typedef struct osm_switch {
 *	mcast_tbl
 *		Multicast forwarding table for this switch.
 *
-*	discovery_count
-*		The number of times this switch has been discovered
-*		during the current fabric sweep.  This number is reset
-*		to zero at the start of a sweep.
-*
 *	need_update
 *		When set indicates that switch was probably reset, so
 *		fwd tables and rest cached data should be flushed
 *
+*	mgrp_item
+*		map item for switch in building mcast tree
+*
+*	num_of_mcm
+*		number of mcast members(ports) connected to switch
+*
+*	is_mc_member
+*		whether switch is a mcast member itself
+*
 * SEE ALSO
 *	Switch object
 *********/
@@ -172,6 +183,7 @@ struct osm_remote_guids_count {
 	struct osm_remote_node {
 		osm_node_t *node;
 		unsigned forwarded_to;
+		uint8_t port;
 	} guids[0];
 };
 /*
@@ -184,6 +196,9 @@ struct osm_remote_guids_count {
 *
 *	forwarded_to
 *		A count of lids forwarded to this node.
+*
+*	port
+*		Port number on the node.
 *********/
 
 /****f* OpenSM: Switch/osm_switch_delete
@@ -195,7 +210,7 @@ struct osm_remote_guids_count {
 *
 * SYNOPSIS
 */
-void osm_switch_delete(IN OUT osm_switch_t ** const pp_sw);
+void osm_switch_delete(IN OUT osm_switch_t ** pp_sw);
 /*
 * PARAMETERS
 *	p_sw
@@ -219,8 +234,8 @@ void osm_switch_delete(IN OUT osm_switch_t ** const pp_sw);
 *
 * SYNOPSIS
 */
-osm_switch_t *osm_switch_new(IN osm_node_t * const p_node,
-			     IN const osm_madw_t * const p_madw);
+osm_switch_t *osm_switch_new(IN osm_node_t * p_node,
+			     IN const osm_madw_t * p_madw);
 /*
 * PARAMETERS
 *	p_node
@@ -248,9 +263,9 @@ osm_switch_t *osm_switch_new(IN osm_node_t * const p_node,
 *
 * SYNOPSIS
 */
-static inline uint8_t
-osm_switch_get_hop_count(IN const osm_switch_t * const p_sw,
-			 IN const uint16_t lid_ho, IN const uint8_t port_num)
+static inline uint8_t osm_switch_get_hop_count(IN const osm_switch_t * p_sw,
+					       IN uint16_t lid_ho,
+					       IN uint8_t port_num)
 {
 	return (lid_ho > p_sw->max_lid_ho || !p_sw->hops[lid_ho]) ?
 	    OSM_NO_PATH : p_sw->hops[lid_ho][port_num];
@@ -283,10 +298,8 @@ osm_switch_get_hop_count(IN const osm_switch_t * const p_sw,
 *
 * SYNOPSIS
 */
-cl_status_t
-osm_switch_set_hops(IN osm_switch_t * const p_sw,
-		    IN const uint16_t lid_ho,
-		    IN const uint8_t port_num, IN const uint8_t num_hops);
+cl_status_t osm_switch_set_hops(IN osm_switch_t * p_sw, IN uint16_t lid_ho,
+				IN uint8_t port_num, IN uint8_t num_hops);
 /*
 * PARAMETERS
 *	p_sw
@@ -302,7 +315,7 @@ osm_switch_set_hops(IN osm_switch_t * const p_sw,
 *		[in] value to assign to this entry.
 *
 * RETURN VALUES
-*	Returns the hop count at the specified LID/Port intersection.
+*	Returns 0 if successfull. -1 if it failed
 *
 * NOTES
 *
@@ -339,9 +352,8 @@ void osm_switch_clear_hops(IN osm_switch_t * p_sw);
 *
 * SYNOPSIS
 */
-static inline uint8_t
-osm_switch_get_least_hops(IN const osm_switch_t * const p_sw,
-			  IN const uint16_t lid_ho)
+static inline uint8_t osm_switch_get_least_hops(IN const osm_switch_t * p_sw,
+						IN uint16_t lid_ho)
 {
 	return (lid_ho > p_sw->max_lid_ho || !p_sw->hops[lid_ho]) ?
 	    OSM_NO_PATH : p_sw->hops[lid_ho][0];
@@ -374,9 +386,8 @@ osm_switch_get_least_hops(IN const osm_switch_t * const p_sw,
 *
 * SYNOPSIS
 */
-uint8_t
-osm_switch_get_port_least_hops(IN const osm_switch_t * const p_sw,
-			       IN const osm_port_t * p_port);
+uint8_t osm_switch_get_port_least_hops(IN const osm_switch_t * p_sw,
+				       IN const osm_port_t * p_port);
 /*
 * PARAMETERS
 *	p_sw
@@ -405,11 +416,10 @@ osm_switch_get_port_least_hops(IN const osm_switch_t * const p_sw,
 *
 * SYNOPSIS
 */
-static inline uint8_t
-osm_switch_get_port_by_lid(IN const osm_switch_t * const p_sw,
-			   IN const uint16_t lid_ho)
+static inline uint8_t osm_switch_get_port_by_lid(IN const osm_switch_t * p_sw,
+						 IN uint16_t lid_ho)
 {
-	if (lid_ho == 0 || lid_ho > IB_LID_UCAST_END_HO)
+	if (lid_ho == 0 || lid_ho > p_sw->max_lid_ho)
 		return OSM_NO_PATH;
 	return p_sw->lft[lid_ho];
 }
@@ -430,37 +440,6 @@ osm_switch_get_port_by_lid(IN const osm_switch_t * const p_sw,
 *	Switch object
 *********/
 
-/****f* OpenSM: Switch/osm_switch_get_physp_ptr
-* NAME
-*	osm_switch_get_physp_ptr
-*
-* DESCRIPTION
-*	Gets the Physical Port Object at the specified port number.
-*
-* SYNOPSIS
-*/
-osm_physp_t *osm_switch_get_physp_ptr(IN const osm_switch_t * const p_sw,
-				      IN const uint32_t port_num);
-/*
-* PARAMETERS
-*	p_sw
-*		[in] Pointer to an osm_switch_t object.
-*
-*	port_num
-*		[in] Port number for which to retrieve the Physical Port Object.
-*
-* RETURN VALUES
-*	Returns a pointer to the Physical Port Object object at the specified
-*	port number.
-*	A return value of zero means the port number was out of range.
-*
-*
-* NOTES
-*
-* SEE ALSO
-*	Switch object
-*********/
-
 /****f* OpenSM: Switch/osm_switch_get_route_by_lid
 * NAME
 *	osm_switch_get_route_by_lid
@@ -471,8 +450,7 @@ osm_physp_t *osm_switch_get_physp_ptr(IN const osm_switch_t * const p_sw,
 * SYNOPSIS
 */
 static inline osm_physp_t *osm_switch_get_route_by_lid(IN const osm_switch_t *
-						       const p_sw,
-						       IN const ib_net16_t lid)
+						       p_sw, IN ib_net16_t lid)
 {
 	uint8_t port_num;
 
@@ -523,7 +501,7 @@ static inline osm_physp_t *osm_switch_get_route_by_lid(IN const osm_switch_t *
 *
 */
 static inline unsigned
-osm_switch_sp0_is_lmc_capable(IN const osm_switch_t * const p_sw,
+osm_switch_sp0_is_lmc_capable(IN const osm_switch_t * p_sw,
 			      IN osm_subn_t * p_subn)
 {
 	return (p_subn->opt.lmc_esp0 &&
@@ -558,7 +536,7 @@ osm_switch_sp0_is_lmc_capable(IN const osm_switch_t * const p_sw,
 * SYNOPSIS
 */
 static inline uint16_t
-osm_switch_get_max_block_id_in_use(IN const osm_switch_t * const p_sw)
+osm_switch_get_max_block_id_in_use(IN const osm_switch_t * p_sw)
 {
 	return cl_ntoh16(p_sw->switch_info.lin_top) / IB_SMP_DATA_SIZE;
 }
@@ -585,10 +563,8 @@ osm_switch_get_max_block_id_in_use(IN const osm_switch_t * const p_sw)
 *
 * SYNOPSIS
 */
-boolean_t
-osm_switch_get_lft_block(IN const osm_switch_t * const p_sw,
-			 IN const uint16_t block_id,
-			 OUT uint8_t * const p_block);
+boolean_t osm_switch_get_lft_block(IN const osm_switch_t * p_sw,
+				   IN uint16_t block_id, OUT uint8_t * p_block);
 /*
 * PARAMETERS
 *	p_sw
@@ -599,7 +575,7 @@ osm_switch_get_lft_block(IN const osm_switch_t * const p_sw,
 *
 *	p_block
 *		[out] Pointer to the 64 byte array to store the
-*		forwarding table clock specified by block_id.
+*		forwarding table block specified by block_id.
 *
 * RETURN VALUES
 *	Returns true if there are more blocks necessary to
@@ -620,8 +596,7 @@ osm_switch_get_lft_block(IN const osm_switch_t * const p_sw,
 *
 * SYNOPSIS
 */
-static inline boolean_t
-osm_switch_supports_mcast(IN const osm_switch_t * const p_sw)
+static inline boolean_t osm_switch_supports_mcast(IN const osm_switch_t * p_sw)
 {
 	return (p_sw->switch_info.mcast_cap != 0);
 }
@@ -648,9 +623,8 @@ osm_switch_supports_mcast(IN const osm_switch_t * const p_sw)
 *
 * SYNOPSIS
 */
-static inline void
-osm_switch_set_switch_info(IN osm_switch_t * const p_sw,
-			   IN const ib_switch_info_t * const p_si)
+static inline void osm_switch_set_switch_info(IN osm_switch_t * p_sw,
+					      IN const ib_switch_info_t * p_si)
 {
 	CL_ASSERT(p_sw);
 	CL_ASSERT(p_si);
@@ -681,8 +655,8 @@ osm_switch_set_switch_info(IN osm_switch_t * const p_sw,
 *
 * SYNOPSIS
 */
-static inline void
-osm_switch_count_path(IN osm_switch_t * const p_sw, IN const uint8_t port)
+static inline void osm_switch_count_path(IN osm_switch_t * p_sw,
+					 IN uint8_t port)
 {
 	osm_port_prof_path_count_inc(&p_sw->p_prof[port]);
 }
@@ -713,15 +687,14 @@ osm_switch_count_path(IN osm_switch_t * const p_sw, IN const uint8_t port)
 * SYNOPSIS
 */
 static inline ib_api_status_t
-osm_switch_set_lft_block(IN osm_switch_t * const p_sw,
-			 IN const uint8_t * const p_block,
-			 IN const uint32_t block_num)
+osm_switch_set_lft_block(IN osm_switch_t * p_sw, IN const uint8_t * p_block,
+			 IN uint32_t block_num)
 {
 	uint16_t lid_start =
 		(uint16_t) (block_num * IB_SMP_DATA_SIZE);
 	CL_ASSERT(p_sw);
 
-	if (lid_start + IB_SMP_DATA_SIZE > IB_LID_UCAST_END_HO)
+	if (lid_start + IB_SMP_DATA_SIZE > p_sw->lft_size)
 		return IB_INVALID_PARAMETER;
 
 	memcpy(&p_sw->lft[lid_start], p_block, IB_SMP_DATA_SIZE);
@@ -756,13 +729,12 @@ osm_switch_set_lft_block(IN osm_switch_t * const p_sw,
 * SYNOPSIS
 */
 static inline ib_api_status_t
-osm_switch_set_mft_block(IN osm_switch_t * const p_sw,
-			 IN const ib_net16_t * const p_block,
-			 IN const uint16_t block_num, IN const uint8_t position)
+osm_switch_set_mft_block(IN osm_switch_t * p_sw, IN const ib_net16_t * p_block,
+			 IN uint16_t block_num, IN uint8_t position)
 {
 	CL_ASSERT(p_sw);
-	return (osm_mcast_tbl_set_block(&p_sw->mcast_tbl, p_block,
-					block_num, position));
+	return osm_mcast_tbl_set_block(&p_sw->mcast_tbl, p_block, block_num,
+				       position);
 }
 /*
 * PARAMETERS
@@ -795,15 +767,14 @@ osm_switch_set_mft_block(IN osm_switch_t * const p_sw,
 *
 * SYNOPSIS
 */
-static inline boolean_t
-osm_switch_get_mft_block(IN osm_switch_t * const p_sw,
-			 IN const uint16_t block_num,
-			 IN const uint8_t position,
-			 OUT ib_net16_t * const p_block)
+static inline boolean_t osm_switch_get_mft_block(IN osm_switch_t * p_sw,
+						 IN uint16_t block_num,
+						 IN uint8_t position,
+						 OUT ib_net16_t * p_block)
 {
 	CL_ASSERT(p_sw);
-	return (osm_mcast_tbl_get_block(&p_sw->mcast_tbl,
-					block_num, position, p_block));
+	return osm_mcast_tbl_get_block(&p_sw->mcast_tbl, block_num, position,
+				       p_block);
 }
 /*
 * PARAMETERS
@@ -838,11 +809,10 @@ osm_switch_get_mft_block(IN osm_switch_t * const p_sw,
 *
 * SYNOPSIS
 */
-static inline uint16_t
-osm_switch_get_mft_max_block(IN osm_switch_t * const p_sw)
+static inline uint16_t osm_switch_get_mft_max_block(IN osm_switch_t * p_sw)
 {
 	CL_ASSERT(p_sw);
-	return (osm_mcast_tbl_get_max_block(&p_sw->mcast_tbl));
+	return osm_mcast_tbl_get_max_block(&p_sw->mcast_tbl);
 }
 /*
 * PARAMETERS
@@ -861,11 +831,10 @@ osm_switch_get_mft_max_block(IN osm_switch_t * const p_sw)
 *
 * SYNOPSIS
 */
-static inline int16_t
-osm_switch_get_mft_max_block_in_use(IN osm_switch_t * const p_sw)
+static inline int16_t osm_switch_get_mft_max_block_in_use(IN osm_switch_t * p_sw)
 {
 	CL_ASSERT(p_sw);
-	return (osm_mcast_tbl_get_max_block_in_use(&p_sw->mcast_tbl));
+	return osm_mcast_tbl_get_max_block_in_use(&p_sw->mcast_tbl);
 }
 /*
 * PARAMETERS
@@ -890,11 +859,10 @@ osm_switch_get_mft_max_block_in_use(IN osm_switch_t * const p_sw)
 *
 * SYNOPSIS
 */
-static inline uint8_t
-osm_switch_get_mft_max_position(IN osm_switch_t * const p_sw)
+static inline uint8_t osm_switch_get_mft_max_position(IN osm_switch_t * p_sw)
 {
 	CL_ASSERT(p_sw);
-	return (osm_mcast_tbl_get_max_position(&p_sw->mcast_tbl));
+	return osm_mcast_tbl_get_max_position(&p_sw->mcast_tbl);
 }
 /*
 * PARAMETERS
@@ -904,6 +872,35 @@ osm_switch_get_mft_max_position(IN osm_switch_t * const p_sw)
 * RETURN VALUE
 */
 
+/****f* OpenSM: Switch/osm_switch_get_dimn_port
+* NAME
+*	osm_switch_get_dimn_port
+*
+* DESCRIPTION
+*	Get the routing ordered port
+*
+* SYNOPSIS
+*/
+static inline uint8_t osm_switch_get_dimn_port(IN const osm_switch_t * p_sw,
+					       IN uint8_t port_num)
+{
+	CL_ASSERT(p_sw);
+	if (p_sw->search_ordering_ports == NULL)
+		return port_num;
+	return p_sw->search_ordering_ports[port_num];
+}
+/*
+* PARAMETERS
+*	p_sw
+*		[in] Pointer to the switch object.
+*
+*	port_num
+*		[in] Port number in the switch
+*
+* RETURN VALUES
+*	Returns the port number ordered for routing purposes.
+*/
+
 /****f* OpenSM: Switch/osm_switch_recommend_path
 * NAME
 *	osm_switch_recommend_path
@@ -917,13 +914,14 @@ osm_switch_get_mft_max_position(IN osm_switch_t * const p_sw)
 *
 * SYNOPSIS
 */
-uint8_t
-osm_switch_recommend_path(IN const osm_switch_t * const p_sw,
-			  IN osm_port_t * p_port,
-			  IN const uint16_t lid_ho,
-			  IN unsigned start_from,
-			  IN const boolean_t ignore_existing,
-			  IN const boolean_t dor);
+uint8_t osm_switch_recommend_path(IN const osm_switch_t * p_sw,
+				  IN osm_port_t * p_port, IN uint16_t lid_ho,
+				  IN unsigned start_from,
+				  IN boolean_t ignore_existing,
+				  IN boolean_t routing_for_lmc,
+				  IN boolean_t dor,
+				  IN boolean_t port_shifting,
+				  IN uint32_t scatter_ports);
 /*
 * PARAMETERS
 *	p_sw
@@ -945,9 +943,26 @@ osm_switch_recommend_path(IN const osm_switch_t * const p_sw,
 *		If false, the switch will choose an existing route if one
 *		exists, otherwise will choose the optimal route.
 *
+*	routing_for_lmc
+*		[in] We support an enhanced LMC aware routing mode:
+*		In the case of LMC > 0, we can track the remote side
+*		system and node for all of the lids of the target
+*		and try and avoid routing again through the same
+*		system / node.
+*
+*		Assume if routing_for_lmc is TRUE that this procedure
+*		was provided with the tracking array and counter via
+*		p_port->priv, and we can conduct this algorithm.
+*
 *	dor
 *		[in] If TRUE, Dimension Order Routing will be done.
 *
+*	port_shifting
+*		[in] If TRUE, port_shifting will be done.
+*
+* 	scatter_ports
+* 		[in] If not zero, randomize the selection of the best ports.
+*
 * RETURN VALUE
 *	Returns the recommended port on which to route this LID.
 *
@@ -965,11 +980,10 @@ osm_switch_recommend_path(IN const osm_switch_t * const p_sw,
 *
 * SYNOPSIS
 */
-uint8_t
-osm_switch_recommend_mcast_path(IN osm_switch_t * const p_sw,
-				IN osm_port_t * p_port,
-				IN const uint16_t mlid_ho,
-				IN const boolean_t ignore_existing);
+uint8_t osm_switch_recommend_mcast_path(IN osm_switch_t * p_sw,
+					IN osm_port_t * p_port,
+					IN uint16_t mlid_ho,
+					IN boolean_t ignore_existing);
 /*
 * PARAMETERS
 *	p_sw
@@ -1006,9 +1020,9 @@ osm_switch_recommend_mcast_path(IN osm_switch_t * const p_sw,
 * SYNOPSIS
 */
 static inline uint16_t
-osm_switch_get_mcast_fwd_tbl_size(IN const osm_switch_t * const p_sw)
+osm_switch_get_mcast_fwd_tbl_size(IN const osm_switch_t * p_sw)
 {
-	return (cl_ntoh16(p_sw->switch_info.mcast_cap));
+	return cl_ntoh16(p_sw->switch_info.mcast_cap);
 }
 /*
 * PARAMETERS
@@ -1032,11 +1046,10 @@ osm_switch_get_mcast_fwd_tbl_size(IN const osm_switch_t * const p_sw)
 *
 * SYNOPSIS
 */
-static inline uint32_t
-osm_switch_path_count_get(IN const osm_switch_t * const p_sw,
-			  IN const uint8_t port_num)
+static inline uint32_t osm_switch_path_count_get(IN const osm_switch_t * p_sw,
+						 IN uint8_t port_num)
 {
-	return (osm_port_prof_path_count_get(&p_sw->p_prof[port_num]));
+	return osm_port_prof_path_count_get(&p_sw->p_prof[port_num]);
 }
 /*
 * PARAMETERS
@@ -1063,8 +1076,8 @@ osm_switch_path_count_get(IN const osm_switch_t * const p_sw,
 *
 * SYNOPSIS
 */
-int
-osm_switch_prepare_path_rebuild(IN osm_switch_t * p_sw, IN uint16_t max_lids);
+int osm_switch_prepare_path_rebuild(IN osm_switch_t * p_sw,
+				    IN uint16_t max_lids);
 /*
 * PARAMETERS
 *	p_sw
@@ -1091,10 +1104,9 @@ osm_switch_prepare_path_rebuild(IN osm_switch_t * p_sw, IN uint16_t max_lids);
 * SYNOPSIS
 */
 static inline osm_mcast_tbl_t *osm_switch_get_mcast_tbl_ptr(IN const
-							    osm_switch_t *
-							    const p_sw)
+							    osm_switch_t * p_sw)
 {
-	return ((osm_mcast_tbl_t *) & p_sw->mcast_tbl);
+	return (osm_mcast_tbl_t *) & p_sw->mcast_tbl;
 }
 /*
 * PARAMETERS
@@ -1120,16 +1132,15 @@ static inline osm_mcast_tbl_t *osm_switch_get_mcast_tbl_ptr(IN const
 * SYNOPSIS
 */
 static inline boolean_t
-osm_switch_is_in_mcast_tree(IN const osm_switch_t * const p_sw,
-			    IN const uint16_t mlid_ho)
+osm_switch_is_in_mcast_tree(IN const osm_switch_t * p_sw, IN uint16_t mlid_ho)
 {
 	const osm_mcast_tbl_t *p_tbl;
 
 	p_tbl = &p_sw->mcast_tbl;
 	if (p_tbl)
-		return (osm_mcast_tbl_is_any_port(&p_sw->mcast_tbl, mlid_ho));
+		return osm_mcast_tbl_is_any_port(&p_sw->mcast_tbl, mlid_ho);
 	else
-		return (FALSE);
+		return FALSE;
 }
 /*
 * PARAMETERS
diff --git a/include/opensm/osm_ucast_cache.h b/include/opensm/osm_ucast_cache.h
index 11335c7..e186590 100644
--- a/include/opensm/osm_ucast_cache.h
+++ b/include/opensm/osm_ucast_cache.h
@@ -1,5 +1,6 @@
 /*
- * Copyright (c) 2008      Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2008 Mellanox Technologies LTD. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
diff --git a/opensm/osm_mcm_port.c b/include/opensm/osm_ucast_lash.h
similarity index 55%
copy from opensm/osm_mcm_port.c
copy to include/opensm/osm_ucast_lash.h
index b6b6149..dd90d5d 100644
--- a/opensm/osm_mcm_port.c
+++ b/include/opensm/osm_ucast_lash.h
@@ -1,7 +1,10 @@
 /*
+ * Copyright (c) 2008,2009 System Fabric Works, Inc. All rights reserved.
  * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2007      Simula Research Laboratory. All rights reserved.
+ * Copyright (c) 2007      Silicon Graphics Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -35,42 +38,60 @@
 
 /*
  * Abstract:
- *    Implementation of osm_mcm_port_t.
- * This object represents the membership of a port in a multicast group.
- * This object is part of the OpenSM family of objects.
+ *      Declarations for LASH algorithm
  */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif				/* HAVE_CONFIG_H */
+#ifndef OSM_UCAST_LASH_H
+#define OSM_UCAST_LASH_H
 
-#include <stdlib.h>
-#include <string.h>
-#include <opensm/osm_mcm_port.h>
+#include <opensm/osm_mesh.h>
 
-/**********************************************************************
- **********************************************************************/
-osm_mcm_port_t *osm_mcm_port_new(IN const ib_gid_t * const p_port_gid,
-				 IN const uint8_t scope_state,
-				 IN const boolean_t proxy_join)
-{
-	osm_mcm_port_t *p_mcm;
+enum {
+	UNQUEUED,
+	Q_MEMBER,
+	MST_MEMBER,
+	MAX_INT = 9999,
+	NONE = MAX_INT
+};
 
-	p_mcm = malloc(sizeof(*p_mcm));
-	if (p_mcm) {
-		memset(p_mcm, 0, sizeof(*p_mcm));
-		p_mcm->port_gid = *p_port_gid;
-		p_mcm->scope_state = scope_state;
-		p_mcm->proxy_join = proxy_join;
-	}
+typedef struct _cdg_vertex {
+	int from;
+	int to;
+	int seen;
+	int temp;
+	int visiting_number;
+	struct _cdg_vertex *next;
+	int num_temp_depend;
+	int num_using_vertex;
+	int num_deps;
+	struct vertex_deps {
+		struct _cdg_vertex *v;
+		int num_used;
+	} deps[0];
+} cdg_vertex_t;
 
-	return (p_mcm);
-}
+typedef struct _switch {
+	osm_switch_t *p_sw;
+	int id;
+	int used_channels;
+	int *dij_channels;
+	int q_state;
+	mesh_node_t *node;
+	struct routing_table {
+		unsigned out_link;
+		unsigned lane;
+	} routing_table[0];
+} switch_t;
 
-/**********************************************************************
- **********************************************************************/
-void osm_mcm_port_delete(IN osm_mcm_port_t * const p_mcm)
-{
-	CL_ASSERT(p_mcm);
-	free(p_mcm);
-}
+typedef struct _lash {
+	osm_opensm_t *p_osm;
+	int num_switches;
+	uint8_t vl_min;
+	int balance_limit;
+	switch_t **switches;
+	cdg_vertex_t ****cdg_vertex_matrix;
+	int num_mst_in_lane[IB_MAX_NUM_VLS];
+	int ***virtual_location;
+} lash_t;
+
+#endif
diff --git a/include/opensm/osm_ucast_mgr.h b/include/opensm/osm_ucast_mgr.h
index a040476..c534b7e 100644
--- a/include/opensm/osm_ucast_mgr.h
+++ b/include/opensm/osm_ucast_mgr.h
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -95,6 +95,7 @@ typedef struct osm_ucast_mgr {
 	osm_subn_t *p_subn;
 	osm_log_t *p_log;
 	cl_plock_t *p_lock;
+	uint16_t max_lid;
 	cl_qlist_t port_order_list;
 	boolean_t is_dor;
 	boolean_t some_hop_count_set;
@@ -121,11 +122,6 @@ typedef struct osm_ucast_mgr {
 *	port_order_list
 *		List of ports ordered for routing.
 *
-*	any_change
-*		Initialized to FALSE at the beginning of the algorithm,
-*		set to TRUE by osm_ucast_mgr_set_fwd_table() if any mad
-*		was sent.
-*
 *	some_hop_count_set
 *		Initialized to FALSE at the beginning of each the min hop
 *		tables calculation iteration cycle, set to TRUE to indicate
@@ -150,7 +146,7 @@ typedef struct osm_ucast_mgr {
 *
 * SYNOPSIS
 */
-void osm_ucast_mgr_construct(IN osm_ucast_mgr_t * const p_mgr);
+void osm_ucast_mgr_construct(IN osm_ucast_mgr_t * p_mgr);
 /*
 * PARAMETERS
 *	p_mgr
@@ -180,7 +176,7 @@ void osm_ucast_mgr_construct(IN osm_ucast_mgr_t * const p_mgr);
 *
 * SYNOPSIS
 */
-void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * const p_mgr);
+void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * p_mgr);
 /*
 * PARAMETERS
 *	p_mgr
@@ -211,8 +207,8 @@ void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * const p_mgr);
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_ucast_mgr_init(IN osm_ucast_mgr_t * const p_mgr, IN struct osm_sm * sm);
+ib_api_status_t osm_ucast_mgr_init(IN osm_ucast_mgr_t * p_mgr,
+				   IN struct osm_sm * sm);
 /*
 * PARAMETERS
 *	p_mgr
@@ -233,25 +229,21 @@ osm_ucast_mgr_init(IN osm_ucast_mgr_t * const p_mgr, IN struct osm_sm * sm);
 *	osm_ucast_mgr_destroy
 *********/
 
-/****f* OpenSM: Unicast Manager/osm_ucast_mgr_set_fwd_table
+/****f* OpenSM: Unicast Manager/osm_ucast_mgr_set_fwd_tables
 * NAME
-*	osm_ucast_mgr_set_fwd_table
+*	osm_ucast_mgr_set_fwd_tables
 *
 * DESCRIPTION
 *	Setup forwarding table for the switch (from prepared new_lft).
 *
 * SYNOPSIS
 */
-int osm_ucast_mgr_set_fwd_table(IN osm_ucast_mgr_t * const p_mgr,
-				IN osm_switch_t * const p_sw);
+void osm_ucast_mgr_set_fwd_tables(IN osm_ucast_mgr_t * p_mgr);
 /*
 * PARAMETERS
 *	p_mgr
 *		[in] Pointer to an osm_ucast_mgr_t object.
 *
-*	p_mgr
-*		[in] Pointer to an osm_switch_t object.
-*
 * SEE ALSO
 *	Unicast Manager
 *********/
@@ -265,7 +257,7 @@ int osm_ucast_mgr_set_fwd_table(IN osm_ucast_mgr_t * const p_mgr,
 *
 * SYNOPSIS
 */
-int osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * const p_mgr);
+int osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * p_mgr);
 /*
 * PARAMETERS
 *	p_mgr
@@ -288,7 +280,7 @@ int osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * const p_mgr);
 *
 * SYNOPSIS
 */
-int osm_ucast_mgr_process(IN osm_ucast_mgr_t * const p_mgr);
+int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr);
 /*
 * PARAMETERS
 *	p_mgr
diff --git a/opensm/osm_mcm_info.c b/include/opensm/osm_version.h
similarity index 60%
rename from opensm/osm_mcm_info.c
rename to include/opensm/osm_version.h
index 0325a34..32109f3 100644
--- a/opensm/osm_mcm_info.c
+++ b/include/opensm/osm_version.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -33,38 +33,19 @@
  *
  */
 
-/*
- * Abstract:
- *    Declaration of osm_mcm_info_t.
- * This object represents a Multicast Forwarding Information object.
- * This object is part of the OpenSM family of objects.
- */
-
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif				/* HAVE_CONFIG_H */
-
-#include <stdlib.h>
-#include <opensm/osm_mcm_info.h>
-
-/**********************************************************************
- **********************************************************************/
-osm_mcm_info_t *osm_mcm_info_new(IN const ib_net16_t mlid)
-{
-	osm_mcm_info_t *p_mcm;
-
-	p_mcm = (osm_mcm_info_t *) malloc(sizeof(*p_mcm));
-	if (p_mcm) {
-		memset(p_mcm, 0, sizeof(*p_mcm));
-		p_mcm->mlid = mlid;
-	}
+#ifndef _OSM_VERSION_H_
+#define _OSM_VERSION_H_
 
-	return (p_mcm);
-}
+/****s* OpenSM: Base/OSM_VERSION
+* NAME
+*	OSM_VERSION
+*
+* DESCRIPTION
+*	The version string for OpenSM
+*
+* SYNOPSIS
+*/
+#define OSM_VERSION "OpenSM 3.3.15"
+/********/
 
-/**********************************************************************
- **********************************************************************/
-void osm_mcm_info_delete(IN osm_mcm_info_t * const p_mcm)
-{
-	free(p_mcm);
-}
+#endif				/* _OSM_VERSION_H_ */
diff --git a/include/opensm/osm_vl15intf.h b/include/opensm/osm_vl15intf.h
index 028eec0..e621c68 100644
--- a/include/opensm/osm_vl15intf.h
+++ b/include/opensm/osm_vl15intf.h
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -36,7 +36,7 @@
 /*
  * Abstract:
  * 	Declaration of osm_vl15_t.
- *	This object represents an IBA subnet.
+ *	This object represents a VL15 interface object.
  *	This object is part of the OpenSM family of objects.
  */
 
@@ -117,6 +117,8 @@ typedef struct osm_vl15 {
 	osm_thread_state_t thread_state;
 	osm_vl15_state_t state;
 	uint32_t max_wire_smps;
+	uint32_t max_wire_smps2;
+	uint32_t max_smps_timeout;
 	cl_event_t signal;
 	cl_thread_t poller;
 	cl_qlist_t rfifo;
@@ -137,6 +139,12 @@ typedef struct osm_vl15 {
 *	max_wire_smps
 *		Maximum number of VL15 MADs allowed on the wire at one time.
 *
+*	max_wire_smps2
+*		Maximum number of timeout based SMPs allowed to be outstanding.
+*
+*	max_smps_timeout
+*		Wait time in usec for timeout based SMPs.
+*
 *	signal
 *		Event on which the poller sleeps.
 *
@@ -176,7 +184,7 @@ typedef struct osm_vl15 {
 *
 * SYNOPSIS
 */
-void osm_vl15_construct(IN osm_vl15_t * const p_vl15);
+void osm_vl15_construct(IN osm_vl15_t * p_vl15);
 /*
 * PARAMETERS
 *	p_vl15
@@ -205,8 +213,7 @@ void osm_vl15_construct(IN osm_vl15_t * const p_vl15);
 *
 * SYNOPSIS
 */
-void
-osm_vl15_destroy(IN osm_vl15_t * const p_vl15, IN struct osm_mad_pool *p_pool);
+void osm_vl15_destroy(IN osm_vl15_t * p_vl15, IN struct osm_mad_pool *p_pool);
 /*
 * PARAMETERS
 *	p_vl15
@@ -242,12 +249,11 @@ osm_vl15_destroy(IN osm_vl15_t * const p_vl15, IN struct osm_mad_pool *p_pool);
 *
 * SYNOPSIS
 */
-ib_api_status_t
-osm_vl15_init(IN osm_vl15_t * const p_vl15,
-	      IN osm_vendor_t * const p_vend,
-	      IN osm_log_t * const p_log,
-	      IN osm_stats_t * const p_stats,
-	      IN const int32_t max_wire_smps);
+ib_api_status_t osm_vl15_init(IN osm_vl15_t * p_vl15, IN osm_vendor_t * p_vend,
+			      IN osm_log_t * p_log, IN osm_stats_t * p_stats,
+			      IN int32_t max_wire_smps,
+			      IN int32_t max_wire_smps2,
+			      IN uint32_t max_smps_timeout);
 /*
 * PARAMETERS
 *	p_vl15
@@ -263,7 +269,15 @@ osm_vl15_init(IN osm_vl15_t * const p_vl15,
 *		[in] Pointer to the OpenSM stastics block.
 *
 *	max_wire_smps
-*		[in] Maximum number of MADs allowed on the wire at one time.
+*		[in] Maximum number of SMPs allowed on the wire at one time.
+*
+*	max_wire_smps2
+*		[in] Maximum number of timeout based SMPs allowed to be
+*		     outstanding.
+*
+*	max_smps_timeout
+*		[in] Wait time in usec for timeout based SMPs.
+*
 *
 * RETURN VALUES
 *	IB_SUCCESS if the VL15 object was initialized successfully.
@@ -284,7 +298,7 @@ osm_vl15_init(IN osm_vl15_t * const p_vl15,
 *
 * SYNOPSIS
 */
-void osm_vl15_post(IN osm_vl15_t * const p_vl15, IN osm_madw_t * const p_madw);
+void osm_vl15_post(IN osm_vl15_t * p_vl15, IN osm_madw_t * p_madw);
 /*
 * PARAMETERS
 *	p_vl15
@@ -313,7 +327,7 @@ void osm_vl15_post(IN osm_vl15_t * const p_vl15, IN osm_madw_t * const p_madw);
 *
 * SYNOPSIS
 */
-void osm_vl15_poll(IN osm_vl15_t * const p_vl);
+void osm_vl15_poll(IN osm_vl15_t * p_vl);
 /*
 * PARAMETERS
 *	p_vl15
@@ -343,9 +357,7 @@ void osm_vl15_poll(IN osm_vl15_t * const p_vl);
 *
 * SYNOPSIS
 */
-void
-osm_vl15_shutdown(IN osm_vl15_t * const p_vl,
-		  IN osm_mad_pool_t * const p_mad_pool);
+void osm_vl15_shutdown(IN osm_vl15_t * p_vl, IN osm_mad_pool_t * p_mad_pool);
 /*
 * PARAMETERS
 *	p_vl15
diff --git a/include/opensm/st.h b/include/opensm/st.h
index 30cc308..ad6c289 100644
--- a/include/opensm/st.h
+++ b/include/opensm/st.h
@@ -39,6 +39,7 @@
 #define ST_INCLUDED
 
 #include <stdlib.h>
+#include <inttypes.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -49,7 +50,7 @@
 #endif				/* __cplusplus */
 
 BEGIN_C_DECLS
-#define st_ptr_t unsigned long
+#define st_ptr_t uintptr_t
 typedef st_ptr_t st_data_t;
 
 #define ST_DATA_T_DEFINED
diff --git a/include/vendor/osm_vendor.h b/include/vendor/osm_vendor.h
index 4d0ae4c..31b8eb8 100644
--- a/include/vendor/osm_vendor.h
+++ b/include/vendor/osm_vendor.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -65,7 +65,7 @@
 #include <vendor/osm_vendor_ibumad.h>
 #elif defined( OSM_VENDOR_INTF_AL )
 #include <vendor/osm_vendor_al.h>
-#elif
+#else
 #error No MAD Interface selected!
 #error Choose an interface in osm_config.h
 #endif
diff --git a/include/vendor/osm_vendor_api.h b/include/vendor/osm_vendor_api.h
index 70eb6cc..4973417 100644
--- a/include/vendor/osm_vendor_api.h
+++ b/include/vendor/osm_vendor_api.h
@@ -172,9 +172,9 @@ void osm_vendor_delete(IN osm_vendor_t ** const pp_vend);
 * SEE ALSO
 *********/
 
-/****f* OpenSM Vendor API/osm_vendor_get_ports
+/****f* OpenSM Vendor API/osm_vendor_get_all_port_attr
 * NAME
-*  osm_vendor_get_ports
+*  osm_vendor_get_all_port_attr
 *
 * DESCRIPTION
 *  Returns an array of available port attribute structures.
@@ -197,7 +197,7 @@ osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
 *
 *  p_num_ports
 *     [in/out] Pointer to a variable to hold the total number of ports
-*     available on the local machine..
+*     available on the local machine.
 *
 * RETURN VALUES
 *  IB_SUCCESS on success.
@@ -219,8 +219,8 @@ osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
 * SYNOPSIS
 */
 ib_api_status_t
-osm_vendor_init(IN osm_vendor_t * const p_vend,
-		IN osm_log_t * const p_log, IN const uint32_t timeout);
+osm_vendor_init(IN osm_vendor_t * const p_vend, IN osm_log_t * const p_log,
+		IN const uint32_t timeout);
 /*
 * PARAMETERS
 *  p_vend
@@ -370,8 +370,8 @@ osm_vendor_send(IN osm_bind_handle_t h_bind,
 *
 * NOTES
 *   1. Only mads that expect a response are tracked for transaction competion.
-*   2. A mad that does not expect a response is being put back immediatly after
-*      being sent.
+*   2. A mad that does not expect a response is being put back immediately
+*      after being sent.
 *
 * SEE ALSO
 *********/
diff --git a/include/vendor/osm_vendor_ibumad.h b/include/vendor/osm_vendor_ibumad.h
index 3a3f070..c33a187 100644
--- a/include/vendor/osm_vendor_ibumad.h
+++ b/include/vendor/osm_vendor_ibumad.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -41,7 +41,6 @@
 #include <opensm/osm_base.h>
 #include <opensm/osm_log.h>
 
-#include <infiniband/common.h>
 #include <infiniband/umad.h>
 
 #ifdef __cplusplus
@@ -67,12 +66,14 @@ BEGIN_C_DECLS
 #define OSM_DEFAULT_RETRY_COUNT 3
 #define OSM_UMAD_MAX_CAS	32
 #define OSM_UMAD_MAX_PORTS_PER_CA	2
+#define OSM_UMAD_MAX_AGENTS	32
+
 /****s* OpenSM: Vendor UMAD/osm_ca_info_t
 * NAME
 *   osm_ca_info_t
 *
 * DESCRIPTION
-* 	Structure containing information about local Channle Adapters.
+* 	Structure containing information about local Channel Adapters.
 *
 * SYNOPSIS
 */
@@ -139,6 +140,7 @@ typedef struct _umad_match {
 	ib_net64_t tid;
 	void *v;
 	uint32_t version;
+	uint8_t mgmt_class;
 } umad_match_t;
 
 #define DEFAULT_OSM_UMAD_MAX_PENDING	1000
@@ -155,7 +157,7 @@ typedef struct _osm_vendor {
 	osm_ca_info_t *p_ca_info;
 	uint32_t timeout;
 	int max_retries;
-	osm_bind_handle_t agents[UMAD_CA_MAX_AGENTS];
+	osm_bind_handle_t agents[OSM_UMAD_MAX_AGENTS];
 	char ca_names[OSM_UMAD_MAX_CAS][UMAD_CA_NAME_LEN];
 	vendor_match_tbl_t mtbl;
 	umad_port_t umad_port;
diff --git a/include/vendor/osm_vendor_mlx.h b/include/vendor/osm_vendor_mlx.h
index 106e0b4..bc0847b 100644
--- a/include/vendor/osm_vendor_mlx.h
+++ b/include/vendor/osm_vendor_mlx.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2007,2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -92,5 +92,8 @@ typedef struct _osm_vend_wrap {
 #define OSM_BIND_INVALID_HANDLE NULL
 #endif
 
+/* The maximum number of retransmissions of the same MAD */
+#define OSM_DEFAULT_RETRY_COUNT  3
+
 END_C_DECLS
 #endif
diff --git a/include/vendor/osm_vendor_mlx_defs.h b/include/vendor/osm_vendor_mlx_defs.h
index d4c2c30..c4ee053 100644
--- a/include/vendor/osm_vendor_mlx_defs.h
+++ b/include/vendor/osm_vendor_mlx_defs.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2005,2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -52,8 +52,6 @@
 BEGIN_C_DECLS
 /* The maximum number of outstanding MADs an RMPP sender can transmit */
 #define OSMV_RMPP_RECV_WIN       16
-/* The maximum number of retransmissions of the same MAD */
-#define OSMV_MAX_RETRANSMIT      3
 /* Transaction Timeout = OSMV_TXN_TIMEOUT_FACTOR * Response Timeout */
 #define OSMV_TXN_TIMEOUT_FACTOR  128
 /************/
diff --git a/include/vendor/osm_vendor_mlx_svc.h b/include/vendor/osm_vendor_mlx_svc.h
index f23a77d..43a83e3 100644
--- a/include/vendor/osm_vendor_mlx_svc.h
+++ b/include/vendor/osm_vendor_mlx_svc.h
@@ -50,12 +50,6 @@
 #endif				/* __cplusplus */
 
 BEGIN_C_DECLS
-inline static boolean_t osmv_mad_is_response(IN const ib_mad_t * p_mad)
-{
-	return (ib_mad_is_response(p_mad) ||
-		(p_mad->method == IB_MAD_METHOD_TRAP_REPRESS));
-}
-
 inline static uint8_t osmv_invert_method(IN uint8_t req_method)
 {
 	switch (req_method) {
diff --git a/include/vendor/osm_vendor_sa_api.h b/include/vendor/osm_vendor_sa_api.h
index 4a4eeaf..653d847 100644
--- a/include/vendor/osm_vendor_sa_api.h
+++ b/include/vendor/osm_vendor_sa_api.h
@@ -448,7 +448,7 @@ static inline ib_path_rec_t *osmv_get_query_path_rec(IN osm_madw_t *
 						     p_result_madw,
 						     IN uint32_t result_index)
 {
-	ib_sa_mad_t *p_sa_mad;
+	ib_sa_mad_t __attribute__((__unused__)) *p_sa_mad;
 
 	CL_ASSERT(p_result_madw);
 	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
@@ -490,7 +490,7 @@ static inline ib_portinfo_record_t *osmv_get_query_portinfo_rec(IN osm_madw_t *
 								IN uint32_t
 								result_index)
 {
-	ib_sa_mad_t *p_sa_mad;
+	ib_sa_mad_t __attribute__((__unused__)) *p_sa_mad;
 
 	CL_ASSERT(p_result_madw);
 	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
@@ -532,7 +532,7 @@ static inline ib_node_record_t *osmv_get_query_node_rec(IN osm_madw_t *
 							IN uint32_t
 							result_index)
 {
-	ib_sa_mad_t *p_sa_mad;
+	ib_sa_mad_t __attribute__((__unused__)) *p_sa_mad;
 
 	CL_ASSERT(p_result_madw);
 	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
@@ -574,7 +574,7 @@ static inline ib_service_record_t *osmv_get_query_svc_rec(IN osm_madw_t *
 							  IN uint32_t
 							  result_index)
 {
-	ib_sa_mad_t *p_sa_mad;
+	ib_sa_mad_t __attribute__((__unused__)) *p_sa_mad;
 
 	CL_ASSERT(p_result_madw);
 	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
@@ -615,7 +615,7 @@ static inline ib_member_rec_t *osmv_get_query_mc_rec(IN osm_madw_t *
 						     p_result_madw,
 						     IN uint32_t result_index)
 {
-	ib_sa_mad_t *p_sa_mad;
+	ib_sa_mad_t __attribute__((__unused__)) *p_sa_mad;
 
 	CL_ASSERT(p_result_madw);
 	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
@@ -660,7 +660,7 @@ static inline ib_inform_info_record_t *osmv_get_query_inform_info_rec(IN
 								      uint32_t
 								      result_index)
 {
-	ib_sa_mad_t *p_sa_mad;
+	ib_sa_mad_t __attribute__((__unused__)) *p_sa_mad;
 
 	CL_ASSERT(p_result_madw);
 	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
@@ -753,7 +753,7 @@ typedef struct _osmv_query_req {
 *		and is determined by the specified query_type.
 *
 *	sm_key
-*		The M_Key to be provided with the SA MAD for authentication.
+*		The SM_Key to be provided with the SA MAD for authentication.
 *		Normally 0 is used.
 *
 *	timeout_ms
diff --git a/libvendor/Makefile.in b/libvendor/Makefile.in
index 0d2f576..6b794d4 100644
--- a/libvendor/Makefile.in
+++ b/libvendor/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -17,8 +18,9 @@
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -37,27 +39,44 @@ subdir = libvendor
 DIST_COMMON = $(am__libosmvendorinclude_HEADERS_DIST) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
-	$(top_srcdir)/config/ltoptions.m4 \
-	$(top_srcdir)/config/ltsugar.m4 \
-	$(top_srcdir)/config/ltversion.m4 \
-	$(top_srcdir)/config/lt~obsolete.m4 \
-	$(top_srcdir)/config/osmvsel.m4 $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/osmvsel.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/include/config.h \
 	$(top_builddir)/include/opensm/osm_config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(libdir)" \
 	"$(DESTDIR)$(libosmvendorincludedir)"
-libLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(lib_LTLIBRARIES)
 am__libosmvendor_la_SOURCES_DIST = osm_vendor_mlx.c \
 	osm_pkt_randomizer.c osm_vendor_mlx_hca.c \
@@ -107,6 +126,7 @@ libosmvendor_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/include -I$(top_builddir)/include/opensm
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
+am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
@@ -132,14 +152,41 @@ am__libosmvendorinclude_HEADERS_DIST =  \
 	$(srcdir)/../include/vendor/osm_vendor_mlx.h \
 	$(srcdir)/../include/vendor/osm_pkt_randomizer.h \
 	$(srcdir)/../include/vendor/osm_vendor_ibumad.h
-libosmvendorincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(libosmvendorinclude_HEADERS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
 AR = @AR@
@@ -156,6 +203,7 @@ CYGPATH_W = @CYGPATH_W@
 DEFAULT_EVENT_PLUGIN = @DEFAULT_EVENT_PLUGIN@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -182,6 +230,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -200,9 +249,11 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PARTITION_CONFIG_FILE = @PARTITION_CONFIG_FILE@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PER_MOD_LOGGING_FILE = @PER_MOD_LOGGING_FILE@
 PREFIX_ROUTES_FILE = @PREFIX_ROUTES_FILE@
 QOS_POLICY_FILE = @QOS_POLICY_FILE@
 RANLIB = @RANLIB@
@@ -212,6 +263,7 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
 TARBALL = @TARBALL@
+TORUS2QOS_CONF_FILE = @TORUS2QOS_CONF_FILE@
 VERSION = @VERSION@
 YACC = @YACC@
 YFLAGS = @YFLAGS@
@@ -221,6 +273,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -253,7 +306,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -351,9 +403,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  libvendor/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  libvendor/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libvendor/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign libvendor/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -371,23 +423,28 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
 	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
-	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	list2=; for p in $$list; do \
 	  if test -f $$p; then \
-	    f=$(am__strip_dir) \
-	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
-	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	    list2="$$list2 $$p"; \
 	  else :; fi; \
-	done
+	done; \
+	test -z "$$list2" || { \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+	}
 
 uninstall-libLTLIBRARIES:
 	@$(NORMAL_UNINSTALL)
-	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
-	  p=$(am__strip_dir) \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	for p in $$list; do \
+	  $(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
 	done
 
 clean-libLTLIBRARIES:
@@ -398,7 +455,7 @@ clean-libLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libosmvendor.la: $(libosmvendor_la_OBJECTS) $(libosmvendor_la_DEPENDENCIES) 
+libosmvendor.la: $(libosmvendor_la_OBJECTS) $(libosmvendor_la_DEPENDENCIES) $(EXTRA_libosmvendor_la_DEPENDENCIES) 
 	$(libosmvendor_la_LINK) -rpath $(libdir) $(libosmvendor_la_OBJECTS) $(libosmvendor_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -425,129 +482,129 @@ distclean-compile:
 
 .c.o:
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 
 .c.lo:
 @am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
 libosmvendor_la-osm_vendor_mlx.lo: osm_vendor_mlx.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx.Tpo -c -o libosmvendor_la-osm_vendor_mlx.lo `test -f 'osm_vendor_mlx.c' || echo '$(srcdir)/'`osm_vendor_mlx.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmvendor_la-osm_vendor_mlx.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx.Tpo -c -o libosmvendor_la-osm_vendor_mlx.lo `test -f 'osm_vendor_mlx.c' || echo '$(srcdir)/'`osm_vendor_mlx.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmvendor_la-osm_vendor_mlx.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osm_vendor_mlx.c' object='libosmvendor_la-osm_vendor_mlx.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx.lo `test -f 'osm_vendor_mlx.c' || echo '$(srcdir)/'`osm_vendor_mlx.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx.lo `test -f 'osm_vendor_mlx.c' || echo '$(srcdir)/'`osm_vendor_mlx.c
 
 libosmvendor_la-osm_pkt_randomizer.lo: osm_pkt_randomizer.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_pkt_randomizer.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_pkt_randomizer.Tpo -c -o libosmvendor_la-osm_pkt_randomizer.lo `test -f 'osm_pkt_randomizer.c' || echo '$(srcdir)/'`osm_pkt_randomizer.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmvendor_la-osm_pkt_randomizer.Tpo $(DEPDIR)/libosmvendor_la-osm_pkt_randomizer.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_pkt_randomizer.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_pkt_randomizer.Tpo -c -o libosmvendor_la-osm_pkt_randomizer.lo `test -f 'osm_pkt_randomizer.c' || echo '$(srcdir)/'`osm_pkt_randomizer.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmvendor_la-osm_pkt_randomizer.Tpo $(DEPDIR)/libosmvendor_la-osm_pkt_randomizer.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osm_pkt_randomizer.c' object='libosmvendor_la-osm_pkt_randomizer.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_pkt_randomizer.lo `test -f 'osm_pkt_randomizer.c' || echo '$(srcdir)/'`osm_pkt_randomizer.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_pkt_randomizer.lo `test -f 'osm_pkt_randomizer.c' || echo '$(srcdir)/'`osm_pkt_randomizer.c
 
 libosmvendor_la-osm_vendor_mlx_hca.lo: osm_vendor_mlx_hca.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_hca.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_hca.Tpo -c -o libosmvendor_la-osm_vendor_mlx_hca.lo `test -f 'osm_vendor_mlx_hca.c' || echo '$(srcdir)/'`osm_vendor_mlx_hca.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_hca.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_hca.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_hca.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_hca.Tpo -c -o libosmvendor_la-osm_vendor_mlx_hca.lo `test -f 'osm_vendor_mlx_hca.c' || echo '$(srcdir)/'`osm_vendor_mlx_hca.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_hca.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_hca.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osm_vendor_mlx_hca.c' object='libosmvendor_la-osm_vendor_mlx_hca.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_hca.lo `test -f 'osm_vendor_mlx_hca.c' || echo '$(srcdir)/'`osm_vendor_mlx_hca.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_hca.lo `test -f 'osm_vendor_mlx_hca.c' || echo '$(srcdir)/'`osm_vendor_mlx_hca.c
 
 libosmvendor_la-osm_vendor_mlx_dispatcher.lo: osm_vendor_mlx_dispatcher.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_dispatcher.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_dispatcher.Tpo -c -o libosmvendor_la-osm_vendor_mlx_dispatcher.lo `test -f 'osm_vendor_mlx_dispatcher.c' || echo '$(srcdir)/'`osm_vendor_mlx_dispatcher.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_dispatcher.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_dispatcher.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_dispatcher.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_dispatcher.Tpo -c -o libosmvendor_la-osm_vendor_mlx_dispatcher.lo `test -f 'osm_vendor_mlx_dispatcher.c' || echo '$(srcdir)/'`osm_vendor_mlx_dispatcher.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_dispatcher.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_dispatcher.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osm_vendor_mlx_dispatcher.c' object='libosmvendor_la-osm_vendor_mlx_dispatcher.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_dispatcher.lo `test -f 'osm_vendor_mlx_dispatcher.c' || echo '$(srcdir)/'`osm_vendor_mlx_dispatcher.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_dispatcher.lo `test -f 'osm_vendor_mlx_dispatcher.c' || echo '$(srcdir)/'`osm_vendor_mlx_dispatcher.c
 
 libosmvendor_la-osm_vendor_mlx_rmpp_ctx.lo: osm_vendor_mlx_rmpp_ctx.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_rmpp_ctx.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_rmpp_ctx.Tpo -c -o libosmvendor_la-osm_vendor_mlx_rmpp_ctx.lo `test -f 'osm_vendor_mlx_rmpp_ctx.c' || echo '$(srcdir)/'`osm_vendor_mlx_rmpp_ctx.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_rmpp_ctx.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_rmpp_ctx.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_rmpp_ctx.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_rmpp_ctx.Tpo -c -o libosmvendor_la-osm_vendor_mlx_rmpp_ctx.lo `test -f 'osm_vendor_mlx_rmpp_ctx.c' || echo '$(srcdir)/'`osm_vendor_mlx_rmpp_ctx.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_rmpp_ctx.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_rmpp_ctx.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osm_vendor_mlx_rmpp_ctx.c' object='libosmvendor_la-osm_vendor_mlx_rmpp_ctx.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_rmpp_ctx.lo `test -f 'osm_vendor_mlx_rmpp_ctx.c' || echo '$(srcdir)/'`osm_vendor_mlx_rmpp_ctx.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_rmpp_ctx.lo `test -f 'osm_vendor_mlx_rmpp_ctx.c' || echo '$(srcdir)/'`osm_vendor_mlx_rmpp_ctx.c
 
 libosmvendor_la-osm_vendor_mlx_sar.lo: osm_vendor_mlx_sar.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_sar.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sar.Tpo -c -o libosmvendor_la-osm_vendor_mlx_sar.lo `test -f 'osm_vendor_mlx_sar.c' || echo '$(srcdir)/'`osm_vendor_mlx_sar.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sar.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sar.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_sar.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sar.Tpo -c -o libosmvendor_la-osm_vendor_mlx_sar.lo `test -f 'osm_vendor_mlx_sar.c' || echo '$(srcdir)/'`osm_vendor_mlx_sar.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sar.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sar.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osm_vendor_mlx_sar.c' object='libosmvendor_la-osm_vendor_mlx_sar.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_sar.lo `test -f 'osm_vendor_mlx_sar.c' || echo '$(srcdir)/'`osm_vendor_mlx_sar.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_sar.lo `test -f 'osm_vendor_mlx_sar.c' || echo '$(srcdir)/'`osm_vendor_mlx_sar.c
 
 libosmvendor_la-osm_vendor_mlx_sender.lo: osm_vendor_mlx_sender.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_sender.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sender.Tpo -c -o libosmvendor_la-osm_vendor_mlx_sender.lo `test -f 'osm_vendor_mlx_sender.c' || echo '$(srcdir)/'`osm_vendor_mlx_sender.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sender.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sender.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_sender.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sender.Tpo -c -o libosmvendor_la-osm_vendor_mlx_sender.lo `test -f 'osm_vendor_mlx_sender.c' || echo '$(srcdir)/'`osm_vendor_mlx_sender.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sender.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sender.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osm_vendor_mlx_sender.c' object='libosmvendor_la-osm_vendor_mlx_sender.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_sender.lo `test -f 'osm_vendor_mlx_sender.c' || echo '$(srcdir)/'`osm_vendor_mlx_sender.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_sender.lo `test -f 'osm_vendor_mlx_sender.c' || echo '$(srcdir)/'`osm_vendor_mlx_sender.c
 
 libosmvendor_la-osm_vendor_mlx_ts.lo: osm_vendor_mlx_ts.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_ts.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_ts.Tpo -c -o libosmvendor_la-osm_vendor_mlx_ts.lo `test -f 'osm_vendor_mlx_ts.c' || echo '$(srcdir)/'`osm_vendor_mlx_ts.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_ts.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_ts.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_ts.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_ts.Tpo -c -o libosmvendor_la-osm_vendor_mlx_ts.lo `test -f 'osm_vendor_mlx_ts.c' || echo '$(srcdir)/'`osm_vendor_mlx_ts.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_ts.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_ts.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osm_vendor_mlx_ts.c' object='libosmvendor_la-osm_vendor_mlx_ts.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_ts.lo `test -f 'osm_vendor_mlx_ts.c' || echo '$(srcdir)/'`osm_vendor_mlx_ts.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_ts.lo `test -f 'osm_vendor_mlx_ts.c' || echo '$(srcdir)/'`osm_vendor_mlx_ts.c
 
 libosmvendor_la-osm_vendor_mlx_txn.lo: osm_vendor_mlx_txn.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_txn.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_txn.Tpo -c -o libosmvendor_la-osm_vendor_mlx_txn.lo `test -f 'osm_vendor_mlx_txn.c' || echo '$(srcdir)/'`osm_vendor_mlx_txn.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_txn.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_txn.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_txn.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_txn.Tpo -c -o libosmvendor_la-osm_vendor_mlx_txn.lo `test -f 'osm_vendor_mlx_txn.c' || echo '$(srcdir)/'`osm_vendor_mlx_txn.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_txn.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_txn.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osm_vendor_mlx_txn.c' object='libosmvendor_la-osm_vendor_mlx_txn.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_txn.lo `test -f 'osm_vendor_mlx_txn.c' || echo '$(srcdir)/'`osm_vendor_mlx_txn.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_txn.lo `test -f 'osm_vendor_mlx_txn.c' || echo '$(srcdir)/'`osm_vendor_mlx_txn.c
 
 libosmvendor_la-osm_vendor_mlx_sa.lo: osm_vendor_mlx_sa.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_sa.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sa.Tpo -c -o libosmvendor_la-osm_vendor_mlx_sa.lo `test -f 'osm_vendor_mlx_sa.c' || echo '$(srcdir)/'`osm_vendor_mlx_sa.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sa.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sa.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_sa.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sa.Tpo -c -o libosmvendor_la-osm_vendor_mlx_sa.lo `test -f 'osm_vendor_mlx_sa.c' || echo '$(srcdir)/'`osm_vendor_mlx_sa.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sa.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sa.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osm_vendor_mlx_sa.c' object='libosmvendor_la-osm_vendor_mlx_sa.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_sa.lo `test -f 'osm_vendor_mlx_sa.c' || echo '$(srcdir)/'`osm_vendor_mlx_sa.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_sa.lo `test -f 'osm_vendor_mlx_sa.c' || echo '$(srcdir)/'`osm_vendor_mlx_sa.c
 
 libosmvendor_la-osm_vendor_ibumad.lo: osm_vendor_ibumad.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_ibumad.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_ibumad.Tpo -c -o libosmvendor_la-osm_vendor_ibumad.lo `test -f 'osm_vendor_ibumad.c' || echo '$(srcdir)/'`osm_vendor_ibumad.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmvendor_la-osm_vendor_ibumad.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_ibumad.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_ibumad.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_ibumad.Tpo -c -o libosmvendor_la-osm_vendor_ibumad.lo `test -f 'osm_vendor_ibumad.c' || echo '$(srcdir)/'`osm_vendor_ibumad.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmvendor_la-osm_vendor_ibumad.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_ibumad.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osm_vendor_ibumad.c' object='libosmvendor_la-osm_vendor_ibumad.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_ibumad.lo `test -f 'osm_vendor_ibumad.c' || echo '$(srcdir)/'`osm_vendor_ibumad.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_ibumad.lo `test -f 'osm_vendor_ibumad.c' || echo '$(srcdir)/'`osm_vendor_ibumad.c
 
 libosmvendor_la-osm_vendor_ibumad_sa.lo: osm_vendor_ibumad_sa.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_ibumad_sa.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_ibumad_sa.Tpo -c -o libosmvendor_la-osm_vendor_ibumad_sa.lo `test -f 'osm_vendor_ibumad_sa.c' || echo '$(srcdir)/'`osm_vendor_ibumad_sa.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmvendor_la-osm_vendor_ibumad_sa.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_ibumad_sa.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_ibumad_sa.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_ibumad_sa.Tpo -c -o libosmvendor_la-osm_vendor_ibumad_sa.lo `test -f 'osm_vendor_ibumad_sa.c' || echo '$(srcdir)/'`osm_vendor_ibumad_sa.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmvendor_la-osm_vendor_ibumad_sa.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_ibumad_sa.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osm_vendor_ibumad_sa.c' object='libosmvendor_la-osm_vendor_ibumad_sa.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_ibumad_sa.lo `test -f 'osm_vendor_ibumad_sa.c' || echo '$(srcdir)/'`osm_vendor_ibumad_sa.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_ibumad_sa.lo `test -f 'osm_vendor_ibumad_sa.c' || echo '$(srcdir)/'`osm_vendor_ibumad_sa.c
 
 libosmvendor_la-osm_vendor_mlx_sim.lo: osm_vendor_mlx_sim.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_sim.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sim.Tpo -c -o libosmvendor_la-osm_vendor_mlx_sim.lo `test -f 'osm_vendor_mlx_sim.c' || echo '$(srcdir)/'`osm_vendor_mlx_sim.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sim.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sim.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_sim.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sim.Tpo -c -o libosmvendor_la-osm_vendor_mlx_sim.lo `test -f 'osm_vendor_mlx_sim.c' || echo '$(srcdir)/'`osm_vendor_mlx_sim.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sim.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_sim.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osm_vendor_mlx_sim.c' object='libosmvendor_la-osm_vendor_mlx_sim.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_sim.lo `test -f 'osm_vendor_mlx_sim.c' || echo '$(srcdir)/'`osm_vendor_mlx_sim.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_sim.lo `test -f 'osm_vendor_mlx_sim.c' || echo '$(srcdir)/'`osm_vendor_mlx_sim.c
 
 libosmvendor_la-osm_vendor_mlx_hca_sim.lo: osm_vendor_mlx_hca_sim.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_hca_sim.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_hca_sim.Tpo -c -o libosmvendor_la-osm_vendor_mlx_hca_sim.lo `test -f 'osm_vendor_mlx_hca_sim.c' || echo '$(srcdir)/'`osm_vendor_mlx_hca_sim.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_hca_sim.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_hca_sim.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_hca_sim.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_hca_sim.Tpo -c -o libosmvendor_la-osm_vendor_mlx_hca_sim.lo `test -f 'osm_vendor_mlx_hca_sim.c' || echo '$(srcdir)/'`osm_vendor_mlx_hca_sim.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_hca_sim.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_hca_sim.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osm_vendor_mlx_hca_sim.c' object='libosmvendor_la-osm_vendor_mlx_hca_sim.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_hca_sim.lo `test -f 'osm_vendor_mlx_hca_sim.c' || echo '$(srcdir)/'`osm_vendor_mlx_hca_sim.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_hca_sim.lo `test -f 'osm_vendor_mlx_hca_sim.c' || echo '$(srcdir)/'`osm_vendor_mlx_hca_sim.c
 
 libosmvendor_la-osm_vendor_mlx_ibmgt.lo: osm_vendor_mlx_ibmgt.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_ibmgt.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_ibmgt.Tpo -c -o libosmvendor_la-osm_vendor_mlx_ibmgt.lo `test -f 'osm_vendor_mlx_ibmgt.c' || echo '$(srcdir)/'`osm_vendor_mlx_ibmgt.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_ibmgt.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_ibmgt.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -MT libosmvendor_la-osm_vendor_mlx_ibmgt.lo -MD -MP -MF $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_ibmgt.Tpo -c -o libosmvendor_la-osm_vendor_mlx_ibmgt.lo `test -f 'osm_vendor_mlx_ibmgt.c' || echo '$(srcdir)/'`osm_vendor_mlx_ibmgt.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_ibmgt.Tpo $(DEPDIR)/libosmvendor_la-osm_vendor_mlx_ibmgt.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osm_vendor_mlx_ibmgt.c' object='libosmvendor_la-osm_vendor_mlx_ibmgt.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_ibmgt.lo `test -f 'osm_vendor_mlx_ibmgt.c' || echo '$(srcdir)/'`osm_vendor_mlx_ibmgt.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmvendor_la_CFLAGS) $(CFLAGS) -c -o libosmvendor_la-osm_vendor_mlx_ibmgt.lo `test -f 'osm_vendor_mlx_ibmgt.c' || echo '$(srcdir)/'`osm_vendor_mlx_ibmgt.c
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -557,20 +614,21 @@ clean-libtool:
 install-libosmvendorincludeHEADERS: $(libosmvendorinclude_HEADERS)
 	@$(NORMAL_INSTALL)
 	test -z "$(libosmvendorincludedir)" || $(MKDIR_P) "$(DESTDIR)$(libosmvendorincludedir)"
-	@list='$(libosmvendorinclude_HEADERS)'; for p in $$list; do \
+	@list='$(libosmvendorinclude_HEADERS)'; test -n "$(libosmvendorincludedir)" || list=; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(libosmvendorincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libosmvendorincludedir)/$$f'"; \
-	  $(libosmvendorincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libosmvendorincludedir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libosmvendorincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(libosmvendorincludedir)" || exit $$?; \
 	done
 
 uninstall-libosmvendorincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(libosmvendorinclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(libosmvendorincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(libosmvendorincludedir)/$$f"; \
-	done
+	@list='$(libosmvendorinclude_HEADERS)'; test -n "$(libosmvendorincludedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(libosmvendorincludedir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -579,7 +637,7 @@ uninstall-libosmvendorincludeHEADERS:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -596,7 +654,7 @@ $(RECURSIVE_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
@@ -604,7 +662,7 @@ $(RECURSIVE_TARGETS):
 	fi; test -z "$$fail"
 
 $(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -630,16 +688,16 @@ $(RECURSIVE_CLEAN_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
 	done
 ctags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
 	done
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -654,7 +712,7 @@ tags: TAGS
 
 TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
@@ -666,7 +724,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test ! -f $$subdir/TAGS || \
-	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
@@ -675,29 +733,34 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -718,29 +781,44 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test -d "$(distdir)/$$subdir" \
 	    || $(MKDIR_P) "$(distdir)/$$subdir" \
 	    || exit 1; \
-	    distdir=`$(am__cd) $(distdir) && pwd`; \
-	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
-	    (cd $$subdir && \
+	  fi; \
+	done
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$top_distdir" \
-	        distdir="$$distdir/$$subdir" \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
 		am__remove_distdir=: \
 		am__skip_length_check=: \
+		am__skip_mode_fix=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -763,16 +841,22 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -794,6 +878,8 @@ dvi-am:
 
 html: html-recursive
 
+html-am:
+
 info: info-recursive
 
 info-am:
@@ -802,18 +888,28 @@ install-data-am: install-libosmvendorincludeHEADERS
 
 install-dvi: install-dvi-recursive
 
+install-dvi-am:
+
 install-exec-am: install-libLTLIBRARIES
 
 install-html: install-html-recursive
 
+install-html-am:
+
 install-info: install-info-recursive
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-recursive
 
+install-pdf-am:
+
 install-ps: install-ps-recursive
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
@@ -837,8 +933,8 @@ ps-am:
 uninstall-am: uninstall-libLTLIBRARIES \
 	uninstall-libosmvendorincludeHEADERS
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
-	install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+	install-am install-strip tags-recursive
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am check check-am clean clean-generic \
@@ -857,6 +953,7 @@ uninstall-am: uninstall-libLTLIBRARIES \
 	pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
 	uninstall-libLTLIBRARIES uninstall-libosmvendorincludeHEADERS
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/libvendor/libosmvendor.ver b/libvendor/libosmvendor.ver
index 0c3a85b..aa30dc3 100644
--- a/libvendor/libosmvendor.ver
+++ b/libvendor/libosmvendor.ver
@@ -6,4 +6,4 @@
 # API_REV - advance on any added API
 # RUNNING_REV - advance any change to the vendor files
 # AGE - number of backward versions the API still supports
-LIBVERSION=2:0:0
+LIBVERSION=3:8:0
diff --git a/libvendor/osm_pkt_randomizer.c b/libvendor/osm_pkt_randomizer.c
index 3e77b56..cfc5a8f 100644
--- a/libvendor/osm_pkt_randomizer.c
+++ b/libvendor/osm_pkt_randomizer.c
@@ -47,7 +47,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#ifndef WIN32
+#ifndef __WIN__
 #include <sys/time.h>
 #include <unistd.h>
 #endif
@@ -130,23 +130,23 @@ __osm_pkt_randomizer_process_path(IN osm_log_t * p_log,
 
 	if (rand_value_init == FALSE) {
 		int seed;
-#ifdef WIN32
+#ifdef __WIN__
 		SYSTEMTIME st;
 #else
 		struct timeval tv;
 		struct timezone tz;
-#endif				/*  WIN32 */
+#endif				/*  __WIN__ */
 
 		/* initiate the rand_value according to timeofday */
 		rand_value_init = TRUE;
 
-#ifdef WIN32
+#ifdef __WIN__
 		GetLocalTime(&st);
 		seed = st.wMilliseconds;
 #else
 		gettimeofday(&tv, &tz);
 		seed = tv.tv_usec;
-#endif				/*  WIN32 */
+#endif				/*  __WIN__ */
 
 		srand(seed);
 	}
@@ -217,8 +217,6 @@ Exit:
 	return res;
 }
 
-/**********************************************************************
- **********************************************************************/
 boolean_t
 osm_pkt_randomizer_mad_drop(IN osm_log_t * p_log,
 			    IN osm_pkt_randomizer_t * p_pkt_randomizer,
@@ -253,8 +251,6 @@ Exit:
 	return res;
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osm_pkt_randomizer_init(IN OUT osm_pkt_randomizer_t ** pp_pkt_randomizer,
 			IN osm_log_t * p_log)
@@ -313,8 +309,6 @@ Exit:
 	return (res);
 }
 
-/**********************************************************************
- **********************************************************************/
 void
 osm_pkt_randomizer_destroy(IN OUT osm_pkt_randomizer_t ** pp_pkt_randomizer,
 			   IN osm_log_t * p_log)
diff --git a/libvendor/osm_vendor_ibumad.c b/libvendor/osm_vendor_ibumad.c
index 734a860..d9ed13a 100644
--- a/libvendor/osm_vendor_ibumad.c
+++ b/libvendor/osm_vendor_ibumad.c
@@ -1,7 +1,9 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -59,6 +61,8 @@
 #include <complib/cl_qlist.h>
 #include <complib/cl_math.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_VENDOR_IBUMAD_C
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_mad_pool.h>
@@ -84,6 +88,8 @@ typedef struct _osm_umad_bind_info {
 	int port_id;
 	int agent_id;
 	int agent_id1;		/* SMI requires two agents */
+	int timeout;
+	int max_retries;
 } osm_umad_bind_info_t;
 
 typedef struct _umad_receiver {
@@ -94,6 +100,35 @@ typedef struct _umad_receiver {
 
 static void osm_vendor_close_port(osm_vendor_t * const p_vend);
 
+static void log_send_error(osm_vendor_t * const p_vend, osm_madw_t *p_madw)
+{
+	if (p_madw->p_mad->mgmt_class != IB_MCLASS_SUBN_DIR) {
+		/* LID routed */
+		OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5410: "
+			"Send completed with error (%s) -- dropping\n"
+			"\t\t\tClass 0x%x, Method 0x%X, Attr 0x%X, "
+			"TID 0x%" PRIx64 ", LID %u\n",
+			ib_get_err_str(p_madw->status),
+			p_madw->p_mad->mgmt_class, p_madw->p_mad->method,
+			cl_ntoh16(p_madw->p_mad->attr_id),
+			cl_ntoh64(p_madw->p_mad->trans_id),
+			cl_ntoh16(p_madw->mad_addr.dest_lid));
+	} else {
+		ib_smp_t *p_smp;
+
+		/* Direct routed SMP */
+		p_smp = osm_madw_get_smp_ptr(p_madw);
+		OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5411: "
+			"DR SMP Send completed with error (%s) -- dropping\n"
+			"\t\t\tMethod 0x%X, Attr 0x%X, TID 0x%" PRIx64 "\n",
+			ib_get_err_str(p_madw->status),
+			p_madw->p_mad->method,
+			cl_ntoh16(p_madw->p_mad->attr_id),
+			cl_ntoh64(p_madw->p_mad->trans_id));
+		osm_dump_smp_dr_path(p_vend->p_log, p_smp, OSM_LOG_ERROR);
+	}
+}
+
 static void clear_madw(osm_vendor_t * p_vend)
 {
 	umad_match_t *m, *e, *old_m;
@@ -112,7 +147,7 @@ static void clear_madw(osm_vendor_t * p_vend)
 			pthread_mutex_unlock(&p_vend->match_tbl_mutex);
 			OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5401: "
 				"evicting entry %p (tid was 0x%" PRIx64 ")\n",
-				old_m, old_tid);
+				old_m, cl_ntoh64(old_tid));
 			goto Exit;
 		}
 	}
@@ -122,23 +157,25 @@ Exit:
 	OSM_LOG_EXIT(p_vend->p_log);
 }
 
-static osm_madw_t *get_madw(osm_vendor_t * p_vend, ib_net64_t * tid)
+static osm_madw_t *get_madw(osm_vendor_t * p_vend, ib_net64_t * tid,
+			    uint8_t mgmt_class)
 {
 	umad_match_t *m, *e;
-	ib_net64_t mtid = (*tid & CL_HTON64(0x00000000ffffffffllu));
+	ib_net64_t mtid = (*tid & CL_HTON64(0x00000000ffffffffULL));
 	osm_madw_t *res;
 
 	/*
 	 * Since mtid == 0 is the empty key, we should not
 	 * waste time looking for it
 	 */
-	if (mtid == 0)
+	if (mtid == 0 || mgmt_class == 0)
 		return 0;
 
 	pthread_mutex_lock(&p_vend->match_tbl_mutex);
 	for (m = p_vend->mtbl.tbl, e = m + p_vend->mtbl.max; m < e; m++) {
-		if (m->tid == mtid) {
+		if (m->tid == mtid && m->mgmt_class == mgmt_class) {
 			m->tid = 0;
+			m->mgmt_class = 0;
 			*tid = mtid;
 			res = m->v;
 			pthread_mutex_unlock(&p_vend->match_tbl_mutex);
@@ -151,18 +188,21 @@ static osm_madw_t *get_madw(osm_vendor_t * p_vend, ib_net64_t * tid)
 }
 
 static void
-put_madw(osm_vendor_t * p_vend, osm_madw_t * p_madw, ib_net64_t tid)
+put_madw(osm_vendor_t * p_vend, osm_madw_t * p_madw, ib_net64_t tid,
+	 uint8_t mgmt_class)
 {
 	umad_match_t *m, *e, *old_lru, *lru = 0;
 	osm_madw_t *p_req_madw;
 	osm_umad_bind_info_t *p_bind;
 	ib_net64_t old_tid;
 	uint32_t oldest = ~0;
+	uint8_t old_mgmt_class;
 
 	pthread_mutex_lock(&p_vend->match_tbl_mutex);
 	for (m = p_vend->mtbl.tbl, e = m + p_vend->mtbl.max; m < e; m++) {
-		if (m->tid == 0) {
+		if (m->tid == 0 && m->mgmt_class == 0) {
 			m->tid = tid;
+			m->mgmt_class = mgmt_class;
 			m->v = p_madw;
 			m->version =
 			    cl_atomic_inc((atomic32_t *) & p_vend->mtbl.
@@ -170,7 +210,7 @@ put_madw(osm_vendor_t * p_vend, osm_madw_t * p_madw, ib_net64_t tid)
 			pthread_mutex_unlock(&p_vend->match_tbl_mutex);
 			return;
 		}
-		if (oldest > m->version) {
+		if (oldest >= m->version) {
 			oldest = m->version;
 			lru = m;
 		}
@@ -178,20 +218,24 @@ put_madw(osm_vendor_t * p_vend, osm_madw_t * p_madw, ib_net64_t tid)
 
 	old_lru = lru;
 	old_tid = lru->tid;
+	old_mgmt_class = lru->mgmt_class;
 	p_req_madw = old_lru->v;
 	p_bind = p_req_madw->h_bind;
 	p_req_madw->status = IB_CANCELED;
+	log_send_error(p_vend, p_req_madw);
 	pthread_mutex_lock(&p_vend->cb_mutex);
 	(*p_bind->send_err_callback) (p_bind->client_context, p_req_madw);
 	pthread_mutex_unlock(&p_vend->cb_mutex);
 	lru->tid = tid;
+	lru->mgmt_class = mgmt_class;
 	lru->v = p_madw;
 	lru->version =
 	    cl_atomic_inc((atomic32_t *) & p_vend->mtbl.last_version);
 	pthread_mutex_unlock(&p_vend->match_tbl_mutex);
 	OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5402: "
-		"evicting entry %p (tid was 0x%" PRIx64 ")\n", old_lru,
-		cl_ntoh64(old_tid));
+		"evicting entry %p (tid was 0x%" PRIx64
+		" mgmt class 0x%x)\n", old_lru,
+		cl_ntoh64(old_tid), old_mgmt_class);
 }
 
 static void
@@ -239,7 +283,6 @@ static void *umad_receiver(void *p_ptr)
 	umad_receiver_t *const p_ur = (umad_receiver_t *) p_ptr;
 	osm_vendor_t *p_vend = p_ur->p_vend;
 	osm_umad_bind_info_t *p_bind;
-	ib_mad_addr_t *ib_mad_addr;
 	osm_mad_addr_t osm_addr;
 	osm_madw_t *p_madw, *p_req_madw;
 	ib_mad_t *mad;
@@ -287,7 +330,7 @@ static void *umad_receiver(void *p_ptr)
 			}
 		}
 
-		if (mad_agent >= UMAD_CA_MAX_AGENTS ||
+		if (mad_agent >= OSM_UMAD_MAX_AGENTS ||
 		    !(p_bind = p_vend->agents[mad_agent])) {
 			OSM_LOG(p_ur->p_log, OSM_LOG_ERROR, "ERR 5407: "
 				"invalid mad agent %d - dropping\n", mad_agent);
@@ -295,7 +338,6 @@ static void *umad_receiver(void *p_ptr)
 		}
 
 		mad = (ib_mad_t *) umad_get_mad(umad);
-		ib_mad_addr = umad_get_mad_addr(umad);
 
 		ib_mad_addr_conv(umad, &osm_addr,
 				 mad->mgmt_class == IB_MCLASS_SUBN_LID ||
@@ -322,39 +364,18 @@ static void *umad_receiver(void *p_ptr)
 
 		/* if status != 0 then we are handling recv timeout on send */
 		if (umad_status(p_madw->vend_wrap.umad)) {
-			OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5409: "
-				"send completed with error"
-				" (method=0x%X attr=0x%X trans_id=0x%" PRIx64
-				") -- dropping\n",
-				mad->method, cl_ntoh16(mad->attr_id),
-				cl_ntoh64(mad->trans_id));
-			if (mad->mgmt_class != IB_MCLASS_SUBN_DIR) {
-				/* LID routed */
-				OSM_LOG(p_vend->p_log, OSM_LOG_ERROR,
-					"ERR 5410: class 0x%x LID 0x%x\n",
-					mad->mgmt_class,
-					cl_ntoh16(ib_mad_addr->lid));
-			} else {
-				ib_smp_t *smp;
-
-				/* Direct routed SMP */
-				smp = (ib_smp_t *) mad;
-				OSM_LOG(p_vend->p_log, OSM_LOG_ERROR,
-					"ERR 5411: DR SMP Hop Ptr: 0x%X\n",
-					smp->hop_ptr);
-				osm_dump_smp_dr_path(p_vend->p_log, smp,
-						     OSM_LOG_ERROR);
-			}
-
-			if (!(p_req_madw = get_madw(p_vend, &mad->trans_id))) {
+			if (!(p_req_madw = get_madw(p_vend, &mad->trans_id,
+						    mad->mgmt_class))) {
 				OSM_LOG(p_vend->p_log, OSM_LOG_ERROR,
 					"ERR 5412: "
 					"Failed to obtain request madw for timed out MAD"
-					"(method=0x%X attr=0x%X tid=0x%"PRIx64") -- dropping\n",
-					mad->method, cl_ntoh16(mad->attr_id),
+					" (class=0x%X method=0x%X attr=0x%X tid=0x%"PRIx64") -- dropping\n",
+					mad->mgmt_class, mad->method,
+					cl_ntoh16(mad->attr_id),
 					cl_ntoh64(mad->trans_id));
 			} else {
 				p_req_madw->status = IB_TIMEOUT;
+				log_send_error(p_vend, p_req_madw);
 				/* cb frees req_madw */
 				pthread_mutex_lock(&p_vend->cb_mutex);
 				pthread_cleanup_push(unlock_mutex,
@@ -371,11 +392,13 @@ static void *umad_receiver(void *p_ptr)
 
 		p_req_madw = 0;
 		if (ib_mad_is_response(mad) &&
-		    !(p_req_madw = get_madw(p_vend, &mad->trans_id))) {
+		    !(p_req_madw = get_madw(p_vend, &mad->trans_id,
+					    mad->mgmt_class))) {
 			OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5413: "
 				"Failed to obtain request madw for received MAD"
-				"(method=0x%X attr=0x%X tid=0x%"PRIx64") -- dropping\n",
-				mad->method, cl_ntoh16((mad)->attr_id),
+				" (class=0x%X method=0x%X attr=0x%X tid=0x%"PRIx64") -- dropping\n",
+				mad->mgmt_class, mad->method,
+				cl_ntoh16((mad)->attr_id),
 				cl_ntoh64(mad->trans_id));
 			osm_mad_pool_put(p_bind->p_mad_pool, p_madw);
 			continue;
@@ -416,7 +439,7 @@ static int umad_receiver_start(osm_vendor_t * p_vend)
 	p_ur->p_vend = p_vend;
 	p_ur->p_log = p_vend->p_log;
 
-	if (pthread_create(&p_ur->tid, NULL, umad_receiver, p_ur) < 0)
+	if (pthread_create(&p_ur->tid, NULL, umad_receiver, p_ur) != 0)
 		return -1;
 
 	return 0;
@@ -431,8 +454,6 @@ static void umad_receiver_stop(umad_receiver_t * p_ur)
 	p_ur->p_log = NULL;
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osm_vendor_init(IN osm_vendor_t * const p_vend,
 		IN osm_log_t * const p_log, IN const uint32_t timeout)
@@ -475,7 +496,7 @@ osm_vendor_init(IN osm_vendor_t * const p_vend,
 			p_vend->mtbl.max = tmp;
 		else
 			OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "Error:"
-				"OSM_UMAD_MAX_PENDING=%d is invalid",
+				"OSM_UMAD_MAX_PENDING=%d is invalid\n",
 				tmp);
 	}
 
@@ -495,8 +516,6 @@ Exit:
 	return (r);
 }
 
-/**********************************************************************
- **********************************************************************/
 osm_vendor_t *osm_vendor_new(IN osm_log_t * const p_log,
 			     IN const uint32_t timeout)
 {
@@ -529,8 +548,6 @@ Exit:
 	return (p_vend);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_vendor_delete(IN osm_vendor_t ** const pp_vend)
 {
 	osm_vendor_close_port(*pp_vend);
@@ -546,8 +563,6 @@ void osm_vendor_delete(IN osm_vendor_t ** const pp_vend)
 	*pp_vend = NULL;
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
 			     IN ib_port_attr_t * const p_attr_array,
@@ -556,7 +571,7 @@ osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
 	umad_ca_t ca;
 	ib_port_attr_t *attr = p_attr_array;
 	unsigned done = 0;
-	int r, i, j;
+	int r = 0, i, j, k;
 
 	OSM_LOG_ENTER(p_vend->p_log);
 
@@ -576,9 +591,7 @@ osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
 	}
 
 	for (i = 0; i < p_vend->ca_count && !done; i++) {
-		/*
-		 * For each CA, retrieve the port guids
-		 */
+		/* For each CA, retrieve the port attributes */
 		if (umad_get_ca(p_vend->ca_names[i], &ca) == 0) {
 			if (ca.node_type < 1 || ca.node_type > 3)
 				continue;
@@ -590,6 +603,14 @@ osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
 				attr->port_num = ca.ports[j]->portnum;
 				attr->sm_lid = ca.ports[j]->sm_lid;
 				attr->link_state = ca.ports[j]->state;
+				if (attr->num_pkeys && attr->p_pkey_table) {
+					if (attr->num_pkeys > ca.ports[j]->pkeys_size)
+						attr->num_pkeys = ca.ports[j]->pkeys_size;
+					for (k = 0; k < attr->num_pkeys; k++)
+						attr->p_pkey_table[k] =
+							cl_hton16(ca.ports[j]->pkeys[k]);
+				}
+				attr->num_pkeys = ca.ports[j]->pkeys_size;
 				attr++;
 				if (attr - p_attr_array > *p_num_ports) {
 					done = 1;
@@ -601,15 +622,12 @@ osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
 	}
 
 	*p_num_ports = attr - p_attr_array;
-	r = 0;
 
 Exit:
 	OSM_LOG_EXIT(p_vend->p_log);
 	return r;
 }
 
-/**********************************************************************
- **********************************************************************/
 static int
 osm_vendor_open_port(IN osm_vendor_t * const p_vend,
 		     IN const ib_net64_t port_guid)
@@ -636,9 +654,8 @@ osm_vendor_open_port(IN osm_vendor_t * const p_vend,
 	}
 
 	for (ca = 0; ca < p_vend->ca_count; ca++) {
-		if ((r = umad_get_ca_portguids(p_vend->ca_names[ca],
-					       portguids,
-					       OSM_UMAD_MAX_CAS)) < 0) {
+		if ((r = umad_get_ca_portguids(p_vend->ca_names[ca], portguids,
+					       OSM_UMAD_MAX_PORTS_PER_CA + 1)) < 0) {
 			OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5421: "
 				"Unable to get CA %s port guids (%s)\n",
 				p_vend->ca_names[ca], strerror(r));
@@ -732,7 +749,7 @@ static void osm_vendor_close_port(osm_vendor_t * const p_vend)
 	}
 
 	if (p_vend->umad_port_id >= 0) {
-		for (i = 0; i < UMAD_CA_MAX_AGENTS; i++)
+		for (i = 0; i < OSM_UMAD_MAX_AGENTS; i++)
 			if (p_vend->agents[i])
 				umad_unregister(p_vend->umad_port_id, i);
 		umad_close_port(p_vend->umad_port_id);
@@ -754,8 +771,6 @@ static int set_bit(int nr, void *method_mask)
 	return retval;
 }
 
-/**********************************************************************
- **********************************************************************/
 osm_bind_handle_t
 osm_vendor_bind(IN osm_vendor_t * const p_vend,
 		IN osm_bind_info_t * const p_user_bind,
@@ -780,7 +795,8 @@ osm_vendor_bind(IN osm_vendor_t * const p_vend,
 	port_guid = p_user_bind->port_guid;
 
 	OSM_LOG(p_vend->p_log, OSM_LOG_INFO,
-		"Binding to port 0x%" PRIx64 "\n", cl_ntoh64(port_guid));
+		"Mgmt class 0x%02x binding to port GUID 0x%" PRIx64 "\n",
+		p_user_bind->mad_class, cl_ntoh64(port_guid));
 
 	if ((umad_port_id = osm_vendor_open_port(p_vend, port_guid)) < 0) {
 		OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5424: "
@@ -813,6 +829,10 @@ osm_vendor_bind(IN osm_vendor_t * const p_vend,
 	p_bind->send_err_callback = send_err_callback;
 	p_bind->p_mad_pool = p_mad_pool;
 	p_bind->port_guid = port_guid;
+	p_bind->timeout = p_user_bind->timeout ? p_user_bind->timeout :
+			  p_vend->timeout;
+	p_bind->max_retries = p_user_bind->retries ? p_user_bind->retries :
+			      p_vend->max_retries;
 
 	memset(method_mask, 0, sizeof method_mask);
 	if (p_user_bind->is_responder) {
@@ -856,7 +876,7 @@ osm_vendor_bind(IN osm_vendor_t * const p_vend,
 		goto Exit;
 	}
 
-	if (p_bind->agent_id >= UMAD_CA_MAX_AGENTS ||
+	if (p_bind->agent_id >= OSM_UMAD_MAX_AGENTS ||
 	    p_vend->agents[p_bind->agent_id]) {
 		OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5427: "
 			"bad agent id %u or duplicate agent for class %u vers %u\n",
@@ -884,7 +904,7 @@ osm_vendor_bind(IN osm_vendor_t * const p_vend,
 			goto Exit;
 		}
 
-		if (p_bind->agent_id1 >= UMAD_CA_MAX_AGENTS ||
+		if (p_bind->agent_id1 >= OSM_UMAD_MAX_AGENTS ||
 		    p_vend->agents[p_bind->agent_id1]) {
 			OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5429: "
 				"bad agent id %u or duplicate agent for class 1 vers %u\n",
@@ -902,8 +922,6 @@ Exit:
 	return ((osm_bind_handle_t) p_bind);
 }
 
-/**********************************************************************
- **********************************************************************/
 static void
 __osm_vendor_recv_dummy_cb(IN osm_madw_t * p_madw,
 			   IN void *bind_context, IN osm_madw_t * p_req_madw)
@@ -914,8 +932,6 @@ __osm_vendor_recv_dummy_cb(IN osm_madw_t * p_madw,
 #endif
 }
 
-/**********************************************************************
- **********************************************************************/
 static void
 __osm_vendor_send_err_dummy_cb(IN void *bind_context,
 			       IN osm_madw_t * p_req_madw)
@@ -926,8 +942,6 @@ __osm_vendor_send_err_dummy_cb(IN void *bind_context,
 #endif
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_vendor_unbind(IN osm_bind_handle_t h_bind)
 {
 	osm_umad_bind_info_t *p_bind = (osm_umad_bind_info_t *) h_bind;
@@ -943,8 +957,6 @@ void osm_vendor_unbind(IN osm_bind_handle_t h_bind)
 	OSM_LOG_EXIT(p_vend->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_mad_t *osm_vendor_get(IN osm_bind_handle_t h_bind,
 			 IN const uint32_t mad_size,
 			 IN osm_vend_wrap_t * const p_vw)
@@ -967,11 +979,9 @@ ib_mad_t *osm_vendor_get(IN osm_bind_handle_t h_bind,
 		"Acquired UMAD %p, size = %u\n", p_vw->umad, p_vw->size);
 
 	OSM_LOG_EXIT(p_vend->p_log);
-	return umad_get_mad(p_vw->umad);
+	return (p_vw->umad ? umad_get_mad(p_vw->umad) : NULL);
 }
 
-/**********************************************************************
- **********************************************************************/
 void
 osm_vendor_put(IN osm_bind_handle_t h_bind, IN osm_vend_wrap_t * const p_vw)
 {
@@ -999,8 +1009,6 @@ osm_vendor_put(IN osm_bind_handle_t h_bind, IN osm_vend_wrap_t * const p_vw)
 	OSM_LOG_EXIT(p_vend->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osm_vendor_send(IN osm_bind_handle_t h_bind,
 		IN osm_madw_t * const p_madw, IN boolean_t const resp_expected)
@@ -1012,8 +1020,9 @@ osm_vendor_send(IN osm_bind_handle_t h_bind,
 	ib_mad_t *const p_mad = osm_madw_get_mad_ptr(p_madw);
 	ib_sa_mad_t *const p_sa = (ib_sa_mad_t *) p_mad;
 	int ret = -1;
-	int is_rmpp = 0;
+	int __attribute__((__unused__)) is_rmpp = 0;
 	uint32_t sent_mad_size;
+	uint64_t tid;
 #ifndef VENDOR_RMPP_SUPPORT
 	uint32_t paylen = 0;
 #endif
@@ -1033,14 +1042,14 @@ osm_vendor_send(IN osm_bind_handle_t h_bind,
 		umad_set_grh(p_vw->umad, 0);
 		goto Resp;
 	}
-	/* GSI classes */
+	/* GS classes */
 	umad_set_addr_net(p_vw->umad, p_mad_addr->dest_lid,
 			  p_mad_addr->addr_type.gsi.remote_qp,
 			  p_mad_addr->addr_type.gsi.service_level,
 			  IB_QP1_WELL_KNOWN_Q_KEY);
 	umad_set_grh(p_vw->umad, 0);	/* FIXME: GRH support */
 	umad_set_pkey(p_vw->umad, p_mad_addr->addr_type.gsi.pkey_ix);
-	if (ib_class_is_rmpp(p_mad->mgmt_class)) {	/* RMPP GSI classes     FIXME: no GRH */
+	if (ib_class_is_rmpp(p_mad->mgmt_class)) {	/* RMPP GS classes     FIXME: no GRH */
 		if (!ib_rmpp_is_flag_set((ib_rmpp_mad_t *) p_sa,
 					 IB_RMPP_FLAG_ACTIVE)) {
 			/* Clear RMPP header when RMPP not ACTIVE */
@@ -1051,7 +1060,7 @@ osm_vendor_send(IN osm_bind_handle_t h_bind,
 #ifdef VENDOR_RMPP_SUPPORT
 		} else
 			is_rmpp = 1;
-		OSM_LOG(p_vend->p_log, OSM_LOG_VERBOSE, "RMPP %d length %d\n",
+		OSM_LOG(p_vend->p_log, OSM_LOG_DEBUG, "RMPP %d length %d\n",
 			ib_rmpp_is_flag_set((ib_rmpp_mad_t *) p_sa,
 					    IB_RMPP_FLAG_ACTIVE),
 			p_madw->mad_size);
@@ -1070,7 +1079,7 @@ osm_vendor_send(IN osm_bind_handle_t h_bind,
 
 Resp:
 	if (resp_expected)
-		put_madw(p_vend, p_madw, p_mad->trans_id);
+		put_madw(p_vend, p_madw, p_mad->trans_id, p_mad->mgmt_class);
 
 #ifdef VENDOR_RMPP_SUPPORT
 	sent_mad_size = p_madw->mad_size;
@@ -1078,15 +1087,17 @@ Resp:
 	sent_mad_size = is_rmpp ? p_madw->mad_size - IB_SA_MAD_HDR_SIZE :
 	    p_madw->mad_size;
 #endif
+	tid = cl_ntoh64(p_mad->trans_id);
 	if ((ret = umad_send(p_bind->port_id, p_bind->agent_id, p_vw->umad,
 			     sent_mad_size,
-			     resp_expected ? p_vend->timeout : 0,
-			     p_vend->max_retries)) < 0) {
+			     resp_expected ? p_bind->timeout : 0,
+			     p_bind->max_retries)) < 0) {
 		OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5430: "
-			"Send p_madw = %p of size %d failed %d (%m)\n",
-			p_madw, sent_mad_size, ret);
+			"Send p_madw = %p of size %d TID 0x%" PRIx64 " failed %d (%m)\n",
+			p_madw, sent_mad_size, tid, ret);
 		if (resp_expected) {
-			get_madw(p_vend, &p_mad->trans_id);	/* remove from aging table */
+			get_madw(p_vend, &p_mad->trans_id,
+				 p_mad->mgmt_class);	/* remove from aging table */
 			p_madw->status = IB_ERROR;
 			pthread_mutex_lock(&p_vend->cb_mutex);
 			(*p_bind->send_err_callback) (p_bind->client_context, p_madw);	/* cb frees madw */
@@ -1099,15 +1110,13 @@ Resp:
 	if (!resp_expected)
 		osm_mad_pool_put(p_bind->p_mad_pool, p_madw);
 
-	OSM_LOG(p_vend->p_log, OSM_LOG_DEBUG, "Completed sending %s p_madw = %p\n",
-		resp_expected ? "request" : "response or unsolicited", p_madw);
+	OSM_LOG(p_vend->p_log, OSM_LOG_DEBUG, "Completed sending %s TID 0x%" PRIx64 "\n",
+		resp_expected ? "request" : "response or unsolicited", tid);
 Exit:
 	OSM_LOG_EXIT(p_vend->p_log);
 	return (ret);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t osm_vendor_local_lid_change(IN osm_bind_handle_t h_bind)
 {
 	osm_umad_bind_info_t *p_bind = (osm_umad_bind_info_t *) h_bind;
@@ -1119,8 +1128,6 @@ ib_api_status_t osm_vendor_local_lid_change(IN osm_bind_handle_t h_bind)
 	return (0);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_vendor_set_sm(IN osm_bind_handle_t h_bind, IN boolean_t is_sm_val)
 {
 	osm_umad_bind_info_t *p_bind = (osm_umad_bind_info_t *) h_bind;
diff --git a/libvendor/osm_vendor_ibumad_sa.c b/libvendor/osm_vendor_ibumad_sa.c
index 800b308..1d482c0 100644
--- a/libvendor/osm_vendor_ibumad_sa.c
+++ b/libvendor/osm_vendor_ibumad_sa.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2007,2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009,2010 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -44,9 +45,6 @@
 #include <vendor/osm_vendor_sa_api.h>
 #include <complib/cl_event.h>
 
-/*****************************************************************************
- *****************************************************************************/
-
 /* this struct is the internal rep of the bind handle */
 typedef struct _osmv_sa_bind_info {
 	osm_bind_handle_t h_bind;
@@ -57,9 +55,6 @@ typedef struct _osmv_sa_bind_info {
 	time_t last_lids_update_sec;
 } osmv_sa_bind_info_t;
 
-/*****************************************************************************
- *****************************************************************************/
-
 /*
   Call back on new mad received:
 
@@ -90,7 +85,7 @@ __osmv_sa_mad_rcv_cb(IN osm_madw_t * p_madw,
 
 	/* obtain the sent context since we store it during send in the ni_ctx */
 	p_query_req_copy =
-	    (osmv_query_req_t *) (long *)(long)(p_req_madw->context.ni_context.
+	    (osmv_query_req_t *) (uintptr_t)(p_req_madw->context.ni_context.
 						node_guid);
 
 	/* provide the context of the original request in the result */
@@ -134,9 +129,9 @@ __osmv_sa_mad_rcv_cb(IN osm_madw_t * p_madw,
 			if (ib_get_attr_size(p_sa_mad->attr_offset)) {
 				/* we used the offset value to calculate the
 				   number of records in here */
-				query_res.result_cnt = (uintn_t)
-				    ((p_madw->mad_size - IB_SA_MAD_HDR_SIZE) /
-				     ib_get_attr_size(p_sa_mad->attr_offset));
+				query_res.result_cnt =
+				    (p_madw->mad_size - IB_SA_MAD_HDR_SIZE) /
+				    ib_get_attr_size(p_sa_mad->attr_offset);
 				OSM_LOG(p_bind->p_log, OSM_LOG_DEBUG,
 					"Count = %u = %zu / %u (%zu)\n",
 					query_res.result_cnt,
@@ -171,8 +166,6 @@ Exit:
 	OSM_LOG_EXIT(p_bind->p_log);
 }
 
-/*****************************************************************************
- ****************************************************************************/
 /*
   Send Error Callback:
 
@@ -188,7 +181,7 @@ static void __osmv_sa_mad_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)
 
 	/* Obtain the sent context etc */
 	p_query_req_copy =
-	    (osmv_query_req_t *) (long *)(long)(p_madw->context.ni_context.
+	    (osmv_query_req_t *) (uintptr_t)(p_madw->context.ni_context.
 						node_guid);
 
 	/* provide the context of the original request in the result */
@@ -206,8 +199,7 @@ static void __osmv_sa_mad_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)
 	if ((p_query_req_copy->flags & OSM_SA_FLAGS_SYNC) == OSM_SA_FLAGS_SYNC)
 		cl_event_signal(&p_bind->sync_event);
 
-	if (p_query_req_copy)
-		free(p_query_req_copy);
+	free(p_query_req_copy);
 	OSM_LOG_EXIT(p_bind->p_log);
 }
 
@@ -226,8 +218,6 @@ static ib_api_status_t update_umad_port(osm_vendor_t * p_vend)
 	return IB_SUCCESS;
 }
 
-/*****************************************************************************
- *****************************************************************************/
 osm_bind_handle_t
 osmv_bind_sa(IN osm_vendor_t * const p_vend,
 	     IN osm_mad_pool_t * const p_mad_pool, IN ib_net64_t port_guid)
@@ -250,6 +240,8 @@ osmv_bind_sa(IN osm_vendor_t * const p_vend,
 	bind_info.is_report_processor = FALSE;
 	bind_info.send_q_size = OSM_SM_DEFAULT_QP1_RCV_SIZE;
 	bind_info.recv_q_size = OSM_SM_DEFAULT_QP1_SEND_SIZE;
+	bind_info.timeout = p_vend->timeout;
+	bind_info.retries = OSM_DEFAULT_RETRY_COUNT;
 
 	/* allocate the new sa bind info */
 	p_sa_bind_info =
@@ -295,9 +287,6 @@ Exit:
 	return (p_sa_bind_info);
 }
 
-/*****************************************************************************
- *****************************************************************************/
-
 /****t* OSM Vendor SA Client/osmv_sa_mad_data
  * NAME
  *    osmv_sa_mad_data
@@ -338,8 +327,6 @@ typedef struct _osmv_sa_mad_data {
  *
  *****/
 
-/*****************************************************************************
- *****************************************************************************/
 /* Send a MAD out on the GSI interface */
 static ib_api_status_t
 __osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind,
@@ -354,6 +341,7 @@ __osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind,
 	static atomic32_t trans_id;
 	boolean_t sync;
 	osmv_query_req_t *p_query_req_copy;
+	uint32_t sa_size;
 
 	OSM_LOG_ENTER(p_log);
 
@@ -413,8 +401,8 @@ __osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind,
 		p_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
 #endif
 	if (p_sa_mad->comp_mask) {
-		memcpy(p_sa_mad->data, p_sa_mad_data->p_attr,
-		       ib_get_attr_size(p_sa_mad_data->attr_offset));
+		p_sa_mad_data->attr_offset ? (sa_size = ib_get_attr_size(p_sa_mad_data->attr_offset)) : (sa_size = IB_SA_DATA_SIZE);
+		memcpy(p_sa_mad->data, p_sa_mad_data->p_attr, sa_size);
 	}
 
 	/*
@@ -437,9 +425,16 @@ __osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind,
 	   p_madw->context.ni_context.node_guid
 	 */
 	p_query_req_copy = malloc(sizeof(*p_query_req_copy));
+	if (!p_query_req_copy) {
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 5511: "
+			"Unable to acquire memory for query copy\n");
+		osm_mad_pool_put(p_bind->p_mad_pool, p_madw);
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
 	*p_query_req_copy = *p_query_req;
 	p_madw->context.ni_context.node_guid =
-	    (ib_net64_t) (long)p_query_req_copy;
+	    (ib_net64_t) (uintptr_t)p_query_req_copy;
 
 	/* we can support async as well as sync calls */
 	sync = ((p_query_req->flags & OSM_SA_FLAGS_SYNC) == OSM_SA_FLAGS_SYNC);
@@ -461,8 +456,6 @@ Exit:
 	return status;
 }
 
-/*****************************************************************************
- *****************************************************************************/
 /*
  * Query the SA based on the user's request.
  */
@@ -470,19 +463,23 @@ ib_api_status_t
 osmv_query_sa(IN osm_bind_handle_t h_bind,
 	      IN const osmv_query_req_t * const p_query_req)
 {
-	osmv_sa_bind_info_t *p_bind = (osmv_sa_bind_info_t *) h_bind;
+	union {
+		ib_service_record_t svc_rec;
+		ib_node_record_t node_rec;
+		ib_portinfo_record_t port_info;
+		ib_path_rec_t path_rec;
+#ifdef DUAL_SIDED_RMPP
+		ib_multipath_rec_t multipath_rec;
+#endif
+		ib_class_port_info_t class_port_info;
+	} u;
 	osmv_sa_mad_data_t sa_mad_data;
+	osmv_sa_bind_info_t *p_bind = (osmv_sa_bind_info_t *) h_bind;
 	osmv_user_query_t *p_user_query;
-	ib_service_record_t svc_rec;
-	ib_node_record_t node_rec;
-	ib_portinfo_record_t port_info;
-	ib_path_rec_t path_rec;
 #ifdef DUAL_SIDED_RMPP
-	ib_multipath_rec_t multipath_rec;
 	osmv_multipath_req_t *p_mpr_req;
 	int i, j;
 #endif
-	ib_class_port_info_t class_port_info;
 	osm_log_t *p_log = p_bind->p_log;
 	ib_api_status_t status;
 
@@ -491,6 +488,7 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 	/* Set the request information. */
 	sa_mad_data.method = IB_MAD_METHOD_GETTABLE;
 	sa_mad_data.attr_mod = 0;
+	sa_mad_data.attr_offset = 0;
 
 	/* Set the MAD attributes and component mask correctly. */
 	switch (p_query_req->query_type) {
@@ -500,7 +498,11 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 		p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;
 		if (p_user_query->method)
 			sa_mad_data.method = p_user_query->method;
-		sa_mad_data.attr_offset = p_user_query->attr_offset;
+#ifdef DUAL_SIDED_RMPP
+		if (sa_mad_data.method == IB_MAD_METHOD_GETMULTI ||
+		    sa_mad_data.method == IB_MAD_METHOD_GETTRACETABLE)
+			sa_mad_data.attr_offset = p_user_query->attr_offset;
+#endif
 		sa_mad_data.attr_id = p_user_query->attr_id;
 		sa_mad_data.attr_mod = p_user_query->attr_mod;
 		sa_mad_data.comp_mask = p_user_query->comp_mask;
@@ -510,10 +512,8 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 	case OSMV_QUERY_ALL_SVC_RECS:
 		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 SVC_REC_BY_NAME\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_SERVICE_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_service_record_t));
 		sa_mad_data.comp_mask = 0;
-		sa_mad_data.p_attr = &svc_rec;
+		sa_mad_data.p_attr = &u.svc_rec;
 		break;
 
 	case OSMV_QUERY_SVC_REC_BY_NAME:
@@ -521,10 +521,8 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 		sa_mad_data.method = IB_MAD_METHOD_GET;
 		sa_mad_data.attr_id = IB_MAD_ATTR_SERVICE_RECORD;
 		sa_mad_data.comp_mask = IB_SR_COMPMASK_SNAME;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_service_record_t));
-		sa_mad_data.p_attr = &svc_rec;
-		memcpy(svc_rec.service_name, p_query_req->p_query_input,
+		sa_mad_data.p_attr = &u.svc_rec;
+		memcpy(u.svc_rec.service_name, p_query_req->p_query_input,
 		       sizeof(ib_svc_name_t));
 		break;
 
@@ -532,10 +530,8 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 SVC_REC_BY_ID\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_SERVICE_RECORD;
 		sa_mad_data.comp_mask = IB_SR_COMPMASK_SID;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_service_record_t));
-		sa_mad_data.p_attr = &svc_rec;
-		svc_rec.service_id =
+		sa_mad_data.p_attr = &u.svc_rec;
+		u.svc_rec.service_id =
 		    *(ib_net64_t *) (p_query_req->p_query_input);
 		break;
 
@@ -543,31 +539,25 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 CLASS_PORT_INFO\n");
 		sa_mad_data.method = IB_MAD_METHOD_GET;
 		sa_mad_data.attr_id = IB_MAD_ATTR_CLASS_PORT_INFO;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_class_port_info_t));
 		sa_mad_data.comp_mask = 0;
-		sa_mad_data.p_attr = &class_port_info;
+		sa_mad_data.p_attr = &u.class_port_info;
 		break;
 
 	case OSMV_QUERY_NODE_REC_BY_NODE_GUID:
 		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 NODE_REC_BY_NODE_GUID\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_NODE_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_node_record_t));
 		sa_mad_data.comp_mask = IB_NR_COMPMASK_NODEGUID;
-		sa_mad_data.p_attr = &node_rec;
-		node_rec.node_info.node_guid =
+		sa_mad_data.p_attr = &u.node_rec;
+		u.node_rec.node_info.node_guid =
 		    *(ib_net64_t *) (p_query_req->p_query_input);
 		break;
 
 	case OSMV_QUERY_PORT_REC_BY_LID:
 		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 PORT_REC_BY_LID\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_PORTINFO_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_portinfo_record_t));
 		sa_mad_data.comp_mask = IB_PIR_COMPMASK_LID;
-		sa_mad_data.p_attr = &port_info;
-		port_info.lid = *(ib_net16_t *) (p_query_req->p_query_input);
+		sa_mad_data.p_attr = &u.port_info;
+		u.port_info.lid = *(ib_net16_t *) (p_query_req->p_query_input);
 		break;
 
 	case OSMV_QUERY_PORT_REC_BY_LID_AND_NUM:
@@ -575,8 +565,6 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 		p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;
 		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 PORT_REC_BY_LID_AND_NUM\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_PORTINFO_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_portinfo_record_t));
 		sa_mad_data.comp_mask =
 		    IB_PIR_COMPMASK_LID | IB_PIR_COMPMASK_PORTNUM;
 		sa_mad_data.p_attr = p_user_query->p_attr;
@@ -587,8 +575,6 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 		p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;
 		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_VLARB_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_vl_arb_table_record_t));
 		sa_mad_data.comp_mask =
 		    IB_VLA_COMPMASK_LID | IB_VLA_COMPMASK_OUT_PORT |
 		    IB_VLA_COMPMASK_BLOCK;
@@ -600,8 +586,6 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 		p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;
 		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_SLVL_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_slvl_table_record_t));
 		sa_mad_data.comp_mask =
 		    IB_SLVL_COMPMASK_LID | IB_SLVL_COMPMASK_OUT_PORT |
 		    IB_SLVL_COMPMASK_IN_PORT;
@@ -610,18 +594,17 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 
 	case OSMV_QUERY_PATH_REC_BY_PORT_GUIDS:
 		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 PATH_REC_BY_PORT_GUIDS\n");
-		memset(&path_rec, 0, sizeof(ib_path_rec_t));
+		memset(&u.path_rec, 0, sizeof(ib_path_rec_t));
 		sa_mad_data.attr_id = IB_MAD_ATTR_PATH_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_path_rec_t));
 		sa_mad_data.comp_mask =
-		    (IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID);
-		sa_mad_data.p_attr = &path_rec;
-		ib_gid_set_default(&path_rec.dgid,
+		    (IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUMBPATH);
+		u.path_rec.num_path = 0x7f;
+		sa_mad_data.p_attr = &u.path_rec;
+		ib_gid_set_default(&u.path_rec.dgid,
 				   ((osmv_guid_pair_t *) (p_query_req->
 							  p_query_input))->
 				   dest_guid);
-		ib_gid_set_default(&path_rec.sgid,
+		ib_gid_set_default(&u.path_rec.sgid,
 				   ((osmv_guid_pair_t *) (p_query_req->
 							  p_query_input))->
 				   src_guid);
@@ -629,35 +612,32 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 
 	case OSMV_QUERY_PATH_REC_BY_GIDS:
 		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 PATH_REC_BY_GIDS\n");
-		memset(&path_rec, 0, sizeof(ib_path_rec_t));
+		memset(&u.path_rec, 0, sizeof(ib_path_rec_t));
 		sa_mad_data.attr_id = IB_MAD_ATTR_PATH_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_path_rec_t));
 		sa_mad_data.comp_mask =
-		    (IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID);
-		sa_mad_data.p_attr = &path_rec;
-		memcpy(&path_rec.dgid,
+		    (IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUMBPATH);
+		u.path_rec.num_path = 0x7f;
+		sa_mad_data.p_attr = &u.path_rec;
+		memcpy(&u.path_rec.dgid,
 		       &((osmv_gid_pair_t *) (p_query_req->p_query_input))->
 		       dest_gid, sizeof(ib_gid_t));
-		memcpy(&path_rec.sgid,
+		memcpy(&u.path_rec.sgid,
 		       &((osmv_gid_pair_t *) (p_query_req->p_query_input))->
 		       src_gid, sizeof(ib_gid_t));
 		break;
 
 	case OSMV_QUERY_PATH_REC_BY_LIDS:
 		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 PATH_REC_BY_LIDS\n");
-		memset(&path_rec, 0, sizeof(ib_path_rec_t));
+		memset(&u.path_rec, 0, sizeof(ib_path_rec_t));
 		sa_mad_data.method = IB_MAD_METHOD_GET;
 		sa_mad_data.attr_id = IB_MAD_ATTR_PATH_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_path_rec_t));
 		sa_mad_data.comp_mask =
 		    (IB_PR_COMPMASK_DLID | IB_PR_COMPMASK_SLID);
-		sa_mad_data.p_attr = &path_rec;
-		path_rec.dlid =
+		sa_mad_data.p_attr = &u.path_rec;
+		u.path_rec.dlid =
 		    ((osmv_lid_pair_t *) (p_query_req->p_query_input))->
 		    dest_lid;
-		path_rec.slid =
+		u.path_rec.slid =
 		    ((osmv_lid_pair_t *) (p_query_req->p_query_input))->src_lid;
 		break;
 
@@ -666,8 +646,6 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 		p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;
 		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 OSMV_QUERY_UD_MULTICAST_SET\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_member_rec_t));
 		sa_mad_data.comp_mask = p_user_query->comp_mask;
 		sa_mad_data.p_attr = p_user_query->p_attr;
 		break;
@@ -677,8 +655,6 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 		p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;
 		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 OSMV_QUERY_UD_MULTICAST_DELETE\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_member_rec_t));
 		sa_mad_data.comp_mask = p_user_query->comp_mask;
 		sa_mad_data.p_attr = p_user_query->p_attr;
 		break;
@@ -697,29 +673,29 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 			CL_ASSERT(0);
 			return IB_ERROR;
 		}
-		memset(&multipath_rec, 0, sizeof(ib_multipath_rec_t));
+		memset(&u.multipath_rec, 0, sizeof(ib_multipath_rec_t));
 		sa_mad_data.method = IB_MAD_METHOD_GETMULTI;
 		sa_mad_data.attr_id = IB_MAD_ATTR_MULTIPATH_RECORD;
 		sa_mad_data.attr_offset =
 		    ib_get_attr_offset(sizeof(ib_multipath_rec_t));
-		sa_mad_data.p_attr = &multipath_rec;
+		sa_mad_data.p_attr = &u.multipath_rec;
 		sa_mad_data.comp_mask = p_mpr_req->comp_mask;
-		multipath_rec.num_path = p_mpr_req->num_path;
+		u.multipath_rec.num_path = p_mpr_req->num_path;
 		if (p_mpr_req->reversible)
-			multipath_rec.num_path |= 0x80;
+			u.multipath_rec.num_path |= 0x80;
 		else
-			multipath_rec.num_path &= ~0x80;
-		multipath_rec.pkey = p_mpr_req->pkey;
-		ib_multipath_rec_set_sl(&multipath_rec, p_mpr_req->sl);
-		ib_multipath_rec_set_qos_class(&multipath_rec, 0);
-		multipath_rec.independence = p_mpr_req->independence;
-		multipath_rec.sgid_count = p_mpr_req->sgid_count;
-		multipath_rec.dgid_count = p_mpr_req->dgid_count;
+			u.multipath_rec.num_path &= ~0x80;
+		u.multipath_rec.pkey = p_mpr_req->pkey;
+		ib_multipath_rec_set_sl(&u.multipath_rec, p_mpr_req->sl);
+		ib_multipath_rec_set_qos_class(&u.multipath_rec, 0);
+		u.multipath_rec.independence = p_mpr_req->independence;
+		u.multipath_rec.sgid_count = p_mpr_req->sgid_count;
+		u.multipath_rec.dgid_count = p_mpr_req->dgid_count;
 		j = 0;
 		for (i = 0; i < p_mpr_req->sgid_count; i++, j++)
-			multipath_rec.gids[j] = p_mpr_req->gids[j];
+			u.multipath_rec.gids[j] = p_mpr_req->gids[j];
 		for (i = 0; i < p_mpr_req->dgid_count; i++, j++)
-			multipath_rec.gids[j] = p_mpr_req->gids[j];
+			u.multipath_rec.gids[j] = p_mpr_req->gids[j];
 		break;
 #endif
 
diff --git a/libvendor/osm_vendor_mlx.c b/libvendor/osm_vendor_mlx.c
index 683f56d..7a40fa5 100644
--- a/libvendor/osm_vendor_mlx.c
+++ b/libvendor/osm_vendor_mlx.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -704,7 +704,7 @@ __osmv_get_send_txn(IN osm_bind_handle_t h_bind,
 		if (IB_SUCCESS != ret) {
 			osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,
 				"__osmv_get_send_txn: ERR 7313: "
-				"The transaction id=0x%llX failed to init.\n",
+				"The transaction id=0x%" PRIx64 " failed to init.\n",
 				tid);
 			goto get_send_txn_done;
 		}
@@ -719,7 +719,7 @@ __osmv_get_send_txn(IN osm_bind_handle_t h_bind,
 		    || FALSE == osmv_txn_is_rmpp_init_by_peer(*pp_txn)) {
 			osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,
 				"__osmv_get_send_txn: ERR 7314: "
-				"The transaction id=0x%llX is not unique. Send failed.\n",
+				"The transaction id=0x%" PRIx64 " is not unique. Send failed.\n",
 				tid);
 
 			ret = IB_INVALID_SETTING;
@@ -729,7 +729,7 @@ __osmv_get_send_txn(IN osm_bind_handle_t h_bind,
 		if (TRUE == resp_expected) {
 			osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,
 				"__osmv_get_send_txn: ERR 7315: "
-				"The transaction id=%llX can't expect a response. Send failed.\n",
+				"The transaction id=0x%" PRIx64 " can't expect a response. Send failed.\n",
 				tid);
 
 			ret = IB_INVALID_PARAMETER;
@@ -742,7 +742,7 @@ __osmv_get_send_txn(IN osm_bind_handle_t h_bind,
 		if (IB_SUCCESS != ret) {
 			osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,
 				"__osmv_get_send_txn: ERR 7316: "
-				"The transaction id=%llX failed to init the rmpp mad. Send failed.\n",
+				"The transaction id=0x%" PRIx64 " failed to init the rmpp mad. Send failed.\n",
 				tid);
 			osmv_txn_done(h_bind, tid, FALSE);
 			goto get_send_txn_done;
@@ -762,8 +762,6 @@ get_send_txn_done:
 	return ret;
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_vendor_set_debug(IN osm_vendor_t * const p_vend, IN int32_t level)
 {
 
diff --git a/libvendor/osm_vendor_mlx_dispatcher.c b/libvendor/osm_vendor_mlx_dispatcher.c
index d476382..ba6c4e8 100644
--- a/libvendor/osm_vendor_mlx_dispatcher.c
+++ b/libvendor/osm_vendor_mlx_dispatcher.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -193,7 +193,7 @@ __osmv_dispatch_route(IN osm_bind_handle_t h_bind,
 {
 	ib_api_status_t ret;
 	osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;
-	boolean_t is_resp = osmv_mad_is_response(p_mad);
+	boolean_t is_resp = ib_mad_is_response(p_mad);
 	boolean_t is_txn;
 	uint64_t key = cl_ntoh64(p_mad->trans_id);
 
@@ -204,7 +204,7 @@ __osmv_dispatch_route(IN osm_bind_handle_t h_bind,
 
 	if (FALSE == is_txn && TRUE == is_resp) {
 		osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
-			"Received a response to a non-started/aged-out transaction (tid=0x%llX). "
+			"Received a response to a non-started/aged-out transaction (tid=0x%" PRIx64 "). "
 			"Dropping the MAD.\n", key);
 		return OSMV_ROUTE_DROP;
 	}
@@ -217,7 +217,7 @@ __osmv_dispatch_route(IN osm_bind_handle_t h_bind,
 	if (TRUE == is_txn && FALSE == is_resp) {
 		/* Does this MAD try to start a transaction with duplicate tid? */
 		osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
-			"Duplicate TID 0x%llX received (not a response). "
+			"Duplicate TID 0x%" PRIx64 " received (not a response). "
 			"Dropping the MAD.\n", key);
 
 		return OSMV_ROUTE_DROP;
@@ -272,7 +272,7 @@ __osmv_dispatch_simple_mad(IN osm_bind_handle_t h_bind,
 
 		p_mad_buf->trans_id = cl_hton64(osmv_txn_get_tid(p_txn));
 		osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
-			"Restoring the original TID to 0x%llX\n",
+			"Restoring the original TID to 0x%" PRIx64 "\n",
 			cl_ntoh64(p_mad_buf->trans_id));
 
 		/* Reply matched, transaction complete */
@@ -327,7 +327,7 @@ __osmv_dispatch_rmpp_mad(IN osm_bind_handle_t h_bind,
 
 		is_init_by_peer = TRUE;
 		osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
-			"A new sender-initiated transfer (TID=0x%llX) started\n",
+			"A new sender-initiated transfer (TID=0x%" PRIx64 ") started\n",
 			key);
 	}
 
@@ -567,7 +567,7 @@ __osmv_dispatch_rmpp_rcv(IN osm_bind_handle_t h_bind,
 
 	if (TRUE != is_last1) {
 		osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
-			"RMPP MADW assembly continues, TID=0x%llX\n", tid);
+			"RMPP MADW assembly continues, TID=0x%" PRIx64 "\n", tid);
 		goto dispatch_rmpp_rcv_done;
 	}
 
@@ -620,12 +620,12 @@ __osmv_dispatch_rmpp_rcv(IN osm_bind_handle_t h_bind,
 	}
 
 	osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
-		"RMPP MADW %p assembly complete, TID=0x%llX\n", p_new_madw,
+		"RMPP MADW %p assembly complete, TID=0x%" PRIx64 "\n", p_new_madw,
 		tid);
 
 	p_mad_buf->trans_id = cl_hton64(tid);
 	osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
-		"Restoring the original TID to 0x%llX\n",
+		"Restoring the original TID to 0x%" PRIx64 "\n",
 		cl_ntoh64(p_mad_buf->trans_id));
 
 	/* Finally, do the job! */
@@ -657,7 +657,7 @@ __osmv_dispatch_accept_seg(IN osm_bind_handle_t h_bind,
 
 	if (seg_num != p_recv_ctx->expected_seg) {
 		osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
-			"TID 0x%llX: can't accept this segment (%d) - "
+			"TID 0x%" PRIx64 ": can't accept this segment (%d) - "
 			"this is a Go-Back-N implementation\n", tid, seg_num);
 		return IB_INSUFFICIENT_RESOURCES;
 	}
@@ -671,7 +671,7 @@ __osmv_dispatch_accept_seg(IN osm_bind_handle_t h_bind,
 	}
 
 	osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
-		"TID 0x%llX: segment %d accepted\n", tid, seg_num);
+		"TID 0x%" PRIx64 ": segment %d accepted\n", tid, seg_num);
 	p_recv_ctx->expected_seg = seg_num + 1;
 
 	OSM_LOG_EXIT(p_bo->p_vendor->p_log);
diff --git a/libvendor/osm_vendor_mlx_hca.c b/libvendor/osm_vendor_mlx_hca.c
index e98e272..910e81b 100644
--- a/libvendor/osm_vendor_mlx_hca.c
+++ b/libvendor/osm_vendor_mlx_hca.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -262,8 +262,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 void
 osm_ca_info_destroy(IN osm_vendor_t * const p_vend,
 		    IN osm_ca_info_t * const p_ca_info, IN uint8_t num_ca)
diff --git a/libvendor/osm_vendor_mlx_hca_sim.c b/libvendor/osm_vendor_mlx_hca_sim.c
index b6c0193..15df23e 100644
--- a/libvendor/osm_vendor_mlx_hca_sim.c
+++ b/libvendor/osm_vendor_mlx_hca_sim.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -264,7 +264,7 @@ __parse_ca_info_file(IN osm_vendor_t * const p_vend,
 
 	osm_log(p_vend->p_log, OSM_LOG_DEBUG,
 		"__parse_ca_info_file: "
-		"CA1 = name:%s guid:0x%016llx ports:%d\n",
+		"CA1 = name:%s guid:0x%" PRIx64 " ports:%d\n",
 		sim_ca_info->name, sim_ca_info->guid, sim_ca_info->num_ports);
 
 	status = IB_SUCCESS;
@@ -593,8 +593,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 void
 osm_ca_info_destroy(IN osm_vendor_t * const p_vend,
 		    IN osm_ca_info_t * const p_ca_info, IN uint8_t num_ca)
diff --git a/libvendor/osm_vendor_mlx_rmpp_ctx.c b/libvendor/osm_vendor_mlx_rmpp_ctx.c
index bbd42c3..f59620e 100644
--- a/libvendor/osm_vendor_mlx_rmpp_ctx.c
+++ b/libvendor/osm_vendor_mlx_rmpp_ctx.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
diff --git a/libvendor/osm_vendor_mlx_sa.c b/libvendor/osm_vendor_mlx_sa.c
index 0257f32..bfc643e 100644
--- a/libvendor/osm_vendor_mlx_sa.c
+++ b/libvendor/osm_vendor_mlx_sa.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009,2010 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -45,9 +46,6 @@
 #include <vendor/osm_vendor_api.h>
 #include <vendor/osm_vendor_sa_api.h>
 
-/*****************************************************************************
- *****************************************************************************/
-
 /* this struct is the internal rep of the bind handle */
 typedef struct _osmv_sa_bind_info {
 	osm_bind_handle_t h_bind;
@@ -61,9 +59,6 @@ typedef struct _osmv_sa_bind_info {
 	uint16_t sm_lid;
 } osmv_sa_bind_info_t;
 
-/*****************************************************************************
- *****************************************************************************/
-
 /*
   Call back on new mad received:
 
@@ -73,7 +68,7 @@ typedef struct _osmv_sa_bind_info {
   A pointer to the actual context of the request (a copy of the oriignal
   request structure) is attached as the p_madw->context.ni_context.node_guid
 */
-void
+static void
 __osmv_sa_mad_rcv_cb(IN osm_madw_t * p_madw,
 		     IN void *bind_context, IN osm_madw_t * p_req_madw)
 {
@@ -86,8 +81,7 @@ __osmv_sa_mad_rcv_cb(IN osm_madw_t * p_madw,
 	OSM_LOG_ENTER(p_bind->p_log);
 
 	if (!p_req_madw) {
-		osm_log(p_bind->p_log, OSM_LOG_DEBUG,
-			"__osmv_sa_mad_rcv_cb: "
+		OSM_LOG(p_bind->p_log, OSM_LOG_DEBUG,
 			"Ignoring a non-response mad\n");
 		osm_mad_pool_put(p_bind->p_mad_pool, p_madw);
 		goto Exit;
@@ -109,19 +103,16 @@ __osmv_sa_mad_rcv_cb(IN osm_madw_t * p_madw,
 	/* if we got a remote error track it in the status */
 	mad_status = (ib_net16_t) (p_sa_mad->status & IB_SMP_STATUS_MASK);
 	if (mad_status != IB_SUCCESS) {
-		osm_log(p_bind->p_log, OSM_LOG_ERROR,
-			"__osmv_sa_mad_rcv_cb: ERR 0501: "
-			"Remote error:0x%04X .\n", mad_status);
+		OSM_LOG(p_bind->p_log, OSM_LOG_ERROR, "ERR 0501: "
+			"Remote error:0x%04X\n", cl_ntoh16(mad_status));
 		query_res.status = IB_REMOTE_ERROR;
-	} else {
+	} else
 		query_res.status = IB_SUCCESS;
-	}
 
 	/* what if we have got back an empty mad ? */
 	if (!p_madw->mad_size) {
-		osm_log(p_bind->p_log, OSM_LOG_ERROR,
-			"__osmv_sa_mad_rcv_cb: ERR 0502: "
-			"Got an empty mad.\n");
+		OSM_LOG(p_bind->p_log, OSM_LOG_ERROR, "ERR 0502: "
+			"Got an empty mad\n");
 		query_res.status = IB_ERROR;
 	}
 
@@ -142,15 +133,14 @@ __osmv_sa_mad_rcv_cb(IN osm_madw_t * p_madw,
 			   records in here */
 			if (ib_get_attr_size(p_sa_mad->attr_offset) == 0) {
 				query_res.result_cnt = 0;
-				osm_log(p_bind->p_log, OSM_LOG_DEBUG,
-					"__osmv_sa_mad_rcv_cb: Count = 0\n");
+				OSM_LOG(p_bind->p_log, OSM_LOG_DEBUG,
+					"Count = 0\n");
 			}
 			else {
-				query_res.result_cnt = (uintn_t)
-					((p_madw->mad_size - IB_SA_MAD_HDR_SIZE) /
-					 ib_get_attr_size(p_sa_mad->attr_offset));
-				osm_log(p_bind->p_log, OSM_LOG_DEBUG,
-					"__osmv_sa_mad_rcv_cb: "
+				query_res.result_cnt =
+					(p_madw->mad_size - IB_SA_MAD_HDR_SIZE) /
+					ib_get_attr_size(p_sa_mad->attr_offset);
+				OSM_LOG(p_bind->p_log, OSM_LOG_DEBUG,
 					"Count = %u = %zu / %u (%zu)\n",
 					query_res.result_cnt,
 					p_madw->mad_size - IB_SA_MAD_HDR_SIZE,
@@ -182,14 +172,12 @@ Exit:
 	OSM_LOG_EXIT(p_bind->p_log);
 }
 
-/*****************************************************************************
- ****************************************************************************/
 /*
   Send Error Callback:
 
   Only report the error and get rid of the mad wrapper
 */
-void __osmv_sa_mad_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)
+static void __osmv_sa_mad_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)
 {
 	osmv_sa_bind_info_t *p_bind = (osmv_sa_bind_info_t *) bind_context;
 	osmv_query_req_t *p_query_req_copy = NULL;
@@ -217,8 +205,7 @@ void __osmv_sa_mad_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)
 	if ((p_query_req_copy->flags & OSM_SA_FLAGS_SYNC) == OSM_SA_FLAGS_SYNC)
 		cl_event_signal(&p_bind->sync_event);
 
-	if (p_query_req_copy)
-		free(p_query_req_copy);
+	free(p_query_req_copy);
 	OSM_LOG_EXIT(p_bind->p_log);
 }
 
@@ -230,7 +217,7 @@ void __osmv_sa_mad_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)
  to be stored in the context of the results. Also this coveres cases were
  we query for multiple guids.
  *****************************************************************************/
-ib_api_status_t
+static ib_api_status_t
 __osmv_get_lid_and_sm_lid_by_port_guid(IN osm_vendor_t * const p_vend,
 				       IN ib_net64_t port_guid,
 				       IN OUT uint64_t * p_lids_update_time_sec,
@@ -247,8 +234,7 @@ __osmv_get_lid_and_sm_lid_by_port_guid(IN osm_vendor_t * const p_vend,
 
 	/* use prevous values if current time is close enough to previous query */
 	if (cl_get_time_stamp_sec() <= *p_lids_update_time_sec + 30) {
-		osm_log(p_vend->p_log, OSM_LOG_DEBUG,
-			"__osmv_get_lid_and_sm_lid_by_port_guid: "
+		OSM_LOG(p_vend->p_log, OSM_LOG_DEBUG,
 			"Using previously stored lid:0x%04x sm_lid:0x%04x\n",
 			*lid, *sm_lid);
 		status = IB_SUCCESS;
@@ -259,20 +245,16 @@ __osmv_get_lid_and_sm_lid_by_port_guid(IN osm_vendor_t * const p_vend,
 	num_ports = 0;
 	status = osm_vendor_get_all_port_attr(p_vend, NULL, &num_ports);
 	if (status != IB_INSUFFICIENT_MEMORY) {
-		osm_log(p_vend->p_log, OSM_LOG_ERROR,
-			"__osmv_get_lid_and_sm_lid_by_port_guid: ERR 0503: "
-			"expected to get the IB_INSUFFICIENT_MEMORY but got: %s\n",
-			ib_get_err_str(status)
-		    );
+		OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 0503: "
+			"Expected to get the IB_INSUFFICIENT_MEMORY but got: %s\n",
+			ib_get_err_str(status));
 		status = IB_ERROR;
 		goto Exit;
 	}
 
-	osm_log(p_vend->p_log, OSM_LOG_DEBUG,
-		"__osmv_get_lid_and_sm_lid_by_port_guid: "
+	OSM_LOG(p_vend->p_log, OSM_LOG_DEBUG,
 		"Found total of %u ports. Looking for guid:0x%016" PRIx64 "\n",
-		num_ports, cl_ntoh64(port_guid)
-	    );
+		num_ports, cl_ntoh64(port_guid));
 
 	/* allocate the attributes */
 	p_attr_array =
@@ -281,11 +263,9 @@ __osmv_get_lid_and_sm_lid_by_port_guid(IN osm_vendor_t * const p_vend,
 	/* obtain the attributes */
 	status = osm_vendor_get_all_port_attr(p_vend, p_attr_array, &num_ports);
 	if (status != IB_SUCCESS) {
-		osm_log(p_vend->p_log, OSM_LOG_ERROR,
-			"__osmv_get_lid_and_sm_lid_by_port_guid: ERR 0504: "
-			"Fail to get port attributes (error: %s)\n",
-			ib_get_err_str(status)
-		    );
+		OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 0504: "
+			"Failed to get port attributes (error: %s)\n",
+			ib_get_err_str(status));
 		free(p_attr_array);
 		goto Exit;
 	}
@@ -299,8 +279,7 @@ __osmv_get_lid_and_sm_lid_by_port_guid(IN osm_vendor_t * const p_vend,
 			*sm_lid = p_attr_array[port_num].sm_lid;
 			*p_lids_update_time_sec = cl_get_time_stamp_sec();
 			status = IB_SUCCESS;
-			osm_log(p_vend->p_log, OSM_LOG_DEBUG,
-				"__osmv_get_lid_and_sm_lid_by_port_guid: "
+			OSM_LOG(p_vend->p_log, OSM_LOG_DEBUG,
 				"Found guid:0x%016" PRIx64 " with idx:%d\n",
 				cl_ntoh64(port_guid), port_num);
 		}
@@ -313,8 +292,6 @@ Exit:
 	return (status);
 }
 
-/*****************************************************************************
- *****************************************************************************/
 osm_bind_handle_t
 osmv_bind_sa(IN osm_vendor_t * const p_vend,
 	     IN osm_mad_pool_t * const p_mad_pool, IN ib_net64_t port_guid)
@@ -327,16 +304,15 @@ osmv_bind_sa(IN osm_vendor_t * const p_vend,
 
 	OSM_LOG_ENTER(p_log);
 
-	osm_log(p_log, OSM_LOG_DEBUG,
-		"osmv_bind_sa: "
-		"Binding to port 0x%" PRIx64 ".\n", cl_ntoh64(port_guid));
+	OSM_LOG(p_log, OSM_LOG_DEBUG,
+		"Binding to port 0x%" PRIx64 "\n", cl_ntoh64(port_guid));
 
 	bind_info.port_guid = port_guid;
 	bind_info.mad_class = IB_MCLASS_SUBN_ADM;
 	bind_info.class_version = 2;
-	bind_info.is_responder = TRUE;
+	bind_info.is_responder = FALSE;
 	bind_info.is_trap_processor = FALSE;
-	bind_info.is_report_processor = TRUE;
+	bind_info.is_report_processor = FALSE;
 	bind_info.send_q_size = 256;
 	bind_info.recv_q_size = 256;
 
@@ -344,9 +320,8 @@ osmv_bind_sa(IN osm_vendor_t * const p_vend,
 	p_sa_bind_info =
 	    (osmv_sa_bind_info_t *) malloc(sizeof(osmv_sa_bind_info_t));
 	if (!p_sa_bind_info) {
-		osm_log(p_log, OSM_LOG_ERROR,
-			"osmv_bind_sa: ERR 0505: "
-			"Fail to allocate new bidn structure\n");
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0505: "
+			"Failed to allocate new bind structure\n");
 		p_sa_bind_info = OSM_BIND_INVALID_HANDLE;
 		goto Exit;
 	}
@@ -364,9 +339,8 @@ osmv_bind_sa(IN osm_vendor_t * const p_vend,
 	if (p_sa_bind_info->h_bind == OSM_BIND_INVALID_HANDLE) {
 		free(p_sa_bind_info);
 		p_sa_bind_info = OSM_BIND_INVALID_HANDLE;
-		osm_log(p_log, OSM_LOG_ERROR,
-			"osmv_bind_sa: ERR 0506: "
-			"Fail to bind to vendor SMI.\n");
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0506: "
+			"Failed to bind to vendor GSI\n");
 		goto Exit;
 	}
 
@@ -380,9 +354,8 @@ osmv_bind_sa(IN osm_vendor_t * const p_vend,
 	if (status != IB_SUCCESS) {
 		free(p_sa_bind_info);
 		p_sa_bind_info = OSM_BIND_INVALID_HANDLE;
-		osm_log(p_log, OSM_LOG_ERROR,
-			"osmv_bind_sa: ERR 0507: "
-			"Fail to obtain the sm lid.\n");
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0507: "
+			"Failed to obtain the SM lid\n");
 		goto Exit;
 	}
 
@@ -390,10 +363,8 @@ osmv_bind_sa(IN osm_vendor_t * const p_vend,
 	cl_event_construct(&p_sa_bind_info->sync_event);
 	cl_status = cl_event_init(&p_sa_bind_info->sync_event, TRUE);
 	if (cl_status != CL_SUCCESS) {
-		osm_log(p_log, OSM_LOG_ERROR,
-			"osmv_bind_sa: ERR 0508: "
-			"cl_init_event failed: %s\n", ib_get_err_str(cl_status)
-		    );
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0508: "
+			"cl_init_event failed: %s\n", ib_get_err_str(cl_status));
 		free(p_sa_bind_info);
 		p_sa_bind_info = OSM_BIND_INVALID_HANDLE;
 	}
@@ -403,9 +374,6 @@ Exit:
 	return (p_sa_bind_info);
 }
 
-/*****************************************************************************
- *****************************************************************************/
-
 /****t* OSM Vendor SA Client/osmv_sa_mad_data
  * NAME
  *    osmv_sa_mad_data
@@ -446,10 +414,8 @@ typedef struct _osmv_sa_mad_data {
  *
  *****/
 
-/*****************************************************************************
- *****************************************************************************/
 /* Send a MAD out on the GSI interface */
-ib_api_status_t
+static ib_api_status_t
 __osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind,
 		   IN const osmv_sa_mad_data_t * const p_sa_mad_data,
 		   IN const osmv_query_req_t * const p_query_req)
@@ -462,13 +428,14 @@ __osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind,
 	static atomic32_t trans_id;
 	boolean_t sync;
 	osmv_query_req_t *p_query_req_copy;
+	uint32_t sa_size;
 
 	OSM_LOG_ENTER(p_log);
 
 	/*
 	   since the sm_lid might change we obtain it every send
 	   (actually it is cached in the bind object and refreshed
-	   every 30sec by this proc )
+	   every 30sec by this proc)
 	 */
 	status =
 	    __osmv_get_lid_and_sm_lid_by_port_guid(p_bind->p_vendor,
@@ -478,9 +445,8 @@ __osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind,
 						   &p_bind->lid,
 						   &p_bind->sm_lid);
 	if (status != IB_SUCCESS) {
-		osm_log(p_log, OSM_LOG_ERROR,
-			"__osmv_send_sa_req: ERR 0509: "
-			"Fail to obtain the sm lid.\n");
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0509: "
+			"Failed to obtain the SM lid\n");
 		goto Exit;
 	}
 
@@ -489,9 +455,8 @@ __osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind,
 				  p_bind->h_bind, MAD_BLOCK_SIZE, NULL);
 
 	if (p_madw == NULL) {
-		osm_log(p_log, OSM_LOG_ERROR,
-			"__osmv_send_sa_req: ERR 0510: "
-			"Unable to acquire MAD.\n");
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0510: "
+			"Unable to acquire MAD\n");
 		status = IB_INSUFFICIENT_RESOURCES;
 		goto Exit;
 	}
@@ -515,16 +480,15 @@ __osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind,
 			p_sa_mad_data->method,	/* method */
 			cl_hton64((uint64_t) trans_id),	/* tid */
 			p_sa_mad_data->attr_id,	/* attr id */
-			p_sa_mad_data->attr_mod	/* attr mod */
-	    );
+			p_sa_mad_data->attr_mod	/* attr mod */);
 
 	/* Set the query information. */
 	p_sa_mad->sm_key = p_query_req->sm_key;
 	p_sa_mad->attr_offset = 0;
 	p_sa_mad->comp_mask = p_sa_mad_data->comp_mask;
 	if (p_sa_mad->comp_mask) {
-		memcpy(p_sa_mad->data, p_sa_mad_data->p_attr,
-		       ib_get_attr_size(p_sa_mad_data->attr_offset));
+		p_sa_mad_data->attr_offset ? (sa_size = ib_get_attr_size(p_sa_mad_data->attr_offset)) : (sa_size = IB_SA_DATA_SIZE);
+		memcpy(p_sa_mad->data, p_sa_mad_data->p_attr, sa_size);
 	}
 
 	/*
@@ -538,20 +502,25 @@ __osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind,
 #endif
 	p_madw->mad_addr.addr_type.smi.source_lid = cl_hton16(p_bind->lid);
 	p_madw->mad_addr.addr_type.gsi.remote_qp = CL_HTON32(1);
-	p_madw->mad_addr.addr_type.gsi.remote_qkey = IB_QP1_WELL_KNOWN_Q_KEY;
-	p_madw->mad_addr.addr_type.gsi.pkey_ix = 0;
 	p_madw->resp_expected = TRUE;
 	p_madw->fail_msg = CL_DISP_MSGID_NONE;
 
 	/*
 	   Provide MAD context such that the call back will know what to do.
 	   We have to keep the entire request structure so we know the CB.
-	   Since we can not rely on the client to keep it arroud until
+	   Since we can not rely on the client to keep it around until
 	   the response - we duplicate it and will later dispose it (in CB).
 	   To store on the MADW we cast it into what opensm has:
 	   p_madw->context.arb_context.context1
 	 */
 	p_query_req_copy = malloc(sizeof(*p_query_req_copy));
+	if (!p_query_req_copy) {
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0511: "
+			"Unable to acquire memory for query copy\n");
+		osm_mad_pool_put(p_bind->p_mad_pool, p_madw);
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
 	*p_query_req_copy = *p_query_req;
 	p_madw->context.arb_context.context1 = p_query_req_copy;
 
@@ -564,8 +533,7 @@ __osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind,
 
 	/* if synchronous - wait on the event */
 	if (sync) {
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"__osmv_send_sa_req: " "Waiting for async event.\n");
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "Waiting for async event\n");
 		cl_event_wait_on(&p_bind->sync_event, EVENT_NO_TIMEOUT, FALSE);
 		cl_event_reset(&p_bind->sync_event);
 		status = p_madw->status;
@@ -576,8 +544,6 @@ Exit:
 	return status;
 }
 
-/*****************************************************************************
- *****************************************************************************/
 /*
  * Query the SA based on the user's request.
  */
@@ -585,14 +551,23 @@ ib_api_status_t
 osmv_query_sa(IN osm_bind_handle_t h_bind,
 	      IN const osmv_query_req_t * const p_query_req)
 {
-	osmv_sa_bind_info_t *p_bind = (osmv_sa_bind_info_t *) h_bind;
+	union {
+		ib_service_record_t svc_rec;
+		ib_node_record_t node_rec;
+		ib_portinfo_record_t port_info;
+		ib_path_rec_t path_rec;
+#ifdef DUAL_SIDED_RMPP
+		ib_multipath_rec_t multipath_rec;
+#endif
+		ib_class_port_info_t class_port_info;
+	} u;
 	osmv_sa_mad_data_t sa_mad_data;
+	osmv_sa_bind_info_t *p_bind = (osmv_sa_bind_info_t *) h_bind;
 	osmv_user_query_t *p_user_query;
-	ib_service_record_t svc_rec;
-	ib_node_record_t node_rec;
-	ib_portinfo_record_t port_info;
-	ib_path_rec_t path_rec;
-	ib_class_port_info_t class_port_info;
+#ifdef DUAL_SIDED_RMPP
+	osmv_multipath_req_t *p_mpr_req;
+	int i, j;
+#endif
 	osm_log_t *p_log = p_bind->p_log;
 	ib_api_status_t status;
 
@@ -601,17 +576,21 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 	/* Set the request information. */
 	sa_mad_data.method = IB_MAD_METHOD_GETTABLE;
 	sa_mad_data.attr_mod = 0;
+	sa_mad_data.attr_offset = 0;
 
 	/* Set the MAD attributes and component mask correctly. */
 	switch (p_query_req->query_type) {
 
 	case OSMV_QUERY_USER_DEFINED:
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"osmv_query_sa DBG:001 %s", "USER_DEFINED\n");
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 USER_DEFINED\n");
 		p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;
 		if (p_user_query->method)
 			sa_mad_data.method = p_user_query->method;
-		sa_mad_data.attr_offset = p_user_query->attr_offset;
+#ifdef DUAL_SIDED_RMPP
+		if (sa_mad_data.method == IB_MAD_METHOD_GETMULTI ||
+		    sa_mad_data.method == IB_MAD_METHOD_GETTRACETABLE)
+			sa_mad_data.attr_offset = p_user_query->attr_offset;
+#endif
 		sa_mad_data.attr_id = p_user_query->attr_id;
 		sa_mad_data.attr_mod = p_user_query->attr_mod;
 		sa_mad_data.comp_mask = p_user_query->comp_mask;
@@ -619,87 +598,61 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 		break;
 
 	case OSMV_QUERY_ALL_SVC_RECS:
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"osmv_query_sa DBG:001 %s", "SVC_REC_BY_NAME\n");
-		sa_mad_data.method = IB_MAD_METHOD_GETTABLE;
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 SVC_REC_BY_NAME\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_SERVICE_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_service_record_t));
 		sa_mad_data.comp_mask = 0;
-		sa_mad_data.p_attr = &svc_rec;
+		sa_mad_data.p_attr = &u.svc_rec;
 		break;
 
 	case OSMV_QUERY_SVC_REC_BY_NAME:
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"osmv_query_sa DBG:001 %s", "SVC_REC_BY_NAME\n");
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 SVC_REC_BY_NAME\n");
 		sa_mad_data.method = IB_MAD_METHOD_GET;
 		sa_mad_data.attr_id = IB_MAD_ATTR_SERVICE_RECORD;
 		sa_mad_data.comp_mask = IB_SR_COMPMASK_SNAME;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_service_record_t));
-		sa_mad_data.p_attr = &svc_rec;
-		memcpy(svc_rec.service_name, p_query_req->p_query_input,
+		sa_mad_data.p_attr = &u.svc_rec;
+		memcpy(u.svc_rec.service_name, p_query_req->p_query_input,
 		       sizeof(ib_svc_name_t));
 		break;
 
 	case OSMV_QUERY_SVC_REC_BY_ID:
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"osmv_query_sa DBG:001 %s", "SVC_REC_BY_ID\n");
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 SVC_REC_BY_ID\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_SERVICE_RECORD;
 		sa_mad_data.comp_mask = IB_SR_COMPMASK_SID;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_service_record_t));
-		sa_mad_data.p_attr = &svc_rec;
-		svc_rec.service_id =
+		sa_mad_data.p_attr = &u.svc_rec;
+		u.svc_rec.service_id =
 		    *(ib_net64_t *) (p_query_req->p_query_input);
 		break;
 
 	case OSMV_QUERY_CLASS_PORT_INFO:
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"osmv_query_sa DBG:001 %s", "CLASS_PORT_INFO\n");
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 CLASS_PORT_INFO\n");
 		sa_mad_data.method = IB_MAD_METHOD_GET;
 		sa_mad_data.attr_id = IB_MAD_ATTR_CLASS_PORT_INFO;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_class_port_info_t));
 		sa_mad_data.comp_mask = 0;
-		sa_mad_data.p_attr = &class_port_info;
-
+		sa_mad_data.p_attr = &u.class_port_info;
 		break;
 
 	case OSMV_QUERY_NODE_REC_BY_NODE_GUID:
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"osmv_query_sa DBG:001 %s", "NODE_REC_BY_NODE_GUID\n");
-		sa_mad_data.method = IB_MAD_METHOD_GETTABLE;
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 NODE_REC_BY_NODE_GUID\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_NODE_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_node_record_t));
 		sa_mad_data.comp_mask = IB_NR_COMPMASK_NODEGUID;
-		sa_mad_data.p_attr = &node_rec;
-		node_rec.node_info.node_guid =
+		sa_mad_data.p_attr = &u.node_rec;
+		u.node_rec.node_info.node_guid =
 		    *(ib_net64_t *) (p_query_req->p_query_input);
-
 		break;
 
 	case OSMV_QUERY_PORT_REC_BY_LID:
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"osmv_query_sa DBG:001 %s", "PORT_REC_BY_LID\n");
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 PORT_REC_BY_LID\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_PORTINFO_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_portinfo_record_t));
 		sa_mad_data.comp_mask = IB_PIR_COMPMASK_LID;
-		sa_mad_data.p_attr = &port_info;
-		port_info.lid = *(ib_net16_t *) (p_query_req->p_query_input);
+		sa_mad_data.p_attr = &u.port_info;
+		u.port_info.lid = *(ib_net16_t *) (p_query_req->p_query_input);
 		break;
 
 	case OSMV_QUERY_PORT_REC_BY_LID_AND_NUM:
 		sa_mad_data.method = IB_MAD_METHOD_GET;
 		p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"osmv_query_sa DBG:001 %s",
-			"PORT_REC_BY_LID_AND_NUM\n");
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 PORT_REC_BY_LID_AND_NUM\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_PORTINFO_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_portinfo_record_t));
 		sa_mad_data.comp_mask =
 		    IB_PIR_COMPMASK_LID | IB_PIR_COMPMASK_PORTNUM;
 		sa_mad_data.p_attr = p_user_query->p_attr;
@@ -708,12 +661,8 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 	case OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK:
 		sa_mad_data.method = IB_MAD_METHOD_GET;
 		p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"osmv_query_sa DBG:001 %s",
-			"OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK\n");
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_VLARB_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_vl_arb_table_record_t));
 		sa_mad_data.comp_mask =
 		    IB_VLA_COMPMASK_LID | IB_VLA_COMPMASK_OUT_PORT |
 		    IB_VLA_COMPMASK_BLOCK;
@@ -723,12 +672,8 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 	case OSMV_QUERY_SLVL_BY_LID_AND_PORTS:
 		sa_mad_data.method = IB_MAD_METHOD_GET;
 		p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"osmv_query_sa DBG:001 %s",
-			"OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK\n");
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_SLVL_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_slvl_table_record_t));
 		sa_mad_data.comp_mask =
 		    IB_SLVL_COMPMASK_LID | IB_SLVL_COMPMASK_OUT_PORT |
 		    IB_SLVL_COMPMASK_IN_PORT;
@@ -736,70 +681,59 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 		break;
 
 	case OSMV_QUERY_PATH_REC_BY_PORT_GUIDS:
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"osmv_query_sa DBG:001 %s", "PATH_REC_BY_PORT_GUIDS\n");
-		memset(&path_rec, 0, sizeof(ib_path_rec_t));
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 PATH_REC_BY_PORT_GUIDS\n");
+		memset(&u.path_rec, 0, sizeof(ib_path_rec_t));
 		sa_mad_data.attr_id = IB_MAD_ATTR_PATH_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_path_rec_t));
 		sa_mad_data.comp_mask =
-		    (IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID);
-		sa_mad_data.p_attr = &path_rec;
-		ib_gid_set_default(&path_rec.dgid,
+		    (IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUMBPATH);
+		u.path_rec.num_path = 0x7f;
+		sa_mad_data.p_attr = &u.path_rec;
+		ib_gid_set_default(&u.path_rec.dgid,
 				   ((osmv_guid_pair_t *) (p_query_req->
 							  p_query_input))->
 				   dest_guid);
-		ib_gid_set_default(&path_rec.sgid,
+		ib_gid_set_default(&u.path_rec.sgid,
 				   ((osmv_guid_pair_t *) (p_query_req->
 							  p_query_input))->
 				   src_guid);
 		break;
 
 	case OSMV_QUERY_PATH_REC_BY_GIDS:
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"osmv_query_sa DBG:001 %s", "PATH_REC_BY_GIDS\n");
-		memset(&path_rec, 0, sizeof(ib_path_rec_t));
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 PATH_REC_BY_GIDS\n");
+		memset(&u.path_rec, 0, sizeof(ib_path_rec_t));
 		sa_mad_data.attr_id = IB_MAD_ATTR_PATH_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_path_rec_t));
 		sa_mad_data.comp_mask =
-		    (IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID);
-		sa_mad_data.p_attr = &path_rec;
-		memcpy(&path_rec.dgid,
+		    (IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUMBPATH);
+		u.path_rec.num_path = 0x7f;
+		sa_mad_data.p_attr = &u.path_rec;
+		memcpy(&u.path_rec.dgid,
 		       &((osmv_gid_pair_t *) (p_query_req->p_query_input))->
 		       dest_gid, sizeof(ib_gid_t));
-		memcpy(&path_rec.sgid,
+		memcpy(&u.path_rec.sgid,
 		       &((osmv_gid_pair_t *) (p_query_req->p_query_input))->
 		       src_gid, sizeof(ib_gid_t));
 		break;
 
 	case OSMV_QUERY_PATH_REC_BY_LIDS:
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"osmv_query_sa DBG:001 %s", "PATH_REC_BY_LIDS\n");
-		memset(&path_rec, 0, sizeof(ib_path_rec_t));
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 PATH_REC_BY_LIDS\n");
+		memset(&u.path_rec, 0, sizeof(ib_path_rec_t));
 		sa_mad_data.method = IB_MAD_METHOD_GET;
 		sa_mad_data.attr_id = IB_MAD_ATTR_PATH_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_path_rec_t));
 		sa_mad_data.comp_mask =
 		    (IB_PR_COMPMASK_DLID | IB_PR_COMPMASK_SLID);
-		sa_mad_data.p_attr = &path_rec;
-		path_rec.dlid =
+		sa_mad_data.p_attr = &u.path_rec;
+		u.path_rec.dlid =
 		    ((osmv_lid_pair_t *) (p_query_req->p_query_input))->
 		    dest_lid;
-		path_rec.slid =
+		u.path_rec.slid =
 		    ((osmv_lid_pair_t *) (p_query_req->p_query_input))->src_lid;
 		break;
 
 	case OSMV_QUERY_UD_MULTICAST_SET:
 		sa_mad_data.method = IB_MAD_METHOD_SET;
 		p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"osmv_query_sa DBG:001 %s",
-			"OSMV_QUERY_UD_MULTICAST_SET\n");
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 OSMV_QUERY_UD_MULTICAST_SET\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_member_rec_t));
 		sa_mad_data.comp_mask = p_user_query->comp_mask;
 		sa_mad_data.p_attr = p_user_query->p_attr;
 		break;
@@ -807,19 +741,54 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 	case OSMV_QUERY_UD_MULTICAST_DELETE:
 		sa_mad_data.method = IB_MAD_METHOD_DELETE;
 		p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;
-		osm_log(p_log, OSM_LOG_DEBUG,
-			"osmv_query_sa DBG:001 %s",
-			"OSMV_QUERY_UD_MULTICAST_DELETE\n");
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 OSMV_QUERY_UD_MULTICAST_DELETE\n");
 		sa_mad_data.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;
-		sa_mad_data.attr_offset =
-		    ib_get_attr_offset(sizeof(ib_member_rec_t));
 		sa_mad_data.comp_mask = p_user_query->comp_mask;
 		sa_mad_data.p_attr = p_user_query->p_attr;
 		break;
 
+#ifdef DUAL_SIDED_RMPP
+	case OSMV_QUERY_MULTIPATH_REC:
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 MULTIPATH_REC\n");
+		/* Validate sgid/dgid counts against SA client limit */
+		p_mpr_req = (osmv_multipath_req_t *) p_query_req->p_query_input;
+		if (p_mpr_req->sgid_count + p_mpr_req->dgid_count >
+		    IB_MULTIPATH_MAX_GIDS) {
+			OSM_LOG(p_log, OSM_LOG_ERROR, "DBG:001 MULTIPATH_REC "
+				"SGID count %d DGID count %d max count %d\n",
+				p_mpr_req->sgid_count, p_mpr_req->dgid_count,
+				IB_MULTIPATH_MAX_GIDS);
+			CL_ASSERT(0);
+			return IB_ERROR;
+		}
+		memset(&u.multipath_rec, 0, sizeof(ib_multipath_rec_t));
+		sa_mad_data.method = IB_MAD_METHOD_GETMULTI;
+		sa_mad_data.attr_id = IB_MAD_ATTR_MULTIPATH_RECORD;
+		sa_mad_data.attr_offset =
+		    ib_get_attr_offset(sizeof(ib_multipath_rec_t));
+		sa_mad_data.p_attr = &u.multipath_rec;
+		sa_mad_data.comp_mask = p_mpr_req->comp_mask;
+		u.multipath_rec.num_path = p_mpr_req->num_path;
+		if (p_mpr_req->reversible)
+			u.multipath_rec.num_path |= 0x80;
+		else
+			u.multipath_rec.num_path &= ~0x80;
+		u.multipath_rec.pkey = p_mpr_req->pkey;
+		ib_multipath_rec_set_sl(&u.multipath_rec, p_mpr_req->sl);
+		ib_multipath_rec_set_qos_class(&u.multipath_rec, 0);
+		u.multipath_rec.independence = p_mpr_req->independence;
+		u.multipath_rec.sgid_count = p_mpr_req->sgid_count;
+		u.multipath_rec.dgid_count = p_mpr_req->dgid_count;
+		j = 0;
+		for (i = 0; i < p_mpr_req->sgid_count; i++, j++)
+			u.multipath_rec.gids[j] = p_mpr_req->gids[j];
+		for (i = 0; i < p_mpr_req->dgid_count; i++, j++)
+			u.multipath_rec.gids[j] = p_mpr_req->gids[j];
+		break;
+#endif
+
 	default:
-		osm_log(p_log, OSM_LOG_ERROR,
-			"osmv_query_sa DBG:001 %s", "UNKNOWN\n");
+		OSM_LOG(p_log, OSM_LOG_ERROR, "DBG:001 UNKNOWN\n");
 		CL_ASSERT(0);
 		return IB_ERROR;
 	}
@@ -829,6 +798,3 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 	OSM_LOG_EXIT(p_log);
 	return status;
 }
-
-/*****************************************************************************
- *****************************************************************************/
diff --git a/libvendor/osm_vendor_mlx_sender.c b/libvendor/osm_vendor_mlx_sender.c
index a0bdef8..319a54e 100644
--- a/libvendor/osm_vendor_mlx_sender.c
+++ b/libvendor/osm_vendor_mlx_sender.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -341,7 +341,7 @@ __osmv_rmpp_send_segment(IN osm_bind_handle_t h_bind,
 		p_mad->trans_id = cl_hton64(key);
 
 		osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
-			"Sending RMPP segment #%d, on-wire TID=0x%llX\n",
+			"Sending RMPP segment #%d, on-wire TID=0x%" PRIx64 "\n",
 			seg_num, p_mad->trans_id);
 
 		/*
diff --git a/libvendor/osm_vendor_mlx_txn.c b/libvendor/osm_vendor_mlx_txn.c
index a2da75a..72b6435 100644
--- a/libvendor/osm_vendor_mlx_txn.c
+++ b/libvendor/osm_vendor_mlx_txn.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2005,2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -76,7 +76,8 @@ osmv_txn_init(IN osm_bind_handle_t h_bind,
 	CL_ASSERT(NULL != h_bind && NULL != pp_txn);
 
 	osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
-		"Starting transaction 0x%llX (key=0x%llX)\n", tid, key);
+		"Starting transaction 0x%016" PRIx64
+		" (key=0x%016" PRIx64 ")\n", tid, key);
 
 	p_txn = malloc(sizeof(osmv_txn_ctx_t));
 	if (!p_txn) {
@@ -95,7 +96,8 @@ osmv_txn_init(IN osm_bind_handle_t h_bind,
 	if (IB_SUCCESS != st) {
 		osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,
 			"osmv_txn_init: ERR 6703: "
-			"Failed to insert to transaction 0x%llX (key=0x%llX) to manager DB\n",
+			"Failed to insert to transaction 0x%016" PRIx64
+			" (key=0x%016" PRIx64 ") to manager DB\n",
 			tid, key);
 		goto insert_txn_failed;
 	}
@@ -371,7 +373,7 @@ __osmv_txnmgr_lookup(IN osmv_txn_mgr_t * p_tx_mgr,
 
 	osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG,
 		"__osmv_txnmgr_lookup: "
-		"Looking for key: 0x%llX in map ptr:%p\n", key,
+		"Looking for key: 0x%016" PRIx64 " in map ptr:%p\n", key,
 		p_tx_mgr->p_txn_map);
 
 	p_item = cl_qmap_head(p_tx_mgr->p_txn_map);
@@ -379,7 +381,7 @@ __osmv_txnmgr_lookup(IN osmv_txn_mgr_t * p_tx_mgr,
 		tmp_key = cl_qmap_key(p_item);
 		osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG,
 			"__osmv_txnmgr_lookup: "
-			"Found key 0x%llX \n", tmp_key);
+			"Found key 0x%016" PRIx64 "\n", tmp_key);
 		p_item = cl_qmap_next(p_item);
 	}
 
@@ -413,7 +415,7 @@ __osmv_txnmgr_insert_txn(IN osmv_txn_mgr_t * p_tx_mgr,
 
 	osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG,
 		"__osmv_txnmgr_insert_txn: "
-		"Inserting key: 0x%llX to map ptr:%p\n", key,
+		"Inserting key: 0x%016" PRIx64 " to map ptr:%p\n", key,
 		p_tx_mgr->p_txn_map);
 
 	memset(p_obj, 0, sizeof(cl_map_obj_t));
@@ -427,7 +429,7 @@ __osmv_txnmgr_insert_txn(IN osmv_txn_mgr_t * p_tx_mgr,
 		tmp_key = cl_qmap_key(p_item);
 		osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG,
 			"__osmv_txnmgr_insert_txn: "
-			"Found key 0x%llX \n", tmp_key);
+			"Found key 0x%016" PRIx64 "\n", tmp_key);
 		p_item = cl_qmap_next(p_item);
 	}
 
@@ -452,7 +454,7 @@ __osmv_txnmgr_remove_txn(IN osmv_txn_mgr_t * p_tx_mgr,
 
 		osm_log(p_tx_mgr->p_log, OSM_LOG_ERROR,
 			"__osmv_txnmgr_remove_txn: ERR 6701: "
-			"Could not remove the transaction 0x%llX - "
+			"Could not remove the transaction 0x%016" PRIx64 " - "
 			"something is really wrong!\n", key);
 		OSM_LOG_EXIT(p_tx_mgr->p_log);
 		return IB_NOT_FOUND;
@@ -556,14 +558,14 @@ __osmv_txn_timeout_cb(IN uint64_t key,
 	switch (osmv_txn_get_rmpp_state(p_txn)) {
 
 	case OSMV_TXN_RMPP_NONE:
-		if (num_regs <= OSMV_MAX_RETRANSMIT) {
+		if (num_regs <= OSM_DEFAULT_RETRY_COUNT) {
 			/* We still did not exceed the limit of retransmissions.
 			 * Set the next timeout's value.
 			 */
 			osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
 				"__osmv_txn_timeout_cb: "
-				"The transaction request (tid=0x%llX) timed out %d times. "
-				"Retrying the send.\n",
+				"The transaction request (tid=0x%016" PRIx64 ")"
+				" timed out %d times. Retrying the send.\n",
 				osmv_txn_get_tid(p_txn), num_regs);
 
 			/* resend this mad */
@@ -572,7 +574,8 @@ __osmv_txn_timeout_cb(IN uint64_t key,
 			if (ret != IB_SUCCESS) {
 				osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,
 					"__osmv_txn_timeout_cb: "
-					"Fail to send retry for transaction request (tid=0x%llX).\n",
+					"Fail to send retry for transaction"
+					"request (tid=0x%016" PRIx64 ").\n",
 					osmv_txn_get_tid(p_txn));
 
 				osmv_txn_done((osm_bind_handle_t) p_bo, key,
@@ -599,7 +602,8 @@ __osmv_txn_timeout_cb(IN uint64_t key,
 		} else {
 			osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,
 				"__osmv_txn_timeout_cb: ERR 6702: "
-				"The transaction request (tid=0x%llX) timed out (after %d retries). "
+				"The transaction request (0x%016" PRIx64 ") "
+				"timed out (after %d retries). "
 				"Invoking the error callback.\n",
 				osmv_txn_get_tid(p_txn), num_regs);
 
@@ -613,12 +617,12 @@ __osmv_txn_timeout_cb(IN uint64_t key,
 
 	case OSMV_TXN_RMPP_SENDER:
 		osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
-			"RMPP sender (tid=0x%llX) did not receive ACK "
+			"RMPP sender (tid=0x%016" PRIx64 ") did not receive ACK "
 			"on every segment in the current send window.\n",
 			osmv_txn_get_tid(p_txn));
 
 		p_send_ctx = osmv_txn_get_rmpp_send_ctx(p_txn);
-		if (num_regs <= OSMV_MAX_RETRANSMIT) {
+		if (num_regs <= OSM_DEFAULT_RETRY_COUNT) {
 			/* We still did not exceed the limit of retransmissions.
 			 * Set the next timeout's value.
 			 */
@@ -643,8 +647,9 @@ __osmv_txn_timeout_cb(IN uint64_t key,
 
 	case OSMV_TXN_RMPP_RECEIVER:
 		osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
-			"Transaction timeout on an RMPP receiver (tid=0x%llX). "
-			"Dropping the transaction.\n", osmv_txn_get_tid(p_txn));
+			"Transaction timeout on an RMPP receiver "
+			"(tid=0x%016" PRIx64 "). Dropping the transaction.\n",
+			osmv_txn_get_tid(p_txn));
 
 		osmv_txn_done((osm_bind_handle_t) p_bo, key,
 			      TRUE /*in timeout callback */ );
diff --git a/man/opensm.8.in b/man/opensm.8
similarity index 57%
copy from man/opensm.8.in
copy to man/opensm.8
index 3000eaf..f6c9377 100644
--- a/man/opensm.8.in
+++ b/man/opensm.8
@@ -1,4 +1,4 @@
-.TH OPENSM 8 "June 13, 2008" "OpenIB" "OpenIB Management"
+.TH OPENSM 8 "March 8, 2012" "OpenIB" "OpenIB Management"
 
 .SH NAME
 opensm \- InfiniBand subnet manager and administration (SM/SA)
@@ -12,8 +12,11 @@ opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-l(mc) <LMC>]
 [\-p(riority) <PRIORITY>]
 [\-smkey <SM_Key>]
+[\-\-sm_sl <SL number>]
 [\-r(eassign_lids)]
 [\-R <engine name(s)> | \-\-routing_engine <engine name(s)>]
+[\-\-do_mesh_analysis]
+[\-\-lash_start_vl <vl number>]
 [\-A | \-\-ucast_cache]
 [\-z | \-\-connect_roots]
 [\-M <file name> | \-\-lid_matrix_file <file name>]
@@ -21,20 +24,32 @@ opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-S | \-\-sadb_file <file name>]
 [\-a | \-\-root_guid_file <path to file>]
 [\-u | \-\-cn_guid_file <path to file>]
+[\-G | \-\-io_guid_file <path to file>]
+[\-\-port\-shifting]
+[\-\-scatter\-ports]
+[\-H | \-\-max_reverse_hops <max reverse hops allowed>]
 [\-X | \-\-guid_routing_order_file <path to file>]
 [\-m | \-\-ids_guid_file <path to file>]
 [\-o(nce)]
 [\-s(weep) <interval>]
 [\-t(imeout) <milliseconds>]
+[\-\-retries <number>]
 [\-maxsmps <number>]
 [\-console [off | local | socket | loopback]]
 [\-console-port <port>]
 [\-i(gnore-guids) <equalize-ignore-guids-file>]
+[\-w | \-\-hop_weights_file <path to file>]
+[\-O | \-\-port_search_ordering_file <path to file>]
+[\-O | \-\-dimn_ports_file <path to file>] (DEPRECATED)
 [\-f <log file path> | \-\-log_file <log file path> ]
 [\-L | \-\-log_limit <size in MB>] [\-e(rase_log_file)]
 [\-P(config) <partition config file> ]
-[\-N | \-\-no_part_enforce]
+[\-N | \-\-no_part_enforce] (DEPRECATED)
+[\-Z | \-\-part_enforce [both | in | out | off]]
+[\-W | \-\-allow_both_pkeys]
 [\-Q | \-\-qos [\-Y | \-\-qos_policy_file <file name>]]
+[\-\-congestion\-control]
+[\-\-cckey <key>]
 [\-y | \-\-stay_on_fatal]
 [\-B | \-\-daemon]
 [\-I | \-\-inactive]
@@ -42,6 +57,8 @@ opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-\-perfmgr_sweep_time_s <seconds>]
 [\-\-prefix_routes_file <path>]
 [\-\-consolidate_ipv6_snm_req]
+[\-\-log_prefix <prefix text>]
+[\-\-torus_config <path to file>]
 [\-v(erbose)] [\-V] [\-D <flags>] [\-d(ebug) <number>]
 [\-h(elp)] [\-?]
 
@@ -86,7 +103,7 @@ Prints OpenSM version and exits.
 .TP
 \fB\-F\fR, \fB\-\-config\fR <config file>
 The name of the OpenSM config file. When not specified
-\fB\% @OPENSM_CONFIG_DIR@/@OPENSM_CONFIG_FILE@\fP will be used (if exists).
+\fB\% /usr/local/etc/opensm/opensm.conf\fP will be used (if exists).
 .TP
 \fB\-c\fR, \fB\-\-create-config\fR <file name>
 OpenSM will dump its configuration to the specified file and exit.
@@ -124,6 +141,10 @@ Note that OpenSM version 3.2.1 and below used the default value '1'
 in a host byte order, it is fixed now but you may need this option to
 interoperate with old OpenSM running on a little endian machine.
 .TP
+\fB\-\-sm_sl\fR <SL number>
+This option sets the SL to use for communication with the SM/SA.
+Defaults to 0.
+.TP
 \fB\-r\fR, \fB\-\-reassign_lids\fR
 This option causes OpenSM to reassign LIDs to all
 end nodes. Specifying -r on a running subnet
@@ -135,8 +156,20 @@ LID assignments resolving multiple use of same LID.
 This option chooses routing engine(s) to use instead of Min Hop
 algorithm (default).  Multiple routing engines can be specified
 separated by commas so that specific ordering of routing algorithms
-will be tried if earlier routing engines fail.
-Supported engines: minhop, updn, file, ftree, lash, dor
+will be tried if earlier routing engines fail.  If all configured
+routing engines fail, OpenSM will always attempt to route with Min Hop
+unless 'no_fallback' is included in the list of routing engines.
+Supported engines: minhop, updn, dnup, file, ftree, lash, dor, torus-2QoS,
+dfsssp, sssp.
+.TP
+\fB\-\-do_mesh_analysis\fR
+This option enables additional analysis for the lash routing engine to
+precondition switch port assignments in regular cartesian meshes which
+may reduce the number of SLs required to give a deadlock free routing.
+.TP
+\fB\-\-lash_start_vl\fR <vl number>
+This option sets the starting VL to use for the lash routing algorithm.
+Defaults to 0.
 .TP
 \fB\-A\fR, \fB\-\-ucast_cache\fR
 This option enables unicast routing cache and prevents routing
@@ -151,9 +184,9 @@ recalculations: one when the host goes down, and the other when
 the host comes back online.
 .TP
 \fB\-z\fR, \fB\-\-connect_roots\fR
-This option enforces a routing engine (currently up/down
-only) to make connectivity between root switches and in
-this way to be fully IBA complaint. In many cases this can
+This option enforces routing engines (up/down and
+fat-tree) to make connectivity between root switches and in
+this way to be fully IBA compliant. In many cases this can
 violate "pure" deadlock free algorithm, so use it carefully.
 .TP
 \fB\-M\fR, \fB\-\-lid_matrix_file\fR <file name>
@@ -177,6 +210,26 @@ algorithm to the guids provided in the given file (one to a line).
 Set the compute nodes for the Fat-Tree routing algorithm
 to the guids provided in the given file (one to a line).
 .TP
+\fB\-G\fR, \fB\-\-io_guid_file\fR <file name>
+Set the I/O nodes for the Fat-Tree routing algorithm
+to the guids provided in the given file (one to a line).
+I/O nodes are non-CN nodes allowed to use up to max_reverse_hops switches
+the wrong way around to improve connectivity.
+.TP
+\fB\-\-port\-shifting\fR
+This option enables a feature called \fBport shifting\fR.  In some
+fabrics, particularly cluster environments, routes commonly align and
+congest with other routes due to algorithmically unchanging traffic
+patterns.  This routing option will "shift" routing around in an
+attempt to alleviate this problem.
+.TP
+\fB\-\-scatter\-ports\fR
+This option will randomize port selecting in routing.
+.TP
+\fB\-H\fR, \fB\-\-max_reverse_hops\fR <max reverse hops allowed>
+Set the maximum number of reverse hops an I/O node is allowed
+to make. A reverse hop is the use of a switch the wrong way around.
+.TP
 \fB\-m\fR, \fB\-\-ids_guid_file\fR <file name>
 Name of the map file with set of the IDs which will be used
 by Up/Down routing algorithm instead of node GUIDs
@@ -200,10 +253,16 @@ Without -s, OpenSM defaults to a sweep interval of
 \fB\-t\fR, \fB\-\-timeout\fR <value>
 This option specifies the time in milliseconds
 used for transaction timeouts.
-Specifying -t 0 disables timeouts.
+Timeout values should be > 0.
 Without -t, OpenSM defaults to a timeout value of
 200 milliseconds.
 .TP
+\fB\-\-retries\fR <number>
+This option specifies the number of retries used
+for transactions.
+Without --retries, OpenSM defaults to 3 retries
+for transactions.
+.TP
 \fB\-maxsmps\fR <number>
 This option specifies the number of VL15 SMP MADs
 allowed on the wire at any one time.
@@ -212,10 +271,13 @@ SMPs.
 Without -maxsmps, OpenSM defaults to a maximum of
 4 outstanding SMPs.
 .TP
-\fB\-console [off | local | socket | loopback]\fR
-This option brings up the OpenSM console (default off).
-Note that the socket and loopback options will only be available
-if OpenSM was built with --enable-console-socket.
+\fB\-console [off | local | loopback | socket]\fR
+This option brings up the OpenSM console (default off).  Note, loopback and
+socket open a socket which can be connected to WITHOUT CREDENTIALS.  Loopback
+is safer if access to your SM host is controlled.  tcp_wrappers
+(hosts.[allow|deny]) is used with loopback and socket.  loopback and socket
+will only be available if OpenSM was built with --enable-console-loopback
+(default yes) and --enable-console-socket (default no) respectively.
 .TP
 \fB\-console-port\fR <port>
 Specify an alternate telnet port for the socket console (default 10000).
@@ -227,6 +289,47 @@ This option provides the means to define a set of ports
 (by node guid and port number) that will be ignored by the link load
 equalization algorithm.
 .TP
+\fB\-w\fR, \fB\-\-hop_weights_file\fR <path to file>
+This option provides weighting factors per port representing a hop cost in
+computing the lid matrix.  The file consists of lines containing a switch port
+GUID (specified as a 64 bit hex number, with leading 0x), output port number,
+and weighting factor.  Any port not listed in the file defaults to a weighting
+factor of 1.  Lines starting with # are comments.  Weights affect only the
+output route from the port, so many useful configurations will require weights
+to be specified in pairs.
+.TP
+\fB\-O\fR, \fB\-\-port_search_ordering_file\fR <path to file>
+This option tweaks the routing. It suitable for two cases:
+1. While using DOR routing algorithm.
+This option provides a mapping between hypercube dimensions and ports
+on a per switch basis for the DOR routing engine.  The file consists
+of lines containing a switch node GUID (specified as a 64 bit hex
+number, with leading 0x) followed by a list of non-zero port numbers,
+separated by spaces, one switch per line.  The order for the port
+numbers is in one to one correspondence to the dimensions.  Ports not
+listed on a line are assigned to the remaining dimensions, in port
+order.  Anything after a # is a comment.
+2. While using general routing algorithm.
+This option provides the order of the ports that would be chosen for routing,
+from each switch rather than searching for an appropriate port from port 1 to N.
+The file consists of lines containing a switch node GUID (specified as a 64 bit
+hex number, with leading 0x) followed by a list of non-zero port numbers,
+separated by spaces, one switch per line.  In case of DOR, the order for the
+port numbers is in one to one correspondence to the dimensions.  Ports not
+listed on a line are assigned to the remaining dimensions, in port
+order.  Anything after a # is a comment.
+.TP
+\fB\-O\fR, \fB\-\-dimn_ports_file\fR <path to file> \fB(DEPRECATED)\fR
+This is a deprecated flag. Please use \fB-port_search_ordering_file\fR instead.
+This option provides a mapping between hypercube dimensions and ports
+on a per switch basis for the DOR routing engine.  The file consists
+of lines containing a switch node GUID (specified as a 64 bit hex
+number, with leading 0x) followed by a list of non-zero port numbers,
+separated by spaces, one switch per line.  The order for the port
+numbers is in one to one correspondence to the dimensions.  Ports not
+listed on a line are assigned to the remaining dimensions, in port
+order.  Anything after a # is a comment.
+.TP
 \fB\-x\fR, \fB\-\-honor_guid2lid\fR
 This option forces OpenSM to honor the guid2lid file,
 when it comes out of Standby state, if such file exists
@@ -250,25 +353,47 @@ is accumulative.
 .TP
 \fB\-P\fR, \fB\-\-Pconfig\fR <partition config file>
 This option defines the optional partition configuration file.
-The default name is \fB\%@OPENSM_CONFIG_DIR@/@PARTITION_CONFIG_FILE@\fP.
+The default name is \fB\%/usr/local/etc/opensm/partitions.conf\fP.
 .TP
 \fB\-\-prefix_routes_file\fR <file name>
 Prefix routes control how the SA responds to path record queries for
 off-subnet DGIDs.  By default, the SA fails such queries. The
 .B PREFIX ROUTES
 section below describes the format of the configuration file.
-The default path is \fB\%@OPENSM_CONFIG_DIR@/prefix\-routes.conf\fP.
+The default path is \fB\%/usr/local/etc/opensm/prefix\-routes.conf\fP.
 .TP
 \fB\-Q\fR, \fB\-\-qos\fR
 This option enables QoS setup. It is disabled by default.
 .TP
 \fB\-Y\fR, \fB\-\-qos_policy_file\fR <file name>
 This option defines the optional QoS policy file. The default
-name is \fB\%@OPENSM_CONFIG_DIR@/@QOS_POLICY_FILE@\fP.
+name is \fB\%/usr/local/etc/opensm/qos-policy.conf\fP. See
+QoS_management_in_OpenSM.txt in opensm doc for more information on
+configuring QoS policy via this file.
 .TP
-\fB\-N\fR, \fB\-\-no_part_enforce\fR
+\fB\-\-congestion_control\fR
+(EXPERIMENTAL) This option enables congestion control configuration.
+It is disabled by default.  See config file for congestion control
+configuration options.
+\fB\-\-cc_key\fR <key>
+(EXPERIMENTAL) This option configures the CCkey to use when configuring
+congestion control.  Note that this option does not configure a new
+CCkey into switches and CAs.  Defaults to 0.
+.TP
+\fB\-N\fR, \fB\-\-no_part_enforce\fR \fB(DEPRECATED)\fR
+This is a deprecated flag. Please use \fB\-\-part_enforce\fR instead.
 This option disables partition enforcement on switch external ports.
 .TP
+\fB\-Z\fR, \fB\-\-part_enforce\fR [both | in | out | off]
+This option indicates the partition enforcement type (for switches).
+Enforcement type can be inbound only (in), outbound only (out),
+both or disabled (off). Default is both.
+.TP
+\fB\-W\fR, \fB\-\-allow_both_pkeys\fR
+This option indicates whether both full and limited membership on the
+same partition can be configured in the PKeyTable. Default is not
+to allow both pkeys.
+.TP
 \fB\-y\fR, \fB\-\-stay_on_fatal\fR
 This option will cause SM not to exit on fatal initialization
 issues: if SM discovers duplicated guids or a 12x link with
@@ -286,7 +411,8 @@ this is NOT currently implemented in the performance manager.
 .TP
 \fB\-perfmgr\fR
 Enable the perfmgr.  Only takes effect if --enable-perfmgr was specified at
-configure time.
+configure time.  See performance-manager-HOWTO.txt in opensm doc for
+more information on running perfmgr.
 .TP
 \fB\-perfmgr_sweep_time_s\fR <seconds>
 Specify the sweep time for the performance manager in seconds
@@ -294,8 +420,20 @@ Specify the sweep time for the performance manager in seconds
 effect if --enable-perfmgr was specified at configure time.
 .TP
 .BI --consolidate_ipv6_snm_req
-Consolidate IPv6 Solicited Node Multicast group join requests into one
-multicast group per MGID PKey.
+Use shared MLID for IPv6 Solicited Node Multicast groups per MGID scope
+and P_Key.
+.TP
+\fB\-\-log_prefix\fR <prefix text>
+This option specifies the prefix to the syslog messages from OpenSM.
+A suitable prefix can be used to identify the IB subnet in syslog messages
+when two or more instances of OpenSM run in a single node to manage multiple
+fabrics. For example, in a dual-fabric (or dual-rail) IB cluster, the prefix
+for the first fabric could be "mpi" and the other fabric could be "storage".
+.TP
+\fB\-\-torus_config\fR <path to torus\-2QoS config file>
+This option defines the file name for the extra configuration
+information needed for the torus-2QoS routing engine.   The default
+name is \fB\%/usr/local/etc/opensm/torus-2QoS.conf\fP
 .TP
 \fB\-v\fR, \fB\-\-verbose\fR
 This option increases the log verbosity level.
@@ -326,7 +464,7 @@ specific log level as follows:
  0x10 - FUNCS (function entry/exit, very high volume)
  0x20 - FRAMES (dumps all SMP and GMP frames)
  0x40 - ROUTING (dump FDB routing information)
- 0x80 - currently unused.
+ 0x80 - SYS (syslog at LOG_INFO level in addition to OpenSM logging)
 
 Without -D, OpenSM defaults to ERROR + INFO (0x3).
 Specifying -D 0 disables all messages.
@@ -363,9 +501,12 @@ opensm.mcfdbs. By default, this directory is /var/log.
 
 OSM_CACHE_DIR - opensm stores certain data to the disk such that subsequent
 runs are consistent. The default directory used is /var/cache/opensm.
-The following file is included in it:
+The following files are included in it:
 
- guid2lid - stores the LID range assigned to each GUID
+ guid2lid  - stores the LID range assigned to each GUID
+ guid2mkey - stores the MKey previously assiged to each GUID
+ neighbors - stores a map of the GUIDs at either end of each link
+             in the fabric
 
 .SH NOTES
 .PP
@@ -377,68 +518,122 @@ logrotate purposes.
 .SH PARTITION CONFIGURATION
 .PP
 The default name of OpenSM partitions configuration file is
-\fB\%@OPENSM_CONFIG_DIR@/@PARTITION_CONFIG_FILE@\fP. The default may be changed by using
---Pconfig (-P) option with OpenSM.
+\fB\%/usr/local/etc/opensm/partitions.conf\fP. The default may be changed
+by using the --Pconfig (-P) option with OpenSM.
 
 The default partition will be created by OpenSM unconditionally even
 when partition configuration file does not exist or cannot be accessed.
 
-The default partition has P_Key value 0x7fff. OpenSM\'s port will have
-full membership in default partition. All other end ports will have
-partial membership.
+The default partition has P_Key value 0x7fff. OpenSM\'s port will always
+have full membership in default partition. All other end ports will have
+full membership if the partition configuration file is not found or cannot
+be accessed, or limited membership if the file exists and can be accessed
+but there is no rule for the Default partition.
 
-File Format
+Effectively, this amounts to the same as if one of the following rules
+below appear in the partition configuration file.
 
-Comments:
+In the case of no rule for the Default partition:
 
-Line content followed after \'#\' character is comment and ignored by
-parser.
-
-General file format:
+Default=0x7fff : ALL=limited, SELF=full ;
 
-<Partition Definition>:<PortGUIDs list> ;
+In the case of no partition configuration file or file cannot be accessed:
 
-Partition Definition:
+Default=0x7fff : ALL=full ;
 
-[PartitionName][=PKey][,flag[=value]][,defmember=full|limited]
 
- PartitionName - string, will be used with logging. When omitted
-                 empty string will be used.
- PKey          - P_Key value for this partition. Only low 15 bits will
-                 be used. When omitted will be autogenerated.
- flag          - used to indicate IPoIB capability of this partition.
- defmember=full|limited - specifies default membership for port guid
-                 list. Default is limited.
-
-Currently recognized flags are:
-
- ipoib       - indicates that this partition may be used for IPoIB, as
-               result IPoIB capable MC group will be created.
- rate=<val>  - specifies rate for this IPoIB MC group
-               (default is 3 (10GBps))
- mtu=<val>   - specifies MTU for this IPoIB MC group
-               (default is 4 (2048))
- sl=<val>    - specifies SL for this IPoIB MC group
-               (default is 0)
- scope=<val> - specifies scope for this IPoIB MC group
-               (default is 2 (link local)).  Multiple scope settings
-               are permitted for a partition.
+File Format
 
-Note that values for rate, mtu, and scope should be specified as
-defined in the IBTA specification (for example, mtu=4 for 2048).
+Comments:
 
-PortGUIDs list:
+Line content followed after \'#\' character is comment and ignored by
+parser.
 
- PortGUID         - GUID of partition member EndPort. Hexadecimal
-                    numbers should start from 0x, decimal numbers
-                    are accepted too.
- full or limited  - indicates full or limited membership for this
-                    port.  When omitted (or unrecognized) limited
-                    membership is assumed.
+General file format:
 
-There are two useful keywords for PortGUID definition:
+<Partition Definition>:[<newline>]<Partition Properties>;
+
+     Partition Definition:
+       [PartitionName][=PKey][,ipoib_bc_flags][,defmember=full|limited]
+
+        PartitionName  - string, will be used with logging. When omitted
+                         empty string will be used.
+        PKey           - P_Key value for this partition. Only low 15 bits will
+                         be used. When omitted will be autogenerated.
+        ipoib_bc_flags - used to indicate/specify IPoIB capability of this partition.
+
+        defmember=full|limited|both - specifies default membership for port guid
+                         list. Default is limited.
+
+     ipoib_bc_flags:
+        ipoib_flag|[mgroup_flag]*
+
+        ipoib_flag - indicates that this partition may be used for IPoIB, as
+                     a result the IPoIB broadcast group will be created with
+                     the flags given, if any.
+
+     Partition Properties:
+       [<Port list>|<MCast Group>]* | <Port list>
+
+     Port list:
+        <Port Specifier>[,<Port Specifier>]
+
+     Port Specifier:
+        <PortGUID>[=[full|limited|both]]
+
+        PortGUID         - GUID of partition member EndPort. Hexadecimal
+                           numbers should start from 0x, decimal numbers
+                           are accepted too.
+
+        full, limited,   - indicates full and/or limited membership for this
+        both               port.  When omitted (or unrecognized) limited
+                           membership is assumed. Both indicates both full
+                           and limited membership for this port.
+
+     MCast Group:
+        mgid=gid[,mgroup_flag]*<newline>
+
+                         - gid specified is verified to be a Multicast address
+                           IP groups are verified to match the rate and mtu of the
+                           broadcast group.  The P_Key bits of the mgid for IP
+                           groups are verified to either match the P_Key specified
+                           in by "Partition Definition" or if they are 0x0000 the
+                           P_Key will be copied into those bits.
+
+     mgroup_flag:
+        rate=<val>  - specifies rate for this MC group
+                      (default is 3 (10GBps))
+        mtu=<val>   - specifies MTU for this MC group
+                      (default is 4 (2048))
+        sl=<val>    - specifies SL for this MC group
+                      (default is 0)
+        scope=<val> - specifies scope for this MC group
+                      (default is 2 (link local)).  Multiple scope settings
+                      are permitted for a partition.
+                      NOTE: This overwrites the scope nibble of the specified
+                            mgid.  Furthermore specifying multiple scope
+                            settings will result in multiple MC groups
+                            being created.
+        qkey=<val>      - specifies the Q_Key for this MC group
+                          (default: 0x0b1b for IP groups, 0 for other groups)
+        tclass=<val>    - specifies tclass for this MC group
+                          (default is 0)
+        FlowLabel=<val> - specifies FlowLabel for this MC group
+                          (default is 0)
+
+     newline: '\n'
+
+
+Note that values for rate, mtu, and scope, for both partitions and multicast
+groups, should be specified as defined in the IBTA specification (for example,
+mtu=4 for 2048).
+
+There are several useful keywords for PortGUID definition:
 
  - 'ALL' means all end ports in this subnet.
+ - 'ALL_CAS' means all Channel Adapter end ports in this subnet.
+ - 'ALL_SWITCHES' means all Switch end ports in this subnet.
+ - 'ALL_ROUTERS' means all Router end ports in this subnet.
  - 'SELF' means subnet manager's port.
 
 Empty list means no ports in this partition.
@@ -447,9 +642,6 @@ Notes:
 
 White space is permitted between delimiters ('=', ',',':',';').
 
-The line can be wrapped after ':' followed after Partition Definition and
-between.
-
 PartitionName does not need to be unique, PKey does need to be unique.
 If PKey is repeated then those partition configurations will be merged
 and first PartitionName will be used (see also next note).
@@ -461,6 +653,7 @@ different PKey values will be generated for those definitions).
 Examples:
 
  Default=0x7fff : ALL, SELF=full ;
+ Default=0x7fff : ALL, ALL_SWITCHES=full, SELF=full ;
 
  NewPartition , ipoib : 0x123456=full, 0x3456789034=limi, 0x2134af2306 ;
 
@@ -475,6 +668,15 @@ Examples:
  ShareIO = 0x80 , defmember=full : 0x123459, 0x12345a;
  ShareIO = 0x80 , defmember=full : 0x12345b, 0x12345c=limited, 0x12345d;
 
+ # multicast groups added to default
+ Default=0x7fff,ipoib:
+        mgid=ff12:401b::0707,sl=1 # random IPv4 group
+        mgid=ff12:601b::16    # MLDv2-capable routers
+        mgid=ff12:401b::16    # IGMP
+        mgid=ff12:601b::2     # All routers
+        mgid=ff12::1,sl=1,Q_Key=0xDEADBEEF,rate=3,mtu=2 # random group
+        ALL=full;
+
 
 Note:
 
@@ -559,12 +761,89 @@ opensm will return the path to the first available matching router.
 A configuration file with a single line where both prefix and GUID
 are wild-carded means that a path record query specifying any
 off-subnet DGID should return a path to the first available router.
-This configuration yields the same behaviour formerly achieved by
-compiling opensm with -DROUTER_EXP.
+This configuration yields the same behavior formerly achieved by
+compiling opensm with -DROUTER_EXP which has been obsoleted.
+
+.SH MKEY CONFIGURATION
+.PP
+OpenSM supports configuring a single management key (MKey) for use across
+the subnet.
+
+The following configuration options are available:
+
+ m_key                  - the 64-bit MKey to be used on the subnet
+                          (IBA 14.2.4)
+ m_key_protection_level - the numeric value of the MKey ProtectBits
+                          (IBA 14.2.4.1)
+ m_key_lease_period     - the number of seconds a CA will wait for a
+                          response from the SM before resetting the
+                          protection level to 0 (IBA 14.2.4.2).
+
+OpenSM will configure all ports with the MKey specified by m_key, defaulting
+to a value of 0. A m_key value of 0 disables MKey protection on the subnet.
+Switches and HCAs with a non-zero MKey will not accept requests to change
+their configuration unless the request includes the proper MKey.
+
+MKey Protection Levels
+
+MKey protection levels modify how switches and CAs respond to SMPs lacking
+a valid MKey.
+OpenSM will configure each port's ProtectBits to support the level defined by
+the m_key_protection_level parameter.  If no parameter is specified, OpenSM
+defaults to operating at protection level 0.
+
+There are currently 4 protection levels defined by the IBA:
+
+ 0 - Queries return valid data, including MKey.  Configuration changes
+     are not allowed unless the request contains a valid MKey.
+ 1 - Like level 0, but the MKey is set to 0 (0x00000000) in queries,
+     unless the request contains a valid MKey.
+ 2 - Neither queries nor configuration changes are allowed, unless the
+     request contains a valid MKey.
+ 3 - Identical to 2.  Maintained for backwards compatibility.
+
+MKey Lease Period
+
+InfiniBand supports a MKey lease timeout, which is intended to allow
+administrators or a new SM to recover/reset lost MKeys on a fabric.
+
+If MKeys are enabled on the subnet and a switch or CA receives a request that
+requires a valid MKey but does not contain one, it warns the SM by sending a trap
+(Bad M_Key, Trap 256).  If the MKey lease period is non-zero, it also starts a
+countdown timer for the time specified by the lease period.
+If a SM (or other agent) responds with the correct MKey, the timer is stopped
+and reset.  Should the timer reach zero, the switch or CA will reset its MKey
+protection level to 0, exposing the MKey and allowing recovery.
+
+OpenSM will initialize all ports to use a mkey lease period of the number of
+seconds specified in the config file.  If no mkey_lease_period is specified,
+a default of 0 will be used.
+
+OpenSM normally quickly responds to all Bad_M_Key traps, resetting the lease
+timers.  Additionally, OpenSM's subnet sweeps will also cancel
+any running timers.  For maximum protection against accidentally-exposed MKeys,
+the MKey lease time should be a few multiples of the subnet sweep time.
+If OpenSM detects at startup that your sweep interval is greater than your
+MKey lease period, it will reset the lease period to be greater than the
+sweep interval.  Similarly, if sweeping is disabled at startup, it will be
+re-enabled with an interval less than the Mkey lease period.
+
+If OpenSM is required to recover a subnet for which it is missing mkeys,
+it must do so one switch level at a time.  As such, the total time to
+recover the subnet may be as long as the mkey lease period multiplied by
+the maximum number of hops between the SM and an endpoint, plus one.
+
+MKey Effects on Diagnostic Utilities
+
+Setting a MKey may have a detrimental effect on diagnostic software run on
+the subnet, unless your diagnostic software is able to retrieve MKeys from the
+SA or can be explicitly configured with the proper MKey.  This is particularly
+true at protection level 2, where CAs will ignore queries for management
+information that do not contain the proper MKey.
 
 .SH ROUTING
 .PP
-OpenSM now offers five routing engines:
+OpenSM now offers nine routing engines:
 
 1.  Min Hop Algorithm - based on the minimum hops to each node where the
 path length is optimized.
@@ -574,25 +853,46 @@ node, but it is constrained to ranking rules. This algorithm should be chosen
 if the subnet is not a pure Fat Tree, and deadlock may occur due to a
 loop in the subnet.
 
-3.  Fat Tree Unicast routing algorithm - this algorithm optimizes routing
+3. DNUP Unicast routing algorithm - similar to UPDN but allows routing in
+fabrics which have some CA nodes attached closer to the roots than some switch
+nodes.
+
+4.  Fat Tree Unicast routing algorithm - this algorithm optimizes routing
 for congestion-free "shift" communication pattern.
 It should be chosen if a subnet is a symmetrical or almost symmetrical
 fat-tree of various types, not just K-ary-N-Trees: non-constant K, not
 fully staffed, any Constant Bisectional Bandwidth (CBB) ratio.
 Similar to UPDN, Fat Tree routing is constrained to ranking rules.
 
-4. LASH unicast routing algorithm - uses Infiniband virtual layers
+5. LASH unicast routing algorithm - uses Infiniband virtual layers
 (SL) to provide deadlock-free shortest-path routing while also
 distributing the paths between layers. LASH is an alternative
 deadlock-free topology-agnostic routing algorithm to the non-minimal
 UPDN algorithm avoiding the use of a potentially congested root node.
 
-5. DOR Unicast routing algorithm - based on the Min Hop algorithm, but
+6. DOR Unicast routing algorithm - based on the Min Hop algorithm, but
 avoids port equalization except for redundant links between the same
 two switches.  This provides deadlock free routes for hypercubes when
 the fabric is cabled as a hypercube and for meshes when cabled as a
 mesh (see details below).
 
+7. Torus-2QoS unicast routing algorithm - a DOR-based routing algorithm
+specialized for 2D/3D torus topologies.  Torus-2QoS provides deadlock-free
+routing while supporting two quality of service (QoS) levels.  In addition
+it is able to route around multiple failed fabric links or a single failed
+fabric switch without introducing deadlocks, and without changing path SL
+values granted before the failure.
+
+8. DFSSSP unicast routing algorithm - a deadlock-free
+single-source-shortest-path routing, which uses the SSSP algorithm
+(see algorithm 9.) as the base to optimize link utilization and uses
+Infiniband virtual lanes (SL) to provide deadlock-freedom.
+
+9. SSSP unicast routing algorithm - a single-source-shortest-path routing
+algorithm, which globally balances the number of routes per link to
+optimize link utilization. This routing algorithm has no restrictions
+in terms of the underlying topology.
+
 OpenSM also supports a file method which
 can load routes from a table. See \'Modular Routing Engine\' for more
 information on this.
@@ -614,7 +914,7 @@ decision is made as to what port should be used to get to that LID.
    This step is common to standard and Up/Down routing. Each port has a
 counter counting the number of target LIDs going through it.
    When there are multiple alternative ports with same MinHop to a LID,
-the one with less previously assigned ports is selected.
+the one with less previously assigned LIDs is selected.
    If LMC > 0, more checks are added: Within each group of LIDs assigned to
 same target port,
    a. use only ports which have same MinHop
@@ -736,6 +1036,18 @@ format will be discarded.
 possible to specify CA guids; OpenSM will use the guid of the switch (if
 it exists) that connects the CA to the subnet as a root node.
 
+Purpose of DNUP Algorithm
+
+The DNUP algorithm is designed to serve a similar purpose to UPDN. However
+it is intended to work in network topologies which are unsuited to
+UPDN due to nodes being connected closer to the roots than some of
+the switches.  An example would be a fabric which contains nodes and
+uplinks connected to the same switch. The operation of DNUP is the
+same as UPDN with the exception of the ranking process.  In DNUP all
+switch nodes are ranked based solely on their distance from CA Nodes,
+all switch nodes directly connected to at least one CA are assigned a
+value of 1 all other switch nodes are assigned a value of one more than
+the minimum rank of all neighbor switch nodes.
 
 Fat-tree Routing Algorithm
 
@@ -790,6 +1102,21 @@ in the same directory where the OpenSM log resides. This ordering file provides
 the CN order that may be used to create efficient communication pattern, that
 will match the routing tables.
 
+Routing between non-CN nodes
+
+The use of the cn_guid_file option allows non-CN nodes to be located on different levels in the fat tree.
+In such case, it is not guaranteed that the Fat Tree algorithm will route between two non-CN nodes.
+To solve this problem, a list of non-CN nodes can be specified by \'-G\' or \'--io_guid_file\' option.
+Theses nodes will be allowed to use switches the wrong way round a specific number of times (specified by \'-H\' or \'--max_reverse_hops\'.
+With the proper max_reverse_hops and io_guid_file values, you can ensure full connectivity in the Fat Tree.
+
+Please note that using max_reverse_hops creates routes that use the switch in a counter-stream way.
+This option should never be used to connect nodes with high bandwidth traffic between them ! It should only be used
+to allow connectivity for HA purposes or similar.
+Also having routes the other way around can in theory cause credit loops.
+
+Use these options with extreme care !
+
 Activation through OpenSM
 
 Use '-R ftree' option to activate the fat-tree algorithm.
@@ -860,6 +1187,18 @@ used.
 Note: LMC > 0 is not supported by the LASH routing. If this is
 specified, the default routing algorithm is invoked instead.
 
+For open regular cartesian meshes the DOR algorithm is the ideal
+routing algorithm. For toroidal meshes on the other hand there
+are routing loops that can cause deadlocks. LASH can be used to
+route these cases. The performance of LASH can be improved by
+preconditioning the mesh in cases where there are multiple links
+connecting switches and also in cases where the switches are not
+cabled consistently. An option exists for LASH to do this. To
+invoke this use '-R lash -Q --do_mesh_analysis'. This will
+add an additional phase that analyses the mesh to try to determine
+the dimension and size of a mesh. If it determines that the mesh
+looks like an open or closed cartesian mesh it reorders the ports
+in dimension order before the rest of the LASH algorithm runs.
 
 DOR Routing Algorithm
 
@@ -868,20 +1207,109 @@ algorithm and so uses shortest paths.  Instead of spreading traffic
 out across different paths with the same shortest distance, it chooses
 among the available shortest paths based on an ordering of dimensions.
 Each port must be consistently cabled to represent a hypercube
-dimension or a mesh dimension.  Paths are grown from a destination
-back to a source using the lowest dimension (port) of available paths
-at each step.  This provides the ordering necessary to avoid deadlock.
+dimension or a mesh dimension.  Alternatively, the -O option can be
+used to assign a custom mapping between the ports on a given switch,
+and the associated dimension.  Paths are grown from a destination back
+to a source using the lowest dimension (port) of available paths at
+each step.  This provides the ordering necessary to avoid deadlock.
 When there are multiple links between any two switches, they still
 represent only one dimension and traffic is balanced across them
 unless port equalization is turned off.  In the case of hypercubes,
 the same port must be used throughout the fabric to represent the
-hypercube dimension and match on both ends of the cable.  In the case
-of meshes, the dimension should consistently use the same pair of
-ports, one port on one end of the cable, and the other port on the
-other end, continuing along the mesh dimension.
+hypercube dimension and match on both ends of the cable, or the -O
+option used to accomplish the alignment.  In the case of meshes, the
+dimension should consistently use the same pair of ports, one port on
+one end of the cable, and the other port on the other end, continuing
+along the mesh dimension, or the -O option used as an override.
 
 Use '-R dor' option to activate the DOR algorithm.
 
+DFSSSP and SSSP Routing Algorithm
+
+The (Deadlock-Free) Single-Source-Shortest-Path routing algorithm is
+designed to optimize link utilization thru global balancing of routes,
+while supporting arbitrary topologies. The DFSSSP routing algorithm
+uses Infiniband virtual lanes (SL) to provide deadlock-freedom.
+
+The DFSSSP algorithm consists of five major steps:
+.br
+1) It discovers the subnet and models the subnet as a directed
+multigraph in which each node represents a node of the physical
+network and each edge represents one direction of the full-duplex
+links used to connect the nodes.
+.br
+2) A loop, which iterates over all CA and switches of the subnet, will
+perform three steps to generate the linear forwarding tables for
+each switch:
+.br
+2.1) use Dijkstra's algorithm to find the shortest path from all
+nodes to the current selected destination;
+.br
+2.2) update the egde weights in the graph, i.e. add the number of
+routes, which use a link to reach the destination,
+to the link/edge;
+.br
+2.3) update the LFT of each switch with the outgoing port which was
+used in the current step to route the traffic to the
+destination node.
+.br
+3) After the number of available virtual lanes or layers in the subnet
+is detected and a channel dependency graph is initialized for each
+layer, the algorithm will put each possible route of the subnet into
+the first layer.
+.br
+4) A loop iterates over all channel dependency graphs (CDG) and performs
+the following substeps:
+.br
+4.1) search for a cycle in the current CDG;
+.br
+4.2) when a cycle is found, i.e. a possible deadlock is present,
+one edge is selected and all routes, which induced this egde,
+are moved to the "next higher" virtual layer (CDG[i+1]);
+.br
+4.3) the cycle search is continued until all cycles are broken and
+routes are moved "up".
+.br
+5) When the number of needed layers does not exceeds the number of
+available SL/VL to remove all cycles in all CDGs, the rounting is
+deadlock-free and an relation table is generated, which contains
+the assignment of routes from source to destination to a SL
+
+Note on SSSP:
+.br
+This algorithm does not perform the steps 3)-5) and can not be
+considered to be deadlock-free for all topologies. But on the one
+hand, you can choose this algorithm for really large networks
+(5,000+ CAs and deadlock-free by design) to reduce
+the runtime of the algorithm. On the other hand, you might use
+the SSSP routing algorithm as an alternative, when all deadlock-free
+routing algorithms fail to route the network for whatever reason.
+In the last case, SSSP was designed to deliver an equal or higher
+bandwidth due to better congestion avoidance than the Min Hop
+routing algorithm.
+
+Notes for usage:
+.br
+a) running DFSSSP: '-R dfsssp -Q'
+.br
+a.1) QoS has to be configured to equally spread the load on the
+available SL or virtual lanes
+.br
+a.2) applications must perform a path record query to get path SL for
+each route, which the application will use to transmite packages
+.br
+b) running SSSP:   '-R sssp'
+.br
+c) both algorithms support LMC > 0
+
+Torus-2QoS Routing Algorithm
+
+Torus-2QoS is routing algorithm designed for large-scale 2D/3D torus fabrics;
+see torus-2QoS(8) for full documentation.
+
+Use '-R torus-2QoS -Q' or '-R torus-2QoS,no_fallback -Q'
+to activate the torus-2QoS algorithm.
+
 
 Routing References
 
@@ -909,6 +1337,16 @@ Communications Magazine, Vol.44, No.7, July 2006.
 Networks", Skeie et al. IEEE Computer Society Communication
 Architecture for Clusters 2002.
 
+To learn more about the DFSSSP and SSSP routing algorithm,
+see the articles:
+.br
+J. Domke, T. Hoefler and W. Nagel: Deadlock-Free Oblivious Routing
+for Arbitrary Topologies, In Proceedings of the 25th IEEE International
+Parallel & Distributed Processing Symposium (IPDPS 2011)
+.br
+T. Hoefler, T. Schneider and A. Lumsdaine: Optimized Routing for
+Large-Scale InfiniBand Networks, In 17th Annual IEEE Symposium on High
+Performance Interconnects (HOTI 2009)
 
 Modular Routine Engine
 
@@ -970,31 +1408,66 @@ a file compatible with dump_lfts.sh output. This file can be used
 as input for forwarding tables loading by 'file' routing engine.
 Both or one of options -U and -M can be specified together with \'-R file\'.
 
+.SH PER MODULE LOGGING CONFIGURATION
+.PP
+To enabled per module logging, set per_module_logging to TRUE in
+the opensm options file and configure per_module_logging_file there
+appropriately.
+
+The per module logging config file format is a set of lines with module
+name and logging level as follows:
+
+ <module name><separator><logging level>
+
+ <module name> is the file name including .c
+ <separator> is either = , space, or tab
+ <logging level> is the same levels as used in the coarse/overall
+ logging as follows:
+
+ BIT    LOG LEVEL ENABLED
+ ----   -----------------
+ 0x01 - ERROR (error messages)
+ 0x02 - INFO (basic messages, low volume)
+ 0x04 - VERBOSE (interesting stuff, moderate volume)
+ 0x08 - DEBUG (diagnostic, high volume)
+ 0x10 - FUNCS (function entry/exit, very high volume)
+ 0x20 - FRAMES (dumps all SMP and GMP frames)
+ 0x40 - ROUTING (dump FDB routing information)
+ 0x80 - SYS (syslog at LOG_INFO level in addition to OpenSM logging)
+
 .SH FILES
 .TP
-.B @OPENSM_CONFIG_DIR@/@OPENSM_CONFIG_FILE@
+.B /usr/local/etc/opensm/opensm.conf
 default OpenSM config file.
 
 .TP
-.B @OPENSM_CONFIG_DIR@/@NODENAMEMAPFILE@
+.B /usr/local/etc/opensm/ib-node-name-map
 default node name map file.  See ibnetdiscover for more information on format.
 
 .TP
-.B @OPENSM_CONFIG_DIR@/@PARTITION_CONFIG_FILE@
+.B /usr/local/etc/opensm/partitions.conf
 default partition config file
 
 .TP
-.B @OPENSM_CONFIG_DIR@/@QOS_POLICY_FILE@
+.B /usr/local/etc/opensm/qos-policy.conf
 default QOS policy config file
 
 .TP
-.B @OPENSM_CONFIG_DIR@/@PREFIX_ROUTES_FILE@
-default prefix routes file.
+.B /usr/local/etc/opensm/prefix-routes.conf
+default prefix routes file
+
+.TP
+.B /usr/local/etc/opensm/per-module-logging.conf
+default per module logging config file
+
+.TP
+.B /usr/local/etc/opensm/torus-2QoS.conf
+default torus-2QoS config file
 
 .SH AUTHORS
 .TP
 Hal Rosenstock
-.RI < hal.rosenstock at gmail.com >
+.RI < hal at mellanox.com >
 .TP
 Sasha Khapyorsky
 .RI < sashak at voltaire.com >
@@ -1010,3 +1483,9 @@ Thomas Sodring
 .TP
 Ira Weiny
 .RI < weiny2 at llnl.gov >
+.TP
+Dale Purdy
+.RI < purdy at sgi.com >
+
+.SH SEE ALSO
+torus-2QoS(8), torus-2QoS.conf(5).
diff --git a/man/opensm.8.in b/man/opensm.8.in
index 3000eaf..79ff6a5 100644
--- a/man/opensm.8.in
+++ b/man/opensm.8.in
@@ -1,4 +1,4 @@
-.TH OPENSM 8 "June 13, 2008" "OpenIB" "OpenIB Management"
+.TH OPENSM 8 "March 8, 2012" "OpenIB" "OpenIB Management"
 
 .SH NAME
 opensm \- InfiniBand subnet manager and administration (SM/SA)
@@ -12,8 +12,11 @@ opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-l(mc) <LMC>]
 [\-p(riority) <PRIORITY>]
 [\-smkey <SM_Key>]
+[\-\-sm_sl <SL number>]
 [\-r(eassign_lids)]
 [\-R <engine name(s)> | \-\-routing_engine <engine name(s)>]
+[\-\-do_mesh_analysis]
+[\-\-lash_start_vl <vl number>]
 [\-A | \-\-ucast_cache]
 [\-z | \-\-connect_roots]
 [\-M <file name> | \-\-lid_matrix_file <file name>]
@@ -21,20 +24,32 @@ opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-S | \-\-sadb_file <file name>]
 [\-a | \-\-root_guid_file <path to file>]
 [\-u | \-\-cn_guid_file <path to file>]
+[\-G | \-\-io_guid_file <path to file>]
+[\-\-port\-shifting]
+[\-\-scatter\-ports]
+[\-H | \-\-max_reverse_hops <max reverse hops allowed>]
 [\-X | \-\-guid_routing_order_file <path to file>]
 [\-m | \-\-ids_guid_file <path to file>]
 [\-o(nce)]
 [\-s(weep) <interval>]
 [\-t(imeout) <milliseconds>]
+[\-\-retries <number>]
 [\-maxsmps <number>]
 [\-console [off | local | socket | loopback]]
 [\-console-port <port>]
 [\-i(gnore-guids) <equalize-ignore-guids-file>]
+[\-w | \-\-hop_weights_file <path to file>]
+[\-O | \-\-port_search_ordering_file <path to file>]
+[\-O | \-\-dimn_ports_file <path to file>] (DEPRECATED)
 [\-f <log file path> | \-\-log_file <log file path> ]
 [\-L | \-\-log_limit <size in MB>] [\-e(rase_log_file)]
 [\-P(config) <partition config file> ]
-[\-N | \-\-no_part_enforce]
+[\-N | \-\-no_part_enforce] (DEPRECATED)
+[\-Z | \-\-part_enforce [both | in | out | off]]
+[\-W | \-\-allow_both_pkeys]
 [\-Q | \-\-qos [\-Y | \-\-qos_policy_file <file name>]]
+[\-\-congestion\-control]
+[\-\-cckey <key>]
 [\-y | \-\-stay_on_fatal]
 [\-B | \-\-daemon]
 [\-I | \-\-inactive]
@@ -42,6 +57,8 @@ opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-\-perfmgr_sweep_time_s <seconds>]
 [\-\-prefix_routes_file <path>]
 [\-\-consolidate_ipv6_snm_req]
+[\-\-log_prefix <prefix text>]
+[\-\-torus_config <path to file>]
 [\-v(erbose)] [\-V] [\-D <flags>] [\-d(ebug) <number>]
 [\-h(elp)] [\-?]
 
@@ -124,6 +141,10 @@ Note that OpenSM version 3.2.1 and below used the default value '1'
 in a host byte order, it is fixed now but you may need this option to
 interoperate with old OpenSM running on a little endian machine.
 .TP
+\fB\-\-sm_sl\fR <SL number>
+This option sets the SL to use for communication with the SM/SA.
+Defaults to 0.
+.TP
 \fB\-r\fR, \fB\-\-reassign_lids\fR
 This option causes OpenSM to reassign LIDs to all
 end nodes. Specifying -r on a running subnet
@@ -135,8 +156,20 @@ LID assignments resolving multiple use of same LID.
 This option chooses routing engine(s) to use instead of Min Hop
 algorithm (default).  Multiple routing engines can be specified
 separated by commas so that specific ordering of routing algorithms
-will be tried if earlier routing engines fail.
-Supported engines: minhop, updn, file, ftree, lash, dor
+will be tried if earlier routing engines fail.  If all configured
+routing engines fail, OpenSM will always attempt to route with Min Hop
+unless 'no_fallback' is included in the list of routing engines.
+Supported engines: minhop, updn, dnup, file, ftree, lash, dor, torus-2QoS,
+dfsssp, sssp.
+.TP
+\fB\-\-do_mesh_analysis\fR
+This option enables additional analysis for the lash routing engine to
+precondition switch port assignments in regular cartesian meshes which
+may reduce the number of SLs required to give a deadlock free routing.
+.TP
+\fB\-\-lash_start_vl\fR <vl number>
+This option sets the starting VL to use for the lash routing algorithm.
+Defaults to 0.
 .TP
 \fB\-A\fR, \fB\-\-ucast_cache\fR
 This option enables unicast routing cache and prevents routing
@@ -151,9 +184,9 @@ recalculations: one when the host goes down, and the other when
 the host comes back online.
 .TP
 \fB\-z\fR, \fB\-\-connect_roots\fR
-This option enforces a routing engine (currently up/down
-only) to make connectivity between root switches and in
-this way to be fully IBA complaint. In many cases this can
+This option enforces routing engines (up/down and
+fat-tree) to make connectivity between root switches and in
+this way to be fully IBA compliant. In many cases this can
 violate "pure" deadlock free algorithm, so use it carefully.
 .TP
 \fB\-M\fR, \fB\-\-lid_matrix_file\fR <file name>
@@ -177,6 +210,26 @@ algorithm to the guids provided in the given file (one to a line).
 Set the compute nodes for the Fat-Tree routing algorithm
 to the guids provided in the given file (one to a line).
 .TP
+\fB\-G\fR, \fB\-\-io_guid_file\fR <file name>
+Set the I/O nodes for the Fat-Tree routing algorithm
+to the guids provided in the given file (one to a line).
+I/O nodes are non-CN nodes allowed to use up to max_reverse_hops switches
+the wrong way around to improve connectivity.
+.TP
+\fB\-\-port\-shifting\fR
+This option enables a feature called \fBport shifting\fR.  In some
+fabrics, particularly cluster environments, routes commonly align and
+congest with other routes due to algorithmically unchanging traffic
+patterns.  This routing option will "shift" routing around in an
+attempt to alleviate this problem.
+.TP
+\fB\-\-scatter\-ports\fR
+This option will randomize port selecting in routing.
+.TP
+\fB\-H\fR, \fB\-\-max_reverse_hops\fR <max reverse hops allowed>
+Set the maximum number of reverse hops an I/O node is allowed
+to make. A reverse hop is the use of a switch the wrong way around.
+.TP
 \fB\-m\fR, \fB\-\-ids_guid_file\fR <file name>
 Name of the map file with set of the IDs which will be used
 by Up/Down routing algorithm instead of node GUIDs
@@ -200,10 +253,16 @@ Without -s, OpenSM defaults to a sweep interval of
 \fB\-t\fR, \fB\-\-timeout\fR <value>
 This option specifies the time in milliseconds
 used for transaction timeouts.
-Specifying -t 0 disables timeouts.
+Timeout values should be > 0.
 Without -t, OpenSM defaults to a timeout value of
 200 milliseconds.
 .TP
+\fB\-\-retries\fR <number>
+This option specifies the number of retries used
+for transactions.
+Without --retries, OpenSM defaults to 3 retries
+for transactions.
+.TP
 \fB\-maxsmps\fR <number>
 This option specifies the number of VL15 SMP MADs
 allowed on the wire at any one time.
@@ -212,10 +271,13 @@ SMPs.
 Without -maxsmps, OpenSM defaults to a maximum of
 4 outstanding SMPs.
 .TP
-\fB\-console [off | local | socket | loopback]\fR
-This option brings up the OpenSM console (default off).
-Note that the socket and loopback options will only be available
-if OpenSM was built with --enable-console-socket.
+\fB\-console [off | local | loopback | socket]\fR
+This option brings up the OpenSM console (default off).  Note, loopback and
+socket open a socket which can be connected to WITHOUT CREDENTIALS.  Loopback
+is safer if access to your SM host is controlled.  tcp_wrappers
+(hosts.[allow|deny]) is used with loopback and socket.  loopback and socket
+will only be available if OpenSM was built with --enable-console-loopback
+(default yes) and --enable-console-socket (default no) respectively.
 .TP
 \fB\-console-port\fR <port>
 Specify an alternate telnet port for the socket console (default 10000).
@@ -227,6 +289,47 @@ This option provides the means to define a set of ports
 (by node guid and port number) that will be ignored by the link load
 equalization algorithm.
 .TP
+\fB\-w\fR, \fB\-\-hop_weights_file\fR <path to file>
+This option provides weighting factors per port representing a hop cost in
+computing the lid matrix.  The file consists of lines containing a switch port
+GUID (specified as a 64 bit hex number, with leading 0x), output port number,
+and weighting factor.  Any port not listed in the file defaults to a weighting
+factor of 1.  Lines starting with # are comments.  Weights affect only the
+output route from the port, so many useful configurations will require weights
+to be specified in pairs.
+.TP
+\fB\-O\fR, \fB\-\-port_search_ordering_file\fR <path to file>
+This option tweaks the routing. It suitable for two cases:
+1. While using DOR routing algorithm.
+This option provides a mapping between hypercube dimensions and ports
+on a per switch basis for the DOR routing engine.  The file consists
+of lines containing a switch node GUID (specified as a 64 bit hex
+number, with leading 0x) followed by a list of non-zero port numbers,
+separated by spaces, one switch per line.  The order for the port
+numbers is in one to one correspondence to the dimensions.  Ports not
+listed on a line are assigned to the remaining dimensions, in port
+order.  Anything after a # is a comment.
+2. While using general routing algorithm.
+This option provides the order of the ports that would be chosen for routing,
+from each switch rather than searching for an appropriate port from port 1 to N.
+The file consists of lines containing a switch node GUID (specified as a 64 bit
+hex number, with leading 0x) followed by a list of non-zero port numbers,
+separated by spaces, one switch per line.  In case of DOR, the order for the
+port numbers is in one to one correspondence to the dimensions.  Ports not
+listed on a line are assigned to the remaining dimensions, in port
+order.  Anything after a # is a comment.
+.TP
+\fB\-O\fR, \fB\-\-dimn_ports_file\fR <path to file> \fB(DEPRECATED)\fR
+This is a deprecated flag. Please use \fB-port_search_ordering_file\fR instead.
+This option provides a mapping between hypercube dimensions and ports
+on a per switch basis for the DOR routing engine.  The file consists
+of lines containing a switch node GUID (specified as a 64 bit hex
+number, with leading 0x) followed by a list of non-zero port numbers,
+separated by spaces, one switch per line.  The order for the port
+numbers is in one to one correspondence to the dimensions.  Ports not
+listed on a line are assigned to the remaining dimensions, in port
+order.  Anything after a # is a comment.
+.TP
 \fB\-x\fR, \fB\-\-honor_guid2lid\fR
 This option forces OpenSM to honor the guid2lid file,
 when it comes out of Standby state, if such file exists
@@ -264,11 +367,33 @@ This option enables QoS setup. It is disabled by default.
 .TP
 \fB\-Y\fR, \fB\-\-qos_policy_file\fR <file name>
 This option defines the optional QoS policy file. The default
-name is \fB\%@OPENSM_CONFIG_DIR@/@QOS_POLICY_FILE@\fP.
+name is \fB\%@OPENSM_CONFIG_DIR@/@QOS_POLICY_FILE@\fP. See
+QoS_management_in_OpenSM.txt in opensm doc for more information on
+configuring QoS policy via this file.
 .TP
-\fB\-N\fR, \fB\-\-no_part_enforce\fR
+\fB\-\-congestion_control\fR
+(EXPERIMENTAL) This option enables congestion control configuration.
+It is disabled by default.  See config file for congestion control
+configuration options.
+\fB\-\-cc_key\fR <key>
+(EXPERIMENTAL) This option configures the CCkey to use when configuring
+congestion control.  Note that this option does not configure a new
+CCkey into switches and CAs.  Defaults to 0.
+.TP
+\fB\-N\fR, \fB\-\-no_part_enforce\fR \fB(DEPRECATED)\fR
+This is a deprecated flag. Please use \fB\-\-part_enforce\fR instead.
 This option disables partition enforcement on switch external ports.
 .TP
+\fB\-Z\fR, \fB\-\-part_enforce\fR [both | in | out | off]
+This option indicates the partition enforcement type (for switches).
+Enforcement type can be inbound only (in), outbound only (out),
+both or disabled (off). Default is both.
+.TP
+\fB\-W\fR, \fB\-\-allow_both_pkeys\fR
+This option indicates whether both full and limited membership on the
+same partition can be configured in the PKeyTable. Default is not
+to allow both pkeys.
+.TP
 \fB\-y\fR, \fB\-\-stay_on_fatal\fR
 This option will cause SM not to exit on fatal initialization
 issues: if SM discovers duplicated guids or a 12x link with
@@ -286,7 +411,8 @@ this is NOT currently implemented in the performance manager.
 .TP
 \fB\-perfmgr\fR
 Enable the perfmgr.  Only takes effect if --enable-perfmgr was specified at
-configure time.
+configure time.  See performance-manager-HOWTO.txt in opensm doc for
+more information on running perfmgr.
 .TP
 \fB\-perfmgr_sweep_time_s\fR <seconds>
 Specify the sweep time for the performance manager in seconds
@@ -294,8 +420,20 @@ Specify the sweep time for the performance manager in seconds
 effect if --enable-perfmgr was specified at configure time.
 .TP
 .BI --consolidate_ipv6_snm_req
-Consolidate IPv6 Solicited Node Multicast group join requests into one
-multicast group per MGID PKey.
+Use shared MLID for IPv6 Solicited Node Multicast groups per MGID scope
+and P_Key.
+.TP
+\fB\-\-log_prefix\fR <prefix text>
+This option specifies the prefix to the syslog messages from OpenSM.
+A suitable prefix can be used to identify the IB subnet in syslog messages
+when two or more instances of OpenSM run in a single node to manage multiple
+fabrics. For example, in a dual-fabric (or dual-rail) IB cluster, the prefix
+for the first fabric could be "mpi" and the other fabric could be "storage".
+.TP
+\fB\-\-torus_config\fR <path to torus\-2QoS config file>
+This option defines the file name for the extra configuration
+information needed for the torus-2QoS routing engine.   The default
+name is \fB\%@OPENSM_CONFIG_DIR@/@TORUS2QOS_CONF_FILE@\fP
 .TP
 \fB\-v\fR, \fB\-\-verbose\fR
 This option increases the log verbosity level.
@@ -326,7 +464,7 @@ specific log level as follows:
  0x10 - FUNCS (function entry/exit, very high volume)
  0x20 - FRAMES (dumps all SMP and GMP frames)
  0x40 - ROUTING (dump FDB routing information)
- 0x80 - currently unused.
+ 0x80 - SYS (syslog at LOG_INFO level in addition to OpenSM logging)
 
 Without -D, OpenSM defaults to ERROR + INFO (0x3).
 Specifying -D 0 disables all messages.
@@ -363,9 +501,12 @@ opensm.mcfdbs. By default, this directory is /var/log.
 
 OSM_CACHE_DIR - opensm stores certain data to the disk such that subsequent
 runs are consistent. The default directory used is /var/cache/opensm.
-The following file is included in it:
+The following files are included in it:
 
- guid2lid - stores the LID range assigned to each GUID
+ guid2lid  - stores the LID range assigned to each GUID
+ guid2mkey - stores the MKey previously assiged to each GUID
+ neighbors - stores a map of the GUIDs at either end of each link
+             in the fabric
 
 .SH NOTES
 .PP
@@ -377,68 +518,122 @@ logrotate purposes.
 .SH PARTITION CONFIGURATION
 .PP
 The default name of OpenSM partitions configuration file is
-\fB\%@OPENSM_CONFIG_DIR@/@PARTITION_CONFIG_FILE@\fP. The default may be changed by using
---Pconfig (-P) option with OpenSM.
+\fB\%@OPENSM_CONFIG_DIR@/@PARTITION_CONFIG_FILE@\fP. The default may be changed
+by using the --Pconfig (-P) option with OpenSM.
 
 The default partition will be created by OpenSM unconditionally even
 when partition configuration file does not exist or cannot be accessed.
 
-The default partition has P_Key value 0x7fff. OpenSM\'s port will have
-full membership in default partition. All other end ports will have
-partial membership.
+The default partition has P_Key value 0x7fff. OpenSM\'s port will always
+have full membership in default partition. All other end ports will have
+full membership if the partition configuration file is not found or cannot
+be accessed, or limited membership if the file exists and can be accessed
+but there is no rule for the Default partition.
 
-File Format
+Effectively, this amounts to the same as if one of the following rules
+below appear in the partition configuration file.
 
-Comments:
+In the case of no rule for the Default partition:
 
-Line content followed after \'#\' character is comment and ignored by
-parser.
-
-General file format:
+Default=0x7fff : ALL=limited, SELF=full ;
 
-<Partition Definition>:<PortGUIDs list> ;
+In the case of no partition configuration file or file cannot be accessed:
 
-Partition Definition:
+Default=0x7fff : ALL=full ;
 
-[PartitionName][=PKey][,flag[=value]][,defmember=full|limited]
 
- PartitionName - string, will be used with logging. When omitted
-                 empty string will be used.
- PKey          - P_Key value for this partition. Only low 15 bits will
-                 be used. When omitted will be autogenerated.
- flag          - used to indicate IPoIB capability of this partition.
- defmember=full|limited - specifies default membership for port guid
-                 list. Default is limited.
-
-Currently recognized flags are:
-
- ipoib       - indicates that this partition may be used for IPoIB, as
-               result IPoIB capable MC group will be created.
- rate=<val>  - specifies rate for this IPoIB MC group
-               (default is 3 (10GBps))
- mtu=<val>   - specifies MTU for this IPoIB MC group
-               (default is 4 (2048))
- sl=<val>    - specifies SL for this IPoIB MC group
-               (default is 0)
- scope=<val> - specifies scope for this IPoIB MC group
-               (default is 2 (link local)).  Multiple scope settings
-               are permitted for a partition.
+File Format
 
-Note that values for rate, mtu, and scope should be specified as
-defined in the IBTA specification (for example, mtu=4 for 2048).
+Comments:
 
-PortGUIDs list:
+Line content followed after \'#\' character is comment and ignored by
+parser.
 
- PortGUID         - GUID of partition member EndPort. Hexadecimal
-                    numbers should start from 0x, decimal numbers
-                    are accepted too.
- full or limited  - indicates full or limited membership for this
-                    port.  When omitted (or unrecognized) limited
-                    membership is assumed.
+General file format:
 
-There are two useful keywords for PortGUID definition:
+<Partition Definition>:[<newline>]<Partition Properties>;
+
+     Partition Definition:
+       [PartitionName][=PKey][,ipoib_bc_flags][,defmember=full|limited]
+
+        PartitionName  - string, will be used with logging. When omitted
+                         empty string will be used.
+        PKey           - P_Key value for this partition. Only low 15 bits will
+                         be used. When omitted will be autogenerated.
+        ipoib_bc_flags - used to indicate/specify IPoIB capability of this partition.
+
+        defmember=full|limited|both - specifies default membership for port guid
+                         list. Default is limited.
+
+     ipoib_bc_flags:
+        ipoib_flag|[mgroup_flag]*
+
+        ipoib_flag - indicates that this partition may be used for IPoIB, as
+                     a result the IPoIB broadcast group will be created with
+                     the flags given, if any.
+
+     Partition Properties:
+       [<Port list>|<MCast Group>]* | <Port list>
+
+     Port list:
+        <Port Specifier>[,<Port Specifier>]
+
+     Port Specifier:
+        <PortGUID>[=[full|limited|both]]
+
+        PortGUID         - GUID of partition member EndPort. Hexadecimal
+                           numbers should start from 0x, decimal numbers
+                           are accepted too.
+
+        full, limited,   - indicates full and/or limited membership for this
+        both               port.  When omitted (or unrecognized) limited
+                           membership is assumed. Both indicates both full
+                           and limited membership for this port.
+
+     MCast Group:
+        mgid=gid[,mgroup_flag]*<newline>
+
+                         - gid specified is verified to be a Multicast address
+                           IP groups are verified to match the rate and mtu of the
+                           broadcast group.  The P_Key bits of the mgid for IP
+                           groups are verified to either match the P_Key specified
+                           in by "Partition Definition" or if they are 0x0000 the
+                           P_Key will be copied into those bits.
+
+     mgroup_flag:
+        rate=<val>  - specifies rate for this MC group
+                      (default is 3 (10GBps))
+        mtu=<val>   - specifies MTU for this MC group
+                      (default is 4 (2048))
+        sl=<val>    - specifies SL for this MC group
+                      (default is 0)
+        scope=<val> - specifies scope for this MC group
+                      (default is 2 (link local)).  Multiple scope settings
+                      are permitted for a partition.
+                      NOTE: This overwrites the scope nibble of the specified
+                            mgid.  Furthermore specifying multiple scope
+                            settings will result in multiple MC groups
+                            being created.
+        qkey=<val>      - specifies the Q_Key for this MC group
+                          (default: 0x0b1b for IP groups, 0 for other groups)
+        tclass=<val>    - specifies tclass for this MC group
+                          (default is 0)
+        FlowLabel=<val> - specifies FlowLabel for this MC group
+                          (default is 0)
+
+     newline: '\n'
+
+
+Note that values for rate, mtu, and scope, for both partitions and multicast
+groups, should be specified as defined in the IBTA specification (for example,
+mtu=4 for 2048).
+
+There are several useful keywords for PortGUID definition:
 
  - 'ALL' means all end ports in this subnet.
+ - 'ALL_CAS' means all Channel Adapter end ports in this subnet.
+ - 'ALL_SWITCHES' means all Switch end ports in this subnet.
+ - 'ALL_ROUTERS' means all Router end ports in this subnet.
  - 'SELF' means subnet manager's port.
 
 Empty list means no ports in this partition.
@@ -447,9 +642,6 @@ Notes:
 
 White space is permitted between delimiters ('=', ',',':',';').
 
-The line can be wrapped after ':' followed after Partition Definition and
-between.
-
 PartitionName does not need to be unique, PKey does need to be unique.
 If PKey is repeated then those partition configurations will be merged
 and first PartitionName will be used (see also next note).
@@ -461,6 +653,7 @@ different PKey values will be generated for those definitions).
 Examples:
 
  Default=0x7fff : ALL, SELF=full ;
+ Default=0x7fff : ALL, ALL_SWITCHES=full, SELF=full ;
 
  NewPartition , ipoib : 0x123456=full, 0x3456789034=limi, 0x2134af2306 ;
 
@@ -475,6 +668,15 @@ Examples:
  ShareIO = 0x80 , defmember=full : 0x123459, 0x12345a;
  ShareIO = 0x80 , defmember=full : 0x12345b, 0x12345c=limited, 0x12345d;
 
+ # multicast groups added to default
+ Default=0x7fff,ipoib:
+        mgid=ff12:401b::0707,sl=1 # random IPv4 group
+        mgid=ff12:601b::16    # MLDv2-capable routers
+        mgid=ff12:401b::16    # IGMP
+        mgid=ff12:601b::2     # All routers
+        mgid=ff12::1,sl=1,Q_Key=0xDEADBEEF,rate=3,mtu=2 # random group
+        ALL=full;
+
 
 Note:
 
@@ -559,12 +761,89 @@ opensm will return the path to the first available matching router.
 A configuration file with a single line where both prefix and GUID
 are wild-carded means that a path record query specifying any
 off-subnet DGID should return a path to the first available router.
-This configuration yields the same behaviour formerly achieved by
-compiling opensm with -DROUTER_EXP.
+This configuration yields the same behavior formerly achieved by
+compiling opensm with -DROUTER_EXP which has been obsoleted.
+
+.SH MKEY CONFIGURATION
+.PP
+OpenSM supports configuring a single management key (MKey) for use across
+the subnet.
+
+The following configuration options are available:
+
+ m_key                  - the 64-bit MKey to be used on the subnet
+                          (IBA 14.2.4)
+ m_key_protection_level - the numeric value of the MKey ProtectBits
+                          (IBA 14.2.4.1)
+ m_key_lease_period     - the number of seconds a CA will wait for a
+                          response from the SM before resetting the
+                          protection level to 0 (IBA 14.2.4.2).
+
+OpenSM will configure all ports with the MKey specified by m_key, defaulting
+to a value of 0. A m_key value of 0 disables MKey protection on the subnet.
+Switches and HCAs with a non-zero MKey will not accept requests to change
+their configuration unless the request includes the proper MKey.
+
+MKey Protection Levels
+
+MKey protection levels modify how switches and CAs respond to SMPs lacking
+a valid MKey.
+OpenSM will configure each port's ProtectBits to support the level defined by
+the m_key_protection_level parameter.  If no parameter is specified, OpenSM
+defaults to operating at protection level 0.
+
+There are currently 4 protection levels defined by the IBA:
+
+ 0 - Queries return valid data, including MKey.  Configuration changes
+     are not allowed unless the request contains a valid MKey.
+ 1 - Like level 0, but the MKey is set to 0 (0x00000000) in queries,
+     unless the request contains a valid MKey.
+ 2 - Neither queries nor configuration changes are allowed, unless the
+     request contains a valid MKey.
+ 3 - Identical to 2.  Maintained for backwards compatibility.
+
+MKey Lease Period
+
+InfiniBand supports a MKey lease timeout, which is intended to allow
+administrators or a new SM to recover/reset lost MKeys on a fabric.
+
+If MKeys are enabled on the subnet and a switch or CA receives a request that
+requires a valid MKey but does not contain one, it warns the SM by sending a trap
+(Bad M_Key, Trap 256).  If the MKey lease period is non-zero, it also starts a
+countdown timer for the time specified by the lease period.
+If a SM (or other agent) responds with the correct MKey, the timer is stopped
+and reset.  Should the timer reach zero, the switch or CA will reset its MKey
+protection level to 0, exposing the MKey and allowing recovery.
+
+OpenSM will initialize all ports to use a mkey lease period of the number of
+seconds specified in the config file.  If no mkey_lease_period is specified,
+a default of 0 will be used.
+
+OpenSM normally quickly responds to all Bad_M_Key traps, resetting the lease
+timers.  Additionally, OpenSM's subnet sweeps will also cancel
+any running timers.  For maximum protection against accidentally-exposed MKeys,
+the MKey lease time should be a few multiples of the subnet sweep time.
+If OpenSM detects at startup that your sweep interval is greater than your
+MKey lease period, it will reset the lease period to be greater than the
+sweep interval.  Similarly, if sweeping is disabled at startup, it will be
+re-enabled with an interval less than the Mkey lease period.
+
+If OpenSM is required to recover a subnet for which it is missing mkeys,
+it must do so one switch level at a time.  As such, the total time to
+recover the subnet may be as long as the mkey lease period multiplied by
+the maximum number of hops between the SM and an endpoint, plus one.
+
+MKey Effects on Diagnostic Utilities
+
+Setting a MKey may have a detrimental effect on diagnostic software run on
+the subnet, unless your diagnostic software is able to retrieve MKeys from the
+SA or can be explicitly configured with the proper MKey.  This is particularly
+true at protection level 2, where CAs will ignore queries for management
+information that do not contain the proper MKey.
 
 .SH ROUTING
 .PP
-OpenSM now offers five routing engines:
+OpenSM now offers nine routing engines:
 
 1.  Min Hop Algorithm - based on the minimum hops to each node where the
 path length is optimized.
@@ -574,25 +853,46 @@ node, but it is constrained to ranking rules. This algorithm should be chosen
 if the subnet is not a pure Fat Tree, and deadlock may occur due to a
 loop in the subnet.
 
-3.  Fat Tree Unicast routing algorithm - this algorithm optimizes routing
+3. DNUP Unicast routing algorithm - similar to UPDN but allows routing in
+fabrics which have some CA nodes attached closer to the roots than some switch
+nodes.
+
+4.  Fat Tree Unicast routing algorithm - this algorithm optimizes routing
 for congestion-free "shift" communication pattern.
 It should be chosen if a subnet is a symmetrical or almost symmetrical
 fat-tree of various types, not just K-ary-N-Trees: non-constant K, not
 fully staffed, any Constant Bisectional Bandwidth (CBB) ratio.
 Similar to UPDN, Fat Tree routing is constrained to ranking rules.
 
-4. LASH unicast routing algorithm - uses Infiniband virtual layers
+5. LASH unicast routing algorithm - uses Infiniband virtual layers
 (SL) to provide deadlock-free shortest-path routing while also
 distributing the paths between layers. LASH is an alternative
 deadlock-free topology-agnostic routing algorithm to the non-minimal
 UPDN algorithm avoiding the use of a potentially congested root node.
 
-5. DOR Unicast routing algorithm - based on the Min Hop algorithm, but
+6. DOR Unicast routing algorithm - based on the Min Hop algorithm, but
 avoids port equalization except for redundant links between the same
 two switches.  This provides deadlock free routes for hypercubes when
 the fabric is cabled as a hypercube and for meshes when cabled as a
 mesh (see details below).
 
+7. Torus-2QoS unicast routing algorithm - a DOR-based routing algorithm
+specialized for 2D/3D torus topologies.  Torus-2QoS provides deadlock-free
+routing while supporting two quality of service (QoS) levels.  In addition
+it is able to route around multiple failed fabric links or a single failed
+fabric switch without introducing deadlocks, and without changing path SL
+values granted before the failure.
+
+8. DFSSSP unicast routing algorithm - a deadlock-free
+single-source-shortest-path routing, which uses the SSSP algorithm
+(see algorithm 9.) as the base to optimize link utilization and uses
+Infiniband virtual lanes (SL) to provide deadlock-freedom.
+
+9. SSSP unicast routing algorithm - a single-source-shortest-path routing
+algorithm, which globally balances the number of routes per link to
+optimize link utilization. This routing algorithm has no restrictions
+in terms of the underlying topology.
+
 OpenSM also supports a file method which
 can load routes from a table. See \'Modular Routing Engine\' for more
 information on this.
@@ -614,7 +914,7 @@ decision is made as to what port should be used to get to that LID.
    This step is common to standard and Up/Down routing. Each port has a
 counter counting the number of target LIDs going through it.
    When there are multiple alternative ports with same MinHop to a LID,
-the one with less previously assigned ports is selected.
+the one with less previously assigned LIDs is selected.
    If LMC > 0, more checks are added: Within each group of LIDs assigned to
 same target port,
    a. use only ports which have same MinHop
@@ -736,6 +1036,18 @@ format will be discarded.
 possible to specify CA guids; OpenSM will use the guid of the switch (if
 it exists) that connects the CA to the subnet as a root node.
 
+Purpose of DNUP Algorithm
+
+The DNUP algorithm is designed to serve a similar purpose to UPDN. However
+it is intended to work in network topologies which are unsuited to
+UPDN due to nodes being connected closer to the roots than some of
+the switches.  An example would be a fabric which contains nodes and
+uplinks connected to the same switch. The operation of DNUP is the
+same as UPDN with the exception of the ranking process.  In DNUP all
+switch nodes are ranked based solely on their distance from CA Nodes,
+all switch nodes directly connected to at least one CA are assigned a
+value of 1 all other switch nodes are assigned a value of one more than
+the minimum rank of all neighbor switch nodes.
 
 Fat-tree Routing Algorithm
 
@@ -790,6 +1102,21 @@ in the same directory where the OpenSM log resides. This ordering file provides
 the CN order that may be used to create efficient communication pattern, that
 will match the routing tables.
 
+Routing between non-CN nodes
+
+The use of the cn_guid_file option allows non-CN nodes to be located on different levels in the fat tree.
+In such case, it is not guaranteed that the Fat Tree algorithm will route between two non-CN nodes.
+To solve this problem, a list of non-CN nodes can be specified by \'-G\' or \'--io_guid_file\' option.
+Theses nodes will be allowed to use switches the wrong way round a specific number of times (specified by \'-H\' or \'--max_reverse_hops\'.
+With the proper max_reverse_hops and io_guid_file values, you can ensure full connectivity in the Fat Tree.
+
+Please note that using max_reverse_hops creates routes that use the switch in a counter-stream way.
+This option should never be used to connect nodes with high bandwidth traffic between them ! It should only be used
+to allow connectivity for HA purposes or similar.
+Also having routes the other way around can in theory cause credit loops.
+
+Use these options with extreme care !
+
 Activation through OpenSM
 
 Use '-R ftree' option to activate the fat-tree algorithm.
@@ -860,6 +1187,18 @@ used.
 Note: LMC > 0 is not supported by the LASH routing. If this is
 specified, the default routing algorithm is invoked instead.
 
+For open regular cartesian meshes the DOR algorithm is the ideal
+routing algorithm. For toroidal meshes on the other hand there
+are routing loops that can cause deadlocks. LASH can be used to
+route these cases. The performance of LASH can be improved by
+preconditioning the mesh in cases where there are multiple links
+connecting switches and also in cases where the switches are not
+cabled consistently. An option exists for LASH to do this. To
+invoke this use '-R lash -Q --do_mesh_analysis'. This will
+add an additional phase that analyses the mesh to try to determine
+the dimension and size of a mesh. If it determines that the mesh
+looks like an open or closed cartesian mesh it reorders the ports
+in dimension order before the rest of the LASH algorithm runs.
 
 DOR Routing Algorithm
 
@@ -868,20 +1207,109 @@ algorithm and so uses shortest paths.  Instead of spreading traffic
 out across different paths with the same shortest distance, it chooses
 among the available shortest paths based on an ordering of dimensions.
 Each port must be consistently cabled to represent a hypercube
-dimension or a mesh dimension.  Paths are grown from a destination
-back to a source using the lowest dimension (port) of available paths
-at each step.  This provides the ordering necessary to avoid deadlock.
+dimension or a mesh dimension.  Alternatively, the -O option can be
+used to assign a custom mapping between the ports on a given switch,
+and the associated dimension.  Paths are grown from a destination back
+to a source using the lowest dimension (port) of available paths at
+each step.  This provides the ordering necessary to avoid deadlock.
 When there are multiple links between any two switches, they still
 represent only one dimension and traffic is balanced across them
 unless port equalization is turned off.  In the case of hypercubes,
 the same port must be used throughout the fabric to represent the
-hypercube dimension and match on both ends of the cable.  In the case
-of meshes, the dimension should consistently use the same pair of
-ports, one port on one end of the cable, and the other port on the
-other end, continuing along the mesh dimension.
+hypercube dimension and match on both ends of the cable, or the -O
+option used to accomplish the alignment.  In the case of meshes, the
+dimension should consistently use the same pair of ports, one port on
+one end of the cable, and the other port on the other end, continuing
+along the mesh dimension, or the -O option used as an override.
 
 Use '-R dor' option to activate the DOR algorithm.
 
+DFSSSP and SSSP Routing Algorithm
+
+The (Deadlock-Free) Single-Source-Shortest-Path routing algorithm is
+designed to optimize link utilization thru global balancing of routes,
+while supporting arbitrary topologies. The DFSSSP routing algorithm
+uses Infiniband virtual lanes (SL) to provide deadlock-freedom.
+
+The DFSSSP algorithm consists of five major steps:
+.br
+1) It discovers the subnet and models the subnet as a directed
+multigraph in which each node represents a node of the physical
+network and each edge represents one direction of the full-duplex
+links used to connect the nodes.
+.br
+2) A loop, which iterates over all CA and switches of the subnet, will
+perform three steps to generate the linear forwarding tables for
+each switch:
+.br
+2.1) use Dijkstra's algorithm to find the shortest path from all
+nodes to the current selected destination;
+.br
+2.2) update the egde weights in the graph, i.e. add the number of
+routes, which use a link to reach the destination,
+to the link/edge;
+.br
+2.3) update the LFT of each switch with the outgoing port which was
+used in the current step to route the traffic to the
+destination node.
+.br
+3) After the number of available virtual lanes or layers in the subnet
+is detected and a channel dependency graph is initialized for each
+layer, the algorithm will put each possible route of the subnet into
+the first layer.
+.br
+4) A loop iterates over all channel dependency graphs (CDG) and performs
+the following substeps:
+.br
+4.1) search for a cycle in the current CDG;
+.br
+4.2) when a cycle is found, i.e. a possible deadlock is present,
+one edge is selected and all routes, which induced this egde,
+are moved to the "next higher" virtual layer (CDG[i+1]);
+.br
+4.3) the cycle search is continued until all cycles are broken and
+routes are moved "up".
+.br
+5) When the number of needed layers does not exceeds the number of
+available SL/VL to remove all cycles in all CDGs, the rounting is
+deadlock-free and an relation table is generated, which contains
+the assignment of routes from source to destination to a SL
+
+Note on SSSP:
+.br
+This algorithm does not perform the steps 3)-5) and can not be
+considered to be deadlock-free for all topologies. But on the one
+hand, you can choose this algorithm for really large networks
+(5,000+ CAs and deadlock-free by design) to reduce
+the runtime of the algorithm. On the other hand, you might use
+the SSSP routing algorithm as an alternative, when all deadlock-free
+routing algorithms fail to route the network for whatever reason.
+In the last case, SSSP was designed to deliver an equal or higher
+bandwidth due to better congestion avoidance than the Min Hop
+routing algorithm.
+
+Notes for usage:
+.br
+a) running DFSSSP: '-R dfsssp -Q'
+.br
+a.1) QoS has to be configured to equally spread the load on the
+available SL or virtual lanes
+.br
+a.2) applications must perform a path record query to get path SL for
+each route, which the application will use to transmite packages
+.br
+b) running SSSP:   '-R sssp'
+.br
+c) both algorithms support LMC > 0
+
+Torus-2QoS Routing Algorithm
+
+Torus-2QoS is routing algorithm designed for large-scale 2D/3D torus fabrics;
+see torus-2QoS(8) for full documentation.
+
+Use '-R torus-2QoS -Q' or '-R torus-2QoS,no_fallback -Q'
+to activate the torus-2QoS algorithm.
+
 
 Routing References
 
@@ -909,6 +1337,16 @@ Communications Magazine, Vol.44, No.7, July 2006.
 Networks", Skeie et al. IEEE Computer Society Communication
 Architecture for Clusters 2002.
 
+To learn more about the DFSSSP and SSSP routing algorithm,
+see the articles:
+.br
+J. Domke, T. Hoefler and W. Nagel: Deadlock-Free Oblivious Routing
+for Arbitrary Topologies, In Proceedings of the 25th IEEE International
+Parallel & Distributed Processing Symposium (IPDPS 2011)
+.br
+T. Hoefler, T. Schneider and A. Lumsdaine: Optimized Routing for
+Large-Scale InfiniBand Networks, In 17th Annual IEEE Symposium on High
+Performance Interconnects (HOTI 2009)
 
 Modular Routine Engine
 
@@ -970,6 +1408,33 @@ a file compatible with dump_lfts.sh output. This file can be used
 as input for forwarding tables loading by 'file' routing engine.
 Both or one of options -U and -M can be specified together with \'-R file\'.
 
+.SH PER MODULE LOGGING CONFIGURATION
+.PP
+To enabled per module logging, set per_module_logging to TRUE in
+the opensm options file and configure per_module_logging_file there
+appropriately.
+
+The per module logging config file format is a set of lines with module
+name and logging level as follows:
+
+ <module name><separator><logging level>
+
+ <module name> is the file name including .c
+ <separator> is either = , space, or tab
+ <logging level> is the same levels as used in the coarse/overall
+ logging as follows:
+
+ BIT    LOG LEVEL ENABLED
+ ----   -----------------
+ 0x01 - ERROR (error messages)
+ 0x02 - INFO (basic messages, low volume)
+ 0x04 - VERBOSE (interesting stuff, moderate volume)
+ 0x08 - DEBUG (diagnostic, high volume)
+ 0x10 - FUNCS (function entry/exit, very high volume)
+ 0x20 - FRAMES (dumps all SMP and GMP frames)
+ 0x40 - ROUTING (dump FDB routing information)
+ 0x80 - SYS (syslog at LOG_INFO level in addition to OpenSM logging)
+
 .SH FILES
 .TP
 .B @OPENSM_CONFIG_DIR@/@OPENSM_CONFIG_FILE@
@@ -989,12 +1454,20 @@ default QOS policy config file
 
 .TP
 .B @OPENSM_CONFIG_DIR@/@PREFIX_ROUTES_FILE@
-default prefix routes file.
+default prefix routes file
+
+.TP
+.B @OPENSM_CONFIG_DIR@/@PER_MOD_LOGGING_FILE@
+default per module logging config file
+
+.TP
+.B @OPENSM_CONFIG_DIR@/@TORUS2QOS_CONF_FILE@
+default torus-2QoS config file
 
 .SH AUTHORS
 .TP
 Hal Rosenstock
-.RI < hal.rosenstock at gmail.com >
+.RI < hal at mellanox.com >
 .TP
 Sasha Khapyorsky
 .RI < sashak at voltaire.com >
@@ -1010,3 +1483,9 @@ Thomas Sodring
 .TP
 Ira Weiny
 .RI < weiny2 at llnl.gov >
+.TP
+Dale Purdy
+.RI < purdy at sgi.com >
+
+.SH SEE ALSO
+torus-2QoS(8), torus-2QoS.conf(5).
diff --git a/man/osmtest.8 b/man/osmtest.8
index c814b49..d47a501 100644
--- a/man/osmtest.8
+++ b/man/osmtest.8
@@ -1,4 +1,4 @@
-.TH OSMTEST 8 "August 11, 2008" "OpenIB" "OpenIB Management"
+.TH OSMTEST 8 "August 31, 2009" "OpenIB" "OpenIB Management"
 
 .SH NAME
 osmtest \- InfiniBand subnet manager and administration (SM/SA) test program
@@ -108,9 +108,10 @@ Stress test options are as follows:
 
  OPT    Description
  ---    -----------------
- -s1  - Single-MAD response SA queries
+ -s1  - Single-MAD (RMPP) response SA queries
  -s2  - Multi-MAD (RMPP) response SA queries
  -s3  - Multi-MAD (RMPP) Path Record SA queries
+ -s4  - Single-MAD (non RMPP) get Path Record SA queries
 
 Without -s, stress testing is not performed
 .TP
@@ -184,7 +185,7 @@ Display this usage info then exit.
 .SH AUTHORS
 .TP
 Hal Rosenstock
-.RI < hal at xsigo.com >
+.RI < hal.rosenstock at gmail.com >
 .TP
 Eitan Zahavi
 .RI < eitan at mellanox.co.il >
diff --git a/man/torus-2QoS.8 b/man/torus-2QoS.8
new file mode 100644
index 0000000..943613b
--- /dev/null
+++ b/man/torus-2QoS.8
@@ -0,0 +1,476 @@
+.TH TORUS\-2QOS 8 "November 10, 2010" "OpenIB" "OpenIB Management"
+.
+.SH NAME
+torus\-2QoS \- Routing engine for OpenSM subnet manager
+.
+.SH DESCRIPTION
+.
+Torus-2QoS is routing algorithm designed for large-scale 2D/3D torus fabrics.
+The torus-2QoS routing engine can provide the following functionality on
+a 2D/3D torus:
+.br
+\" roff illiteracy leads to following brain-dead list implementation
+\"
+.na  \" otherwise line space adjustment can add spaces between dash and text
+.in +2m
+\[en]
+'in +2m
+Routing that is free of credit loops.
+.in
+\[en]
+'in +2m
+Two levels of Quality of Service (QoS), assuming switches and channel
+adapters support eight data VLs.
+.in
+\[en]
+'in +2m
+The ability to route around a single failed switch, and/or multiple failed
+links, without
+.in
+.in +2m
+\[en]
+'in +2
+introducing credit loops, or
+.in
+\[en]
+'in +2m
+changing path SL values.
+.in -4m
+\[en]
+'in +2m
+Very short run times, with good scaling properties as fabric size increases.
+.ad
+.
+.SH UNICAST ROUTING
+.
+Unicast routing in torus-2QoS is based on Dimension Order Routing (DOR).
+It avoids the deadlocks that would otherwise occur in a DOR-routed
+torus using the concept of a dateline for each torus dimension.
+It encodes into a path SL which datelines the path crosses, as follows:
+\f(CR
+.P
+.nf
+    sl = 0;
+    for (d = 0; d < torus_dimensions; d++) {
+	/* path_crosses_dateline(d) returns 0 or 1 */
+	sl |= path_crosses_dateline(d) << d;
+    }
+.fi
+\fR
+.P
+On a 3D torus this consumes three SL bits, leaving one SL bit unused.
+Torus-2QoS uses this SL bit to implement two QoS levels.
+.P
+Torus-2QoS also makes use of the output port
+dependence of switch SL2VL maps to encode into one VL bit the
+information encoded in three SL bits.
+It computes in which torus coordinate direction each inter-switch link
+"points", and writes SL2VL maps for such ports as follows:
+\f(CR
+.P
+.nf
+    for (sl = 0; sl < 16; sl++) {
+	/* cdir(port) computes which torus coordinate direction
+	 * a switch port "points" in; returns 0, 1, or 2
+	 */
+	sl2vl(iport,oport,sl) = 0x1 & (sl >> cdir(oport));
+    }
+.fi
+\fR
+.P
+Thus, on a pristine 3D torus,
+\fIi.e.\fR,
+in the absence of failed fabric switches,
+torus-2QoS consumes eight SL values (SL bits 0-2) and
+two VL values (VL bit 0) per QoS level to provide deadlock-free routing.
+.P
+Torus-2QoS routes around link failure by "taking the long way around" any
+1D ring interrupted by link failure.  For example, consider the 2D 6x5
+torus below, where switches are denoted by [+a-zA-Z]:
+.
+.
+\# define macros to start and end ascii art, assuming Roman font.
+\# the start macro takes an argument which is the width in ems of
+\# the ascii art, and is used to center it.
+\#
+.de ascii_art
+.nop \f(CR
+.nr indent_in_ems ((((\\n[.ll] - \\n[.i]) / \\w'm') - \\$1)/2)
+.in +\\n[indent_in_ems]m
+.nf
+..
+.de end_ascii_art
+.fi
+.in
+.nop \fR
+..
+\# end of macro definitions
+.
+.
+.ascii_art 36
+       |    |    |    |    |    |
+  4  --+----+----+----+----+----+--
+       |    |    |    |    |    |
+  3  --+----+----+----D----+----+--
+       |    |    |    |    |    |
+  2  --+----+----I----r----+----+--
+       |    |    |    |    |    |
+  1  --m----S----n----T----o----p--
+       |    |    |    |    |    |
+y=0  --+----+----+----+----+----+--
+       |    |    |    |    |    |
+
+     x=0    1    2    3    4    5
+.end_ascii_art
+.P
+For a pristine fabric the path from S to D would be S-n-T-r-D.
+In the event that either link S-n or n-T has failed, torus-2QoS would
+use the path S-m-p-o-T-r-D.
+Note that it can do this without changing the path SL
+value; once the 1D ring m-S-n-T-o-p-m has been broken by failure, path
+segments using it cannot contribute to deadlock, and the x-direction
+dateline (between, say, x=5 and x=0) can be ignored for path segments on
+that ring.
+.P
+One result of this is that torus-2QoS can route around many simultaneous
+link failures, as long as no 1D ring is broken into disjoint segments.
+For example, if links n-T and T-o have both failed, that ring has been broken
+into two disjoint segments, T and o-p-m-S-n.
+Torus-2QoS checks for such
+issues, reports if they are found, and refuses to route such fabrics.
+.P
+Note that in the case where there are multiple parallel links between a
+pair of switches, torus-2QoS will allocate routes across such links
+in a round-robin fashion, based on ports at the path destination switch that
+are active and not used for inter-switch links.
+Should a link that is one of several such parallel links fail, routes
+are redistributed across the remaining links.
+When the last of such a set of parallel links fails, traffic is rerouted
+as described above.
+.P
+Handling a failed switch under DOR requires introducing into a path at
+least one turn that would be otherwise "illegal",
+\fIi.e.\fR,
+not allowed by DOR rules.
+Torus-2QoS will introduce such a turn as close as possible to the
+failed switch in order to route around it.
+.P
+In the above example, suppose switch T has failed, and consider the path
+from S to D.
+Torus-2QoS will produce the path S-n-I-r-D, rather than the
+S-n-T-r-D path for a pristine torus, by introducing an early turn at n.
+Normal DOR rules will cause traffic arriving at switch I to be forwarded
+to switch r; for traffic arriving from I due to the "early" turn at n,
+this will generate an "illegal" turn at I.
+.P
+Torus-2QoS will also use the input port dependence of SL2VL maps to set VL
+bit 1 (which would be otherwise unused) for y-x, z-x, and z-y turns,
+\fIi.e.\fR,
+those turns that are illegal under DOR.
+This causes the first hop after any such turn to use a separate set of
+VL values, and prevents deadlock in the presence of a single failed switch.
+.P
+For any given path, only the hops after a turn that is illegal under DOR
+can contribute to a credit loop that leads to deadlock.  So in the example
+above with failed switch T, the location of the illegal turn at I in the
+path from S to D requires that any credit loop caused by that turn must
+encircle the failed switch at T.  Thus the second and later hops after the
+illegal turn at I (\fIi.e.\fR, hop r-D) cannot contribute to a credit loop
+because they cannot be used to construct a loop encircling T.  The hop I-r
+uses a separate VL, so it cannot contribute to a credit loop encircling T.
+.P
+Extending this argument shows that in addition to being capable of routing
+around a single switch failure without introducing deadlock, torus-2QoS can
+also route around multiple failed switches on the condition they are
+adjacent in the last dimension routed by DOR.  For example, consider the
+following case on a 6x6 2D torus:
+.
+.ascii_art 36
+       |    |    |    |    |    |
+  5  --+----+----+----+----+----+--
+       |    |    |    |    |    |
+  4  --+----+----+----D----+----+--
+       |    |    |    |    |    |
+  3  --+----+----I----u----+----+--
+       |    |    |    |    |    |
+  2  --+----+----q----R----+----+--
+       |    |    |    |    |    |
+  1  --m----S----n----T----o----p--
+       |    |    |    |    |    |
+y=0  --+----+----+----+----+----+--
+       |    |    |    |    |    |
+
+     x=0    1    2    3    4    5
+.end_ascii_art
+.P
+Suppose switches T and R have failed, and consider the path from S to D.
+Torus-2QoS will generate the path S-n-q-I-u-D, with an illegal turn at
+switch I, and with hop I-u using a VL with bit 1 set.
+.P
+As a further example, consider a case that torus-2QoS cannot route without
+deadlock: two failed switches adjacent in a dimension that is not the last
+dimension routed by DOR; here the failed switches are O and T:
+.
+.ascii_art 36
+       |    |    |    |    |    |
+  5  --+----+----+----+----+----+--
+       |    |    |    |    |    |
+  4  --+----+----+----+----+----+--
+       |    |    |    |    |    |
+  3  --+----+----+----+----D----+--
+       |    |    |    |    |    |
+  2  --+----+----I----q----r----+--
+       |    |    |    |    |    |
+  1  --m----S----n----O----T----p--
+       |    |    |    |    |    |
+y=0  --+----+----+----+----+----+--
+       |    |    |    |    |    |
+
+     x=0    1    2    3    4    5
+.end_ascii_art
+.P
+In a pristine fabric, torus-2QoS would generate the path from S to D as
+S-n-O-T-r-D.  With failed switches O and T, torus-2QoS will generate the
+path S-n-I-q-r-D, with illegal turn at switch I, and with hop I-q using a
+VL with bit 1 set.  In contrast to the earlier examples, the second hop
+after the illegal turn, q-r, can be used to construct a credit loop
+encircling the failed switches.
+.
+.SH MULTICAST ROUTING
+.
+Since torus-2QoS uses all four available SL bits, and the three data VL
+bits that are typically available in current switches, there is no way
+to use SL/VL values to separate multicast traffic from unicast traffic.
+Thus, torus-2QoS must generate multicast routing such that credit loops
+cannot arise from a combination of multicast and unicast path segments.
+.P
+It turns out that it is possible to construct spanning trees for multicast
+routing that have that property.  For the 2D 6x5 torus example above, here
+is the full-fabric spanning tree that torus-2QoS will construct, where "x"
+is the root switch and each "+" is a non-root switch:
+.
+.ascii_art 36
+  4    +    +    +    +    +    +
+       |    |    |    |    |    |
+  3    +    +    +    +    +    +
+       |    |    |    |    |    |
+  2    +----+----+----x----+----+
+       |    |    |    |    |    |
+  1    +    +    +    +    +    +
+       |    |    |    |    |    |
+y=0    +    +    +    +    +    +
+
+     x=0    1    2    3    4    5
+.end_ascii_art
+.P
+For multicast traffic routed from root to tip, every turn in the above
+spanning tree is a legal DOR turn.
+.P
+For traffic routed from tip to root, and some traffic routed through the
+root, turns are not legal DOR turns.  However, to construct a credit loop,
+the union of multicast routing on this spanning tree with DOR unicast
+routing can only provide 3 of the 4 turns needed for the loop.
+.P
+In addition, if none of the above spanning tree branches crosses a dateline
+used for unicast credit loop avoidance on a torus, and if multicast traffic
+is confined to SL 0 or SL 8 (recall that torus-2QoS uses SL bit 3 to
+differentiate QoS level), then multicast traffic also cannot contribute to
+the "ring" credit loops that are otherwise possible in a torus.
+.P
+Torus-2QoS uses these ideas to create a master spanning tree.  Every
+multicast group spanning tree will be constructed as a subset of the master
+tree, with the same root as the master tree.
+.P
+Such multicast group spanning trees will in general not be optimal for
+groups which are a subset of the full fabric. However, this compromise must
+be made to enable support for two QoS levels on a torus while preventing
+credit loops.
+.P
+In the presence of link or switch failures that result in a fabric for
+which torus-2QoS can generate credit-loop-free unicast routes, it is also
+possible to generate a master spanning tree for multicast that retains the
+required properties.  For example, consider that same 2D 6x5 torus, with
+the link from (2,2) to (3,2) failed.  Torus-2QoS will generate the following
+master spanning tree:
+.
+.ascii_art 36
+  4    +    +    +    +    +    +
+       |    |    |    |    |    |
+  3    +    +    +    +    +    +
+       |    |    |    |    |    |
+  2  --+----+----+    x----+----+--
+       |    |    |    |    |    |
+  1    +    +    +    +    +    +
+       |    |    |    |    |    |
+y=0    +    +    +    +    +    +
+
+     x=0    1    2    3    4    5
+.end_ascii_art
+.P
+Two things are notable about this master spanning tree.  First, assuming
+the x dateline was between x=5 and x=0, this spanning tree has a branch
+that crosses the dateline.  However, just as for unicast, crossing a
+dateline on a 1D ring (here, the ring for y=2) that is broken by a failure
+cannot contribute to a torus credit loop.
+.P
+Second, this spanning tree is no longer optimal even for multicast groups
+that encompass the entire fabric.  That, unfortunately, is a compromise that
+must be made to retain the other desirable properties of torus-2QoS routing.
+.P
+In the event that a single switch fails, torus-2QoS will generate a master
+spanning tree that has no "extra" turns by appropriately selecting a root
+switch.
+In the 2D 6x5 torus example, assume now that the switch at (3,2),
+\fIi.e.\fR, the root for a pristine fabric, fails.
+Torus-2QoS will generate the
+following master spanning tree for that case:
+.
+.ascii_art 36
+		      |
+  4    +    +    +    +    +    +
+       |    |    |    |    |    |
+  3    +    +    +    +    +    +
+       |    |    |         |    |
+  2    +    +    +         +    +
+       |    |    |         |    |
+  1    +----+----x----+----+----+
+       |    |    |    |    |    |
+y=0    +    +    +    +    +    +
+		      |
+
+     x=0    1    2    3    4    5
+.end_ascii_art
+.P
+Assuming the y dateline was between y=4 and y=0, this spanning tree has
+a branch that crosses a dateline.  However, again this cannot contribute
+to credit loops as it occurs on a 1D ring (the ring for x=3) that is
+broken by a failure, as in the above example.
+.
+.SH TORUS TOPOLOGY DISCOVERY
+.
+The algorithm used by torus-2QoS to construct the torus topology from
+the undirected graph representing the fabric requires that the radix of
+each dimension be configured via torus-2QoS.conf.
+It also requires that the torus topology be "seeded"; for a 3D torus this
+requires configuring four switches that define the three coordinate
+directions of the torus.
+.P
+Given this starting information, the algorithm is to examine the
+cube formed by the eight switch locations bounded by the corners
+(x,y,z) and (x+1,y+1,z+1).
+Based on switches already placed into the torus topology at some of these
+locations, the algorithm examines 4-loops of inter-switch links to find the
+one that is consistent with a face of the cube of switch locations,
+and adds its swiches to the discovered topology in the correct locations.
+.P
+Because the algorithm is based on examining the topology of 4-loops of links,
+a torus with one or more radix-4 dimensions requires extra initial
+seed configuration.
+See torus-2QoS.conf(5) for details.
+Torus-2QoS will detect and report when it has insufficient configuration
+for a torus with radix-4 dimensions.
+.P
+In the event the torus is significantly degraded, \fIi.e.\fR, there are
+many missing switches or links, it may happen that torus-2QoS is unable
+to place into the torus some switches and/or links that were discovered
+in the fabric, and will generate a warning in that case.
+A similar condition occurs if torus-2QoS is misconfigured, \fIi.e.\fR,
+the radix of a torus dimension as configured does not match the radix
+of that torus dimension as wired, and many switches/links in the fabric
+will not be placed into the torus.
+.
+.SH QUALITY OF SERVICE CONFIGURATION
+.
+OpenSM will not program switchs and channel adapters with
+SL2VL maps or VL arbitration configuration unless it is invoked with -Q.
+Since torus-2QoS depends on such functionality for correct operation,
+always invoke OpenSM with -Q when torus-2QoS is in the list of routing
+engines.
+.P
+Any quality of service configuration method supported by OpenSM will
+work with torus-2QoS, subject to the following limitations and
+considerations.
+.P
+For all routing engines supported by OpenSM except torus-2QoS,
+there is a one-to-one correspondence between QoS level and SL.
+Torus-2QoS can only support two quality of service levels, so only
+the high-order bit of any SL value used for unicast QoS configuration
+will be honored by torus-2QoS.
+.P
+For multicast QoS configuration, only SL values 0 and 8 should be used
+with torus-2QoS.
+.P
+Since SL to VL map configuration must be under the complete control of
+torus-2QoS, any configuration via qos_sl2vl, qos_swe_sl2vl,
+\fIetc.\fR, must and  will be ignored, and a warning will be generated.
+.P
+Torus-2QoS uses VL values 0-3 to implement one of its supported QoS
+levels, and VL values 4-7 to implement the other.  Hard-to-diagnose
+application issues may arise if traffic is not delivered fairly
+across each of these two VL ranges.
+Torus-2QoS will detect and warn if VL arbitration is configured
+unfairly across VLs in the range 0-3, and also in the range 4-7.
+Note that the default OpenSM VL arbitration configuration
+does not meet this constraint, so all torus-2QoS users should
+configure VL arbitration via qos_vlarb_high, qos_vlarb_low, \fIetc.\fR
+.
+.SH OPERATIONAL CONSIDERATIONS
+.
+Any routing algorithm for a torus IB fabric must employ path
+SL values to avoid credit loops.
+As a result, all applications run over such fabrics must perform a
+path record query to obtain the correct path SL for connection setup.
+Applications that use \fBrdma_cm\fR for connection setup will automatically
+meet this requirement.
+.P
+If a change in fabric topology causes changes in path SL values required
+to route without credit loops, in general all applications would need
+to repath to avoid message deadlock.  Since torus-2QoS has the ability
+to reroute after a single switch failure without changing path SL values,
+repathing by running applications is not required when the fabric
+is routed with torus-2QoS.
+.P
+Torus-2QoS can provide unchanging path SL values in the presence of
+subnet manager failover provided that all OpenSM instances have the
+same idea of dateline location.  See torus-2QoS.conf(5) for details.
+.P
+Torus-2QoS will detect configurations of failed switches and links
+that prevent routing that is free of credit loops, and will
+log warnings and refuse to route.  If "no_fallback" was configured in the
+list of OpenSM routing engines, then no other routing engine
+will attempt to route the fabric.  In that case all paths that
+do not transit the failed components will continue to work, and
+the subset of paths that are still operational will continue to remain
+free of credit loops.
+OpenSM will continue to attempt to route the fabric after every sweep
+interval, and after any change (such as a link up) in the fabric topology.
+When the fabric components are repaired, full functionality will be
+restored.
+.P
+In the event OpenSM was configured to allow some other engine to
+route the fabric if torus-2QoS fails, then credit loops and message
+deadlock are likely if torus-2QoS had previously routed
+the fabric successfully.
+Even if the other engine is capable of routing a torus
+without credit loops, applications that built connections with
+path SL values granted under torus-2QoS will likely experience
+message deadlock under routing generated by a different engine,
+unless they repath.
+.P
+To verify that a torus fabric is routed free of credit loops,
+use \fBibdmchk\fR to analyze data collected via \fBibdiagnet -vlr\fR.
+.
+.SH FILES
+.TP
+.B /usr/local/etc/opensm/opensm.conf
+default OpenSM config file.
+.TP
+.B /usr/local/etc/opensm/qos-policy.conf
+default QoS policy config file.
+.TP
+.B /usr/local/etc/opensm/torus-2QoS.conf
+default torus-2QoS config file.
+.
+.SH SEE ALSO
+.
+opensm(8), torus-2QoS.conf(5), ibdiagnet(1), ibdmchk(1), rdma_cm(7).
diff --git a/man/torus-2QoS.8.in b/man/torus-2QoS.8.in
new file mode 100644
index 0000000..be74f26
--- /dev/null
+++ b/man/torus-2QoS.8.in
@@ -0,0 +1,476 @@
+.TH TORUS\-2QOS 8 "November 10, 2010" "OpenIB" "OpenIB Management"
+.
+.SH NAME
+torus\-2QoS \- Routing engine for OpenSM subnet manager
+.
+.SH DESCRIPTION
+.
+Torus-2QoS is routing algorithm designed for large-scale 2D/3D torus fabrics.
+The torus-2QoS routing engine can provide the following functionality on
+a 2D/3D torus:
+.br
+\" roff illiteracy leads to following brain-dead list implementation
+\"
+.na  \" otherwise line space adjustment can add spaces between dash and text
+.in +2m
+\[en]
+'in +2m
+Routing that is free of credit loops.
+.in
+\[en]
+'in +2m
+Two levels of Quality of Service (QoS), assuming switches and channel
+adapters support eight data VLs.
+.in
+\[en]
+'in +2m
+The ability to route around a single failed switch, and/or multiple failed
+links, without
+.in
+.in +2m
+\[en]
+'in +2
+introducing credit loops, or
+.in
+\[en]
+'in +2m
+changing path SL values.
+.in -4m
+\[en]
+'in +2m
+Very short run times, with good scaling properties as fabric size increases.
+.ad
+.
+.SH UNICAST ROUTING
+.
+Unicast routing in torus-2QoS is based on Dimension Order Routing (DOR).
+It avoids the deadlocks that would otherwise occur in a DOR-routed
+torus using the concept of a dateline for each torus dimension.
+It encodes into a path SL which datelines the path crosses, as follows:
+\f(CR
+.P
+.nf
+    sl = 0;
+    for (d = 0; d < torus_dimensions; d++) {
+	/* path_crosses_dateline(d) returns 0 or 1 */
+	sl |= path_crosses_dateline(d) << d;
+    }
+.fi
+\fR
+.P
+On a 3D torus this consumes three SL bits, leaving one SL bit unused.
+Torus-2QoS uses this SL bit to implement two QoS levels.
+.P
+Torus-2QoS also makes use of the output port
+dependence of switch SL2VL maps to encode into one VL bit the
+information encoded in three SL bits.
+It computes in which torus coordinate direction each inter-switch link
+"points", and writes SL2VL maps for such ports as follows:
+\f(CR
+.P
+.nf
+    for (sl = 0; sl < 16; sl++) {
+	/* cdir(port) computes which torus coordinate direction
+	 * a switch port "points" in; returns 0, 1, or 2
+	 */
+	sl2vl(iport,oport,sl) = 0x1 & (sl >> cdir(oport));
+    }
+.fi
+\fR
+.P
+Thus, on a pristine 3D torus,
+\fIi.e.\fR,
+in the absence of failed fabric switches,
+torus-2QoS consumes eight SL values (SL bits 0-2) and
+two VL values (VL bit 0) per QoS level to provide deadlock-free routing.
+.P
+Torus-2QoS routes around link failure by "taking the long way around" any
+1D ring interrupted by link failure.  For example, consider the 2D 6x5
+torus below, where switches are denoted by [+a-zA-Z]:
+.
+.
+\# define macros to start and end ascii art, assuming Roman font.
+\# the start macro takes an argument which is the width in ems of
+\# the ascii art, and is used to center it.
+\#
+.de ascii_art
+.nop \f(CR
+.nr indent_in_ems ((((\\n[.ll] - \\n[.i]) / \\w'm') - \\$1)/2)
+.in +\\n[indent_in_ems]m
+.nf
+..
+.de end_ascii_art
+.fi
+.in
+.nop \fR
+..
+\# end of macro definitions
+.
+.
+.ascii_art 36
+       |    |    |    |    |    |
+  4  --+----+----+----+----+----+--
+       |    |    |    |    |    |
+  3  --+----+----+----D----+----+--
+       |    |    |    |    |    |
+  2  --+----+----I----r----+----+--
+       |    |    |    |    |    |
+  1  --m----S----n----T----o----p--
+       |    |    |    |    |    |
+y=0  --+----+----+----+----+----+--
+       |    |    |    |    |    |
+
+     x=0    1    2    3    4    5
+.end_ascii_art
+.P
+For a pristine fabric the path from S to D would be S-n-T-r-D.
+In the event that either link S-n or n-T has failed, torus-2QoS would
+use the path S-m-p-o-T-r-D.
+Note that it can do this without changing the path SL
+value; once the 1D ring m-S-n-T-o-p-m has been broken by failure, path
+segments using it cannot contribute to deadlock, and the x-direction
+dateline (between, say, x=5 and x=0) can be ignored for path segments on
+that ring.
+.P
+One result of this is that torus-2QoS can route around many simultaneous
+link failures, as long as no 1D ring is broken into disjoint segments.
+For example, if links n-T and T-o have both failed, that ring has been broken
+into two disjoint segments, T and o-p-m-S-n.
+Torus-2QoS checks for such
+issues, reports if they are found, and refuses to route such fabrics.
+.P
+Note that in the case where there are multiple parallel links between a
+pair of switches, torus-2QoS will allocate routes across such links
+in a round-robin fashion, based on ports at the path destination switch that
+are active and not used for inter-switch links.
+Should a link that is one of several such parallel links fail, routes
+are redistributed across the remaining links.
+When the last of such a set of parallel links fails, traffic is rerouted
+as described above.
+.P
+Handling a failed switch under DOR requires introducing into a path at
+least one turn that would be otherwise "illegal",
+\fIi.e.\fR,
+not allowed by DOR rules.
+Torus-2QoS will introduce such a turn as close as possible to the
+failed switch in order to route around it.
+.P
+In the above example, suppose switch T has failed, and consider the path
+from S to D.
+Torus-2QoS will produce the path S-n-I-r-D, rather than the
+S-n-T-r-D path for a pristine torus, by introducing an early turn at n.
+Normal DOR rules will cause traffic arriving at switch I to be forwarded
+to switch r; for traffic arriving from I due to the "early" turn at n,
+this will generate an "illegal" turn at I.
+.P
+Torus-2QoS will also use the input port dependence of SL2VL maps to set VL
+bit 1 (which would be otherwise unused) for y-x, z-x, and z-y turns,
+\fIi.e.\fR,
+those turns that are illegal under DOR.
+This causes the first hop after any such turn to use a separate set of
+VL values, and prevents deadlock in the presence of a single failed switch.
+.P
+For any given path, only the hops after a turn that is illegal under DOR
+can contribute to a credit loop that leads to deadlock.  So in the example
+above with failed switch T, the location of the illegal turn at I in the
+path from S to D requires that any credit loop caused by that turn must
+encircle the failed switch at T.  Thus the second and later hops after the
+illegal turn at I (\fIi.e.\fR, hop r-D) cannot contribute to a credit loop
+because they cannot be used to construct a loop encircling T.  The hop I-r
+uses a separate VL, so it cannot contribute to a credit loop encircling T.
+.P
+Extending this argument shows that in addition to being capable of routing
+around a single switch failure without introducing deadlock, torus-2QoS can
+also route around multiple failed switches on the condition they are
+adjacent in the last dimension routed by DOR.  For example, consider the
+following case on a 6x6 2D torus:
+.
+.ascii_art 36
+       |    |    |    |    |    |
+  5  --+----+----+----+----+----+--
+       |    |    |    |    |    |
+  4  --+----+----+----D----+----+--
+       |    |    |    |    |    |
+  3  --+----+----I----u----+----+--
+       |    |    |    |    |    |
+  2  --+----+----q----R----+----+--
+       |    |    |    |    |    |
+  1  --m----S----n----T----o----p--
+       |    |    |    |    |    |
+y=0  --+----+----+----+----+----+--
+       |    |    |    |    |    |
+
+     x=0    1    2    3    4    5
+.end_ascii_art
+.P
+Suppose switches T and R have failed, and consider the path from S to D.
+Torus-2QoS will generate the path S-n-q-I-u-D, with an illegal turn at
+switch I, and with hop I-u using a VL with bit 1 set.
+.P
+As a further example, consider a case that torus-2QoS cannot route without
+deadlock: two failed switches adjacent in a dimension that is not the last
+dimension routed by DOR; here the failed switches are O and T:
+.
+.ascii_art 36
+       |    |    |    |    |    |
+  5  --+----+----+----+----+----+--
+       |    |    |    |    |    |
+  4  --+----+----+----+----+----+--
+       |    |    |    |    |    |
+  3  --+----+----+----+----D----+--
+       |    |    |    |    |    |
+  2  --+----+----I----q----r----+--
+       |    |    |    |    |    |
+  1  --m----S----n----O----T----p--
+       |    |    |    |    |    |
+y=0  --+----+----+----+----+----+--
+       |    |    |    |    |    |
+
+     x=0    1    2    3    4    5
+.end_ascii_art
+.P
+In a pristine fabric, torus-2QoS would generate the path from S to D as
+S-n-O-T-r-D.  With failed switches O and T, torus-2QoS will generate the
+path S-n-I-q-r-D, with illegal turn at switch I, and with hop I-q using a
+VL with bit 1 set.  In contrast to the earlier examples, the second hop
+after the illegal turn, q-r, can be used to construct a credit loop
+encircling the failed switches.
+.
+.SH MULTICAST ROUTING
+.
+Since torus-2QoS uses all four available SL bits, and the three data VL
+bits that are typically available in current switches, there is no way
+to use SL/VL values to separate multicast traffic from unicast traffic.
+Thus, torus-2QoS must generate multicast routing such that credit loops
+cannot arise from a combination of multicast and unicast path segments.
+.P
+It turns out that it is possible to construct spanning trees for multicast
+routing that have that property.  For the 2D 6x5 torus example above, here
+is the full-fabric spanning tree that torus-2QoS will construct, where "x"
+is the root switch and each "+" is a non-root switch:
+.
+.ascii_art 36
+  4    +    +    +    +    +    +
+       |    |    |    |    |    |
+  3    +    +    +    +    +    +
+       |    |    |    |    |    |
+  2    +----+----+----x----+----+
+       |    |    |    |    |    |
+  1    +    +    +    +    +    +
+       |    |    |    |    |    |
+y=0    +    +    +    +    +    +
+
+     x=0    1    2    3    4    5
+.end_ascii_art
+.P
+For multicast traffic routed from root to tip, every turn in the above
+spanning tree is a legal DOR turn.
+.P
+For traffic routed from tip to root, and some traffic routed through the
+root, turns are not legal DOR turns.  However, to construct a credit loop,
+the union of multicast routing on this spanning tree with DOR unicast
+routing can only provide 3 of the 4 turns needed for the loop.
+.P
+In addition, if none of the above spanning tree branches crosses a dateline
+used for unicast credit loop avoidance on a torus, and if multicast traffic
+is confined to SL 0 or SL 8 (recall that torus-2QoS uses SL bit 3 to
+differentiate QoS level), then multicast traffic also cannot contribute to
+the "ring" credit loops that are otherwise possible in a torus.
+.P
+Torus-2QoS uses these ideas to create a master spanning tree.  Every
+multicast group spanning tree will be constructed as a subset of the master
+tree, with the same root as the master tree.
+.P
+Such multicast group spanning trees will in general not be optimal for
+groups which are a subset of the full fabric. However, this compromise must
+be made to enable support for two QoS levels on a torus while preventing
+credit loops.
+.P
+In the presence of link or switch failures that result in a fabric for
+which torus-2QoS can generate credit-loop-free unicast routes, it is also
+possible to generate a master spanning tree for multicast that retains the
+required properties.  For example, consider that same 2D 6x5 torus, with
+the link from (2,2) to (3,2) failed.  Torus-2QoS will generate the following
+master spanning tree:
+.
+.ascii_art 36
+  4    +    +    +    +    +    +
+       |    |    |    |    |    |
+  3    +    +    +    +    +    +
+       |    |    |    |    |    |
+  2  --+----+----+    x----+----+--
+       |    |    |    |    |    |
+  1    +    +    +    +    +    +
+       |    |    |    |    |    |
+y=0    +    +    +    +    +    +
+
+     x=0    1    2    3    4    5
+.end_ascii_art
+.P
+Two things are notable about this master spanning tree.  First, assuming
+the x dateline was between x=5 and x=0, this spanning tree has a branch
+that crosses the dateline.  However, just as for unicast, crossing a
+dateline on a 1D ring (here, the ring for y=2) that is broken by a failure
+cannot contribute to a torus credit loop.
+.P
+Second, this spanning tree is no longer optimal even for multicast groups
+that encompass the entire fabric.  That, unfortunately, is a compromise that
+must be made to retain the other desirable properties of torus-2QoS routing.
+.P
+In the event that a single switch fails, torus-2QoS will generate a master
+spanning tree that has no "extra" turns by appropriately selecting a root
+switch.
+In the 2D 6x5 torus example, assume now that the switch at (3,2),
+\fIi.e.\fR, the root for a pristine fabric, fails.
+Torus-2QoS will generate the
+following master spanning tree for that case:
+.
+.ascii_art 36
+		      |
+  4    +    +    +    +    +    +
+       |    |    |    |    |    |
+  3    +    +    +    +    +    +
+       |    |    |         |    |
+  2    +    +    +         +    +
+       |    |    |         |    |
+  1    +----+----x----+----+----+
+       |    |    |    |    |    |
+y=0    +    +    +    +    +    +
+		      |
+
+     x=0    1    2    3    4    5
+.end_ascii_art
+.P
+Assuming the y dateline was between y=4 and y=0, this spanning tree has
+a branch that crosses a dateline.  However, again this cannot contribute
+to credit loops as it occurs on a 1D ring (the ring for x=3) that is
+broken by a failure, as in the above example.
+.
+.SH TORUS TOPOLOGY DISCOVERY
+.
+The algorithm used by torus-2QoS to construct the torus topology from
+the undirected graph representing the fabric requires that the radix of
+each dimension be configured via torus-2QoS.conf.
+It also requires that the torus topology be "seeded"; for a 3D torus this
+requires configuring four switches that define the three coordinate
+directions of the torus.
+.P
+Given this starting information, the algorithm is to examine the
+cube formed by the eight switch locations bounded by the corners
+(x,y,z) and (x+1,y+1,z+1).
+Based on switches already placed into the torus topology at some of these
+locations, the algorithm examines 4-loops of inter-switch links to find the
+one that is consistent with a face of the cube of switch locations,
+and adds its swiches to the discovered topology in the correct locations.
+.P
+Because the algorithm is based on examining the topology of 4-loops of links,
+a torus with one or more radix-4 dimensions requires extra initial
+seed configuration.
+See torus-2QoS.conf(5) for details.
+Torus-2QoS will detect and report when it has insufficient configuration
+for a torus with radix-4 dimensions.
+.P
+In the event the torus is significantly degraded, \fIi.e.\fR, there are
+many missing switches or links, it may happen that torus-2QoS is unable
+to place into the torus some switches and/or links that were discovered
+in the fabric, and will generate a warning in that case.
+A similar condition occurs if torus-2QoS is misconfigured, \fIi.e.\fR,
+the radix of a torus dimension as configured does not match the radix
+of that torus dimension as wired, and many switches/links in the fabric
+will not be placed into the torus.
+.
+.SH QUALITY OF SERVICE CONFIGURATION
+.
+OpenSM will not program switchs and channel adapters with
+SL2VL maps or VL arbitration configuration unless it is invoked with -Q.
+Since torus-2QoS depends on such functionality for correct operation,
+always invoke OpenSM with -Q when torus-2QoS is in the list of routing
+engines.
+.P
+Any quality of service configuration method supported by OpenSM will
+work with torus-2QoS, subject to the following limitations and
+considerations.
+.P
+For all routing engines supported by OpenSM except torus-2QoS,
+there is a one-to-one correspondence between QoS level and SL.
+Torus-2QoS can only support two quality of service levels, so only
+the high-order bit of any SL value used for unicast QoS configuration
+will be honored by torus-2QoS.
+.P
+For multicast QoS configuration, only SL values 0 and 8 should be used
+with torus-2QoS.
+.P
+Since SL to VL map configuration must be under the complete control of
+torus-2QoS, any configuration via qos_sl2vl, qos_swe_sl2vl,
+\fIetc.\fR, must and  will be ignored, and a warning will be generated.
+.P
+Torus-2QoS uses VL values 0-3 to implement one of its supported QoS
+levels, and VL values 4-7 to implement the other.  Hard-to-diagnose
+application issues may arise if traffic is not delivered fairly
+across each of these two VL ranges.
+Torus-2QoS will detect and warn if VL arbitration is configured
+unfairly across VLs in the range 0-3, and also in the range 4-7.
+Note that the default OpenSM VL arbitration configuration
+does not meet this constraint, so all torus-2QoS users should
+configure VL arbitration via qos_vlarb_high, qos_vlarb_low, \fIetc.\fR
+.
+.SH OPERATIONAL CONSIDERATIONS
+.
+Any routing algorithm for a torus IB fabric must employ path
+SL values to avoid credit loops.
+As a result, all applications run over such fabrics must perform a
+path record query to obtain the correct path SL for connection setup.
+Applications that use \fBrdma_cm\fR for connection setup will automatically
+meet this requirement.
+.P
+If a change in fabric topology causes changes in path SL values required
+to route without credit loops, in general all applications would need
+to repath to avoid message deadlock.  Since torus-2QoS has the ability
+to reroute after a single switch failure without changing path SL values,
+repathing by running applications is not required when the fabric
+is routed with torus-2QoS.
+.P
+Torus-2QoS can provide unchanging path SL values in the presence of
+subnet manager failover provided that all OpenSM instances have the
+same idea of dateline location.  See torus-2QoS.conf(5) for details.
+.P
+Torus-2QoS will detect configurations of failed switches and links
+that prevent routing that is free of credit loops, and will
+log warnings and refuse to route.  If "no_fallback" was configured in the
+list of OpenSM routing engines, then no other routing engine
+will attempt to route the fabric.  In that case all paths that
+do not transit the failed components will continue to work, and
+the subset of paths that are still operational will continue to remain
+free of credit loops.
+OpenSM will continue to attempt to route the fabric after every sweep
+interval, and after any change (such as a link up) in the fabric topology.
+When the fabric components are repaired, full functionality will be
+restored.
+.P
+In the event OpenSM was configured to allow some other engine to
+route the fabric if torus-2QoS fails, then credit loops and message
+deadlock are likely if torus-2QoS had previously routed
+the fabric successfully.
+Even if the other engine is capable of routing a torus
+without credit loops, applications that built connections with
+path SL values granted under torus-2QoS will likely experience
+message deadlock under routing generated by a different engine,
+unless they repath.
+.P
+To verify that a torus fabric is routed free of credit loops,
+use \fBibdmchk\fR to analyze data collected via \fBibdiagnet -vlr\fR.
+.
+.SH FILES
+.TP
+.B @OPENSM_CONFIG_DIR@/@OPENSM_CONFIG_FILE@
+default OpenSM config file.
+.TP
+.B @OPENSM_CONFIG_DIR@/@QOS_POLICY_FILE@
+default QoS policy config file.
+.TP
+.B @OPENSM_CONFIG_DIR@/@TORUS2QOS_CONF_FILE@
+default torus-2QoS config file.
+.
+.SH SEE ALSO
+.
+opensm(8), torus-2QoS.conf(5), ibdiagnet(1), ibdmchk(1), rdma_cm(7).
diff --git a/man/torus-2QoS.conf.5 b/man/torus-2QoS.conf.5
new file mode 100644
index 0000000..ef8a351
--- /dev/null
+++ b/man/torus-2QoS.conf.5
@@ -0,0 +1,210 @@
+.TH TORUS\-2QOS.CONF 5 "November 7, 2011" "OpenIB" "OpenIB Management"
+.
+.SH NAME
+torus\-2QoS.conf \- Torus-2QoS configuration for OpenSM subnet manager
+.
+.SH DESCRIPTION
+.
+The file
+.B torus-2QoS.conf
+contains configuration information that is specific to the OpenSM
+routing engine torus-2QoS.
+Blank lines and lines where the first non-whitespace character is
+"#" are ignored.
+A token is any contiguous group of non-whitespace characters.
+Any tokens on a line following the recognized configuration tokens described
+below are ignored.
+.
+.P
+\fR[\fBtorus\fR|\fBmesh\fR]
+\fIx_radix\fR[\fBm\fR|\fBM\fR|\fBt\fR|\fBT\fR]
+\fIy_radix\fR[\fBm\fR|\fBM\fR|\fBt\fR|\fBT\fR]
+\fIz_radix\fR[\fBm\fR|\fBM\fR|\fBt\fR|\fBT\fR]
+.RS
+Either \fBtorus\fR or \fBmesh\fR must be the first keyword in the
+configuration, and sets the topology
+that torus-2QoS will try to construct.
+A 2D topology can be configured by specifying one of
+\fIx_radix\fR, \fIy_radix\fR, or \fIz_radix\fR as 1.
+An individual dimension can be configured as mesh (open) or torus
+(looped) by suffixing its radix specification with one of
+\fBm\fR, \fBM\fR, \fBt\fR, or \fBT\fR.  Thus, "mesh 3T 4 5" and
+"torus 3 4M 5M" both specify the same topology.
+.P
+Note that although torus-2QoS can route mesh fabrics, its ability to
+route around failed components is severely compromised on such fabrics.
+A failed fabric component is very likely to cause a disjoint ring;
+see \fBUNICAST ROUTING\fR in torus-2QoS(8).
+.RE
+.
+.P
+\fBxp_link
+\fIsw0_GUID sw1_GUID
+.br
+.ns
+\fByp_link
+\fIsw0_GUID sw1_GUID
+.br
+.ns
+\fBzp_link
+\fIsw0_GUID sw1_GUID
+.br
+.ns
+\fBxm_link
+\fIsw0_GUID sw1_GUID
+.br
+.ns
+\fBym_link
+\fIsw0_GUID sw1_GUID
+.br
+.ns
+\fBzm_link
+\fIsw0_GUID sw1_GUID
+\fR
+.RS
+These keywords are used to seed the torus/mesh topology.
+For example, "xp_link 0x2000 0x2001" specifies that a link from
+the switch with node GUID 0x2000 to the switch with node GUID 0x2001
+would point in the positive x direction,
+while "xm_link 0x2000 0x2001" specifies that a link from
+the switch with node GUID 0x2000 to the switch with node GUID 0x2001
+would point in the negative x direction.  All the link keywords for
+a given seed must specify the same "from" switch.
+.P
+In general, it is not necessary to configure both the positive and
+negative directions for a given coordinate; either is sufficient.
+However, the algorithm used for topology discovery needs extra information
+for torus dimensions of radix four (see \fBTOPOLOGY DISCOVERY\fR in
+torus-2QoS(8)).  For such cases both the positive and negative coordinate
+directions must be specified.
+.P
+Based on the topology specified via the \fBtorus\fR/\fBmesh\fR keyword,
+torus-2QoS will detect and log when it has insufficient seed configuration.
+.RE
+.
+.P
+\fBx_dateline
+\fIposition
+.br
+.ns
+\fBy_dateline
+\fIposition
+.br
+.ns
+\fBz_dateline
+\fIposition
+\fR
+.RS
+In order for torus-2QoS to provide the guarantee that path SL values
+do not change under any conditions for which it can still route the fabric,
+its idea of dateline position must not change relative to physical switch
+locations.  The dateline keywords provide the means to configure such
+behavior.
+.P
+The dateline for a torus dimension is always between the switch with
+coordinate 0 and the switch with coordinate radix-1 for that dimension.
+By default, the common switch in a torus seed is taken as the origin of
+the coordinate system used to describe switch location.
+The \fIposition\fR parameter for a dateline keyword moves the origin
+(and hence the dateline) the specified amount relative to the common
+switch in a torus seed.
+.RE
+.
+.P
+\fBnext_seed
+\fR
+.RS
+If any of the switches used to specify a seed were to fail torus-2QoS
+would be unable to complete topology discovery successfully.
+The \fBnext_seed\fR keyword specifies that the following link and dateline
+keywords apply to a new seed specification.
+.P
+For maximum resiliency, no seed specification should share a switch
+with any other seed specification.
+Multiple seed specifications should use dateline configuration to
+ensure that torus-2QoS can grant path SL values that are constant,
+regardless of which seed was used to initiate topology discovery.
+.RE
+.
+.P
+\fBportgroup_max_ports
+\fImax_ports
+\fR
+.RS
+This keyword specifies the maximum number of parallel inter-switch
+links, and also the maximum number of host ports per switch, that
+torus-2QoS can accommodate.
+The default value is 16.
+Torus-2QoS will log an error message during topology discovery if this
+parameter needs to be increased.
+If this keyword appears multiple times, the last instance prevails.
+.P
+Note that the switch management port (switch port 0) gets put into
+the same port group with the host ports, so if you have 16 host ports per
+switch, portgroup_max_ports would need to be at least 17.
+.RE
+.
+.P
+\fBport_order
+\fIp1 p2 p3 ...
+\fR
+.RS
+This keyword specifies the order in which CA ports on a destination switch
+are visited when computing routes. When the fabric contains switches connected
+with multiple parallel links, routes are distributed in a round-robin fashion
+across such links, and so changing the order that CA ports are visited changes
+the distribution of routes across such links.  This may be advantageous for
+some specific traffic patterns.
+.P
+The default is to visit CA ports in increasing port
+order on destination switches.
+.P
+Duplicate values in the list will be ignored.
+.RE
+.
+.SH EXAMPLE
+.
+\f(RC
+.nf
+# Look for a 2D (since x radix is one) 4x5 torus.
+torus 1 4 5
+
+# y is radix-4 torus dimension, need both
+# ym_link and yp_link configuration.
+yp_link 0x200000 0x200005  # sw @ y=0,z=0 -> sw @ y=1,z=0
+ym_link 0x200000 0x20000f  # sw @ y=0,z=0 -> sw @ y=3,z=0
+
+# z is not radix-4 torus dimension, only need one of
+# zm_link or zp_link configuration.
+zp_link 0x200000 0x200001  # sw @ y=0,z=0 -> sw @ y=0,z=1
+
+next_seed
+
+yp_link 0x20000b 0x200010  # sw @ y=2,z=1 -> sw @ y=3,z=1
+ym_link 0x20000b 0x200006  # sw @ y=2,z=1 -> sw @ y=1,z=1
+zp_link 0x20000b 0x20000c  # sw @ y=2,z=1 -> sw @ y=2,z=2
+
+y_dateline -2  # Move the dateline for this seed
+z_dateline -1  # back to its original position.
+
+# If OpenSM failover is configured, for maximum resiliency
+# one instance should run on a host attached to a switch
+# from the first seed, and another instance should run
+# on a host attached to a switch from the second seed.
+# Both instances should use this torus-2QoS.conf to ensure
+# path SL values do not change in the event of SM failover.
+
+# port_order defines the order on which the ports would be
+# chosen for routing.
+port_order 7 10 8 11 9 12 25 28 26 29 27 30
+.fi
+\fR
+.
+.SH FILES
+.TP
+.B /usr/local/etc/opensm/torus-2QoS.conf
+Default torus-2QoS config file.
+.
+.SH SEE ALSO
+.
+opensm(8), torus-2QoS(8).
diff --git a/man/torus-2QoS.conf.5.in b/man/torus-2QoS.conf.5.in
new file mode 100644
index 0000000..d806ab5
--- /dev/null
+++ b/man/torus-2QoS.conf.5.in
@@ -0,0 +1,210 @@
+.TH TORUS\-2QOS.CONF 5 "November 7, 2011" "OpenIB" "OpenIB Management"
+.
+.SH NAME
+torus\-2QoS.conf \- Torus-2QoS configuration for OpenSM subnet manager
+.
+.SH DESCRIPTION
+.
+The file
+.B torus-2QoS.conf
+contains configuration information that is specific to the OpenSM
+routing engine torus-2QoS.
+Blank lines and lines where the first non-whitespace character is
+"#" are ignored.
+A token is any contiguous group of non-whitespace characters.
+Any tokens on a line following the recognized configuration tokens described
+below are ignored.
+.
+.P
+\fR[\fBtorus\fR|\fBmesh\fR]
+\fIx_radix\fR[\fBm\fR|\fBM\fR|\fBt\fR|\fBT\fR]
+\fIy_radix\fR[\fBm\fR|\fBM\fR|\fBt\fR|\fBT\fR]
+\fIz_radix\fR[\fBm\fR|\fBM\fR|\fBt\fR|\fBT\fR]
+.RS
+Either \fBtorus\fR or \fBmesh\fR must be the first keyword in the
+configuration, and sets the topology
+that torus-2QoS will try to construct.
+A 2D topology can be configured by specifying one of
+\fIx_radix\fR, \fIy_radix\fR, or \fIz_radix\fR as 1.
+An individual dimension can be configured as mesh (open) or torus
+(looped) by suffixing its radix specification with one of
+\fBm\fR, \fBM\fR, \fBt\fR, or \fBT\fR.  Thus, "mesh 3T 4 5" and
+"torus 3 4M 5M" both specify the same topology.
+.P
+Note that although torus-2QoS can route mesh fabrics, its ability to
+route around failed components is severely compromised on such fabrics.
+A failed fabric component is very likely to cause a disjoint ring;
+see \fBUNICAST ROUTING\fR in torus-2QoS(8).
+.RE
+.
+.P
+\fBxp_link
+\fIsw0_GUID sw1_GUID
+.br
+.ns
+\fByp_link
+\fIsw0_GUID sw1_GUID
+.br
+.ns
+\fBzp_link
+\fIsw0_GUID sw1_GUID
+.br
+.ns
+\fBxm_link
+\fIsw0_GUID sw1_GUID
+.br
+.ns
+\fBym_link
+\fIsw0_GUID sw1_GUID
+.br
+.ns
+\fBzm_link
+\fIsw0_GUID sw1_GUID
+\fR
+.RS
+These keywords are used to seed the torus/mesh topology.
+For example, "xp_link 0x2000 0x2001" specifies that a link from
+the switch with node GUID 0x2000 to the switch with node GUID 0x2001
+would point in the positive x direction,
+while "xm_link 0x2000 0x2001" specifies that a link from
+the switch with node GUID 0x2000 to the switch with node GUID 0x2001
+would point in the negative x direction.  All the link keywords for
+a given seed must specify the same "from" switch.
+.P
+In general, it is not necessary to configure both the positive and
+negative directions for a given coordinate; either is sufficient.
+However, the algorithm used for topology discovery needs extra information
+for torus dimensions of radix four (see \fBTOPOLOGY DISCOVERY\fR in
+torus-2QoS(8)).  For such cases both the positive and negative coordinate
+directions must be specified.
+.P
+Based on the topology specified via the \fBtorus\fR/\fBmesh\fR keyword,
+torus-2QoS will detect and log when it has insufficient seed configuration.
+.RE
+.
+.P
+\fBx_dateline
+\fIposition
+.br
+.ns
+\fBy_dateline
+\fIposition
+.br
+.ns
+\fBz_dateline
+\fIposition
+\fR
+.RS
+In order for torus-2QoS to provide the guarantee that path SL values
+do not change under any conditions for which it can still route the fabric,
+its idea of dateline position must not change relative to physical switch
+locations.  The dateline keywords provide the means to configure such
+behavior.
+.P
+The dateline for a torus dimension is always between the switch with
+coordinate 0 and the switch with coordinate radix-1 for that dimension.
+By default, the common switch in a torus seed is taken as the origin of
+the coordinate system used to describe switch location.
+The \fIposition\fR parameter for a dateline keyword moves the origin
+(and hence the dateline) the specified amount relative to the common
+switch in a torus seed.
+.RE
+.
+.P
+\fBnext_seed
+\fR
+.RS
+If any of the switches used to specify a seed were to fail torus-2QoS
+would be unable to complete topology discovery successfully.
+The \fBnext_seed\fR keyword specifies that the following link and dateline
+keywords apply to a new seed specification.
+.P
+For maximum resiliency, no seed specification should share a switch
+with any other seed specification.
+Multiple seed specifications should use dateline configuration to
+ensure that torus-2QoS can grant path SL values that are constant,
+regardless of which seed was used to initiate topology discovery.
+.RE
+.
+.P
+\fBportgroup_max_ports
+\fImax_ports
+\fR
+.RS
+This keyword specifies the maximum number of parallel inter-switch
+links, and also the maximum number of host ports per switch, that
+torus-2QoS can accommodate.
+The default value is 16.
+Torus-2QoS will log an error message during topology discovery if this
+parameter needs to be increased.
+If this keyword appears multiple times, the last instance prevails.
+.P
+Note that the switch management port (switch port 0) gets put into
+the same port group with the host ports, so if you have 16 host ports per
+switch, portgroup_max_ports would need to be at least 17.
+.RE
+.
+.P
+\fBport_order
+\fIp1 p2 p3 ...
+\fR
+.RS
+This keyword specifies the order in which CA ports on a destination switch
+are visited when computing routes. When the fabric contains switches connected
+with multiple parallel links, routes are distributed in a round-robin fashion
+across such links, and so changing the order that CA ports are visited changes
+the distribution of routes across such links.  This may be advantageous for
+some specific traffic patterns.
+.P
+The default is to visit CA ports in increasing port
+order on destination switches.
+.P
+Duplicate values in the list will be ignored.
+.RE
+.
+.SH EXAMPLE
+.
+\f(RC
+.nf
+# Look for a 2D (since x radix is one) 4x5 torus.
+torus 1 4 5
+
+# y is radix-4 torus dimension, need both
+# ym_link and yp_link configuration.
+yp_link 0x200000 0x200005  # sw @ y=0,z=0 -> sw @ y=1,z=0
+ym_link 0x200000 0x20000f  # sw @ y=0,z=0 -> sw @ y=3,z=0
+
+# z is not radix-4 torus dimension, only need one of
+# zm_link or zp_link configuration.
+zp_link 0x200000 0x200001  # sw @ y=0,z=0 -> sw @ y=0,z=1
+
+next_seed
+
+yp_link 0x20000b 0x200010  # sw @ y=2,z=1 -> sw @ y=3,z=1
+ym_link 0x20000b 0x200006  # sw @ y=2,z=1 -> sw @ y=1,z=1
+zp_link 0x20000b 0x20000c  # sw @ y=2,z=1 -> sw @ y=2,z=2
+
+y_dateline -2  # Move the dateline for this seed
+z_dateline -1  # back to its original position.
+
+# If OpenSM failover is configured, for maximum resiliency
+# one instance should run on a host attached to a switch
+# from the first seed, and another instance should run
+# on a host attached to a switch from the second seed.
+# Both instances should use this torus-2QoS.conf to ensure
+# path SL values do not change in the event of SM failover.
+
+# port_order defines the order on which the ports would be
+# chosen for routing.
+port_order 7 10 8 11 9 12 25 28 26 29 27 30
+.fi
+\fR
+.
+.SH FILES
+.TP
+.B @OPENSM_CONFIG_DIR@/@TORUS2QOS_CONF_FILE@
+Default torus-2QoS config file.
+.
+.SH SEE ALSO
+.
+opensm(8), torus-2QoS(8).
diff --git a/opensm.spec.in b/opensm.spec
similarity index 84%
copy from opensm.spec.in
copy to opensm.spec
index 9c23f47..1624c67 100644
--- a/opensm.spec.in
+++ b/opensm.spec
@@ -1,5 +1,5 @@
-%define RELEASE @RELEASE@
-%define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE}
+%define RELEASE 1
+%define rel %{?CUSTOM_RELEASE}%{!?CUSTOM_RELEASE:%RELEASE}
 %if %{?_with_console_socket:1}%{!?_with_console_socket:0}
 %define _enable_console_socket --enable-console-socket
 %endif
@@ -15,20 +15,24 @@
 %endif
 
 %if %{?_with_event_plugin:1}%{!?_with_event_plugin:0}
-%define _enable_event_plugin --enable-event-plugin
+%define _enable_event_plugin --enable-default-event-plugin
 %endif
 %if %{?_without_event_plugin:1}%{!?_without_event_plugin:0}
-%define _disable_event_plugin --disable-event-plugin
+%define _disable_event_plugin --disable-default-event-plugin
+%endif
+
+%if %{?_with_node_name_map:1}%{!?_with_node_name_map:0}
+%define _enable_node_name_map --with-node-name-map%{?_with_node_name_map}
 %endif
 
 Summary: InfiniBand subnet manager and administration
 Name: opensm
-Version: @VERSION@
+Version: 3.3.15
 Release: %rel%{?dist}
 License: GPLv2 or BSD
 Group: System Environment/Daemons
 URL: http://openfabrics.org/
-Source: http://www.openfabrics.org/downloads/management/@TARBALL@
+Source: http://www.openfabrics.org/downloads/management/opensm-3.3.15.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: libibumad-devel, libtool
 Requires: %{name}-libs = %{version}-%{release}, logrotate
@@ -80,7 +84,8 @@ Static version of the opensm libraries
         %{?_enable_perf_mgr} \
         %{?_disable_perf_mgr} \
         %{?_enable_event_plugin} \
-        %{?_disable_event_plugin}
+        %{?_disable_event_plugin} \
+        %{?_enable_node_name_map}
 make %{?_smp_mflags}
 
 %install
@@ -94,7 +99,7 @@ if [ -f /etc/redhat-release -o -s /etc/redhat-release ]; then
 else
     REDHAT=""
 fi
-mkdir -p $etc/{init.d,logrotate.d} $etc/@OPENSM_CONFIG_SUB_DIR@
+mkdir -p $etc/{init.d,logrotate.d} $etc/opensm
 install -m 755 scripts/${REDHAT}opensm.init $etc/init.d/opensmd
 install -D -m 644 scripts/opensm.logrotate $etc/logrotate.d/opensm
 install -m 755 scripts/sldd.sh $RPM_BUILD_ROOT%{_sbindir}/sldd.sh
@@ -124,12 +129,13 @@ fi
 %{_sbindir}/opensm
 %{_sbindir}/osmtest
 %{_mandir}/man8/*
-%doc AUTHORS COPYING README doc/performance-manager-HOWTO.txt doc/QoS_management_in_OpenSM.txt doc/opensm_release_notes-3.2.txt
+%{_mandir}/man5/*
+%doc AUTHORS COPYING README doc/performance-manager-HOWTO.txt doc/QoS_management_in_OpenSM.txt doc/opensm_release_notes-3.3.txt
 %{_sysconfdir}/init.d/opensmd
 %{_sbindir}/sldd.sh
 %config(noreplace) %{_sysconfdir}/logrotate.d/opensm
 %dir /var/cache/opensm
-%dir %{_sysconfdir}/@OPENSM_CONFIG_SUB_DIR@
+%dir %{_sysconfdir}/opensm
 
 %files libs
 %defattr(-,root,root,-)
diff --git a/opensm.spec.in b/opensm.spec.in
index 9c23f47..65e46c9 100644
--- a/opensm.spec.in
+++ b/opensm.spec.in
@@ -1,5 +1,5 @@
 %define RELEASE @RELEASE@
-%define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE}
+%define rel %{?CUSTOM_RELEASE}%{!?CUSTOM_RELEASE:%RELEASE}
 %if %{?_with_console_socket:1}%{!?_with_console_socket:0}
 %define _enable_console_socket --enable-console-socket
 %endif
@@ -15,10 +15,14 @@
 %endif
 
 %if %{?_with_event_plugin:1}%{!?_with_event_plugin:0}
-%define _enable_event_plugin --enable-event-plugin
+%define _enable_event_plugin --enable-default-event-plugin
 %endif
 %if %{?_without_event_plugin:1}%{!?_without_event_plugin:0}
-%define _disable_event_plugin --disable-event-plugin
+%define _disable_event_plugin --disable-default-event-plugin
+%endif
+
+%if %{?_with_node_name_map:1}%{!?_with_node_name_map:0}
+%define _enable_node_name_map --with-node-name-map%{?_with_node_name_map}
 %endif
 
 Summary: InfiniBand subnet manager and administration
@@ -80,7 +84,8 @@ Static version of the opensm libraries
         %{?_enable_perf_mgr} \
         %{?_disable_perf_mgr} \
         %{?_enable_event_plugin} \
-        %{?_disable_event_plugin}
+        %{?_disable_event_plugin} \
+        %{?_enable_node_name_map}
 make %{?_smp_mflags}
 
 %install
@@ -124,7 +129,8 @@ fi
 %{_sbindir}/opensm
 %{_sbindir}/osmtest
 %{_mandir}/man8/*
-%doc AUTHORS COPYING README doc/performance-manager-HOWTO.txt doc/QoS_management_in_OpenSM.txt doc/opensm_release_notes-3.2.txt
+%{_mandir}/man5/*
+%doc AUTHORS COPYING README doc/performance-manager-HOWTO.txt doc/QoS_management_in_OpenSM.txt doc/opensm_release_notes-3.3.txt
 %{_sysconfdir}/init.d/opensmd
 %{_sbindir}/sldd.sh
 %config(noreplace) %{_sysconfdir}/logrotate.d/opensm
diff --git a/opensm/Makefile.am b/opensm/Makefile.am
index 01573d2..7fd6bc6 100644
--- a/opensm/Makefile.am
+++ b/opensm/Makefile.am
@@ -25,16 +25,17 @@ libopensm_la_LDFLAGS = -version-info $(opensm_api_version) \
 libopensm_la_DEPENDENCIES = $(srcdir)/libopensm.map
 
 sbin_PROGRAMS = opensm
+opensm_LDFLAGS = -rdynamic
 opensm_DEPENDENCIES = libopensm.la
 opensm_SOURCES = main.c osm_console_io.c osm_console.c osm_db_files.c \
-		 osm_db_pack.c osm_drop_mgr.c \
-		 osm_inform.c osm_lid_mgr.c osm_lin_fwd_rcv.c \
+		 osm_db_pack.c osm_drop_mgr.c osm_guid_info_rcv.c \
+		 osm_guid_mgr.c 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_info.c \
-		 osm_mcm_port.c osm_mtree.c osm_multicast.c osm_node.c \
+		 osm_mcast_mgr.c osm_mcast_tbl.c \
+		 osm_mcm_port.c osm_mesh.c osm_mtree.c osm_multicast.c osm_node.c \
 		 osm_node_desc_rcv.c osm_node_info_rcv.c \
 		 osm_opensm.c osm_pkey.c osm_pkey_mgr.c osm_pkey_rcv.c \
-		 osm_port.c osm_port_info_rcv.c \
+		 osm_port.c osm_port_info_rcv.c osm_mlnx_ext_port_info_rcv.c \
 		 osm_remote_sm.c osm_req.c \
 		 osm_resp.c osm_sa.c osm_sa_class_port_info.c \
 		 osm_sa_informinfo.c osm_sa_lft_record.c osm_sa_mft_record.c \
@@ -52,10 +53,12 @@ opensm_SOURCES = main.c osm_console_io.c osm_console.c osm_db_files.c \
 		 osm_prtn.c osm_prtn_config.c osm_qos.c osm_router.c \
 		 osm_trap_rcv.c osm_ucast_mgr.c osm_ucast_updn.c \
 		 osm_ucast_lash.c osm_ucast_file.c osm_ucast_ftree.c \
-		 osm_vl15intf.c osm_vl_arb_rcv.c \
-		 st.c osm_perfmgr.c osm_perfmgr_db.c \
+		 osm_torus.c osm_ucast_dnup.c \
+		 osm_ucast_dfsssp.c osm_vl15intf.c \
+		 osm_vl_arb_rcv.c st.c osm_perfmgr.c osm_perfmgr_db.c \
 		 osm_event_plugin.c osm_dump.c osm_ucast_cache.c \
-		 osm_qos_parser_y.y osm_qos_parser_l.l osm_qos_policy.c
+		 osm_qos_parser_y.y osm_qos_parser_l.l osm_qos_policy.c \
+		 osm_congestion_control.c
 
 AM_YFLAGS:= -d
 
@@ -74,15 +77,18 @@ opensminclude_HEADERS = \
 	$(srcdir)/../include/opensm/osm_db_pack.h \
 	$(srcdir)/../include/opensm/osm_event_plugin.h \
 	$(srcdir)/../include/opensm/osm_errors.h \
+	$(srcdir)/../include/opensm/osm_file_ids.h \
+	$(srcdir)/../include/opensm/osm_guid.h \
 	$(srcdir)/../include/opensm/osm_helper.h \
 	$(srcdir)/../include/opensm/osm_inform.h \
+	$(srcdir)/../include/opensm/osm_ucast_lash.h \
 	$(srcdir)/../include/opensm/osm_lid_mgr.h \
 	$(srcdir)/../include/opensm/osm_log.h \
 	$(srcdir)/../include/opensm/osm_mad_pool.h \
 	$(srcdir)/../include/opensm/osm_madw.h \
 	$(srcdir)/../include/opensm/osm_mcast_tbl.h \
-	$(srcdir)/../include/opensm/osm_mcm_info.h \
 	$(srcdir)/../include/opensm/osm_mcm_port.h \
+	$(srcdir)/../include/opensm/osm_mesh.h \
 	$(srcdir)/../include/opensm/osm_mtree.h \
 	$(srcdir)/../include/opensm/osm_multicast.h \
 	$(srcdir)/../include/opensm/osm_msgdef.h \
@@ -93,11 +99,11 @@ opensminclude_HEADERS = \
 	$(srcdir)/../include/opensm/osm_perfmgr.h \
 	$(srcdir)/../include/opensm/osm_perfmgr_db.h \
 	$(srcdir)/../include/opensm/osm_pkey.h \
-	$(srcdir)/../include/opensm/osm_pkey_mgr.h \
 	$(srcdir)/../include/opensm/osm_port.h \
 	$(srcdir)/../include/opensm/osm_port_profile.h \
 	$(srcdir)/../include/opensm/osm_prefix_route.h \
 	$(srcdir)/../include/opensm/osm_qos_policy.h \
+	$(srcdir)/../include/opensm/osm_congestion_control.h \
 	$(srcdir)/../include/opensm/osm_remote_sm.h \
 	$(srcdir)/../include/opensm/osm_router.h \
 	$(srcdir)/../include/opensm/osm_sa.h \
@@ -117,10 +123,10 @@ opensminclude_HEADERS = \
 
 BUILT_SOURCES = osm_version osm_qos_parser_y.h
 osm_version:
-	if [ -x $(top_srcdir)/../gen_ver.sh ] ; then \
+	if [ -x $(top_srcdir)/gen_ver.sh ] ; then \
 		ver_file=$(top_builddir)/include/opensm/osm_version.h ; \
 		osm_ver=`cat $$ver_file | sed -ne '/#define OSM_VERSION /s/^.*\"OpenSM \(.*\)\"$$/\1/p'` ; \
-		ver=`$(top_srcdir)/../gen_ver.sh $(PACKAGE)` ; \
+		ver=`$(top_srcdir)/gen_ver.sh $(PACKAGE)` ; \
 		if [ $$ver != $$osm_ver ] ; then \
 			cat $$ver_file | sed -e '/#define OSM_VERSION /s/\"OpenSM .*\"/\"OpenSM '$$ver'\"/' > tmp_new_version ; \
 			cat tmp_new_version > $$ver_file && rm -f tmp_new_version ; \
diff --git a/opensm/Makefile.in b/opensm/Makefile.in
index f1952ca..055620b 100644
--- a/opensm/Makefile.in
+++ b/opensm/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -18,8 +19,9 @@
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -40,27 +42,44 @@ DIST_COMMON = $(opensminclude_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in ChangeLog osm_qos_parser_l.c \
 	osm_qos_parser_y.c osm_qos_parser_y.h
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
-	$(top_srcdir)/config/ltoptions.m4 \
-	$(top_srcdir)/config/ltsugar.m4 \
-	$(top_srcdir)/config/ltversion.m4 \
-	$(top_srcdir)/config/lt~obsolete.m4 \
-	$(top_srcdir)/config/osmvsel.m4 $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/osmvsel.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/include/config.h \
 	$(top_builddir)/include/opensm/osm_config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sbindir)" \
 	"$(DESTDIR)$(opensmincludedir)"
-libLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(lib_LTLIBRARIES)
 libopensm_la_LIBADD =
 am_libopensm_la_OBJECTS = osm_log.lo osm_mad_pool.lo osm_helper.lo
@@ -68,21 +87,22 @@ libopensm_la_OBJECTS = $(am_libopensm_la_OBJECTS)
 libopensm_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(libopensm_la_LDFLAGS) $(LDFLAGS) -o $@
-sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(sbin_PROGRAMS)
 am_opensm_OBJECTS = main.$(OBJEXT) osm_console_io.$(OBJEXT) \
 	osm_console.$(OBJEXT) osm_db_files.$(OBJEXT) \
 	osm_db_pack.$(OBJEXT) osm_drop_mgr.$(OBJEXT) \
+	osm_guid_info_rcv.$(OBJEXT) osm_guid_mgr.$(OBJEXT) \
 	osm_inform.$(OBJEXT) osm_lid_mgr.$(OBJEXT) \
 	osm_lin_fwd_rcv.$(OBJEXT) osm_link_mgr.$(OBJEXT) \
 	osm_mcast_fwd_rcv.$(OBJEXT) osm_mcast_mgr.$(OBJEXT) \
-	osm_mcast_tbl.$(OBJEXT) osm_mcm_info.$(OBJEXT) \
-	osm_mcm_port.$(OBJEXT) osm_mtree.$(OBJEXT) \
-	osm_multicast.$(OBJEXT) osm_node.$(OBJEXT) \
-	osm_node_desc_rcv.$(OBJEXT) osm_node_info_rcv.$(OBJEXT) \
-	osm_opensm.$(OBJEXT) osm_pkey.$(OBJEXT) osm_pkey_mgr.$(OBJEXT) \
+	osm_mcast_tbl.$(OBJEXT) osm_mcm_port.$(OBJEXT) \
+	osm_mesh.$(OBJEXT) osm_mtree.$(OBJEXT) osm_multicast.$(OBJEXT) \
+	osm_node.$(OBJEXT) osm_node_desc_rcv.$(OBJEXT) \
+	osm_node_info_rcv.$(OBJEXT) osm_opensm.$(OBJEXT) \
+	osm_pkey.$(OBJEXT) osm_pkey_mgr.$(OBJEXT) \
 	osm_pkey_rcv.$(OBJEXT) osm_port.$(OBJEXT) \
-	osm_port_info_rcv.$(OBJEXT) osm_remote_sm.$(OBJEXT) \
+	osm_port_info_rcv.$(OBJEXT) \
+	osm_mlnx_ext_port_info_rcv.$(OBJEXT) osm_remote_sm.$(OBJEXT) \
 	osm_req.$(OBJEXT) osm_resp.$(OBJEXT) osm_sa.$(OBJEXT) \
 	osm_sa_class_port_info.$(OBJEXT) osm_sa_informinfo.$(OBJEXT) \
 	osm_sa_lft_record.$(OBJEXT) osm_sa_mft_record.$(OBJEXT) \
@@ -104,17 +124,23 @@ am_opensm_OBJECTS = main.$(OBJEXT) osm_console_io.$(OBJEXT) \
 	osm_router.$(OBJEXT) osm_trap_rcv.$(OBJEXT) \
 	osm_ucast_mgr.$(OBJEXT) osm_ucast_updn.$(OBJEXT) \
 	osm_ucast_lash.$(OBJEXT) osm_ucast_file.$(OBJEXT) \
-	osm_ucast_ftree.$(OBJEXT) osm_vl15intf.$(OBJEXT) \
-	osm_vl_arb_rcv.$(OBJEXT) st.$(OBJEXT) osm_perfmgr.$(OBJEXT) \
-	osm_perfmgr_db.$(OBJEXT) osm_event_plugin.$(OBJEXT) \
-	osm_dump.$(OBJEXT) osm_ucast_cache.$(OBJEXT) \
-	osm_qos_parser_y.$(OBJEXT) osm_qos_parser_l.$(OBJEXT) \
-	osm_qos_policy.$(OBJEXT)
+	osm_ucast_ftree.$(OBJEXT) osm_torus.$(OBJEXT) \
+	osm_ucast_dnup.$(OBJEXT) osm_ucast_dfsssp.$(OBJEXT) \
+	osm_vl15intf.$(OBJEXT) osm_vl_arb_rcv.$(OBJEXT) st.$(OBJEXT) \
+	osm_perfmgr.$(OBJEXT) osm_perfmgr_db.$(OBJEXT) \
+	osm_event_plugin.$(OBJEXT) osm_dump.$(OBJEXT) \
+	osm_ucast_cache.$(OBJEXT) osm_qos_parser_y.$(OBJEXT) \
+	osm_qos_parser_l.$(OBJEXT) osm_qos_policy.$(OBJEXT) \
+	osm_congestion_control.$(OBJEXT)
 opensm_OBJECTS = $(am_opensm_OBJECTS)
 am__DEPENDENCIES_1 =
+opensm_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(opensm_LDFLAGS) \
+	$(LDFLAGS) -o $@
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/include -I$(top_builddir)/include/opensm
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
+am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
@@ -124,16 +150,15 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
+LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS)
 LTLEXCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS)
+	--mode=compile $(LEX) $(AM_LFLAGS) $(LFLAGS)
 YLWRAP = $(top_srcdir)/config/ylwrap
-YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
+YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS)
 LTYACCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(YACC) $(YFLAGS) $(AM_YFLAGS)
+	--mode=compile $(YACC) $(AM_YFLAGS) $(YFLAGS)
 SOURCES = $(libopensm_la_SOURCES) $(opensm_SOURCES)
 DIST_SOURCES = $(libopensm_la_SOURCES) $(opensm_SOURCES)
-opensmincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(opensminclude_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -154,6 +179,7 @@ CYGPATH_W = @CYGPATH_W@
 DEFAULT_EVENT_PLUGIN = @DEFAULT_EVENT_PLUGIN@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -180,6 +206,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -198,9 +225,11 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PARTITION_CONFIG_FILE = @PARTITION_CONFIG_FILE@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PER_MOD_LOGGING_FILE = @PER_MOD_LOGGING_FILE@
 PREFIX_ROUTES_FILE = @PREFIX_ROUTES_FILE@
 QOS_POLICY_FILE = @QOS_POLICY_FILE@
 RANLIB = @RANLIB@
@@ -210,6 +239,7 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
 TARBALL = @TARBALL@
+TORUS2QOS_CONF_FILE = @TORUS2QOS_CONF_FILE@
 VERSION = @VERSION@
 YACC = @YACC@
 YFLAGS = @YFLAGS@
@@ -219,6 +249,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -251,7 +282,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -280,16 +310,17 @@ libopensm_la_LDFLAGS = -version-info $(opensm_api_version) \
 	-export-dynamic $(libopensm_version_script)
 
 libopensm_la_DEPENDENCIES = $(srcdir)/libopensm.map
+opensm_LDFLAGS = -rdynamic
 opensm_DEPENDENCIES = libopensm.la
 opensm_SOURCES = main.c osm_console_io.c osm_console.c osm_db_files.c \
-		 osm_db_pack.c osm_drop_mgr.c \
-		 osm_inform.c osm_lid_mgr.c osm_lin_fwd_rcv.c \
+		 osm_db_pack.c osm_drop_mgr.c osm_guid_info_rcv.c \
+		 osm_guid_mgr.c 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_info.c \
-		 osm_mcm_port.c osm_mtree.c osm_multicast.c osm_node.c \
+		 osm_mcast_mgr.c osm_mcast_tbl.c \
+		 osm_mcm_port.c osm_mesh.c osm_mtree.c osm_multicast.c osm_node.c \
 		 osm_node_desc_rcv.c osm_node_info_rcv.c \
 		 osm_opensm.c osm_pkey.c osm_pkey_mgr.c osm_pkey_rcv.c \
-		 osm_port.c osm_port_info_rcv.c \
+		 osm_port.c osm_port_info_rcv.c osm_mlnx_ext_port_info_rcv.c \
 		 osm_remote_sm.c osm_req.c \
 		 osm_resp.c osm_sa.c osm_sa_class_port_info.c \
 		 osm_sa_informinfo.c osm_sa_lft_record.c osm_sa_mft_record.c \
@@ -307,10 +338,12 @@ opensm_SOURCES = main.c osm_console_io.c osm_console.c osm_db_files.c \
 		 osm_prtn.c osm_prtn_config.c osm_qos.c osm_router.c \
 		 osm_trap_rcv.c osm_ucast_mgr.c osm_ucast_updn.c \
 		 osm_ucast_lash.c osm_ucast_file.c osm_ucast_ftree.c \
-		 osm_vl15intf.c osm_vl_arb_rcv.c \
-		 st.c osm_perfmgr.c osm_perfmgr_db.c \
+		 osm_torus.c osm_ucast_dnup.c \
+		 osm_ucast_dfsssp.c osm_vl15intf.c \
+		 osm_vl_arb_rcv.c st.c osm_perfmgr.c osm_perfmgr_db.c \
 		 osm_event_plugin.c osm_dump.c osm_ucast_cache.c \
-		 osm_qos_parser_y.y osm_qos_parser_l.l osm_qos_policy.c
+		 osm_qos_parser_y.y osm_qos_parser_l.l osm_qos_policy.c \
+		 osm_congestion_control.c
 
 AM_YFLAGS := -d
 
@@ -327,15 +360,18 @@ opensminclude_HEADERS = \
 	$(srcdir)/../include/opensm/osm_db_pack.h \
 	$(srcdir)/../include/opensm/osm_event_plugin.h \
 	$(srcdir)/../include/opensm/osm_errors.h \
+	$(srcdir)/../include/opensm/osm_file_ids.h \
+	$(srcdir)/../include/opensm/osm_guid.h \
 	$(srcdir)/../include/opensm/osm_helper.h \
 	$(srcdir)/../include/opensm/osm_inform.h \
+	$(srcdir)/../include/opensm/osm_ucast_lash.h \
 	$(srcdir)/../include/opensm/osm_lid_mgr.h \
 	$(srcdir)/../include/opensm/osm_log.h \
 	$(srcdir)/../include/opensm/osm_mad_pool.h \
 	$(srcdir)/../include/opensm/osm_madw.h \
 	$(srcdir)/../include/opensm/osm_mcast_tbl.h \
-	$(srcdir)/../include/opensm/osm_mcm_info.h \
 	$(srcdir)/../include/opensm/osm_mcm_port.h \
+	$(srcdir)/../include/opensm/osm_mesh.h \
 	$(srcdir)/../include/opensm/osm_mtree.h \
 	$(srcdir)/../include/opensm/osm_multicast.h \
 	$(srcdir)/../include/opensm/osm_msgdef.h \
@@ -346,11 +382,11 @@ opensminclude_HEADERS = \
 	$(srcdir)/../include/opensm/osm_perfmgr.h \
 	$(srcdir)/../include/opensm/osm_perfmgr_db.h \
 	$(srcdir)/../include/opensm/osm_pkey.h \
-	$(srcdir)/../include/opensm/osm_pkey_mgr.h \
 	$(srcdir)/../include/opensm/osm_port.h \
 	$(srcdir)/../include/opensm/osm_port_profile.h \
 	$(srcdir)/../include/opensm/osm_prefix_route.h \
 	$(srcdir)/../include/opensm/osm_qos_policy.h \
+	$(srcdir)/../include/opensm/osm_congestion_control.h \
 	$(srcdir)/../include/opensm/osm_remote_sm.h \
 	$(srcdir)/../include/opensm/osm_router.h \
 	$(srcdir)/../include/opensm/osm_sa.h \
@@ -388,9 +424,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  opensm/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  opensm/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign opensm/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign opensm/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -408,23 +444,28 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
 	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
-	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	list2=; for p in $$list; do \
 	  if test -f $$p; then \
-	    f=$(am__strip_dir) \
-	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
-	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	    list2="$$list2 $$p"; \
 	  else :; fi; \
-	done
+	done; \
+	test -z "$$list2" || { \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+	}
 
 uninstall-libLTLIBRARIES:
 	@$(NORMAL_UNINSTALL)
-	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
-	  p=$(am__strip_dir) \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	for p in $$list; do \
+	  $(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
 	done
 
 clean-libLTLIBRARIES:
@@ -435,44 +476,57 @@ clean-libLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libopensm.la: $(libopensm_la_OBJECTS) $(libopensm_la_DEPENDENCIES) 
+libopensm.la: $(libopensm_la_OBJECTS) $(libopensm_la_DEPENDENCIES) $(EXTRA_libopensm_la_DEPENDENCIES) 
 	$(libopensm_la_LINK) -rpath $(libdir) $(libopensm_la_OBJECTS) $(libopensm_la_LIBADD) $(LIBS)
 install-sbinPROGRAMS: $(sbin_PROGRAMS)
 	@$(NORMAL_INSTALL)
 	test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
-	@list='$(sbin_PROGRAMS)'; for p in $$list; do \
-	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
-	  if test -f $$p \
-	     || test -f $$p1 \
-	  ; then \
-	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
-	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
-	  else :; fi; \
-	done
+	@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+	for p in $$list; do echo "$$p $$p"; done | \
+	sed 's/$(EXEEXT)$$//' | \
+	while read p p1; do if test -f $$p || test -f $$p1; \
+	  then echo "$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+	sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
+	    else { print "f", $$3 "/" $$4, $$1; } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	    test -z "$$files" || { \
+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
+	    } \
+	; done
 
 uninstall-sbinPROGRAMS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(sbin_PROGRAMS)'; for p in $$list; do \
-	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
-	  echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(sbindir)/$$f"; \
-	done
+	@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+	      -e 's/$$/$(EXEEXT)/' `; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(sbindir)" && rm -f $$files
 
 clean-sbinPROGRAMS:
-	@list='$(sbin_PROGRAMS)'; for p in $$list; do \
-	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
-	  echo " rm -f $$p $$f"; \
-	  rm -f $$p $$f ; \
-	done
+	@list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
 osm_qos_parser_y.h: osm_qos_parser_y.c
-	@if test ! -f $@; then \
-	  rm -f osm_qos_parser_y.c; \
-	  $(MAKE) $(AM_MAKEFLAGS) osm_qos_parser_y.c; \
-	else :; fi
-opensm$(EXEEXT): $(opensm_OBJECTS) $(opensm_DEPENDENCIES) 
+	@if test ! -f $@; then rm -f osm_qos_parser_y.c; else :; fi
+	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) osm_qos_parser_y.c; else :; fi
+opensm$(EXEEXT): $(opensm_OBJECTS) $(opensm_DEPENDENCIES) $(EXTRA_opensm_DEPENDENCIES) 
 	@rm -f opensm$(EXEEXT)
-	$(LINK) $(opensm_OBJECTS) $(opensm_LDADD) $(LIBS)
+	$(opensm_LINK) $(opensm_OBJECTS) $(opensm_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -481,6 +535,7 @@ distclean-compile:
 	-rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/main.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_congestion_control.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_console.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_console_io.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_db_files.Po at am__quote@
@@ -488,6 +543,8 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_drop_mgr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_dump.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_event_plugin.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_guid_info_rcv.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_guid_mgr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_helper.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_inform.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_lid_mgr.Po at am__quote@
@@ -498,8 +555,9 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_mcast_fwd_rcv.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_mcast_mgr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_mcast_tbl.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_mcm_info.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_mcm_port.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_mesh.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_mlnx_ext_port_info_rcv.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_mtree.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_multicast.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_node.Po at am__quote@
@@ -552,8 +610,11 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_subnet.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_sw_info_rcv.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_switch.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_torus.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_trap_rcv.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_ucast_cache.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_ucast_dfsssp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_ucast_dnup.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_ucast_file.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_ucast_ftree.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/osm_ucast_lash.Po at am__quote@
@@ -565,21 +626,21 @@ distclean-compile:
 
 .c.o:
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 
 .c.lo:
 @am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
@@ -598,20 +659,21 @@ clean-libtool:
 install-opensmincludeHEADERS: $(opensminclude_HEADERS)
 	@$(NORMAL_INSTALL)
 	test -z "$(opensmincludedir)" || $(MKDIR_P) "$(DESTDIR)$(opensmincludedir)"
-	@list='$(opensminclude_HEADERS)'; for p in $$list; do \
+	@list='$(opensminclude_HEADERS)'; test -n "$(opensmincludedir)" || list=; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(opensmincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(opensmincludedir)/$$f'"; \
-	  $(opensmincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(opensmincludedir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(opensmincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(opensmincludedir)" || exit $$?; \
 	done
 
 uninstall-opensmincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(opensminclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(opensmincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(opensmincludedir)/$$f"; \
-	done
+	@list='$(opensminclude_HEADERS)'; test -n "$(opensmincludedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(opensmincludedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -625,7 +687,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -633,29 +695,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -676,13 +743,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -705,16 +776,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -740,6 +817,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -748,18 +827,28 @@ install-data-am: install-opensmincludeHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am: install-libLTLIBRARIES install-sbinPROGRAMS
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
@@ -783,7 +872,7 @@ ps-am:
 uninstall-am: uninstall-libLTLIBRARIES uninstall-opensmincludeHEADERS \
 	uninstall-sbinPROGRAMS
 
-.MAKE: install-am install-strip
+.MAKE: all check install install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
 	clean-libLTLIBRARIES clean-libtool clean-sbinPROGRAMS ctags \
@@ -802,15 +891,16 @@ uninstall-am: uninstall-libLTLIBRARIES uninstall-opensmincludeHEADERS \
 	uninstall-opensmincludeHEADERS uninstall-sbinPROGRAMS
 
 osm_version:
-	if [ -x $(top_srcdir)/../gen_ver.sh ] ; then \
+	if [ -x $(top_srcdir)/gen_ver.sh ] ; then \
 		ver_file=$(top_builddir)/include/opensm/osm_version.h ; \
 		osm_ver=`cat $$ver_file | sed -ne '/#define OSM_VERSION /s/^.*\"OpenSM \(.*\)\"$$/\1/p'` ; \
-		ver=`$(top_srcdir)/../gen_ver.sh $(PACKAGE)` ; \
+		ver=`$(top_srcdir)/gen_ver.sh $(PACKAGE)` ; \
 		if [ $$ver != $$osm_ver ] ; then \
 			cat $$ver_file | sed -e '/#define OSM_VERSION /s/\"OpenSM .*\"/\"OpenSM '$$ver'\"/' > tmp_new_version ; \
 			cat tmp_new_version > $$ver_file && rm -f tmp_new_version ; \
 		fi ; \
 	fi
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/opensm/libopensm.map b/opensm/libopensm.map
index 7cd2aba..e75d424 100644
--- a/opensm/libopensm.map
+++ b/opensm/libopensm.map
@@ -18,31 +18,57 @@ OPENSM_1.5 {
 		ib_get_sm_attr_str;
 		ib_get_sa_attr_str;
 		ib_get_trap_str;
+		ib_zero_gid;
 		osm_dump_port_info;
+		osm_dump_port_info_v2;
 		osm_dump_portinfo_record;
+		osm_dump_portinfo_record_v2;
+		osm_dump_guid_info;
+		osm_dump_guid_info_v2;
 		osm_dump_guidinfo_record;
+		osm_dump_guidinfo_record_v2;
 		osm_dump_node_info;
+		osm_dump_node_info_v2;
 		osm_dump_node_record;
+		osm_dump_node_record_v2;
 		osm_dump_path_record;
+		osm_dump_path_record_v2;
 		osm_dump_multipath_record;
+		osm_dump_multipath_record_v2;
 		osm_dump_mc_record;
+		osm_dump_mc_record_v2;
 		osm_dump_service_record;
+		osm_dump_service_record_v2;
 		osm_dump_inform_info;
+		osm_dump_inform_info_v2;
 		osm_dump_inform_info_record;
+		osm_dump_inform_info_record_v2;
 		osm_dump_link_record;
+		osm_dump_link_record_v2;
 		osm_dump_switch_info;
+		osm_dump_switch_info_v2;
 		osm_dump_switch_info_record;
-		osm_dump_pkey_table;
+		osm_dump_switch_info_record_v2;
 		osm_dump_slvl_map_table;
+		osm_dump_slvl_map_table_v2;
 		osm_dump_vl_arb_table;
+		osm_dump_vl_arb_table_v2;
 		osm_dump_sm_info;
+		osm_dump_sm_info_v2;
 		osm_dump_sm_info_record;
+		osm_dump_sm_info_record_v2;
 		osm_dump_notice;
+		osm_dump_notice_v2;
 		osm_dump_dr_smp;
+		osm_dump_dr_smp_v2;
 		osm_dump_sa_mad;
+		osm_dump_sa_mad_v2;
 		osm_dump_dr_path;
+		osm_dump_dr_path_v2;
 		osm_dump_smp_dr_path;
+		osm_dump_smp_dr_path_v2;
 		osm_dump_pkey_block;
+		osm_dump_pkey_block_v2;
 		osm_log_raw;
 		osm_get_sm_state_str;
 		osm_get_sm_signal_str;
@@ -55,5 +81,18 @@ OPENSM_1.5 {
 		osm_get_lsa_str;
 		osm_get_sm_mgr_signal_str;
 		osm_get_sm_mgr_state_str;
+		ib_mtu_is_valid;
+		ib_rate_is_valid;
+		ib_path_compare_rates;
+		ib_path_rate_get_prev;
+		ib_path_rate_get_next;
+		osm_dump_mlnx_ext_port_info;
+		osm_dump_mlnx_ext_port_info_v2;
+		osm_log_v2;
+		osm_log_msg_box_v2;
+		osm_log_is_active_v2;
+		osm_get_log_per_module;
+		osm_set_log_per_module;
+		osm_reset_log_per_module;
 	local: *;
 };
diff --git a/opensm/libopensm.ver b/opensm/libopensm.ver
index f552dd0..bdb52f6 100644
--- a/opensm/libopensm.ver
+++ b/opensm/libopensm.ver
@@ -6,4 +6,4 @@
 # API_REV - advance on any added API
 # RUNNING_REV - advance any change to the vendor files
 # AGE - number of backward versions the API still supports
-LIBVERSION=3:3:1
+LIBVERSION=6:0:1
diff --git a/opensm/main.c b/opensm/main.c
index 999e92f..e9a0b4c 100644
--- a/opensm/main.c
+++ b/opensm/main.c
@@ -1,7 +1,10 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved.
+ * Copyright (c) 2009-2011 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -52,6 +55,8 @@
 #include <fcntl.h>
 #include <complib/cl_types.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_MAIN_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_version.h>
 #include <opensm/osm_opensm.h>
@@ -64,7 +69,7 @@ volatile unsigned int osm_exit_flag = 0;
 static volatile unsigned int osm_hup_flag = 0;
 static volatile unsigned int osm_usr1_flag = 0;
 
-#define GUID_ARRAY_SIZE 64
+#define MAX_LOCAL_IBPORTS 64
 #define INVALID_GUID (0xFFFFFFFFFFFFFFFFULL)
 
 static void mark_exit_flag(int signum)
@@ -119,9 +124,6 @@ static void setup_signals()
 	pthread_sigmask(SIG_SETMASK, &saved_sigset, NULL);
 }
 
-/**********************************************************************
- **********************************************************************/
-
 static void show_usage(void)
 {
 	printf("\n------- OpenSM - Usage and options ----------------------\n");
@@ -130,7 +132,8 @@ static void show_usage(void)
 	printf("--version\n          Prints OpenSM version and exits.\n\n");
 	printf("--config, -F <file-name>\n"
 	       "          The name of the OpenSM config file. When not specified\n"
-	       "          " OSM_DEFAULT_CONFIG_FILE " will be used (if exists).\n\n");
+	       "          " OSM_DEFAULT_CONFIG_FILE
+	       " will be used (if exists).\n\n");
 	printf("--create-config, -c <file-name>\n"
 	       "          OpenSM will dump its configuration to the specified file and exit.\n"
 	       "          This is a way to generate OpenSM configuration file template.\n\n");
@@ -174,10 +177,23 @@ static void show_usage(void)
 	       "          Min Hop algorithm.  Multiple routing engines can be specified\n"
 	       "          separated by commas so that specific ordering of routing\n"
 	       "          algorithms will be tried if earlier routing engines fail.\n"
-	       "          Supported engines: updn, file, ftree, lash, dor\n\n");
+	       "          If all configured routing engines fail, OpenSM will always\n"
+	       "          attempt to route with Min Hop unless 'no_fallback' is\n"
+	       "          included in the list of routing engines.\n"
+	       "          Supported engines: updn, dnup, file, ftree, lash, dor, torus-2QoS, dfsssp, sssp\n\n");
+	printf("--do_mesh_analysis\n"
+	       "          This option enables additional analysis for the lash\n"
+	       "          routing engine to precondition switch port assignments\n"
+	       "          in regular cartesian meshes which may reduce the number\n"
+	       "          of SLs required to give a deadlock free routing\n\n");
+	printf("--lash_start_vl <vl number>\n"
+	       "          Sets the starting VL to use for the lash routing algorithm.\n"
+	       "          Defaults to 0.\n");
+	printf("--sm_sl <sl number>\n"
+	       "          Sets the SL to use to communicate with the SM/SA. Defaults to 0.\n\n");
 	printf("--connect_roots, -z\n"
-	       "          This option enforces a routing engine (currently\n"
-	       "          up/down only) to make connectivity between root switches\n"
+	       "          This option enforces routing engines (up/down and \n"
+	       "          fat-tree) to make connectivity between root switches\n"
 	       "          and in this way be IBA compliant. In many cases,\n"
 	       "          this can violate \"pure\" deadlock free algorithm, so\n"
 	       "          use it carefully.\n\n");
@@ -207,6 +223,17 @@ static void show_usage(void)
 	printf("--cn_guid_file, -u <path to file>\n"
 	       "          Set the compute nodes for the Fat-Tree routing algorithm\n"
 	       "          to the guids provided in the given file (one to a line)\n\n");
+	printf("--io_guid_file, -G <path to file>\n"
+	       "          Set the I/O nodes for the Fat-Tree routing algorithm\n"
+	       "          to the guids provided in the given file (one to a line)\n\n");
+	printf("--port-shifting\n"
+	       "          Attempt to shift port routes around to remove alignment problems\n"
+	       "          in routing tables\n\n");
+	printf("--scatter-ports <random seed>\n"
+	       "          Randomize best port chosen for a route\n\n");
+	printf("--max_reverse_hops, -H <hop_count>\n"
+	       "          Set the max number of hops the wrong way around\n"
+	       "          an I/O node is allowed to do (connectivity for I/O nodes on top swithces)\n\n");
 	printf("--ids_guid_file, -m <path to file>\n"
 	       "          Name of the map file with set of the IDs which will be used\n"
 	       "          by Up/Down routing algorithm instead of node GUIDs\n"
@@ -215,6 +242,10 @@ static void show_usage(void)
 	       "          Set the order port guids will be routed for the MinHop\n"
 	       "          and Up/Down routing algorithms to the guids provided in the\n"
 	       "          given file (one to a line)\n\n");
+	printf("--torus_config <path to file>\n"
+	       "          This option defines the file name for the extra configuration\n"
+	       "          info needed for the torus-2QoS routing engine.   The default\n"
+	       "          name is \'"OSM_DEFAULT_TORUS_CONF_FILE"\'\n\n");
 	printf("--once, -o\n"
 	       "          This option causes OpenSM to configure the subnet\n"
 	       "          once, then exit.  Ports remain in the ACTIVE state.\n\n");
@@ -226,9 +257,14 @@ static void show_usage(void)
 	printf("--timeout, -t <milliseconds>\n"
 	       "          This option specifies the time in milliseconds\n"
 	       "          used for transaction timeouts.\n"
-	       "          Specifying -t 0 disables timeouts.\n"
+	       "          Timeout values should be > 0.\n"
 	       "          Without -t, OpenSM defaults to a timeout value of\n"
 	       "          200 milliseconds.\n\n");
+	printf("--retries <number>\n"
+	       "          This option specifies the number of retries used\n"
+	       "          for transactions.\n"
+	       "          Without --retries, OpenSM defaults to %u retries\n"
+	       "          for transactions.\n\n", OSM_DEFAULT_RETRY_COUNT);
 	printf("--maxsmps, -n <number>\n"
 	       "          This option specifies the number of VL15 SMP MADs\n"
 	       "          allowed on the wire at any one time.\n"
@@ -237,11 +273,14 @@ static void show_usage(void)
 	       "          Without --maxsmps, OpenSM defaults to a maximum of\n"
 	       "          4 outstanding SMPs.\n\n");
 	printf("--console, -q [off|local"
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
+	       "|loopback"
+#endif
 #ifdef ENABLE_OSM_CONSOLE_SOCKET
-	       "|socket|loopback"
+	       "|socket"
 #endif
 	       "]\n          This option activates the OpenSM console (default off).\n\n");
-#ifdef ENABLE_OSM_CONSOLE_SOCKET
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
 	printf("--console-port, -C <port>\n"
 	       "          Specify an alternate telnet port for the console (default %d).\n\n",
 	       OSM_DEFAULT_CONSOLE_PORT);
@@ -250,6 +289,21 @@ static void show_usage(void)
 	       "          This option provides the means to define a set of ports\n"
 	       "          (by guid) that will be ignored by the link load\n"
 	       "          equalization algorithm.\n\n");
+	printf("--hop_weights_file, -w <path to file>\n"
+	       "          This option provides the means to define a weighting\n"
+	       "          factor per port for customizing the least weight\n"
+	       "          hops for the routing.\n\n");
+	printf("--port_search_ordering_file, -O <path to file>\n"
+	       "          This option provides the means to define a mapping\n"
+	       "          between ports and dimension (Order) for controlling\n"
+	       "          Dimension Order Routing (DOR).\n"
+	       "          Moreover this option provides the means to define non\n"
+	       "          default routing port order.\n\n");
+	printf("--dimn_ports_file, -O <path to file> (DEPRECATED)\n"
+	       "          Use --port_search_ordering_file instead.\n"
+	       "          This option provides the means to define a mapping\n"
+	       "          between ports and dimension (Order) for controlling\n"
+	       "          Dimension Order Routing (DOR).\n\n");
 	printf("--honor_guid2lid, -x\n"
 	       "          This option forces OpenSM to honor the guid2lid file,\n"
 	       "          when it comes out of Standby state, if such file exists\n"
@@ -270,13 +324,27 @@ static void show_usage(void)
 	       "          This option defines the optional partition configuration file.\n"
 	       "          The default name is \'"
 	       OSM_DEFAULT_PARTITION_CONFIG_FILE "\'.\n\n");
-	printf("--no_part_enforce, -N\n"
+	printf("--no_part_enforce, -N (DEPRECATED)\n"
+	       "          Use --part_enforce instead.\n"
 	       "          This option disables partition enforcement on switch external ports.\n\n");
+	printf("--part_enforce, -Z [both, in, out, off]\n"
+	       "          This option indicates the partition enforcement type (for switches)\n"
+	       "          Enforcement type can be outbound only (out), inbound only (in), both or\n"
+	       "          disabled (off). Default is both.\n\n");
+	printf("--allow_both_pkeys, -W\n"
+	       "          This option indicates whether both full and limited membership\n"
+	       "          on the same partition can be configured in the PKeyTable.\n"
+	       "          Default is not to allow both pkeys.\n\n");
 	printf("--qos, -Q\n" "          This option enables QoS setup.\n\n");
 	printf("--qos_policy_file, -Y <QoS-policy-file>\n"
 	       "          This option defines the optional QoS policy file.\n"
 	       "          The default name is \'" OSM_DEFAULT_QOS_POLICY_FILE
 	       "\'.\n\n");
+	printf("--congestion_control\n"
+	       "          (EXPERIMENTAL) This option enables congestion control configuration.\n\n");
+	printf("--cc_key <key>\n"
+	       "          (EXPERIMENTAL) This option configures the CCkey to use when configuring\n"
+	       "          congestion control.\n\n");
 	printf("--stay_on_fatal, -y\n"
 	       "          This option will cause SM not to exit on fatal initialization\n"
 	       "          issues: if SM discovers duplicated guids or 12x link with\n"
@@ -297,8 +365,10 @@ static void show_usage(void)
 	       "          queries for off-subnet DGIDs.  Default file is:\n"
 	       "              " OSM_DEFAULT_PREFIX_ROUTES_FILE "\n\n");
 	printf("--consolidate_ipv6_snm_req\n"
-	       "          Consolidate IPv6 Solicited Node Multicast group joins\n"
-	       "          into 1 IB multicast group.\n\n");
+	       "          Use shared MLID for IPv6 Solicited Node Multicast groups\n"
+	       "          per MGID scope and P_Key.\n\n");
+	printf("--log_prefix <prefix text>\n"
+	       "          Prefix to syslog messages from OpenSM.\n\n");
 	printf("--verbose, -v\n"
 	       "          This option increases the log verbosity level.\n"
 	       "          The -v option may be specified multiple times\n"
@@ -350,41 +420,38 @@ static void show_usage(void)
 	exit(2);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_net64_t get_port_guid(IN osm_opensm_t * p_osm, uint64_t port_guid)
 {
-	ib_port_attr_t attr_array[GUID_ARRAY_SIZE];
-	uint32_t num_ports = GUID_ARRAY_SIZE;
-	char junk[128];
+	ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS];
+	uint32_t num_ports = MAX_LOCAL_IBPORTS;
 	uint32_t i, choice = 0;
-	boolean_t done_flag = FALSE;
 	ib_api_status_t status;
 
-	/*
-	   Call the transport layer for a list of local port
-	   GUID values.
-	 */
-	status =
-	    osm_vendor_get_all_port_attr(p_osm->p_vendor, attr_array,
-					 &num_ports);
+	for (i = 0; i < num_ports; i++) {
+		attr_array[i].num_pkeys = 0;
+		attr_array[i].p_pkey_table = NULL;
+	}
+
+	/* Call the transport layer for a list of local port GUID values */
+	status = osm_vendor_get_all_port_attr(p_osm->p_vendor, attr_array,
+					      &num_ports);
 	if (status != IB_SUCCESS) {
 		printf("\nError from osm_vendor_get_all_port_attr (%x)\n",
 		       status);
-		return (0);
+		return 0;
 	}
 
 	/* if num_ports is 0 - return 0 */
 	if (num_ports == 0) {
 		printf("\nNo local ports detected!\n");
-		return (0);
+		return 0;
 	}
 	/* If num_ports is 1, then there is only one possible port to use.
 	 * Use it. */
 	if (num_ports == 1) {
 		printf("Using default GUID 0x%" PRIx64 "\n",
 		       cl_hton64(attr_array[0].port_guid));
-		return (attr_array[0].port_guid);
+		return attr_array[0].port_guid;
 	}
 	/* If port_guid is 0 - use the first connected port */
 	if (port_guid == 0) {
@@ -395,7 +462,7 @@ static ib_net64_t get_port_guid(IN osm_opensm_t * p_osm, uint64_t port_guid)
 			i = 0;
 		printf("Using default GUID 0x%" PRIx64 "\n",
 		       cl_hton64(attr_array[i].port_guid));
-		return (attr_array[i].port_guid);
+		return attr_array[i].port_guid;
 	}
 
 	if (p_osm->subn.opt.daemon)
@@ -403,41 +470,34 @@ static ib_net64_t get_port_guid(IN osm_opensm_t * p_osm, uint64_t port_guid)
 
 	/* More than one possible port - list all ports and let the user
 	 * to choose. */
-	while (done_flag == FALSE) {
+	while (1) {
 		printf("\nChoose a local port number with which to bind:\n\n");
 		for (i = 0; i < num_ports; i++)
 			/* Print the index + 1 since by convention, port
 			 * numbers start with 1 on host channel adapters. */
-			printf("\t%u: GUID 0x%" PRIx64
-			       ", lid %u, state %s\n", i + 1,
-			       cl_ntoh64(attr_array[i].port_guid),
+			printf("\t%u: GUID 0x%" PRIx64 ", lid %u, state %s\n",
+			       i + 1, cl_ntoh64(attr_array[i].port_guid),
 			       attr_array[i].lid,
 			       ib_get_port_state_str(attr_array[i].link_state));
-		printf("\nEnter choice (1-%u): ", i);
+		printf("\n\t0: Exit\n");
+		printf("\nEnter choice (0-%u): ", i);
 		fflush(stdout);
-		if (scanf("%u", &choice)) {
-			if (choice > num_ports || choice < 1) {
-				printf("\nError: Lame choice!\n");
-				fflush(stdin);
-			} else {
-				choice--;
-				done_flag = TRUE;
-			}
-		} else {
-			/* get rid of the junk in the selection line */
-			scanf("%s", junk);
-			printf("\nError: Lame choice!\n");
-			fflush(stdin);
-		}
+		if (scanf("%u", &choice) <= 0) {
+			char junk[128];
+			if (scanf("%s", junk) <= 0)
+				printf("\nError: Cannot scan!\n");
+		} else if (choice == 0)
+			return 0;
+		else if (choice <= num_ports)
+			break;
+		printf("\nError: Lame choice! Please try again.\n");
 	}
+	choice--;
 	printf("Choice guid=0x%" PRIx64 "\n",
 	       cl_ntoh64(attr_array[choice].port_guid));
-	return (attr_array[choice].port_guid);
+	return attr_array[choice].port_guid;
 }
 
-/**********************************************************************
- **********************************************************************/
-
 static int daemonize(osm_opensm_t * osm)
 {
 	pid_t pid;
@@ -474,8 +534,6 @@ static int daemonize(osm_opensm_t * osm)
 	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
 int osm_manager_loop(osm_subn_opt_t * p_opt, osm_opensm_t * p_osm)
 {
 	int console_init_flag = 0;
@@ -489,9 +547,10 @@ int osm_manager_loop(osm_subn_opt_t * p_opt, osm_opensm_t * p_osm)
 	   Sit here forever - dwell or do console i/o & cmds
 	 */
 	while (!osm_exit_flag) {
-		if (console_init_flag)
-			osm_console(p_osm);
-		else
+		if (console_init_flag) {
+			if (osm_console(p_osm))
+				console_init_flag = 0;
+		} else
 			cl_thread_suspend(10000);
 
 		if (osm_usr1_flag) {
@@ -510,8 +569,10 @@ int osm_manager_loop(osm_subn_opt_t * p_opt, osm_opensm_t * p_osm)
 	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
+#define SET_STR_OPT(opt, val) do { \
+	opt = val ? strdup(val) : NULL ; \
+} while (0)
+
 int main(int argc, char *argv[])
 {
 	osm_opensm_t osm;
@@ -521,12 +582,11 @@ int main(int argc, char *argv[])
 	uint32_t temp, dbg_lvl;
 	boolean_t run_once_flag = FALSE;
 	int32_t vendor_debug = 0;
-	uint32_t next_option;
-	char *conf_template = NULL;
+	int next_option;
+	char *conf_template = NULL, *config_file = NULL;
 	uint32_t val;
-	unsigned config_file_done = 0;
 	const char *const short_option =
-	    "F:c:i:f:ed:D:g:l:L:s:t:a:u:m:X:R:zM:U:S:P:Y:ANBIQvVhoryxp:n:q:k:C:";
+	    "F:c:i:w:O:f:ed:D:g:l:L:s:t:a:u:m:X:R:zM:U:S:P:Y:ANZ:WBIQvVhoryxp:n:q:k:C:G:H:";
 
 	/*
 	   In the array below, the 2nd parameter specifies the number
@@ -542,6 +602,9 @@ int main(int argc, char *argv[])
 		{"debug", 1, NULL, 'd'},
 		{"guid", 1, NULL, 'g'},
 		{"ignore_guids", 1, NULL, 'i'},
+		{"hop_weights_file", 1, NULL, 'w'},
+		{"dimn_ports_file", 1, NULL, 'O'},
+		{"port_search_ordering_file", 1, NULL, 'O'},
 		{"lmc", 1, NULL, 'l'},
 		{"sweep", 1, NULL, 's'},
 		{"timeout", 1, NULL, 't'},
@@ -552,8 +615,12 @@ int main(int argc, char *argv[])
 		{"erase_log_file", 0, NULL, 'e'},
 		{"Pconfig", 1, NULL, 'P'},
 		{"no_part_enforce", 0, NULL, 'N'},
+		{"part_enforce", 1, NULL, 'Z'},
+		{"allow_both_pkeys", 0, NULL, 'W'},
 		{"qos", 0, NULL, 'Q'},
 		{"qos_policy_file", 1, NULL, 'Y'},
+		{"congestion_control", 0, NULL, 128},
+		{"cc_key", 1, NULL, 129},
 		{"maxsmps", 1, NULL, 'n'},
 		{"console", 1, NULL, 'q'},
 		{"V", 0, NULL, 'V'},
@@ -570,11 +637,15 @@ int main(int argc, char *argv[])
 		{"sadb_file", 1, NULL, 'S'},
 		{"root_guid_file", 1, NULL, 'a'},
 		{"cn_guid_file", 1, NULL, 'u'},
+		{"io_guid_file", 1, NULL, 'G'},
+		{"port-shifting", 0, NULL, 11},
+		{"scatter-ports", 1, NULL, 14},
+		{"max_reverse_hops", 1, NULL, 'H'},
 		{"ids_guid_file", 1, NULL, 'm'},
 		{"guid_routing_order_file", 1, NULL, 'X'},
 		{"stay_on_fatal", 0, NULL, 'y'},
 		{"honor_guid2lid", 0, NULL, 'x'},
-#ifdef ENABLE_OSM_CONSOLE_SOCKET
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
 		{"console-port", 1, NULL, 'C'},
 #endif
 		{"daemon", 0, NULL, 'B'},
@@ -585,9 +656,18 @@ int main(int argc, char *argv[])
 #endif
 		{"prefix_routes_file", 1, NULL, 3},
 		{"consolidate_ipv6_snm_req", 0, NULL, 4},
+		{"do_mesh_analysis", 0, NULL, 5},
+		{"lash_start_vl", 1, NULL, 6},
+		{"sm_sl", 1, NULL, 7},
+		{"retries", 1, NULL, 8},
+		{"log_prefix", 1, NULL, 9},
+		{"torus_config", 1, NULL, 10},
 		{NULL, 0, NULL, 0}	/* Required at the end of the array */
 	};
 
+	/* force stdout to be line-buffered */
+	setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
+
 	/* Make sure that the opensm and complib were compiled using
 	   same modes (debug/free) */
 	if (osm_is_debug() != cl_is_debug()) {
@@ -597,37 +677,42 @@ int main(int argc, char *argv[])
 			osm_is_debug(), cl_is_debug());
 		exit(1);
 	}
-#if defined (_DEBUG_) && defined (OSM_VENDOR_INTF_OPENIB)
-	enable_stack_dump(1);
-#endif
 
 	printf("-------------------------------------------------\n");
 	printf("%s\n", OSM_VERSION);
 
+	do {
+		next_option = getopt_long_only(argc, argv, short_option,
+					       long_option, NULL);
+		switch (next_option) {
+		case 'F':
+			config_file = optarg;
+			printf("Config file is `%s`:\n", config_file);
+			break;
+		default:
+			break;
+		}
+	} while (next_option != -1);
+
+	optind = 0;		/* reset command line */
+
+	if (!config_file)
+		config_file = OSM_DEFAULT_CONFIG_FILE;
+
 	osm_subn_set_default_opt(&opt);
 
-	if (osm_subn_parse_conf_file(OSM_DEFAULT_CONFIG_FILE, &opt) < 0)
-		printf("\nosm_subn_parse_conf_file failed!\n");
+	if (osm_subn_parse_conf_file(config_file, &opt) < 0)
+		printf("\nFail to parse config file \'%s\'\n", config_file);
 
 	printf("Command Line Arguments:\n");
 	do {
 		next_option = getopt_long_only(argc, argv, short_option,
 					       long_option, NULL);
 		switch (next_option) {
-		case 12: /* --version - already printed above */
+		case 12:	/* --version - already printed above */
 			exit(0);
 			break;
 		case 'F':
-			if (config_file_done)
-				break;
-			printf("Reloading config from `%s`:\n", optarg);
-			if (osm_subn_parse_conf_file(optarg, &opt)) {
-				printf("cannot parse config file.\n");
-				exit(1);
-			}
-			printf("Rescaning command line:\n");
-			config_file_done = 1;
-			optind = 0;
 			break;
 		case 'c':
 			conf_template = optarg;
@@ -654,11 +739,23 @@ int main(int argc, char *argv[])
 			/*
 			   Specifies ignore guids file.
 			 */
-			opt.port_prof_ignore_file = optarg;
+			SET_STR_OPT(opt.port_prof_ignore_file, optarg);
 			printf(" Ignore Guids File = %s\n",
 			       opt.port_prof_ignore_file);
 			break;
 
+		case 'w':
+			SET_STR_OPT(opt.hop_weights_file, optarg);
+			printf(" Hop Weights File = %s\n",
+			       opt.hop_weights_file);
+			break;
+
+		case 'O':
+			SET_STR_OPT(opt.port_search_ordering_file, optarg);
+			printf(" Port Search Ordering/Dimension Ports File = %s\n",
+			       opt.port_search_ordering_file);
+			break;
+
 		case 'g':
 			/*
 			   Specifies port guid with which to bind.
@@ -687,14 +784,21 @@ int main(int argc, char *argv[])
 			break;
 
 		case 't':
-			opt.transaction_timeout = strtol(optarg, NULL, 0);
-			printf(" Transaction timeout = %d\n",
-			       opt.transaction_timeout);
+			val = strtoul(optarg, NULL, 0);
+			opt.transaction_timeout = strtoul(optarg, NULL, 0);
+			if (val == 0)
+				fprintf(stderr, "ERROR: timeout value 0 is invalid. Ignoring it.\n");
+			else {
+				opt.transaction_timeout = val;
+				printf(" Transaction timeout = %u\n",
+				       opt.transaction_timeout);
+			}
 			break;
 
 		case 'n':
-			opt.max_wire_smps = strtol(optarg, NULL, 0);
-			if (opt.max_wire_smps <= 0)
+			opt.max_wire_smps = strtoul(optarg, NULL, 0);
+			if (opt.max_wire_smps == 0 ||
+			    opt.max_wire_smps > 0x7FFFFFFF)
 				opt.max_wire_smps = 0x7FFFFFFF;
 			printf(" Max wire smp's = %d\n", opt.max_wire_smps);
 			break;
@@ -707,16 +811,18 @@ int main(int argc, char *argv[])
 			    || strcmp(optarg, OSM_LOCAL_CONSOLE) == 0
 #ifdef ENABLE_OSM_CONSOLE_SOCKET
 			    || strcmp(optarg, OSM_REMOTE_CONSOLE) == 0
+#endif
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
 			    || strcmp(optarg, OSM_LOOPBACK_CONSOLE) == 0
 #endif
 			    )
-				opt.console = optarg;
+				SET_STR_OPT(opt.console, optarg);
 			else
 				printf("-console %s option not understood\n",
 				       optarg);
 			break;
 
-#ifdef ENABLE_OSM_CONSOLE_SOCKET
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
 		case 'C':
 			opt.console_port = strtol(optarg, NULL, 0);
 			break;
@@ -751,11 +857,11 @@ int main(int argc, char *argv[])
 			break;
 
 		case 'l':
-			temp = strtol(optarg, NULL, 0);
+			temp = strtoul(optarg, NULL, 0);
 			if (temp > 7) {
 				fprintf(stderr,
 					"ERROR: LMC must be 7 or less.\n");
-				return (-1);
+				return -1;
 			}
 			opt.lmc = (uint8_t) temp;
 			printf(" LMC = %d\n", temp);
@@ -767,13 +873,12 @@ int main(int argc, char *argv[])
 			break;
 
 		case 'f':
-			opt.log_file = optarg;
+			SET_STR_OPT(opt.log_file, optarg);
 			break;
 
 		case 'L':
-			opt.log_max_size =
-			    strtoul(optarg, NULL, 0) * (1024 * 1024);
-			printf(" Log file max size is %lu bytes\n",
+			opt.log_max_size = strtoul(optarg, NULL, 0);
+			printf(" Log file max size is %lu MBytes\n",
 			       opt.log_max_size);
 			break;
 
@@ -783,22 +888,54 @@ int main(int argc, char *argv[])
 			break;
 
 		case 'P':
-			opt.partition_config_file = optarg;
+			SET_STR_OPT(opt.partition_config_file, optarg);
 			break;
 
 		case 'N':
 			opt.no_partition_enforcement = TRUE;
 			break;
 
+		case 'Z':
+			if (strcmp(optarg, OSM_PARTITION_ENFORCE_BOTH) == 0
+			    || strcmp(optarg, OSM_PARTITION_ENFORCE_IN) == 0
+			    || strcmp(optarg, OSM_PARTITION_ENFORCE_OUT) == 0
+			    || strcmp(optarg, OSM_PARTITION_ENFORCE_OFF) == 0) {
+				SET_STR_OPT(opt.part_enforce, optarg);
+				if (strcmp(optarg, OSM_PARTITION_ENFORCE_BOTH) == 0)
+					opt.part_enforce_enum = OSM_PARTITION_ENFORCE_TYPE_BOTH;
+				else if (strcmp(optarg, OSM_PARTITION_ENFORCE_IN) == 0)
+					opt.part_enforce_enum = OSM_PARTITION_ENFORCE_TYPE_IN;
+				else if (strcmp(optarg, OSM_PARTITION_ENFORCE_OUT) == 0)
+					opt.part_enforce_enum = OSM_PARTITION_ENFORCE_TYPE_OUT;
+				else
+					opt.part_enforce_enum = OSM_PARTITION_ENFORCE_TYPE_OFF;
+			} else
+				printf("-part_enforce %s option not understood\n",
+				       optarg);
+			break;
+
+		case 'W':
+			opt.allow_both_pkeys = TRUE;
+			break;
+
 		case 'Q':
 			opt.qos = TRUE;
 			break;
 
 		case 'Y':
-			opt.qos_policy_file = optarg;
+			SET_STR_OPT(opt.qos_policy_file, optarg);
 			printf(" QoS policy file \'%s\'\n", optarg);
 			break;
 
+		case 128:
+			opt.congestion_control = TRUE;
+			break;
+
+		case 129:
+			opt.cc_key = strtoull(optarg, NULL, 0);
+			printf(" CC Key 0x%" PRIx64 "\n", opt.cc_key);
+			break;
+
 		case 'y':
 			opt.exit_on_fatal = FALSE;
 			printf(" Staying on fatal initialization errors\n");
@@ -817,11 +954,11 @@ int main(int argc, char *argv[])
 			break;
 
 		case 'p':
-			temp = strtol(optarg, NULL, 0);
-			if (0 > temp || 15 < temp) {
+			temp = strtoul(optarg, NULL, 0);
+			if (temp > 15) {
 				fprintf(stderr,
 					"ERROR: priority must be between 0 and 15\n");
-				return (-1);
+				return -1;
 			}
 			opt.sm_priority = (uint8_t) temp;
 			printf(" Priority = %d\n", temp);
@@ -834,7 +971,7 @@ int main(int argc, char *argv[])
 			break;
 
 		case 'R':
-			opt.routing_engine_names = optarg;
+			SET_STR_OPT(opt.routing_engine_names, optarg);
 			printf(" Activate \'%s\' routing engine(s)\n", optarg);
 			break;
 
@@ -849,47 +986,56 @@ int main(int argc, char *argv[])
 			break;
 
 		case 'M':
-			opt.lid_matrix_dump_file = optarg;
+			SET_STR_OPT(opt.lid_matrix_dump_file, optarg);
 			printf(" Lid matrix dump file is \'%s\'\n", optarg);
 			break;
 
 		case 'U':
-			opt.lfts_file = optarg;
+			SET_STR_OPT(opt.lfts_file, optarg);
 			printf(" LFTs file is \'%s\'\n", optarg);
 			break;
 
 		case 'S':
-			opt.sa_db_file = optarg;
+			SET_STR_OPT(opt.sa_db_file, optarg);
 			printf(" SA DB file is \'%s\'\n", optarg);
 			break;
 
 		case 'a':
-			/*
-			   Specifies root guids file
-			 */
-			opt.root_guid_file = optarg;
+			SET_STR_OPT(opt.root_guid_file, optarg);
 			printf(" Root Guid File: %s\n", opt.root_guid_file);
 			break;
 
 		case 'u':
-			/*
-			   Specifies compute node guids file
-			 */
-			opt.cn_guid_file = optarg;
+			SET_STR_OPT(opt.cn_guid_file, optarg);
 			printf(" Compute Node Guid File: %s\n",
 			       opt.cn_guid_file);
 			break;
 
+		case 'G':
+			SET_STR_OPT(opt.io_guid_file, optarg);
+			printf(" I/O Node Guid File: %s\n", opt.io_guid_file);
+			break;
+		case 11:
+			opt.port_shifting = TRUE;
+			printf(" Port Shifting is on\n");
+			break;
+		case 14:
+			opt.scatter_ports = strtol(optarg, NULL, 0);
+			printf(" Scatter Ports is on\n");
+			break;
+		case 'H':
+			opt.max_reverse_hops = atoi(optarg);
+			printf(" Max Reverse Hops: %d\n", opt.max_reverse_hops);
+			break;
 		case 'm':
-			/* Specifies ids guid file */
-			opt.ids_guid_file = optarg;
+			SET_STR_OPT(opt.ids_guid_file, optarg);
 			printf(" IDs Guid File: %s\n", opt.ids_guid_file);
 			break;
 
 		case 'X':
-			/* Specifies guid routing order file */
-			opt.guid_routing_order_file = optarg;
-			printf(" GUID Routing Order File: %s\n", opt.guid_routing_order_file);
+			SET_STR_OPT(opt.guid_routing_order_file, optarg);
+			printf(" GUID Routing Order File: %s\n",
+			       opt.guid_routing_order_file);
 			break;
 
 		case 'x':
@@ -917,11 +1063,47 @@ int main(int argc, char *argv[])
 #endif				/* ENABLE_OSM_PERF_MGR */
 
 		case 3:
-			opt.prefix_routes_file = optarg;
+			SET_STR_OPT(opt.prefix_routes_file, optarg);
 			break;
 		case 4:
 			opt.consolidate_ipv6_snm_req = TRUE;
 			break;
+		case 5:
+			opt.do_mesh_analysis = TRUE;
+			break;
+		case 6:
+			temp = strtoul(optarg, NULL, 0);
+			if (temp >= IB_MAX_NUM_VLS) {
+				fprintf(stderr,
+					"ERROR: starting lash vl must be between 0 and 15\n");
+				return -1;
+			}
+			opt.lash_start_vl = (uint8_t) temp;
+			printf(" LASH starting VL = %d\n", opt.lash_start_vl);
+			break;
+		case 7:
+			temp = strtoul(optarg, NULL, 0);
+			if (temp > 15) {
+				fprintf(stderr,
+					"ERROR: SM's SL must be between 0 and 15\n");
+				return -1;
+			}
+			opt.sm_sl = (uint8_t) temp;
+			printf(" SMSL = %d\n", opt.sm_sl);
+			break;
+		case 8:
+			opt.transaction_retries = strtoul(optarg, NULL, 0);
+			printf(" Transaction retries = %u\n",
+			       opt.transaction_retries);
+			break;
+		case 9:
+			SET_STR_OPT(opt.log_prefix, optarg);
+			printf("Log prefix = %s\n", opt.log_prefix);
+			break;
+		case 10:
+			SET_STR_OPT(opt.torus_conf_file, optarg);
+			printf("Torus-2QoS config file = %s\n", opt.torus_conf_file);
+			break;
 		case 'h':
 		case '?':
 		case ':':
@@ -933,8 +1115,7 @@ int main(int argc, char *argv[])
 		default:	/* something wrong */
 			abort();
 		}
-	}
-	while (next_option != -1);
+	} while (next_option != -1);
 
 	if (opt.log_file != NULL)
 		printf(" Log File: %s\n", opt.log_file);
@@ -955,8 +1136,14 @@ int main(int argc, char *argv[])
 
 	block_signals();
 
-	if (opt.daemon)
+	if (opt.daemon) {
+		if (INVALID_GUID == opt.guid) {
+			fprintf(stderr,
+				"ERROR: Invalid GUID specified; exiting because of daemon mode\n");
+			return -1;
+		}
 		daemonize(&osm);
+	}
 
 	complib_init();
 
@@ -969,7 +1156,7 @@ int main(int argc, char *argv[])
 		/* We will just exit, and not go to Exit, since we don't
 		   want the destroy to be called. */
 		complib_exit();
-		return (status);
+		return status;
 	}
 
 	/*
@@ -979,6 +1166,9 @@ int main(int argc, char *argv[])
 	if (opt.guid == 0 || cl_hton64(opt.guid) == CL_HTON64(INVALID_GUID))
 		opt.guid = get_port_guid(&osm, opt.guid);
 
+	if (opt.guid == 0)
+		goto Exit;
+
 	status = osm_opensm_bind(&osm, opt.guid);
 	if (status != IB_SUCCESS) {
 		printf("\nError from osm_opensm_bind (0x%X)\n", status);
diff --git a/opensm/osm_congestion_control.c b/opensm/osm_congestion_control.c
new file mode 100644
index 0000000..8be333d
--- /dev/null
+++ b/opensm/osm_congestion_control.c
@@ -0,0 +1,746 @@
+/*
+ * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2012 Lawrence Livermore National Lab.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+/*
+ * Abstract:
+ *    OSM Congestion Control configuration implementation
+ *
+ * Author:
+ *    Albert Chu, LLNL
+ */
+
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif				/* HAVE_CONFIG_H */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <iba/ib_types.h>
+#include <complib/cl_debug.h>
+#include <opensm/osm_subnet.h>
+#include <opensm/osm_opensm.h>
+#include <opensm/osm_log.h>
+#include <opensm/osm_subnet.h>
+#include <opensm/osm_congestion_control.h>
+
+#define CONGESTION_CONTROL_INITIAL_TID_VALUE 0x7A93
+
+static void cc_mad_post(osm_congestion_control_t *p_cc,
+			osm_madw_t *p_madw,
+			osm_node_t *p_node,
+			osm_physp_t *p_physp,
+			ib_net16_t attr_id,
+			ib_net32_t attr_mod)
+{
+	osm_subn_opt_t *p_opt = &p_cc->subn->opt;
+	ib_cc_mad_t *p_cc_mad;
+	uint8_t port;
+
+	OSM_LOG_ENTER(p_cc->log);
+
+	port = osm_physp_get_port_num(p_physp);
+
+	p_cc_mad = osm_madw_get_cc_mad_ptr(p_madw);
+
+	p_cc_mad->header.base_ver = 1;
+	p_cc_mad->header.mgmt_class = IB_MCLASS_CC;
+	p_cc_mad->header.class_ver = 2;
+	p_cc_mad->header.method = IB_MAD_METHOD_SET;
+	p_cc_mad->header.status = 0;
+	p_cc_mad->header.class_spec = 0;
+	p_cc_mad->header.trans_id =
+		cl_hton64((uint64_t) cl_atomic_inc(&p_cc->trans_id) &
+			  (uint64_t) (0xFFFFFFFF));
+	if (p_cc_mad->header.trans_id == 0)
+		p_cc_mad->header.trans_id =
+			cl_hton64((uint64_t) cl_atomic_inc(&p_cc->trans_id) &
+				  (uint64_t) (0xFFFFFFFF));
+	p_cc_mad->header.attr_id = attr_id;
+	p_cc_mad->header.resv = 0;
+	p_cc_mad->header.attr_mod = attr_mod;
+
+	p_cc_mad->cc_key = p_opt->cc_key;
+
+	memset(p_cc_mad->log_data, '\0', IB_CC_LOG_DATA_SIZE);
+
+	p_madw->mad_addr.dest_lid = osm_node_get_base_lid(p_node, port);
+	p_madw->mad_addr.addr_type.gsi.remote_qp = IB_QP1;
+	p_madw->mad_addr.addr_type.gsi.remote_qkey =
+		cl_hton32(IB_QP1_WELL_KNOWN_Q_KEY);
+	p_madw->resp_expected = TRUE;
+	p_madw->fail_msg = CL_DISP_MSGID_NONE;
+
+	p_madw->context.cc_context.node_guid = osm_node_get_node_guid(p_node);
+	p_madw->context.cc_context.port_guid = osm_physp_get_port_guid(p_physp);
+	p_madw->context.cc_context.port = port;
+	p_madw->context.cc_context.mad_method = IB_MAD_METHOD_SET;
+	p_madw->context.cc_context.attr_mod = attr_mod;
+
+	cl_spinlock_acquire(&p_cc->mad_queue_lock);
+	cl_atomic_inc(&p_cc->outstanding_mads);
+	cl_qlist_insert_tail(&p_cc->mad_queue, &p_madw->list_item);
+	cl_spinlock_release(&p_cc->mad_queue_lock);
+
+	cl_event_signal(&p_cc->cc_poller_wakeup);
+
+	OSM_LOG_EXIT(p_cc->log);
+}
+
+static void cc_setup_mad_data(osm_sm_t * p_sm)
+{
+	osm_congestion_control_t *p_cc = &p_sm->p_subn->p_osm->cc;
+	osm_subn_opt_t *p_opt = &p_sm->p_subn->opt;
+	uint16_t ccti_limit;
+	int i;
+
+	/* Switch Congestion Setting */
+	p_cc->sw_cong_setting.control_map = p_opt->cc_sw_cong_setting_control_map;
+
+	memcpy(p_cc->sw_cong_setting.victim_mask,
+	       p_opt->cc_sw_cong_setting_victim_mask,
+	       IB_CC_PORT_MASK_DATA_SIZE);
+
+	memcpy(p_cc->sw_cong_setting.credit_mask,
+	       p_opt->cc_sw_cong_setting_credit_mask,
+	       IB_CC_PORT_MASK_DATA_SIZE);
+
+	/* threshold is 4 bits, takes up upper nibble of byte */
+	p_cc->sw_cong_setting.threshold_resv = (p_opt->cc_sw_cong_setting_threshold << 4);
+
+	p_cc->sw_cong_setting.packet_size = p_opt->cc_sw_cong_setting_packet_size;
+
+	/* cs threshold is 4 bits, takes up upper nibble of short */
+	p_cc->sw_cong_setting.cs_threshold_resv =
+		cl_hton16(p_opt->cc_sw_cong_setting_credit_starvation_threshold << 12);
+
+	p_cc->sw_cong_setting.cs_return_delay =
+		cl_hton16(p_opt->cc_sw_cong_setting_credit_starvation_return_delay.shift << 14
+			  | p_opt->cc_sw_cong_setting_credit_starvation_return_delay.multiplier);
+
+	p_cc->sw_cong_setting.marking_rate = p_opt->cc_sw_cong_setting_marking_rate;
+
+	/* CA Congestion Setting */
+	p_cc->ca_cong_setting.port_control = p_opt->cc_ca_cong_setting_port_control;
+	p_cc->ca_cong_setting.control_map = p_opt->cc_ca_cong_setting_control_map;
+
+	for (i = 0; i < IB_CA_CONG_ENTRY_DATA_SIZE; i++) {
+		ib_ca_cong_entry_t *p_entry;
+
+		p_entry = &p_cc->ca_cong_setting.entry_list[i];
+
+		p_entry->ccti_timer = p_opt->cc_ca_cong_entries[i].ccti_timer;
+		p_entry->ccti_increase = p_opt->cc_ca_cong_entries[i].ccti_increase;
+		p_entry->trigger_threshold = p_opt->cc_ca_cong_entries[i].trigger_threshold;
+		p_entry->ccti_min = p_opt->cc_ca_cong_entries[i].ccti_min;
+		p_entry->resv0 = 0;
+		p_entry->resv1 = 0;
+	}
+
+	/* Congestion Control Table */
+
+	/* if no entries, we will always send atleast 1 mad to set ccti_limit = 0 */
+	if (!p_opt->cc_cct.entries_len)
+		p_cc->cc_tbl_mads = 1;
+	else {
+		p_cc->cc_tbl_mads = p_opt->cc_cct.entries_len - 1;
+		p_cc->cc_tbl_mads /= IB_CC_TBL_ENTRY_LIST_MAX;
+		p_cc->cc_tbl_mads += 1;
+	}
+
+	CL_ASSERT(p_cc->cc_tbl_mads <= OSM_CCT_ENTRY_MAD_BLOCKS);
+
+	if (!p_opt->cc_cct.entries_len)
+		ccti_limit = 0;
+	else
+		ccti_limit = p_opt->cc_cct.entries_len - 1;
+
+	for (i = 0; i < p_cc->cc_tbl_mads; i++) {
+		int j;
+
+		p_cc->cc_tbl[i].ccti_limit = cl_hton16(ccti_limit);
+		p_cc->cc_tbl[i].resv = 0;
+
+		memset(p_cc->cc_tbl[i].entry_list,
+		       '\0',
+		       sizeof(p_cc->cc_tbl[i].entry_list));
+
+		if (!ccti_limit)
+			break;
+
+		for (j = 0; j < IB_CC_TBL_ENTRY_LIST_MAX; j++) {
+			int k;
+
+			k = (i * IB_CC_TBL_ENTRY_LIST_MAX) + j;
+			p_cc->cc_tbl[i].entry_list[j].shift_multiplier =
+				cl_hton16(p_opt->cc_cct.entries[k].shift << 14
+					  | p_opt->cc_cct.entries[k].multiplier);
+		}
+	}
+}
+
+static ib_api_status_t cc_send_sw_cong_setting(osm_sm_t * p_sm,
+					       osm_node_t *p_node)
+{
+	osm_congestion_control_t *p_cc = &p_sm->p_subn->p_osm->cc;
+	unsigned force_update;
+	osm_physp_t *p_physp;
+	osm_madw_t *p_madw = NULL;
+	ib_cc_mad_t *p_cc_mad = NULL;
+	ib_sw_cong_setting_t *p_sw_cong_setting = NULL;
+
+	OSM_LOG_ENTER(p_sm->p_log);
+
+	p_physp = osm_node_get_physp_ptr(p_node, 0);
+
+	force_update = p_physp->need_update || p_sm->p_subn->need_update;
+
+	if (!force_update
+	    && !memcmp(&p_cc->sw_cong_setting,
+		       &p_physp->cc.sw.sw_cong_setting,
+		       sizeof(p_cc->sw_cong_setting)))
+		return IB_SUCCESS;
+
+	p_madw = osm_mad_pool_get(p_cc->mad_pool, p_cc->bind_handle,
+				  MAD_BLOCK_SIZE, NULL);
+	if (p_madw == NULL) {
+		OSM_LOG(p_sm->p_log, OSM_LOG_ERROR, "ERR C101: "
+			"failed to allocate mad\n");
+		return IB_INSUFFICIENT_MEMORY;
+	}
+
+	p_cc_mad = osm_madw_get_cc_mad_ptr(p_madw);
+
+	p_sw_cong_setting = ib_cc_mad_get_mgt_data_ptr(p_cc_mad);
+
+	memcpy(p_sw_cong_setting,
+	       &p_cc->sw_cong_setting,
+	       sizeof(p_cc->sw_cong_setting));
+
+	cc_mad_post(p_cc, p_madw, p_node, p_physp,
+		    IB_MAD_ATTR_SW_CONG_SETTING, 0);
+
+	OSM_LOG_EXIT(p_sm->p_log);
+
+	return IB_SUCCESS;
+}
+
+static ib_api_status_t cc_send_ca_cong_setting(osm_sm_t * p_sm,
+					       osm_node_t *p_node,
+					       osm_physp_t *p_physp)
+{
+	osm_congestion_control_t *p_cc = &p_sm->p_subn->p_osm->cc;
+	unsigned force_update;
+	osm_madw_t *p_madw = NULL;
+	ib_cc_mad_t *p_cc_mad = NULL;
+	ib_ca_cong_setting_t *p_ca_cong_setting = NULL;
+
+	OSM_LOG_ENTER(p_sm->p_log);
+
+	force_update = p_physp->need_update || p_sm->p_subn->need_update;
+
+	if (!force_update
+	    && !memcmp(&p_cc->ca_cong_setting,
+		       &p_physp->cc.ca.ca_cong_setting,
+		       sizeof(p_cc->ca_cong_setting)))
+		return IB_SUCCESS;
+
+	p_madw = osm_mad_pool_get(p_cc->mad_pool, p_cc->bind_handle,
+				  MAD_BLOCK_SIZE, NULL);
+	if (p_madw == NULL) {
+		OSM_LOG(p_sm->p_log, OSM_LOG_ERROR, "ERR C102: "
+			"failed to allocate mad\n");
+		return IB_INSUFFICIENT_MEMORY;
+	}
+
+	p_cc_mad = osm_madw_get_cc_mad_ptr(p_madw);
+
+	p_ca_cong_setting = ib_cc_mad_get_mgt_data_ptr(p_cc_mad);
+
+	memcpy(p_ca_cong_setting,
+	       &p_cc->ca_cong_setting,
+	       sizeof(p_cc->ca_cong_setting));
+
+	cc_mad_post(p_cc, p_madw, p_node, p_physp,
+		    IB_MAD_ATTR_CA_CONG_SETTING, 0);
+
+	OSM_LOG_EXIT(p_sm->p_log);
+
+	return IB_SUCCESS;
+}
+
+static ib_api_status_t cc_send_cct(osm_sm_t * p_sm,
+				   osm_node_t *p_node,
+				   osm_physp_t *p_physp)
+{
+	osm_congestion_control_t *p_cc = &p_sm->p_subn->p_osm->cc;
+	unsigned force_update;
+	osm_madw_t *p_madw = NULL;
+	ib_cc_mad_t *p_cc_mad = NULL;
+	ib_cc_tbl_t *p_cc_tbl = NULL;
+	unsigned int index = 0;
+
+	OSM_LOG_ENTER(p_sm->p_log);
+
+	force_update = p_physp->need_update || p_sm->p_subn->need_update;
+
+	for (index = 0; index < p_cc->cc_tbl_mads; index++) {
+		if (!force_update
+		    && !memcmp(&p_cc->cc_tbl[index],
+			       &p_physp->cc.ca.cc_tbl[index],
+			       sizeof(p_cc->cc_tbl[index])))
+			continue;
+
+		p_madw = osm_mad_pool_get(p_cc->mad_pool, p_cc->bind_handle,
+					  MAD_BLOCK_SIZE, NULL);
+		if (p_madw == NULL) {
+			OSM_LOG(p_sm->p_log, OSM_LOG_ERROR, "ERR C103: "
+				"failed to allocate mad\n");
+			return IB_INSUFFICIENT_MEMORY;
+		}
+
+		p_cc_mad = osm_madw_get_cc_mad_ptr(p_madw);
+
+		p_cc_tbl = (ib_cc_tbl_t *)ib_cc_mad_get_mgt_data_ptr(p_cc_mad);
+
+		memcpy(p_cc_tbl,
+		       &p_cc->cc_tbl[index],
+		       sizeof(p_cc->cc_tbl[index]));
+
+		cc_mad_post(p_cc, p_madw, p_node, p_physp,
+			    IB_MAD_ATTR_CC_TBL, cl_hton32(index));
+	}
+
+	OSM_LOG_EXIT(p_sm->p_log);
+
+	return IB_SUCCESS;
+}
+
+int osm_congestion_control_setup(struct osm_opensm *p_osm)
+{
+	cl_qmap_t *p_tbl;
+	cl_map_item_t *p_next;
+	int ret = 0;
+
+	if (!p_osm->subn.opt.congestion_control)
+		return 0;
+
+	OSM_LOG_ENTER(&p_osm->log);
+
+	/*
+	 * Do nothing unless the most recent routing attempt was successful.
+	 */
+	if (!p_osm->sm.p_subn->p_osm->routing_engine_used)
+		return 0;
+
+	cc_setup_mad_data(&p_osm->sm);
+
+	cl_plock_acquire(&p_osm->lock);
+
+	p_tbl = &p_osm->subn.port_guid_tbl;
+	p_next = cl_qmap_head(p_tbl);
+	while (p_next != cl_qmap_end(p_tbl)) {
+		osm_port_t *p_port = (osm_port_t *) p_next;
+		osm_node_t *p_node = p_port->p_node;
+		ib_api_status_t status;
+
+		p_next = cl_qmap_next(p_next);
+
+		if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH) {
+			status = cc_send_sw_cong_setting(&p_osm->sm, p_node);
+			if (status != IB_SUCCESS)
+				ret = -1;
+		} else if (osm_node_get_type(p_node) == IB_NODE_TYPE_CA) {
+			status = cc_send_ca_cong_setting(&p_osm->sm,
+							 p_node,
+							 p_port->p_physp);
+			if (status != IB_SUCCESS)
+				ret = -1;
+
+			status = cc_send_cct(&p_osm->sm,
+					     p_node,
+					     p_port->p_physp);
+			if (status != IB_SUCCESS)
+				ret = -1;
+		}
+	}
+
+	cl_plock_release(&p_osm->lock);
+
+	OSM_LOG_EXIT(&p_osm->log);
+
+	return ret;
+}
+
+int osm_congestion_control_wait_pending_transactions(struct osm_opensm *p_osm)
+{
+	osm_congestion_control_t *cc = &p_osm->sm.p_subn->p_osm->cc;
+
+	if (!p_osm->subn.opt.congestion_control)
+		return 0;
+
+	while (1) {
+		unsigned count = cc->outstanding_mads;
+		if (!count || osm_exit_flag)
+			break;
+		cl_event_wait_on(&cc->outstanding_mads_done_event,
+				 EVENT_NO_TIMEOUT,
+				 TRUE);
+	}
+
+	return osm_exit_flag;
+}
+
+static inline void decrement_outstanding_mads(osm_congestion_control_t *p_cc)
+{
+	uint32_t outstanding;
+
+	outstanding = cl_atomic_dec(&p_cc->outstanding_mads);
+	if (!outstanding)
+		cl_event_signal(&p_cc->outstanding_mads_done_event);
+
+	cl_atomic_dec(&p_cc->outstanding_mads_on_wire);
+	cl_event_signal(&p_cc->sig_mads_on_wire_continue);
+}
+
+
+static void cc_rcv_mad(void *context, void *data)
+{
+	osm_congestion_control_t *p_cc = context;
+	osm_opensm_t *p_osm = p_cc->osm;
+	osm_madw_t *p_madw = data;
+	ib_cc_mad_t *p_cc_mad;
+	osm_madw_context_t *p_mad_context = &p_madw->context;
+	ib_mad_t *p_mad = osm_madw_get_mad_ptr(p_madw);
+	uint64_t node_guid = p_mad_context->cc_context.node_guid;
+	uint64_t port_guid = p_mad_context->cc_context.port_guid;
+	uint8_t port = p_mad_context->cc_context.port;
+	osm_port_t *p_port;
+
+	OSM_LOG_ENTER(p_cc->log);
+
+	OSM_LOG(p_cc->log, OSM_LOG_VERBOSE,
+		"Processing received MAD status 0x%x context 0x%"
+		PRIx64 "port %u\n", p_mad->status, node_guid, port);
+
+	p_cc_mad = osm_madw_get_cc_mad_ptr(p_madw);
+
+	cl_plock_acquire(&p_osm->lock);
+
+	p_port = osm_get_port_by_guid(p_cc->subn, port_guid);
+	if (!p_port) {
+		OSM_LOG(p_cc->log, OSM_LOG_ERROR, "ERR C109: "
+			"Port guid not in table 0x%" PRIx64 "\n",
+			   port_guid);
+		cl_plock_release(&p_osm->lock);
+		goto Exit;
+	}
+
+	if (p_cc_mad->header.attr_id == IB_MAD_ATTR_SW_CONG_SETTING) {
+		ib_sw_cong_setting_t *p_sw_cong_setting;
+
+		p_sw_cong_setting = ib_cc_mad_get_mgt_data_ptr(p_cc_mad);
+		p_port->p_physp->cc.sw.sw_cong_setting = *p_sw_cong_setting;
+	}
+	else if (p_cc_mad->header.attr_id == IB_MAD_ATTR_CA_CONG_SETTING) {
+		ib_ca_cong_setting_t *p_ca_cong_setting;
+
+		p_ca_cong_setting = ib_cc_mad_get_mgt_data_ptr(p_cc_mad);
+		p_port->p_physp->cc.ca.ca_cong_setting = *p_ca_cong_setting;
+	}
+	else if (p_cc_mad->header.attr_id == IB_MAD_ATTR_CC_TBL) {
+		ib_net32_t attr_mod = p_mad_context->cc_context.attr_mod;
+		uint32_t index = cl_ntoh32(attr_mod);
+		ib_cc_tbl_t *p_cc_tbl;
+
+		p_cc_tbl = ib_cc_mad_get_mgt_data_ptr(p_cc_mad);
+		p_port->p_physp->cc.ca.cc_tbl[index] = *p_cc_tbl;
+	}
+	else
+		OSM_LOG(p_cc->log, OSM_LOG_ERROR, "ERR C10A: "
+			"Unexpected MAD attribute received: %u\n",
+			   p_cc_mad->header.attr_id);
+
+	cl_plock_release(&p_osm->lock);
+
+Exit:
+	decrement_outstanding_mads(p_cc);
+	osm_mad_pool_put(p_cc->mad_pool, p_madw);
+	OSM_LOG_EXIT(p_cc->log);
+}
+
+static void cc_poller_send(osm_congestion_control_t *p_cc,
+			   osm_madw_t *p_madw)
+{
+	osm_subn_opt_t *p_opt = &p_cc->subn->opt;
+	ib_api_status_t status;
+
+	status = osm_vendor_send(p_cc->bind_handle, p_madw, TRUE);
+	if (status == IB_SUCCESS) {
+		cl_atomic_inc(&p_cc->outstanding_mads_on_wire);
+		if (p_cc->outstanding_mads_on_wire >
+		    p_opt->cc_max_outstanding_mads)
+			cl_event_wait_on(&p_cc->sig_mads_on_wire_continue,
+					 EVENT_NO_TIMEOUT,
+					 TRUE);
+	}
+	else {
+		osm_madw_context_t *mad_context = &p_madw->context;
+
+		OSM_LOG(p_cc->log, OSM_LOG_ERROR, "ERR C104: "
+			"send failed to node 0x%" PRIx64 "port %u\n",
+			mad_context->cc_context.node_guid,
+			mad_context->cc_context.port);
+	}
+}
+
+static void cc_poller(void *p_ptr)
+{
+	osm_congestion_control_t *p_cc = p_ptr;
+	osm_madw_t *p_madw;
+
+	OSM_LOG_ENTER(p_cc->log);
+
+	if (p_cc->thread_state == OSM_THREAD_STATE_NONE)
+		p_cc->thread_state = OSM_THREAD_STATE_RUN;
+
+	while (p_cc->thread_state == OSM_THREAD_STATE_RUN) {
+		cl_spinlock_acquire(&p_cc->mad_queue_lock);
+
+		p_madw = (osm_madw_t *) cl_qlist_remove_head(&p_cc->mad_queue);
+
+		cl_spinlock_release(&p_cc->mad_queue_lock);
+
+		if (p_madw != (osm_madw_t *) cl_qlist_end(&p_cc->mad_queue))
+			cc_poller_send(p_cc, p_madw);
+		else
+			cl_event_wait_on(&p_cc->cc_poller_wakeup,
+					 EVENT_NO_TIMEOUT, TRUE);
+	}
+
+	OSM_LOG_EXIT(p_cc->log);
+}
+
+ib_api_status_t osm_congestion_control_init(osm_congestion_control_t * p_cc,
+					    struct osm_opensm *p_osm,
+					    const osm_subn_opt_t * p_opt)
+{
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(&p_osm->log);
+
+	memset(p_cc, 0, sizeof(*p_cc));
+
+	p_cc->osm = p_osm;
+	p_cc->subn = &p_osm->subn;
+	p_cc->sm = &p_osm->sm;
+	p_cc->log = &p_osm->log;
+	p_cc->mad_pool = &p_osm->mad_pool;
+	p_cc->trans_id = CONGESTION_CONTROL_INITIAL_TID_VALUE;
+	p_cc->vendor = p_osm->p_vendor;
+
+	p_cc->cc_disp_h = cl_disp_register(&p_osm->disp, OSM_MSG_MAD_CC,
+					   cc_rcv_mad, p_cc);
+	if (p_cc->cc_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	cl_qlist_init(&p_cc->mad_queue);
+
+	status = cl_spinlock_init(&p_cc->mad_queue_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	cl_event_construct(&p_cc->cc_poller_wakeup);
+	status = cl_event_init(&p_cc->cc_poller_wakeup, FALSE);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	cl_event_construct(&p_cc->outstanding_mads_done_event);
+	status = cl_event_init(&p_cc->outstanding_mads_done_event, FALSE);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	cl_event_construct(&p_cc->sig_mads_on_wire_continue);
+	status = cl_event_init(&p_cc->sig_mads_on_wire_continue, FALSE);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	p_cc->thread_state = OSM_THREAD_STATE_NONE;
+
+	status = cl_thread_init(&p_cc->cc_poller, cc_poller, p_cc,
+				"cc poller");
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = IB_SUCCESS;
+Exit:
+	OSM_LOG_EXIT(p_cc->log);
+	return status;
+}
+
+static void cc_mad_recv_callback(osm_madw_t * p_madw, void *bind_context,
+				 osm_madw_t * p_req_madw)
+{
+	osm_congestion_control_t *p_cc = bind_context;
+
+	OSM_LOG_ENTER(p_cc->log);
+
+	osm_madw_copy_context(p_madw, p_req_madw);
+	osm_mad_pool_put(p_cc->mad_pool, p_req_madw);
+
+	/* Do not decrement outstanding mads here, do it in the dispatcher */
+
+	if (cl_disp_post(p_cc->cc_disp_h, OSM_MSG_MAD_CC,
+			 p_madw, NULL, NULL) != CL_SUCCESS) {
+		OSM_LOG(p_cc->log, OSM_LOG_ERROR, "ERR C105: "
+			"Congestion Control Dispatcher post failed\n");
+		osm_mad_pool_put(p_cc->mad_pool, p_madw);
+	}
+
+	OSM_LOG_EXIT(p_cc->log);
+}
+
+static void cc_mad_send_err_callback(void *bind_context,
+				     osm_madw_t * p_madw)
+{
+	osm_congestion_control_t *p_cc = bind_context;
+	osm_madw_context_t *p_madw_context = &p_madw->context;
+	uint64_t node_guid = p_madw_context->cc_context.node_guid;
+	uint8_t port = p_madw_context->cc_context.port;
+
+	OSM_LOG_ENTER(p_cc->log);
+
+	OSM_LOG(p_cc->log, OSM_LOG_ERROR, "ERR C106: MAD Error (%s): "
+		"attr id = %u LID %u GUID 0x%016" PRIx64 " port %u "
+		"TID 0x%" PRIx64 "\n",
+		ib_get_err_str(p_madw->status),
+		p_madw->p_mad->attr_id,
+		cl_ntoh16(p_madw->mad_addr.dest_lid),
+		node_guid,
+		port,
+		cl_ntoh64(p_madw->p_mad->trans_id));
+
+	p_cc->subn->subnet_initialization_error = TRUE;
+
+	osm_mad_pool_put(p_cc->mad_pool, p_madw);
+
+	decrement_outstanding_mads(p_cc);
+
+	OSM_LOG_EXIT(p_cc->log);
+}
+
+ib_api_status_t osm_congestion_control_bind(osm_congestion_control_t * p_cc,
+					    ib_net64_t port_guid)
+{
+	osm_bind_info_t bind_info;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_cc->log);
+
+	bind_info.port_guid = p_cc->port_guid = port_guid;
+	bind_info.mad_class = IB_MCLASS_CC;
+	bind_info.class_version = 2;
+	bind_info.is_responder = FALSE;
+	bind_info.is_report_processor = FALSE;
+	bind_info.is_trap_processor = FALSE;
+	bind_info.recv_q_size = OSM_SM_DEFAULT_QP1_RCV_SIZE;
+	bind_info.send_q_size = OSM_SM_DEFAULT_QP1_SEND_SIZE;
+	bind_info.timeout = p_cc->subn->opt.transaction_timeout;
+	bind_info.retries = p_cc->subn->opt.transaction_retries;
+
+	OSM_LOG(p_cc->log, OSM_LOG_VERBOSE,
+		"Binding to port GUID 0x%" PRIx64 "\n", cl_ntoh64(port_guid));
+
+	p_cc->bind_handle = osm_vendor_bind(p_cc->vendor, &bind_info,
+					    p_cc->mad_pool,
+					    cc_mad_recv_callback,
+					    cc_mad_send_err_callback, p_cc);
+
+	if (p_cc->bind_handle == OSM_BIND_INVALID_HANDLE) {
+		status = IB_ERROR;
+		OSM_LOG(p_cc->log, OSM_LOG_ERROR,
+			"ERR C107: Vendor specific bind failed (%s)\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+Exit:
+	OSM_LOG_EXIT(p_cc->log);
+	return status;
+}
+
+void osm_congestion_control_shutdown(osm_congestion_control_t * p_cc)
+{
+	OSM_LOG_ENTER(p_cc->log);
+	if (p_cc->bind_handle == OSM_BIND_INVALID_HANDLE) {
+		OSM_LOG(p_cc->log, OSM_LOG_ERROR,
+			"ERR C108: No previous bind\n");
+		goto Exit;
+	}
+	cl_disp_unregister(p_cc->cc_disp_h);
+Exit:
+	OSM_LOG_EXIT(p_cc->log);
+}
+
+void osm_congestion_control_destroy(osm_congestion_control_t * p_cc)
+{
+	osm_madw_t *p_madw;
+
+	OSM_LOG_ENTER(p_cc->log);
+
+	p_cc->thread_state = OSM_THREAD_STATE_EXIT;
+
+	cl_event_signal(&p_cc->sig_mads_on_wire_continue);
+	cl_event_signal(&p_cc->cc_poller_wakeup);
+
+	cl_thread_destroy(&p_cc->cc_poller);
+
+	cl_spinlock_acquire(&p_cc->mad_queue_lock);
+
+	while (!cl_is_qlist_empty(&p_cc->mad_queue)) {
+		p_madw = (osm_madw_t *) cl_qlist_remove_head(&p_cc->mad_queue);
+		osm_mad_pool_put(p_cc->mad_pool, p_madw);
+	}
+
+	cl_spinlock_release(&p_cc->mad_queue_lock);
+
+	cl_spinlock_destroy(&p_cc->mad_queue_lock);
+
+	cl_event_destroy(&p_cc->cc_poller_wakeup);
+	cl_event_destroy(&p_cc->outstanding_mads_done_event);
+	cl_event_destroy(&p_cc->sig_mads_on_wire_continue);
+
+	OSM_LOG_EXIT(p_cc->log);
+}
diff --git a/opensm/osm_console.c b/opensm/osm_console.c
index 5727cea..b0f7f48 100644
--- a/opensm/osm_console.c
+++ b/opensm/osm_console.c
@@ -1,5 +1,7 @@
 /*
- * Copyright (c) 2005-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2005-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2009,2010 HNR Consulting. All rights reserved.
+ * Copyright (c) 2010,2011 Mellanox Technologies LTD. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -42,18 +44,23 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
-#ifdef ENABLE_OSM_CONSOLE_SOCKET
+#include <regex.h>
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
 #include <arpa/inet.h>
 #endif
 #include <unistd.h>
 #include <errno.h>
 #include <ctype.h>
 #include <sys/time.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_CONSOLE_C
 #include <opensm/osm_console.h>
 #include <complib/cl_passivelock.h>
 #include <opensm/osm_perfmgr.h>
 #include <opensm/osm_subnet.h>
 
+extern void osm_update_node_desc(IN osm_opensm_t *osm);
+
 struct command {
 	char *name;
 	void (*help_function) (FILE * out, int detail);
@@ -67,15 +74,22 @@ static struct {
 	time_t previous;
 	void (*loop_function) (osm_opensm_t * p_osm, FILE * out);
 } loop_command = {
-on: 0, delay_s: 2, loop_function:NULL};
+.on = 0, .delay_s = 2, .loop_function = NULL};
 
 static const struct command console_cmds[];
 
-static inline char *next_token(char **p_last)
+static char *next_token(char **p_last)
 {
 	return strtok_r(NULL, " \t\n\r", p_last);
 }
 
+#ifdef ENABLE_OSM_PERF_MGR
+static char *name_token(char **p_last)
+{
+	return strtok_r(NULL, "\t\n\r", p_last);
+}
+#endif
+
 static void help_command(FILE * out, int detail)
 {
 	int i;
@@ -121,6 +135,11 @@ static void help_loglevel(FILE * out, int detail)
 	}
 }
 
+static void help_permodlog(FILE * out, int detail)
+{
+	fprintf(out, "permodlog\n");
+}
+
 static void help_priority(FILE * out, int detail)
 {
 	fprintf(out, "priority [<sm-priority>]\n");
@@ -139,6 +158,16 @@ static void help_reroute(FILE * out, int detail)
 	}
 }
 
+static void help_sweep(FILE * out, int detail)
+{
+	fprintf(out, "sweep [on|off]\n");
+	if (detail) {
+		fprintf(out, "enable or disable sweeping\n");
+		fprintf(out, "   [on] sweep normally\n");
+		fprintf(out, "   [off] inhibit all sweeping\n");
+	}
+}
+
 static void help_status(FILE * out, int detail)
 {
 	fprintf(out, "status [loop]\n");
@@ -198,11 +227,22 @@ static void help_dump_conf(FILE *out, int detail)
 	}
 }
 
+static void help_update_desc(FILE *out, int detail)
+{
+	fprintf(out, "update_desc\n");
+	if (detail) {
+		fprintf(out, "update node description for all nodes\n");
+	}
+}
+
 #ifdef ENABLE_OSM_PERF_MGR
 static void help_perfmgr(FILE * out, int detail)
 {
 	fprintf(out,
-		"perfmgr [enable|disable|clear_counters|dump_counters|sweep_time[seconds]]\n");
+		"perfmgr(pm) [enable|disable\n"
+		"             |clear_counters|dump_counters|print_counters(pc)|print_errors(pe)\n"
+		"             |set_rm_nodes|clear_rm_nodes|clear_inactive\n"
+		"             |dump_redir|clear_redir|sweep_time[seconds]]\n");
 	if (detail) {
 		fprintf(out,
 			"perfmgr -- print the performance manager state\n");
@@ -215,9 +255,31 @@ static void help_perfmgr(FILE * out, int detail)
 		fprintf(out,
 			"   [dump_counters [mach]] -- dump the counters (optionally in [mach]ine readable format)\n");
 		fprintf(out,
-			"   [print_counters <nodename|nodeguid>] -- print the counters for the specified node\n");
+			"   [print_counters [<nodename|nodeguid>][:<port>]] -- print the internal counters\n"
+			"                                                      Optionaly limit output by name, guid, or port\n");
+		fprintf(out,
+			"   [pc [<nodename|nodeguid>][:<port>]] -- same as print_counters\n");
+		fprintf(out,
+			"   [print_errors [<nodename|nodeguid>]] -- print only ports with errors\n"
+			"                                           Optionaly limit output by name or guid\n");
+		fprintf(out,
+			"   [pe [<nodename|nodeguid>]] -- same as print_errors\n");
+		fprintf(out,
+			"   [dump_redir [<nodename|nodeguid>]] -- dump the redirection table\n");
+		fprintf(out,
+			"   [clear_redir [<nodename|nodeguid>]] -- clear the redirection table\n");
+		fprintf(out,
+			"   [[set|clear]_rm_nodes] -- enable/disable the removal of \"inactive\" nodes from the DB\n"
+			"                             Inactive nodes are those which no longer appear on the fabric\n");
+		fprintf(out,
+			"   [clear_inactive] -- Delete inactive nodes from the DB\n");
 	}
 }
+static void help_pm(FILE *out, int detail)
+{
+	if (detail)
+		help_perfmgr(out, detail);
+}
 #endif				/* ENABLE_OSM_PERF_MGR */
 
 /* more help routines go here */
@@ -274,6 +336,31 @@ static void loglevel_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 	}
 }
 
+static void permodlog_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
+{
+	FILE *fp;
+	char buf[1024];
+
+	if (p_osm->subn.opt.per_module_logging_file != NULL) {
+		fp = fopen(p_osm->subn.opt.per_module_logging_file, "r");
+		if (!fp) {
+			if (errno == ENOENT)
+				return;
+			fprintf(out, "fopen(%s) failed: %s\n",
+				p_osm->subn.opt.per_module_logging_file,
+				strerror(errno));
+			return;
+		}
+
+		fprintf(out, "Per module logging file: %s\n",
+			p_osm->subn.opt.per_module_logging_file);
+		while (fgets(buf, sizeof buf, fp) != NULL)
+			fprintf(out, "%s", buf);
+		fclose(fp);
+		fprintf(out, "\n");
+	}
+}
+
 static void priority_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 {
 	char *p_cmd;
@@ -296,48 +383,95 @@ static void priority_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 	}
 }
 
-static char *sm_state_str(int state)
+static const char *sm_state_str(int state)
 {
 	switch (state) {
 	case IB_SMINFO_STATE_DISCOVERING:
-		return ("Discovering");
+		return "Discovering";
 	case IB_SMINFO_STATE_STANDBY:
-		return ("Standby");
+		return "Standby    ";
 	case IB_SMINFO_STATE_NOTACTIVE:
-		return ("Not Active");
+		return "Not Active ";
 	case IB_SMINFO_STATE_MASTER:
-		return ("Master");
+		return "Master     ";
 	}
-	return ("UNKNOWN");
+	return "UNKNOWN    ";
 }
 
-static char *sa_state_str(osm_sa_state_t state)
+static const char *sa_state_str(osm_sa_state_t state)
 {
 	switch (state) {
 	case OSM_SA_STATE_INIT:
-		return ("Init");
+		return "Init";
 	case OSM_SA_STATE_READY:
-		return ("Ready");
+		return "Ready";
 	}
-	return ("UNKNOWN");
+	return "UNKNOWN";
+}
+
+static void dump_sms(osm_opensm_t * p_osm, FILE * out)
+{
+	osm_subn_t *p_subn = &p_osm->subn;
+	osm_remote_sm_t *p_rsm;
+
+	fprintf(out, "\n   Known SMs\n"
+		     "   ---------\n");
+	fprintf(out, "   Port GUID       SM State    Priority\n");
+	fprintf(out, "   ---------       --------    --------\n");
+	fprintf(out, "   0x%" PRIx64 " %s %d        SELF\n",
+		cl_ntoh64(p_subn->sm_port_guid),
+		sm_state_str(p_subn->sm_state),
+		p_subn->opt.sm_priority);
+
+	CL_PLOCK_ACQUIRE(p_osm->sm.p_lock);
+	p_rsm = (osm_remote_sm_t *) cl_qmap_head(&p_subn->sm_guid_tbl);
+	while (p_rsm != (osm_remote_sm_t *) cl_qmap_end(&p_subn->sm_guid_tbl)) {
+		fprintf(out, "   0x%" PRIx64 " %s %d\n",
+			cl_ntoh64(p_rsm->smi.guid),
+			sm_state_str(ib_sminfo_get_state(&p_rsm->smi)),
+			ib_sminfo_get_priority(&p_rsm->smi));
+		p_rsm = (osm_remote_sm_t *) cl_qmap_next(&p_rsm->map_item);
+	}
+	CL_PLOCK_RELEASE(p_osm->sm.p_lock);
 }
 
 static void print_status(osm_opensm_t * p_osm, FILE * out)
 {
+	cl_list_item_t *item;
+
 	if (out) {
+		const char *re_str;
+
 		cl_plock_acquire(&p_osm->lock);
-		fprintf(out, "   OpenSM Version: %s\n", p_osm->osm_version);
-		fprintf(out, "   SM State      : %s\n",
+		fprintf(out, "   OpenSM Version       : %s\n", p_osm->osm_version);
+		fprintf(out, "   SM State             : %s\n",
 			sm_state_str(p_osm->subn.sm_state));
-		fprintf(out, "   SA State      : %s\n",
+		fprintf(out, "   SM Priority          : %d\n",
+			p_osm->subn.opt.sm_priority);
+		fprintf(out, "   SA State             : %s\n",
 			sa_state_str(p_osm->sa.state));
-		fprintf(out, "   Routing Engine: %s\n",
-			osm_routing_engine_type_str(p_osm->
-						    routing_engine_used));
+
+		re_str = p_osm->routing_engine_used ?
+			osm_routing_engine_type_str(p_osm->routing_engine_used->type) :
+			osm_routing_engine_type_str(OSM_ROUTING_ENGINE_TYPE_NONE);
+		fprintf(out, "   Routing Engine       : %s\n", re_str);
+
+		fprintf(out, "   Loaded event plugins :");
+		if (cl_qlist_head(&p_osm->plugin_list) ==
+			cl_qlist_end(&p_osm->plugin_list)) {
+			fprintf(out, " <none>");
+		}
+		for (item = cl_qlist_head(&p_osm->plugin_list);
+		     item != cl_qlist_end(&p_osm->plugin_list);
+		     item = cl_qlist_next(item))
+			fprintf(out, " %s",
+				((osm_epi_plugin_t *)item)->plugin_name);
+		fprintf(out, "\n");
+
 #ifdef ENABLE_OSM_PERF_MGR
 		fprintf(out, "\n   PerfMgr state/sweep state : %s/%s\n",
-			osm_perfmgr_get_state_str(&(p_osm->perfmgr)),
-			osm_perfmgr_get_sweep_state_str(&(p_osm->perfmgr)));
+			osm_perfmgr_get_state_str(&p_osm->perfmgr),
+			osm_perfmgr_get_sweep_state_str(&p_osm->perfmgr));
 #endif
 		fprintf(out, "\n   MAD stats\n"
 			"   ---------\n"
@@ -365,16 +499,23 @@ static void print_status(osm_opensm_t * p_osm, FILE * out)
 			p_osm->stats.sa_mads_ignored);
 		fprintf(out, "\n   Subnet flags\n"
 			"   ------------\n"
+			"   Sweeping enabled               : %d\n"
+			"   Sweep interval (seconds)       : %d\n"
 			"   Ignore existing lfts           : %d\n"
 			"   Subnet Init errors             : %d\n"
 			"   In sweep hop 0                 : %d\n"
 			"   First time master sweep        : %d\n"
+			"   Set client rereg on sweep      : %d\n"
 			"   Coming out of standby          : %d\n",
+			p_osm->subn.sweeping_enabled,
+			p_osm->subn.opt.sweep_interval,
 			p_osm->subn.ignore_existing_lfts,
 			p_osm->subn.subnet_initialization_error,
 			p_osm->subn.in_sweep_hop_0,
 			p_osm->subn.first_time_master_sweep,
+			p_osm->subn.set_client_rereg_on_sweep,
 			p_osm->subn.coming_out_of_standby);
+		dump_sms(p_osm, out);
 		fprintf(out, "\n");
 		cl_plock_release(&p_osm->lock);
 	}
@@ -385,9 +526,9 @@ static int loop_command_check_time(void)
 	time_t cur = time(NULL);
 	if ((loop_command.previous + loop_command.delay_s) < cur) {
 		loop_command.previous = cur;
-		return (1);
+		return 1;
 	}
-	return (0);
+	return 0;
 }
 
 static void status_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
@@ -432,6 +573,23 @@ static void reroute_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 	osm_opensm_sweep(p_osm);
 }
 
+static void sweep_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
+{
+	char *p_cmd;
+
+	p_cmd = next_token(p_last);
+	if (!p_cmd ||
+	    (strcmp(p_cmd, "on") != 0 && strcmp(p_cmd, "off") != 0)) {
+		fprintf(out, "Invalid sweep command\n");
+		help_sweep(out, 1);
+	} else {
+		if (strcmp(p_cmd, "on") == 0)
+			p_osm->subn.sweeping_enabled = TRUE;
+		else
+			p_osm->subn.sweeping_enabled = FALSE;
+	}
+}
+
 static void logflush_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 {
 	fflush(p_osm->log.out_port);
@@ -439,7 +597,7 @@ static void logflush_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 
 static void querylid_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 {
-	int p = 0;
+	unsigned int p = 0;
 	uint16_t lid = 0;
 	osm_port_t *p_port = NULL;
 	char *p_cmd = next_token(p_last);
@@ -452,9 +610,7 @@ static void querylid_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 
 	lid = (uint16_t) strtoul(p_cmd, NULL, 0);
 	cl_plock_acquire(&p_osm->lock);
-	if (lid > cl_ptr_vector_get_capacity(&(p_osm->subn.port_lid_tbl)))
-		goto invalid_lid;
-	p_port = cl_ptr_vector_get(&(p_osm->subn.port_lid_tbl), lid);
+	p_port = osm_get_port_by_lid_ho(&p_osm->subn, lid);
 	if (!p_port)
 		goto invalid_lid;
 
@@ -475,7 +631,7 @@ static void querylid_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 		p = 1;
 	for ( /* see above */ ; p < p_port->p_node->physp_tbl_size; p++) {
 		fprintf(out,
-			"   Port %d health       : %s\n",
+			"   Port %u health       : %s\n",
 			p,
 			p_port->p_node->physp_table[p].
 			healthy ? "OK" : "ERROR");
@@ -549,6 +705,9 @@ typedef struct {
 	uint64_t ports_sdr;
 	uint64_t ports_ddr;
 	uint64_t ports_qdr;
+	uint64_t ports_fdr10;
+	uint64_t ports_fdr;
+	uint64_t ports_edr;
 	uint64_t ports_unknown_speed;
 	uint64_t ports_reduced_speed;
 	port_report_t *reduced_speed_ports;
@@ -561,6 +720,8 @@ static void __get_stats(cl_map_item_t * const p_map_item, void *context)
 {
 	fabric_stats_t *fs = (fabric_stats_t *) context;
 	osm_node_t *node = (osm_node_t *) p_map_item;
+	osm_physp_t *physp0;
+	ib_port_info_t *pi0;
 	uint8_t num_ports = osm_node_get_num_physp(node);
 	uint8_t port = 0;
 
@@ -571,9 +732,16 @@ static void __get_stats(cl_map_item_t * const p_map_item, void *context)
 
 	fs->total_nodes++;
 
+	if (osm_node_get_type(node) == IB_NODE_TYPE_SWITCH) {
+		physp0 = osm_node_get_physp_ptr(node, 0);
+		pi0 = &physp0->port_info;
+	} else
+		pi0 = NULL;
+
 	for (port = 1; port < num_ports; port++) {
 		osm_physp_t *phys = osm_node_get_physp_ptr(node, port);
 		ib_port_info_t *pi = NULL;
+		ib_mlnx_ext_port_info_t *epi = NULL;
 		uint8_t active_speed = 0;
 		uint8_t enabled_speed = 0;
 		uint8_t active_width = 0;
@@ -584,7 +752,10 @@ static void __get_stats(cl_map_item_t * const p_map_item, void *context)
 		if (!phys)
 			continue;
 
-		pi = &(phys->port_info);
+		pi = &phys->port_info;
+		epi = &phys->ext_port_info;
+		if (!pi0)
+			pi0 = pi;
 		active_speed = ib_port_info_get_link_speed_active(pi);
 		enabled_speed = ib_port_info_get_link_speed_enabled(pi);
 		active_width = pi->link_width_active;
@@ -614,12 +785,50 @@ static void __get_stats(cl_map_item_t * const p_map_item, void *context)
 			fs->ports_ddr++;
 			break;
 		case IB_LINK_SPEED_ACTIVE_10:
-			fs->ports_qdr++;
+			if (!(pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) ||
+			    ((pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) &&
+			    !ib_port_info_get_link_speed_ext_active(pi))) {
+				if (epi->link_speed_active & FDR10)
+					fs->ports_fdr10++;
+				else {
+					fs->ports_qdr++;
+					/* check for speed reduced from FDR10 */
+					if (epi->link_speed_enabled & FDR10) {
+						__tag_port_report(&(fs->reduced_speed_ports),
+								  cl_ntoh64(node->node_info.node_guid),
+								  port, node->print_desc);
+						fs->ports_reduced_speed++;
+					}
+				}
+			}
 			break;
 		default:
 			fs->ports_unknown_speed++;
 			break;
 		}
+		if (pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS &&
+		    ib_port_info_get_link_speed_ext_sup(pi) &&
+		    (enabled_speed = pi->link_speed_ext_enabled) != IB_LINK_SPEED_EXT_DISABLE &&
+		    active_speed == IB_LINK_SPEED_ACTIVE_10) {
+			active_speed = ib_port_info_get_link_speed_ext_active(pi);
+			if ((enabled_speed ^ active_speed) > active_speed) {
+				__tag_port_report(&(fs->reduced_speed_ports),
+						  cl_ntoh64(node->node_info.node_guid),
+						  port, node->print_desc);
+				fs->ports_reduced_speed++;
+			}
+			switch (active_speed) {
+			case IB_LINK_SPEED_EXT_ACTIVE_14:
+				fs->ports_fdr++;
+				break;
+			case IB_LINK_SPEED_EXT_ACTIVE_25:
+				fs->ports_edr++;
+				break;
+			default:
+				fs->ports_unknown_speed++;
+				break;
+			}
+		}
 		switch (active_width) {
 		case IB_LINK_WIDTH_ACTIVE_1X:
 			fs->ports_1X++;
@@ -713,6 +922,12 @@ static void portstatus_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 		fprintf(out, "   %" PRIu64 " at 5.0 Gbps\n", fs.ports_ddr);
 	if (fs.ports_qdr)
 		fprintf(out, "   %" PRIu64 " at 10.0 Gbps\n", fs.ports_qdr);
+	if (fs.ports_fdr10)
+		fprintf(out, "   %" PRIu64 " at 10.0 Gbps (FDR10)\n", fs.ports_fdr10);
+	if (fs.ports_fdr)
+		fprintf(out, "   %" PRIu64 " at 14.0625 Gbps\n", fs.ports_fdr);
+	if (fs.ports_edr)
+		fprintf(out, "   %" PRIu64 " at 25.78125 Gbps\n", fs.ports_edr);
 
 	if (fs.ports_disabled + fs.ports_reduced_speed + fs.ports_reduced_width
 	    > 0) {
@@ -1081,7 +1296,158 @@ static void dump_conf_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 	osm_subn_output_conf(out, &p_osm->subn.opt);
 }
 
+static void update_desc_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
+{
+	osm_update_node_desc(p_osm);
+}
+
 #ifdef ENABLE_OSM_PERF_MGR
+static monitored_node_t *find_node_by_name(osm_opensm_t * p_osm,
+					   char *nodename)
+{
+	cl_map_item_t *item;
+	monitored_node_t *node;
+
+	item = cl_qmap_head(&p_osm->perfmgr.monitored_map);
+	while (item != cl_qmap_end(&p_osm->perfmgr.monitored_map)) {
+		node = (monitored_node_t *)item;
+		if (strcmp(node->name, nodename) == 0)
+			return node;
+		item = cl_qmap_next(item);
+	}
+
+	return NULL;
+}
+
+static monitored_node_t *find_node_by_guid(osm_opensm_t * p_osm,
+					   uint64_t guid)
+{
+	cl_map_item_t *node;
+
+	node = cl_qmap_get(&p_osm->perfmgr.monitored_map, guid);
+	if (node != cl_qmap_end(&p_osm->perfmgr.monitored_map))
+		return (monitored_node_t *)node;
+
+	return NULL;
+}
+
+static void dump_redir_entry(monitored_node_t *p_mon_node, FILE * out)
+{
+	int port, redir;
+
+	/* only display monitored nodes with redirection info */
+	redir = 0;
+	for (port = (p_mon_node->esp0) ? 0 : 1;
+	     port < p_mon_node->num_ports; port++) {
+		if (p_mon_node->port[port].redirection) {
+			if (!redir) {
+				fprintf(out, "   Node GUID       ESP0   Name\n");
+				fprintf(out, "   ---------       ----   ----\n");
+				fprintf(out, "   0x%" PRIx64 " %d      %s\n",
+					p_mon_node->guid, p_mon_node->esp0,
+					p_mon_node->name);
+				fprintf(out, "\n   Port Valid  LIDs     PKey  QP    PKey Index\n");
+				fprintf(out, "   ---- -----  ----     ----  --    ----------\n");
+				redir = 1;
+			}
+			fprintf(out, "   %d    %d      %u->%u  0x%x 0x%x   %d\n",
+				port, p_mon_node->port[port].valid,
+				cl_ntoh16(p_mon_node->port[port].orig_lid),
+				cl_ntoh16(p_mon_node->port[port].lid),
+				cl_ntoh16(p_mon_node->port[port].pkey),
+				cl_ntoh32(p_mon_node->port[port].qp),
+				p_mon_node->port[port].pkey_ix);
+		}
+	}
+	if (redir)
+		fprintf(out, "\n");
+}
+
+static void dump_redir(osm_opensm_t * p_osm, char *nodename, FILE * out)
+{
+	monitored_node_t *p_mon_node;
+	uint64_t guid;
+
+	if (!p_osm->subn.opt.perfmgr_redir)
+		fprintf(out, "Perfmgr redirection not enabled\n");
+
+	fprintf(out, "\nRedirection Table\n");
+	fprintf(out, "-----------------\n");
+	cl_plock_acquire(&p_osm->lock);
+	if (nodename) {
+		guid = strtoull(nodename, NULL, 0);
+		if (guid == 0 && errno)
+			p_mon_node = find_node_by_name(p_osm, nodename);
+		else
+			p_mon_node = find_node_by_guid(p_osm, guid);
+		if (p_mon_node)
+			dump_redir_entry(p_mon_node, out);
+		else {
+			if (guid == 0 && errno)
+				fprintf(out, "Node %s not found...\n", nodename);
+			else
+				fprintf(out, "Node 0x%" PRIx64 " not found...\n", guid);
+		}
+	} else {
+		p_mon_node = (monitored_node_t *) cl_qmap_head(&p_osm->perfmgr.monitored_map);
+		while (p_mon_node != (monitored_node_t *) cl_qmap_end(&p_osm->perfmgr.monitored_map)) {
+			dump_redir_entry(p_mon_node, out);
+			p_mon_node = (monitored_node_t *) cl_qmap_next((const cl_map_item_t *)p_mon_node);
+		}
+	}
+	cl_plock_release(&p_osm->lock);
+}
+
+static void clear_redir_entry(monitored_node_t *p_mon_node)
+{
+	int port;
+	ib_net16_t orig_lid;
+
+	for (port = (p_mon_node->esp0) ? 0 : 1;
+	     port < p_mon_node->num_ports; port++) {
+		if (p_mon_node->port[port].redirection) {
+			orig_lid = p_mon_node->port[port].orig_lid;
+			memset(&p_mon_node->port[port], 0,
+			       sizeof(monitored_port_t));
+			p_mon_node->port[port].valid = TRUE;
+			p_mon_node->port[port].orig_lid = orig_lid;
+		}
+	}
+}
+
+static void clear_redir(osm_opensm_t * p_osm, char *nodename, FILE * out)
+{
+	monitored_node_t *p_mon_node;
+	uint64_t guid;
+
+	if (!p_osm->subn.opt.perfmgr_redir)
+		fprintf(out, "Perfmgr redirection not enabled\n");
+
+	cl_plock_acquire(&p_osm->lock);
+	if (nodename) {
+		guid = strtoull(nodename, NULL, 0);
+		if (guid == 0 && errno)
+			p_mon_node = find_node_by_name(p_osm, nodename);
+		else
+			p_mon_node = find_node_by_guid(p_osm, guid);
+		if (p_mon_node)
+			clear_redir_entry(p_mon_node);
+		else {
+			if (guid == 0 && errno)
+				fprintf(out, "Node %s not found...\n", nodename);
+			else
+				fprintf(out, "Node 0x%" PRIx64 " not found...\n", guid);
+		}
+	} else {
+		p_mon_node = (monitored_node_t *) cl_qmap_head(&p_osm->perfmgr.monitored_map);
+		while (p_mon_node != (monitored_node_t *) cl_qmap_end(&p_osm->perfmgr.monitored_map)) {
+			clear_redir_entry(p_mon_node);
+			p_mon_node = (monitored_node_t *) cl_qmap_next((const cl_map_item_t *)p_mon_node);
+		}
+	}
+	cl_plock_release(&p_osm->lock);
+}
+
 static void perfmgr_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 {
 	char *p_cmd;
@@ -1089,70 +1455,96 @@ static void perfmgr_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 	p_cmd = next_token(p_last);
 	if (p_cmd) {
 		if (strcmp(p_cmd, "enable") == 0) {
-			osm_perfmgr_set_state(&(p_osm->perfmgr),
+			osm_perfmgr_set_state(&p_osm->perfmgr,
 					      PERFMGR_STATE_ENABLED);
 		} else if (strcmp(p_cmd, "disable") == 0) {
-			osm_perfmgr_set_state(&(p_osm->perfmgr),
+			osm_perfmgr_set_state(&p_osm->perfmgr,
 					      PERFMGR_STATE_DISABLE);
 		} else if (strcmp(p_cmd, "clear_counters") == 0) {
-			osm_perfmgr_clear_counters(&(p_osm->perfmgr));
+			osm_perfmgr_clear_counters(&p_osm->perfmgr);
+		} else if (strcmp(p_cmd, "set_rm_nodes") == 0) {
+			osm_perfmgr_set_rm_nodes(&p_osm->perfmgr, 1);
+		} else if (strcmp(p_cmd, "clear_rm_nodes") == 0) {
+			osm_perfmgr_set_rm_nodes(&p_osm->perfmgr, 0);
 		} else if (strcmp(p_cmd, "dump_counters") == 0) {
 			p_cmd = next_token(p_last);
 			if (p_cmd && (strcmp(p_cmd, "mach") == 0)) {
-				osm_perfmgr_dump_counters(&(p_osm->perfmgr),
+				osm_perfmgr_dump_counters(&p_osm->perfmgr,
 							  PERFMGR_EVENT_DB_DUMP_MR);
 			} else {
-				osm_perfmgr_dump_counters(&(p_osm->perfmgr),
+				osm_perfmgr_dump_counters(&p_osm->perfmgr,
 							  PERFMGR_EVENT_DB_DUMP_HR);
 			}
-		} else if (strcmp(p_cmd, "print_counters") == 0) {
-			p_cmd = next_token(p_last);
+		} else if (strcmp(p_cmd, "clear_inactive") == 0) {
+			unsigned cnt = osm_perfmgr_delete_inactive(&p_osm->perfmgr);
+			fprintf(out, "Removed %u nodes from Database\n", cnt);
+		} else if (strcmp(p_cmd, "print_counters") == 0 ||
+			   strcmp(p_cmd, "pc") == 0) {
+			char *port = NULL;
+			p_cmd = name_token(p_last);
 			if (p_cmd) {
-				osm_perfmgr_print_counters(&(p_osm->perfmgr),
-							   p_cmd, out);
-			} else {
-				fprintf(out,
-					"print_counters requires a node name to be specified\n");
+				port = strchr(p_cmd, ':');
+				if (port) {
+					*port = '\0';
+					port++;
+				}
 			}
+			osm_perfmgr_print_counters(&p_osm->perfmgr, p_cmd,
+						   out, port, 0);
+		} else if (strcmp(p_cmd, "print_errors") == 0 ||
+			   strcmp(p_cmd, "pe") == 0) {
+			p_cmd = name_token(p_last);
+			osm_perfmgr_print_counters(&p_osm->perfmgr, p_cmd,
+						   out, NULL, 1);
+		} else if (strcmp(p_cmd, "dump_redir") == 0) {
+			p_cmd = name_token(p_last);
+			dump_redir(p_osm, p_cmd, out);
+		} else if (strcmp(p_cmd, "clear_redir") == 0) {
+			p_cmd = name_token(p_last);
+			clear_redir(p_osm, p_cmd, out);
 		} else if (strcmp(p_cmd, "sweep_time") == 0) {
 			p_cmd = next_token(p_last);
 			if (p_cmd) {
 				uint16_t time_s = atoi(p_cmd);
-				osm_perfmgr_set_sweep_time_s(&(p_osm->perfmgr),
-							     time_s);
+				if (time_s < 1)
+					fprintf(out,
+						"sweep_time requires a "
+						"positive time period "
+						"(in seconds) to be "
+						"specified\n");
+				else
+					osm_perfmgr_set_sweep_time_s(
+							&p_osm->perfmgr,
+							time_s);
 			} else {
 				fprintf(out,
-					"sweep_time requires a time period (in seconds) to be specified\n");
+					"sweep_time requires a time period "
+					"(in seconds) to be specified\n");
 			}
 		} else {
 			fprintf(out, "\"%s\" option not found\n", p_cmd);
 		}
 	} else {
-		cl_list_item_t *item;
 		fprintf(out, "Performance Manager status:\n"
-			"state                   : %s\n"
-			"sweep state             : %s\n"
-			"sweep time              : %us\n"
-			"outstanding queries/max : %d/%u\n"
-			"loaded event plugin     :",
-			osm_perfmgr_get_state_str(&(p_osm->perfmgr)),
-			osm_perfmgr_get_sweep_state_str(&(p_osm->perfmgr)),
-			osm_perfmgr_get_sweep_time_s(&(p_osm->perfmgr)),
+			"state                        : %s\n"
+			"sweep state                  : %s\n"
+			"sweep time                   : %us\n"
+			"outstanding queries/max      : %d/%u\n"
+			"remove missing nodes from DB : %s\n",
+			osm_perfmgr_get_state_str(&p_osm->perfmgr),
+			osm_perfmgr_get_sweep_state_str(&p_osm->perfmgr),
+			osm_perfmgr_get_sweep_time_s(&p_osm->perfmgr),
 			p_osm->perfmgr.outstanding_queries,
-			p_osm->perfmgr.max_outstanding_queries);
-		for (item = cl_qlist_head(&p_osm->plugin_list);
-		     item != cl_qlist_end(&p_osm->plugin_list);
-		     item = cl_qlist_next(item))
-			fprintf(out, " %s",
-				((osm_epi_plugin_t *)item)->plugin_name);
-		fprintf(out, "\n");
+			p_osm->perfmgr.max_outstanding_queries,
+			osm_perfmgr_get_rm_nodes(&p_osm->perfmgr)
+						 ? "TRUE" : "FALSE");
 	}
 }
 #endif				/* ENABLE_OSM_PERF_MGR */
 
 static void quit_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 {
-	osm_console_exit(&p_osm->console, &p_osm->log);
+	cio_close(&p_osm->console, &p_osm->log);
 }
 
 static void help_version(FILE * out, int detail)
@@ -1166,14 +1558,119 @@ static void version_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 }
 
 /* more parse routines go here */
+typedef struct _regexp_list {
+	regex_t exp;
+	struct _regexp_list *next;
+} regexp_list_t;
+
+static void dump_portguid_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
+{
+	cl_qmap_t *p_alias_port_guid_tbl;
+	osm_alias_guid_t *p_alias_guid, *p_next_alias_guid;
+	regexp_list_t *p_regexp, *p_head_regexp = NULL;
+	FILE *output = out;
+
+	while (1) {
+		char *p_cmd = next_token(p_last);
+		if (!p_cmd)
+			break;
+
+		if (strcmp(p_cmd, "file") == 0) {
+			p_cmd = next_token(p_last);
+			if (p_cmd) {
+				output = fopen(p_cmd, "w+");
+				if (output == NULL) {
+					fprintf(out,
+						"Could not open file %s: %s\n",
+						p_cmd, strerror(errno));
+					output = out;
+				}
+			} else
+				fprintf(out, "No file name passed\n");
+		} else if (!(p_regexp = malloc(sizeof(*p_regexp)))) {
+			fprintf(out, "No memory\n");
+			break;
+		} else if (regcomp(&p_regexp->exp, p_cmd,
+				   REG_NOSUB | REG_EXTENDED) != 0) {
+			fprintf(out, "Cannot parse regular expression \'%s\'."
+				" Skipping\n", p_cmd);
+			free(p_regexp);
+			continue;
+		} else {
+			p_regexp->next = p_head_regexp;
+			p_head_regexp = p_regexp;
+		}
+	}
+
+	/* Check we have at least one expression to match */
+	if (p_head_regexp == NULL) {
+		fprintf(out, "No valid expression provided. Aborting\n");
+		goto Exit;
+	}
+
+	if (p_osm->sm.p_subn->need_update != 0) {
+		fprintf(out, "Subnet is not ready yet. Try again later\n");
+		goto Free_and_exit;
+	}
+
+	/* Subnet doesn't need to be updated so we can carry on */
+
+	p_alias_port_guid_tbl = &(p_osm->sm.p_subn->alias_port_guid_tbl);
+	CL_PLOCK_ACQUIRE(p_osm->sm.p_lock);
+
+	p_next_alias_guid = (osm_alias_guid_t *) cl_qmap_head(p_alias_port_guid_tbl);
+	while (p_next_alias_guid != (osm_alias_guid_t *) cl_qmap_end(p_alias_port_guid_tbl)) {
+
+		p_alias_guid = p_next_alias_guid;
+		p_next_alias_guid =
+		    (osm_alias_guid_t *) cl_qmap_next(&p_next_alias_guid->map_item);
+
+		for (p_regexp = p_head_regexp; p_regexp != NULL;
+		     p_regexp = p_regexp->next)
+			if (regexec(&p_regexp->exp,
+				    p_alias_guid->p_base_port->p_node->print_desc,
+				    0, NULL, 0) == 0) {
+				fprintf(output, "0x%" PRIxLEAST64 "\n",
+					cl_ntoh64(p_alias_guid->alias_guid));
+				break;
+			}
+	}
+
+	CL_PLOCK_RELEASE(p_osm->sm.p_lock);
+
+Free_and_exit:
+	for (; p_head_regexp; p_head_regexp = p_regexp) {
+		p_regexp = p_head_regexp->next;
+		regfree(&p_head_regexp->exp);
+		free(p_head_regexp);
+	}
+Exit:
+	if (output != out)
+		fclose(output);
+}
+
+static void help_dump_portguid(FILE * out, int detail)
+{
+	fprintf(out,
+		"dump_portguid [file filename] regexp1 [regexp2 [regexp3 ...]] -- Dump port GUID matching a regexp \n");
+	if (detail) {
+		fprintf(out,
+			"getguidgetguid  -- Dump all the port GUID whom node_desc matches one of the provided regexp\n");
+		fprintf(out,
+			"   [file filename] -- Send the port GUID list to the specified file instead of regular output\n");
+	}
+
+}
 
 static const struct command console_cmds[] = {
 	{"help", &help_command, &help_parse},
 	{"quit", &help_quit, &quit_parse},
 	{"loglevel", &help_loglevel, &loglevel_parse},
+	{"permodlog", &help_permodlog, &permodlog_parse},
 	{"priority", &help_priority, &priority_parse},
 	{"resweep", &help_resweep, &resweep_parse},
 	{"reroute", &help_reroute, &reroute_parse},
+	{"sweep", &help_sweep, &sweep_parse},
 	{"status", &help_status, &status_parse},
 	{"logflush", &help_logflush, &logflush_parse},
 	{"querylid", &help_querylid, &querylid_parse},
@@ -1181,10 +1678,13 @@ static const struct command console_cmds[] = {
 	{"switchbalance", &help_switchbalance, &switchbalance_parse},
 	{"lidbalance", &help_lidbalance, &lidbalance_parse},
 	{"dump_conf", &help_dump_conf, &dump_conf_parse},
+	{"update_desc", &help_update_desc, &update_desc_parse},
 	{"version", &help_version, &version_parse},
 #ifdef ENABLE_OSM_PERF_MGR
 	{"perfmgr", &help_perfmgr, &perfmgr_parse},
+	{"pm", &help_pm, &perfmgr_parse},
 #endif				/* ENABLE_OSM_PERF_MGR */
+	{"dump_portguid", &help_dump_portguid, &dump_portguid_parse},
 	{NULL, NULL, NULL}	/* end of array */
 };
 
@@ -1230,7 +1730,7 @@ static void parse_cmd_line(char *line, osm_opensm_t * p_osm)
 	}
 }
 
-void osm_console(osm_opensm_t * p_osm)
+int osm_console(osm_opensm_t * p_osm)
 {
 	struct pollfd pollfd[2];
 	char *p_line;
@@ -1239,7 +1739,6 @@ void osm_console(osm_opensm_t * p_osm)
 	struct pollfd *fds;
 	nfds_t nfds;
 	osm_console_t *p_oct = &p_osm->console;
-	osm_log_t *p_log = &p_osm->log;
 
 	pollfd[0].fd = p_oct->socket;
 	pollfd[0].events = POLLIN;
@@ -1263,42 +1762,45 @@ void osm_console(osm_opensm_t * p_osm)
 	}
 
 	if (poll(fds, nfds, 1000) <= 0)
-		return;
+		return 0;
 
-#ifdef ENABLE_OSM_CONSOLE_SOCKET
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
 	if (pollfd[0].revents & POLLIN) {
 		int new_fd = 0;
 		struct sockaddr_in sin;
 		socklen_t len = sizeof(sin);
 		struct hostent *hent;
 		if ((new_fd = accept(p_oct->socket, &sin, &len)) < 0) {
-			OSM_LOG(p_log, OSM_LOG_ERROR,
+			OSM_LOG(&p_osm->log, OSM_LOG_ERROR,
 				"ERR 4B04: Failed to accept console socket: %s\n",
 				strerror(errno));
 			p_oct->in_fd = -1;
-			return;
+			return 0;
 		}
 		if (inet_ntop
 		    (AF_INET, &sin.sin_addr, p_oct->client_ip,
 		     sizeof(p_oct->client_ip)) == NULL) {
-			snprintf(p_oct->client_ip, 64, "STRING_UNKNOWN");
+			snprintf(p_oct->client_ip, sizeof(p_oct->client_ip),
+				 "STRING_UNKNOWN");
 		}
 		if ((hent = gethostbyaddr((const char *)&sin.sin_addr,
 					  sizeof(struct in_addr),
 					  AF_INET)) == NULL) {
-			snprintf(p_oct->client_hn, 128, "STRING_UNKNOWN");
+			snprintf(p_oct->client_hn, sizeof(p_oct->client_hn),
+				 "STRING_UNKNOWN");
 		} else {
-			snprintf(p_oct->client_hn, 128, "%s", hent->h_name);
+			snprintf(p_oct->client_hn, sizeof(p_oct->client_hn),
+				 "%s", hent->h_name);
 		}
 		if (is_authorized(p_oct)) {
-			cio_open(p_oct, new_fd, p_log);
+			cio_open(p_oct, new_fd, &p_osm->log);
 		} else {
-			OSM_LOG(p_log, OSM_LOG_ERROR,
+			OSM_LOG(&p_osm->log, OSM_LOG_ERROR,
 				"ERR 4B05: Console connection denied: %s (%s)\n",
 				p_oct->client_hn, p_oct->client_ip);
 			close(new_fd);
 		}
-		return;
+		return 0;
 	}
 #endif
 
@@ -1313,8 +1815,24 @@ void osm_console(osm_opensm_t * p_osm)
 				osm_console_prompt(p_oct->out);
 			}
 		} else
-			osm_console_exit(p_oct, p_log);
+			cio_close(p_oct, &p_osm->log);
 		if (p_line)
 			free(p_line);
+		return 0;
 	}
+	/* input fd is closed (hanged up) */
+	if (pollfd[1].revents & POLLHUP) {
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
+		/* If we are using a socket, we close the current connection */
+		if (p_oct->socket >= 0) {
+			cio_close(p_oct, &p_osm->log);
+			return 0;
+		}
+#endif
+		/* If we use a local console, stdin is closed (most probable is pipe ended)
+		 * so we close the local console */
+		return -1;
+	}
+
+	return 0;
 }
diff --git a/opensm/osm_console_io.c b/opensm/osm_console_io.c
index 3d3ece4..167562c 100644
--- a/opensm/osm_console_io.c
+++ b/opensm/osm_console_io.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005-2007 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2005-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2008 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -46,7 +46,7 @@
 #endif				/* HAVE_CONFIG_H */
 
 #define _GNU_SOURCE		/* for getline */
-#ifdef ENABLE_OSM_CONSOLE_SOCKET
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
 #include <tcpd.h>
 #include <arpa/inet.h>
 #include <netinet/in.h>
@@ -55,49 +55,61 @@
 #include <unistd.h>
 #include <errno.h>
 #include <signal.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_CONSOLE_IO_C
 #include <opensm/osm_console_io.h>
+#include <stdlib.h>
 
 static int is_local(char *str)
 {
-	// convenience - checks if just stdin/stdout
+	/* convenience - checks if just stdin/stdout */
 	if (str)
 		return (strcmp(str, OSM_LOCAL_CONSOLE) == 0);
 	return 0;
 }
 
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
 static int is_loopback(char *str)
 {
-	// convenience - checks if socket based connection
+	/* convenience - checks if socket based connection */
 	if (str)
 		return (strcmp(str, OSM_LOOPBACK_CONSOLE) == 0);
 	return 0;
 }
+#else
+#define is_loopback is_local
+#endif
 
+#ifdef ENABLE_OSM_CONSOLE_SOCKET
 static int is_remote(char *str)
 {
-	// convenience - checks if socket based connection
+	/* convenience - checks if socket based connection */
 	if (str)
-		return (strcmp(str, OSM_REMOTE_CONSOLE) == 0)
-		    || is_loopback(str);
+		return strcmp(str, OSM_REMOTE_CONSOLE) == 0 || is_loopback(str);
 	return 0;
 }
+#else
+#define is_remote is_loopback
+#endif
 
 int is_console_enabled(osm_subn_opt_t * p_opt)
 {
-	// checks for a variety of types of consoles - default is off or 0
+	/* checks for a variety of types of consoles - default is off or 0 */
 	if (p_opt)
-		return (is_local(p_opt->console)
-			|| is_loopback(p_opt->console)
-			|| is_remote(p_opt->console));
+		return is_local(p_opt->console) || is_loopback(p_opt->console)
+			|| is_remote(p_opt->console);
 	return 0;
 }
 
 
-#ifdef ENABLE_OSM_CONSOLE_SOCKET
-static int cio_close(osm_console_t * p_oct)
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
+int cio_close(osm_console_t * p_oct, osm_log_t * p_log)
 {
 	int rtnval = -1;
-	if (p_oct && (p_oct->in_fd > 0)) {
+	if (p_oct && p_oct->in_fd > 0) {
+		OSM_LOG(p_log, OSM_LOG_INFO,
+			"Console connection closed: %s (%s)\n",
+			p_oct->client_hn, p_oct->client_ip);
 		rtnval = close(p_oct->in_fd);
 		p_oct->in_fd = -1;
 		p_oct->out_fd = -1;
@@ -106,30 +118,48 @@ static int cio_close(osm_console_t * p_oct)
 	}
 	return rtnval;
 }
-#endif
 
-/* close the connection */
-static void osm_console_close(osm_console_t * p_oct, osm_log_t * p_log)
+int cio_open(osm_console_t * p_oct, int new_fd, osm_log_t * p_log)
 {
-#ifdef ENABLE_OSM_CONSOLE_SOCKET
-	if ((p_oct->socket > 0) && (p_oct->in_fd != -1)) {
-		OSM_LOG(p_log, OSM_LOG_INFO,
-			"Console connection closed: %s (%s)\n",
-			p_oct->client_hn, p_oct->client_ip);
-		cio_close(p_oct);
-	}
-	if (p_oct->socket > 0) {
-		close(p_oct->socket);
-		p_oct->socket = -1;
+	/* returns zero if opened fine, -1 otherwise */
+	char *p_line;
+	size_t len;
+	ssize_t n;
+
+	if (p_oct->in_fd >= 0) {
+		FILE *file = fdopen(new_fd, "w+");
+
+		fprintf(file, "OpenSM Console connection already in use\n"
+			"   kill other session (y/n)? ");
+		fflush(file);
+		p_line = NULL;
+		n = getline(&p_line, &len, file);
+		if (n > 0 && (p_line[0] == 'y' || p_line[0] == 'Y'))
+			cio_close(p_oct, p_log);
+		else {
+			OSM_LOG(p_log, OSM_LOG_INFO,
+				"Console connection aborted: %s (%s)\n",
+				p_oct->client_hn, p_oct->client_ip);
+			close(new_fd);
+			free(p_line);
+			return -1;
+		}
+		free(p_line);
 	}
-#endif
-}
+	p_oct->in_fd = new_fd;
+	p_oct->out_fd = p_oct->in_fd;
+	p_oct->in = fdopen(p_oct->in_fd, "w+");
+	p_oct->out = p_oct->in;
+	osm_console_prompt(p_oct->out);
+	OSM_LOG(p_log, OSM_LOG_INFO, "Console connection accepted: %s (%s)\n",
+		p_oct->client_hn, p_oct->client_ip);
 
+	return (p_oct->in == NULL) ? -1 : 0;
+}
 
 /**********************************************************************
  * Do authentication & authorization check
  **********************************************************************/
-#ifdef ENABLE_OSM_CONSOLE_SOCKET
 int is_authorized(osm_console_t * p_oct)
 {
 	/* allowed to use the console? */
@@ -161,9 +191,12 @@ int osm_console_init(osm_subn_opt_t * opt, osm_console_t * p_oct, osm_log_t * p_
 		p_oct->out_fd = fileno(stdout);
 
 		osm_console_prompt(p_oct->out);
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
+	} else if (strcmp(opt->console, OSM_LOOPBACK_CONSOLE) == 0
 #ifdef ENABLE_OSM_CONSOLE_SOCKET
-	} else if (strcmp(opt->console, OSM_REMOTE_CONSOLE) == 0
-		   || strcmp(opt->console, OSM_LOOPBACK_CONSOLE) == 0) {
+		   || strcmp(opt->console, OSM_REMOTE_CONSOLE) == 0
+#endif
+		   ) {
 		struct sockaddr_in sin;
 		int optval = 1;
 
@@ -177,9 +210,11 @@ int osm_console_init(osm_subn_opt_t * opt, osm_console_t * p_oct, osm_log_t * p_
 			   &optval, sizeof(optval));
 		sin.sin_family = AF_INET;
 		sin.sin_port = htons(opt->console_port);
+#ifdef ENABLE_OSM_CONSOLE_SOCKET
 		if (strcmp(opt->console, OSM_REMOTE_CONSOLE) == 0)
 			sin.sin_addr.s_addr = htonl(INADDR_ANY);
 		else
+#endif
 			sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 		if (bind(p_oct->socket, &sin, sizeof(sin)) < 0) {
 			OSM_LOG(p_log, OSM_LOG_ERROR,
@@ -210,45 +245,12 @@ int osm_console_init(osm_subn_opt_t * opt, osm_console_t * p_oct, osm_log_t * p_
 /* clean up and release resources */
 void osm_console_exit(osm_console_t * p_oct, osm_log_t * p_log)
 {
-	// clean up and release resources, currently just close the socket
-	osm_console_close(p_oct, p_log);
-}
-
-#ifdef ENABLE_OSM_CONSOLE_SOCKET
-int cio_open(osm_console_t * p_oct, int new_fd, osm_log_t * p_log)
-{
-	// returns zero if opened fine, -1 otherwise
-	char *p_line;
-	size_t len;
-	ssize_t n;
-
-	if (p_oct->in_fd >= 0) {
-		FILE *file = fdopen(new_fd, "w+");
-
-		fprintf(file, "OpenSM Console connection already in use\n"
-			"   kill other session (y/n)? ");
-		fflush(file);
-		p_line = NULL;
-		n = getline(&p_line, &len, file);
-		if (n > 0 && (p_line[0] == 'y' || p_line[0] == 'Y')) {
-			osm_console_close(p_oct, p_log);
-		} else {
-			OSM_LOG(p_log, OSM_LOG_INFO,
-				"Console connection aborted: %s (%s)\n",
-				p_oct->client_hn, p_oct->client_ip);
-			close(new_fd);
-			return -1;
-		}
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
+	cio_close(p_oct, p_log);
+	if (p_oct->socket > 0) {
+		OSM_LOG(p_log, OSM_LOG_INFO, "Closing console socket\n");
+		close(p_oct->socket);
+		p_oct->socket = -1;
 	}
-	p_oct->in_fd = new_fd;
-	p_oct->out_fd = p_oct->in_fd;
-	p_oct->in = fdopen(p_oct->in_fd, "w+");
-	p_oct->out = p_oct->in;
-	osm_console_prompt(p_oct->out);
-	OSM_LOG(p_log, OSM_LOG_INFO,
-		"Console connection accepted: %s (%s)\n",
-		p_oct->client_hn, p_oct->client_ip);
-
-	return (p_oct->in == NULL) ? -1 : 0;
-}
 #endif
+}
diff --git a/opensm/osm_db_files.c b/opensm/osm_db_files.c
index 907b7c7..9f338f3 100644
--- a/opensm/osm_db_files.c
+++ b/opensm/osm_db_files.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -46,8 +46,11 @@
 #include <sys/types.h>
 #include <stdlib.h>
 #include <string.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_DB_FILES_C
 #include <opensm/st.h>
 #include <opensm/osm_db.h>
+#include <opensm/osm_log.h>
 
 /****d* Database/OSM_DB_MAX_LINE_LEN
  * NAME
@@ -117,17 +120,13 @@ typedef struct osm_db_imp {
  * osm_db_t
  *********/
 
-/***************************************************************************
- ***************************************************************************/
-void osm_db_construct(IN osm_db_t * const p_db)
+void osm_db_construct(IN osm_db_t * p_db)
 {
 	memset(p_db, 0, sizeof(osm_db_t));
 	cl_list_construct(&p_db->domains);
 }
 
-/***************************************************************************
- ***************************************************************************/
-void osm_db_domain_destroy(IN osm_db_domain_t * const p_db_domain)
+void osm_db_domain_destroy(IN osm_db_domain_t * p_db_domain)
 {
 	osm_db_domain_imp_t *p_domain_imp;
 	p_domain_imp = (osm_db_domain_imp_t *) p_db_domain->p_domain_imp;
@@ -141,9 +140,7 @@ void osm_db_domain_destroy(IN osm_db_domain_t * const p_db_domain)
 	free(p_domain_imp);
 }
 
-/***************************************************************************
- ***************************************************************************/
-void osm_db_destroy(IN osm_db_t * const p_db)
+void osm_db_destroy(IN osm_db_t * p_db)
 {
 	osm_db_domain_t *p_domain;
 
@@ -155,17 +152,18 @@ void osm_db_destroy(IN osm_db_t * const p_db)
 	free(p_db->p_db_imp);
 }
 
-/***************************************************************************
- ***************************************************************************/
-int osm_db_init(IN osm_db_t * const p_db, IN osm_log_t * p_log)
+int osm_db_init(IN osm_db_t * p_db, IN osm_log_t * p_log)
 {
 	osm_db_imp_t *p_db_imp;
 	struct stat dstat;
 
 	OSM_LOG_ENTER(p_log);
 
-	p_db_imp = (osm_db_imp_t *) malloc(sizeof(osm_db_imp_t));
-	CL_ASSERT(p_db_imp != NULL);
+	p_db_imp = malloc(sizeof(osm_db_imp_t));
+	if (!p_db_imp) {
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6100: No memory.\n");
+		return -1;
+	}
 
 	p_db_imp->db_dir_name = getenv("OSM_CACHE_DIR");
 	if (!p_db_imp->db_dir_name || !(*p_db_imp->db_dir_name))
@@ -174,18 +172,19 @@ int osm_db_init(IN osm_db_t * const p_db, IN osm_log_t * p_log)
 	/* Create the directory if it doesn't exist */
 	/* There is a difference in creating directory between windows and linux */
 #ifdef __WIN__
-	/* Check if the directory exists. If not - create it. */
-	CreateDirectory(p_db_imp->db_dir_name, NULL);
+	{
+		int ret;
+
+		ret = SHCreateDirectoryEx(NULL, p_db_imp->db_dir_name, NULL);
+		if (ret != ERROR_SUCCESS && ret != ERROR_ALREADY_EXISTS &&
+			ret != ERROR_FILE_EXISTS)
+			goto err;
+	}
 #else				/* __WIN__ */
 	/* make sure the directory exists */
 	if (lstat(p_db_imp->db_dir_name, &dstat)) {
-		if (mkdir(p_db_imp->db_dir_name, 0755)) {
-			OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6101: "
-				"Failed to create the db directory:%s\n",
-				p_db_imp->db_dir_name);
-			OSM_LOG_EXIT(p_log);
-			return 1;
-		}
+		if (mkdir(p_db_imp->db_dir_name, 0755))
+			goto err;
 	}
 #endif
 
@@ -197,39 +196,41 @@ int osm_db_init(IN osm_db_t * const p_db, IN osm_log_t * p_log)
 	OSM_LOG_EXIT(p_log);
 
 	return 0;
+
+err:
+	OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6101: "
+		"Failed to create the db directory:%s\n",
+		p_db_imp->db_dir_name);
+	free(p_db_imp);
+	OSM_LOG_EXIT(p_log);
+	return 1;
 }
 
-/***************************************************************************
- ***************************************************************************/
-osm_db_domain_t *osm_db_domain_init(IN osm_db_t * const p_db,
-				    IN char *domain_name)
+osm_db_domain_t *osm_db_domain_init(IN osm_db_t * p_db, IN char *domain_name)
 {
 	osm_db_domain_t *p_domain;
 	osm_db_domain_imp_t *p_domain_imp;
-	int dir_name_len;
+	size_t path_len;
 	osm_log_t *p_log = p_db->p_log;
 	FILE *p_file;
 
 	OSM_LOG_ENTER(p_log);
 
 	/* allocate a new domain object */
-	p_domain = (osm_db_domain_t *) malloc(sizeof(osm_db_domain_t));
+	p_domain = malloc(sizeof(osm_db_domain_t));
 	CL_ASSERT(p_domain != NULL);
 
-	p_domain_imp =
-	    (osm_db_domain_imp_t *) malloc(sizeof(osm_db_domain_imp_t));
+	p_domain_imp = malloc(sizeof(osm_db_domain_imp_t));
 	CL_ASSERT(p_domain_imp != NULL);
 
-	dir_name_len = strlen(((osm_db_imp_t *) p_db->p_db_imp)->db_dir_name);
+	path_len = strlen(((osm_db_imp_t *) p_db->p_db_imp)->db_dir_name)
+	    + strlen(domain_name) + 2;
 
 	/* set the domain file name */
-	p_domain_imp->file_name =
-	    (char *)malloc(sizeof(char) * (dir_name_len) + strlen(domain_name) +
-			   2);
+	p_domain_imp->file_name = malloc(path_len);
 	CL_ASSERT(p_domain_imp->file_name != NULL);
-	strcpy(p_domain_imp->file_name,
-	       ((osm_db_imp_t *) p_db->p_db_imp)->db_dir_name);
-	strcat(p_domain_imp->file_name, domain_name);
+	snprintf(p_domain_imp->file_name, path_len, "%s/%s",
+		 ((osm_db_imp_t *) p_db->p_db_imp)->db_dir_name, domain_name);
 
 	/* make sure the file exists - or exit if not writable */
 	p_file = fopen(p_domain_imp->file_name, "a+");
@@ -259,8 +260,6 @@ Exit:
 	return p_domain;
 }
 
-/***************************************************************************
- ***************************************************************************/
 int osm_db_restore(IN osm_db_domain_t * p_domain)
 {
 
@@ -321,7 +320,8 @@ int osm_db_restore(IN osm_db_domain_t * p_domain)
 				p_first_word =
 				    strtok_r(sLine, " \t\n", &p_last);
 				if (!p_first_word) {
-					OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6104: "
+					OSM_LOG(p_log, OSM_LOG_ERROR,
+						"ERR 6104: "
 						"Failed to get key from line:%u : %s (file:%s)\n",
 						line_num, sLine,
 						p_domain_imp->file_name);
@@ -329,7 +329,8 @@ int osm_db_restore(IN osm_db_domain_t * p_domain)
 					goto EndParsing;
 				}
 				if (strlen(p_first_word) > OSM_DB_MAX_GUID_LEN) {
-					OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 610A: "
+					OSM_LOG(p_log, OSM_LOG_ERROR,
+						"ERR 610A: "
 						"Illegal key from line:%u : %s (file:%s)\n",
 						line_num, sLine,
 						p_domain_imp->file_name);
@@ -337,21 +338,17 @@ int osm_db_restore(IN osm_db_domain_t * p_domain)
 					goto EndParsing;
 				}
 
-				p_key =
-				    (char *)malloc(sizeof(char) *
-						   (strlen(p_first_word) + 1));
+				p_key = malloc(sizeof(char) *
+					       (strlen(p_first_word) + 1));
 				strcpy(p_key, p_first_word);
 
 				p_rest_of_line = strtok_r(NULL, "\n", &p_last);
 				if (p_rest_of_line != NULL) {
-					p_accum_val =
-					    (char *)malloc(sizeof(char) *
-							   (strlen
-							    (p_rest_of_line) +
-							    1));
+					p_accum_val = malloc(sizeof(char) *
+					    (strlen(p_rest_of_line) + 1));
 					strcpy(p_accum_val, p_rest_of_line);
 				} else {
-					p_accum_val = (char *)malloc(2);
+					p_accum_val = malloc(2);
 					strcpy(p_accum_val, "\0");
 				}
 			} else if (sLine[0] != '\n') {
@@ -373,11 +370,11 @@ int osm_db_restore(IN osm_db_domain_t * p_domain)
 				/* make sure the key was not previously used */
 				if (st_lookup(p_domain_imp->p_hash,
 					      (st_data_t) p_key,
-					      (void *) & p_prev_val)) {
-					OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6106: "
+					      (void *)&p_prev_val)) {
+					OSM_LOG(p_log, OSM_LOG_ERROR,
+						"ERR 6106: "
 						"Key:%s already exists in:%s with value:%s."
-						" Removing it\n",
-						p_key,
+						" Removing it\n", p_key,
 						p_domain_imp->file_name,
 						p_prev_val);
 				} else {
@@ -391,7 +388,8 @@ int osm_db_restore(IN osm_db_domain_t * p_domain)
 				/* check that the key is a number */
 				if (!strtouq(p_key, &endptr, 0)
 				    && *endptr != '\0') {
-					OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 610B: "
+					OSM_LOG(p_log, OSM_LOG_ERROR,
+						"ERR 610B: "
 						"Key:%s is invalid\n", p_key);
 				} else {
 					/* store our key and value */
@@ -402,9 +400,8 @@ int osm_db_restore(IN osm_db_domain_t * p_domain)
 			} else {
 				/* accumulate into the value */
 				p_prev_val = p_accum_val;
-				p_accum_val =
-				    (char *)malloc(strlen(p_prev_val) +
-						   strlen(sLine) + 1);
+				p_accum_val = malloc(strlen(p_prev_val) +
+						     strlen(sLine) + 1);
 				strcpy(p_accum_val, p_prev_val);
 				free(p_prev_val);
 				strcat(p_accum_val, sLine);
@@ -421,9 +418,7 @@ Exit:
 	return status;
 }
 
-/***************************************************************************
- ***************************************************************************/
-static int __osm_dump_tbl_entry(st_data_t key, st_data_t val, st_data_t arg)
+static int dump_tbl_entry(st_data_t key, st_data_t val, st_data_t arg)
 {
 	FILE *p_file = (FILE *) arg;
 	char *p_key = (char *)key;
@@ -444,9 +439,8 @@ int osm_db_store(IN osm_db_domain_t * p_domain)
 	OSM_LOG_ENTER(p_log);
 
 	p_domain_imp = (osm_db_domain_imp_t *) p_domain->p_domain_imp;
-	p_tmp_file_name =
-	    (char *)malloc(sizeof(char) *
-			   (strlen(p_domain_imp->file_name) + 8));
+	p_tmp_file_name = malloc(sizeof(char) *
+				 (strlen(p_domain_imp->file_name) + 8));
 	strcpy(p_tmp_file_name, p_domain_imp->file_name);
 	strcat(p_tmp_file_name, ".tmp");
 
@@ -462,8 +456,7 @@ int osm_db_store(IN osm_db_domain_t * p_domain)
 		goto Exit;
 	}
 
-	st_foreach(p_domain_imp->p_hash, __osm_dump_tbl_entry,
-		   (st_data_t) p_file);
+	st_foreach(p_domain_imp->p_hash, dump_tbl_entry, (st_data_t) p_file);
 	fclose(p_file);
 
 	/* move the domain file */
@@ -487,11 +480,9 @@ Exit:
 	return status;
 }
 
-/***************************************************************************
- ***************************************************************************/
 /* simply de-allocate the key and the value and return the code
    that makes the st_foreach delete the entry */
-static int __osm_clear_tbl_entry(st_data_t key, st_data_t val, st_data_t arg)
+static int clear_tbl_entry(st_data_t key, st_data_t val, st_data_t arg)
 {
 	free((char *)key);
 	free((char *)val);
@@ -504,17 +495,13 @@ int osm_db_clear(IN osm_db_domain_t * p_domain)
 	    (osm_db_domain_imp_t *) p_domain->p_domain_imp;
 
 	cl_spinlock_acquire(&p_domain_imp->lock);
-	st_foreach(p_domain_imp->p_hash, __osm_clear_tbl_entry,
-		   (st_data_t) NULL);
+	st_foreach(p_domain_imp->p_hash, clear_tbl_entry, (st_data_t) NULL);
 	cl_spinlock_release(&p_domain_imp->lock);
 
 	return 0;
 }
 
-/***************************************************************************
- ***************************************************************************/
-static int __osm_get_key_of_tbl_entry(st_data_t key, st_data_t val,
-				      st_data_t arg)
+static int get_key_of_tbl_entry(st_data_t key, st_data_t val, st_data_t arg)
 {
 	cl_list_t *p_list = (cl_list_t *) arg;
 	cl_list_insert_tail(p_list, (void *)key);
@@ -528,17 +515,15 @@ int osm_db_keys(IN osm_db_domain_t * p_domain, OUT cl_list_t * p_key_list)
 
 	cl_spinlock_acquire(&p_domain_imp->lock);
 
-	st_foreach(p_domain_imp->p_hash,
-		   __osm_get_key_of_tbl_entry, (st_data_t) p_key_list);
+	st_foreach(p_domain_imp->p_hash, get_key_of_tbl_entry,
+		   (st_data_t) p_key_list);
 
 	cl_spinlock_release(&p_domain_imp->lock);
 
 	return 0;
 }
 
-/***************************************************************************
- ***************************************************************************/
-char *osm_db_lookup(IN osm_db_domain_t * p_domain, IN char *const p_key)
+char *osm_db_lookup(IN osm_db_domain_t * p_domain, IN char *p_key)
 {
 	osm_db_domain_imp_t *p_domain_imp =
 	    (osm_db_domain_imp_t *) p_domain->p_domain_imp;
@@ -546,8 +531,7 @@ char *osm_db_lookup(IN osm_db_domain_t * p_domain, IN char *const p_key)
 
 	cl_spinlock_acquire(&p_domain_imp->lock);
 
-	if (!st_lookup
-	    (p_domain_imp->p_hash, (st_data_t) p_key, (void *) & p_val))
+	if (!st_lookup(p_domain_imp->p_hash, (st_data_t) p_key, (void *)&p_val))
 		p_val = NULL;
 
 	cl_spinlock_release(&p_domain_imp->lock);
@@ -555,11 +539,7 @@ char *osm_db_lookup(IN osm_db_domain_t * p_domain, IN char *const p_key)
 	return p_val;
 }
 
-/***************************************************************************
- ***************************************************************************/
-int
-osm_db_update(IN osm_db_domain_t * p_domain,
-	      IN char *const p_key, IN char *const p_val)
+int osm_db_update(IN osm_db_domain_t * p_domain, IN char *p_key, IN char *p_val)
 {
 	osm_log_t *p_log = p_domain->p_db->p_log;
 	osm_db_domain_imp_t *p_domain_imp =
@@ -571,7 +551,7 @@ osm_db_update(IN osm_db_domain_t * p_domain,
 	cl_spinlock_acquire(&p_domain_imp->lock);
 
 	if (st_lookup(p_domain_imp->p_hash,
-		      (st_data_t) p_key, (void *) & p_prev_val)) {
+		      (st_data_t) p_key, (void *)&p_prev_val)) {
 		OSM_LOG(p_log, OSM_LOG_DEBUG,
 			"Key:%s previously exists in:%s with value:%s\n",
 			p_key, p_domain_imp->file_name, p_prev_val);
@@ -597,9 +577,7 @@ osm_db_update(IN osm_db_domain_t * p_domain,
 	return 0;
 }
 
-/***************************************************************************
- ***************************************************************************/
-int osm_db_delete(IN osm_db_domain_t * p_domain, IN char *const p_key)
+int osm_db_delete(IN osm_db_domain_t * p_domain, IN char *p_key)
 {
 	osm_log_t *p_log = p_domain->p_db->p_log;
 	osm_db_domain_imp_t *p_domain_imp =
@@ -611,15 +589,14 @@ int osm_db_delete(IN osm_db_domain_t * p_domain, IN char *const p_key)
 
 	cl_spinlock_acquire(&p_domain_imp->lock);
 	if (st_delete(p_domain_imp->p_hash,
-		      (void *) & p_key, (void *) & p_prev_val)) {
+		      (void *)&p_key, (void *)&p_prev_val)) {
 		if (st_lookup(p_domain_imp->p_hash,
-			      (st_data_t) p_key, (void *) & p_prev_val)) {
+			      (st_data_t) p_key, (void *)&p_prev_val)) {
 			OSM_LOG(p_log, OSM_LOG_ERROR,
 				"key:%s still exists in:%s with value:%s\n",
 				p_key, p_domain_imp->file_name, p_prev_val);
 			res = 1;
 		} else {
-			free(p_key);
 			free(p_prev_val);
 			res = 0;
 		}
diff --git a/opensm/osm_db_pack.c b/opensm/osm_db_pack.c
index bf56169..ea00c31 100644
--- a/opensm/osm_db_pack.c
+++ b/opensm/osm_db_pack.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -39,27 +39,27 @@
 
 #include <stdlib.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_DB_PACK_C
 #include <opensm/osm_db_pack.h>
 
-static inline void __osm_pack_guid(uint64_t guid, char *p_guid_str)
+static inline void pack_guid(uint64_t guid, char *p_guid_str)
 {
 	sprintf(p_guid_str, "0x%016" PRIx64, guid);
 }
 
-static inline uint64_t __osm_unpack_guid(char *p_guid_str)
+static inline uint64_t unpack_guid(char *p_guid_str)
 {
 	return strtoull(p_guid_str, NULL, 0);
 }
 
-static inline void
-__osm_pack_lids(uint16_t min_lid, uint16_t max_lid, char *p_lid_str)
+static inline void pack_lids(uint16_t min_lid, uint16_t max_lid, char *lid_str)
 {
-	sprintf(p_lid_str, "0x%04x 0x%04x", min_lid, max_lid);
+	sprintf(lid_str, "0x%04x 0x%04x", min_lid, max_lid);
 }
 
-static inline int
-__osm_unpack_lids(IN char *p_lid_str,
-		  OUT uint16_t * p_min_lid, OUT uint16_t * p_max_lid)
+static inline int unpack_lids(IN char *p_lid_str, OUT uint16_t * p_min_lid,
+			      OUT uint16_t * p_max_lid)
 {
 	unsigned long tmp;
 	char *p_next;
@@ -85,9 +85,50 @@ __osm_unpack_lids(IN char *p_lid_str,
 	return 0;
 }
 
-int
-osm_db_guid2lid_guids(IN osm_db_domain_t * const p_g2l,
-		      OUT cl_qlist_t * p_guid_list)
+static inline void pack_mkey(uint64_t mkey, char *p_mkey_str)
+{
+	sprintf(p_mkey_str, "0x%016" PRIx64, mkey);
+}
+
+static inline uint64_t unpack_mkey(char *p_mkey_str)
+{
+	return strtoull(p_mkey_str, NULL, 0);
+}
+
+static inline void pack_neighbor(uint64_t guid, uint8_t portnum, char *p_str)
+{
+	sprintf(p_str, "0x%016" PRIx64 ":%u", guid, portnum);
+}
+
+static inline int unpack_neighbor(char *p_str, uint64_t *guid,
+				  uint8_t *portnum)
+{
+	char tmp_str[24];
+	char *p_num, *p_next;
+	unsigned long tmp_port;
+
+	strncpy(tmp_str, p_str, 23);
+	tmp_str[23] = '\0';
+	p_num = strtok_r(tmp_str, ":", &p_next);
+	if (!p_num)
+		return 1;
+	if (guid)
+		*guid = strtoull(p_num, NULL, 0);
+
+	p_num = strtok_r(NULL, ":", &p_next);
+	if (!p_num)
+		return 1;
+	if (portnum) {
+		tmp_port = strtoul(p_num, NULL, 0);
+		CL_ASSERT(tmp_port < 0x100);
+		*portnum = (uint8_t) tmp_port;
+	}
+
+	return 0;
+}
+
+int osm_db_guid2lid_guids(IN osm_db_domain_t * p_g2l,
+			  OUT cl_qlist_t * p_guid_list)
 {
 	char *p_key;
 	cl_list_t keys;
@@ -104,7 +145,7 @@ osm_db_guid2lid_guids(IN osm_db_domain_t * const p_g2l,
 		    (osm_db_guid_elem_t *) malloc(sizeof(osm_db_guid_elem_t));
 		CL_ASSERT(p_guid_elem != NULL);
 
-		p_guid_elem->guid = __osm_unpack_guid(p_key);
+		p_guid_elem->guid = unpack_guid(p_key);
 		cl_qlist_insert_head(p_guid_list, &p_guid_elem->item);
 	}
 
@@ -112,20 +153,18 @@ osm_db_guid2lid_guids(IN osm_db_domain_t * const p_g2l,
 	return 0;
 }
 
-int
-osm_db_guid2lid_get(IN osm_db_domain_t * const p_g2l,
-		    IN uint64_t guid,
-		    OUT uint16_t * p_min_lid, OUT uint16_t * p_max_lid)
+int osm_db_guid2lid_get(IN osm_db_domain_t * p_g2l, IN uint64_t guid,
+			OUT uint16_t * p_min_lid, OUT uint16_t * p_max_lid)
 {
 	char guid_str[20];
 	char *p_lid_str;
 	uint16_t min_lid, max_lid;
 
-	__osm_pack_guid(guid, guid_str);
+	pack_guid(guid, guid_str);
 	p_lid_str = osm_db_lookup(p_g2l, guid_str);
 	if (!p_lid_str)
 		return 1;
-	if (__osm_unpack_lids(p_lid_str, &min_lid, &max_lid))
+	if (unpack_lids(p_lid_str, &min_lid, &max_lid))
 		return 1;
 
 	if (p_min_lid)
@@ -136,22 +175,155 @@ osm_db_guid2lid_get(IN osm_db_domain_t * const p_g2l,
 	return 0;
 }
 
-int
-osm_db_guid2lid_set(IN osm_db_domain_t * const p_g2l,
-		    IN uint64_t guid, IN uint16_t min_lid, IN uint16_t max_lid)
+int osm_db_guid2lid_set(IN osm_db_domain_t * p_g2l, IN uint64_t guid,
+			IN uint16_t min_lid, IN uint16_t max_lid)
 {
 	char guid_str[20];
 	char lid_str[16];
 
-	__osm_pack_guid(guid, guid_str);
-	__osm_pack_lids(min_lid, max_lid, lid_str);
+	pack_guid(guid, guid_str);
+	pack_lids(min_lid, max_lid, lid_str);
 
-	return (osm_db_update(p_g2l, guid_str, lid_str));
+	return osm_db_update(p_g2l, guid_str, lid_str);
 }
 
-int osm_db_guid2lid_delete(IN osm_db_domain_t * const p_g2l, IN uint64_t guid)
+int osm_db_guid2lid_delete(IN osm_db_domain_t * p_g2l, IN uint64_t guid)
 {
 	char guid_str[20];
-	__osm_pack_guid(guid, guid_str);
-	return (osm_db_delete(p_g2l, guid_str));
+	pack_guid(guid, guid_str);
+	return osm_db_delete(p_g2l, guid_str);
+}
+
+int osm_db_guid2mkey_guids(IN osm_db_domain_t * p_g2m,
+			   OUT cl_qlist_t * p_guid_list)
+{
+	char *p_key;
+	cl_list_t keys;
+	osm_db_guid_elem_t *p_guid_elem;
+
+	cl_list_construct(&keys);
+	cl_list_init(&keys, 10);
+
+	if (osm_db_keys(p_g2m, &keys))
+		return 1;
+
+	while ((p_key = cl_list_remove_head(&keys)) != NULL) {
+		p_guid_elem =
+		    (osm_db_guid_elem_t *) malloc(sizeof(osm_db_guid_elem_t));
+		CL_ASSERT(p_guid_elem != NULL);
+
+		p_guid_elem->guid = unpack_guid(p_key);
+		cl_qlist_insert_head(p_guid_list, &p_guid_elem->item);
+	}
+
+	cl_list_destroy(&keys);
+	return 0;
+}
+
+int osm_db_guid2mkey_get(IN osm_db_domain_t * p_g2m, IN uint64_t guid,
+			 OUT uint64_t * p_mkey)
+{
+	char guid_str[20];
+	char *p_mkey_str;
+
+	pack_guid(guid, guid_str);
+	p_mkey_str = osm_db_lookup(p_g2m, guid_str);
+	if (!p_mkey_str)
+		return 1;
+
+	if (p_mkey)
+		*p_mkey = unpack_mkey(p_mkey_str);
+
+	return 0;
+}
+
+int osm_db_guid2mkey_set(IN osm_db_domain_t * p_g2m, IN uint64_t guid,
+			 IN uint64_t mkey)
+{
+	char guid_str[20];
+	char mkey_str[20];
+
+	pack_guid(guid, guid_str);
+	pack_mkey(mkey, mkey_str);
+
+	return osm_db_update(p_g2m, guid_str, mkey_str);
+}
+
+int osm_db_guid2mkey_delete(IN osm_db_domain_t * p_g2m, IN uint64_t guid)
+{
+	char guid_str[20];
+	pack_guid(guid, guid_str);
+	return osm_db_delete(p_g2m, guid_str);
+}
+
+int osm_db_neighbor_guids(IN osm_db_domain_t * p_neighbor,
+			  OUT cl_qlist_t * p_neighbor_list)
+{
+	char *p_key;
+	cl_list_t keys;
+	osm_db_neighbor_elem_t *p_neighbor_elem;
+
+	cl_list_construct(&keys);
+	cl_list_init(&keys, 10);
+
+	if (osm_db_keys(p_neighbor, &keys))
+		return 1;
+
+	while ((p_key = cl_list_remove_head(&keys)) != NULL) {
+		p_neighbor_elem =
+		    (osm_db_neighbor_elem_t *) malloc(sizeof(osm_db_neighbor_elem_t));
+		CL_ASSERT(p_neighbor_elem != NULL);
+
+		unpack_neighbor(p_key, &p_neighbor_elem->guid,
+				&p_neighbor_elem->portnum);
+		cl_qlist_insert_head(p_neighbor_list, &p_neighbor_elem->item);
+	}
+
+	cl_list_destroy(&keys);
+	return 0;
+}
+
+int osm_db_neighbor_get(IN osm_db_domain_t * p_neighbor, IN uint64_t guid1,
+			IN uint8_t portnum1, OUT uint64_t * p_guid2,
+			OUT uint8_t * p_portnum2)
+{
+	char neighbor_str[24];
+	char *p_other_str;
+	uint64_t temp_guid;
+	uint8_t temp_portnum;
+
+	pack_neighbor(guid1, portnum1, neighbor_str);
+	p_other_str = osm_db_lookup(p_neighbor, neighbor_str);
+	if (!p_other_str)
+		return 1;
+	if (unpack_neighbor(p_other_str, &temp_guid, &temp_portnum))
+		return 1;
+
+	if (p_guid2)
+		*p_guid2 = temp_guid;
+	if (p_portnum2)
+		*p_portnum2 = temp_portnum;
+
+	return 0;
+}
+
+int osm_db_neighbor_set(IN osm_db_domain_t * p_neighbor, IN uint64_t guid1,
+			IN uint8_t portnum1, IN uint64_t guid2,
+			IN uint8_t portnum2)
+{
+	char n1_str[24], n2_str[24];
+
+	pack_neighbor(guid1, portnum1, n1_str);
+	pack_neighbor(guid2, portnum2, n2_str);
+
+	return osm_db_update(p_neighbor, n1_str, n2_str);
+}
+
+int osm_db_neighbor_delete(IN osm_db_domain_t * p_neighbor, IN uint64_t guid,
+			   IN uint8_t portnum)
+{
+	char n_str[24];
+
+	pack_neighbor(guid, portnum, n_str);
+	return osm_db_delete(p_neighbor, n_str);
 }
diff --git a/opensm/osm_drop_mgr.c b/opensm/osm_drop_mgr.c
index 215a155..5e5f1b1 100644
--- a/opensm/osm_drop_mgr.c
+++ b/opensm/osm_drop_mgr.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
  *
@@ -52,21 +52,20 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_ptr_vector.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_DROP_MGR_C
 #include <opensm/osm_sm.h>
 #include <opensm/osm_router.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_node.h>
+#include <opensm/osm_guid.h>
 #include <opensm/osm_helper.h>
-#include <opensm/osm_mcm_info.h>
 #include <opensm/osm_multicast.h>
 #include <opensm/osm_remote_sm.h>
 #include <opensm/osm_inform.h>
 #include <opensm/osm_ucast_mgr.h>
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_drop_mgr_remove_router(osm_sm_t * sm, IN const ib_net64_t portguid)
+static void drop_mgr_remove_router(osm_sm_t * sm, IN const ib_net64_t portguid)
 {
 	osm_router_t *p_rtr;
 	cl_qmap_t *p_rtr_guid_tbl;
@@ -81,8 +80,6 @@ __osm_drop_mgr_remove_router(osm_sm_t * sm, IN const ib_net64_t portguid)
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
 static void drop_mgr_clean_physp(osm_sm_t * sm, IN osm_physp_t * p_physp)
 {
 	osm_physp_t *p_remote_physp;
@@ -94,11 +91,13 @@ static void drop_mgr_clean_physp(osm_sm_t * sm, IN osm_physp_t * p_physp)
 						     p_remote_physp->port_guid);
 
 		if (p_remote_port) {
-			/* Let's check if this is a case of link that is lost (both ports
-			   weren't recognized), or a "hiccup" in the subnet - in which case
-			   the remote port was recognized, and its state is ACTIVE.
-			   If this is just a "hiccup" - force a heavy sweep in the next sweep.
-			   We don't want to lose that part of the subnet. */
+			/* Let's check if this is a case of link that is lost
+			   (both ports weren't recognized), or a "hiccup" in the
+			   subnet - in which case the remote port was
+			   recognized, and its state is ACTIVE.
+			   If this is just a "hiccup" - force a heavy sweep in
+			   the next sweep. We don't want to lose that part of
+			   the subnet. */
 			if (p_remote_port->discovery_count &&
 			    osm_physp_get_port_state(p_remote_physp) ==
 			    IB_LINK_ACTIVE) {
@@ -111,9 +110,10 @@ static void drop_mgr_clean_physp(osm_sm_t * sm, IN osm_physp_t * p_physp)
 				sm->p_subn->force_heavy_sweep = TRUE;
 			}
 
-			/* If the remote node is ca or router - need to remove the remote port,
-			   since it is no longer reachable. This can be done if we reset the
-			   discovery count of the remote port. */
+			/* If the remote node is ca or router - need to remove
+			   the remote port, since it is no longer reachable.
+			   This can be done if we reset the discovery count
+			   of the remote port. */
 			if (!p_remote_physp->p_node->sw) {
 				p_remote_port->discovery_count = 0;
 				OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
@@ -136,8 +136,8 @@ static void drop_mgr_clean_physp(osm_sm_t * sm, IN osm_physp_t * p_physp)
 			p_remote_physp->port_num);
 
 		if (sm->ucast_mgr.cache_valid)
-			osm_ucast_cache_add_link(&sm->ucast_mgr,
-						 p_physp, p_remote_physp);
+			osm_ucast_cache_add_link(&sm->ucast_mgr, p_physp,
+						 p_remote_physp);
 
 		osm_physp_unlink(p_physp, p_remote_physp);
 
@@ -151,21 +151,22 @@ static void drop_mgr_clean_physp(osm_sm_t * sm, IN osm_physp_t * p_physp)
 	osm_physp_destroy(p_physp);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void __osm_drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)
+static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)
 {
 	ib_net64_t port_guid;
 	osm_port_t *p_port_check;
+	cl_qmap_t *p_alias_guid_tbl;
 	cl_qmap_t *p_sm_guid_tbl;
-	osm_mcm_info_t *p_mcm;
-	osm_mgrp_t *p_mgrp;
+	osm_mcm_port_t *mcm_port;
 	cl_ptr_vector_t *p_port_lid_tbl;
 	uint16_t min_lid_ho;
 	uint16_t max_lid_ho;
 	uint16_t lid_ho;
 	osm_node_t *p_node;
 	osm_remote_sm_t *p_sm;
+	osm_alias_guid_t *p_alias_guid, *p_alias_guid_check;
+	osm_guidinfo_work_obj_t *wobj;
+	cl_list_item_t *item, *next_item;
 	ib_gid_t port_gid;
 	ib_mad_notice_attr_t notice;
 	ib_api_status_t status;
@@ -177,8 +178,7 @@ static void __osm_drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)
 		"Unreachable port 0x%016" PRIx64 "\n", cl_ntoh64(port_guid));
 
 	p_port_check =
-	    (osm_port_t *) cl_qmap_remove(&sm->p_subn->port_guid_tbl,
-					  port_guid);
+	    (osm_port_t *) cl_qmap_get(&sm->p_subn->port_guid_tbl, port_guid);
 	if (p_port_check != p_port) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0101: "
 			"Port 0x%016" PRIx64 " not in guid table\n",
@@ -186,6 +186,69 @@ static void __osm_drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)
 		goto Exit;
 	}
 
+	/* issue a notice - trap 65 */
+	/* details of the notice */
+	notice.generic_type = 0x83;	/* is generic subn mgt type */
+	ib_notice_set_prod_type_ho(&notice, 4);	/* A class manager generator */
+	/* endport ceases to be reachable */
+	notice.g_or_v.generic.trap_num = CL_HTON16(65);
+	/* The sm_base_lid is saved in network order already. */
+	notice.issuer_lid = sm->p_subn->sm_base_lid;
+	/* following C14-72.1.2 and table 119 p725 */
+	/* we need to provide the GID */
+	port_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix;
+	port_gid.unicast.interface_id = port_guid;
+	memcpy(&(notice.data_details.ntc_64_67.gid),
+	       &(port_gid), sizeof(ib_gid_t));
+
+	/* According to page 653 - the issuer gid in this case of trap
+	   is the SM gid, since the SM is the initiator of this trap. */
+	notice.issuer_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix;
+	notice.issuer_gid.unicast.interface_id = sm->p_subn->sm_port_guid;
+
+	status = osm_report_notice(sm->p_log, sm->p_subn, &notice);
+	if (status != IB_SUCCESS) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0103: "
+			"Error sending trap reports (%s)\n",
+			ib_get_err_str(status));
+	}
+
+	next_item = cl_qlist_head(&sm->p_subn->alias_guid_list);
+	while (next_item != cl_qlist_end(&sm->p_subn->alias_guid_list)) {
+		item = next_item;
+		next_item = cl_qlist_next(item);
+		wobj = cl_item_obj(item, wobj, list_item);
+		if (wobj->p_port == p_port) {
+			cl_qlist_remove_item(&sm->p_subn->alias_guid_list,
+					     &wobj->list_item);
+			osm_guid_work_obj_delete(wobj);
+		}
+	}
+
+	while (!cl_is_qlist_empty(&p_port->mcm_list)) {
+		mcm_port = cl_item_obj(cl_qlist_head(&p_port->mcm_list),
+				       mcm_port, list_item);
+		osm_mgrp_delete_port(sm->p_subn, sm->p_log, mcm_port->mgrp,
+				     p_port);
+	}
+
+	p_alias_guid_tbl = &sm->p_subn->alias_port_guid_tbl;
+	p_alias_guid_check = (osm_alias_guid_t *) cl_qmap_head(p_alias_guid_tbl);
+	while (p_alias_guid_check != (osm_alias_guid_t *) cl_qmap_end(p_alias_guid_tbl)) {
+		if (p_alias_guid_check->p_base_port == p_port)
+			p_alias_guid = p_alias_guid_check;
+		else
+			p_alias_guid = NULL;
+		p_alias_guid_check = (osm_alias_guid_t *) cl_qmap_next(&p_alias_guid_check->map_item);
+		if (p_alias_guid) {
+			cl_qmap_remove_item(p_alias_guid_tbl,
+					    &p_alias_guid->map_item);
+			osm_alias_guid_delete(&p_alias_guid);
+		}
+	}
+
+	cl_qmap_remove(&sm->p_subn->port_guid_tbl, port_guid);
+
 	p_sm_guid_tbl = &sm->p_subn->sm_guid_tbl;
 	p_sm = (osm_remote_sm_t *) cl_qmap_remove(p_sm_guid_tbl, port_guid);
 	if (p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_guid_tbl)) {
@@ -193,11 +256,13 @@ static void __osm_drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)
 		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 			"Cleaned SM for port guid 0x%016" PRIx64 "\n",
 			cl_ntoh64(port_guid));
-
+		/* clean up the polling_sm pointer */
+		if (sm->p_polling_sm == p_sm)
+			sm->p_polling_sm = NULL;
 		free(p_sm);
 	}
 
-	__osm_drop_mgr_remove_router(sm, port_guid);
+	drop_mgr_remove_router(sm, port_guid);
 
 	osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);
 
@@ -211,52 +276,11 @@ static void __osm_drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)
 
 	drop_mgr_clean_physp(sm, p_port->p_physp);
 
-	p_mcm = (osm_mcm_info_t *) cl_qlist_remove_head(&p_port->mcm_list);
-	while (p_mcm != (osm_mcm_info_t *) cl_qlist_end(&p_port->mcm_list)) {
-		p_mgrp = osm_get_mgrp_by_mlid(sm->p_subn, p_mcm->mlid);
-		if (p_mgrp) {
-			osm_mgrp_delete_port(sm->p_subn, sm->p_log,
-					     p_mgrp, p_port->guid);
-			osm_mcm_info_delete((osm_mcm_info_t *) p_mcm);
-		}
-		p_mcm =
-		    (osm_mcm_info_t *) cl_qlist_remove_head(&p_port->mcm_list);
-	}
-
 	/* initialize the p_node - may need to get node_desc later */
 	p_node = p_port->p_node;
 
 	osm_port_delete(&p_port);
 
-	/* issue a notice - trap 65 */
-
-	/* details of the notice */
-	notice.generic_type = 0x83;	/* is generic subn mgt type */
-	ib_notice_set_prod_type_ho(&notice, 4);	/* A class manager generator */
-	/* endport ceases to be reachable */
-	notice.g_or_v.generic.trap_num = CL_HTON16(65);
-	/* The sm_base_lid is saved in network order already. */
-	notice.issuer_lid = sm->p_subn->sm_base_lid;
-	/* following C14-72.1.2 and table 119 p725 */
-	/* we need to provide the GID */
-	port_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix;
-	port_gid.unicast.interface_id = port_guid;
-	memcpy(&(notice.data_details.ntc_64_67.gid),
-	       &(port_gid), sizeof(ib_gid_t));
-
-	/* According to page 653 - the issuer gid in this case of trap
-	   is the SM gid, since the SM is the initiator of this trap. */
-	notice.issuer_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix;
-	notice.issuer_gid.unicast.interface_id = sm->p_subn->sm_port_guid;
-
-	status = osm_report_notice(sm->p_log, sm->p_subn, &notice);
-	if (status != IB_SUCCESS) {
-		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0103: "
-			"Error sending trap reports (%s)\n",
-			ib_get_err_str(status));
-		goto Exit;
-	}
-
 	OSM_LOG(sm->p_log, OSM_LOG_INFO,
 		"Removed port with GUID:0x%016" PRIx64
 		" LID range [%u, %u] of node:%s\n",
@@ -268,9 +292,7 @@ Exit:
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void __osm_drop_mgr_remove_switch(osm_sm_t * sm, IN osm_node_t * p_node)
+static void drop_mgr_remove_switch(osm_sm_t * sm, IN osm_node_t * p_node)
 {
 	osm_switch_t *p_sw;
 	cl_qmap_t *p_sw_guid_tbl;
@@ -294,10 +316,7 @@ static void __osm_drop_mgr_remove_switch(osm_sm_t * sm, IN osm_node_t * p_node)
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static boolean_t
-__osm_drop_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node)
+static boolean_t drop_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node)
 {
 	osm_physp_t *p_physp;
 	osm_port_t *p_port;
@@ -329,7 +348,7 @@ __osm_drop_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node)
 			p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
 
 			if (p_port)
-				__osm_drop_mgr_remove_port(sm, p_port);
+				drop_mgr_remove_port(sm, p_port);
 			else
 				drop_mgr_clean_physp(sm, p_physp);
 		}
@@ -338,7 +357,7 @@ __osm_drop_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node)
 	return_val = TRUE;
 
 	if (p_node->sw)
-		__osm_drop_mgr_remove_switch(sm, p_node);
+		drop_mgr_remove_switch(sm, p_node);
 
 	p_node_check =
 	    (osm_node_t *) cl_qmap_remove(&sm->p_subn->node_guid_tbl,
@@ -353,12 +372,10 @@ __osm_drop_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node)
 	osm_node_delete(&p_node);
 
 	OSM_LOG_EXIT(sm->p_log);
-	return (return_val);
+	return return_val;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void __osm_drop_mgr_check_node(osm_sm_t * sm, IN osm_node_t * p_node)
+static void drop_mgr_check_node(osm_sm_t * sm, IN osm_node_t * p_node)
 {
 	ib_net64_t node_guid;
 	osm_physp_t *p_physp;
@@ -383,7 +400,7 @@ static void __osm_drop_mgr_check_node(osm_sm_t * sm, IN osm_node_t * p_node)
 			"Node 0x%016" PRIx64 " no switch in table\n",
 			cl_ntoh64(node_guid));
 
-		__osm_drop_mgr_process_node(sm, p_node);
+		drop_mgr_process_node(sm, p_node);
 		goto Exit;
 	}
 
@@ -394,7 +411,7 @@ static void __osm_drop_mgr_check_node(osm_sm_t * sm, IN osm_node_t * p_node)
 			"Node 0x%016" PRIx64 " no valid physical port 0\n",
 			cl_ntoh64(node_guid));
 
-		__osm_drop_mgr_process_node(sm, p_node);
+		drop_mgr_process_node(sm, p_node);
 		goto Exit;
 	}
 
@@ -407,7 +424,7 @@ static void __osm_drop_mgr_check_node(osm_sm_t * sm, IN osm_node_t * p_node)
 			"Node 0x%016" PRIx64 " has no port object\n",
 			cl_ntoh64(node_guid));
 
-		__osm_drop_mgr_process_node(sm, p_node);
+		drop_mgr_process_node(sm, p_node);
 		goto Exit;
 	}
 
@@ -416,7 +433,7 @@ static void __osm_drop_mgr_check_node(osm_sm_t * sm, IN osm_node_t * p_node)
 			"Node 0x%016" PRIx64 " port has discovery count zero\n",
 			cl_ntoh64(node_guid));
 
-		__osm_drop_mgr_process_node(sm, p_node);
+		drop_mgr_process_node(sm, p_node);
 		goto Exit;
 	}
 
@@ -425,16 +442,11 @@ Exit:
 	return;
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_drop_mgr_process(osm_sm_t * sm)
 {
-	cl_qmap_t *p_node_guid_tbl;
-	cl_qmap_t *p_port_guid_tbl;
-	osm_port_t *p_port;
-	osm_port_t *p_next_port;
-	osm_node_t *p_node;
-	osm_node_t *p_next_node;
+	cl_qmap_t *p_node_guid_tbl, *p_port_guid_tbl;
+	osm_port_t *p_port, *p_next_port;
+	osm_node_t *p_node, *p_next_node;
 
 	CL_ASSERT(sm);
 
@@ -464,7 +476,7 @@ void osm_drop_mgr_process(osm_sm_t * sm)
 		   should therefore be removed from the subnet object.
 		 */
 		if (p_node->discovery_count == 0)
-			__osm_drop_mgr_process_node(sm, p_node);
+			drop_mgr_process_node(sm, p_node);
 	}
 
 	/*
@@ -488,7 +500,7 @@ void osm_drop_mgr_process(osm_sm_t * sm)
 			continue;
 
 		/* We are handling a switch node */
-		__osm_drop_mgr_check_node(sm, p_node);
+		drop_mgr_check_node(sm, p_node);
 	}
 
 	p_next_port = (osm_port_t *) cl_qmap_head(p_port_guid_tbl);
@@ -508,7 +520,7 @@ void osm_drop_mgr_process(osm_sm_t * sm)
 		   If the port is unreachable, remove it from the guid table.
 		 */
 		if (p_port->discovery_count == 0)
-			__osm_drop_mgr_remove_port(sm, p_port);
+			drop_mgr_remove_port(sm, p_port);
 	}
 
 	CL_PLOCK_RELEASE(sm->p_lock);
diff --git a/opensm/osm_dump.c b/opensm/osm_dump.c
index 7e0ba47..daaa98e 100644
--- a/opensm/osm_dump.c
+++ b/opensm/osm_dump.c
@@ -1,6 +1,7 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -49,6 +50,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_DUMP_C
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
@@ -57,8 +60,8 @@
 #include <opensm/osm_msgdef.h>
 #include <opensm/osm_opensm.h>
 
-static void dump_ucast_path_distribution(cl_map_item_t * p_map_item,
-					 FILE *file, void *cxt)
+static void dump_ucast_path_distribution(cl_map_item_t * item, FILE * file,
+					 void *cxt)
 {
 	osm_node_t *p_node;
 	osm_node_t *p_remote_node;
@@ -66,7 +69,7 @@ static void dump_ucast_path_distribution(cl_map_item_t * p_map_item,
 	uint8_t num_ports;
 	uint32_t num_paths;
 	ib_net64_t remote_guid_ho;
-	osm_switch_t *p_sw = (osm_switch_t *) p_map_item;
+	osm_switch_t *p_sw = (osm_switch_t *) item;
 
 	p_node = p_sw->p_node;
 	num_ports = p_sw->num_ports;
@@ -111,7 +114,7 @@ static void dump_ucast_path_distribution(cl_map_item_t * p_map_item,
 	fprintf(file, "\n");
 }
 
-static void dump_ucast_routes(cl_map_item_t *p_map_item, FILE *file, void *cxt)
+static void dump_ucast_routes(cl_map_item_t * item, FILE * file, void *cxt)
 {
 	const osm_node_t *p_node;
 	osm_port_t *p_port;
@@ -123,23 +126,24 @@ static void dump_ucast_routes(cl_map_item_t *p_map_item, FILE *file, void *cxt)
 	uint16_t lid_ho, base_lid;
 	boolean_t direct_route_exists = FALSE;
 	boolean_t dor;
-	osm_switch_t *p_sw = (osm_switch_t *) p_map_item;
+	osm_switch_t *p_sw = (osm_switch_t *) item;
 	osm_opensm_t *p_osm = cxt;
 
 	p_node = p_sw->p_node;
 
 	max_lid_ho = p_sw->max_lid_ho;
 
-	fprintf(file, "__osm_ucast_mgr_dump_ucast_routes: "
+	fprintf(file, "dump_ucast_routes: "
 		"Switch 0x%016" PRIx64 "\nLID    : Port : Hops : Optimal\n",
 		cl_ntoh64(osm_node_get_node_guid(p_node)));
 
-	dor = (p_osm->routing_engine_used == OSM_ROUTING_ENGINE_TYPE_DOR);
+	dor = (p_osm->routing_engine_used &&
+	       p_osm->routing_engine_used->type == OSM_ROUTING_ENGINE_TYPE_DOR);
 
 	for (lid_ho = 1; lid_ho <= max_lid_ho; lid_ho++) {
 		fprintf(file, "0x%04X : ", lid_ho);
 
-		p_port = cl_ptr_vector_get(&p_osm->subn.port_lid_tbl, lid_ho);
+		p_port = osm_get_port_by_lid_ho(&p_osm->subn, lid_ho);
 		if (!p_port) {
 			fprintf(file, "UNREACHABLE\n");
 			continue;
@@ -201,7 +205,7 @@ static void dump_ucast_routes(cl_map_item_t *p_map_item, FILE *file, void *cxt)
 		}
 
 		if (num_hops == OSM_NO_PATH) {
-			fprintf(file, "UNREACHABLE\n");
+			fprintf(file, "%03u  : HOPS UNKNOWN\n", port_num);
 			continue;
 		}
 
@@ -219,7 +223,9 @@ static void dump_ucast_routes(cl_map_item_t *p_map_item, FILE *file, void *cxt)
 			/* No LMC Optimization */
 			best_port = osm_switch_recommend_path(p_sw, p_port,
 							      lid_ho, 1, TRUE,
-							      dor);
+							      FALSE, dor,
+							      p_osm->subn.opt.port_shifting,
+							      p_osm->subn.opt.scatter_ports);
 			fprintf(file, "No %u hop path possible via port %u!",
 				best_hops, best_port);
 		}
@@ -228,9 +234,9 @@ static void dump_ucast_routes(cl_map_item_t *p_map_item, FILE *file, void *cxt)
 	}
 }
 
-static void dump_mcast_routes(cl_map_item_t *p_map_item, FILE *file, void *cxt)
+static void dump_mcast_routes(cl_map_item_t * item, FILE * file, void *cxt)
 {
-	osm_switch_t *p_sw = (osm_switch_t *) p_map_item;
+	osm_switch_t *p_sw = (osm_switch_t *) item;
 	osm_mcast_tbl_t *p_tbl;
 	int16_t mlid_ho = 0;
 	int16_t mlid_start_ho;
@@ -292,9 +298,9 @@ static void dump_mcast_routes(cl_map_item_t *p_map_item, FILE *file, void *cxt)
 	}
 }
 
-static void dump_lid_matrix(cl_map_item_t *p_map_item, FILE *file, void *cxt)
+static void dump_lid_matrix(cl_map_item_t * item, FILE * file, void *cxt)
 {
-	osm_switch_t *p_sw = (osm_switch_t *) p_map_item;
+	osm_switch_t *p_sw = (osm_switch_t *) item;
 	osm_opensm_t *p_osm = cxt;
 	osm_node_t *p_node = p_sw->p_node;
 	unsigned max_lid = p_sw->max_lid_ho;
@@ -312,7 +318,7 @@ static void dump_lid_matrix(cl_map_item_t *p_map_item, FILE *file, void *cxt)
 		for (port = 0; port < max_port; port++)
 			fprintf(file, " %02x",
 				osm_switch_get_hop_count(p_sw, lid, port));
-		p_port = cl_ptr_vector_get(&p_osm->subn.port_lid_tbl, lid);
+		p_port = osm_get_port_by_lid_ho(&p_osm->subn, lid);
 		if (p_port)
 			fprintf(file, " # portguid 0x016%" PRIx64,
 				cl_ntoh64(osm_port_get_guid(p_port)));
@@ -320,9 +326,9 @@ static void dump_lid_matrix(cl_map_item_t *p_map_item, FILE *file, void *cxt)
 	}
 }
 
-static void dump_ucast_lfts(cl_map_item_t *p_map_item, FILE *file, void *cxt)
+static void dump_ucast_lfts(cl_map_item_t * item, FILE * file, void *cxt)
 {
-	osm_switch_t *p_sw = (osm_switch_t *) p_map_item;
+	osm_switch_t *p_sw = (osm_switch_t *) item;
 	osm_opensm_t *p_osm = cxt;
 	osm_node_t *p_node = p_sw->p_node;
 	unsigned max_lid = p_sw->max_lid_ho;
@@ -343,7 +349,7 @@ static void dump_ucast_lfts(cl_map_item_t *p_map_item, FILE *file, void *cxt)
 
 		fprintf(file, "0x%04x %03u # ", lid, port);
 
-		p_port = cl_ptr_vector_get(&p_osm->subn.port_lid_tbl, lid);
+		p_port = osm_get_port_by_lid_ho(&p_osm->subn, lid);
 		if (p_port) {
 			p_node = p_port->p_node;
 			fprintf(file, "%s portguid 0x%016" PRIx64 ": \'%s\'",
@@ -357,13 +363,14 @@ static void dump_ucast_lfts(cl_map_item_t *p_map_item, FILE *file, void *cxt)
 	fprintf(file, "%u lids dumped\n", max_lid);
 }
 
-static void dump_topology_node(cl_map_item_t *p_map_item, FILE *file, void *cxt)
+static void dump_topology_node(cl_map_item_t * item, FILE * file, void *cxt)
 {
-	osm_node_t *p_node = (osm_node_t *) p_map_item;
+	osm_node_t *p_node = (osm_node_t *) item;
 	uint32_t cPort;
 	osm_node_t *p_nbnode;
 	osm_physp_t *p_physp, *p_default_physp, *p_rphysp;
 	uint8_t link_speed_act;
+	char *link_speed_act_str;
 
 	if (!p_node->node_info.num_ports)
 		return;
@@ -440,6 +447,28 @@ static void dump_topology_node(cl_map_item_t *p_map_item, FILE *file, void *cxt)
 		port_state = ib_port_info_get_port_state(&p_physp->port_info);
 		link_speed_act =
 		    ib_port_info_get_link_speed_active(&p_physp->port_info);
+		if (link_speed_act == IB_LINK_SPEED_ACTIVE_2_5)
+			link_speed_act_str = "2.5";
+		else if (link_speed_act == IB_LINK_SPEED_ACTIVE_5)
+			link_speed_act_str = "5";
+		else if (link_speed_act == IB_LINK_SPEED_ACTIVE_10)
+			link_speed_act_str = "10";
+		else
+			link_speed_act_str = "??";
+
+		if (p_physp->ext_port_info.link_speed_active & FDR10)
+			link_speed_act_str = "FDR10";
+
+		if (p_default_physp->port_info.capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) {
+			link_speed_act =
+			    ib_port_info_get_link_speed_ext_active(&p_physp->port_info);
+			if (link_speed_act == IB_LINK_SPEED_EXT_ACTIVE_14)
+				link_speed_act_str = "14";
+			else if (link_speed_act == IB_LINK_SPEED_EXT_ACTIVE_25)
+				link_speed_act_str = "25";
+			else if (link_speed_act != IB_LINK_SPEED_EXT_ACTIVE_NONE)
+				link_speed_act_str = "??";
+		}
 
 		fprintf(file, "PHY=%s LOG=%s SPD=%s\n",
 			p_physp->port_info.link_width_active == 1 ? "1x" :
@@ -449,15 +478,67 @@ static void dump_topology_node(cl_map_item_t *p_map_item, FILE *file, void *cxt)
 			port_state == IB_LINK_ACTIVE ? "ACT" :
 			port_state == IB_LINK_ARMED ? "ARM" :
 			port_state == IB_LINK_INIT ? "INI" : "DWN",
-			link_speed_act == 1 ? "2.5" :
-			link_speed_act == 2 ? "5" :
-			link_speed_act == 4 ? "10" : "??");
+			link_speed_act_str);
+	}
+}
+
+static void dump_sl2vl_tbl(cl_map_item_t * item, FILE * file, void *cxt)
+{
+	osm_port_t *p_port = (osm_port_t *) item;
+	osm_node_t *p_node = p_port->p_node;
+	uint32_t in_port, out_port,
+		 num_ports = p_node->node_info.num_ports;
+	ib_net16_t base_lid = osm_port_get_base_lid(p_port);
+	osm_physp_t *p_physp;
+	ib_slvl_table_t *p_tbl;
+	int i, n;
+	char buf[1024];
+	char * header_line =	"#in out : 0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15";
+	char * separator_line = "#--------------------------------------------------------";
+
+	if (!num_ports)
+		return;
+
+	fprintf(file, "%s 0x%016" PRIx64 ", base LID %d, "
+		"\"%s\"\n%s\n%s\n",
+		ib_get_node_type_str(p_node->node_info.node_type),
+		cl_ntoh64(p_port->guid), cl_ntoh16(base_lid),
+		p_node->print_desc, header_line, separator_line);
+
+	if (p_node->node_info.node_type == IB_NODE_TYPE_SWITCH) {
+		for (out_port = 0; out_port <= num_ports; out_port++){
+			p_physp = osm_node_get_physp_ptr(p_node, out_port);
+
+			/* no need to print SL2VL table for port that is down */
+			if (!p_physp->p_remote_physp)
+				continue;
+
+			for (in_port = 0; in_port <= num_ports; in_port++) {
+				p_tbl = osm_physp_get_slvl_tbl(p_physp, in_port);
+				for (i = 0, n = 0; i < 16; i++)
+					n += sprintf(buf + n, " %-2d",
+						ib_slvl_table_get(p_tbl, i));
+				fprintf(file, "%-3d %-3d :%s\n",
+					in_port, out_port, buf);
+			}
+		}
+	} else {
+		p_physp = p_port->p_physp;
+		CL_ASSERT(p_physp->p_remote_physp);
+		p_tbl = osm_physp_get_slvl_tbl(p_physp, 0);
+		for (i = 0, n = 0; i < 16; i++)
+			n += sprintf(buf + n, " %-2d",
+					ib_slvl_table_get(p_tbl, i));
+		fprintf(file, "%-3d %-3d :%s\n",
+			0, p_physp->port_num, buf);
 	}
+
+	fprintf(file, "%s\n\n", separator_line);
 }
 
-static void print_node_report(cl_map_item_t *p_map_item, FILE *file, void *cxt)
+static void print_node_report(cl_map_item_t * item, FILE * file, void *cxt)
 {
-	osm_node_t *p_node = (osm_node_t *) p_map_item;
+	osm_node_t *p_node = (osm_node_t *) item;
 	osm_opensm_t *osm = cxt;
 	const osm_physp_t *p_physp, *p_remote_physp;
 	const ib_port_info_t *p_pi;
@@ -510,9 +591,12 @@ static void print_node_report(cl_map_item_t *p_map_item, FILE *file, void *cxt)
 				(ib_port_info_get_neighbor_mtu(p_pi)),
 				osm_get_lwa_str(p_pi->link_width_active),
 				osm_get_lsa_str
-				(ib_port_info_get_link_speed_active(p_pi)));
+				(ib_port_info_get_link_speed_active(p_pi),
+				 ib_port_info_get_link_speed_ext_active(p_pi),
+				 ib_port_info_get_port_state(p_pi),
+				 p_physp->ext_port_info.link_speed_active & FDR10));
 		else
-			fprintf(file, "      :     :     ");
+			fprintf(file, "      :     :      ");
 
 		if (osm_physp_get_port_guid(p_physp) == osm->subn.sm_port_guid)
 			fprintf(file, "* %016" PRIx64 " *",
@@ -527,7 +611,7 @@ static void print_node_report(cl_map_item_t *p_map_item, FILE *file, void *cxt)
 			if (p_remote_physp)
 				fprintf(file, " %016" PRIx64 " (%02X)",
 					cl_ntoh64(osm_physp_get_port_guid
-					 (p_remote_physp)),
+						  (p_remote_physp)),
 					osm_physp_get_port_num(p_remote_physp));
 			else
 				fprintf(file, " UNKNOWN");
@@ -540,8 +624,6 @@ static void print_node_report(cl_map_item_t *p_map_item, FILE *file, void *cxt)
 		"------------------------------------------------\n");
 }
 
-/**********************************************************************
- **********************************************************************/
 struct dump_context {
 	osm_opensm_t *p_osm;
 	FILE *file;
@@ -549,15 +631,15 @@ struct dump_context {
 	void *cxt;
 };
 
-static void dump_item(cl_map_item_t *item, void *cxt)
+static void dump_item(cl_map_item_t * item, void *cxt)
 {
 	((struct dump_context *)cxt)->func(item,
 					   ((struct dump_context *)cxt)->file,
 					   ((struct dump_context *)cxt)->cxt);
 }
 
-static void dump_qmap(FILE *file, cl_qmap_t *map,
-		      void (*func)(cl_map_item_t *, FILE *, void *), void *cxt)
+static void dump_qmap(FILE * file, cl_qmap_t * map,
+		      void (*func) (cl_map_item_t *, FILE *, void *), void *cxt)
 {
 	struct dump_context dump_context;
 
@@ -592,21 +674,19 @@ void osm_dump_qmap_to_file(osm_opensm_t * p_osm, const char *file_name,
 	fclose(file);
 }
 
-/**********************************************************************
- **********************************************************************/
 
-static void print_report(osm_opensm_t *osm, FILE *file)
+static void print_report(osm_opensm_t * osm, FILE * file)
 {
 	fprintf(file, "\n==================================================="
 		"====================================================\n"
 		"Vendor      : Ty : #  : Sta : LID  : LMC : MTU  : LWA :"
-		" LSA : Port GUID        : Neighbor Port (Port #)\n");
+		" LSA  : Port GUID        : Neighbor Port (Port #)\n");
 	dump_qmap(stdout, &osm->subn.node_guid_tbl, print_node_report, osm);
 }
 
 void osm_dump_mcast_routes(osm_opensm_t * osm)
 {
-	if (osm_log_is_active(&osm->log, OSM_LOG_ROUTING))
+	if (OSM_LOG_IS_ACTIVE_V2(&osm->log, OSM_LOG_ROUTING))
 		/* multicast routes */
 		osm_dump_qmap_to_file(osm, "opensm.mcfdbs",
 				      &osm->subn.sw_guid_tbl,
@@ -615,7 +695,7 @@ void osm_dump_mcast_routes(osm_opensm_t * osm)
 
 void osm_dump_all(osm_opensm_t * osm)
 {
-	if (osm_log_is_active(&osm->log, OSM_LOG_ROUTING)) {
+	if (OSM_LOG_IS_ACTIVE_V2(&osm->log, OSM_LOG_ROUTING)) {
 		/* unicast routes */
 		osm_dump_qmap_to_file(osm, "opensm-lid-matrix.dump",
 				      &osm->subn.sw_guid_tbl, dump_lid_matrix,
@@ -623,9 +703,15 @@ void osm_dump_all(osm_opensm_t * osm)
 		osm_dump_qmap_to_file(osm, "opensm-lfts.dump",
 				      &osm->subn.sw_guid_tbl, dump_ucast_lfts,
 				      osm);
-		if (osm_log_is_active(&osm->log, OSM_LOG_DEBUG))
+		if (OSM_LOG_IS_ACTIVE_V2(&osm->log, OSM_LOG_DEBUG))
 			dump_qmap(stdout, &osm->subn.sw_guid_tbl,
 				  dump_ucast_path_distribution, osm);
+
+		/* An attempt to get osm_switch_recommend_path to report the
+		   same routes that a sweep would assign. */
+		if (osm->subn.opt.scatter_ports)
+			srandom(osm->subn.opt.scatter_ports);
+
 		osm_dump_qmap_to_file(osm, "opensm.fdbs",
 				      &osm->subn.sw_guid_tbl,
 				      dump_ucast_routes, osm);
@@ -633,10 +719,17 @@ void osm_dump_all(osm_opensm_t * osm)
 		osm_dump_qmap_to_file(osm, "opensm.mcfdbs",
 				      &osm->subn.sw_guid_tbl,
 				      dump_mcast_routes, osm);
+		/* SL2VL tables */
+		if (osm->subn.opt.qos ||
+		    (osm->routing_engine_used &&
+		     osm->routing_engine_used->update_sl2vl))
+			osm_dump_qmap_to_file(osm, "opensm-sl2vl.dump",
+					      &osm->subn.port_guid_tbl,
+					      dump_sl2vl_tbl, osm);
 	}
 	osm_dump_qmap_to_file(osm, "opensm-subnet.lst",
 			      &osm->subn.node_guid_tbl, dump_topology_node,
 			      osm);
-	if (osm_log_is_active(&osm->log, OSM_LOG_VERBOSE))
+	if (OSM_LOG_IS_ACTIVE_V2(&osm->log, OSM_LOG_VERBOSE))
 		print_report(osm, stdout);
 }
diff --git a/opensm/osm_event_plugin.c b/opensm/osm_event_plugin.c
index b0dc549..ae73783 100644
--- a/opensm/osm_event_plugin.c
+++ b/opensm/osm_event_plugin.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2008-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2007 The Regents of the University of California.
  *
  * This software is available to you under a choice of one of two
@@ -49,6 +49,8 @@
 
 #include <stdlib.h>
 #include <dlfcn.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_EVENT_PLUGIN_C
 #include <opensm/osm_event_plugin.h>
 #include <opensm/osm_opensm.h>
 
@@ -70,14 +72,14 @@ osm_epi_plugin_t *osm_epi_construct(osm_opensm_t *osm, char *plugin_name)
 	osm_epi_plugin_t *rc = NULL;
 
 	if (!plugin_name || !*plugin_name)
-		return (NULL);
+		return NULL;
 
 	/* find the plugin */
-	snprintf(lib_name, OSM_PATH_MAX, "lib%s.so", plugin_name);
+	snprintf(lib_name, sizeof(lib_name), "lib%s.so", plugin_name);
 
 	rc = malloc(sizeof(*rc));
 	if (!rc)
-		return (NULL);
+		return NULL;
 
 	rc->handle = dlopen(lib_name, RTLD_LAZY);
 	if (!rc->handle) {
@@ -129,13 +131,13 @@ osm_epi_plugin_t *osm_epi_construct(osm_opensm_t *osm, char *plugin_name)
 		goto Exit;
 
 	rc->plugin_name = strdup(plugin_name);
-	return (rc);
+	return rc;
 
 Exit:
 	dlclose(rc->handle);
 DLOPENFAIL:
 	free(rc);
-	return (NULL);
+	return NULL;
 }
 
 void osm_epi_destroy(osm_epi_plugin_t * plugin)
diff --git a/opensm/osm_mcast_fwd_rcv.c b/opensm/osm_guid_info_rcv.c
similarity index 53%
copy from opensm/osm_mcast_fwd_rcv.c
copy to opensm/osm_guid_info_rcv.c
index 635c7da..141bcb1 100644
--- a/opensm/osm_mcast_fwd_rcv.c
+++ b/opensm/osm_guid_info_rcv.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -35,8 +35,8 @@
 
 /*
  * Abstract:
- *    Implementation of osm_mft_rcv_t.
- * This object represents the Multicast Forwarding Table Receiver object.
+ *    Implementation of osm_gi_rcv_t.
+ * This object represents the GUIDInfo Receiver object.
  * This object is part of the opensm family of objects.
  */
 
@@ -45,77 +45,72 @@
 #endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
+#include <stdlib.h>
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_GUID_INFO_RCV_C
+#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
-#include <opensm/osm_switch.h>
+#include <opensm/osm_node.h>
 #include <opensm/osm_subnet.h>
-#include <opensm/osm_sm.h>
+#include <opensm/osm_mad_pool.h>
+#include <opensm/osm_msgdef.h>
+#include <opensm/osm_helper.h>
+#include <opensm/osm_remote_sm.h>
+#include <opensm/osm_opensm.h>
 
-/**********************************************************************
- **********************************************************************/
-void osm_mft_rcv_process(IN void *context, IN void *data)
+void osm_gi_rcv_process(IN void *context, IN void *data)
 {
 	osm_sm_t *sm = context;
 	osm_madw_t *p_madw = data;
+	ib_guid_info_t *p_gi;
 	ib_smp_t *p_smp;
-	uint32_t block_num;
-	uint8_t position;
-	osm_switch_t *p_sw;
-	osm_mft_context_t *p_mft_context;
-	uint16_t *p_block;
-	ib_net64_t node_guid;
-	ib_api_status_t status;
-
-	CL_ASSERT(sm);
+	osm_port_t *p_port;
+	osm_gi_context_t *p_context;
+	ib_net64_t port_guid, node_guid;
+	uint8_t block_num;
 
 	OSM_LOG_ENTER(sm->p_log);
 
+	CL_ASSERT(sm);
 	CL_ASSERT(p_madw);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_block = (uint16_t *) ib_smp_get_payload_ptr(p_smp);
-	block_num = cl_ntoh32(p_smp->attr_mod) & IB_MCAST_BLOCK_ID_MASK_HO;
-	position = (uint8_t) ((cl_ntoh32(p_smp->attr_mod) &
-			       IB_MCAST_POSITION_MASK_HO) >>
-			      IB_MCAST_POSITION_SHIFT);
+	p_context = osm_madw_get_gi_context_ptr(p_madw);
+	p_gi = ib_smp_get_payload_ptr(p_smp);
 
-	/*
-	   Acquire the switch object for this switch.
-	 */
-	p_mft_context = osm_madw_get_mft_context_ptr(p_madw);
-	node_guid = p_mft_context->node_guid;
+	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_GUID_INFO);
 
-	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-		"Setting MFT block %u, position %u, "
-		"Switch 0x%016" PRIx64 ", TID 0x%" PRIx64 "\n",
-		block_num, position, cl_ntoh64(node_guid),
-		cl_ntoh64(p_smp->trans_id));
+	block_num = (uint8_t) cl_ntoh32(p_smp->attr_mod);
 
-	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
-	p_sw = osm_get_switch_by_guid(sm->p_subn, node_guid);
+	port_guid = p_context->port_guid;
+	node_guid = p_context->node_guid;
 
-	if (!p_sw) {
-		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0801: "
-			"MFT received for nonexistent node "
-			"0x%016" PRIx64 "\n", cl_ntoh64(node_guid));
-	} else {
-		status = osm_switch_set_mft_block(p_sw, p_block,
-						  (uint16_t) block_num,
-						  position);
-		if (status != IB_SUCCESS) {
-			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0802: "
-				"Setting MFT block failed (%s)"
-				"\n\t\t\t\tSwitch 0x%016" PRIx64
-				", block %u, position %u\n",
-				ib_get_err_str(status),
-				cl_ntoh64(node_guid), block_num, position);
-		}
+	osm_dump_guid_info_v2(sm->p_log, node_guid, port_guid, block_num, p_gi,
+			      FILE_ID, OSM_LOG_DEBUG);
+
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
+	p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
+	if (!p_port) {
+		CL_PLOCK_RELEASE(sm->p_lock);
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4701: "
+			"No port object for port with GUID 0x%" PRIx64
+			"\n\t\t\t\tfor parent node GUID 0x%" PRIx64
+			", TID 0x%" PRIx64 "\n",
+			cl_ntoh64(port_guid), cl_ntoh64(node_guid),
+			cl_ntoh64(p_smp->trans_id));
+		goto Exit;
 	}
 
 	CL_PLOCK_RELEASE(sm->p_lock);
+
+Exit:
+	/*
+	   Release the lock before jumping here!!
+	 */
 	OSM_LOG_EXIT(sm->p_log);
 }
diff --git a/opensm/osm_guid_mgr.c b/opensm/osm_guid_mgr.c
new file mode 100644
index 0000000..5bb2c67
--- /dev/null
+++ b/opensm/osm_guid_mgr.c
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+/*
+ * Abstract:
+ *    Implementation of osm_guid_mgr_t.
+ * This object implements the GUID manager object.
+ * This object is part of the opensm family of objects.
+ */
+
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif				/* HAVE_CONFIG_H */
+
+#include <string.h>
+#include <iba/ib_types.h>
+#include <complib/cl_debug.h>
+#include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_GUID_MGR_C
+#include <opensm/osm_port.h>
+#include <opensm/osm_node.h>
+#include <opensm/osm_guid.h>
+#include <opensm/osm_opensm.h>
+
+static void guidinfo_set(IN osm_sa_t *sa, IN osm_port_t *p_port,
+			 IN uint8_t block_num)
+{
+	uint8_t payload[IB_SMP_DATA_SIZE];
+	osm_madw_context_t context;
+	ib_api_status_t status;
+
+	memcpy(payload,
+	       &((*p_port->p_physp->p_guids)[block_num * GUID_TABLE_MAX_ENTRIES]),
+	       sizeof(ib_guid_info_t));
+
+	context.gi_context.node_guid = osm_node_get_node_guid(p_port->p_node);
+	context.gi_context.port_guid = osm_physp_get_port_guid(p_port->p_physp);
+	context.gi_context.set_method = TRUE;
+	context.gi_context.port_num = osm_physp_get_port_num(p_port->p_physp);
+
+	status = osm_req_set(sa->sm, osm_physp_get_dr_path_ptr(p_port->p_physp),
+			     payload, sizeof(payload), IB_MAD_ATTR_GUID_INFO,
+			     cl_hton32((uint32_t)block_num),
+			     CL_DISP_MSGID_NONE, &context);
+	if (status != IB_SUCCESS)
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5109: "
+			"Failure initiating GUIDInfo request (%s)\n",
+			ib_get_err_str(status));
+}
+
+osm_guidinfo_work_obj_t *osm_guid_work_obj_new(IN osm_port_t * p_port,
+					       IN uint8_t block_num)
+{
+	osm_guidinfo_work_obj_t *p_obj;
+
+	/*
+	   clean allocated memory to avoid assertion when trying to insert to
+	   qlist.
+	   see cl_qlist_insert_tail(): CL_ASSERT(p_list_item->p_list != p_list)
+	*/
+	p_obj = calloc(1, sizeof(*p_obj));
+	if (p_obj) {
+		p_obj->p_port = p_port;
+		p_obj->block_num = block_num;
+	}
+
+	return p_obj;
+}
+
+void osm_guid_work_obj_delete(IN osm_guidinfo_work_obj_t * p_wobj)
+{
+	free(p_wobj);
+}
+
+int osm_queue_guidinfo(IN osm_sa_t *sa, IN osm_port_t *p_port,
+		      IN uint8_t block_num)
+{
+	osm_guidinfo_work_obj_t *p_obj;
+	int status = 1;
+
+	p_obj = osm_guid_work_obj_new(p_port, block_num);
+	if (p_obj)
+		cl_qlist_insert_tail(&sa->p_subn->alias_guid_list,
+				     &p_obj->list_item);
+	else {
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 510F: "
+			"Memory allocation of guid work object failed\n");
+		status = 0;
+	}
+
+	return status;
+}
+
+void osm_guid_mgr_process(IN osm_sm_t * sm) {
+	osm_guidinfo_work_obj_t *p_obj;
+
+	OSM_LOG_ENTER(sm->p_log);
+
+	OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Processing alias guid list\n");
+
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
+	while (cl_qlist_count(&sm->p_subn->alias_guid_list)) {
+		p_obj = (osm_guidinfo_work_obj_t *) cl_qlist_remove_head(&sm->p_subn->alias_guid_list);
+		guidinfo_set(&sm->p_subn->p_osm->sa, p_obj->p_port,
+			     p_obj->block_num);
+		osm_guid_work_obj_delete(p_obj);
+	}
+
+	CL_PLOCK_RELEASE(sm->p_lock);
+	OSM_LOG_EXIT(sm->p_log);
+}
diff --git a/opensm/osm_helper.c b/opensm/osm_helper.c
index 0443987..26f28cd 100644
--- a/opensm/osm_helper.c
+++ b/opensm/osm_helper.c
@@ -1,7 +1,9 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -48,6 +50,8 @@
 #include <arpa/inet.h>
 #include <complib/cl_debug.h>
 #include <iba/ib_types.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_HELPER_C
 #include <opensm/osm_helper.h>
 #include <opensm/osm_log.h>
 
@@ -56,7 +60,7 @@
 #define ARR_SIZE(a) (sizeof(a)/sizeof((a)[0]))
 
 /* we use two tables - one for queries and one for responses */
-static const char *const __ib_sa_method_str[] = {
+static const char *ib_sa_method_str[] = {
 	"RESERVED",		/* 0 */
 	"SubnAdmGet",		/* 1 */
 	"SubnAdmSet",		/* 2 */
@@ -82,7 +86,9 @@ static const char *const __ib_sa_method_str[] = {
 	"UNKNOWN"		/* 16 */
 };
 
-static const char *const __ib_sa_resp_method_str[] = {
+#define OSM_SA_METHOD_STR_UNKNOWN_VAL (ARR_SIZE(ib_sa_method_str) - 1)
+
+static const char *ib_sa_resp_method_str[] = {
 	"RESERVED",		/* 80 */
 	"SubnAdmGetResp",	/* 81 */
 	"RESERVED (SetResp?)",	/* 82 */
@@ -108,9 +114,7 @@ static const char *const __ib_sa_resp_method_str[] = {
 	"UNKNOWN"
 };
 
-#define OSM_SA_METHOD_STR_UNKNOWN_VAL 0x16
-
-static const char *const __ib_sm_method_str[] = {
+static const char *ib_sm_method_str[] = {
 	"RESERVED0",		/* 0 */
 	"SubnGet",		/* 1 */
 	"SubnSet",		/* 2 */
@@ -146,9 +150,9 @@ static const char *const __ib_sm_method_str[] = {
 	"UNKNOWN"		/* 20 */
 };
 
-#define OSM_SM_METHOD_STR_UNKNOWN_VAL 0x21
+#define OSM_SM_METHOD_STR_UNKNOWN_VAL (ARR_SIZE(ib_sm_method_str) - 1)
 
-static const char *const __ib_sm_attr_str[] = {
+static const char *ib_sm_attr_str[] = {
 	"RESERVED",		/* 0 */
 	"ClassPortInfo",	/* 1 */
 	"Notice",		/* 2 */
@@ -185,9 +189,9 @@ static const char *const __ib_sm_attr_str[] = {
 	"UNKNOWN"		/* 21 - always highest value */
 };
 
-#define OSM_SM_ATTR_STR_UNKNOWN_VAL 0x21
+#define OSM_SM_ATTR_STR_UNKNOWN_VAL (ARR_SIZE(ib_sm_attr_str) - 1)
 
-static const char *const __ib_sa_attr_str[] = {
+static const char *ib_sa_attr_str[] = {
 	"RESERVED",		/* 0 */
 	"ClassPortInfo",	/* 1 */
 	"Notice",		/* 2 */
@@ -435,113 +439,138 @@ static const char *const __ib_sa_attr_str[] = {
 	"UNKNOWN"		/* F4 - always highest value */
 };
 
-#define OSM_SA_ATTR_STR_UNKNOWN_VAL 0xF4
+#define OSM_SA_ATTR_STR_UNKNOWN_VAL (ARR_SIZE(ib_sa_attr_str) - 1)
+
+static int ordered_rates[] = {
+	0, 0,	/*  0, 1 - reserved */
+	1,	/*  2 - 2.5 Gbps */
+	3,	/*  3 - 10  Gbps */
+	6,	/*  4 - 30  Gbps */
+	2,	/*  5 - 5   Gbps */
+	5,	/*  6 - 20  Gbps */
+	8,	/*  7 - 40  Gbps */
+	9,	/*  8 - 60  Gbps */
+	11,	/*  9 - 80  Gbps */
+	12,	/* 10 - 120 Gbps */
+	4,	/* 11 -  14 Gbps (17 Gbps equiv) */
+	10,	/* 12 -  56 Gbps (68 Gbps equiv) */
+	14,	/* 13 - 112 Gbps (136 Gbps equiv) */
+	15,	/* 14 - 168 Gbps (204 Gbps equiv) */
+	7,	/* 15 -  25 Gbps (31.25 Gbps equiv) */
+	13,	/* 16 - 100 Gbps (125 Gbps equiv) */
+	16,	/* 17 - 200 Gbps (250 Gbps equiv) */
+	17	/* 18 - 300 Gbps (375 Gbps equiv) */
+};
+
+static int sprint_uint8_arr(char *buf, size_t size,
+			    const uint8_t * arr, size_t len)
+{
+	int n;
+	unsigned int i;
+	for (i = 0, n = 0; i < len; i++) {
+		n += snprintf(buf + n, size - n, "%s%u", i == 0 ? "" : ",",
+			      arr[i]);
+		if (n >= size)
+			break;
+	}
+	return n;
+}
 
-/**********************************************************************
- **********************************************************************/
 const char *ib_get_sa_method_str(IN uint8_t method)
 {
 	if (method & 0x80) {
 		method = method & 0x7f;
-		if (method >= OSM_SA_METHOD_STR_UNKNOWN_VAL)
+		if (method > OSM_SA_METHOD_STR_UNKNOWN_VAL)
 			method = OSM_SA_METHOD_STR_UNKNOWN_VAL;
 		/* it is a response - use the response table */
-		return (__ib_sa_resp_method_str[method]);
+		return ib_sa_resp_method_str[method];
 	} else {
-		if (method >= OSM_SA_METHOD_STR_UNKNOWN_VAL)
+		if (method > OSM_SA_METHOD_STR_UNKNOWN_VAL)
 			method = OSM_SA_METHOD_STR_UNKNOWN_VAL;
-		return (__ib_sa_method_str[method]);
+		return ib_sa_method_str[method];
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
 const char *ib_get_sm_method_str(IN uint8_t method)
 {
 	if (method & 0x80)
 		method = (method & 0x0F) | 0x10;
-	if (method >= OSM_SM_METHOD_STR_UNKNOWN_VAL)
+	if (method > OSM_SM_METHOD_STR_UNKNOWN_VAL)
 		method = OSM_SM_METHOD_STR_UNKNOWN_VAL;
-	return (__ib_sm_method_str[method]);
+	return ib_sm_method_str[method];
 }
 
-/**********************************************************************
- **********************************************************************/
 const char *ib_get_sm_attr_str(IN ib_net16_t attr)
 {
-	uint16_t host_attr;
-	host_attr = cl_ntoh16(attr);
+	uint16_t host_attr = cl_ntoh16(attr);
 
-	if (host_attr >= OSM_SM_ATTR_STR_UNKNOWN_VAL)
+	if (attr == IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO)
+		return "MLNXExtendedPortInfo";
+
+	if (host_attr > OSM_SM_ATTR_STR_UNKNOWN_VAL)
 		host_attr = OSM_SM_ATTR_STR_UNKNOWN_VAL;
 
-	return (__ib_sm_attr_str[host_attr]);
+	return ib_sm_attr_str[host_attr];
 }
 
-/**********************************************************************
- **********************************************************************/
 const char *ib_get_sa_attr_str(IN ib_net16_t attr)
 {
-	uint16_t host_attr;
-	host_attr = cl_ntoh16(attr);
+	uint16_t host_attr = cl_ntoh16(attr);
 
-	if (host_attr >= OSM_SA_ATTR_STR_UNKNOWN_VAL)
+	if (host_attr > OSM_SA_ATTR_STR_UNKNOWN_VAL)
 		host_attr = OSM_SA_ATTR_STR_UNKNOWN_VAL;
 
-	return (__ib_sa_attr_str[host_attr]);
+	return ib_sa_attr_str[host_attr];
 }
 
-/**********************************************************************
- **********************************************************************/
 const char *ib_get_trap_str(ib_net16_t trap_num)
 {
-	switch(cl_ntoh16(trap_num))
-	{
-		case 64:
-			return "GID in service";
-		case 65:
-			return "GID out of service";
-		case 66:
-			return "New mcast group created";
-		case 67:
-			return "Mcast group deleted";
-		case 68:
-			return "UnPath, Path no longer valid";
-		case 69:
-			return "RePath, Path recomputed";
-		case 128:
-			return "Link state change";
-		case 129:
-			return "Local Link integrity threshold reached";
-		case 130:
-			return "Excessive Buffer Overrun Threshold reached";
-		case 131:
-			return "Flow Control Update watchdog timer expired";
-		case 144:
-			return "CapabilityMask, NodeDescription, Link [Width|Speed] Enabled changed";
-		case 145:
-			return "System Image GUID changed";
-		case 256:
-			return "Bad M_Key";
-		case 257:
-			return "Bad P_Key";
-		case 258:
-			return "Bad Q_Key";
-		case 259:
-			return "Bad P_Key (switch external port)";
-		default:
-			break;
+	switch (cl_ntoh16(trap_num)) {
+	case 64:
+		return "GID in service";
+	case 65:
+		return "GID out of service";
+	case 66:
+		return "New mcast group created";
+	case 67:
+		return "Mcast group deleted";
+	case 68:
+		return "UnPath, Path no longer valid";
+	case 69:
+		return "RePath, Path recomputed";
+	case 128:
+		return "Link state change";
+	case 129:
+		return "Local Link integrity threshold reached";
+	case 130:
+		return "Excessive Buffer Overrun Threshold reached";
+	case 131:
+		return "Flow Control Update watchdog timer expired";
+	case 144:
+		return
+		    "CapabilityMask, NodeDescription, Link [Width|Speed] Enabled, SM priority changed";
+	case 145:
+		return "System Image GUID changed";
+	case 256:
+		return "Bad M_Key";
+	case 257:
+		return "Bad P_Key";
+	case 258:
+		return "Bad Q_Key";
+	case 259:
+		return "Bad P_Key (switch external port)";
+	default:
+		break;
 	}
 	return "Unknown";
 }
 
-/**********************************************************************
- **********************************************************************/
-static ib_api_status_t
-dbg_do_line(IN char **pp_local,
-	    IN const uint32_t buf_size,
-	    IN const char *const p_prefix_str,
-	    IN const char *const p_new_str, IN uint32_t * const p_total_len)
+const ib_gid_t ib_zero_gid = { {0} };
+
+static ib_api_status_t dbg_do_line(IN char **pp_local, IN uint32_t buf_size,
+				   IN const char *p_prefix_str,
+				   IN const char *p_new_str,
+				   IN uint32_t * p_total_len)
 {
 	char line[LINE_LENGTH];
 	uint32_t len;
@@ -550,20 +579,16 @@ dbg_do_line(IN char **pp_local,
 	len = (uint32_t) strlen(line);
 	*p_total_len += len;
 	if (*p_total_len + sizeof('\0') > buf_size)
-		return (IB_INSUFFICIENT_MEMORY);
+		return IB_INSUFFICIENT_MEMORY;
 
 	strcpy(*pp_local, line);
 	*pp_local += len;
-	return (IB_SUCCESS);
+	return IB_SUCCESS;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-dbg_get_capabilities_str(IN char *p_buf,
-			 IN const uint32_t buf_size,
-			 IN const char *const p_prefix_str,
-			 IN const ib_port_info_t * const p_pi)
+static void dbg_get_capabilities_str(IN char *p_buf, IN uint32_t buf_size,
+				     IN const char *p_prefix_str,
+				     IN const ib_port_info_t * p_pi)
 {
 	uint32_t total_len = 0;
 	char *p_local = p_buf;
@@ -655,15 +680,15 @@ dbg_get_capabilities_str(IN char *p_buf,
 				&total_len) != IB_SUCCESS)
 			return;
 	}
-	if (p_pi->capability_mask & IB_PORT_CAP_RESV14) {
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) {
 		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
-				"IB_PORT_CAP_RESV14\n",
+				"IB_PORT_CAP_HAS_EXT_SPEEDS\n",
 				&total_len) != IB_SUCCESS)
 			return;
 	}
-	if (p_pi->capability_mask & IB_PORT_CAP_RESV15) {
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_CAP_MASK2) {
 		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
-				"IB_PORT_CAP_RESV15\n",
+				"IB_PORT_CAP_HAS_CAP_MASK2\n",
 				&total_len) != IB_SUCCESS)
 			return;
 	}
@@ -739,97 +764,95 @@ dbg_get_capabilities_str(IN char *p_buf,
 				&total_len) != IB_SUCCESS)
 			return;
 	}
-	if (p_pi->capability_mask & IB_PORT_CAP_RESV28) {
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_VEND_MADS) {
 		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
-				"IB_PORT_CAP_RESV28\n",
+				"IB_PORT_CAP_HAS_VEND_MADS\n",
 				&total_len) != IB_SUCCESS)
 			return;
 	}
-	if (p_pi->capability_mask & IB_PORT_CAP_RESV29) {
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_MCAST_PKEY_TRAP_SUPPRESS) {
 		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
-				"IB_PORT_CAP_RESV29\n",
+				"IB_PORT_CAP_HAS_MCAST_PKEY_TRAP_SUPPRESS\n",
 				&total_len) != IB_SUCCESS)
 			return;
 	}
-	if (p_pi->capability_mask & IB_PORT_CAP_RESV30) {
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_MCAST_FDB_TOP) {
 		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
-				"IB_PORT_CAP_RESV30\n",
+				"IB_PORT_CAP_HAS_MCAST_FDB_TOP\n",
 				&total_len) != IB_SUCCESS)
 			return;
 	}
-	if (p_pi->capability_mask & IB_PORT_CAP_RESV31) {
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_HIER_INFO) {
 		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
-				"IB_PORT_CAP_RESV31\n",
+				"IB_PORT_CAP_HAS_HIER_INFO\n",
 				&total_len) != IB_SUCCESS)
 			return;
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_port_info(IN osm_log_t * const p_log,
-		   IN const ib_net64_t node_guid,
-		   IN const ib_net64_t port_guid,
-		   IN const uint8_t port_num,
-		   IN const ib_port_info_t * const p_pi,
-		   IN const osm_log_level_t log_level)
+static void osm_dump_port_info_to_buf(IN ib_net64_t node_guid,
+				      IN ib_net64_t port_guid,
+				      IN uint8_t port_num,
+				      IN const ib_port_info_t * p_pi,
+				      OUT char * buf)
 {
-	if (osm_log_is_active(p_log, log_level)) {
-		char buf[BUF_SIZE];
-
-		osm_log(p_log, log_level,
+	if (!buf || !p_pi)
+		return;
+	else {
+		sprintf(buf,
 			"PortInfo dump:\n"
-			"\t\t\t\tport number.............%u\n"
-			"\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
-			"\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
-			"\t\t\t\tm_key...................0x%016" PRIx64 "\n"
-			"\t\t\t\tsubnet_prefix...........0x%016" PRIx64 "\n"
-			"\t\t\t\tbase_lid................%u\n"
-			"\t\t\t\tmaster_sm_base_lid......%u\n"
-			"\t\t\t\tcapability_mask.........0x%X\n"
-			"\t\t\t\tdiag_code...............0x%X\n"
-			"\t\t\t\tm_key_lease_period......0x%X\n"
-			"\t\t\t\tlocal_port_num..........%u\n"
-			"\t\t\t\tlink_width_enabled......0x%X\n"
-			"\t\t\t\tlink_width_supported....0x%X\n"
-			"\t\t\t\tlink_width_active.......0x%X\n"
-			"\t\t\t\tlink_speed_supported....0x%X\n"
-			"\t\t\t\tport_state..............%s\n"
-			"\t\t\t\tstate_info2.............0x%X\n"
-			"\t\t\t\tm_key_protect_bits......0x%X\n"
-			"\t\t\t\tlmc.....................0x%X\n"
-			"\t\t\t\tlink_speed..............0x%X\n"
-			"\t\t\t\tmtu_smsl................0x%X\n"
-			"\t\t\t\tvl_cap_init_type........0x%X\n"
-			"\t\t\t\tvl_high_limit...........0x%X\n"
-			"\t\t\t\tvl_arb_high_cap.........0x%X\n"
-			"\t\t\t\tvl_arb_low_cap..........0x%X\n"
-			"\t\t\t\tinit_rep_mtu_cap........0x%X\n"
-			"\t\t\t\tvl_stall_life...........0x%X\n"
-			"\t\t\t\tvl_enforce..............0x%X\n"
-			"\t\t\t\tm_key_violations........0x%X\n"
-			"\t\t\t\tp_key_violations........0x%X\n"
-			"\t\t\t\tq_key_violations........0x%X\n"
-			"\t\t\t\tguid_cap................0x%X\n"
-			"\t\t\t\tclient_reregister.......0x%X\n"
-			"\t\t\t\tsubnet_timeout..........0x%X\n"
-			"\t\t\t\tresp_time_value.........0x%X\n"
-			"\t\t\t\terror_threshold.........0x%X\n",
-			port_num,
-			cl_ntoh64(node_guid),
-			cl_ntoh64(port_guid),
-			cl_ntoh64(p_pi->m_key),
-			cl_ntoh64(p_pi->subnet_prefix),
+			"\t\t\t\tport number..............%u\n"
+			"\t\t\t\tnode_guid................0x%016" PRIx64 "\n"
+			"\t\t\t\tport_guid................0x%016" PRIx64 "\n"
+			"\t\t\t\tm_key....................0x%016" PRIx64 "\n"
+			"\t\t\t\tsubnet_prefix............0x%016" PRIx64 "\n"
+			"\t\t\t\tbase_lid.................%u\n"
+			"\t\t\t\tmaster_sm_base_lid.......%u\n"
+			"\t\t\t\tcapability_mask..........0x%X\n"
+			"\t\t\t\tdiag_code................0x%X\n"
+			"\t\t\t\tm_key_lease_period.......0x%X\n"
+			"\t\t\t\tlocal_port_num...........%u\n"
+			"\t\t\t\tlink_width_enabled.......0x%X\n"
+			"\t\t\t\tlink_width_supported.....0x%X\n"
+			"\t\t\t\tlink_width_active........0x%X\n"
+			"\t\t\t\tlink_speed_supported.....0x%X\n"
+			"\t\t\t\tport_state...............%s\n"
+			"\t\t\t\tstate_info2..............0x%X\n"
+			"\t\t\t\tm_key_protect_bits.......0x%X\n"
+			"\t\t\t\tlmc......................0x%X\n"
+			"\t\t\t\tlink_speed...............0x%X\n"
+			"\t\t\t\tmtu_smsl.................0x%X\n"
+			"\t\t\t\tvl_cap_init_type.........0x%X\n"
+			"\t\t\t\tvl_high_limit............0x%X\n"
+			"\t\t\t\tvl_arb_high_cap..........0x%X\n"
+			"\t\t\t\tvl_arb_low_cap...........0x%X\n"
+			"\t\t\t\tinit_rep_mtu_cap.........0x%X\n"
+			"\t\t\t\tvl_stall_life............0x%X\n"
+			"\t\t\t\tvl_enforce...............0x%X\n"
+			"\t\t\t\tm_key_violations.........0x%X\n"
+			"\t\t\t\tp_key_violations.........0x%X\n"
+			"\t\t\t\tq_key_violations.........0x%X\n"
+			"\t\t\t\tguid_cap.................0x%X\n"
+			"\t\t\t\tclient_reregister........0x%X\n"
+			"\t\t\t\tmcast_pkey_trap_suppr....0x%X\n"
+			"\t\t\t\tsubnet_timeout...........0x%X\n"
+			"\t\t\t\tresp_time_value..........0x%X\n"
+			"\t\t\t\terror_threshold..........0x%X\n"
+			"\t\t\t\tmax_credit_hint..........0x%X\n"
+			"\t\t\t\tlink_round_trip_latency..0x%X\n"
+			"\t\t\t\tcapability_mask2.........0x%X\n"
+			"\t\t\t\tlink_speed_ext_active....0x%X\n"
+			"\t\t\t\tlink_speed_ext_supported.0x%X\n"
+			"\t\t\t\tlink_speed_ext_enabled...0x%X\n",
+			port_num, cl_ntoh64(node_guid), cl_ntoh64(port_guid),
+			cl_ntoh64(p_pi->m_key), cl_ntoh64(p_pi->subnet_prefix),
 			cl_ntoh16(p_pi->base_lid),
 			cl_ntoh16(p_pi->master_sm_base_lid),
 			cl_ntoh32(p_pi->capability_mask),
 			cl_ntoh16(p_pi->diag_code),
 			cl_ntoh16(p_pi->m_key_lease_period),
-			p_pi->local_port_num,
-			p_pi->link_width_enabled,
-			p_pi->link_width_supported,
-			p_pi->link_width_active,
+			p_pi->local_port_num, p_pi->link_width_enabled,
+			p_pi->link_width_supported, p_pi->link_width_active,
 			ib_port_info_get_link_speed_sup(p_pi),
 			ib_get_port_state_str(ib_port_info_get_port_state
 					      (p_pi)), p_pi->state_info2,
@@ -842,8 +865,30 @@ osm_dump_port_info(IN osm_log_t * const p_log,
 			cl_ntoh16(p_pi->p_key_violations),
 			cl_ntoh16(p_pi->q_key_violations), p_pi->guid_cap,
 			ib_port_info_get_client_rereg(p_pi),
-			ib_port_info_get_timeout(p_pi), p_pi->resp_time_value,
-			p_pi->error_threshold);
+			ib_port_info_get_mcast_pkey_trap_suppress(p_pi),
+			ib_port_info_get_timeout(p_pi),
+			ib_port_info_get_resp_time_value(p_pi),
+			p_pi->error_threshold, cl_ntoh16(p_pi->max_credit_hint),
+			cl_ntoh32(p_pi->link_rt_latency),
+			cl_ntoh16(p_pi->capability_mask2),
+			ib_port_info_get_link_speed_ext_active(p_pi),
+			ib_port_info_get_link_speed_ext_sup(p_pi),
+			p_pi->link_speed_ext_enabled);
+	}
+}
+
+void osm_dump_port_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
+			IN ib_net64_t port_guid, IN uint8_t port_num,
+			IN const ib_port_info_t * p_pi,
+			IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active(p_log, log_level)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_port_info_to_buf(node_guid, port_guid,
+					  port_num, p_pi, buf);
+
+		osm_log(p_log, log_level, buf);
 
 		/*  show the capabilities mask */
 		if (p_pi->capability_mask) {
@@ -854,70 +899,145 @@ osm_dump_port_info(IN osm_log_t * const p_log,
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_portinfo_record(IN osm_log_t * const p_log,
-			 IN const ib_portinfo_record_t * const p_pir,
-			 IN const osm_log_level_t log_level)
+void osm_dump_port_info_v2(IN osm_log_t * p_log, IN ib_net64_t node_guid,
+			   IN ib_net64_t port_guid, IN uint8_t port_num,
+			   IN const ib_port_info_t * p_pi, IN const int file_id,
+			   IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_port_info_to_buf(node_guid, port_guid,
+					  port_num, p_pi, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+
+		/*  show the capabilities mask */
+		if (p_pi->capability_mask) {
+			dbg_get_capabilities_str(buf, BUF_SIZE, "\t\t\t\t",
+						 p_pi);
+			osm_log_v2(p_log, log_level, file_id, "%s", buf);
+		}
+	}
+}
+
+static void osm_dump_mlnx_ext_port_info_to_buf(IN ib_net64_t node_guid,
+					       IN ib_net64_t port_guid, IN uint8_t port_num,
+					       IN const ib_mlnx_ext_port_info_t * p_pi,
+					       OUT char * buf)
+{
+	if (!buf || !p_pi)
+		return;
+	else {
+		sprintf(buf,
+                        "MLNX ExtendedPortInfo dump:\n"
+                        "\t\t\t\tport number..............%u\n"
+                        "\t\t\t\tnode_guid................0x%016" PRIx64 "\n"
+                        "\t\t\t\tport_guid................0x%016" PRIx64 "\n"
+                        "\t\t\t\tStateChangeEnable........0x%X\n"
+                        "\t\t\t\tLinkSpeedSupported.......0x%X\n"
+                        "\t\t\t\tLinkSpeedEnabled.........0x%X\n"
+                        "\t\t\t\tLinkSpeedActive..........0x%X\n",
+                        port_num, cl_ntoh64(node_guid), cl_ntoh64(port_guid),
+                        p_pi->state_change_enable, p_pi->link_speed_supported,
+                        p_pi->link_speed_enabled, p_pi->link_speed_active);
+	}
+}
+
+void osm_dump_mlnx_ext_port_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
+				 IN ib_net64_t port_guid, IN uint8_t port_num,
+				 IN const ib_mlnx_ext_port_info_t * p_pi,
+				 IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
 		char buf[BUF_SIZE];
-		const ib_port_info_t *const p_pi = &p_pir->port_info;
 
-		osm_log(p_log, log_level,
+		osm_dump_mlnx_ext_port_info_to_buf(node_guid, port_guid,
+						   port_num, p_pi, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_mlnx_ext_port_info_v2(IN osm_log_t * p_log, IN ib_net64_t node_guid,
+				    IN ib_net64_t port_guid, IN uint8_t port_num,
+				    IN const ib_mlnx_ext_port_info_t * p_pi,
+				    IN const int file_id, IN osm_log_level_t log_level)
+{
+        if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+                char buf[BUF_SIZE];
+
+		osm_dump_mlnx_ext_port_info_to_buf(node_guid, port_guid,
+						   port_num, p_pi, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+        }
+}
+
+static void osm_dump_portinfo_record_to_buf(IN const ib_portinfo_record_t * p_pir,
+					    OUT char * buf)
+{
+	if (!buf || !p_pir)
+		return;
+	else {
+		const ib_port_info_t *p_pi = &p_pir->port_info;
+
+		sprintf(buf,
 			"PortInfo Record dump:\n"
 			"\t\t\t\tRID\n"
-			"\t\t\t\tEndPortLid..............%u\n"
-			"\t\t\t\tPortNum.................0x%X\n"
-			"\t\t\t\tReserved................0x%X\n"
+			"\t\t\t\tEndPortLid...............%u\n"
+			"\t\t\t\tPortNum..................%u\n"
+			"\t\t\t\tOptions..................0x%X\n"
 			"\t\t\t\tPortInfo dump:\n"
-			"\t\t\t\tm_key...................0x%016" PRIx64 "\n"
-			"\t\t\t\tsubnet_prefix...........0x%016" PRIx64 "\n"
-			"\t\t\t\tbase_lid................%u\n"
-			"\t\t\t\tmaster_sm_base_lid......%u\n"
-			"\t\t\t\tcapability_mask.........0x%X\n"
-			"\t\t\t\tdiag_code...............0x%X\n"
-			"\t\t\t\tm_key_lease_period......0x%X\n"
-			"\t\t\t\tlocal_port_num..........%u\n"
-			"\t\t\t\tlink_width_enabled......0x%X\n"
-			"\t\t\t\tlink_width_supported....0x%X\n"
-			"\t\t\t\tlink_width_active.......0x%X\n"
-			"\t\t\t\tlink_speed_supported....0x%X\n"
-			"\t\t\t\tport_state..............%s\n"
-			"\t\t\t\tstate_info2.............0x%X\n"
-			"\t\t\t\tm_key_protect_bits......0x%X\n"
-			"\t\t\t\tlmc.....................0x%X\n"
-			"\t\t\t\tlink_speed..............0x%X\n"
-			"\t\t\t\tmtu_smsl................0x%X\n"
-			"\t\t\t\tvl_cap_init_type........0x%X\n"
-			"\t\t\t\tvl_high_limit...........0x%X\n"
-			"\t\t\t\tvl_arb_high_cap.........0x%X\n"
-			"\t\t\t\tvl_arb_low_cap..........0x%X\n"
-			"\t\t\t\tinit_rep_mtu_cap........0x%X\n"
-			"\t\t\t\tvl_stall_life...........0x%X\n"
-			"\t\t\t\tvl_enforce..............0x%X\n"
-			"\t\t\t\tm_key_violations........0x%X\n"
-			"\t\t\t\tp_key_violations........0x%X\n"
-			"\t\t\t\tq_key_violations........0x%X\n"
-			"\t\t\t\tguid_cap................0x%X\n"
-			"\t\t\t\tsubnet_timeout..........0x%X\n"
-			"\t\t\t\tresp_time_value.........0x%X\n"
-			"\t\t\t\terror_threshold.........0x%X\n",
-			cl_ntoh16(p_pir->lid),
-			p_pir->port_num,
-			p_pir->resv,
-			cl_ntoh64(p_pi->m_key),
-			cl_ntoh64(p_pi->subnet_prefix),
+			"\t\t\t\tm_key....................0x%016" PRIx64 "\n"
+			"\t\t\t\tsubnet_prefix............0x%016" PRIx64 "\n"
+			"\t\t\t\tbase_lid.................%u\n"
+			"\t\t\t\tmaster_sm_base_lid.......%u\n"
+			"\t\t\t\tcapability_mask..........0x%X\n"
+			"\t\t\t\tdiag_code................0x%X\n"
+			"\t\t\t\tm_key_lease_period.......0x%X\n"
+			"\t\t\t\tlocal_port_num...........%u\n"
+			"\t\t\t\tlink_width_enabled.......0x%X\n"
+			"\t\t\t\tlink_width_supported.....0x%X\n"
+			"\t\t\t\tlink_width_active........0x%X\n"
+			"\t\t\t\tlink_speed_supported.....0x%X\n"
+			"\t\t\t\tport_state...............%s\n"
+			"\t\t\t\tstate_info2..............0x%X\n"
+			"\t\t\t\tm_key_protect_bits.......0x%X\n"
+			"\t\t\t\tlmc......................0x%X\n"
+			"\t\t\t\tlink_speed...............0x%X\n"
+			"\t\t\t\tmtu_smsl.................0x%X\n"
+			"\t\t\t\tvl_cap_init_type.........0x%X\n"
+			"\t\t\t\tvl_high_limit............0x%X\n"
+			"\t\t\t\tvl_arb_high_cap..........0x%X\n"
+			"\t\t\t\tvl_arb_low_cap...........0x%X\n"
+			"\t\t\t\tinit_rep_mtu_cap.........0x%X\n"
+			"\t\t\t\tvl_stall_life............0x%X\n"
+			"\t\t\t\tvl_enforce...............0x%X\n"
+			"\t\t\t\tm_key_violations.........0x%X\n"
+			"\t\t\t\tp_key_violations.........0x%X\n"
+			"\t\t\t\tq_key_violations.........0x%X\n"
+			"\t\t\t\tguid_cap.................0x%X\n"
+			"\t\t\t\tclient_reregister........0x%X\n"
+			"\t\t\t\tmcast_pkey_trap_suppr....0x%X\n"
+			"\t\t\t\tsubnet_timeout...........0x%X\n"
+			"\t\t\t\tresp_time_value..........0x%X\n"
+			"\t\t\t\terror_threshold..........0x%X\n"
+			"\t\t\t\tmax_credit_hint..........0x%X\n"
+			"\t\t\t\tlink_round_trip_latency..0x%X\n"
+			"\t\t\t\tcapability_mask2.........0x%X\n"
+			"\t\t\t\tlink_speed_ext_active....0x%X\n"
+			"\t\t\t\tlink_speed_ext_supported.0x%X\n"
+			"\t\t\t\tlink_speed_ext_enabled...0x%X\n",
+			cl_ntoh16(p_pir->lid), p_pir->port_num, p_pir->options,
+			cl_ntoh64(p_pi->m_key), cl_ntoh64(p_pi->subnet_prefix),
 			cl_ntoh16(p_pi->base_lid),
 			cl_ntoh16(p_pi->master_sm_base_lid),
 			cl_ntoh32(p_pi->capability_mask),
 			cl_ntoh16(p_pi->diag_code),
 			cl_ntoh16(p_pi->m_key_lease_period),
-			p_pi->local_port_num,
-			p_pi->link_width_enabled,
-			p_pi->link_width_supported,
-			p_pi->link_width_active,
+			p_pi->local_port_num, p_pi->link_width_enabled,
+			p_pi->link_width_supported, p_pi->link_width_active,
 			ib_port_info_get_link_speed_sup(p_pi),
 			ib_get_port_state_str(ib_port_info_get_port_state
 					      (p_pi)), p_pi->state_info2,
@@ -929,8 +1049,30 @@ osm_dump_portinfo_record(IN osm_log_t * const p_log,
 			cl_ntoh16(p_pi->m_key_violations),
 			cl_ntoh16(p_pi->p_key_violations),
 			cl_ntoh16(p_pi->q_key_violations), p_pi->guid_cap,
-			ib_port_info_get_timeout(p_pi), p_pi->resp_time_value,
-			p_pi->error_threshold);
+			ib_port_info_get_client_rereg(p_pi),
+			ib_port_info_get_mcast_pkey_trap_suppress(p_pi),
+			ib_port_info_get_timeout(p_pi),
+			ib_port_info_get_resp_time_value(p_pi),
+			p_pi->error_threshold, cl_ntoh16(p_pi->max_credit_hint),
+			cl_ntoh32(p_pi->link_rt_latency),
+			cl_ntoh16(p_pi->capability_mask2),
+			ib_port_info_get_link_speed_ext_active(p_pi),
+			ib_port_info_get_link_speed_ext_sup(p_pi),
+			p_pi->link_speed_ext_enabled);
+	}
+}
+
+void osm_dump_portinfo_record(IN osm_log_t * p_log,
+			      IN const ib_portinfo_record_t * p_pir,
+			      IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active(p_log, log_level)) {
+		char buf[BUF_SIZE];
+		const ib_port_info_t *p_pi = &p_pir->port_info;
+
+		osm_dump_portinfo_record_to_buf(p_pir, buf);
+
+		osm_log(p_log, log_level, buf);
 
 		/*  show the capabilities mask */
 		if (p_pi->capability_mask) {
@@ -941,17 +1083,98 @@ osm_dump_portinfo_record(IN osm_log_t * const p_log,
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_guidinfo_record(IN osm_log_t * const p_log,
-			 IN const ib_guidinfo_record_t * const p_gir,
-			 IN const osm_log_level_t log_level)
+void osm_dump_portinfo_record_v2(IN osm_log_t * p_log,
+				 IN const ib_portinfo_record_t * p_pir,
+				 IN const int file_id,
+				 IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+		const ib_port_info_t *p_pi = &p_pir->port_info;
+
+		osm_dump_portinfo_record_to_buf(p_pir, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+
+		/*  show the capabilities mask */
+		if (p_pi->capability_mask) {
+			dbg_get_capabilities_str(buf, BUF_SIZE, "\t\t\t\t",
+						 p_pi);
+			osm_log_v2(p_log, log_level, file_id, "%s", buf);
+		}
+	}
+}
+
+static void osm_dump_guid_info_to_buf(IN ib_net64_t node_guid,
+				      IN ib_net64_t port_guid,
+				      IN uint8_t block_num,
+				      IN const ib_guid_info_t * p_gi,
+				      OUT char * buf)
+{
+	if (!buf || !p_gi)
+		return;
+	else {
+		sprintf(buf,
+			"GUIDInfo dump:\n"
+			"\t\t\t\tblock number............%u\n"
+			"\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
+			"\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
+			"\t\t\t\tGUID 0..................0x%016" PRIx64 "\n"
+			"\t\t\t\tGUID 1..................0x%016" PRIx64 "\n"
+			"\t\t\t\tGUID 2..................0x%016" PRIx64 "\n"
+			"\t\t\t\tGUID 3..................0x%016" PRIx64 "\n"
+			"\t\t\t\tGUID 4..................0x%016" PRIx64 "\n"
+			"\t\t\t\tGUID 5..................0x%016" PRIx64 "\n"
+			"\t\t\t\tGUID 6..................0x%016" PRIx64 "\n"
+			"\t\t\t\tGUID 7..................0x%016" PRIx64 "\n",
+			block_num, cl_ntoh64(node_guid), cl_ntoh64(port_guid),
+			cl_ntoh64(p_gi->guid[0]), cl_ntoh64(p_gi->guid[1]),
+			cl_ntoh64(p_gi->guid[2]), cl_ntoh64(p_gi->guid[3]),
+			cl_ntoh64(p_gi->guid[4]), cl_ntoh64(p_gi->guid[5]),
+			cl_ntoh64(p_gi->guid[6]), cl_ntoh64(p_gi->guid[7]));
+	}
+}
+
+void osm_dump_guid_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
+			IN ib_net64_t port_guid, IN uint8_t block_num,
+			IN const ib_guid_info_t * p_gi,
+			IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
-		const ib_guid_info_t *const p_gi = &p_gir->guid_info;
+		char buf[BUF_SIZE];
+
+		osm_dump_guid_info_to_buf(node_guid, port_guid,
+					  block_num, p_gi, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_guid_info_v2(IN osm_log_t * p_log, IN ib_net64_t node_guid,
+			   IN ib_net64_t port_guid, IN uint8_t block_num,
+			   IN const ib_guid_info_t * p_gi,
+			   IN const int file_id,
+			   IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_guid_info_to_buf(node_guid, port_guid,
+					  block_num, p_gi, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_guidinfo_record_to_buf(IN const ib_guidinfo_record_t * p_gir,
+					    OUT char * buf)
+{
+	if (!buf || !p_gir)
+		return;
+	else {
+		const ib_guid_info_t *p_gi = &p_gir->guid_info;
 
-		osm_log(p_log, log_level,
+		sprintf(buf,
 			"GUIDInfo Record dump:\n"
 			"\t\t\t\tRID\n"
 			"\t\t\t\tLid.....................%u\n"
@@ -967,29 +1190,48 @@ osm_dump_guidinfo_record(IN osm_log_t * const p_log,
 			"\t\t\t\tGUID 5..................0x%016" PRIx64 "\n"
 			"\t\t\t\tGUID 6..................0x%016" PRIx64 "\n"
 			"\t\t\t\tGUID 7..................0x%016" PRIx64 "\n",
-			cl_ntoh16(p_gir->lid),
-			p_gir->block_num,
-			p_gir->resv,
+			cl_ntoh16(p_gir->lid), p_gir->block_num, p_gir->resv,
 			cl_ntoh32(p_gir->reserved),
-			cl_ntoh64(p_gi->guid[0]),
-			cl_ntoh64(p_gi->guid[1]),
-			cl_ntoh64(p_gi->guid[2]),
-			cl_ntoh64(p_gi->guid[3]),
-			cl_ntoh64(p_gi->guid[4]),
-			cl_ntoh64(p_gi->guid[5]),
+			cl_ntoh64(p_gi->guid[0]), cl_ntoh64(p_gi->guid[1]),
+			cl_ntoh64(p_gi->guid[2]), cl_ntoh64(p_gi->guid[3]),
+			cl_ntoh64(p_gi->guid[4]), cl_ntoh64(p_gi->guid[5]),
 			cl_ntoh64(p_gi->guid[6]), cl_ntoh64(p_gi->guid[7]));
 	}
 }
-
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_node_info(IN osm_log_t * const p_log,
-		   IN const ib_node_info_t * const p_ni,
-		   IN const osm_log_level_t log_level)
+void osm_dump_guidinfo_record(IN osm_log_t * p_log,
+			      IN const ib_guidinfo_record_t * p_gir,
+			      IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
-		osm_log(p_log, log_level,
+		char buf[BUF_SIZE];
+
+		osm_dump_guidinfo_record_to_buf(p_gir, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_guidinfo_record_v2(IN osm_log_t * p_log,
+				 IN const ib_guidinfo_record_t * p_gir,
+				 IN const int file_id,
+				 IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_guidinfo_record_to_buf(p_gir, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_node_info_to_buf(IN const ib_node_info_t * p_ni,
+				      OUT char * buf)
+{
+	if (!buf || !p_ni)
+		return;
+	else {
+		sprintf(buf,
 			"NodeInfo dump:\n"
 			"\t\t\t\tbase_version............0x%X\n"
 			"\t\t\t\tclass_version...........0x%X\n"
@@ -1003,36 +1245,54 @@ osm_dump_node_info(IN osm_log_t * const p_log,
 			"\t\t\t\trevision................0x%X\n"
 			"\t\t\t\tport_num................%u\n"
 			"\t\t\t\tvendor_id...............0x%X\n",
-			p_ni->base_version,
-			p_ni->class_version,
-			ib_get_node_type_str(p_ni->node_type),
-			p_ni->num_ports,
-			cl_ntoh64(p_ni->sys_guid),
-			cl_ntoh64(p_ni->node_guid),
+			p_ni->base_version, p_ni->class_version,
+			ib_get_node_type_str(p_ni->node_type), p_ni->num_ports,
+			cl_ntoh64(p_ni->sys_guid), cl_ntoh64(p_ni->node_guid),
 			cl_ntoh64(p_ni->port_guid),
 			cl_ntoh16(p_ni->partition_cap),
-			cl_ntoh16(p_ni->device_id),
-			cl_ntoh32(p_ni->revision),
+			cl_ntoh16(p_ni->device_id), cl_ntoh32(p_ni->revision),
 			ib_node_info_get_local_port_num(p_ni),
 			cl_ntoh32(ib_node_info_get_vendor_id(p_ni)));
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_node_record(IN osm_log_t * const p_log,
-		     IN const ib_node_record_t * const p_nr,
-		     IN const osm_log_level_t log_level)
+void osm_dump_node_info(IN osm_log_t * p_log, IN const ib_node_info_t * p_ni,
+			IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_node_info_to_buf(p_ni, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_node_info_v2(IN osm_log_t * p_log, IN const ib_node_info_t * p_ni,
+			   IN const int file_id, IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_node_info_to_buf(p_ni, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_node_record_to_buf(IN const ib_node_record_t * p_nr,
+					OUT char * buf)
+{
+	if (!buf || !p_nr)
+		return;
+	else {
 		char desc[sizeof(p_nr->node_desc.description) + 1];
-		const ib_node_info_t *const p_ni = &p_nr->node_info;
+		const ib_node_info_t *p_ni = &p_nr->node_info;
 
 		memcpy(desc, p_nr->node_desc.description,
 		       sizeof(p_nr->node_desc.description));
 		desc[sizeof(desc) - 1] = '\0';
-		osm_log(p_log, log_level,
+		sprintf(buf,
 			"Node Record dump:\n"
 			"\t\t\t\tRID\n"
 			"\t\t\t\tLid.....................%u\n"
@@ -1052,38 +1312,59 @@ osm_dump_node_record(IN osm_log_t * const p_log,
 			"\t\t\t\tvendor_id...............0x%X\n"
 			"\t\t\t\tNodeDescription\n"
 			"\t\t\t\t%s\n",
-			cl_ntoh16(p_nr->lid),
-			cl_ntoh16(p_nr->resv),
-			p_ni->base_version,
-			p_ni->class_version,
-			ib_get_node_type_str(p_ni->node_type),
-			p_ni->num_ports,
-			cl_ntoh64(p_ni->sys_guid),
-			cl_ntoh64(p_ni->node_guid),
+			cl_ntoh16(p_nr->lid), cl_ntoh16(p_nr->resv),
+			p_ni->base_version, p_ni->class_version,
+			ib_get_node_type_str(p_ni->node_type), p_ni->num_ports,
+			cl_ntoh64(p_ni->sys_guid), cl_ntoh64(p_ni->node_guid),
 			cl_ntoh64(p_ni->port_guid),
 			cl_ntoh16(p_ni->partition_cap),
-			cl_ntoh16(p_ni->device_id),
-			cl_ntoh32(p_ni->revision),
+			cl_ntoh16(p_ni->device_id), cl_ntoh32(p_ni->revision),
 			ib_node_info_get_local_port_num(p_ni),
 			cl_ntoh32(ib_node_info_get_vendor_id(p_ni)), desc);
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_path_record(IN osm_log_t * const p_log,
-		     IN const ib_path_rec_t * const p_pr,
-		     IN const osm_log_level_t log_level)
+void osm_dump_node_record(IN osm_log_t * p_log,
+			  IN const ib_node_record_t * p_nr,
+			  IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
-		osm_log(p_log, log_level,
+		char buf[BUF_SIZE];
+
+		osm_dump_node_record_to_buf(p_nr, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_node_record_v2(IN osm_log_t * p_log,
+			     IN const ib_node_record_t * p_nr,
+			     IN const int file_id,
+			     IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_node_record_to_buf(p_nr, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_path_record_to_buf(IN const ib_path_rec_t * p_pr,
+					OUT char * buf)
+{
+	if (!buf || !p_pr)
+		return;
+	else {
+		char gid_str[INET6_ADDRSTRLEN];
+		char gid_str2[INET6_ADDRSTRLEN];
+
+		sprintf(buf,
 			"PathRecord dump:\n"
 			"\t\t\t\tservice_id..............0x%016" PRIx64 "\n"
-			"\t\t\t\tdgid....................0x%016" PRIx64 " : "
-			"0x%016" PRIx64 "\n"
-			"\t\t\t\tsgid....................0x%016" PRIx64 " : "
-			"0x%016" PRIx64 "\n"
+			"\t\t\t\tdgid....................%s\n"
+			"\t\t\t\tsgid....................%s\n"
 			"\t\t\t\tdlid....................%u\n"
 			"\t\t\t\tslid....................%u\n"
 			"\t\t\t\thop_flow_raw............0x%X\n"
@@ -1096,38 +1377,53 @@ osm_dump_path_record(IN osm_log_t * const p_log,
 			"\t\t\t\trate....................0x%X\n"
 			"\t\t\t\tpkt_life................0x%X\n"
 			"\t\t\t\tpreference..............0x%X\n"
-			"\t\t\t\tresv2...................0x%X\n"
-			"\t\t\t\tresv3...................0x%X\n",
+			"\t\t\t\tresv2...................0x%02X%02X%02X%02X%02X%02X\n",
 			cl_ntoh64(p_pr->service_id),
-			cl_ntoh64(p_pr->dgid.unicast.prefix),
-			cl_ntoh64(p_pr->dgid.unicast.interface_id),
-			cl_ntoh64(p_pr->sgid.unicast.prefix),
-			cl_ntoh64(p_pr->sgid.unicast.interface_id),
-			cl_ntoh16(p_pr->dlid),
-			cl_ntoh16(p_pr->slid),
-			cl_ntoh32(p_pr->hop_flow_raw),
-			p_pr->tclass,
-			p_pr->num_path,
-			cl_ntoh16(p_pr->pkey),
-			ib_path_rec_qos_class(p_pr),
-			ib_path_rec_sl(p_pr),
-			p_pr->mtu,
-			p_pr->rate,
-			p_pr->pkt_life,
-			p_pr->preference,
-			*(uint32_t *) & p_pr->resv2,
-			*((uint16_t *) & p_pr->resv2 + 2));
-	}
-}
-
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_multipath_record(IN osm_log_t * const p_log,
-			  IN const ib_multipath_rec_t * const p_mpr,
-			  IN const osm_log_level_t log_level)
+			inet_ntop(AF_INET6, p_pr->dgid.raw, gid_str,
+				  sizeof gid_str),
+			inet_ntop(AF_INET6, p_pr->sgid.raw, gid_str2,
+				  sizeof gid_str2),
+			cl_ntoh16(p_pr->dlid), cl_ntoh16(p_pr->slid),
+			cl_ntoh32(p_pr->hop_flow_raw), p_pr->tclass,
+			p_pr->num_path, cl_ntoh16(p_pr->pkey),
+			ib_path_rec_qos_class(p_pr), ib_path_rec_sl(p_pr),
+			p_pr->mtu, p_pr->rate, p_pr->pkt_life, p_pr->preference,
+			p_pr->resv2[0], p_pr->resv2[1], p_pr->resv2[2],
+			p_pr->resv2[3], p_pr->resv2[4], p_pr->resv2[5]);
+	}
+}
+
+void osm_dump_path_record(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr,
+			  IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_path_record_to_buf(p_pr, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_path_record_v2(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr,
+			     IN const int file_id, IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_path_record_to_buf(p_pr, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_multipath_record_to_buf(IN const ib_multipath_rec_t * p_mpr,
+					     OUT char * buf)
+{
+	if (!buf || !p_mpr)
+		return;
+	else {
+		char gid_str[INET6_ADDRSTRLEN];
 		char buf_line[1024];
 		ib_gid_t const *p_gid = p_mpr->gids;
 		int i, n = 0;
@@ -1136,11 +1432,10 @@ osm_dump_multipath_record(IN osm_log_t * const p_log,
 			for (i = 0; i < p_mpr->sgid_count; i++) {
 				n += sprintf(buf_line + n,
 					     "\t\t\t\tsgid%02d.................."
-					     "0x%016" PRIx64 " : 0x%016" PRIx64
-					     "\n", i + 1,
-					     cl_ntoh64(p_gid->unicast.prefix),
-					     cl_ntoh64(p_gid->unicast.
-						       interface_id));
+					     "%s\n", i + 1,
+					     inet_ntop(AF_INET6, p_gid->raw,
+						       gid_str,
+						       sizeof gid_str));
 				p_gid++;
 			}
 		}
@@ -1148,15 +1443,14 @@ osm_dump_multipath_record(IN osm_log_t * const p_log,
 			for (i = 0; i < p_mpr->dgid_count; i++) {
 				n += sprintf(buf_line + n,
 					     "\t\t\t\tdgid%02d.................."
-					     "0x%016" PRIx64 " : 0x%016" PRIx64
-					     "\n", i + 1,
-					     cl_ntoh64(p_gid->unicast.prefix),
-					     cl_ntoh64(p_gid->unicast.
-						       interface_id));
+					     "%s\n", i + 1,
+					     inet_ntop(AF_INET6, p_gid->raw,
+						       gid_str,
+						       sizeof gid_str));
 				p_gid++;
 			}
 		}
-		osm_log(p_log, log_level,
+		sprintf(buf,
 			"MultiPath Record dump:\n"
 			"\t\t\t\thop_flow_raw............0x%X\n"
 			"\t\t\t\ttclass..................0x%X\n"
@@ -1172,33 +1466,54 @@ osm_dump_multipath_record(IN osm_log_t * const p_log,
 			"\t\t\t\tdgid_count..............0x%X\n"
 			"\t\t\t\tservice_id..............0x%016" PRIx64 "\n"
 			"%s\n",
-			cl_ntoh32(p_mpr->hop_flow_raw),
-			p_mpr->tclass,
-			p_mpr->num_path,
-			cl_ntoh16(p_mpr->pkey),
+			cl_ntoh32(p_mpr->hop_flow_raw), p_mpr->tclass,
+			p_mpr->num_path, cl_ntoh16(p_mpr->pkey),
 			ib_multipath_rec_qos_class(p_mpr),
-			ib_multipath_rec_sl(p_mpr),
-			p_mpr->mtu,
-			p_mpr->rate,
-			p_mpr->pkt_life,
-			p_mpr->independence,
+			ib_multipath_rec_sl(p_mpr), p_mpr->mtu, p_mpr->rate,
+			p_mpr->pkt_life, p_mpr->independence,
 			p_mpr->sgid_count, p_mpr->dgid_count,
 			cl_ntoh64(ib_multipath_rec_service_id(p_mpr)),
 			buf_line);
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_mc_record(IN osm_log_t * const p_log,
-		   IN const ib_member_rec_t * const p_mcmr,
-		   IN const osm_log_level_t log_level)
+void osm_dump_multipath_record(IN osm_log_t * p_log,
+			       IN const ib_multipath_rec_t * p_mpr,
+			       IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_multipath_record_to_buf(p_mpr, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_multipath_record_v2(IN osm_log_t * p_log,
+				  IN const ib_multipath_rec_t * p_mpr,
+				  IN const int file_id,
+				  IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_multipath_record_to_buf(p_mpr, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_mc_record_to_buf(IN const ib_member_rec_t * p_mcmr,
+				      OUT char * buf)
+{
+	if(!buf || !p_mcmr)
+		return;
+	else {
 		char gid_str[INET6_ADDRSTRLEN];
 		char gid_str2[INET6_ADDRSTRLEN];
-		osm_log(p_log, log_level,
+
+		sprintf(buf,
 			"MCMember Record dump:\n"
 			"\t\t\t\tMGID....................%s\n"
 			"\t\t\t\tPortGid.................%s\n"
@@ -1213,54 +1528,65 @@ osm_dump_mc_record(IN osm_log_t * const p_log,
 			"\t\t\t\tScopeState..............0x%X\n"
 			"\t\t\t\tProxyJoin...............0x%X\n",
 			inet_ntop(AF_INET6, p_mcmr->mgid.raw, gid_str,
-				sizeof gid_str),
+				  sizeof gid_str),
 			inet_ntop(AF_INET6, p_mcmr->port_gid.raw, gid_str2,
-				sizeof gid_str2),
-			cl_ntoh32(p_mcmr->qkey),
-			cl_ntoh16(p_mcmr->mlid),
-			p_mcmr->mtu,
-			p_mcmr->tclass,
-			cl_ntoh16(p_mcmr->pkey),
-			p_mcmr->rate,
-			p_mcmr->pkt_life,
+				  sizeof gid_str2),
+			cl_ntoh32(p_mcmr->qkey), cl_ntoh16(p_mcmr->mlid),
+			p_mcmr->mtu, p_mcmr->tclass, cl_ntoh16(p_mcmr->pkey),
+			p_mcmr->rate, p_mcmr->pkt_life,
 			cl_ntoh32(p_mcmr->sl_flow_hop),
 			p_mcmr->scope_state, p_mcmr->proxy_join);
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_service_record(IN osm_log_t * const p_log,
-			IN const ib_service_record_t * const p_sr,
-			IN const osm_log_level_t log_level)
+void osm_dump_mc_record(IN osm_log_t * p_log, IN const ib_member_rec_t * p_mcmr,
+			IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_mc_record_to_buf(p_mcmr, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_mc_record_v2(IN osm_log_t * p_log, IN const ib_member_rec_t * p_mcmr,
+			   IN const int file_id, IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_mc_record_to_buf(p_mcmr, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_service_record_to_buf(IN const ib_service_record_t * p_sr,
+					   OUT char * buf)
+{
+	if (!buf || !p_sr)
+		return;
+	else {
 		char gid_str[INET6_ADDRSTRLEN];
 		char buf_service_key[35];
 		char buf_service_name[65];
 
 		sprintf(buf_service_key,
 			"0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
-			p_sr->service_key[0],
-			p_sr->service_key[1],
-			p_sr->service_key[2],
-			p_sr->service_key[3],
-			p_sr->service_key[4],
-			p_sr->service_key[5],
-			p_sr->service_key[6],
-			p_sr->service_key[7],
-			p_sr->service_key[8],
-			p_sr->service_key[9],
-			p_sr->service_key[10],
-			p_sr->service_key[11],
-			p_sr->service_key[12],
-			p_sr->service_key[13],
+			p_sr->service_key[0], p_sr->service_key[1],
+			p_sr->service_key[2], p_sr->service_key[3],
+			p_sr->service_key[4], p_sr->service_key[5],
+			p_sr->service_key[6], p_sr->service_key[7],
+			p_sr->service_key[8], p_sr->service_key[9],
+			p_sr->service_key[10], p_sr->service_key[11],
+			p_sr->service_key[12], p_sr->service_key[13],
 			p_sr->service_key[14], p_sr->service_key[15]);
 		strncpy(buf_service_name, (char *)p_sr->service_name, 64);
 		buf_service_name[64] = '\0';
 
-		osm_log(p_log, log_level,
+		sprintf(buf,
 			"Service Record dump:\n"
 			"\t\t\t\tServiceID...............0x%016" PRIx64 "\n"
 			"\t\t\t\tServiceGID..............%s\n"
@@ -1300,11 +1626,10 @@ osm_dump_service_record(IN osm_log_t * const p_log,
 			"\t\t\t\tServiceData64.2.........0x%016" PRIx64 "\n",
 			cl_ntoh64(p_sr->service_id),
 			inet_ntop(AF_INET6, p_sr->service_gid.raw, gid_str,
-				sizeof gid_str),
+				  sizeof gid_str),
 			cl_ntoh16(p_sr->service_pkey),
 			cl_ntoh32(p_sr->service_lease),
-			buf_service_key,
-			buf_service_name,
+			buf_service_key, buf_service_name,
 			p_sr->service_data8[0], p_sr->service_data8[1],
 			p_sr->service_data8[2], p_sr->service_data8[3],
 			p_sr->service_data8[4], p_sr->service_data8[5],
@@ -1330,164 +1655,277 @@ osm_dump_service_record(IN osm_log_t * const p_log,
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_inform_info(IN osm_log_t * const p_log,
-		     IN const ib_inform_info_t * const p_ii,
-		     IN const osm_log_level_t log_level)
+void osm_dump_service_record(IN osm_log_t * p_log,
+			     IN const ib_service_record_t * p_sr,
+			     IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_service_record_to_buf(p_sr, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_service_record_v2(IN osm_log_t * p_log,
+				IN const ib_service_record_t * p_sr,
+				IN const int file_id,
+				IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_service_record_to_buf(p_sr, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_inform_info_to_buf_generic(IN const ib_inform_info_t * p_ii,
+						OUT char * buf)
+{
+	if (!buf || !p_ii)
+		return;
+	else {
 		uint32_t qpn;
 		uint8_t resp_time_val;
+		char gid_str[INET6_ADDRSTRLEN];
 
 		ib_inform_info_get_qpn_resp_time(p_ii->g_or_v.generic.
 						 qpn_resp_time_val, &qpn,
 						 &resp_time_val);
-		if (p_ii->is_generic) {
-			osm_log(p_log, log_level,
-				"InformInfo dump:\n"
-				"\t\t\t\tgid.....................0x%016" PRIx64
-				" : 0x%016" PRIx64 "\n"
-				"\t\t\t\tlid_range_begin.........%u\n"
-				"\t\t\t\tlid_range_end...........%u\n"
-				"\t\t\t\tis_generic..............0x%X\n"
-				"\t\t\t\tsubscribe...............0x%X\n"
-				"\t\t\t\ttrap_type...............0x%X\n"
-				"\t\t\t\ttrap_num................%u\n"
-				"\t\t\t\tqpn.....................0x%06X\n"
-				"\t\t\t\tresp_time_val...........0x%X\n"
-				"\t\t\t\tnode_type...............0x%06X\n" "",
-				cl_ntoh64(p_ii->gid.unicast.prefix),
-				cl_ntoh64(p_ii->gid.unicast.interface_id),
-				cl_ntoh16(p_ii->lid_range_begin),
-				cl_ntoh16(p_ii->lid_range_end),
-				p_ii->is_generic, p_ii->subscribe,
-				cl_ntoh16(p_ii->trap_type),
-				cl_ntoh16(p_ii->g_or_v.generic.trap_num),
-				cl_ntoh32(qpn), resp_time_val,
-				cl_ntoh32(ib_inform_info_get_prod_type(p_ii)));
-		} else {
-			osm_log(p_log, log_level,
-				"InformInfo dump:\n"
-				"\t\t\t\tgid.....................0x%016" PRIx64
-				" : 0x%016" PRIx64 "\n"
-				"\t\t\t\tlid_range_begin.........%u\n"
-				"\t\t\t\tlid_range_end...........%u\n"
-				"\t\t\t\tis_generic..............0x%X\n"
-				"\t\t\t\tsubscribe...............0x%X\n"
-				"\t\t\t\ttrap_type...............0x%X\n"
-				"\t\t\t\tdev_id..................0x%X\n"
-				"\t\t\t\tqpn.....................0x%06X\n"
-				"\t\t\t\tresp_time_val...........0x%X\n"
-				"\t\t\t\tvendor_id...............0x%06X\n" "",
-				cl_ntoh64(p_ii->gid.unicast.prefix),
-				cl_ntoh64(p_ii->gid.unicast.interface_id),
-				cl_ntoh16(p_ii->lid_range_begin),
-				cl_ntoh16(p_ii->lid_range_end),
-				p_ii->is_generic, p_ii->subscribe,
-				cl_ntoh16(p_ii->trap_type),
-				cl_ntoh16(p_ii->g_or_v.vend.dev_id),
-				cl_ntoh32(qpn), resp_time_val,
-				cl_ntoh32(ib_inform_info_get_prod_type(p_ii)));
-		}
+		sprintf(buf,
+			"InformInfo dump:\n"
+			"\t\t\t\tgid.....................%s\n"
+			"\t\t\t\tlid_range_begin.........%u\n"
+			"\t\t\t\tlid_range_end...........%u\n"
+			"\t\t\t\tis_generic..............0x%X\n"
+			"\t\t\t\tsubscribe...............0x%X\n"
+			"\t\t\t\ttrap_type...............0x%X\n"
+			"\t\t\t\ttrap_num................%u\n"
+			"\t\t\t\tqpn.....................0x%06X\n"
+			"\t\t\t\tresp_time_val...........0x%X\n"
+			"\t\t\t\tnode_type...............0x%06X\n" "",
+			inet_ntop(AF_INET6, p_ii->gid.raw, gid_str,
+				  sizeof gid_str),
+			cl_ntoh16(p_ii->lid_range_begin),
+			cl_ntoh16(p_ii->lid_range_end),
+			p_ii->is_generic, p_ii->subscribe,
+			cl_ntoh16(p_ii->trap_type),
+			cl_ntoh16(p_ii->g_or_v.generic.trap_num),
+			cl_ntoh32(qpn), resp_time_val,
+			cl_ntoh32(ib_inform_info_get_prod_type(p_ii)));
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_inform_info_record(IN osm_log_t * const p_log,
-			    IN const ib_inform_info_record_t * const p_iir,
-			    IN const osm_log_level_t log_level)
+static void osm_dump_inform_info_to_buf(IN const ib_inform_info_t * p_ii,
+					OUT char * buf)
 {
-	if (osm_log_is_active(p_log, log_level)) {
-		char gid_str[INET6_ADDRSTRLEN];
-		char gid_str2[INET6_ADDRSTRLEN];
+	if (!buf || !p_ii)
+		return;
+	else {
 		uint32_t qpn;
 		uint8_t resp_time_val;
+		char gid_str[INET6_ADDRSTRLEN];
 
-		ib_inform_info_get_qpn_resp_time(p_iir->inform_info.g_or_v.
-						 generic.qpn_resp_time_val,
-						 &qpn, &resp_time_val);
-		if (p_iir->inform_info.is_generic) {
-			osm_log(p_log, log_level,
-				"InformInfo Record dump:\n"
-				"\t\t\t\tRID\n"
-				"\t\t\t\tSubscriberGID...........%s\n"
-				"\t\t\t\tSubscriberEnum..........0x%X\n"
-				"\t\t\t\tInformInfo dump:\n"
-				"\t\t\t\tgid.....................%s\n"
-				"\t\t\t\tlid_range_begin.........%u\n"
-				"\t\t\t\tlid_range_end...........%u\n"
-				"\t\t\t\tis_generic..............0x%X\n"
-				"\t\t\t\tsubscribe...............0x%X\n"
-				"\t\t\t\ttrap_type...............0x%X\n"
-				"\t\t\t\ttrap_num................%u\n"
-				"\t\t\t\tqpn.....................0x%06X\n"
-				"\t\t\t\tresp_time_val...........0x%X\n"
-				"\t\t\t\tnode_type...............0x%06X\n" "",
-				inet_ntop(AF_INET6, p_iir->subscriber_gid.raw,
-					gid_str, sizeof gid_str),
-				cl_ntoh16(p_iir->subscriber_enum),
-				inet_ntop(AF_INET6, p_iir->inform_info.gid.raw,
-					gid_str2, sizeof gid_str2),
-				cl_ntoh16(p_iir->inform_info.lid_range_begin),
-				cl_ntoh16(p_iir->inform_info.lid_range_end),
-				p_iir->inform_info.is_generic,
-				p_iir->inform_info.subscribe,
-				cl_ntoh16(p_iir->inform_info.trap_type),
-				cl_ntoh16(p_iir->inform_info.g_or_v.generic.
-					  trap_num), cl_ntoh32(qpn),
-				resp_time_val,
-				cl_ntoh32(ib_inform_info_get_prod_type
-					  (&p_iir->inform_info)));
-		} else {
-			osm_log(p_log, log_level,
-				"InformInfo Record dump:\n"
-				"\t\t\t\tRID\n"
-				"\t\t\t\tSubscriberGID...........%s\n"
-				"\t\t\t\tSubscriberEnum..........0x%X\n"
-				"\t\t\t\tInformInfo dump:\n"
-				"\t\t\t\tgid.....................%s\n"
-				"\t\t\t\tlid_range_begin.........%u\n"
-				"\t\t\t\tlid_range_end...........%u\n"
-				"\t\t\t\tis_generic..............0x%X\n"
-				"\t\t\t\tsubscribe...............0x%X\n"
-				"\t\t\t\ttrap_type...............0x%X\n"
-				"\t\t\t\tdev_id..................0x%X\n"
-				"\t\t\t\tqpn.....................0x%06X\n"
-				"\t\t\t\tresp_time_val...........0x%X\n"
-				"\t\t\t\tvendor_id...............0x%06X\n" "",
-				inet_ntop(AF_INET6, p_iir->subscriber_gid.raw,
-					gid_str, sizeof gid_str),
-				cl_ntoh16(p_iir->subscriber_enum),
-				inet_ntop(AF_INET6, p_iir->inform_info.gid.raw,
-					gid_str2, sizeof gid_str2),
-				cl_ntoh16(p_iir->inform_info.lid_range_begin),
-				cl_ntoh16(p_iir->inform_info.lid_range_end),
-				p_iir->inform_info.is_generic,
-				p_iir->inform_info.subscribe,
-				cl_ntoh16(p_iir->inform_info.trap_type),
-				cl_ntoh16(p_iir->inform_info.g_or_v.vend.
-					  dev_id), cl_ntoh32(qpn),
-				resp_time_val,
-				cl_ntoh32(ib_inform_info_get_prod_type
-					  (&p_iir->inform_info)));
-		}
+		ib_inform_info_get_qpn_resp_time(p_ii->g_or_v.generic.
+						 qpn_resp_time_val, &qpn,
+						 &resp_time_val);
+		sprintf(buf,
+			"InformInfo dump:\n"
+			"\t\t\t\tgid.....................%s\n"
+			"\t\t\t\tlid_range_begin.........%u\n"
+			"\t\t\t\tlid_range_end...........%u\n"
+			"\t\t\t\tis_generic..............0x%X\n"
+			"\t\t\t\tsubscribe...............0x%X\n"
+			"\t\t\t\ttrap_type...............0x%X\n"
+			"\t\t\t\tdev_id..................0x%X\n"
+			"\t\t\t\tqpn.....................0x%06X\n"
+			"\t\t\t\tresp_time_val...........0x%X\n"
+			"\t\t\t\tvendor_id...............0x%06X\n" "",
+			inet_ntop(AF_INET6, p_ii->gid.raw, gid_str,
+				  sizeof gid_str),
+			cl_ntoh16(p_ii->lid_range_begin),
+			cl_ntoh16(p_ii->lid_range_end),
+			p_ii->is_generic, p_ii->subscribe,
+			cl_ntoh16(p_ii->trap_type),
+			cl_ntoh16(p_ii->g_or_v.vend.dev_id),
+			cl_ntoh32(qpn), resp_time_val,
+			cl_ntoh32(ib_inform_info_get_prod_type(p_ii)));
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_link_record(IN osm_log_t * const p_log,
-		     IN const ib_link_record_t * const p_lr,
-		     IN const osm_log_level_t log_level)
+void osm_dump_inform_info(IN osm_log_t * p_log,
+			  IN const ib_inform_info_t * p_ii,
+			  IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
-		osm_log(p_log, log_level,
-			"Link Record dump:\n"
+		char buf[BUF_SIZE];
+
+		if (p_ii->is_generic)
+			osm_dump_inform_info_to_buf_generic(p_ii, buf);
+		else
+			osm_dump_inform_info_to_buf(p_ii, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_inform_info_v2(IN osm_log_t * p_log,
+			     IN const ib_inform_info_t * p_ii,
+			     IN const int file_id,
+			     IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		if (p_ii->is_generic)
+			osm_dump_inform_info_to_buf_generic(p_ii, buf);
+		else
+			osm_dump_inform_info_to_buf(p_ii, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_inform_info_record_to_buf_generic(IN const ib_inform_info_record_t * p_iir,
+						       OUT char * buf)
+{
+	if (!buf || p_iir)
+		return;
+	else {
+		char gid_str[INET6_ADDRSTRLEN];
+		char gid_str2[INET6_ADDRSTRLEN];
+		uint32_t qpn;
+		uint8_t resp_time_val;
+
+		ib_inform_info_get_qpn_resp_time(p_iir->inform_info.g_or_v.
+						 generic.qpn_resp_time_val,
+						 &qpn, &resp_time_val);
+		sprintf(buf,
+			"InformInfo Record dump:\n"
+			"\t\t\t\tRID\n"
+			"\t\t\t\tSubscriberGID...........%s\n"
+			"\t\t\t\tSubscriberEnum..........0x%X\n"
+			"\t\t\t\tInformInfo dump:\n"
+			"\t\t\t\tgid.....................%s\n"
+			"\t\t\t\tlid_range_begin.........%u\n"
+			"\t\t\t\tlid_range_end...........%u\n"
+			"\t\t\t\tis_generic..............0x%X\n"
+			"\t\t\t\tsubscribe...............0x%X\n"
+			"\t\t\t\ttrap_type...............0x%X\n"
+			"\t\t\t\ttrap_num................%u\n"
+			"\t\t\t\tqpn.....................0x%06X\n"
+			"\t\t\t\tresp_time_val...........0x%X\n"
+			"\t\t\t\tnode_type...............0x%06X\n" "",
+			inet_ntop(AF_INET6, p_iir->subscriber_gid.raw,
+				  gid_str, sizeof gid_str),
+			cl_ntoh16(p_iir->subscriber_enum),
+			inet_ntop(AF_INET6, p_iir->inform_info.gid.raw,
+				  gid_str2, sizeof gid_str2),
+			cl_ntoh16(p_iir->inform_info.lid_range_begin),
+			cl_ntoh16(p_iir->inform_info.lid_range_end),
+			p_iir->inform_info.is_generic,
+			p_iir->inform_info.subscribe,
+			cl_ntoh16(p_iir->inform_info.trap_type),
+			cl_ntoh16(p_iir->inform_info.g_or_v.generic.
+				  trap_num), cl_ntoh32(qpn),
+			resp_time_val,
+			cl_ntoh32(ib_inform_info_get_prod_type
+				  (&p_iir->inform_info)));
+	}
+}
+
+static void osm_dump_inform_info_record_to_buf(IN const ib_inform_info_record_t * p_iir,
+					       OUT char * buf)
+{
+	if(!buf || p_iir)
+		return;
+	else {
+		char gid_str[INET6_ADDRSTRLEN];
+		char gid_str2[INET6_ADDRSTRLEN];
+		uint32_t qpn;
+		uint8_t resp_time_val;
+
+		ib_inform_info_get_qpn_resp_time(p_iir->inform_info.g_or_v.
+						 generic.qpn_resp_time_val,
+						 &qpn, &resp_time_val);
+		sprintf(buf,
+			"InformInfo Record dump:\n"
+			"\t\t\t\tRID\n"
+			"\t\t\t\tSubscriberGID...........%s\n"
+			"\t\t\t\tSubscriberEnum..........0x%X\n"
+			"\t\t\t\tInformInfo dump:\n"
+			"\t\t\t\tgid.....................%s\n"
+			"\t\t\t\tlid_range_begin.........%u\n"
+			"\t\t\t\tlid_range_end...........%u\n"
+			"\t\t\t\tis_generic..............0x%X\n"
+			"\t\t\t\tsubscribe...............0x%X\n"
+			"\t\t\t\ttrap_type...............0x%X\n"
+			"\t\t\t\tdev_id..................0x%X\n"
+			"\t\t\t\tqpn.....................0x%06X\n"
+			"\t\t\t\tresp_time_val...........0x%X\n"
+			"\t\t\t\tvendor_id...............0x%06X\n" "",
+			inet_ntop(AF_INET6, p_iir->subscriber_gid.raw,
+				  gid_str, sizeof gid_str),
+			cl_ntoh16(p_iir->subscriber_enum),
+			inet_ntop(AF_INET6, p_iir->inform_info.gid.raw,
+				  gid_str2, sizeof gid_str2),
+			cl_ntoh16(p_iir->inform_info.lid_range_begin),
+			cl_ntoh16(p_iir->inform_info.lid_range_end),
+			p_iir->inform_info.is_generic,
+			p_iir->inform_info.subscribe,
+			cl_ntoh16(p_iir->inform_info.trap_type),
+			cl_ntoh16(p_iir->inform_info.g_or_v.vend.
+				  dev_id), cl_ntoh32(qpn),
+			resp_time_val,
+			cl_ntoh32(ib_inform_info_get_prod_type
+				  (&p_iir->inform_info)));
+	}
+}
+
+void osm_dump_inform_info_record(IN osm_log_t * p_log,
+				 IN const ib_inform_info_record_t * p_iir,
+				 IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active(p_log, log_level)) {
+		char buf[BUF_SIZE];
+
+		if (p_iir->inform_info.is_generic)
+			osm_dump_inform_info_record_to_buf_generic(p_iir, buf);
+		else
+			osm_dump_inform_info_record_to_buf(p_iir, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_inform_info_record_v2(IN osm_log_t * p_log,
+				    IN const ib_inform_info_record_t * p_iir,
+				    IN const int file_id,
+				    IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		if (p_iir->inform_info.is_generic)
+			osm_dump_inform_info_record_to_buf_generic(p_iir, buf);
+		else
+			osm_dump_inform_info_record_to_buf(p_iir, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_link_record_to_buf(IN const ib_link_record_t * p_lr,
+					OUT char * buf)
+{
+	if (!buf || !p_lr)
+		return;
+	else {
+		sprintf(buf,
+			"Link Record dump:\n"
 			"\t\t\t\tfrom_lid................%u\n"
 			"\t\t\t\tfrom_port_num...........%u\n"
 			"\t\t\t\tto_port_num.............%u\n"
@@ -1498,15 +1936,40 @@ osm_dump_link_record(IN osm_log_t * const p_log,
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_switch_info(IN osm_log_t * const p_log,
-		     IN const ib_switch_info_t * const p_si,
-		     IN const osm_log_level_t log_level)
+void osm_dump_link_record(IN osm_log_t * p_log,
+			  IN const ib_link_record_t * p_lr,
+			  IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
-		osm_log(p_log, OSM_LOG_VERBOSE,
+		char buf[BUF_SIZE];
+
+		osm_dump_link_record_to_buf(p_lr, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_link_record_v2(IN osm_log_t * p_log,
+			     IN const ib_link_record_t * p_lr,
+			     IN const int file_id,
+			     IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_link_record_to_buf(p_lr, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_switch_info_to_buf(IN const ib_switch_info_t * p_si,
+					OUT char * buf)
+{
+	if (!buf || !p_si)
+		return;
+	else {
+		sprintf(buf,
 			"SwitchInfo dump:\n"
 			"\t\t\t\tlin_cap.................0x%X\n"
 			"\t\t\t\trand_cap................0x%X\n"
@@ -1518,29 +1981,52 @@ osm_dump_switch_info(IN osm_log_t * const p_log,
 			"\t\t\t\tlife_state..............0x%X\n"
 			"\t\t\t\tlids_per_port...........%u\n"
 			"\t\t\t\tpartition_enf_cap.......0x%X\n"
-			"\t\t\t\tflags...................0x%X\n",
-			cl_ntoh16(p_si->lin_cap),
-			cl_ntoh16(p_si->rand_cap),
-			cl_ntoh16(p_si->mcast_cap),
-			cl_ntoh16(p_si->lin_top),
-			p_si->def_port,
-			p_si->def_mcast_pri_port,
-			p_si->def_mcast_not_port,
-			p_si->life_state,
+			"\t\t\t\tflags...................0x%X\n"
+			"\t\t\t\tmcast_top...............0x%X\n",
+			cl_ntoh16(p_si->lin_cap), cl_ntoh16(p_si->rand_cap),
+			cl_ntoh16(p_si->mcast_cap), cl_ntoh16(p_si->lin_top),
+			p_si->def_port, p_si->def_mcast_pri_port,
+			p_si->def_mcast_not_port, p_si->life_state,
 			cl_ntoh16(p_si->lids_per_port),
-			cl_ntoh16(p_si->enforce_cap), p_si->flags);
+			cl_ntoh16(p_si->enforce_cap), p_si->flags,
+			cl_ntoh16(p_si->mcast_top));
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_switch_info_record(IN osm_log_t * const p_log,
-			    IN const ib_switch_info_record_t * const p_sir,
-			    IN const osm_log_level_t log_level)
+void osm_dump_switch_info(IN osm_log_t * p_log,
+			  IN const ib_switch_info_t * p_si,
+			  IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
-		osm_log(p_log, log_level,
+		char buf[BUF_SIZE];
+
+		osm_dump_switch_info_to_buf(p_si, buf);
+
+		osm_log(p_log, OSM_LOG_VERBOSE, buf);
+	}
+}
+
+void osm_dump_switch_info_v2(IN osm_log_t * p_log,
+			     IN const ib_switch_info_t * p_si,
+			     IN const int file_id,
+			     IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_switch_info_to_buf(p_si, buf);
+
+		osm_log_v2(p_log, OSM_LOG_VERBOSE, file_id, buf);
+	}
+}
+
+static void osm_dump_switch_info_record_to_buf(IN const ib_switch_info_record_t * p_sir,
+					       OUT char * buf)
+{
+	if (!buf || !p_sir)
+		return;
+	else {
+		sprintf(buf,
 			"SwitchInfo Record dump:\n"
 			"\t\t\t\tRID\n"
 			"\t\t\t\tlid.....................%u\n"
@@ -1571,17 +2057,42 @@ osm_dump_switch_info_record(IN osm_log_t * const p_log,
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_pkey_block(IN osm_log_t * const p_log,
-		    IN uint64_t port_guid,
-		    IN uint16_t block_num,
-		    IN uint8_t port_num,
-		    IN const ib_pkey_table_t * const p_pkey_tbl,
-		    IN const osm_log_level_t log_level)
+void osm_dump_switch_info_record(IN osm_log_t * p_log,
+				 IN const ib_switch_info_record_t * p_sir,
+				 IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_switch_info_record_to_buf(p_sir, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_switch_info_record_v2(IN osm_log_t * p_log,
+				    IN const ib_switch_info_record_t * p_sir,
+				    IN const int file_id,
+				    IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_switch_info_record_to_buf(p_sir, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_pkey_block_to_buf(IN uint64_t port_guid,
+				       IN uint16_t block_num,
+				       IN uint8_t port_num,
+				       IN const ib_pkey_table_t * p_pkey_tbl,
+				       OUT char * buf)
+{
+	if (!buf || !p_pkey_tbl)
+		return;
+	else {
 		char buf_line[1024];
 		int i, n;
 
@@ -1589,7 +2100,7 @@ osm_dump_pkey_block(IN osm_log_t * const p_log,
 			n += sprintf(buf_line + n, " 0x%04x |",
 				     cl_ntoh16(p_pkey_tbl->pkey_entry[i]));
 
-		osm_log(p_log, log_level,
+		sprintf(buf,
 			"P_Key table dump:\n"
 			"\t\t\tport_guid...........0x%016" PRIx64 "\n"
 			"\t\t\tblock_num...........0x%X\n"
@@ -1598,17 +2109,46 @@ osm_dump_pkey_block(IN osm_log_t * const p_log,
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_slvl_map_table(IN osm_log_t * const p_log,
-			IN uint64_t port_guid,
-			IN uint8_t in_port_num,
-			IN uint8_t out_port_num,
-			IN const ib_slvl_table_t * const p_slvl_tbl,
-			IN const osm_log_level_t log_level)
+void osm_dump_pkey_block(IN osm_log_t * p_log, IN uint64_t port_guid,
+			 IN uint16_t block_num, IN uint8_t port_num,
+			 IN const ib_pkey_table_t * p_pkey_tbl,
+			 IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_pkey_block_to_buf(port_guid, block_num, port_num,
+					   p_pkey_tbl, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_pkey_block_v2(IN osm_log_t * p_log, IN uint64_t port_guid,
+			    IN uint16_t block_num, IN uint8_t port_num,
+			    IN const ib_pkey_table_t * p_pkey_tbl,
+			    IN const int file_id,
+			    IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_pkey_block_to_buf(port_guid, block_num,
+					   port_num, p_pkey_tbl, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_slvl_map_table_to_buf(IN uint64_t port_guid,
+					   IN uint8_t in_port_num,
+					   IN uint8_t out_port_num,
+					   IN const ib_slvl_table_t * p_slvl_tbl,
+					   OUT char * buf)
+{
+	if (!buf || !p_slvl_tbl)
+		return;
+	else {
 		char buf_line1[1024], buf_line2[1024];
 		int n;
 		uint8_t i;
@@ -1618,27 +2158,56 @@ osm_dump_slvl_map_table(IN osm_log_t * const p_log,
 		for (i = 0, n = 0; i < 16; i++)
 			n += sprintf(buf_line2 + n, "0x%01X |",
 				     ib_slvl_table_get(p_slvl_tbl, i));
-		osm_log(p_log, log_level,
+		sprintf(buf,
 			"SLtoVL dump:\n"
 			"\t\t\tport_guid............0x%016" PRIx64 "\n"
 			"\t\t\tin_port_num..........%u\n"
 			"\t\t\tout_port_num.........%u\n\tSL: | %s\n\tVL: | %s\n",
-			cl_ntoh64(port_guid),
-			in_port_num, out_port_num, buf_line1, buf_line2);
+			cl_ntoh64(port_guid), in_port_num, out_port_num,
+			buf_line1, buf_line2);
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_vl_arb_table(IN osm_log_t * const p_log,
-		      IN uint64_t port_guid,
-		      IN uint8_t block_num,
-		      IN uint8_t port_num,
-		      IN const ib_vl_arb_table_t * const p_vla_tbl,
-		      IN const osm_log_level_t log_level)
+void osm_dump_slvl_map_table(IN osm_log_t * p_log, IN uint64_t port_guid,
+			     IN uint8_t in_port_num, IN uint8_t out_port_num,
+			     IN const ib_slvl_table_t * p_slvl_tbl,
+			     IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_slvl_map_table_to_buf(port_guid, in_port_num,
+					       out_port_num, p_slvl_tbl, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_slvl_map_table_v2(IN osm_log_t * p_log, IN uint64_t port_guid,
+				IN uint8_t in_port_num, IN uint8_t out_port_num,
+				IN const ib_slvl_table_t * p_slvl_tbl,
+				IN const int file_id,
+				IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_slvl_map_table_to_buf(port_guid, in_port_num,
+					       out_port_num, p_slvl_tbl, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_vl_arb_table_to_buf(IN uint64_t port_guid,
+					 IN uint8_t block_num,
+					 IN uint8_t port_num,
+					 IN const ib_vl_arb_table_t * p_vla_tbl,
+					 OUT char * buf)
+{
+	if (!buf || !p_vla_tbl)
+		return;
+	else {
 		char buf_line1[1024], buf_line2[1024];
 		int i, n;
 
@@ -1648,7 +2217,7 @@ osm_dump_vl_arb_table(IN osm_log_t * const p_log,
 		for (i = 0, n = 0; i < 32; i++)
 			n += sprintf(buf_line2 + n, " 0x%01X |",
 				     p_vla_tbl->vl_entry[i].weight);
-		osm_log(p_log, log_level,
+		sprintf(buf,
 			"VLArb dump:\n" "\t\t\tport_guid...........0x%016"
 			PRIx64 "\n" "\t\t\tblock_num...........0x%X\n"
 			"\t\t\tport_num............%u\n\tVL    : | %s\n\tWEIGHT:| %s\n",
@@ -1657,38 +2226,88 @@ osm_dump_vl_arb_table(IN osm_log_t * const p_log,
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_sm_info(IN osm_log_t * const p_log,
-		 IN const ib_sm_info_t * const p_smi,
-		 IN const osm_log_level_t log_level)
+void osm_dump_vl_arb_table(IN osm_log_t * p_log, IN uint64_t port_guid,
+			   IN uint8_t block_num, IN uint8_t port_num,
+			   IN const ib_vl_arb_table_t * p_vla_tbl,
+			   IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
-		osm_log(p_log, OSM_LOG_DEBUG,
+		char buf[BUF_SIZE];
+
+		osm_dump_vl_arb_table_to_buf(port_guid, block_num,
+					     port_num, p_vla_tbl, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_vl_arb_table_v2(IN osm_log_t * p_log, IN uint64_t port_guid,
+			      IN uint8_t block_num, IN uint8_t port_num,
+			      IN const ib_vl_arb_table_t * p_vla_tbl,
+			      IN const int file_id,
+			      IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_vl_arb_table_to_buf(port_guid, block_num,
+					     port_num, p_vla_tbl, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_sm_info_to_buf(IN const ib_sm_info_t * p_smi,
+				    OUT char * buf)
+{
+	if (!buf || !p_smi)
+		return;
+	else {
+		sprintf(buf,
 			"SMInfo dump:\n"
 			"\t\t\t\tguid....................0x%016" PRIx64 "\n"
 			"\t\t\t\tsm_key..................0x%016" PRIx64 "\n"
 			"\t\t\t\tact_count...............%u\n"
 			"\t\t\t\tpriority................%u\n"
 			"\t\t\t\tsm_state................%u\n",
-			cl_ntoh64(p_smi->guid),
-			cl_ntoh64(p_smi->sm_key),
+			cl_ntoh64(p_smi->guid), cl_ntoh64(p_smi->sm_key),
 			cl_ntoh32(p_smi->act_count),
 			ib_sminfo_get_priority(p_smi),
 			ib_sminfo_get_state(p_smi));
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_sm_info_record(IN osm_log_t * const p_log,
-			IN const ib_sminfo_record_t * const p_smir,
-			IN const osm_log_level_t log_level)
+void osm_dump_sm_info(IN osm_log_t * p_log, IN const ib_sm_info_t * p_smi,
+		      IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
-		osm_log(p_log, OSM_LOG_DEBUG,
+		char buf[BUF_SIZE];
+
+		osm_dump_sm_info_to_buf(p_smi, buf);
+
+		osm_log(p_log, OSM_LOG_DEBUG, buf);
+	}
+}
+
+void osm_dump_sm_info_v2(IN osm_log_t * p_log, IN const ib_sm_info_t * p_smi,
+			 IN const int file_id, IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_sm_info_to_buf(p_smi, buf);
+
+		osm_log_v2(p_log, OSM_LOG_DEBUG, file_id, buf);
+	}
+}
+
+static void osm_dump_sm_info_record_to_buf(IN const ib_sminfo_record_t * p_smir,
+					   OUT char * buf)
+{
+	if (!buf || !p_smir)
+		return;
+	else {
+		sprintf(buf,
 			"SMInfo Record dump:\n"
 			"\t\t\t\tRID\n"
 			"\t\t\t\tLid.....................%u\n"
@@ -1699,8 +2318,7 @@ osm_dump_sm_info_record(IN osm_log_t * const p_log,
 			"\t\t\t\tact_count...............%u\n"
 			"\t\t\t\tpriority................%u\n"
 			"\t\t\t\tsm_state................%u\n",
-			cl_ntoh16(p_smir->lid),
-			cl_ntoh16(p_smir->resv0),
+			cl_ntoh16(p_smir->lid), cl_ntoh16(p_smir->resv0),
 			cl_ntoh64(p_smir->sm_info.guid),
 			cl_ntoh64(p_smir->sm_info.sm_key),
 			cl_ntoh32(p_smir->sm_info.act_count),
@@ -1709,232 +2327,403 @@ osm_dump_sm_info_record(IN osm_log_t * const p_log,
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_notice(IN osm_log_t * const p_log,
-		IN const ib_mad_notice_attr_t * p_ntci,
-		IN const osm_log_level_t log_level)
+void osm_dump_sm_info_record(IN osm_log_t * p_log,
+			     IN const ib_sminfo_record_t * p_smir,
+			     IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
-		if (ib_notice_is_generic(p_ntci)) {
-			char buff[1024];
-			buff[0] = '\0';
-
-			/* immediate data based on the trap */
-			switch (cl_ntoh16(p_ntci->g_or_v.generic.trap_num)) {
-			case 64:
-			case 65:
-			case 66:
-			case 67:
-				sprintf(buff,
-					"\t\t\t\tsrc_gid..................0x%016"
-					PRIx64 ":0x%016" PRIx64 "\n",
-					cl_ntoh64(p_ntci->data_details.
-						  ntc_64_67.gid.unicast.prefix),
-					cl_ntoh64(p_ntci->data_details.
-						  ntc_64_67.gid.unicast.
-						  interface_id));
-				break;
-			case 128:
-				sprintf(buff,
-					"\t\t\t\tsw_lid...................%u\n",
-					cl_ntoh16(p_ntci->data_details.ntc_128.
-						  sw_lid));
-				break;
-			case 129:
-			case 130:
-			case 131:
-				sprintf(buff,
-					"\t\t\t\tlid......................%u\n"
-					"\t\t\t\tport_num.................%u\n",
-					cl_ntoh16(p_ntci->data_details.
-						  ntc_129_131.lid),
-					p_ntci->data_details.ntc_129_131.
-					port_num);
-				break;
-			case 144:
-				sprintf(buff,
-					"\t\t\t\tlid......................%u\n"
-					"\t\t\t\tnew_cap_mask.............0x%08x\n",
-					cl_ntoh16(p_ntci->data_details.ntc_144.
-						  lid),
-					cl_ntoh32(p_ntci->data_details.ntc_144.
-						  new_cap_mask));
-				break;
-			case 145:
-				sprintf(buff,
-					"\t\t\t\tlid......................%u\n"
-					"\t\t\t\tnew_sys_guid.............0x%016"
-					PRIx64 "\n",
-					cl_ntoh16(p_ntci->data_details.ntc_145.
-						  lid),
-					cl_ntoh64(p_ntci->data_details.ntc_145.
-						  new_sys_guid));
+		char buf[BUF_SIZE];
+
+		osm_dump_sm_info_record_to_buf(p_smir, buf);
+
+		osm_log(p_log, OSM_LOG_DEBUG, buf);
+	}
+}
+
+void osm_dump_sm_info_record_v2(IN osm_log_t * p_log,
+				IN const ib_sminfo_record_t * p_smir,
+				IN const int file_id,
+				IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_sm_info_record_to_buf(p_smir, buf);
+
+		osm_log_v2(p_log, OSM_LOG_DEBUG, file_id, buf);
+	}
+}
+
+static void osm_dump_notice_to_buf_generic(IN const ib_mad_notice_attr_t * p_ntci,
+					   OUT char * log_buf)
+{
+	if (!log_buf || !p_ntci)
+		return;
+	else {
+		char gid_str[INET6_ADDRSTRLEN];
+		char gid_str2[INET6_ADDRSTRLEN];
+		char buff[1024];
+		int n;
+
+		buff[0] = '\0';
+
+		/* immediate data based on the trap */
+		switch (cl_ntoh16(p_ntci->g_or_v.generic.trap_num)) {
+		case 64:
+		case 65:
+		case 66:
+		case 67:
+			sprintf(buff,
+				"\t\t\t\tsrc_gid..................%s\n",
+				inet_ntop(AF_INET6, p_ntci->data_details.
+					  ntc_64_67.gid.raw, gid_str,
+					  sizeof gid_str));
+			break;
+		case 128:
+			sprintf(buff,
+				"\t\t\t\tsw_lid...................%u\n",
+				cl_ntoh16(p_ntci->data_details.ntc_128.sw_lid));
+			break;
+		case 129:
+		case 130:
+		case 131:
+			sprintf(buff,
+				"\t\t\t\tlid......................%u\n"
+				"\t\t\t\tport_num.................%u\n",
+				cl_ntoh16(p_ntci->data_details.
+					  ntc_129_131.lid),
+				p_ntci->data_details.ntc_129_131.port_num);
+			break;
+		case 144:
+			sprintf(buff,
+				"\t\t\t\tlid......................%u\n"
+				"\t\t\t\tlocal_changes............%u\n"
+				"\t\t\t\tnew_cap_mask.............0x%08x\n"
+				"\t\t\t\tchange_flags.............0x%x\n"
+				"\t\t\t\tcap_mask2................0x%x\n",
+				cl_ntoh16(p_ntci->data_details.ntc_144.lid),
+				p_ntci->data_details.ntc_144.local_changes,
+				cl_ntoh32(p_ntci->data_details.ntc_144.
+					  new_cap_mask),
+				cl_ntoh16(p_ntci->data_details.ntc_144.
+					  change_flgs),
+				cl_ntoh16(p_ntci->data_details.ntc_144.
+					  cap_mask2));
+			break;
+		case 145:
+			sprintf(buff,
+				"\t\t\t\tlid......................%u\n"
+				"\t\t\t\tnew_sys_guid.............0x%016"
+				PRIx64 "\n",
+				cl_ntoh16(p_ntci->data_details.ntc_145.
+					  lid),
+				cl_ntoh64(p_ntci->data_details.ntc_145.
+					  new_sys_guid));
+			break;
+		case 256:
+			n = sprintf(buff,
+				    "\t\t\t\tlid......................%u\n"
+				    "\t\t\t\tdrslid...................%u\n"
+				    "\t\t\t\tmethod...................0x%x\n"
+				    "\t\t\t\tattr_id..................0x%x\n"
+				    "\t\t\t\tattr_mod.................0x%x\n"
+				    "\t\t\t\tm_key....................0x%016"
+				    PRIx64 "\n"
+				    "\t\t\t\tdr_notice................%d\n"
+				    "\t\t\t\tdr_path_truncated........%d\n"
+				    "\t\t\t\tdr_hop_count.............%u\n",
+				    cl_ntoh16(p_ntci->data_details.ntc_256.lid),
+				    cl_ntoh16(p_ntci->data_details.ntc_256.
+					      dr_slid),
+				    p_ntci->data_details.ntc_256.method,
+				    cl_ntoh16(p_ntci->data_details.ntc_256.
+					      attr_id),
+				    cl_ntoh32(p_ntci->data_details.ntc_256.
+					      attr_mod),
+				    cl_ntoh64(p_ntci->data_details.ntc_256.
+					      mkey),
+				    p_ntci->data_details.ntc_256.
+				    dr_trunc_hop >> 7,
+				    p_ntci->data_details.ntc_256.
+				    dr_trunc_hop >> 6,
+				    p_ntci->data_details.ntc_256.
+				    dr_trunc_hop & 0x3f);
+			n += snprintf(buff + n, sizeof(buff) - n,
+				      "Directed Path Dump of %u hop path:"
+				      "\n\t\t\t\tPath = ",
+				      p_ntci->data_details.ntc_256.
+				      dr_trunc_hop & 0x3f);
+			n += sprint_uint8_arr(buff + n, sizeof(buff) - n,
+					      p_ntci->data_details.ntc_256.
+					      dr_rtn_path,
+					      (p_ntci->data_details.ntc_256.
+					       dr_trunc_hop & 0x3f) + 1);
+			if (n >= sizeof(buff)) {
+				n = sizeof(buff) - 2;
 				break;
 			}
-
-			osm_log(p_log, log_level,
-				"Generic Notice dump:\n"
-				"\t\t\t\ttype.....................%u\n"
-				"\t\t\t\tprod_type................%u (%s)\n"
-				"\t\t\t\ttrap_num.................%u\n%s",
-				ib_notice_get_type(p_ntci),
-				cl_ntoh32(ib_notice_get_prod_type(p_ntci)),
-				ib_get_producer_type_str(ib_notice_get_prod_type
-							 (p_ntci)),
-				cl_ntoh16(p_ntci->g_or_v.generic.trap_num),
-				buff);
-		} else {
-			osm_log(p_log, log_level,
-				"Vendor Notice dump:\n"
-				"\t\t\t\ttype.....................%u\n"
-				"\t\t\t\tvendor...................%u\n"
-				"\t\t\t\tdevice_id................%u\n",
-				cl_ntoh16(ib_notice_get_type(p_ntci)),
-				cl_ntoh32(ib_notice_get_vend_id(p_ntci)),
-				cl_ntoh16(p_ntci->g_or_v.vend.dev_id));
+			snprintf(buff + n, sizeof(buff) - n, "\n");
+			break;
+		case 257:
+		case 258:
+			sprintf(buff,
+				"\t\t\t\tlid1.....................%u\n"
+				"\t\t\t\tlid2.....................%u\n"
+				"\t\t\t\tkey......................0x%x\n"
+				"\t\t\t\tsl.......................%d\n"
+				"\t\t\t\tqp1......................0x%x\n"
+				"\t\t\t\tqp2......................0x%x\n"
+				"\t\t\t\tgid1.....................%s\n"
+				"\t\t\t\tgid2.....................%s\n",
+				cl_ntoh16(p_ntci->data_details.ntc_257_258.
+					  lid1),
+				cl_ntoh16(p_ntci->data_details.ntc_257_258.
+					  lid2),
+				cl_ntoh32(p_ntci->data_details.ntc_257_258.key),
+				cl_ntoh32(p_ntci->data_details.ntc_257_258.
+					  qp1) >> 28,
+				cl_ntoh32(p_ntci->data_details.ntc_257_258.
+					  qp1) & 0xffffff,
+				cl_ntoh32(p_ntci->data_details.ntc_257_258.
+					  qp2) & 0xffffff,
+				inet_ntop(AF_INET6, p_ntci->data_details.
+					  ntc_257_258.gid1.raw, gid_str,
+					  sizeof gid_str),
+				inet_ntop(AF_INET6, p_ntci->data_details.
+					  ntc_257_258.gid2.raw, gid_str2,
+					  sizeof gid_str2));
+			break;
+		case 259:
+			sprintf(buff,
+				"\t\t\t\tdata_valid...............0x%x\n"
+				"\t\t\t\tlid1.....................%u\n"
+				"\t\t\t\tlid2.....................%u\n"
+				"\t\t\t\tpkey.....................0x%x\n"
+				"\t\t\t\tsl.......................%d\n"
+				"\t\t\t\tqp1......................0x%x\n"
+				"\t\t\t\tqp2......................0x%x\n"
+				"\t\t\t\tgid1.....................%s\n"
+				"\t\t\t\tgid2.....................%s\n"
+				"\t\t\t\tsw_lid...................%u\n"
+				"\t\t\t\tport_no..................%u\n",
+				cl_ntoh16(p_ntci->data_details.ntc_259.
+					  data_valid),
+				cl_ntoh16(p_ntci->data_details.ntc_259.lid1),
+				cl_ntoh16(p_ntci->data_details.ntc_259.lid2),
+				cl_ntoh16(p_ntci->data_details.ntc_259.pkey),
+				cl_ntoh32(p_ntci->data_details.ntc_259.
+					  sl_qp1) >> 24,
+				cl_ntoh32(p_ntci->data_details.ntc_259.
+					  sl_qp1) & 0xffffff,
+				cl_ntoh32(p_ntci->data_details.ntc_259.qp2),
+				inet_ntop(AF_INET6, p_ntci->data_details.
+					  ntc_259.gid1.raw, gid_str,
+					  sizeof gid_str),
+				inet_ntop(AF_INET6, p_ntci->data_details.
+					  ntc_259.gid2.raw, gid_str2,
+					  sizeof gid_str2),
+				cl_ntoh16(p_ntci->data_details.ntc_259.sw_lid),
+				p_ntci->data_details.ntc_259.port_no);
+			break;
 		}
+
+		sprintf(log_buf,
+			"Generic Notice dump:\n"
+			"\t\t\t\ttype.....................%u\n"
+			"\t\t\t\tprod_type................%u (%s)\n"
+			"\t\t\t\ttrap_num.................%u\n%s",
+			ib_notice_get_type(p_ntci),
+			cl_ntoh32(ib_notice_get_prod_type(p_ntci)),
+			ib_get_producer_type_str(ib_notice_get_prod_type
+						 (p_ntci)),
+			cl_ntoh16(p_ntci->g_or_v.generic.trap_num), buff);
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_dr_smp(IN osm_log_t * const p_log,
-		IN const ib_smp_t * const p_smp,
-		IN const osm_log_level_t log_level)
+static void osm_dump_notice_to_buf(IN const ib_mad_notice_attr_t * p_ntci,
+				   OUT char * buf)
+{
+	if (!buf || !p_ntci)
+		return;
+	else {
+		sprintf(buf,
+			"Vendor Notice dump:\n"
+			"\t\t\t\ttype.....................%u\n"
+			"\t\t\t\tvendor...................%u\n"
+			"\t\t\t\tdevice_id................%u\n",
+			cl_ntoh16(ib_notice_get_type(p_ntci)),
+			cl_ntoh32(ib_notice_get_vend_id(p_ntci)),
+			cl_ntoh16(p_ntci->g_or_v.vend.dev_id));
+	}
+}
+
+void osm_dump_notice(IN osm_log_t * p_log,
+		     IN const ib_mad_notice_attr_t * p_ntci,
+		     IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
-		char buf[BUF_SIZE], line[BUF_SIZE];
-		uint32_t i;
+		char buf[BUF_SIZE];
 
-		sprintf(buf,
-			"SMP dump:\n"
-			"\t\t\t\tbase_ver................0x%X\n"
-			"\t\t\t\tmgmt_class..............0x%X\n"
-			"\t\t\t\tclass_ver...............0x%X\n"
-			"\t\t\t\tmethod..................0x%X (%s)\n",
-			p_smp->base_ver,
-			p_smp->mgmt_class,
-			p_smp->class_ver,
-			p_smp->method, ib_get_sm_method_str(p_smp->method));
+		if (ib_notice_is_generic(p_ntci))
+			osm_dump_notice_to_buf_generic(p_ntci, buf);
+		else
+			osm_dump_notice_to_buf(p_ntci, buf);
 
-		if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {
-			sprintf(line,
-				"\t\t\t\tD bit...................0x%X\n"
-				"\t\t\t\tstatus..................0x%X\n",
-				ib_smp_is_d(p_smp), ib_smp_get_status(p_smp));
-		} else {
-			sprintf(line,
-				"\t\t\t\tstatus..................0x%X\n",
-				cl_ntoh16(p_smp->status));
-		}
-		strcat(buf, line);
+		osm_log(p_log, log_level, buf);
+	}
+}
 
-		sprintf(line,
-			"\t\t\t\thop_ptr.................0x%X\n"
-			"\t\t\t\thop_count...............0x%X\n"
-			"\t\t\t\ttrans_id................0x%" PRIx64 "\n"
-			"\t\t\t\tattr_id.................0x%X (%s)\n"
-			"\t\t\t\tresv....................0x%X\n"
-			"\t\t\t\tattr_mod................0x%X\n"
-			"\t\t\t\tm_key...................0x%016" PRIx64 "\n",
-			p_smp->hop_ptr,
-			p_smp->hop_count,
-			cl_ntoh64(p_smp->trans_id),
-			cl_ntoh16(p_smp->attr_id),
-			ib_get_sm_attr_str(p_smp->attr_id),
-			cl_ntoh16(p_smp->resv),
-			cl_ntoh32(p_smp->attr_mod), cl_ntoh64(p_smp->m_key));
-		strcat(buf, line);
+void osm_dump_notice_v2(IN osm_log_t * p_log,
+			IN const ib_mad_notice_attr_t * p_ntci,
+			IN const int file_id, IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
 
-		if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {
-			sprintf(line,
-				"\t\t\t\tdr_slid.................%u\n"
-				"\t\t\t\tdr_dlid.................%u\n",
-				cl_ntoh16(p_smp->dr_slid),
-				cl_ntoh16(p_smp->dr_dlid));
-			strcat(buf, line);
-
-			strcat(buf, "\n\t\t\t\tInitial path: ");
-
-			for (i = 0; i <= p_smp->hop_count; i++) {
-				if (i == 0)
-					sprintf(line, "%d",
-						p_smp->initial_path[i]);
-				else
-					sprintf(line, ",%d",
-						p_smp->initial_path[i]);
-				strcat(buf, line);
-			}
+		if (ib_notice_is_generic(p_ntci))
+			osm_dump_notice_to_buf_generic(p_ntci, buf);
+		else
+			osm_dump_notice_to_buf(p_ntci, buf);
 
-			strcat(buf, "\n\t\t\t\tReturn path:  ");
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
 
-			for (i = 0; i <= p_smp->hop_count; i++) {
-				if (i == 0)
-					sprintf(line, "%d",
-						p_smp->return_path[i]);
-				else
-					sprintf(line, ",%d",
-						p_smp->return_path[i]);
-				strcat(buf, line);
-			}
+static void osm_dump_dr_smp_to_buf(IN const ib_smp_t * p_smp, OUT char * buf)
+{
+	if (!buf || !p_smp)
+		return;
+	else {
+		unsigned n;
+
+		n = sprintf(buf,
+			    "SMP dump:\n"
+			    "\t\t\t\tbase_ver................0x%X\n"
+			    "\t\t\t\tmgmt_class..............0x%X\n"
+			    "\t\t\t\tclass_ver...............0x%X\n"
+			    "\t\t\t\tmethod..................0x%X (%s)\n",
+			    p_smp->base_ver, p_smp->mgmt_class,
+			    p_smp->class_ver, p_smp->method,
+			    ib_get_sm_method_str(p_smp->method));
 
-			strcat(buf, "\n\t\t\t\tReserved:     ");
+		if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {
+			n += snprintf(buf + n, sizeof(buf) - n,
+				      "\t\t\t\tD bit...................0x%X\n"
+				      "\t\t\t\tstatus..................0x%X\n",
+				      ib_smp_is_d(p_smp),
+				      cl_ntoh16(ib_smp_get_status(p_smp)));
+		} else {
+			n += snprintf(buf + n, sizeof(buf) - n,
+				      "\t\t\t\tstatus..................0x%X\n",
+				      cl_ntoh16(p_smp->status));
+		}
+
+		n += snprintf(buf + n, sizeof(buf) - n,
+			      "\t\t\t\thop_ptr.................0x%X\n"
+			      "\t\t\t\thop_count...............0x%X\n"
+			      "\t\t\t\ttrans_id................0x%" PRIx64 "\n"
+			      "\t\t\t\tattr_id.................0x%X (%s)\n"
+			      "\t\t\t\tresv....................0x%X\n"
+			      "\t\t\t\tattr_mod................0x%X\n"
+			      "\t\t\t\tm_key...................0x%016" PRIx64
+			      "\n", p_smp->hop_ptr, p_smp->hop_count,
+			      cl_ntoh64(p_smp->trans_id),
+			      cl_ntoh16(p_smp->attr_id),
+			      ib_get_sm_attr_str(p_smp->attr_id),
+			      cl_ntoh16(p_smp->resv),
+			      cl_ntoh32(p_smp->attr_mod),
+			      cl_ntoh64(p_smp->m_key));
 
+		if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {
+			uint32_t i;
+			n += snprintf(buf + n, sizeof(buf) - n,
+				      "\t\t\t\tdr_slid.................%u\n"
+				      "\t\t\t\tdr_dlid.................%u\n",
+				      cl_ntoh16(p_smp->dr_slid),
+				      cl_ntoh16(p_smp->dr_dlid));
+
+			n += snprintf(buf + n, sizeof(buf) - n,
+				      "\n\t\t\t\tInitial path: ");
+			n += sprint_uint8_arr(buf + n, sizeof(buf) - n,
+					      p_smp->initial_path,
+					      p_smp->hop_count + 1);
+
+			n += snprintf(buf + n, sizeof(buf) - n,
+				      "\n\t\t\t\tReturn path:  ");
+			n += sprint_uint8_arr(buf + n, sizeof(buf) - n,
+					      p_smp->return_path,
+					      p_smp->hop_count + 1);
+
+			n += snprintf(buf + n, sizeof(buf) - n,
+				      "\n\t\t\t\tReserved:     ");
 			for (i = 0; i < 7; i++) {
-				sprintf(line, "[%0X]", p_smp->resv1[i]);
-				strcat(buf, line);
+				n += snprintf(buf + n, sizeof(buf) - n,
+					      "[%0X]", p_smp->resv1[i]);
 			}
-
-			strcat(buf, "\n");
+			n += snprintf(buf + n, sizeof(buf) - n, "\n");
 
 			for (i = 0; i < 64; i += 16) {
-				sprintf(line, "\n\t\t\t\t%02X %02X %02X %02X "
-					"%02X %02X %02X %02X"
-					"   %02X %02X %02X %02X %02X %02X %02X %02X\n",
-					p_smp->data[i],
-					p_smp->data[i + 1],
-					p_smp->data[i + 2],
-					p_smp->data[i + 3],
-					p_smp->data[i + 4],
-					p_smp->data[i + 5],
-					p_smp->data[i + 6],
-					p_smp->data[i + 7],
-					p_smp->data[i + 8],
-					p_smp->data[i + 9],
-					p_smp->data[i + 10],
-					p_smp->data[i + 11],
-					p_smp->data[i + 12],
-					p_smp->data[i + 13],
-					p_smp->data[i + 14],
-					p_smp->data[i + 15]);
-
-				strcat(buf, line);
+				n += snprintf(buf + n, sizeof(buf) - n,
+					      "\n\t\t\t\t%02X %02X %02X %02X "
+					      "%02X %02X %02X %02X"
+					      "   %02X %02X %02X %02X %02X %02X %02X %02X\n",
+					      p_smp->data[i],
+					      p_smp->data[i + 1],
+					      p_smp->data[i + 2],
+					      p_smp->data[i + 3],
+					      p_smp->data[i + 4],
+					      p_smp->data[i + 5],
+					      p_smp->data[i + 6],
+					      p_smp->data[i + 7],
+					      p_smp->data[i + 8],
+					      p_smp->data[i + 9],
+					      p_smp->data[i + 10],
+					      p_smp->data[i + 11],
+					      p_smp->data[i + 12],
+					      p_smp->data[i + 13],
+					      p_smp->data[i + 14],
+					      p_smp->data[i + 15]);
 			}
 		} else {
 			/* not a Direct Route so provide source and destination lids */
-			strcat(buf, "\t\t\t\tMAD IS LID ROUTED\n");
+			n += snprintf(buf + n, sizeof(buf) - n,
+				      "\t\t\t\tMAD IS LID ROUTED\n");
 		}
-
-		osm_log(p_log, log_level, "%s\n", buf);
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_sa_mad(IN osm_log_t * const p_log,
-		IN const ib_sa_mad_t * const p_mad,
-		IN const osm_log_level_t log_level)
+void osm_dump_dr_smp(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
+		     IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
 		char buf[BUF_SIZE];
 
+		osm_dump_dr_smp_to_buf(p_smp, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_dr_smp_v2(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
+			IN const int file_id, IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_dr_smp_to_buf(p_smp, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_sa_mad_to_buf(IN const ib_sa_mad_t * p_mad, OUT char * buf)
+{
+	if (!buf || !p_mad)
+		return;
+	else {
 		/* make sure the mad is valid */
 		if (p_mad == NULL) {
-			OSM_LOG(p_log, log_level, "NULL MAD POINTER\n");
+			sprintf(buf, "NULL MAD POINTER\n");
 			return;
 		}
 
@@ -1960,120 +2749,153 @@ osm_dump_sa_mad(IN osm_log_t * const p_log,
 			"\t\t\t\tattr_offset.............0x%X\n"
 			"\t\t\t\tresv2...................0x%X\n"
 			"\t\t\t\tcomp_mask...............0x%016" PRIx64 "\n",
-			p_mad->base_ver,
-			p_mad->mgmt_class,
-			p_mad->class_ver,
+			p_mad->base_ver, p_mad->mgmt_class, p_mad->class_ver,
 			p_mad->method, ib_get_sa_method_str(p_mad->method),
-			cl_ntoh16(p_mad->status),
-			cl_ntoh16(p_mad->resv),
-			cl_ntoh64(p_mad->trans_id),
-			cl_ntoh16(p_mad->attr_id),
+			cl_ntoh16(p_mad->status), cl_ntoh16(p_mad->resv),
+			cl_ntoh64(p_mad->trans_id), cl_ntoh16(p_mad->attr_id),
 			ib_get_sa_attr_str(p_mad->attr_id),
-			cl_ntoh16(p_mad->resv1),
-			cl_ntoh32(p_mad->attr_mod),
-			p_mad->rmpp_version,
-			p_mad->rmpp_type,
-			p_mad->rmpp_flags,
-			p_mad->rmpp_status,
+			cl_ntoh16(p_mad->resv1), cl_ntoh32(p_mad->attr_mod),
+			p_mad->rmpp_version, p_mad->rmpp_type,
+			p_mad->rmpp_flags, p_mad->rmpp_status,
 			cl_ntoh32(p_mad->seg_num),
 			cl_ntoh32(p_mad->paylen_newwin),
-			cl_ntoh64(p_mad->sm_key),
-			cl_ntoh16(p_mad->attr_offset),
+			cl_ntoh64(p_mad->sm_key), cl_ntoh16(p_mad->attr_offset),
 			cl_ntoh16(p_mad->resv3), cl_ntoh64(p_mad->comp_mask));
 
 		strcat(buf, "\n");
+	}
+}
+
+void osm_dump_sa_mad(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_mad,
+		     IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active(p_log, log_level)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_sa_mad_to_buf(p_mad, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_sa_mad_v2(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_mad,
+			IN const int file_id, IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_sa_mad_to_buf(p_mad, buf);
 
-		osm_log(p_log, log_level, "%s\n", buf);
+		osm_log_v2(p_log, log_level, file_id, buf);
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_dr_path(IN osm_log_t * const p_log,
-		 IN const osm_dr_path_t * const p_path,
-		 IN const osm_log_level_t log_level)
+static void osm_dump_dr_path_to_buf(IN const osm_dr_path_t * p_path,
+				    OUT char * buf)
+{
+	if (!buf || !p_path)
+		return;
+	else {
+		unsigned n = 0;
+
+		n = sprintf(buf, "Directed Path Dump of %u hop path: "
+			    "Path = ", p_path->hop_count);
+
+		sprint_uint8_arr(buf + n, sizeof(buf) - n, p_path->path,
+				 p_path->hop_count + 1);
+	}
+}
+
+void osm_dump_dr_path(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path,
+		      IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
-		char buf[BUF_SIZE], line[BUF_SIZE];
-		uint32_t i;
-
-		sprintf(buf, "Directed Path Dump of %u hop path:"
-			"\n\t\t\t\tPath = ", p_path->hop_count);
-
-		for (i = 0; i <= p_path->hop_count; i++) {
-			if (i == 0)
-				sprintf(line, "%d", p_path->path[i]);
-			else
-				sprintf(line, ",%d", p_path->path[i]);
-			strcat(buf, line);
-		}
-		osm_log(p_log, log_level, "%s\n", buf);
+		char buf[BUF_SIZE];
+
+		osm_dump_dr_path_to_buf(p_path, buf);
+
+		osm_log(p_log, log_level, buf);
+	}
+}
+
+void osm_dump_dr_path_v2(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path,
+			 IN const int file_id, IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_dr_path_to_buf(p_path, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
+	}
+}
+
+static void osm_dump_smp_dr_path_to_buf(IN const ib_smp_t * p_smp,
+					OUT char * buf)
+{
+	if (!buf || !p_smp)
+		return;
+	else {
+		unsigned n;
+
+		n = sprintf(buf, "Received SMP on a %u hop path: "
+			    "Initial path = ", p_smp->hop_count);
+		n += sprint_uint8_arr(buf + n, sizeof(buf) - n,
+				      p_smp->initial_path,
+				      p_smp->hop_count + 1);
+
+		n += sprintf(buf + n, ", Return path  = ");
+		n += sprint_uint8_arr(buf + n, sizeof(buf) - n,
+				      p_smp->return_path, p_smp->hop_count + 1);
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_dump_smp_dr_path(IN osm_log_t * const p_log,
-		     IN const ib_smp_t * const p_smp,
-		     IN const osm_log_level_t log_level)
+void osm_dump_smp_dr_path(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
+			  IN osm_log_level_t log_level)
 {
 	if (osm_log_is_active(p_log, log_level)) {
-		char buf[BUF_SIZE], line[BUF_SIZE];
-		uint32_t i;
-
-		sprintf(buf, "Received SMP on a %u hop path:"
-			"\n\t\t\t\tInitial path = ", p_smp->hop_count);
-
-		for (i = 0; i <= p_smp->hop_count; i++) {
-			if (i == 0)
-				sprintf(line, "%d", p_smp->initial_path[i]);
-			else
-				sprintf(line, ",%d", p_smp->initial_path[i]);
-			strcat(buf, line);
-		}
+		char buf[BUF_SIZE];
 
-		strcat(buf, "\n\t\t\t\tReturn path  = ");
+		osm_dump_smp_dr_path_to_buf(p_smp, buf);
 
-		for (i = 0; i <= p_smp->hop_count; i++) {
-			if (i == 0)
-				sprintf(line, "%d", p_smp->return_path[i]);
-			else
-				sprintf(line, ",%d", p_smp->return_path[i]);
-			strcat(buf, line);
-		}
+		osm_log(p_log, log_level, buf);
+	}
+}
 
-		osm_log(p_log, log_level, "%s\n", buf);
+void osm_dump_smp_dr_path_v2(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
+			     IN const int file_id, IN osm_log_level_t log_level)
+{
+	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
+		char buf[BUF_SIZE];
+
+		osm_dump_smp_dr_path_to_buf(p_smp, buf);
+
+		osm_log_v2(p_log, log_level, file_id, buf);
 	}
 }
 
-static const char *const __osm_sm_signal_str[] = {
+static const char *sm_signal_str[] = {
 	"OSM_SIGNAL_NONE",	/* 0 */
 	"OSM_SIGNAL_SWEEP",	/* 1 */
 	"OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST",	/* 2 */
-	"OSM_SIGNAL_EXIT_STBY",	/* 3 */
-	"OSM_SIGNAL_PERFMGR_SWEEP",	/* 4 */
+	"OSM_SIGNAL_PERFMGR_SWEEP",	/* 3 */
+	"OSM_SIGNAL_GUID_PROCESS_REQUEST",	/* 4 */
 	"UNKNOWN SIGNAL!!"	/* 5 */
 };
 
-/**********************************************************************
- **********************************************************************/
 const char *osm_get_sm_signal_str(IN osm_signal_t signal)
 {
 	if (signal > OSM_SIGNAL_MAX)
 		signal = OSM_SIGNAL_MAX;
-	return (__osm_sm_signal_str[signal]);
+	return sm_signal_str[signal];
 }
 
-/**********************************************************************
- **********************************************************************/
-
-static const char *const __osm_disp_msg_str[] = {
+static const char *disp_msg_str[] = {
 	"OSM_MSG_NONE",
 	"OSM_MSG_MAD_NODE_INFO",
 	"OSM_MSG_MAD_PORT_INFO",
 	"OSM_MSG_MAD_SWITCH_INFO",
+	"OSM_MSG_MAD_GUID_INFO",
 	"OSM_MSG_MAD_NODE_DESC",
 	"OSM_MSG_MAD_NODE_RECORD",
 	"OSM_MSG_MAD_PORTINFO_RECORD",
@@ -2098,22 +2920,24 @@ static const char *const __osm_disp_msg_str[] = {
 	"OSM_MSG_MAD_SLVL",
 	"OSM_MSG_MAD_GUIDINFO_RECORD",
 	"OSM_MSG_MAD_INFORM_INFO_RECORD",
+	"OSM_MSG_MAD_SWITCH_INFO_RECORD",
+	"OSM_MSG_MAD_MFT_RECORD",
 #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
 	"OSM_MSG_MAD_MULTIPATH_RECORD",
 #endif
+	"OSM_MSG_MAD_PORT_COUNTERS",
+	"OSM_MSG_MAD_MLNX_EXT_PORT_INFO",
 	"UNKNOWN!!"
 };
 
-/**********************************************************************
- **********************************************************************/
 const char *osm_get_disp_msg_str(IN cl_disp_msgid_t msg)
 {
 	if (msg > OSM_MSG_MAX)
 		msg = OSM_MSG_MAX;
-	return (__osm_disp_msg_str[msg]);
+	return disp_msg_str[msg];
 }
 
-static const char *const __osm_port_state_str_fixed_width[] = {
+static const char *port_state_str_fixed_width[] = {
 	"NOC",
 	"DWN",
 	"INI",
@@ -2122,34 +2946,28 @@ static const char *const __osm_port_state_str_fixed_width[] = {
 	"???"
 };
 
-/**********************************************************************
- **********************************************************************/
 const char *osm_get_port_state_str_fixed_width(IN uint8_t port_state)
 {
 	if (port_state > IB_LINK_ACTIVE)
 		port_state = IB_LINK_ACTIVE + 1;
-	return (__osm_port_state_str_fixed_width[port_state]);
+	return port_state_str_fixed_width[port_state];
 }
 
-static const char *const __osm_node_type_str_fixed_width[] = {
+static const char *node_type_str_fixed_width[] = {
 	"??",
 	"CA",
 	"SW",
 	"RT",
 };
 
-/**********************************************************************
- **********************************************************************/
 const char *osm_get_node_type_str_fixed_width(IN uint8_t node_type)
 {
 	if (node_type > IB_NODE_TYPE_ROUTER)
 		node_type = 0;
-	return (__osm_node_type_str_fixed_width[node_type]);
+	return node_type_str_fixed_width[node_type];
 }
 
-/**********************************************************************
- **********************************************************************/
-const char *osm_get_manufacturer_str(IN uint64_t const guid_ho)
+const char *osm_get_manufacturer_str(IN uint64_t guid_ho)
 {
 	/* note that the max vendor string length is 11 */
 	static const char *intel_str = "Intel";
@@ -2175,63 +2993,76 @@ const char *osm_get_manufacturer_str(IN uint64_t const guid_ho)
 	static const char *sun_str = "Sun";
 	static const char *leafntwks_str = "3LeafNtwks";
 	static const char *xsigo_str = "Xsigo";
+	static const char *dell_str = "Dell";
+	static const char *supermicro_str = "SuperMicro";
+	static const char *openib_str = "OpenIB";
 	static const char *unknown_str = "Unknown";
 
 	switch ((uint32_t) (guid_ho >> (5 * 8))) {
 	case OSM_VENDOR_ID_INTEL:
-		return (intel_str);
+		return intel_str;
 	case OSM_VENDOR_ID_MELLANOX:
-		return (mellanox_str);
+		return mellanox_str;
 	case OSM_VENDOR_ID_REDSWITCH:
-		return (redswitch_str);
+		return redswitch_str;
 	case OSM_VENDOR_ID_SILVERSTORM:
-		return (silverstorm_str);
+		return silverstorm_str;
 	case OSM_VENDOR_ID_TOPSPIN:
-		return (topspin_str);
+		return topspin_str;
 	case OSM_VENDOR_ID_FUJITSU:
 	case OSM_VENDOR_ID_FUJITSU2:
-		return (fujitsu_str);
+		return fujitsu_str;
 	case OSM_VENDOR_ID_VOLTAIRE:
-		return (voltaire_str);
+		return voltaire_str;
 	case OSM_VENDOR_ID_YOTTAYOTTA:
-		return (yotta_str);
+		return yotta_str;
 	case OSM_VENDOR_ID_PATHSCALE:
-		return (pathscale_str);
+		return pathscale_str;
 	case OSM_VENDOR_ID_IBM:
-		return (ibm_str);
+	case OSM_VENDOR_ID_IBM2:
+		return ibm_str;
 	case OSM_VENDOR_ID_DIVERGENET:
-		return (divergenet_str);
+		return divergenet_str;
 	case OSM_VENDOR_ID_FLEXTRONICS:
-		return (flextronics_str);
+		return flextronics_str;
 	case OSM_VENDOR_ID_AGILENT:
-		return (agilent_str);
+		return agilent_str;
 	case OSM_VENDOR_ID_OBSIDIAN:
-		return (obsidian_str);
+		return obsidian_str;
 	case OSM_VENDOR_ID_BAYMICRO:
-		return (baymicro_str);
+		return baymicro_str;
 	case OSM_VENDOR_ID_LSILOGIC:
-		return (lsilogic_str);
+		return lsilogic_str;
 	case OSM_VENDOR_ID_DDN:
-		return (ddn_str);
+		return ddn_str;
 	case OSM_VENDOR_ID_PANTA:
-		return (panta_str);
+		return panta_str;
 	case OSM_VENDOR_ID_HP:
 	case OSM_VENDOR_ID_HP2:
-		return (hp_str);
+	case OSM_VENDOR_ID_HP3:
+	case OSM_VENDOR_ID_HP4:
+		return hp_str;
 	case OSM_VENDOR_ID_RIOWORKS:
-		return (rioworks_str);
+		return rioworks_str;
 	case OSM_VENDOR_ID_SUN:
-		return (sun_str);
+	case OSM_VENDOR_ID_SUN2:
+		return sun_str;
 	case OSM_VENDOR_ID_3LEAFNTWKS:
-		return (leafntwks_str);
+		return leafntwks_str;
 	case OSM_VENDOR_ID_XSIGO:
-		return (xsigo_str);
+		return xsigo_str;
+	case OSM_VENDOR_ID_DELL:
+		return dell_str;
+	case OSM_VENDOR_ID_SUPERMICRO:
+		return supermicro_str;
+	case OSM_VENDOR_ID_OPENIB:
+		return openib_str;
 	default:
-		return (unknown_str);
+		return unknown_str;
 	}
 }
 
-static const char *const __osm_mtu_str_fixed_width[] = {
+static const char *mtu_str_fixed_width[] = {
 	"??? ",
 	"256 ",
 	"512 ",
@@ -2240,17 +3071,15 @@ static const char *const __osm_mtu_str_fixed_width[] = {
 	"4096"
 };
 
-/**********************************************************************
- **********************************************************************/
-const char *osm_get_mtu_str(IN uint8_t const mtu)
+const char *osm_get_mtu_str(IN uint8_t mtu)
 {
 	if (mtu > IB_MTU_LEN_4096)
-		return (__osm_mtu_str_fixed_width[0]);
+		return mtu_str_fixed_width[0];
 	else
-		return (__osm_mtu_str_fixed_width[mtu]);
+		return mtu_str_fixed_width[mtu];
 }
 
-static const char *const __osm_lwa_str_fixed_width[] = {
+static const char *lwa_str_fixed_width[] = {
 	"???",
 	"1x ",
 	"4x ",
@@ -2262,72 +3091,150 @@ static const char *const __osm_lwa_str_fixed_width[] = {
 	"12x"
 };
 
-/**********************************************************************
- **********************************************************************/
-const char *osm_get_lwa_str(IN uint8_t const lwa)
+const char *osm_get_lwa_str(IN uint8_t lwa)
 {
 	if (lwa > 8)
-		return (__osm_lwa_str_fixed_width[0]);
+		return lwa_str_fixed_width[0];
 	else
-		return (__osm_lwa_str_fixed_width[lwa]);
+		return lwa_str_fixed_width[lwa];
 }
 
-/**********************************************************************
- **********************************************************************/
-static const char *const __osm_lsa_str_fixed_width[] = {
-	"???",
-	"2.5",
-	"5  ",
-	"???",
-	"10 "
+static const char *lsa_str_fixed_width[] = {
+	"Ext ",
+	"2.5 ",
+	"5   ",
+	"????",
+	"10  "
+};
+
+static const char *lsea_str_fixed_width[] = {
+	"Std ",
+	"14  ",
+	"25  "
 };
 
-const char *osm_get_lsa_str(IN uint8_t const lsa)
+const char *osm_get_lsa_str(IN uint8_t lsa, IN uint8_t lsea, IN uint8_t state,
+			    IN uint8_t fdr10)
 {
-	if (lsa > 4)
-		return (__osm_lsa_str_fixed_width[0]);
-	else
-		return (__osm_lsa_str_fixed_width[lsa]);
+	if (lsa > IB_LINK_SPEED_ACTIVE_10)
+		return lsa_str_fixed_width[3];
+	if (lsea == IB_LINK_SPEED_EXT_ACTIVE_NONE) {
+		if (fdr10)
+			return "FDR10";
+		else
+			return lsa_str_fixed_width[lsa];
+	}
+	if (lsea > IB_LINK_SPEED_EXT_ACTIVE_25)
+		return lsa_str_fixed_width[3];
+	return lsea_str_fixed_width[lsea];
 }
 
-/**********************************************************************
- **********************************************************************/
-
-static const char *const __osm_sm_mgr_signal_str[] = {
+static const char *sm_mgr_signal_str[] = {
 	"OSM_SM_SIGNAL_NONE",	/* 0 */
-	"OSM_SM_SIGNAL_DISCOVERY_COMPLETED",	/* 2 */
-	"OSM_SM_SIGNAL_POLLING_TIMEOUT",	/* 3 */
-	"OSM_SM_SIGNAL_DISCOVER",	/* 4 */
-	"OSM_SM_SIGNAL_DISABLE",	/* 5 */
-	"OSM_SM_SIGNAL_HANDOVER",	/* 6 */
-	"OSM_SM_SIGNAL_HANDOVER_SENT",	/* 7 */
-	"OSM_SM_SIGNAL_ACKNOWLEDGE",	/* 8 */
-	"OSM_SM_SIGNAL_STANDBY",	/* 9 */
-	"OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED",	/* 10 */
-	"OSM_SM_SIGNAL_WAIT_FOR_HANDOVER",	/* 11 */
-	"UNKNOWN STATE!!"	/* 12 */
+	"OSM_SM_SIGNAL_DISCOVERY_COMPLETED",	/* 1 */
+	"OSM_SM_SIGNAL_POLLING_TIMEOUT",	/* 2 */
+	"OSM_SM_SIGNAL_DISCOVER",	/* 3 */
+	"OSM_SM_SIGNAL_DISABLE",	/* 4 */
+	"OSM_SM_SIGNAL_HANDOVER",	/* 5 */
+	"OSM_SM_SIGNAL_HANDOVER_SENT",	/* 6 */
+	"OSM_SM_SIGNAL_ACKNOWLEDGE",	/* 7 */
+	"OSM_SM_SIGNAL_STANDBY",	/* 8 */
+	"OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED",	/* 9 */
+	"OSM_SM_SIGNAL_WAIT_FOR_HANDOVER",	/* 10 */
+	"UNKNOWN STATE!!"	/* 11 */
 };
 
-/**********************************************************************
- **********************************************************************/
 const char *osm_get_sm_mgr_signal_str(IN osm_sm_signal_t signal)
 {
 	if (signal > OSM_SM_SIGNAL_MAX)
 		signal = OSM_SM_SIGNAL_MAX;
-	return (__osm_sm_mgr_signal_str[signal]);
+	return sm_mgr_signal_str[signal];
 }
 
-static const char *const __osm_sm_mgr_state_str[] = {
-	"NOTACTIVE",	/* 0 */
-	"DISCOVERING",	/* 1 */
-	"STANDBY",	/* 2 */
-	"MASTER",	/* 3 */
+static const char *sm_mgr_state_str[] = {
+	"NOTACTIVE",		/* 0 */
+	"DISCOVERING",		/* 1 */
+	"STANDBY",		/* 2 */
+	"MASTER",		/* 3 */
 	"UNKNOWN STATE!!"	/* 4 */
 };
 
 const char *osm_get_sm_mgr_state_str(IN uint16_t state)
 {
-	return state < ARR_SIZE(__osm_sm_mgr_state_str) ?
-		__osm_sm_mgr_state_str[state] :
-		__osm_sm_mgr_state_str[ARR_SIZE(__osm_sm_mgr_state_str) - 1];
+	return state < ARR_SIZE(sm_mgr_state_str) ?
+	    sm_mgr_state_str[state] :
+	    sm_mgr_state_str[ARR_SIZE(sm_mgr_state_str) - 1];
+}
+
+int ib_mtu_is_valid(IN const int mtu)
+{
+	if (mtu < IB_MIN_MTU || mtu > IB_MAX_MTU)
+		return 0;
+	return 1;
+}
+
+int ib_rate_is_valid(IN const int rate)
+{
+	if (rate < IB_MIN_RATE || rate > IB_MAX_RATE)
+		return 0;
+	return 1;
+}
+
+int ib_path_compare_rates(IN const int rate1, IN const int rate2)
+{
+	int orate1 = 0, orate2 = 0;
+
+	CL_ASSERT(rate1 >= IB_MIN_RATE && rate1 <= IB_MAX_RATE);
+	CL_ASSERT(rate2 >= IB_MIN_RATE && rate2 <= IB_MAX_RATE);
+
+	if (rate1 <= IB_MAX_RATE)
+		orate1 = ordered_rates[rate1];
+	if (rate2 <= IB_MAX_RATE)
+		orate2 = ordered_rates[rate2];
+	if (orate1 < orate2)
+		return -1;
+	if (orate1 == orate2)
+		return 0;
+	return 1;
+}
+
+static int find_ordered_rate(IN const int rate)
+{
+	int i;
+
+	for (i = IB_MIN_RATE; i <= IB_MAX_RATE; i++) {
+		if (ordered_rates[i] == rate)
+			return i;
+	}
+	return 0;
+}
+
+int ib_path_rate_get_prev(IN const int rate)
+{
+	int orate;
+
+	CL_ASSERT(rate >= IB_MIN_RATE && rate <= IB_MAX_RATE);
+
+	if (rate <= IB_MIN_RATE)
+		return 0;
+	if (rate > IB_MAX_RATE)
+		return 0;
+	orate = ordered_rates[rate];
+	orate--;
+	return find_ordered_rate(orate);
+}
+
+int ib_path_rate_get_next(IN const int rate)
+{
+	int orate;
+
+	CL_ASSERT(rate >= IB_MIN_RATE && rate <= IB_MAX_RATE);
+
+	if (rate < IB_MIN_RATE)
+		return 0;
+	if (rate >= IB_MAX_RATE)
+		return 0;
+	orate = ordered_rates[rate];
+	orate++;
+	return find_ordered_rate(orate);
 }
diff --git a/opensm/osm_inform.c b/opensm/osm_inform.c
index f3c8ed7..f5abbc6 100644
--- a/opensm/osm_inform.c
+++ b/opensm/osm_inform.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -46,26 +47,25 @@
 #include <string.h>
 #include <arpa/inet.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_INFORM_C
 #include <opensm/osm_helper.h>
 #include <opensm/osm_inform.h>
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
+#include <opensm/osm_opensm.h>
 
 typedef struct osm_infr_match_ctxt {
 	cl_list_t *p_remove_infr_list;
 	ib_mad_notice_attr_t *p_ntc;
 } osm_infr_match_ctxt_t;
 
-/**********************************************************************
- **********************************************************************/
-void osm_infr_delete(IN osm_infr_t * const p_infr)
+void osm_infr_delete(IN osm_infr_t * p_infr)
 {
 	free(p_infr);
 }
 
-/**********************************************************************
- **********************************************************************/
 osm_infr_t *osm_infr_new(IN const osm_infr_t * p_infr_rec)
 {
 	osm_infr_t *p_infr;
@@ -76,23 +76,21 @@ osm_infr_t *osm_infr_new(IN const osm_infr_t * p_infr_rec)
 	if (p_infr)
 		memcpy(p_infr, p_infr_rec, sizeof(osm_infr_t));
 
-	return (p_infr);
+	return p_infr;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void dump_all_informs(IN osm_subn_t const *p_subn, IN osm_log_t * p_log)
+static void dump_all_informs(IN const osm_subn_t * p_subn, IN osm_log_t * p_log)
 {
 	cl_list_item_t *p_list_item;
 
-	if (!osm_log_is_active(p_log, OSM_LOG_DEBUG))
+	if (!OSM_LOG_IS_ACTIVE_V2(p_log, OSM_LOG_DEBUG))
 		return;
 
 	p_list_item = cl_qlist_head(&p_subn->sa_infr_list);
 	while (p_list_item != cl_qlist_end(&p_subn->sa_infr_list)) {
-		osm_dump_inform_info(p_log,
-				     &((osm_infr_t *) p_list_item)->
-				     inform_record.inform_info, OSM_LOG_DEBUG);
+		osm_dump_inform_info_v2(p_log,
+				        &((osm_infr_t *) p_list_item)->
+				        inform_record.inform_info, FILE_ID, OSM_LOG_DEBUG);
 		p_list_item = cl_qlist_next(p_list_item);
 	}
 }
@@ -100,14 +98,13 @@ static void dump_all_informs(IN osm_subn_t const *p_subn, IN osm_log_t * p_log)
 /**********************************************************************
  * Match an infr by the InformInfo and Address vector
  **********************************************************************/
-static cl_status_t
-__match_inf_rec(IN const cl_list_item_t * const p_list_item, IN void *context)
+static cl_status_t match_inf_rec(IN const cl_list_item_t * p_list_item,
+				 IN void *context)
 {
 	osm_infr_t *p_infr_rec = (osm_infr_t *) context;
 	osm_infr_t *p_infr = (osm_infr_t *) p_list_item;
 	osm_log_t *p_log = p_infr_rec->sa->p_log;
 	cl_status_t status = CL_NOT_FOUND;
-	ib_gid_t all_zero_gid;
 
 	OSM_LOG_ENTER(p_log);
 
@@ -117,11 +114,8 @@ __match_inf_rec(IN const cl_list_item_t * const p_list_item, IN void *context)
 		goto Exit;
 	}
 
-	memset(&all_zero_gid, 0, sizeof(ib_gid_t));
-
 	/* if inform_info.gid is not zero, ignore lid range */
-	if (!memcmp(&p_infr_rec->inform_record.inform_info.gid, &all_zero_gid,
-		    sizeof(p_infr_rec->inform_record.inform_info.gid))) {
+	if (ib_gid_is_notzero(&p_infr_rec->inform_record.inform_info.gid)) {
 		if (memcmp(&p_infr->inform_record.inform_info.gid,
 			   &p_infr_rec->inform_record.inform_info.gid,
 			   sizeof(p_infr->inform_record.inform_info.gid))) {
@@ -212,11 +206,9 @@ Exit:
 	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
 osm_infr_t *osm_infr_get_by_rec(IN osm_subn_t const *p_subn,
 				IN osm_log_t * p_log,
-				IN osm_infr_t * const p_infr_rec)
+				IN osm_infr_t * p_infr_rec)
 {
 	cl_list_item_t *p_list_item;
 
@@ -225,13 +217,13 @@ osm_infr_t *osm_infr_get_by_rec(IN osm_subn_t const *p_subn,
 	dump_all_informs(p_subn, p_log);
 
 	OSM_LOG(p_log, OSM_LOG_DEBUG, "Looking for Inform Record\n");
-	osm_dump_inform_info(p_log, &(p_infr_rec->inform_record.inform_info),
-			     OSM_LOG_DEBUG);
+	osm_dump_inform_info_v2(p_log, &(p_infr_rec->inform_record.inform_info),
+			        FILE_ID, OSM_LOG_DEBUG);
 	OSM_LOG(p_log, OSM_LOG_DEBUG, "InformInfo list size %d\n",
 		cl_qlist_count(&p_subn->sa_infr_list));
 
 	p_list_item = cl_qlist_find_from_head(&p_subn->sa_infr_list,
-					      __match_inf_rec, p_infr_rec);
+					      match_inf_rec, p_infr_rec);
 
 	if (p_list_item == cl_qlist_end(&p_subn->sa_infr_list))
 		p_list_item = NULL;
@@ -240,11 +232,8 @@ osm_infr_t *osm_infr_get_by_rec(IN osm_subn_t const *p_subn,
 	return (osm_infr_t *) p_list_item;
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_infr_insert_to_db(IN osm_subn_t * p_subn,
-		      IN osm_log_t * p_log, IN osm_infr_t * p_infr)
+void osm_infr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
+			   IN osm_infr_t * p_infr)
 {
 	OSM_LOG_ENTER(p_log);
 
@@ -255,12 +244,13 @@ osm_infr_insert_to_db(IN osm_subn_t * p_subn,
 	dump_all_informs(p_subn, p_log);
 
 #if 0
-	osm_dump_inform_info(p_log,
-			     &(p_infr->inform_record.inform_info),
-			     OSM_LOG_DEBUG);
+	osm_dump_inform_info_v2(p_log,
+			        &(p_infr->inform_record.inform_info),
+			        FILE_ID, OSM_LOG_DEBUG);
 #endif
 
 	cl_qlist_insert_head(&p_subn->sa_infr_list, &p_infr->list_item);
+	p_subn->p_osm->sa.dirty = TRUE;
 
 	OSM_LOG(p_log, OSM_LOG_DEBUG, "Dump after insertion (size %d)\n",
 		cl_qlist_count(&p_subn->sa_infr_list));
@@ -268,11 +258,8 @@ osm_infr_insert_to_db(IN osm_subn_t * p_subn,
 	OSM_LOG_EXIT(p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_infr_remove_from_db(IN osm_subn_t * p_subn,
-			IN osm_log_t * p_log, IN osm_infr_t * p_infr)
+void osm_infr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
+			     IN osm_infr_t * p_infr)
 {
 	char gid_str[INET6_ADDRSTRLEN];
 	OSM_LOG_ENTER(p_log);
@@ -280,13 +267,14 @@ osm_infr_remove_from_db(IN osm_subn_t * p_subn,
 	OSM_LOG(p_log, OSM_LOG_DEBUG, "Removing InformInfo Subscribing GID:%s"
 		" Enum:0x%X from Database\n",
 		inet_ntop(AF_INET6, p_infr->inform_record.subscriber_gid.raw,
-			gid_str, sizeof gid_str),
+			  gid_str, sizeof gid_str),
 		p_infr->inform_record.subscriber_enum);
 
-	osm_dump_inform_info(p_log, &(p_infr->inform_record.inform_info),
-			     OSM_LOG_DEBUG);
+	osm_dump_inform_info_v2(p_log, &(p_infr->inform_record.inform_info),
+			        FILE_ID, OSM_LOG_DEBUG);
 
 	cl_qlist_remove_item(&p_subn->sa_infr_list, &p_infr->list_item);
+	p_subn->p_osm->sa.dirty = TRUE;
 
 	osm_infr_delete(p_infr);
 
@@ -298,8 +286,8 @@ osm_infr_remove_from_db(IN osm_subn_t * p_subn,
  * Given a target address to send to and the notice.
  * We need to send SubnAdmReport
  **********************************************************************/
-static ib_api_status_t __osm_send_report(IN osm_infr_t * p_infr_rec,	/* the informinfo */
-					 IN ib_mad_notice_attr_t * p_ntc	/* notice to send */
+static ib_api_status_t send_report(IN osm_infr_t * p_infr_rec,	/* the informinfo */
+				   IN ib_mad_notice_attr_t * p_ntc	/* notice to send */
     )
 {
 	osm_madw_t *p_report_madw;
@@ -309,6 +297,7 @@ static ib_api_status_t __osm_send_report(IN osm_infr_t * p_infr_rec,	/* the info
 	static atomic32_t trap_fwd_trans_id = 0x02DAB000;
 	ib_api_status_t status = IB_SUCCESS;
 	osm_log_t *p_log = p_infr_rec->sa->p_log;
+	ib_net64_t tid;
 
 	OSM_LOG_ENTER(p_log);
 
@@ -316,7 +305,7 @@ static ib_api_status_t __osm_send_report(IN osm_infr_t * p_infr_rec,	/* the info
 
 	/* it is better to use LIDs since the GIDs might not be there for SMI traps */
 	OSM_LOG(p_log, OSM_LOG_DEBUG, "Forwarding Notice Event from LID:%u"
-		" to InformInfo LID: %u TID:0x%X\n",
+		" to InformInfo LID:%u TID:0x%X\n",
 		cl_ntoh16(p_ntc->issuer_lid),
 		cl_ntoh16(p_infr_rec->report_addr.dest_lid), trap_fwd_trans_id);
 
@@ -325,20 +314,24 @@ static ib_api_status_t __osm_send_report(IN osm_infr_t * p_infr_rec,	/* the info
 					 p_infr_rec->h_bind, MAD_BLOCK_SIZE,
 					 &(p_infr_rec->report_addr));
 
-	p_report_madw->resp_expected = TRUE;
-
 	if (!p_report_madw) {
-		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0203"
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0203: "
 			"osm_mad_pool_get failed\n");
 		status = IB_ERROR;
 		goto Exit;
 	}
 
+	p_report_madw->resp_expected = TRUE;
+
 	/* advance trap trans id (cant simply ++ on some systems inside ntoh) */
+	tid = cl_hton64((uint64_t) cl_atomic_inc(&trap_fwd_trans_id) &
+			(uint64_t) (0xFFFFFFFF));
+	if (trap_fwd_trans_id == 0)
+		tid = cl_hton64((uint64_t) cl_atomic_inc(&trap_fwd_trans_id) &
+				(uint64_t) (0xFFFFFFFF));
 	p_mad = osm_madw_get_mad_ptr(p_report_madw);
 	ib_mad_init_new(p_mad, IB_MCLASS_SUBN_ADM, 2, IB_MAD_METHOD_REPORT,
-			cl_hton64((uint64_t) cl_atomic_inc(&trap_fwd_trans_id)),
-			IB_MAD_ATTR_NOTICE, 0);
+			tid, IB_MAD_ATTR_NOTICE, 0);
 
 	p_sa_mad = osm_madw_get_sa_mad_ptr(p_report_madw);
 
@@ -352,29 +345,121 @@ static ib_api_status_t __osm_send_report(IN osm_infr_t * p_infr_rec,	/* the info
 
 Exit:
 	OSM_LOG_EXIT(p_log);
-	return (status);
+	return status;
+}
+
+static int is_access_permitted(osm_infr_t *p_infr_rec,
+			       osm_infr_match_ctxt_t *p_infr_match )
+{
+	cl_list_t *p_infr_to_remove_list = p_infr_match->p_remove_infr_list;
+	ib_inform_info_t *p_ii = &(p_infr_rec->inform_record.inform_info);
+	ib_mad_notice_attr_t *p_ntc = p_infr_match->p_ntc;
+	uint16_t trap_num = cl_ntoh16(p_ntc->g_or_v.generic.trap_num);
+	osm_subn_t *p_subn = p_infr_rec->sa->p_subn;
+	osm_log_t *p_log = p_infr_rec->sa->p_log;
+	osm_mgrp_t *p_mgrp;
+	ib_gid_t source_gid;
+	osm_port_t *p_src_port;
+	osm_port_t *p_dest_port;
+
+	/* In case of GID_IN(64) or GID_OUT(65) traps the source gid
+	   comparison should be done on the trap source (saved as the gid in the
+	   data details field).
+	   For traps MC_CREATE(66) or MC_DELETE(67) the data details gid is
+	   the MGID. We need to check whether the subscriber has a compatible
+	   pkey with MC group.
+	   In all other cases the issuer gid is the trap source.
+	*/
+	if (trap_num >= 64 && trap_num <= 67 )
+		/* The issuer of these traps is the SM so source_gid
+		   is the gid saved on the data details */
+		source_gid = p_ntc->data_details.ntc_64_67.gid;
+	else
+		source_gid = p_ntc->issuer_gid;
+
+	p_dest_port = osm_get_port_by_lid(p_subn,
+					  p_infr_rec->report_addr.dest_lid);
+	if (!p_dest_port) {
+		OSM_LOG(p_log, OSM_LOG_INFO,
+			"Cannot find destination port with LID:%u\n",
+			cl_ntoh16(p_infr_rec->report_addr.dest_lid));
+		goto Exit;
+	}
+
+	/* Check if there is a pkey match. o13-17.1.1 */
+	switch (trap_num) {
+		case 66:
+		case 67:
+			p_mgrp = osm_get_mgrp_by_mgid(p_subn, &source_gid);
+			if (!p_mgrp) {
+				char gid_str[INET6_ADDRSTRLEN];
+				OSM_LOG(p_log, OSM_LOG_INFO,
+					"Cannot find MGID %s\n",
+					inet_ntop(AF_INET6, source_gid.raw, gid_str, sizeof gid_str));
+				goto Exit;
+			}
+
+			if (!osm_physp_has_pkey(p_log,
+						p_mgrp->mcmember_rec.pkey,
+						p_dest_port->p_physp)) {
+				char gid_str[INET6_ADDRSTRLEN];
+				OSM_LOG(p_log, OSM_LOG_INFO,
+					"MGID %s and port GUID:0x%016" PRIx64 " do not share same pkey\n",
+					inet_ntop(AF_INET6, source_gid.raw, gid_str, sizeof gid_str),
+					cl_ntoh64(p_dest_port->guid));
+				goto Exit;
+			}
+			break;
+
+		default:
+			p_src_port =
+			    osm_get_port_by_guid(p_subn, source_gid.unicast.interface_id);
+			if (!p_src_port) {
+				OSM_LOG(p_log, OSM_LOG_INFO,
+					"Cannot find source port with GUID:0x%016" PRIx64 "\n",
+					cl_ntoh64(source_gid.unicast.interface_id));
+				goto Exit;
+			}
+
+
+			if (osm_port_share_pkey(p_log, p_src_port, p_dest_port,
+						p_subn->opt.allow_both_pkeys) == FALSE) {
+				OSM_LOG(p_log, OSM_LOG_DEBUG, "Mismatch by Pkey\n");
+				/* According to o13-17.1.2 - If this informInfo
+				   does not have lid_range_begin of 0xFFFF,
+				   then this informInfo request should be
+				   removed from database */
+				if (p_ii->lid_range_begin != 0xFFFF) {
+					OSM_LOG(p_log, OSM_LOG_VERBOSE,
+						"Pkey mismatch on lid_range_begin != 0xFFFF. "
+						"Need to remove this informInfo from db\n");
+					/* add the informInfo record to the remove_infr list */
+					cl_list_insert_tail(p_infr_to_remove_list, p_infr_rec);
+				}
+				goto Exit;
+			}
+			break;
+	}
+
+	return 1;
+Exit:
+	return 0;
 }
 
+
 /**********************************************************************
  * This routine compares a given Notice and a ListItem of InformInfo type.
  * PREREQUISITE:
  * The Notice.GID should be pre-filled with the trap generator GID
  **********************************************************************/
-static void
-__match_notice_to_inf_rec(IN cl_list_item_t * const p_list_item,
-			  IN void *context)
+static void match_notice_to_inf_rec(IN cl_list_item_t * p_list_item,
+				    IN void *context)
 {
 	osm_infr_match_ctxt_t *p_infr_match = (osm_infr_match_ctxt_t *) context;
 	ib_mad_notice_attr_t *p_ntc = p_infr_match->p_ntc;
-	cl_list_t *p_infr_to_remove_list = p_infr_match->p_remove_infr_list;
 	osm_infr_t *p_infr_rec = (osm_infr_t *) p_list_item;
 	ib_inform_info_t *p_ii = &(p_infr_rec->inform_record.inform_info);
-	cl_status_t status = CL_NOT_FOUND;
 	osm_log_t *p_log = p_infr_rec->sa->p_log;
-	osm_subn_t *p_subn = p_infr_rec->sa->p_subn;
-	ib_gid_t source_gid;
-	osm_port_t *p_src_port;
-	osm_port_t *p_dest_port;
 
 	OSM_LOG_ENTER(p_log);
 
@@ -469,65 +554,18 @@ __match_notice_to_inf_rec(IN cl_list_item_t * const p_list_item,
 		if ((ib_inform_info_get_vend_id(p_ii) != CL_HTON32(0xFFFFFF)) &&
 		    (ib_inform_info_get_vend_id(p_ii) !=
 		     ib_notice_get_vend_id(p_ntc))) {
-			OSM_LOG(p_log, OSM_LOG_DEBUG, "Mismatch by Vendor ID\n");
+			OSM_LOG(p_log, OSM_LOG_DEBUG,
+				"Mismatch by Vendor ID\n");
 			goto Exit;
 		}
 	}
 
-	/* Check if there is a pkey match. o13-17.1.1 */
-	/* Check if the issuer of the trap is the SM. If it is, then the gid
-	   comparison should be done on the trap source (saved as the gid in the
-	   data details field).
-	   If the issuer gid is not the SM - then it is the guid of the trap
-	   source */
-	if ((cl_ntoh64(p_ntc->issuer_gid.unicast.prefix) ==
-	     p_subn->opt.subnet_prefix)
-	    && (cl_ntoh64(p_ntc->issuer_gid.unicast.interface_id) ==
-		p_subn->sm_port_guid))
-		/* The issuer is the SM then this is trap 64-67 - compare the gid
-		   with the gid saved on the data details */
-		source_gid = p_ntc->data_details.ntc_64_67.gid;
-	else
-		source_gid = p_ntc->issuer_gid;
-
-	p_src_port =
-	    osm_get_port_by_guid(p_subn, source_gid.unicast.interface_id);
-	if (!p_src_port) {
-		OSM_LOG(p_log, OSM_LOG_INFO,
-			"Cannot find source port with GUID:0x%016" PRIx64 "\n",
-			cl_ntoh64(source_gid.unicast.interface_id));
+	if (!is_access_permitted(p_infr_rec, p_infr_match))
 		goto Exit;
-	}
-
-	p_dest_port =
-	    cl_ptr_vector_get(&p_subn->port_lid_tbl,
-			      cl_ntoh16(p_infr_rec->report_addr.dest_lid));
-	if (!p_dest_port) {
-		OSM_LOG(p_log, OSM_LOG_INFO,
-			"Cannot find destination port with LID:%u\n",
-			cl_ntoh16(p_infr_rec->report_addr.dest_lid));
-		goto Exit;
-	}
-
-	if (osm_port_share_pkey(p_log, p_src_port, p_dest_port) == FALSE) {
-		OSM_LOG(p_log, OSM_LOG_DEBUG, "Mismatch by Pkey\n");
-		/* According to o13-17.1.2 - If this informInfo does not have
-		   lid_range_begin of 0xFFFF, then this informInfo request
-		   should be removed from database */
-		if (p_ii->lid_range_begin != 0xFFFF) {
-			OSM_LOG(p_log, OSM_LOG_VERBOSE,
-				"Pkey mismatch on lid_range_begin != 0xFFFF. "
-				"Need to remove this informInfo from db\n");
-			/* add the informInfo record to the remove_infr list */
-			cl_list_insert_tail(p_infr_to_remove_list, p_infr_rec);
-		}
-		goto Exit;
-	}
 
 	/* send the report to the address provided in the inform record */
 	OSM_LOG(p_log, OSM_LOG_DEBUG, "MATCH! Sending Report...\n");
-	__osm_send_report(p_infr_rec, p_ntc);
-	status = CL_SUCCESS;
+	send_report(p_infr_rec, p_ntc);
 
 Exit:
 	OSM_LOG_EXIT(p_log);
@@ -541,11 +579,44 @@ Exit:
  * element and if it does - call the Report(Notice) for the
  * target QP registered by the address stored in the InformInfo element
  **********************************************************************/
-ib_api_status_t
-osm_report_notice(IN osm_log_t * const p_log,
-		  IN osm_subn_t * p_subn, IN ib_mad_notice_attr_t * p_ntc)
+static void log_notice(osm_log_t * log, osm_log_level_t level,
+		       ib_mad_notice_attr_t * ntc)
 {
 	char gid_str[INET6_ADDRSTRLEN];
+	ib_gid_t *gid;
+
+	/* an official Event information log */
+	if (ib_notice_is_generic(ntc)) {
+		if ((ntc->g_or_v.generic.trap_num == CL_HTON16(64)) ||
+		    (ntc->g_or_v.generic.trap_num == CL_HTON16(65)) ||
+		    (ntc->g_or_v.generic.trap_num == CL_HTON16(66)) ||
+		    (ntc->g_or_v.generic.trap_num == CL_HTON16(67)))
+			gid = &ntc->data_details.ntc_64_67.gid;
+		else
+			gid = &ntc->issuer_gid;
+		OSM_LOG(log, level,
+			"Reporting Generic Notice type:%u num:%u (%s)"
+			" from LID:%u GID:%s\n",
+			ib_notice_get_type(ntc),
+			cl_ntoh16(ntc->g_or_v.generic.trap_num),
+			ib_get_trap_str(ntc->g_or_v.generic.trap_num),
+			cl_ntoh16(ntc->issuer_lid),
+			inet_ntop(AF_INET6, gid->raw, gid_str, sizeof gid_str));
+	} else
+		OSM_LOG(log, level,
+			"Reporting Vendor Notice type:%u vend:%u dev:%u"
+			" from LID:%u GID:%s\n",
+			ib_notice_get_type(ntc),
+			cl_ntoh32(ib_notice_get_vend_id(ntc)),
+			cl_ntoh16(ntc->g_or_v.vend.dev_id),
+			cl_ntoh16(ntc->issuer_lid),
+			inet_ntop(AF_INET6, ntc->issuer_gid.raw, gid_str,
+				  sizeof gid_str));
+}
+
+ib_api_status_t osm_report_notice(IN osm_log_t * p_log, IN osm_subn_t * p_subn,
+				  IN ib_mad_notice_attr_t * p_ntc)
+{
 	osm_infr_match_ctxt_t context;
 	cl_list_t infr_to_remove_list;
 	osm_infr_t *p_infr_rec;
@@ -561,30 +632,11 @@ osm_report_notice(IN osm_log_t * const p_log,
 	if (p_subn->sa_infr_list.state != CL_INITIALIZED) {
 		OSM_LOG(p_log, OSM_LOG_DEBUG,
 			"Ignoring Notice Reports since Inform List is not initialized yet!\n");
-		return (IB_ERROR);
+		return IB_ERROR;
 	}
 
-	/* an official Event information log */
-	if (ib_notice_is_generic(p_ntc))
-		OSM_LOG(p_log, OSM_LOG_INFO,
-			"Reporting Generic Notice type:%u num:%u (%s)"
-			" from LID:%u GID:%s\n",
-			ib_notice_get_type(p_ntc),
-			cl_ntoh16(p_ntc->g_or_v.generic.trap_num),
-			ib_get_trap_str(p_ntc->g_or_v.generic.trap_num),
-			cl_ntoh16(p_ntc->issuer_lid),
-			inet_ntop(AF_INET6, p_ntc->issuer_gid.raw, gid_str,
-				sizeof gid_str));
-	else
-		OSM_LOG(p_log, OSM_LOG_INFO,
-			"Reporting Vendor Notice type:%u vend:%u dev:%u"
-			" from LID:%u GID:%s\n",
-			ib_notice_get_type(p_ntc),
-			cl_ntoh32(ib_notice_get_vend_id(p_ntc)),
-			cl_ntoh16(p_ntc->g_or_v.vend.dev_id),
-			cl_ntoh16(p_ntc->issuer_lid),
-			inet_ntop(AF_INET6, p_ntc->issuer_gid.raw, gid_str,
-				sizeof gid_str));
+	if (OSM_LOG_IS_ACTIVE_V2(p_log, OSM_LOG_INFO))
+		log_notice(p_log, OSM_LOG_INFO, p_ntc);
 
 	/* Create a list that will hold all the infr records that should
 	   be removed due to violation. o13-17.1.2 */
@@ -595,8 +647,8 @@ osm_report_notice(IN osm_log_t * const p_log,
 
 	/* go over all inform info available at the subnet */
 	/* try match to the given notice and send if match */
-	cl_qlist_apply_func(&(p_subn->sa_infr_list),
-			    __match_notice_to_inf_rec, &context);
+	cl_qlist_apply_func(&p_subn->sa_infr_list, match_notice_to_inf_rec,
+			    &context);
 
 	/* If we inserted items into the infr_to_remove_list - we need to
 	   remove them */
@@ -609,7 +661,10 @@ osm_report_notice(IN osm_log_t * const p_log,
 	}
 	cl_list_destroy(&infr_to_remove_list);
 
+	/* report IB traps to plugin */
+	osm_opensm_report_event(p_subn->p_osm, OSM_EVENT_ID_TRAP, p_ntc);
+
 	OSM_LOG_EXIT(p_log);
 
-	return (IB_SUCCESS);
+	return IB_SUCCESS;
 }
diff --git a/opensm/osm_lid_mgr.c b/opensm/osm_lid_mgr.c
index b74aba5..aa48eab 100644
--- a/opensm/osm_lid_mgr.c
+++ b/opensm/osm_lid_mgr.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -47,7 +47,7 @@
  * ALGORITHM:
  *
  * 0. we define a function to obtain the correct port lid:
- *    __osm_lid_mgr_get_port_lid( p_mgr, port, &min_lid ):
+ *    lid_mgr_get_port_lid( p_mgr, port, &min_lid ):
  *    0.1 if the port info lid matches the guid2lid return 0
  *    0.2 if the port info has a lid and that range is empty in
  *        port_lid_tbl, return 0 and update the port_lid_tbl and
@@ -64,12 +64,12 @@
  * 2. During SM port lid assignment:
  *   2.1 if reassign_lids is set, make it 2^lmc
  *   2.2 cleanup all port_lid_tbl and re-fill it according to guid2lid
- *   2.3 call __osm_lid_mgr_get_port_lid the SM port
+ *   2.3 call lid_mgr_get_port_lid the SM port
  *   2.4 set the port info
  *
  * 3. During all other ports lid assignment:
  *   3.1 go through all ports in the subnet
- *   3.1.1 call __osm_lid_mgr_get_port_min_lid
+ *   3.1.1 call lid_mgr_get_port_min_lid
  *   3.1.2 if a change required send the port info
  *   3.2 if any change send the signal PENDING...
  *
@@ -85,6 +85,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_LID_MGR_C
 #include <opensm/osm_lid_mgr.h>
 #include <opensm/osm_sm.h>
 #include <opensm/osm_log.h>
@@ -104,28 +106,20 @@ typedef struct osm_lid_mgr_range {
 	uint16_t max_lid;
 } osm_lid_mgr_range_t;
 
-/**********************************************************************
- **********************************************************************/
-void osm_lid_mgr_construct(IN osm_lid_mgr_t * const p_mgr)
+void osm_lid_mgr_construct(IN osm_lid_mgr_t * p_mgr)
 {
 	memset(p_mgr, 0, sizeof(*p_mgr));
-	cl_ptr_vector_construct(&p_mgr->used_lids);
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_lid_mgr_destroy(IN osm_lid_mgr_t * const p_mgr)
+void osm_lid_mgr_destroy(IN osm_lid_mgr_t * p_mgr)
 {
 	cl_list_item_t *p_item;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 
-	cl_ptr_vector_destroy(&p_mgr->used_lids);
-	p_item = cl_qlist_remove_head(&p_mgr->free_ranges);
-	while (p_item != cl_qlist_end(&p_mgr->free_ranges)) {
+	while ((p_item = cl_qlist_remove_head(&p_mgr->free_ranges)) !=
+	       cl_qlist_end(&p_mgr->free_ranges))
 		free((osm_lid_mgr_range_t *) p_item);
-		p_item = cl_qlist_remove_head(&p_mgr->free_ranges);
-	}
 	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
@@ -134,7 +128,7 @@ Validate the guid to lid data by making sure that under the current
 LMC we did not get duplicates. If we do flag them as errors and remove
 the entry.
 **********************************************************************/
-static void __osm_lid_mgr_validate_db(IN osm_lid_mgr_t * p_mgr)
+static void lid_mgr_validate_db(IN osm_lid_mgr_t * p_mgr)
 {
 	cl_qlist_t guids;
 	osm_db_guid_elem_t *p_item;
@@ -146,10 +140,7 @@ static void __osm_lid_mgr_validate_db(IN osm_lid_mgr_t * p_mgr)
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 
-	if (p_mgr->p_subn->opt.lmc)
-		lmc_mask = ~((1 << p_mgr->p_subn->opt.lmc) - 1);
-	else
-		lmc_mask = 0xffff;
+	lmc_mask = ~((1 << p_mgr->p_subn->opt.lmc) - 1);
 
 	cl_qlist_init(&guids);
 
@@ -159,29 +150,31 @@ static void __osm_lid_mgr_validate_db(IN osm_lid_mgr_t * p_mgr)
 		goto Exit;
 	}
 
-	p_item = (osm_db_guid_elem_t *) cl_qlist_remove_head(&guids);
-	while ((cl_list_item_t *) p_item != cl_qlist_end(&guids)) {
-		if (osm_db_guid2lid_get
-		    (p_mgr->p_g2l, p_item->guid, &min_lid, &max_lid))
+	while ((p_item = (osm_db_guid_elem_t *) cl_qlist_remove_head(&guids))
+	       != (osm_db_guid_elem_t *) cl_qlist_end(&guids)) {
+		if (osm_db_guid2lid_get(p_mgr->p_g2l, p_item->guid,
+					&min_lid, &max_lid))
 			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 0311: "
 				"could not get lid for guid:0x%016" PRIx64 "\n",
 				p_item->guid);
 		else {
 			lids_ok = TRUE;
 
-			if ((min_lid > max_lid) || (min_lid == 0)
-			    || (p_item->guid == 0)
-			    || (max_lid > p_mgr->p_subn->max_ucast_lid_ho)) {
-				OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 0312: "
+			if (min_lid > max_lid || min_lid == 0
+			    || p_item->guid == 0
+			    || max_lid > p_mgr->p_subn->max_ucast_lid_ho) {
+				OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+					"ERR 0312: "
 					"Illegal LID range [%u:%u] for "
 					"guid:0x%016" PRIx64 "\n", min_lid,
 					max_lid, p_item->guid);
 				lids_ok = FALSE;
-			} else if ((min_lid != max_lid)
-				   && ((min_lid & lmc_mask) != min_lid)) {
-				/* check that if the lids define a range that is valid
-				   for the current LMC mask */
-				OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 0313: "
+			} else if (min_lid != max_lid
+				   && (min_lid & lmc_mask) != min_lid) {
+				/* check that if the lids define a range that is
+				   valid for the current LMC mask */
+				OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+					"ERR 0313: "
 					"LID range [%u:%u] for guid:0x%016"
 					PRIx64
 					" is not aligned according to mask:0x%04x\n",
@@ -191,13 +184,10 @@ static void __osm_lid_mgr_validate_db(IN osm_lid_mgr_t * p_mgr)
 			} else {
 				/* check if the lids were not previously assigned */
 				for (lid = min_lid; lid <= max_lid; lid++) {
-					if ((cl_ptr_vector_get_size
-					     (&p_mgr->used_lids) > lid)
-					    &&
-					    (cl_ptr_vector_get
-					     (&p_mgr->used_lids, lid))) {
+					if (p_mgr->used_lids[lid]) {
 						OSM_LOG(p_mgr->p_log,
-							OSM_LOG_ERROR, "ERR 0314: "
+							OSM_LOG_ERROR,
+							"ERR 0314: "
 							"0x%04x for guid:0x%016"
 							PRIx64
 							" was previously used\n",
@@ -207,32 +197,24 @@ static void __osm_lid_mgr_validate_db(IN osm_lid_mgr_t * p_mgr)
 				}
 			}
 
-			if (!lids_ok) {
-				if (osm_db_guid2lid_delete
-				    (p_mgr->p_g2l, p_item->guid))
-					OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
-						"ERR 0315: "
-						"failed to delete entry for "
-						"guid:0x%016" PRIx64 "\n",
-						p_item->guid);
-			} else {
-				/* mark it was visited */
+			if (lids_ok)
+				/* mark that it was visited */
 				for (lid = min_lid; lid <= max_lid; lid++)
-					cl_ptr_vector_set(&p_mgr->used_lids,
-							  lid, (void *)1);
-			}
+					p_mgr->used_lids[lid] = 1;
+			else if (osm_db_guid2lid_delete(p_mgr->p_g2l,
+							p_item->guid))
+				OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+					"ERR 0315: failed to delete entry for "
+					"guid:0x%016" PRIx64 "\n",
+					p_item->guid);
 		}		/* got a lid */
 		free(p_item);
-		p_item = (osm_db_guid_elem_t *) cl_qlist_remove_head(&guids);
 	}			/* all guids */
 Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_lid_mgr_init(IN osm_lid_mgr_t * const p_mgr, IN osm_sm_t *sm)
+ib_api_status_t osm_lid_mgr_init(IN osm_lid_mgr_t * p_mgr, IN osm_sm_t * sm)
 {
 	ib_api_status_t status = IB_SUCCESS;
 
@@ -247,7 +229,7 @@ osm_lid_mgr_init(IN osm_lid_mgr_t * const p_mgr, IN osm_sm_t *sm)
 	p_mgr->p_lock = sm->p_lock;
 
 	/* we initialize and restore the db domain of guid to lid map */
-	p_mgr->p_g2l = osm_db_domain_init(p_mgr->p_db, "/guid2lid");
+	p_mgr->p_g2l = osm_db_domain_init(p_mgr->p_db, "guid2lid");
 	if (!p_mgr->p_g2l) {
 		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 0316: "
 			"Error initializing Guid-to-Lid persistent database\n");
@@ -255,7 +237,6 @@ osm_lid_mgr_init(IN osm_lid_mgr_t * const p_mgr, IN osm_sm_t *sm)
 		goto Exit;
 	}
 
-	cl_ptr_vector_init(&p_mgr->used_lids, 100, 40);
 	cl_qlist_init(&p_mgr->free_ranges);
 
 	/* we use the stored guid to lid table if not forced to reassign */
@@ -268,9 +249,9 @@ osm_lid_mgr_init(IN osm_lid_mgr_t * const p_mgr, IN osm_sm_t *sm)
 			 * are closed, so we might see corrupted guid2lid file.
 			 */
 			if (p_mgr->p_subn->opt.exit_on_fatal) {
-				osm_log(p_mgr->p_log, OSM_LOG_SYS,
-					"FATAL: Error restoring Guid-to-Lid "
-					"persistent database\n");
+				osm_log_v2(p_mgr->p_log, OSM_LOG_SYS, FILE_ID,
+					   "FATAL: Error restoring Guid-to-Lid "
+					   "persistent database\n");
 				status = IB_ERROR;
 				goto Exit;
 			} else
@@ -282,17 +263,17 @@ osm_lid_mgr_init(IN osm_lid_mgr_t * const p_mgr, IN osm_sm_t *sm)
 
 		/* we need to make sure we did not get duplicates with
 		   current lmc */
-		__osm_lid_mgr_validate_db(p_mgr);
+		lid_mgr_validate_db(p_mgr);
 	}
 
 Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
-	return (status);
+	return status;
 }
 
-static uint16_t __osm_trim_lid(IN uint16_t lid)
+static uint16_t trim_lid(IN uint16_t lid)
 {
-	if ((lid > IB_LID_UCAST_END_HO) || (lid < IB_LID_UCAST_START_HO))
+	if (lid > IB_LID_UCAST_END_HO || lid < IB_LID_UCAST_START_HO)
 		return 0;
 	return lid;
 }
@@ -303,18 +284,11 @@ static uint16_t __osm_trim_lid(IN uint16_t lid)
  re-calculate all empty ranges.
  cleanup invalid port_lid_tbl entries
 **********************************************************************/
-static int __osm_lid_mgr_init_sweep(IN osm_lid_mgr_t * const p_mgr)
+static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr)
 {
 	cl_ptr_vector_t *p_discovered_vec = &p_mgr->p_subn->port_lid_tbl;
-	cl_ptr_vector_t *p_persistent_vec = &p_mgr->used_lids;
-	uint16_t max_defined_lid;
-	uint16_t max_persistent_lid;
-	uint16_t max_discovered_lid;
-	uint16_t lid;
-	uint16_t disc_min_lid;
-	uint16_t disc_max_lid;
-	uint16_t db_min_lid;
-	uint16_t db_max_lid;
+	uint16_t max_defined_lid, max_persistent_lid, max_discovered_lid;
+	uint16_t disc_min_lid, disc_max_lid, db_min_lid, db_max_lid;
 	int status = 0;
 	cl_list_item_t *p_item;
 	boolean_t is_free;
@@ -322,47 +296,39 @@ static int __osm_lid_mgr_init_sweep(IN osm_lid_mgr_t * const p_mgr)
 	osm_port_t *p_port;
 	cl_qmap_t *p_port_guid_tbl;
 	uint8_t lmc_num_lids = (uint8_t) (1 << p_mgr->p_subn->opt.lmc);
-	uint16_t lmc_mask;
-	uint16_t req_lid, num_lids;
+	uint16_t lmc_mask, req_lid, num_lids, lid;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 
-	if (p_mgr->p_subn->opt.lmc)
-		lmc_mask = ~((1 << p_mgr->p_subn->opt.lmc) - 1);
-	else
-		lmc_mask = 0xffff;
+	lmc_mask = ~((1 << p_mgr->p_subn->opt.lmc) - 1);
 
 	/* if we came out of standby we need to discard any previous guid2lid
 	   info we might have.
 	   Do this only if the honor_guid2lid_file option is FALSE. If not, then
 	   need to honor this file. */
 	if (p_mgr->p_subn->coming_out_of_standby == TRUE) {
-		if (p_mgr->p_subn->opt.honor_guid2lid_file == FALSE) {
+		osm_db_clear(p_mgr->p_g2l);
+		memset(p_mgr->used_lids, 0, sizeof(p_mgr->used_lids));
+		if (p_mgr->p_subn->opt.honor_guid2lid_file == FALSE)
 			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 				"Ignore guid2lid file when coming out of standby\n");
-			osm_db_clear(p_mgr->p_g2l);
-			for (lid = 0;
-			     lid < cl_ptr_vector_get_size(&p_mgr->used_lids);
-			     lid++)
-				cl_ptr_vector_set(p_persistent_vec, lid, NULL);
-		} else {
+		else {
 			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 				"Honor current guid2lid file when coming out "
 				"of standby\n");
-			osm_db_clear(p_mgr->p_g2l);
 			if (osm_db_restore(p_mgr->p_g2l))
-				OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 0306: "
+				OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+					"ERR 0306: "
 					"Error restoring Guid-to-Lid "
 					"persistent database. Ignoring it\n");
+			lid_mgr_validate_db(p_mgr);
 		}
 	}
 
 	/* we need to cleanup the empty ranges list */
-	p_item = cl_qlist_remove_head(&p_mgr->free_ranges);
-	while (p_item != cl_qlist_end(&p_mgr->free_ranges)) {
+	while ((p_item = cl_qlist_remove_head(&p_mgr->free_ranges)) !=
+	       cl_qlist_end(&p_mgr->free_ranges))
 		free((osm_lid_mgr_range_t *) p_item);
-		p_item = cl_qlist_remove_head(&p_mgr->free_ranges);
-	}
 
 	/* first clean up the port_by_lid_tbl */
 	for (lid = 0; lid < cl_ptr_vector_get_size(p_discovered_vec); lid++)
@@ -371,12 +337,11 @@ static int __osm_lid_mgr_init_sweep(IN osm_lid_mgr_t * const p_mgr)
 	/* we if are in the first sweep and in reassign lids mode
 	   we should ignore all the available info and simply define one
 	   huge empty range */
-	if ((p_mgr->p_subn->first_time_master_sweep == TRUE) &&
-	    (p_mgr->p_subn->opt.reassign_lids == TRUE)) {
+	if (p_mgr->p_subn->first_time_master_sweep == TRUE &&
+	    p_mgr->p_subn->opt.reassign_lids == TRUE) {
 		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 			"Skipping all lids as we are reassigning them\n");
-		p_range =
-		    (osm_lid_mgr_range_t *) malloc(sizeof(osm_lid_mgr_range_t));
+		p_range = malloc(sizeof(osm_lid_mgr_range_t));
 		if (p_range)
 			p_range->min_lid = 1;
 		goto AfterScanningLids;
@@ -389,39 +354,37 @@ static int __osm_lid_mgr_init_sweep(IN osm_lid_mgr_t * const p_mgr)
 	     p_port != (osm_port_t *) cl_qmap_end(p_port_guid_tbl);
 	     p_port = (osm_port_t *) cl_qmap_next(&p_port->map_item)) {
 		osm_port_get_lid_range_ho(p_port, &disc_min_lid, &disc_max_lid);
-		disc_min_lid = __osm_trim_lid(disc_min_lid);
-		disc_max_lid = __osm_trim_lid(disc_max_lid);
+		disc_min_lid = trim_lid(disc_min_lid);
+		disc_max_lid = trim_lid(disc_max_lid);
 		for (lid = disc_min_lid; lid <= disc_max_lid; lid++)
 			cl_ptr_vector_set(p_discovered_vec, lid, p_port);
 		/* make sure the guid2lid entry is valid. If not, clean it. */
-		if (!osm_db_guid2lid_get(p_mgr->p_g2l,
-					 cl_ntoh64(osm_port_get_guid(p_port)),
-					 &db_min_lid, &db_max_lid)) {
-			if (!p_port->p_node->sw ||
-			    osm_switch_sp0_is_lmc_capable(p_port->p_node->sw,
-							  p_mgr->p_subn))
-				num_lids = lmc_num_lids;
-			else
-				num_lids = 1;
-
-			if ((num_lids != 1) &&
-			    (((db_min_lid & lmc_mask) != db_min_lid) ||
-			     (db_max_lid - db_min_lid + 1 < num_lids))) {
-				/* Not aligned, or not wide enough, then remove the entry */
-				OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
-					"Cleaning persistent entry for guid:"
-					"0x%016" PRIx64 " illegal range:"
-					"[0x%x:0x%x]\n",
+		if (osm_db_guid2lid_get(p_mgr->p_g2l,
 					cl_ntoh64(osm_port_get_guid(p_port)),
-					db_min_lid, db_max_lid);
-				osm_db_guid2lid_delete(p_mgr->p_g2l,
-						       cl_ntoh64
-						       (osm_port_get_guid
-							(p_port)));
-				for (lid = db_min_lid; lid <= db_max_lid; lid++)
-					cl_ptr_vector_set(p_persistent_vec, lid,
-							  NULL);
-			}
+					&db_min_lid, &db_max_lid))
+			continue;
+
+		if (!p_port->p_node->sw ||
+		    osm_switch_sp0_is_lmc_capable(p_port->p_node->sw,
+						  p_mgr->p_subn))
+			num_lids = lmc_num_lids;
+		else
+			num_lids = 1;
+
+		if (num_lids != 1 &&
+		    ((db_min_lid & lmc_mask) != db_min_lid ||
+		     db_max_lid - db_min_lid + 1 < num_lids)) {
+			/* Not aligned, or not wide enough, then remove the entry */
+			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+				"Cleaning persistent entry for guid:"
+				"0x%016" PRIx64 " illegal range:[0x%x:0x%x]\n",
+				cl_ntoh64(osm_port_get_guid(p_port)),
+				db_min_lid, db_max_lid);
+			osm_db_guid2lid_delete(p_mgr->p_g2l,
+					       cl_ntoh64
+					       (osm_port_get_guid(p_port)));
+			for (lid = db_min_lid; lid <= db_max_lid; lid++)
+				p_mgr->used_lids[lid] = 0;
 		}
 	}
 
@@ -429,8 +392,8 @@ static int __osm_lid_mgr_init_sweep(IN osm_lid_mgr_t * const p_mgr)
 	   Our task is to find free lid ranges.
 	   A lid can be used if
 	   1. a persistent assignment exists
-	   2. the lid is used by a discovered port that does not have a persistent
-	   assignment.
+	   2. the lid is used by a discovered port that does not have a
+	   persistent assignment.
 
 	   scan through all lid values of both the persistent table and
 	   discovered table.
@@ -445,14 +408,11 @@ static int __osm_lid_mgr_init_sweep(IN osm_lid_mgr_t * const p_mgr)
 	/* find the range of lids to scan */
 	max_discovered_lid =
 	    (uint16_t) cl_ptr_vector_get_size(p_discovered_vec);
-	max_persistent_lid =
-	    (uint16_t) cl_ptr_vector_get_size(p_persistent_vec);
+	max_persistent_lid = sizeof(p_mgr->used_lids) - 1;
 
 	/* but the vectors have one extra entry for lid=0 */
 	if (max_discovered_lid)
 		max_discovered_lid--;
-	if (max_persistent_lid)
-		max_persistent_lid--;
 
 	if (max_persistent_lid > max_discovered_lid)
 		max_defined_lid = max_persistent_lid;
@@ -462,100 +422,87 @@ static int __osm_lid_mgr_init_sweep(IN osm_lid_mgr_t * const p_mgr)
 	for (lid = 1; lid <= max_defined_lid; lid++) {
 		is_free = TRUE;
 		/* first check to see if the lid is used by a persistent assignment */
-		if ((lid <= max_persistent_lid)
-		    && cl_ptr_vector_get(p_persistent_vec, lid)) {
+		if (lid <= max_persistent_lid && p_mgr->used_lids[lid]) {
 			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 				"0x%04x is not free as its mapped by the "
 				"persistent db\n", lid);
 			is_free = FALSE;
-		} else {
 			/* check this is a discovered port */
-			if (lid <= max_discovered_lid
-			    && (p_port = (osm_port_t *)
-				cl_ptr_vector_get(p_discovered_vec, lid))) {
-				/* we have a port. Now lets see if we can preserve its lid range. */
-				/* For that, we need to make sure:
-				   1. The port has a (legal) persistency entry. Then the local lid
-				   is free (we will use the persistency value).
-				   2. Can the port keep its local assignment?
-				   a. Make sure the lid a aligned.
-				   b. Make sure all needed lids (for the lmc) are free according
-				   to persistency table.
-				 */
-				/* qualify the guid of the port is not persistently mapped to
-				   another range */
-				if (!osm_db_guid2lid_get(p_mgr->p_g2l,
-							 cl_ntoh64
-							 (osm_port_get_guid
-							  (p_port)),
-							 &db_min_lid,
-							 &db_max_lid)) {
+		} else if (lid <= max_discovered_lid &&
+			   (p_port = cl_ptr_vector_get(p_discovered_vec,
+						       lid))) {
+			/* we have a port. Now lets see if we can preserve its lid range. */
+			/* For that, we need to make sure:
+			   1. The port has a (legal) persistency entry. Then the
+			   local lid is free (we will use the persistency value).
+			   2. Can the port keep its local assignment?
+			   a. Make sure the lid a aligned.
+			   b. Make sure all needed lids (for the lmc) are free
+			   according to persistency table.
+			 */
+			/* qualify the guid of the port is not persistently
+			   mapped to another range */
+			if (!osm_db_guid2lid_get(p_mgr->p_g2l,
+						 cl_ntoh64
+						 (osm_port_get_guid(p_port)),
+						 &db_min_lid, &db_max_lid)) {
+				OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+					"0x%04x is free as it was "
+					"discovered but mapped by the "
+					"persistent db to [0x%04x:0x%04x]\n",
+					lid, db_min_lid, db_max_lid);
+			} else {
+				/* can the port keep its assignment ? */
+				/* get the lid range of that port, and the
+				   required number of lids we are about to
+				   assign to it */
+				osm_port_get_lid_range_ho(p_port,
+							  &disc_min_lid,
+							  &disc_max_lid);
+				if (!p_port->p_node->sw ||
+				    osm_switch_sp0_is_lmc_capable
+				    (p_port->p_node->sw, p_mgr->p_subn)) {
+					disc_max_lid =
+					    disc_min_lid + lmc_num_lids - 1;
+					num_lids = lmc_num_lids;
+				} else
+					num_lids = 1;
+
+				/* Make sure the lid is aligned */
+				if (num_lids != 1
+				    && (disc_min_lid & lmc_mask) !=
+				    disc_min_lid) {
+					/* The lid cannot be used */
 					OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 						"0x%04x is free as it was "
-						"discovered but mapped by the "
-						"persistent db to [0x%04x:0x%04x]\n",
-						lid, db_min_lid, db_max_lid);
+						"discovered but not aligned\n",
+						lid);
 				} else {
-					/* can the port keep its assignment ? */
-					/* get the lid range of that port, and the required number
-					   of lids we are about to assign to it */
-					osm_port_get_lid_range_ho(p_port,
-								  &disc_min_lid,
-								  &disc_max_lid);
-					if (!p_port->p_node->sw
-					    ||
-					    osm_switch_sp0_is_lmc_capable
-					    (p_port->p_node->sw,
-					     p_mgr->p_subn)) {
-						disc_max_lid =
-						    disc_min_lid +
-						    lmc_num_lids - 1;
-						num_lids = lmc_num_lids;
-					} else
-						num_lids = 1;
-
-					/* Make sure the lid is aligned */
-					if ((num_lids != 1)
-					    && ((disc_min_lid & lmc_mask) !=
-						disc_min_lid)) {
-						/* The lid cannot be used */
-						OSM_LOG(p_mgr->p_log,
-							OSM_LOG_DEBUG,
-							"0x%04x is free as it was "
-							"discovered but not aligned\n",
-							lid);
-					} else {
-						/* check that all needed lids are not persistently mapped */
-						is_free = FALSE;
-						for (req_lid = disc_min_lid + 1;
-						     req_lid <= disc_max_lid;
-						     req_lid++) {
-							if ((req_lid <=
-							     max_persistent_lid)
-							    &&
-							    cl_ptr_vector_get
-							    (p_persistent_vec,
-							     req_lid)) {
-								OSM_LOG(p_mgr->
-									p_log,
-									OSM_LOG_DEBUG,
-									"0x%04x is free as it was discovered "
-									"but mapped\n",
-									lid);
-								is_free = TRUE;
-								break;
-							}
+					/* check that all needed lids are not persistently mapped */
+					is_free = FALSE;
+					for (req_lid = disc_min_lid + 1;
+					     req_lid <= disc_max_lid;
+					     req_lid++) {
+						if (req_lid <=
+						    max_persistent_lid &&
+						    p_mgr->used_lids[req_lid]) {
+							OSM_LOG(p_mgr->p_log,
+								OSM_LOG_DEBUG,
+								"0x%04x is free as it was discovered "
+								"but mapped\n",
+								lid);
+							is_free = TRUE;
+							break;
 						}
+					}
 
-						if (is_free == FALSE) {
-							/* This port will use its local lid, and consume the entire required lid range.
-							   Thus we can skip that range. */
-							/* If the disc_max_lid is greater then lid, we can skip right to it,
-							   since we've done all neccessary checks on the lids in between. */
-							if (disc_max_lid > lid)
-								lid =
-								    disc_max_lid;
-						}
+					if (is_free == FALSE) {
+						/* This port will use its local lid, and consume the entire required lid range.
+						   Thus we can skip that range. */
+						/* If the disc_max_lid is greater then lid, we can skip right to it,
+						   since we've done all neccessary checks on the lids in between. */
+						if (disc_max_lid > lid)
+							lid = disc_max_lid;
 					}
 				}
 			}
@@ -565,23 +512,20 @@ static int __osm_lid_mgr_init_sweep(IN osm_lid_mgr_t * const p_mgr)
 			if (p_range)
 				p_range->max_lid = lid;
 			else {
-				p_range = (osm_lid_mgr_range_t *)
-				    malloc(sizeof(osm_lid_mgr_range_t));
+				p_range = malloc(sizeof(osm_lid_mgr_range_t));
 				if (p_range) {
 					p_range->min_lid = lid;
 					p_range->max_lid = lid;
 				}
 			}
-		} else {
-			/* this lid is used so we need to finalize the previous free range */
-			if (p_range) {
-				cl_qlist_insert_tail(&p_mgr->free_ranges,
-						     &p_range->item);
-				OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
-					"new free lid range [%u:%u]\n",
-					p_range->min_lid, p_range->max_lid);
-				p_range = NULL;
-			}
+		/* this lid is used so we need to finalize the previous free range */
+		} else if (p_range) {
+			cl_qlist_insert_tail(&p_mgr->free_ranges,
+					     &p_range->item);
+			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+				"new free lid range [%u:%u]\n",
+				p_range->min_lid, p_range->max_lid);
+			p_range = NULL;
 		}
 	}
 
@@ -589,8 +533,7 @@ AfterScanningLids:
 	/* after scanning all known lids we need to extend the last range
 	   to the max allowed lid */
 	if (!p_range) {
-		p_range =
-		    (osm_lid_mgr_range_t *) malloc(sizeof(osm_lid_mgr_range_t));
+		p_range = malloc(sizeof(osm_lid_mgr_range_t));
 		/*
 		   The p_range can be NULL in one of 2 cases:
 		   1. If max_defined_lid == 0. In this case, we want the
@@ -617,44 +560,26 @@ AfterScanningLids:
 /**********************************************************************
  check if the given range of lids is free
 **********************************************************************/
-static boolean_t
-__osm_lid_mgr_is_range_not_persistent(IN osm_lid_mgr_t * const p_mgr,
-				      IN const uint16_t lid,
-				      IN const uint16_t num_lids)
+static boolean_t lid_mgr_is_range_not_persistent(IN osm_lid_mgr_t * p_mgr,
+						 IN uint16_t lid,
+						 IN uint16_t num_lids)
 {
 	uint16_t i;
-	cl_status_t status;
-	osm_port_t *p_port;
-	const uint8_t start_lid = (uint8_t) (1 << p_mgr->p_subn->opt.lmc);
-	const cl_ptr_vector_t *const p_tbl = &p_mgr->used_lids;
-
-	if (lid < start_lid)
-		return (FALSE);
 
-	for (i = lid; i < lid + num_lids; i++) {
-		status = cl_ptr_vector_at(p_tbl, i, (void *)&p_port);
-		if (status == CL_SUCCESS) {
-			if (p_port != NULL)
-				return (FALSE);
-		} else
-			/*
-			   We are out of range in the array.
-			   Consider all further entries "free".
-			 */
-			return (TRUE);
-	}
+	for (i = lid; i < lid + num_lids; i++)
+		if (p_mgr->used_lids[i])
+			return FALSE;
 
-	return (TRUE);
+	return TRUE;
 }
 
 /**********************************************************************
 find a free lid range
 **********************************************************************/
-static void
-__osm_lid_mgr_find_free_lid_range(IN osm_lid_mgr_t * const p_mgr,
-				  IN const uint8_t num_lids,
-				  OUT uint16_t * const p_min_lid,
-				  OUT uint16_t * const p_max_lid)
+static void lid_mgr_find_free_lid_range(IN osm_lid_mgr_t * p_mgr,
+					IN uint8_t num_lids,
+					OUT uint16_t * p_min_lid,
+					OUT uint16_t * p_max_lid)
 {
 	uint16_t lid;
 	cl_list_item_t *p_item;
@@ -667,10 +592,7 @@ __osm_lid_mgr_find_free_lid_range(IN osm_lid_mgr_t * const p_mgr,
 		p_mgr->p_subn->opt.lmc, num_lids);
 
 	lmc_num_lids = (1 << p_mgr->p_subn->opt.lmc);
-	if (p_mgr->p_subn->opt.lmc)
-		lmc_mask = ~((1 << p_mgr->p_subn->opt.lmc) - 1);
-	else
-		lmc_mask = 0xffff;
+	lmc_mask = ~((1 << p_mgr->p_subn->opt.lmc) - 1);
 
 	/*
 	   Search the list of free lid ranges for a range which is big enough
@@ -691,11 +613,12 @@ __osm_lid_mgr_find_free_lid_range(IN osm_lid_mgr_t * const p_mgr,
 		/* but we can be out of the range */
 		if (lid + num_lids - 1 <= p_range->max_lid) {
 			/* ok let us use that range */
-			if (lid + num_lids - 1 == p_range->max_lid)
+			if (lid + num_lids - 1 == p_range->max_lid) {
 				/* we consumed the entire range */
 				cl_qlist_remove_item(&p_mgr->free_ranges,
 						     p_item);
-			else
+				free(p_item);
+			} else
 				/* only update the available range */
 				p_range->min_lid = lid + num_lids;
 
@@ -716,11 +639,8 @@ __osm_lid_mgr_find_free_lid_range(IN osm_lid_mgr_t * const p_mgr,
 	CL_ASSERT(0);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_lid_mgr_cleanup_discovered_port_lid_range(IN osm_lid_mgr_t * p_mgr,
-						IN osm_port_t * p_port)
+static void lid_mgr_cleanup_discovered_port_lid_range(IN osm_lid_mgr_t * p_mgr,
+						      IN osm_port_t * p_port)
 {
 	cl_ptr_vector_t *p_discovered_vec = &p_mgr->p_subn->port_lid_tbl;
 	uint16_t lid, min_lid, max_lid;
@@ -728,14 +648,12 @@ __osm_lid_mgr_cleanup_discovered_port_lid_range(IN osm_lid_mgr_t * p_mgr,
 	    (uint16_t) (cl_ptr_vector_get_size(p_discovered_vec));
 
 	osm_port_get_lid_range_ho(p_port, &min_lid, &max_lid);
-	min_lid = __osm_trim_lid(min_lid);
-	max_lid = __osm_trim_lid(max_lid);
-	for (lid = min_lid; lid <= max_lid; lid++) {
-		if ((lid < max_tbl_lid) &&
-		    (p_port ==
-		     (osm_port_t *) cl_ptr_vector_get(p_discovered_vec, lid)))
+	min_lid = trim_lid(min_lid);
+	max_lid = trim_lid(max_lid);
+	for (lid = min_lid; lid <= max_lid; lid++)
+		if (lid < max_tbl_lid &&
+		    p_port == cl_ptr_vector_get(p_discovered_vec, lid))
 			cl_ptr_vector_set(p_discovered_vec, lid, NULL);
-	}
 }
 
 /**********************************************************************
@@ -746,11 +664,10 @@ __osm_lid_mgr_cleanup_discovered_port_lid_range(IN osm_lid_mgr_t * p_mgr,
  0.3 else find an empty space in port_lid_tbl, update the
  port_lid_tbl and guid2lid, return 1 to flag a change required.
 **********************************************************************/
-static int
-__osm_lid_mgr_get_port_lid(IN osm_lid_mgr_t * const p_mgr,
-			   IN osm_port_t * const p_port,
-			   OUT uint16_t * const p_min_lid,
-			   OUT uint16_t * const p_max_lid)
+static int lid_mgr_get_port_lid(IN osm_lid_mgr_t * p_mgr,
+				IN osm_port_t * p_port,
+				OUT uint16_t * p_min_lid,
+				OUT uint16_t * p_max_lid)
 {
 	uint16_t lid, min_lid, max_lid;
 	uint64_t guid;
@@ -760,11 +677,6 @@ __osm_lid_mgr_get_port_lid(IN osm_lid_mgr_t * const p_mgr,
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 
-	if (p_mgr->p_subn->opt.lmc)
-		lmc_mask = ~((1 << p_mgr->p_subn->opt.lmc) - 1);
-	else
-		lmc_mask = 0xffff;
-
 	/* get the lid from the guid2lid */
 	guid = cl_ntoh64(osm_port_get_guid(p_port));
 
@@ -773,26 +685,31 @@ __osm_lid_mgr_get_port_lid(IN osm_lid_mgr_t * const p_mgr,
 	    !osm_switch_sp0_is_lmc_capable(p_port->p_node->sw, p_mgr->p_subn))
 		num_lids = 1;
 
+	if (p_mgr->p_subn->first_time_master_sweep == TRUE &&
+	    p_mgr->p_subn->opt.reassign_lids == TRUE)
+		goto AssignLid;
+
+	lmc_mask = ~(num_lids - 1);
+
 	/* if the port matches the guid2lid */
 	if (!osm_db_guid2lid_get(p_mgr->p_g2l, guid, &min_lid, &max_lid)) {
 		*p_min_lid = min_lid;
 		*p_max_lid = min_lid + num_lids - 1;
-		if (min_lid == cl_ntoh16(osm_port_get_base_lid(p_port))) {
+		if (min_lid == cl_ntoh16(osm_port_get_base_lid(p_port)))
 			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "0x%016" PRIx64
 				" matches its known lid:%u\n", guid, min_lid);
-			goto Exit;
-		} else {
+		else {
 			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 				"0x%016" PRIx64 " with lid:%u "
 				"does not match its known lid:%u\n",
 				guid, cl_ntoh16(osm_port_get_base_lid(p_port)),
 				min_lid);
-			__osm_lid_mgr_cleanup_discovered_port_lid_range(p_mgr,
-									p_port);
+			lid_mgr_cleanup_discovered_port_lid_range(p_mgr,
+								  p_port);
 			/* we still need to send the setting to the target port */
 			lid_changed = 1;
-			goto Exit;
 		}
+		goto NewLidSet;
 	} else
 		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 			"0x%016" PRIx64 " has no persistent lid assigned\n",
@@ -804,13 +721,11 @@ __osm_lid_mgr_get_port_lid(IN osm_lid_mgr_t * const p_mgr,
 
 	/* we want to ignore the discovered lid if we are also on first sweep of
 	   reassign lids flow */
-	if (min_lid &&
-	    !((p_mgr->p_subn->first_time_master_sweep == TRUE) &&
-	      (p_mgr->p_subn->opt.reassign_lids == TRUE))) {
+	if (min_lid) {
 		/* make sure lid is valid */
-		if ((num_lids == 1) || ((min_lid & lmc_mask) == min_lid)) {
+		if ((min_lid & lmc_mask) == min_lid) {
 			/* is it free */
-			if (__osm_lid_mgr_is_range_not_persistent
+			if (lid_mgr_is_range_not_persistent
 			    (p_mgr, min_lid, num_lids)) {
 				*p_min_lid = min_lid;
 				*p_max_lid = min_lid + num_lids - 1;
@@ -831,12 +746,12 @@ __osm_lid_mgr_get_port_lid(IN osm_lid_mgr_t * const p_mgr,
 				guid, min_lid, min_lid + num_lids - 1);
 	}
 
+AssignLid:
 	/* first cleanup the existing discovered lid range */
-	__osm_lid_mgr_cleanup_discovered_port_lid_range(p_mgr, p_port);
+	lid_mgr_cleanup_discovered_port_lid_range(p_mgr, p_port);
 
 	/* find an empty space */
-	__osm_lid_mgr_find_free_lid_range(p_mgr, num_lids, p_min_lid,
-					  p_max_lid);
+	lid_mgr_find_free_lid_range(p_mgr, num_lids, p_min_lid, p_max_lid);
 	OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 		"0x%016" PRIx64 " assigned a new lid range:[%u-%u]\n",
 		guid, *p_min_lid, *p_max_lid);
@@ -846,9 +761,8 @@ NewLidSet:
 	/* update the guid2lid db and used_lids */
 	osm_db_guid2lid_set(p_mgr->p_g2l, guid, *p_min_lid, *p_max_lid);
 	for (lid = *p_min_lid; lid <= *p_max_lid; lid++)
-		cl_ptr_vector_set(&p_mgr->used_lids, lid, (void *)1);
+		p_mgr->used_lids[lid] = 1;
 
-Exit:
 	/* make sure the assigned lids are marked in port_lid_tbl */
 	for (lid = *p_min_lid; lid <= *p_max_lid; lid++)
 		cl_ptr_vector_set(&p_mgr->p_subn->port_lid_tbl, lid, p_port);
@@ -860,9 +774,8 @@ Exit:
 /**********************************************************************
  Set to INIT the remote port of the given physical port
  **********************************************************************/
-static void
-__osm_lid_mgr_set_remote_pi_state_to_init(IN osm_lid_mgr_t * const p_mgr,
-					  IN osm_physp_t * const p_physp)
+static void lid_mgr_set_remote_pi_state_to_init(IN osm_lid_mgr_t * p_mgr,
+						IN osm_physp_t * p_physp)
 {
 	osm_physp_t *p_rem_physp = osm_physp_get_remote(p_physp);
 
@@ -873,13 +786,9 @@ __osm_lid_mgr_set_remote_pi_state_to_init(IN osm_lid_mgr_t * const p_mgr,
 	ib_port_info_set_port_state(&p_rem_physp->port_info, IB_LINK_INIT);
 }
 
-/**********************************************************************
- **********************************************************************/
-static boolean_t
-__osm_lid_mgr_set_physp_pi(IN osm_lid_mgr_t * const p_mgr,
-			   IN osm_port_t * const p_port,
-			   IN osm_physp_t * const p_physp,
-			   IN ib_net16_t const lid)
+static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
+				IN osm_port_t * p_port,
+				IN osm_physp_t * p_physp, IN ib_net16_t lid)
 {
 	uint8_t payload[IB_SMP_DATA_SIZE];
 	ib_port_info_t *p_pi = (ib_port_info_t *) payload;
@@ -891,6 +800,8 @@ __osm_lid_mgr_set_physp_pi(IN osm_lid_mgr_t * const p_mgr,
 	uint8_t op_vls;
 	uint8_t port_num;
 	boolean_t send_set = FALSE;
+	boolean_t update_mkey = FALSE;
+	int ret = 0;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 
@@ -929,7 +840,6 @@ __osm_lid_mgr_set_physp_pi(IN osm_lid_mgr_t * const p_mgr,
 	   Third, send the SMP to this physical port.
 	 */
 
-	memset(payload, 0, IB_SMP_DATA_SIZE);
 	memcpy(payload, p_old_pi, sizeof(ib_port_info_t));
 
 	/*
@@ -953,8 +863,10 @@ __osm_lid_mgr_set_physp_pi(IN osm_lid_mgr_t * const p_mgr,
 		send_set = TRUE;
 
 	p_pi->m_key = p_mgr->p_subn->opt.m_key;
-	if (memcmp(&p_pi->m_key, &p_old_pi->m_key, sizeof(p_pi->m_key)))
+	if (memcmp(&p_pi->m_key, &p_old_pi->m_key, sizeof(p_pi->m_key))) {
+		update_mkey = TRUE;
 		send_set = TRUE;
+	}
 
 	p_pi->subnet_prefix = p_mgr->p_subn->opt.subnet_prefix;
 	if (memcmp(&p_pi->subnet_prefix, &p_old_pi->subnet_prefix,
@@ -977,6 +889,11 @@ __osm_lid_mgr_set_physp_pi(IN osm_lid_mgr_t * const p_mgr,
 		   sizeof(p_pi->m_key_lease_period)))
 		send_set = TRUE;
 
+	p_pi->mkey_lmc = 0;
+	ib_port_info_set_mpb(p_pi, p_mgr->p_subn->opt.m_key_protect_bits);
+	if (ib_port_info_get_mpb(p_pi) != ib_port_info_get_mpb(p_old_pi))
+		send_set = TRUE;
+
 	/*
 	   we want to set the timeout for both the switch port 0
 	   and the CA ports
@@ -998,17 +915,18 @@ __osm_lid_mgr_set_physp_pi(IN osm_lid_mgr_t * const p_mgr,
 			   sizeof(p_pi->link_width_enabled)))
 			send_set = TRUE;
 
-		/* M_KeyProtectBits are always zero */
-		p_pi->mkey_lmc = p_mgr->p_subn->opt.lmc;
-		if (memcmp(&p_pi->mkey_lmc, &p_old_pi->mkey_lmc,
-			   sizeof(p_pi->mkey_lmc)))
+		/* p_pi->mkey_lmc is initialized earlier */
+		ib_port_info_set_lmc(p_pi, p_mgr->p_subn->opt.lmc);
+		if (ib_port_info_get_lmc(p_pi) !=
+		    ib_port_info_get_lmc(p_old_pi))
 			send_set = TRUE;
 
 		/* calc new op_vls and mtu */
-		op_vls =
-		    osm_physp_calc_link_op_vls(p_mgr->p_log, p_mgr->p_subn,
-					       p_physp);
-		mtu = osm_physp_calc_link_mtu(p_mgr->p_log, p_physp);
+		op_vls = osm_physp_calc_link_op_vls(p_mgr->p_log, p_mgr->p_subn,
+					      p_physp,
+					      ib_port_info_get_op_vls(p_old_pi));
+		mtu = osm_physp_calc_link_mtu(p_mgr->p_log, p_physp,
+					      ib_port_info_get_neighbor_mtu(p_old_pi));
 
 		ib_port_info_set_neighbor_mtu(p_pi, mtu);
 
@@ -1038,8 +956,8 @@ __osm_lid_mgr_set_physp_pi(IN osm_lid_mgr_t * const p_mgr,
 		   To reset the port state machine we can send
 		   PortInfo.State = DOWN. (see: 7.2.7 p171 lines:10-19)
 		 */
-		if ((mtu != ib_port_info_get_neighbor_mtu(p_old_pi)) ||
-		    (op_vls != ib_port_info_get_op_vls(p_old_pi))) {
+		if (mtu != ib_port_info_get_neighbor_mtu(p_old_pi) ||
+		    op_vls != ib_port_info_get_op_vls(p_old_pi)) {
 			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 				"Sending Link Down to GUID 0x%016"
 				PRIx64 " port %d due to op_vls or "
@@ -1054,8 +972,7 @@ __osm_lid_mgr_set_physp_pi(IN osm_lid_mgr_t * const p_mgr,
 			   fact that the remote port is also going through
 			   "down" state into "init"...
 			 */
-			__osm_lid_mgr_set_remote_pi_state_to_init(p_mgr,
-								  p_physp);
+			lid_mgr_set_remote_pi_state_to_init(p_mgr, p_physp);
 
 			ib_port_info_set_port_state(p_pi, IB_LINK_DOWN);
 			if (ib_port_info_get_port_state(p_pi) !=
@@ -1082,10 +999,10 @@ __osm_lid_mgr_set_physp_pi(IN osm_lid_mgr_t * const p_mgr,
 
 		/* Determine if enhanced switch port 0 and if so set LMC */
 		if (osm_switch_sp0_is_lmc_capable(p_node->sw, p_mgr->p_subn)) {
-			/* M_KeyProtectBits are always zero */
-			p_pi->mkey_lmc = p_mgr->p_subn->opt.lmc;
-			if (memcmp(&p_pi->mkey_lmc, &p_old_pi->mkey_lmc,
-				   sizeof(p_pi->mkey_lmc)))
+			/* p_pi->mkey_lmc is initialized earlier */
+			ib_port_info_set_lmc(p_pi, p_mgr->p_subn->opt.lmc);
+			if (ib_port_info_get_lmc(p_pi) !=
+			    ib_port_info_get_lmc(p_old_pi))
 				send_set = TRUE;
 		}
 	}
@@ -1103,11 +1020,13 @@ __osm_lid_mgr_set_physp_pi(IN osm_lid_mgr_t * const p_mgr,
 	   the cli_rereg bit. We know that the port was just discovered if its
 	   is_new field is set.
 	 */
-	if ((p_mgr->p_subn->first_time_master_sweep == TRUE || p_port->is_new)
+	if ((p_mgr->p_subn->first_time_master_sweep == TRUE
+	     || p_mgr->p_subn->set_client_rereg_on_sweep == TRUE
+	     || p_port->is_new)
 	    && !p_mgr->p_subn->opt.no_clients_rereg
 	    && (p_old_pi->capability_mask & IB_PORT_CAP_HAS_CLIENT_REREG)) {
 		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
-			"Seting client rereg on %s, port %d\n",
+			"Setting client rereg on %s, port %d\n",
 			p_port->p_node->print_desc, p_port->p_physp->port_num);
 		ib_port_info_set_client_rereg(p_pi, 1);
 		send_set = TRUE;
@@ -1120,50 +1039,60 @@ __osm_lid_mgr_set_physp_pi(IN osm_lid_mgr_t * const p_mgr,
 	   2. first_time_master_sweep flag on the subnet is TRUE. This means the
 	   SM just became master, and it then needs to send a PortInfo Set to
 	   every port.
+	   3. set_client_rereg_on_sweep is TRUE.  The one situation in which this
+	   is true but first_time_master_sweep is FALSE is when the SM receives
+	   a HANDOVER while in master.  We don't want to re-setup everything by
+	   setting first_time_master_sweep, but we do want to reset up this.
 	 */
-	if (p_mgr->p_subn->first_time_master_sweep == TRUE)
+	if (p_mgr->p_subn->first_time_master_sweep == TRUE
+	    || p_mgr->p_subn->set_client_rereg_on_sweep == TRUE)
 		send_set = TRUE;
 
-	if (send_set) {
-		p_mgr->send_set_reqs = TRUE;
-		status = osm_req_set(p_mgr->sm,
-				     osm_physp_get_dr_path_ptr(p_physp),
-				     payload,
-				     sizeof(payload),
-				     IB_MAD_ATTR_PORT_INFO,
-				     cl_hton32(osm_physp_get_port_num(p_physp)),
-				     CL_DISP_MSGID_NONE, &context);
-	}
+	if (!send_set)
+		goto Exit;
+
+	status = osm_req_set(p_mgr->sm, osm_physp_get_dr_path_ptr(p_physp),
+			     payload, sizeof(payload), IB_MAD_ATTR_PORT_INFO,
+			     cl_hton32(osm_physp_get_port_num(p_physp)),
+			     CL_DISP_MSGID_NONE, &context);
+	if (status != IB_SUCCESS)
+		ret = -1;
+	/* If we sent a new mkey above, update our guid2mkey map
+	   now, on the assumption that the SubnSet succeeds
+	*/
+	if (update_mkey)
+		osm_db_guid2mkey_set(p_mgr->p_subn->p_g2m,
+				     cl_ntoh64(p_physp->port_guid),
+				     cl_ntoh64(p_pi->m_key));
 
 Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
-	return send_set;
+	return ret;
 }
 
 /**********************************************************************
  Processes our own node
  Lock must already be held.
 **********************************************************************/
-static boolean_t
-__osm_lid_mgr_process_our_sm_node(IN osm_lid_mgr_t * const p_mgr)
+static int lid_mgr_process_our_sm_node(IN osm_lid_mgr_t * p_mgr)
 {
 	osm_port_t *p_port;
 	uint16_t min_lid_ho;
 	uint16_t max_lid_ho;
-	boolean_t res = TRUE;
+	int ret;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 
 	/*
 	   Acquire our own port object.
 	 */
-	p_port =
-	    osm_get_port_by_guid(p_mgr->p_subn, p_mgr->p_subn->sm_port_guid);
+	p_port = osm_get_port_by_guid(p_mgr->p_subn,
+				      p_mgr->p_subn->sm_port_guid);
 	if (!p_port) {
 		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 0308: "
 			"Can't acquire SM's port object, GUID 0x%016" PRIx64
 			"\n", cl_ntoh64(p_mgr->p_subn->sm_port_guid));
-		res = FALSE;
+		ret = -1;
 		goto Exit;
 	}
 
@@ -1175,7 +1104,7 @@ __osm_lid_mgr_process_our_sm_node(IN osm_lid_mgr_t * const p_mgr)
 	   configure the SM with a LID that has non-zero bits, even after
 	   LMC masking by hardware.
 	 */
-	__osm_lid_mgr_get_port_lid(p_mgr, p_port, &min_lid_ho, &max_lid_ho);
+	lid_mgr_get_port_lid(p_mgr, p_port, &min_lid_ho, &max_lid_ho);
 	OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 		"Current base LID is %u\n", min_lid_ho);
 	/*
@@ -1192,19 +1121,17 @@ __osm_lid_mgr_process_our_sm_node(IN osm_lid_mgr_t * const p_mgr)
 	/*
 	   Set the PortInfo the Physical Port associated with this Port.
 	 */
-	__osm_lid_mgr_set_physp_pi(p_mgr, p_port, p_port->p_physp,
+	ret = lid_mgr_set_physp_pi(p_mgr, p_port, p_port->p_physp,
 				   cl_hton16(min_lid_ho));
 
 Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
-	return res;
+	return ret;
 }
 
-/**********************************************************************
- **********************************************************************/
-osm_signal_t osm_lid_mgr_process_sm(IN osm_lid_mgr_t * const p_mgr)
+int osm_lid_mgr_process_sm(IN osm_lid_mgr_t * p_mgr)
 {
-	osm_signal_t signal = OSM_SIGNAL_DONE_PENDING;
+	int ret;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 
@@ -1214,39 +1141,29 @@ osm_signal_t osm_lid_mgr_process_sm(IN osm_lid_mgr_t * const p_mgr)
 
 	/* initialize the port_lid_tbl and empty ranges list following the
 	   persistent db */
-	__osm_lid_mgr_init_sweep(p_mgr);
+	lid_mgr_init_sweep(p_mgr);
 
-	/* Set the send_set_reqs of the p_mgr to FALSE, and
-	   we'll see if any set requests were sent. If not -
-	   can signal OSM_SIGNAL_DONE */
-	p_mgr->send_set_reqs = FALSE;
-	if (__osm_lid_mgr_process_our_sm_node(p_mgr) == FALSE)
-		/* The initialization failed */
-		signal = OSM_SIGNAL_DONE;
-
-	if (p_mgr->send_set_reqs == FALSE)
-		signal = OSM_SIGNAL_DONE;
+	ret = lid_mgr_process_our_sm_node(p_mgr);
 
 	CL_PLOCK_RELEASE(p_mgr->p_lock);
 
 	OSM_LOG_EXIT(p_mgr->p_log);
-	return (signal);
+	return ret;
 }
 
 /**********************************************************************
  1 go through all ports in the subnet.
- 1.1 call __osm_lid_mgr_get_port_min_lid
+ 1.1 call lid_mgr_get_port_min_lid
  1.2 if a change is required send the port info
  2 if any change send the signal PENDING...
 **********************************************************************/
-osm_signal_t osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * const p_mgr)
+int osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * p_mgr)
 {
-	osm_signal_t signal;
 	cl_qmap_t *p_port_guid_tbl;
 	osm_port_t *p_port;
 	ib_net64_t port_guid;
+	int lid_changed, ret = 0;
 	uint16_t min_lid_ho, max_lid_ho;
-	int lid_changed;
 
 	CL_ASSERT(p_mgr);
 
@@ -1256,11 +1173,6 @@ osm_signal_t osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * const p_mgr)
 
 	CL_ASSERT(p_mgr->p_subn->sm_port_guid);
 
-	/* Set the send_set_reqs of the p_mgr to FALSE, and
-	   we'll see if any set requests were sent. If not -
-	   can signal OSM_SIGNAL_DONE */
-	p_mgr->send_set_reqs = FALSE;
-
 	p_port_guid_tbl = &p_mgr->p_subn->port_guid_tbl;
 
 	for (p_port = (osm_port_t *) cl_qmap_head(p_port_guid_tbl);
@@ -1286,36 +1198,30 @@ osm_signal_t osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * const p_mgr)
 		/*
 		   get the port lid range - we need to send it on first active
 		   sweep or if there was a change (the result of
-		   __osm_lid_mgr_get_port_lid)
+		   lid_mgr_get_port_lid)
 		 */
-		lid_changed =
-		    __osm_lid_mgr_get_port_lid(p_mgr, p_port, &min_lid_ho,
-					       &max_lid_ho);
+		lid_changed = lid_mgr_get_port_lid(p_mgr, p_port,
+						   &min_lid_ho, &max_lid_ho);
 
 		/* we can call the function to update the port info as it known
 		   to look for any field change and will only send an updated
 		   if required */
 		OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE,
-			"Assigned port 0x%016" PRIx64
-			", LID [%u,%u]\n", cl_ntoh64(port_guid),
+			"Assigned port 0x%016" PRIx64 ", %s LID [%u,%u]\n",
+			cl_ntoh64(port_guid), lid_changed ? "new" : "",
 			min_lid_ho, max_lid_ho);
 
 		/* the proc returns the fact it sent a set port info */
-		if (__osm_lid_mgr_set_physp_pi
-		    (p_mgr, p_port, p_port->p_physp, cl_hton16(min_lid_ho)))
-			p_mgr->send_set_reqs = TRUE;
+		if (lid_mgr_set_physp_pi(p_mgr, p_port, p_port->p_physp,
+					 cl_hton16(min_lid_ho)))
+			ret = -1;
 	}			/* all ports */
 
 	/* store the guid to lid table in persistent db */
 	osm_db_store(p_mgr->p_g2l);
 
-	if (p_mgr->send_set_reqs == FALSE)
-		signal = OSM_SIGNAL_DONE;
-	else
-		signal = OSM_SIGNAL_DONE_PENDING;
-
 	CL_PLOCK_RELEASE(p_mgr->p_lock);
 
 	OSM_LOG_EXIT(p_mgr->p_log);
-	return (signal);
+	return ret;
 }
diff --git a/opensm/osm_lin_fwd_rcv.c b/opensm/osm_lin_fwd_rcv.c
index c3d8633..f13b9a8 100644
--- a/opensm/osm_lin_fwd_rcv.c
+++ b/opensm/osm_lin_fwd_rcv.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -36,7 +37,7 @@
 /*
  * Abstract:
  *    Implementation of osm_lft_rcv_t.
- * This object represents the NodeDescription Receiver object.
+ * This object represents the Linear Forwarding Table Receiver object.
  * This object is part of the opensm family of objects.
  */
 
@@ -46,11 +47,11 @@
 
 #include <string.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_LIN_FWD_RCV_C
 #include <opensm/osm_switch.h>
 #include <opensm/osm_sm.h>
 
-/**********************************************************************
- **********************************************************************/
 void osm_lft_rcv_process(IN void *context, IN void *data)
 {
 	osm_sm_t *sm = context;
@@ -70,7 +71,7 @@ void osm_lft_rcv_process(IN void *context, IN void *data)
 	CL_ASSERT(p_madw);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_block = (uint8_t *) ib_smp_get_payload_ptr(p_smp);
+	p_block = ib_smp_get_payload_ptr(p_smp);
 	block_num = cl_ntoh32(p_smp->attr_mod);
 
 	/*
@@ -91,8 +92,9 @@ void osm_lft_rcv_process(IN void *context, IN void *data)
 		if (status != IB_SUCCESS) {
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0402: "
 				"Setting forwarding table block failed (%s)"
-				"\n\t\t\t\tSwitch 0x%" PRIx64 "\n",
-				ib_get_err_str(status), cl_ntoh64(node_guid));
+				", Switch 0x%" PRIx64 " %s\n",
+				ib_get_err_str(status), cl_ntoh64(node_guid),
+				p_sw->p_node->print_desc);
 		}
 	}
 
diff --git a/opensm/osm_link_mgr.c b/opensm/osm_link_mgr.c
index 37e3e1b..5271d59 100644
--- a/opensm/osm_link_mgr.c
+++ b/opensm/osm_link_mgr.c
@@ -1,7 +1,9 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2009-2011 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -46,43 +48,79 @@
 #include <string.h>
 #include <iba/ib_types.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_LINK_MGR_C
 #include <opensm/osm_sm.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_msgdef.h>
+#include <opensm/osm_opensm.h>
+#include <opensm/osm_db_pack.h>
 
-/**********************************************************************
- **********************************************************************/
-static boolean_t
-__osm_link_mgr_set_physp_pi(osm_sm_t * sm,
-			    IN osm_physp_t * const p_physp,
-			    IN uint8_t const port_state)
+static uint8_t link_mgr_get_smsl(IN osm_sm_t * sm, IN osm_physp_t * p_physp)
 {
-	uint8_t payload[IB_SMP_DATA_SIZE];
-	ib_port_info_t *const p_pi = (ib_port_info_t *) payload;
+	osm_opensm_t *p_osm = sm->p_subn->p_osm;
+	struct osm_routing_engine *re = p_osm->routing_engine_used;
+	ib_net16_t slid;
+	ib_net16_t smlid;
+	uint8_t sl;
+
+	OSM_LOG_ENTER(sm->p_log);
+
+	if (!(re && re->path_sl &&
+	      (slid = osm_physp_get_base_lid(p_physp)))) {
+		/*
+		 * Use default SL if routing engine does not provide a
+		 * path SL lookup callback.
+		 */
+		OSM_LOG_EXIT(sm->p_log);
+		return sm->p_subn->opt.sm_sl;
+	}
+
+	smlid = sm->p_subn->sm_base_lid;
+
+	/* Call into routing engine to find proper SL */
+	sl = re->path_sl(re->context, sm->p_subn->opt.sm_sl,
+			 slid, smlid);
+
+	OSM_LOG_EXIT(sm->p_log);
+	return sl;
+}
+
+static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
+				 IN uint8_t port_state)
+{
+	uint8_t payload[IB_SMP_DATA_SIZE], payload2[IB_SMP_DATA_SIZE];
+	ib_port_info_t *p_pi = (ib_port_info_t *) payload;
+	ib_mlnx_ext_port_info_t *p_epi = (ib_mlnx_ext_port_info_t *) payload2;
 	const ib_port_info_t *p_old_pi;
+	const ib_mlnx_ext_port_info_t *p_old_epi;
 	osm_madw_context_t context;
 	osm_node_t *p_node;
 	ib_api_status_t status;
-	uint8_t port_num;
-	uint8_t mtu;
-	uint8_t op_vls;
-	boolean_t esp0 = FALSE;
-	boolean_t send_set = FALSE;
-	osm_physp_t *p_remote_physp;
+	uint8_t port_num, mtu, op_vls, smsl = OSM_DEFAULT_SL;
+	boolean_t esp0 = FALSE, send_set = FALSE, send_set2 = FALSE;
+	osm_physp_t *p_remote_physp, *physp0;
+	int qdr_change = 0, fdr10_change = 0;
+	int ret = 0;
+	ib_net32_t attr_mod, cap_mask;
+	boolean_t update_mkey = FALSE;
 
 	OSM_LOG_ENTER(sm->p_log);
 
 	p_node = osm_physp_get_node_ptr(p_physp);
 
+	p_old_pi = &p_physp->port_info;
+
 	port_num = osm_physp_get_port_num(p_physp);
 
 	if (port_num == 0) {
 		/*
 		   CAs don't have a port 0, and for switch port 0,
 		   we need to check if this is enhanced or base port 0.
-		   For base port 0 the following parameters are not valid (p822, table 145).
+		   For base port 0 the following parameters are not valid
+		   (IBA 1.2.1 p.830 table 146).
 		 */
 		if (!p_node->sw) {
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4201: "
@@ -93,23 +131,32 @@ __osm_link_mgr_set_physp_pi(osm_sm_t * sm,
 
 		if (ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info)
 		    == FALSE) {
-			/* This means the switch doesn't support enhanced port 0.
-			   Can skip it. */
-			OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-				"Skipping port 0, GUID 0x%016" PRIx64 "\n",
-				cl_ntoh64(osm_physp_get_port_guid(p_physp)));
-			goto Exit;
-		}
-		esp0 = TRUE;
-	}
 
-	/*
-	   PAST THIS POINT WE ARE HANDLING EITHER A NON PORT 0 OR ENHANCED PORT 0
-	 */
-
-	p_old_pi = &p_physp->port_info;
+			/* Even for base port 0 we might have to set smsl
+			   (if we are using lash routing) */
+			smsl = link_mgr_get_smsl(sm, p_physp);
+			if (smsl != ib_port_info_get_master_smsl(p_old_pi)) {
+				send_set = TRUE;
+				OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
+					"Setting SMSL to %d on port 0 GUID 0x%016"
+					PRIx64 "\n", smsl,
+					cl_ntoh64(osm_physp_get_port_guid
+						  (p_physp)));
+			} else {
+				/* This means the switch doesn't support
+				   enhanced port 0 and we don't need to
+				   change SMSL. Can skip it. */
+				OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
+					"Skipping port 0, GUID 0x%016" PRIx64
+					"\n",
+					cl_ntoh64(osm_physp_get_port_guid
+						  (p_physp)));
+				goto Exit;
+			}
+		} else
+			esp0 = TRUE;
+	}
 
-	memset(payload, 0, IB_SMP_DATA_SIZE);
 	memcpy(payload, p_old_pi, sizeof(ib_port_info_t));
 
 	/*
@@ -124,6 +171,16 @@ __osm_link_mgr_set_physp_pi(osm_sm_t * sm,
 	p_pi->state_info2 = 0x02;
 	ib_port_info_set_port_state(p_pi, port_state);
 
+	/* Check whether this is base port0 smsl handling only */
+	if (port_num == 0 && esp0 == FALSE) {
+		ib_port_info_set_master_smsl(p_pi, smsl);
+		goto Send;
+	}
+
+	/*
+	   PAST THIS POINT WE ARE HANDLING EITHER A NON PORT 0 OR ENHANCED PORT 0
+	 */
+
 	if (ib_port_info_get_link_down_def_state(p_pi) !=
 	    ib_port_info_get_link_down_def_state(p_old_pi))
 		send_set = TRUE;
@@ -139,8 +196,10 @@ __osm_link_mgr_set_physp_pi(osm_sm_t * sm,
 		    port_num == 0) {
 			p_pi->m_key = sm->p_subn->opt.m_key;
 			if (memcmp(&p_pi->m_key, &p_old_pi->m_key,
-				   sizeof(p_pi->m_key)))
+				   sizeof(p_pi->m_key))) {
+				update_mkey = TRUE;
 				send_set = TRUE;
+			}
 
 			p_pi->subnet_prefix = sm->p_subn->opt.subnet_prefix;
 			if (memcmp(&p_pi->subnet_prefix,
@@ -160,6 +219,20 @@ __osm_link_mgr_set_physp_pi(osm_sm_t * sm,
 				   sizeof(p_pi->master_sm_base_lid)))
 				send_set = TRUE;
 
+			smsl = link_mgr_get_smsl(sm, p_physp);
+			if (smsl != ib_port_info_get_master_smsl(p_old_pi)) {
+
+				ib_port_info_set_master_smsl(p_pi, smsl);
+
+				OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
+					"Setting SMSL to %d on GUID 0x%016"
+					PRIx64 ", port %d\n", smsl,
+					cl_ntoh64(osm_physp_get_port_guid
+						  (p_physp)), port_num);
+
+				send_set = TRUE;
+			}
+
 			p_pi->m_key_lease_period =
 			    sm->p_subn->opt.m_key_lease_period;
 			if (memcmp(&p_pi->m_key_lease_period,
@@ -167,16 +240,14 @@ __osm_link_mgr_set_physp_pi(osm_sm_t * sm,
 				   sizeof(p_pi->m_key_lease_period)))
 				send_set = TRUE;
 
-			if (esp0 == FALSE)
-				p_pi->mkey_lmc = sm->p_subn->opt.lmc;
-			else {
-				if (sm->p_subn->opt.lmc_esp0)
-					p_pi->mkey_lmc = sm->p_subn->opt.lmc;
-				else
-					p_pi->mkey_lmc = 0;
-			}
-			if (memcmp(&p_pi->mkey_lmc, &p_old_pi->mkey_lmc,
-				   sizeof(p_pi->mkey_lmc)))
+			p_pi->mkey_lmc = 0;
+			ib_port_info_set_mpb(p_pi, sm->p_subn->opt.m_key_protect_bits);
+			if (esp0 == FALSE || sm->p_subn->opt.lmc_esp0)
+				ib_port_info_set_lmc(p_pi, sm->p_subn->opt.lmc);
+			if (ib_port_info_get_lmc(p_old_pi) !=
+			    ib_port_info_get_lmc(p_pi) ||
+			    ib_port_info_get_mpb(p_old_pi) !=
+			    ib_port_info_get_mpb(p_pi))
 				send_set = TRUE;
 
 			ib_port_info_set_timeout(p_pi,
@@ -263,14 +334,84 @@ __osm_link_mgr_set_physp_pi(osm_sm_t * sm,
 							    sm->p_subn->opt.
 							    force_link_speed);
 			if (memcmp(&p_pi->link_speed, &p_old_pi->link_speed,
-				   sizeof(p_pi->link_speed)))
+				   sizeof(p_pi->link_speed))) {
 				send_set = TRUE;
+				/* Determine whether QDR in LSE is being changed */
+				if ((ib_port_info_get_link_speed_enabled(p_pi) &
+				     IB_LINK_SPEED_ACTIVE_10 &&
+				     !(ib_port_info_get_link_speed_enabled(p_old_pi) &
+				      IB_LINK_SPEED_ACTIVE_10)) ||
+				    ((!(ib_port_info_get_link_speed_enabled(p_pi) &
+				       IB_LINK_SPEED_ACTIVE_10) &&
+				      ib_port_info_get_link_speed_enabled(p_old_pi) &
+				      IB_LINK_SPEED_ACTIVE_10)))
+				qdr_change = 1;
+			}
+		}
+
+		if (sm->p_subn->opt.fdr10 &&
+		    p_physp->ext_port_info.link_speed_supported & FDR10) {
+			if (sm->p_subn->opt.fdr10 == 1) { /* enable */
+				if (!(p_physp->ext_port_info.link_speed_enabled & FDR10))
+					fdr10_change = 1;
+			} else {	/* disable */
+				if (p_physp->ext_port_info.link_speed_enabled & FDR10)
+					fdr10_change = 1;
+			}
+			if (fdr10_change) {
+				p_old_epi = &p_physp->ext_port_info;
+				memcpy(payload2, p_old_epi,
+				       sizeof(ib_mlnx_ext_port_info_t));
+				p_epi->state_change_enable = 0x01;
+				if (sm->p_subn->opt.fdr10 == 1)
+					p_epi->link_speed_enabled = FDR10;
+				else
+					p_epi->link_speed_enabled = 0;
+				send_set2 = TRUE;
+			}
+		}
+
+		if (osm_node_get_type(p_physp->p_node) == IB_NODE_TYPE_SWITCH) {
+			physp0 = osm_node_get_physp_ptr(p_physp->p_node, 0);
+			cap_mask = physp0->port_info.capability_mask;
+		} else
+			cap_mask = p_pi->capability_mask;
+		if (!(cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS))
+			qdr_change = 0;
+
+		/* Do peer ports support extended link speeds ? */
+		if (port_num != 0 && p_remote_physp) {
+			osm_physp_t *rphysp0;
+			ib_net32_t rem_cap_mask;
+
+			if (osm_node_get_type(p_remote_physp->p_node) ==
+			    IB_NODE_TYPE_SWITCH) {
+				rphysp0 = osm_node_get_physp_ptr(p_remote_physp->p_node, 0);
+				rem_cap_mask = rphysp0->port_info.capability_mask;
+			} else
+				rem_cap_mask = p_remote_physp->port_info.capability_mask;
+
+			if (cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS &&
+			    rem_cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) {
+				if (sm->p_subn->opt.force_link_speed_ext &&
+				    (sm->p_subn->opt.force_link_speed_ext != IB_LINK_SPEED_EXT_SET_LSES ||
+				     p_pi->link_speed_ext_enabled !=
+				     ib_port_info_get_link_speed_ext_sup(p_pi))) {
+					p_pi->link_speed_ext_enabled = sm->p_subn->opt.force_link_speed_ext;
+					if (memcmp(&p_pi->link_speed_ext_enabled,
+						   &p_old_pi->link_speed_ext_enabled,
+						   sizeof(p_pi->link_speed_ext_enabled)))
+						send_set = TRUE;
+				}
+			}
 		}
 
 		/* calc new op_vls and mtu */
 		op_vls =
-		    osm_physp_calc_link_op_vls(sm->p_log, sm->p_subn, p_physp);
-		mtu = osm_physp_calc_link_mtu(sm->p_log, p_physp);
+		    osm_physp_calc_link_op_vls(sm->p_log, sm->p_subn, p_physp,
+					       ib_port_info_get_op_vls(p_old_pi));
+		mtu = osm_physp_calc_link_mtu(sm->p_log, p_physp,
+					      ib_port_info_get_neighbor_mtu(p_old_pi));
 
 		ib_port_info_set_neighbor_mtu(p_pi, mtu);
 		if (ib_port_info_get_neighbor_mtu(p_pi) !=
@@ -290,6 +431,7 @@ __osm_link_mgr_set_physp_pi(osm_sm_t * sm,
 		}
 	}
 
+Send:
 	if (port_state != IB_LINK_NO_CHANGE &&
 	    port_state != ib_port_info_get_port_state(p_old_pi)) {
 		send_set = TRUE;
@@ -316,30 +458,48 @@ __osm_link_mgr_set_physp_pi(osm_sm_t * sm,
 	    && sm->p_subn->first_time_master_sweep == TRUE)
 		send_set = TRUE;
 
-	if (send_set)
+	if (!send_set)
+		goto Exit;
+
+	attr_mod = cl_hton32(port_num);
+	if (qdr_change)
+		attr_mod |= cl_hton32(1 << 31);	/* AM SMSupportExtendedSpeeds */
+	status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p_physp),
+			     payload, sizeof(payload), IB_MAD_ATTR_PORT_INFO,
+			     attr_mod, CL_DISP_MSGID_NONE, &context);
+	if (status)
+		ret = -1;
+
+	/* If we sent a new mkey above, update our guid2mkey map
+	   now, on the assumption that the SubnSet succeeds
+	 */
+	if (update_mkey)
+		osm_db_guid2mkey_set(sm->p_subn->p_g2m,
+				     cl_ntoh64(p_physp->port_guid),
+				     cl_ntoh64(p_pi->m_key));
+
+	if (send_set2) {
 		status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p_physp),
-				     payload, sizeof(payload),
-				     IB_MAD_ATTR_PORT_INFO,
+				     payload2, sizeof(payload2),
+				     IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO,
 				     cl_hton32(port_num),
 				     CL_DISP_MSGID_NONE, &context);
+		if (status)
+			ret = -1;
+	}
 
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
-	return send_set;
+	return ret;
 }
 
-/**********************************************************************
- **********************************************************************/
-static osm_signal_t
-__osm_link_mgr_process_node(osm_sm_t * sm,
-			    IN osm_node_t * const p_node,
-			    IN const uint8_t link_state)
+static int link_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node,
+				 IN const uint8_t link_state)
 {
-	uint32_t i;
-	uint32_t num_physp;
-	osm_physp_t *p_physp;
+	osm_physp_t *p_physp, *p_physp_remote;
+	uint32_t i, num_physp;
+	int ret = 0;
 	uint8_t current_state;
-	osm_signal_t signal = OSM_SIGNAL_DONE;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -369,6 +529,19 @@ __osm_link_mgr_process_node(osm_sm_t * sm,
 			continue;
 
 		/*
+		    Set PortState to DOWN in case Remote Physical Port is
+		    unreachable. We have to check this for all ports, except
+		    port zero.
+		 */
+		p_physp_remote = osm_physp_get_remote(p_physp);
+		if ((i != 0) && (!p_physp_remote ||
+		    !osm_physp_is_valid(p_physp_remote))) {
+			if (current_state != IB_LINK_INIT)
+				link_mgr_set_physp_pi(sm, p_physp, IB_LINK_DOWN);
+			continue;
+		}
+
+		/*
 		   Normally we only send state update if state is lower
 		   then required state. However, we need to send update if
 		   no state change required.
@@ -379,21 +552,19 @@ __osm_link_mgr_process_node(osm_sm_t * sm,
 				"Physical port %u already %s. Skipping\n",
 				p_physp->port_num,
 				ib_get_port_state_str(current_state));
-		else if (__osm_link_mgr_set_physp_pi(sm, p_physp, link_state))
-			signal = OSM_SIGNAL_DONE_PENDING;
+		else if (link_mgr_set_physp_pi(sm, p_physp, link_state))
+			ret = -1;
 	}
 
 	OSM_LOG_EXIT(sm->p_log);
-	return (signal);
+	return ret;
 }
 
-/**********************************************************************
- **********************************************************************/
-osm_signal_t osm_link_mgr_process(osm_sm_t * sm, IN const uint8_t link_state)
+int osm_link_mgr_process(osm_sm_t * sm, IN const uint8_t link_state)
 {
 	cl_qmap_t *p_node_guid_tbl;
 	osm_node_t *p_node;
-	osm_signal_t signal = OSM_SIGNAL_DONE;
+	int ret = 0;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -403,14 +574,12 @@ osm_signal_t osm_link_mgr_process(osm_sm_t * sm, IN const uint8_t link_state)
 
 	for (p_node = (osm_node_t *) cl_qmap_head(p_node_guid_tbl);
 	     p_node != (osm_node_t *) cl_qmap_end(p_node_guid_tbl);
-	     p_node = (osm_node_t *) cl_qmap_next(&p_node->map_item)) {
-		if (__osm_link_mgr_process_node(sm, p_node, link_state) ==
-		    OSM_SIGNAL_DONE_PENDING)
-			signal = OSM_SIGNAL_DONE_PENDING;
-	}
+	     p_node = (osm_node_t *) cl_qmap_next(&p_node->map_item))
+		if (link_mgr_process_node(sm, p_node, link_state))
+			ret = -1;
 
 	CL_PLOCK_RELEASE(sm->p_lock);
 
 	OSM_LOG_EXIT(sm->p_log);
-	return (signal);
+	return ret;
 }
diff --git a/opensm/osm_log.c b/opensm/osm_log.c
index 88633ab..2b7efe6 100644
--- a/opensm/osm_log.c
+++ b/opensm/osm_log.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -44,6 +44,8 @@
 #  include <config.h>
 #endif				/* HAVE_CONFIG_H */
 
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_LOG_C
 #include <opensm/osm_log.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -55,7 +57,7 @@
 
 static int log_exit_count = 0;
 
-#ifndef WIN32
+#ifndef __WIN__
 #include <sys/time.h>
 #include <unistd.h>
 #include <complib/cl_timer.h>
@@ -76,11 +78,11 @@ static char *month_str[] = {
 };
 #else
 void OsmReportState(IN const char *p_str);
-#endif				/* ndef WIN32 */
+#endif				/* ndef __WIN__ */
 
-#ifndef WIN32
+#ifndef __WIN__
 
-static void truncate_log_file(osm_log_t * const p_log)
+static void truncate_log_file(osm_log_t * p_log)
 {
 	int fd = fileno(p_log->out_port);
 	if (ftruncate(fd, 0) < 0)
@@ -94,20 +96,26 @@ static void truncate_log_file(osm_log_t * const p_log)
 
 #else				/* Windows */
 
-static void truncate_log_file(osm_log_t * const p_log)
+static void truncate_log_file(osm_log_t * p_log)
 {
-	fprintf(stderr,
-		"truncate_log_file: cannot truncate on windows system (yet)\n");
+	int fd = _fileno(p_log->out_port);
+	HANDLE hFile = (HANDLE) _get_osfhandle(fd);
+
+	if (_lseek(fd, 0, SEEK_SET) < 0)
+		fprintf(stderr, "truncate_log_file: cannot rewind: %s\n",
+			strerror(errno));
+	SetEndOfFile(hFile);
+	p_log->count = 0;
 }
-#endif				/* ndef WIN32 */
+#endif				/* ndef __WIN__ */
 
-void osm_log(IN osm_log_t * const p_log,
-	     IN const osm_log_level_t verbosity, IN const char *p_str, ...)
+void osm_log(IN osm_log_t * p_log, IN osm_log_level_t verbosity,
+	     IN const char *p_str, ...)
 {
 	char buffer[LOG_ENTRY_SIZE_MAX];
 	va_list args;
 	int ret;
-#ifdef WIN32
+#ifdef __WIN__
 	SYSTEMTIME st;
 	uint32_t pid = GetCurrentThreadId();
 #else
@@ -116,14 +124,141 @@ void osm_log(IN osm_log_t * const p_log,
 	struct tm result;
 	uint64_t time_usecs;
 	uint32_t usecs;
-#endif				/* WIN32 */
+#endif				/* __WIN__ */
 
 	/* If this is a call to syslog - always print it */
-	if (!(verbosity & (OSM_LOG_SYS | p_log->level)))
+	if (!(verbosity & p_log->level))
 		return;
 
 	va_start(args, p_str);
-	vsprintf(buffer, p_str, args);
+#ifndef __WIN__
+	if (p_log->log_prefix == NULL)
+		vsprintf(buffer, p_str, args);
+	else {
+		int n = snprintf(buffer, sizeof(buffer), "%s: ", p_log->log_prefix);
+		vsprintf(buffer + n, p_str, args);
+	}
+#else
+	if (p_log->log_prefix == NULL)
+		_vsnprintf(buffer, 1024, (LPSTR)p_str, args);
+	else {
+		int n = snprintf(buffer, sizeof(buffer), "%s: ", p_log->log_prefix);
+		_vsnprintf(buffer + n, (1024 - n), (LPSTR)p_str, args);
+	}
+#endif
+	va_end(args);
+
+	/* this is a call to the syslog */
+	if (verbosity & OSM_LOG_SYS) {
+		syslog(LOG_INFO, "%s\n", buffer);
+
+		/* SYSLOG should go to stdout too */
+		if (p_log->out_port != stdout) {
+			printf("%s\n", buffer);
+			fflush(stdout);
+		}
+#ifdef __WIN__
+		OsmReportState(buffer);
+#endif				/* __WIN__ */
+	}
+
+	/* regular log to default out_port */
+	cl_spinlock_acquire(&p_log->lock);
+
+	if (p_log->max_size && p_log->count > p_log->max_size) {
+		/* truncate here */
+		fprintf(stderr,
+			"osm_log: log file exceeds the limit %lu. Truncating.\n",
+			p_log->max_size);
+		truncate_log_file(p_log);
+	}
+#ifdef __WIN__
+	GetLocalTime(&st);
+_retry:
+	ret =
+	    fprintf(p_log->out_port,
+		    "[%02d:%02d:%02d:%03d][%04X] 0x%02x -> %s",
+		    st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
+		    pid, verbosity, buffer);
+#else
+	time_usecs = cl_get_time_stamp();
+	tim = time_usecs / 1000000;
+	usecs = time_usecs % 1000000;
+	localtime_r(&tim, &result);
+	pid = pthread_self();
+_retry:
+	ret =
+	    fprintf(p_log->out_port,
+		    "%s %02d %02d:%02d:%02d %06d [%04X] 0x%02x -> %s",
+		    (result.tm_mon <
+		     12 ? month_str[result.tm_mon] : "???"),
+		    result.tm_mday, result.tm_hour, result.tm_min,
+		    result.tm_sec, usecs, pid, verbosity, buffer);
+#endif
+
+	/*  flush log */
+	if (ret > 0 &&
+	    (p_log->flush || (verbosity & (OSM_LOG_ERROR | OSM_LOG_SYS)))
+	    && fflush(p_log->out_port) < 0)
+		ret = -1;
+
+	if (ret >= 0) {
+		log_exit_count = 0;
+		p_log->count += ret;
+	} else if (log_exit_count < 3) {
+		log_exit_count++;
+		if (errno == ENOSPC && p_log->max_size) {
+			fprintf(stderr,
+				"osm_log: write failed: %s. Truncating log file.\n",
+				strerror(errno));
+			truncate_log_file(p_log);
+			goto _retry;
+		}
+		fprintf(stderr, "osm_log: write failed: %s\n", strerror(errno));
+	}
+
+	cl_spinlock_release(&p_log->lock);
+}
+
+void osm_log_v2(IN osm_log_t * p_log, IN osm_log_level_t verbosity,
+		IN const int file_id, IN const char *p_str, ...)
+{
+	char buffer[LOG_ENTRY_SIZE_MAX];
+	va_list args;
+	int ret;
+#ifdef __WIN__
+	SYSTEMTIME st;
+	uint32_t pid = GetCurrentThreadId();
+#else
+	pid_t pid = 0;
+	time_t tim;
+	struct tm result;
+	uint64_t time_usecs;
+	uint32_t usecs;
+#endif				/* __WIN__ */
+
+	/* If this is a call to syslog - always print it */
+	if (!(verbosity & p_log->level)) {
+		if (!(verbosity & p_log->per_mod_log_tbl[file_id]))
+			return;
+	}
+
+	va_start(args, p_str);
+#ifndef __WIN__
+	if (p_log->log_prefix == NULL)
+		vsprintf(buffer, p_str, args);
+	else {
+		int n = snprintf(buffer, sizeof(buffer), "%s: ", p_log->log_prefix);
+		vsprintf(buffer + n, p_str, args);
+	}
+#else
+	if (p_log->log_prefix == NULL)
+		_vsnprintf(buffer, 1024, (LPSTR)p_str, args);
+	else {
+		int n = snprintf(buffer, sizeof(buffer), "%s: ", p_log->log_prefix);
+		_vsnprintf(buffer + n, (1024 - n), (LPSTR)p_str, args);
+	}
+#endif
 	va_end(args);
 
 	/* this is a call to the syslog */
@@ -135,9 +270,9 @@ void osm_log(IN osm_log_t * const p_log,
 			printf("%s\n", buffer);
 			fflush(stdout);
 		}
-#ifdef WIN32
+#ifdef __WIN__
 		OsmReportState(buffer);
-#endif				/* WIN32 */
+#endif				/* __WIN__ */
 	}
 
 	/* regular log to default out_port */
@@ -150,7 +285,7 @@ void osm_log(IN osm_log_t * const p_log,
 			p_log->max_size);
 		truncate_log_file(p_log);
 	}
-#ifdef WIN32
+#ifdef __WIN__
 	GetLocalTime(&st);
 _retry:
 	ret =
@@ -198,8 +333,8 @@ _retry:
 	cl_spinlock_release(&p_log->lock);
 }
 
-void osm_log_raw(IN osm_log_t * const p_log,
-		 IN const osm_log_level_t verbosity, IN const char *p_buf)
+void osm_log_raw(IN osm_log_t * p_log, IN osm_log_level_t verbosity,
+		 IN const char *p_buf)
 {
 	if (p_log->level & verbosity) {
 		cl_spinlock_acquire(&p_log->lock);
@@ -241,6 +376,34 @@ void osm_log_msg_box(IN osm_log_t * log, osm_log_level_t level,
 		"*********************\n\n\n", func_name, buf);
 }
 
+void osm_log_msg_box_v2(IN osm_log_t * log, osm_log_level_t level,
+			const int file_id, const char *func_name,
+			const char *msg)
+{
+#define MSG_BOX_LENGTH 66
+	char buf[MSG_BOX_LENGTH + 1];
+	int i, n;
+
+	if (!osm_log_is_active_v2(log, level, file_id))
+		return;
+
+	n = (MSG_BOX_LENGTH - strlen(msg)) / 2 - 1;
+	if (n < 0)
+		n = 0;
+	for (i = 0; i < n; i++)
+		sprintf(buf + i, "*");
+	n += snprintf(buf + n, sizeof(buf) - n, " %s ", msg);
+	for (i = n; i < MSG_BOX_LENGTH; i++)
+		buf[i] = '*';
+	buf[i] = '\0';
+
+	osm_log_v2(log, level, file_id, "%s:\n\n\n"
+		   "*********************************************"
+		   "*********************\n%s\n"
+		   "*********************************************"
+		   "*********************\n\n\n", func_name, buf);
+}
+
 boolean_t osm_is_debug(void)
 {
 #if defined( _DEBUG_ )
@@ -296,19 +459,18 @@ int osm_log_reopen_file(osm_log_t * p_log)
 	return ret;
 }
 
-ib_api_status_t osm_log_init_v2(IN osm_log_t * const p_log,
-				IN const boolean_t flush,
-				IN const uint8_t log_flags,
-				IN const char *log_file,
-				IN const unsigned long max_size,
-				IN const boolean_t accum_log_file)
+ib_api_status_t osm_log_init_v2(IN osm_log_t * p_log, IN boolean_t flush,
+				IN uint8_t log_flags, IN const char *log_file,
+				IN unsigned long max_size,
+				IN boolean_t accum_log_file)
 {
-	p_log->level = log_flags;
+	p_log->level = log_flags | OSM_LOG_SYS;
 	p_log->flush = flush;
 	p_log->count = 0;
-	p_log->max_size = max_size;
+	p_log->max_size = max_size << 20; /* convert size in MB to bytes */
 	p_log->accum_log_file = accum_log_file;
 	p_log->log_file_name = (char *)log_file;
+	memset(p_log->per_mod_log_tbl, 0, sizeof(p_log->per_mod_log_tbl));
 
 	openlog("OpenSM", LOG_CONS | LOG_PID, LOG_USER);
 
@@ -326,12 +488,27 @@ ib_api_status_t osm_log_init_v2(IN osm_log_t * const p_log,
 		return IB_ERROR;
 }
 
-ib_api_status_t osm_log_init(IN osm_log_t * const p_log,
-			     IN const boolean_t flush,
-			     IN const uint8_t log_flags,
-			     IN const char *log_file,
-			     IN const boolean_t accum_log_file)
+ib_api_status_t osm_log_init(IN osm_log_t * p_log, IN boolean_t flush,
+			     IN uint8_t log_flags, IN const char *log_file,
+			     IN boolean_t accum_log_file)
 {
 	return osm_log_init_v2(p_log, flush, log_flags, log_file, 0,
 			       accum_log_file);
 }
+
+osm_log_level_t osm_get_log_per_module(IN osm_log_t * p_log,
+				       IN const int file_id)
+{
+	return p_log->per_mod_log_tbl[file_id];
+}
+
+void osm_set_log_per_module(IN osm_log_t * p_log, IN const int file_id,
+			    IN osm_log_level_t level)
+{
+	p_log->per_mod_log_tbl[file_id] = level;
+}
+
+void osm_reset_log_per_module(IN osm_log_t * p_log)
+{
+	memset(p_log->per_mod_log_tbl, 0, sizeof(p_log->per_mod_log_tbl));
+}
diff --git a/opensm/osm_mad_pool.c b/opensm/osm_mad_pool.c
index 56a2a6d..9bd9a4b 100644
--- a/opensm/osm_mad_pool.c
+++ b/opensm/osm_mad_pool.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -46,41 +46,35 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_MAD_POOL_C
 #include <opensm/osm_mad_pool.h>
 #include <opensm/osm_madw.h>
 #include <vendor/osm_vendor_api.h>
 
-/**********************************************************************
- **********************************************************************/
-void osm_mad_pool_construct(IN osm_mad_pool_t * const p_pool)
+void osm_mad_pool_construct(IN osm_mad_pool_t * p_pool)
 {
 	CL_ASSERT(p_pool);
 
 	memset(p_pool, 0, sizeof(*p_pool));
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_mad_pool_destroy(IN osm_mad_pool_t * const p_pool)
+void osm_mad_pool_destroy(IN osm_mad_pool_t * p_pool)
 {
 	CL_ASSERT(p_pool);
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t osm_mad_pool_init(IN osm_mad_pool_t * const p_pool)
+ib_api_status_t osm_mad_pool_init(IN osm_mad_pool_t * p_pool)
 {
 	p_pool->mads_out = 0;
 
 	return IB_SUCCESS;
 }
 
-/**********************************************************************
- **********************************************************************/
-osm_madw_t *osm_mad_pool_get(IN osm_mad_pool_t * const p_pool,
+osm_madw_t *osm_mad_pool_get(IN osm_mad_pool_t * p_pool,
 			     IN osm_bind_handle_t h_bind,
-			     IN const uint32_t total_size,
-			     IN const osm_mad_addr_t * const p_mad_addr)
+			     IN uint32_t total_size,
+			     IN const osm_mad_addr_t * p_mad_addr)
 {
 	osm_madw_t *p_madw;
 	ib_mad_t *p_mad;
@@ -118,13 +112,11 @@ Exit:
 	return p_madw;
 }
 
-/**********************************************************************
- **********************************************************************/
-osm_madw_t *osm_mad_pool_get_wrapper(IN osm_mad_pool_t * const p_pool,
+osm_madw_t *osm_mad_pool_get_wrapper(IN osm_mad_pool_t * p_pool,
 				     IN osm_bind_handle_t h_bind,
-				     IN const uint32_t total_size,
-				     IN const ib_mad_t * const p_mad,
-				     IN const osm_mad_addr_t * const p_mad_addr)
+				     IN uint32_t total_size,
+				     IN const ib_mad_t * p_mad,
+				     IN const osm_mad_addr_t * p_mad_addr)
 {
 	osm_madw_t *p_madw;
 
@@ -147,12 +139,10 @@ osm_madw_t *osm_mad_pool_get_wrapper(IN osm_mad_pool_t * const p_pool,
 	osm_madw_set_mad(p_madw, p_mad);
 
 Exit:
-	return (p_madw);
+	return p_madw;
 }
 
-/**********************************************************************
- **********************************************************************/
-osm_madw_t *osm_mad_pool_get_wrapper_raw(IN osm_mad_pool_t * const p_pool)
+osm_madw_t *osm_mad_pool_get_wrapper_raw(IN osm_mad_pool_t * p_pool)
 {
 	osm_madw_t *p_madw;
 
@@ -164,13 +154,10 @@ osm_madw_t *osm_mad_pool_get_wrapper_raw(IN osm_mad_pool_t * const p_pool)
 	osm_madw_set_mad(p_madw, 0);
 	cl_atomic_inc(&p_pool->mads_out);
 
-	return (p_madw);
+	return p_madw;
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_mad_pool_put(IN osm_mad_pool_t * const p_pool, IN osm_madw_t * const p_madw)
+void osm_mad_pool_put(IN osm_mad_pool_t * p_pool, IN osm_madw_t * p_madw)
 {
 	CL_ASSERT(p_madw);
 
diff --git a/opensm/osm_mcast_fwd_rcv.c b/opensm/osm_mcast_fwd_rcv.c
index 635c7da..d855cbb 100644
--- a/opensm/osm_mcast_fwd_rcv.c
+++ b/opensm/osm_mcast_fwd_rcv.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -49,14 +50,14 @@
 #include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_MCAST_FWD_RCV_C
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_subnet.h>
 #include <opensm/osm_sm.h>
 
-/**********************************************************************
- **********************************************************************/
 void osm_mft_rcv_process(IN void *context, IN void *data)
 {
 	osm_sm_t *sm = context;
@@ -77,7 +78,7 @@ void osm_mft_rcv_process(IN void *context, IN void *data)
 	CL_ASSERT(p_madw);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_block = (uint16_t *) ib_smp_get_payload_ptr(p_smp);
+	p_block = ib_smp_get_payload_ptr(p_smp);
 	block_num = cl_ntoh32(p_smp->attr_mod) & IB_MCAST_BLOCK_ID_MASK_HO;
 	position = (uint8_t) ((cl_ntoh32(p_smp->attr_mod) &
 			       IB_MCAST_POSITION_MASK_HO) >>
@@ -109,10 +110,10 @@ void osm_mft_rcv_process(IN void *context, IN void *data)
 		if (status != IB_SUCCESS) {
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0802: "
 				"Setting MFT block failed (%s)"
-				"\n\t\t\t\tSwitch 0x%016" PRIx64
-				", block %u, position %u\n",
-				ib_get_err_str(status),
-				cl_ntoh64(node_guid), block_num, position);
+				", Switch 0x%016" PRIx64
+				" (%s), block %u, position %u\n",
+				ib_get_err_str(status), cl_ntoh64(node_guid),
+				p_sw->p_node->print_desc, block_num, position);
 		}
 	}
 
diff --git a/opensm/osm_mcast_mgr.c b/opensm/osm_mcast_mgr.c
index 2f9cb5e..fea0a69 100644
--- a/opensm/osm_mcast_mgr.c
+++ b/opensm/osm_mcast_mgr.c
@@ -1,8 +1,10 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
+ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2010 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -48,6 +50,8 @@
 #include <string.h>
 #include <iba/ib_types.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_MCAST_MGR_C
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_sm.h>
 #include <opensm/osm_multicast.h>
@@ -56,21 +60,14 @@
 #include <opensm/osm_helper.h>
 #include <opensm/osm_msgdef.h>
 
-/**********************************************************************
- **********************************************************************/
 typedef struct osm_mcast_work_obj {
 	cl_list_item_t list_item;
 	osm_port_t *p_port;
+	cl_map_item_t map_item;
 } osm_mcast_work_obj_t;
 
-/**********************************************************************
- **********************************************************************/
-static osm_mcast_work_obj_t *__osm_mcast_work_obj_new(IN const osm_port_t *
-						      const p_port)
+static osm_mcast_work_obj_t *mcast_work_obj_new(IN osm_port_t * p_port)
 {
-	/*
-	   TO DO - get these objects from a lockpool.
-	 */
 	osm_mcast_work_obj_t *p_obj;
 
 	/*
@@ -81,169 +78,198 @@ static osm_mcast_work_obj_t *__osm_mcast_work_obj_new(IN const osm_port_t *
 	p_obj = malloc(sizeof(*p_obj));
 	if (p_obj) {
 		memset(p_obj, 0, sizeof(*p_obj));
-		p_obj->p_port = (osm_port_t *) p_port;
+		p_obj->p_port = p_port;
 	}
 
-	return (p_obj);
+	return p_obj;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void __osm_mcast_work_obj_delete(IN osm_mcast_work_obj_t * p_wobj)
+static void mcast_work_obj_delete(IN osm_mcast_work_obj_t * p_wobj)
 {
 	free(p_wobj);
 }
 
+static int make_port_list(cl_qlist_t * list, osm_mgrp_box_t * mbox)
+{
+	cl_qmap_t map;
+	cl_map_item_t *map_item;
+	cl_list_item_t *list_item;
+	osm_mgrp_t *mgrp;
+	osm_mcm_port_t *mcm_port;
+	osm_mcast_work_obj_t *wobj;
+
+	cl_qmap_init(&map);
+	cl_qlist_init(list);
+
+	for (list_item = cl_qlist_head(&mbox->mgrp_list);
+	     list_item != cl_qlist_end(&mbox->mgrp_list);
+	     list_item = cl_qlist_next(list_item)) {
+		mgrp = cl_item_obj(list_item, mgrp, list_item);
+		for (map_item = cl_qmap_head(&mgrp->mcm_port_tbl);
+		     map_item != cl_qmap_end(&mgrp->mcm_port_tbl);
+		     map_item = cl_qmap_next(map_item)) {
+			/* Acquire the port object for this port guid, then
+			   create the new worker object to build the list. */
+			mcm_port = cl_item_obj(map_item, mcm_port, map_item);
+			if (cl_qmap_get(&map, mcm_port->port->guid) !=
+			    cl_qmap_end(&map))
+				continue;
+			wobj = mcast_work_obj_new(mcm_port->port);
+			if (!wobj)
+				return -1;
+			cl_qlist_insert_tail(list, &wobj->list_item);
+			cl_qmap_insert(&map, mcm_port->port->guid,
+				       &wobj->map_item);
+		}
+	}
+	return 0;
+}
+
+static void drop_port_list(cl_qlist_t * list)
+{
+	while (cl_qlist_count(list))
+		mcast_work_obj_delete((osm_mcast_work_obj_t *)
+				      cl_qlist_remove_head(list));
+}
+
 /**********************************************************************
  Recursively remove nodes from the tree
  *********************************************************************/
-static void __osm_mcast_mgr_purge_tree_node(IN osm_mtree_node_t * p_mtn)
+static void mcast_mgr_purge_tree_node(IN osm_mtree_node_t * p_mtn)
 {
 	uint8_t i;
 
 	for (i = 0; i < p_mtn->max_children; i++) {
 		if (p_mtn->child_array[i] &&
 		    (p_mtn->child_array[i] != OSM_MTREE_LEAF))
-			__osm_mcast_mgr_purge_tree_node(p_mtn->child_array[i]);
-
+			mcast_mgr_purge_tree_node(p_mtn->child_array[i]);
 		p_mtn->child_array[i] = NULL;
-
 	}
 
 	free(p_mtn);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_mcast_mgr_purge_tree(osm_sm_t * sm, IN osm_mgrp_t * const p_mgrp)
+void osm_purge_mtree(osm_sm_t * sm, IN osm_mgrp_box_t * mbox)
 {
 	OSM_LOG_ENTER(sm->p_log);
 
-	if (p_mgrp->p_root)
-		__osm_mcast_mgr_purge_tree_node(p_mgrp->p_root);
-
-	p_mgrp->p_root = NULL;
+	if (mbox->root)
+		mcast_mgr_purge_tree_node(mbox->root);
+	mbox->root = NULL;
 
 	OSM_LOG_EXIT(sm->p_log);
 }
 
+static void create_mgrp_switch_map(cl_qmap_t * m, cl_qlist_t * port_list)
+{
+	osm_mcast_work_obj_t *wobj;
+	osm_port_t *port;
+	osm_switch_t *sw;
+	ib_net64_t guid;
+	cl_list_item_t *i;
+
+	cl_qmap_init(m);
+	for (i = cl_qlist_head(port_list); i != cl_qlist_end(port_list);
+	     i = cl_qlist_next(i)) {
+		wobj = cl_item_obj(i, wobj, list_item);
+		port = wobj->p_port;
+		if (port->p_node->sw) {
+			sw = port->p_node->sw;
+			sw->is_mc_member = 1;
+		} else {
+			sw = port->p_physp->p_remote_physp->p_node->sw;
+			sw->num_of_mcm++;
+		}
+		guid = osm_node_get_node_guid(sw->p_node);
+		if (cl_qmap_get(m, guid) == cl_qmap_end(m))
+			cl_qmap_insert(m, guid, &sw->mgrp_item);
+	}
+}
+
+static void destroy_mgrp_switch_map(cl_qmap_t * m)
+{
+	osm_switch_t *sw;
+	cl_map_item_t *i;
+
+	for (i = cl_qmap_head(m); i != cl_qmap_end(m); i = cl_qmap_next(i)) {
+		sw = cl_item_obj(i, sw, mgrp_item);
+		sw->num_of_mcm = 0;
+		sw->is_mc_member = 0;
+	}
+	cl_qmap_remove_all(m);
+}
+
 /**********************************************************************
+ Calculate the maximal "min hops" from the given switch to any
+ of the group HCAs
  **********************************************************************/
-static float
-osm_mcast_mgr_compute_avg_hops(osm_sm_t * sm,
-			       const osm_mgrp_t * const p_mgrp,
-			       const osm_switch_t * const p_sw)
+#ifdef OSM_VENDOR_INTF_ANAFA
+static float mcast_mgr_compute_avg_hops(osm_sm_t * sm, cl_qmap_t * m,
+					const osm_switch_t * this_sw)
 {
 	float avg_hops = 0;
 	uint32_t hops = 0;
 	uint32_t num_ports = 0;
-	const osm_port_t *p_port;
-	const osm_mcm_port_t *p_mcm_port;
-	const cl_qmap_t *p_mcm_tbl;
+	uint16_t lid;
+	uint32_t least_hops;
+	cl_map_item_t *i;
+	osm_switch_t *sw;
 
 	OSM_LOG_ENTER(sm->p_log);
 
-	p_mcm_tbl = &p_mgrp->mcm_port_tbl;
-
-	/*
-	   For each member of the multicast group, compute the
-	   number of hops to its base LID.
-	 */
-	for (p_mcm_port = (osm_mcm_port_t *) cl_qmap_head(p_mcm_tbl);
-	     p_mcm_port != (osm_mcm_port_t *) cl_qmap_end(p_mcm_tbl);
-	     p_mcm_port =
-	     (osm_mcm_port_t *) cl_qmap_next(&p_mcm_port->map_item)) {
-		/*
-		   Acquire the port object for this port guid, then create
-		   the new worker object to build the list.
-		 */
-		p_port = osm_get_port_by_guid(sm->p_subn,
-					      ib_gid_get_guid(&p_mcm_port->
-							      port_gid));
-
-		if (!p_port) {
-			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A18: "
-				"No port object for port 0x%016" PRIx64 "\n",
-				cl_ntoh64(ib_gid_get_guid
-					  (&p_mcm_port->port_gid)));
-			continue;
-		}
-
-		hops += osm_switch_get_port_least_hops(p_sw, p_port);
-		num_ports++;
+	for (i = cl_qmap_head(m); i != cl_qmap_end(m); i = cl_qmap_next(i)) {
+		sw = cl_item_obj(i, sw, mcast_item);
+		lid = cl_ntoh16(osm_node_get_base_lid(sw->p_node, 0));
+		least_hops = osm_switch_get_least_hops(this_sw, lid);
+		/* for all host that are MC members and attached to the switch,
+		   we should add the (least_hops + 1) * number_of_such_hosts.
+		   If switch itself is in the MC, we should add the least_hops only */
+		hops += (least_hops + 1) * sw->num_of_mcm +
+		    least_hops * sw->is_mc_member;
+		num_ports += sw->num_of_mcm + sw->is_mc_member;
 	}
 
-	/*
-	   We should be here if there aren't any ports in the group.
-	 */
+	/* We shouldn't be here if there aren't any ports in the group. */
 	CL_ASSERT(num_ports);
 
-	if (num_ports != 0)
-		avg_hops = (float)(hops / num_ports);
+	avg_hops = (float)(hops / num_ports);
 
 	OSM_LOG_EXIT(sm->p_log);
-	return (avg_hops);
+	return avg_hops;
 }
-
-/**********************************************************************
- Calculate the maximal "min hops" from the given switch to any
- of the group HCAs
- **********************************************************************/
-static float
-osm_mcast_mgr_compute_max_hops(osm_sm_t * sm,
-			       const osm_mgrp_t * const p_mgrp,
-			       const osm_switch_t * const p_sw)
+#else
+static float mcast_mgr_compute_max_hops(osm_sm_t * sm, cl_qmap_t * m,
+					const osm_switch_t * this_sw)
 {
-	uint32_t max_hops = 0;
-	uint32_t hops = 0;
-	const osm_port_t *p_port;
-	const osm_mcm_port_t *p_mcm_port;
-	const cl_qmap_t *p_mcm_tbl;
+	uint32_t max_hops = 0, hops;
+	uint16_t lid;
+	cl_map_item_t *i;
+	osm_switch_t *sw;
 
 	OSM_LOG_ENTER(sm->p_log);
 
-	p_mcm_tbl = &p_mgrp->mcm_port_tbl;
-
 	/*
 	   For each member of the multicast group, compute the
 	   number of hops to its base LID.
 	 */
-	for (p_mcm_port = (osm_mcm_port_t *) cl_qmap_head(p_mcm_tbl);
-	     p_mcm_port != (osm_mcm_port_t *) cl_qmap_end(p_mcm_tbl);
-	     p_mcm_port =
-	     (osm_mcm_port_t *) cl_qmap_next(&p_mcm_port->map_item)) {
-		/*
-		   Acquire the port object for this port guid, then create
-		   the new worker object to build the list.
-		 */
-		p_port = osm_get_port_by_guid(sm->p_subn,
-					      ib_gid_get_guid(&p_mcm_port->
-							      port_gid));
-
-		if (!p_port) {
-			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A1A: "
-				"No port object for port 0x%016" PRIx64 "\n",
-				cl_ntoh64(ib_gid_get_guid
-					  (&p_mcm_port->port_gid)));
-			continue;
-		}
-
-		hops = osm_switch_get_port_least_hops(p_sw, p_port);
+	for (i = cl_qmap_head(m); i != cl_qmap_end(m); i = cl_qmap_next(i)) {
+		sw = cl_item_obj(i, sw, mgrp_item);
+		lid = cl_ntoh16(osm_node_get_base_lid(sw->p_node, 0));
+		hops = osm_switch_get_least_hops(this_sw, lid);
+		if (!sw->is_mc_member)
+			hops += 1;
 		if (hops > max_hops)
 			max_hops = hops;
 	}
 
-	if (max_hops == 0) {
-		/*
-		   We should be here if there aren't any ports in the group.
-		 */
-		max_hops = 10001;	/* see later - we use it to realize no hops */
-	}
+	/* Note that at this point we might get (max_hops == 0),
+	   which means that there's only one member in the mcast
+	   group, and it's the current switch */
 
 	OSM_LOG_EXIT(sm->p_log);
-	return (float)(max_hops);
+	return (float)max_hops;
 }
+#endif
 
 /**********************************************************************
    This function attempts to locate the optimal switch for the
@@ -251,37 +277,31 @@ osm_mcast_mgr_compute_max_hops(osm_sm_t * sm,
    a switch with the lowest average hop count to the members
    of the multicast group.
 **********************************************************************/
-static osm_switch_t *__osm_mcast_mgr_find_optimal_switch(osm_sm_t * sm,
-							 const osm_mgrp_t *
-							 const p_mgrp)
+static osm_switch_t *mcast_mgr_find_optimal_switch(osm_sm_t * sm,
+						   cl_qlist_t * list)
 {
+	cl_qmap_t mgrp_sw_map;
 	cl_qmap_t *p_sw_tbl;
-	const osm_switch_t *p_sw;
-	const osm_switch_t *p_best_sw = NULL;
+	osm_switch_t *p_sw, *p_best_sw = NULL;
 	float hops = 0;
 	float best_hops = 10000;	/* any big # will do */
-#ifdef OSM_VENDOR_INTF_ANAFA
-	boolean_t use_avg_hops = TRUE;	/* anafa2 - bug hca on switch *//* use max hops for root */
-#else
-	boolean_t use_avg_hops = FALSE;	/* use max hops for root */
-#endif
 
 	OSM_LOG_ENTER(sm->p_log);
 
 	p_sw_tbl = &sm->p_subn->sw_guid_tbl;
 
-	CL_ASSERT(!osm_mgrp_is_empty(p_mgrp));
-
+	create_mgrp_switch_map(&mgrp_sw_map, list);
 	for (p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);
 	     p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl);
 	     p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item)) {
 		if (!osm_switch_supports_mcast(p_sw))
 			continue;
 
-		if (use_avg_hops)
-			hops = osm_mcast_mgr_compute_avg_hops(sm, p_mgrp, p_sw);
-		else
-			hops = osm_mcast_mgr_compute_max_hops(sm, p_mgrp, p_sw);
+#ifdef OSM_VENDOR_INTF_ANAFA
+		hops = mcast_mgr_compute_avg_hops(sm, &mgrp_sw_map, p_sw);
+#else
+		hops = mcast_mgr_compute_max_hops(sm, &mgrp_sw_map, p_sw);
+#endif
 
 		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
 			"Switch 0x%016" PRIx64 ", hops = %f\n",
@@ -295,25 +315,24 @@ static osm_switch_t *__osm_mcast_mgr_find_optimal_switch(osm_sm_t * sm,
 
 	if (p_best_sw)
 		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-			"Best switch is 0x%" PRIx64 ", hops = %f\n",
+			"Best switch is 0x%" PRIx64 " (%s), hops = %f\n",
 			cl_ntoh64(osm_node_get_node_guid(p_best_sw->p_node)),
-			best_hops);
+			p_best_sw->p_node->print_desc, best_hops);
 	else
 		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 			"No multicast capable switches detected\n");
 
+	destroy_mgrp_switch_map(&mgrp_sw_map);
 	OSM_LOG_EXIT(sm->p_log);
-	return ((osm_switch_t *) p_best_sw);
+	return p_best_sw;
 }
 
 /**********************************************************************
-   This function returns the existing or optimal root swtich for the tree.
+   This function returns the existing or optimal root switch for the tree.
 **********************************************************************/
-static osm_switch_t *__osm_mcast_mgr_find_root_switch(osm_sm_t * sm,
-						      const osm_mgrp_t *
-						      const p_mgrp)
+static osm_switch_t *mcast_mgr_find_root_switch(osm_sm_t * sm, cl_qlist_t *list)
 {
-	const osm_switch_t *p_sw = NULL;
+	osm_switch_t *p_sw = NULL;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -323,28 +342,23 @@ static osm_switch_t *__osm_mcast_mgr_find_root_switch(osm_sm_t * sm,
 	   the root will be always on the first switch attached to it.
 	   - Very bad ...
 	 */
-	p_sw = __osm_mcast_mgr_find_optimal_switch(sm, p_mgrp);
+	p_sw = mcast_mgr_find_optimal_switch(sm, list);
 
 	OSM_LOG_EXIT(sm->p_log);
-	return ((osm_switch_t *) p_sw);
+	return p_sw;
 }
 
-/**********************************************************************
- **********************************************************************/
-static osm_signal_t
-__osm_mcast_mgr_set_tbl(osm_sm_t * sm, IN osm_switch_t * const p_sw)
+static int mcast_mgr_set_mft_block(osm_sm_t * sm, IN osm_switch_t * p_sw,
+				   uint32_t block_num, uint32_t position)
 {
 	osm_node_t *p_node;
 	osm_dr_path_t *p_path;
-	osm_madw_context_t mad_context;
+	osm_madw_context_t context;
 	ib_api_status_t status;
-	uint32_t block_id_ho = 0;
-	int16_t block_num = 0;
-	uint32_t position = 0;
-	uint32_t max_position;
+	uint32_t block_id_ho;
 	osm_mcast_tbl_t *p_tbl;
 	ib_net16_t block[IB_MCAST_BLOCK_SIZE];
-	osm_signal_t signal = OSM_SIGNAL_DONE;
+	int ret = 0;
 
 	CL_ASSERT(sm);
 
@@ -364,66 +378,53 @@ __osm_mcast_mgr_set_tbl(osm_sm_t * sm, IN osm_switch_t * const p_sw)
 	   configuration.
 	 */
 
-	mad_context.mft_context.node_guid = osm_node_get_node_guid(p_node);
-	mad_context.mft_context.set_method = TRUE;
+	context.mft_context.node_guid = osm_node_get_node_guid(p_node);
+	context.mft_context.set_method = TRUE;
 
 	p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
-	max_position = p_tbl->max_position;
-
-	while (osm_mcast_tbl_get_block(p_tbl, block_num,
-				       (uint8_t) position, block)) {
-		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-			"Writing MFT block 0x%X\n", block_id_ho);
 
+	if (osm_mcast_tbl_get_block(p_tbl, (uint16_t) block_num,
+				    (uint8_t) position, block)) {
 		block_id_ho = block_num + (position << 28);
 
+		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
+			"Writing MFT block %u position %u to switch 0x%" PRIx64
+			"\n", block_num, position,
+			cl_ntoh64(context.mft_context.node_guid));
+
 		status = osm_req_set(sm, p_path, (void *)block, sizeof(block),
 				     IB_MAD_ATTR_MCAST_FWD_TBL,
-				     cl_hton32(block_id_ho),
-				     CL_DISP_MSGID_NONE, &mad_context);
-
+				     cl_hton32(block_id_ho), CL_DISP_MSGID_NONE,
+				     &context);
 		if (status != IB_SUCCESS) {
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A02: "
-				"Sending multicast fwd. tbl. block failed (%s)\n",
-				ib_get_err_str(status));
-		}
-
-		signal = OSM_SIGNAL_DONE_PENDING;
-
-		if (++position > max_position) {
-			position = 0;
-			block_num++;
+				"Sending multicast fwd. tbl. block to %s failed (%s)\n",
+				p_node->print_desc, ib_get_err_str(status));
+			ret = -1;
 		}
 	}
 
 	OSM_LOG_EXIT(sm->p_log);
-	return (signal);
+	return ret;
 }
 
 /**********************************************************************
   This is part of the recursive function to compute the paths in the
-  spanning tree that eminate from this switch.  On input, the p_list
+  spanning tree that emanate from this switch.  On input, the p_list
   contains the group members that must be routed from this switch.
 **********************************************************************/
-static void
-__osm_mcast_mgr_subdivide(osm_sm_t * sm,
-			  osm_mgrp_t * const p_mgrp,
-			  osm_switch_t * const p_sw,
-			  cl_qlist_t * const p_list,
-			  cl_qlist_t * const list_array,
-			  uint8_t const array_size)
+static void mcast_mgr_subdivide(osm_sm_t * sm, uint16_t mlid_ho,
+				osm_switch_t * p_sw, cl_qlist_t * p_list,
+				cl_qlist_t * list_array, uint8_t array_size)
 {
 	uint8_t port_num;
-	uint16_t mlid_ho;
 	boolean_t ignore_existing;
 	osm_mcast_work_obj_t *p_wobj;
 
 	OSM_LOG_ENTER(sm->p_log);
 
-	mlid_ho = cl_ntoh16(osm_mgrp_get_mlid(p_mgrp));
-
 	/*
-	   For Multicast Groups, we want not to count on previous
+	   For Multicast Groups, we don't want to count on previous
 	   configurations - since we can easily generate a storm
 	   by loops.
 	 */
@@ -439,40 +440,36 @@ __osm_mcast_mgr_subdivide(osm_sm_t * sm,
 		port_num =
 		    osm_switch_recommend_mcast_path(p_sw, p_wobj->p_port,
 						    mlid_ho, ignore_existing);
-
 		if (port_num == OSM_NO_PATH) {
 			/*
 			   This typically occurs if the switch does not support
 			   multicast and the multicast tree must branch at this
 			   switch.
 			 */
-			uint64_t node_guid_ho =
-			    cl_ntoh64(osm_node_get_node_guid(p_sw->p_node));
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A03: "
 				"Error routing MLID 0x%X through switch 0x%"
-				PRIx64 "\n"
-				"\t\t\t\tNo multicast paths from this switch for port "
-				"with LID %u\n", mlid_ho, node_guid_ho,
+				PRIx64 " %s\n"
+				"\t\t\t\tNo multicast paths from this switch "
+				"for port with LID %u\n", mlid_ho,
+				cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)),
+				p_sw->p_node->print_desc,
 				cl_ntoh16(osm_port_get_base_lid
 					  (p_wobj->p_port)));
-
-			__osm_mcast_work_obj_delete(p_wobj);
+			mcast_work_obj_delete(p_wobj);
 			continue;
 		}
 
 		if (port_num > array_size) {
-			uint64_t node_guid_ho =
-			    cl_ntoh64(osm_node_get_node_guid(p_sw->p_node));
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A04: "
 				"Error routing MLID 0x%X through switch 0x%"
-				PRIx64 "\n"
-				"\t\t\t\tNo multicast paths from this switch to port "
-				"with LID %u\n", mlid_ho, node_guid_ho,
+				PRIx64 " %s\n"
+				"\t\t\t\tNo multicast paths from this switch "
+				"to port with LID %u\n", mlid_ho,
+				cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)),
+				p_sw->p_node->print_desc,
 				cl_ntoh16(osm_port_get_base_lid
 					  (p_wobj->p_port)));
-
-			__osm_mcast_work_obj_delete(p_wobj);
-
+			mcast_work_obj_delete(p_wobj);
 			/* This is means OpenSM has a bug. */
 			CL_ASSERT(FALSE);
 			continue;
@@ -484,23 +481,20 @@ __osm_mcast_mgr_subdivide(osm_sm_t * sm,
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void __osm_mcast_mgr_purge_list(osm_sm_t * sm, cl_qlist_t * const p_list)
+static void mcast_mgr_purge_list(osm_sm_t * sm, cl_qlist_t * list)
 {
-	osm_mcast_work_obj_t *p_wobj;
-
-	OSM_LOG_ENTER(sm->p_log);
-
-	while ((p_wobj = (osm_mcast_work_obj_t *) cl_qlist_remove_head(p_list))
-	       != (osm_mcast_work_obj_t *) cl_qlist_end(p_list)) {
-		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A06: "
-			"Unable to route for port 0x%" PRIx64 "\n",
-			osm_port_get_guid(p_wobj->p_port));
-		__osm_mcast_work_obj_delete(p_wobj);
+	if (OSM_LOG_IS_ACTIVE_V2(sm->p_log, OSM_LOG_ERROR)) {
+		osm_mcast_work_obj_t *wobj;
+		cl_list_item_t *i;
+		for (i = cl_qlist_head(list); i != cl_qlist_end(list);
+		     i = cl_qlist_next(i)) {
+			wobj = cl_item_obj(i, wobj, list_item);
+			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A06: "
+				"Unable to route for port 0x%" PRIx64 "\n",
+				osm_port_get_guid(wobj->p_port));
+		}
 	}
-
-	OSM_LOG_EXIT(sm->p_log);
+	drop_port_list(list);
 }
 
 /**********************************************************************
@@ -510,24 +504,20 @@ static void __osm_mcast_mgr_purge_list(osm_sm_t * sm, cl_qlist_t * const p_list)
 
   The function returns the newly created mtree node element.
 **********************************************************************/
-static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_sm_t * sm,
-						osm_mgrp_t * const p_mgrp,
-						osm_switch_t * const p_sw,
-						cl_qlist_t * const p_list,
-						uint8_t depth,
-						uint8_t const upstream_port,
-						uint8_t * const p_max_depth)
+static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, uint16_t mlid_ho,
+					  osm_switch_t * p_sw,
+					  cl_qlist_t * p_list, uint8_t depth,
+					  uint8_t upstream_port,
+					  uint8_t * p_max_depth)
 {
 	uint8_t max_children;
 	osm_mtree_node_t *p_mtn = NULL;
 	cl_qlist_t *list_array = NULL;
 	uint8_t i;
 	ib_net64_t node_guid;
-	uint64_t node_guid_ho;
 	osm_mcast_work_obj_t *p_wobj;
 	cl_qlist_t *p_port_list;
 	size_t count;
-	uint16_t mlid_ho;
 	osm_mcast_tbl_t *p_tbl;
 
 	OSM_LOG_ENTER(sm->p_log);
@@ -537,13 +527,12 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_sm_t * sm,
 	CL_ASSERT(p_max_depth);
 
 	node_guid = osm_node_get_node_guid(p_sw->p_node);
-	node_guid_ho = cl_ntoh64(node_guid);
-	mlid_ho = cl_ntoh16(osm_mgrp_get_mlid(p_mgrp));
 
 	OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 		"Routing MLID 0x%X through switch 0x%" PRIx64
-		", %u nodes at depth %u\n",
-		mlid_ho, node_guid_ho, cl_qlist_count(p_list), depth);
+		" %s, %u nodes at depth %u\n",
+		mlid_ho, cl_ntoh64(node_guid), p_sw->p_node->print_desc,
+		cl_qlist_count(p_list), depth);
 
 	CL_ASSERT(cl_qlist_count(p_list) > 0);
 
@@ -553,7 +542,7 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_sm_t * sm,
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
 			"Maximal hops number is reached for MLID 0x%x."
 			" Break processing.", mlid_ho);
-		__osm_mcast_mgr_purge_list(sm, p_list);
+		mcast_mgr_purge_list(sm, p_list);
 		goto Exit;
 	}
 
@@ -567,13 +556,13 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_sm_t * sm,
 		   This switch doesn't do multicast.  Clean-up.
 		 */
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A14: "
-			"Switch 0x%" PRIx64 " does not support multicast\n",
-			node_guid_ho);
+			"Switch 0x%" PRIx64 " %s does not support multicast\n",
+			cl_ntoh64(node_guid), p_sw->p_node->print_desc);
 
 		/*
 		   Deallocate all the work objects on this branch of the tree.
 		 */
-		__osm_mcast_mgr_purge_list(sm, p_list);
+		mcast_mgr_purge_list(sm, p_list);
 		goto Exit;
 	}
 
@@ -589,7 +578,7 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_sm_t * sm,
 		/*
 		   Deallocate all the work objects on this branch of the tree.
 		 */
-		__osm_mcast_mgr_purge_list(sm, p_list);
+		mcast_mgr_purge_list(sm, p_list);
 		goto Exit;
 	}
 
@@ -606,7 +595,9 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_sm_t * sm,
 	if (list_array == NULL) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A16: "
 			"Unable to allocate list array\n");
-		__osm_mcast_mgr_purge_list(sm, p_list);
+		mcast_mgr_purge_list(sm, p_list);
+		osm_mtree_destroy(p_mtn);
+		p_mtn = NULL;
 		goto Exit;
 	}
 
@@ -615,8 +606,7 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_sm_t * sm,
 	for (i = 0; i < max_children; i++)
 		cl_qlist_init(&list_array[i]);
 
-	__osm_mcast_mgr_subdivide(sm, p_mgrp, p_sw, p_list, list_array,
-				  max_children);
+	mcast_mgr_subdivide(sm, mlid_ho, p_sw, p_list, list_array, max_children);
 
 	p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
 
@@ -653,8 +643,8 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_sm_t * sm,
 		/*
 		   There should be no children routed through the upstream port!
 		 */
-		CL_ASSERT((upstream_port == 0) || (i != upstream_port) ||
-			  ((i == upstream_port) && (count == 0)));
+		CL_ASSERT(upstream_port == 0 || i != upstream_port ||
+			  (i == upstream_port && count == 0));
 
 		if (count == 0)
 			continue;	/* No routes down this port. */
@@ -671,13 +661,13 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_sm_t * sm,
 		osm_mcast_tbl_set(p_tbl, mlid_ho, i);
 		if (i == 0) {
 			/* This means we are adding the switch to the MC group.
-			   We do not need to continue looking at the remote port, just
-			   needed to add the port to the table */
+			   We do not need to continue looking at the remote
+			   port, just needed to add the port to the table */
 			CL_ASSERT(count == 1);
 
 			p_wobj = (osm_mcast_work_obj_t *)
 			    cl_qlist_remove_head(p_port_list);
-			__osm_mcast_work_obj_delete(p_wobj);
+			mcast_work_obj_delete(p_wobj);
 			continue;
 		}
 
@@ -699,12 +689,10 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_sm_t * sm,
 			CL_ASSERT(p_remote_physp);
 
 			p_mtn->child_array[i] =
-			    __osm_mcast_mgr_branch(sm, p_mgrp,
-						   p_remote_node->sw,
-						   p_port_list, depth,
-						   osm_physp_get_port_num
-						   (p_remote_physp),
-						   p_max_depth);
+			    mcast_mgr_branch(sm, mlid_ho, p_remote_node->sw,
+					     p_port_list, depth,
+					     osm_physp_get_port_num
+					     (p_remote_physp), p_max_depth);
 		} else {
 			/*
 			   The neighbor node is not a switch, so this
@@ -723,51 +711,49 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_sm_t * sm,
 				" on switch port %u\n",
 				cl_ntoh64(osm_port_get_guid(p_wobj->p_port)),
 				i);
-
-			__osm_mcast_work_obj_delete(p_wobj);
+			mcast_work_obj_delete(p_wobj);
 		}
 	}
 
 	free(list_array);
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
-	return (p_mtn);
+	return p_mtn;
 }
 
-/**********************************************************************
- **********************************************************************/
-static ib_api_status_t
-__osm_mcast_mgr_build_spanning_tree(osm_sm_t * sm, osm_mgrp_t * const p_mgrp)
+static ib_api_status_t mcast_mgr_build_spanning_tree(osm_sm_t * sm,
+						     osm_mgrp_box_t * mbox)
 {
-	const cl_qmap_t *p_mcm_tbl;
-	const osm_port_t *p_port;
-	const osm_mcm_port_t *p_mcm_port;
-	uint32_t num_ports;
 	cl_qlist_t port_list;
+	uint32_t num_ports;
 	osm_switch_t *p_sw;
-	osm_mcast_work_obj_t *p_wobj;
 	ib_api_status_t status = IB_SUCCESS;
 	uint8_t max_depth = 0;
-	uint32_t count;
 
 	OSM_LOG_ENTER(sm->p_log);
 
-	cl_qlist_init(&port_list);
-
 	/*
 	   TO DO - for now, just blow away the old tree.
 	   In the future we'll need to construct the tree based
 	   on multicast forwarding table information if the user wants to
 	   preserve existing multicast routes.
 	 */
-	__osm_mcast_mgr_purge_tree(sm, p_mgrp);
+	osm_purge_mtree(sm, mbox);
+
+	/* build the first "subset" containing all member ports */
+	if (make_port_list(&port_list, mbox)) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A10: "
+			"Insufficient memory to make port list\n");
+		status = IB_ERROR;
+		goto Exit;
+	}
 
-	p_mcm_tbl = &p_mgrp->mcm_port_tbl;
-	num_ports = cl_qmap_count(p_mcm_tbl);
-	if (num_ports == 0) {
+	num_ports = cl_qlist_count(&port_list);
+	if (num_ports < 2) {
 		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-			"MLID 0x%X has no members - nothing to do\n",
-			cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)));
+			"MLID 0x%X has %u members - nothing to do\n",
+			mbox->mlid, num_ports);
+		drop_port_list(&port_list);
 		goto Exit;
 	}
 
@@ -787,70 +773,31 @@ __osm_mcast_mgr_build_spanning_tree(osm_sm_t * sm, osm_mgrp_t * const p_mgrp)
 	   Locate the switch around which to create the spanning
 	   tree for this multicast group.
 	 */
-	p_sw = __osm_mcast_mgr_find_root_switch(sm, p_mgrp);
+	p_sw = mcast_mgr_find_root_switch(sm, &port_list);
 	if (p_sw == NULL) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A08: "
 			"Unable to locate a suitable switch for group 0x%X\n",
-			cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)));
+			mbox->mlid);
+		drop_port_list(&port_list);
 		status = IB_ERROR;
 		goto Exit;
 	}
 
-	/*
-	   Build the first "subset" containing all member ports.
-	 */
-	for (p_mcm_port = (osm_mcm_port_t *) cl_qmap_head(p_mcm_tbl);
-	     p_mcm_port != (osm_mcm_port_t *) cl_qmap_end(p_mcm_tbl);
-	     p_mcm_port =
-	     (osm_mcm_port_t *) cl_qmap_next(&p_mcm_port->map_item)) {
-		/*
-		   Acquire the port object for this port guid, then create
-		   the new worker object to build the list.
-		 */
-		p_port = osm_get_port_by_guid(sm->p_subn,
-					      ib_gid_get_guid(&p_mcm_port->
-							      port_gid));
-		if (!p_port) {
-			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A09: "
-				"No port object for port 0x%016" PRIx64 "\n",
-				cl_ntoh64(ib_gid_get_guid
-					  (&p_mcm_port->port_gid)));
-			continue;
-		}
-
-		p_wobj = __osm_mcast_work_obj_new(p_port);
-		if (p_wobj == NULL) {
-			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A10: "
-				"Insufficient memory to route port 0x%016"
-				PRIx64 "\n",
-				cl_ntoh64(osm_port_get_guid(p_port)));
-			continue;
-		}
-
-		cl_qlist_insert_tail(&port_list, &p_wobj->list_item);
-	}
-
-	count = cl_qlist_count(&port_list);
-	p_mgrp->p_root = __osm_mcast_mgr_branch(sm, p_mgrp, p_sw,
-						&port_list, 0, 0, &max_depth);
+	mbox->root = mcast_mgr_branch(sm, mbox->mlid, p_sw, &port_list, 0, 0,
+				      &max_depth);
 
 	OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 		"Configured MLID 0x%X for %u ports, max tree depth = %u\n",
-		cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)), count, max_depth);
-
+		mbox->mlid, num_ports, max_depth);
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
-	return (status);
+	return status;
 }
 
 #if 0
 /* unused */
-/**********************************************************************
- **********************************************************************/
-void
-osm_mcast_mgr_set_table(osm_sm_t * sm,
-			IN const osm_mgrp_t * const p_mgrp,
-			IN const osm_mtree_node_t * const p_mtn)
+void osm_mcast_mgr_set_table(osm_sm_t * sm, IN const osm_mgrp_t * p_mgrp,
+			     IN const osm_mtree_node_t * p_mtn)
 {
 	uint8_t i;
 	uint8_t max_children;
@@ -893,9 +840,7 @@ osm_mcast_mgr_set_table(osm_sm_t * sm,
 }
 #endif
 
-/**********************************************************************
- **********************************************************************/
-static void __osm_mcast_mgr_clear(osm_sm_t * sm, IN osm_mgrp_t * const p_mgrp)
+static void mcast_mgr_clear(osm_sm_t * sm, uint16_t mlid)
 {
 	osm_switch_t *p_sw;
 	cl_qmap_t *p_sw_tbl;
@@ -903,15 +848,12 @@ static void __osm_mcast_mgr_clear(osm_sm_t * sm, IN osm_mgrp_t * const p_mgrp)
 
 	OSM_LOG_ENTER(sm->p_log);
 
-	/*
-	   Walk the switches and clear the routing entries for
-	   this MLID.
-	 */
+	/* Walk the switches and clear the routing entries for this MLID. */
 	p_sw_tbl = &sm->p_subn->sw_guid_tbl;
 	p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);
 	while (p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl)) {
 		p_mcast_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
-		osm_mcast_tbl_clear_mlid(p_mcast_tbl, cl_ntoh16(p_mgrp->mlid));
+		osm_mcast_tbl_clear_mlid(p_mcast_tbl, mlid);
 		p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
 	}
 
@@ -923,11 +865,10 @@ static void __osm_mcast_mgr_clear(osm_sm_t * sm, IN osm_mgrp_t * const p_mgrp)
 /**********************************************************************
    Lock must be held on entry.
 **********************************************************************/
-ib_api_status_t
-osm_mcast_mgr_process_single(osm_sm_t * sm,
-			     IN ib_net16_t const mlid,
-			     IN ib_net64_t const port_guid,
-			     IN uint8_t const join_state)
+ib_api_status_t osm_mcast_mgr_process_single(osm_sm_t * sm,
+					     IN ib_net16_t const mlid,
+					     IN ib_net64_t const port_guid,
+					     IN uint8_t const join_state)
 {
 	uint8_t port_num;
 	uint16_t mlid_ho;
@@ -1038,230 +979,226 @@ osm_mcast_mgr_process_single(osm_sm_t * sm,
 
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
-	return (status);
+	return status;
 }
 #endif
 
 /**********************************************************************
-   lock must already be held on entry
-**********************************************************************/
-static ib_api_status_t
-osm_mcast_mgr_process_tree(osm_sm_t * sm,
-			   IN osm_mgrp_t * const p_mgrp,
-			   IN osm_mcast_req_type_t req_type,
-			   ib_net64_t port_guid)
+ Process the entire group.
+ NOTE : The lock should be held externally!
+ **********************************************************************/
+static ib_api_status_t mcast_mgr_process_mlid(osm_sm_t * sm, uint16_t mlid)
 {
 	ib_api_status_t status = IB_SUCCESS;
-	ib_net16_t mlid;
+	struct osm_routing_engine *re = sm->p_subn->p_osm->routing_engine_used;
+	osm_mgrp_box_t *mbox;
 
 	OSM_LOG_ENTER(sm->p_log);
 
-	mlid = osm_mgrp_get_mlid(p_mgrp);
-
 	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-		"Processing multicast group 0x%X\n", cl_ntoh16(mlid));
+		"Processing multicast group with lid 0x%X\n", mlid);
 
-	/*
-	   If there are no switches in the subnet, then we have nothing to do.
-	 */
-	if (cl_qmap_count(&sm->p_subn->sw_guid_tbl) == 0) {
-		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-			"No switches in subnet. Nothing to do\n");
-		goto Exit;
-	}
-
-	/*
-	   Clear the multicast tables to start clean, then build
+	/* Clear the multicast tables to start clean, then build
 	   the spanning tree which sets the mcast table bits for each
-	   port in the group.
-	 */
-	__osm_mcast_mgr_clear(sm, p_mgrp);
+	   port in the group. */
+	mcast_mgr_clear(sm, mlid);
 
-	if (!p_mgrp->full_members)
-		goto Exit;
+	mbox = osm_get_mbox_by_mlid(sm->p_subn, cl_hton16(mlid));
+	if (mbox) {
+		if (re && re->mcast_build_stree)
+			status = re->mcast_build_stree(re->context, mbox);
+		else
+			status = mcast_mgr_build_spanning_tree(sm, mbox);
 
-	status = __osm_mcast_mgr_build_spanning_tree(sm, p_mgrp);
-	if (status != IB_SUCCESS) {
-		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A17: "
-			"Unable to create spanning tree (%s)\n",
-			ib_get_err_str(status));
-		goto Exit;
+		if (status != IB_SUCCESS)
+			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A17: "
+				"Unable to create spanning tree (%s) for mlid "
+				"0x%x\n", ib_get_err_str(status), mlid);
 	}
 
-Exit:
 	OSM_LOG_EXIT(sm->p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- Process the entire group.
- NOTE : The lock should be held externally!
- **********************************************************************/
-static ib_api_status_t
-mcast_mgr_process_mgrp(osm_sm_t * sm,
-		       IN osm_mgrp_t * const p_mgrp,
-		       IN osm_mcast_req_type_t req_type,
-		       IN ib_net64_t port_guid)
+static void mcast_mgr_set_mfttop(IN osm_sm_t * sm, IN osm_switch_t * p_sw)
 {
+	osm_node_t *p_node;
+	osm_dr_path_t *p_path;
+	osm_physp_t *p_physp;
+	osm_mcast_tbl_t *p_tbl;
+	osm_madw_context_t context;
 	ib_api_status_t status;
+	ib_switch_info_t si;
+	ib_net16_t mcast_top;
 
 	OSM_LOG_ENTER(sm->p_log);
 
-	status = osm_mcast_mgr_process_tree(sm, p_mgrp, req_type, port_guid);
-	if (status != IB_SUCCESS) {
-		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A19: "
-			"Unable to create spanning tree (%s)\n",
-			ib_get_err_str(status));
-		goto Exit;
-	}
-	p_mgrp->last_tree_id = p_mgrp->last_change_id;
+	CL_ASSERT(p_sw);
 
-	/* remove MCGRP if it is marked for deletion */
-	if (p_mgrp->to_be_deleted) {
-		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-			"Destroying mgrp with lid:0x%x\n",
-			cl_ntoh16(p_mgrp->mlid));
-		sm->p_subn->mgroups[cl_ntoh16(p_mgrp->mlid) - IB_LID_MCAST_START_HO] = NULL;
-		osm_mgrp_delete(p_mgrp);
-	}
+	p_node = p_sw->p_node;
 
-Exit:
-	OSM_LOG_EXIT(sm->p_log);
-	return status;
-}
+	CL_ASSERT(p_node);
 
-/**********************************************************************
- **********************************************************************/
-osm_signal_t osm_mcast_mgr_process(osm_sm_t * sm)
-{
-	osm_signal_t signal;
-	osm_switch_t *p_sw;
-	cl_qmap_t *p_sw_tbl;
-	cl_qlist_t *p_list = &sm->mgrp_list;
-	osm_mgrp_t *p_mgrp;
-	boolean_t pending_transactions = FALSE;
-	int i;
+	p_physp = osm_node_get_physp_ptr(p_node, 0);
+	p_path = osm_physp_get_dr_path_ptr(p_physp);
+	p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
 
-	OSM_LOG_ENTER(sm->p_log);
+	if (sm->p_subn->opt.use_mfttop &&
+	    p_physp->port_info.capability_mask & IB_PORT_CAP_HAS_MCAST_FDB_TOP) {
+		/*
+		   Set the top of the multicast forwarding table.
+		 */
+		si = p_sw->switch_info;
+		if (sm->p_subn->first_time_master_sweep == TRUE)
+			mcast_top = cl_hton16(sm->mlids_init_max);
+		else {
+			if (p_tbl->max_block_in_use == -1)
+				mcast_top = cl_hton16(IB_LID_MCAST_START_HO - 1);
+			else
+				mcast_top = cl_hton16(IB_LID_MCAST_START_HO +
+						      (p_tbl->max_block_in_use + 1) * IB_MCAST_BLOCK_SIZE - 1);
+		}
+		if (mcast_top == si.mcast_top)
+			return;
 
-	p_sw_tbl = &sm->p_subn->sw_guid_tbl;
-	/*
-	   While holding the lock, iterate over all the established
-	   multicast groups, servicing each in turn.
+		si.mcast_top = mcast_top;
 
-	   Then, download the multicast tables to the switches.
-	 */
-	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
+		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
+			"Setting switch MFT top to MLID 0x%x\n",
+			cl_ntoh16(si.mcast_top));
 
-	for (i = 0; i <= sm->p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO;
-	     i++) {
-		/*
-		   We reached here due to some change that caused a heavy sweep
-		   of the subnet. Not due to a specific multicast request.
-		   So the request type is subnet_change and the port guid is 0.
-		 */
-		p_mgrp = sm->p_subn->mgroups[i];
-		if (p_mgrp)
-			mcast_mgr_process_mgrp(sm, p_mgrp,
-					       OSM_MCAST_REQ_TYPE_SUBNET_CHANGE,
-					       0);
+		context.si_context.light_sweep = FALSE;
+		context.si_context.node_guid = osm_node_get_node_guid(p_node);
+		context.si_context.set_method = TRUE;
+
+		status = osm_req_set(sm, p_path, (uint8_t *) & si,
+				     sizeof(si), IB_MAD_ATTR_SWITCH_INFO,
+				     0, CL_DISP_MSGID_NONE, &context);
+
+		if (status != IB_SUCCESS)
+			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A1B: "
+				"Sending SwitchInfo attribute failed (%s)\n",
+				ib_get_err_str(status));
 	}
+}
+
+static int mcast_mgr_set_mftables(osm_sm_t * sm)
+{
+	cl_qmap_t *p_sw_tbl = &sm->p_subn->sw_guid_tbl;
+	osm_switch_t *p_sw;
+	osm_mcast_tbl_t *p_tbl;
+	int block_notdone, ret = 0;
+	int16_t block_num, max_block = -1;
 
-	/*
-	   Walk the switches and download the tables for each.
-	 */
 	p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);
 	while (p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl)) {
-		signal = __osm_mcast_mgr_set_tbl(sm, p_sw);
-		if (signal == OSM_SIGNAL_DONE_PENDING)
-			pending_transactions = TRUE;
+		p_sw->mft_block_num = 0;
+		p_sw->mft_position = 0;
+		p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
+		if (osm_mcast_tbl_get_max_block_in_use(p_tbl) > max_block)
+			max_block = osm_mcast_tbl_get_max_block_in_use(p_tbl);
+		mcast_mgr_set_mfttop(sm, p_sw);
 		p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
 	}
 
-	while (!cl_is_qlist_empty(p_list)) {
-		cl_list_item_t *p = cl_qlist_remove_head(p_list);
-		free(p);
+	/* Stripe the MFT blocks across the switches */
+	for (block_num = 0; block_num <= max_block; block_num++) {
+		block_notdone = 1;
+		while (block_notdone) {
+			block_notdone = 0;
+			p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);
+			while (p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl)) {
+				if (p_sw->mft_block_num == block_num) {
+					block_notdone = 1;
+					if (mcast_mgr_set_mft_block(sm, p_sw,
+								    p_sw->mft_block_num,
+								    p_sw->mft_position))
+						ret = -1;
+					p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
+					if (++p_sw->mft_position > p_tbl->max_position) {
+						p_sw->mft_position = 0;
+						p_sw->mft_block_num++;
+					}
+				}
+				p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
+			}
+		}
 	}
 
-	CL_PLOCK_RELEASE(sm->p_lock);
+	return ret;
+}
 
-	OSM_LOG_EXIT(sm->p_log);
+static int alloc_mfts(osm_sm_t * sm)
+{
+	int i;
+	cl_map_item_t *item;
+	osm_switch_t *p_sw;
 
-	if (pending_transactions == TRUE)
-		return (OSM_SIGNAL_DONE_PENDING);
-	else
-		return (OSM_SIGNAL_DONE);
+	for (i = sm->p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO; i >= 0;
+	     i--)
+		if (sm->p_subn->mboxes[i])
+			break;
+	if (i < 0)
+		return 0;
+
+	/* Now, walk switches and (re)allocate multicast tables */
+	for (item = cl_qmap_head(&sm->p_subn->sw_guid_tbl);
+	     item != cl_qmap_end(&sm->p_subn->sw_guid_tbl);
+	     item = cl_qmap_next(item)) {
+		p_sw = (osm_switch_t *) item;
+		if (osm_mcast_tbl_realloc(&p_sw->mcast_tbl, i))
+			return -1;
+	}
+	return 0;
 }
 
 /**********************************************************************
-  This is the function that is invoked during idle time to handle the
-  process request for mcast groups where join/leave/delete was required.
+  This is the function that is invoked during idle time and sweep to
+  handle the process request for mcast groups where join/leave/delete
+  was required.
  **********************************************************************/
-osm_signal_t osm_mcast_mgr_process_mgroups(osm_sm_t * sm)
+int osm_mcast_mgr_process(osm_sm_t * sm, boolean_t config_all)
 {
-	cl_qlist_t *p_list = &sm->mgrp_list;
-	osm_switch_t *p_sw;
-	cl_qmap_t *p_sw_tbl;
-	osm_mgrp_t *p_mgrp;
-	ib_net16_t mlid;
-	osm_signal_t ret, signal = OSM_SIGNAL_DONE;
-	osm_mcast_mgr_ctxt_t *ctx;
-	osm_mcast_req_type_t req_type;
-	ib_net64_t port_guid;
+	int ret = 0;
+	unsigned i;
+	unsigned max_mlid;
 
 	OSM_LOG_ENTER(sm->p_log);
 
-	/* we need a lock to make sure the p_mgrp is not change other ways */
 	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
 
-	while (!cl_is_qlist_empty(p_list)) {
-		ctx = (osm_mcast_mgr_ctxt_t *) cl_qlist_remove_head(p_list);
-		req_type = ctx->req_type;
-		port_guid = ctx->port_guid;
-
-		/* nice copy no warning on size diff */
-		memcpy(&mlid, &ctx->mlid, sizeof(mlid));
-
-		/* we can destroy the context now */
-		free(ctx);
+	/* If there are no switches in the subnet we have nothing to do. */
+	if (cl_qmap_count(&sm->p_subn->sw_guid_tbl) == 0) {
+		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
+			"No switches in subnet. Nothing to do\n");
+		goto exit;
+	}
 
-		/* since we delayed the execution we prefer to pass the
-		   mlid as the mgrp identifier and then find it or abort */
-		p_mgrp = osm_get_mgrp_by_mlid(sm->p_subn, mlid);
-		if (!p_mgrp)
-			continue;
+	if (alloc_mfts(sm)) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
+			"ERR 0A09: alloc_mfts failed\n");
+		ret = -1;
+		goto exit;
+	}
 
-		/* if there was no change from the last time
-		 * we processed the group we can skip doing anything
-		 */
-		if (p_mgrp->last_change_id == p_mgrp->last_tree_id) {
-			OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-				"Skip processing mgrp with lid:0x%X change id:%u\n",
-				cl_ntoh16(mlid), p_mgrp->last_change_id);
-			continue;
+	max_mlid = config_all ? sm->p_subn->max_mcast_lid_ho
+			- IB_LID_MCAST_START_HO : sm->mlids_req_max;
+	for (i = 0; i <= max_mlid; i++) {
+		if (sm->mlids_req[i] ||
+		    (config_all && sm->p_subn->mboxes[i])) {
+			sm->mlids_req[i] = 0;
+			mcast_mgr_process_mlid(sm, i + IB_LID_MCAST_START_HO);
 		}
-
-		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-			"Processing mgrp with lid:0x%X change id:%u\n",
-			cl_ntoh16(mlid), p_mgrp->last_change_id);
-		mcast_mgr_process_mgrp(sm, p_mgrp, req_type, port_guid);
 	}
 
-	/*
-	   Walk the switches and download the tables for each.
-	 */
-	p_sw_tbl = &sm->p_subn->sw_guid_tbl;
-	p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);
-	while (p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl)) {
-		ret = __osm_mcast_mgr_set_tbl(sm, p_sw);
-		if (ret == OSM_SIGNAL_DONE_PENDING)
-			signal = ret;
-		p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
-	}
+	sm->mlids_req_max = 0;
+
+	ret = mcast_mgr_set_mftables(sm);
 
 	osm_dump_mcast_routes(sm->p_subn->p_osm);
 
+exit:
 	CL_PLOCK_RELEASE(sm->p_lock);
 	OSM_LOG_EXIT(sm->p_log);
-	return signal;
+	return ret;
 }
diff --git a/opensm/osm_mcast_tbl.c b/opensm/osm_mcast_tbl.c
index 17fb69c..c4a64e2 100644
--- a/opensm/osm_mcast_tbl.c
+++ b/opensm/osm_mcast_tbl.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -36,7 +37,7 @@
 /*
  * Abstract:
  *    Implementation of osm_mcast_tbl_t.
- * This object represents an multicast forwarding table.
+ * This object represents a multicast forwarding table.
  * This object is part of the opensm family of objects.
  */
 
@@ -48,13 +49,12 @@
 #include <string.h>
 #include <complib/cl_math.h>
 #include <iba/ib_types.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_MCAST_TBL_C
 #include <opensm/osm_mcast_tbl.h>
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_mcast_tbl_init(IN osm_mcast_tbl_t * const p_tbl,
-		   IN uint8_t const num_ports, IN uint16_t const capacity)
+void osm_mcast_tbl_init(IN osm_mcast_tbl_t * p_tbl, IN uint8_t num_ports,
+			IN uint16_t capacity)
 {
 	CL_ASSERT(p_tbl);
 	CL_ASSERT(num_ports);
@@ -68,7 +68,7 @@ osm_mcast_tbl_init(IN osm_mcast_tbl_t * const p_tbl,
 		   This switch apparently doesn't support multicast.
 		   Everything is initialized to zero already, so return.
 		 */
-		return (IB_SUCCESS);
+		return;
 	}
 
 	p_tbl->num_entries = capacity;
@@ -80,54 +80,22 @@ osm_mcast_tbl_init(IN osm_mcast_tbl_t * const p_tbl,
 	p_tbl->max_block = (uint16_t) ((ROUNDUP(p_tbl->num_entries,
 						IB_MCAST_BLOCK_SIZE) /
 					IB_MCAST_BLOCK_SIZE) - 1);
-
-	p_tbl->max_mlid_ho = (uint16_t) (IB_LID_MCAST_START_HO + capacity - 1);
-
-	/*
-	   The number of bytes needed in the mask table is:
-	   The (maximum bit mask 'position' + 1) times the
-	   number of bytes in each bit mask times the
-	   number of MLIDs supported by the table.
-
-	   We must always allocate the array with the maximum position
-	   since it is (and must be) defined that way the table structure
-	   in order to create a pointer to a two dimensional array.
-	 */
-	p_tbl->p_mask_tbl = malloc(p_tbl->num_entries *
-				   (IB_MCAST_POSITION_MAX +
-				    1) * IB_MCAST_MASK_SIZE / 8);
-
-	if (p_tbl->p_mask_tbl == NULL)
-		return (IB_INSUFFICIENT_MEMORY);
-
-	memset(p_tbl->p_mask_tbl, 0,
-	       p_tbl->num_entries * (IB_MCAST_POSITION_MAX +
-				     1) * IB_MCAST_MASK_SIZE / 8);
-	return (IB_SUCCESS);
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_mcast_tbl_destroy(IN osm_mcast_tbl_t * const p_tbl)
+void osm_mcast_tbl_destroy(IN osm_mcast_tbl_t * p_tbl)
 {
 	free(p_tbl->p_mask_tbl);
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_mcast_tbl_set(IN osm_mcast_tbl_t * const p_tbl,
-		  IN const uint16_t mlid_ho, IN const uint8_t port)
+void osm_mcast_tbl_set(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho,
+		       IN uint8_t port)
 {
-	uintn_t mlid_offset;
-	uintn_t mask_offset;
-	uintn_t bit_mask;
+	unsigned mlid_offset, mask_offset, bit_mask;
 	int16_t block_num;
 
-	CL_ASSERT(p_tbl);
+	CL_ASSERT(p_tbl && p_tbl->p_mask_tbl);
 	CL_ASSERT(mlid_ho >= IB_LID_MCAST_START_HO);
 	CL_ASSERT(mlid_ho <= p_tbl->max_mlid_ho);
-	CL_ASSERT(p_tbl->p_mask_tbl);
 
 	mlid_offset = mlid_ho - IB_LID_MCAST_START_HO;
 	mask_offset = port / IB_MCAST_MASK_SIZE;
@@ -140,15 +108,43 @@ osm_mcast_tbl_set(IN osm_mcast_tbl_t * const p_tbl,
 		p_tbl->max_block_in_use = (uint16_t) block_num;
 }
 
-/**********************************************************************
- **********************************************************************/
-boolean_t
-osm_mcast_tbl_is_port(IN const osm_mcast_tbl_t * const p_tbl,
-		      IN const uint16_t mlid_ho, IN const uint8_t port_num)
+int osm_mcast_tbl_realloc(IN osm_mcast_tbl_t * p_tbl, IN unsigned mlid_offset)
+{
+	size_t mft_depth, size;
+	uint16_t (*p_mask_tbl)[][IB_MCAST_POSITION_MAX + 1];
+
+	if (mlid_offset < p_tbl->mft_depth)
+		goto done;
+
+	/*
+	   The number of bytes needed in the mask table is:
+	   The (maximum bit mask 'position' + 1) times the
+	   number of bytes in each bit mask times the
+	   number of MLIDs supported by the table.
+
+	   We must always allocate the array with the maximum position
+	   since it is (and must be) defined that way the table structure
+	   in order to create a pointer to a two dimensional array.
+	 */
+	mft_depth = (mlid_offset / IB_MCAST_BLOCK_SIZE + 1) * IB_MCAST_BLOCK_SIZE;
+	size = mft_depth * (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8;
+	p_mask_tbl = realloc(p_tbl->p_mask_tbl, size);
+	if (!p_mask_tbl)
+		return -1;
+	memset((uint8_t *)p_mask_tbl + p_tbl->mft_depth * (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8,
+	       0,
+	       size - p_tbl->mft_depth * (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8);
+	p_tbl->p_mask_tbl = p_mask_tbl;
+	p_tbl->mft_depth = mft_depth;
+done:
+	p_tbl->max_mlid_ho = mlid_offset + IB_LID_MCAST_START_HO;
+	return 0;
+}
+
+boolean_t osm_mcast_tbl_is_port(IN const osm_mcast_tbl_t * p_tbl,
+				IN uint16_t mlid_ho, IN uint8_t port_num)
 {
-	uintn_t mlid_offset;
-	uintn_t mask_offset;
-	uintn_t bit_mask;
+	unsigned mlid_offset, mask_offset, bit_mask;
 
 	CL_ASSERT(p_tbl);
 
@@ -167,16 +163,13 @@ osm_mcast_tbl_is_port(IN const osm_mcast_tbl_t * const p_tbl,
 			bit_mask);
 	}
 
-	return (FALSE);
+	return FALSE;
 }
 
-/**********************************************************************
- **********************************************************************/
-boolean_t
-osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * const p_tbl,
-			  IN const uint16_t mlid_ho)
+boolean_t osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * p_tbl,
+				    IN uint16_t mlid_ho)
 {
-	uintn_t mlid_offset;
+	unsigned mlid_offset;
 	uint8_t position;
 	uint16_t result = 0;
 
@@ -195,12 +188,10 @@ osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * const p_tbl,
 	return (result != 0);
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_mcast_tbl_set_block(IN osm_mcast_tbl_t * const p_tbl,
-			IN const ib_net16_t * const p_block,
-			IN const int16_t block_num, IN const uint8_t position)
+ib_api_status_t osm_mcast_tbl_set_block(IN osm_mcast_tbl_t * p_tbl,
+					IN const ib_net16_t * p_block,
+					IN int16_t block_num,
+					IN uint8_t position)
 {
 	uint32_t i;
 	uint16_t mlid_start_ho;
@@ -209,15 +200,15 @@ osm_mcast_tbl_set_block(IN osm_mcast_tbl_t * const p_tbl,
 	CL_ASSERT(p_block);
 
 	if (block_num > p_tbl->max_block)
-		return (IB_INVALID_PARAMETER);
+		return IB_INVALID_PARAMETER;
 
 	if (position > p_tbl->max_position)
-		return (IB_INVALID_PARAMETER);
+		return IB_INVALID_PARAMETER;
 
 	mlid_start_ho = (uint16_t) (block_num * IB_MCAST_BLOCK_SIZE);
 
-	if (mlid_start_ho + IB_MCAST_BLOCK_SIZE - 1 > p_tbl->max_mlid_ho)
-		return (IB_INVALID_PARAMETER);
+	if (mlid_start_ho + IB_MCAST_BLOCK_SIZE - 1 > p_tbl->mft_depth)
+		return IB_INVALID_PARAMETER;
 
 	for (i = 0; i < IB_MCAST_BLOCK_SIZE; i++)
 		(*p_tbl->p_mask_tbl)[mlid_start_ho + i][position] = p_block[i];
@@ -225,60 +216,49 @@ osm_mcast_tbl_set_block(IN osm_mcast_tbl_t * const p_tbl,
 	if (block_num > p_tbl->max_block_in_use)
 		p_tbl->max_block_in_use = (uint16_t) block_num;
 
-	return (IB_SUCCESS);
+	return IB_SUCCESS;
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * const p_tbl,
-			 IN const uint16_t mlid_ho)
+void osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho)
 {
-	uint8_t i;
-	uintn_t mlid_offset;
+	unsigned mlid_offset;
 
 	CL_ASSERT(p_tbl);
 	CL_ASSERT(mlid_ho >= IB_LID_MCAST_START_HO);
 
-	if (p_tbl->p_mask_tbl && (mlid_ho <= p_tbl->max_mlid_ho)) {
-		mlid_offset = mlid_ho - IB_LID_MCAST_START_HO;
-		for (i = 0; i <= p_tbl->max_position; i++)
-			(*p_tbl->p_mask_tbl)[mlid_offset][i] = 0;
-	}
+	mlid_offset = mlid_ho - IB_LID_MCAST_START_HO;
+	if (p_tbl->p_mask_tbl && mlid_offset < p_tbl->mft_depth)
+		memset((uint8_t *)p_tbl->p_mask_tbl + mlid_offset * (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8,
+		       0,
+		       (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8);
 }
 
-/**********************************************************************
- **********************************************************************/
-boolean_t
-osm_mcast_tbl_get_block(IN osm_mcast_tbl_t * const p_tbl,
-			IN int16_t const block_num,
-			IN uint8_t const position,
-			OUT ib_net16_t * const p_block)
+boolean_t osm_mcast_tbl_get_block(IN osm_mcast_tbl_t * p_tbl,
+				  IN int16_t block_num, IN uint8_t position,
+				  OUT ib_net16_t * p_block)
 {
 	uint32_t i;
 	uint16_t mlid_start_ho;
 
 	CL_ASSERT(p_tbl);
 	CL_ASSERT(p_block);
+	CL_ASSERT(block_num * IB_MCAST_BLOCK_SIZE <= p_tbl->mft_depth);
 
 	if (block_num > p_tbl->max_block_in_use)
-		return (FALSE);
+		return FALSE;
 
 	if (position > p_tbl->max_position) {
 		/*
 		   Caller shouldn't do this for efficiency's sake...
 		 */
 		memset(p_block, 0, IB_SMP_DATA_SIZE);
-		return (TRUE);
+		return TRUE;
 	}
 
 	mlid_start_ho = (uint16_t) (block_num * IB_MCAST_BLOCK_SIZE);
 
-	if (mlid_start_ho + IB_MCAST_BLOCK_SIZE - 1 > p_tbl->max_mlid_ho)
-		return (IB_INVALID_PARAMETER);
-
 	for (i = 0; i < IB_MCAST_BLOCK_SIZE; i++)
 		p_block[i] = (*p_tbl->p_mask_tbl)[mlid_start_ho + i][position];
 
-	return (TRUE);
+	return TRUE;
 }
diff --git a/opensm/osm_mcm_port.c b/opensm/osm_mcm_port.c
index b6b6149..65cef0b 100644
--- a/opensm/osm_mcm_port.c
+++ b/opensm/osm_mcm_port.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -46,31 +46,53 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_MCM_PORT_C
 #include <opensm/osm_mcm_port.h>
+#include <opensm/osm_multicast.h>
 
-/**********************************************************************
- **********************************************************************/
-osm_mcm_port_t *osm_mcm_port_new(IN const ib_gid_t * const p_port_gid,
-				 IN const uint8_t scope_state,
-				 IN const boolean_t proxy_join)
+osm_mcm_port_t *osm_mcm_port_new(IN osm_port_t *port, IN osm_mgrp_t *mgrp)
 {
 	osm_mcm_port_t *p_mcm;
 
 	p_mcm = malloc(sizeof(*p_mcm));
 	if (p_mcm) {
 		memset(p_mcm, 0, sizeof(*p_mcm));
-		p_mcm->port_gid = *p_port_gid;
-		p_mcm->scope_state = scope_state;
-		p_mcm->proxy_join = proxy_join;
+		p_mcm->port = port;
+		p_mcm->mgrp = mgrp;
 	}
 
-	return (p_mcm);
+	return p_mcm;
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_mcm_port_delete(IN osm_mcm_port_t * const p_mcm)
+void osm_mcm_port_delete(IN osm_mcm_port_t * p_mcm)
 {
 	CL_ASSERT(p_mcm);
+
 	free(p_mcm);
 }
+
+osm_mcm_alias_guid_t *osm_mcm_alias_guid_new(IN osm_mcm_port_t *p_base_mcm_port,
+					     IN ib_member_rec_t *mcmr,
+					     IN boolean_t proxy)
+{
+	osm_mcm_alias_guid_t *p_mcm_alias_guid;
+
+	p_mcm_alias_guid = calloc(1, sizeof(*p_mcm_alias_guid));
+	if (p_mcm_alias_guid) {
+		p_mcm_alias_guid->alias_guid = mcmr->port_gid.unicast.interface_id;
+		p_mcm_alias_guid->p_base_mcm_port = p_base_mcm_port;
+		p_mcm_alias_guid->port_gid.unicast.prefix = mcmr->port_gid.unicast.prefix;
+		p_mcm_alias_guid->port_gid.unicast.interface_id = mcmr->port_gid.unicast.interface_id;
+		p_mcm_alias_guid->scope_state = mcmr->scope_state;
+		p_mcm_alias_guid->proxy_join = proxy;
+	}
+
+	return p_mcm_alias_guid;
+}
+
+void osm_mcm_alias_guid_delete(IN OUT osm_mcm_alias_guid_t ** pp_mcm_alias_guid)
+{
+	free(*pp_mcm_alias_guid);
+	*pp_mcm_alias_guid = NULL;
+}
diff --git a/opensm/osm_mesh.c b/opensm/osm_mesh.c
new file mode 100644
index 0000000..8f84e53
--- /dev/null
+++ b/opensm/osm_mesh.c
@@ -0,0 +1,1736 @@
+/*
+ * Copyright (c) 2008-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2008,2009      System Fabric Works, Inc. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+/*
+ * Abstract:
+ *      routines to analyze certain meshes
+ */
+
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif				/* HAVE_CONFIG_H */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_MESH_C
+#include <opensm/osm_switch.h>
+#include <opensm/osm_opensm.h>
+#include <opensm/osm_log.h>
+#include <opensm/osm_mesh.h>
+#include <opensm/osm_ucast_lash.h>
+
+#define MAX_DEGREE	(8)
+#define MAX_DIMENSION	(8)
+#define LARGE		(0x7fffffff)
+
+/*
+ * characteristic polynomials for selected 1d through 8d tori
+ */
+static const struct mesh_info {
+	int dimension;			/* dimension of the torus */
+	int size[MAX_DIMENSION];	/* size of the torus */
+	unsigned int degree;		/* degree of polynomial */
+	int poly[MAX_DEGREE+1];		/* polynomial */
+} mesh_info[] = {
+	{0, {0},       0, {0},					},
+
+	{1, {2},       1, {0, -1},				},
+	{1, {3},       2, {-1, 0, 1},				},
+	{1, {5},       2, {-9, 0, 1},				},
+	{1, {6},       2, {-36, 0, 1},				},
+
+	{2, {2, 2},    2, {-4, 0, 1},				},
+	{2, {3, 2},    3, {8, 9, 0, -1},			},
+	{2, {5, 2},    3, {24, 17, 0, -1},			},
+	{2, {6, 2},    3, {32, 24, 0, -1},			},
+	{2, {3, 3},    4, {-15, -32, -18, 0, 1},		},
+	{2, {5, 3},    4, {-39, -64, -26, 0, 1},		},
+	{2, {6, 3},    4, {-48, -80, -33, 0, 1},		},
+	{2, {5, 5},    4, {-63, -96, -34, 0, 1},		},
+	{2, {6, 5},    4, {-48, -112, -41, 0, 1},		},
+	{2, {6, 6},    4, {0, -128, -48, 0, 1},			},
+
+	{3, {2, 2, 2}, 3, {16, 12, 0, -1},			},
+	{3, {3, 2, 2}, 4, {-28, -48, -21, 0, 1},		},
+	{3, {5, 2, 2}, 4, {-60, -80, -29, 0, 1},		},
+	{3, {6, 2, 2}, 4, {-64, -96, -36, 0, 1},		},
+	{3, {3, 3, 2}, 5, {48, 127, 112, 34, 0, -1},		},
+	{3, {5, 3, 2}, 5, {96, 215, 160, 42, 0, -1},		},
+	{3, {6, 3, 2}, 5, {96, 232, 184, 49, 0, -1},		},
+	{3, {5, 5, 2}, 5, {144, 303, 208, 50, 0, -1},		},
+	{3, {6, 5, 2}, 5, {96, 296, 232, 57, 0, -1},		},
+	{3, {6, 6, 2}, 5, {0, 256, 256, 64, 0, -1},		},
+	{3, {3, 3, 3}, 6, {-81, -288, -381, -224, -51, 0, 1},	},
+	{3, {5, 3, 3}, 6, {-153, -480, -557, -288, -59, 0, 1},	},
+	{3, {6, 3, 3}, 6, {-144, -480, -591, -320, -66, 0, 1},	},
+	{3, {5, 5, 3}, 6, {-225, -672, -733, -352, -67, 0, 1},	},
+	{3, {6, 5, 3}, 6, {-144, -576, -743, -384, -74, 0, 1},	},
+	{3, {6, 6, 3}, 6, {0, -384, -720, -416, -81, 0, 1},	},
+	{3, {5, 5, 5}, 6, {-297, -864, -909, -416, -75, 0, 1},	},
+	{3, {6, 5, 5}, 6, {-144, -672, -895, -448, -82, 0, 1},	},
+	{3, {6, 6, 5}, 6, {0, -384, -848, -480, -89, 0, 1},	},
+	{3, {6, 6, 6}, 6, {0, 0, -768, -512, -96, 0, 1},	},
+
+	{4, {2, 2, 2, 2},	4, {-48, -64, -24, 0, 1},	},
+	{4, {3, 2, 2, 2},	5, {80, 180, 136, 37, 0, -1},	},
+	{4, {5, 2, 2, 2},	5, {144, 276, 184, 45, 0, -1},	},
+	{4, {6, 2, 2, 2},	5, {128, 288, 208, 52, 0, -1},	},
+	{4, {3, 3, 2, 2},	6, {-132, -416, -487, -256, -54, 0, 1},	},
+	{4, {5, 3, 2, 2},	6, {-228, -640, -671, -320, -62, 0, 1},	},
+	{4, {6, 3, 2, 2},	6, {-192, -608, -700, -352, -69, 0, 1},	},
+	{4, {5, 5, 2, 2},	6, {-324, -864, -855, -384, -70, 0, 1},	},
+	{4, {6, 5, 2, 2},	6, {-192, -736, -860, -416, -77, 0, 1},	},
+	{4, {6, 6, 2, 2},	6, {0, -512, -832, -448, -84, 0, 1},	},
+	{4, {3, 3, 3, 2},	7, {216, 873, 1392, 1101, 440, 75, 0, -1},	},
+	{4, {5, 3, 3, 2},	7, {360, 1329, 1936, 1405, 520, 83, 0, -1},	},
+	{4, {6, 3, 3, 2},	7, {288, 1176, 1872, 1455, 560, 90, 0, -1},	},
+	{4, {5, 5, 3, 2},	7, {504, 1785, 2480, 1709, 600, 91, 0, -1},	},
+	{4, {6, 5, 3, 2},	7, {288, 1368, 2272, 1735, 640, 98, 0, -1},	},
+	{4, {6, 6, 3, 2},	7, {0, 768, 1920, 1728, 680, 105, 0, -1},	},
+	{4, {5, 5, 5, 2},	7, {648, 2241, 3024, 2013, 680, 99, 0, -1},	},
+	{4, {6, 5, 5, 2},	7, {288, 1560, 2672, 2015, 720, 106, 0, -1},	},
+	{4, {6, 6, 5, 2},	7, {0, 768, 2176, 1984, 760, 113, 0, -1},	},
+	{4, {6, 6, 6, 2},	7, {0, 0, 1536, 1920, 800, 120, 0, -1},	},
+	{4, {3, 3, 3, 3},	8, {-351, -1728, -3492, -3712, -2202, -704, -100, 0, 1},	},
+	{4, {5, 3, 3, 3},	8, {-567, -2592, -4860, -4800, -2658, -800, -108, 0, 1},	},
+	{4, {6, 3, 3, 3},	8, {-432, -2160, -4401, -4672, -2733, -848, -115, 0, 1},	},
+	{4, {5, 5, 3, 3},	8, {-783, -3456, -6228, -5888, -3114, -896, -116, 0, 1},	},
+	{4, {6, 5, 3, 3},	8, {-432, -2448, -5241, -5568, -3165, -944, -123, 0, 1},	},
+	{4, {6, 6, 3, 3},	8, {0, -1152, -3888, -5056, -3183, -992, -130, 0, 1},	},
+	{4, {5, 5, 5, 3},	8, {-999, -4320, -7596, -6976, -3570, -992, -124, 0, 1},	},
+	{4, {6, 5, 5, 3},	8, {-432, -2736, -6081, -6464, -3597, -1040, -131, 0, 1},	},
+	{4, {6, 6, 5, 3},	8, {0, -1152, -4272, -5760, -3591, -1088, -138, 0, 1},	},
+	{4, {6, 6, 6, 3},	8, {0, 0, -2304, -4864, -3552, -1136, -145, 0, 1},	},
+
+	{5, {2, 2, 2, 2, 2},	5, {128, 240, 160, 40, 0, -1},	},
+	{5, {3, 2, 2, 2, 2},	6, {-208, -576, -600, -288, -57, 0, 1},	},
+	{5, {5, 2, 2, 2, 2},	6, {-336, -832, -792, -352, -65, 0, 1},	},
+	{5, {6, 2, 2, 2, 2},	6, {-256, -768, -816, -384, -72, 0, 1},	},
+	{5, {3, 3, 2, 2, 2},	7, {336, 1228, 1776, 1287, 480, 78, 0, -1},	},
+	{5, {5, 3, 2, 2, 2},	7, {528, 1772, 2368, 1599, 560, 86, 0, -1},	},
+	{5, {6, 3, 2, 2, 2},	7, {384, 1504, 2256, 1644, 600, 93, 0, -1},	},
+	{5, {5, 5, 2, 2, 2},	7, {720, 2316, 2960, 1911, 640, 94, 0, -1},	},
+	{5, {6, 5, 2, 2, 2},	7, {384, 1760, 2704, 1932, 680, 101, 0, -1},	},
+	{5, {6, 6, 2, 2, 2},	7, {0, 1024, 2304, 1920, 720, 108, 0, -1},	},
+	{5, {3, 3, 3, 2, 2},	8, {-540, -2448, -4557, -4480, -2481, -752, -103, 0, 1},	},
+	{5, {5, 3, 3, 2, 2},	8, {-828, -3504, -6101, -5632, -2945, -848, -111, 0, 1},	},
+	{5, {6, 3, 3, 2, 2},	8, {-576, -2784, -5412, -5440, -3015, -896, -118, 0, 1},	},
+	{5, {5, 5, 3, 2, 2},	8, {-1116, -4560, -7645, -6784, -3409, -944, -119, 0, 1},	},
+	{5, {6, 5, 3, 2, 2},	8, {-576, -3168, -6404, -6400, -3455, -992, -126, 0, 1},	},
+	{5, {6, 6, 3, 2, 2},	8, {0, -1536, -4800, -5824, -3468, -1040, -133, 0, 1},	},
+	{5, {5, 5, 5, 2, 2},	8, {-1404, -5616, -9189, -7936, -3873, -1040, -127, 0, 1},	},
+	{5, {6, 5, 5, 2, 2},	8, {-576, -3552, -7396, -7360, -3895, -1088, -134, 0, 1},	},
+	{5, {6, 6, 5, 2, 2},	8, {0, -1536, -5312, -6592, -3884, -1136, -141, 0, 1},	},
+	{5, {6, 6, 6, 2, 2},	8, {0, 0, -3072, -5632, -3840, -1184, -148, 0, 1},	},
+
+	{6, {2, 2, 2, 2, 2, 2},	6, {-320, -768, -720, -320, -60, 0, 1},	},
+	{6, {3, 2, 2, 2, 2, 2},	7, {512, 1680, 2208, 1480, 520, 81, 0, -1},	},
+	{6, {5, 2, 2, 2, 2, 2},	7, {768, 2320, 2848, 1800, 600, 89, 0, -1},	},
+	{6, {6, 2, 2, 2, 2, 2},	7, {512, 1920, 2688, 1840, 640, 96, 0, -1},	},
+	{6, {3, 3, 2, 2, 2, 2},	8, {-816, -3392, -5816, -5312, -2767, -800, -106, 0, 1},	},
+	{6, {5, 3, 2, 2, 2, 2},	8, {-1200, -4672, -7544, -6528, -3239, -896, -114, 0, 1},	},
+	{6, {6, 3, 2, 2, 2, 2},	8, {-768, -3584, -6608, -6272, -3304, -944, -121, 0, 1},	},
+	{6, {5, 5, 2, 2, 2, 2},	8, {-1584, -5952, -9272, -7744, -3711, -992, -122, 0, 1},	},
+	{6, {6, 5, 2, 2, 2, 2},	8, {-768, -4096, -7760, -7296, -3752, -1040, -129, 0, 1},	},
+	{6, {6, 6, 2, 2, 2, 2},	8, {0, -2048, -5888, -6656, -3760, -1088, -136, 0, 1},	},
+
+	{7, {2, 2, 2, 2, 2, 2, 2},	7, {768, 2240, 2688, 1680, 560, 84, 0, -1},	},
+	{7, {3, 2, 2, 2, 2, 2, 2},	8, {-1216, -4608, -7280, -6208, -3060, -848, -109, 0, 1},	},
+	{7, {5, 2, 2, 2, 2, 2, 2},	8, {-1728, -6144, -9200, -7488, -3540, -944, -117, 0, 1},	},
+	{7, {6, 2, 2, 2, 2, 2, 2},	8, {-1024, -4608, -8000, -7168, -3600, -992, -124, 0, 1},	},
+
+	{8, {2, 2, 2, 2, 2, 2, 2, 2},	8, {-1792, -6144, -8960, -7168, -3360, -896, -112, 0, 1},	},
+
+	/*
+	 * mesh errors
+	 */
+	{2, {6, 6},                     4, {-192, -256, -80, 0, 1}, },
+
+	{-1, {0,}, 0, {0, },					},
+};
+
+/*
+ * per fabric mesh info
+ */
+typedef struct _mesh {
+	int num_class;			/* number of switch classes */
+	int *class_type;		/* index of first switch found for each class */
+	int *class_count;		/* population of each class */
+	int dimension;			/* mesh dimension */
+	int *size;			/* an array to hold size of mesh */
+	int dim_order[MAX_DIMENSION];
+} mesh_t;
+
+typedef struct sort_ctx {
+	lash_t *p_lash;
+	mesh_t *mesh;
+} sort_ctx_t;
+
+typedef struct comp {
+	int index;
+	sort_ctx_t ctx;
+} comp_t;
+
+/*
+ * poly_alloc
+ *
+ * allocate a polynomial of degree n
+ */
+static int *poly_alloc(lash_t *p_lash, int n)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	int *p;
+
+	if (!(p = calloc(n+1, sizeof(int))))
+		OSM_LOG(p_log, OSM_LOG_ERROR,
+			"Failed allocating poly - out of memory\n");
+
+	return p;
+}
+
+/*
+ * print a polynomial
+ */
+static char *poly_print(int n, int *coeff)
+{
+	static char str[(MAX_DEGREE+1)*20];
+	char *p = str;
+	int i;
+	int first = 1;
+	int t;
+	int sign;
+
+	str[0] = 0;
+
+	for (i = 0; i <= n; i++) {
+		if (!coeff[i])
+			continue;
+
+		if (coeff[i] < 0) {
+			sign = 1;
+			t = -coeff[i];
+		} else {
+			sign = 0;
+			t = coeff[i];
+		}
+
+		p += sprintf(p, "%s", sign? "-" : (first? "" : "+"));
+		first = 0;
+
+		if (t != 1 || i == 0)
+			p += sprintf(p, "%d", t);
+
+		if (i)
+			p += sprintf(p, "x");
+		if (i > 1)
+			p += sprintf(p, "^%d", i);
+	}
+
+	return str;
+}
+
+/*
+ * poly_diff
+ *
+ * return a nonzero value if polynomials differ else 0
+ */
+static int poly_diff(unsigned int n, const int *p, switch_t *s)
+{
+	if (s->node->num_links != n)
+		return 1;
+
+	return memcmp(p, s->node->poly, n*sizeof(int));
+}
+
+/*
+ * m_free
+ *
+ * free a square matrix of rank l
+ */
+static void m_free(int **m, int l)
+{
+	int i;
+
+	if (m) {
+		for (i = 0; i < l; i++) {
+			if (m[i])
+				free(m[i]);
+		}
+		free(m);
+	}
+}
+
+/*
+ * m_alloc
+ *
+ * allocate a square matrix of rank l
+ */
+static int **m_alloc(lash_t *p_lash, int l)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	int i;
+	int **m = NULL;
+
+	do {
+		if (!(m = calloc(l, sizeof(int *))))
+			break;
+
+		for (i = 0; i < l; i++) {
+			if (!(m[i] = calloc(l, sizeof(int))))
+				break;
+		}
+		if (i != l)
+			break;
+
+		return m;
+	} while (0);
+
+	OSM_LOG(p_log, OSM_LOG_ERROR,
+		"Failed allocating matrix - out of memory\n");
+
+	m_free(m, l);
+	return NULL;
+}
+
+/*
+ * pm_free
+ *
+ * free a square matrix of rank l of polynomials
+ */
+static void pm_free(int ***m, int l)
+{
+	int i, j;
+
+	if (m) {
+		for (i = 0; i < l; i++) {
+			if (m[i]) {
+				for (j = 0; j < l; j++) {
+					if (m[i][j])
+						free(m[i][j]);
+				}
+				free(m[i]);
+			}
+		}
+		free(m);
+	}
+}
+
+/*
+ * pm_alloc
+ *
+ * allocate a square matrix of rank l of polynomials of degree n
+ */
+static int ***pm_alloc(lash_t *p_lash, int l, int n)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	int i, j;
+	int ***m = NULL;
+
+	do {
+		if (!(m = calloc(l, sizeof(int **))))
+			break;
+
+		for (i = 0; i < l; i++) {
+			if (!(m[i] = calloc(l, sizeof(int *))))
+				break;
+
+			for (j = 0; j < l; j++) {
+				if (!(m[i][j] = calloc(n+1, sizeof(int))))
+					break;
+			}
+			if (j != l)
+				break;
+		}
+		if (i != l)
+			break;
+
+		return m;
+	} while (0);
+
+	OSM_LOG(p_log, OSM_LOG_ERROR,
+		"Failed allocating matrix - out of memory\n");
+
+	pm_free(m, l);
+	return NULL;
+}
+
+static int determinant(lash_t *p_lash, int n, int rank, int ***m, int *p);
+
+/*
+ * sub_determinant
+ *
+ * compute the determinant of a submatrix of matrix of rank l of polynomials of degree n
+ * with row and col removed in poly. caller must free poly
+ */
+static int sub_determinant(lash_t *p_lash, int n, int l, int row, int col,
+			   int ***matrix, int **poly)
+{
+	int ret = -1;
+	int ***m = NULL;
+	int *p = NULL;
+	int i, j, k, x, y;
+	int rank = l - 1;
+
+	do {
+		if (!(p = poly_alloc(p_lash, n))) {
+			break;
+		}
+
+		if (rank <= 0) {
+			p[0] = 1;
+			ret = 0;
+			break;
+		}
+
+		if (!(m = pm_alloc(p_lash, rank, n))) {
+			free(p);
+			p = NULL;
+			break;
+		}
+
+		x = 0;
+		for (i = 0; i < l; i++) {
+			if (i == row)
+				continue;
+
+			y = 0;
+			for (j = 0; j < l; j++) {
+				if (j == col)
+					continue;
+
+				for (k = 0; k <= n; k++)
+					m[x][y][k] = matrix[i][j][k];
+
+				y++;
+			}
+			x++;
+		}
+
+		if (determinant(p_lash, n, rank, m, p)) {
+			free(p);
+			p = NULL;
+			break;
+		}
+
+		ret = 0;
+	} while (0);
+
+	pm_free(m, rank);
+	*poly = p;
+	return ret;
+}
+
+/*
+ * determinant
+ *
+ * compute the determinant of matrix m of rank of polynomials of degree deg
+ * and add the result to polynomial p allocated by caller
+ */
+static int determinant(lash_t *p_lash, int deg, int rank, int ***m, int *p)
+{
+	int i, j, k;
+	int *q;
+	int sign = 1;
+
+	/*
+	 * handle simple case of 1x1 matrix
+	 */
+	if (rank == 1) {
+		for (i = 0; i <= deg; i++)
+			p[i] += m[0][0][i];
+	}
+
+	/*
+	 * handle simple case of 2x2 matrix
+	 */
+	else if (rank == 2) {
+		for (i = 0; i <= deg; i++) {
+			if (m[0][0][i] == 0)
+				continue;
+
+			for (j = 0; j <= deg; j++) {
+				if (m[1][1][j] == 0)
+					continue;
+
+				p[i+j] += m[0][0][i]*m[1][1][j];
+			}
+		}
+
+		for (i = 0; i <= deg; i++) {
+			if (m[0][1][i] == 0)
+				continue;
+
+			for (j = 0; j <= deg; j++) {
+				if (m[1][0][j] == 0)
+					continue;
+
+				p[i+j] -= m[0][1][i]*m[1][0][j];
+			}
+		}
+	}
+
+	/*
+	 * handle the general case
+	 */
+	else {
+		for (i = 0; i < rank; i++) {
+			if (sub_determinant(p_lash, deg, rank, 0, i, m, &q))
+				return -1;
+
+			for (j = 0; j <= deg; j++) {
+				if (m[0][i][j] == 0)
+					continue;
+
+				for (k = 0; k <= deg; k++) {
+					if (q[k] == 0)
+						continue;
+
+					p[j+k] += sign*m[0][i][j]*q[k];
+				}
+			}
+
+			free(q);
+			sign = -sign;
+		}
+	}
+
+	return 0;
+}
+
+/*
+ * char_poly
+ *
+ * compute the characteristic polynomial of matrix of rank
+ * by computing the determinant of m-x*I and return in poly
+ * as an array. caller must free poly
+ */
+static int char_poly(lash_t *p_lash, int rank, int **matrix, int **poly)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	int ret = -1;
+	int i, j;
+	int ***m = NULL;
+	int *p = NULL;
+	int deg = rank;
+
+	OSM_LOG_ENTER(p_log);
+
+	do {
+		if (!matrix)
+			break;
+
+		if (!(p = poly_alloc(p_lash, deg)))
+			break;
+
+		if (!(m = pm_alloc(p_lash, rank, deg))) {
+			free(p);
+			p = NULL;
+			break;
+		}
+
+		for (i = 0; i < rank; i++) {
+			for (j = 0; j < rank; j++) {
+				m[i][j][0] = matrix[i][j];
+			}
+			m[i][i][1] = -1;
+		}
+
+		if (determinant(p_lash, deg, rank, m, p)) {
+			free(p);
+			p = NULL;
+			break;
+		}
+
+		ret = 0;
+	} while (0);
+
+	pm_free(m, rank);
+	*poly = p;
+
+	OSM_LOG_EXIT(p_log);
+	return ret;
+}
+
+/*
+ * get_switch_metric
+ *
+ * compute the matrix of minimum distances between each of
+ * the adjacent switch nodes to sw along paths
+ * that do not go through sw. do calculation by
+ * relaxation method
+ * allocate space for the matrix and save in node_t structure
+ */
+static int get_switch_metric(lash_t *p_lash, int sw)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	int ret = -1;
+	unsigned int i, j, change;
+	int sw1, sw2, sw3;
+	switch_t *s = p_lash->switches[sw];
+	switch_t *s1, *s2, *s3;
+	int **m;
+	mesh_node_t *node = s->node;
+	unsigned int num_links = node->num_links;
+
+	OSM_LOG_ENTER(p_log);
+
+	do {
+		if (!(m = m_alloc(p_lash, num_links)))
+			break;
+
+		for (i = 0; i < num_links; i++) {
+			sw1 = node->links[i]->switch_id;
+			s1 = p_lash->switches[sw1];
+
+			/* make all distances big except s1 to itself */
+			for (sw2 = 0; sw2 < p_lash->num_switches; sw2++)
+				p_lash->switches[sw2]->node->temp = LARGE;
+
+			s1->node->temp = 0;
+
+			do {
+				change = 0;
+
+				for (sw2 = 0; sw2 < p_lash->num_switches; sw2++) {
+					s2 = p_lash->switches[sw2];
+					if (s2->node->temp == LARGE)
+						continue;
+					for (j = 0; j < s2->node->num_links; j++) {
+						sw3 = s2->node->links[j]->switch_id;
+						s3 = p_lash->switches[sw3];
+
+						if (sw3 == sw)
+							continue;
+
+						if ((s2->node->temp + 1) < s3->node->temp) {
+							s3->node->temp = s2->node->temp + 1;
+							change++;
+						}
+					}
+				}
+			} while (change);
+
+			for (j = 0; j < num_links; j++) {
+				sw2 = node->links[j]->switch_id;
+				s2 = p_lash->switches[sw2];
+				m[i][j] = s2->node->temp;
+			}
+		}
+
+		if (char_poly(p_lash, num_links, m, &node->poly)) {
+			m_free(m, num_links);
+			m = NULL;
+			break;
+		}
+
+		ret = 0;
+	} while (0);
+
+	node->matrix = m;
+
+	OSM_LOG_EXIT(p_log);
+	return ret;
+}
+
+/*
+ * classify_switch
+ *
+ * add switch to histogram of switch types
+ * we keep a reference to the first switch
+ * found of each type as an exemplar
+ */
+static void classify_switch(lash_t *p_lash, mesh_t *mesh, int sw)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	int i;
+	switch_t *s = p_lash->switches[sw];
+	switch_t *s1;
+
+	OSM_LOG_ENTER(p_log);
+
+	if (!s->node->poly)
+		goto done;
+
+	for (i = 0; i < mesh->num_class; i++) {
+		s1 = p_lash->switches[mesh->class_type[i]];
+
+		if (poly_diff(s->node->num_links, s->node->poly, s1))
+			continue;
+
+		mesh->class_count[i]++;
+		goto done;
+	}
+
+	mesh->class_type[mesh->num_class] = sw;
+	mesh->class_count[mesh->num_class] = 1;
+	mesh->num_class++;
+
+done:
+	OSM_LOG_EXIT(p_log);
+}
+
+/*
+ * classify_mesh_type
+ *
+ * try to look up node polynomial in table
+ */
+static void classify_mesh_type(lash_t *p_lash, int sw)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	int i;
+	switch_t *s = p_lash->switches[sw];
+	const struct mesh_info *t;
+
+	OSM_LOG_ENTER(p_log);
+
+	if (!s->node->poly)
+		goto done;
+
+	for (i = 1; (t = &mesh_info[i])->dimension != -1; i++) {
+		if (poly_diff(t->degree, t->poly, s))
+			continue;
+
+		s->node->type = i;
+		s->node->dimension = t->dimension;
+		OSM_LOG_EXIT(p_log);
+		return;
+	}
+
+done:
+	s->node->type = 0;
+	OSM_LOG_EXIT(p_log);
+	return;
+}
+
+/*
+ * remove_edges
+ *
+ * remove type from nodes that have fewer links
+ * than adjacent nodes
+ */
+static void remove_edges(lash_t *p_lash)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	int sw;
+	mesh_node_t *n, *nn;
+	unsigned i;
+
+	OSM_LOG_ENTER(p_log);
+
+	for (sw = 0; sw < p_lash->num_switches; sw++) {
+		n = p_lash->switches[sw]->node;
+		if (!n->type)
+			continue;
+
+		for (i = 0; i < n->num_links; i++) {
+			nn = p_lash->switches[n->links[i]->switch_id]->node;
+
+			if (nn->num_links > n->num_links) {
+				OSM_LOG(p_log, OSM_LOG_DEBUG,
+					"removed edge switch %s\n",
+					p_lash->switches[sw]->p_sw->p_node->print_desc);
+				n->type = -1;
+				break;
+			}
+		}
+	}
+
+	OSM_LOG_EXIT(p_log);
+}
+
+/*
+ * get_local_geometry
+ *
+ * analyze the local geometry around each switch
+ */
+static int get_local_geometry(lash_t *p_lash, mesh_t *mesh)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	int sw;
+	int status = 0;
+
+	OSM_LOG_ENTER(p_log);
+
+	for (sw = 0; sw < p_lash->num_switches; sw++) {
+		/*
+		 * skip switches with more links than MAX_DEGREE
+		 * since they will never match a known case
+		 */
+		if (p_lash->switches[sw]->node->num_links > MAX_DEGREE)
+			continue;
+
+		if (get_switch_metric(p_lash, sw)) {
+			status = -1;
+			goto Exit;
+		}
+		classify_mesh_type(p_lash, sw);
+	}
+
+	remove_edges(p_lash);
+
+	for (sw = 0; sw < p_lash->num_switches; sw++) {
+		if (p_lash->switches[sw]->node->type < 0)
+			continue;
+		classify_switch(p_lash, mesh, sw);
+	}
+
+Exit:
+	OSM_LOG_EXIT(p_log);
+	return status;
+}
+
+static void print_axis(lash_t *p_lash, char *p, int sw, int port)
+{
+	mesh_node_t *node = p_lash->switches[sw]->node;
+	char *name = p_lash->switches[sw]->p_sw->p_node->print_desc;
+	int c = node->axes[port];
+
+	p += sprintf(p, "%s[%d] = ", name, port);
+	if (c)
+		p += sprintf(p, "%s%c -> ", ((c - 1) & 1) ? "-" : "+", 'X' + (c - 1)/2);
+	else
+		p += sprintf(p, "N/A -> ");
+	p += sprintf(p, "%s\n",
+		     p_lash->switches[node->links[port]->switch_id]->p_sw->p_node->print_desc);
+}
+
+/*
+ * seed_axes
+ *
+ * assign axes to the links of the seed switch
+ * assumes switch is of type cartesian mesh
+ * axes are numbered 1 to n i.e. +x => 1 -x => 2 etc.
+ * this assumes that if all distances are 2 that
+ * an axis has only 2 nodes so +A and -A collapse to +A
+ */
+static void seed_axes(lash_t *p_lash, int sw)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	mesh_node_t *node = p_lash->switches[sw]->node;
+	int n = node->num_links;
+	int i, j, c;
+
+	OSM_LOG_ENTER(p_log);
+
+	if (!node->matrix || !node->dimension)
+		goto done;
+
+	for (c = 1; c <= 2*node->dimension; c++) {
+		/*
+		 * find the next unassigned axis
+		 */
+		for (i = 0; i < n; i++) {
+			if (!node->axes[i])
+				break;
+		}
+
+		node->axes[i] = c++;
+
+		/*
+		 * find the matching opposite direction
+		 */
+		for (j = 0; j < n; j++) {
+			if (node->axes[j] || j == i)
+				continue;
+
+			if (node->matrix[i][j] != 2)
+				break;
+		}
+
+		if (j != n) {
+			node->axes[j] = c;
+		}
+	}
+
+	if (OSM_LOG_IS_ACTIVE_V2(p_log, OSM_LOG_DEBUG)) {
+		char buf[256], *p;
+
+		for (i = 0; i < n; i++) {
+			p = buf;
+			print_axis(p_lash, p, sw, i);
+			OSM_LOG(p_log, OSM_LOG_DEBUG, "%s", buf);
+		}
+	}
+
+done:
+	OSM_LOG_EXIT(p_log);
+}
+
+/*
+ * opposite
+ *
+ * compute the opposite of axis for switch
+ */
+static inline int opposite(switch_t *s, int axis)
+{
+	unsigned i, j;
+	int negaxis = 1 + (1 ^ (axis - 1));
+
+	if (!s->node->matrix)
+		return 0;
+
+	for (i = 0; i < s->node->num_links; i++) {
+		if (s->node->axes[i] == axis) {
+			for (j = 0; j < s->node->num_links; j++) {
+				if (j == i)
+					continue;
+				if (s->node->matrix[i][j] != 2)
+					return negaxis;
+			}
+
+			return axis;
+		}
+	}
+
+	return 0;
+}
+
+/*
+ * make_geometry
+ *
+ * induce a geometry on the switches
+ */
+static void make_geometry(lash_t *p_lash, int sw)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	int num_switches = p_lash->num_switches;
+	int sw1, sw2;
+	switch_t *s, *s1, *s2, *seed;
+	unsigned int i, j, k, l, n, m;
+	unsigned int change;
+
+	OSM_LOG_ENTER(p_log);
+
+	s = p_lash->switches[sw];
+
+	if (!s->node->matrix)
+		goto done;
+
+	/*
+	 * assign axes to seed switch
+	 */
+	seed_axes(p_lash, sw);
+	seed = p_lash->switches[sw];
+
+	/*
+	 * induce axes in other switches until
+	 * there is no more change
+	 */
+	do {
+		change = 0;
+
+		/* phase 1 opposites */
+		for (sw1 = 0; sw1 < num_switches; sw1++) {
+			s1 = p_lash->switches[sw1];
+			n = s1->node->num_links;
+
+			/*
+			 * ignore chain fragments
+			 */
+			if (n < seed->node->num_links && n <= 2)
+				continue;
+
+			/*
+			 * only process 'mesh' switches
+			 */
+			if (!s1->node->matrix)
+				continue;
+
+			for (i = 0; i < n; i++) {
+				if (!s1->node->axes[i])
+					continue;
+
+				/*
+				 * can't tell across if more than one
+				 * likely looking link
+				 */
+				m = 0;
+				for (j = 0; j < n; j++) {
+					if (j == i)
+						continue;
+
+					if (s1->node->matrix[i][j] != 2)
+						m++;
+				}
+
+				if (m != 1) {
+					continue;
+				}
+
+				for (j = 0; j < n; j++) {
+					if (j == i)
+						continue;
+
+					/* Rule out opposite nodes when distance greater than 4 */
+					if (s1->node->matrix[i][j] != 2 &&
+					    s1->node->matrix[i][j] <= 4) {
+						if (s1->node->axes[j]) {
+							if (s1->node->axes[j] != opposite(seed, s1->node->axes[i])) {
+								OSM_LOG(p_log, OSM_LOG_DEBUG,
+									"phase 1 mismatch\n");
+							}
+						} else {
+							s1->node->axes[j] = opposite(seed, s1->node->axes[i]);
+							change++;
+						}
+					}
+				}
+			}
+		}
+
+		/* phase 2 switch to switch */
+		for (sw1 = 0; sw1 < num_switches; sw1++) {
+			s1 = p_lash->switches[sw1];
+			n = s1->node->num_links;
+
+			if (!s1->node->matrix)
+				continue;
+
+			for (i = 0; i < n; i++) {
+				int l2 = s1->node->links[i]->link_id;
+
+				if (!s1->node->axes[i])
+					continue;
+
+				if (l2 == -1) {
+					OSM_LOG(p_log, OSM_LOG_DEBUG,
+						"no reverse link\n");
+					continue;
+				}
+
+				sw2 = s1->node->links[i]->switch_id;
+				s2 = p_lash->switches[sw2];
+
+				if (!s2->node->matrix)
+					continue;
+
+				if (!s2->node->axes[l2]) {
+					/*
+					 * set axis to opposite of s1->axes[i]
+					 */
+					s2->node->axes[l2] = opposite(seed, s1->node->axes[i]);
+					change++;
+				} else {
+					if (s2->node->axes[l2] != opposite(seed, s1->node->axes[i])) {
+						OSM_LOG(p_log, OSM_LOG_DEBUG,
+							"phase 2 mismatch\n");
+					}
+				}
+			}
+		}
+
+		/* Phase 3 corners */
+		for (sw1 = 0; sw1 < num_switches; sw1++) {
+			s = p_lash->switches[sw1];
+			n = s->node->num_links;
+
+			if (!s->node->matrix)
+				continue;
+
+			for (i = 0; i < n; i++) {
+				if (!s->node->axes[i])
+					continue;
+
+				for (j = 0; j < n; j++) {
+					if (i == j || !s->node->axes[j] || s->node->matrix[i][j] != 2)
+						continue;
+
+					s1 = p_lash->switches[s->node->links[i]->switch_id];
+					s2 = p_lash->switches[s->node->links[j]->switch_id];
+
+					/*
+					 * find switch (other than s1) that neighbors i and j
+					 * have in common
+					 */
+					for (k = 0; k < s1->node->num_links; k++) {
+						if (s1->node->links[k]->switch_id == sw1)
+							continue;
+
+						for (l = 0; l < s2->node->num_links; l++) {
+							if (s2->node->links[l]->switch_id == sw1)
+								continue;
+
+							if (s1->node->links[k]->switch_id == s2->node->links[l]->switch_id) {
+								if (s1->node->axes[k]) {
+									if (s1->node->axes[k] != s->node->axes[j]) {
+										OSM_LOG(p_log, OSM_LOG_DEBUG, "phase 3 mismatch\n");
+									}
+								} else {
+									s1->node->axes[k] = s->node->axes[j];
+									change++;
+								}
+
+								if (s2->node->axes[l]) {
+									if (s2->node->axes[l] != s->node->axes[i]) {
+										OSM_LOG(p_log, OSM_LOG_DEBUG, "phase 3 mismatch\n");
+									}
+								} else {
+									s2->node->axes[l] = s->node->axes[i];
+									change++;
+								}
+								goto next_j;
+							}
+						}
+					}
+next_j:
+					;
+				}
+			}
+		}
+	} while (change);
+
+done:
+	OSM_LOG_EXIT(p_log);
+}
+
+/*
+ * return |a| < |b|
+ */
+static inline int ltmag(int a, int b)
+{
+	int a1 = (a >= 0)? a : -a;
+	int b1 = (b >= 0)? b : -b;
+
+	return (a1 < b1) || (a1 == b1 && a > b);
+}
+
+/*
+ * reorder_node_links
+ *
+ * reorder the links out of a switch in sign/dimension order
+ */
+static int reorder_node_links(lash_t *p_lash, mesh_t *mesh, int sw)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	switch_t *s = p_lash->switches[sw];
+	mesh_node_t *node = s->node;
+	int n = node->num_links;
+	link_t **links;
+	int *axes;
+	int i, j, k, l;
+	int c;
+	int next = 0;
+	int dimension = mesh->dimension;
+
+	if (!(links = calloc(n, sizeof(link_t *)))) {
+		OSM_LOG(p_log, OSM_LOG_ERROR,
+			"Failed allocating links array - out of memory\n");
+		return -1;
+	}
+
+	if (!(axes = calloc(n, sizeof(int)))) {
+		free(links);
+		OSM_LOG(p_log, OSM_LOG_ERROR,
+			"Failed allocating axes array - out of memory\n");
+		return -1;
+	}
+
+	/*
+	 * find the links with axes
+	 */
+	for (i = 0; i < dimension; i++) {
+		j = mesh->dim_order[i];
+		for (k = 1; k <= 2; k++) {
+			c = 2*j + k;
+
+			if (node->coord[j] > 0)
+				c = opposite(s, c);
+
+			for (l = 0; l < n; l++) {
+				if (!node->links[l])
+					continue;
+				if (node->axes[l] == c) {
+					links[next] = node->links[l];
+					axes[next] = node->axes[l];
+					node->links[l] = NULL;
+					next++;
+				}
+			}
+		}
+	}
+
+	/*
+	 * get the rest
+	 */
+	for (i = 0; i < n; i++) {
+		if (!node->links[i])
+			continue;
+
+		links[next] = node->links[i];
+		axes[next] = node->axes[i];
+		node->links[i] = NULL;
+		next++;
+	}
+
+	for (i = 0; i < n; i++) {
+		node->links[i] = links[i];
+		node->axes[i] = axes[i];
+	}
+
+	free(links);
+	free(axes);
+
+	return 0;
+}
+
+/*
+ * make_coord
+ */
+static int make_coord(lash_t *p_lash, mesh_t *mesh, int seed)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	unsigned int i, j, k;
+	int sw;
+	switch_t *s, *s1;
+	unsigned int change;
+	unsigned int dimension = mesh->dimension;
+	int num_switches = p_lash->num_switches;
+	int assigned_axes = 0, unassigned_axes = 0;
+
+	OSM_LOG_ENTER(p_log);
+
+	for (sw = 0; sw < num_switches; sw++) {
+		s = p_lash->switches[sw];
+
+		s->node->coord = calloc(dimension, sizeof(int));
+		if (!s->node->coord) {
+			OSM_LOG(p_log, OSM_LOG_ERROR,
+				"Failed allocating coord - out of memory\n");
+			OSM_LOG_EXIT(p_log);
+			return -1;
+		}
+
+		for (i = 0; i < dimension; i++)
+			s->node->coord[i] = (sw == seed) ? 0 : LARGE;
+
+		for (i = 0; i < s->node->num_links; i++)
+			if (s->node->axes[i] == 0)
+				unassigned_axes++;
+			else
+				assigned_axes++;
+	}
+
+	OSM_LOG(p_log, OSM_LOG_DEBUG, "%d/%d unassigned/assigned axes\n",
+		unassigned_axes, assigned_axes);
+
+	do {
+		change = 0;
+
+		for (sw = 0; sw < num_switches; sw++) {
+			s = p_lash->switches[sw];
+
+			if (s->node->coord[0] == LARGE)
+				continue;
+
+			for (j = 0; j < s->node->num_links; j++) {
+				if (!s->node->axes[j])
+					continue;
+
+				s1 = p_lash->switches[s->node->links[j]->switch_id];
+
+				for (k = 0; k < dimension; k++) {
+					int coord = s->node->coord[k];
+					unsigned axis = s->node->axes[j] - 1;
+
+					if (k == axis/2)
+						coord += (axis & 1)? -1 : +1;
+
+					if (ltmag(coord, s1->node->coord[k])) {
+						s1->node->coord[k] = coord;
+						change++;
+					}
+				}
+			}
+		}
+	} while (change);
+
+	OSM_LOG_EXIT(p_log);
+	return 0;
+}
+
+/*
+ * measure geometry
+ */
+static int measure_geometry(lash_t *p_lash, mesh_t *mesh)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	int i, j;
+	int sw;
+	switch_t *s;
+	int dimension = mesh->dimension;
+	int num_switches = p_lash->num_switches;
+	int max[MAX_DIMENSION];
+	int min[MAX_DIMENSION];
+	int size[MAX_DIMENSION];
+	int max_size;
+	int max_index;
+
+	OSM_LOG_ENTER(p_log);
+
+	mesh->size = calloc(dimension, sizeof(int));
+	if (!mesh->size) {
+		OSM_LOG(p_log, OSM_LOG_ERROR,
+			"Failed allocating size - out of memory\n");
+		OSM_LOG_EXIT(p_log);
+		return -1;
+	}
+
+	for (i = 0; i < dimension; i++) {
+		max[i] = -LARGE;
+		min[i] = LARGE;
+	}
+
+	for (sw = 0; sw < num_switches; sw++) {
+		s = p_lash->switches[sw];
+
+		for (i = 0; i < dimension; i++) {
+			if (s->node->coord[i] == LARGE)
+				continue;
+			if (s->node->coord[i] > max[i])
+				max[i] = s->node->coord[i];
+			if (s->node->coord[i] < min[i])
+				min[i] = s->node->coord[i];
+		}
+	}
+
+	for (i = 0; i < dimension; i++)
+		mesh->size[i] = size[i] = max[i] - min[i] + 1;
+
+	/*
+	 * find an order of dimensions that places largest
+	 * sizes first since this seems to work best with LASH
+	 */
+	for (j = 0; j < dimension; j++) {
+		max_size = -1;
+		max_index = -1;
+
+		for (i = 0; i < dimension; i++) {
+			if (size[i] > max_size) {
+				max_size = size[i];
+				max_index = i;
+			}
+		}
+
+		mesh->dim_order[j] = max_index;
+		size[max_index] = -1;
+	}
+
+	OSM_LOG_EXIT(p_log);
+	return 0;
+}
+
+/*
+ * reorder links
+ */
+static int reorder_links(lash_t *p_lash, mesh_t *mesh)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	int sw;
+	int num_switches = p_lash->num_switches;
+
+	OSM_LOG_ENTER(p_log);
+
+	for (sw = 0; sw < num_switches; sw++) {
+		if (reorder_node_links(p_lash, mesh, sw)) {
+			OSM_LOG_EXIT(p_log);
+			return -1;
+		}
+	}
+
+	OSM_LOG_EXIT(p_log);
+	return 0;
+}
+
+/*
+ * compare two switches in a sort
+ */
+static int compare_switches(const void *p1, const void *p2)
+{
+	const comp_t *cp1 = p1, *cp2 = p2;
+	const sort_ctx_t *ctx = &cp1->ctx;
+	switch_t *s1 = ctx->p_lash->switches[cp1->index];
+	switch_t *s2 = ctx->p_lash->switches[cp2->index];
+	int i, j;
+	int ret;
+
+	for (i = 0; i < ctx->mesh->dimension; i++) {
+		j = ctx->mesh->dim_order[i];
+		ret = s1->node->coord[j] - s2->node->coord[j];
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
+/*
+ * sort_switches - reorder switch array
+ */
+static void sort_switches(lash_t *p_lash, mesh_t *mesh)
+{
+	unsigned int i, j;
+	unsigned int num_switches = p_lash->num_switches;
+	comp_t *comp;
+	int *reverse;
+	switch_t *s;
+	switch_t **switches;
+
+	comp = malloc(num_switches * sizeof(comp_t));
+	reverse = malloc(num_switches * sizeof(int));
+	switches = malloc(num_switches * sizeof(switch_t *));
+	if (!comp || !reverse || !switches) {
+		OSM_LOG(&p_lash->p_osm->log, OSM_LOG_ERROR,
+			"Failed memory allocation - switches not sorted!\n");
+		goto Exit;
+	}
+
+	for (i = 0; i < num_switches; i++) {
+		comp[i].index = i;
+		comp[i].ctx.mesh = mesh;
+		comp[i].ctx.p_lash = p_lash;
+	}
+
+	qsort(comp, num_switches, sizeof(comp_t), compare_switches);
+
+	for (i = 0; i < num_switches; i++)
+		reverse[comp[i].index] = i;
+
+	for (i = 0; i < num_switches; i++) {
+		s = p_lash->switches[comp[i].index];
+		switches[i] = s;
+		s->id = i;
+		for (j = 0; j < s->node->num_links; j++)
+			s->node->links[j]->switch_id =
+				reverse[s->node->links[j]->switch_id];
+	}
+
+	for (i = 0; i < num_switches; i++)
+		p_lash->switches[i] = switches[i];
+
+Exit:
+	if (switches)
+		free(switches);
+	if (comp)
+		free(comp);
+	if (reverse)
+		free(reverse);
+}
+
+/*
+ * osm_mesh_delete - free per mesh resources
+ */
+static void mesh_delete(mesh_t *mesh)
+{
+	if (mesh) {
+		if (mesh->class_type)
+			free(mesh->class_type);
+
+		if (mesh->class_count)
+			free(mesh->class_count);
+
+		if (mesh->size)
+			free(mesh->size);
+
+		free(mesh);
+	}
+}
+
+/*
+ * osm_mesh_create - allocate per mesh resources
+ */
+static mesh_t *mesh_create(lash_t *p_lash)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	mesh_t *mesh;
+
+	if(!(mesh = calloc(1, sizeof(mesh_t))))
+		goto err;
+
+	if (!(mesh->class_type = calloc(p_lash->num_switches, sizeof(int))))
+		goto err;
+
+	if (!(mesh->class_count = calloc(p_lash->num_switches, sizeof(int))))
+		goto err;
+
+	return mesh;
+
+err:
+	mesh_delete(mesh);
+	OSM_LOG(p_log, OSM_LOG_ERROR,
+		"Failed allocating mesh - out of memory\n");
+	return NULL;
+}
+
+/*
+ * osm_mesh_node_delete - cleanup per switch resources
+ */
+void osm_mesh_node_delete(lash_t *p_lash, switch_t *sw)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	unsigned i;
+	mesh_node_t *node = sw->node;
+	unsigned num_ports = sw->p_sw->num_ports;
+
+	OSM_LOG_ENTER(p_log);
+
+	if (node) {
+		for (i = 0; i < num_ports; i++)
+			if (node->links[i])
+				free(node->links[i]);
+
+		if (node->poly)
+			free(node->poly);
+
+		if (node->matrix) {
+			for (i = 0; i < node->num_links; i++) {
+				if (node->matrix[i])
+					free(node->matrix[i]);
+			}
+			free(node->matrix);
+		}
+
+		if (node->axes)
+			free(node->axes);
+
+		if (node->coord)
+			free(node->coord);
+
+		free(node);
+
+		sw->node = NULL;
+	}
+
+	OSM_LOG_EXIT(p_log);
+}
+
+/*
+ * osm_mesh_node_create - allocate per switch resources
+ */
+int osm_mesh_node_create(lash_t *p_lash, switch_t *sw)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	unsigned i;
+	mesh_node_t *node;
+	unsigned num_ports = sw->p_sw->num_ports;
+
+	OSM_LOG_ENTER(p_log);
+
+	if (!(node = sw->node = calloc(1, sizeof(mesh_node_t) + num_ports * sizeof(link_t *))))
+		goto err;
+
+	for (i = 0; i < num_ports; i++)
+		if (!(node->links[i] = calloc(1, sizeof(link_t) + num_ports * sizeof(int))))
+			goto err;
+
+	if (!(node->axes = calloc(num_ports, sizeof(int))))
+		goto err;
+
+	for (i = 0; i < num_ports; i++) {
+		node->links[i]->switch_id = NONE;
+	}
+
+	OSM_LOG_EXIT(p_log);
+	return 0;
+
+err:
+	osm_mesh_node_delete(p_lash, sw);
+	OSM_LOG(p_log, OSM_LOG_ERROR,
+		"Failed allocating mesh node - out of memory\n");
+	OSM_LOG_EXIT(p_log);
+	return -1;
+}
+
+static void dump_mesh(lash_t *p_lash)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	int sw;
+	int num_switches = p_lash->num_switches;
+	int dimension;
+	int i, j, k, n;
+	switch_t *s, *s2;
+	char buf[256];
+
+	OSM_LOG_ENTER(p_log);
+
+	for (sw = 0; sw < num_switches; sw++) {
+		s = p_lash->switches[sw];
+		dimension = s->node->dimension;
+		n = sprintf(buf, "[");
+		for (i = 0; i < dimension; i++) {
+			n += snprintf(buf + n, sizeof(buf) - n,
+				      "%2d", s->node->coord[i]);
+			if (n > sizeof(buf))
+				n = sizeof(buf);
+			if (i != dimension - 1) {
+				n += snprintf(buf + n, sizeof(buf) - n, "%s", ",");
+				if (n > sizeof(buf))
+					n = sizeof(buf);
+			}
+		}
+		n += snprintf(buf + n, sizeof(buf) - n, "]");
+		if (n > sizeof(buf))
+			n = sizeof(buf);
+		for (j = 0; j < s->node->num_links; j++) {
+			s2 = p_lash->switches[s->node->links[j]->switch_id];
+			n += snprintf(buf + n, sizeof(buf) - n, " [%d]->[", j);
+			if (n > sizeof(buf))
+				n = sizeof(buf);
+			for (k = 0; k < dimension; k++) {
+				n += snprintf(buf + n, sizeof(buf) - n, "%2d",
+					      s2->node->coord[k]);
+				if (n > sizeof(buf))
+					n = sizeof(buf);
+				if (k != dimension - 1) {
+					n += snprintf(buf + n, sizeof(buf) - n,
+						      ",");
+					if (n > sizeof(buf))
+						n = sizeof(buf);
+				}
+			}
+			n += snprintf(buf + n, sizeof(buf) - n, "]");
+			if (n > sizeof(buf))
+				n = sizeof(buf);
+		}
+		OSM_LOG(p_log, OSM_LOG_DEBUG, "%s\n", buf);
+	}
+
+	OSM_LOG_EXIT(p_log);
+}
+
+/*
+ * osm_do_mesh_analysis
+ */
+int osm_do_mesh_analysis(lash_t *p_lash)
+{
+	osm_log_t *p_log = &p_lash->p_osm->log;
+	mesh_t *mesh;
+	int max_class_num = 0;
+	int max_class_type = -1;
+	int i;
+	switch_t *s;
+	char buf[256], *p;
+
+	OSM_LOG_ENTER(p_log);
+
+	mesh = mesh_create(p_lash);
+	if (!mesh)
+		goto err;
+
+	if (get_local_geometry(p_lash, mesh))
+		goto err;
+
+	if (mesh->num_class == 0) {
+		OSM_LOG(p_log, OSM_LOG_INFO,
+			"found no likely mesh nodes - done\n");
+		goto done;
+	}
+
+	/*
+	 * find dominant switch class
+	 */
+	OSM_LOG(p_log, OSM_LOG_INFO, "found %d node class%s\n",
+		mesh->num_class, (mesh->num_class == 1) ? "" : "es");
+	for (i = 0; i < mesh->num_class; i++) {
+		OSM_LOG(p_log, OSM_LOG_INFO,
+			"class[%d] has %d members with type = %d\n",
+			i, mesh->class_count[i],
+			p_lash->switches[mesh->class_type[i]]->node->type);
+		if (mesh->class_count[i] > max_class_num) {
+			max_class_num = mesh->class_count[i];
+			max_class_type = mesh->class_type[i];
+		}
+	}
+
+	s = p_lash->switches[max_class_type];
+
+	p = buf;
+	p += sprintf(p, "%snode shape is ",
+		    (mesh->num_class == 1) ? "" : "most common ");
+
+	if (s->node->type) {
+		const struct mesh_info *t = &mesh_info[s->node->type];
+
+		for (i = 0; i < t->dimension; i++) {
+			p += sprintf(p, "%s%d%s", i? " x " : "", t->size[i],
+				(t->size[i] == 6)? "+" : "");
+		}
+		p += sprintf(p, " mesh\n");
+
+		mesh->dimension = t->dimension;
+	} else {
+		p += sprintf(p, "unknown geometry\n");
+	}
+
+	OSM_LOG(p_log, OSM_LOG_INFO, "%s", buf);
+
+	OSM_LOG(p_log, OSM_LOG_INFO, "poly = %s\n",
+		poly_print(s->node->num_links, s->node->poly));
+
+	if (s->node->type) {
+		make_geometry(p_lash, max_class_type);
+
+		if (make_coord(p_lash, mesh, max_class_type))
+			goto err;
+
+		if (measure_geometry(p_lash, mesh))
+			goto err;
+
+		if (reorder_links(p_lash, mesh))
+			goto err;
+
+		sort_switches(p_lash, mesh);
+
+		p = buf;
+		p += sprintf(p, "found ");
+		for (i = 0; i < mesh->dimension; i++)
+			p += sprintf(p, "%s%d", i? " x " : "", mesh->size[i]);
+		p += sprintf(p, " mesh\n");
+
+		OSM_LOG(p_log, OSM_LOG_INFO, "%s", buf);
+	}
+
+	if (OSM_LOG_IS_ACTIVE_V2(p_log, OSM_LOG_DEBUG))
+		dump_mesh(p_lash);
+
+done:
+	mesh_delete(mesh);
+	OSM_LOG_EXIT(p_log);
+	return 0;
+
+err:
+	mesh_delete(mesh);
+	OSM_LOG_EXIT(p_log);
+	return -1;
+}
diff --git a/opensm/osm_pkey_rcv.c b/opensm/osm_mlnx_ext_port_info_rcv.c
similarity index 53%
copy from opensm/osm_pkey_rcv.c
copy to opensm/osm_mlnx_ext_port_info_rcv.c
index 7061941..8151bbc 100644
--- a/opensm/osm_pkey_rcv.c
+++ b/opensm/osm_mlnx_ext_port_info_rcv.c
@@ -1,7 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2011 Mellanox Technologies LTD. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -33,61 +31,72 @@
  *
  */
 
+/*
+ * Abstract:
+ *    Implementation of osm_mlnx_epi_rcv_t.
+ * This object represents the MLNX ExtendedPortInfo Receiver object.
+ * This object is part of the opensm family of objects.
+ */
+
 #if HAVE_CONFIG_H
 #  include <config.h>
 #endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
+#include <stdlib.h>
 #include <iba/ib_types.h>
+#include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_MLNX_EXT_PORT_INFO_RCV_C
+#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_subnet.h>
+#include <opensm/osm_mad_pool.h>
+#include <opensm/osm_msgdef.h>
 #include <opensm/osm_helper.h>
-#include <opensm/osm_sm.h>
+#include <opensm/osm_opensm.h>
 
-/**********************************************************************
- **********************************************************************/
-/*
- * WE MIGHT ONLY RECEIVE GET or SET responses
- */
-void osm_pkey_rcv_process(IN void *context, IN void *data)
+void osm_mlnx_epi_rcv_process(IN void *context, IN void *data)
 {
 	osm_sm_t *sm = context;
 	osm_madw_t *p_madw = data;
-	ib_pkey_table_t *p_pkey_tbl;
+	ib_mlnx_ext_port_info_t *p_pi;
 	ib_smp_t *p_smp;
 	osm_port_t *p_port;
 	osm_physp_t *p_physp;
 	osm_node_t *p_node;
-	osm_pkey_context_t *p_context;
-	ib_net64_t port_guid;
-	ib_net64_t node_guid;
-	uint8_t port_num;
-	uint16_t block_num;
-
-	CL_ASSERT(sm);
+	osm_pi_context_t *p_context;
+	ib_net64_t port_guid, node_guid;
+	uint8_t port_num, portnum, start_port = 1;
 
 	OSM_LOG_ENTER(sm->p_log);
 
+	CL_ASSERT(sm);
 	CL_ASSERT(p_madw);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
+	p_context = osm_madw_get_pi_context_ptr(p_madw);
+	p_pi = ib_smp_get_payload_ptr(p_smp);
+
+	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO);
 
-	p_context = osm_madw_get_pkey_context_ptr(p_madw);
-	p_pkey_tbl = (ib_pkey_table_t *) ib_smp_get_payload_ptr(p_smp);
+	port_num = (uint8_t) cl_ntoh32(p_smp->attr_mod);
 
 	port_guid = p_context->port_guid;
 	node_guid = p_context->node_guid;
 
-	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_P_KEY_TABLE);
+	osm_dump_mlnx_ext_port_info_v2(sm->p_log, node_guid, port_guid, port_num,
+				       p_pi, FILE_ID, OSM_LOG_DEBUG);
 
-	cl_plock_excl_acquire(sm->p_lock);
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
 	p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
 	if (!p_port) {
-		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4806: "
+		CL_PLOCK_RELEASE(sm->p_lock);
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0F06: "
 			"No port object for port with GUID 0x%" PRIx64
 			"\n\t\t\t\tfor parent node GUID 0x%" PRIx64
 			", TID 0x%" PRIx64 "\n",
@@ -99,47 +108,35 @@ void osm_pkey_rcv_process(IN void *context, IN void *data)
 	p_node = p_port->p_node;
 	CL_ASSERT(p_node);
 
-	block_num = (uint16_t) ((cl_ntoh32(p_smp->attr_mod)) & 0x0000FFFF);
-	/* in case of a non switch node the attr modifier should be ignored */
-	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH) {
-		port_num =
-		    (uint8_t) (((cl_ntoh32(p_smp->attr_mod)) & 0x00FF0000) >>
-			       16);
-		p_physp = osm_node_get_physp_ptr(p_node, port_num);
-	} else {
-		p_physp = p_port->p_physp;
-		port_num = p_physp->port_num;
-	}
-
-	/*
-	   We do not mind if this is a result of a set or get - all we want is to
-	   update the subnet.
-	 */
-	OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-		"Got GetResp(PKey) block:%u port_num %u with GUID 0x%"
-		PRIx64 " for parent node GUID 0x%" PRIx64 ", TID 0x%"
-		PRIx64 "\n", block_num, port_num, cl_ntoh64(port_guid),
-		cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));
+	if (!(cl_ntoh16(p_smp->status) & 0x7fff)) {
+		if (port_num != 255) {
+			p_physp = osm_node_get_physp_ptr(p_node, port_num);
+			CL_ASSERT(p_physp);
+			p_physp->ext_port_info = *p_pi;
+		} else {
+			/* Handle all ports on set/set resp */
+			if (p_node->sw &&
+			    ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info))
+				start_port = 0;
+
+			for (portnum = start_port;
+			     portnum < osm_node_get_num_physp(p_node);
+			     portnum++) {
+				p_physp = osm_node_get_physp_ptr(p_node, portnum);
+				CL_ASSERT(p_physp);
+				p_physp->ext_port_info = *p_pi;
+			}
+		}
+	} else
+		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
+			"MAD status 0x%x received\n",
+			cl_ntoh16(p_smp->status) & 0x7fff);
+
+	CL_PLOCK_RELEASE(sm->p_lock);
 
+Exit:
 	/*
-	   Determine if we encountered a new Physical Port.
-	   If so, ignore it.
+	   Release the lock before jumping here!!
 	 */
-	if (!p_physp) {
-		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4807: "
-			"Got invalid port number %u\n", port_num);
-		goto Exit;
-	}
-
-	osm_dump_pkey_block(sm->p_log,
-			    port_guid, block_num,
-			    port_num, p_pkey_tbl, OSM_LOG_DEBUG);
-
-	osm_physp_set_pkey_tbl(sm->p_log, sm->p_subn,
-			       p_physp, p_pkey_tbl, block_num);
-
-Exit:
-	cl_plock_release(sm->p_lock);
-
 	OSM_LOG_EXIT(sm->p_log);
 }
diff --git a/opensm/osm_mtree.c b/opensm/osm_mtree.c
index 3832e7d..12acd7b 100644
--- a/opensm/osm_mtree.c
+++ b/opensm/osm_mtree.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -44,46 +44,30 @@
 #endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_MTREE_C
 #include <complib/cl_debug.h>
 #include <opensm/osm_mtree.h>
 
-/**********************************************************************
- **********************************************************************/
-static void
-osm_mtree_node_init(IN osm_mtree_node_t * const p_mtn,
-		    IN const osm_switch_t * const p_sw)
+osm_mtree_node_t *osm_mtree_node_new(IN const osm_switch_t * p_sw)
 {
+	osm_mtree_node_t *p_mtn;
 	uint32_t i;
 
-	CL_ASSERT(p_mtn);
-	CL_ASSERT(p_sw);
+	p_mtn = malloc(sizeof(osm_mtree_node_t) +
+		       sizeof(void *) * (p_sw->num_ports - 1));
+	if (!p_mtn)
+		return NULL;
 
 	memset(p_mtn, 0, sizeof(*p_mtn));
-
-	p_mtn->p_sw = (osm_switch_t *) p_sw;
+	p_mtn->p_sw = p_sw;
 	p_mtn->max_children = p_sw->num_ports;
-
 	for (i = 0; i < p_mtn->max_children; i++)
 		p_mtn->child_array[i] = NULL;
-}
-
-/**********************************************************************
- **********************************************************************/
-osm_mtree_node_t *osm_mtree_node_new(IN const osm_switch_t * const p_sw)
-{
-	osm_mtree_node_t *p_mtn;
 
-	p_mtn = malloc(sizeof(osm_mtree_node_t) +
-		       sizeof(void *) * (p_sw->num_ports - 1));
-
-	if (p_mtn != NULL)
-		osm_mtree_node_init(p_mtn, p_sw);
-
-	return (p_mtn);
+	return p_mtn;
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_mtree_destroy(IN osm_mtree_node_t * p_mtn)
 {
 	uint32_t i;
@@ -91,19 +75,16 @@ void osm_mtree_destroy(IN osm_mtree_node_t * p_mtn)
 	if (p_mtn == NULL)
 		return;
 
-	if (p_mtn->child_array != NULL)
-		for (i = 0; i < p_mtn->max_children; i++)
-			if ((p_mtn->child_array[i] != NULL) &&
-			    (p_mtn->child_array[i] != OSM_MTREE_LEAF))
-				osm_mtree_destroy(p_mtn->child_array[i]);
+	for (i = 0; i < p_mtn->max_children; i++)
+		if ((p_mtn->child_array[i] != NULL) &&
+		    (p_mtn->child_array[i] != OSM_MTREE_LEAF))
+			osm_mtree_destroy(p_mtn->child_array[i]);
 
 	free(p_mtn);
 }
 
-/**********************************************************************
- **********************************************************************/
 #if 0
-static void __osm_mtree_dump(IN osm_mtree_node_t * p_mtn)
+static void mtree_dump(IN osm_mtree_node_t * p_mtn)
 {
 	uint32_t i;
 
@@ -118,7 +99,7 @@ static void __osm_mtree_dump(IN osm_mtree_node_t * p_mtn)
 			printf("i=%d\n", i);
 			if ((p_mtn->child_array[i] != NULL)
 			    && (p_mtn->child_array[i] != OSM_MTREE_LEAF))
-				__osm_mtree_dump(p_mtn->child_array[i]);
+				mtree_dump(p_mtn->child_array[i]);
 		}
 	}
 }
diff --git a/opensm/osm_multicast.c b/opensm/osm_multicast.c
index 350fd22..c43d58d 100644
--- a/opensm/osm_multicast.c
+++ b/opensm/osm_multicast.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -44,20 +44,51 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <arpa/inet.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_MULTICAST_C
 #include <opensm/osm_multicast.h>
 #include <opensm/osm_mcm_port.h>
 #include <opensm/osm_mtree.h>
 #include <opensm/osm_inform.h>
+#include <opensm/osm_opensm.h>
 
-/**********************************************************************
- **********************************************************************/
-void osm_mgrp_delete(IN osm_mgrp_t * const p_mgrp)
+static osm_mgrp_box_t *mgrp_box_new(uint16_t mlid)
 {
-	osm_mcm_port_t *p_mcm_port;
-	osm_mcm_port_t *p_next_mcm_port;
+	osm_mgrp_box_t *mbox = malloc(sizeof(*mbox));
+	if (!mbox)
+		return NULL;
+
+	memset(mbox, 0, sizeof(*mbox));
+	mbox->mlid = mlid;
+	cl_qlist_init(&mbox->mgrp_list);
+
+	return mbox;
+}
+
+void mgrp_box_delete(osm_mgrp_box_t *mbox)
+{
+	osm_mtree_destroy(mbox->root);
+	free(mbox);
+}
+
+void mgrp_delete(IN osm_mgrp_t * p_mgrp)
+{
+	osm_mcm_alias_guid_t *p_mcm_alias_guid, *p_next_mcm_alias_guid;
+	osm_mcm_port_t *p_mcm_port, *p_next_mcm_port;
 
 	CL_ASSERT(p_mgrp);
 
+	p_next_mcm_alias_guid =
+	    (osm_mcm_alias_guid_t *) cl_qmap_head(&p_mgrp->mcm_alias_port_tbl);
+	while (p_next_mcm_alias_guid !=
+	       (osm_mcm_alias_guid_t *) cl_qmap_end(&p_mgrp->mcm_alias_port_tbl)) {
+		p_mcm_alias_guid = p_next_mcm_alias_guid;
+		p_next_mcm_alias_guid =
+		    (osm_mcm_alias_guid_t *) cl_qmap_next(&p_mcm_alias_guid->map_item);
+		osm_mcm_alias_guid_delete(&p_mcm_alias_guid);
+	}
+
 	p_next_mcm_port =
 	    (osm_mcm_port_t *) cl_qmap_head(&p_mgrp->mcm_port_tbl);
 	while (p_next_mcm_port !=
@@ -67,17 +98,27 @@ void osm_mgrp_delete(IN osm_mgrp_t * const p_mgrp)
 		    (osm_mcm_port_t *) cl_qmap_next(&p_mcm_port->map_item);
 		osm_mcm_port_delete(p_mcm_port);
 	}
-	/* destroy the mtree_node structure */
-	osm_mtree_destroy(p_mgrp->p_root);
 
 	free(p_mgrp);
 }
 
-/**********************************************************************
- **********************************************************************/
-osm_mgrp_t *osm_mgrp_new(IN const ib_net16_t mlid)
+void osm_mgrp_box_delete(osm_mgrp_box_t *mbox)
+{
+	osm_mgrp_t *mgrp;
+
+	while (cl_qlist_count(&mbox->mgrp_list)) {
+		mgrp = cl_item_obj(cl_qlist_remove_head(&mbox->mgrp_list),
+				   mgrp, list_item);
+		mgrp_delete(mgrp);
+	}
+	mgrp_box_delete(mbox);
+}
+
+osm_mgrp_t *osm_mgrp_new(IN osm_subn_t * subn, IN ib_net16_t mlid,
+			 IN ib_member_rec_t * mcmr)
 {
 	osm_mgrp_t *p_mgrp;
+	osm_mgrp_box_t *mbox;
 
 	p_mgrp = (osm_mgrp_t *) malloc(sizeof(*p_mgrp));
 	if (!p_mgrp)
@@ -85,18 +126,64 @@ osm_mgrp_t *osm_mgrp_new(IN const ib_net16_t mlid)
 
 	memset(p_mgrp, 0, sizeof(*p_mgrp));
 	cl_qmap_init(&p_mgrp->mcm_port_tbl);
+	cl_qmap_init(&p_mgrp->mcm_alias_port_tbl);
 	p_mgrp->mlid = mlid;
-	p_mgrp->last_change_id = 0;
-	p_mgrp->last_tree_id = 0;
-	p_mgrp->to_be_deleted = FALSE;
+	p_mgrp->mcmember_rec = *mcmr;
+
+	mbox = osm_get_mbox_by_mlid(subn, p_mgrp->mlid);
+	if (!mbox && !(mbox = mgrp_box_new(cl_ntoh16(p_mgrp->mlid)))) {
+		free(p_mgrp);
+		return NULL;
+	}
+
+	cl_qlist_insert_tail(&mbox->mgrp_list, &p_mgrp->list_item);
+	subn->mboxes[mbox->mlid - IB_LID_MCAST_START_HO] = mbox;
+
+	cl_fmap_insert(&subn->mgrp_mgid_tbl, &p_mgrp->mcmember_rec.mgid,
+		       &p_mgrp->map_item);
 
 	return p_mgrp;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void mgrp_send_notice(osm_subn_t *subn, osm_log_t *log,
-			     osm_mgrp_t *mgrp, unsigned num)
+void osm_mgrp_cleanup(osm_subn_t * subn, osm_mgrp_t * mgrp)
+{
+	osm_mgrp_box_t *mbox;
+	osm_mcm_alias_guid_t *mcm_alias_guid;
+	osm_mcm_port_t *mcm_port;
+
+	if (mgrp->full_members)
+		return;
+
+	while (cl_qmap_count(&mgrp->mcm_alias_port_tbl)) {
+		mcm_alias_guid = (osm_mcm_alias_guid_t *) cl_qmap_head(&mgrp->mcm_alias_port_tbl);
+		cl_qmap_remove_item(&mgrp->mcm_alias_port_tbl, &mcm_alias_guid->map_item);
+		osm_mcm_alias_guid_delete(&mcm_alias_guid);
+	}
+
+	while (cl_qmap_count(&mgrp->mcm_port_tbl)) {
+		mcm_port = (osm_mcm_port_t *) cl_qmap_head(&mgrp->mcm_port_tbl);
+		cl_qmap_remove_item(&mgrp->mcm_port_tbl, &mcm_port->map_item);
+		cl_qlist_remove_item(&mcm_port->port->mcm_list,
+				     &mcm_port->list_item);
+		osm_mcm_port_delete(mcm_port);
+	}
+
+	if (mgrp->well_known)
+		return;
+
+	cl_fmap_remove_item(&subn->mgrp_mgid_tbl, &mgrp->map_item);
+
+	mbox = osm_get_mbox_by_mlid(subn, mgrp->mlid);
+	cl_qlist_remove_item(&mbox->mgrp_list, &mgrp->list_item);
+	if (cl_is_qlist_empty(&mbox->mgrp_list)) {
+		subn->mboxes[cl_ntoh16(mgrp->mlid) - IB_LID_MCAST_START_HO] = NULL;
+		mgrp_box_delete(mbox);
+	}
+	free(mgrp);
+}
+
+static void mgrp_send_notice(osm_subn_t * subn, osm_log_t * log,
+			     osm_mgrp_t * mgrp, unsigned num)
 {
 	ib_mad_notice_attr_t notice;
 	ib_api_status_t status;
@@ -122,25 +209,92 @@ static void mgrp_send_notice(osm_subn_t *subn, osm_log_t *log,
 			ib_get_err_str(status));
 }
 
-/**********************************************************************
- **********************************************************************/
-osm_mcm_port_t *osm_mgrp_add_port(IN osm_subn_t *subn, osm_log_t *log,
-				  IN osm_mgrp_t * const p_mgrp,
-				  IN const ib_gid_t * const p_port_gid,
-				  IN const uint8_t join_state,
-				  IN boolean_t proxy_join)
+static boolean_t is_qmap_empty_for_port(IN const cl_qmap_t * const p_map,
+					IN const osm_port_t *port)
 {
-	ib_net64_t port_guid;
-	osm_mcm_port_t *p_mcm_port;
+	size_t count = 0;
+	cl_map_item_t *item;
+	osm_mcm_alias_guid_t *mcm_alias_guid;
+
+	for (item = cl_qmap_head(p_map); item != cl_qmap_end(p_map);
+	     item = cl_qmap_next(item)) {
+		mcm_alias_guid = (osm_mcm_alias_guid_t *) item;
+		if (mcm_alias_guid->p_base_mcm_port->port == port) {
+			count++;
+			break;
+		}
+	}
+
+	return (count == 0);
+}
+
+static boolean_t is_qmap_empty_for_mcm_port(IN const cl_qmap_t * const p_map,
+					    IN const osm_mcm_port_t *mcm_port)
+{
+	size_t count = 0;
+	cl_map_item_t *item;
+	osm_mcm_alias_guid_t *mcm_alias_guid;
+
+	for (item = cl_qmap_head(p_map); item != cl_qmap_end(p_map);
+	     item = cl_qmap_next(item)) {
+		mcm_alias_guid = (osm_mcm_alias_guid_t *) item;
+		if (mcm_alias_guid->p_base_mcm_port == mcm_port) {
+			count++;
+			break;
+		}
+	}
+
+	return (count == 0);
+}
+static osm_mcm_alias_guid_t *insert_alias_guid(IN osm_mgrp_t * mgrp,
+					       IN osm_mcm_alias_guid_t * p_mcm_alias_guid)
+{
+	osm_mcm_alias_guid_t *p_mcm_alias_guid_check;
+
+	/* insert into mcm alias guid table */
+	p_mcm_alias_guid_check =
+		(osm_mcm_alias_guid_t *) cl_qmap_insert(&mgrp->mcm_alias_port_tbl,
+							p_mcm_alias_guid->alias_guid,
+							&p_mcm_alias_guid->map_item);
+	if (p_mcm_alias_guid_check != (osm_mcm_alias_guid_t *) &p_mcm_alias_guid->map_item) {
+		/* alias GUID is a duplicate */
+		osm_mcm_alias_guid_delete(&p_mcm_alias_guid);
+		return p_mcm_alias_guid_check;
+	}
+	return NULL;
+}
+
+osm_mcm_port_t *osm_mgrp_add_port(IN osm_subn_t * subn, osm_log_t * log,
+				  IN osm_mgrp_t * mgrp, osm_port_t *port,
+				  IN ib_member_rec_t *mcmr, IN boolean_t proxy)
+{
+	osm_mcm_port_t *mcm_port;
+	osm_mcm_alias_guid_t *p_mcm_alias_guid, *p_mcm_alias_guid_check;
 	cl_map_item_t *prev_item;
-	uint8_t prev_join_state = 0;
+	uint8_t prev_join_state = 0, join_state = mcmr->scope_state;
 	uint8_t prev_scope;
 
-	p_mcm_port = osm_mcm_port_new(p_port_gid, join_state, proxy_join);
-	if (!p_mcm_port)
+	if (OSM_LOG_IS_ACTIVE_V2(log, OSM_LOG_VERBOSE)) {
+		char gid_str[INET6_ADDRSTRLEN];
+		OSM_LOG(log, OSM_LOG_VERBOSE, "GUID 0x%016" PRIx64
+			" Port 0x%016" PRIx64 " joining "
+			"MC group %s (mlid 0x%x)\n",
+			cl_ntoh64(mcmr->port_gid.unicast.interface_id),
+			cl_ntoh64(port->guid),
+			inet_ntop(AF_INET6, mgrp->mcmember_rec.mgid.raw,
+				  gid_str, sizeof(gid_str)),
+			cl_ntoh16(mgrp->mlid));
+	}
+
+	mcm_port = osm_mcm_port_new(port, mgrp);
+	if (!mcm_port)
 		return NULL;
 
-	port_guid = p_port_gid->unicast.interface_id;
+	p_mcm_alias_guid = osm_mcm_alias_guid_new(mcm_port, mcmr, proxy);
+	if (!p_mcm_alias_guid) {
+		osm_mcm_port_delete(mcm_port);
+		return NULL;
+	}
 
 	/*
 	   prev_item = cl_qmap_insert(...)
@@ -149,154 +303,147 @@ osm_mcm_port_t *osm_mgrp_add_port(IN osm_subn_t *subn, osm_log_t *log,
 	   specified key already exists in the map, the pointer to that item is
 	   returned.
 	 */
-	prev_item = cl_qmap_insert(&p_mgrp->mcm_port_tbl,
-				   port_guid, &p_mcm_port->map_item);
-
-	/* if already exists - revert the insertion and only update join state */
-	if (prev_item != &p_mcm_port->map_item) {
-		osm_mcm_port_delete(p_mcm_port);
-		p_mcm_port = (osm_mcm_port_t *) prev_item;
-
-		/*
-		   o15.0.1.11
-		   Join state of the end port should be the or of the
-		   previous setting with the current one
-		 */
-		ib_member_get_scope_state(p_mcm_port->scope_state, &prev_scope,
-					  &prev_join_state);
-		p_mcm_port->scope_state =
-		    ib_member_set_scope_state(prev_scope,
-					      prev_join_state | join_state);
+	prev_item = cl_qmap_insert(&mgrp->mcm_port_tbl, port->guid,
+				   &mcm_port->map_item);
+
+	if (prev_item != &mcm_port->map_item) {	/* mcm port already exists */
+		osm_mcm_port_delete(mcm_port);
+		mcm_port = (osm_mcm_port_t *) prev_item;
+
+		p_mcm_alias_guid->p_base_mcm_port = (osm_mcm_port_t *) prev_item;
+		p_mcm_alias_guid_check = insert_alias_guid(mgrp, p_mcm_alias_guid);
+		if (p_mcm_alias_guid_check) {	/* alias GUID already exists */
+			p_mcm_alias_guid = p_mcm_alias_guid_check;
+			ib_member_get_scope_state(p_mcm_alias_guid->scope_state,
+						  &prev_scope, &prev_join_state);
+			p_mcm_alias_guid->scope_state =
+			    ib_member_set_scope_state(prev_scope,
+						      prev_join_state | join_state);
+		}
 	} else {
-		/* track the fact we modified the group ports */
-		p_mgrp->last_change_id++;
+		insert_alias_guid(mgrp, p_mcm_alias_guid);
+		cl_qlist_insert_tail(&port->mcm_list, &mcm_port->list_item);
+		osm_sm_reroute_mlid(&subn->p_osm->sm, mgrp->mlid);
 	}
 
+	/* o15.0.1.11: copy the join state */
+	mcmr->scope_state = p_mcm_alias_guid->scope_state;
+
 	if ((join_state & IB_JOIN_STATE_FULL) &&
 	    !(prev_join_state & IB_JOIN_STATE_FULL) &&
-	    (++p_mgrp->full_members == 1)) {
-		mgrp_send_notice(subn, log, p_mgrp, 66);
-		p_mgrp->to_be_deleted = 0;
-	}
+	    ++mgrp->full_members == 1)
+		mgrp_send_notice(subn, log, mgrp, 66);
 
-	return (p_mcm_port);
+	subn->p_osm->sa.dirty = TRUE;
+	return mcm_port;
 }
 
-/**********************************************************************
- **********************************************************************/
-int osm_mgrp_remove_port(osm_subn_t *subn, osm_log_t *log, osm_mgrp_t *mgrp,
-			 osm_mcm_port_t *mcm, uint8_t join_state)
+void osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
+			  osm_mcm_alias_guid_t * mcm_alias_guid,
+			  ib_member_rec_t *mcmr)
 {
-	int ret;
-	uint8_t port_join_state;
-	uint8_t new_join_state;
+	uint8_t join_state = mcmr->scope_state & 0xf;
+	uint8_t port_join_state, new_join_state;
 
 	/*
 	 * according to the same o15-0.1.14 we get the stored
 	 * JoinState and the request JoinState and they must be
 	 * opposite to leave - otherwise just update it
 	 */
-	port_join_state = mcm->scope_state & 0x0F;
+	port_join_state = mcm_alias_guid->scope_state & 0x0F;
 	new_join_state = port_join_state & ~join_state;
 
-	if (new_join_state) {
-		mcm->scope_state = new_join_state | (mcm->scope_state & 0xf0);
+	if (OSM_LOG_IS_ACTIVE_V2(log, OSM_LOG_VERBOSE)) {
+		char gid_str[INET6_ADDRSTRLEN];
+		OSM_LOG(log, OSM_LOG_VERBOSE,
+			"GUID 0x%" PRIx64 " Port 0x%" PRIx64
+			" leaving MC group %s (mlid 0x%x)\n",
+			cl_ntoh64(mcm_alias_guid->alias_guid),
+			cl_ntoh64(mcm_alias_guid->p_base_mcm_port->port->guid),
+			inet_ntop(AF_INET6, mgrp->mcmember_rec.mgid.raw,
+				  gid_str, sizeof(gid_str)),
+			cl_ntoh16(mgrp->mlid));
+	}
+
+	if (new_join_state & IB_JOIN_STATE_FULL ||
+	    (new_join_state &&
+	     (mgrp->full_members > (port_join_state & IB_JOIN_STATE_FULL) ? 1 : 0))) {
+		mcm_alias_guid->scope_state =
+		    new_join_state | (mcm_alias_guid->scope_state & 0xf0);
 		OSM_LOG(log, OSM_LOG_DEBUG,
-			"updating port 0x%" PRIx64 " JoinState 0x%x -> 0x%x\n",
-			cl_ntoh64(mcm->port_gid.unicast.interface_id),
+			"updating GUID 0x%" PRIx64 " port 0x%" PRIx64
+			" JoinState 0x%x -> 0x%x\n",
+			cl_ntoh64(mcm_alias_guid->alias_guid),
+			cl_ntoh64(mcm_alias_guid->p_base_mcm_port->port->guid),
 			port_join_state, new_join_state);
-		ret = 0;
+		mcmr->scope_state = mcm_alias_guid->scope_state;
 	} else {
-		cl_qmap_remove_item(&mgrp->mcm_port_tbl, &mcm->map_item);
-		OSM_LOG(log, OSM_LOG_DEBUG, "removing port 0x%" PRIx64 "\n",
-			cl_ntoh64(mcm->port_gid.unicast.interface_id));
-		osm_mcm_port_delete(mcm);
-		/* track the fact we modified the group */
-		mgrp->last_change_id++;
-		ret = 1;
+		mcmr->scope_state = mcm_alias_guid->scope_state & 0xf0;
+		OSM_LOG(log, OSM_LOG_DEBUG, "removing alias GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(mcm_alias_guid->alias_guid));
+		cl_qmap_remove_item(&mgrp->mcm_alias_port_tbl,
+				    &mcm_alias_guid->map_item);
+		if (is_qmap_empty_for_port(&mgrp->mcm_alias_port_tbl,
+					   mcm_alias_guid->p_base_mcm_port->port)) { /* last alias in mcast group for this port */
+			OSM_LOG(log, OSM_LOG_DEBUG, "removing port 0x%" PRIx64 "\n",
+				cl_ntoh64(mcm_alias_guid->p_base_mcm_port->port->guid));
+			cl_qmap_remove_item(&mgrp->mcm_port_tbl,
+					    &mcm_alias_guid->p_base_mcm_port->map_item);
+			cl_qlist_remove_item(&mcm_alias_guid->p_base_mcm_port->port->mcm_list,
+					     &mcm_alias_guid->p_base_mcm_port->list_item);
+			if (is_qmap_empty_for_mcm_port(&mgrp->mcm_alias_port_tbl,
+						       mcm_alias_guid->p_base_mcm_port)) /* last alias in mcast group for this mcm port */
+				osm_mcm_port_delete(mcm_alias_guid->p_base_mcm_port);
+			osm_sm_reroute_mlid(&subn->p_osm->sm, mgrp->mlid);
+		}
+		osm_mcm_alias_guid_delete(&mcm_alias_guid);
 	}
 
 	/* no more full members so the group will be deleted after re-route
 	   but only if it is not a well known group */
 	if ((port_join_state & IB_JOIN_STATE_FULL) &&
 	    !(new_join_state & IB_JOIN_STATE_FULL) &&
-	    (--mgrp->full_members == 0)) {
+	    --mgrp->full_members == 0) {
 		mgrp_send_notice(subn, log, mgrp, 67);
-		if (!mgrp->well_known)
-			mgrp->to_be_deleted = 1;
+		osm_mgrp_cleanup(subn, mgrp);
 	}
 
-	return ret;
+	subn->p_osm->sa.dirty = TRUE;
 }
 
-void osm_mgrp_delete_port(osm_subn_t *subn, osm_log_t *log, osm_mgrp_t *mgrp,
-			  ib_net64_t port_guid)
+void osm_mgrp_delete_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
+			  osm_port_t * port)
 {
-	cl_map_item_t *item = cl_qmap_get(&mgrp->mcm_port_tbl, port_guid);
-
-	if (item != cl_qmap_end(&mgrp->mcm_port_tbl))
-		osm_mgrp_remove_port(subn, log, mgrp, (osm_mcm_port_t *)item, 0xf);
-}
-
-/**********************************************************************
- **********************************************************************/
-boolean_t
-osm_mgrp_is_port_present(IN const osm_mgrp_t * const p_mgrp,
-			 IN const ib_net64_t port_guid,
-			 OUT osm_mcm_port_t ** const pp_mcm_port)
-{
-	cl_map_item_t *p_map_item;
-
-	CL_ASSERT(p_mgrp);
-
-	p_map_item = cl_qmap_get(&p_mgrp->mcm_port_tbl, port_guid);
-
-	if (p_map_item != cl_qmap_end(&p_mgrp->mcm_port_tbl)) {
-		if (pp_mcm_port)
-			*pp_mcm_port = (osm_mcm_port_t *) p_map_item;
-		return TRUE;
+	osm_mcm_alias_guid_t *mcm_alias_guid, *next_mcm_alias_guid;
+	ib_member_rec_t mcmrec;
+
+	next_mcm_alias_guid = (osm_mcm_alias_guid_t *) cl_qmap_head(&mgrp->mcm_alias_port_tbl);
+	while (next_mcm_alias_guid != (osm_mcm_alias_guid_t *) cl_qmap_end(&mgrp->mcm_alias_port_tbl)) {
+		mcm_alias_guid = next_mcm_alias_guid;
+		next_mcm_alias_guid = (osm_mcm_alias_guid_t *) cl_qmap_next(&next_mcm_alias_guid->map_item);
+		if (mcm_alias_guid->p_base_mcm_port->port == port) {
+			mcmrec.scope_state = 0xf;
+			osm_mgrp_remove_port(subn, log, mgrp, mcm_alias_guid,
+					     &mcmrec);
+		}
 	}
-	if (pp_mcm_port)
-		*pp_mcm_port = NULL;
-	return FALSE;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_mgrp_apply_func_sub(const osm_mgrp_t * const p_mgrp,
-			  const osm_mtree_node_t * const p_mtn,
-			  osm_mgrp_func_t p_func, void *context)
+osm_mcm_port_t *osm_mgrp_get_mcm_port(IN const osm_mgrp_t * p_mgrp,
+				      IN ib_net64_t port_guid)
 {
-	uint8_t i = 0;
-	uint8_t max_children;
-	osm_mtree_node_t *p_child_mtn;
-
-	/* Call the user, then recurse. */
-	p_func(p_mgrp, p_mtn, context);
-
-	max_children = osm_mtree_node_get_max_children(p_mtn);
-	for (i = 0; i < max_children; i++) {
-		p_child_mtn = osm_mtree_node_get_child(p_mtn, i);
-		if (p_child_mtn)
-			__osm_mgrp_apply_func_sub(p_mgrp, p_child_mtn, p_func,
-						  context);
-	}
+	cl_map_item_t *item = cl_qmap_get(&p_mgrp->mcm_port_tbl, port_guid);
+	if (item != cl_qmap_end(&p_mgrp->mcm_port_tbl))
+		return (osm_mcm_port_t *) item;
+	return NULL;
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_mgrp_apply_func(const osm_mgrp_t * const p_mgrp,
-		    osm_mgrp_func_t p_func, void *context)
+osm_mcm_alias_guid_t *osm_mgrp_get_mcm_alias_guid(IN const osm_mgrp_t * p_mgrp,
+						  IN ib_net64_t port_guid)
 {
-	osm_mtree_node_t *p_mtn;
-
-	CL_ASSERT(p_mgrp);
-	CL_ASSERT(p_func);
-
-	p_mtn = p_mgrp->p_root;
-
-	if (p_mtn)
-		__osm_mgrp_apply_func_sub(p_mgrp, p_mtn, p_func, context);
+	cl_map_item_t *item = cl_qmap_get(&p_mgrp->mcm_alias_port_tbl,
+					  port_guid);
+	if (item != cl_qmap_end(&p_mgrp->mcm_alias_port_tbl))
+		return (osm_mcm_alias_guid_t *) item;
+	return NULL;
 }
diff --git a/opensm/osm_node.c b/opensm/osm_node.c
index 07371a2..fc71e0f 100644
--- a/opensm/osm_node.c
+++ b/opensm/osm_node.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -46,25 +46,22 @@
 
 #include <stdlib.h>
 #include <iba/ib_types.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_NODE_C
 #include <opensm/osm_node.h>
 #include <opensm/osm_madw.h>
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_node_init_physp(IN osm_node_t * const p_node,
-		    IN const osm_madw_t * const p_madw)
+void osm_node_init_physp(IN osm_node_t * p_node, uint8_t port_num,
+			 IN const osm_madw_t * p_madw)
 {
 	ib_net64_t port_guid;
 	ib_smp_t *p_smp;
 	ib_node_info_t *p_ni;
-	uint8_t port_num;
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 
-	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
+	p_ni = ib_smp_get_payload_ptr(p_smp);
 	port_guid = p_ni->port_guid;
-	port_num = ib_node_info_get_local_port_num(p_ni);
 
 	CL_ASSERT(port_num < p_node->physp_tbl_size);
 
@@ -74,26 +71,7 @@ osm_node_init_physp(IN osm_node_t * const p_node,
 		       p_smp->hop_count, p_smp->initial_path);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void node_init_physp0(IN osm_node_t * const p_node,
-			     IN const osm_madw_t * const p_madw)
-{
-	ib_smp_t *p_smp;
-	ib_node_info_t *p_ni;
-
-	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
-
-	osm_physp_init(&p_node->physp_table[0],
-		       p_ni->port_guid, 0, p_node,
-		       osm_madw_get_bind_handle(p_madw),
-		       p_smp->hop_count, p_smp->initial_path);
-}
-
-/**********************************************************************
- **********************************************************************/
-osm_node_t *osm_node_new(IN const osm_madw_t * const p_madw)
+osm_node_t *osm_node_new(IN const osm_madw_t * p_madw)
 {
 	osm_node_t *p_node;
 	ib_smp_t *p_smp;
@@ -102,7 +80,7 @@ osm_node_t *osm_node_new(IN const osm_madw_t * const p_madw)
 	uint32_t size;
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
+	p_ni = ib_smp_get_payload_ptr(p_smp);
 
 	/*
 	   The node object already contains one physical port object.
@@ -133,17 +111,19 @@ osm_node_t *osm_node_new(IN const osm_madw_t * const p_madw)
 	for (i = 0; i < p_node->physp_tbl_size; i++)
 		osm_physp_construct(&p_node->physp_table[i]);
 
-	osm_node_init_physp(p_node, p_madw);
 	if (p_ni->node_type == IB_NODE_TYPE_SWITCH)
-		node_init_physp0(p_node, p_madw);
+		for (i = 0; i <= p_ni->num_ports; i++)
+			osm_node_init_physp(p_node, i, p_madw);
+	else
+		osm_node_init_physp(p_node,
+				    ib_node_info_get_local_port_num(p_ni),
+				    p_madw);
 	p_node->print_desc = strdup(OSM_NODE_DESC_UNKNOWN);
 
-	return (p_node);
+	return p_node;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void osm_node_destroy(IN osm_node_t * p_node)
+static void node_destroy(IN osm_node_t * p_node)
 {
 	uint16_t i;
 
@@ -154,28 +134,20 @@ static void osm_node_destroy(IN osm_node_t * p_node)
 		osm_physp_destroy(&p_node->physp_table[i]);
 
 	/* cleanup printable node_desc field */
-	if (p_node->print_desc) {
+	if (p_node->print_desc)
 		free(p_node->print_desc);
-	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_node_delete(IN OUT osm_node_t ** const p_node)
+void osm_node_delete(IN OUT osm_node_t ** p_node)
 {
 	CL_ASSERT(p_node && *p_node);
-	osm_node_destroy(*p_node);
+	node_destroy(*p_node);
 	free(*p_node);
 	*p_node = NULL;
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_node_link(IN osm_node_t * const p_node,
-	      IN const uint8_t port_num,
-	      IN osm_node_t * const p_remote_node,
-	      IN const uint8_t remote_port_num)
+void osm_node_link(IN osm_node_t * p_node, IN uint8_t port_num,
+		   IN osm_node_t * p_remote_node, IN uint8_t remote_port_num)
 {
 	osm_physp_t *p_physp;
 	osm_physp_t *p_remote_physp;
@@ -194,13 +166,8 @@ osm_node_link(IN osm_node_t * const p_node,
 	osm_physp_link(p_physp, p_remote_physp);
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_node_unlink(IN osm_node_t * const p_node,
-		IN const uint8_t port_num,
-		IN osm_node_t * const p_remote_node,
-		IN const uint8_t remote_port_num)
+void osm_node_unlink(IN osm_node_t * p_node, IN uint8_t port_num,
+		     IN osm_node_t * p_remote_node, IN uint8_t remote_port_num)
 {
 	osm_physp_t *p_physp;
 	osm_physp_t *p_remote_physp;
@@ -219,13 +186,9 @@ osm_node_unlink(IN osm_node_t * const p_node,
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-boolean_t
-osm_node_link_exists(IN osm_node_t * const p_node,
-		     IN const uint8_t port_num,
-		     IN osm_node_t * const p_remote_node,
-		     IN const uint8_t remote_port_num)
+boolean_t osm_node_link_exists(IN osm_node_t * p_node, IN uint8_t port_num,
+			       IN osm_node_t * p_remote_node,
+			       IN uint8_t remote_port_num)
 {
 	osm_physp_t *p_physp;
 	osm_physp_t *p_remote_physp;
@@ -236,16 +199,13 @@ osm_node_link_exists(IN osm_node_t * const p_node,
 	p_physp = osm_node_get_physp_ptr(p_node, port_num);
 	p_remote_physp = osm_node_get_physp_ptr(p_remote_node, remote_port_num);
 
-	return (osm_physp_link_exists(p_physp, p_remote_physp));
+	return osm_physp_link_exists(p_physp, p_remote_physp);
 }
 
-/**********************************************************************
- **********************************************************************/
-boolean_t
-osm_node_link_has_valid_ports(IN osm_node_t * const p_node,
-			      IN const uint8_t port_num,
-			      IN osm_node_t * const p_remote_node,
-			      IN const uint8_t remote_port_num)
+boolean_t osm_node_link_has_valid_ports(IN osm_node_t * p_node,
+					IN uint8_t port_num,
+					IN osm_node_t * p_remote_node,
+					IN uint8_t remote_port_num)
 {
 	osm_physp_t *p_physp;
 	osm_physp_t *p_remote_physp;
@@ -259,21 +219,16 @@ osm_node_link_has_valid_ports(IN osm_node_t * const p_node,
 	return (p_physp && p_remote_physp);
 }
 
-/**********************************************************************
- **********************************************************************/
-boolean_t
-osm_node_has_any_link(IN osm_node_t * const p_node, IN const uint8_t port_num)
+boolean_t osm_node_has_any_link(IN osm_node_t * p_node, IN uint8_t port_num)
 {
 	osm_physp_t *p_physp;
 	CL_ASSERT(port_num < p_node->physp_tbl_size);
 	p_physp = osm_node_get_physp_ptr(p_node, port_num);
-	return (osm_physp_has_any_link(p_physp));
+	return osm_physp_has_any_link(p_physp);
 }
 
-/**********************************************************************
- **********************************************************************/
-osm_node_t *osm_node_get_remote_node(IN osm_node_t * const p_node,
-				     IN const uint8_t port_num,
+osm_node_t *osm_node_get_remote_node(IN osm_node_t * p_node,
+				     IN uint8_t port_num,
 				     OUT uint8_t * p_remote_port_num)
 {
 	osm_physp_t *p_physp;
@@ -282,21 +237,20 @@ osm_node_t *osm_node_get_remote_node(IN osm_node_t * const p_node,
 	p_physp = osm_node_get_physp_ptr(p_node, port_num);
 
 	if (!p_physp || !osm_physp_has_any_link(p_physp))
-		return (NULL);
+		return NULL;
 
 	p_remote_physp = osm_physp_get_remote(p_physp);
 	if (p_remote_port_num)
 		*p_remote_port_num = osm_physp_get_port_num(p_remote_physp);
 
-	return (osm_physp_get_node_ptr(p_remote_physp));
+	return osm_physp_get_node_ptr(p_remote_physp);
 }
 
 /**********************************************************************
  The lock must be held before calling this function.
 **********************************************************************/
-ib_net16_t
-osm_node_get_remote_base_lid(IN osm_node_t * const p_node,
-			     IN const uint32_t port_num)
+ib_net16_t osm_node_get_remote_base_lid(IN osm_node_t * p_node,
+					IN uint32_t port_num)
 {
 	osm_physp_t *p_physp;
 	osm_physp_t *p_remote_physp;
@@ -305,8 +259,8 @@ osm_node_get_remote_base_lid(IN osm_node_t * const p_node,
 	p_physp = osm_node_get_physp_ptr(p_node, port_num);
 	if (p_physp) {
 		p_remote_physp = osm_physp_get_remote(p_physp);
-		return (osm_physp_get_base_lid(p_remote_physp));
+		return osm_physp_get_base_lid(p_remote_physp);
 	}
 
-	return (0);
+	return 0;
 }
diff --git a/opensm/osm_node_desc_rcv.c b/opensm/osm_node_desc_rcv.c
index f6178b9..741c944 100644
--- a/opensm/osm_node_desc_rcv.c
+++ b/opensm/osm_node_desc_rcv.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -49,18 +49,16 @@
 #include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_NODE_DESC_RCV_C
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_subnet.h>
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_nd_rcv_process_nd(IN osm_sm_t * sm,
-			IN osm_node_t * const p_node,
-			IN const ib_node_desc_t * const p_nd)
+static void nd_rcv_process_nd(IN osm_sm_t * sm, IN osm_node_t * p_node,
+			      IN const ib_node_desc_t * p_nd)
 {
 	char *tmp_desc;
 	char print_desc[IB_NODE_DESCRIPTION_SIZE + 1];
@@ -73,8 +71,8 @@ __osm_nd_rcv_process_nd(IN osm_sm_t * sm,
 	memcpy(print_desc, p_nd, sizeof(*p_nd));
 	print_desc[IB_NODE_DESCRIPTION_SIZE] = '\0';
 	tmp_desc = remap_node_name(sm->p_subn->p_osm->node_name_map,
-			cl_ntoh64(osm_node_get_node_guid(p_node)),
-			print_desc);
+				   cl_ntoh64(osm_node_get_node_guid(p_node)),
+				   print_desc);
 
 	/* make a copy for this node to "own" */
 	if (p_node->print_desc)
@@ -88,8 +86,6 @@ __osm_nd_rcv_process_nd(IN osm_sm_t * sm,
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_nd_rcv_process(IN void *context, IN void *data)
 {
 	osm_sm_t *sm = context;
@@ -106,22 +102,18 @@ void osm_nd_rcv_process(IN void *context, IN void *data)
 	CL_ASSERT(p_madw);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_nd = (ib_node_desc_t *) ib_smp_get_payload_ptr(p_smp);
-
-	/*
-	   Acquire the node object and add the node description.
-	 */
+	p_nd = ib_smp_get_payload_ptr(p_smp);
 
+	/* Acquire the node object and add the node description. */
 	node_guid = osm_madw_get_nd_context_ptr(p_madw)->node_guid;
 	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
 	p_node = osm_get_node_by_guid(sm->p_subn, node_guid);
-	if (!p_node) {
+	if (!p_node)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0B01: "
 			"NodeDescription received for nonexistent node "
 			"0x%" PRIx64 "\n", cl_ntoh64(node_guid));
-	} else {
-		__osm_nd_rcv_process_nd(sm, p_node, p_nd);
-	}
+	else
+		nd_rcv_process_nd(sm, p_node, p_nd);
 
 	CL_PLOCK_RELEASE(sm->p_lock);
 	OSM_LOG_EXIT(sm->p_log);
diff --git a/opensm/osm_node_info_rcv.c b/opensm/osm_node_info_rcv.c
index 4d3724c..36d8046 100644
--- a/opensm/osm_node_info_rcv.c
+++ b/opensm/osm_node_info_rcv.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -50,6 +51,8 @@
 #include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_NODE_INFO_RCV_C
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
@@ -60,11 +63,11 @@
 #include <opensm/osm_msgdef.h>
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_ucast_mgr.h>
+#include <opensm/osm_db_pack.h>
 
-static void
-report_duplicated_guid(IN osm_sm_t * sm,
-		       osm_physp_t * p_physp,
-		       osm_node_t * p_neighbor_node, const uint8_t port_num)
+static void report_duplicated_guid(IN osm_sm_t * sm, osm_physp_t * p_physp,
+				   osm_node_t * p_neighbor_node,
+				   const uint8_t port_num)
 {
 	osm_physp_t *p_old, *p_new;
 	osm_dr_path_t path;
@@ -72,8 +75,8 @@ report_duplicated_guid(IN osm_sm_t * sm,
 	p_old = p_physp->p_remote_physp;
 	p_new = osm_node_get_physp_ptr(p_neighbor_node, port_num);
 
-	OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D01: "
-		"Found duplicated node.\n"
+	OSM_LOG(sm->p_log, OSM_LOG_SYS | OSM_LOG_ERROR, "ERR 0D01: "
+		"Found duplicated node GUID.\n"
 		"Node 0x%" PRIx64 " port %u is reachable from remote node "
 		"0x%" PRIx64 " port %u and remote node 0x%" PRIx64 " port %u.\n"
 		"Paths are:\n",
@@ -82,26 +85,31 @@ report_duplicated_guid(IN osm_sm_t * sm,
 		cl_ntoh64(p_old->p_node->node_info.node_guid), p_old->port_num,
 		cl_ntoh64(p_new->p_node->node_info.node_guid), p_new->port_num);
 
-	osm_dump_dr_path(sm->p_log, osm_physp_get_dr_path_ptr(p_physp),
-			 OSM_LOG_ERROR);
+	osm_dump_dr_path_v2(sm->p_log, osm_physp_get_dr_path_ptr(p_physp),
+			    FILE_ID, OSM_LOG_ERROR);
 
 	path = *osm_physp_get_dr_path_ptr(p_new);
-	osm_dr_path_extend(&path, port_num);
-	osm_dump_dr_path(sm->p_log, &path, OSM_LOG_ERROR);
-
-	osm_log(sm->p_log, OSM_LOG_SYS,
-		"FATAL: duplicated guids or 12x lane reversal\n");
+	if (osm_dr_path_extend(&path, port_num))
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D05: "
+			"DR path with hop count %d couldn't be extended\n",
+			path.hop_count);
+	osm_dump_dr_path_v2(sm->p_log, &path, FILE_ID, OSM_LOG_ERROR);
 }
 
-static void requery_dup_node_info(IN osm_sm_t * sm,
-				  osm_physp_t * p_physp, unsigned count)
+static void requery_dup_node_info(IN osm_sm_t * sm, osm_physp_t * p_physp,
+				  unsigned count)
 {
 	osm_madw_context_t context;
 	osm_dr_path_t path;
 	cl_status_t status;
 
 	path = *osm_physp_get_dr_path_ptr(p_physp->p_remote_physp);
-	osm_dr_path_extend(&path, p_physp->p_remote_physp->port_num);
+	if (osm_dr_path_extend(&path, p_physp->p_remote_physp->port_num)) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D08: "
+			"DR path with hop count %d couldn't be extended\n",
+			path.hop_count);
+		return;
+	}
 
 	context.ni_context.node_guid =
 	    p_physp->p_remote_physp->p_node->node_info.port_guid;
@@ -110,8 +118,8 @@ static void requery_dup_node_info(IN osm_sm_t * sm,
 	context.ni_context.dup_port_num = p_physp->port_num;
 	context.ni_context.dup_count = count;
 
-	status = osm_req_get(sm, &path, IB_MAD_ATTR_NODE_INFO,
-			     0, CL_DISP_MSGID_NONE, &context);
+	status = osm_req_get(sm, &path, IB_MAD_ATTR_NODE_INFO, 0,
+			     CL_DISP_MSGID_NONE, &context);
 
 	if (status != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D02: "
@@ -122,14 +130,12 @@ static void requery_dup_node_info(IN osm_sm_t * sm,
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
-static void
-__osm_ni_rcv_set_links(IN osm_sm_t * sm,
-		       osm_node_t * p_node,
-		       const uint8_t port_num,
-		       const osm_ni_context_t * const p_ni_context)
+static void ni_rcv_set_links(IN osm_sm_t * sm, osm_node_t * p_node,
+			     const uint8_t port_num,
+			     const osm_ni_context_t * p_ni_context)
 {
 	osm_node_t *p_neighbor_node;
-	osm_physp_t *p_physp;
+	osm_physp_t *p_physp, *p_remote_physp;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -149,22 +155,16 @@ __osm_ni_rcv_set_links(IN osm_sm_t * sm,
 					       p_ni_context->node_guid);
 	if (!p_neighbor_node) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D10: "
-			"Unexpected removal of neighbor node "
-			"0x%" PRIx64 "\n", cl_ntoh64(p_ni_context->node_guid));
+			"Unexpected removal of neighbor node 0x%" PRIx64 "\n",
+			cl_ntoh64(p_ni_context->node_guid));
 		goto _exit;
 	}
 
 	/* When setting the link, ports on both
 	   sides of the link should be initialized */
-	if (!osm_node_link_has_valid_ports(p_node, port_num,
-					   p_neighbor_node,
-					   p_ni_context->port_num)) {
-		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-			"Link at node 0x%" PRIx64 ", port %u - no valid ports\n",
-			cl_ntoh64(osm_node_get_node_guid(p_node)), port_num);
-		CL_ASSERT(0);
-		goto _exit;
-	}
+	CL_ASSERT(osm_node_link_has_valid_ports(p_node, port_num,
+						p_neighbor_node,
+						p_ni_context->port_num));
 
 	if (osm_node_link_exists(p_node, port_num,
 				 p_neighbor_node, p_ni_context->port_num)) {
@@ -183,19 +183,18 @@ __osm_ni_rcv_set_links(IN osm_sm_t * sm,
 		   (2 nodes have the same guid) or a 12x link with lane reversal
 		   that is not configured correctly.
 		   We will try to recover by querying NodeInfo again.
-		   In order to catch even fast port moving to new location(s) and
-		   back we will count up to 5.
-		   Some crazy reconnections (newly created switch loop right before
-		   targeted CA) will not be catched this way. So in worst case -
-		   report GUID duplication and request new discovery.
-		   When switch node is targeted NodeInfo querying will be done in
-		   opposite order, this is much stronger check, unfortunately it is
-		   impossible with CAs.
+		   In order to catch even fast port moving to new location(s)
+		   and back we will count up to 5.
+		   Some crazy reconnections (newly created switch loop right
+		   before targeted CA) will not be catched this way. So in worst
+		   case - report GUID duplication and request new discovery.
+		   When switch node is targeted NodeInfo querying will be done
+		   in opposite order, this is much stronger check, unfortunately
+		   it is impossible with CAs.
 		 */
 		p_physp = osm_node_get_physp_ptr(p_node, port_num);
 		if (p_ni_context->dup_count > 5) {
-			report_duplicated_guid(sm, p_physp,
-					       p_neighbor_node,
+			report_duplicated_guid(sm, p_physp, p_neighbor_node,
 					       p_ni_context->port_num);
 			sm->p_subn->force_heavy_sweep = TRUE;
 		} else if (p_node->sw)
@@ -212,23 +211,22 @@ __osm_ni_rcv_set_links(IN osm_sm_t * sm,
 	   them. But the link will be from the port to itself...
 	   Enhanced Port 0 is an exception to this
 	 */
-	if ((osm_node_get_node_guid(p_node) == p_ni_context->node_guid) &&
-	    (port_num == p_ni_context->port_num) &&
+	if (osm_node_get_node_guid(p_node) == p_ni_context->node_guid &&
+	    port_num == p_ni_context->port_num &&
 	    port_num != 0 && cl_qmap_count(&sm->p_subn->sw_guid_tbl) == 0) {
 		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 			"Duplicate GUID found by link from a port to itself:"
 			"node 0x%" PRIx64 ", port number %u\n",
 			cl_ntoh64(osm_node_get_node_guid(p_node)), port_num);
 		p_physp = osm_node_get_physp_ptr(p_node, port_num);
-		osm_dump_dr_path(sm->p_log,
-				 osm_physp_get_dr_path_ptr(p_physp),
-				 OSM_LOG_VERBOSE);
+		osm_dump_dr_path_v2(sm->p_log, osm_physp_get_dr_path_ptr(p_physp),
+				    FILE_ID, OSM_LOG_VERBOSE);
 
 		if (sm->p_subn->opt.exit_on_fatal == TRUE) {
-			osm_log(sm->p_log, OSM_LOG_SYS,
-				"Errors on subnet. Duplicate GUID found "
-				"by link from a port to itself. "
-				"See verbose opensm.log for more details\n");
+			osm_log_v2(sm->p_log, OSM_LOG_SYS, FILE_ID,
+				   "Errors on subnet. Duplicate GUID found "
+				   "by link from a port to itself. "
+				   "See verbose opensm.log for more details\n");
 			exit(1);
 		}
 	}
@@ -241,72 +239,88 @@ __osm_ni_rcv_set_links(IN osm_sm_t * sm,
 		cl_ntoh64(p_ni_context->node_guid), p_ni_context->port_num);
 
 	if (sm->ucast_mgr.cache_valid)
-		osm_ucast_cache_check_new_link(&sm->ucast_mgr,
-					       p_node, port_num,
+		osm_ucast_cache_check_new_link(&sm->ucast_mgr, p_node, port_num,
 					       p_neighbor_node,
 					       p_ni_context->port_num);
 
 	osm_node_link(p_node, port_num, p_neighbor_node,
 		      p_ni_context->port_num);
 
+	p_physp = osm_node_get_physp_ptr(p_node, port_num);
+	p_remote_physp = osm_node_get_physp_ptr(p_neighbor_node,
+						p_ni_context->port_num);
+	osm_db_neighbor_set(sm->p_subn->p_neighbor,
+			    cl_ntoh64(osm_physp_get_port_guid(p_physp)),
+			    port_num,
+			    cl_ntoh64(osm_physp_get_port_guid(p_remote_physp)),
+			    p_ni_context->port_num);
+	osm_db_neighbor_set(sm->p_subn->p_neighbor,
+			    cl_ntoh64(osm_physp_get_port_guid(p_remote_physp)),
+			    p_ni_context->port_num,
+			    cl_ntoh64(osm_physp_get_port_guid(p_physp)),
+			    port_num);
+
 _exit:
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- The plock must be held before calling this function.
-**********************************************************************/
-static void
-__osm_ni_rcv_process_new_node(IN osm_sm_t * sm,
-			      IN osm_node_t * const p_node,
-			      IN const osm_madw_t * const p_madw)
+static void ni_rcv_get_port_info(IN osm_sm_t * sm, IN osm_node_t * node,
+				 IN const osm_madw_t * madw)
 {
-	ib_api_status_t status = IB_SUCCESS;
 	osm_madw_context_t context;
-	osm_physp_t *p_physp;
-	ib_node_info_t *p_ni;
-	ib_smp_t *p_smp;
-	uint8_t port_num;
+	osm_physp_t *physp;
+	ib_node_info_t *ni;
+	unsigned port, num_ports;
+	ib_api_status_t status;
+	int mlnx_epi_supported = 0;
 
-	OSM_LOG_ENTER(sm->p_log);
+	ni = ib_smp_get_payload_ptr(osm_madw_get_smp_ptr(madw));
 
-	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
-	port_num = ib_node_info_get_local_port_num(p_ni);
+	if (ni->node_type == IB_NODE_TYPE_SWITCH) {
+		port = 0;
+		num_ports = osm_node_get_num_physp(node);
+	} else {
+		port = ib_node_info_get_local_port_num(ni);
+		num_ports = port + 1;
+	}
 
-	/*
-	   Request PortInfo & NodeDescription attributes for the port
-	   that responded to the NodeInfo attribute.
-	   Because this is a channel adapter or router, we are
-	   not allowed to request PortInfo for the other ports.
-	   Set the context union properly, so the recipient
-	   knows which node & port are relevant.
-	 */
-	p_physp = osm_node_get_physp_ptr(p_node, port_num);
+	if (sm->p_subn->opt.fdr10)
+		mlnx_epi_supported = is_mlnx_ext_port_info_supported(ni->device_id);
+
+	physp = osm_node_get_physp_ptr(node, port);
 
-	context.pi_context.node_guid = p_ni->node_guid;
-	context.pi_context.port_guid = p_ni->port_guid;
+	context.pi_context.node_guid = osm_node_get_node_guid(node);
+	context.pi_context.port_guid = osm_physp_get_port_guid(physp);
 	context.pi_context.set_method = FALSE;
 	context.pi_context.light_sweep = FALSE;
 	context.pi_context.active_transition = FALSE;
 
-	status = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_physp),
-			     IB_MAD_ATTR_PORT_INFO,
-			     cl_hton32(port_num), CL_DISP_MSGID_NONE, &context);
-	if (status != IB_SUCCESS)
-		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D02: "
-			"Failure initiating PortInfo request (%s)\n",
-			ib_get_err_str(status));
-
-	OSM_LOG_EXIT(sm->p_log);
+	for (; port < num_ports; port++) {
+		status = osm_req_get(sm, osm_physp_get_dr_path_ptr(physp),
+				     IB_MAD_ATTR_PORT_INFO, cl_hton32(port),
+				     CL_DISP_MSGID_NONE, &context);
+		if (status != IB_SUCCESS)
+			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR OD02: "
+				"Failure initiating PortInfo request (%s)\n",
+				ib_get_err_str(status));
+		if (mlnx_epi_supported) {
+			status = osm_req_get(sm,
+					     osm_physp_get_dr_path_ptr(physp),
+					     IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO,
+					     cl_hton32(port),
+					     CL_DISP_MSGID_NONE, &context);
+			if (status != IB_SUCCESS)
+				OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D0B: "
+					"Failure initiating MLNX ExtPortInfo request (%s)\n",
+					ib_get_err_str(status));
+		}
+	}
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
-void
-osm_req_get_node_desc(IN osm_sm_t * sm,
-			osm_physp_t *p_physp)
+void osm_req_get_node_desc(IN osm_sm_t * sm, osm_physp_t * p_physp)
 {
 	ib_api_status_t status = IB_SUCCESS;
 	osm_madw_context_t context;
@@ -314,11 +328,11 @@ osm_req_get_node_desc(IN osm_sm_t * sm,
 	OSM_LOG_ENTER(sm->p_log);
 
 	context.nd_context.node_guid =
-		osm_node_get_node_guid(osm_physp_get_node_ptr(p_physp));
+	    osm_node_get_node_guid(osm_physp_get_node_ptr(p_physp));
 
 	status = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_physp),
-			     IB_MAD_ATTR_NODE_DESC,
-			     0, CL_DISP_MSGID_NONE, &context);
+			     IB_MAD_ATTR_NODE_DESC, 0, CL_DISP_MSGID_NONE,
+			     &context);
 	if (status != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D03: "
 			"Failure initiating NodeDescription request (%s)\n",
@@ -330,10 +344,8 @@ osm_req_get_node_desc(IN osm_sm_t * sm,
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
-static void
-__osm_ni_rcv_get_node_desc(IN osm_sm_t * sm,
-			   IN osm_node_t * const p_node,
-			   IN const osm_madw_t * const p_madw)
+static void ni_rcv_get_node_desc(IN osm_sm_t * sm, IN osm_node_t * p_node,
+				 IN const osm_madw_t * p_madw)
 {
 	ib_node_info_t *p_ni;
 	ib_smp_t *p_smp;
@@ -343,7 +355,7 @@ __osm_ni_rcv_get_node_desc(IN osm_sm_t * sm,
 	OSM_LOG_ENTER(sm->p_log);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
+	p_ni = ib_smp_get_payload_ptr(p_smp);
 	port_num = ib_node_info_get_local_port_num(p_ni);
 
 	/*
@@ -364,14 +376,13 @@ __osm_ni_rcv_get_node_desc(IN osm_sm_t * sm,
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
-static void
-__osm_ni_rcv_process_new_ca_or_router(IN osm_sm_t * sm,
-				      IN osm_node_t * const p_node,
-				      IN const osm_madw_t * const p_madw)
+static void ni_rcv_process_new_ca_or_router(IN osm_sm_t * sm,
+					    IN osm_node_t * p_node,
+					    IN const osm_madw_t * p_madw)
 {
 	OSM_LOG_ENTER(sm->p_log);
 
-	__osm_ni_rcv_process_new_node(sm, p_node, p_madw);
+	ni_rcv_get_port_info(sm, p_node, p_madw);
 
 	/*
 	   A node guid of 0 is the corner case that indicates
@@ -387,28 +398,23 @@ __osm_ni_rcv_process_new_ca_or_router(IN osm_sm_t * sm,
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
-static void
-__osm_ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm,
-					   IN osm_node_t * const p_node,
-					   IN const osm_madw_t * const p_madw)
+static void ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm,
+						 IN osm_node_t * p_node,
+						 IN const osm_madw_t * p_madw)
 {
 	ib_node_info_t *p_ni;
 	ib_smp_t *p_smp;
 	osm_port_t *p_port;
 	osm_port_t *p_port_check;
-	osm_madw_context_t context;
 	uint8_t port_num;
-	osm_physp_t *p_physp;
-	ib_api_status_t status;
 	osm_dr_path_t *p_dr_path;
-	osm_bind_handle_t h_bind;
+	osm_alias_guid_t *p_alias_guid, *p_alias_guid_check;
 
 	OSM_LOG_ENTER(sm->p_log);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
+	p_ni = ib_smp_get_payload_ptr(p_smp);
 	port_num = ib_node_info_get_local_port_num(p_ni);
-	h_bind = osm_madw_get_bind_handle(p_madw);
 
 	/*
 	   Determine if we have encountered this node through a
@@ -421,7 +427,7 @@ __osm_ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm,
 			"Creating new port object with GUID 0x%" PRIx64 "\n",
 			cl_ntoh64(p_ni->port_guid));
 
-		osm_node_init_physp(p_node, p_madw);
+		osm_node_init_physp(p_node, port_num, p_madw);
 
 		p_port = osm_port_new(p_ni, p_node);
 		if (p_port == NULL) {
@@ -450,8 +456,34 @@ __osm_ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm,
 			goto Exit;
 		}
 
+		p_alias_guid = osm_alias_guid_new(p_ni->port_guid,
+						  p_port);
+		if (!p_alias_guid) {
+			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D11: "
+				"alias guid memory allocation failed"
+				" for port GUID 0x%" PRIx64 "\n",
+				cl_ntoh64(p_ni->port_guid));
+			goto alias_done;
+		}
+
+		/* insert into alias guid table */
+		p_alias_guid_check =
+			(osm_alias_guid_t *) cl_qmap_insert(&sm->p_subn->alias_port_guid_tbl,
+							    p_alias_guid->alias_guid,
+							    &p_alias_guid->map_item);
+		if (p_alias_guid_check != p_alias_guid) {
+			/* alias GUID is a duplicate */
+			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D13: "
+				"Duplicate alias port GUID 0x%" PRIx64 "\n",
+				cl_ntoh64(p_ni->port_guid));
+			osm_alias_guid_delete(&p_alias_guid);
+			osm_port_delete(&p_port);
+			goto Exit;
+		}
+
+alias_done:
 		/* If we are a master, then this means the port is new on the subnet.
-		   Mark it as new - need to send trap 64 on these ports.
+		   Mark it as new - need to send trap 64 for these ports.
 		   The condition that we are master is true, since if we are in discovering
 		   state (meaning we woke up from standby or we are just initializing),
 		   then these ports may be new to us, but are not new on the subnet.
@@ -460,43 +492,36 @@ __osm_ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm,
 		if (sm->p_subn->sm_state == IB_SMINFO_STATE_MASTER)
 			p_port->is_new = 1;
 
-		p_physp = osm_node_get_physp_ptr(p_node, port_num);
 	} else {
-		p_physp = osm_node_get_physp_ptr(p_node, port_num);
+		osm_physp_t *p_physp = osm_node_get_physp_ptr(p_node, port_num);
+
+		if (p_physp == NULL) {
+			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D1C: "
+				"No physical port found for node GUID 0x%"
+				PRIx64 " port %u. Might be duplicate port GUID\n",
+				cl_ntoh64(p_node->node_info.node_guid),
+				port_num);
+			goto Exit;
+		}
+
 		/*
 		   Update the DR Path to the port,
 		   in case the old one is no longer available.
 		 */
 		p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
 
-		osm_dr_path_init(p_dr_path, h_bind, p_smp->hop_count,
+		osm_dr_path_init(p_dr_path, p_smp->hop_count,
 				 p_smp->initial_path);
 	}
 
-	context.pi_context.node_guid = p_ni->node_guid;
-	context.pi_context.port_guid = p_ni->port_guid;
-	context.pi_context.set_method = FALSE;
-	context.pi_context.light_sweep = FALSE;
-
-	status = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_physp),
-			     IB_MAD_ATTR_PORT_INFO,
-			     cl_hton32(port_num), CL_DISP_MSGID_NONE, &context);
-
-	if (status != IB_SUCCESS)
-		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D13: "
-			"Failure initiating PortInfo request (%s)\n",
-			ib_get_err_str(status));
+	ni_rcv_get_port_info(sm, p_node, p_madw);
 
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_ni_rcv_process_switch(IN osm_sm_t * sm,
-			    IN osm_node_t * const p_node,
-			    IN const osm_madw_t * const p_madw)
+static void ni_rcv_process_switch(IN osm_sm_t * sm, IN osm_node_t * p_node,
+				  IN const osm_madw_t * p_madw)
 {
 	ib_api_status_t status = IB_SUCCESS;
 	osm_madw_context_t context;
@@ -509,8 +534,7 @@ __osm_ni_rcv_process_switch(IN osm_sm_t * sm,
 
 	/* update DR path of already initialized switch port 0 */
 	path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));
-	osm_dr_path_init(path, osm_madw_get_bind_handle(p_madw),
-			 p_smp->hop_count, p_smp->initial_path);
+	osm_dr_path_init(path, p_smp->hop_count, p_smp->initial_path);
 
 	context.si_context.node_guid = osm_node_get_node_guid(p_node);
 	context.si_context.set_method = FALSE;
@@ -525,37 +549,21 @@ __osm_ni_rcv_process_switch(IN osm_sm_t * sm,
 			"Failure initiating SwitchInfo request (%s)\n",
 			ib_get_err_str(status));
 
+	if (p_node->discovery_count == 1)
+		ni_rcv_get_port_info(sm, p_node, p_madw);
+
 	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
-static void
-__osm_ni_rcv_process_existing_switch(IN osm_sm_t * sm,
-				     IN osm_node_t * const p_node,
-				     IN const osm_madw_t * const p_madw)
+static void ni_rcv_process_existing_switch(IN osm_sm_t * sm,
+					   IN osm_node_t * p_node,
+					   IN const osm_madw_t * p_madw)
 {
-
-	ib_smp_t *p_smp;
-	ib_node_info_t *p_ni;
-	uint8_t port_num;
-
 	OSM_LOG_ENTER(sm->p_log);
 
-	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
-	port_num = ib_node_info_get_local_port_num(p_ni);
-
-	if (!osm_node_get_physp_ptr(p_node, port_num)) {
-		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-			"Creating physp for node GUID:0x%"
-			PRIx64 ", port %u\n",
-			cl_ntoh64(osm_node_get_node_guid(p_node)),
-			port_num);
-		osm_node_init_physp(p_node, p_madw);
-	}
-
 	/*
 	   If this switch has already been probed during this sweep,
 	   then don't bother reprobing it.
@@ -565,13 +573,13 @@ __osm_ni_rcv_process_existing_switch(IN osm_sm_t * sm,
 	   to retry to probe the switch.
 	 */
 	if (p_node->discovery_count == 1)
-		__osm_ni_rcv_process_switch(sm, p_node, p_madw);
-	else if (!p_node->sw || p_node->sw->discovery_count == 0) {
+		ni_rcv_process_switch(sm, p_node, p_madw);
+	else if (!p_node->sw) {
 		/* we don't have the SwitchInfo - retry to get it */
 		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-			"Retry to get SwitchInfo on node GUID:0x%"
-			PRIx64 "\n", cl_ntoh64(osm_node_get_node_guid(p_node)));
-		__osm_ni_rcv_process_switch(sm, p_node, p_madw);
+			"Retry to get SwitchInfo on node GUID:0x%" PRIx64 "\n",
+			cl_ntoh64(osm_node_get_node_guid(p_node)));
+		ni_rcv_process_switch(sm, p_node, p_madw);
 	}
 
 	OSM_LOG_EXIT(sm->p_log);
@@ -580,14 +588,12 @@ __osm_ni_rcv_process_existing_switch(IN osm_sm_t * sm,
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
-static void
-__osm_ni_rcv_process_new_switch(IN osm_sm_t * sm,
-				IN osm_node_t * const p_node,
-				IN const osm_madw_t * const p_madw)
+static void ni_rcv_process_new_switch(IN osm_sm_t * sm, IN osm_node_t * p_node,
+				      IN const osm_madw_t * p_madw)
 {
 	OSM_LOG_ENTER(sm->p_log);
 
-	__osm_ni_rcv_process_switch(sm, p_node, p_madw);
+	ni_rcv_process_switch(sm, p_node, p_madw);
 
 	/*
 	   A node guid of 0 is the corner case that indicates
@@ -603,9 +609,7 @@ __osm_ni_rcv_process_new_switch(IN osm_sm_t * sm,
 /**********************************************************************
  The plock must NOT be held before calling this function.
 **********************************************************************/
-static void
-__osm_ni_rcv_process_new(IN osm_sm_t * sm,
-			 IN const osm_madw_t * const p_madw)
+static void ni_rcv_process_new(IN osm_sm_t * sm, IN const osm_madw_t * p_madw)
 {
 	osm_node_t *p_node;
 	osm_node_t *p_node_check;
@@ -617,16 +621,17 @@ __osm_ni_rcv_process_new(IN osm_sm_t * sm,
 	ib_node_info_t *p_ni;
 	ib_smp_t *p_smp;
 	osm_ni_context_t *p_ni_context;
+	osm_alias_guid_t *p_alias_guid, *p_alias_guid_check;
 	uint8_t port_num;
 
 	OSM_LOG_ENTER(sm->p_log);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
+	p_ni = ib_smp_get_payload_ptr(p_smp);
 	p_ni_context = osm_madw_get_ni_context_ptr(p_madw);
 	port_num = ib_node_info_get_local_port_num(p_ni);
 
-	osm_dump_smp_dr_path(sm->p_log, p_smp, OSM_LOG_VERBOSE);
+	osm_dump_smp_dr_path_v2(sm->p_log, p_smp, FILE_ID, OSM_LOG_VERBOSE);
 
 	OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 		"Discovered new %s node,"
@@ -634,6 +639,17 @@ __osm_ni_rcv_process_new(IN osm_sm_t * sm,
 		ib_get_node_type_str(p_ni->node_type),
 		cl_ntoh64(p_ni->node_guid), cl_ntoh64(p_smp->trans_id));
 
+	if (port_num > p_ni->num_ports) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D0A: "
+			"New %s node GUID 0x%" PRIx64 "is non-compliant and "
+			"is being ignored since the "
+			"local port num %u > num ports %u\n",
+			ib_get_node_type_str(p_ni->node_type),
+			cl_ntoh64(p_ni->node_guid), port_num,
+			p_ni->num_ports);
+		goto Exit;
+	}
+
 	p_node = osm_node_new(p_madw);
 	if (p_node == NULL) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D07: "
@@ -668,18 +684,42 @@ __osm_ni_rcv_process_new(IN osm_sm_t * sm,
 			"Duplicate Port GUID 0x%" PRIx64
 			"! Found by the two directed routes:\n",
 			cl_ntoh64(p_ni->port_guid));
-		osm_dump_dr_path(sm->p_log,
-				 osm_physp_get_dr_path_ptr(p_port->p_physp),
-				 OSM_LOG_ERROR);
-		osm_dump_dr_path(sm->p_log,
-				 osm_physp_get_dr_path_ptr(p_port_check->
+		osm_dump_dr_path_v2(sm->p_log,
+				    osm_physp_get_dr_path_ptr(p_port->p_physp),
+				    FILE_ID, OSM_LOG_ERROR);
+		osm_dump_dr_path_v2(sm->p_log,
+				    osm_physp_get_dr_path_ptr(p_port_check->
 							   p_physp),
-				 OSM_LOG_ERROR);
+				    FILE_ID, OSM_LOG_ERROR);
 		osm_port_delete(&p_port);
 		osm_node_delete(&p_node);
 		goto Exit;
 	}
 
+	p_alias_guid = osm_alias_guid_new(p_ni->port_guid,
+					  p_port);
+	if (!p_alias_guid) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D18: "
+			"alias guid memory allocation failed"
+			" for port GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(p_ni->port_guid));
+		goto alias_done2;
+	}
+
+	/* insert into alias guid table */
+	p_alias_guid_check =
+		(osm_alias_guid_t *) cl_qmap_insert(&sm->p_subn->alias_port_guid_tbl,
+						    p_alias_guid->alias_guid,
+						    &p_alias_guid->map_item);
+	if (p_alias_guid_check != p_alias_guid) {
+		/* alias GUID is a duplicate */
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D19: "
+			"Duplicate alias port GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(p_ni->port_guid));
+		osm_alias_guid_delete(&p_alias_guid);
+	}
+
+alias_done2:
 	/* If we are a master, then this means the port is new on the subnet.
 	   Mark it as new - need to send trap 64 on these ports.
 	   The condition that we are master is true, since if we are in discovering
@@ -725,21 +765,21 @@ __osm_ni_rcv_process_new(IN osm_sm_t * sm,
 			cl_ntoh64(p_ni->node_guid));
 		osm_node_delete(&p_node);
 		p_node = p_node_check;
-		__osm_ni_rcv_set_links(sm, p_node, port_num, p_ni_context);
+		ni_rcv_set_links(sm, p_node, port_num, p_ni_context);
 		goto Exit;
 	} else
-		__osm_ni_rcv_set_links(sm, p_node, port_num, p_ni_context);
+		ni_rcv_set_links(sm, p_node, port_num, p_ni_context);
 
 	p_node->discovery_count++;
-	__osm_ni_rcv_get_node_desc(sm, p_node, p_madw);
+	ni_rcv_get_node_desc(sm, p_node, p_madw);
 
 	switch (p_ni->node_type) {
 	case IB_NODE_TYPE_CA:
 	case IB_NODE_TYPE_ROUTER:
-		__osm_ni_rcv_process_new_ca_or_router(sm, p_node, p_madw);
+		ni_rcv_process_new_ca_or_router(sm, p_node, p_madw);
 		break;
 	case IB_NODE_TYPE_SWITCH:
-		__osm_ni_rcv_process_new_switch(sm, p_node, p_madw);
+		ni_rcv_process_new_switch(sm, p_node, p_madw);
 		break;
 	default:
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D16: "
@@ -755,10 +795,8 @@ Exit:
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
-static void
-__osm_ni_rcv_process_existing(IN osm_sm_t * sm,
-			      IN osm_node_t * const p_node,
-			      IN const osm_madw_t * const p_madw)
+static void ni_rcv_process_existing(IN osm_sm_t * sm, IN osm_node_t * p_node,
+				    IN const osm_madw_t * p_madw)
 {
 	ib_node_info_t *p_ni;
 	ib_smp_t *p_smp;
@@ -768,7 +806,7 @@ __osm_ni_rcv_process_existing(IN osm_sm_t * sm,
 	OSM_LOG_ENTER(sm->p_log);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
+	p_ni = ib_smp_get_payload_ptr(p_smp);
 	p_ni_context = osm_madw_get_ni_context_ptr(p_madw);
 	port_num = ib_node_info_get_local_port_num(p_ni);
 
@@ -779,6 +817,17 @@ __osm_ni_rcv_process_existing(IN osm_sm_t * sm,
 		cl_ntoh64(p_ni->node_guid),
 		cl_ntoh64(p_smp->trans_id), p_node->discovery_count);
 
+	if (port_num > p_ni->num_ports) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D0C: "
+			"Existing %s node GUID 0x%" PRIx64 "is non-compliant "
+			"and is being ignored since the "
+			"local port num %u > num ports %u\n",
+			ib_get_node_type_str(p_ni->node_type),
+			cl_ntoh64(p_ni->node_guid), port_num,
+			p_ni->num_ports);
+		goto Exit;
+	}
+
 	/*
 	   If we haven't already encountered this existing node
 	   on this particular sweep, then process further.
@@ -788,12 +837,11 @@ __osm_ni_rcv_process_existing(IN osm_sm_t * sm,
 	switch (p_ni->node_type) {
 	case IB_NODE_TYPE_CA:
 	case IB_NODE_TYPE_ROUTER:
-		__osm_ni_rcv_process_existing_ca_or_router(sm, p_node,
-							   p_madw);
+		ni_rcv_process_existing_ca_or_router(sm, p_node, p_madw);
 		break;
 
 	case IB_NODE_TYPE_SWITCH:
-		__osm_ni_rcv_process_existing_switch(sm, p_node, p_madw);
+		ni_rcv_process_existing_switch(sm, p_node, p_madw);
 		break;
 
 	default:
@@ -803,13 +851,12 @@ __osm_ni_rcv_process_existing(IN osm_sm_t * sm,
 		break;
 	}
 
-	__osm_ni_rcv_set_links(sm, p_node, port_num, p_ni_context);
+	ni_rcv_set_links(sm, p_node, port_num, p_ni_context);
 
+Exit:
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_ni_rcv_process(IN void *context, IN void *data)
 {
 	osm_sm_t *sm = context;
@@ -825,21 +872,21 @@ void osm_ni_rcv_process(IN void *context, IN void *data)
 	CL_ASSERT(p_madw);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
+	p_ni = ib_smp_get_payload_ptr(p_smp);
 
 	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_NODE_INFO);
 
 	if (p_ni->node_guid == 0) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D16: "
 			"Got Zero Node GUID! Found on the directed route:\n");
-		osm_dump_smp_dr_path(sm->p_log, p_smp, OSM_LOG_ERROR);
+		osm_dump_smp_dr_path_v2(sm->p_log, p_smp, FILE_ID, OSM_LOG_ERROR);
 		goto Exit;
 	}
 
 	if (p_ni->port_guid == 0) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D17: "
 			"Got Zero Port GUID! Found on the directed route:\n");
-		osm_dump_smp_dr_path(sm->p_log, p_smp, OSM_LOG_ERROR);
+		osm_dump_smp_dr_path_v2(sm->p_log, p_smp, FILE_ID, OSM_LOG_ERROR);
 		goto Exit;
 	}
 
@@ -852,12 +899,12 @@ void osm_ni_rcv_process(IN void *context, IN void *data)
 	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
 	p_node = osm_get_node_by_guid(sm->p_subn, p_ni->node_guid);
 
-	osm_dump_node_info(sm->p_log, p_ni, OSM_LOG_DEBUG);
+	osm_dump_node_info_v2(sm->p_log, p_ni, FILE_ID, OSM_LOG_DEBUG);
 
 	if (!p_node)
-		__osm_ni_rcv_process_new(sm, p_madw);
+		ni_rcv_process_new(sm, p_madw);
 	else
-		__osm_ni_rcv_process_existing(sm, p_node, p_madw);
+		ni_rcv_process_existing(sm, p_node, p_madw);
 
 	CL_PLOCK_RELEASE(sm->p_lock);
 
diff --git a/opensm/osm_opensm.c b/opensm/osm_opensm.c
index 7de2e5b..0909a36 100644
--- a/opensm/osm_opensm.c
+++ b/opensm/osm_opensm.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009-2011 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -49,6 +50,8 @@
 #include <string.h>
 #include <complib/cl_dispatcher.h>
 #include <complib/cl_passivelock.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_OPENSM_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_version.h>
 #include <opensm/osm_base.h>
@@ -58,6 +61,7 @@
 #include <opensm/osm_sm.h>
 #include <opensm/osm_vl15intf.h>
 #include <opensm/osm_event_plugin.h>
+#include <opensm/osm_congestion_control.h>
 
 struct routing_engine_module {
 	const char *name;
@@ -66,23 +70,29 @@ struct routing_engine_module {
 
 extern int osm_ucast_minhop_setup(struct osm_routing_engine *, osm_opensm_t *);
 extern int osm_ucast_updn_setup(struct osm_routing_engine *, osm_opensm_t *);
+extern int osm_ucast_dnup_setup(struct osm_routing_engine *, osm_opensm_t *);
 extern int osm_ucast_file_setup(struct osm_routing_engine *, osm_opensm_t *);
 extern int osm_ucast_ftree_setup(struct osm_routing_engine *, osm_opensm_t *);
 extern int osm_ucast_lash_setup(struct osm_routing_engine *, osm_opensm_t *);
 extern int osm_ucast_dor_setup(struct osm_routing_engine *, osm_opensm_t *);
+extern int osm_ucast_torus2QoS_setup(struct osm_routing_engine *, osm_opensm_t *);
+extern int osm_ucast_sssp_setup(struct osm_routing_engine *, osm_opensm_t *);
+extern int osm_ucast_dfsssp_setup(struct osm_routing_engine *, osm_opensm_t *);
 
 const static struct routing_engine_module routing_modules[] = {
 	{"minhop", osm_ucast_minhop_setup},
 	{"updn", osm_ucast_updn_setup},
+	{"dnup", osm_ucast_dnup_setup},
 	{"file", osm_ucast_file_setup},
 	{"ftree", osm_ucast_ftree_setup},
 	{"lash", osm_ucast_lash_setup},
 	{"dor", osm_ucast_dor_setup},
+	{"torus-2QoS", osm_ucast_torus2QoS_setup},
+	{"dfsssp", osm_ucast_dfsssp_setup},
+	{"sssp", osm_ucast_sssp_setup},
 	{NULL, NULL}
 };
 
-/**********************************************************************
- **********************************************************************/
 const char *osm_routing_engine_type_str(IN osm_routing_engine_type_t type)
 {
 	switch (type) {
@@ -92,6 +102,8 @@ const char *osm_routing_engine_type_str(IN osm_routing_engine_type_t type)
 		return "minhop";
 	case OSM_ROUTING_ENGINE_TYPE_UPDN:
 		return "updn";
+	case OSM_ROUTING_ENGINE_TYPE_DNUP:
+		return "dnup";
 	case OSM_ROUTING_ENGINE_TYPE_FILE:
 		return "file";
 	case OSM_ROUTING_ENGINE_TYPE_FTREE:
@@ -100,14 +112,18 @@ const char *osm_routing_engine_type_str(IN osm_routing_engine_type_t type)
 		return "lash";
 	case OSM_ROUTING_ENGINE_TYPE_DOR:
 		return "dor";
+	case OSM_ROUTING_ENGINE_TYPE_TORUS_2QOS:
+		return "torus-2QoS";
+	case OSM_ROUTING_ENGINE_TYPE_DFSSSP:
+		return "dfsssp";
+	case OSM_ROUTING_ENGINE_TYPE_SSSP:
+		return "sssp";
 	default:
 		break;
 	}
 	return "unknown";
 }
 
-/**********************************************************************
- **********************************************************************/
 osm_routing_engine_type_t osm_routing_engine_type(IN const char *str)
 {
 	/* For legacy reasons, consider a NULL pointer and the string
@@ -120,6 +136,8 @@ osm_routing_engine_type_t osm_routing_engine_type(IN const char *str)
 		return OSM_ROUTING_ENGINE_TYPE_NONE;
 	else if (!strcasecmp(str, "updn"))
 		return OSM_ROUTING_ENGINE_TYPE_UPDN;
+	else if (!strcasecmp(str, "dnup"))
+		return OSM_ROUTING_ENGINE_TYPE_DNUP;
 	else if (!strcasecmp(str, "file"))
 		return OSM_ROUTING_ENGINE_TYPE_FILE;
 	else if (!strcasecmp(str, "ftree"))
@@ -128,12 +146,16 @@ osm_routing_engine_type_t osm_routing_engine_type(IN const char *str)
 		return OSM_ROUTING_ENGINE_TYPE_LASH;
 	else if (!strcasecmp(str, "dor"))
 		return OSM_ROUTING_ENGINE_TYPE_DOR;
+	else if (!strcasecmp(str, "torus-2QoS"))
+		return OSM_ROUTING_ENGINE_TYPE_TORUS_2QOS;
+	else if (!strcasecmp(str, "sssp"))
+		return OSM_ROUTING_ENGINE_TYPE_SSSP;
+	else if (!strcasecmp(str, "dfsssp"))
+		return OSM_ROUTING_ENGINE_TYPE_DFSSSP;
 	else
 		return OSM_ROUTING_ENGINE_TYPE_UNKNOWN;
 }
 
-/**********************************************************************
- **********************************************************************/
 static void append_routing_engine(osm_opensm_t *osm,
 				  struct osm_routing_engine *routing_engine)
 {
@@ -153,63 +175,70 @@ static void append_routing_engine(osm_opensm_t *osm,
 	r->next = routing_engine;
 }
 
-static void setup_routing_engine(osm_opensm_t *osm, const char *name)
+static struct osm_routing_engine *setup_routing_engine(osm_opensm_t *osm,
+						       const char *name)
 {
 	struct osm_routing_engine *re;
 	const struct routing_engine_module *m;
 
+	if (!strcmp(name, "no_fallback")) {
+		osm->no_fallback_routing_engine = TRUE;
+		return NULL;
+	}
+
 	for (m = routing_modules; m->name && *m->name; m++) {
 		if (!strcmp(m->name, name)) {
 			re = malloc(sizeof(struct osm_routing_engine));
 			if (!re) {
 				OSM_LOG(&osm->log, OSM_LOG_VERBOSE,
 					"memory allocation failed\n");
-				return;
+				return NULL;
 			}
 			memset(re, 0, sizeof(struct osm_routing_engine));
 
 			re->name = m->name;
+			re->type = osm_routing_engine_type(m->name);
 			if (m->setup(re, osm)) {
 				OSM_LOG(&osm->log, OSM_LOG_VERBOSE,
 					"setup of routing"
 					" engine \'%s\' failed\n", name);
-				return;
+				free(re);
+				return NULL;
 			}
 			OSM_LOG(&osm->log, OSM_LOG_DEBUG,
 				"\'%s\' routing engine set up\n", re->name);
-			append_routing_engine(osm, re);
-			return;
+			if (re->type == OSM_ROUTING_ENGINE_TYPE_MINHOP)
+				osm->default_routing_engine = re;
+			return re;
 		}
 	}
 
 	OSM_LOG(&osm->log, OSM_LOG_ERROR,
-		"cannot find or setup routing engine \'%s\'", name);
+		"cannot find or setup routing engine \'%s\'\n", name);
+	return NULL;
 }
 
 static void setup_routing_engines(osm_opensm_t *osm, const char *engine_names)
 {
 	char *name, *str, *p;
+	struct osm_routing_engine *re;
 
-	if (!engine_names || !*engine_names) {
-		setup_routing_engine(osm, "minhop");
-		return;
-	}
-
-	str = strdup(engine_names);
-	name = strtok_r(str, ", \t\n", &p);
-	while (name && *name) {
-		setup_routing_engine(osm, name);
-		name = strtok_r(NULL, ", \t\n", &p);
+	if (engine_names && *engine_names) {
+		str = strdup(engine_names);
+		name = strtok_r(str, ", \t\n", &p);
+		while (name && *name) {
+			re = setup_routing_engine(osm, name);
+			if (re)
+				append_routing_engine(osm, re);
+			name = strtok_r(NULL, ", \t\n", &p);
+		}
+		free(str);
 	}
-	free(str);
-
-	if (!osm->routing_engine_list)
+	if (!osm->default_routing_engine)
 		setup_routing_engine(osm, "minhop");
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_opensm_construct(IN osm_opensm_t * const p_osm)
+void osm_opensm_construct(IN osm_opensm_t * p_osm)
 {
 	memset(p_osm, 0, sizeof(*p_osm));
 	p_osm->osm_version = OSM_VERSION;
@@ -222,8 +251,6 @@ void osm_opensm_construct(IN osm_opensm_t * const p_osm)
 	osm_log_construct(&p_osm->log);
 }
 
-/**********************************************************************
- **********************************************************************/
 static void destroy_routing_engines(osm_opensm_t *osm)
 {
 	struct osm_routing_engine *r, *next;
@@ -232,14 +259,12 @@ static void destroy_routing_engines(osm_opensm_t *osm)
 	while (next) {
 		r = next;
 		next = r->next;
-		if (r->delete)
-			r->delete(r->context);
+		if (r->destroy)
+			r->destroy(r->context);
 		free(r);
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
 static void destroy_plugins(osm_opensm_t *osm)
 {
 	osm_epi_plugin_t *p;
@@ -251,7 +276,7 @@ static void destroy_plugins(osm_opensm_t *osm)
 	}
 }
 
-void osm_opensm_destroy(IN osm_opensm_t * const p_osm)
+void osm_opensm_destroy(IN osm_opensm_t * p_osm)
 {
 	/* in case of shutdown through exit proc - no ^C */
 	osm_exit_flag = TRUE;
@@ -267,6 +292,8 @@ void osm_opensm_destroy(IN osm_opensm_t * const p_osm)
 	osm_perfmgr_shutdown(&p_osm->perfmgr);
 #endif				/* ENABLE_OSM_PERF_MGR */
 
+	osm_congestion_control_shutdown(&p_osm->cc);
+
 	/* shut down the SA
 	 * - unbind from QP1 messages
 	 */
@@ -285,7 +312,8 @@ void osm_opensm_destroy(IN osm_opensm_t * const p_osm)
 	cl_disp_shutdown(&p_osm->disp);
 
 	/* dump SA DB */
-	osm_sa_db_file_dump(p_osm);
+	if (p_osm->subn.opt.sa_db_dump)
+		osm_sa_db_file_dump(p_osm);
 
 	/* do the destruction in reverse order as init */
 	destroy_plugins(p_osm);
@@ -295,6 +323,7 @@ void osm_opensm_destroy(IN osm_opensm_t * const p_osm)
 #ifdef ENABLE_OSM_PERF_MGR
 	osm_perfmgr_destroy(&p_osm->perfmgr);
 #endif				/* ENABLE_OSM_PERF_MGR */
+	osm_congestion_control_destroy(&p_osm->cc);
 	osm_db_destroy(&p_osm->db);
 	osm_vl15_destroy(&p_osm->vl15, &p_osm->mad_pool);
 	osm_mad_pool_destroy(&p_osm->mad_pool);
@@ -320,12 +349,12 @@ static void load_plugins(osm_opensm_t *osm, const char *plugin_names)
 	char *p_names, *name, *p;
 
 	p_names = strdup(plugin_names);
-	name = strtok_r(p_names, " \t\n", &p);
+	name = strtok_r(p_names, ", \t\n", &p);
 	while (name && *name) {
 		epi = osm_epi_construct(osm, name);
 		if (!epi)
-			osm_log(&osm->log, OSM_LOG_ERROR,
-				"cannot load plugin \'%s\'\n", name);
+			osm_log_v2(&osm->log, OSM_LOG_ERROR, FILE_ID,
+				   "cannot load plugin \'%s\'\n", name);
 		else
 			cl_qlist_insert_tail(&osm->plugin_list, &epi->list);
 		name = strtok_r(NULL, " \t\n", &p);
@@ -333,11 +362,8 @@ static void load_plugins(osm_opensm_t *osm, const char *plugin_names)
 	free(p_names);
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_opensm_init(IN osm_opensm_t * const p_osm,
-		IN const osm_subn_opt_t * const p_opt)
+ib_api_status_t osm_opensm_init(IN osm_opensm_t * p_osm,
+				IN const osm_subn_opt_t * p_opt)
 {
 	ib_api_status_t status;
 
@@ -351,14 +377,15 @@ osm_opensm_init(IN osm_opensm_t * const p_osm,
 				 p_opt->log_flags, p_opt->log_file,
 				 p_opt->log_max_size, p_opt->accum_log_file);
 	if (status != IB_SUCCESS)
-		return (status);
+		return status;
+	p_osm->log.log_prefix = p_opt->log_prefix;
 
 	/* If there is a log level defined - add the OSM_VERSION to it */
-	osm_log(&p_osm->log,
-		osm_log_get_level(&p_osm->log) & (OSM_LOG_SYS ^ 0xFF), "%s\n",
-		p_osm->osm_version);
+	osm_log_v2(&p_osm->log,
+		   osm_log_get_level(&p_osm->log) & (OSM_LOG_SYS ^ 0xFF),
+		   FILE_ID, "%s\n", p_osm->osm_version);
 	/* Write the OSM_VERSION to the SYS_LOG */
-	osm_log(&p_osm->log, OSM_LOG_SYS, "%s\n", p_osm->osm_version);	/* Format Waived */
+	osm_log_v2(&p_osm->log, OSM_LOG_SYS, FILE_ID, "%s\n", p_osm->osm_version);	/* Format Waived */
 
 	OSM_LOG(&p_osm->log, OSM_LOG_FUNCS, "[\n");	/* Format Waived */
 
@@ -389,6 +416,11 @@ osm_opensm_init(IN osm_opensm_t * const p_osm,
 	if (status != IB_SUCCESS)
 		goto Exit;
 
+	/* the DB is in use by subn so init before */
+	status = osm_db_init(&p_osm->db, &p_osm->log);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
 	status = osm_subn_init(&p_osm->subn, p_osm, p_opt);
 	if (status != IB_SUCCESS)
 		goto Exit;
@@ -406,12 +438,8 @@ osm_opensm_init(IN osm_opensm_t * const p_osm,
 
 	status = osm_vl15_init(&p_osm->vl15, p_osm->p_vendor,
 			       &p_osm->log, &p_osm->stats,
-			       p_opt->max_wire_smps);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	/* the DB is in use by the SM and SA so init before */
-	status = osm_db_init(&p_osm->db, &p_osm->log);
+			       p_opt->max_wire_smps, p_opt->max_wire_smps2,
+			       p_opt->max_smps_timeout);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
@@ -419,14 +447,12 @@ osm_opensm_init(IN osm_opensm_t * const p_osm,
 			     p_osm->p_vendor, &p_osm->mad_pool, &p_osm->vl15,
 			     &p_osm->log, &p_osm->stats, &p_osm->disp,
 			     &p_osm->lock);
-
 	if (status != IB_SUCCESS)
 		goto Exit;
 
 	status = osm_sa_init(&p_osm->sm, &p_osm->sa, &p_osm->subn,
 			     p_osm->p_vendor, &p_osm->mad_pool, &p_osm->log,
 			     &p_osm->stats, &p_osm->disp, &p_osm->lock);
-
 	if (status != IB_SUCCESS)
 		goto Exit;
 
@@ -441,6 +467,13 @@ osm_opensm_init(IN osm_opensm_t * const p_osm,
 		goto Exit;
 #endif				/* ENABLE_OSM_PERF_MGR */
 
+	status = osm_congestion_control_init(&p_osm->cc,
+					     p_osm, p_opt);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	p_osm->no_fallback_routing_engine = FALSE;
+
 	setup_routing_engines(p_osm, p_opt->routing_engine_names);
 
 	p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_NONE;
@@ -449,13 +482,10 @@ osm_opensm_init(IN osm_opensm_t * const p_osm,
 
 Exit:
 	OSM_LOG(&p_osm->log, OSM_LOG_FUNCS, "]\n");	/* Format Waived */
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_opensm_bind(IN osm_opensm_t * const p_osm, IN const ib_net64_t guid)
+ib_api_status_t osm_opensm_bind(IN osm_opensm_t * p_osm, IN ib_net64_t guid)
 {
 	ib_api_status_t status;
 
@@ -475,20 +505,27 @@ osm_opensm_bind(IN osm_opensm_t * const p_osm, IN const ib_net64_t guid)
 		goto Exit;
 #endif				/* ENABLE_OSM_PERF_MGR */
 
+	status = osm_congestion_control_bind(&p_osm->cc, guid);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	/* setting IS_SM in capability mask */
+	OSM_LOG(&p_osm->log, OSM_LOG_INFO, "Setting IS_SM on port 0x%016" PRIx64 "\n",
+			cl_ntoh64(guid));
+	osm_vendor_set_sm(p_osm->sm.mad_ctrl.h_bind, TRUE);
+
 Exit:
 	OSM_LOG_EXIT(&p_osm->log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_opensm_report_event(osm_opensm_t *osm, osm_epi_event_id_t event_id,
 			     void *event_data)
 {
 	cl_list_item_t *item;
 
 	for (item = cl_qlist_head(&osm->plugin_list);
-	     item != cl_qlist_end(&osm->plugin_list);
+	     !osm_exit_flag && item != cl_qlist_end(&osm->plugin_list);
 	     item = cl_qlist_next(item)) {
 		osm_epi_plugin_t *p = (osm_epi_plugin_t *)item;
 		if (p->impl->report)
diff --git a/opensm/osm_perfmgr.c b/opensm/osm_perfmgr.c
index f7da2dc..c5c71f6 100644
--- a/opensm/osm_perfmgr.c
+++ b/opensm/osm_perfmgr.c
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2007 The Regents of the University of California.
- * Copyright (c) 2007-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2007-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2009,2010 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -46,7 +47,6 @@
 #endif				/* HAVE_CONFIG_H */
 
 #ifdef ENABLE_OSM_PERF_MGR
-
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
@@ -59,13 +59,16 @@
 #include <iba/ib_types.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_thread.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_PERFMGR_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_perfmgr.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_opensm.h>
+#include <opensm/osm_helper.h>
 
-#define OSM_PERFMGR_INITIAL_TID_VALUE 0xcafe
+#define PERFMGR_INITIAL_TID_VALUE 0xcafe
 
 #if ENABLE_OSM_PERF_MGR_PROFILE
 struct {
@@ -74,11 +77,7 @@ struct {
 	double avg_us;
 	uint64_t num;
 } perfmgr_mad_stats = {
-	fastest_us: DBL_MAX,
-	slowest_us: DBL_MIN,
-	avg_us: 0,
-	num: 0
-};
+fastest_us: DBL_MAX, slowest_us: DBL_MIN, avg_us: 0, num:0};
 
 /* diff must be something which can fit in a susecond_t */
 static inline void update_mad_stats(struct timeval *diff)
@@ -95,7 +94,7 @@ static inline void update_mad_stats(struct timeval *diff)
 	perfmgr_mad_stats.num++;
 }
 
-static inline void perfmgr_clear_mad_stats(void)
+static inline void clear_mad_stats(void)
 {
 	perfmgr_mad_stats.fastest_us = DBL_MAX;
 	perfmgr_mad_stats.slowest_us = DBL_MIN;
@@ -104,8 +103,8 @@ static inline void perfmgr_clear_mad_stats(void)
 }
 
 /* after and diff can be the same struct */
-static inline void diff_time(struct timeval *before,
-			     struct timeval *after, struct timeval *diff)
+static inline void diff_time(struct timeval *before, struct timeval *after,
+			     struct timeval *diff)
 {
 	struct timeval tmp = *after;
 	if (tmp.tv_usec < before->tv_usec) {
@@ -115,15 +114,12 @@ static inline void diff_time(struct timeval *before,
 	diff->tv_sec = tmp.tv_sec - before->tv_sec;
 	diff->tv_usec = tmp.tv_usec - before->tv_usec;
 }
-
 #endif
 
-extern int wait_for_pending_transactions(osm_stats_t * stats);
-
 /**********************************************************************
  * Internal helper functions.
  **********************************************************************/
-static inline void __init_monitored_nodes(osm_perfmgr_t * pm)
+static void init_monitored_nodes(osm_perfmgr_t * pm)
 {
 	cl_qmap_init(&pm->monitored_map);
 	pm->remove_list = NULL;
@@ -131,8 +127,7 @@ static inline void __init_monitored_nodes(osm_perfmgr_t * pm)
 	cl_event_init(&pm->sig_query, FALSE);
 }
 
-static inline void
-__mark_for_removal(osm_perfmgr_t * pm, __monitored_node_t * node)
+static void mark_for_removal(osm_perfmgr_t * pm, monitored_node_t * node)
 {
 	if (pm->remove_list) {
 		node->next = pm->remove_list;
@@ -143,14 +138,19 @@ __mark_for_removal(osm_perfmgr_t * pm, __monitored_node_t * node)
 	}
 }
 
-static inline void __remove_marked_nodes(osm_perfmgr_t * pm)
+static void remove_marked_nodes(osm_perfmgr_t * pm)
 {
 	while (pm->remove_list) {
-		__monitored_node_t *next = pm->remove_list->next;
+		monitored_node_t *next = pm->remove_list->next;
 
-		cl_qmap_remove_item(&(pm->monitored_map),
+		cl_qmap_remove_item(&pm->monitored_map,
 				    (cl_map_item_t *) (pm->remove_list));
 
+		if (pm->rm_nodes)
+			perfmgr_db_delete_entry(pm->db, pm->remove_list->guid);
+		else
+			perfmgr_db_mark_active(pm->db, pm->remove_list->guid, FALSE);
+
 		if (pm->remove_list->name)
 			free(pm->remove_list->name);
 		free(pm->remove_list);
@@ -158,19 +158,18 @@ static inline void __remove_marked_nodes(osm_perfmgr_t * pm)
 	}
 }
 
-static inline void __decrement_outstanding_queries(osm_perfmgr_t * pm)
+static inline void decrement_outstanding_queries(osm_perfmgr_t * pm)
 {
-	cl_atomic_dec(&(pm->outstanding_queries));
-	cl_event_signal(&(pm->sig_query));
+	cl_atomic_dec(&pm->outstanding_queries);
+	cl_event_signal(&pm->sig_query);
 }
 
 /**********************************************************************
  * Receive the MAD from the vendor layer and post it for processing by
  * the dispatcher.
  **********************************************************************/
-static void
-osm_perfmgr_mad_recv_callback(osm_madw_t * p_madw, void *bind_context,
-			      osm_madw_t * p_req_madw)
+static void perfmgr_mad_recv_callback(osm_madw_t * p_madw, void *bind_context,
+				      osm_madw_t * p_req_madw)
 {
 	osm_perfmgr_t *pm = (osm_perfmgr_t *) bind_context;
 
@@ -179,12 +178,12 @@ osm_perfmgr_mad_recv_callback(osm_madw_t * p_madw, void *bind_context,
 	osm_madw_copy_context(p_madw, p_req_madw);
 	osm_mad_pool_put(pm->mad_pool, p_req_madw);
 
-	__decrement_outstanding_queries(pm);
+	decrement_outstanding_queries(pm);
 
 	/* post this message for later processing. */
 	if (cl_disp_post(pm->pc_disp_h, OSM_MSG_MAD_PORT_COUNTERS,
-			 (void *)p_madw, NULL, NULL) != CL_SUCCESS) {
-		OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C01: "
+			 p_madw, NULL, NULL) != CL_SUCCESS) {
+		OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5401: "
 			"PerfMgr Dispatcher post failed\n");
 		osm_mad_pool_put(pm->mad_pool, p_madw);
 	}
@@ -194,55 +193,62 @@ osm_perfmgr_mad_recv_callback(osm_madw_t * p_madw, void *bind_context,
 /**********************************************************************
  * Process MAD send errors.
  **********************************************************************/
-static void
-osm_perfmgr_mad_send_err_callback(void *bind_context, osm_madw_t * p_madw)
+static void perfmgr_mad_send_err_callback(void *bind_context,
+					  osm_madw_t * p_madw)
 {
 	osm_perfmgr_t *pm = (osm_perfmgr_t *) bind_context;
-	osm_madw_context_t *context = &(p_madw->context);
+	osm_madw_context_t *context = &p_madw->context;
 	uint64_t node_guid = context->perfmgr_context.node_guid;
 	uint8_t port = context->perfmgr_context.port;
 	cl_map_item_t *p_node;
-	__monitored_node_t *p_mon_node;
+	monitored_node_t *p_mon_node;
+	ib_net16_t orig_lid;
 
 	OSM_LOG_ENTER(pm->log);
 
-	/* go ahead and get the monitored node struct to have the printable
-	 * name if needed in messages
+	/*
+	 * get the monitored node struct to have the printable name
+	 * for log messages
 	 */
-	if ((p_node = cl_qmap_get(&(pm->monitored_map), node_guid)) ==
-	    cl_qmap_end(&(pm->monitored_map))) {
-		OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C15: GUID 0x%016"
-			PRIx64 " not found in monitored map\n",
-			node_guid);
+	if ((p_node = cl_qmap_get(&pm->monitored_map, node_guid)) ==
+	    cl_qmap_end(&pm->monitored_map)) {
+		OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5415: GUID 0x%016"
+			PRIx64 " not found in monitored map\n", node_guid);
 		goto Exit;
 	}
-	p_mon_node = (__monitored_node_t *) p_node;
+	p_mon_node = (monitored_node_t *) p_node;
 
-	OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C02: %s (0x%" PRIx64
-		") port %u\n", p_mon_node->name, p_mon_node->guid, port);
+	OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5402: %s (0x%" PRIx64
+		") port %u LID %u TID 0x%" PRIx64 "\n",
+		p_mon_node->name, p_mon_node->guid, port,
+		cl_ntoh16(p_madw->mad_addr.dest_lid),
+		cl_ntoh64(p_madw->p_mad->trans_id));
 
 	if (pm->subn->opt.perfmgr_redir && p_madw->status == IB_TIMEOUT) {
 		/* First, find the node in the monitored map */
-		cl_plock_acquire(pm->lock);
+		cl_plock_acquire(&pm->osm->lock);
 		/* Now, validate port number */
-		if (port > p_mon_node->redir_tbl_size) {
-			cl_plock_release(pm->lock);
-			OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C16: "
+		if (port >= p_mon_node->num_ports) {
+			cl_plock_release(&pm->osm->lock);
+			OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5416: "
 				"Invalid port num %u for %s (GUID 0x%016"
-				PRIx64 ") num ports %u\n", port, p_mon_node->name,
-				p_mon_node->guid, p_mon_node->redir_tbl_size);
+				PRIx64 ") num ports %u\n", port,
+				p_mon_node->name, p_mon_node->guid,
+				p_mon_node->num_ports);
 			goto Exit;
 		}
-		/* Clear redirection info */
-		p_mon_node->redir_port[port].redir_lid = 0;
-		p_mon_node->redir_port[port].redir_qp = 0;
-		cl_plock_release(pm->lock);
+		/* Clear redirection info for this port except orig_lid */
+		orig_lid = p_mon_node->port[port].orig_lid;
+		memset(&p_mon_node->port[port], 0, sizeof(monitored_port_t));
+		p_mon_node->port[port].orig_lid = orig_lid;
+		p_mon_node->port[port].valid = TRUE;
+		cl_plock_release(&pm->osm->lock);
 	}
 
 Exit:
 	osm_mad_pool_put(pm->mad_pool, p_madw);
 
-	__decrement_outstanding_queries(pm);
+	decrement_outstanding_queries(pm);
 
 	OSM_LOG_EXIT(pm->log);
 }
@@ -250,8 +256,7 @@ Exit:
 /**********************************************************************
  * Bind the PerfMgr to the vendor layer for MAD sends/receives
  **********************************************************************/
-ib_api_status_t
-osm_perfmgr_bind(osm_perfmgr_t * const pm, const ib_net64_t port_guid)
+ib_api_status_t osm_perfmgr_bind(osm_perfmgr_t * pm, ib_net64_t port_guid)
 {
 	osm_bind_info_t bind_info;
 	ib_api_status_t status = IB_SUCCESS;
@@ -260,12 +265,12 @@ osm_perfmgr_bind(osm_perfmgr_t * const pm, const ib_net64_t port_guid)
 
 	if (pm->bind_handle != OSM_BIND_INVALID_HANDLE) {
 		OSM_LOG(pm->log, OSM_LOG_ERROR,
-			"ERR 4C03: Multiple binds not allowed\n");
+			"ERR 5403: Multiple binds not allowed\n");
 		status = IB_ERROR;
 		goto Exit;
 	}
 
-	bind_info.port_guid = port_guid;
+	bind_info.port_guid = pm->port_guid = port_guid;
 	bind_info.mad_class = IB_MCLASS_PERF;
 	bind_info.class_version = 1;
 	bind_info.is_responder = FALSE;
@@ -273,38 +278,36 @@ osm_perfmgr_bind(osm_perfmgr_t * const pm, const ib_net64_t port_guid)
 	bind_info.is_trap_processor = FALSE;
 	bind_info.recv_q_size = OSM_PM_DEFAULT_QP1_RCV_SIZE;
 	bind_info.send_q_size = OSM_PM_DEFAULT_QP1_SEND_SIZE;
+	bind_info.timeout = pm->subn->opt.transaction_timeout;
+	bind_info.retries = pm->subn->opt.transaction_retries;
 
 	OSM_LOG(pm->log, OSM_LOG_VERBOSE,
 		"Binding to port GUID 0x%" PRIx64 "\n", cl_ntoh64(port_guid));
 
-	pm->bind_handle = osm_vendor_bind(pm->vendor,
-					  &bind_info,
-					  pm->mad_pool,
-					  osm_perfmgr_mad_recv_callback,
-					  osm_perfmgr_mad_send_err_callback,
-					  pm);
+	pm->bind_handle = osm_vendor_bind(pm->vendor, &bind_info, pm->mad_pool,
+					  perfmgr_mad_recv_callback,
+					  perfmgr_mad_send_err_callback, pm);
 
 	if (pm->bind_handle == OSM_BIND_INVALID_HANDLE) {
 		status = IB_ERROR;
 		OSM_LOG(pm->log, OSM_LOG_ERROR,
-			"ERR 4C04: Vendor specific bind failed (%s)\n",
+			"ERR 5404: Vendor specific bind failed (%s)\n",
 			ib_get_err_str(status));
-		goto Exit;
 	}
 
 Exit:
 	OSM_LOG_EXIT(pm->log);
-	return (status);
+	return status;
 }
 
 /**********************************************************************
  * Unbind the PerfMgr from the vendor layer for MAD sends/receives
  **********************************************************************/
-static void osm_perfmgr_mad_unbind(osm_perfmgr_t * const pm)
+static void perfmgr_mad_unbind(osm_perfmgr_t * pm)
 {
 	OSM_LOG_ENTER(pm->log);
 	if (pm->bind_handle == OSM_BIND_INVALID_HANDLE) {
-		OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C05: No previous bind\n");
+		OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5405: No previous bind\n");
 		goto Exit;
 	}
 	osm_vendor_unbind(pm->bind_handle);
@@ -315,31 +318,19 @@ Exit:
 /**********************************************************************
  * Given a monitored node and a port, return the qp
  **********************************************************************/
-static ib_net32_t get_qp(__monitored_node_t * mon_node, uint8_t port)
+static ib_net32_t get_qp(monitored_node_t * mon_node, uint8_t port)
 {
-	ib_net32_t qp = cl_ntoh32(1);
+	ib_net32_t qp = IB_QP1;
 
-	if (mon_node && mon_node->redir_tbl_size &&
-	    port < mon_node->redir_tbl_size &&
-	    mon_node->redir_port[port].redir_lid &&
-	    mon_node->redir_port[port].redir_qp)
-		qp = mon_node->redir_port[port].redir_qp;
+	if (mon_node && mon_node->num_ports && port < mon_node->num_ports &&
+	    mon_node->port[port].redirection && mon_node->port[port].qp)
+		qp = mon_node->port[port].qp;
 
 	return qp;
 }
 
-/**********************************************************************
- * Given a node, a port, and an optional monitored node,
- * return the appropriate lid to query that port
- **********************************************************************/
-static ib_net16_t
-get_lid(osm_node_t * p_node, uint8_t port, __monitored_node_t * mon_node)
+static ib_net16_t get_base_lid(osm_node_t * p_node, uint8_t port)
 {
-	if (mon_node && mon_node->redir_tbl_size &&
-	    port < mon_node->redir_tbl_size &&
-	    mon_node->redir_port[port].redir_lid)
-		return mon_node->redir_port[port].redir_lid;
-
 	switch (p_node->node_info.node_type) {
 	case IB_NODE_TYPE_CA:
 	case IB_NODE_TYPE_ROUTER:
@@ -352,12 +343,27 @@ get_lid(osm_node_t * p_node, uint8_t port, __monitored_node_t * mon_node)
 }
 
 /**********************************************************************
+ * Given a node, a port, and an optional monitored node,
+ * return the lid appropriate to query that port
+ **********************************************************************/
+static ib_net16_t get_lid(osm_node_t * p_node, uint8_t port,
+			  monitored_node_t * mon_node)
+{
+	if (mon_node && mon_node->num_ports && port < mon_node->num_ports &&
+	    mon_node->port[port].lid)
+		return mon_node->port[port].lid;
+
+	return get_base_lid(p_node, port);
+}
+
+/**********************************************************************
  * Form and send the Port Counters MAD for a single port.
  **********************************************************************/
-static ib_api_status_t
-osm_perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr, ib_net16_t dest_lid,
-			ib_net32_t dest_qp, uint8_t port, uint8_t mad_method,
-			osm_madw_context_t * const p_context)
+static ib_api_status_t perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr,
+					   ib_net16_t dest_lid,
+					   ib_net32_t dest_qp, uint16_t pkey_ix,
+					   uint8_t port, uint8_t mad_method,
+					   osm_madw_context_t * p_context)
 {
 	ib_api_status_t status = IB_SUCCESS;
 	ib_port_counters_t *port_counter = NULL;
@@ -366,11 +372,10 @@ osm_perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr, ib_net16_t dest_lid,
 
 	OSM_LOG_ENTER(perfmgr->log);
 
-	p_madw =
-	    osm_mad_pool_get(perfmgr->mad_pool, perfmgr->bind_handle,
-			     MAD_BLOCK_SIZE, NULL);
+	p_madw = osm_mad_pool_get(perfmgr->mad_pool, perfmgr->bind_handle,
+				  MAD_BLOCK_SIZE, NULL);
 	if (p_madw == NULL)
-		return (IB_INSUFFICIENT_MEMORY);
+		return IB_INSUFFICIENT_MEMORY;
 
 	pm_mad = osm_madw_get_perfmgt_mad_ptr(p_madw);
 
@@ -382,12 +387,17 @@ osm_perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr, ib_net16_t dest_lid,
 	pm_mad->header.status = 0;
 	pm_mad->header.class_spec = 0;
 	pm_mad->header.trans_id =
-	    cl_hton64((uint64_t) cl_atomic_inc(&(perfmgr->trans_id)));
+	    cl_hton64((uint64_t) cl_atomic_inc(&perfmgr->trans_id) &
+		      (uint64_t) (0xFFFFFFFF));
+	if (perfmgr->trans_id == 0)
+		pm_mad->header.trans_id =
+		    cl_hton64((uint64_t) cl_atomic_inc(&perfmgr->trans_id) &
+			      (uint64_t) (0xFFFFFFFF));
 	pm_mad->header.attr_id = IB_MAD_ATTR_PORT_CNTRS;
 	pm_mad->header.resv = 0;
 	pm_mad->header.attr_mod = 0;
 
-	port_counter = (ib_port_counters_t *) & (pm_mad->data);
+	port_counter = (ib_port_counters_t *) & pm_mad->data;
 	memset(port_counter, 0, sizeof(*port_counter));
 	port_counter->port_select = port;
 	port_counter->counter_select = 0xFFFF;
@@ -396,8 +406,7 @@ osm_perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr, ib_net16_t dest_lid,
 	p_madw->mad_addr.addr_type.gsi.remote_qp = dest_qp;
 	p_madw->mad_addr.addr_type.gsi.remote_qkey =
 	    cl_hton32(IB_QP1_WELL_KNOWN_Q_KEY);
-	/* FIXME what about other partitions */
-	p_madw->mad_addr.addr_type.gsi.pkey_ix = 0;
+	p_madw->mad_addr.addr_type.gsi.pkey_ix = pkey_ix;
 	p_madw->mad_addr.addr_type.gsi.service_level = 0;
 	p_madw->mad_addr.addr_type.gsi.global_route = FALSE;
 	p_madw->resp_expected = TRUE;
@@ -408,7 +417,7 @@ osm_perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr, ib_net16_t dest_lid,
 	status = osm_vendor_send(perfmgr->bind_handle, p_madw, TRUE);
 
 	if (status == IB_SUCCESS) {
-		/* pause this thread if we have too many outstanding requests */
+		/* pause thread if there are too many outstanding requests */
 		cl_atomic_inc(&(perfmgr->outstanding_queries));
 		if (perfmgr->outstanding_queries >
 		    perfmgr->max_outstanding_queries) {
@@ -420,38 +429,60 @@ osm_perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr, ib_net16_t dest_lid,
 	}
 
 	OSM_LOG_EXIT(perfmgr->log);
-	return (status);
+	return status;
 }
 
 /**********************************************************************
  * sweep the node_guid_tbl and collect the node guids to be tracked
  **********************************************************************/
-static void __collect_guids(cl_map_item_t * const p_map_item, void *context)
+static void collect_guids(cl_map_item_t * p_map_item, void *context)
 {
 	osm_node_t *node = (osm_node_t *) p_map_item;
 	uint64_t node_guid = cl_ntoh64(node->node_info.node_guid);
 	osm_perfmgr_t *pm = (osm_perfmgr_t *) context;
-	__monitored_node_t *mon_node = NULL;
-	uint32_t size;
+	monitored_node_t *mon_node = NULL;
+	uint32_t num_ports;
+	int port;
 
 	OSM_LOG_ENTER(pm->log);
 
-	if (cl_qmap_get(&(pm->monitored_map), node_guid)
-	    == cl_qmap_end(&(pm->monitored_map))) {
-		/* if not already in our map add it */
-		size = node->node_info.num_ports;
-		mon_node = malloc(sizeof(*mon_node) + sizeof(redir_t) * size);
+	if (cl_qmap_get(&pm->monitored_map, node_guid)
+	    == cl_qmap_end(&pm->monitored_map)) {
+
+		if (pm->ignore_cas &&
+		    (node->node_info.node_type == IB_NODE_TYPE_CA))
+			goto Exit;
+
+		/* if not already in map add it */
+		num_ports = osm_node_get_num_physp(node);
+		mon_node = malloc(sizeof(*mon_node) +
+				  sizeof(monitored_port_t) * num_ports);
 		if (!mon_node) {
-			OSM_LOG(pm->log, OSM_LOG_ERROR, "PerfMgr: ERR 4C06: "
+			OSM_LOG(pm->log, OSM_LOG_ERROR, "PerfMgr: ERR 5406: "
 				"malloc failed: not handling node %s"
-				"(GUID 0x%" PRIx64 ")\n", node->print_desc, node_guid);
+				"(GUID 0x%" PRIx64 ")\n", node->print_desc,
+				node_guid);
 			goto Exit;
 		}
-		memset(mon_node, 0, sizeof(*mon_node) + sizeof(redir_t) * size);
+		memset(mon_node, 0,
+		       sizeof(*mon_node) + sizeof(monitored_port_t) * num_ports);
 		mon_node->guid = node_guid;
 		mon_node->name = strdup(node->print_desc);
-		mon_node->redir_tbl_size = size + 1;
-		cl_qmap_insert(&(pm->monitored_map), node_guid,
+		mon_node->num_ports = num_ports;
+		/* check for enhanced switch port 0 */
+		mon_node->esp0 = (node->sw &&
+				  ib_switch_info_is_enhanced_port0(&node->sw->
+								   switch_info));
+		for (port = mon_node->esp0 ? 0 : 1; port < num_ports; port++) {
+			mon_node->port[port].orig_lid = 0;
+			mon_node->port[port].valid = FALSE;
+			if (osm_physp_is_valid(&node->physp_table[port])) {
+				mon_node->port[port].orig_lid = get_base_lid(node, port);
+				mon_node->port[port].valid = TRUE;
+			}
+		}
+
+		cl_qmap_insert(&pm->monitored_map, node_guid,
 			       (cl_map_item_t *) mon_node);
 	}
 
@@ -462,59 +493,56 @@ Exit:
 /**********************************************************************
  * query the Port Counters of all the nodes in the subnet.
  **********************************************************************/
-static void
-__osm_perfmgr_query_counters(cl_map_item_t * const p_map_item, void *context)
+static void perfmgr_query_counters(cl_map_item_t * p_map_item, void *context)
 {
 	ib_api_status_t status = IB_SUCCESS;
-	uint8_t port = 0, startport = 1;
-	osm_perfmgr_t *pm = (osm_perfmgr_t *) context;
+	osm_perfmgr_t *pm = context;
 	osm_node_t *node = NULL;
-	__monitored_node_t *mon_node = (__monitored_node_t *) p_map_item;
+	monitored_node_t *mon_node = (monitored_node_t *) p_map_item;
 	osm_madw_context_t mad_context;
-	uint8_t num_ports = 0;
 	uint64_t node_guid = 0;
 	ib_net32_t remote_qp;
+	uint8_t port, num_ports = 0;
 
 	OSM_LOG_ENTER(pm->log);
 
-	cl_plock_acquire(pm->lock);
+	cl_plock_acquire(&pm->osm->lock);
 	node = osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
 	if (!node) {
 		OSM_LOG(pm->log, OSM_LOG_ERROR,
-			"ERR 4C07: Node \"%s\" (guid 0x%" PRIx64
+			"ERR 5407: Node \"%s\" (guid 0x%" PRIx64
 			") no longer exists so removing from PerfMgr monitoring\n",
 			mon_node->name, mon_node->guid);
-		__mark_for_removal(pm, mon_node);
+		mark_for_removal(pm, mon_node);
 		goto Exit;
 	}
 
 	num_ports = osm_node_get_num_physp(node);
 	node_guid = cl_ntoh64(node->node_info.node_guid);
 
-	/* make sure we have a database object ready to store this information */
-	if (perfmgr_db_create_entry(pm->db, node_guid, num_ports,
-				    node->print_desc) !=
+	/* make sure there is a database object ready to store this info */
+	if (perfmgr_db_create_entry(pm->db, node_guid, mon_node->esp0,
+				    num_ports, node->print_desc) !=
 	    PERFMGR_EVENT_DB_SUCCESS) {
 		OSM_LOG(pm->log, OSM_LOG_ERROR,
-			"ERR 4C08: DB create entry failed for 0x%"
+			"ERR 5408: DB create entry failed for 0x%"
 			PRIx64 " (%s) : %s\n", node_guid, node->print_desc,
 			strerror(errno));
 		goto Exit;
 	}
 
-	/* if switch, check for enhanced port 0 */
-	if (osm_node_get_type(node) == IB_NODE_TYPE_SWITCH &&
-	    node->sw &&
-	    ib_switch_info_is_enhanced_port0(&node->sw->switch_info))
-		startport = 0;
+	perfmgr_db_mark_active(pm->db, node_guid, TRUE);
 
 	/* issue the query for each port */
-	for (port = startport; port < num_ports; port++) {
+	for (port = mon_node->esp0 ? 0 : 1; port < num_ports; port++) {
 		ib_net16_t lid;
 
 		if (!osm_node_get_physp_ptr(node, port))
 			continue;
 
+		if (!mon_node->port[port].valid)
+			continue;
+
 		lid = get_lid(node, port, mon_node);
 		if (lid == 0) {
 			OSM_LOG(pm->log, OSM_LOG_DEBUG, "WARN: node 0x%" PRIx64
@@ -530,41 +558,40 @@ __osm_perfmgr_query_counters(cl_map_item_t * const p_map_item, void *context)
 		mad_context.perfmgr_context.port = port;
 		mad_context.perfmgr_context.mad_method = IB_MAD_METHOD_GET;
 #if ENABLE_OSM_PERF_MGR_PROFILE
-		gettimeofday(&(mad_context.perfmgr_context.query_start), NULL);
+		gettimeofday(&mad_context.perfmgr_context.query_start, NULL);
 #endif
 		OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Getting stats for node 0x%"
 			PRIx64 " port %d (lid %u) (%s)\n", node_guid, port,
 			cl_ntoh16(lid), node->print_desc);
-		status =
-		    osm_perfmgr_send_pc_mad(pm, lid, remote_qp, port,
-					    IB_MAD_METHOD_GET, &mad_context);
+		status = perfmgr_send_pc_mad(pm, lid, remote_qp,
+					     mon_node->port[port].pkey_ix,
+					     port, IB_MAD_METHOD_GET,
+					     &mad_context);
 		if (status != IB_SUCCESS)
-			OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C09: "
+			OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5409: "
 				"Failed to issue port counter query for node 0x%"
 				PRIx64 " port %d (%s)\n",
 				node->node_info.node_guid, port,
 				node->print_desc);
 	}
 Exit:
-	cl_plock_release(pm->lock);
+	cl_plock_release(&pm->osm->lock);
 	OSM_LOG_EXIT(pm->log);
 }
 
 /**********************************************************************
  * Discovery stuff.
- * Basically this code should not be here, but merged with main OpenSM
+ * This code should not be here, but merged with main OpenSM
  **********************************************************************/
-extern void osm_drop_mgr_process(IN osm_sm_t *sm);
+extern int wait_for_pending_transactions(osm_stats_t * stats);
+extern void osm_drop_mgr_process(IN osm_sm_t * sm);
 
 static int sweep_hop_1(osm_sm_t * sm)
 {
 	ib_api_status_t status = IB_SUCCESS;
-	osm_bind_handle_t h_bind;
 	osm_madw_context_t context;
 	osm_node_t *p_node;
 	osm_port_t *p_port;
-	osm_physp_t *p_physp;
-	osm_dr_path_t *p_dr_path;
 	osm_dr_path_t hop_1_path;
 	ib_net64_t port_guid;
 	uint8_t port_num;
@@ -577,7 +604,7 @@ static int sweep_hop_1(osm_sm_t * sm)
 	p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
 	if (!p_port) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
-			"ERR 4C81: No SM port object\n");
+			"ERR 5481: No SM port object\n");
 		return -1;
 	}
 
@@ -587,15 +614,6 @@ static int sweep_hop_1(osm_sm_t * sm)
 	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
 		"Probing hop 1 on local port %u\n", port_num);
 
-	p_physp = osm_node_get_physp_ptr(p_node, port_num);
-
-	CL_ASSERT(p_physp);
-
-	p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
-	h_bind = osm_dr_path_get_bind_handle(p_dr_path);
-
-	CL_ASSERT(h_bind != OSM_BIND_INVALID_HANDLE);
-
 	memset(path_array, 0, sizeof(path_array));
 	/* the hop_1 operations depend on the type of our node.
 	 * Currently - legal nodes that can host SM are SW and CA */
@@ -608,13 +626,14 @@ static int sweep_hop_1(osm_sm_t * sm)
 
 		path_array[1] = port_num;
 
-		osm_dr_path_init(&hop_1_path, h_bind, 1, path_array);
-		status = osm_req_get(sm, &hop_1_path,
-				     IB_MAD_ATTR_NODE_INFO, 0,
+		osm_dr_path_init(&hop_1_path, 1, path_array);
+		CL_PLOCK_ACQUIRE(sm->p_lock);
+		status = osm_req_get(sm, &hop_1_path, IB_MAD_ATTR_NODE_INFO, 0,
 				     CL_DISP_MSGID_NONE, &context);
+		CL_PLOCK_RELEASE(sm->p_lock);
 
 		if (status != IB_SUCCESS)
-			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4C82: "
+			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 5482: "
 				"Request for NodeInfo failed\n");
 		break;
 
@@ -641,27 +660,29 @@ static int sweep_hop_1(osm_sm_t * sm)
 
 			path_array[1] = port_num;
 
-			osm_dr_path_init(&hop_1_path, h_bind, 1, path_array);
+			osm_dr_path_init(&hop_1_path, 1, path_array);
+			CL_PLOCK_ACQUIRE(sm->p_lock);
 			status = osm_req_get(sm, &hop_1_path,
 					     IB_MAD_ATTR_NODE_INFO, 0,
 					     CL_DISP_MSGID_NONE, &context);
+			CL_PLOCK_RELEASE(sm->p_lock);
 
 			if (status != IB_SUCCESS)
-				OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4C82: "
+				OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 5484: "
 					"Request for NodeInfo failed\n");
 		}
 		break;
 
 	default:
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
-			"ERR 4C83: Unknown node type %d\n",
+			"ERR 5483: Unknown node type %d\n",
 			osm_node_get_type(p_node));
 	}
 
-	return (status);
+	return status;
 }
 
-static unsigned is_sm_port_down(osm_sm_t * const sm)
+static unsigned is_sm_port_down(osm_sm_t * sm)
 {
 	ib_net64_t port_guid;
 	osm_port_t *p_port;
@@ -674,17 +695,21 @@ static unsigned is_sm_port_down(osm_sm_t * const sm)
 	p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
 	if (!p_port) {
 		CL_PLOCK_RELEASE(sm->p_lock);
-		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4C85: "
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 5485: "
 			"SM port with GUID:%016" PRIx64 " is unknown\n",
 			cl_ntoh64(port_guid));
 		return 1;
 	}
 	CL_PLOCK_RELEASE(sm->p_lock);
 
+	if (p_port->p_node->sw &&
+	    !ib_switch_info_is_enhanced_port0(&p_port->p_node->sw->switch_info))
+		return 0;	/* base SP0 */
+
 	return osm_physp_get_port_state(p_port->p_physp) == IB_LINK_DOWN;
 }
 
-static int sweep_hop_0(osm_sm_t * const sm)
+static int sweep_hop_0(osm_sm_t * sm)
 {
 	ib_api_status_t status;
 	osm_dr_path_t dr_path;
@@ -695,37 +720,38 @@ static int sweep_hop_0(osm_sm_t * const sm)
 
 	h_bind = osm_sm_mad_ctrl_get_bind_handle(&sm->mad_ctrl);
 	if (h_bind == OSM_BIND_INVALID_HANDLE) {
-		OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "No bound ports.\n");
+		OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "No bound ports\n");
 		return -1;
 	}
 
-	osm_dr_path_init(&dr_path, h_bind, 0, path_array);
+	osm_dr_path_init(&dr_path, 0, path_array);
+	CL_PLOCK_ACQUIRE(sm->p_lock);
 	status = osm_req_get(sm, &dr_path, IB_MAD_ATTR_NODE_INFO, 0,
 			     CL_DISP_MSGID_NONE, NULL);
+	CL_PLOCK_RELEASE(sm->p_lock);
 
 	if (status != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
-			"ERR 4C86: Request for NodeInfo failed\n");
+			"ERR 5486: Request for NodeInfo failed\n");
 
-	return (status);
+	return status;
 }
 
-static void reset_node_count(cl_map_item_t * const p_map_item, void *cxt)
+static void reset_node_count(cl_map_item_t * p_map_item, void *cxt)
 {
 	osm_node_t *p_node = (osm_node_t *) p_map_item;
 	p_node->discovery_count = 0;
 }
 
-static void reset_port_count(cl_map_item_t * const p_map_item, void *cxt)
+static void reset_port_count(cl_map_item_t * p_map_item, void *cxt)
 {
 	osm_port_t *p_port = (osm_port_t *) p_map_item;
 	p_port->discovery_count = 0;
 }
 
-static void reset_switch_count(cl_map_item_t * const p_map_item, void *cxt)
+static void reset_switch_count(cl_map_item_t * p_map_item, void *cxt)
 {
 	osm_switch_t *p_sw = (osm_switch_t *) p_map_item;
-	p_sw->discovery_count = 0;
 	p_sw->need_update = 0;
 }
 
@@ -785,28 +811,42 @@ void osm_perfmgr_process(osm_perfmgr_t * pm)
 	    pm->subn->sm_state == IB_SMINFO_STATE_NOTACTIVE)
 		perfmgr_discovery(pm->subn->p_osm);
 
+	/* if redirection enabled, determine local port */
+	if (pm->subn->opt.perfmgr_redir && pm->local_port == -1) {
+		osm_node_t *p_node;
+		osm_port_t *p_port;
+
+		CL_PLOCK_ACQUIRE(pm->sm->p_lock);
+		p_port = osm_get_port_by_guid(pm->subn, pm->port_guid);
+		if (p_port) {
+			p_node = p_port->p_node;
+			CL_ASSERT(p_node);
+			pm->local_port =
+			    ib_node_info_get_local_port_num(&p_node->node_info);
+		} else
+			OSM_LOG(pm->log, OSM_LOG_ERROR,
+				"ERR 5487: No PerfMgr port object\n");
+		CL_PLOCK_RELEASE(pm->sm->p_lock);
+	}
+
 #if ENABLE_OSM_PERF_MGR_PROFILE
 	gettimeofday(&before, NULL);
 #endif
 	pm->sweep_state = PERFMGR_SWEEP_ACTIVE;
-	/* With the global lock held collect the node guids */
+	/* With the global lock held, collect the node guids */
 	/* FIXME we should be able to track SA notices
 	 * and not have to sweep the node_guid_tbl each pass
 	 */
 	OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Gathering PerfMgr stats\n");
-	cl_plock_acquire(pm->lock);
-	cl_qmap_apply_func(&(pm->subn->node_guid_tbl),
-			   __collect_guids, (void *)pm);
-	cl_plock_release(pm->lock);
+	cl_plock_acquire(&pm->osm->lock);
+	cl_qmap_apply_func(&pm->subn->node_guid_tbl, collect_guids, pm);
+	cl_plock_release(&pm->osm->lock);
 
 	/* then for each node query their counters */
-	cl_qmap_apply_func(&(pm->monitored_map),
-			   __osm_perfmgr_query_counters, (void *)pm);
+	cl_qmap_apply_func(&pm->monitored_map, perfmgr_query_counters, pm);
 
-	/* Clean out any nodes found to be removed during the
-	 * sweep
-	 */
-	__remove_marked_nodes(pm);
+	/* clean out any nodes found to be removed during the sweep */
+	remove_marked_nodes(pm);
 
 #if ENABLE_OSM_PERF_MGR_PROFILE
 	/* spin on outstanding queries */
@@ -815,15 +855,14 @@ void osm_perfmgr_process(osm_perfmgr_t * pm)
 
 	gettimeofday(&after, NULL);
 	diff_time(&before, &after, &after);
-	osm_log(pm->log, OSM_LOG_INFO,
-		"PerfMgr total sweep time : %ld.%06ld s\n"
-		"        fastest mad      : %g us\n"
-		"        slowest mad      : %g us\n"
-		"        average mad      : %g us\n",
-		after.tv_sec, after.tv_usec,
-		perfmgr_mad_stats.fastest_us,
-		perfmgr_mad_stats.slowest_us, perfmgr_mad_stats.avg_us);
-	perfmgr_clear_mad_stats();
+	osm_log_v2(pm->log, OSM_LOG_INFO, FILE_ID,
+		   "PerfMgr total sweep time : %ld.%06ld s\n"
+		   "        fastest mad      : %g us\n"
+		   "        slowest mad      : %g us\n"
+		   "        average mad      : %g us\n",
+		   after.tv_sec, after.tv_usec, perfmgr_mad_stats.fastest_us,
+		   perfmgr_mad_stats.slowest_us, perfmgr_mad_stats.avg_us);
+	clear_mad_stats();
 #endif
 
 	pm->sweep_state = PERFMGR_SWEEP_SLEEP;
@@ -831,30 +870,26 @@ void osm_perfmgr_process(osm_perfmgr_t * pm)
 
 /**********************************************************************
  * PerfMgr timer - loop continuously and signal SM to run PerfMgr
- * processor.
+ * processor if enabled.
  **********************************************************************/
 static void perfmgr_sweep(void *arg)
 {
 	osm_perfmgr_t *pm = arg;
 
-	if (pm->state == PERFMGR_STATE_ENABLED)
-		osm_sm_signal(pm->sm, OSM_SIGNAL_PERFMGR_SWEEP);
+	osm_sm_signal(pm->sm, OSM_SIGNAL_PERFMGR_SWEEP);
 	cl_timer_start(&pm->sweep_timer, pm->sweep_time_s * 1000);
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_perfmgr_shutdown(osm_perfmgr_t * const pm)
+void osm_perfmgr_shutdown(osm_perfmgr_t * pm)
 {
 	OSM_LOG_ENTER(pm->log);
 	cl_timer_stop(&pm->sweep_timer);
-	osm_perfmgr_mad_unbind(pm);
+	cl_disp_unregister(pm->pc_disp_h);
+	perfmgr_mad_unbind(pm);
 	OSM_LOG_EXIT(pm->log);
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_perfmgr_destroy(osm_perfmgr_t * const pm)
+void osm_perfmgr_destroy(osm_perfmgr_t * pm)
 {
 	OSM_LOG_ENTER(pm->log);
 	perfmgr_db_destroy(pm->db);
@@ -864,17 +899,17 @@ void osm_perfmgr_destroy(osm_perfmgr_t * const pm)
 
 /**********************************************************************
  * Detect if someone else on the network could have cleared the counters
- * without us knowing.  This is easy to detect because the counters never wrap
- * but are "sticky"
+ * without us knowing.  This is easy to detect because the counters never
+ * wrap but are "sticky"
  *
- * The one time this will not work is if the port is getting errors fast enough
- * to have the reading overtake the previous reading.  In this case counters
- * will be missed.
+ * The one time this will not work is if the port is getting errors fast
+ * enough to have the reading overtake the previous reading.  In this case,
+ * counters will be missed.
  **********************************************************************/
-static void
-osm_perfmgr_check_oob_clear(osm_perfmgr_t * pm, __monitored_node_t *mon_node,
-			    uint8_t port, perfmgr_db_err_reading_t * cr,
-			    perfmgr_db_data_cnt_reading_t * dc)
+static void perfmgr_check_oob_clear(osm_perfmgr_t * pm,
+				    monitored_node_t * mon_node, uint8_t port,
+				    perfmgr_db_err_reading_t * cr,
+				    perfmgr_db_data_cnt_reading_t * dc)
 {
 	perfmgr_db_err_reading_t prev_err;
 	perfmgr_db_data_cnt_reading_t prev_dc;
@@ -899,7 +934,7 @@ osm_perfmgr_check_oob_clear(osm_perfmgr_t * pm, __monitored_node_t *mon_node,
 	    cr->link_integrity < prev_err.link_integrity ||
 	    cr->buffer_overrun < prev_err.buffer_overrun ||
 	    cr->vl15_dropped < prev_err.vl15_dropped) {
-		OSM_LOG(pm->log, OSM_LOG_ERROR, "PerfMgr: ERR 4C0A: "
+		OSM_LOG(pm->log, OSM_LOG_ERROR, "PerfMgr: ERR 540A: "
 			"Detected an out of band error clear "
 			"on %s (0x%" PRIx64 ") port %u\n",
 			mon_node->name, mon_node->guid, port);
@@ -921,7 +956,7 @@ osm_perfmgr_check_oob_clear(osm_perfmgr_t * pm, __monitored_node_t *mon_node,
 	    dc->xmit_pkts < prev_dc.xmit_pkts ||
 	    dc->rcv_pkts < prev_dc.rcv_pkts) {
 		OSM_LOG(pm->log, OSM_LOG_ERROR,
-			"PerfMgr: ERR 4C0B: Detected an out of band data counter "
+			"PerfMgr: ERR 540B: Detected an out of band data counter "
 			"clear on node %s (0x%" PRIx64 ") port %u\n",
 			mon_node->name, mon_node->guid, port);
 		perfmgr_db_clear_prev_dc(pm->db, mon_node->guid, port);
@@ -955,9 +990,9 @@ static int counter_overflow_32(ib_net32_t val)
  * Check if the port counters have overflowed and if so issue a clear
  * MAD to the port.
  **********************************************************************/
-static void
-osm_perfmgr_check_overflow(osm_perfmgr_t * pm, __monitored_node_t *mon_node,
-			   uint8_t port, ib_port_counters_t * pc)
+static void perfmgr_check_overflow(osm_perfmgr_t * pm,
+				   monitored_node_t * mon_node, int16_t pkey_ix,
+				   uint8_t port, ib_port_counters_t * pc)
 {
 	osm_madw_context_t mad_context;
 	ib_api_status_t status;
@@ -984,17 +1019,21 @@ osm_perfmgr_check_overflow(osm_perfmgr_t * pm, __monitored_node_t *mon_node,
 		osm_node_t *p_node = NULL;
 		ib_net16_t lid = 0;
 
-		osm_log(pm->log, OSM_LOG_VERBOSE,
-			"PerfMgr: Counter overflow: %s (0x%" PRIx64
-			") port %d; clearing counters\n",
-			mon_node->name, mon_node->guid, port);
+		if (!mon_node->port[port].valid)
+			goto Exit;
+
+		osm_log_v2(pm->log, OSM_LOG_VERBOSE, FILE_ID,
+			   "PerfMgr: Counter overflow: %s (0x%" PRIx64
+			   ") port %d; clearing counters\n",
+			   mon_node->name, mon_node->guid, port);
 
-		cl_plock_acquire(pm->lock);
-		p_node = osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
+		cl_plock_acquire(&pm->osm->lock);
+		p_node =
+		    osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
 		lid = get_lid(p_node, port, mon_node);
-		cl_plock_release(pm->lock);
+		cl_plock_release(&pm->osm->lock);
 		if (lid == 0) {
-			OSM_LOG(pm->log, OSM_LOG_ERROR, "PerfMgr: ERR 4C0C: "
+			OSM_LOG(pm->log, OSM_LOG_ERROR, "PerfMgr: ERR 540C: "
 				"Failed to clear counters for %s (0x%"
 				PRIx64 ") port %d; failed to get lid\n",
 				mon_node->name, mon_node->guid, port);
@@ -1007,15 +1046,16 @@ osm_perfmgr_check_overflow(osm_perfmgr_t * pm, __monitored_node_t *mon_node,
 		mad_context.perfmgr_context.port = port;
 		mad_context.perfmgr_context.mad_method = IB_MAD_METHOD_SET;
 		/* clear port counters */
-		status =
-		    osm_perfmgr_send_pc_mad(pm, lid, remote_qp, port,
-					    IB_MAD_METHOD_SET, &mad_context);
+		status = perfmgr_send_pc_mad(pm, lid, remote_qp, pkey_ix,
+					     port, IB_MAD_METHOD_SET,
+					     &mad_context);
 		if (status != IB_SUCCESS)
-			OSM_LOG(pm->log, OSM_LOG_ERROR, "PerfMgr: ERR 4C11: "
+			OSM_LOG(pm->log, OSM_LOG_ERROR, "PerfMgr: ERR 5411: "
 				"Failed to send clear counters MAD for %s (0x%"
 				PRIx64 ") port %d\n",
 				mon_node->name, mon_node->guid, port);
 
+		perfmgr_db_clear_prev_err(pm->db, mon_node->guid, port);
 		perfmgr_db_clear_prev_dc(pm->db, mon_node->guid, port);
 	}
 
@@ -1026,12 +1066,11 @@ Exit:
 /**********************************************************************
  * Check values for logging of errors
  **********************************************************************/
-static void
-osm_perfmgr_log_events(osm_perfmgr_t * pm, __monitored_node_t *mon_node, uint8_t port,
-		       perfmgr_db_err_reading_t * reading)
+static void perfmgr_log_errors(osm_perfmgr_t * pm,
+			       monitored_node_t * mon_node, uint8_t port,
+			       perfmgr_db_err_reading_t * reading)
 {
 	perfmgr_db_err_reading_t prev_read;
-	time_t time_diff = 0;
 	perfmgr_db_err_t err =
 	    perfmgr_db_get_prev_err(pm->db, mon_node->guid, port, &prev_read);
 
@@ -1041,72 +1080,133 @@ osm_perfmgr_log_events(osm_perfmgr_t * pm, __monitored_node_t *mon_node, uint8_t
 			mon_node->name, mon_node->guid, port);
 		return;
 	}
-	time_diff = (reading->time - prev_read.time);
-
-	/* FIXME these events should be defineable by the user in a config
-	 * file somewhere. */
-	if (reading->symbol_err_cnt > prev_read.symbol_err_cnt)
-		OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C0D: "
-			"Found %" PRIu64 " Symbol errors in %lu sec on %s (0x%"
-			PRIx64 ") port %u\n",
-			(reading->symbol_err_cnt - prev_read.symbol_err_cnt),
-			time_diff, mon_node->name, mon_node->guid, port);
-
-	if (reading->rcv_err > prev_read.rcv_err)
-		OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C0E: "
-			"Found %" PRIu64
-			" Receive errors in %lu sec on %s (0x%" PRIx64
-			") port %u\n", (reading->rcv_err - prev_read.rcv_err),
-			time_diff, mon_node->name, mon_node->guid, port);
-
-	if (reading->xmit_discards > prev_read.xmit_discards)
-		OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C0F: "
-			"Found %" PRIu64 " Xmit Discards in %lu sec on %s (0x%"
-			PRIx64 ") port %u\n",
-			(reading->xmit_discards - prev_read.xmit_discards),
-			time_diff, mon_node->name, mon_node->guid, port);
+
+#define LOG_ERR_CNT(errname, errnum, counter_name) \
+	if (reading->counter_name > prev_read.counter_name) \
+		OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR %s: " \
+			"%s : %" PRIu64 " : node " \
+			"\"%s\" (NodeGUID: 0x%" PRIx64 ") : port %u\n", \
+			errnum, errname, \
+			reading->counter_name - prev_read.counter_name, \
+			mon_node->name, mon_node->guid, port);
+
+	LOG_ERR_CNT("SymbolErrorCounter",           "5431", symbol_err_cnt);
+	LOG_ERR_CNT("LinkErrorRecoveryCounter",     "5432", link_err_recover);
+	LOG_ERR_CNT("LinkDownedCounter",            "5433", link_downed);
+	LOG_ERR_CNT("PortRcvErrors",                "5434", rcv_err);
+	LOG_ERR_CNT("PortRcvRemotePhysicalErrors",  "5435", rcv_rem_phys_err);
+	LOG_ERR_CNT("PortRcvSwitchRelayErrors",     "5436", rcv_switch_relay_err);
+	LOG_ERR_CNT("PortXmitDiscards",             "5437", xmit_discards);
+	LOG_ERR_CNT("PortXmitConstraintErrors",     "5438", xmit_constraint_err);
+	LOG_ERR_CNT("PortRcvConstraintErrors",      "5439", rcv_constraint_err);
+	LOG_ERR_CNT("LocalLinkIntegrityErrors",     "543A", link_integrity);
+	LOG_ERR_CNT("ExcessiveBufferOverrunErrors", "543B", buffer_overrun);
+	LOG_ERR_CNT("VL15Dropped",                  "543C", vl15_dropped);
+}
+
+static int16_t validate_redir_pkey(osm_perfmgr_t *pm, ib_net16_t pkey)
+{
+	int16_t pkey_ix = -1;
+	osm_port_t *p_port;
+	osm_pkey_tbl_t *p_pkey_tbl;
+	ib_net16_t *p_orig_pkey;
+	uint16_t block;
+	uint8_t index;
+
+	OSM_LOG_ENTER(pm->log);
+
+	CL_PLOCK_ACQUIRE(pm->sm->p_lock);
+	p_port = osm_get_port_by_guid(pm->subn, pm->port_guid);
+	if (!p_port) {
+		CL_PLOCK_RELEASE(pm->sm->p_lock);
+		OSM_LOG(pm->log, OSM_LOG_ERROR,
+			"ERR 541E: No PerfMgr port object\n");
+		goto Exit;
+	}
+	if (p_port->p_physp && osm_physp_is_valid(p_port->p_physp)) {
+		p_pkey_tbl = &p_port->p_physp->pkeys;
+		if (!p_pkey_tbl) {
+			CL_PLOCK_RELEASE(pm->sm->p_lock);
+			OSM_LOG(pm->log, OSM_LOG_VERBOSE,
+				"No PKey table found for PerfMgr port\n");
+			goto Exit;
+		}
+		p_orig_pkey = cl_map_get(&p_pkey_tbl->keys,
+					 ib_pkey_get_base(pkey));
+		if (!p_orig_pkey) {
+			CL_PLOCK_RELEASE(pm->sm->p_lock);
+			OSM_LOG(pm->log, OSM_LOG_VERBOSE,
+				"PKey 0x%x not found for PerfMgr port\n",
+				cl_ntoh16(pkey));
+			goto Exit;
+		}
+		if (osm_pkey_tbl_get_block_and_idx(p_pkey_tbl, p_orig_pkey,
+						   &block, &index) == IB_SUCCESS) {
+			CL_PLOCK_RELEASE(pm->sm->p_lock);
+			pkey_ix = block * IB_NUM_PKEY_ELEMENTS_IN_BLOCK + index;
+		} else {
+			CL_PLOCK_RELEASE(pm->sm->p_lock);
+			OSM_LOG(pm->log, OSM_LOG_ERROR,
+				"ERR 541F: Failed to obtain P_Key 0x%04x "
+				"block and index for PerfMgr port\n",
+				cl_ntoh16(pkey));
+		}
+	} else {
+		CL_PLOCK_RELEASE(pm->sm->p_lock);
+		OSM_LOG(pm->log, OSM_LOG_ERROR,
+			"ERR 5420: Local PerfMgt port physp invalid\n");
+	}
+
+Exit:
+	OSM_LOG_EXIT(pm->log);
+	return pkey_ix;
 }
 
 /**********************************************************************
  * The dispatcher uses a thread pool which will call this function when
- * we have a thread available to process our mad received from the wire.
+ * there is a thread available to process the mad received on the wire.
  **********************************************************************/
-static void osm_pc_rcv_process(void *context, void *data)
+static void pc_recv_process(void *context, void *data)
 {
-	osm_perfmgr_t *const pm = (osm_perfmgr_t *) context;
-	osm_madw_t *p_madw = (osm_madw_t *) data;
-	osm_madw_context_t *mad_context = &(p_madw->context);
+	osm_perfmgr_t *pm = context;
+	osm_madw_t *p_madw = data;
+	osm_madw_context_t *mad_context = &p_madw->context;
 	ib_port_counters_t *wire_read =
-	    (ib_port_counters_t *) & (osm_madw_get_perfmgt_mad_ptr(p_madw)->
-				      data);
+	    (ib_port_counters_t *) & osm_madw_get_perfmgt_mad_ptr(p_madw)->data;
 	ib_mad_t *p_mad = osm_madw_get_mad_ptr(p_madw);
 	uint64_t node_guid = mad_context->perfmgr_context.node_guid;
 	uint8_t port = mad_context->perfmgr_context.port;
 	perfmgr_db_err_reading_t err_reading;
 	perfmgr_db_data_cnt_reading_t data_reading;
 	cl_map_item_t *p_node;
-	__monitored_node_t *p_mon_node;
+	monitored_node_t *p_mon_node;
+	int16_t pkey_ix = 0;
+	boolean_t valid = TRUE;
 
 	OSM_LOG_ENTER(pm->log);
 
-	/* go ahead and get the monitored node struct to have the printable
-	 * name if needed in messages
+	/*
+	 * get the monitored node struct to have the printable name
+	 * for log messages
 	 */
-	if ((p_node = cl_qmap_get(&(pm->monitored_map), node_guid)) ==
-	    cl_qmap_end(&(pm->monitored_map))) {
-		OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C12: GUID 0x%016"
-			PRIx64 " not found in monitored map\n",
-			node_guid);
+	if ((p_node = cl_qmap_get(&pm->monitored_map, node_guid)) ==
+	    cl_qmap_end(&pm->monitored_map)) {
+		OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5412: GUID 0x%016"
+			PRIx64 " not found in monitored map\n", node_guid);
 		goto Exit;
 	}
-	p_mon_node = (__monitored_node_t *) p_node;
+	p_mon_node = (monitored_node_t *) p_node;
 
 	OSM_LOG(pm->log, OSM_LOG_VERBOSE,
 		"Processing received MAD status 0x%x context 0x%"
 		PRIx64 " port %u\n", p_mad->status, node_guid, port);
 
+	CL_ASSERT(p_mad->attr_id == IB_MAD_ATTR_PORT_CNTRS ||
+		  p_mad->attr_id == IB_MAD_ATTR_CLASS_PORT_INFO);
+
 	/* Response could also be redirection (IBM eHCA PMA does this) */
-	if (p_mad->attr_id == IB_MAD_ATTR_CLASS_PORT_INFO) {
+	if (p_mad->status & IB_MAD_STATUS_REDIRECT &&
+	    p_mad->attr_id == IB_MAD_ATTR_CLASS_PORT_INFO) {
 		char gid_str[INET6_ADDRSTRLEN];
 		ib_class_port_info_t *cpi =
 		    (ib_class_port_info_t *) &
@@ -1117,46 +1217,83 @@ static void osm_pc_rcv_process(void *context, void *data)
 			"Redirection to LID %u GID %s QP 0x%x received\n",
 			cl_ntoh16(cpi->redir_lid),
 			inet_ntop(AF_INET6, cpi->redir_gid.raw, gid_str,
-				  sizeof gid_str),
-			cl_ntoh32(cpi->redir_qp));
+				  sizeof gid_str), cl_ntoh32(cpi->redir_qp));
 
-		/* LID or GID redirection ? */
-		/* For GID redirection, need to get PathRecord from SA */
+		if (!pm->subn->opt.perfmgr_redir) {
+			OSM_LOG(pm->log, OSM_LOG_VERBOSE,
+				"Redirection requested but disabled\n");
+			valid = FALSE;
+		}
+
+		/* valid redirection ? */
 		if (cpi->redir_lid == 0) {
+			if (!ib_gid_is_notzero(&cpi->redir_gid)) {
+				OSM_LOG(pm->log, OSM_LOG_VERBOSE,
+					"Invalid redirection "
+					"(both redirect LID and GID are zero)\n");
+				valid = FALSE;
+			}
+		}
+		if (cpi->redir_qp == 0) {
+			OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Invalid RedirectQP\n");
+			valid = FALSE;
+		}
+		if (cpi->redir_pkey == 0) {
+			OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Invalid RedirectP_Key\n");
+			valid = FALSE;
+		}
+		if (cpi->redir_qkey != IB_QP1_WELL_KNOWN_Q_KEY) {
+			OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Invalid RedirectQ_Key\n");
+			valid = FALSE;
+		}
+
+		pkey_ix = validate_redir_pkey(pm, cpi->redir_pkey);
+		if (pkey_ix == -1) {
 			OSM_LOG(pm->log, OSM_LOG_VERBOSE,
-				"GID redirection not currently implemented!\n");
-			goto Exit;
+				"Index for Pkey 0x%x not found\n",
+				cl_ntoh16(cpi->redir_pkey));
+			valid = FALSE;
 		}
 
-		if (!pm->subn->opt.perfmgr_redir) {
-				OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C16: "
-				       "redirection requested but disabled\n");
+		if (cpi->redir_lid == 0) {
+			/* GID redirection: get PathRecord information */
+			OSM_LOG(pm->log, OSM_LOG_VERBOSE,
+				"GID redirection not currently supported\n");
 			goto Exit;
 		}
 
 		/* LID redirection support (easier than GID redirection) */
-		cl_plock_acquire(pm->lock);
+		cl_plock_acquire(&pm->osm->lock);
 		/* Now, validate port number */
-		if (port > p_mon_node->redir_tbl_size) {
-			cl_plock_release(pm->lock);
-			OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C13: "
+		if (port >= p_mon_node->num_ports) {
+			cl_plock_release(&pm->osm->lock);
+			OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5413: "
 				"Invalid port num %d for GUID 0x%016"
 				PRIx64 " num ports %d\n", port, node_guid,
-				p_mon_node->redir_tbl_size);
+				p_mon_node->num_ports);
 			goto Exit;
 		}
-		p_mon_node->redir_port[port].redir_lid = cpi->redir_lid;
-		p_mon_node->redir_port[port].redir_qp = cpi->redir_qp;
-		cl_plock_release(pm->lock);
+		p_mon_node->port[port].redirection = TRUE;
+		p_mon_node->port[port].valid = valid;
+		memcpy(&p_mon_node->port[port].gid, &cpi->redir_gid,
+		       sizeof(ib_gid_t));
+		p_mon_node->port[port].lid = cpi->redir_lid;
+		p_mon_node->port[port].qp = cpi->redir_qp;
+		p_mon_node->port[port].pkey = cpi->redir_pkey;
+		if (pkey_ix != -1)
+			p_mon_node->port[port].pkey_ix = pkey_ix;
+		cl_plock_release(&pm->osm->lock);
+
+		if (!valid)
+			goto Exit;
 
 		/* Finally, reissue the query to the redirected location */
-		status =
-		    osm_perfmgr_send_pc_mad(pm, cpi->redir_lid, cpi->redir_qp,
-					    port,
-					    mad_context->perfmgr_context.
-					    mad_method, mad_context);
+		status = perfmgr_send_pc_mad(pm, cpi->redir_lid, cpi->redir_qp,
+					     pkey_ix, port,
+					     mad_context->perfmgr_context.
+					     mad_method, mad_context);
 		if (status != IB_SUCCESS)
-			OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C14: "
+			OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5414: "
 				"Failed to send redirected MAD with method 0x%x for node 0x%"
 				PRIx64 " port %d\n",
 				mad_context->perfmgr_context.mad_method,
@@ -1164,8 +1301,6 @@ static void osm_pc_rcv_process(void *context, void *data)
 		goto Exit;
 	}
 
-	CL_ASSERT(p_mad->attr_id == IB_MAD_ATTR_PORT_CNTRS);
-
 	perfmgr_db_fill_err_read(wire_read, &err_reading);
 	/* FIXME separate query for extended counters if they are supported
 	 * on the port.
@@ -1174,13 +1309,14 @@ static void osm_pc_rcv_process(void *context, void *data)
 
 	/* detect an out of band clear on the port */
 	if (mad_context->perfmgr_context.mad_method != IB_MAD_METHOD_SET)
-		osm_perfmgr_check_oob_clear(pm, p_mon_node, port,
-					    &err_reading, &data_reading);
-
-	/* log any critical events from this reading */
-	osm_perfmgr_log_events(pm, p_mon_node, port, &err_reading);
+		perfmgr_check_oob_clear(pm, p_mon_node, port, &err_reading,
+					&data_reading);
 
 	if (mad_context->perfmgr_context.mad_method == IB_MAD_METHOD_GET) {
+		/* log errors from this reading */
+		if (pm->subn->opt.perfmgr_log_errors)
+			perfmgr_log_errors(pm, p_mon_node, port, &err_reading);
+
 		perfmgr_db_add_err_reading(pm->db, node_guid, port,
 					   &err_reading);
 		perfmgr_db_add_dc_reading(pm->db, node_guid, port,
@@ -1190,13 +1326,13 @@ static void osm_pc_rcv_process(void *context, void *data)
 		perfmgr_db_clear_prev_dc(pm->db, node_guid, port);
 	}
 
-	osm_perfmgr_check_overflow(pm, p_mon_node, port, wire_read);
+	perfmgr_check_overflow(pm, p_mon_node, pkey_ix, port, wire_read);
 
 #if ENABLE_OSM_PERF_MGR_PROFILE
 	do {
 		struct timeval proc_time;
 		gettimeofday(&proc_time, NULL);
-		diff_time(&(p_madw->context.perfmgr_context.query_start),
+		diff_time(&p_madw->context.perfmgr_context.query_start,
 			  &proc_time, &proc_time);
 		update_mad_stats(&proc_time);
 	} while (0);
@@ -1211,11 +1347,10 @@ Exit:
 /**********************************************************************
  * Initialize the PerfMgr object
  **********************************************************************/
-ib_api_status_t
-osm_perfmgr_init(osm_perfmgr_t * const pm, osm_opensm_t *osm,
-		 const osm_subn_opt_t * const p_opt)
+ib_api_status_t osm_perfmgr_init(osm_perfmgr_t * pm, osm_opensm_t * osm,
+				 const osm_subn_opt_t * p_opt)
 {
-	ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status;
 
 	OSM_LOG_ENTER(&osm->log);
 
@@ -1230,18 +1365,20 @@ osm_perfmgr_init(osm_perfmgr_t * const pm, osm_opensm_t *osm,
 	pm->log = &osm->log;
 	pm->mad_pool = &osm->mad_pool;
 	pm->vendor = osm->p_vendor;
-	pm->trans_id = OSM_PERFMGR_INITIAL_TID_VALUE;
-	pm->lock = &osm->lock;
+	pm->trans_id = PERFMGR_INITIAL_TID_VALUE;
 	pm->state =
 	    p_opt->perfmgr ? PERFMGR_STATE_ENABLED : PERFMGR_STATE_DISABLE;
 	pm->sweep_time_s = p_opt->perfmgr_sweep_time_s;
 	pm->max_outstanding_queries = p_opt->perfmgr_max_outstanding_queries;
+	pm->ignore_cas = p_opt->perfmgr_ignore_cas;
 	pm->osm = osm;
+	pm->local_port = -1;
 
 	status = cl_timer_init(&pm->sweep_timer, perfmgr_sweep, pm);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
+	status = IB_INSUFFICIENT_RESOURCES;
 	pm->db = perfmgr_db_construct(pm);
 	if (!pm->db) {
 		pm->state = PERFMGR_STATE_NO_DB;
@@ -1249,17 +1386,22 @@ osm_perfmgr_init(osm_perfmgr_t * const pm, osm_opensm_t *osm,
 	}
 
 	pm->pc_disp_h = cl_disp_register(&osm->disp, OSM_MSG_MAD_PORT_COUNTERS,
-					 osm_pc_rcv_process, pm);
-	if (pm->pc_disp_h == CL_DISP_INVALID_HANDLE)
+					 pc_recv_process, pm);
+	if (pm->pc_disp_h == CL_DISP_INVALID_HANDLE) {
+		perfmgr_db_destroy(pm->db);
 		goto Exit;
+	}
 
-	__init_monitored_nodes(pm);
+	init_monitored_nodes(pm);
 
-	cl_timer_start(&pm->sweep_timer, pm->sweep_time_s * 1000);
+	if (pm->state == PERFMGR_STATE_ENABLED)
+		cl_timer_start(&pm->sweep_timer, pm->sweep_time_s * 1000);
 
+	pm->rm_nodes = p_opt->perfmgr_rm_nodes;
+	status = IB_SUCCESS;
 Exit:
 	OSM_LOG_EXIT(pm->log);
-	return (status);
+	return status;
 }
 
 /**********************************************************************
@@ -1271,11 +1413,11 @@ void osm_perfmgr_clear_counters(osm_perfmgr_t * pm)
 	 * FIXME todo issue clear on the fabric?
 	 */
 	perfmgr_db_clear_counters(pm->db);
-	osm_log(pm->log, OSM_LOG_INFO, "PerfMgr counters cleared\n");
+	osm_log_v2(pm->log, OSM_LOG_INFO, FILE_ID, "PerfMgr counters cleared\n");
 }
 
 /*******************************************************************
- * Have the DB dump its information to the file specified
+ * Dump the DB information to the file specified
  *******************************************************************/
 void osm_perfmgr_dump_counters(osm_perfmgr_t * pm, perfmgr_db_dump_t dump_type)
 {
@@ -1295,17 +1437,21 @@ void osm_perfmgr_dump_counters(osm_perfmgr_t * pm, perfmgr_db_dump_t dump_type)
 }
 
 /*******************************************************************
- * Have the DB print its information to the fp specified
+ * Print the DB information to the fp specified
  *******************************************************************/
-void
-osm_perfmgr_print_counters(osm_perfmgr_t *pm, char *nodename, FILE *fp)
+void osm_perfmgr_print_counters(osm_perfmgr_t * pm, char *nodename, FILE * fp,
+				char *port, int err_only)
 {
-	uint64_t guid = strtoull(nodename, NULL, 0);
-	if (guid == 0 && errno == EINVAL) {
-		perfmgr_db_print_by_name(pm->db, nodename, fp);
-	} else {
-		perfmgr_db_print_by_guid(pm->db, guid, fp);
-	}
+	if (nodename) {
+		char *end = NULL;
+		uint64_t guid = strtoull(nodename, &end, 0);
+		if (nodename + strlen(nodename) != end)
+			perfmgr_db_print_by_name(pm->db, nodename, fp, port,
+						 err_only);
+		else
+			perfmgr_db_print_by_guid(pm->db, guid, fp, port,
+						 err_only);
+	} else
+		perfmgr_db_print_all(pm->db, fp, err_only);
 }
-
 #endif				/* ENABLE_OSM_PERF_MGR */
diff --git a/opensm/osm_perfmgr_db.c b/opensm/osm_perfmgr_db.c
index 934be77..98b587d 100644
--- a/opensm/osm_perfmgr_db.c
+++ b/opensm/osm_perfmgr_db.c
@@ -1,6 +1,7 @@
 /*
- * Copyright (c) 2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2008-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2007 The Regents of the University of California.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -44,31 +45,43 @@
 #include <dlfcn.h>
 #include <sys/stat.h>
 
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_PERFMGR_DB_C
 #include <opensm/osm_perfmgr_db.h>
 #include <opensm/osm_perfmgr.h>
 #include <opensm/osm_opensm.h>
 
+static void free_node(db_node_t * node);
+
 /** =========================================================================
  */
 perfmgr_db_t *perfmgr_db_construct(osm_perfmgr_t *perfmgr)
 {
 	perfmgr_db_t *db = malloc(sizeof(*db));
 	if (!db)
-		return (NULL);
+		return NULL;
 
-	cl_qmap_init(&(db->pc_data));
-	cl_plock_construct(&(db->lock));
-	cl_plock_init(&(db->lock));
+	cl_qmap_init(&db->pc_data);
+	cl_plock_construct(&db->lock);
+	cl_plock_init(&db->lock);
 	db->perfmgr = perfmgr;
-	return ((void *)db);
+	return db;
 }
 
 /** =========================================================================
  */
 void perfmgr_db_destroy(perfmgr_db_t * db)
 {
+	cl_map_item_t *item, *next_item;
+
 	if (db) {
-		cl_plock_destroy(&(db->lock));
+		item = cl_qmap_head(&db->pc_data);
+		while (item != cl_qmap_end(&db->pc_data)) {
+			next_item = cl_qmap_next(item);
+			free_node((db_node_t *)item);
+			item = next_item;
+		}
+		cl_plock_destroy(&db->lock);
 		free(db);
 	}
 }
@@ -76,59 +89,69 @@ void perfmgr_db_destroy(perfmgr_db_t * db)
 /**********************************************************************
  * Internal call db->lock should be held when calling
  **********************************************************************/
-static inline _db_node_t *_get(perfmgr_db_t * db, uint64_t guid)
+static inline db_node_t *get(perfmgr_db_t * db, uint64_t guid)
 {
-	cl_map_item_t *rc = cl_qmap_get(&(db->pc_data), guid);
-	const cl_map_item_t *end = cl_qmap_end(&(db->pc_data));
+	cl_map_item_t *rc = cl_qmap_get(&db->pc_data, guid);
+	const cl_map_item_t *end = cl_qmap_end(&db->pc_data);
 
 	if (rc == end)
-		return (NULL);
-	return ((_db_node_t *) rc);
+		return NULL;
+	return (db_node_t *) rc;
 }
 
-static inline perfmgr_db_err_t bad_node_port(_db_node_t * node, uint8_t port)
+static inline perfmgr_db_err_t bad_node_port(db_node_t * node, uint8_t port)
 {
 	if (!node)
-		return (PERFMGR_EVENT_DB_GUIDNOTFOUND);
-	if (port == 0 || port >= node->num_ports)
-		return (PERFMGR_EVENT_DB_PORTNOTFOUND);
-	return (PERFMGR_EVENT_DB_SUCCESS);
+		return PERFMGR_EVENT_DB_GUIDNOTFOUND;
+	if (port >= node->num_ports || (!node->esp0 && port == 0))
+		return PERFMGR_EVENT_DB_PORTNOTFOUND;
+
+	return PERFMGR_EVENT_DB_SUCCESS;
+}
+
+static inline void mark_port_valid(db_node_t * node, uint8_t port)
+{
+	node->ports[port].valid = TRUE;
 }
 
 /** =========================================================================
  */
-static _db_node_t *__malloc_node(uint64_t guid, uint8_t num_ports, char *name)
+static db_node_t *malloc_node(uint64_t guid, boolean_t esp0,
+			      uint8_t num_ports, char *name)
 {
 	int i = 0;
 	time_t cur_time = 0;
-	_db_node_t *rc = malloc(sizeof(*rc));
+	db_node_t *rc = malloc(sizeof(*rc));
 	if (!rc)
-		return (NULL);
+		return NULL;
 
-	rc->ports = calloc(num_ports, sizeof(_db_port_t));
+	rc->ports = calloc(num_ports, sizeof(db_port_t));
 	if (!rc->ports)
 		goto free_rc;
 	rc->num_ports = num_ports;
 	rc->node_guid = guid;
+	rc->esp0 = esp0;
 
 	cur_time = time(NULL);
 	for (i = 0; i < num_ports; i++) {
 		rc->ports[i].last_reset = cur_time;
 		rc->ports[i].err_previous.time = cur_time;
 		rc->ports[i].dc_previous.time = cur_time;
+		rc->ports[i].valid = FALSE;
 	}
-	snprintf(rc->node_name, NODE_NAME_SIZE, "%s", name);
+	snprintf(rc->node_name, sizeof(rc->node_name), "%s", name);
+	rc->active = FALSE;
 
-	return (rc);
+	return rc;
 
 free_rc:
 	free(rc);
-	return (NULL);
+	return NULL;
 }
 
 /** =========================================================================
  */
-static void __free_node(_db_node_t * node)
+static void free_node(db_node_t * node)
 {
 	if (!node)
 		return;
@@ -138,132 +161,202 @@ static void __free_node(_db_node_t * node)
 }
 
 /* insert nodes to the database */
-static perfmgr_db_err_t __insert(perfmgr_db_t * db, _db_node_t * node)
+static perfmgr_db_err_t insert(perfmgr_db_t * db, db_node_t * node)
 {
-	cl_map_item_t *rc = cl_qmap_insert(&(db->pc_data), node->node_guid,
+	cl_map_item_t *rc = cl_qmap_insert(&db->pc_data, node->node_guid,
 					   (cl_map_item_t *) node);
 
 	if ((void *)rc != (void *)node)
-		return (PERFMGR_EVENT_DB_FAIL);
-	return (PERFMGR_EVENT_DB_SUCCESS);
+		return PERFMGR_EVENT_DB_FAIL;
+	return PERFMGR_EVENT_DB_SUCCESS;
 }
 
-/**********************************************************************
- **********************************************************************/
 perfmgr_db_err_t
-perfmgr_db_create_entry(perfmgr_db_t * db, uint64_t guid,
+perfmgr_db_create_entry(perfmgr_db_t * db, uint64_t guid, boolean_t esp0,
 			uint8_t num_ports, char *name)
 {
 	perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;
 
-	cl_plock_excl_acquire(&(db->lock));
-	if (!_get(db, guid)) {
-		_db_node_t *pc_node = __malloc_node(guid, num_ports, name);
+	cl_plock_excl_acquire(&db->lock);
+	if (!get(db, guid)) {
+		db_node_t *pc_node = malloc_node(guid, esp0, num_ports,
+						 name);
 		if (!pc_node) {
 			rc = PERFMGR_EVENT_DB_NOMEM;
 			goto Exit;
 		}
-		if (__insert(db, pc_node)) {
-			__free_node(pc_node);
+		if (insert(db, pc_node)) {
+			free_node(pc_node);
 			rc = PERFMGR_EVENT_DB_FAIL;
 			goto Exit;
 		}
 	}
 Exit:
-	cl_plock_release(&(db->lock));
-	return (rc);
+	cl_plock_release(&db->lock);
+	return rc;
+}
+
+perfmgr_db_err_t
+perfmgr_db_delete_entry(perfmgr_db_t * db, uint64_t guid)
+{
+	cl_map_item_t * rc = cl_qmap_remove(&db->pc_data, guid);
+
+	if (rc == cl_qmap_end(&db->pc_data))
+		return(PERFMGR_EVENT_DB_GUIDNOTFOUND);
+
+	db_node_t *pc_node = (db_node_t *)rc;
+	free_node(pc_node);
+	return(PERFMGR_EVENT_DB_SUCCESS);
 }
 
+perfmgr_db_err_t
+perfmgr_db_delete_inactive(perfmgr_db_t * db, unsigned *cnt)
+{
+	perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;
+	int i = 0;
+	int num = 0;
+	uint64_t * guid_list = NULL;
+	cl_map_item_t * p_map_item = cl_qmap_head(&db->pc_data);
+
+	if (p_map_item == cl_qmap_end(&db->pc_data)) {
+		rc = PERFMGR_EVENT_DB_SUCCESS;
+		goto Done;
+	}
+
+	while (p_map_item != cl_qmap_end(&db->pc_data)) {
+		db_node_t *n = (db_node_t *)p_map_item;
+		if (n->active == FALSE) {
+			guid_list = realloc(guid_list,
+					sizeof(*guid_list) * (num+1));
+			if (!guid_list) {
+				num = 0;
+				rc = PERFMGR_EVENT_DB_NOMEM;
+				goto Done;
+			}
+			guid_list[num] = n->node_guid;
+			num++;
+		}
+		p_map_item = cl_qmap_next(p_map_item);
+	}
+
+	for (i = 0 ; i < num; i++)
+		perfmgr_db_delete_entry(db, guid_list[i]);
+
+	free(guid_list);
+
+Done:
+	if (cnt)
+		*cnt = num;
+
+	return(rc);
+}
+
+perfmgr_db_err_t
+perfmgr_db_mark_active(perfmgr_db_t *db, uint64_t guid, boolean_t active)
+{
+	db_node_t *node = NULL;
+
+	cl_plock_excl_acquire(&db->lock);
+	node = get(db, guid);
+	if (node)
+		node->active = active;
+	cl_plock_release(&db->lock);
+	return (PERFMGR_EVENT_DB_SUCCESS);
+}
+
+
 /**********************************************************************
  * Dump a reading vs the previous reading to stdout
  **********************************************************************/
 static inline void
 debug_dump_err_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port_num,
-		       _db_port_t * port, perfmgr_db_err_reading_t * cur)
+		       db_port_t * port, perfmgr_db_err_reading_t * cur)
 {
 	osm_log_t *log = db->perfmgr->log;
 
-	if (!osm_log_is_active(log, OSM_LOG_DEBUG))
+	if (!OSM_LOG_IS_ACTIVE_V2(log, OSM_LOG_DEBUG))
 		return;		/* optimize this a bit */
 
-	osm_log(log, OSM_LOG_DEBUG,
-		"GUID 0x%" PRIx64 " Port %u:\n", guid, port_num);
-	osm_log(log, OSM_LOG_DEBUG,
-		"sym %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
-		cur->symbol_err_cnt, port->err_previous.symbol_err_cnt,
-		port->err_total.symbol_err_cnt);
-	osm_log(log, OSM_LOG_DEBUG,
-		"ler %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
-		cur->link_err_recover, port->err_previous.link_err_recover,
-		port->err_total.link_err_recover);
-	osm_log(log, OSM_LOG_DEBUG,
-		"ld %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
-		cur->link_downed, port->err_previous.link_downed,
-		port->err_total.link_downed);
-	osm_log(log, OSM_LOG_DEBUG,
-		"re %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_err,
-		port->err_previous.rcv_err, port->err_total.rcv_err);
-	osm_log(log, OSM_LOG_DEBUG,
-		"rrp %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
-		cur->rcv_rem_phys_err, port->err_previous.rcv_rem_phys_err,
-		port->err_total.rcv_rem_phys_err);
-	osm_log(log, OSM_LOG_DEBUG,
-		"rsr %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
-		cur->rcv_switch_relay_err,
-		port->err_previous.rcv_switch_relay_err,
-		port->err_total.rcv_switch_relay_err);
-	osm_log(log, OSM_LOG_DEBUG,
-		"xd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
-		cur->xmit_discards, port->err_previous.xmit_discards,
-		port->err_total.xmit_discards);
-	osm_log(log, OSM_LOG_DEBUG,
-		"xce %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
-		cur->xmit_constraint_err,
-		port->err_previous.xmit_constraint_err,
-		port->err_total.xmit_constraint_err);
-	osm_log(log, OSM_LOG_DEBUG,
-		"rce %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
-		cur->rcv_constraint_err, port->err_previous.rcv_constraint_err,
-		port->err_total.rcv_constraint_err);
-	osm_log(log, OSM_LOG_DEBUG,
-		"li %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
-		cur->link_integrity, port->err_previous.link_integrity,
-		port->err_total.link_integrity);
-	osm_log(log, OSM_LOG_DEBUG,
-		"bo %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
-		cur->buffer_overrun, port->err_previous.buffer_overrun,
-		port->err_total.buffer_overrun);
-	osm_log(log, OSM_LOG_DEBUG,
-		"vld %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
-		cur->vl15_dropped, port->err_previous.vl15_dropped,
-		port->err_total.vl15_dropped);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "GUID 0x%" PRIx64 " Port %u:\n", guid, port_num);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "sym %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		   cur->symbol_err_cnt, port->err_previous.symbol_err_cnt,
+		   port->err_total.symbol_err_cnt);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "ler %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		   cur->link_err_recover, port->err_previous.link_err_recover,
+		   port->err_total.link_err_recover);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "ld %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		   cur->link_downed, port->err_previous.link_downed,
+		   port->err_total.link_downed);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "re %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_err,
+		   port->err_previous.rcv_err, port->err_total.rcv_err);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "rrp %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		   cur->rcv_rem_phys_err, port->err_previous.rcv_rem_phys_err,
+		   port->err_total.rcv_rem_phys_err);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "rsr %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		   cur->rcv_switch_relay_err,
+		   port->err_previous.rcv_switch_relay_err,
+		   port->err_total.rcv_switch_relay_err);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "xd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		   cur->xmit_discards, port->err_previous.xmit_discards,
+		   port->err_total.xmit_discards);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "xce %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		   cur->xmit_constraint_err,
+		   port->err_previous.xmit_constraint_err,
+		   port->err_total.xmit_constraint_err);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "rce %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		   cur->rcv_constraint_err, port->err_previous.rcv_constraint_err,
+		   port->err_total.rcv_constraint_err);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "li %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		   cur->link_integrity, port->err_previous.link_integrity,
+		   port->err_total.link_integrity);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "bo %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		   cur->buffer_overrun, port->err_previous.buffer_overrun,
+		   port->err_total.buffer_overrun);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "vld %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		   cur->vl15_dropped, port->err_previous.vl15_dropped,
+		   port->err_total.vl15_dropped);
 }
 
 /**********************************************************************
  * perfmgr_db_err_reading_t functions
  **********************************************************************/
 perfmgr_db_err_t
-perfmgr_db_add_err_reading(perfmgr_db_t * db, uint64_t guid,
-			   uint8_t port, perfmgr_db_err_reading_t * reading)
+perfmgr_db_add_err_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port,
+			   perfmgr_db_err_reading_t * reading)
 {
-	_db_port_t *p_port = NULL;
-	_db_node_t *node = NULL;
+	db_port_t *p_port = NULL;
+	db_node_t *node = NULL;
 	perfmgr_db_err_reading_t *previous = NULL;
 	perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;
 	osm_epi_pe_event_t epi_pe_data;
 
-	cl_plock_excl_acquire(&(db->lock));
-	node = _get(db, guid);
+	cl_plock_excl_acquire(&db->lock);
+	node = get(db, guid);
 	if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS)
 		goto Exit;
 
+	mark_port_valid(node, port);
+
 	p_port = &(node->ports[port]);
 	previous = &(node->ports[port].err_previous);
 
 	debug_dump_err_reading(db, guid, port, p_port, reading);
 
 	epi_pe_data.time_diff_s = (reading->time - previous->time);
-	osm_epi_create_port_id(&(epi_pe_data.port_id), guid, port,
+	osm_epi_create_port_id(&epi_pe_data.port_id, guid, port,
 			       node->node_name);
 
 	/* calculate changes from previous reading */
@@ -311,39 +404,39 @@ perfmgr_db_add_err_reading(perfmgr_db_t * db, uint64_t guid,
 				&epi_pe_data);
 
 Exit:
-	cl_plock_release(&(db->lock));
-	return (rc);
+	cl_plock_release(&db->lock);
+	return rc;
 }
 
 perfmgr_db_err_t perfmgr_db_get_prev_err(perfmgr_db_t * db, uint64_t guid,
 					 uint8_t port,
 					 perfmgr_db_err_reading_t * reading)
 {
-	_db_node_t *node = NULL;
+	db_node_t *node = NULL;
 	perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;
 
-	cl_plock_acquire(&(db->lock));
+	cl_plock_acquire(&db->lock);
 
-	node = _get(db, guid);
+	node = get(db, guid);
 	if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS)
 		goto Exit;
 
 	*reading = node->ports[port].err_previous;
 
 Exit:
-	cl_plock_release(&(db->lock));
-	return (rc);
+	cl_plock_release(&db->lock);
+	return rc;
 }
 
 perfmgr_db_err_t
 perfmgr_db_clear_prev_err(perfmgr_db_t * db, uint64_t guid, uint8_t port)
 {
-	_db_node_t *node = NULL;
+	db_node_t *node = NULL;
 	perfmgr_db_err_reading_t *previous = NULL;
 	perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;
 
-	cl_plock_excl_acquire(&(db->lock));
-	node = _get(db, guid);
+	cl_plock_excl_acquire(&db->lock);
+	node = get(db, guid);
 	if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS)
 		goto Exit;
 
@@ -353,81 +446,83 @@ perfmgr_db_clear_prev_err(perfmgr_db_t * db, uint64_t guid, uint8_t port)
 	node->ports[port].err_previous.time = time(NULL);
 
 Exit:
-	cl_plock_release(&(db->lock));
-	return (rc);
+	cl_plock_release(&db->lock);
+	return rc;
 }
 
 static inline void
 debug_dump_dc_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port_num,
-		      _db_port_t * port, perfmgr_db_data_cnt_reading_t * cur)
+		      db_port_t * port, perfmgr_db_data_cnt_reading_t * cur)
 {
 	osm_log_t *log = db->perfmgr->log;
-	if (!osm_log_is_active(log, OSM_LOG_DEBUG))
-		return;		/* optimize this a big */
-
-	osm_log(log, OSM_LOG_DEBUG,
-		"xd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
-		cur->xmit_data, port->dc_previous.xmit_data,
-		port->dc_total.xmit_data);
-	osm_log(log, OSM_LOG_DEBUG,
-		"rd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_data,
-		port->dc_previous.rcv_data, port->dc_total.rcv_data);
-	osm_log(log, OSM_LOG_DEBUG,
-		"xp %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
-		cur->xmit_pkts, port->dc_previous.xmit_pkts,
-		port->dc_total.xmit_pkts);
-	osm_log(log, OSM_LOG_DEBUG,
-		"rp %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_pkts,
-		port->dc_previous.rcv_pkts, port->dc_total.rcv_pkts);
+	if (!OSM_LOG_IS_ACTIVE_V2(log, OSM_LOG_DEBUG))
+		return;
+
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "xd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		   cur->xmit_data, port->dc_previous.xmit_data,
+		   port->dc_total.xmit_data);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "rd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_data,
+		   port->dc_previous.rcv_data, port->dc_total.rcv_data);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "xp %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		   cur->xmit_pkts, port->dc_previous.xmit_pkts,
+		   port->dc_total.xmit_pkts);
+	osm_log_v2(log, OSM_LOG_DEBUG, FILE_ID,
+		   "rp %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_pkts,
+		   port->dc_previous.rcv_pkts, port->dc_total.rcv_pkts);
 }
 
 /**********************************************************************
  * perfmgr_db_data_cnt_reading_t functions
  **********************************************************************/
 perfmgr_db_err_t
-perfmgr_db_add_dc_reading(perfmgr_db_t * db, uint64_t guid,
-			  uint8_t port, perfmgr_db_data_cnt_reading_t * reading)
+perfmgr_db_add_dc_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port,
+			  perfmgr_db_data_cnt_reading_t * reading)
 {
-	_db_port_t *p_port = NULL;
-	_db_node_t *node = NULL;
+	db_port_t *p_port = NULL;
+	db_node_t *node = NULL;
 	perfmgr_db_data_cnt_reading_t *previous = NULL;
 	perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;
 	osm_epi_dc_event_t epi_dc_data;
 
-	cl_plock_excl_acquire(&(db->lock));
-	node = _get(db, guid);
+	cl_plock_excl_acquire(&db->lock);
+	node = get(db, guid);
 	if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS)
 		goto Exit;
 
-	p_port = &(node->ports[port]);
-	previous = &(node->ports[port].dc_previous);
+	mark_port_valid(node, port);
+
+	p_port = &node->ports[port];
+	previous = &node->ports[port].dc_previous;
 
 	debug_dump_dc_reading(db, guid, port, p_port, reading);
 
-	epi_dc_data.time_diff_s = (reading->time - previous->time);
-	osm_epi_create_port_id(&(epi_dc_data.port_id), guid, port,
+	epi_dc_data.time_diff_s = reading->time - previous->time;
+	osm_epi_create_port_id(&epi_dc_data.port_id, guid, port,
 			       node->node_name);
 
 	/* calculate changes from previous reading */
-	epi_dc_data.xmit_data = (reading->xmit_data - previous->xmit_data);
+	epi_dc_data.xmit_data = reading->xmit_data - previous->xmit_data;
 	p_port->dc_total.xmit_data += epi_dc_data.xmit_data;
-	epi_dc_data.rcv_data = (reading->rcv_data - previous->rcv_data);
+	epi_dc_data.rcv_data = reading->rcv_data - previous->rcv_data;
 	p_port->dc_total.rcv_data += epi_dc_data.rcv_data;
-	epi_dc_data.xmit_pkts = (reading->xmit_pkts - previous->xmit_pkts);
+	epi_dc_data.xmit_pkts = reading->xmit_pkts - previous->xmit_pkts;
 	p_port->dc_total.xmit_pkts += epi_dc_data.xmit_pkts;
-	epi_dc_data.rcv_pkts = (reading->rcv_pkts - previous->rcv_pkts);
+	epi_dc_data.rcv_pkts = reading->rcv_pkts - previous->rcv_pkts;
 	p_port->dc_total.rcv_pkts += epi_dc_data.rcv_pkts;
 	epi_dc_data.unicast_xmit_pkts =
-	    (reading->unicast_xmit_pkts - previous->unicast_xmit_pkts);
+	    reading->unicast_xmit_pkts - previous->unicast_xmit_pkts;
 	p_port->dc_total.unicast_xmit_pkts += epi_dc_data.unicast_xmit_pkts;
 	epi_dc_data.unicast_rcv_pkts =
-	    (reading->unicast_rcv_pkts - previous->unicast_rcv_pkts);
+	    reading->unicast_rcv_pkts - previous->unicast_rcv_pkts;
 	p_port->dc_total.unicast_rcv_pkts += epi_dc_data.unicast_rcv_pkts;
 	epi_dc_data.multicast_xmit_pkts =
-	    (reading->multicast_xmit_pkts - previous->multicast_xmit_pkts);
+	    reading->multicast_xmit_pkts - previous->multicast_xmit_pkts;
 	p_port->dc_total.multicast_xmit_pkts += epi_dc_data.multicast_xmit_pkts;
 	epi_dc_data.multicast_rcv_pkts =
-	    (reading->multicast_rcv_pkts - previous->multicast_rcv_pkts);
+	    reading->multicast_rcv_pkts - previous->multicast_rcv_pkts;
 	p_port->dc_total.multicast_rcv_pkts += epi_dc_data.multicast_rcv_pkts;
 
 	p_port->dc_previous = *reading;
@@ -436,55 +531,55 @@ perfmgr_db_add_dc_reading(perfmgr_db_t * db, uint64_t guid,
 				OSM_EVENT_ID_PORT_DATA_COUNTERS, &epi_dc_data);
 
 Exit:
-	cl_plock_release(&(db->lock));
-	return (rc);
+	cl_plock_release(&db->lock);
+	return rc;
 }
 
 perfmgr_db_err_t perfmgr_db_get_prev_dc(perfmgr_db_t * db, uint64_t guid,
 					uint8_t port,
 					perfmgr_db_data_cnt_reading_t * reading)
 {
-	_db_node_t *node = NULL;
+	db_node_t *node = NULL;
 	perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;
 
-	cl_plock_acquire(&(db->lock));
+	cl_plock_acquire(&db->lock);
 
-	node = _get(db, guid);
+	node = get(db, guid);
 	if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS)
 		goto Exit;
 
 	*reading = node->ports[port].dc_previous;
 
 Exit:
-	cl_plock_release(&(db->lock));
-	return (rc);
+	cl_plock_release(&db->lock);
+	return rc;
 }
 
 perfmgr_db_err_t
 perfmgr_db_clear_prev_dc(perfmgr_db_t * db, uint64_t guid, uint8_t port)
 {
-	_db_node_t *node = NULL;
+	db_node_t *node = NULL;
 	perfmgr_db_data_cnt_reading_t *previous = NULL;
 	perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;
 
-	cl_plock_excl_acquire(&(db->lock));
-	node = _get(db, guid);
+	cl_plock_excl_acquire(&db->lock);
+	node = get(db, guid);
 	if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS)
 		goto Exit;
 
-	previous = &(node->ports[port].dc_previous);
+	previous = &node->ports[port].dc_previous;
 
 	memset(previous, 0, sizeof(*previous));
 	node->ports[port].dc_previous.time = time(NULL);
 
 Exit:
-	cl_plock_release(&(db->lock));
-	return (rc);
+	cl_plock_release(&db->lock);
+	return rc;
 }
 
-static void __clear_counters(cl_map_item_t * const p_map_item, void *context)
+static void clear_counters(cl_map_item_t * const p_map_item, void *context)
 {
-	_db_node_t *node = (_db_node_t *) p_map_item;
+	db_node_t *node = (db_node_t *) p_map_item;
 	int i = 0;
 	time_t ts = time(NULL);
 
@@ -522,9 +617,9 @@ static void __clear_counters(cl_map_item_t * const p_map_item, void *context)
  **********************************************************************/
 void perfmgr_db_clear_counters(perfmgr_db_t * db)
 {
-	cl_plock_excl_acquire(&(db->lock));
-	cl_qmap_apply_func(&(db->pc_data), __clear_counters, (void *)db);
-	cl_plock_release(&(db->lock));
+	cl_plock_excl_acquire(&db->lock);
+	cl_qmap_apply_func(&db->pc_data, clear_counters, (void *)db);
+	cl_plock_release(&db->lock);
 #if 0
 	if (db->db_impl->clear_counters)
 		db->db_impl->clear_counters(db->db_data);
@@ -534,11 +629,11 @@ void perfmgr_db_clear_counters(perfmgr_db_t * db)
 /**********************************************************************
  * Output a tab delimited output of the port counters
  **********************************************************************/
-static void __dump_node_mr(_db_node_t * node, FILE * fp)
+static void dump_node_mr(db_node_t * node, FILE * fp)
 {
 	int i = 0;
 
-	fprintf(fp, "\nName\tGUID\tPort\tLast Reset\t"
+	fprintf(fp, "\nName\tGUID\tActive\tPort\tLast Reset\t"
 		"%s\t%s\t"
 		"%s\t%s\t%s\t%s\t%s\t%s\t%s\t"
 		"%s\t%s\t%s\t%s\t%s\t%s\t%s\t"
@@ -561,19 +656,26 @@ static void __dump_node_mr(_db_node_t * node, FILE * fp)
 		"rcv_pkts",
 		"unicast_xmit_pkts",
 		"unicast_rcv_pkts",
-		"multicast_xmit_pkts", "multicast_rcv_pkts");
-	for (i = 1; i < node->num_ports; i++) {
-		char *since = ctime(&(node->ports[i].last_reset));
+		"multicast_xmit_pkts",
+		"multicast_rcv_pkts");
+	for (i = (node->esp0) ? 0 : 1; i < node->num_ports; i++) {
+		char *since = ctime(&node->ports[i].last_reset);
+
+		if (!node->ports[i].valid)
+			continue;
+
 		since[strlen(since) - 1] = '\0';	/* remove \n */
 
 		fprintf(fp,
-			"%s\t0x%" PRIx64 "\t%d\t%s\t%" PRIu64 "\t%" PRIu64 "\t"
+			"%s\t0x%" PRIx64 "\t%s\t%d\t%s\t%" PRIu64 "\t%" PRIu64 "\t"
 			"%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t"
 			"%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t" "%" PRIu64
 			"\t%" PRIu64 "\t%" PRIu64 "\t" "%" PRIu64 "\t%" PRIu64
 			"\t%" PRIu64 "\t%" PRIu64 "\t" "%" PRIu64 "\t%" PRIu64
 			"\t%" PRIu64 "\t%" PRIu64 "\n", node->node_name,
-			node->node_guid, i, since,
+			node->node_guid,
+			node->active ? "TRUE" : "FALSE",
+			i, since,
 			node->ports[i].err_total.symbol_err_cnt,
 			node->ports[i].err_total.link_err_recover,
 			node->ports[i].err_total.link_downed,
@@ -597,63 +699,163 @@ static void __dump_node_mr(_db_node_t * node, FILE * fp)
 	}
 }
 
+static void dump_hr_dc(FILE *fp, uint64_t val64, int data)
+{
+	char *unit = "";
+	uint64_t tmp = val64;
+	float val = 0.0;
+	int ui = 0;
+	int div = 1;
+
+	tmp /= 1024;
+	while (tmp) {
+		ui++;
+		tmp /= 1024;
+		div *= 1024;
+	}
+
+	val = (float)(val64);
+	if (data) {
+		val *= 4;
+		if (val/div > 1024) {
+			ui++;
+			div *= 1024;
+		}
+	}
+	val /= div;
+
+	switch (ui) {
+		case 1:
+			unit = "K";
+			break;
+		case 2:
+			unit = "M";
+			break;
+		case 3:
+			unit = "G";
+			break;
+		case 4:
+			unit = "T";
+			break;
+		case 5:
+			unit = "P";
+			break;
+		case 6:
+			unit = "E";
+			break;
+	}
+
+	fprintf(fp, " (%5.3f%s%s)\n", val, unit, data ? "B" : "");
+}
+
 /**********************************************************************
  * Output a human readable output of the port counters
  **********************************************************************/
-static void __dump_node_hr(_db_node_t * node, FILE * fp)
+static void dump_node_hr(db_node_t * node, FILE * fp, char *port, int err_only)
 {
-	int i = 0;
+	int i = (node->esp0) ? 0 : 1;
+	int num_ports = node->num_ports;
+
+	if (port) {
+		char *end = NULL;
+		int p = strtoul(port, &end, 0);
+		if (port + strlen(port) == end && p >= i && p < num_ports) {
+			i = p;
+			num_ports = p+1;
+		} else {
+			fprintf(fp, "Warning: \"%s\" is not a valid port\n", port);
+		}
+	}
+	for (/* set above */; i < num_ports; i++) {
+		char *since = ctime(&node->ports[i].last_reset);
 
-	fprintf(fp, "\n");
-	for (i = 1; i < node->num_ports; i++) {
-		char *since = ctime(&(node->ports[i].last_reset));
-		since[strlen(since) - 1] = '\0';	/* remove \n */
+		if (!node->ports[i].valid)
+			continue;
 
-		fprintf(fp, "\"%s\" 0x%" PRIx64 " port %d (Since %s)\n"
-			"     symbol_err_cnt       : %" PRIu64 "\n"
-			"     link_err_recover     : %" PRIu64 "\n"
-			"     link_downed          : %" PRIu64 "\n"
-			"     rcv_err              : %" PRIu64 "\n"
-			"     rcv_rem_phys_err     : %" PRIu64 "\n"
-			"     rcv_switch_relay_err : %" PRIu64 "\n"
-			"     xmit_discards        : %" PRIu64 "\n"
-			"     xmit_constraint_err  : %" PRIu64 "\n"
-			"     rcv_constraint_err   : %" PRIu64 "\n"
-			"     link_integrity_err   : %" PRIu64 "\n"
-			"     buf_overrun_err      : %" PRIu64 "\n"
-			"     vl15_dropped         : %" PRIu64 "\n"
-			"     xmit_data            : %" PRIu64 "\n"
-			"     rcv_data             : %" PRIu64 "\n"
-			"     xmit_pkts            : %" PRIu64 "\n"
-			"     rcv_pkts             : %" PRIu64 "\n"
-			"     unicast_xmit_pkts    : %" PRIu64 "\n"
-			"     unicast_rcv_pkts     : %" PRIu64 "\n"
-			"     multicast_xmit_pkts  : %" PRIu64 "\n"
-			"     multicast_rcv_pkts   : %" PRIu64 "\n",
-			node->node_name,
-			node->node_guid,
-			i,
-			since,
-			node->ports[i].err_total.symbol_err_cnt,
-			node->ports[i].err_total.link_err_recover,
-			node->ports[i].err_total.link_downed,
-			node->ports[i].err_total.rcv_err,
-			node->ports[i].err_total.rcv_rem_phys_err,
-			node->ports[i].err_total.rcv_switch_relay_err,
-			node->ports[i].err_total.xmit_discards,
-			node->ports[i].err_total.xmit_constraint_err,
-			node->ports[i].err_total.rcv_constraint_err,
-			node->ports[i].err_total.link_integrity,
-			node->ports[i].err_total.buffer_overrun,
-			node->ports[i].err_total.vl15_dropped,
-			node->ports[i].dc_total.xmit_data,
-			node->ports[i].dc_total.rcv_data,
-			node->ports[i].dc_total.xmit_pkts,
-			node->ports[i].dc_total.rcv_pkts,
-			node->ports[i].dc_total.unicast_xmit_pkts,
-			node->ports[i].dc_total.unicast_rcv_pkts,
-			node->ports[i].dc_total.multicast_xmit_pkts,
+		since[strlen(since) - 1] = '\0';	/* remove \n */
+		perfmgr_db_err_reading_t *err = &node->ports[i].err_total;
+
+		if (err_only
+		    && err->symbol_err_cnt == 0
+		    && err->link_err_recover == 0
+		    && err->link_downed == 0
+		    && err->rcv_err == 0
+		    && err->rcv_rem_phys_err == 0
+		    && err->rcv_switch_relay_err == 0
+		    && err->xmit_discards == 0
+		    && err->xmit_constraint_err == 0
+		    && err->rcv_constraint_err == 0
+		    && err->link_integrity == 0
+		    && err->buffer_overrun == 0
+		    && err->vl15_dropped == 0)
+			continue;
+
+		fprintf(fp, "\"%s\" 0x%" PRIx64 " active %s port %d (Since %s)\n",
+			node->node_name, node->node_guid,
+			node->active ? "TRUE":"FALSE", i, since);
+
+		if (!err_only || err->symbol_err_cnt != 0)
+			fprintf(fp, "     symbol_err_cnt       : %" PRIu64 "\n",
+				err->symbol_err_cnt);
+		if (!err_only || err->link_err_recover != 0)
+			fprintf(fp, "     link_err_recover     : %" PRIu64 "\n",
+				err->link_err_recover);
+		if (!err_only || err->link_downed != 0)
+			fprintf(fp, "     link_downed          : %" PRIu64 "\n",
+				err->link_downed);
+		if (!err_only || err->rcv_err != 0)
+			fprintf(fp, "     rcv_err              : %" PRIu64 "\n",
+				err->rcv_err);
+		if (!err_only || err->rcv_rem_phys_err != 0)
+			fprintf(fp, "     rcv_rem_phys_err     : %" PRIu64 "\n",
+				err->rcv_rem_phys_err);
+		if (!err_only || err->rcv_switch_relay_err != 0)
+			fprintf(fp, "     rcv_switch_relay_err : %" PRIu64 "\n",
+				err->rcv_switch_relay_err);
+		if (!err_only || err->xmit_discards != 0)
+			fprintf(fp, "     xmit_discards        : %" PRIu64 "\n",
+				err->xmit_discards);
+		if (!err_only || err->xmit_constraint_err != 0)
+			fprintf(fp, "     xmit_constraint_err  : %" PRIu64 "\n",
+				err->xmit_constraint_err);
+		if (!err_only || err->rcv_constraint_err != 0)
+			fprintf(fp, "     rcv_constraint_err   : %" PRIu64 "\n",
+				err->rcv_constraint_err);
+		if (!err_only || err->link_integrity != 0)
+			fprintf(fp, "     link_integrity_err   : %" PRIu64 "\n",
+				err->link_integrity);
+		if (!err_only || err->buffer_overrun != 0)
+			fprintf(fp, "     buf_overrun_err      : %" PRIu64 "\n",
+				err->buffer_overrun);
+		if (!err_only || err->vl15_dropped != 0)
+			fprintf(fp, "     vl15_dropped         : %" PRIu64 "\n",
+				err->vl15_dropped);
+
+		fprintf(fp, "     xmit_data            : %" PRIu64,
+			node->ports[i].dc_total.xmit_data);
+		dump_hr_dc(fp, node->ports[i].dc_total.xmit_data, 1);
+		fprintf(fp, "     rcv_data             : %" PRIu64,
+			node->ports[i].dc_total.rcv_data);
+		dump_hr_dc(fp, node->ports[i].dc_total.rcv_data, 1);
+		fprintf(fp, "     xmit_pkts            : %" PRIu64,
+			node->ports[i].dc_total.xmit_pkts);
+		dump_hr_dc(fp, node->ports[i].dc_total.xmit_pkts, 0);
+		fprintf(fp, "     rcv_pkts             : %" PRIu64,
+			node->ports[i].dc_total.rcv_pkts);
+		dump_hr_dc(fp, node->ports[i].dc_total.rcv_pkts, 0);
+		fprintf(fp, "     unicast_xmit_pkts    : %" PRIu64,
+			node->ports[i].dc_total.unicast_xmit_pkts);
+		dump_hr_dc(fp, node->ports[i].dc_total.unicast_xmit_pkts, 0);
+		fprintf(fp, "     unicast_rcv_pkts     : %" PRIu64,
+			node->ports[i].dc_total.unicast_rcv_pkts);
+		dump_hr_dc(fp, node->ports[i].dc_total.unicast_rcv_pkts, 0);
+		fprintf(fp, "     multicast_xmit_pkts  : %" PRIu64,
+			node->ports[i].dc_total.multicast_xmit_pkts);
+		dump_hr_dc(fp, node->ports[i].dc_total.multicast_xmit_pkts, 0);
+		fprintf(fp, "     multicast_rcv_pkts   : %" PRIu64,
 			node->ports[i].dc_total.multicast_rcv_pkts);
+		dump_hr_dc(fp, node->ports[i].dc_total.multicast_rcv_pkts, 0);
+
 	}
 }
 
@@ -663,42 +865,60 @@ typedef struct {
 	perfmgr_db_dump_t dump_type;
 } dump_context_t;
 
-/**********************************************************************
- **********************************************************************/
-static void __db_dump(cl_map_item_t * const p_map_item, void *context)
+static void db_dump(cl_map_item_t * const p_map_item, void *context)
 {
-	_db_node_t *node = (_db_node_t *) p_map_item;
+	db_node_t *node = (db_node_t *) p_map_item;
 	dump_context_t *c = (dump_context_t *) context;
 	FILE *fp = c->fp;
 
 	switch (c->dump_type) {
 	case PERFMGR_EVENT_DB_DUMP_MR:
-		__dump_node_mr(node, fp);
+		dump_node_mr(node, fp);
 		break;
 	case PERFMGR_EVENT_DB_DUMP_HR:
 	default:
-		__dump_node_hr(node, fp);
+		dump_node_hr(node, fp, NULL, 0);
 		break;
 	}
 }
 
 /**********************************************************************
+ * print all node data to fp
+ **********************************************************************/
+void
+perfmgr_db_print_all(perfmgr_db_t * db, FILE *fp, int err_only)
+{
+	cl_map_item_t *item;
+	db_node_t *node;
+
+	cl_plock_acquire(&db->lock);
+	item = cl_qmap_head(&db->pc_data);
+	while (item != cl_qmap_end(&db->pc_data)) {
+		node = (db_node_t *)item;
+		dump_node_hr(node, fp, NULL, err_only);
+		item = cl_qmap_next(item);
+	}
+	cl_plock_release(&db->lock);
+}
+
+/**********************************************************************
  * print node data to fp
  **********************************************************************/
 void
-perfmgr_db_print_by_name(perfmgr_db_t * db, char *nodename, FILE *fp)
+perfmgr_db_print_by_name(perfmgr_db_t * db, char *nodename, FILE *fp,
+			 char *port, int err_only)
 {
-	cl_map_item_t *item = NULL;
-	_db_node_t *node = NULL;
+	cl_map_item_t *item;
+	db_node_t *node;
 
-	cl_plock_acquire(&(db->lock));
+	cl_plock_acquire(&db->lock);
 
 	/* find the node */
-	item = cl_qmap_head(&(db->pc_data));
-	while (item != cl_qmap_end(&(db->pc_data))) {
-		node = (_db_node_t *)item;
+	item = cl_qmap_head(&db->pc_data);
+	while (item != cl_qmap_end(&db->pc_data)) {
+		node = (db_node_t *)item;
 		if (strcmp(node->node_name, nodename) == 0) {
-			__dump_node_hr(node, fp);
+			dump_node_hr(node, fp, port, err_only);
 			goto done;
 		}
 		item = cl_qmap_next(item);
@@ -706,26 +926,27 @@ perfmgr_db_print_by_name(perfmgr_db_t * db, char *nodename, FILE *fp)
 
 	fprintf(fp, "Node %s not found...\n", nodename);
 done:
-	cl_plock_release(&(db->lock));
+	cl_plock_release(&db->lock);
 }
 
 /**********************************************************************
  * print node data to fp
  **********************************************************************/
 void
-perfmgr_db_print_by_guid(perfmgr_db_t * db, uint64_t nodeguid, FILE *fp)
+perfmgr_db_print_by_guid(perfmgr_db_t * db, uint64_t nodeguid, FILE *fp,
+			 char *port, int err_only)
 {
-	cl_map_item_t *node = NULL;
+	cl_map_item_t *node;
 
-	cl_plock_acquire(&(db->lock));
+	cl_plock_acquire(&db->lock);
 
-	node = cl_qmap_get(&(db->pc_data), nodeguid);
-	if (node != cl_qmap_end(&(db->pc_data)))
-		__dump_node_hr((_db_node_t *)node, fp);
+	node = cl_qmap_get(&db->pc_data, nodeguid);
+	if (node != cl_qmap_end(&db->pc_data))
+		dump_node_hr((db_node_t *)node, fp, port, err_only);
 	else
-		fprintf(fp, "Node %"PRIx64" not found...\n", nodeguid);
+		fprintf(fp, "Node 0x%" PRIx64 " not found...\n", nodeguid);
 
-	cl_plock_release(&(db->lock));
+	cl_plock_release(&db->lock);
 }
 
 /**********************************************************************
@@ -738,14 +959,14 @@ perfmgr_db_dump(perfmgr_db_t * db, char *file, perfmgr_db_dump_t dump_type)
 
 	context.fp = fopen(file, "w+");
 	if (!context.fp)
-		return (PERFMGR_EVENT_DB_FAIL);
+		return PERFMGR_EVENT_DB_FAIL;
 	context.dump_type = dump_type;
 
-	cl_plock_acquire(&(db->lock));
-	cl_qmap_apply_func(&(db->pc_data), __db_dump, (void *)&context);
-	cl_plock_release(&(db->lock));
+	cl_plock_acquire(&db->lock);
+	cl_qmap_apply_func(&db->pc_data, db_dump, (void *)&context);
+	cl_plock_release(&db->lock);
 	fclose(context.fp);
-	return (PERFMGR_EVENT_DB_SUCCESS);
+	return PERFMGR_EVENT_DB_SUCCESS;
 }
 
 /**********************************************************************
@@ -756,15 +977,14 @@ perfmgr_db_fill_err_read(ib_port_counters_t * wire_read,
 			 perfmgr_db_err_reading_t * reading)
 {
 	reading->symbol_err_cnt = cl_ntoh16(wire_read->symbol_err_cnt);
-	reading->link_err_recover = cl_ntoh16(wire_read->link_err_recover);
+	reading->link_err_recover = wire_read->link_err_recover;
 	reading->link_downed = wire_read->link_downed;
-	reading->rcv_err = wire_read->rcv_err;
+	reading->rcv_err = cl_ntoh16(wire_read->rcv_err);
 	reading->rcv_rem_phys_err = cl_ntoh16(wire_read->rcv_rem_phys_err);
 	reading->rcv_switch_relay_err =
 	    cl_ntoh16(wire_read->rcv_switch_relay_err);
 	reading->xmit_discards = cl_ntoh16(wire_read->xmit_discards);
-	reading->xmit_constraint_err =
-	    cl_ntoh16(wire_read->xmit_constraint_err);
+	reading->xmit_constraint_err = wire_read->xmit_constraint_err;
 	reading->rcv_constraint_err = wire_read->rcv_constraint_err;
 	reading->link_integrity =
 	    PC_LINK_INT(wire_read->link_int_buffer_overrun);
diff --git a/opensm/osm_pkey.c b/opensm/osm_pkey.c
index e09faa8..1ae9f4e 100644
--- a/opensm/osm_pkey.c
+++ b/opensm/osm_pkey.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -47,6 +47,8 @@
 #include <string.h>
 #include <complib/cl_debug.h>
 #include <iba/ib_types.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_PKEY_C
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_port.h>
@@ -54,17 +56,14 @@
 #include <opensm/osm_switch.h>
 #include <opensm/osm_helper.h>
 
-/**********************************************************************
- **********************************************************************/
 void osm_pkey_tbl_construct(IN osm_pkey_tbl_t * p_pkey_tbl)
 {
+	cl_ptr_vector_construct(&p_pkey_tbl->accum_pkeys);
 	cl_ptr_vector_construct(&p_pkey_tbl->blocks);
 	cl_ptr_vector_construct(&p_pkey_tbl->new_blocks);
 	cl_map_construct(&p_pkey_tbl->keys);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_pkey_tbl_destroy(IN osm_pkey_tbl_t * p_pkey_tbl)
 {
 	ib_pkey_table_t *p_block;
@@ -83,25 +82,25 @@ void osm_pkey_tbl_destroy(IN osm_pkey_tbl_t * p_pkey_tbl)
 			free(p_block);
 	cl_ptr_vector_destroy(&p_pkey_tbl->new_blocks);
 
+	cl_ptr_vector_destroy(&p_pkey_tbl->accum_pkeys);
+
 	cl_map_remove_all(&p_pkey_tbl->keys);
 	cl_map_destroy(&p_pkey_tbl->keys);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t osm_pkey_tbl_init(IN osm_pkey_tbl_t * p_pkey_tbl)
 {
+	cl_ptr_vector_init(&p_pkey_tbl->accum_pkeys, 0, 1);
 	cl_ptr_vector_init(&p_pkey_tbl->blocks, 0, 1);
 	cl_ptr_vector_init(&p_pkey_tbl->new_blocks, 0, 1);
 	cl_map_init(&p_pkey_tbl->keys, 1);
 	cl_qlist_init(&p_pkey_tbl->pending);
+	p_pkey_tbl->last_pkey_idx = 0;
 	p_pkey_tbl->used_blocks = 0;
 	p_pkey_tbl->max_blocks = 0;
-	return (IB_SUCCESS);
+	return IB_SUCCESS;
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_pkey_tbl_init_new_blocks(IN const osm_pkey_tbl_t * p_pkey_tbl)
 {
 	ib_pkey_table_t *p_block;
@@ -112,28 +111,14 @@ void osm_pkey_tbl_init_new_blocks(IN const osm_pkey_tbl_t * p_pkey_tbl)
 			memset(p_block, 0, sizeof(*p_block));
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_pkey_tbl_cleanup_pending(IN osm_pkey_tbl_t * p_pkey_tbl)
-{
-	cl_list_item_t *p_item;
-
-	p_item = cl_qlist_remove_head(&p_pkey_tbl->pending);
-	while (p_item != cl_qlist_end(&p_pkey_tbl->pending)) {
-		free((osm_pending_pkey_t *) p_item);
-	}
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl,
-		 IN uint16_t block, IN ib_pkey_table_t * p_tbl)
+ib_api_status_t osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl,
+				 IN uint16_t block, IN ib_pkey_table_t * p_tbl,
+				 IN boolean_t allow_both_pkeys)
 {
 	uint16_t b, i;
 	ib_pkey_table_t *p_pkey_block;
 	uint16_t *p_prev_pkey;
-	ib_net16_t pkey;
+	ib_net16_t pkey, pkey_base;
 
 	/* make sure the block is allocated */
 	if (cl_ptr_vector_get_size(&p_pkey_tbl->blocks) > block)
@@ -147,7 +132,7 @@ osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl,
 		p_pkey_block =
 		    (ib_pkey_table_t *) malloc(sizeof(ib_pkey_table_t));
 		if (!p_pkey_block)
-			return (IB_ERROR);
+			return IB_ERROR;
 		memset(p_pkey_block, 0, sizeof(ib_pkey_table_t));
 		cl_ptr_vector_set(&p_pkey_tbl->blocks, block, p_pkey_block);
 	}
@@ -160,7 +145,7 @@ osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl,
 	   tables there is no other way but to refresh the entire keys map.
 
 	   Moreover, if the same key exists but with full membership it should
-	   have precedence on the key with limited membership !
+	   have precedence over the key with limited membership !
 	 */
 	cl_map_remove_all(&p_pkey_tbl->keys);
 
@@ -175,43 +160,95 @@ osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl,
 			if (ib_pkey_is_invalid(pkey))
 				continue;
 
+			if (allow_both_pkeys)
+				pkey_base = pkey;
+			else
+				pkey_base = ib_pkey_get_base(pkey);
+
 			/*
+			   If allow_both_pkeys is FALSE,
 			   ignore the PKey Full Member bit in the key but store
 			   the pointer to the table element as the map value
 			 */
-			p_prev_pkey =
-			    cl_map_get(&p_pkey_tbl->keys,
-				       ib_pkey_get_base(pkey));
+			p_prev_pkey = cl_map_get(&p_pkey_tbl->keys, pkey_base);
 
-			/* we only insert if no previous or it is not full member */
+			/* we only insert if no previous or it is not full member and allow_both_pkeys is FALSE */
 			if ((p_prev_pkey == NULL) ||
-			    (cl_ntoh16(*p_prev_pkey) < cl_ntoh16(pkey)))
-				cl_map_insert(&p_pkey_tbl->keys,
-					      ib_pkey_get_base(pkey),
+			    (allow_both_pkeys == FALSE &&
+			     cl_ntoh16(*p_prev_pkey) < cl_ntoh16(pkey)))
+				cl_map_insert(&p_pkey_tbl->keys, pkey_base,
 					      &(p_pkey_block->pkey_entry[i])
 				    );
 		}
 	}
-	return (IB_SUCCESS);
+	return IB_SUCCESS;
+}
+
+/*
+  Store the given pkey (along with it's overall index) in the accum_pkeys array.
+*/
+cl_status_t osm_pkey_tbl_set_accum_pkeys(IN osm_pkey_tbl_t * p_pkey_tbl,
+					 IN uint16_t pkey,
+					 IN uint16_t pkey_idx)
+{
+	uintptr_t ptr = pkey_idx + 1; /* 0 means not found so bias by 1 */
+
+	if (pkey_idx >= p_pkey_tbl->last_pkey_idx)
+		p_pkey_tbl->last_pkey_idx = pkey_idx + 1;
+
+	return cl_ptr_vector_set(&p_pkey_tbl->accum_pkeys, pkey, (void *)ptr);
+}
+
+/*
+  Clears the given pkey (along with it's overall index) in the accum_pkeys array.
+*/
+void osm_pkey_tbl_clear_accum_pkeys(IN osm_pkey_tbl_t * p_pkey_tbl,
+				    IN uint16_t pkey)
+{
+	void *ptr;
+	uintptr_t pkey_idx_ptr;
+	uint16_t pkey_idx, last_pkey_idx;
+	uint32_t i;
+
+	ptr = cl_ptr_vector_get(&p_pkey_tbl->accum_pkeys, pkey);
+	if (ptr == NULL)
+		return;
+
+	cl_ptr_vector_set(&p_pkey_tbl->accum_pkeys, pkey, NULL);
+
+	pkey_idx_ptr = (uintptr_t) ptr;
+	pkey_idx = pkey_idx_ptr;
+
+	if (p_pkey_tbl->last_pkey_idx == pkey_idx) {
+		last_pkey_idx = 0;
+		for (i = 1; i < cl_ptr_vector_get_size(&p_pkey_tbl->accum_pkeys); i++) {
+			ptr = cl_ptr_vector_get(&p_pkey_tbl->accum_pkeys, i);
+			if (ptr != NULL) {
+				pkey_idx_ptr = (uintptr_t) ptr;
+				pkey_idx = pkey_idx_ptr;
+				if (pkey_idx > last_pkey_idx)
+					last_pkey_idx = pkey_idx;
+			}
+		}
+		p_pkey_tbl->last_pkey_idx = last_pkey_idx;
+	}
 }
 
-/**********************************************************************
- **********************************************************************/
 /*
   Store the given pkey in the "new" blocks array.
   Also, make sure the regular block exists.
 */
-ib_api_status_t
-osm_pkey_tbl_set_new_entry(IN osm_pkey_tbl_t * p_pkey_tbl,
-			   IN uint16_t block_idx,
-			   IN uint8_t pkey_idx, IN uint16_t pkey)
+ib_api_status_t osm_pkey_tbl_set_new_entry(IN osm_pkey_tbl_t * p_pkey_tbl,
+					   IN uint16_t block_idx,
+					   IN uint8_t pkey_idx,
+					   IN uint16_t pkey)
 {
 	ib_pkey_table_t *p_block;
 
 	if (!(p_block = osm_pkey_tbl_new_block_get(p_pkey_tbl, block_idx))) {
 		p_block = (ib_pkey_table_t *) malloc(sizeof(ib_pkey_table_t));
 		if (!p_block)
-			return (IB_ERROR);
+			return IB_ERROR;
 		memset(p_block, 0, sizeof(ib_pkey_table_t));
 		cl_ptr_vector_set(&p_pkey_tbl->new_blocks, block_idx, p_block);
 	}
@@ -220,15 +257,12 @@ osm_pkey_tbl_set_new_entry(IN osm_pkey_tbl_t * p_pkey_tbl,
 	if (p_pkey_tbl->used_blocks <= block_idx)
 		p_pkey_tbl->used_blocks = block_idx + 1;
 
-	return (IB_SUCCESS);
+	return IB_SUCCESS;
 }
 
-/**********************************************************************
- **********************************************************************/
-boolean_t
-osm_pkey_find_next_free_entry(IN osm_pkey_tbl_t * p_pkey_tbl,
-			      OUT uint16_t * p_block_idx,
-			      OUT uint8_t * p_pkey_idx)
+boolean_t osm_pkey_find_next_free_entry(IN osm_pkey_tbl_t * p_pkey_tbl,
+					OUT uint16_t * p_block_idx,
+					OUT uint8_t * p_pkey_idx)
 {
 	ib_pkey_table_t *p_new_block;
 
@@ -255,13 +289,10 @@ osm_pkey_find_next_free_entry(IN osm_pkey_tbl_t * p_pkey_tbl,
 	return FALSE;
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_pkey_tbl_get_block_and_idx(IN osm_pkey_tbl_t * p_pkey_tbl,
-			       IN uint16_t * p_pkey,
-			       OUT uint16_t * p_block_idx,
-			       OUT uint8_t * p_pkey_idx)
+ib_api_status_t osm_pkey_tbl_get_block_and_idx(IN osm_pkey_tbl_t * p_pkey_tbl,
+					       IN uint16_t * p_pkey,
+					       OUT uint16_t * p_block_idx,
+					       OUT uint8_t * p_pkey_idx)
 {
 	uint16_t num_of_blocks;
 	uint16_t block_index;
@@ -278,60 +309,76 @@ osm_pkey_tbl_get_block_and_idx(IN osm_pkey_tbl_t * p_pkey_tbl,
 		     block->pkey_entry + IB_NUM_PKEY_ELEMENTS_IN_BLOCK)) {
 			*p_block_idx = block_index;
 			*p_pkey_idx = (uint8_t) (p_pkey - block->pkey_entry);
-			return (IB_SUCCESS);
+			return IB_SUCCESS;
 		}
 	}
-	return (IB_NOT_FOUND);
+	return IB_NOT_FOUND;
 }
 
-/**********************************************************************
- **********************************************************************/
-static boolean_t
-__osm_match_pkey(IN const ib_net16_t * pkey1, IN const ib_net16_t * pkey2)
+static boolean_t match_pkey(IN const ib_net16_t * pkey1,
+			    IN const ib_net16_t * pkey2)
 {
 
 	/* if both pkeys are not full member - this is not a match */
 	if (!(ib_pkey_is_full_member(*pkey1) || ib_pkey_is_full_member(*pkey2)))
-		return (FALSE);
+		return FALSE;
 
 	/* compare if the bases are the same. if they are - then
 	   this is a match */
 	if (ib_pkey_get_base(*pkey1) != ib_pkey_get_base(*pkey2))
-		return (FALSE);
+		return FALSE;
 
-	return (TRUE);
+	return TRUE;
 }
 
-/**********************************************************************
- **********************************************************************/
-boolean_t
-osm_physp_share_this_pkey(IN const osm_physp_t * const p_physp1,
-			  IN const osm_physp_t * const p_physp2,
-			  IN const ib_net16_t pkey)
+boolean_t osm_physp_share_this_pkey(IN const osm_physp_t * p_physp1,
+				    IN const osm_physp_t * p_physp2,
+				    IN ib_net16_t pkey,
+				    IN boolean_t allow_both_pkeys)
 {
 	ib_net16_t *pkey1, *pkey2;
-
-	pkey1 = cl_map_get(&(osm_physp_get_pkey_tbl(p_physp1))->keys,
-			   ib_pkey_get_base(pkey));
-	pkey2 = cl_map_get(&(osm_physp_get_pkey_tbl(p_physp2))->keys,
-			   ib_pkey_get_base(pkey));
-	return (pkey1 && pkey2 && __osm_match_pkey(pkey1, pkey2));
+	ib_net16_t full_pkey, limited_pkey;
+
+	if (allow_both_pkeys) {
+		full_pkey = pkey | IB_PKEY_TYPE_MASK;
+		limited_pkey = pkey & ~IB_PKEY_TYPE_MASK;
+		pkey1 = cl_map_get(&(osm_physp_get_pkey_tbl(p_physp1))->keys,
+				   full_pkey);
+		if (!pkey1)
+			pkey1 = cl_map_get(&(osm_physp_get_pkey_tbl(p_physp1))->keys,
+					   limited_pkey);
+		pkey2 = cl_map_get(&(osm_physp_get_pkey_tbl(p_physp2))->keys,
+				   full_pkey);
+		if (!pkey2)
+			pkey2 = cl_map_get(&(osm_physp_get_pkey_tbl(p_physp2))->keys,
+					   limited_pkey);
+	} else {
+		pkey1 = cl_map_get(&(osm_physp_get_pkey_tbl(p_physp1))->keys,
+				   ib_pkey_get_base(pkey));
+		pkey2 = cl_map_get(&(osm_physp_get_pkey_tbl(p_physp2))->keys,
+				   ib_pkey_get_base(pkey));
+	}
+	return (pkey1 && pkey2 && match_pkey(pkey1, pkey2));
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_net16_t
-osm_physp_find_common_pkey(IN const osm_physp_t * const p_physp1,
-			   IN const osm_physp_t * const p_physp2)
+ib_net16_t osm_physp_find_common_pkey(IN const osm_physp_t * p_physp1,
+				      IN const osm_physp_t * p_physp2,
+				      IN boolean_t allow_both_pkeys)
 {
 	ib_net16_t *pkey1, *pkey2;
 	uint64_t pkey1_base, pkey2_base;
 	const osm_pkey_tbl_t *pkey_tbl1, *pkey_tbl2;
 	cl_map_iterator_t map_iter1, map_iter2;
+	ib_net16_t key;
+	const osm_pkey_tbl_t *pkey_tbl;
+	cl_map_iterator_t map_iter, map_end;
 
 	pkey_tbl1 = osm_physp_get_pkey_tbl(p_physp1);
 	pkey_tbl2 = osm_physp_get_pkey_tbl(p_physp2);
 
+	if (allow_both_pkeys)
+		goto SearchByKeys;
+
 	map_iter1 = cl_map_head(&pkey_tbl1->keys);
 	map_iter2 = cl_map_head(&pkey_tbl2->keys);
 
@@ -341,7 +388,7 @@ osm_physp_find_common_pkey(IN const osm_physp_t * const p_physp1,
 		pkey1 = (ib_net16_t *) cl_map_obj(map_iter1);
 		pkey2 = (ib_net16_t *) cl_map_obj(map_iter2);
 
-		if (__osm_match_pkey(pkey1, pkey2))
+		if (match_pkey(pkey1, pkey2))
 			return *pkey1;
 
 		/* advance the lower value if they are not equal */
@@ -357,14 +404,42 @@ osm_physp_find_common_pkey(IN const osm_physp_t * const p_physp1,
 	}
 
 	return 0;
+
+SearchByKeys:
+
+	/* Select to iterate over the table with the least elements */
+	if (cl_map_count(&pkey_tbl1->keys) < cl_map_count(&pkey_tbl2->keys)) {
+		map_iter = cl_map_head(&pkey_tbl1->keys);
+		map_end = cl_map_end(&pkey_tbl1->keys);
+		pkey_tbl = pkey_tbl2;
+	} else {
+		map_iter = cl_map_head(&pkey_tbl2->keys);
+		map_end = cl_map_end(&pkey_tbl2->keys);
+		pkey_tbl =  pkey_tbl1;
+	}
+
+	while (map_iter != map_end) {
+		pkey1 = (ib_net16_t *) cl_map_obj(map_iter);
+		key = cl_map_key(map_iter);
+
+		pkey2 = cl_map_get(&pkey_tbl->keys, key | IB_PKEY_TYPE_MASK);
+		if (!pkey2)
+			pkey2 = cl_map_get(&pkey_tbl->keys,
+					key & ~IB_PKEY_TYPE_MASK);
+
+		if (pkey2 && match_pkey(pkey1, pkey2))
+			return (pkey_tbl == pkey_tbl2 ? *pkey1 : *pkey2);
+
+		map_iter = cl_map_next(map_iter);
+	}
+
+	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
-boolean_t
-osm_physp_share_pkey(IN osm_log_t * p_log,
-		     IN const osm_physp_t * const p_physp_1,
-		     IN const osm_physp_t * const p_physp_2)
+boolean_t osm_physp_share_pkey(IN osm_log_t * p_log,
+			       IN const osm_physp_t * p_physp_1,
+			       IN const osm_physp_t * p_physp_2,
+			       IN boolean_t allow_both_pkeys)
 {
 	const osm_pkey_tbl_t *pkey_tbl1, *pkey_tbl2;
 
@@ -386,15 +461,13 @@ osm_physp_share_pkey(IN osm_log_t * p_log,
 
 	return
 	    !ib_pkey_is_invalid(osm_physp_find_common_pkey
-				(p_physp_1, p_physp_2));
+				(p_physp_1, p_physp_2, allow_both_pkeys));
 }
 
-/**********************************************************************
- **********************************************************************/
-boolean_t
-osm_port_share_pkey(IN osm_log_t * p_log,
-		    IN const osm_port_t * const p_port_1,
-		    IN const osm_port_t * const p_port_2)
+boolean_t osm_port_share_pkey(IN osm_log_t * p_log,
+			      IN const osm_port_t * p_port_1,
+			      IN const osm_port_t * p_port_2,
+			      IN boolean_t allow_both_pkeys)
 {
 
 	osm_physp_t *p_physp1, *p_physp2;
@@ -415,59 +488,16 @@ osm_port_share_pkey(IN osm_log_t * p_log,
 		goto Exit;
 	}
 
-	ret = osm_physp_share_pkey(p_log, p_physp1, p_physp2);
+	ret = osm_physp_share_pkey(p_log, p_physp1, p_physp2, allow_both_pkeys);
 
 Exit:
 	OSM_LOG_EXIT(p_log);
 	return ret;
 }
 
-/**********************************************************************
- **********************************************************************/
-boolean_t
-osm_lid_share_pkey(IN osm_log_t * p_log,
-		   IN const osm_subn_t * const p_subn,
-		   IN const ib_net16_t lid1,
-		   IN const uint8_t port_num1,
-		   IN const ib_net16_t lid2, IN const uint8_t port_num2)
-{
-
-	osm_physp_t *p_physp1, *p_physp2;
-	osm_port_t *p_port1, *p_port2;
-	osm_node_t *p_node1, *p_node2;
-	const cl_ptr_vector_t *const p_port_lid_tbl = &(p_subn->port_lid_tbl);
-
-	OSM_LOG_ENTER(p_log);
-
-	p_port1 = cl_ptr_vector_get(p_port_lid_tbl, lid1);
-	p_port2 = cl_ptr_vector_get(p_port_lid_tbl, lid2);
-
-	p_node1 = p_port1->p_node;
-	p_node2 = p_port2->p_node;
-
-	if (osm_node_get_type(p_node1) == IB_NODE_TYPE_SWITCH) {
-		p_physp1 = osm_node_get_physp_ptr(p_node1, port_num1);
-	} else {
-		p_physp1 = p_port1->p_physp;
-	}
-
-	if (osm_node_get_type(p_node2) == IB_NODE_TYPE_SWITCH) {
-		p_physp2 = osm_node_get_physp_ptr(p_node2, port_num2);
-	} else {
-		p_physp2 = p_port2->p_physp;
-	}
-
-	return (osm_physp_share_pkey(p_log, p_physp1, p_physp2));
-}
-
-/**********************************************************************
- **********************************************************************/
-boolean_t
-osm_physp_has_pkey(IN osm_log_t * p_log,
-		   IN const ib_net16_t pkey,
-		   IN const osm_physp_t * const p_physp)
+boolean_t osm_physp_has_pkey(IN osm_log_t * p_log, IN ib_net16_t pkey,
+			     IN const osm_physp_t * p_physp)
 {
-
 	ib_net16_t *p_pkey, pkey_base;
 	const osm_pkey_tbl_t *pkey_tbl;
 	boolean_t res = FALSE;
@@ -494,10 +524,9 @@ osm_physp_has_pkey(IN osm_log_t * p_log,
 		res = TRUE;
 		OSM_LOG(p_log, OSM_LOG_DEBUG,
 			"PKey 0x%04x was found\n", cl_ntoh16(pkey));
-	} else {
+	} else
 		OSM_LOG(p_log, OSM_LOG_DEBUG,
 			"PKey 0x%04x was not found\n", cl_ntoh16(pkey));
-	}
 
 Exit:
 	OSM_LOG_EXIT(p_log);
diff --git a/opensm/osm_pkey_mgr.c b/opensm/osm_pkey_mgr.c
index 9df8c85..7a1f31c 100644
--- a/opensm/osm_pkey_mgr.c
+++ b/opensm/osm_pkey_mgr.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -35,7 +36,7 @@
 
 /*
  * Abstract:
- * Implementation of the P_Key Manager (Partititon Manager).
+ * Implementation of the P_Key Manager (Partition Manager).
  * This is part of the OpenSM.
  */
 
@@ -47,22 +48,20 @@
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_PKEY_MGR_C
 #include <opensm/osm_node.h>
 #include <opensm/osm_switch.h>
-#include <opensm/osm_pkey_mgr.h>
 #include <opensm/osm_partition.h>
 #include <opensm/osm_opensm.h>
 
-/**********************************************************************
- **********************************************************************/
 /*
-  The max number of pkey blocks for a physical port is located in
-  a different place for switch external ports (SwitchInfo) and the
+  The max number of pkeys/pkey blocks for a physical port is located
+  in a different place for switch external ports (SwitchInfo) and the
   rest of the ports (NodeInfo).
 */
 static uint16_t
-pkey_mgr_get_physp_max_blocks(IN const osm_subn_t * p_subn,
-			      IN const osm_physp_t * p_physp)
+pkey_mgr_get_physp_max_pkeys(IN const osm_physp_t * p_physp)
 {
 	osm_node_t *p_node = osm_physp_get_node_ptr(p_physp);
 	uint16_t num_pkeys = 0;
@@ -71,11 +70,15 @@ pkey_mgr_get_physp_max_blocks(IN const osm_subn_t * p_subn,
 		num_pkeys = cl_ntoh16(p_node->node_info.partition_cap);
 	else
 		num_pkeys = cl_ntoh16(p_node->sw->switch_info.enforce_cap);
-	return ((num_pkeys + 31) / 32);
+	return num_pkeys;
+}
+
+static uint16_t
+pkey_mgr_get_physp_max_blocks(IN const osm_physp_t * p_physp)
+{
+	return ((pkey_mgr_get_physp_max_pkeys(p_physp) + 31) / 32);
 }
 
-/**********************************************************************
- **********************************************************************/
 /*
  * Insert new pending pkey entry to the specific port pkey table
  * pending pkeys. New entries are inserted at the back.
@@ -103,7 +106,11 @@ pkey_mgr_process_physical_port(IN osm_log_t * p_log,
 		return;
 	}
 	p_pending->pkey = pkey;
-	p_orig_pkey = cl_map_get(&p_pkey_tbl->keys, ib_pkey_get_base(pkey));
+	if (sm->p_subn->opt.allow_both_pkeys)
+		p_orig_pkey = cl_map_get(&p_pkey_tbl->keys, pkey);
+	else
+		p_orig_pkey = cl_map_get(&p_pkey_tbl->keys,
+					 ib_pkey_get_base(pkey));
 	if (!p_orig_pkey) {
 		p_pending->is_new = TRUE;
 		cl_qlist_insert_tail(&p_pkey_tbl->pending,
@@ -118,11 +125,12 @@ pkey_mgr_process_physical_port(IN osm_log_t * p_log,
 						   &p_pending->index) !=
 		    IB_SUCCESS) {
 			OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0503: "
-				"Failed to obtain P_Key 0x%04x block and index for node "
-				"0x%016" PRIx64 " port %u\n",
-				ib_pkey_get_base(pkey),
+				"Failed to obtain P_Key 0x%04x block and index "
+				"for node 0x%016" PRIx64 " port %u\n",
+				cl_ntoh16(ib_pkey_get_base(pkey)),
 				cl_ntoh64(osm_node_get_node_guid(p_node)),
 				osm_physp_get_port_num(p_physp));
+			free(p_pending);
 			return;
 		}
 		cl_qlist_insert_head(&p_pkey_tbl->pending,
@@ -137,8 +145,6 @@ pkey_mgr_process_physical_port(IN osm_log_t * p_log,
 		osm_physp_get_port_num(p_physp));
 }
 
-/**********************************************************************
- **********************************************************************/
 static void
 pkey_mgr_process_partition_table(osm_log_t * p_log, osm_sm_t * sm,
 				 const osm_prtn_t * p_prtn,
@@ -164,8 +170,6 @@ pkey_mgr_process_partition_table(osm_log_t * p_log, osm_sm_t * sm,
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 pkey_mgr_update_pkey_entry(IN osm_sm_t * sm,
 			   IN const osm_physp_t * p_physp,
@@ -188,37 +192,45 @@ pkey_mgr_update_pkey_entry(IN osm_sm_t * sm,
 			   cl_hton32(attr_mod), CL_DISP_MSGID_NONE, &context);
 }
 
-/**********************************************************************
- **********************************************************************/
-static boolean_t
+static ib_api_status_t
 pkey_mgr_enforce_partition(IN osm_log_t * p_log, osm_sm_t * sm,
-			   IN osm_physp_t * p_physp, IN const boolean_t enforce)
+			   IN osm_physp_t * p_physp,
+			   IN osm_partition_enforce_type_enum enforce_type)
 {
 	osm_madw_context_t context;
 	uint8_t payload[IB_SMP_DATA_SIZE];
 	ib_port_info_t *p_pi;
 	ib_api_status_t status;
+	uint8_t enforce_bits;
 
 	p_pi = &p_physp->port_info;
 
-	if ((p_pi->vl_enforce & 0xc) == (0xc) * (enforce == TRUE)) {
+	if (enforce_type == OSM_PARTITION_ENFORCE_TYPE_BOTH)
+		enforce_bits = 0xc;
+	else if (enforce_type == OSM_PARTITION_ENFORCE_TYPE_IN)
+		enforce_bits = 0x8;
+	else
+		enforce_bits = 0x4;
+
+	if ((p_pi->vl_enforce & 0xc) == enforce_bits *
+	    (enforce_type != OSM_PARTITION_ENFORCE_TYPE_OFF)) {
 		OSM_LOG(p_log, OSM_LOG_DEBUG,
 			"No need to update PortInfo for "
-			"node 0x%016" PRIx64 " port %u\n",
+			"node 0x%016" PRIx64 " port %u (%s)\n",
 			cl_ntoh64(osm_node_get_node_guid
 				  (osm_physp_get_node_ptr(p_physp))),
-			osm_physp_get_port_num(p_physp));
-		return FALSE;
+			osm_physp_get_port_num(p_physp),
+			p_physp->p_node->print_desc);
+		return IB_SUCCESS;
 	}
 
-	memset(payload, 0, IB_SMP_DATA_SIZE);
 	memcpy(payload, p_pi, sizeof(ib_port_info_t));
 
 	p_pi = (ib_port_info_t *) payload;
-	if (enforce == TRUE)
-		p_pi->vl_enforce |= 0xc;
-	else
-		p_pi->vl_enforce &= ~0xc;
+	p_pi->vl_enforce &= ~0xc;
+	if (enforce_type != OSM_PARTITION_ENFORCE_TYPE_OFF)
+		p_pi->vl_enforce |= enforce_bits;
+
 	p_pi->state_info2 = 0;
 	ib_port_info_set_port_state(p_pi, IB_LINK_NO_CHANGE);
 
@@ -234,28 +246,61 @@ pkey_mgr_enforce_partition(IN osm_log_t * p_log, osm_sm_t * sm,
 			     IB_MAD_ATTR_PORT_INFO,
 			     cl_hton32(osm_physp_get_port_num(p_physp)),
 			     CL_DISP_MSGID_NONE, &context);
-	if (status != IB_SUCCESS) {
+	if (status != IB_SUCCESS)
 		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0511: "
 			"Failed to set PortInfo for "
-			"node 0x%016" PRIx64 " port %u\n",
+			"node 0x%016" PRIx64 " port %u (%s)\n",
 			cl_ntoh64(osm_node_get_node_guid
 				  (osm_physp_get_node_ptr(p_physp))),
-			osm_physp_get_port_num(p_physp));
-		return FALSE;
-	} else {
+			osm_physp_get_port_num(p_physp),
+			p_physp->p_node->print_desc);
+	else
 		OSM_LOG(p_log, OSM_LOG_DEBUG,
-			"Set PortInfo for node 0x%016" PRIx64 " port %u\n",
+			"Set PortInfo for node 0x%016" PRIx64 " port %u (%s)\n",
 			cl_ntoh64(osm_node_get_node_guid
 				  (osm_physp_get_node_ptr(p_physp))),
-			osm_physp_get_port_num(p_physp));
-		return TRUE;
+			osm_physp_get_port_num(p_physp),
+			p_physp->p_node->print_desc);
+	return status;
+}
+
+static void clear_accum_pkey_index(osm_pkey_tbl_t * p_pkey_tbl,
+                                   uint16_t pkey_index)
+{
+	uint16_t pkey_idx_bias, pkey_idx;
+	uint32_t i;
+	void *ptr;
+	uintptr_t pkey_idx_ptr;
+
+	pkey_idx_bias = pkey_index + 1; // adjust for pkey index bias in accum_pkeys
+	for (i = 1; i < cl_ptr_vector_get_size(&p_pkey_tbl->accum_pkeys); i++) {
+		ptr = cl_ptr_vector_get(&p_pkey_tbl->accum_pkeys, i);
+		if (ptr != NULL) {
+			pkey_idx_ptr = (uintptr_t) ptr;
+			pkey_idx = pkey_idx_ptr;
+			if (pkey_idx == pkey_idx_bias) {
+				osm_pkey_tbl_clear_accum_pkeys(p_pkey_tbl, i);
+				break;
+			}
+		}
+	}
+}
+
+static int last_accum_pkey_index(osm_pkey_tbl_t * p_pkey_tbl,
+				 uint16_t * p_block_idx,
+				 uint8_t * p_pkey_idx)
+{
+	if (p_pkey_tbl->last_pkey_idx) {
+		*p_block_idx = (p_pkey_tbl->last_pkey_idx - 1) / IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
+		*p_pkey_idx = (p_pkey_tbl->last_pkey_idx - 1) % IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
+		return 1;
 	}
+
+	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
-static boolean_t pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
-				      const osm_port_t * const p_port)
+static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
+				const osm_port_t * const p_port)
 {
 	osm_physp_t *p_physp;
 	osm_node_t *p_node;
@@ -268,29 +313,32 @@ static boolean_t pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
 	uint16_t num_of_blocks;
 	uint16_t max_num_of_blocks;
 	ib_api_status_t status;
-	boolean_t ret_val = FALSE;
 	osm_pending_pkey_t *p_pending;
 	boolean_t found;
 	ib_pkey_table_t empty_block;
-
-	memset(&empty_block, 0, sizeof(ib_pkey_table_t));
+	int ret = 0, full = 0;
+	void *ptr;
+	uintptr_t pkey_idx_ptr;
+	uint16_t pkey_idx;
 
 	p_physp = p_port->p_physp;
 	if (!p_physp)
 		return FALSE;
 
+	memset(&empty_block, 0, sizeof(ib_pkey_table_t));
+
 	p_node = osm_physp_get_node_ptr(p_physp);
 	p_pkey_tbl = &p_physp->pkeys;
 	num_of_blocks = osm_pkey_tbl_get_num_blocks(p_pkey_tbl);
-	max_num_of_blocks =
-	    pkey_mgr_get_physp_max_blocks(sm->p_subn, p_physp);
+	max_num_of_blocks = pkey_mgr_get_physp_max_blocks(p_physp);
 	if (p_pkey_tbl->max_blocks > max_num_of_blocks) {
 		OSM_LOG(p_log, OSM_LOG_INFO,
 			"Max number of blocks reduced from %u to %u "
-			"for node 0x%016" PRIx64 " port %u\n",
+			"for node 0x%016" PRIx64 " port %u (%s)\n",
 			p_pkey_tbl->max_blocks, max_num_of_blocks,
 			cl_ntoh64(osm_node_get_node_guid(p_node)),
-			osm_physp_get_port_num(p_physp));
+			osm_physp_get_port_num(p_physp),
+			p_physp->p_node->print_desc);
 	}
 	p_pkey_tbl->max_blocks = max_num_of_blocks;
 
@@ -305,25 +353,79 @@ static boolean_t pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
 	    (osm_pending_pkey_t *) cl_qlist_remove_head(&p_pkey_tbl->pending);
 	while (p_pending !=
 	       (osm_pending_pkey_t *) cl_qlist_end(&p_pkey_tbl->pending)) {
+
+		found = FALSE;
+		ptr = NULL;
+
 		if (p_pending->is_new == FALSE) {
 			block_index = p_pending->block;
 			pkey_index = p_pending->index;
 			found = TRUE;
 		} else {
-			found = osm_pkey_find_next_free_entry(p_pkey_tbl,
-							      &last_free_block_index,
-							      &last_free_pkey_index);
+			if (p_pending->pkey < cl_ptr_vector_get_size(&p_pkey_tbl->accum_pkeys)) {
+				ptr = cl_ptr_vector_get(&p_pkey_tbl->accum_pkeys,
+							p_pending->pkey);
+				if (ptr != NULL) {
+					pkey_idx_ptr = (uintptr_t) ptr;
+					pkey_idx = pkey_idx_ptr;
+					pkey_idx--; /* adjust pkey index for bias */
+					block_index = pkey_idx / IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
+					pkey_index = pkey_idx % IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
+					found = TRUE;
+				}
+			}
+
 			if (!found) {
-				OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0504: "
-					"Failed to find empty space for new pkey 0x%04x "
-					"for node 0x%016" PRIx64 " port %u\n",
-					cl_ntoh16(p_pending->pkey),
-					cl_ntoh64(osm_node_get_node_guid
-						  (p_node)),
-					osm_physp_get_port_num(p_physp));
-			} else {
-				block_index = last_free_block_index;
-				pkey_index = last_free_pkey_index++;
+				if (last_accum_pkey_index(p_pkey_tbl,
+						      &last_free_block_index,
+						      &last_free_pkey_index)) {
+					block_index = last_free_block_index;
+					pkey_index = last_free_pkey_index + 1;
+				} else {
+					block_index = 0;
+					pkey_index = 0;
+				}
+				if (pkey_index >= IB_NUM_PKEY_ELEMENTS_IN_BLOCK) {
+					block_index++;
+					pkey_index -= IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
+				}
+				if (block_index * IB_NUM_PKEY_ELEMENTS_IN_BLOCK + pkey_index >= pkey_mgr_get_physp_max_pkeys(p_physp)) {
+					last_free_block_index = 0;
+					last_free_pkey_index = 0;
+					found = osm_pkey_find_next_free_entry(p_pkey_tbl, &last_free_block_index, &last_free_pkey_index);
+					if (!found)
+						full = 1;
+					else {
+						block_index = last_free_block_index;
+						pkey_index = last_free_pkey_index;
+						if (block_index * IB_NUM_PKEY_ELEMENTS_IN_BLOCK + pkey_index >= pkey_mgr_get_physp_max_pkeys(p_physp)) {
+							full = 1;
+							found = FALSE;
+						} else {
+							OSM_LOG(p_log, OSM_LOG_INFO,
+								"Reusing PKeyTable block index %u pkey index %u "
+								"for pkey 0x%x on 0x%016" PRIx64 " port %u (%s)\n",
+								block_index,
+								pkey_index,
+								cl_ntoh16(p_pending->pkey),
+								cl_ntoh64(osm_node_get_node_guid(p_node)),
+								osm_physp_get_port_num(p_physp),
+								p_physp->p_node->print_desc);
+
+							clear_accum_pkey_index(p_pkey_tbl, block_index * IB_NUM_PKEY_ELEMENTS_IN_BLOCK + pkey_index);
+						}
+					}
+					if (full)
+						OSM_LOG(p_log, OSM_LOG_ERROR,
+							"ERR 0512: "
+							"Failed to set PKey 0x%04x because Pkey table is full "
+							"for node 0x%016" PRIx64 " port %u (%s)\n",
+							cl_ntoh16(p_pending->pkey),
+							cl_ntoh64(osm_node_get_node_guid(p_node)),
+							osm_physp_get_port_num(p_physp),
+							p_physp->p_node->print_desc);
+				} else
+					found = TRUE;
 			}
 		}
 
@@ -334,12 +436,28 @@ static boolean_t pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
 						       p_pending->pkey)) {
 				OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0505: "
 					"Failed to set PKey 0x%04x in block %u idx %u "
-					"for node 0x%016" PRIx64 " port %u\n",
+					"for node 0x%016" PRIx64 " port %u (%s)\n",
 					cl_ntoh16(p_pending->pkey), block_index,
 					pkey_index,
 					cl_ntoh64(osm_node_get_node_guid
 						  (p_node)),
-					osm_physp_get_port_num(p_physp));
+					osm_physp_get_port_num(p_physp),
+					p_physp->p_node->print_desc);
+			}
+			if (ptr == NULL &&
+			    CL_SUCCESS !=
+			    osm_pkey_tbl_set_accum_pkeys(p_pkey_tbl,
+							 p_pending->pkey,
+							 block_index * IB_NUM_PKEY_ELEMENTS_IN_BLOCK + pkey_index)) {
+				OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0508: "
+					"Failed to set accum_pkeys PKey 0x%04x "
+					"in block %u idx %u for node 0x%016"
+					PRIx64 " port %u (%s)\n",
+					cl_ntoh16(p_pending->pkey), block_index,
+					pkey_index,
+					cl_ntoh64(osm_node_get_node_guid(p_node)),
+					osm_physp_get_port_num(p_physp),
+					p_physp->p_node->print_desc);
 			}
 		}
 
@@ -361,126 +479,242 @@ static boolean_t pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
 		status =
 		    pkey_mgr_update_pkey_entry(sm, p_physp, new_block,
 					       block_index);
-		if (status == IB_SUCCESS) {
+		if (status == IB_SUCCESS)
 			OSM_LOG(p_log, OSM_LOG_DEBUG,
 				"Updated pkey table block %d for node 0x%016"
-				PRIx64 " port %u\n", block_index,
+				PRIx64 " port %u (%s)\n", block_index,
 				cl_ntoh64(osm_node_get_node_guid(p_node)),
-				osm_physp_get_port_num(p_physp));
-			ret_val = TRUE;
-		} else {
+				osm_physp_get_port_num(p_physp),
+				p_physp->p_node->print_desc);
+		else {
 			OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0506: "
 				"pkey_mgr_update_pkey_entry() failed to update "
 				"pkey table block %d for node 0x%016" PRIx64
-				" port %u\n", block_index,
+				" port %u (%s)\n", block_index,
 				cl_ntoh64(osm_node_get_node_guid(p_node)),
-				osm_physp_get_port_num(p_physp));
+				osm_physp_get_port_num(p_physp),
+				p_physp->p_node->print_desc);
+			ret = -1;
 		}
 	}
 
-	return ret_val;
+	return ret;
+}
+
+static int last_used_pkey_index(const osm_port_t * const p_port,
+				const osm_pkey_tbl_t * p_pkey_tbl,
+				uint16_t * p_last_index)
+{
+	ib_pkey_table_t *last_block;
+	uint16_t index, last_index = 0;
+
+	CL_ASSERT(p_last_index);
+
+	last_block = osm_pkey_tbl_new_block_get(p_pkey_tbl,
+						p_pkey_tbl->used_blocks - 1);
+	if (!last_block)
+		return 1;
+
+	if (p_pkey_tbl->used_blocks == p_pkey_tbl->max_blocks)
+		last_index = cl_ntoh16(p_port->p_node->node_info.partition_cap) % IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
+	if (last_index == 0)
+		last_index = IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
+	index = last_index;
+	do {
+		index--;
+		if (!ib_pkey_is_invalid(last_block->pkey_entry[index]))
+			break;
+	} while (index != 0);
+
+	*p_last_index = index;
+	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
-static boolean_t
-pkey_mgr_update_peer_port(osm_log_t * p_log, osm_sm_t * sm,
-			  const osm_subn_t * p_subn,
-			  const osm_port_t * const p_port, boolean_t enforce)
+static int update_peer_block(osm_log_t * p_log, osm_sm_t * sm,
+			     osm_physp_t * peer,
+			     osm_pkey_tbl_t * p_peer_pkey_tbl,
+			     ib_pkey_table_t * new_peer_block,
+			     uint16_t peer_block_idx, osm_node_t * p_node)
+{
+	int ret = 0;
+	ib_pkey_table_t *peer_block;
+
+	peer_block = osm_pkey_tbl_block_get(p_peer_pkey_tbl, peer_block_idx);
+	if (!peer_block ||
+	    memcmp(peer_block, new_peer_block, sizeof(*peer_block))) {
+		if (pkey_mgr_update_pkey_entry(sm, peer, new_peer_block,
+					       peer_block_idx) != IB_SUCCESS) {
+			OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0509: "
+				"pkey_mgr_update_pkey_entry() failed to update "
+				"pkey table block %d for node 0x%016"
+				PRIx64 " port %u (%s)\n",
+				peer_block_idx,
+				cl_ntoh64(osm_node_get_node_guid(p_node)),
+				osm_physp_get_port_num(peer),
+				p_node->print_desc);
+			ret = -1;
+		}
+	}
+
+	return ret;
+}
+
+static int new_pkey_exists(osm_pkey_tbl_t * p_pkey_tbl, ib_net16_t pkey)
+{
+	uint16_t num_blocks;
+	uint16_t block_index;
+	ib_pkey_table_t *block;
+	uint16_t pkey_idx;
+
+	num_blocks = (uint16_t) cl_ptr_vector_get_size(&p_pkey_tbl->new_blocks);
+	for (block_index = 0; block_index < num_blocks; block_index++) {
+		block = osm_pkey_tbl_new_block_get(p_pkey_tbl, block_index);
+		if (!block)
+			continue;
+
+		for (pkey_idx = 0; pkey_idx < IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
+		     pkey_idx++) {
+			if (block->pkey_entry[pkey_idx] == pkey)
+				return 1;
+		}
+	}
+	return 0;
+}
+
+static int pkey_mgr_update_peer_port(osm_log_t * p_log, osm_sm_t * sm,
+				     const osm_subn_t * p_subn,
+				     const osm_port_t * const p_port,
+				     osm_partition_enforce_type_enum enforce_type)
 {
 	osm_physp_t *p_physp, *peer;
 	osm_node_t *p_node;
-	ib_pkey_table_t *block, *peer_block;
+	ib_pkey_table_t *block;
 	const osm_pkey_tbl_t *p_pkey_tbl;
 	osm_pkey_tbl_t *p_peer_pkey_tbl;
-	uint16_t block_index;
-	uint16_t num_of_blocks;
+	uint16_t block_index, peer_block_idx;
 	uint16_t peer_max_blocks;
-	ib_api_status_t status = IB_SUCCESS;
-	boolean_t ret_val = FALSE;
-	boolean_t port_info_set = FALSE;
-	ib_pkey_table_t empty_block;
-
-	memset(&empty_block, 0, sizeof(ib_pkey_table_t));
+	uint16_t last_index;
+	ib_pkey_table_t new_peer_block;
+	uint16_t pkey_idx, peer_pkey_idx;
+	ib_net16_t pkey, full_pkey;
+	int ret = 0, loop_exit = 0;
 
 	p_physp = p_port->p_physp;
 	if (!p_physp)
-		return FALSE;
+		return -1;
 	peer = osm_physp_get_remote(p_physp);
 	if (!peer)
-		return FALSE;
+		return -1;
 	p_node = osm_physp_get_node_ptr(peer);
 	if (!p_node->sw || !p_node->sw->switch_info.enforce_cap)
-		return FALSE;
+		return 0;
 
-	p_pkey_tbl = osm_physp_get_pkey_tbl(p_physp);
-	p_peer_pkey_tbl = &peer->pkeys;
-	num_of_blocks = osm_pkey_tbl_get_num_blocks(p_pkey_tbl);
-	peer_max_blocks = pkey_mgr_get_physp_max_blocks(p_subn, peer);
-	if (peer_max_blocks < p_pkey_tbl->used_blocks) {
-		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0508: "
-			"Not enough pkey entries (%u < %u) on switch 0x%016"
-			PRIx64 " port %u. Clearing Enforcement bit\n",
-			peer_max_blocks, num_of_blocks,
-			cl_ntoh64(osm_node_get_node_guid(p_node)),
-			osm_physp_get_port_num(peer));
-		enforce = FALSE;
+	if (enforce_type == OSM_PARTITION_ENFORCE_TYPE_OFF) {
+		pkey_mgr_enforce_partition(p_log, sm, peer, OSM_PARTITION_ENFORCE_TYPE_OFF);
+		return ret;
 	}
 
-	if (pkey_mgr_enforce_partition(p_log, sm, peer, enforce))
-		port_info_set = TRUE;
-
-	if (enforce == FALSE)
-		return port_info_set;
-
-	p_peer_pkey_tbl->used_blocks = p_pkey_tbl->used_blocks;
+	p_pkey_tbl = osm_physp_get_pkey_tbl(p_physp);
+	peer_max_blocks = pkey_mgr_get_physp_max_blocks(peer);
+	p_peer_pkey_tbl = &peer->pkeys;
+	peer_block_idx = 0;
+	peer_pkey_idx = 0;
 	for (block_index = 0; block_index < p_pkey_tbl->used_blocks;
 	     block_index++) {
+		if (loop_exit)
+			break;
 		block = osm_pkey_tbl_new_block_get(p_pkey_tbl, block_index);
 		if (!block)
-			block = &empty_block;
-
-		peer_block =
-		    osm_pkey_tbl_block_get(p_peer_pkey_tbl, block_index);
-		if (!peer_block
-		    || memcmp(peer_block, block, sizeof(*peer_block))) {
-			status =
-			    pkey_mgr_update_pkey_entry(sm, peer, block,
-						       block_index);
-			if (status == IB_SUCCESS)
-				ret_val = TRUE;
-			else
-				OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0509: "
-					"pkey_mgr_update_pkey_entry() failed to update "
-					"pkey table block %d for node 0x%016"
-					PRIx64 " port %u\n", block_index,
-					cl_ntoh64(osm_node_get_node_guid
-						  (p_node)),
-					osm_physp_get_port_num(peer));
+			continue;
+		for (pkey_idx = 0; pkey_idx < IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
+		     pkey_idx++) {
+			pkey = block->pkey_entry[pkey_idx];
+			if (ib_pkey_is_invalid(pkey))
+				continue;
+			if (!ib_pkey_is_full_member(pkey)) {
+				full_pkey = pkey | IB_PKEY_TYPE_MASK;
+				if (new_pkey_exists(&p_physp->pkeys, full_pkey))
+					continue;
+			}
+			new_peer_block.pkey_entry[peer_pkey_idx] = pkey;
+			if (peer_block_idx >= peer_max_blocks) {
+				loop_exit = 1;
+				break;
+			}
+			if (++peer_pkey_idx == IB_NUM_PKEY_ELEMENTS_IN_BLOCK) {
+				if (update_peer_block(p_log, sm, peer,
+						      p_peer_pkey_tbl,
+						      &new_peer_block,
+						      peer_block_idx, p_node))
+					ret = -1;
+				peer_pkey_idx = 0;
+				peer_block_idx++;
+			}
+		}
+	}
+
+	if (peer_block_idx < peer_max_blocks) {
+		if (peer_pkey_idx) {
+			/* Handle partial last block */
+			for (; peer_pkey_idx < IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
+			     peer_pkey_idx++)
+				new_peer_block.pkey_entry[peer_pkey_idx] = 0;
+			if (update_peer_block(p_log, sm, peer, p_peer_pkey_tbl,
+					      &new_peer_block, peer_block_idx,
+					      p_node))
+				ret = -1;
+		} else
+			peer_block_idx--;
+
+		p_peer_pkey_tbl->used_blocks = peer_block_idx + 1;
+		if (p_peer_pkey_tbl->used_blocks == peer_max_blocks) {
+			/* Is last used pkey index beyond switch peer port capacity ? */
+			if (!last_used_pkey_index(p_port, p_peer_pkey_tbl,
+						  &last_index)) {
+				last_index += peer_block_idx * IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
+				if (cl_ntoh16(p_node->sw->switch_info.enforce_cap) <= last_index) {
+					OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0507: "
+						"Not enough pkey entries (%u <= %u) on switch 0x%016"
+						PRIx64 " port %u (%s). Clearing Enforcement bit\n",
+						cl_ntoh16(p_node->sw->switch_info.enforce_cap),
+						last_index,
+						cl_ntoh64(osm_node_get_node_guid(p_node)),
+						osm_physp_get_port_num(peer),
+						p_node->print_desc);
+					enforce_type = OSM_PARTITION_ENFORCE_TYPE_OFF;
+					ret = -1;
+				}
+			}
 		}
+	} else {
+		p_peer_pkey_tbl->used_blocks = peer_max_blocks;
+		enforce_type = OSM_PARTITION_ENFORCE_TYPE_OFF;
 	}
 
-	if (ret_val)
+	if (!ret)
 		OSM_LOG(p_log, OSM_LOG_DEBUG,
-			"Pkey table was updated for node 0x%016" PRIx64
-			" port %u\n",
+			"Pkey table was successfully updated for node 0x%016"
+			PRIx64 " port %u (%s)\n",
 			cl_ntoh64(osm_node_get_node_guid(p_node)),
-			osm_physp_get_port_num(peer));
+			osm_physp_get_port_num(peer), p_node->print_desc);
 
-	if (port_info_set)
-		return TRUE;
-	return ret_val;
+	if (pkey_mgr_enforce_partition(p_log, sm, peer, enforce_type))
+		ret = -1;
+
+	return ret;
 }
 
-/**********************************************************************
- **********************************************************************/
-osm_signal_t osm_pkey_mgr_process(IN osm_opensm_t * p_osm)
+int osm_pkey_mgr_process(IN osm_opensm_t * p_osm)
 {
 	cl_qmap_t *p_tbl;
 	cl_map_item_t *p_next;
 	osm_prtn_t *p_prtn;
 	osm_port_t *p_port;
-	osm_signal_t signal = OSM_SIGNAL_DONE;
+	osm_switch_t *p_sw;
+	osm_physp_t *p_physp;
+	osm_node_t *p_remote_node;
+	uint8_t i;
+	int ret = 0;
 
 	CL_ASSERT(p_osm);
 
@@ -491,6 +725,7 @@ osm_signal_t osm_pkey_mgr_process(IN osm_opensm_t * p_osm)
 	if (osm_prtn_make_partitions(&p_osm->log, &p_osm->subn) != IB_SUCCESS) {
 		OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR 0510: "
 			"osm_prtn_make_partitions() failed\n");
+		ret = -1;
 		goto _err;
 	}
 
@@ -513,17 +748,40 @@ osm_signal_t osm_pkey_mgr_process(IN osm_opensm_t * p_osm)
 		p_port = (osm_port_t *) p_next;
 		p_next = cl_qmap_next(p_next);
 		if (pkey_mgr_update_port(&p_osm->log, &p_osm->sm, p_port))
-			signal = OSM_SIGNAL_DONE_PENDING;
+			ret = -1;
 		if ((osm_node_get_type(p_port->p_node) != IB_NODE_TYPE_SWITCH)
 		    && pkey_mgr_update_peer_port(&p_osm->log, &p_osm->sm,
 						 &p_osm->subn, p_port,
-						 !p_osm->subn.opt.
-						 no_partition_enforcement))
-			signal = OSM_SIGNAL_DONE_PENDING;
+						 p_osm->subn.opt.part_enforce_enum))
+			ret = -1;
 	}
 
+	/* clear partition enforcement on inter-switch links */
+	p_tbl = &p_osm->subn.sw_guid_tbl;
+	p_next = cl_qmap_head(p_tbl);
+	while (p_next != cl_qmap_end(p_tbl)) {
+		p_sw = (osm_switch_t *) p_next;
+		p_next = cl_qmap_next(p_next);
+		for (i = 1; i < p_sw->num_ports; i++) {
+			p_physp = osm_node_get_physp_ptr(p_sw->p_node, i);
+			if (p_physp && p_physp->p_remote_physp)
+				p_remote_node = p_physp->p_remote_physp->p_node;
+			else
+				continue;
+
+			if (osm_node_get_type(p_remote_node) != IB_NODE_TYPE_SWITCH)
+				continue;
+
+			if(! (p_physp->port_info.vl_enforce & 0xc ))
+				continue;
+
+			/* clear partition enforcement */
+			if (pkey_mgr_enforce_partition(&p_osm->log, &p_osm->sm, p_physp, OSM_PARTITION_ENFORCE_TYPE_OFF))
+				ret = -1;
+		}
+	}
 _err:
 	CL_PLOCK_RELEASE(&p_osm->lock);
 	OSM_LOG_EXIT(&p_osm->log);
-	return (signal);
+	return ret;
 }
diff --git a/opensm/osm_pkey_rcv.c b/opensm/osm_pkey_rcv.c
index 7061941..b818485 100644
--- a/opensm/osm_pkey_rcv.c
+++ b/opensm/osm_pkey_rcv.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -41,6 +41,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_PKEY_RCV_C
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
@@ -48,10 +50,8 @@
 #include <opensm/osm_helper.h>
 #include <opensm/osm_sm.h>
 
-/**********************************************************************
- **********************************************************************/
 /*
- * WE MIGHT ONLY RECEIVE GET or SET responses
+ * WE ONLY RECEIVE GET or SET responses
  */
 void osm_pkey_rcv_process(IN void *context, IN void *data)
 {
@@ -77,7 +77,7 @@ void osm_pkey_rcv_process(IN void *context, IN void *data)
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 
 	p_context = osm_madw_get_pkey_context_ptr(p_madw);
-	p_pkey_tbl = (ib_pkey_table_t *) ib_smp_get_payload_ptr(p_smp);
+	p_pkey_tbl = ib_smp_get_payload_ptr(p_smp);
 
 	port_guid = p_context->port_guid;
 	node_guid = p_context->node_guid;
@@ -90,8 +90,7 @@ void osm_pkey_rcv_process(IN void *context, IN void *data)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4806: "
 			"No port object for port with GUID 0x%" PRIx64
 			"\n\t\t\t\tfor parent node GUID 0x%" PRIx64
-			", TID 0x%" PRIx64 "\n",
-			cl_ntoh64(port_guid),
+			", TID 0x%" PRIx64 "\n", cl_ntoh64(port_guid),
 			cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));
 		goto Exit;
 	}
@@ -112,8 +111,8 @@ void osm_pkey_rcv_process(IN void *context, IN void *data)
 	}
 
 	/*
-	   We do not mind if this is a result of a set or get - all we want is to
-	   update the subnet.
+	   We do not care if this is a result of a set or get -
+	   all we want is to update the subnet.
 	 */
 	OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 		"Got GetResp(PKey) block:%u port_num %u with GUID 0x%"
@@ -131,9 +130,8 @@ void osm_pkey_rcv_process(IN void *context, IN void *data)
 		goto Exit;
 	}
 
-	osm_dump_pkey_block(sm->p_log,
-			    port_guid, block_num,
-			    port_num, p_pkey_tbl, OSM_LOG_DEBUG);
+	osm_dump_pkey_block_v2(sm->p_log, port_guid, block_num, port_num,
+			       p_pkey_tbl, FILE_ID, OSM_LOG_DEBUG);
 
 	osm_physp_set_pkey_tbl(sm->p_log, sm->p_subn,
 			       p_physp, p_pkey_tbl, block_num);
diff --git a/opensm/osm_port.c b/opensm/osm_port.c
index 4b4d4b8..6e73e66 100644
--- a/opensm/osm_port.c
+++ b/opensm/osm_port.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -48,15 +48,16 @@
 #include <string.h>
 #include <complib/cl_debug.h>
 #include <iba/ib_types.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_PORT_C
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_madw.h>
-#include <opensm/osm_mcm_info.h>
 #include <opensm/osm_switch.h>
+#include <opensm/osm_db_pack.h>
+#include <opensm/osm_sm.h>
 
-/**********************************************************************
- **********************************************************************/
-void osm_physp_construct(IN osm_physp_t * const p_physp)
+void osm_physp_construct(IN osm_physp_t * p_physp)
 {
 	memset(p_physp, 0, sizeof(*p_physp));
 	osm_dr_path_construct(&p_physp->dr_path);
@@ -64,14 +65,15 @@ void osm_physp_construct(IN osm_physp_t * const p_physp)
 	osm_pkey_tbl_construct(&p_physp->pkeys);
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_physp_destroy(IN osm_physp_t * const p_physp)
+void osm_physp_destroy(IN osm_physp_t * p_physp)
 {
 	size_t num_slvl, i;
 
 	/* the physp might be uninitialized */
 	if (p_physp->port_guid) {
+		if (p_physp->p_guids)
+			free(p_physp->p_guids);
+
 		/* free the SL2VL Tables */
 		num_slvl = cl_ptr_vector_get_size(&p_physp->slvl_by_port);
 		for (i = 0; i < num_slvl; i++)
@@ -86,16 +88,10 @@ void osm_physp_destroy(IN osm_physp_t * const p_physp)
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_physp_init(IN osm_physp_t * const p_physp,
-	       IN const ib_net64_t port_guid,
-	       IN const uint8_t port_num,
-	       IN const struct osm_node *const p_node,
-	       IN const osm_bind_handle_t h_bind,
-	       IN const uint8_t hop_count,
-	       IN const uint8_t * const p_initial_path)
+void osm_physp_init(IN osm_physp_t * p_physp, IN ib_net64_t port_guid,
+		    IN uint8_t port_num, IN const struct osm_node *p_node,
+		    IN osm_bind_handle_t h_bind, IN uint8_t hop_count,
+		    IN const uint8_t * p_initial_path)
 {
 	uint16_t num_slvl, i;
 	ib_slvl_table_t *p_slvl;
@@ -109,7 +105,7 @@ osm_physp_init(IN osm_physp_t * const p_physp,
 	p_physp->need_update = 2;
 	p_physp->p_node = (struct osm_node *)p_node;
 
-	osm_dr_path_init(&p_physp->dr_path, h_bind, hop_count, p_initial_path);
+	osm_dr_path_init(&p_physp->dr_path, hop_count, p_initial_path);
 
 	/* allocate enough SL2VL tables */
 	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH)
@@ -132,30 +128,23 @@ osm_physp_init(IN osm_physp_t * const p_physp,
 	osm_pkey_tbl_init(&p_physp->pkeys);
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_port_delete(IN OUT osm_port_t ** const pp_port)
+void osm_port_delete(IN OUT osm_port_t ** pp_port)
 {
-	/* cleanup all mcm recs attached */
-	osm_port_remove_all_mgrp(*pp_port);
 	free(*pp_port);
 	*pp_port = NULL;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-osm_port_init(IN osm_port_t * const p_port,
-	      IN const ib_node_info_t * p_ni,
-	      IN osm_node_t * const p_parent_node)
+osm_port_t *osm_port_new(IN const ib_node_info_t * p_ni,
+			 IN osm_node_t * p_parent_node)
 {
+	osm_port_t *p_port;
 	ib_net64_t port_guid;
 	osm_physp_t *p_physp;
 	uint8_t port_num;
 
-	CL_ASSERT(p_port);
-	CL_ASSERT(p_ni);
-	CL_ASSERT(p_parent_node);
+	p_port = malloc(sizeof(*p_port));
+	if (!p_port)
+		return NULL;
 
 	memset(p_port, 0, sizeof(*p_port));
 	cl_qlist_init(&p_port->mcm_list);
@@ -163,7 +152,7 @@ osm_port_init(IN osm_port_t * const p_port,
 	port_guid = p_ni->port_guid;
 	p_port->guid = port_guid;
 	port_num = p_ni->node_type == IB_NODE_TYPE_SWITCH ?
-		0 : ib_node_info_get_local_port_num(p_ni);
+	    0 : ib_node_info_get_local_port_num(p_ni);
 
 	/*
 	   Get the pointers to the physical node objects "owned" by this
@@ -174,30 +163,12 @@ osm_port_init(IN osm_port_t * const p_port,
 	p_physp = osm_node_get_physp_ptr(p_parent_node, port_num);
 	CL_ASSERT(port_guid == osm_physp_get_port_guid(p_physp));
 	p_port->p_physp = p_physp;
-}
-
-/**********************************************************************
- **********************************************************************/
-osm_port_t *osm_port_new(IN const ib_node_info_t * p_ni,
-			 IN osm_node_t * const p_parent_node)
-{
-	osm_port_t *p_port;
 
-	p_port = malloc(sizeof(*p_port));
-	if (p_port != NULL) {
-		memset(p_port, 0, sizeof(*p_port));
-		osm_port_init(p_port, p_ni, p_parent_node);
-	}
-
-	return (p_port);
+	return p_port;
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_port_get_lid_range_ho(IN const osm_port_t * const p_port,
-			  IN uint16_t * const p_min_lid,
-			  IN uint16_t * const p_max_lid)
+void osm_port_get_lid_range_ho(IN const osm_port_t * p_port,
+			       IN uint16_t * p_min_lid, IN uint16_t * p_max_lid)
 {
 	uint8_t lmc;
 
@@ -206,106 +177,9 @@ osm_port_get_lid_range_ho(IN const osm_port_t * const p_port,
 	*p_max_lid = (uint16_t) (*p_min_lid + (1 << lmc) - 1);
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_get_port_by_base_lid(IN const osm_subn_t * const p_subn,
-			 IN const ib_net16_t lid,
-			 IN OUT const osm_port_t ** const pp_port)
-{
-	ib_api_status_t status;
-	uint16_t base_lid;
-	uint8_t lmc;
-
-	*pp_port = NULL;
-
-	/* Loop on lmc from 0 up through max LMC possible */
-	for (lmc = 0; lmc <= IB_PORT_LMC_MAX; lmc++) {
-		/* Calculate a base LID assuming this is the real LMC */
-		base_lid = cl_ntoh16(lid) & ~((1 << lmc) - 1);
-
-		/* Look for a match */
-		status = cl_ptr_vector_at(&p_subn->port_lid_tbl,
-					  base_lid, (void **)pp_port);
-		if ((status == CL_SUCCESS) && (*pp_port != NULL)) {
-			/* Determine if base LID "tested" is the real base LID */
-			/* This is true if the LMC "tested" is the port's actual LMC */
-			if (lmc == osm_port_get_lmc(*pp_port)) {
-				status = IB_SUCCESS;
-				goto Found;
-			}
-		}
-	}
-	*pp_port = NULL;
-	status = IB_NOT_FOUND;
-
-Found:
-	return status;
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_port_add_mgrp(IN osm_port_t * const p_port, IN const ib_net16_t mlid)
-{
-	ib_api_status_t status = IB_SUCCESS;
-	osm_mcm_info_t *p_mcm;
-
-	p_mcm = osm_mcm_info_new(mlid);
-	if (p_mcm)
-		cl_qlist_insert_tail(&p_port->mcm_list,
-				     (cl_list_item_t *) p_mcm);
-	else
-		status = IB_INSUFFICIENT_MEMORY;
-
-	return (status);
-}
-
-/**********************************************************************
- **********************************************************************/
-static cl_status_t
-__osm_port_mgrp_find_func(IN const cl_list_item_t * const p_list_item,
-			  IN void *context)
-{
-	if (*((ib_net16_t *) context) == ((osm_mcm_info_t *) p_list_item)->mlid)
-		return (CL_SUCCESS);
-	else
-		return (CL_NOT_FOUND);
-}
-
-/**********************************************************************
- **********************************************************************/
-void
-osm_port_remove_mgrp(IN osm_port_t * const p_port, IN const ib_net16_t mlid)
-{
-	cl_list_item_t *p_mcm;
-
-	p_mcm = cl_qlist_find_from_head(&p_port->mcm_list,
-					__osm_port_mgrp_find_func, &mlid);
-
-	if (p_mcm != cl_qlist_end(&p_port->mcm_list)) {
-		cl_qlist_remove_item(&p_port->mcm_list, p_mcm);
-		osm_mcm_info_delete((osm_mcm_info_t *) p_mcm);
-	}
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_port_remove_all_mgrp(IN osm_port_t * const p_port)
-{
-	cl_list_item_t *p_mcm;
-
-	p_mcm = cl_qlist_remove_head(&p_port->mcm_list);
-	while (p_mcm != cl_qlist_end(&p_port->mcm_list)) {
-		osm_mcm_info_delete((osm_mcm_info_t *) p_mcm);
-		p_mcm = cl_qlist_remove_head(&p_port->mcm_list);
-	}
-}
-
-/**********************************************************************
- **********************************************************************/
-uint8_t
-osm_physp_calc_link_mtu(IN osm_log_t * p_log, IN const osm_physp_t * p_physp)
+uint8_t osm_physp_calc_link_mtu(IN osm_log_t * p_log,
+				IN const osm_physp_t * p_physp,
+				IN uint8_t current_mtu)
 {
 	const osm_physp_t *p_remote_physp;
 	uint8_t mtu;
@@ -331,16 +205,17 @@ osm_physp_calc_link_mtu(IN osm_log_t * p_log, IN const osm_physp_t * p_physp)
 		if (mtu != remote_mtu) {
 			if (mtu > remote_mtu)
 				mtu = remote_mtu;
-
-			OSM_LOG(p_log, OSM_LOG_VERBOSE,
-				"MTU mismatch between ports."
-				"\n\t\t\t\tPort 0x%016" PRIx64 ", port %u"
-				" and port 0x%016" PRIx64 ", port %u."
-				"\n\t\t\t\tUsing lower MTU of %u\n",
-				cl_ntoh64(osm_physp_get_port_guid(p_physp)),
-				osm_physp_get_port_num(p_physp),
-				cl_ntoh64(osm_physp_get_port_guid(p_remote_physp)),
-				osm_physp_get_port_num(p_remote_physp),mtu);
+			if (mtu != current_mtu)
+				OSM_LOG(p_log, OSM_LOG_VERBOSE,
+					"MTU mismatch between ports."
+					"\n\t\t\t\tPort 0x%016" PRIx64 ", port %u"
+					" and port 0x%016" PRIx64 ", port %u."
+					"\n\t\t\t\tUsing lower MTU of %u\n",
+					cl_ntoh64(osm_physp_get_port_guid(p_physp)),
+					osm_physp_get_port_num(p_physp),
+					cl_ntoh64(osm_physp_get_port_guid
+						  (p_remote_physp)),
+					osm_physp_get_port_num(p_remote_physp), mtu);
 		}
 	} else
 		mtu = ib_port_info_get_neighbor_mtu(&p_physp->port_info);
@@ -352,15 +227,13 @@ osm_physp_calc_link_mtu(IN osm_log_t * p_log, IN const osm_physp_t * p_physp)
 	}
 
 	OSM_LOG_EXIT(p_log);
-	return (mtu);
+	return mtu;
 }
 
-/**********************************************************************
- **********************************************************************/
-uint8_t
-osm_physp_calc_link_op_vls(IN osm_log_t * p_log,
-			   IN const osm_subn_t * p_subn,
-			   IN const osm_physp_t * p_physp)
+uint8_t osm_physp_calc_link_op_vls(IN osm_log_t * p_log,
+				   IN const osm_subn_t * p_subn,
+				   IN const osm_physp_t * p_physp,
+				   IN uint8_t current_op_vls)
 {
 	const osm_physp_t *p_remote_physp;
 	uint8_t op_vls;
@@ -386,35 +259,37 @@ osm_physp_calc_link_op_vls(IN osm_log_t * p_log,
 		if (op_vls != remote_op_vls) {
 			if (op_vls > remote_op_vls)
 				op_vls = remote_op_vls;
-
-			OSM_LOG(p_log, OSM_LOG_VERBOSE,
-				"OP_VLS mismatch between ports."
-				"\n\t\t\t\tPort 0x%016" PRIx64 ", port 0x%X"
-				" and port 0x%016" PRIx64 ", port 0x%X."
-				"\n\t\t\t\tUsing lower OP_VLS of %u\n",
-				cl_ntoh64(osm_physp_get_port_guid(p_physp)),
-				osm_physp_get_port_num(p_physp),
-				cl_ntoh64(osm_physp_get_port_guid(p_remote_physp)),
-				osm_physp_get_port_num(p_remote_physp), op_vls);
+			if (op_vls != current_op_vls)
+				OSM_LOG(p_log, OSM_LOG_VERBOSE,
+					"OP_VLS mismatch between ports."
+					"\n\t\t\t\tPort 0x%016" PRIx64 ", port 0x%X"
+					" and port 0x%016" PRIx64 ", port 0x%X."
+					"\n\t\t\t\tUsing lower OP_VLS of %u\n",
+					cl_ntoh64(osm_physp_get_port_guid(p_physp)),
+					osm_physp_get_port_num(p_physp),
+					cl_ntoh64(osm_physp_get_port_guid
+						  (p_remote_physp)),
+					osm_physp_get_port_num(p_remote_physp), op_vls);
 		}
 	} else
 		op_vls = ib_port_info_get_op_vls(&p_physp->port_info);
 
-	/* support user limitation of max_op_vls */
-	if (op_vls > p_subn->opt.max_op_vls)
-		op_vls = p_subn->opt.max_op_vls;
-
 	if (op_vls == 0) {
-		OSM_LOG(p_log, OSM_LOG_DEBUG, "ERR 4102: "
+		/* for non compliant implementations */
+		OSM_LOG(p_log, OSM_LOG_VERBOSE,
 			"Invalid OP_VLS = 0. Forcing correction to 1 (VL0)\n");
 		op_vls = 1;
 	}
 
+	/* support user limitation of max_op_vls */
+	if (op_vls > p_subn->opt.max_op_vls)
+		op_vls = p_subn->opt.max_op_vls;
+
 	OSM_LOG_EXIT(p_log);
-	return (op_vls);
+	return op_vls;
 }
 
-static inline uint64_t __osm_ptr_to_key(void const *p)
+static inline uint64_t ptr_to_key(void const *p)
 {
 	uint64_t k = 0;
 
@@ -422,7 +297,7 @@ static inline uint64_t __osm_ptr_to_key(void const *p)
 	return k;
 }
 
-static inline void *__osm_key_to_ptr(uint64_t k)
+static inline void *key_to_ptr(uint64_t k)
 {
 	void *p = 0;
 
@@ -435,11 +310,10 @@ static inline void *__osm_key_to_ptr(uint64_t k)
  add every phys port traversed to the map. Avoid tracking the first and
  last phys ports (going into the first switch and into the target port).
  **********************************************************************/
-static cl_status_t
-__osm_physp_get_dr_physp_set(IN osm_log_t * p_log,
-			     IN osm_subn_t const *p_subn,
-			     IN osm_dr_path_t const *p_path,
-			     OUT cl_map_t * p_physp_map)
+static cl_status_t physp_get_dr_physp_set(IN osm_log_t * p_log,
+					  IN osm_subn_t const *p_subn,
+					  IN osm_dr_path_t const *p_path,
+					  OUT cl_map_t * p_physp_map)
 {
 	osm_port_t *p_port;
 	osm_physp_t *p_physp;
@@ -481,8 +355,7 @@ __osm_physp_get_dr_physp_set(IN osm_log_t * p_log,
 
 		/* we track the ports we go out along the path */
 		if (hop > 1)
-			cl_map_insert(p_physp_map, __osm_ptr_to_key(p_physp),
-				      NULL);
+			cl_map_insert(p_physp_map, ptr_to_key(p_physp), NULL);
 
 		OSM_LOG(p_log, OSM_LOG_DEBUG,
 			"Traversed through node: 0x%016" PRIx64
@@ -506,12 +379,9 @@ Exit:
 	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_physp_update_new_dr_path(IN osm_physp_t const *p_dest_physp,
-			       IN cl_map_t * p_visited_map,
-			       IN osm_bind_handle_t * h_bind)
+static void physp_update_new_dr_path(IN osm_physp_t const *p_dest_physp,
+				     IN cl_map_t * p_visited_map,
+				     IN osm_bind_handle_t * h_bind)
 {
 	cl_list_t tmpPortsList;
 	osm_physp_t *p_physp, *p_src_physp = NULL;
@@ -525,20 +395,20 @@ __osm_physp_update_new_dr_path(IN osm_physp_t const *p_dest_physp,
 	cl_list_insert_head(&tmpPortsList, p_dest_physp);
 	/* get the output port where we need to come from */
 	p_physp = (osm_physp_t *) cl_map_get(p_visited_map,
-					     __osm_ptr_to_key(p_dest_physp));
+					     ptr_to_key(p_dest_physp));
 	while (p_physp != NULL) {
 		cl_list_insert_head(&tmpPortsList, p_physp);
 		/* get the input port through where we reached the output port */
 		p_src_physp = p_physp;
 		p_physp = (osm_physp_t *) cl_map_get(p_visited_map,
-						     __osm_ptr_to_key(p_physp));
+						     ptr_to_key(p_physp));
 		/* if we reached a null p_physp - this means we are at the begining
 		   of the path. Break. */
 		if (p_physp == NULL)
 			break;
 		/* get the output port */
 		p_physp = (osm_physp_t *) cl_map_get(p_visited_map,
-						     __osm_ptr_to_key(p_physp));
+						     ptr_to_key(p_physp));
 	}
 
 	memset(path_array, 0, sizeof(path_array));
@@ -550,20 +420,18 @@ __osm_physp_update_new_dr_path(IN osm_physp_t const *p_dest_physp,
 	}
 	if (p_src_physp) {
 		p_dr_path = osm_physp_get_dr_path_ptr(p_src_physp);
-		osm_dr_path_init(p_dr_path, h_bind, i, path_array);
+		osm_dr_path_init(p_dr_path, i, path_array);
 	}
 
 	cl_list_destroy(&tmpPortsList);
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_physp_replace_dr_path_with_alternate_dr_path(IN osm_log_t * p_log,
-						 IN osm_subn_t const *p_subn,
-						 IN osm_physp_t const
-						 *p_dest_physp,
-						 IN osm_bind_handle_t * h_bind)
+void osm_physp_replace_dr_path_with_alternate_dr_path(IN osm_log_t * p_log,
+						      IN osm_subn_t const
+						      *p_subn, IN osm_physp_t const
+						      *p_dest_physp,
+						      IN osm_bind_handle_t *
+						      h_bind)
 {
 	cl_map_t physp_map;
 	cl_map_t visited_map;
@@ -589,7 +457,7 @@ osm_physp_replace_dr_path_with_alternate_dr_path(IN osm_log_t * p_log,
 	cl_map_construct(&visited_map);
 	cl_map_init(&visited_map, 4);
 	p_dr_path = osm_physp_get_dr_path_ptr(p_dest_physp);
-	__osm_physp_get_dr_physp_set(p_log, p_subn, p_dr_path, &physp_map);
+	physp_get_dr_physp_set(p_log, p_subn, p_dr_path, &physp_map);
 
 	/*
 	   BFS from OSM port until we find the target physp but avoid
@@ -658,21 +526,21 @@ osm_physp_replace_dr_path_with_alternate_dr_path(IN osm_log_t * p_log,
 				if (p_remote_physp &&
 				    p_remote_physp != p_physp &&
 				    cl_map_get(&physp_map,
-					       __osm_ptr_to_key(p_remote_physp))
+					       ptr_to_key(p_remote_physp))
 				    == NULL
 				    && cl_map_get(&visited_map,
-						  __osm_ptr_to_key
+						  ptr_to_key
 						  (p_remote_physp)) == NULL) {
 					/* Insert the port into the visited_map, and save its source port */
 					cl_map_insert(&visited_map,
-						      __osm_ptr_to_key
+						      ptr_to_key
 						      (p_remote_physp),
 						      p_physp);
 
 					/* Is this the p_dest_physp? */
 					if (p_remote_physp == p_dest_physp) {
 						/* update the new dr path */
-						__osm_physp_update_new_dr_path
+						physp_update_new_dr_path
 						    (p_dest_physp, &visited_map,
 						     h_bind);
 						reached_dest = TRUE;
@@ -716,9 +584,7 @@ Exit:
 	cl_map_destroy(&visited_map);
 }
 
-/**********************************************************************
- **********************************************************************/
-boolean_t osm_link_is_healthy(IN const osm_physp_t * const p_physp)
+boolean_t osm_link_is_healthy(IN const osm_physp_t * p_physp)
 {
 	osm_physp_t *p_remote_physp;
 
@@ -727,16 +593,13 @@ boolean_t osm_link_is_healthy(IN const osm_physp_t * const p_physp)
 	if (p_remote_physp != NULL)
 		return ((p_physp->healthy) & (p_remote_physp->healthy));
 	/* the other side is not known - consider the link as healthy */
-	return (TRUE);
+	return TRUE;
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_physp_set_pkey_tbl(IN osm_log_t * p_log,
-		       IN const osm_subn_t * p_subn,
-		       IN osm_physp_t * const p_physp,
-		       IN ib_pkey_table_t * p_pkey_tbl, IN uint16_t block_num)
+void osm_physp_set_pkey_tbl(IN osm_log_t * p_log, IN const osm_subn_t * p_subn,
+			    IN osm_physp_t * p_physp,
+			    IN ib_pkey_table_t * p_pkey_tbl,
+			    IN uint16_t block_num)
 {
 	uint16_t max_blocks;
 
@@ -776,5 +639,55 @@ osm_physp_set_pkey_tbl(IN osm_log_t * p_log,
 		return;
 	}
 
-	osm_pkey_tbl_set(&p_physp->pkeys, block_num, p_pkey_tbl);
+	osm_pkey_tbl_set(&p_physp->pkeys, block_num, p_pkey_tbl,
+			 p_subn->opt.allow_both_pkeys);
+}
+
+osm_alias_guid_t *osm_alias_guid_new(IN const ib_net64_t alias_guid,
+				     IN osm_port_t *p_base_port)
+{
+	osm_alias_guid_t *p_alias_guid;
+
+	p_alias_guid = calloc(1, sizeof(*p_alias_guid));
+	if (p_alias_guid) {
+		p_alias_guid->alias_guid = alias_guid;
+		p_alias_guid->p_base_port = p_base_port;
+	}
+	return p_alias_guid;
+}
+
+void osm_alias_guid_delete(IN OUT osm_alias_guid_t ** pp_alias_guid)
+{
+	free(*pp_alias_guid);
+	*pp_alias_guid = NULL;
+}
+
+void osm_physp_set_port_info(IN osm_physp_t * p_physp,
+					   IN const ib_port_info_t * p_pi,
+					   IN const struct osm_sm * p_sm)
+{
+	CL_ASSERT(p_pi);
+	CL_ASSERT(osm_physp_is_valid(p_physp));
+
+	if (ib_port_info_get_port_state(p_pi) == IB_LINK_DOWN) {
+		/* If PortState is down, only copy PortState */
+		/* and PortPhysicalState per C14-24-2.1 */
+		ib_port_info_set_port_state(&p_physp->port_info, IB_LINK_DOWN);
+		ib_port_info_set_port_phys_state
+		    (ib_port_info_get_port_phys_state(p_pi),
+		     &p_physp->port_info);
+	} else {
+		p_physp->port_info = *p_pi;
+
+		/* The MKey in p_pi can only be considered valid if it's
+		 * for a HCA/router or switch port 0, and it's either
+		 * non-zero or the MKeyProtect bits are also zero.
+		 */
+		if ((osm_node_get_type(p_physp->p_node) !=
+		     IB_NODE_TYPE_SWITCH || p_physp->port_num == 0) &&
+		    (p_pi->m_key != 0 || ib_port_info_get_mpb(p_pi) == 0))
+			osm_db_guid2mkey_set(p_sm->p_subn->p_g2m,
+					     cl_ntoh64(p_physp->port_guid),
+					     cl_ntoh64(p_pi->m_key));
+	}
 }
diff --git a/opensm/osm_port_info_rcv.c b/opensm/osm_port_info_rcv.c
index 02ad586..c3bc66c 100644
--- a/opensm/osm_port_info_rcv.c
+++ b/opensm/osm_port_info_rcv.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -45,10 +46,13 @@
 #endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
+#include <stdlib.h>
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_PORT_INFO_RCV_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
@@ -62,56 +66,26 @@
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_ucast_mgr.h>
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_pi_rcv_set_sm(IN osm_sm_t * sm,
-		    IN osm_physp_t * const p_physp)
-{
-	osm_bind_handle_t h_bind;
-	osm_dr_path_t *p_dr_path;
-
-	OSM_LOG_ENTER(sm->p_log);
-
-	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-		"Setting IS_SM bit in port attributes\n");
-
-	p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
-	h_bind = osm_dr_path_get_bind_handle(p_dr_path);
-
-	/*
-	   The 'IS_SM' bit isn't already set, so set it.
-	 */
-	osm_vendor_set_sm(h_bind, TRUE);
-
-	OSM_LOG_EXIT(sm->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-static void pi_rcv_check_and_fix_lid(osm_log_t *log, ib_port_info_t * const pi,
+static void pi_rcv_check_and_fix_lid(osm_log_t * log, ib_port_info_t * pi,
 				     osm_physp_t * p)
 {
 	if (cl_ntoh16(pi->base_lid) > IB_LID_UCAST_END_HO) {
 		OSM_LOG(log, OSM_LOG_ERROR, "ERR 0F04: "
 			"Got invalid base LID %u from the network. "
-			"Corrected to %u.\n", cl_ntoh16(pi->base_lid),
+			"Corrected to %u\n", cl_ntoh16(pi->base_lid),
 			cl_ntoh16(p->port_info.base_lid));
 		pi->base_lid = p->port_info.base_lid;
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_pi_rcv_process_endport(IN osm_sm_t * sm,
-			     IN osm_physp_t * const p_physp,
-			     IN const ib_port_info_t * const p_pi)
+static void pi_rcv_process_endport(IN osm_sm_t * sm, IN osm_physp_t * p_physp,
+				   IN const ib_port_info_t * p_pi)
 {
 	osm_madw_context_t context;
 	ib_api_status_t status;
 	ib_net64_t port_guid;
 	uint8_t rate, mtu;
+	unsigned data_vls;
 	cl_qmap_t *p_sm_tbl;
 	osm_remote_sm_t *p_sm;
 
@@ -121,7 +95,7 @@ __osm_pi_rcv_process_endport(IN osm_sm_t * sm,
 
 	/* HACK extended port 0 should be handled too! */
 	if (osm_physp_get_port_num(p_physp) != 0) {
-		/* track the minimal endport MTU and rate */
+		/* track the minimal endport MTU, rate, and operational VLs */
 		mtu = ib_port_info_get_mtu_cap(p_pi);
 		if (mtu < sm->p_subn->min_ca_mtu) {
 			OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
@@ -130,25 +104,27 @@ __osm_pi_rcv_process_endport(IN osm_sm_t * sm,
 			sm->p_subn->min_ca_mtu = mtu;
 		}
 
-		rate = ib_port_info_compute_rate(p_pi);
+		rate = ib_port_info_compute_rate(p_pi,
+						 p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);
 		if (rate < sm->p_subn->min_ca_rate) {
 			OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 				"Setting endport minimal rate to:%u defined by port:0x%"
 				PRIx64 "\n", rate, cl_ntoh64(port_guid));
 			sm->p_subn->min_ca_rate = rate;
 		}
+
+		data_vls = 1U << (ib_port_info_get_op_vls(p_pi) - 1);
+		if (data_vls >= IB_MAX_NUM_VLS)
+			data_vls = IB_MAX_NUM_VLS - 1;
+		if ((uint8_t)data_vls < sm->p_subn->min_data_vls) {
+			OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
+				"Setting endport minimal data VLs to:%u defined by port:0x%"
+				PRIx64 "\n", data_vls, cl_ntoh64(port_guid));
+			sm->p_subn->min_data_vls = data_vls;
+		}
 	}
 
-	if (port_guid == sm->p_subn->sm_port_guid) {
-		/*
-		   We received the PortInfo for our own port.
-		 */
-		if (!(p_pi->capability_mask & IB_PORT_CAP_IS_SM))
-			/*
-			   Set the IS_SM bit to indicate our port hosts an SM.
-			 */
-			__osm_pi_rcv_set_sm(sm, p_physp);
-	} else {
+	if (port_guid != sm->p_subn->sm_port_guid) {
 		p_sm_tbl = &sm->p_subn->sm_guid_tbl;
 		if (p_pi->capability_mask & IB_PORT_CAP_IS_SM) {
 			/*
@@ -156,10 +132,13 @@ __osm_pi_rcv_process_endport(IN osm_sm_t * sm,
 			 * clean its state, so if the querying fails we
 			 * recognize that this SM is not active.
 			 */
-			p_sm = (osm_remote_sm_t *) cl_qmap_get(p_sm_tbl, port_guid);
+			p_sm =
+			    (osm_remote_sm_t *) cl_qmap_get(p_sm_tbl,
+							    port_guid);
 			if (p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_tbl))
 				/* clean it up */
-				p_sm->smi.pri_state = 0xF0 & p_sm->smi.pri_state;
+				p_sm->smi.pri_state =
+				    0xF0 & p_sm->smi.pri_state;
 			if (sm->p_subn->opt.ignore_other_sm)
 				OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 					"Ignoring SM on port 0x%" PRIx64 "\n",
@@ -192,7 +171,9 @@ __osm_pi_rcv_process_endport(IN osm_sm_t * sm,
 						ib_get_err_str(status));
 			}
 		} else {
-			p_sm = (osm_remote_sm_t *) cl_qmap_remove(p_sm_tbl, port_guid);
+			p_sm =
+			    (osm_remote_sm_t *) cl_qmap_remove(p_sm_tbl,
+							       port_guid);
 			if (p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_tbl))
 				free(p_sm);
 		}
@@ -204,11 +185,9 @@ __osm_pi_rcv_process_endport(IN osm_sm_t * sm,
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
-static void
-__osm_pi_rcv_process_switch_port(IN osm_sm_t * sm,
-				 IN osm_node_t * const p_node,
-				 IN osm_physp_t * const p_physp,
-				 IN ib_port_info_t * const p_pi)
+static void pi_rcv_process_switch_port(IN osm_sm_t * sm, IN osm_node_t * p_node,
+				       IN osm_physp_t * p_physp,
+				       IN ib_port_info_t * p_pi)
 {
 	ib_api_status_t status = IB_SUCCESS;
 	osm_madw_context_t context;
@@ -279,9 +258,15 @@ __osm_pi_rcv_process_switch_port(IN osm_sm_t * sm,
 			    osm_physp_get_port_num(p_physp)) {
 				path = *osm_physp_get_dr_path_ptr(p_physp);
 
-				osm_dr_path_extend(&path,
-						   osm_physp_get_port_num
-						   (p_physp));
+				if (osm_dr_path_extend(&path,
+						       osm_physp_get_port_num
+						       (p_physp))) {
+					OSM_LOG(sm->p_log, OSM_LOG_ERROR,
+						"ERR 0F08: "
+						"DR path with hop count %d couldn't be extended\n",
+						path.hop_count);
+					break;
+				}
 
 				memset(&context, 0, sizeof(context));
 				context.ni_context.node_guid =
@@ -289,10 +274,8 @@ __osm_pi_rcv_process_switch_port(IN osm_sm_t * sm,
 				context.ni_context.port_num =
 				    osm_physp_get_port_num(p_physp);
 
-				status = osm_req_get(sm,
-						     &path,
-						     IB_MAD_ATTR_NODE_INFO,
-						     0,
+				status = osm_req_get(sm, &path,
+						     IB_MAD_ATTR_NODE_INFO, 0,
 						     CL_DISP_MSGID_NONE,
 						     &context);
 
@@ -329,7 +312,7 @@ __osm_pi_rcv_process_switch_port(IN osm_sm_t * sm,
 	/*
 	   Update the PortInfo attribute.
 	 */
-	osm_physp_set_port_info(p_physp, p_pi);
+	osm_physp_set_port_info(p_physp, p_pi, sm);
 
 	if (port_num == 0) {
 		/* Determine if base switch port 0 */
@@ -337,19 +320,16 @@ __osm_pi_rcv_process_switch_port(IN osm_sm_t * sm,
 		    !ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info))
 			/* PortState is not used on BSP0 but just in case it is DOWN */
 			p_physp->port_info = *p_pi;
-		__osm_pi_rcv_process_endport(sm, p_physp, p_pi);
+		pi_rcv_process_endport(sm, p_physp, p_pi);
 	}
 
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_pi_rcv_process_ca_or_router_port(IN osm_sm_t * sm,
-				       IN osm_node_t * const p_node,
-				       IN osm_physp_t * const p_physp,
-				       IN ib_port_info_t * const p_pi)
+static void pi_rcv_process_ca_or_router_port(IN osm_sm_t * sm,
+					     IN osm_node_t * p_node,
+					     IN osm_physp_t * p_physp,
+					     IN ib_port_info_t * p_pi)
 {
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -357,20 +337,16 @@ __osm_pi_rcv_process_ca_or_router_port(IN osm_sm_t * sm,
 
 	pi_rcv_check_and_fix_lid(sm->p_log, p_pi, p_physp);
 
-	osm_physp_set_port_info(p_physp, p_pi);
+	osm_physp_set_port_info(p_physp, p_pi, sm);
 
-	__osm_pi_rcv_process_endport(sm, p_physp, p_pi);
+	pi_rcv_process_endport(sm, p_physp, p_pi);
 
 	OSM_LOG_EXIT(sm->p_log);
 }
 
 #define IBM_VENDOR_ID  (0x5076)
-/**********************************************************************
- **********************************************************************/
-static void get_pkey_table(IN osm_log_t * p_log,
-			   IN osm_sm_t * sm,
-			   IN osm_node_t * const p_node,
-			   IN osm_physp_t * const p_physp)
+static void get_pkey_table(IN osm_log_t * p_log, IN osm_sm_t * sm,
+			   IN osm_node_t * p_node, IN osm_physp_t * p_physp)
 {
 
 	osm_madw_context_t context;
@@ -391,8 +367,8 @@ static void get_pkey_table(IN osm_log_t * p_log,
 	port_num = p_physp->port_num;
 
 	if (!p_node->sw || port_num == 0)
-		/* The maximum blocks is defined by the node info partition cap for CA,
-		   router, and switch management ports. */
+		/* The maximum blocks is defined by the node info partition cap
+		   for CA, router, and switch management ports. */
 		max_blocks =
 		    (cl_ntoh16(p_node->node_info.partition_cap) +
 		     IB_NUM_PKEY_ELEMENTS_IN_BLOCK - 1)
@@ -436,12 +412,9 @@ Exit:
 	OSM_LOG_EXIT(p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_pi_rcv_get_pkey_slvl_vla_tables(IN osm_sm_t * sm,
-				      IN osm_node_t * const p_node,
-				      IN osm_physp_t * const p_physp)
+static void pi_rcv_get_pkey_slvl_vla_tables(IN osm_sm_t * sm,
+					    IN osm_node_t * p_node,
+					    IN osm_physp_t * p_physp)
 {
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -450,11 +423,8 @@ __osm_pi_rcv_get_pkey_slvl_vla_tables(IN osm_sm_t * sm,
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-osm_pi_rcv_process_set(IN osm_sm_t * sm, IN osm_node_t * const p_node,
-		       IN const uint8_t port_num, IN osm_madw_t * const p_madw)
+static void pi_rcv_process_set(IN osm_sm_t * sm, IN osm_node_t * p_node,
+			       IN uint8_t port_num, IN osm_madw_t * p_madw)
 {
 	osm_physp_t *p_physp;
 	ib_net64_t port_guid;
@@ -475,7 +445,7 @@ osm_pi_rcv_process_set(IN osm_sm_t * sm, IN osm_node_t * const p_node,
 	port_guid = osm_physp_get_port_guid(p_physp);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_pi = (ib_port_info_t *) ib_smp_get_payload_ptr(p_smp);
+	p_pi = ib_smp_get_payload_ptr(p_smp);
 
 	/* check for error */
 	if (cl_ntoh16(p_smp->status) & 0x7fff) {
@@ -492,9 +462,8 @@ osm_pi_rcv_process_set(IN osm_sm_t * sm, IN osm_node_t * const p_node,
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0F10: "
 				"Received error status for SetResp()\n");
 		}
-		osm_dump_port_info(sm->p_log,
-				   osm_node_get_node_guid(p_node),
-				   port_guid, port_num, p_pi, level);
+		osm_dump_port_info_v2(sm->p_log, osm_node_get_node_guid(p_node),
+				      port_guid, port_num, p_pi, FILE_ID, level);
 	}
 
 	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
@@ -506,13 +475,11 @@ osm_pi_rcv_process_set(IN osm_sm_t * sm, IN osm_node_t * const p_node,
 		cl_ntoh64(osm_node_get_node_guid(p_node)),
 		cl_ntoh64(p_smp->trans_id));
 
-	osm_physp_set_port_info(p_physp, p_pi);
+	osm_physp_set_port_info(p_physp, p_pi, sm);
 
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_pi_rcv_process(IN void *context, IN void *data)
 {
 	osm_sm_t *sm = context;
@@ -524,8 +491,7 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 	osm_dr_path_t *p_dr_path;
 	osm_node_t *p_node;
 	osm_pi_context_t *p_context;
-	ib_net64_t port_guid;
-	ib_net64_t node_guid;
+	ib_net64_t port_guid, node_guid;
 	uint8_t port_num;
 
 	OSM_LOG_ENTER(sm->p_log);
@@ -535,7 +501,7 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 	p_context = osm_madw_get_pi_context_ptr(p_madw);
-	p_pi = (ib_port_info_t *) ib_smp_get_payload_ptr(p_smp);
+	p_pi = ib_smp_get_payload_ptr(p_smp);
 
 	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_PORT_INFO);
 
@@ -544,8 +510,8 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 	port_guid = p_context->port_guid;
 	node_guid = p_context->node_guid;
 
-	osm_dump_port_info(sm->p_log,
-			   node_guid, port_guid, port_num, p_pi, OSM_LOG_DEBUG);
+	osm_dump_port_info_v2(sm->p_log, node_guid, port_guid, port_num, p_pi,
+			      FILE_ID, OSM_LOG_DEBUG);
 
 	/* On receipt of client reregister, clear the reregister bit so
 	   reregistering won't be sent again and again */
@@ -600,9 +566,8 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 	   boolean around to determine if we were doing Get() or Set().
 	 */
 	if (p_context->set_method)
-		osm_pi_rcv_process_set(sm, p_node, port_num, p_madw);
+		pi_rcv_process_set(sm, p_node, port_num, p_madw);
 	else {
-		p_port->discovery_count++;
 
 		/*
 		   This PortInfo arrived because we did a Get() method,
@@ -617,31 +582,13 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 
 		p_physp = osm_node_get_physp_ptr(p_node, port_num);
 
-		/*
-		   Determine if we encountered a new Physical Port.
-		   If so, initialize the new Physical Port then
-		   continue processing as normal.
-		 */
-		if (!p_physp) {
-			OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-				"Initializing port number %u\n", port_num);
-			p_physp = &p_node->physp_table[port_num];
-			osm_physp_init(p_physp,
-				       port_guid,
-				       port_num,
-				       p_node,
-				       osm_madw_get_bind_handle(p_madw),
-				       p_smp->hop_count, p_smp->initial_path);
-		} else {
-			/*
-			   Update the directed route path to this port
-			   in case the old path is no longer usable.
-			 */
-			p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
-			osm_dr_path_init(p_dr_path,
-					 osm_madw_get_bind_handle(p_madw),
-					 p_smp->hop_count, p_smp->initial_path);
-		}
+		CL_ASSERT(p_physp);
+
+		/* Update the directed route path to this port
+		   in case the old path is no longer usable. */
+		p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
+		osm_dr_path_init(p_dr_path, p_smp->hop_count,
+				 p_smp->initial_path);
 
 		/* if port just inited or reached INIT state (external reset)
 		   request update for port related tables */
@@ -652,13 +599,14 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 		switch (osm_node_get_type(p_node)) {
 		case IB_NODE_TYPE_CA:
 		case IB_NODE_TYPE_ROUTER:
-			__osm_pi_rcv_process_ca_or_router_port(sm,
-							       p_node, p_physp,
-							       p_pi);
+			p_port->discovery_count++;
+			pi_rcv_process_ca_or_router_port(sm, p_node, p_physp,
+							 p_pi);
 			break;
 		case IB_NODE_TYPE_SWITCH:
-			__osm_pi_rcv_process_switch_port(sm,
-							 p_node, p_physp, p_pi);
+			if (port_num == 0)
+				p_port->discovery_count++;
+			pi_rcv_process_switch_port(sm, p_node, p_physp, p_pi);
 			break;
 		default:
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0F07: "
@@ -672,8 +620,7 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 		   Get the tables on the physp.
 		 */
 		if (p_physp->need_update || sm->p_subn->need_update)
-			__osm_pi_rcv_get_pkey_slvl_vla_tables(sm, p_node,
-							      p_physp);
+			pi_rcv_get_pkey_slvl_vla_tables(sm, p_node, p_physp);
 
 	}
 
diff --git a/opensm/osm_prtn.c b/opensm/osm_prtn.c
index be51410..b4ee965 100644
--- a/opensm/osm_prtn.c
+++ b/opensm/osm_prtn.c
@@ -1,5 +1,6 @@
 /*
- * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2012 Mellanox Technologies LTD. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -48,19 +49,22 @@
 #include <sys/stat.h>
 #include <complib/cl_debug.h>
 #include <iba/ib_types.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_PRTN_C
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_partition.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_sa.h>
 #include <opensm/osm_multicast.h>
+#include <arpa/inet.h>
+#include <errno.h>
 
-extern int osm_prtn_config_parse_file(osm_log_t * const p_log,
-				      osm_subn_t * const p_subn,
+extern int osm_prtn_config_parse_file(osm_log_t * p_log, osm_subn_t * p_subn,
 				      const char *file_name);
 
 static uint16_t global_pkey_counter;
 
-osm_prtn_t *osm_prtn_new(IN const char *name, IN const uint16_t pkey)
+osm_prtn_t *osm_prtn_new(IN const char *name, IN uint16_t pkey)
 {
 	osm_prtn_t *p = malloc(sizeof(*p));
 	if (!p)
@@ -69,6 +73,8 @@ osm_prtn_t *osm_prtn_new(IN const char *name, IN const uint16_t pkey)
 	memset(p, 0, sizeof(*p));
 	p->pkey = pkey;
 	p->sl = OSM_DEFAULT_SL;
+	p->mgrps = NULL;
+	p->nmgrps = 0;
 	cl_map_construct(&p->full_guid_tbl);
 	cl_map_init(&p->full_guid_tbl, 32);
 	cl_map_construct(&p->part_guid_tbl);
@@ -82,14 +88,35 @@ osm_prtn_t *osm_prtn_new(IN const char *name, IN const uint16_t pkey)
 	return p;
 }
 
-void osm_prtn_delete(IN OUT osm_prtn_t ** const pp_prtn)
+void osm_prtn_delete(IN osm_subn_t * p_subn, IN OUT osm_prtn_t ** pp_prtn)
 {
+	char gid_str[INET6_ADDRSTRLEN];
+	int i = 0;
 	osm_prtn_t *p = *pp_prtn;
 
 	cl_map_remove_all(&p->full_guid_tbl);
 	cl_map_destroy(&p->full_guid_tbl);
 	cl_map_remove_all(&p->part_guid_tbl);
 	cl_map_destroy(&p->part_guid_tbl);
+
+	if (p->mgrps) {
+		/* Clean up mgrps */
+		for (i = 0; i < p->nmgrps; i++) {
+			/* osm_mgrp_cleanup will not delete
+			 * "well_known" groups */
+			p->mgrps[i]->well_known = FALSE;
+			osm_mgrp_cleanup(p_subn, p->mgrps[i]);
+			OSM_LOG(&p_subn->p_osm->log, OSM_LOG_DEBUG,
+				"removing mgroup %s from partition (0x%x)\n",
+				inet_ntop(AF_INET6,
+					  p->mgrps[i]->mcmember_rec.mgid.raw,
+					  gid_str, sizeof gid_str),
+				cl_hton16(p->pkey));
+		}
+
+		free(p->mgrps);
+	}
+
 	free(p);
 	*pp_prtn = NULL;
 }
@@ -118,16 +145,24 @@ ib_api_status_t osm_prtn_add_port(osm_log_t * p_log, osm_subn_t * p_subn,
 		return status;
 	}
 
-	if (cl_map_remove(&p->part_guid_tbl, guid) ||
-	    cl_map_remove(&p->full_guid_tbl, guid)) {
-		OSM_LOG(p_log, OSM_LOG_VERBOSE,
-			"port 0x%" PRIx64 " already in "
-			"partition \'%s\' (0x%04x). Will overwrite\n",
-			cl_ntoh64(guid), p->name, cl_ntoh16(p->pkey));
-	}
-
 	p_tbl = (full == TRUE) ? &p->full_guid_tbl : &p->part_guid_tbl;
 
+	if (p_subn->opt.allow_both_pkeys) {
+		if (cl_map_remove(p_tbl, guid))
+			OSM_LOG(p_log, OSM_LOG_ERROR, "port 0x%" PRIx64
+				" already in partition \'%s\' (0x%04x) full %d."
+				" Will overwrite\n",
+				cl_ntoh64(guid), p->name, cl_ntoh16(p->pkey),
+				full);
+	} else {
+		if (cl_map_remove(&p->part_guid_tbl, guid) ||
+		    cl_map_remove(&p->full_guid_tbl, guid))
+			OSM_LOG(p_log, OSM_LOG_VERBOSE, "port 0x%" PRIx64
+				" already in partition \'%s\' (0x%04x)."
+				" Will overwrite\n",
+				cl_ntoh64(guid), p->name, cl_ntoh16(p->pkey));
+	}
+
 	if (cl_map_insert(p_tbl, guid, p_physp) == NULL)
 		return IB_INSUFFICIENT_MEMORY;
 
@@ -135,7 +170,7 @@ ib_api_status_t osm_prtn_add_port(osm_log_t * p_log, osm_subn_t * p_subn,
 }
 
 ib_api_status_t osm_prtn_add_all(osm_log_t * p_log, osm_subn_t * p_subn,
-				 osm_prtn_t * p, boolean_t full)
+				 osm_prtn_t * p, unsigned type, boolean_t full)
 {
 	cl_qmap_t *p_port_tbl = &p_subn->port_guid_tbl;
 	cl_map_item_t *p_item;
@@ -146,53 +181,66 @@ ib_api_status_t osm_prtn_add_all(osm_log_t * p_log, osm_subn_t * p_subn,
 	while (p_item != cl_qmap_end(p_port_tbl)) {
 		p_port = (osm_port_t *) p_item;
 		p_item = cl_qmap_next(p_item);
-		status = osm_prtn_add_port(p_log, p_subn, p,
-					   osm_port_get_guid(p_port), full);
-		if (status != IB_SUCCESS)
-			goto _err;
+		if (!type || osm_node_get_type(p_port->p_node) == type) {
+			status = osm_prtn_add_port(p_log, p_subn, p,
+						   osm_port_get_guid(p_port),
+						   full);
+			if (status != IB_SUCCESS)
+				goto _err;
+		}
 	}
 
 _err:
 	return status;
 }
 
-static const ib_gid_t osm_ipoib_mgid = {
-	{
-	 0xff,			/*  multicast field */
-	 0x12,			/*  non-permanent bit, link local scope */
-	 0x40, 0x1b,		/*  IPv4 signature */
-	 0xff, 0xff,		/*  16 bits of P_Key (to be filled in) */
-	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,	/*  48 bits of zeros */
-	 0xff, 0xff, 0xff, 0xff,	/*  32 bit IPv4 broadcast address */
-	 },
-};
+static ib_api_status_t
+track_mgrp_w_partition(osm_log_t *p_log, osm_prtn_t *p, osm_mgrp_t *mgrp,
+			osm_subn_t *p_subn, const ib_gid_t *mgid,
+			ib_net16_t pkey)
+{
+	char gid_str[INET6_ADDRSTRLEN];
+	osm_mgrp_t **tmp;
+	int i = 0;
+
+	/* check if we are already tracking this group */
+	for (i = 0; i< p->nmgrps; i++)
+		if (p->mgrps[i] == mgrp)
+			return (IB_SUCCESS);
+
+	/* otherwise add it to our list */
+	tmp = realloc(p->mgrps, (p->nmgrps +1) * sizeof(*p->mgrps));
+	if (tmp) {
+		p->mgrps = tmp;
+		p->mgrps[p->nmgrps] = mgrp;
+		p->nmgrps++;
+	} else {
+		OSM_LOG(p_log, OSM_LOG_ERROR,
+			"realloc error to create MC group (%s) in "
+			"partition (pkey 0x%04x)\n",
+			inet_ntop(AF_INET6, mgid->raw,
+				  gid_str, sizeof gid_str),
+			cl_ntoh16(pkey));
+		mgrp->well_known = FALSE;
+		osm_mgrp_cleanup(p_subn, mgrp);
+		return (IB_ERROR);
+	}
+	mgrp->well_known = TRUE;
+	return (IB_SUCCESS);
+}
 
-/*
- * HACK: Until TS resolves their noncompliant join compmask,
- * we have to pre-define the MGID
- */
-static const ib_gid_t osm_ts_ipoib_mgid = {
-	{
-	 0xff,			/*  multicast field */
-	 0x12,			/*  non-permanent bit, link local scope */
-	 0x40, 0x1b,		/*  IPv4 signature */
-	 0xff, 0xff,		/*  16 bits of P_Key (to be filled in) */
-	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,	/*  48 bits of zeros */
-	 0x00, 0x00, 0x00, 0x01,	/*  32 bit IPv4 broadcast address */
-	 },
-};
-
-ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log,
-				     osm_subn_t * p_subn, osm_prtn_t * p,
-				     uint8_t rate,
-				     uint8_t mtu, uint8_t scope)
+ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log, osm_subn_t * p_subn,
+				     osm_prtn_t * p, uint8_t rate, uint8_t mtu,
+				     uint8_t sl, uint8_t scope, uint32_t Q_Key,
+				     uint8_t tclass, uint32_t FlowLabel,
+				     const ib_gid_t *mgid)
 {
+	char gid_str[INET6_ADDRSTRLEN];
 	ib_member_rec_t mc_rec;
 	ib_net64_t comp_mask;
 	ib_net16_t pkey;
-	osm_mgrp_t *p_mgrp = NULL;
+	osm_mgrp_t *mgrp;
 	osm_sa_t *p_sa = &p_subn->p_osm->sa;
-	ib_api_status_t status = IB_SUCCESS;
 	uint8_t hop_limit;
 
 	pkey = p->pkey | cl_hton16(0x8000);
@@ -202,54 +250,36 @@ ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log,
 
 	memset(&mc_rec, 0, sizeof(mc_rec));
 
-	mc_rec.mgid = osm_ipoib_mgid;	/* ipv4 broadcast group */
-	memcpy(&mc_rec.mgid.raw[4], &pkey, sizeof(pkey));
+	mc_rec.mgid = *mgid;
 
-	mc_rec.qkey = CL_HTON32(0x0b1b);
-	mc_rec.mtu = (mtu ? mtu : OSM_DEFAULT_MGRP_MTU) | (2 << 6);	/* 2048 Bytes */
-	mc_rec.tclass = 0;
+	mc_rec.qkey = CL_HTON32(Q_Key);
+	mc_rec.mtu = mtu | (2 << 6);
+	mc_rec.tclass = tclass;
 	mc_rec.pkey = pkey;
-	mc_rec.rate = (rate ? rate : OSM_DEFAULT_MGRP_RATE) | (2 << 6);	/* 10Gb/sec */
+	mc_rec.rate = rate | (2 << 6);
 	mc_rec.pkt_life = p_subn->opt.subnet_timeout;
-	mc_rec.sl_flow_hop = ib_member_set_sl_flow_hop(p->sl, 0, hop_limit);
+	mc_rec.sl_flow_hop = ib_member_set_sl_flow_hop(sl, FlowLabel, hop_limit);
 	/* Scope in MCMemberRecord (if present) needs to be consistent with MGID */
-	mc_rec.scope_state = ib_member_set_scope_state(scope, IB_MC_REC_STATE_FULL_MEMBER);
+	mc_rec.scope_state =
+	    ib_member_set_scope_state(scope, IB_MC_REC_STATE_FULL_MEMBER);
 	ib_mgid_set_scope(&mc_rec.mgid, scope);
 
 	/* don't update rate, mtu */
 	comp_mask = IB_MCR_COMPMASK_MTU | IB_MCR_COMPMASK_MTU_SEL |
 	    IB_MCR_COMPMASK_RATE | IB_MCR_COMPMASK_RATE_SEL;
-	status = osm_mcmr_rcv_find_or_create_new_mgrp(p_sa, comp_mask, &mc_rec,
-						      &p_mgrp);
-	if (!p_mgrp || status != IB_SUCCESS)
+	mgrp = osm_mcmr_rcv_find_or_create_new_mgrp(p_sa, comp_mask, &mc_rec);
+	if (!mgrp) {
 		OSM_LOG(p_log, OSM_LOG_ERROR,
-			"Failed to create MC group with pkey 0x%04x\n",
+			"Failed to create MC group (%s) with pkey 0x%04x\n",
+			inet_ntop(AF_INET6, mgid->raw, gid_str, sizeof gid_str),
 			cl_ntoh16(pkey));
-	if (p_mgrp) {
-		p_mgrp->well_known = TRUE;
-		p->mlid = p_mgrp->mlid;
-	}
-
-	/* workaround for TS */
-	/* FIXME: remove this upon TS fixes */
-	mc_rec.mgid = osm_ts_ipoib_mgid;
-	memcpy(&mc_rec.mgid.raw[4], &pkey, sizeof(pkey));
-	/* Scope in MCMemberRecord (if present) needs to be consistent with MGID */
-	mc_rec.scope_state = ib_member_set_scope_state(scope, IB_MC_REC_STATE_FULL_MEMBER);
-	ib_mgid_set_scope(&mc_rec.mgid, scope);
-
-	status = osm_mcmr_rcv_find_or_create_new_mgrp(p_sa, comp_mask, &mc_rec,
-						      &p_mgrp);
-	if (p_mgrp) {
-		p_mgrp->well_known = TRUE;
-		if (!p->mlid)
-			p->mlid = p_mgrp->mlid;
+		return IB_ERROR;
 	}
 
-	return status;
+	return (track_mgrp_w_partition(p_log, p, mgrp, p_subn, mgid, pkey));
 }
 
-static uint16_t __generate_pkey(osm_subn_t * p_subn)
+static uint16_t generate_pkey(osm_subn_t * p_subn)
 {
 	uint16_t pkey;
 
@@ -285,11 +315,10 @@ osm_prtn_t *osm_prtn_make_new(osm_log_t * p_log, osm_subn_t * p_subn,
 	osm_prtn_t *p = NULL, *p_check;
 
 	pkey &= cl_hton16((uint16_t) ~ 0x8000);
-
 	if (!pkey) {
 		if (name && (p = osm_prtn_find_by_name(p_subn, name)))
 			return p;
-		if (!(pkey = __generate_pkey(p_subn)))
+		if (!(pkey = generate_pkey(p_subn)))
 			return NULL;
 	}
 
@@ -307,16 +336,15 @@ osm_prtn_t *osm_prtn_make_new(osm_log_t * p_log, osm_subn_t * p_subn,
 			" definition: \'%s\' (0x%04x) prev name \'%s\'"
 			".  Will use it\n",
 			name, cl_ntoh16(pkey), p_check->name);
-		osm_prtn_delete(&p);
+		osm_prtn_delete(p_subn, &p);
 		p = p_check;
 	}
 
 	return p;
 }
 
-static ib_api_status_t osm_prtn_make_default(osm_log_t * const p_log,
-					     osm_subn_t * const p_subn,
-					     boolean_t no_config)
+static ib_api_status_t prtn_make_default(osm_log_t * p_log, osm_subn_t * p_subn,
+					 boolean_t no_config)
 {
 	ib_api_status_t status = IB_UNKNOWN_ERROR;
 	osm_prtn_t *p;
@@ -325,22 +353,25 @@ static ib_api_status_t osm_prtn_make_default(osm_log_t * const p_log,
 			      IB_DEFAULT_PARTIAL_PKEY);
 	if (!p)
 		goto _err;
-	status = osm_prtn_add_all(p_log, p_subn, p, no_config);
+	status = osm_prtn_add_all(p_log, p_subn, p, 0, no_config);
 	if (status != IB_SUCCESS)
 		goto _err;
 	cl_map_remove(&p->part_guid_tbl, p_subn->sm_port_guid);
 	status =
 	    osm_prtn_add_port(p_log, p_subn, p, p_subn->sm_port_guid, TRUE);
 
+	/* ipv4 broadcast group */
 	if (no_config)
-		osm_prtn_add_mcgroup(p_log, p_subn, p, 0, 0, 0);
+		osm_prtn_add_mcgroup(p_log, p_subn, p, OSM_DEFAULT_MGRP_RATE,
+				     OSM_DEFAULT_MGRP_MTU, OSM_DEFAULT_SL,
+				     0, OSM_IPOIB_BROADCAST_MGRP_QKEY, 0, 0,
+				     &osm_ipoib_broadcast_mgid);
 
 _err:
 	return status;
 }
 
-ib_api_status_t osm_prtn_make_partitions(osm_log_t * const p_log,
-					 osm_subn_t * const p_subn)
+ib_api_status_t osm_prtn_make_partitions(osm_log_t * p_log, osm_subn_t * p_subn)
 {
 	struct stat statbuf;
 	const char *file_name;
@@ -351,8 +382,12 @@ ib_api_status_t osm_prtn_make_partitions(osm_log_t * const p_log,
 
 	file_name = p_subn->opt.partition_config_file ?
 	    p_subn->opt.partition_config_file : OSM_DEFAULT_PARTITION_CONFIG_FILE;
-	if (stat(file_name, &statbuf))
+	if (stat(file_name, &statbuf)) {
+		OSM_LOG(p_log, OSM_LOG_ERROR, "Partition configuration "
+			"%s is not accessible (%s)\n", file_name,
+			strerror(errno));
 		is_config = FALSE;
+	}
 
 	/* clean up current port maps */
 	p_next = cl_qmap_head(&p_subn->prtn_pkey_tbl);
@@ -365,14 +400,13 @@ ib_api_status_t osm_prtn_make_partitions(osm_log_t * const p_log,
 
 	global_pkey_counter = 0;
 
-	status = osm_prtn_make_default(p_log, p_subn, !is_config);
+	status = prtn_make_default(p_log, p_subn, !is_config);
 	if (status != IB_SUCCESS)
 		goto _err;
 
-	if (is_config && osm_prtn_config_parse_file(p_log, p_subn, file_name)) {
+	if (is_config && osm_prtn_config_parse_file(p_log, p_subn, file_name))
 		OSM_LOG(p_log, OSM_LOG_VERBOSE, "Partition configuration "
 			"was not fully processed\n");
-	}
 
 	/* and now clean up empty partitions */
 	p_next = cl_qmap_head(&p_subn->prtn_pkey_tbl);
@@ -383,7 +417,7 @@ ib_api_status_t osm_prtn_make_partitions(osm_log_t * const p_log,
 		    cl_map_count(&p->full_guid_tbl) == 0) {
 			cl_qmap_remove_item(&p_subn->prtn_pkey_tbl,
 					    (cl_map_item_t *) p);
-			osm_prtn_delete(&p);
+			osm_prtn_delete(p_subn, &p);
 		}
 	}
 
diff --git a/opensm/osm_prtn_config.c b/opensm/osm_prtn_config.c
index 9511608..8714eba 100644
--- a/opensm/osm_prtn_config.c
+++ b/opensm/osm_prtn_config.c
@@ -1,5 +1,6 @@
 /*
- * Copyright (c) 2006-2007 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2012 Mellanox Technologies LTD. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -47,37 +48,173 @@
 #include <ctype.h>
 
 #include <iba/ib_types.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_PRTN_CONFIG_C
 #include <opensm/osm_base.h>
 #include <opensm/osm_partition.h>
 #include <opensm/osm_subnet.h>
 #include <opensm/osm_log.h>
+#include <arpa/inet.h>
+
+typedef enum {
+	LIMITED,
+	FULL,
+	BOTH
+} membership_t;
+
+const ib_gid_t osm_ipoib_broadcast_mgid = {
+	{
+	 0xff,			/*  multicast field */
+	 0x12,			/*  non-permanent bit, link local scope */
+	 0x40, 0x1b,		/*  IPv4 signature */
+	 0xff, 0xff,		/*  16 bits of P_Key (to be filled in) */
+	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,	/*  48 bits of zeros */
+	 0xff, 0xff, 0xff, 0xff,	/*  32 bit IPv4 broadcast address */
+	 },
+};
+
+struct group_flags {
+	unsigned mtu, rate, sl, scope_mask;
+	uint32_t Q_Key;
+	uint8_t TClass;
+	uint32_t FlowLabel;
+};
+
+struct precreate_mgroup {
+	ib_gid_t mgid;
+	struct group_flags flags;
+};
 
 struct part_conf {
 	osm_log_t *p_log;
 	osm_subn_t *p_subn;
 	osm_prtn_t *p_prtn;
-	unsigned is_ipoib, mtu, rate, sl, scope_mask;
-	boolean_t full;
+	unsigned is_ipoib;
+	struct group_flags flags;
+	membership_t membership;
 };
 
 extern osm_prtn_t *osm_prtn_make_new(osm_log_t * p_log, osm_subn_t * p_subn,
 				     const char *name, uint16_t pkey);
-extern ib_api_status_t osm_prtn_add_all(osm_log_t * p_log,
-					osm_subn_t * p_subn,
-					osm_prtn_t * p, boolean_t full);
+extern ib_api_status_t osm_prtn_add_all(osm_log_t * p_log, osm_subn_t * p_subn,
+					osm_prtn_t * p, unsigned type,
+					boolean_t full);
 extern ib_api_status_t osm_prtn_add_port(osm_log_t * p_log,
 					 osm_subn_t * p_subn, osm_prtn_t * p,
 					 ib_net64_t guid, boolean_t full);
-extern ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log,
-					    osm_subn_t * p_subn, osm_prtn_t * p,
-					    uint8_t rate,
-					    uint8_t mtu, uint8_t scope);
+
+ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log, osm_subn_t * p_subn,
+				     osm_prtn_t * p, uint8_t rate, uint8_t mtu,
+				     uint8_t sl, uint8_t scope, uint32_t Q_Key,
+				     uint8_t TClass, uint32_t FlowLabel,
+				     const ib_gid_t *mgid);
+
+
+static inline boolean_t mgid_is_broadcast(const ib_gid_t *mgid)
+{
+	return (memcmp(mgid, &osm_ipoib_broadcast_mgid,
+			sizeof(osm_ipoib_broadcast_mgid)) == 0);
+}
+
+static inline boolean_t mgid_is_ip(const ib_gid_t *mgid)
+{
+	ib_net16_t ipsig = *(ib_net16_t *)&mgid->raw[2];
+	return (ipsig == cl_hton16(0x401b) || ipsig == cl_hton16(0x601b));
+}
+
+static inline boolean_t ip_mgroup_pkey_ok(struct part_conf *conf,
+				struct precreate_mgroup *group)
+{
+	ib_net16_t mpkey = *(ib_net16_t *)&group->mgid.raw[4];
+	char gid_str[INET6_ADDRSTRLEN];
+
+	if (mgid_is_broadcast(&group->mgid)
+	    /* user requested "wild card" of pkey */
+	    || mpkey == 0x0000
+	    /* user was smart enough to match */
+	    || mpkey == (conf->p_prtn->pkey | cl_hton16(0x8000)))
+		return (TRUE);
+
+	OSM_LOG(conf->p_log, OSM_LOG_ERROR,
+		"IP MC group (%s) specified with invalid pkey 0x%04x "
+		"for partition pkey = 0x%04x (%s)\n",
+		inet_ntop(AF_INET6, group->mgid.raw, gid_str, sizeof gid_str),
+		cl_ntoh16(mpkey), cl_ntoh16(conf->p_prtn->pkey), conf->p_prtn->name);
+	return (FALSE);
+}
+
+static inline boolean_t ip_mgroup_rate_ok(struct part_conf *conf,
+				struct precreate_mgroup *group)
+{
+	char gid_str[INET6_ADDRSTRLEN];
+
+	if (group->flags.rate == conf->flags.rate)
+		return (TRUE);
+
+	OSM_LOG(conf->p_log, OSM_LOG_ERROR,
+		"IP MC group (%s) specified with invalid rate (%d): "
+		"partition pkey = 0x%04x (%s) "
+		"[Partition broadcast group rate = %d]\n",
+		inet_ntop(AF_INET6, group->mgid.raw, gid_str, sizeof gid_str),
+		group->flags.rate, cl_ntoh16(conf->p_prtn->pkey),
+		conf->p_prtn->name, conf->flags.rate);
+	return (FALSE);
+}
+
+static inline boolean_t ip_mgroup_mtu_ok(struct part_conf *conf,
+				struct precreate_mgroup *group)
+{
+	char gid_str[INET6_ADDRSTRLEN];
+
+	if (group->flags.mtu == conf->flags.mtu)
+		return (TRUE);
+
+	OSM_LOG(conf->p_log, OSM_LOG_ERROR,
+		"IP MC group (%s) specified with invalid mtu (%d): "
+		"partition pkey = 0x%04x (%s) "
+		"[Partition broadcast group mtu = %d]\n",
+		inet_ntop(AF_INET6, group->mgid.raw, gid_str, sizeof gid_str),
+		group->flags.mtu, cl_ntoh16(conf->p_prtn->pkey),
+		conf->p_prtn->name, conf->flags.mtu);
+	return (FALSE);
+}
+
+static void __create_mgrp(struct part_conf *conf, struct precreate_mgroup *group)
+{
+	unsigned int scope;
+
+	if (!group->flags.scope_mask) {
+		osm_prtn_add_mcgroup(conf->p_log, conf->p_subn, conf->p_prtn,
+				     (uint8_t) group->flags.rate,
+				     (uint8_t) group->flags.mtu,
+				     group->flags.sl,
+				     0,
+				     group->flags.Q_Key,
+				     group->flags.TClass,
+				     group->flags.FlowLabel,
+				     &group->mgid);
+	} else {
+		for (scope = 0; scope < 16; scope++) {
+			if (((1<<scope) & group->flags.scope_mask) == 0)
+				continue;
+
+			osm_prtn_add_mcgroup(conf->p_log, conf->p_subn, conf->p_prtn,
+					     (uint8_t)group->flags.rate,
+					     (uint8_t)group->flags.mtu,
+					     (uint8_t)group->flags.sl,
+					     (uint8_t)scope,
+					     group->flags.Q_Key,
+					     group->flags.TClass,
+					     group->flags.FlowLabel,
+					     &group->mgid);
+		}
+	}
+}
 
 static int partition_create(unsigned lineno, struct part_conf *conf,
 			    char *name, char *id, char *flag, char *flag_val)
 {
-	uint16_t pkey;
-	unsigned int scope;
+	ib_net16_t pkey;
 
 	if (!id && name && isdigit(*name)) {
 		id = name;
@@ -87,97 +224,149 @@ static int partition_create(unsigned lineno, struct part_conf *conf,
 	if (id) {
 		char *end;
 
-		pkey = (uint16_t) strtoul(id, &end, 0);
+		pkey = cl_hton16((uint16_t)strtoul(id, &end, 0));
 		if (end == id || *end)
 			return -1;
 	} else
 		pkey = 0;
 
 	conf->p_prtn = osm_prtn_make_new(conf->p_log, conf->p_subn,
-					 name, cl_hton16(pkey));
+					 name, pkey);
 	if (!conf->p_prtn)
 		return -1;
 
-	if (!conf->p_subn->opt.qos && conf->sl != OSM_DEFAULT_SL) {
+	if (!conf->p_subn->opt.qos && conf->flags.sl != OSM_DEFAULT_SL) {
 		OSM_LOG(conf->p_log, OSM_LOG_DEBUG, "Overriding SL %d"
 			" to default SL %d on partition %s"
 			" as QoS is not enabled.\n",
-			conf->sl, OSM_DEFAULT_SL, name);
-		conf->sl = OSM_DEFAULT_SL;
+			conf->flags.sl, OSM_DEFAULT_SL, name);
+		conf->flags.sl = OSM_DEFAULT_SL;
 	}
-	conf->p_prtn->sl = (uint8_t) conf->sl;
-
-	if (!conf->is_ipoib)
-		return 0;
-
-	if (!conf->scope_mask) {
-		osm_prtn_add_mcgroup(conf->p_log, conf->p_subn, conf->p_prtn,
-				     (uint8_t) conf->rate,
-				     (uint8_t) conf->mtu,
-				     0);
-		return 0;
+	conf->p_prtn->sl = (uint8_t) conf->flags.sl;
+
+	if (conf->is_ipoib) {
+		struct precreate_mgroup broadcast_mgroup;
+		memset(&broadcast_mgroup, 0, sizeof(broadcast_mgroup));
+		broadcast_mgroup.mgid = osm_ipoib_broadcast_mgid;
+		pkey |= cl_hton16(0x8000);
+		memcpy(&broadcast_mgroup.mgid.raw[4], &pkey , sizeof(pkey));
+		broadcast_mgroup.flags.mtu = conf->flags.mtu;
+		broadcast_mgroup.flags.rate = conf->flags.rate;
+		broadcast_mgroup.flags.sl = conf->flags.sl;
+		broadcast_mgroup.flags.Q_Key = conf->flags.Q_Key ?
+						conf->flags.Q_Key :
+						OSM_IPOIB_BROADCAST_MGRP_QKEY;
+		broadcast_mgroup.flags.TClass = conf->flags.TClass;
+		broadcast_mgroup.flags.FlowLabel = conf->flags.FlowLabel;
+		__create_mgrp(conf, &broadcast_mgroup);
 	}
 
-	for (scope = 0; scope < 16; scope++) {
-		if (((1<<scope) & conf->scope_mask) == 0)
-			continue;
-
-		osm_prtn_add_mcgroup(conf->p_log, conf->p_subn, conf->p_prtn,
-				     (uint8_t) conf->rate,
-				     (uint8_t) conf->mtu,
-				     (uint8_t) scope);
-	}
 	return 0;
 }
 
-static int partition_add_flag(unsigned lineno, struct part_conf *conf,
-			      char *flag, char *val)
+/* returns 1 if processed 0 if _not_ */
+static int parse_group_flag(unsigned lineno, osm_log_t * p_log,
+			    struct group_flags *flags,
+			    char *flag, char *val)
 {
+	int rc = 0;
 	int len = strlen(flag);
-	if (!strncmp(flag, "ipoib", len)) {
-		conf->is_ipoib = 1;
-	} else if (!strncmp(flag, "mtu", len)) {
-		if (!val || (conf->mtu = strtoul(val, NULL, 0)) == 0)
-			OSM_LOG(conf->p_log, OSM_LOG_VERBOSE,
+	if (!strncmp(flag, "mtu", len)) {
+		rc = 1;
+		if (!val || (flags->mtu = strtoul(val, NULL, 0)) == 0)
+			OSM_LOG(p_log, OSM_LOG_VERBOSE,
 				"PARSE WARN: line %d: "
 				"flag \'mtu\' requires valid value"
 				" - skipped\n", lineno);
 	} else if (!strncmp(flag, "rate", len)) {
-		if (!val || (conf->rate = strtoul(val, NULL, 0)) == 0)
-			OSM_LOG(conf->p_log, OSM_LOG_VERBOSE,
+		rc = 1;
+		if (!val || (flags->rate = strtoul(val, NULL, 0)) == 0)
+			OSM_LOG(p_log, OSM_LOG_VERBOSE,
 				"PARSE WARN: line %d: "
 				"flag \'rate\' requires valid value"
 				" - skipped\n", lineno);
 	} else if (!strncmp(flag, "scope", len)) {
 		unsigned int scope;
+		rc = 1;
 		if (!val || (scope = strtoul(val, NULL, 0)) == 0 || scope > 0xF)
-			OSM_LOG(conf->p_log, OSM_LOG_VERBOSE,
+			OSM_LOG(p_log, OSM_LOG_VERBOSE,
 				"PARSE WARN: line %d: "
 				"flag \'scope\' requires valid value"
 				" - skipped\n", lineno);
 		else
-			conf->scope_mask |= (1<<scope);
+			flags->scope_mask |= (1<<scope);
+	} else if (!strncmp(flag, "Q_Key", strlen(flag))) {
+		if (!val || (flags->Q_Key = strtoul(val, NULL, 0)) == 0)
+			OSM_LOG(p_log, OSM_LOG_VERBOSE,
+				"PARSE WARN: line %d: "
+				"flag \'Q_Key\' requires valid value"
+				" - using '0'\n", lineno);
+	} else if (!strncmp(flag, "TClass", strlen(flag))) {
+		if (!val || (flags->TClass = strtoul(val, NULL, 0)) == 0)
+			OSM_LOG(p_log, OSM_LOG_VERBOSE,
+				"PARSE WARN: line %d: "
+				"flag \'TClass\' requires valid value"
+				" - using '0'\n", lineno);
 	} else if (!strncmp(flag, "sl", len)) {
 		unsigned sl;
 		char *end;
+		rc = 1;
 
 		if (!val || !*val || (sl = strtoul(val, &end, 0)) > 15 ||
 		    (*end && !isspace(*end)))
-			OSM_LOG(conf->p_log, OSM_LOG_VERBOSE,
+			OSM_LOG(p_log, OSM_LOG_VERBOSE,
 				"PARSE WARN: line %d: "
 				"flag \'sl\' requires valid value"
 				" - skipped\n", lineno);
 		else
-			conf->sl = sl;
+			flags->sl = sl;
+	} else if (!strncmp(flag, "FlowLabel", len)) {
+		uint32_t FlowLabel;
+		char *end;
+		rc = 1;
+
+		if (!val || !*val ||
+		    (FlowLabel = strtoul(val, &end, 0)) > 0xFFFFF ||
+		    (*end && !isspace(*end)))
+			OSM_LOG(p_log, OSM_LOG_VERBOSE,
+				"PARSE WARN: line %d: "
+				"flag \'FlowLabel\' requires valid value"
+				" - skipped\n", lineno);
+		else
+			flags->FlowLabel = FlowLabel;
+	}
+
+	return rc;
+}
+
+static int partition_add_flag(unsigned lineno, struct part_conf *conf,
+			      char *flag, char *val)
+{
+	int len = strlen(flag);
+
+	/* ipoib gc group flags are processed here. */
+	if (parse_group_flag(lineno, conf->p_log, &conf->flags, flag, val))
+		return 0;
+
+	/* partition flags go here. */
+	if (!strncmp(flag, "ipoib", len)) {
+		conf->is_ipoib = 1;
 	} else if (!strncmp(flag, "defmember", len)) {
 		if (!val || (strncmp(val, "limited", strlen(val))
+			     && strncmp(val, "both", strlen(val))
 			     && strncmp(val, "full", strlen(val))))
 			OSM_LOG(conf->p_log, OSM_LOG_VERBOSE,
 				"PARSE WARN: line %d: "
-				"flag \'defmember\' requires valid value (limited or full)"
+				"flag \'defmember\' requires valid value (limited or full or both)"
 				" - skipped\n", lineno);
-		else
-			conf->full = strncmp(val, "full", strlen(val)) == 0;
+		else {
+			if (!strncmp(val, "full", strlen(val)))
+				conf->membership = FULL;
+			else if (!strncmp(val, "both", strlen(val)))
+				conf->membership = BOTH;
+			else
+				conf->membership = LIMITED;
+		}
 	} else {
 		OSM_LOG(conf->p_log, OSM_LOG_VERBOSE,
 			"PARSE WARN: line %d: "
@@ -187,22 +376,37 @@ static int partition_add_flag(unsigned lineno, struct part_conf *conf,
 	return 0;
 }
 
+static int partition_add_all(struct part_conf *conf, osm_prtn_t * p,
+			     unsigned type, membership_t membership)
+{
+	if (membership != LIMITED &&
+	    osm_prtn_add_all(conf->p_log, conf->p_subn, p, type, TRUE) != IB_SUCCESS)
+		return -1;
+	if ((membership == LIMITED ||
+	     (membership == BOTH && conf->p_subn->opt.allow_both_pkeys)) &&
+	    osm_prtn_add_all(conf->p_log, conf->p_subn, p, type, FALSE) != IB_SUCCESS)
+		return -1;
+	return 0;
+}
+
 static int partition_add_port(unsigned lineno, struct part_conf *conf,
 			      char *name, char *flag)
 {
 	osm_prtn_t *p = conf->p_prtn;
 	ib_net64_t guid;
-	boolean_t full = conf->full;
+	membership_t membership = conf->membership;
 
 	if (!name || !*name || !strncmp(name, "NONE", strlen(name)))
 		return 0;
 
 	if (flag) {
 		/* reset default membership to limited */
-		full = FALSE;
+		membership = LIMITED;
 		if (!strncmp(flag, "full", strlen(flag)))
-			full = TRUE;
-		else if (strncmp(flag, "limited", strlen(flag))) {
+			membership = FULL;
+		else if (!strncmp(flag, "both", strlen(flag)))
+			membership = BOTH;
+		else if (!strncmp(flag, "limited", strlen(flag))) {
 			OSM_LOG(conf->p_log, OSM_LOG_VERBOSE,
 				"PARSE WARN: line %d: "
 				"unrecognized port flag \'%s\'."
@@ -210,10 +414,17 @@ static int partition_add_port(unsigned lineno, struct part_conf *conf,
 		}
 	}
 
-	if (!strncmp(name, "ALL", strlen(name))) {
-		return osm_prtn_add_all(conf->p_log, conf->p_subn, p,
-					full) == IB_SUCCESS ? 0 : -1;
-	} else if (!strncmp(name, "SELF", strlen(name))) {
+	if (!strncmp(name, "ALL", strlen(name)))
+		return partition_add_all(conf, p, 0, membership);
+	else if (!strncmp(name, "ALL_CAS", strlen(name)))
+		return partition_add_all(conf, p, IB_NODE_TYPE_CA, membership);
+	else if (!strncmp(name, "ALL_SWITCHES", strlen(name)))
+		return partition_add_all(conf, p, IB_NODE_TYPE_SWITCH,
+					 membership);
+	else if (!strncmp(name, "ALL_ROUTERS", strlen(name)))
+		return partition_add_all(conf, p, IB_NODE_TYPE_ROUTER,
+					 membership);
+	else if (!strncmp(name, "SELF", strlen(name))) {
 		guid = cl_ntoh64(conf->p_subn->sm_port_guid);
 	} else {
 		char *end;
@@ -222,10 +433,15 @@ static int partition_add_port(unsigned lineno, struct part_conf *conf,
 			return -1;
 	}
 
-	if (osm_prtn_add_port(conf->p_log, conf->p_subn, p,
-			      cl_hton64(guid), full) != IB_SUCCESS)
+	if (membership != LIMITED &&
+	    osm_prtn_add_port(conf->p_log, conf->p_subn, p,
+			      cl_hton64(guid), TRUE) != IB_SUCCESS)
+		return -1;
+	if ((membership == LIMITED ||
+	    (membership == BOTH && conf->p_subn->opt.allow_both_pkeys)) &&
+	    osm_prtn_add_port(conf->p_log, conf->p_subn, p,
+			      cl_hton64(guid), FALSE) != IB_SUCCESS)
 		return -1;
-
 	return 0;
 }
 
@@ -279,6 +495,87 @@ static int parse_name_token(char *str, char **name, char **val)
 	return len;
 }
 
+static int parse_mgroup_flags(osm_log_t * p_log,
+				struct precreate_mgroup *mgroup,
+				char *p, unsigned lineno)
+{
+	int ret, len = 0;
+	char *flag, *val, *q;
+	do {
+		flag = val = NULL;
+		q = strchr(p, ',');
+		if (q)
+			*q++ = '\0';
+
+		ret = parse_name_token(p, &flag, &val);
+
+		if (!parse_group_flag(lineno, p_log, &mgroup->flags,
+				     flag, val)) {
+			OSM_LOG(p_log, OSM_LOG_VERBOSE,
+				"PARSE WARN: line %d: "
+				"unrecognized mgroup flag \'%s\'"
+				" - ignored\n", lineno, flag);
+		}
+		p += ret;
+		len += ret;
+	} while (q);
+
+	return (len);
+}
+
+static int mgroup_create(char *p, char *mgid, unsigned lineno, struct part_conf *conf)
+{
+	int ret = 0;
+	struct precreate_mgroup mgroup;
+
+	memset(&mgroup, 0, sizeof(mgroup));
+
+	if (inet_pton(AF_INET6, mgid, &mgroup.mgid) != 1
+	    || mgroup.mgid.raw[0] != 0xff) {
+		OSM_LOG(conf->p_log, OSM_LOG_ERROR,
+			"PARSE ERROR partition conf file line %d: "
+			"mgid \"%s\": gid is not multicast\n", lineno, mgid);
+		return 0;
+	}
+
+	/* inherit partition flags */
+	mgroup.flags.mtu = conf->flags.mtu;
+	mgroup.flags.rate = conf->flags.rate;
+	mgroup.flags.sl = conf->flags.sl;
+	mgroup.flags.Q_Key = conf->flags.Q_Key;
+	mgroup.flags.FlowLabel = conf->flags.FlowLabel;
+	mgroup.flags.scope_mask = conf->flags.scope_mask;
+
+	/* override with user specified flags */
+	ret = parse_mgroup_flags(conf->p_log, &mgroup, p, lineno);
+
+	/* check/verify special IP group parameters */
+	if (mgid_is_ip(&mgroup.mgid)) {
+		ib_net16_t pkey = conf->p_prtn->pkey | cl_hton16(0x8000);
+
+		if (!ip_mgroup_pkey_ok(conf, &mgroup)
+		    || !ip_mgroup_rate_ok(conf, &mgroup)
+		    || !ip_mgroup_mtu_ok(conf, &mgroup))
+			goto error;
+
+		/* set special IP settings */
+		memcpy(&mgroup.mgid.raw[4], &pkey, sizeof(pkey));
+
+		if (mgroup.flags.Q_Key == 0)
+			mgroup.flags.Q_Key = OSM_IPOIB_BROADCAST_MGRP_QKEY;
+	}
+
+	/* don't create multiple copies of the group */
+	if (osm_get_mgrp_by_mgid(conf->p_subn, &mgroup.mgid))
+		goto error;
+
+	/* create the group */
+	__create_mgrp(conf, &mgroup);
+
+error:
+	return ret;
+}
+
 static struct part_conf *new_part_conf(osm_log_t * p_log, osm_subn_t * p_subn)
 {
 	static struct part_conf part;
@@ -289,8 +586,10 @@ static struct part_conf *new_part_conf(osm_log_t * p_log, osm_subn_t * p_subn)
 	conf->p_subn = p_subn;
 	conf->p_prtn = NULL;
 	conf->is_ipoib = 0;
-	conf->sl = OSM_DEFAULT_SL;
-	conf->full = FALSE;
+	conf->flags.sl = OSM_DEFAULT_SL;
+	conf->flags.rate = OSM_DEFAULT_MGRP_RATE;
+	conf->flags.mtu = OSM_DEFAULT_MGRP_MTU;
+	conf->membership = LIMITED;
 	return conf;
 }
 
@@ -373,6 +672,13 @@ skip_header:
 		if (q)
 			*q++ = '\0';
 		ret = parse_name_token(p, &name, &flag);
+		len += ret;
+
+		if (strcmp(name, "mgid") == 0) {
+			/* parse an mgid line if specified. */
+			len += mgroup_create(p+ret, flag, lineno, conf);
+			goto done; /* We're done: this consumes the line */
+		}
 		if (partition_add_port(lineno, conf, name, flag) < 0) {
 			OSM_LOG(conf->p_log, OSM_LOG_ERROR,
 				"PARSE ERROR: line %d: "
@@ -382,16 +688,16 @@ skip_header:
 			return -1;
 		}
 		p += ret;
-		len += ret;
 	} while (q);
 
+done:
 	return len;
 }
 
 int osm_prtn_config_parse_file(osm_log_t * p_log, osm_subn_t * p_subn,
 			       const char *file_name)
 {
-	char line[1024];
+	char line[4096];
 	struct part_conf *conf = NULL;
 	FILE *file;
 	int lineno;
@@ -425,7 +731,7 @@ int osm_prtn_config_parse_file(osm_log_t * p_log, osm_subn_t * p_subn,
 				break;
 
 			if (!conf && !(conf = new_part_conf(p_log, p_subn))) {
-				OSM_LOG(conf->p_log, OSM_LOG_ERROR,
+				OSM_LOG(p_log, OSM_LOG_ERROR,
 					"PARSE ERROR: line %d: "
 					"internal: cannot create config\n",
 					lineno);
diff --git a/opensm/osm_qos.c b/opensm/osm_qos.c
index b451c25..bfcf1e3 100644
--- a/opensm/osm_qos.c
+++ b/opensm/osm_qos.c
@@ -1,5 +1,6 @@
 /*
- * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -46,6 +47,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_QOS_C
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_subnet.h>
 #include <opensm/osm_qos_policy.h>
@@ -58,12 +61,79 @@ struct qos_config {
 	ib_slvl_table_t sl2vl;
 };
 
+typedef struct qos_mad_item {
+	cl_list_item_t list_item;
+	osm_madw_t *p_madw;
+} qos_mad_item_t;
+
+typedef struct qos_mad_list {
+	cl_list_item_t list_item;
+	cl_qlist_t port_mad_list;
+} qos_mad_list_t;
+
 static void qos_build_config(struct qos_config *cfg,
-			     osm_qos_options_t * opt, osm_qos_options_t * dflt);
+			     osm_qos_options_t * opt,
+			     osm_qos_options_t * dflt);
 
 /*
  * QoS primitives
  */
+
+static qos_mad_item_t *osm_qos_mad_create(IN osm_sm_t * sm,
+					  IN osm_physp_t * p,
+					  IN uint32_t data_size,
+					  IN uint8_t * p_data,
+					  IN ib_net16_t attr_id,
+					  IN uint32_t attr_mod)
+
+{
+	qos_mad_item_t *p_mad;
+	osm_madw_context_t context;
+	osm_madw_t *p_madw;
+	osm_node_t *p_node;
+
+	p_node = osm_physp_get_node_ptr(p);
+
+	switch (attr_id){
+	case IB_MAD_ATTR_SLVL_TABLE:
+		context.slvl_context.node_guid = osm_node_get_node_guid(p_node);
+		context.slvl_context.port_guid = osm_physp_get_port_guid(p);
+		context.slvl_context.set_method = TRUE;
+		break;
+	case IB_MAD_ATTR_VL_ARBITRATION:
+		context.vla_context.node_guid = osm_node_get_node_guid(p_node);
+		context.vla_context.port_guid = osm_physp_get_port_guid(p);
+		context.vla_context.set_method = TRUE;
+		break;
+	default:
+		return NULL;
+	}
+
+	p_mad = (qos_mad_item_t *) malloc(sizeof(*p_mad));
+	if (!p_mad)
+		return NULL;
+
+	memset(p_mad, 0, sizeof(*p_mad));
+
+	p_madw = osm_prepare_req_set(sm, osm_physp_get_dr_path_ptr(p),
+				     p_data, data_size,
+				     attr_id, cl_hton32(attr_mod),
+				     CL_DISP_MSGID_NONE, &context);
+
+	if (p_madw == NULL) {
+		free(p_mad);
+		return NULL;
+	}
+	p_mad->p_madw = p_madw;
+	return p_mad;
+}
+
+static void osm_qos_mad_delete(qos_mad_item_t ** p_item)
+{
+	free(*p_item);
+	*p_item = NULL;
+}
+
 static ib_api_status_t vlarb_update_table_block(osm_sm_t * sm,
 						osm_physp_t * p,
 						uint8_t port_num,
@@ -71,13 +141,13 @@ static ib_api_status_t vlarb_update_table_block(osm_sm_t * sm,
 						const ib_vl_arb_table_t *
 						table_block,
 						unsigned block_length,
-						unsigned block_num)
+						unsigned block_num,
+						cl_qlist_t *mad_list)
 {
 	ib_vl_arb_table_t block;
-	osm_madw_context_t context;
 	uint32_t attr_mod;
 	unsigned vl_mask, i;
-
+	qos_mad_item_t *p_mad;
 	vl_mask = (1 << (ib_port_info_get_op_vls(&p->port_info) - 1)) - 1;
 
 	memset(&block, 0, sizeof(block));
@@ -90,22 +160,23 @@ static ib_api_status_t vlarb_update_table_block(osm_sm_t * sm,
 		    block_length * sizeof(block.vl_entry[0])))
 		return IB_SUCCESS;
 
-	context.vla_context.node_guid =
-	    osm_node_get_node_guid(osm_physp_get_node_ptr(p));
-	context.vla_context.port_guid = osm_physp_get_port_guid(p);
-	context.vla_context.set_method = TRUE;
 	attr_mod = ((block_num + 1) << 16) | port_num;
 
-	return osm_req_set(sm, osm_physp_get_dr_path_ptr(p),
-			   (uint8_t *) & block, sizeof(block),
-			   IB_MAD_ATTR_VL_ARBITRATION,
-			   cl_hton32(attr_mod), CL_DISP_MSGID_NONE, &context);
+	p_mad = osm_qos_mad_create(sm,p,sizeof(block),(uint8_t *) & block,
+				   IB_MAD_ATTR_VL_ARBITRATION, attr_mod);
+
+	if (!p_mad)
+		return IB_INSUFFICIENT_MEMORY;
+
+	cl_qlist_insert_tail(mad_list, &p_mad->list_item);
+
+	return IB_SUCCESS;
 }
 
-static ib_api_status_t vlarb_update(osm_sm_t * sm,
-				    osm_physp_t * p, uint8_t port_num,
-				    unsigned force_update,
-				    const struct qos_config *qcfg)
+static ib_api_status_t vlarb_update(osm_sm_t * sm, osm_physp_t * p,
+				    uint8_t port_num, unsigned force_update,
+				    const struct qos_config *qcfg,
+				    cl_qlist_t *mad_list)
 {
 	ib_api_status_t status = IB_SUCCESS;
 	ib_port_info_t *p_pi = &p->port_info;
@@ -117,7 +188,8 @@ static ib_api_status_t vlarb_update(osm_sm_t * sm,
 		if ((status = vlarb_update_table_block(sm, p, port_num,
 						       force_update,
 						       &qcfg->vlarb_low[0],
-						       len, 0)) != IB_SUCCESS)
+						       len, 0,
+						       mad_list)) != IB_SUCCESS)
 			return status;
 	}
 	if (p_pi->vl_arb_low_cap > IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK) {
@@ -125,7 +197,8 @@ static ib_api_status_t vlarb_update(osm_sm_t * sm,
 		if ((status = vlarb_update_table_block(sm, p, port_num,
 						       force_update,
 						       &qcfg->vlarb_low[1],
-						       len, 1)) != IB_SUCCESS)
+						       len, 1,
+						       mad_list)) != IB_SUCCESS)
 			return status;
 	}
 	if (p_pi->vl_arb_high_cap > 0) {
@@ -134,7 +207,8 @@ static ib_api_status_t vlarb_update(osm_sm_t * sm,
 		if ((status = vlarb_update_table_block(sm, p, port_num,
 						       force_update,
 						       &qcfg->vlarb_high[0],
-						       len, 2)) != IB_SUCCESS)
+						       len, 2,
+						       mad_list)) != IB_SUCCESS)
 			return status;
 	}
 	if (p_pi->vl_arb_high_cap > IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK) {
@@ -142,26 +216,25 @@ static ib_api_status_t vlarb_update(osm_sm_t * sm,
 		if ((status = vlarb_update_table_block(sm, p, port_num,
 						       force_update,
 						       &qcfg->vlarb_high[1],
-						       len, 3)) != IB_SUCCESS)
+						       len, 3,
+						       mad_list)) != IB_SUCCESS)
 			return status;
 	}
 
 	return status;
 }
 
-static ib_api_status_t sl2vl_update_table(osm_sm_t * sm,
-					  osm_physp_t * p, uint8_t in_port,
-					  uint8_t out_port,
+static ib_api_status_t sl2vl_update_table(osm_sm_t * sm, osm_physp_t * p,
+					  uint8_t in_port, uint32_t attr_mod,
 					  unsigned force_update,
-					  const ib_slvl_table_t * sl2vl_table)
+					  const ib_slvl_table_t * sl2vl_table,
+					  cl_qlist_t *mad_list)
 {
-	osm_madw_context_t context;
 	ib_slvl_table_t tbl, *p_tbl;
-	osm_node_t *p_node = osm_physp_get_node_ptr(p);
-	uint32_t attr_mod;
 	unsigned vl_mask;
 	uint8_t vl1, vl2;
 	int i;
+	qos_mad_item_t *p_mad;
 
 	vl_mask = (1 << (ib_port_info_get_op_vls(&p->port_info) - 1)) - 1;
 
@@ -179,104 +252,171 @@ static ib_api_status_t sl2vl_update_table(osm_sm_t * sm,
 	    !memcmp(p_tbl, &tbl, sizeof(tbl)))
 		return IB_SUCCESS;
 
-	context.slvl_context.node_guid = osm_node_get_node_guid(p_node);
-	context.slvl_context.port_guid = osm_physp_get_port_guid(p);
-	context.slvl_context.set_method = TRUE;
-	attr_mod = in_port << 8 | out_port;
-	return osm_req_set(sm, osm_physp_get_dr_path_ptr(p),
-			   (uint8_t *) & tbl, sizeof(tbl),
-			   IB_MAD_ATTR_SLVL_TABLE,
-			   cl_hton32(attr_mod), CL_DISP_MSGID_NONE, &context);
+	p_mad = osm_qos_mad_create(sm, p, sizeof(tbl), (uint8_t *) & tbl,
+				   IB_MAD_ATTR_SLVL_TABLE, attr_mod);
+	if (!p_mad)
+		return IB_INSUFFICIENT_MEMORY;
+
+	cl_qlist_insert_tail(mad_list, &p_mad->list_item);
+	return IB_SUCCESS;
 }
 
-static ib_api_status_t sl2vl_update(osm_sm_t * sm, osm_port_t * p_port,
-				    osm_physp_t * p, uint8_t port_num,
-				    unsigned force_update,
-				    const struct qos_config *qcfg)
+static int qos_extports_setup(osm_sm_t * sm, osm_node_t *node,
+			      const struct qos_config *qcfg,
+			      cl_qlist_t *port_mad_list)
+
 {
-	ib_api_status_t status;
-	uint8_t i, num_ports;
-	osm_physp_t *p_physp;
-
-	if (osm_node_get_type(osm_physp_get_node_ptr(p)) == IB_NODE_TYPE_SWITCH) {
-		if (ib_port_info_get_vl_cap(&p->port_info) == 1) {
-			/* Check port 0's capability mask */
-			p_physp = p_port->p_physp;
-			if (!
-			    (p_physp->port_info.
-			     capability_mask & IB_PORT_CAP_HAS_SL_MAP))
-				return IB_SUCCESS;
+	osm_physp_t *p0, *p;
+	unsigned force_update;
+	unsigned num_ports = osm_node_get_num_physp(node);
+	struct osm_routing_engine *re = sm->p_subn->p_osm->routing_engine_used;
+	int ret = 0;
+	unsigned in, out;
+	uint8_t op_vl, common_op_vl = 0, max_num = 0;
+	uint8_t op_vl_arr[15];
+
+	/*
+	 * Do nothing unless the most recent routing attempt was successful.
+	 */
+	if (!re)
+		return ret;
+
+	for (out = 1; out < num_ports; out++) {
+		p = osm_node_get_physp_ptr(node, out);
+		if (ib_port_info_get_port_state(&p->port_info) == IB_LINK_DOWN)
+			continue;
+		force_update = p->need_update || sm->p_subn->need_update;
+		p->vl_high_limit = qcfg->vl_high_limit;
+		if (vlarb_update(sm, p, p->port_num, force_update, qcfg,
+				 port_mad_list))
+			ret = -1;
+	}
+
+	p0 = osm_node_get_physp_ptr(node, 0);
+	if (!(p0->port_info.capability_mask & IB_PORT_CAP_HAS_SL_MAP))
+		return ret;
+
+	if (ib_switch_info_get_opt_sl2vlmapping(&node->sw->switch_info) &&
+	    sm->p_subn->opt.use_optimized_slvl && !re->update_sl2vl) {
+
+		/* we should find the op_vl that is used by majority of ports */
+		memset(&op_vl_arr[0], 0, sizeof(op_vl_arr));
+		p0 = osm_node_get_physp_ptr(node, 1);
+
+		for (out = 1; out < num_ports; out++) {
+			p = osm_node_get_physp_ptr(node, out);
+			if (ib_port_info_get_port_state(&p->port_info) ==
+			    IB_LINK_DOWN)
+				continue;
+			op_vl = ib_port_info_get_op_vls(&p->port_info);
+			op_vl_arr[op_vl]++;
+			if (op_vl_arr[op_vl] > max_num){
+				max_num = op_vl_arr[op_vl];
+				common_op_vl = op_vl;
+				/* remember the port with most common op_vl */
+				p0 = p;
+			}
+
 		}
-		num_ports = osm_node_get_num_physp(osm_physp_get_node_ptr(p));
-	} else {
-		if (!(p->port_info.capability_mask & IB_PORT_CAP_HAS_SL_MAP))
-			return IB_SUCCESS;
-		num_ports = 1;
+		force_update = node->sw->need_update || sm->p_subn->need_update;
+		if (sl2vl_update_table(sm, p0, p0->port_num, 0x30000, force_update,
+					&qcfg->sl2vl, port_mad_list))
+			ret = -1;
+		/*
+		 * Overwrite default ALL configuration if port's
+		 * op_vl is different.
+		 */
+		for (out = 1; out < num_ports; out++) {
+			p = osm_node_get_physp_ptr(node, out);
+			if (ib_port_info_get_port_state(&p->port_info) ==
+			    IB_LINK_DOWN)
+				continue;
+
+			force_update = p->need_update || force_update;
+			if (ib_port_info_get_op_vls(&p->port_info) !=
+			    common_op_vl &&
+			    sl2vl_update_table(sm, p, p->port_num, 0x20000 | out,
+					       force_update, &qcfg->sl2vl,
+					       port_mad_list))
+				ret = -1;
+		}
+		return ret;
 	}
 
-	for (i = 0; i < num_ports; i++) {
-		status =
-		    sl2vl_update_table(sm, p, i, port_num,
-				       force_update, &qcfg->sl2vl);
-		if (status != IB_SUCCESS)
-			return status;
+	/* non optimized sl2vl configuration */
+	out = ib_switch_info_is_enhanced_port0(&node->sw->switch_info) ? 0 : 1;
+	for (; out < num_ports; out++) {
+		p = osm_node_get_physp_ptr(node, out);
+		if (ib_port_info_get_port_state(&p->port_info) == IB_LINK_DOWN)
+			continue;
+		force_update = p->need_update || sm->p_subn->need_update;
+		/* go over all in ports */
+		for (in = 0; in < num_ports; in++) {
+			const ib_slvl_table_t *port_sl2vl = &qcfg->sl2vl;
+			ib_slvl_table_t routing_sl2vl;
+
+			if (re->update_sl2vl) {
+				routing_sl2vl = *port_sl2vl;
+				re->update_sl2vl(re->context,
+						 p, in, out, &routing_sl2vl);
+				port_sl2vl = &routing_sl2vl;
+			}
+			if (sl2vl_update_table(sm, p, in, in << 8 | out,
+					       force_update, port_sl2vl,
+					       port_mad_list))
+				ret = -1;
+		}
 	}
 
-	return IB_SUCCESS;
+	return ret;
 }
 
-static ib_api_status_t qos_physp_setup(osm_log_t * p_log, osm_sm_t * sm,
-				       osm_port_t * p_port, osm_physp_t * p,
-				       uint8_t port_num,
-				       unsigned force_update,
-				       const struct qos_config *qcfg)
+static int qos_endport_setup(osm_sm_t * sm, osm_physp_t * p,
+			     const struct qos_config *qcfg, int vlarb_only,
+			     cl_qlist_t *port_mad_list)
 {
-	ib_api_status_t status;
+	unsigned force_update = p->need_update || sm->p_subn->need_update;
+	struct osm_routing_engine *re = sm->p_subn->p_osm->routing_engine_used;
+	const ib_slvl_table_t *port_sl2vl = &qcfg->sl2vl;
+	ib_slvl_table_t routing_sl2vl;
 
-	/* OpVLs should be ok at this moment - just use it */
-
-	/* setup VL high limit on the physp later to be updated by link mgr */
 	p->vl_high_limit = qcfg->vl_high_limit;
-
-	/* setup VLArbitration */
-	status = vlarb_update(sm, p, port_num, force_update, qcfg);
-	if (status != IB_SUCCESS) {
-		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6202 : "
-			"failed to update VLArbitration tables "
-			"for port %" PRIx64 " #%d\n",
-			cl_ntoh64(p->port_guid), port_num);
-		return status;
+	if (vlarb_update(sm, p, 0, force_update, qcfg, port_mad_list))
+		return -1;
+	if (vlarb_only)
+		return 0;
+
+	if (!(p->port_info.capability_mask & IB_PORT_CAP_HAS_SL_MAP))
+		return 0;
+
+	if (re && re->update_sl2vl) {
+		routing_sl2vl = *port_sl2vl;
+		re->update_sl2vl(re->context, p, 0, 0, &routing_sl2vl);
+		port_sl2vl = &routing_sl2vl;
 	}
+	if (sl2vl_update_table(sm, p, 0, 0, force_update, port_sl2vl,
+			       port_mad_list))
+		return -1;
 
-	/* setup SL2VL tables */
-	status = sl2vl_update(sm, p_port, p, port_num, force_update, qcfg);
-	if (status != IB_SUCCESS) {
-		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6203 : "
-			"failed to update SL2VLMapping tables "
-			"for port %" PRIx64 " #%d\n",
-			cl_ntoh64(p->port_guid), port_num);
-		return status;
-	}
-
-	return IB_SUCCESS;
+	return 0;
 }
 
-osm_signal_t osm_qos_setup(osm_opensm_t * p_osm)
+int osm_qos_setup(osm_opensm_t * p_osm)
 {
 	struct qos_config ca_config, sw0_config, swe_config, rtr_config;
 	struct qos_config *cfg;
 	cl_qmap_t *p_tbl;
 	cl_map_item_t *p_next;
 	osm_port_t *p_port;
-	uint32_t num_physp;
-	osm_physp_t *p_physp;
 	osm_node_t *p_node;
-	ib_api_status_t status;
-	unsigned force_update;
-	uint8_t i;
+	int ret = 0;
+	int vlarb_only;
+	qos_mad_list_t *p_list, *p_list_next;
+	qos_mad_item_t *p_port_mad;
+	cl_qlist_t qos_mad_list;
 
 	if (!p_osm->subn.opt.qos)
-		return OSM_SIGNAL_DONE;
+		return 0;
 
 	OSM_LOG_ENTER(&p_osm->log);
 
@@ -289,35 +429,43 @@ osm_signal_t osm_qos_setup(osm_opensm_t * p_osm)
 	qos_build_config(&rtr_config, &p_osm->subn.opt.qos_rtr_options,
 			 &p_osm->subn.opt.qos_options);
 
+	cl_qlist_init(&qos_mad_list);
+
 	cl_plock_excl_acquire(&p_osm->lock);
 
 	/* read QoS policy config file */
 	osm_qos_parse_policy_file(&p_osm->subn);
-
 	p_tbl = &p_osm->subn.port_guid_tbl;
 	p_next = cl_qmap_head(p_tbl);
 	while (p_next != cl_qmap_end(p_tbl)) {
+		vlarb_only = 0;
 		p_port = (osm_port_t *) p_next;
 		p_next = cl_qmap_next(p_next);
 
+		p_list = (qos_mad_list_t *) malloc(sizeof(*p_list));
+		if (!p_list)
+			return -1;
+
+		memset(p_list, 0, sizeof(*p_list));
+
+		cl_qlist_init(&p_list->port_mad_list);
+
 		p_node = p_port->p_node;
 		if (p_node->sw) {
-			num_physp = osm_node_get_num_physp(p_node);
-			for (i = 1; i < num_physp; i++) {
-				p_physp = osm_node_get_physp_ptr(p_node, i);
-				if (!p_physp)
-					continue;
-				force_update = p_physp->need_update ||
-				    p_osm->subn.need_update;
-				status =
-				    qos_physp_setup(&p_osm->log, &p_osm->sm,
-						    p_port, p_physp, i,
-						    force_update, &swe_config);
-			}
+			if (qos_extports_setup(&p_osm->sm, p_node, &swe_config,
+					       &p_list->port_mad_list))
+				ret = -1;
+
 			/* skip base port 0 */
 			if (!ib_switch_info_is_enhanced_port0
 			    (&p_node->sw->switch_info))
-				continue;
+				goto Continue;
+
+			if (ib_switch_info_get_opt_sl2vlmapping(&p_node->sw->switch_info) &&
+			    p_osm->sm.p_subn->opt.use_optimized_slvl &&
+			    !memcmp(&swe_config.sl2vl, &sw0_config.sl2vl,
+				    sizeof(swe_config.sl2vl)))
+				vlarb_only = 1;
 
 			cfg = &sw0_config;
 		} else if (osm_node_get_type(p_node) == IB_NODE_TYPE_ROUTER)
@@ -325,25 +473,48 @@ osm_signal_t osm_qos_setup(osm_opensm_t * p_osm)
 		else
 			cfg = &ca_config;
 
-		p_physp = p_port->p_physp;
-		if (!p_physp)
-			continue;
+		if (qos_endport_setup(&p_osm->sm, p_port->p_physp, cfg,
+				      vlarb_only, &p_list->port_mad_list))
 
-		force_update = p_physp->need_update || p_osm->subn.need_update;
-		status = qos_physp_setup(&p_osm->log, &p_osm->sm,
-					 p_port, p_physp, 0, force_update, cfg);
+			ret = -1;
+Continue:
+		/* if MAD list is not empty, add it to the global MAD list */
+		if (cl_qlist_count(&p_list->port_mad_list)) {
+			cl_qlist_insert_tail(&qos_mad_list, &p_list->list_item);
+		} else {
+			free(p_list);
+		}
+	}
+	while (cl_qlist_count(&qos_mad_list)) {
+		p_list_next = (qos_mad_list_t *) cl_qlist_head(&qos_mad_list);
+		while (p_list_next !=
+			(qos_mad_list_t *) cl_qlist_end(&qos_mad_list)) {
+			p_list = p_list_next;
+			p_list_next = (qos_mad_list_t *)
+				      cl_qlist_next(&p_list->list_item);
+			/* next MAD to send*/
+			p_port_mad = (qos_mad_item_t *)
+				     cl_qlist_remove_head(&p_list->port_mad_list);
+			osm_send_req_mad(&p_osm->sm, p_port_mad->p_madw);
+			osm_qos_mad_delete(&p_port_mad);
+			/* remove the QoS MAD from global MAD list */
+			if (cl_qlist_count(&p_list->port_mad_list) == 0) {
+				cl_qlist_remove_item(&qos_mad_list, &p_list->list_item);
+				free(p_list);
+			}
+		}
 	}
 
 	cl_plock_release(&p_osm->lock);
 	OSM_LOG_EXIT(&p_osm->log);
 
-	return OSM_SIGNAL_DONE;
+	return ret;
 }
 
 /*
  *  QoS config stuff
  */
-static int parse_one_unsigned(char *str, char delim, unsigned *val)
+static int parse_one_unsigned(const char *str, char delim, unsigned *val)
 {
 	char *end;
 	*val = strtoul(str, &end, 0);
@@ -352,10 +523,10 @@ static int parse_one_unsigned(char *str, char delim, unsigned *val)
 	return (int)(end - str);
 }
 
-static int parse_vlarb_entry(char *str, ib_vl_arb_element_t * e)
+static int parse_vlarb_entry(const char *str, ib_vl_arb_element_t * e)
 {
 	unsigned val;
-	char *p = str;
+	const char *p = str;
 	p += parse_one_unsigned(p, ':', &val);
 	e->vl = val % 15;
 	p += parse_one_unsigned(p, ',', &val);
@@ -363,32 +534,50 @@ static int parse_vlarb_entry(char *str, ib_vl_arb_element_t * e)
 	return (int)(p - str);
 }
 
-static int parse_sl2vl_entry(char *str, uint8_t * raw)
+static int parse_sl2vl_entry(const char *str, uint8_t * raw)
 {
 	unsigned val1, val2;
-	char *p = str;
+	const char *p = str;
 	p += parse_one_unsigned(p, ',', &val1);
 	p += parse_one_unsigned(p, ',', &val2);
 	*raw = (val1 << 4) | (val2 & 0xf);
 	return (int)(p - str);
 }
 
-static void qos_build_config(struct qos_config *cfg,
-			     osm_qos_options_t * opt, osm_qos_options_t * dflt)
+static void qos_build_config(struct qos_config *cfg, osm_qos_options_t * opt,
+			     osm_qos_options_t * dflt)
 {
 	int i;
-	char *p;
+	const char *p;
 
 	memset(cfg, 0, sizeof(*cfg));
 
-	cfg->max_vls = opt->max_vls > 0 ? opt->max_vls : dflt->max_vls;
+	if (opt->max_vls > 0)
+		cfg->max_vls = opt->max_vls;
+	else {
+		if (dflt->max_vls > 0)
+			cfg->max_vls = dflt->max_vls;
+		else
+			cfg->max_vls = OSM_DEFAULT_QOS_MAX_VLS;
+	}
 
 	if (opt->high_limit >= 0)
 		cfg->vl_high_limit = (uint8_t) opt->high_limit;
-	else
-		cfg->vl_high_limit = (uint8_t) dflt->high_limit;
+	else {
+		if (dflt->high_limit >= 0)
+			cfg->vl_high_limit = (uint8_t) dflt->high_limit;
+		else
+			cfg->vl_high_limit = (uint8_t) OSM_DEFAULT_QOS_HIGH_LIMIT;
+	}
 
-	p = opt->vlarb_high ? opt->vlarb_high : dflt->vlarb_high;
+	if (opt->vlarb_high)
+		p = opt->vlarb_high;
+	else {
+		if (dflt->vlarb_high)
+			p = dflt->vlarb_high;
+		else
+			p = OSM_DEFAULT_QOS_VLARB_HIGH;
+	}
 	for (i = 0; i < 2 * IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK; i++) {
 		p += parse_vlarb_entry(p,
 				       &cfg->vlarb_high[i /
@@ -397,7 +586,14 @@ static void qos_build_config(struct qos_config *cfg,
 						IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK]);
 	}
 
-	p = opt->vlarb_low ? opt->vlarb_low : dflt->vlarb_low;
+	if (opt->vlarb_low)
+		p = opt->vlarb_low;
+	else {
+		if (dflt->vlarb_low)
+			p = dflt->vlarb_low;
+		else
+			p = OSM_DEFAULT_QOS_VLARB_LOW;
+	}
 	for (i = 0; i < 2 * IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK; i++) {
 		p += parse_vlarb_entry(p,
 				       &cfg->vlarb_low[i /
@@ -407,7 +603,14 @@ static void qos_build_config(struct qos_config *cfg,
 	}
 
 	p = opt->sl2vl ? opt->sl2vl : dflt->sl2vl;
+	if (opt->sl2vl)
+		p = opt->sl2vl;
+	else {
+		if (dflt->sl2vl)
+			p = dflt->sl2vl;
+		else
+			p = OSM_DEFAULT_QOS_SL2VL;
+	}
 	for (i = 0; i < IB_MAX_NUM_VLS / 2; i++)
 		p += parse_sl2vl_entry(p, &cfg->sl2vl.raw_vl_by_sl[i]);
-
 }
diff --git a/opensm/osm_qos_parser_l.c b/opensm/osm_qos_parser_l.c
index 07a5cbb..e7bb49c 100644
--- a/opensm/osm_qos_parser_l.c
+++ b/opensm/osm_qos_parser_l.c
@@ -359,8 +359,8 @@ static void yy_fatal_error (yyconst char msg[]  );
 	*yy_cp = '\0'; \
 	(yy_c_buf_p) = yy_cp;
 
-#define YY_NUM_RULES 82
-#define YY_END_OF_BUFFER 83
+#define YY_NUM_RULES 84
+#define YY_END_OF_BUFFER 85
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -368,68 +368,72 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_accept[551] =
+static yyconst flex_int16_t yy_accept[582] =
     {   0,
-        0,    0,   83,   81,    3,    4,   81,   81,   79,   78,
-       76,   75,   75,   77,   81,   81,   81,   81,   81,   81,
-       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,
-       81,   81,   81,   81,    3,    2,    0,   80,    0,    1,
-       75,    0,    0,    0,   57,    0,    0,    0,    0,    0,
+        0,    0,   85,   83,    3,    4,   83,   83,   81,   80,
+       78,   77,   77,   79,   83,   83,   83,   83,   83,   83,
+       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
+       83,   83,   83,   83,    3,    2,    0,   82,    0,    1,
+       77,    0,    0,    0,   57,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,   74,   60,    0,    0,    0,    0,    0,
+        0,    0,    0,   76,   60,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
         0,    0,    0,   45,    0,    0,   39,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,   67,    0,    0,
-        0,   65,   59,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,   69,    0,    0,
+        0,   67,   59,    0,    0,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
         0,    0,    0,   45,    0,   39,    0,   34,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,   69,    0,
-        0,   67,    0,    0,    0,   65,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,   71,    0,
+        0,   69,    0,    0,    0,   67,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,   40,    0,    0,    0,
        33,    0,    0,    0,    0,    0,   54,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,   34,    0,    0,
 
-        0,    0,    0,    0,    0,    0,   72,    0,    0,   69,
-        0,   56,    0,    0,   58,    0,    0,    0,    0,    0,
-        0,   40,    0,   35,    0,   33,    0,    0,    0,    0,
-       54,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,   74,    0,    0,
+       71,    0,   56,    0,    0,   58,    0,    0,    0,    0,
+        0,    0,   40,    0,   35,    0,   33,    0,    0,    0,
+        0,   54,    0,    0,    0,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-       72,    0,    0,    0,    0,    0,    0,   43,    0,    0,
-        0,    0,    0,   35,    0,    0,    0,    0,    0,    0,
+        0,    0,   74,    0,    0,    0,    0,    0,    0,   43,
+        0,    0,    0,    0,    0,   35,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,   51,    0,    0,    0,    0,    0,   63,    0,
-        0,    0,   61,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,   51,    0,    0,    0,    0,    0,
+       63,    0,    0,    0,    0,   61,    0,    0,    0,    0,
 
-       43,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    5,    0,
-        0,    0,    0,   51,    0,    0,    0,    0,    0,    0,
-        0,   61,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,   43,    0,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,   23,    0,   11,    0,
+        0,    5,    0,    0,    0,    0,   51,    0,    0,    0,
+        0,    0,    0,    0,    0,   61,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-       73,    0,    0,    0,    0,    0,    0,   41,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,   46,    0,   32,
-        0,    0,   31,    0,   49,    9,    0,   29,    0,   30,
-
-        0,   50,    0,   21,    0,    0,    0,    0,    0,    0,
-        0,    0,   37,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+       23,    0,   11,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,   75,    0,    0,    0,    0,
         0,    0,   41,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,   46,   32,    0,   31,   49,    7,   29,
-       30,   50,    0,    0,    0,   47,    0,   53,   19,    0,
-        0,    0,   36,   37,   15,    0,    0,    0,    0,   68,
-       66,    0,    0,   42,    0,   52,    0,    0,    0,    0,
-        6,    0,    0,    0,    0,    0,   48,    0,    0,   47,
-       53,    0,   44,   17,    0,   36,   13,    0,    0,   70,
-        0,   42,   52,    0,   24,    0,   12,    0,    0,    0,
+        0,    0,   46,    0,   32,    0,    0,   31,    0,   49,
+
+        9,    0,   29,    0,   30,    0,   50,    0,   21,    0,
+        0,    0,    0,    0,    0,    0,    0,   37,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,   41,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,   46,
+       32,    0,   31,   49,    7,   29,   30,   50,    0,    0,
+        0,   47,    0,   53,   19,    0,    0,    0,   36,   37,
+       15,    0,    0,    0,    0,    0,    0,   70,   68,    0,
+        0,   42,    0,   52,    0,    0,    0,    0,    6,    0,
+        0,    0,    0,    0,   48,    0,    0,   47,   53,    0,
+       44,   17,    0,   36,   13,    0,    0,    0,    0,   72,
 
-        0,   48,    0,    0,   44,    0,   62,    0,    0,   10,
-       22,    0,    0,    0,    0,    0,    0,   27,    0,   38,
-        0,    0,    8,    0,   20,    0,   16,    0,    0,   55,
-       25,   38,    0,    0,    0,   18,   14,   55,    0,    0,
-        0,    0,    0,   28,    0,    0,   26,   64,   71,    0
+        0,   42,   52,    0,   24,    0,   12,    0,    0,    0,
+        0,   48,    0,    0,   44,    0,   62,    0,    0,    0,
+        0,   10,   22,    0,    0,    0,    0,    0,    0,   27,
+        0,   38,    0,    0,    0,    0,    8,    0,   20,    0,
+       16,    0,    0,   55,   25,   38,    0,    0,    0,    0,
+        0,   18,   14,   55,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,   28,    0,    0,    0,    0,   26,   65,
+        0,   64,   73,    0,    0,    0,    0,    0,    0,   66,
+        0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -474,137 +478,143 @@ static yyconst flex_int32_t yy_meta[55] =
         1,    1,    1,    1
     } ;
 
-static yyconst flex_int16_t yy_base[554] =
+static yyconst flex_int16_t yy_base[585] =
     {   0,
-        0,    0,  759,  760,   53,  760,  754,  754,  760,  760,
-      760,   48,   51,  760,   42,   53,   51,   43,   56,   77,
-       54,   54,  712,  707,  706,  703,   38,   63,  707,   84,
-      115,  706,  701,  707,   71,  760,  744,  760,  744,  760,
-       71,    0,   76,   68,  760,   87,   88,   92,   77,   86,
-       93,   94,   96,  101,  698,  109,  710,  699,  698,  691,
-      698,  705,  104,  703,  690,  688,  686,  113,  154,  684,
-      133,  698,  115,    0,  760,  141,  140,  129,  134,  168,
-      135,  169,  146,  171,  140,  688,  682,  723,  687,  678,
-      720,  691,  690,  684,  674,  684,  668,  671,  712,  683,
-
-      666,  172,  665,  714,  667,  175,  712,  177,  674,  664,
-      184,  186,  164,  179,  192,  193,  194,  709,  180,  196,
-      199,  708,  760,  200,  204,  194,  660,  668,  171,  209,
-      661,  664,  212,  697,  668,  663,  694,  217,  693,  188,
-      692,  659,  656,  695,  662,  693,  231,  692,  653,  659,
-      211,  650,  654,  657,  204,  240,  246,  224,  686,  225,
-      642,  684,  216,  232,  640,  682,  236,  651,  230,  633,
-      637,  635,  634,  636,  635,  253,  674,  254,  635,  260,
-      672,  623,  622,  621,  637,  261,  667,  206,  626,  631,
-      634,  629,  622,  621,  628,  653,  624,  657,  620,  649,
-
-      620,  607,  606,  224,  273,  257,  651,  265,  607,  649,
-      602,  760,  601,  600,  760,  275,  615,  598,  596,  633,
-      611,  640,  277,  639,  597,  637,  584,  629,  596,  595,
-      632,  233,  601,  600,  579,  580,  579,  582,  587,  590,
-      241,  280,  586,  255,  570,  571,  584,  286,  266,  580,
-      618,  571,  568,  567,  578,  294,  258,  613,  564,  563,
-      604,  559,  562,  607,  568,  561,  564,  560,  554,  558,
-      562,  558,  551,  563,  564,  546,  547,  552,  586,  559,
-      560,  297,  589,  582,  549,  543,  553,  554,  760,  545,
-      548,  298,  581,  546,  531,  572,  571,  542,  529,  531,
-
-      573,  534,  565,  271,  530,  538,  520,  533,  528,  523,
-      517,  514,  529,  527,  513,  519,  521,  513,  760,  518,
-      517,  511,  522,  552,  511,  514,  498,  505,  516,  514,
-      497,  544,  491,  536,  499,  498,  491,  495,  305,  494,
-      500,  501,  504,  499,  492,  525,  524,  313,  314,  494,
-      316,  317,  484,  319,  321,  322,  293,  521,  760,  478,
-      492,  480,  483,  484,  484,  325,  476,  479,  484,  511,
-      760,  474,  466,  465,  507,  471,  328,  511,  468,  463,
-      458,  459,  458,  461,  286,  289,  339,  504,  341,  503,
-      468,  342,  501,  343,  500,  452,  344,  498,  345,  497,
-
-      346,  496,  453,  760,  448,  347,  348,  459,  458,  450,
-      350,  359,  490,  455,  454,  481,  442,  436,  443,  442,
-      438,  361,  481,  362,  437,  445,  446,  428,  429,  443,
-      444,  441,  442,  471,  470,  363,  469,  468,  760,  467,
-      466,  465,  434,  414,  364,  462,  365,  461,  760,  366,
-      422,  367,  459,  458,  760,  410,  418,  412,  413,  760,
-      760,  410,  368,  452,  370,  451,  401,  409,  411,  403,
-      760,  403,  414,  401,  412,  379,  442,  400,  400,  439,
-      438,  381,  437,  760,  388,  435,  760,  401,  387,  760,
-      386,  431,  430,  385,  381,  421,  760,  382,  385,  380,
-
-      383,  422,  387,  386,  419,  382,  760,  370,  364,  364,
-      760,  364,  375,  374,  373,  372,  383,  358,  384,  404,
-      397,  396,  760,  352,  760,  353,  760,  352,  385,  398,
-      760,  397,  360,  354,  348,  760,  760,  387,  337,  281,
-      266,  253,  236,  161,   75,   42,  760,  760,  760,  760,
-      415,  417,   63
+        0,    0,  790,  791,   53,  791,  785,  785,  791,  791,
+      791,   48,   51,  791,   42,   53,   51,   43,   56,   77,
+       54,   54,  743,  738,  737,  734,   38,   63,  738,   84,
+      115,  737,  732,  738,   71,  791,  775,  791,  775,  791,
+       71,    0,   76,   68,  791,   87,   88,   92,   77,   86,
+       93,   94,   96,  101,  729,  109,  741,  730,  729,  722,
+      729,  736,  104,  734,  721,  719,  717,  113,  154,  715,
+      133,  729,  115,    0,  791,  141,  140,  129,  134,  168,
+      135,  169,  146,  171,  140,  719,  713,  754,  718,  709,
+      751,  722,  721,  715,  705,  715,  699,  702,  743,  714,
+
+      697,  172,  696,  745,  698,  175,  743,  177,  705,  695,
+      184,  186,  164,  179,  192,  193,  194,  740,  180,  196,
+      199,  739,  791,  200,  204,  194,  691,  699,  171,  209,
+      692,  695,  212,  728,  699,  694,  725,  217,  724,  188,
+      723,  690,  687,  726,  693,  724,  231,  723,  684,  690,
+      211,  681,  189,  689,  205,  239,  246,  225,  718,  236,
+      674,  716,  217,  242,  672,  714,  247,  683,  231,  665,
+      669,  667,  666,  668,  667,  250,  706,  254,  667,  257,
+      704,  655,  654,  653,  669,  261,  699,  230,  658,  663,
+      666,  661,  654,  653,  660,  685,  656,  689,  652,  681,
+
+      652,  639,  635,  637,  228,  265,  262,  682,  273,  638,
+      680,  633,  791,  632,  631,  791,  277,  646,  629,  627,
+      664,  642,  671,  274,  670,  628,  668,  615,  660,  627,
+      626,  663,  232,  632,  631,  610,  611,  610,  613,  618,
+      621,  241,  282,  617,  253,  601,  602,  605,  614,  294,
+      279,  610,  648,  601,  598,  597,  608,  297,  250,  643,
+      594,  593,  634,  589,  592,  637,  598,  591,  594,  590,
+      584,  588,  592,  588,  581,  593,  594,  576,  577,  582,
+      616,  589,  590,  299,  619,  612,  579,  573,  583,  584,
+      791,  575,  580,  577,  302,  610,  575,  560,  601,  600,
+
+      571,  558,  560,  602,  563,  594,  273,  559,  567,  549,
+      562,  557,  552,  546,  543,  558,  556,  542,  548,  550,
+      542,  791,  547,  546,  540,  551,  581,  540,  543,  527,
+      534,  545,  543,  540,  525,  572,  519,  564,  527,  526,
+      519,  523,  305,  522,  528,  529,  532,  527,  520,  553,
+      552,  308,  311,  522,  316,  319,  512,  324,  325,  327,
+      285,  549,  791,  506,  520,  508,  511,  512,  512,  328,
+      504,  507,  512,  539,  538,  791,  501,  493,  492,  534,
+      498,  330,  538,  495,  490,  485,  486,  485,  488,  294,
+      296,  336,  531,  339,  530,  495,  345,  528,  347,  527,
+
+      479,  348,  525,  350,  524,  351,  523,  480,  791,  475,
+      352,  353,  486,  485,  477,  354,  356,  517,  482,  481,
+      508,  321,  469,  463,  470,  469,  465,  367,  508,  368,
+      464,  472,  473,  455,  456,  470,  471,  468,  469,  498,
+      497,  370,  496,  495,  791,  494,  493,  492,  461,  441,
+      371,  489,  372,  488,  791,  373,  449,  374,  486,  485,
+      791,  437,  445,  439,  451,  437,  438,  791,  791,  435,
+      375,  477,  376,  476,  426,  434,  436,  428,  791,  428,
+      439,  426,  437,  379,  467,  425,  425,  464,  463,  387,
+      462,  791,  413,  460,  791,  426,  412,  411,  410,  791,
+
+      409,  454,  453,  408,  404,  444,  791,  405,  408,  403,
+      406,  445,  410,  409,  442,  388,  791,  393,  404,  391,
+      390,  390,  791,  390,  401,  400,  399,  398,  390,  384,
+      391,  430,  423,  394,  421,  420,  791,  376,  791,  372,
+      791,  371,  392,  417,  791,  416,  379,  366,  377,  376,
+      371,  791,  791,  410,  360,  402,  358,  357,  371,  366,
+      359,  361,  358,  348,  361,  350,  326,  300,  791,  791,
+      285,  791,  791,  262,  297,  260,  159,   70,   42,  791,
+      791,  422,  424,   63
     } ;
 
-static yyconst flex_int16_t yy_def[554] =
+static yyconst flex_int16_t yy_def[585] =
     {   0,
-      550,    1,  550,  550,  550,  550,  551,  552,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  551,  550,  552,  550,
-      550,  553,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  553,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,    0,
-      550,  550,  550
+      581,    1,  581,  581,  581,  581,  582,  583,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  582,  581,  583,  581,
+      581,  584,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  584,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+        0,  581,  581,  581
     } ;
 
-static yyconst flex_int16_t yy_nxt[815] =
+static yyconst flex_int16_t yy_nxt[846] =
     {   0,
         4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
        13,   14,   15,    4,   16,   17,    4,    4,    4,   18,
@@ -613,11 +623,11 @@ static yyconst flex_int16_t yy_nxt[815] =
         4,    4,   26,   27,    4,   28,   29,   30,   31,   32,
        33,   34,    4,    4,   35,   36,   41,   41,   41,   41,
        41,   41,   43,   44,   74,   45,   47,   46,   48,   61,
-       46,   49,   35,   36,   43,   44,  549,   42,   50,   41,
+       46,   49,   35,   36,   43,   44,  580,   42,   50,   41,
        41,   41,   62,   43,   45,   44,   46,   55,   47,   56,
        49,   48,   51,   52,   63,   43,   75,   44,   76,   49,
 
-       50,   53,   80,   64,   77,   54,   50,   65,   79,  548,
+       50,   53,   80,   64,   77,   54,   50,   65,   79,  579,
        78,   51,   52,   81,   83,   67,   82,   75,   49,   84,
        85,   76,  109,   77,   53,   80,   77,   79,   50,   54,
        51,   52,   78,   83,  106,   83,   81,   94,   82,   53,
@@ -628,77 +638,80 @@ static yyconst flex_int16_t yy_nxt[815] =
       122,  115,  123,  104,  119,  111,  107,  151,  148,  126,
       112,  155,  156,  157,  116,  160,  163,  120,  158,  117,
 
-      164,  124,  121,  159,  118,  167,  125,  122,  169,  547,
+      164,  124,  121,  159,  118,  167,  125,  122,  169,  578,
       176,  156,  151,  180,  155,  163,  172,  173,  186,  174,
-      177,  189,  175,  181,  204,  208,  160,  169,  187,  190,
-      191,  152,  147,  164,  153,  154,  192,  167,  193,  161,
-      212,  205,  148,  232,  165,  204,  206,  157,  215,  233,
-      248,  207,  158,  168,  176,  223,  152,  159,  249,  153,
-      154,  180,  186,  212,  177,  224,  208,  249,  215,  209,
-      161,  181,  187,  248,  205,  546,  256,  165,  223,  206,
-      270,  282,  257,  271,  207,  168,  258,  292,  224,  280,
-      281,  283,  545,  285,  299,  256,  286,  293,  282,  292,
-
-      403,  544,  250,  287,  288,  258,  377,  300,  283,  293,
-      209,  250,  342,  343,  387,  389,  378,  392,  394,  344,
-      397,  345,  399,  401,  388,  390,  412,  393,  395,  377,
-      398,  543,  400,  402,  430,  431,  413,  432,  433,  378,
-      387,  404,  389,  392,  394,  397,  399,  401,  445,  447,
-      388,  452,  390,  393,  395,  398,  400,  402,  446,  448,
-      412,  453,  463,  465,  476,  445,  447,  482,  452,  463,
-      413,  465,  464,  466,  477,  446,  448,  483,  453,  464,
-      476,  466,  482,  519,  529,  519,  529,  542,  538,  541,
-      477,  540,  483,  520,  530,  520,  530,  539,  532,  538,
-
-      537,  536,  535,  534,  533,  532,  531,  528,  527,  526,
-      525,  524,  523,  522,  484,   37,   37,   39,   39,  521,
-      505,  518,  517,  502,  516,  515,  514,  513,  512,  511,
-      510,  493,  492,  509,  508,  507,  486,  506,  505,  481,
-      480,  504,  503,  502,  501,  500,  499,  498,  497,  496,
-      495,  494,  493,  492,  491,  490,  489,  488,  487,  454,
-      486,  485,  481,  480,  479,  478,  442,  441,  440,  438,
-      437,  435,  434,  475,  474,  473,  472,  471,  470,  469,
-      468,  467,  423,  462,  461,  460,  459,  458,  457,  456,
-      455,  454,  451,  450,  449,  444,  443,  442,  441,  440,
-
-      439,  438,  437,  436,  435,  434,  429,  428,  427,  426,
-      425,  424,  423,  422,  421,  420,  419,  418,  417,  416,
-      415,  414,  411,  410,  409,  408,  407,  406,  405,  396,
-      391,  386,  385,  384,  383,  382,  381,  380,  379,  376,
-      375,  374,  373,  372,  371,  332,  370,  369,  368,  367,
-      366,  365,  364,  324,  363,  362,  361,  360,  359,  358,
-      357,  356,  355,  354,  353,  352,  351,  350,  349,  348,
-      347,  346,  341,  340,  301,  339,  338,  337,  336,  335,
-      334,  333,  332,  331,  330,  329,  328,  327,  326,  325,
-      324,  323,  322,  321,  320,  319,  318,  317,  316,  315,
-
-      314,  313,  312,  311,  310,  309,  308,  307,  264,  306,
-      305,  304,  303,  302,  301,  298,  297,  296,  295,  251,
-      294,  291,  290,  289,  284,  279,  278,  277,  276,  275,
-      274,  273,  272,  231,  269,  268,  267,  266,  226,  265,
-      264,  222,  263,  262,  261,  260,  259,  255,  254,  253,
-      210,  252,  251,  247,  246,  245,  244,  243,  198,  242,
-      241,  240,  239,  238,  237,  236,  235,  234,  231,  230,
-      229,  228,  227,  226,  225,  222,  221,  220,  219,  218,
-      217,  216,  214,  166,  213,  162,  211,  210,  203,  202,
-      201,  200,  199,  198,  146,  197,  144,  196,  195,  194,
-
-      188,  185,  184,  183,  182,  179,  178,  171,  170,  166,
-      162,  150,  149,  146,  145,  144,  143,  142,  141,  140,
-      139,  138,  137,  136,  135,  134,  133,  132,  131,  130,
-      129,  128,  127,  108,  105,  100,   99,   98,   97,   93,
-       92,   91,   90,   89,   88,   86,   40,   38,   73,   72,
-       71,   66,   60,   59,   58,   57,   40,   38,  550,    3,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550
+      177,  189,  175,  181,  202,  205,  209,  169,  187,  190,
+      191,  152,  147,  203,  153,  154,  192,  160,  193,  161,
+      206,  213,  148,  164,  165,  207,  205,  157,  167,  216,
+      208,  176,  158,  168,  250,  224,  152,  159,  180,  153,
+      154,  177,  186,  251,  213,  225,  206,  233,  181,  216,
+      210,  207,  187,  234,  209,  224,  208,  250,  258,  272,
+      251,  161,  273,  284,  259,  225,  302,  165,  260,  282,
+      283,  287,  408,  285,  288,  295,  168,  577,  258,  303,
+
+      284,  289,  290,  295,  576,  296,  382,  252,  260,  392,
+      285,  575,  394,  296,  346,  347,  383,  397,  210,  393,
+      399,  348,  395,  349,  252,  402,  404,  398,  406,  417,
+      400,  382,  574,  409,  573,  403,  405,  392,  407,  418,
+      394,  383,  436,  437,  438,  439,  397,  393,  399,  402,
+      395,  404,  406,  451,  453,  458,  398,  417,  400,  403,
+      572,  405,  407,  452,  454,  459,  464,  418,  471,  473,
+      465,  484,  451,  453,  490,  458,  471,  473,  472,  474,
+      484,  485,  452,  454,  491,  459,  472,  474,  490,  531,
+      485,  543,  531,  543,  571,  570,  569,  568,  491,  532,
+
+      567,  544,  532,  544,  566,  565,  564,  563,  562,  561,
+      560,  554,  559,  558,  557,  556,  555,  546,  554,  553,
+      552,  492,   37,   37,   39,   39,  551,  550,  549,  548,
+      547,  546,  545,  542,  541,  540,  539,  538,  537,  536,
+      535,  534,  533,  515,  530,  529,  512,  528,  527,  526,
+      525,  524,  523,  522,  503,  502,  521,  520,  519,  518,
+      517,  494,  516,  515,  489,  488,  514,  513,  512,  511,
+      510,  509,  508,  507,  506,  505,  504,  503,  502,  501,
+      500,  499,  498,  497,  496,  495,  460,  494,  493,  489,
+      488,  487,  486,  448,  447,  446,  444,  443,  441,  440,
+
+      483,  482,  481,  480,  479,  478,  477,  476,  475,  429,
+      470,  469,  468,  467,  466,  463,  462,  461,  460,  457,
+      456,  455,  450,  449,  448,  447,  446,  445,  444,  443,
+      442,  441,  440,  435,  434,  433,  432,  431,  430,  429,
+      428,  427,  426,  425,  424,  423,  422,  421,  420,  419,
+      416,  415,  414,  413,  412,  411,  410,  401,  396,  391,
+      390,  389,  388,  387,  386,  385,  384,  381,  380,  379,
+      378,  377,  376,  336,  375,  374,  373,  372,  371,  370,
+      369,  368,  327,  367,  366,  365,  364,  363,  362,  361,
+      360,  359,  358,  357,  356,  355,  354,  353,  352,  351,
+
+      350,  345,  344,  304,  343,  342,  341,  340,  339,  338,
+      337,  336,  335,  334,  333,  332,  331,  330,  329,  328,
+      327,  326,  325,  324,  323,  322,  321,  320,  319,  318,
+      317,  316,  315,  314,  313,  312,  311,  310,  266,  309,
+      308,  307,  306,  305,  304,  301,  300,  299,  298,  253,
+      297,  294,  293,  292,  291,  286,  281,  280,  279,  278,
+      277,  276,  275,  274,  232,  271,  270,  269,  268,  227,
+      267,  266,  223,  265,  264,  263,  262,  261,  257,  256,
+      255,  211,  254,  253,  249,  248,  247,  246,  245,  244,
+      198,  243,  242,  241,  240,  239,  238,  237,  236,  235,
+
+      232,  231,  230,  229,  228,  227,  226,  223,  222,  221,
+      220,  219,  218,  217,  215,  166,  214,  162,  212,  211,
+      204,  201,  200,  199,  198,  146,  197,  144,  196,  195,
+      194,  188,  185,  184,  183,  182,  179,  178,  171,  170,
+      166,  162,  150,  149,  146,  145,  144,  143,  142,  141,
+      140,  139,  138,  137,  136,  135,  134,  133,  132,  131,
+      130,  129,  128,  127,  108,  105,  100,   99,   98,   97,
+       93,   92,   91,   90,   89,   88,   86,   40,   38,   73,
+       72,   71,   66,   60,   59,   58,   57,   40,   38,  581,
+        3,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581
     } ;
 
-static yyconst flex_int16_t yy_chk[815] =
+static yyconst flex_int16_t yy_chk[846] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -706,12 +719,12 @@ static yyconst flex_int16_t yy_chk[815] =
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    5,    5,   12,   12,   12,   13,
-       13,   13,   15,   15,  553,   16,   18,   17,   18,   27,
-       22,   19,   35,   35,   21,   21,  546,   12,   19,   41,
+       13,   13,   15,   15,  584,   16,   18,   17,   18,   27,
+       22,   19,   35,   35,   21,   21,  579,   12,   19,   41,
        41,   41,   27,   15,   16,   15,   17,   21,   18,   22,
        19,   18,   20,   20,   28,   21,   43,   21,   44,   30,
 
-       19,   20,   49,   28,   46,   20,   30,   28,   48,  545,
+       19,   20,   49,   28,   46,   20,   30,   28,   48,  578,
        47,   20,   20,   50,   52,   30,   51,   43,   30,   53,
        54,   44,   73,   46,   20,   49,   56,   48,   30,   20,
        31,   31,   47,   68,   71,   52,   50,   63,   51,   31,
@@ -722,74 +735,77 @@ static yyconst flex_int16_t yy_chk[815] =
        82,   79,   83,  102,   81,  111,  106,  112,  108,   85,
       111,  113,  114,  115,  116,  117,  119,  120,  115,  116,
 
-      121,  124,  120,  115,  116,  125,  124,  120,  126,  544,
+      121,  124,  120,  115,  116,  125,  124,  120,  126,  577,
       130,  114,  151,  133,  113,  119,  129,  129,  138,  129,
-      130,  140,  129,  133,  155,  158,  160,  126,  138,  140,
-      140,  112,  147,  164,  112,  112,  140,  167,  140,  117,
-      163,  156,  147,  188,  121,  155,  156,  157,  169,  188,
-      204,  156,  157,  125,  176,  178,  151,  157,  206,  151,
-      151,  180,  186,  163,  176,  178,  208,  249,  169,  158,
-      160,  180,  186,  204,  205,  543,  216,  164,  223,  205,
-      232,  242,  216,  232,  205,  167,  216,  248,  223,  241,
-      241,  242,  542,  244,  257,  256,  244,  248,  282,  292,
-
-      357,  541,  206,  244,  244,  256,  339,  257,  282,  292,
-      208,  249,  304,  304,  348,  349,  339,  351,  352,  304,
-      354,  304,  355,  356,  348,  349,  366,  351,  352,  377,
-      354,  540,  355,  356,  385,  385,  366,  386,  386,  377,
-      387,  357,  389,  392,  394,  397,  399,  401,  406,  407,
-      387,  411,  389,  392,  394,  397,  399,  401,  406,  407,
-      412,  411,  422,  424,  436,  445,  447,  450,  452,  463,
-      412,  465,  422,  424,  436,  445,  447,  450,  452,  463,
-      476,  465,  482,  506,  517,  519,  529,  539,  538,  535,
-      476,  534,  482,  506,  517,  519,  529,  533,  532,  530,
-
-      528,  526,  524,  522,  521,  520,  518,  516,  515,  514,
-      513,  512,  510,  509,  450,  551,  551,  552,  552,  508,
-      505,  504,  503,  502,  501,  500,  499,  498,  496,  495,
-      494,  493,  492,  491,  489,  488,  486,  485,  483,  481,
-      480,  479,  478,  477,  475,  474,  473,  472,  470,  469,
-      468,  467,  466,  464,  462,  459,  458,  457,  456,  454,
-      453,  451,  448,  446,  444,  443,  442,  441,  440,  438,
-      437,  435,  434,  433,  432,  431,  430,  429,  428,  427,
-      426,  425,  423,  421,  420,  419,  418,  417,  416,  415,
-      414,  413,  410,  409,  408,  405,  403,  402,  400,  398,
-
-      396,  395,  393,  391,  390,  388,  384,  383,  382,  381,
-      380,  379,  378,  376,  375,  374,  373,  372,  370,  369,
-      368,  367,  365,  364,  363,  362,  361,  360,  358,  353,
-      350,  347,  346,  345,  344,  343,  342,  341,  340,  338,
-      337,  336,  335,  334,  333,  332,  331,  330,  329,  328,
-      327,  326,  325,  324,  323,  322,  321,  320,  318,  317,
-      316,  315,  314,  313,  312,  311,  310,  309,  308,  307,
-      306,  305,  303,  302,  301,  300,  299,  298,  297,  296,
-      295,  294,  293,  291,  290,  288,  287,  286,  285,  284,
-      283,  281,  280,  279,  278,  277,  276,  275,  274,  273,
-
-      272,  271,  270,  269,  268,  267,  266,  265,  264,  263,
-      262,  261,  260,  259,  258,  255,  254,  253,  252,  251,
-      250,  247,  246,  245,  243,  240,  239,  238,  237,  236,
-      235,  234,  233,  231,  230,  229,  228,  227,  226,  225,
-      224,  222,  221,  220,  219,  218,  217,  214,  213,  211,
-      210,  209,  207,  203,  202,  201,  200,  199,  198,  197,
-      196,  195,  194,  193,  192,  191,  190,  189,  187,  185,
-      184,  183,  182,  181,  179,  177,  175,  174,  173,  172,
-      171,  170,  168,  166,  165,  162,  161,  159,  154,  153,
-      152,  150,  149,  148,  146,  145,  144,  143,  142,  141,
-
-      139,  137,  136,  135,  134,  132,  131,  128,  127,  122,
-      118,  110,  109,  107,  105,  104,  103,  101,  100,   99,
-       98,   97,   96,   95,   94,   93,   92,   91,   90,   89,
-       88,   87,   86,   72,   70,   67,   66,   65,   64,   62,
-       61,   60,   59,   58,   57,   55,   39,   37,   34,   33,
-       32,   29,   26,   25,   24,   23,    8,    7,    3,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,
-      550,  550,  550,  550
+      130,  140,  129,  133,  153,  155,  158,  126,  138,  140,
+      140,  112,  147,  153,  112,  112,  140,  160,  140,  117,
+      156,  163,  147,  164,  121,  156,  155,  157,  167,  169,
+      156,  176,  157,  125,  205,  178,  151,  157,  180,  151,
+      151,  176,  186,  207,  163,  178,  206,  188,  180,  169,
+      158,  206,  186,  188,  209,  224,  206,  205,  217,  233,
+      251,  160,  233,  243,  217,  224,  259,  164,  217,  242,
+      242,  245,  361,  243,  245,  250,  167,  576,  258,  259,
+
+      284,  245,  245,  295,  575,  250,  343,  207,  258,  352,
+      284,  574,  353,  295,  307,  307,  343,  355,  209,  352,
+      356,  307,  353,  307,  251,  358,  359,  355,  360,  370,
+      356,  382,  571,  361,  568,  358,  359,  392,  360,  370,
+      394,  382,  390,  390,  391,  391,  397,  392,  399,  402,
+      394,  404,  406,  411,  412,  416,  397,  417,  399,  402,
+      567,  404,  406,  411,  412,  416,  422,  417,  428,  430,
+      422,  442,  451,  453,  456,  458,  471,  473,  428,  430,
+      484,  442,  451,  453,  456,  458,  471,  473,  490,  516,
+      484,  529,  531,  543,  566,  565,  564,  563,  490,  516,
+
+      562,  529,  531,  543,  561,  560,  559,  558,  557,  556,
+      555,  554,  551,  550,  549,  548,  547,  546,  544,  542,
+      540,  456,  582,  582,  583,  583,  538,  536,  535,  534,
+      533,  532,  530,  528,  527,  526,  525,  524,  522,  521,
+      520,  519,  518,  515,  514,  513,  512,  511,  510,  509,
+      508,  506,  505,  504,  503,  502,  501,  499,  498,  497,
+      496,  494,  493,  491,  489,  488,  487,  486,  485,  483,
+      482,  481,  480,  478,  477,  476,  475,  474,  472,  470,
+      467,  466,  465,  464,  463,  462,  460,  459,  457,  454,
+      452,  450,  449,  448,  447,  446,  444,  443,  441,  440,
+
+      439,  438,  437,  436,  435,  434,  433,  432,  431,  429,
+      427,  426,  425,  424,  423,  421,  420,  419,  418,  415,
+      414,  413,  410,  408,  407,  405,  403,  401,  400,  398,
+      396,  395,  393,  389,  388,  387,  386,  385,  384,  383,
+      381,  380,  379,  378,  377,  375,  374,  373,  372,  371,
+      369,  368,  367,  366,  365,  364,  362,  357,  354,  351,
+      350,  349,  348,  347,  346,  345,  344,  342,  341,  340,
+      339,  338,  337,  336,  335,  334,  333,  332,  331,  330,
+      329,  328,  327,  326,  325,  324,  323,  321,  320,  319,
+      318,  317,  316,  315,  314,  313,  312,  311,  310,  309,
+
+      308,  306,  305,  304,  303,  302,  301,  300,  299,  298,
+      297,  296,  294,  293,  292,  290,  289,  288,  287,  286,
+      285,  283,  282,  281,  280,  279,  278,  277,  276,  275,
+      274,  273,  272,  271,  270,  269,  268,  267,  266,  265,
+      264,  263,  262,  261,  260,  257,  256,  255,  254,  253,
+      252,  249,  248,  247,  246,  244,  241,  240,  239,  238,
+      237,  236,  235,  234,  232,  231,  230,  229,  228,  227,
+      226,  225,  223,  222,  221,  220,  219,  218,  215,  214,
+      212,  211,  210,  208,  204,  203,  202,  201,  200,  199,
+      198,  197,  196,  195,  194,  193,  192,  191,  190,  189,
+
+      187,  185,  184,  183,  182,  181,  179,  177,  175,  174,
+      173,  172,  171,  170,  168,  166,  165,  162,  161,  159,
+      154,  152,  150,  149,  148,  146,  145,  144,  143,  142,
+      141,  139,  137,  136,  135,  134,  132,  131,  128,  127,
+      122,  118,  110,  109,  107,  105,  104,  103,  101,  100,
+       99,   98,   97,   96,   95,   94,   93,   92,   91,   90,
+       89,   88,   87,   86,   72,   70,   67,   66,   65,   64,
+       62,   61,   60,   59,   58,   57,   55,   39,   37,   34,
+       33,   32,   29,   26,   25,   24,   23,    8,    7,    3,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      581,  581,  581,  581,  581
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -810,7 +826,7 @@ char *yytext;
 #line 2 "osm_qos_parser_l.l"
 /*
  * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -854,6 +870,8 @@ char *yytext;
  *    Yevgeny Kliteynik, Mellanox
  */
 
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_QOS_PARSER_L_L
 #include <opensm/osm_qos_policy.h>
 #include "osm_qos_parser_y.h"
 
@@ -929,7 +947,7 @@ static void reset_new_line_flags();
 
 
 #define YY_NO_INPUT 1
-#line 933 "osm_qos_parser_l.c"
+#line 951 "osm_qos_parser_l.c"
 
 #define INITIAL 0
 
@@ -1016,7 +1034,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -1027,7 +1045,7 @@ static int input (void );
 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
 		{ \
 		int c = '*'; \
-		int n; \
+		unsigned n; \
 		for ( n = 0; n < max_size && \
 			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
 			buf[n] = (char) c; \
@@ -1109,11 +1127,11 @@ YY_DECL
 	register char *yy_cp, *yy_bp;
 	register int yy_act;
     
-#line 201 "osm_qos_parser_l.l"
+#line 205 "osm_qos_parser_l.l"
 
 
 
-#line 1117 "osm_qos_parser_l.c"
+#line 1135 "osm_qos_parser_l.c"
 
 	if ( !(yy_init) )
 		{
@@ -1166,13 +1184,13 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 551 )
+				if ( yy_current_state >= 582 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			++yy_cp;
 			}
-		while ( yy_base[yy_current_state] != 760 );
+		while ( yy_base[yy_current_state] != 791 );
 
 yy_find_action:
 		yy_act = yy_accept[yy_current_state];
@@ -1199,374 +1217,384 @@ do_action:	/* This label is used only to access EOF actions. */
 case 1:
 /* rule 1 can match eol */
 YY_RULE_SETUP
-#line 204 "osm_qos_parser_l.l"
+#line 208 "osm_qos_parser_l.l"
 { SAVE_POS; RESET_NEW_LINE_FLAGS; } /* swallow comment */
 	YY_BREAK
 case 2:
 /* rule 2 can match eol */
 YY_RULE_SETUP
-#line 205 "osm_qos_parser_l.l"
+#line 209 "osm_qos_parser_l.l"
 { SAVE_POS; RESET_NEW_LINE_FLAGS; } /* trailing blanks with new line */
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 206 "osm_qos_parser_l.l"
+#line 210 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; }
 	YY_BREAK
 case 4:
 /* rule 4 can match eol */
 YY_RULE_SETUP
-#line 207 "osm_qos_parser_l.l"
+#line 211 "osm_qos_parser_l.l"
 { SAVE_POS; RESET_NEW_LINE_FLAGS; }
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 209 "osm_qos_parser_l.l"
+#line 213 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_ULPS_START; }
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 210 "osm_qos_parser_l.l"
+#line 214 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_ULPS_END; }
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 212 "osm_qos_parser_l.l"
+#line 216 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUPS_START; }
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 213 "osm_qos_parser_l.l"
+#line 217 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUPS_END; }
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 214 "osm_qos_parser_l.l"
+#line 218 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUP_START; }
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 215 "osm_qos_parser_l.l"
+#line 219 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUP_END; }
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 217 "osm_qos_parser_l.l"
+#line 221 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_SETUP_START; }
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 218 "osm_qos_parser_l.l"
+#line 222 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_SETUP_END; }
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 219 "osm_qos_parser_l.l"
+#line 223 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_TABLES_START; }
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 220 "osm_qos_parser_l.l"
+#line 224 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_TABLES_END; }
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 221 "osm_qos_parser_l.l"
+#line 225 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_SCOPE_START; }
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 222 "osm_qos_parser_l.l"
+#line 226 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_SCOPE_END; }
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 224 "osm_qos_parser_l.l"
+#line 228 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_TABLES_START; }
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 225 "osm_qos_parser_l.l"
+#line 229 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_TABLES_END; }
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 226 "osm_qos_parser_l.l"
+#line 230 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_SCOPE_START; }
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 227 "osm_qos_parser_l.l"
+#line 231 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_SCOPE_END; }
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 229 "osm_qos_parser_l.l"
+#line 233 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVELS_START; }
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 230 "osm_qos_parser_l.l"
+#line 234 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVELS_END; }
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 231 "osm_qos_parser_l.l"
+#line 235 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVEL_START; }
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 232 "osm_qos_parser_l.l"
+#line 236 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVEL_END; }
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 234 "osm_qos_parser_l.l"
+#line 238 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULES_START; }
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 235 "osm_qos_parser_l.l"
+#line 239 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULES_END; }
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 236 "osm_qos_parser_l.l"
+#line 240 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULE_START; }
 	YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 237 "osm_qos_parser_l.l"
+#line 241 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULE_END; }
 	YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 239 "osm_qos_parser_l.l"
+#line 243 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PORT_GUID;    return TK_PORT_GUID;  }
 	YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 240 "osm_qos_parser_l.l"
+#line 244 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PORT_NAME;    return TK_PORT_NAME;  }
 	YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 241 "osm_qos_parser_l.l"
+#line 245 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PARTITION;    return TK_PARTITION;  }
 	YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 242 "osm_qos_parser_l.l"
+#line 246 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_NODE_TYPE;    return TK_NODE_TYPE;  }
 	YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 243 "osm_qos_parser_l.l"
+#line 247 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_NAME;         return TK_NAME;       }
 	YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 244 "osm_qos_parser_l.l"
+#line 248 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_USE;          return TK_USE;        }
 	YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 245 "osm_qos_parser_l.l"
+#line 249 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_GROUP;        return TK_GROUP;      }
 	YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 246 "osm_qos_parser_l.l"
+#line 250 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_VLARB_HIGH;   return TK_VLARB_HIGH; }
 	YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 247 "osm_qos_parser_l.l"
+#line 251 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_VLARB_LOW;    return TK_VLARB_LOW;  }
 	YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 248 "osm_qos_parser_l.l"
+#line 252 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_VLARB_HIGH_LIMIT; return TK_VLARB_HIGH_LIMIT;}
 	YY_BREAK
 case 39:
 YY_RULE_SETUP
-#line 249 "osm_qos_parser_l.l"
+#line 253 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_TO;           return TK_TO;         }
 	YY_BREAK
 case 40:
 YY_RULE_SETUP
-#line 250 "osm_qos_parser_l.l"
+#line 254 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_FROM;         return TK_FROM;       }
 	YY_BREAK
 case 41:
 YY_RULE_SETUP
-#line 251 "osm_qos_parser_l.l"
+#line 255 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ACROSS_TO;    return TK_ACROSS_TO;  }
 	YY_BREAK
 case 42:
 YY_RULE_SETUP
-#line 252 "osm_qos_parser_l.l"
+#line 256 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ACROSS_FROM;  return TK_ACROSS_FROM;}
 	YY_BREAK
 case 43:
 YY_RULE_SETUP
-#line 253 "osm_qos_parser_l.l"
+#line 257 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ACROSS;       return TK_ACROSS;     }
 	YY_BREAK
 case 44:
 YY_RULE_SETUP
-#line 254 "osm_qos_parser_l.l"
+#line 258 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SL2VL_TABLE;  return TK_SL2VL_TABLE;}
 	YY_BREAK
 case 45:
 YY_RULE_SETUP
-#line 255 "osm_qos_parser_l.l"
+#line 259 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SL;           return TK_SL;         }
 	YY_BREAK
 case 46:
 YY_RULE_SETUP
-#line 256 "osm_qos_parser_l.l"
+#line 260 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_MTU_LIMIT;    return TK_MTU_LIMIT;  }
 	YY_BREAK
 case 47:
 YY_RULE_SETUP
-#line 257 "osm_qos_parser_l.l"
+#line 261 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_RATE_LIMIT;   return TK_RATE_LIMIT; }
 	YY_BREAK
 case 48:
 YY_RULE_SETUP
-#line 258 "osm_qos_parser_l.l"
+#line 262 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PACKET_LIFE;  return TK_PACKET_LIFE;}
 	YY_BREAK
 case 49:
 YY_RULE_SETUP
-#line 259 "osm_qos_parser_l.l"
+#line 263 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PATH_BITS;    return TK_PATH_BITS;  }
 	YY_BREAK
 case 50:
 YY_RULE_SETUP
-#line 260 "osm_qos_parser_l.l"
+#line 264 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_QOS_CLASS;    return TK_QOS_CLASS;  }
 	YY_BREAK
 case 51:
 YY_RULE_SETUP
-#line 261 "osm_qos_parser_l.l"
+#line 265 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SOURCE;       return TK_SOURCE;     }
 	YY_BREAK
 case 52:
 YY_RULE_SETUP
-#line 262 "osm_qos_parser_l.l"
+#line 266 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_DESTINATION;  return TK_DESTINATION;}
 	YY_BREAK
 case 53:
 YY_RULE_SETUP
-#line 263 "osm_qos_parser_l.l"
+#line 267 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SERVICE_ID;   return TK_SERVICE_ID; }
 	YY_BREAK
 case 54:
 YY_RULE_SETUP
-#line 264 "osm_qos_parser_l.l"
+#line 268 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PKEY;         return TK_PKEY;       }
 	YY_BREAK
 case 55:
 YY_RULE_SETUP
-#line 265 "osm_qos_parser_l.l"
+#line 269 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_QOS_LEVEL_NAME; return TK_QOS_LEVEL_NAME;}
 	YY_BREAK
 case 56:
 YY_RULE_SETUP
-#line 267 "osm_qos_parser_l.l"
+#line 271 "osm_qos_parser_l.l"
 { SAVE_POS; if (in_node_type) return TK_NODE_TYPE_ROUTER; yylval = strdup(yytext); return TK_TEXT; }
 	YY_BREAK
 case 57:
 YY_RULE_SETUP
-#line 268 "osm_qos_parser_l.l"
+#line 272 "osm_qos_parser_l.l"
 { SAVE_POS; if (in_node_type) return TK_NODE_TYPE_CA;     yylval = strdup(yytext); return TK_TEXT; }
 	YY_BREAK
 case 58:
 YY_RULE_SETUP
-#line 269 "osm_qos_parser_l.l"
+#line 273 "osm_qos_parser_l.l"
 { SAVE_POS; if (in_node_type) return TK_NODE_TYPE_SWITCH; yylval = strdup(yytext); return TK_TEXT; }
 	YY_BREAK
 case 59:
 YY_RULE_SETUP
-#line 270 "osm_qos_parser_l.l"
+#line 274 "osm_qos_parser_l.l"
 { SAVE_POS; if (in_node_type) return TK_NODE_TYPE_SELF;   yylval = strdup(yytext); return TK_TEXT; }
 	YY_BREAK
 case 60:
 YY_RULE_SETUP
-#line 271 "osm_qos_parser_l.l"
+#line 275 "osm_qos_parser_l.l"
 { SAVE_POS; if (in_node_type) return TK_NODE_TYPE_ALL;    yylval = strdup(yytext); return TK_TEXT; }
 	YY_BREAK
 case 61:
 YY_RULE_SETUP
-#line 273 "osm_qos_parser_l.l"
+#line 277 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_DEFAULT; return TK_ULP_DEFAULT; }
 	YY_BREAK
 case 62:
 YY_RULE_SETUP
-#line 274 "osm_qos_parser_l.l"
+#line 278 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_SERVICE_ID; }
 	YY_BREAK
 case 63:
 YY_RULE_SETUP
-#line 275 "osm_qos_parser_l.l"
+#line 279 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_PKEY; }
 	YY_BREAK
 case 64:
 YY_RULE_SETUP
-#line 276 "osm_qos_parser_l.l"
+#line 280 "osm_qos_parser_l.l"
 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_TARGET_PORT_GUID; }
 	YY_BREAK
 case 65:
 YY_RULE_SETUP
-#line 278 "osm_qos_parser_l.l"
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_DEFAULT; return TK_ULP_SDP_DEFAULT; }
+#line 281 "osm_qos_parser_l.l"
+{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_SOURCE_PORT_GUID; }
 	YY_BREAK
 case 66:
 YY_RULE_SETUP
-#line 279 "osm_qos_parser_l.l"
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_PORT; return TK_ULP_SDP_PORT; }
+#line 282 "osm_qos_parser_l.l"
+{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_SOURCE_TARGET_PORT_GUID; }
 	YY_BREAK
 case 67:
 YY_RULE_SETUP
-#line 281 "osm_qos_parser_l.l"
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_RDS_DEFAULT; return TK_ULP_RDS_DEFAULT; }
+#line 284 "osm_qos_parser_l.l"
+{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_DEFAULT; return TK_ULP_SDP_DEFAULT; }
 	YY_BREAK
 case 68:
 YY_RULE_SETUP
-#line 282 "osm_qos_parser_l.l"
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_RDS_PORT; return TK_ULP_RDS_PORT; }
+#line 285 "osm_qos_parser_l.l"
+{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_PORT; return TK_ULP_SDP_PORT; }
 	YY_BREAK
 case 69:
 YY_RULE_SETUP
-#line 284 "osm_qos_parser_l.l"
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_DEFAULT; return TK_ULP_ISER_DEFAULT; }
+#line 287 "osm_qos_parser_l.l"
+{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_RDS_DEFAULT; return TK_ULP_RDS_DEFAULT; }
 	YY_BREAK
 case 70:
 YY_RULE_SETUP
-#line 285 "osm_qos_parser_l.l"
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_PORT; return TK_ULP_ISER_PORT; }
+#line 288 "osm_qos_parser_l.l"
+{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_RDS_PORT; return TK_ULP_RDS_PORT; }
 	YY_BREAK
 case 71:
 YY_RULE_SETUP
-#line 287 "osm_qos_parser_l.l"
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SRP_GUID; return TK_ULP_SRP_GUID; }
+#line 290 "osm_qos_parser_l.l"
+{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_DEFAULT; return TK_ULP_ISER_DEFAULT; }
 	YY_BREAK
 case 72:
 YY_RULE_SETUP
-#line 289 "osm_qos_parser_l.l"
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_IPOIB_DEFAULT; return TK_ULP_IPOIB_DEFAULT; }
+#line 291 "osm_qos_parser_l.l"
+{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_PORT; return TK_ULP_ISER_PORT; }
 	YY_BREAK
 case 73:
 YY_RULE_SETUP
-#line 290 "osm_qos_parser_l.l"
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_IPOIB_PKEY; return TK_ULP_IPOIB_PKEY; }
+#line 293 "osm_qos_parser_l.l"
+{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SRP_GUID; return TK_ULP_SRP_GUID; }
 	YY_BREAK
 case 74:
 YY_RULE_SETUP
-#line 292 "osm_qos_parser_l.l"
+#line 295 "osm_qos_parser_l.l"
+{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_IPOIB_DEFAULT; return TK_ULP_IPOIB_DEFAULT; }
+	YY_BREAK
+case 75:
+YY_RULE_SETUP
+#line 296 "osm_qos_parser_l.l"
+{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_IPOIB_PKEY; return TK_ULP_IPOIB_PKEY; }
+	YY_BREAK
+case 76:
+YY_RULE_SETUP
+#line 298 "osm_qos_parser_l.l"
 {
                         SAVE_POS;
                         yylval = strdup(yytext);
@@ -1575,9 +1603,9 @@ YY_RULE_SETUP
                         return TK_NUMBER;
                     }
 	YY_BREAK
-case 75:
+case 77:
 YY_RULE_SETUP
-#line 300 "osm_qos_parser_l.l"
+#line 306 "osm_qos_parser_l.l"
 {
                         SAVE_POS;
                         yylval = strdup(yytext);
@@ -1586,9 +1614,9 @@ YY_RULE_SETUP
                         return TK_NUMBER;
                     }
 	YY_BREAK
-case 76:
+case 78:
 YY_RULE_SETUP
-#line 309 "osm_qos_parser_l.l"
+#line 315 "osm_qos_parser_l.l"
 {
                         SAVE_POS;
                         if (in_description || in_list_of_strings || in_single_string)
@@ -1599,9 +1627,9 @@ YY_RULE_SETUP
                         return TK_DASH;
                     }
 	YY_BREAK
-case 77:
+case 79:
 YY_RULE_SETUP
-#line 319 "osm_qos_parser_l.l"
+#line 325 "osm_qos_parser_l.l"
 {
                         SAVE_POS;
                         if (in_description || in_list_of_strings || in_single_string)
@@ -1612,9 +1640,9 @@ YY_RULE_SETUP
                         return TK_DOTDOT;
                     }
 	YY_BREAK
-case 78:
+case 80:
 YY_RULE_SETUP
-#line 329 "osm_qos_parser_l.l"
+#line 335 "osm_qos_parser_l.l"
 {
                         SAVE_POS;
                         if (in_description)
@@ -1625,9 +1653,9 @@ YY_RULE_SETUP
                         return TK_COMMA;
                     }
 	YY_BREAK
-case 79:
+case 81:
 YY_RULE_SETUP
-#line 339 "osm_qos_parser_l.l"
+#line 345 "osm_qos_parser_l.l"
 {
                         SAVE_POS;
                         if (in_description || in_list_of_strings || in_single_string)
@@ -1638,10 +1666,10 @@ YY_RULE_SETUP
                         return TK_ASTERISK;
                     }
 	YY_BREAK
-case 80:
-/* rule 80 can match eol */
+case 82:
+/* rule 82 can match eol */
 YY_RULE_SETUP
-#line 349 "osm_qos_parser_l.l"
+#line 355 "osm_qos_parser_l.l"
 {
                         SAVE_POS;
                         yylval = strdup(&yytext[1]);
@@ -1649,19 +1677,24 @@ YY_RULE_SETUP
                         return TK_TEXT;
                     }
 	YY_BREAK
-case 81:
+case 83:
 YY_RULE_SETUP
-#line 356 "osm_qos_parser_l.l"
+#line 362 "osm_qos_parser_l.l"
 { SAVE_POS; yylval = strdup(yytext); return TK_TEXT;}
 	YY_BREAK
-case 82:
+case YY_STATE_EOF(INITIAL):
+#line 364 "osm_qos_parser_l.l"
+{
+                        YY_NEW_FILE;
+                        yyterminate();
+                    }
+	YY_BREAK
+case 84:
 YY_RULE_SETUP
-#line 358 "osm_qos_parser_l.l"
+#line 368 "osm_qos_parser_l.l"
 ECHO;
 	YY_BREAK
-#line 1663 "osm_qos_parser_l.c"
-case YY_STATE_EOF(INITIAL):
-	yyterminate();
+#line 1698 "osm_qos_parser_l.c"
 
 	case YY_END_OF_BUFFER:
 		{
@@ -1951,7 +1984,7 @@ static int yy_get_next_buffer (void)
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 551 )
+			if ( yy_current_state >= 582 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1979,11 +2012,11 @@ static int yy_get_next_buffer (void)
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 551 )
+		if ( yy_current_state >= 582 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 550);
+	yy_is_jam = (yy_current_state == 581);
 
 	return yy_is_jam ? 0 : yy_current_state;
 }
@@ -2172,19 +2205,9 @@ static void yy_load_buffer_state  (void)
 	yyfree((void *) b  );
 }
 
-#ifndef _UNISTD_H /* assume unistd.h has isatty() for us */
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __THROW /* this is a gnuism */
-extern int isatty (int ) __THROW;
-#else
+#ifndef __cplusplus
 extern int isatty (int );
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
+#endif /* __cplusplus */
     
 /* Initializes or reinitializes a buffer.
  * This function is sometimes called more than once on the same buffer,
@@ -2630,7 +2653,7 @@ void yyfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 358 "osm_qos_parser_l.l"
+#line 368 "osm_qos_parser_l.l"
 
 
 
diff --git a/opensm/osm_qos_parser_l.l b/opensm/osm_qos_parser_l.l
index ecdee8a..6054397 100644
--- a/opensm/osm_qos_parser_l.l
+++ b/opensm/osm_qos_parser_l.l
@@ -1,7 +1,7 @@
 %{
 /*
  * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -45,6 +45,8 @@
  *    Yevgeny Kliteynik, Mellanox
  */
 
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_QOS_PARSER_L_L
 #include <opensm/osm_qos_policy.h>
 #include "osm_qos_parser_y.h"
 
@@ -134,6 +136,8 @@ NAME                    name
 USE                     use
 PORT_GUID               port\-guid
 TARGET_PORT_GUID        target\-port\-guid
+SOURCE_PORT_GUID        source\-port\-guid
+SOURCE_TARGET_PORT_GUID source\-target\-port\-guid
 PORT_NAME               port\-name
 PARTITION               partition
 NODE_TYPE               node\-type
@@ -274,6 +278,8 @@ QUOTED_TEXT             \"[^\"]*\"
 {ULP_ANY}{WHITE_COMMA_WHITE}{SERVICE_ID}       { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_SERVICE_ID; }
 {ULP_ANY}{WHITE_COMMA_WHITE}{PKEY}             { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_PKEY; }
 {ULP_ANY}{WHITE_COMMA_WHITE}{TARGET_PORT_GUID} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_TARGET_PORT_GUID; }
+{ULP_ANY}{WHITE_COMMA_WHITE}{SOURCE_PORT_GUID} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_SOURCE_PORT_GUID; }
+{ULP_ANY}{WHITE_COMMA_WHITE}{SOURCE_TARGET_PORT_GUID} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_SOURCE_TARGET_PORT_GUID; }
 
 {ULP_SDP}{WHITE_DOTDOT_WHITE}                  { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_DEFAULT; return TK_ULP_SDP_DEFAULT; }
 {ULP_SDP}{WHITE_COMMA_WHITE}{PORT_NUM}         { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_PORT; return TK_ULP_SDP_PORT; }
@@ -355,6 +361,10 @@ QUOTED_TEXT             \"[^\"]*\"
 
 .                   { SAVE_POS; yylval = strdup(yytext); return TK_TEXT;}
 
+<<EOF>>             {
+                        YY_NEW_FILE;
+                        yyterminate();
+                    }
 %%
 
 
diff --git a/opensm/osm_qos_parser_y.c b/opensm/osm_qos_parser_y.c
index 3ffd75b..81c2491 100644
--- a/opensm/osm_qos_parser_y.c
+++ b/opensm/osm_qos_parser_y.c
@@ -1,10 +1,8 @@
+/* A Bison parser, made by GNU Bison 2.5.  */
 
-/* A Bison parser, made by GNU Bison 2.4.1.  */
-
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* Bison implementation for Yacc-like parsers in C
    
-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-   Free Software Foundation, Inc.
+      Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -46,7 +44,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.4.1"
+#define YYBISON_VERSION "2.5"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -67,12 +65,12 @@
 
 /* Copy the first part of user declarations.  */
 
-/* Line 189 of yacc.c  */
+/* Line 268 of yacc.c  */
 #line 1 "osm_qos_parser_y.y"
 
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 HNR Consulting. All rights reserved.
  *
@@ -124,6 +122,8 @@
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_QOS_PARSER_Y_Y
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_qos_policy.h>
 
@@ -220,6 +220,7 @@ extern char * yytext;
 extern int yylex (void);
 extern FILE * yyin;
 extern int errno;
+extern void yyrestart(FILE *input_file);
 int yyparse();
 
 #define RESET_BUFFER  __parser_tmp_struct_reset()
@@ -255,8 +256,8 @@ static cl_list_t __ulp_match_rules;
 
 
 
-/* Line 189 of yacc.c  */
-#line 260 "osm_qos_parser_y.c"
+/* Line 268 of yacc.c  */
+#line 261 "osm_qos_parser_y.c"
 
 /* Enabling traces.  */
 #ifndef YYDEBUG
@@ -349,15 +350,17 @@ static cl_list_t __ulp_match_rules;
      TK_ULP_ANY_SERVICE_ID = 321,
      TK_ULP_ANY_PKEY = 322,
      TK_ULP_ANY_TARGET_PORT_GUID = 323,
-     TK_ULP_SDP_DEFAULT = 324,
-     TK_ULP_SDP_PORT = 325,
-     TK_ULP_RDS_DEFAULT = 326,
-     TK_ULP_RDS_PORT = 327,
-     TK_ULP_ISER_DEFAULT = 328,
-     TK_ULP_ISER_PORT = 329,
-     TK_ULP_SRP_GUID = 330,
-     TK_ULP_IPOIB_DEFAULT = 331,
-     TK_ULP_IPOIB_PKEY = 332
+     TK_ULP_ANY_SOURCE_PORT_GUID = 324,
+     TK_ULP_ANY_SOURCE_TARGET_PORT_GUID = 325,
+     TK_ULP_SDP_DEFAULT = 326,
+     TK_ULP_SDP_PORT = 327,
+     TK_ULP_RDS_DEFAULT = 328,
+     TK_ULP_RDS_PORT = 329,
+     TK_ULP_ISER_DEFAULT = 330,
+     TK_ULP_ISER_PORT = 331,
+     TK_ULP_SRP_GUID = 332,
+     TK_ULP_IPOIB_DEFAULT = 333,
+     TK_ULP_IPOIB_PKEY = 334
    };
 #endif
 /* Tokens.  */
@@ -427,15 +430,17 @@ static cl_list_t __ulp_match_rules;
 #define TK_ULP_ANY_SERVICE_ID 321
 #define TK_ULP_ANY_PKEY 322
 #define TK_ULP_ANY_TARGET_PORT_GUID 323
-#define TK_ULP_SDP_DEFAULT 324
-#define TK_ULP_SDP_PORT 325
-#define TK_ULP_RDS_DEFAULT 326
-#define TK_ULP_RDS_PORT 327
-#define TK_ULP_ISER_DEFAULT 328
-#define TK_ULP_ISER_PORT 329
-#define TK_ULP_SRP_GUID 330
-#define TK_ULP_IPOIB_DEFAULT 331
-#define TK_ULP_IPOIB_PKEY 332
+#define TK_ULP_ANY_SOURCE_PORT_GUID 324
+#define TK_ULP_ANY_SOURCE_TARGET_PORT_GUID 325
+#define TK_ULP_SDP_DEFAULT 326
+#define TK_ULP_SDP_PORT 327
+#define TK_ULP_RDS_DEFAULT 328
+#define TK_ULP_RDS_PORT 329
+#define TK_ULP_ISER_DEFAULT 330
+#define TK_ULP_ISER_PORT 331
+#define TK_ULP_SRP_GUID 332
+#define TK_ULP_IPOIB_DEFAULT 333
+#define TK_ULP_IPOIB_PKEY 334
 
 
 
@@ -451,8 +456,8 @@ typedef int YYSTYPE;
 /* Copy the second part of user declarations.  */
 
 
-/* Line 264 of yacc.c  */
-#line 456 "osm_qos_parser_y.c"
+/* Line 343 of yacc.c  */
+#line 461 "osm_qos_parser_y.c"
 
 #ifdef short
 # undef short
@@ -502,7 +507,7 @@ typedef short int yytype_int16;
 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
 
 #ifndef YY_
-# if YYENABLE_NLS
+# if defined YYENABLE_NLS && YYENABLE_NLS
 #  if ENABLE_NLS
 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -555,11 +560,11 @@ YYID (yyi)
 #    define alloca _alloca
 #   else
 #    define YYSTACK_ALLOC alloca
-#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#     ifndef _STDLIB_H
-#      define _STDLIB_H 1
+#     ifndef EXIT_SUCCESS
+#      define EXIT_SUCCESS 0
 #     endif
 #    endif
 #   endif
@@ -582,24 +587,24 @@ YYID (yyi)
 #  ifndef YYSTACK_ALLOC_MAXIMUM
 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
 #  endif
-#  if (defined __cplusplus && ! defined _STDLIB_H \
+#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
        && ! ((defined YYMALLOC || defined malloc) \
 	     && (defined YYFREE || defined free)))
 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#   ifndef _STDLIB_H
-#    define _STDLIB_H 1
+#   ifndef EXIT_SUCCESS
+#    define EXIT_SUCCESS 0
 #   endif
 #  endif
 #  ifndef YYMALLOC
 #   define YYMALLOC malloc
-#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+#   if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
 #  ifndef YYFREE
 #   define YYFREE free
-#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+#   if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 void free (void *); /* INFRINGES ON USER NAME SPACE */
 #   endif
@@ -628,23 +633,7 @@ union yyalloc
      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
       + YYSTACK_GAP_MAXIMUM)
 
-/* Copy COUNT objects from FROM to TO.  The source and destination do
-   not overlap.  */
-# ifndef YYCOPY
-#  if defined __GNUC__ && 1 < __GNUC__
-#   define YYCOPY(To, From, Count) \
-      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-#  else
-#   define YYCOPY(To, From, Count)		\
-      do					\
-	{					\
-	  YYSIZE_T yyi;				\
-	  for (yyi = 0; yyi < (Count); yyi++)	\
-	    (To)[yyi] = (From)[yyi];		\
-	}					\
-      while (YYID (0))
-#  endif
-# endif
+# define YYCOPY_NEEDED 1
 
 /* Relocate STACK from its old location to the new one.  The
    local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -664,23 +653,43 @@ union yyalloc
 
 #endif
 
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from FROM to TO.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if defined __GNUC__ && 1 < __GNUC__
+#   define YYCOPY(To, From, Count) \
+      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+#  else
+#   define YYCOPY(To, From, Count)		\
+      do					\
+	{					\
+	  YYSIZE_T yyi;				\
+	  for (yyi = 0; yyi < (Count); yyi++)	\
+	    (To)[yyi] = (From)[yyi];		\
+	}					\
+      while (YYID (0))
+#  endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  3
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   262
+#define YYLAST   275
 
 /* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  78
+#define YYNTOKENS  80
 /* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  165
+#define YYNNTS  169
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  238
+#define YYNRULES  244
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  328
+#define YYNSTATES  340
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   332
+#define YYMAXUTOK   334
 
 #define YYTRANSLATE(YYX)						\
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -721,7 +730,7 @@ static const yytype_uint8 yytranslate[] =
       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
-      75,    76,    77
+      75,    76,    77,    78,    79
 };
 
 #if YYDEBUG
@@ -739,113 +748,117 @@ static const yytype_uint16 yyprhs[] =
      162,   164,   166,   168,   170,   172,   174,   178,   179,   182,
      186,   188,   190,   191,   194,   196,   198,   200,   202,   204,
      206,   208,   211,   212,   218,   219,   225,   226,   232,   233,
-     237,   238,   244,   245,   249,   250,   256,   257,   261,   262,
-     268,   269,   275,   276,   280,   281,   287,   289,   291,   293,
-     295,   297,   299,   301,   303,   305,   307,   309,   311,   313,
-     316,   318,   321,   323,   326,   328,   331,   333,   336,   338,
-     341,   343,   346,   348,   350,   354,   356,   358,   360,   362,
-     364,   366,   368,   370,   372,   374,   377,   379,   382,   384,
-     387,   389,   392,   394,   397,   399,   402,   404,   407,   409,
-     412,   414,   417,   419,   422,   424,   427,   429,   431,   433,
-     435,   437,   439,   441,   443,   445,   448,   450,   453,   455,
-     458,   460,   463,   465,   468,   470,   473,   475,   478,   480,
-     483,   485,   488,   490,   493,   495,   498,   500,   503,   505,
-     508,   510,   513,   515,   518,   520,   523,   525,   527,   529,
-     532,   534,   536,   540,   542,   544,   548,   550,   554,   560,
-     562,   564,   566,   568,   572,   578,   582,   584,   586
+     239,   240,   246,   247,   251,   252,   258,   259,   263,   264,
+     270,   271,   275,   276,   282,   283,   289,   290,   294,   295,
+     301,   303,   305,   307,   309,   311,   313,   315,   317,   319,
+     321,   323,   325,   327,   329,   331,   334,   336,   339,   341,
+     344,   346,   349,   351,   354,   356,   359,   361,   364,   366,
+     368,   372,   374,   376,   378,   380,   382,   384,   386,   388,
+     390,   392,   395,   397,   400,   402,   405,   407,   410,   412,
+     415,   417,   420,   422,   425,   427,   430,   432,   435,   437,
+     440,   442,   445,   447,   449,   451,   453,   455,   457,   459,
+     461,   463,   466,   468,   471,   473,   476,   478,   481,   483,
+     486,   488,   491,   493,   496,   498,   501,   503,   506,   508,
+     511,   513,   516,   518,   521,   523,   526,   528,   531,   533,
+     536,   538,   541,   543,   545,   547,   550,   552,   554,   558,
+     560,   562,   566,   568,   572,   578,   580,   582,   584,   586,
+     590,   596,   600,   602,   604
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
 static const yytype_int16 yyrhs[] =
 {
-      79,     0,    -1,    80,    -1,    -1,    80,    81,    -1,    82,
-      -1,    84,    -1,    91,    -1,   107,    -1,   114,    -1,     9,
-      83,    10,    -1,   121,    -1,    83,   121,    -1,    11,    85,
-      12,    -1,    86,    -1,    85,    86,    -1,    87,    89,    88,
-      -1,    13,    -1,    14,    -1,    -1,    89,    90,    -1,   147,
-      -1,   149,    -1,   153,    -1,   151,    -1,   155,    -1,   157,
-      -1,   159,    -1,    15,    92,    16,    -1,    -1,    92,    93,
-      -1,    92,   100,    -1,    17,    94,    18,    -1,    -1,    94,
-      95,    -1,    96,    98,    97,    -1,    19,    -1,    20,    -1,
-      -1,    98,    99,    -1,   168,    -1,   170,    -1,   174,    -1,
-     176,    -1,   172,    -1,    21,   101,    22,    -1,    -1,   101,
-     102,    -1,   103,   105,   104,    -1,    23,    -1,    24,    -1,
-      -1,   105,   106,    -1,   178,    -1,   180,    -1,   182,    -1,
-     184,    -1,   186,    -1,   188,    -1,   196,    -1,    25,   108,
-      26,    -1,    -1,   108,   109,    -1,   110,   112,   111,    -1,
-      27,    -1,    28,    -1,    -1,   112,   113,    -1,   198,    -1,
-     200,    -1,   202,    -1,   204,    -1,   206,    -1,   208,    -1,
-     210,    -1,   212,    -1,    29,   115,    30,    -1,    -1,   115,
-     116,    -1,   117,   119,   118,    -1,    31,    -1,    32,    -1,
-      -1,   119,   120,    -1,   214,    -1,   216,    -1,   222,    -1,
-     218,    -1,   220,    -1,   224,    -1,   226,    -1,    65,   232,
-      -1,    -1,   134,   238,     5,   122,   146,    -1,    -1,   135,
-     238,     5,   123,   146,    -1,    -1,   136,   238,     5,   124,
-     146,    -1,    -1,   137,   125,   146,    -1,    -1,   138,   238,
-       5,   126,   146,    -1,    -1,   139,   127,   146,    -1,    -1,
-     140,   238,     5,   128,   146,    -1,    -1,   141,   129,   146,
-      -1,    -1,   142,   238,     5,   130,   146,    -1,    -1,   143,
-     238,     5,   131,   146,    -1,    -1,   144,   132,   146,    -1,
-      -1,   145,   238,     5,   133,   146,    -1,    66,    -1,    67,
-      -1,    68,    -1,    69,    -1,    70,    -1,    71,    -1,    72,
-      -1,    73,    -1,    74,    -1,    75,    -1,    76,    -1,    77,
-      -1,   232,    -1,   148,   228,    -1,    33,    -1,   150,   228,
-      -1,    34,    -1,   152,   231,    -1,    36,    -1,   154,   238,
-      -1,    35,    -1,   156,   238,    -1,    59,    -1,   158,   231,
-      -1,    37,    -1,   160,   161,    -1,    38,    -1,   162,    -1,
-     161,     6,   162,    -1,   163,    -1,   164,    -1,   165,    -1,
-     166,    -1,   167,    -1,    61,    -1,    62,    -1,    60,    -1,
-      64,    -1,    63,    -1,   169,   231,    -1,    39,    -1,   171,
-     231,    -1,    40,    -1,   173,   232,    -1,    43,    -1,   175,
-     235,    -1,    41,    -1,   177,   235,    -1,    42,    -1,   179,
-     231,    -1,    39,    -1,   181,   231,    -1,    40,    -1,   183,
-     231,    -1,    47,    -1,   185,   231,    -1,    46,    -1,   187,
-     190,    -1,    45,    -1,   189,   192,    -1,    44,    -1,   191,
-      -1,   194,    -1,     7,    -1,   193,    -1,   195,    -1,     7,
-      -1,   238,    -1,   238,    -1,   197,   233,    -1,    48,    -1,
-     199,   228,    -1,    33,    -1,   201,   228,    -1,    34,    -1,
-     203,   232,    -1,    49,    -1,   205,   232,    -1,    50,    -1,
-     207,   232,    -1,    51,    -1,   209,   232,    -1,    52,    -1,
-     211,   238,    -1,    53,    -1,   213,   238,    -1,    59,    -1,
-     215,   228,    -1,    34,    -1,   217,   238,    -1,    54,    -1,
-     219,   231,    -1,    55,    -1,   221,   231,    -1,    56,    -1,
-     223,   228,    -1,    58,    -1,   225,   238,    -1,    57,    -1,
-     227,   238,    -1,    59,    -1,   229,    -1,   230,    -1,   229,
-     230,    -1,     8,    -1,   228,    -1,   231,     6,   228,    -1,
-     234,    -1,   234,    -1,   233,     6,   234,    -1,     3,    -1,
-     236,     5,   237,    -1,   235,     6,   236,     5,   237,    -1,
-       3,    -1,     3,    -1,   239,    -1,   240,    -1,   241,     4,
-     242,    -1,   239,     6,   241,     4,   242,    -1,   239,     6,
-     240,    -1,     3,    -1,     3,    -1,     3,    -1
+      81,     0,    -1,    82,    -1,    -1,    82,    83,    -1,    84,
+      -1,    86,    -1,    93,    -1,   109,    -1,   116,    -1,     9,
+      85,    10,    -1,   123,    -1,    85,   123,    -1,    11,    87,
+      12,    -1,    88,    -1,    87,    88,    -1,    89,    91,    90,
+      -1,    13,    -1,    14,    -1,    -1,    91,    92,    -1,   153,
+      -1,   155,    -1,   159,    -1,   157,    -1,   161,    -1,   163,
+      -1,   165,    -1,    15,    94,    16,    -1,    -1,    94,    95,
+      -1,    94,   102,    -1,    17,    96,    18,    -1,    -1,    96,
+      97,    -1,    98,   100,    99,    -1,    19,    -1,    20,    -1,
+      -1,   100,   101,    -1,   174,    -1,   176,    -1,   180,    -1,
+     182,    -1,   178,    -1,    21,   103,    22,    -1,    -1,   103,
+     104,    -1,   105,   107,   106,    -1,    23,    -1,    24,    -1,
+      -1,   107,   108,    -1,   184,    -1,   186,    -1,   188,    -1,
+     190,    -1,   192,    -1,   194,    -1,   202,    -1,    25,   110,
+      26,    -1,    -1,   110,   111,    -1,   112,   114,   113,    -1,
+      27,    -1,    28,    -1,    -1,   114,   115,    -1,   204,    -1,
+     206,    -1,   208,    -1,   210,    -1,   212,    -1,   214,    -1,
+     216,    -1,   218,    -1,    29,   117,    30,    -1,    -1,   117,
+     118,    -1,   119,   121,   120,    -1,    31,    -1,    32,    -1,
+      -1,   121,   122,    -1,   220,    -1,   222,    -1,   228,    -1,
+     224,    -1,   226,    -1,   230,    -1,   232,    -1,    65,   238,
+      -1,    -1,   138,   244,     5,   124,   152,    -1,    -1,   139,
+     244,     5,   125,   152,    -1,    -1,   140,   244,     5,   126,
+     152,    -1,    -1,   141,   244,     5,   127,   152,    -1,    -1,
+     142,   244,     5,   128,   152,    -1,    -1,   143,   129,   152,
+      -1,    -1,   144,   244,     5,   130,   152,    -1,    -1,   145,
+     131,   152,    -1,    -1,   146,   244,     5,   132,   152,    -1,
+      -1,   147,   133,   152,    -1,    -1,   148,   244,     5,   134,
+     152,    -1,    -1,   149,   244,     5,   135,   152,    -1,    -1,
+     150,   136,   152,    -1,    -1,   151,   244,     5,   137,   152,
+      -1,    66,    -1,    67,    -1,    68,    -1,    69,    -1,    70,
+      -1,    71,    -1,    72,    -1,    73,    -1,    74,    -1,    75,
+      -1,    76,    -1,    77,    -1,    78,    -1,    79,    -1,   238,
+      -1,   154,   234,    -1,    33,    -1,   156,   234,    -1,    34,
+      -1,   158,   237,    -1,    36,    -1,   160,   244,    -1,    35,
+      -1,   162,   244,    -1,    59,    -1,   164,   237,    -1,    37,
+      -1,   166,   167,    -1,    38,    -1,   168,    -1,   167,     6,
+     168,    -1,   169,    -1,   170,    -1,   171,    -1,   172,    -1,
+     173,    -1,    61,    -1,    62,    -1,    60,    -1,    64,    -1,
+      63,    -1,   175,   237,    -1,    39,    -1,   177,   237,    -1,
+      40,    -1,   179,   238,    -1,    43,    -1,   181,   241,    -1,
+      41,    -1,   183,   241,    -1,    42,    -1,   185,   237,    -1,
+      39,    -1,   187,   237,    -1,    40,    -1,   189,   237,    -1,
+      47,    -1,   191,   237,    -1,    46,    -1,   193,   196,    -1,
+      45,    -1,   195,   198,    -1,    44,    -1,   197,    -1,   200,
+      -1,     7,    -1,   199,    -1,   201,    -1,     7,    -1,   244,
+      -1,   244,    -1,   203,   239,    -1,    48,    -1,   205,   234,
+      -1,    33,    -1,   207,   234,    -1,    34,    -1,   209,   238,
+      -1,    49,    -1,   211,   238,    -1,    50,    -1,   213,   238,
+      -1,    51,    -1,   215,   238,    -1,    52,    -1,   217,   244,
+      -1,    53,    -1,   219,   244,    -1,    59,    -1,   221,   234,
+      -1,    34,    -1,   223,   244,    -1,    54,    -1,   225,   237,
+      -1,    55,    -1,   227,   237,    -1,    56,    -1,   229,   234,
+      -1,    58,    -1,   231,   244,    -1,    57,    -1,   233,   244,
+      -1,    59,    -1,   235,    -1,   236,    -1,   235,   236,    -1,
+       8,    -1,   234,    -1,   237,     6,   234,    -1,   240,    -1,
+     240,    -1,   239,     6,   240,    -1,     3,    -1,   242,     5,
+     243,    -1,   241,     6,   242,     5,   243,    -1,     3,    -1,
+       3,    -1,   245,    -1,   246,    -1,   247,     4,   248,    -1,
+     245,     6,   247,     4,   248,    -1,   245,     6,   246,    -1,
+       3,    -1,     3,    -1,     3,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   276,   276,   279,   280,   283,   284,   285,   286,   287,
-     311,   314,   315,   344,   347,   348,   351,   354,   359,   365,
-     366,   369,   370,   371,   372,   373,   374,   375,   402,   405,
-     406,   407,   412,   415,   416,   419,   422,   427,   433,   434,
-     449,   450,   451,   452,   453,   458,   461,   462,   465,   468,
-     473,   479,   480,   499,   500,   501,   502,   503,   504,   505,
-     529,   532,   533,   536,   539,   544,   550,   551,   554,   555,
-     556,   557,   558,   559,   560,   561,   583,   586,   587,   590,
-     593,   598,   604,   605,   608,   609,   610,   611,   612,   613,
-     614,   636,   654,   654,   675,   675,   696,   696,   731,   731,
-     744,   744,   777,   777,   790,   790,   823,   823,   836,   836,
-     869,   869,   905,   905,   925,   925,   956,   959,   962,   965,
-     968,   971,   974,   977,   980,   983,   986,   989,   993,  1032,
-    1055,  1060,  1083,  1088,  1154,  1159,  1179,  1184,  1204,  1209,
-    1217,  1222,  1227,  1232,  1233,  1236,  1237,  1238,  1239,  1240,
-    1243,  1249,  1255,  1261,  1269,  1291,  1308,  1313,  1330,  1335,
-    1353,  1358,  1375,  1380,  1397,  1413,  1430,  1435,  1454,  1459,
-    1476,  1481,  1499,  1504,  1509,  1514,  1519,  1524,  1525,  1528,
-    1535,  1536,  1539,  1546,  1578,  1611,  1654,  1671,  1694,  1699,
-    1722,  1727,  1747,  1752,  1772,  1778,  1798,  1804,  1824,  1830,
-    1865,  1870,  1903,  1920,  1943,  1948,  1982,  1987,  2004,  2009,
-    2026,  2031,  2054,  2059,  2092,  2097,  2130,  2141,  2148,  2149,
-    2152,  2159,  2160,  2165,  2168,  2169,  2172,  2180,  2186,  2194,
-    2200,  2206,  2209,  2215,  2227,  2239,  2247,  2254,  2260
+       0,   281,   281,   284,   285,   288,   289,   290,   291,   292,
+     318,   321,   322,   351,   354,   355,   358,   361,   366,   372,
+     373,   376,   377,   378,   379,   380,   381,   382,   409,   412,
+     413,   414,   419,   422,   423,   426,   429,   434,   440,   441,
+     456,   457,   458,   459,   460,   465,   468,   469,   472,   475,
+     480,   486,   487,   506,   507,   508,   509,   510,   511,   512,
+     536,   539,   540,   543,   546,   551,   557,   558,   561,   562,
+     563,   564,   565,   566,   567,   568,   590,   593,   594,   597,
+     600,   605,   611,   612,   615,   616,   617,   618,   619,   620,
+     621,   645,   663,   663,   684,   684,   705,   705,   740,   740,
+     775,   775,   813,   813,   826,   826,   860,   860,   873,   873,
+     907,   907,   920,   920,   954,   954,   990,   990,  1010,  1010,
+    1043,  1046,  1049,  1052,  1055,  1058,  1061,  1064,  1067,  1070,
+    1073,  1076,  1079,  1082,  1086,  1125,  1148,  1153,  1176,  1181,
+    1247,  1252,  1272,  1277,  1297,  1302,  1310,  1315,  1320,  1325,
+    1326,  1329,  1330,  1331,  1332,  1333,  1336,  1342,  1348,  1354,
+    1362,  1384,  1401,  1406,  1423,  1428,  1446,  1451,  1468,  1473,
+    1490,  1506,  1523,  1528,  1547,  1552,  1569,  1574,  1592,  1597,
+    1602,  1607,  1612,  1617,  1618,  1621,  1628,  1629,  1632,  1639,
+    1671,  1704,  1747,  1764,  1787,  1792,  1815,  1820,  1840,  1845,
+    1865,  1871,  1891,  1897,  1917,  1923,  1958,  1963,  1996,  2013,
+    2036,  2041,  2075,  2080,  2097,  2102,  2119,  2124,  2147,  2152,
+    2185,  2190,  2223,  2234,  2241,  2242,  2245,  2252,  2253,  2258,
+    2261,  2262,  2265,  2273,  2279,  2287,  2293,  2299,  2302,  2308,
+    2320,  2332,  2340,  2347,  2353
 };
 #endif
 
@@ -873,11 +886,12 @@ static const char *const yytname[] =
   "TK_PKEY", "TK_NODE_TYPE_ROUTER", "TK_NODE_TYPE_CA",
   "TK_NODE_TYPE_SWITCH", "TK_NODE_TYPE_SELF", "TK_NODE_TYPE_ALL",
   "TK_ULP_DEFAULT", "TK_ULP_ANY_SERVICE_ID", "TK_ULP_ANY_PKEY",
-  "TK_ULP_ANY_TARGET_PORT_GUID", "TK_ULP_SDP_DEFAULT", "TK_ULP_SDP_PORT",
-  "TK_ULP_RDS_DEFAULT", "TK_ULP_RDS_PORT", "TK_ULP_ISER_DEFAULT",
-  "TK_ULP_ISER_PORT", "TK_ULP_SRP_GUID", "TK_ULP_IPOIB_DEFAULT",
-  "TK_ULP_IPOIB_PKEY", "$accept", "head", "qos_policy_entries",
-  "qos_policy_entry", "qos_ulps_section", "qos_ulps",
+  "TK_ULP_ANY_TARGET_PORT_GUID", "TK_ULP_ANY_SOURCE_PORT_GUID",
+  "TK_ULP_ANY_SOURCE_TARGET_PORT_GUID", "TK_ULP_SDP_DEFAULT",
+  "TK_ULP_SDP_PORT", "TK_ULP_RDS_DEFAULT", "TK_ULP_RDS_PORT",
+  "TK_ULP_ISER_DEFAULT", "TK_ULP_ISER_PORT", "TK_ULP_SRP_GUID",
+  "TK_ULP_IPOIB_DEFAULT", "TK_ULP_IPOIB_PKEY", "$accept", "head",
+  "qos_policy_entries", "qos_policy_entry", "qos_ulps_section", "qos_ulps",
   "port_groups_section", "port_groups", "port_group", "port_group_start",
   "port_group_end", "port_group_entries", "port_group_entry",
   "qos_setup_section", "qos_setup_items", "vlarb_tables",
@@ -890,9 +904,10 @@ static const char *const yytname[] =
   "qos_match_rules_section", "qos_match_rules", "qos_match_rule",
   "qos_match_rule_start", "qos_match_rule_end", "qos_match_rule_entries",
   "qos_match_rule_entry", "qos_ulp", "$@1", "$@2", "$@3", "$@4", "$@5",
-  "$@6", "$@7", "$@8", "$@9", "$@10", "$@11", "$@12",
+  "$@6", "$@7", "$@8", "$@9", "$@10", "$@11", "$@12", "$@13", "$@14",
   "qos_ulp_type_any_service", "qos_ulp_type_any_pkey",
-  "qos_ulp_type_any_target_port_guid", "qos_ulp_type_sdp_default",
+  "qos_ulp_type_any_target_port_guid", "qos_ulp_type_any_source_port_guid",
+  "qos_ulp_type_any_source_target_port_guid", "qos_ulp_type_sdp_default",
   "qos_ulp_type_sdp_port", "qos_ulp_type_rds_default",
   "qos_ulp_type_rds_port", "qos_ulp_type_iser_default",
   "qos_ulp_type_iser_port", "qos_ulp_type_srp_guid",
@@ -952,37 +967,38 @@ static const yytype_uint16 yytoknum[] =
      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
-     325,   326,   327,   328,   329,   330,   331,   332
+     325,   326,   327,   328,   329,   330,   331,   332,   333,   334
 };
 # endif
 
 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_uint8 yyr1[] =
 {
-       0,    78,    79,    80,    80,    81,    81,    81,    81,    81,
-      82,    83,    83,    84,    85,    85,    86,    87,    88,    89,
-      89,    90,    90,    90,    90,    90,    90,    90,    91,    92,
-      92,    92,    93,    94,    94,    95,    96,    97,    98,    98,
-      99,    99,    99,    99,    99,   100,   101,   101,   102,   103,
-     104,   105,   105,   106,   106,   106,   106,   106,   106,   106,
-     107,   108,   108,   109,   110,   111,   112,   112,   113,   113,
-     113,   113,   113,   113,   113,   113,   114,   115,   115,   116,
-     117,   118,   119,   119,   120,   120,   120,   120,   120,   120,
-     120,   121,   122,   121,   123,   121,   124,   121,   125,   121,
-     126,   121,   127,   121,   128,   121,   129,   121,   130,   121,
-     131,   121,   132,   121,   133,   121,   134,   135,   136,   137,
+       0,    80,    81,    82,    82,    83,    83,    83,    83,    83,
+      84,    85,    85,    86,    87,    87,    88,    89,    90,    91,
+      91,    92,    92,    92,    92,    92,    92,    92,    93,    94,
+      94,    94,    95,    96,    96,    97,    98,    99,   100,   100,
+     101,   101,   101,   101,   101,   102,   103,   103,   104,   105,
+     106,   107,   107,   108,   108,   108,   108,   108,   108,   108,
+     109,   110,   110,   111,   112,   113,   114,   114,   115,   115,
+     115,   115,   115,   115,   115,   115,   116,   117,   117,   118,
+     119,   120,   121,   121,   122,   122,   122,   122,   122,   122,
+     122,   123,   124,   123,   125,   123,   126,   123,   127,   123,
+     128,   123,   129,   123,   130,   123,   131,   123,   132,   123,
+     133,   123,   134,   123,   135,   123,   136,   123,   137,   123,
      138,   139,   140,   141,   142,   143,   144,   145,   146,   147,
      148,   149,   150,   151,   152,   153,   154,   155,   156,   157,
-     158,   159,   160,   161,   161,   162,   162,   162,   162,   162,
-     163,   164,   165,   166,   167,   168,   169,   170,   171,   172,
+     158,   159,   160,   161,   162,   163,   164,   165,   166,   167,
+     167,   168,   168,   168,   168,   168,   169,   170,   171,   172,
      173,   174,   175,   176,   177,   178,   179,   180,   181,   182,
-     183,   184,   185,   186,   187,   188,   189,   190,   190,   191,
-     192,   192,   193,   194,   195,   196,   197,   198,   199,   200,
+     183,   184,   185,   186,   187,   188,   189,   190,   191,   192,
+     193,   194,   195,   196,   196,   197,   198,   198,   199,   200,
      201,   202,   203,   204,   205,   206,   207,   208,   209,   210,
      211,   212,   213,   214,   215,   216,   217,   218,   219,   220,
-     221,   222,   223,   224,   225,   226,   227,   228,   229,   229,
-     230,   231,   231,   232,   233,   233,   234,   235,   235,   236,
-     237,   238,   239,   239,   239,   239,   240,   241,   242
+     221,   222,   223,   224,   225,   226,   227,   228,   229,   230,
+     231,   232,   233,   234,   235,   235,   236,   237,   237,   238,
+     239,   239,   240,   241,   241,   242,   243,   244,   245,   245,
+     245,   245,   246,   247,   248
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
@@ -997,251 +1013,262 @@ static const yytype_uint8 yyr2[] =
        3,     0,     2,     3,     1,     1,     0,     2,     1,     1,
        1,     1,     1,     1,     1,     1,     3,     0,     2,     3,
        1,     1,     0,     2,     1,     1,     1,     1,     1,     1,
-       1,     2,     0,     5,     0,     5,     0,     5,     0,     3,
+       1,     2,     0,     5,     0,     5,     0,     5,     0,     5,
        0,     5,     0,     3,     0,     5,     0,     3,     0,     5,
-       0,     5,     0,     3,     0,     5,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     2,
-       1,     2,     1,     2,     1,     2,     1,     2,     1,     2,
-       1,     2,     1,     1,     3,     1,     1,     1,     1,     1,
+       0,     3,     0,     5,     0,     5,     0,     3,     0,     5,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
        1,     1,     1,     1,     1,     2,     1,     2,     1,     2,
+       1,     2,     1,     2,     1,     2,     1,     2,     1,     1,
+       3,     1,     1,     1,     1,     1,     1,     1,     1,     1,
        1,     2,     1,     2,     1,     2,     1,     2,     1,     2,
-       1,     2,     1,     2,     1,     2,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     2,     1,     2,     1,     2,
        1,     2,     1,     2,     1,     2,     1,     2,     1,     2,
+       1,     2,     1,     1,     1,     1,     1,     1,     1,     1,
        1,     2,     1,     2,     1,     2,     1,     2,     1,     2,
-       1,     2,     1,     2,     1,     2,     1,     1,     1,     2,
-       1,     1,     3,     1,     1,     3,     1,     3,     5,     1,
-       1,     1,     1,     3,     5,     3,     1,     1,     1
+       1,     2,     1,     2,     1,     2,     1,     2,     1,     2,
+       1,     2,     1,     2,     1,     2,     1,     2,     1,     2,
+       1,     2,     1,     1,     1,     2,     1,     1,     3,     1,
+       1,     3,     1,     3,     5,     1,     1,     1,     1,     3,
+       5,     3,     1,     1,     1
 };
 
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
-   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+   Performed when YYTABLE doesn't specify something else to do.  Zero
    means the default is an error.  */
 static const yytype_uint8 yydefact[] =
 {
        3,     0,     2,     1,     0,     0,    29,    61,    77,     4,
-       5,     6,     7,     8,     9,     0,   116,   117,   118,   119,
-     120,   121,   122,   123,   124,   125,   126,   127,     0,    11,
-       0,     0,     0,    98,     0,   102,     0,   106,     0,     0,
-     112,     0,    17,     0,    14,    19,     0,     0,     0,   226,
-      91,   223,    10,    12,   236,     0,   231,   232,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-      13,    15,     0,    28,    33,    46,    30,    31,    60,    64,
-      62,    66,    76,    80,    78,    82,    92,     0,     0,    94,
-      96,    99,   128,   100,   103,   104,   107,   108,   110,   113,
-     114,    18,   130,   132,   136,   134,   140,   142,   138,    16,
-      20,    21,     0,    22,     0,    24,     0,    23,     0,    25,
-       0,    26,     0,    27,     0,     0,     0,     0,     0,     0,
-     235,     0,   238,   233,     0,     0,     0,     0,     0,     0,
-       0,   220,   129,   217,   218,   131,   221,   133,   135,   137,
-     139,   152,   150,   151,   154,   153,   141,   143,   145,   146,
-     147,   148,   149,    32,    36,    34,    38,    45,    49,    47,
-      51,    65,   188,   190,   192,   194,   196,   198,   200,   202,
+       5,     6,     7,     8,     9,     0,   120,   121,   122,   123,
+     124,   125,   126,   127,   128,   129,   130,   131,   132,   133,
+       0,    11,     0,     0,     0,     0,     0,   102,     0,   106,
+       0,   110,     0,     0,   116,     0,    17,     0,    14,    19,
+       0,     0,     0,   232,    91,   229,    10,    12,   242,     0,
+     237,   238,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,    13,    15,     0,    28,
+      33,    46,    30,    31,    60,    64,    62,    66,    76,    80,
+      78,    82,    92,     0,     0,    94,    96,    98,   100,   103,
+     134,   104,   107,   108,   111,   112,   114,   117,   118,    18,
+     136,   138,   142,   140,   146,   148,   144,    16,    20,    21,
+       0,    22,     0,    24,     0,    23,     0,    25,     0,    26,
+       0,    27,     0,     0,     0,     0,     0,     0,   241,     0,
+     244,   239,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,   226,   135,   223,   224,   137,   227,   139,   141,   143,
+     145,   158,   156,   157,   160,   159,   147,   149,   151,   152,
+     153,   154,   155,    32,    36,    34,    38,    45,    49,    47,
+      51,    65,   194,   196,   198,   200,   202,   204,   206,   208,
       63,    67,    68,     0,    69,     0,    70,     0,    71,     0,
-      72,     0,    73,     0,    74,     0,    75,     0,    81,   204,
-     206,   208,   210,   214,   212,   216,    79,    83,    84,     0,
+      72,     0,    73,     0,    74,     0,    75,     0,    81,   210,
+     212,   214,   216,   220,   218,   222,    79,    83,    84,     0,
       85,     0,    87,     0,    88,     0,    86,     0,    89,     0,
-      90,     0,    93,     0,    95,    97,   101,   105,   109,   111,
-     115,   219,     0,     0,     0,     0,   187,   189,   191,   193,
-     195,   197,   199,   201,   203,   205,   207,   209,   211,   213,
-     215,   234,   222,   144,    37,   156,   158,   162,   164,   160,
-      35,    39,    40,     0,    41,     0,    44,     0,    42,     0,
-      43,     0,    50,   166,   168,   176,   174,   172,   170,   186,
-      48,    52,    53,     0,    54,     0,    55,     0,    56,     0,
-      57,     0,    58,     0,    59,     0,   155,   157,   159,   229,
-     161,     0,   163,   165,   167,   169,   171,   179,   173,   177,
-     178,   183,   182,   175,   180,   181,   184,   185,   224,     0,
-       0,     0,     0,   230,   227,   225,     0,   228
+      90,     0,    93,     0,    95,    97,    99,   101,   105,   109,
+     113,   115,   119,   225,     0,     0,     0,     0,   193,   195,
+     197,   199,   201,   203,   205,   207,   209,   211,   213,   215,
+     217,   219,   221,   240,   228,   150,    37,   162,   164,   168,
+     170,   166,    35,    39,    40,     0,    41,     0,    44,     0,
+      42,     0,    43,     0,    50,   172,   174,   182,   180,   178,
+     176,   192,    48,    52,    53,     0,    54,     0,    55,     0,
+      56,     0,    57,     0,    58,     0,    59,     0,   161,   163,
+     165,   235,   167,     0,   169,   171,   173,   175,   177,   185,
+     179,   183,   184,   189,   188,   181,   186,   187,   190,   191,
+     230,     0,     0,     0,     0,   236,   233,   231,     0,   234
 };
 
 /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int16 yydefgoto[] =
 {
-      -1,     1,     2,     9,    10,    28,    11,    43,    44,    45,
-     109,    72,   110,    12,    46,    76,   125,   165,   166,   260,
-     234,   261,    77,   126,   169,   170,   280,   235,   281,    13,
-      47,    80,    81,   180,   127,   181,    14,    48,    84,    85,
-     206,   128,   207,    29,   129,   134,   135,    61,   136,    63,
-     137,    65,   138,   139,    68,   140,    30,    31,    32,    33,
-      34,    35,    36,    37,    38,    39,    40,    41,    91,   111,
-     112,   113,   114,   115,   116,   117,   118,   119,   120,   121,
-     122,   123,   124,   156,   157,   158,   159,   160,   161,   162,
-     262,   263,   264,   265,   266,   267,   268,   269,   270,   271,
-     282,   283,   284,   285,   286,   287,   288,   289,   290,   291,
-     292,   293,   308,   309,   313,   314,   310,   315,   294,   295,
-     182,   183,   184,   185,   186,   187,   188,   189,   190,   191,
-     192,   193,   194,   195,   196,   197,   208,   209,   210,   211,
-     212,   213,   214,   215,   216,   217,   218,   219,   220,   221,
-     146,   143,   144,   147,    92,   317,    51,   300,   301,   324,
-      55,    56,    57,    58,   133
+      -1,     1,     2,     9,    10,    30,    11,    47,    48,    49,
+     117,    78,   118,    12,    50,    82,   133,   175,   176,   272,
+     246,   273,    83,   134,   179,   180,   292,   247,   293,    13,
+      51,    86,    87,   190,   135,   191,    14,    52,    90,    91,
+     216,   136,   217,    31,   137,   142,   143,   144,   145,    67,
+     146,    69,   147,    71,   148,   149,    74,   150,    32,    33,
+      34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
+      44,    45,    99,   119,   120,   121,   122,   123,   124,   125,
+     126,   127,   128,   129,   130,   131,   132,   166,   167,   168,
+     169,   170,   171,   172,   274,   275,   276,   277,   278,   279,
+     280,   281,   282,   283,   294,   295,   296,   297,   298,   299,
+     300,   301,   302,   303,   304,   305,   320,   321,   325,   326,
+     322,   327,   306,   307,   192,   193,   194,   195,   196,   197,
+     198,   199,   200,   201,   202,   203,   204,   205,   206,   207,
+     218,   219,   220,   221,   222,   223,   224,   225,   226,   227,
+     228,   229,   230,   231,   156,   153,   154,   157,   100,   329,
+      55,   312,   313,   336,    59,    60,    61,    62,   141
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -279
+#define YYPACT_NINF -294
 static const yytype_int16 yypact[] =
 {
-    -279,    19,     5,  -279,    63,     9,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,    21,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,    45,  -279,
-      29,    29,    29,  -279,    29,  -279,    29,  -279,    29,    29,
-    -279,    29,  -279,     0,  -279,  -279,    36,    33,    -4,  -279,
-    -279,  -279,  -279,  -279,    31,    61,    62,  -279,    70,    71,
-      79,    21,    80,    21,    81,    21,    83,    85,    21,    86,
-    -279,  -279,     4,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,    29,    64,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,    84,  -279,    84,  -279,    84,  -279,    29,  -279,
-      29,  -279,    84,  -279,    91,    32,    39,    -5,    24,    21,
-    -279,    90,  -279,  -279,    21,    21,    21,    21,    21,    21,
-      21,  -279,  -279,    84,  -279,  -279,  -279,    92,  -279,  -279,
-      92,  -279,  -279,  -279,  -279,  -279,    93,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,    84,  -279,    84,  -279,    21,  -279,    21,
-    -279,    21,  -279,    21,  -279,    29,  -279,    29,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,    84,
-    -279,    29,  -279,    84,  -279,    84,  -279,    84,  -279,    29,
-    -279,    29,  -279,    64,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,    84,    91,   107,    25,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,    92,    92,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,    84,  -279,    84,  -279,    21,  -279,    97,
-    -279,    97,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,    84,  -279,    84,  -279,    84,  -279,    84,
-    -279,     8,  -279,    18,  -279,    21,    92,    92,  -279,  -279,
-     117,   120,   117,    92,    92,    92,    92,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,   135,  -279,    97,
-     123,    21,   137,  -279,  -279,  -279,   123,  -279
+    -294,    18,    13,  -294,    87,     7,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,    20,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+      66,  -294,    26,    26,    26,    26,    26,  -294,    26,  -294,
+      26,  -294,    26,    26,  -294,    26,  -294,    41,  -294,  -294,
+       0,    29,    35,  -294,  -294,  -294,  -294,  -294,    27,    52,
+      53,  -294,    69,    70,    72,    73,    75,    20,    79,    20,
+      80,    20,    81,    89,    20,    91,  -294,  -294,    -1,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,    26,    71,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+      90,  -294,    90,  -294,    90,  -294,    26,  -294,    26,  -294,
+      90,  -294,   116,    50,    49,    11,    -7,    20,  -294,    88,
+    -294,  -294,    20,    20,    20,    20,    20,    20,    20,    20,
+      20,  -294,  -294,    90,  -294,  -294,  -294,    94,  -294,  -294,
+      94,  -294,  -294,  -294,  -294,  -294,    95,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,    90,  -294,    90,  -294,    20,  -294,    20,
+    -294,    20,  -294,    20,  -294,    26,  -294,    26,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,    90,
+    -294,    26,  -294,    90,  -294,    90,  -294,    90,  -294,    26,
+    -294,    26,  -294,    71,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,    90,   116,    84,    43,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,    94,    94,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,    90,  -294,    90,  -294,    20,
+    -294,    99,  -294,    99,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,    90,  -294,    90,  -294,    90,
+    -294,    90,  -294,    12,  -294,    23,  -294,    20,    94,    94,
+    -294,  -294,    97,   101,    97,    94,    94,    94,    94,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,   102,
+    -294,    99,   104,    20,   105,  -294,  -294,  -294,   104,  -294
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,    53,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,   116,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,   -32,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,   -77,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,
-    -108,  -279,    14,  -120,    -6,  -279,  -278,  -113,  -160,  -166,
-     -31,  -279,    74,    75,   -55
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,    64,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,    82,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,   -28,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -117,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,  -294,
+    -294,  -294,  -294,  -294,  -114,  -294,   -24,  -126,    -4,  -294,
+    -293,  -137,  -184,  -190,   -33,  -294,    57,    74,   -65
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    positive, shift that token.  If negative, reduce the rule which
-   number is the opposite.  If zero, do what YYDEFACT says.
-   If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -238
+   number is the opposite.  If YYTABLE_NINF, syntax error.  */
+#define YYTABLE_NINF -244
 static const yytype_int16 yytable[] =
 {
-      59,    60,   150,    62,   142,    64,   145,    66,    67,    50,
-      69,    54,    70,    42,     4,   307,     5,   318,   101,     3,
-       6,    54,    42,   171,    49,   312,    82,    83,   172,   173,
-       7,    94,    54,    96,     8,  -237,    99,   102,   103,   104,
-     105,   106,   107,   325,   174,   175,   176,   177,   178,   272,
-     163,   164,    73,    74,   179,    52,   198,    75,   199,    78,
-      79,   167,   168,   108,   273,   274,    86,   132,    87,   275,
-     276,   277,   278,   279,    88,   236,    89,   237,   200,   201,
-     202,   203,   204,   205,    90,    93,    95,   148,    97,   149,
-      98,   100,   141,   246,   223,   247,    71,   222,   232,   233,
-     299,   244,   224,   225,   226,   227,   228,   229,   230,   248,
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-      25,    26,    27,   319,   252,   320,   323,   254,    15,    16,
-      17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
-      27,   321,   326,   296,    53,   297,   255,   256,   257,   258,
-     259,   151,   152,   153,   154,   155,   253,   231,   302,   322,
-     327,   130,   131,   303,   242,   304,   243,   305,   251,   306,
+      63,    64,    65,    66,   160,    68,   152,    70,   155,    72,
+      73,    54,    75,   109,   330,    58,    79,    80,     3,   319,
+      46,    81,     4,    53,     5,   208,    58,   209,     6,    58,
+     324,  -243,   110,   111,   112,   113,   114,   115,     7,   181,
+     337,   102,     8,   104,   182,   183,   107,   210,   211,   212,
+     213,   214,   215,    76,    46,    84,    85,    92,   116,    93,
+     184,   185,   186,   187,   188,    88,    89,   284,   173,   174,
+     189,   177,   178,    94,   140,    95,    56,    96,    97,   248,
+      98,   249,   285,   286,   101,   103,   105,   287,   288,   289,
+     290,   291,   233,   158,   106,   159,   108,   258,   151,   259,
+     244,   245,   311,   331,   266,   256,   332,   335,   333,   232,
+     338,    77,    57,   260,   234,   235,   236,   237,   238,   239,
+     240,   241,   242,   267,   268,   269,   270,   271,   265,   243,
+     264,    15,    16,    17,    18,    19,    20,    21,    22,    23,
+      24,    25,    26,    27,    28,    29,   314,   334,   339,   308,
+     138,   309,    15,    16,    17,    18,    19,    20,    21,    22,
+      23,    24,    25,    26,    27,    28,    29,   139,   263,   315,
+       0,   316,   254,   317,   255,   318,   161,   162,   163,   164,
+     165,     0,     0,     0,     0,     0,     0,     0,   257,     0,
+       0,     0,     0,   250,     0,   251,   261,   252,   262,   253,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     245,   238,     0,   239,     0,   240,     0,   241,   249,     0,
-     250,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     311,   298,   316
+     323,     0,   328,     0,     0,   310
 };
 
+#define yypact_value_is_default(yystate) \
+  ((yystate) == (-294))
+
+#define yytable_value_is_error(yytable_value) \
+  YYID (0)
+
 static const yytype_int16 yycheck[] =
 {
-      31,    32,   122,    34,   112,    36,   114,    38,    39,    15,
-      41,     3,    12,    13,     9,     7,    11,   295,    14,     0,
-      15,     3,    13,    28,     3,     7,    30,    31,    33,    34,
-      25,    63,     3,    65,    29,     4,    68,    33,    34,    35,
-      36,    37,    38,   321,    49,    50,    51,    52,    53,    24,
-      18,    19,    16,    17,    59,    10,    32,    21,    34,    26,
-      27,    22,    23,    59,    39,    40,     5,     3,     6,    44,
-      45,    46,    47,    48,     4,   183,     5,   185,    54,    55,
-      56,    57,    58,    59,     5,     5,     5,   118,     5,   120,
-       5,     5,     8,   213,     4,   215,    43,   129,     6,     6,
-       3,   209,   134,   135,   136,   137,   138,   139,   140,   217,
-      65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
-      75,    76,    77,     6,   232,     5,     3,    20,    65,    66,
-      67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
-      77,     6,     5,   263,    28,   265,    39,    40,    41,    42,
-      43,    60,    61,    62,    63,    64,   233,   143,   271,   319,
-     326,    87,    87,   283,   195,   285,   197,   287,   223,   289,
+      33,    34,    35,    36,   130,    38,   120,    40,   122,    42,
+      43,    15,    45,    14,   307,     3,    16,    17,     0,     7,
+      13,    21,     9,     3,    11,    32,     3,    34,    15,     3,
+       7,     4,    33,    34,    35,    36,    37,    38,    25,    28,
+     333,    69,    29,    71,    33,    34,    74,    54,    55,    56,
+      57,    58,    59,    12,    13,    26,    27,     5,    59,     6,
+      49,    50,    51,    52,    53,    30,    31,    24,    18,    19,
+      59,    22,    23,     4,     3,     5,    10,     5,     5,   193,
+       5,   195,    39,    40,     5,     5,     5,    44,    45,    46,
+      47,    48,     4,   126,     5,   128,     5,   223,     8,   225,
+       6,     6,     3,     6,    20,   219,     5,     3,     6,   137,
+       5,    47,    30,   227,   142,   143,   144,   145,   146,   147,
+     148,   149,   150,    39,    40,    41,    42,    43,   245,   153,
+     244,    65,    66,    67,    68,    69,    70,    71,    72,    73,
+      74,    75,    76,    77,    78,    79,   283,   331,   338,   275,
+      93,   277,    65,    66,    67,    68,    69,    70,    71,    72,
+      73,    74,    75,    76,    77,    78,    79,    93,   233,   295,
+      -1,   297,   205,   299,   207,   301,    60,    61,    62,    63,
+      64,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   221,    -1,
+      -1,    -1,    -1,   197,    -1,   199,   229,   201,   231,   203,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-     211,   187,    -1,   189,    -1,   191,    -1,   193,   219,    -1,
-     221,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-     291,   267,   293
+     303,    -1,   305,    -1,    -1,   279
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
-       0,    79,    80,     0,     9,    11,    15,    25,    29,    81,
-      82,    84,    91,   107,   114,    65,    66,    67,    68,    69,
-      70,    71,    72,    73,    74,    75,    76,    77,    83,   121,
-     134,   135,   136,   137,   138,   139,   140,   141,   142,   143,
-     144,   145,    13,    85,    86,    87,    92,   108,   115,     3,
-     232,   234,    10,   121,     3,   238,   239,   240,   241,   238,
-     238,   125,   238,   127,   238,   129,   238,   238,   132,   238,
-      12,    86,    89,    16,    17,    21,    93,   100,    26,    27,
-     109,   110,    30,    31,   116,   117,     5,     6,     4,     5,
-       5,   146,   232,     5,   146,     5,   146,     5,     5,   146,
-       5,    14,    33,    34,    35,    36,    37,    38,    59,    88,
-      90,   147,   148,   149,   150,   151,   152,   153,   154,   155,
-     156,   157,   158,   159,   160,    94,   101,   112,   119,   122,
-     240,   241,     3,   242,   123,   124,   126,   128,   130,   131,
-     133,     8,   228,   229,   230,   228,   228,   231,   238,   238,
-     231,    60,    61,    62,    63,    64,   161,   162,   163,   164,
-     165,   166,   167,    18,    19,    95,    96,    22,    23,   102,
-     103,    28,    33,    34,    49,    50,    51,    52,    53,    59,
-     111,   113,   198,   199,   200,   201,   202,   203,   204,   205,
-     206,   207,   208,   209,   210,   211,   212,   213,    32,    34,
-      54,    55,    56,    57,    58,    59,   118,   120,   214,   215,
-     216,   217,   218,   219,   220,   221,   222,   223,   224,   225,
-     226,   227,   146,     4,   146,   146,   146,   146,   146,   146,
-     146,   230,     6,     6,    98,   105,   228,   228,   232,   232,
-     232,   232,   238,   238,   228,   238,   231,   231,   228,   238,
-     238,   242,   228,   162,    20,    39,    40,    41,    42,    43,
-      97,    99,   168,   169,   170,   171,   172,   173,   174,   175,
-     176,   177,    24,    39,    40,    44,    45,    46,    47,    48,
-     104,   106,   178,   179,   180,   181,   182,   183,   184,   185,
-     186,   187,   188,   189,   196,   197,   231,   231,   232,     3,
-     235,   236,   235,   231,   231,   231,   231,     7,   190,   191,
-     194,   238,     7,   192,   193,   195,   238,   233,   234,     6,
-       5,     6,   236,     3,   237,   234,     5,   237
+       0,    81,    82,     0,     9,    11,    15,    25,    29,    83,
+      84,    86,    93,   109,   116,    65,    66,    67,    68,    69,
+      70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
+      85,   123,   138,   139,   140,   141,   142,   143,   144,   145,
+     146,   147,   148,   149,   150,   151,    13,    87,    88,    89,
+      94,   110,   117,     3,   238,   240,    10,   123,     3,   244,
+     245,   246,   247,   244,   244,   244,   244,   129,   244,   131,
+     244,   133,   244,   244,   136,   244,    12,    88,    91,    16,
+      17,    21,    95,   102,    26,    27,   111,   112,    30,    31,
+     118,   119,     5,     6,     4,     5,     5,     5,     5,   152,
+     238,     5,   152,     5,   152,     5,     5,   152,     5,    14,
+      33,    34,    35,    36,    37,    38,    59,    90,    92,   153,
+     154,   155,   156,   157,   158,   159,   160,   161,   162,   163,
+     164,   165,   166,    96,   103,   114,   121,   124,   246,   247,
+       3,   248,   125,   126,   127,   128,   130,   132,   134,   135,
+     137,     8,   234,   235,   236,   234,   234,   237,   244,   244,
+     237,    60,    61,    62,    63,    64,   167,   168,   169,   170,
+     171,   172,   173,    18,    19,    97,    98,    22,    23,   104,
+     105,    28,    33,    34,    49,    50,    51,    52,    53,    59,
+     113,   115,   204,   205,   206,   207,   208,   209,   210,   211,
+     212,   213,   214,   215,   216,   217,   218,   219,    32,    34,
+      54,    55,    56,    57,    58,    59,   120,   122,   220,   221,
+     222,   223,   224,   225,   226,   227,   228,   229,   230,   231,
+     232,   233,   152,     4,   152,   152,   152,   152,   152,   152,
+     152,   152,   152,   236,     6,     6,   100,   107,   234,   234,
+     238,   238,   238,   238,   244,   244,   234,   244,   237,   237,
+     234,   244,   244,   248,   234,   168,    20,    39,    40,    41,
+      42,    43,    99,   101,   174,   175,   176,   177,   178,   179,
+     180,   181,   182,   183,    24,    39,    40,    44,    45,    46,
+      47,    48,   106,   108,   184,   185,   186,   187,   188,   189,
+     190,   191,   192,   193,   194,   195,   202,   203,   237,   237,
+     238,     3,   241,   242,   241,   237,   237,   237,   237,     7,
+     196,   197,   200,   244,     7,   198,   199,   201,   244,   239,
+     240,     6,     5,     6,   242,     3,   243,   240,     5,   243
 };
 
 #define yyerrok		(yyerrstatus = 0)
@@ -1256,9 +1283,18 @@ static const yytype_uint8 yystos[] =
 
 /* Like YYERROR except do call yyerror.  This remains here temporarily
    to ease the transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  */
+   Once GCC version 2 has supplanted version 1, this can go.  However,
+   YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
+   in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+   discussed.  */
 
 #define YYFAIL		goto yyerrlab
+#if defined YYFAIL
+  /* This is here to suppress warnings from the GCC cpp's
+     -Wunused-macros.  Normally we don't worry about that warning, but
+     some users do, and we want to make it easy for users to remove
+     YYFAIL uses, which will produce warnings from Bison 2.5.  */
+#endif
 
 #define YYRECOVERING()  (!!yyerrstatus)
 
@@ -1268,7 +1304,6 @@ do								\
     {								\
       yychar = (Token);						\
       yylval = (Value);						\
-      yytoken = YYTRANSLATE (yychar);				\
       YYPOPSTACK (1);						\
       goto yybackup;						\
     }								\
@@ -1310,19 +1345,10 @@ while (YYID (0))
 #endif
 
 
-/* YY_LOCATION_PRINT -- Print the location on the stream.
-   This macro was not mandated originally: define only if we know
-   we won't break user code: when these are the locations we know.  */
+/* This macro is provided for backward compatibility. */
 
 #ifndef YY_LOCATION_PRINT
-# if YYLTYPE_IS_TRIVIAL
-#  define YY_LOCATION_PRINT(File, Loc)			\
-     fprintf (File, "%d.%d-%d.%d",			\
-	      (Loc).first_line, (Loc).first_column,	\
-	      (Loc).last_line,  (Loc).last_column)
-# else
-#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
 #endif
 
 
@@ -1514,7 +1540,6 @@ int yydebug;
 # define YYMAXDEPTH 10000
 #endif
 
-

 
 #if YYERROR_VERBOSE
 
@@ -1617,115 +1642,142 @@ yytnamerr (char *yyres, const char *yystr)
 }
 # endif
 
-/* Copy into YYRESULT an error message about the unexpected token
-   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
-   including the terminating null byte.  If YYRESULT is null, do not
-   copy anything; just return the number of bytes that would be
-   copied.  As a special case, return 0 if an ordinary "syntax error"
-   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
-   size calculation.  */
-static YYSIZE_T
-yysyntax_error (char *yyresult, int yystate, int yychar)
-{
-  int yyn = yypact[yystate];
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+   about the unexpected token YYTOKEN for the state stack whose top is
+   YYSSP.
 
-  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
-    return 0;
-  else
-    {
-      int yytype = YYTRANSLATE (yychar);
-      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
-      YYSIZE_T yysize = yysize0;
-      YYSIZE_T yysize1;
-      int yysize_overflow = 0;
-      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
-      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
-      int yyx;
-
-# if 0
-      /* This is so xgettext sees the translatable formats that are
-	 constructed on the fly.  */
-      YY_("syntax error, unexpected %s");
-      YY_("syntax error, unexpected %s, expecting %s");
-      YY_("syntax error, unexpected %s, expecting %s or %s");
-      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
-      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
-# endif
-      char *yyfmt;
-      char const *yyf;
-      static char const yyunexpected[] = "syntax error, unexpected %s";
-      static char const yyexpecting[] = ", expecting %s";
-      static char const yyor[] = " or %s";
-      char yyformat[sizeof yyunexpected
-		    + sizeof yyexpecting - 1
-		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
-		       * (sizeof yyor - 1))];
-      char const *yyprefix = yyexpecting;
-
-      /* Start YYX at -YYN if negative to avoid negative indexes in
-	 YYCHECK.  */
-      int yyxbegin = yyn < 0 ? -yyn : 0;
-
-      /* Stay within bounds of both yycheck and yytname.  */
-      int yychecklim = YYLAST - yyn + 1;
-      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
-      int yycount = 1;
-
-      yyarg[0] = yytname[yytype];
-      yyfmt = yystpcpy (yyformat, yyunexpected);
-
-      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
-	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
-	  {
-	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
-	      {
-		yycount = 1;
-		yysize = yysize0;
-		yyformat[sizeof yyunexpected - 1] = '\0';
-		break;
-	      }
-	    yyarg[yycount++] = yytname[yyx];
-	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
-	    yysize_overflow |= (yysize1 < yysize);
-	    yysize = yysize1;
-	    yyfmt = yystpcpy (yyfmt, yyprefix);
-	    yyprefix = yyor;
-	  }
+   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
+   not large enough to hold the message.  In that case, also set
+   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
+   required number of bytes is too large to store.  */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+                yytype_int16 *yyssp, int yytoken)
+{
+  YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
+  YYSIZE_T yysize = yysize0;
+  YYSIZE_T yysize1;
+  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+  /* Internationalized format string. */
+  const char *yyformat = 0;
+  /* Arguments of yyformat. */
+  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+  /* Number of reported tokens (one for the "unexpected", one per
+     "expected"). */
+  int yycount = 0;
+
+  /* There are many possibilities here to consider:
+     - Assume YYFAIL is not used.  It's too flawed to consider.  See
+       <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+       for details.  YYERROR is fine as it does not invoke this
+       function.
+     - If this state is a consistent state with a default action, then
+       the only way this function was invoked is if the default action
+       is an error action.  In that case, don't check for expected
+       tokens because there are none.
+     - The only way there can be no lookahead present (in yychar) is if
+       this state is a consistent state with a default action.  Thus,
+       detecting the absence of a lookahead is sufficient to determine
+       that there is no unexpected or expected token to report.  In that
+       case, just report a simple "syntax error".
+     - Don't assume there isn't a lookahead just because this state is a
+       consistent state with a default action.  There might have been a
+       previous inconsistent state, consistent state with a non-default
+       action, or user semantic action that manipulated yychar.
+     - Of course, the expected token list depends on states to have
+       correct lookahead information, and it depends on the parser not
+       to perform extra reductions after fetching a lookahead from the
+       scanner and before detecting a syntax error.  Thus, state merging
+       (from LALR or IELR) and default reductions corrupt the expected
+       token list.  However, the list is correct for canonical LR with
+       one exception: it will still contain any token that will not be
+       accepted due to an error action in a later state.
+  */
+  if (yytoken != YYEMPTY)
+    {
+      int yyn = yypact[*yyssp];
+      yyarg[yycount++] = yytname[yytoken];
+      if (!yypact_value_is_default (yyn))
+        {
+          /* Start YYX at -YYN if negative to avoid negative indexes in
+             YYCHECK.  In other words, skip the first -YYN actions for
+             this state because they are default actions.  */
+          int yyxbegin = yyn < 0 ? -yyn : 0;
+          /* Stay within bounds of both yycheck and yytname.  */
+          int yychecklim = YYLAST - yyn + 1;
+          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+          int yyx;
+
+          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+                && !yytable_value_is_error (yytable[yyx + yyn]))
+              {
+                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+                  {
+                    yycount = 1;
+                    yysize = yysize0;
+                    break;
+                  }
+                yyarg[yycount++] = yytname[yyx];
+                yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+                if (! (yysize <= yysize1
+                       && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+                  return 2;
+                yysize = yysize1;
+              }
+        }
+    }
 
-      yyf = YY_(yyformat);
-      yysize1 = yysize + yystrlen (yyf);
-      yysize_overflow |= (yysize1 < yysize);
-      yysize = yysize1;
+  switch (yycount)
+    {
+# define YYCASE_(N, S)                      \
+      case N:                               \
+        yyformat = S;                       \
+      break
+      YYCASE_(0, YY_("syntax error"));
+      YYCASE_(1, YY_("syntax error, unexpected %s"));
+      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+    }
 
-      if (yysize_overflow)
-	return YYSIZE_MAXIMUM;
+  yysize1 = yysize + yystrlen (yyformat);
+  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+    return 2;
+  yysize = yysize1;
 
-      if (yyresult)
-	{
-	  /* Avoid sprintf, as that infringes on the user's name space.
-	     Don't have undefined behavior even if the translation
-	     produced a string with the wrong number of "%s"s.  */
-	  char *yyp = yyresult;
-	  int yyi = 0;
-	  while ((*yyp = *yyf) != '\0')
-	    {
-	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
-		{
-		  yyp += yytnamerr (yyp, yyarg[yyi++]);
-		  yyf += 2;
-		}
-	      else
-		{
-		  yyp++;
-		  yyf++;
-		}
-	    }
-	}
-      return yysize;
+  if (*yymsg_alloc < yysize)
+    {
+      *yymsg_alloc = 2 * yysize;
+      if (! (yysize <= *yymsg_alloc
+             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+      return 1;
     }
+
+  /* Avoid sprintf, as that infringes on the user's name space.
+     Don't have undefined behavior even if the translation
+     produced a string with the wrong number of "%s"s.  */
+  {
+    char *yyp = *yymsg;
+    int yyi = 0;
+    while ((*yyp = *yyformat) != '\0')
+      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+        {
+          yyp += yytnamerr (yyp, yyarg[yyi++]);
+          yyformat += 2;
+        }
+      else
+        {
+          yyp++;
+          yyformat++;
+        }
+  }
+  return 0;
 }
 #endif /* YYERROR_VERBOSE */
-

 
 /*-----------------------------------------------.
 | Release the memory associated to this symbol.  |
@@ -1758,6 +1810,7 @@ yydestruct (yymsg, yytype, yyvaluep)
     }
 }
 
+
 /* Prevent warnings from -Wmissing-prototypes.  */
 #ifdef YYPARSE_PARAM
 #if defined __STDC__ || defined __cplusplus
@@ -1784,10 +1837,9 @@ YYSTYPE yylval;
 int yynerrs;
 
 
-
-/*-------------------------.
-| yyparse or yypush_parse.  |
-`-------------------------*/
+/*----------.
+| yyparse.  |
+`----------*/
 
 #ifdef YYPARSE_PARAM
 #if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1811,8 +1863,6 @@ yyparse ()
 #endif
 #endif
 {
-
-
     int yystate;
     /* Number of tokens to shift before error messages enabled.  */
     int yyerrstatus;
@@ -1967,7 +2017,7 @@ yybackup:
 
   /* First try to decide what to do without reference to lookahead token.  */
   yyn = yypact[yystate];
-  if (yyn == YYPACT_NINF)
+  if (yypact_value_is_default (yyn))
     goto yydefault;
 
   /* Not known => get a lookahead token if don't already have one.  */
@@ -1998,8 +2048,8 @@ yybackup:
   yyn = yytable[yyn];
   if (yyn <= 0)
     {
-      if (yyn == 0 || yyn == YYTABLE_NINF)
-	goto yyerrlab;
+      if (yytable_value_is_error (yyn))
+        goto yyerrlab;
       yyn = -yyn;
       goto yyreduce;
     }
@@ -2054,8 +2104,8 @@ yyreduce:
     {
         case 17:
 
-/* Line 1455 of yacc.c  */
-#line 354 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 361 "osm_qos_parser_y.y"
     {
                         __parser_port_group_start();
                     }
@@ -2063,8 +2113,8 @@ yyreduce:
 
   case 18:
 
-/* Line 1455 of yacc.c  */
-#line 359 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 366 "osm_qos_parser_y.y"
     {
                         if ( __parser_port_group_end() )
                             return 1;
@@ -2073,8 +2123,8 @@ yyreduce:
 
   case 36:
 
-/* Line 1455 of yacc.c  */
-#line 422 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 429 "osm_qos_parser_y.y"
     {
                         __parser_vlarb_scope_start();
                     }
@@ -2082,8 +2132,8 @@ yyreduce:
 
   case 37:
 
-/* Line 1455 of yacc.c  */
-#line 427 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 434 "osm_qos_parser_y.y"
     {
                         if ( __parser_vlarb_scope_end() )
                             return 1;
@@ -2092,8 +2142,8 @@ yyreduce:
 
   case 49:
 
-/* Line 1455 of yacc.c  */
-#line 468 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 475 "osm_qos_parser_y.y"
     {
                         __parser_sl2vl_scope_start();
                     }
@@ -2101,8 +2151,8 @@ yyreduce:
 
   case 50:
 
-/* Line 1455 of yacc.c  */
-#line 473 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 480 "osm_qos_parser_y.y"
     {
                         if ( __parser_sl2vl_scope_end() )
                             return 1;
@@ -2111,8 +2161,8 @@ yyreduce:
 
   case 64:
 
-/* Line 1455 of yacc.c  */
-#line 539 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 546 "osm_qos_parser_y.y"
     {
                         __parser_qos_level_start();
                     }
@@ -2120,8 +2170,8 @@ yyreduce:
 
   case 65:
 
-/* Line 1455 of yacc.c  */
-#line 544 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 551 "osm_qos_parser_y.y"
     {
                         if ( __parser_qos_level_end() )
                             return 1;
@@ -2130,8 +2180,8 @@ yyreduce:
 
   case 80:
 
-/* Line 1455 of yacc.c  */
-#line 593 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 600 "osm_qos_parser_y.y"
     {
                         __parser_match_rule_start();
                     }
@@ -2139,8 +2189,8 @@ yyreduce:
 
   case 81:
 
-/* Line 1455 of yacc.c  */
-#line 598 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 605 "osm_qos_parser_y.y"
     {
                         if ( __parser_match_rule_end() )
                             return 1;
@@ -2149,8 +2199,8 @@ yyreduce:
 
   case 91:
 
-/* Line 1455 of yacc.c  */
-#line 636 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 645 "osm_qos_parser_y.y"
     {
                         /* parsing default ulp rule: "default: num" */
                         cl_list_iterator_t    list_iterator;
@@ -2172,8 +2222,8 @@ yyreduce:
 
   case 92:
 
-/* Line 1455 of yacc.c  */
-#line 654 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 663 "osm_qos_parser_y.y"
     {
                         /* "any, service-id ... : sl" - one instance of list of ranges */
                         uint64_t ** range_arr;
@@ -2198,8 +2248,8 @@ yyreduce:
 
   case 94:
 
-/* Line 1455 of yacc.c  */
-#line 675 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 684 "osm_qos_parser_y.y"
     {
                         /* "any, pkey ... : sl" - one instance of list of ranges */
                         uint64_t ** range_arr;
@@ -2224,8 +2274,8 @@ yyreduce:
 
   case 96:
 
-/* Line 1455 of yacc.c  */
-#line 696 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 705 "osm_qos_parser_y.y"
     {
                         /* any, target-port-guid ... : sl */
                         uint64_t ** range_arr;
@@ -2264,8 +2314,91 @@ yyreduce:
 
   case 98:
 
-/* Line 1455 of yacc.c  */
-#line 731 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 740 "osm_qos_parser_y.y"
+    {
+			/* any, source-port-guid ... : sl */
+			uint64_t ** range_arr;
+			unsigned    range_len;
+
+			if (!cl_list_count(&tmp_parser_struct.num_pair_list))
+			{
+				yyerror("ULP rule doesn't have port guids");
+				return 1;
+			}
+
+                        /* create a new port group with these ports */
+                        __parser_port_group_start();
+
+                        p_current_port_group->name = strdup("_ULP_Sources_");
+                        p_current_port_group->use = strdup("Generated from ULP rules");
+
+                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,
+                                              &range_arr,
+                                              &range_len );
+
+                        __parser_add_guid_range_to_port_map(
+                                              &p_current_port_group->port_map,
+                                              range_arr,
+                                              range_len);
+
+                        /* add this port group to the source
+                           groups of the current match rule */
+                        cl_list_insert_tail(&p_current_qos_match_rule->source_group_list,
+                                            p_current_port_group);
+
+                        __parser_port_group_end();
+
+		    }
+    break;
+
+  case 100:
+
+/* Line 1806 of yacc.c  */
+#line 775 "osm_qos_parser_y.y"
+    {
+			/* any, source-target-port-guid ... : sl */
+			uint64_t ** range_arr;
+			unsigned    range_len;
+
+			if (!cl_list_count(&tmp_parser_struct.num_pair_list))
+			{
+				yyerror("ULP rule doesn't have port guids");
+				return 1;
+			}
+
+                        /* create a new port group with these ports */
+                        __parser_port_group_start();
+
+                        p_current_port_group->name = strdup("_ULP_Sources_Targets_");
+                        p_current_port_group->use = strdup("Generated from ULP rules");
+
+                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,
+                                              &range_arr,
+                                              &range_len );
+
+                        __parser_add_guid_range_to_port_map(
+                                              &p_current_port_group->port_map,
+                                              range_arr,
+                                              range_len);
+
+                        /* add this port group to the source and destination
+                           groups of the current match rule */
+                        cl_list_insert_tail(&p_current_qos_match_rule->source_group_list,
+                                            p_current_port_group);
+
+                        cl_list_insert_tail(&p_current_qos_match_rule->destination_group_list,
+                                            p_current_port_group);
+
+                        __parser_port_group_end();
+
+		    }
+    break;
+
+  case 102:
+
+/* Line 1806 of yacc.c  */
+#line 813 "osm_qos_parser_y.y"
     {
                         /* "sdp : sl" - default SL for SDP */
                         uint64_t ** range_arr =
@@ -2280,10 +2413,10 @@ yyreduce:
                     }
     break;
 
-  case 100:
+  case 104:
 
-/* Line 1455 of yacc.c  */
-#line 744 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 826 "osm_qos_parser_y.y"
     {
                         /* sdp with port numbers */
                         uint64_t ** range_arr;
@@ -2306,6 +2439,7 @@ yyreduce:
                             if (range_arr[i][0] > 0xFFFF || range_arr[i][1] > 0xFFFF)
                             {
                                 yyerror("SDP port number out of range");
+				free(range_arr);
                                 return 1;
                             }
                             range_arr[i][0] += OSM_QOS_POLICY_ULP_SDP_SERVICE_ID;
@@ -2318,10 +2452,10 @@ yyreduce:
                     }
     break;
 
-  case 102:
+  case 106:
 
-/* Line 1455 of yacc.c  */
-#line 777 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 860 "osm_qos_parser_y.y"
     {
                         /* "rds : sl" - default SL for RDS */
                         uint64_t ** range_arr =
@@ -2336,10 +2470,10 @@ yyreduce:
                     }
     break;
 
-  case 104:
+  case 108:
 
-/* Line 1455 of yacc.c  */
-#line 790 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 873 "osm_qos_parser_y.y"
     {
                         /* rds with port numbers */
                         uint64_t ** range_arr;
@@ -2362,6 +2496,7 @@ yyreduce:
                             if (range_arr[i][0] > 0xFFFF || range_arr[i][1] > 0xFFFF)
                             {
                                 yyerror("SDP port number out of range");
+				free(range_arr);
                                 return 1;
                             }
                             range_arr[i][0] += OSM_QOS_POLICY_ULP_RDS_SERVICE_ID;
@@ -2374,10 +2509,10 @@ yyreduce:
                     }
     break;
 
-  case 106:
+  case 110:
 
-/* Line 1455 of yacc.c  */
-#line 823 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 907 "osm_qos_parser_y.y"
     {
                         /* "iSER : sl" - default SL for iSER */
                         uint64_t ** range_arr =
@@ -2392,10 +2527,10 @@ yyreduce:
                     }
     break;
 
-  case 108:
+  case 112:
 
-/* Line 1455 of yacc.c  */
-#line 836 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 920 "osm_qos_parser_y.y"
     {
                         /* iser with port numbers */
                         uint64_t ** range_arr;
@@ -2418,6 +2553,7 @@ yyreduce:
                             if (range_arr[i][0] > 0xFFFF || range_arr[i][1] > 0xFFFF)
                             {
                                 yyerror("SDP port number out of range");
+				free(range_arr);
                                 return 1;
                             }
                             range_arr[i][0] += OSM_QOS_POLICY_ULP_ISER_SERVICE_ID;
@@ -2430,10 +2566,10 @@ yyreduce:
                     }
     break;
 
-  case 110:
+  case 114:
 
-/* Line 1455 of yacc.c  */
-#line 869 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 954 "osm_qos_parser_y.y"
     {
                         /* srp with target guids - this rule is similar
                            to writing 'any' ulp with target port guids */
@@ -2471,10 +2607,10 @@ yyreduce:
                     }
     break;
 
-  case 112:
+  case 116:
 
-/* Line 1455 of yacc.c  */
-#line 905 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 990 "osm_qos_parser_y.y"
     {
                         /* ipoib w/o any pkeys (default pkey) */
                         uint64_t ** range_arr =
@@ -2496,10 +2632,10 @@ yyreduce:
                     }
     break;
 
-  case 114:
+  case 118:
 
-/* Line 1455 of yacc.c  */
-#line 925 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1010 "osm_qos_parser_y.y"
     {
                         /* ipoib with pkeys */
                         uint64_t ** range_arr;
@@ -2522,8 +2658,10 @@ yyreduce:
                          * If some problem would be found, parsing will
                          * be aborted with a proper error messages.
                          */
-                        if (__validate_pkeys(range_arr, range_len, TRUE))
+			if (__validate_pkeys(range_arr, range_len, TRUE)) {
+			    free(range_arr);
                             return 1;
+			}
 
                         p_current_qos_match_rule->pkey_range_arr = range_arr;
                         p_current_qos_match_rule->pkey_range_len = range_len;
@@ -2531,94 +2669,108 @@ yyreduce:
                     }
     break;
 
-  case 116:
+  case 120:
 
-/* Line 1455 of yacc.c  */
-#line 957 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1044 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
-  case 117:
+  case 121:
 
-/* Line 1455 of yacc.c  */
-#line 960 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1047 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
-  case 118:
+  case 122:
 
-/* Line 1455 of yacc.c  */
-#line 963 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1050 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
-  case 119:
+  case 123:
 
-/* Line 1455 of yacc.c  */
-#line 966 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1053 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
-  case 120:
+  case 124:
 
-/* Line 1455 of yacc.c  */
-#line 969 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1056 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
-  case 121:
+  case 125:
 
-/* Line 1455 of yacc.c  */
-#line 972 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1059 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
-  case 122:
+  case 126:
 
-/* Line 1455 of yacc.c  */
-#line 975 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1062 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
-  case 123:
+  case 127:
 
-/* Line 1455 of yacc.c  */
-#line 978 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1065 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
-  case 124:
+  case 128:
 
-/* Line 1455 of yacc.c  */
-#line 981 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1068 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
-  case 125:
+  case 129:
 
-/* Line 1455 of yacc.c  */
-#line 984 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1071 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
-  case 126:
+  case 130:
 
-/* Line 1455 of yacc.c  */
-#line 987 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1074 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
-  case 127:
+  case 131:
 
-/* Line 1455 of yacc.c  */
-#line 990 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1077 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
-  case 128:
+  case 132:
 
-/* Line 1455 of yacc.c  */
-#line 993 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1080 "osm_qos_parser_y.y"
+    { __parser_ulp_match_rule_start(); }
+    break;
+
+  case 133:
+
+/* Line 1806 of yacc.c  */
+#line 1083 "osm_qos_parser_y.y"
+    { __parser_ulp_match_rule_start(); }
+    break;
+
+  case 134:
+
+/* Line 1806 of yacc.c  */
+#line 1086 "osm_qos_parser_y.y"
     {
                         /* get the SL for ULP rules */
                         cl_list_iterator_t  list_iterator;
@@ -2647,10 +2799,10 @@ yyreduce:
                     }
     break;
 
-  case 129:
+  case 135:
 
-/* Line 1455 of yacc.c  */
-#line 1032 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1125 "osm_qos_parser_y.y"
     {
                             /* 'name' of 'port-group' - one instance */
                             cl_list_iterator_t    list_iterator;
@@ -2674,19 +2826,19 @@ yyreduce:
                         }
     break;
 
-  case 130:
+  case 136:
 
-/* Line 1455 of yacc.c  */
-#line 1055 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1148 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 131:
+  case 137:
 
-/* Line 1455 of yacc.c  */
-#line 1060 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1153 "osm_qos_parser_y.y"
     {
                             /* 'use' of 'port-group' - one instance */
                             cl_list_iterator_t    list_iterator;
@@ -2710,19 +2862,19 @@ yyreduce:
                         }
     break;
 
-  case 132:
+  case 138:
 
-/* Line 1455 of yacc.c  */
-#line 1083 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1176 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 133:
+  case 139:
 
-/* Line 1455 of yacc.c  */
-#line 1088 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1181 "osm_qos_parser_y.y"
     {
                             /* 'port-name' in 'port-group' - any num of instances */
                             cl_list_iterator_t list_iterator;
@@ -2789,19 +2941,19 @@ yyreduce:
                         }
     break;
 
-  case 134:
+  case 140:
 
-/* Line 1455 of yacc.c  */
-#line 1154 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1247 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 135:
+  case 141:
 
-/* Line 1455 of yacc.c  */
-#line 1159 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1252 "osm_qos_parser_y.y"
     {
                             /* 'port-guid' in 'port-group' - any num of instances */
                             /* list of guid ranges */
@@ -2822,19 +2974,19 @@ yyreduce:
                         }
     break;
 
-  case 136:
+  case 142:
 
-/* Line 1455 of yacc.c  */
-#line 1179 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1272 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 137:
+  case 143:
 
-/* Line 1455 of yacc.c  */
-#line 1184 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1277 "osm_qos_parser_y.y"
     {
                             /* 'pkey' in 'port-group' - any num of instances */
                             /* list of pkey ranges */
@@ -2855,19 +3007,19 @@ yyreduce:
                         }
     break;
 
-  case 138:
+  case 144:
 
-/* Line 1455 of yacc.c  */
-#line 1204 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1297 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 139:
+  case 145:
 
-/* Line 1455 of yacc.c  */
-#line 1209 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1302 "osm_qos_parser_y.y"
     {
                             /* 'partition' in 'port-group' - any num of instances */
                             __parser_add_partition_list_to_port_map(
@@ -2876,67 +3028,67 @@ yyreduce:
                         }
     break;
 
-  case 140:
+  case 146:
 
-/* Line 1455 of yacc.c  */
-#line 1217 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1310 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 141:
+  case 147:
 
-/* Line 1455 of yacc.c  */
-#line 1222 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1315 "osm_qos_parser_y.y"
     {
                             /* 'node-type' in 'port-group' - any num of instances */
                         }
     break;
 
-  case 142:
+  case 148:
 
-/* Line 1455 of yacc.c  */
-#line 1227 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1320 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 150:
+  case 156:
 
-/* Line 1455 of yacc.c  */
-#line 1243 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1336 "osm_qos_parser_y.y"
     {
                             p_current_port_group->node_types |=
                                OSM_QOS_POLICY_NODE_TYPE_CA;
                         }
     break;
 
-  case 151:
+  case 157:
 
-/* Line 1455 of yacc.c  */
-#line 1249 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1342 "osm_qos_parser_y.y"
     {
                             p_current_port_group->node_types |=
                                OSM_QOS_POLICY_NODE_TYPE_SWITCH;
                         }
     break;
 
-  case 152:
+  case 158:
 
-/* Line 1455 of yacc.c  */
-#line 1255 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1348 "osm_qos_parser_y.y"
     {
                             p_current_port_group->node_types |=
                                OSM_QOS_POLICY_NODE_TYPE_ROUTER;
                         }
     break;
 
-  case 153:
+  case 159:
 
-/* Line 1455 of yacc.c  */
-#line 1261 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1354 "osm_qos_parser_y.y"
     {
                             p_current_port_group->node_types |=
                                (OSM_QOS_POLICY_NODE_TYPE_CA |
@@ -2945,10 +3097,10 @@ yyreduce:
                         }
     break;
 
-  case 154:
+  case 160:
 
-/* Line 1455 of yacc.c  */
-#line 1269 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1362 "osm_qos_parser_y.y"
     {
                             osm_port_t * p_osm_port =
                                 osm_get_port_by_guid(p_qos_policy->p_subn,
@@ -2960,10 +3112,10 @@ yyreduce:
                         }
     break;
 
-  case 155:
+  case 161:
 
-/* Line 1455 of yacc.c  */
-#line 1291 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1384 "osm_qos_parser_y.y"
     {
                             /* 'group' in 'vlarb-scope' - any num of instances */
                             cl_list_iterator_t    list_iterator;
@@ -2981,19 +3133,19 @@ yyreduce:
                         }
     break;
 
-  case 156:
+  case 162:
 
-/* Line 1455 of yacc.c  */
-#line 1308 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1401 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 157:
+  case 163:
 
-/* Line 1455 of yacc.c  */
-#line 1313 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1406 "osm_qos_parser_y.y"
     {
                             /* 'across' in 'vlarb-scope' - any num of instances */
                             cl_list_iterator_t    list_iterator;
@@ -3011,19 +3163,19 @@ yyreduce:
                         }
     break;
 
-  case 158:
+  case 164:
 
-/* Line 1455 of yacc.c  */
-#line 1330 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1423 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 159:
+  case 165:
 
-/* Line 1455 of yacc.c  */
-#line 1335 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1428 "osm_qos_parser_y.y"
     {
                             /* 'vl-high-limit' in 'vlarb-scope' - one instance of one number */
                             cl_list_iterator_t    list_iterator;
@@ -3042,19 +3194,19 @@ yyreduce:
                         }
     break;
 
-  case 160:
+  case 166:
 
-/* Line 1455 of yacc.c  */
-#line 1353 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1446 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 161:
+  case 167:
 
-/* Line 1455 of yacc.c  */
-#line 1358 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1451 "osm_qos_parser_y.y"
     {
                             /* 'vlarb-high' in 'vlarb-scope' - list of pairs of numbers with ':' and ',' */
                             cl_list_iterator_t    list_iterator;
@@ -3072,19 +3224,19 @@ yyreduce:
                         }
     break;
 
-  case 162:
+  case 168:
 
-/* Line 1455 of yacc.c  */
-#line 1375 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1468 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 163:
+  case 169:
 
-/* Line 1455 of yacc.c  */
-#line 1380 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1473 "osm_qos_parser_y.y"
     {
                             /* 'vlarb-low' in 'vlarb-scope' - list of pairs of numbers with ':' and ',' */
                             cl_list_iterator_t    list_iterator;
@@ -3102,19 +3254,19 @@ yyreduce:
                         }
     break;
 
-  case 164:
+  case 170:
 
-/* Line 1455 of yacc.c  */
-#line 1397 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1490 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 165:
+  case 171:
 
-/* Line 1455 of yacc.c  */
-#line 1413 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1506 "osm_qos_parser_y.y"
     {
                             /* 'group' in 'sl2vl-scope' - any num of instances */
                             cl_list_iterator_t    list_iterator;
@@ -3132,19 +3284,19 @@ yyreduce:
                         }
     break;
 
-  case 166:
+  case 172:
 
-/* Line 1455 of yacc.c  */
-#line 1430 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1523 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 167:
+  case 173:
 
-/* Line 1455 of yacc.c  */
-#line 1435 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1528 "osm_qos_parser_y.y"
     {
                             /* 'across' in 'sl2vl-scope' - any num of instances */
                             cl_list_iterator_t    list_iterator;
@@ -3164,19 +3316,19 @@ yyreduce:
                         }
     break;
 
-  case 168:
+  case 174:
 
-/* Line 1455 of yacc.c  */
-#line 1454 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1547 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 169:
+  case 175:
 
-/* Line 1455 of yacc.c  */
-#line 1459 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1552 "osm_qos_parser_y.y"
     {
                             /* 'across-from' in 'sl2vl-scope' - any num of instances */
                             cl_list_iterator_t    list_iterator;
@@ -3194,19 +3346,19 @@ yyreduce:
                         }
     break;
 
-  case 170:
+  case 176:
 
-/* Line 1455 of yacc.c  */
-#line 1476 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1569 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 171:
+  case 177:
 
-/* Line 1455 of yacc.c  */
-#line 1481 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1574 "osm_qos_parser_y.y"
     {
                             /* 'across-to' in 'sl2vl-scope' - any num of instances */
                             cl_list_iterator_t    list_iterator;
@@ -3225,55 +3377,55 @@ yyreduce:
                         }
     break;
 
-  case 172:
+  case 178:
 
-/* Line 1455 of yacc.c  */
-#line 1499 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1592 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 173:
+  case 179:
 
-/* Line 1455 of yacc.c  */
-#line 1504 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1597 "osm_qos_parser_y.y"
     {
                             /* 'from' in 'sl2vl-scope' - any num of instances */
                         }
     break;
 
-  case 174:
+  case 180:
 
-/* Line 1455 of yacc.c  */
-#line 1509 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1602 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 175:
+  case 181:
 
-/* Line 1455 of yacc.c  */
-#line 1514 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1607 "osm_qos_parser_y.y"
     {
                             /* 'to' in 'sl2vl-scope' - any num of instances */
                         }
     break;
 
-  case 176:
+  case 182:
 
-/* Line 1455 of yacc.c  */
-#line 1519 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1612 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 179:
+  case 185:
 
-/* Line 1455 of yacc.c  */
-#line 1528 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1621 "osm_qos_parser_y.y"
     {
                             int i;
                             for (i = 0; i < OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH; i++)
@@ -3281,10 +3433,10 @@ yyreduce:
                         }
     break;
 
-  case 182:
+  case 188:
 
-/* Line 1455 of yacc.c  */
-#line 1539 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1632 "osm_qos_parser_y.y"
     {
                             int i;
                             for (i = 0; i < OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH; i++)
@@ -3292,10 +3444,10 @@ yyreduce:
                         }
     break;
 
-  case 183:
+  case 189:
 
-/* Line 1455 of yacc.c  */
-#line 1546 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1639 "osm_qos_parser_y.y"
     {
                             int i;
                             cl_list_iterator_t    list_iterator;
@@ -3328,10 +3480,10 @@ yyreduce:
                         }
     break;
 
-  case 184:
+  case 190:
 
-/* Line 1455 of yacc.c  */
-#line 1578 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1671 "osm_qos_parser_y.y"
     {
                             int i;
                             cl_list_iterator_t    list_iterator;
@@ -3364,10 +3516,10 @@ yyreduce:
                         }
     break;
 
-  case 185:
+  case 191:
 
-/* Line 1455 of yacc.c  */
-#line 1611 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1704 "osm_qos_parser_y.y"
     {
                             /* 'sl2vl-table' - one instance of exactly
                                OSM_QOS_POLICY_SL2VL_TABLE_LEN numbers */
@@ -3411,19 +3563,19 @@ yyreduce:
                         }
     break;
 
-  case 186:
+  case 192:
 
-/* Line 1455 of yacc.c  */
-#line 1654 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1747 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 187:
+  case 193:
 
-/* Line 1455 of yacc.c  */
-#line 1671 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1764 "osm_qos_parser_y.y"
     {
                             /* 'name' of 'qos-level' - one instance */
                             cl_list_iterator_t    list_iterator;
@@ -3447,19 +3599,19 @@ yyreduce:
                         }
     break;
 
-  case 188:
+  case 194:
 
-/* Line 1455 of yacc.c  */
-#line 1694 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1787 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 189:
+  case 195:
 
-/* Line 1455 of yacc.c  */
-#line 1699 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1792 "osm_qos_parser_y.y"
     {
                             /* 'use' of 'qos-level' - one instance */
                             cl_list_iterator_t    list_iterator;
@@ -3483,19 +3635,19 @@ yyreduce:
                         }
     break;
 
-  case 190:
+  case 196:
 
-/* Line 1455 of yacc.c  */
-#line 1722 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1815 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 191:
+  case 197:
 
-/* Line 1455 of yacc.c  */
-#line 1727 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1820 "osm_qos_parser_y.y"
     {
                             /* 'sl' in 'qos-level' - one instance */
                             cl_list_iterator_t   list_iterator;
@@ -3516,19 +3668,19 @@ yyreduce:
                         }
     break;
 
-  case 192:
+  case 198:
 
-/* Line 1455 of yacc.c  */
-#line 1747 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1840 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 193:
+  case 199:
 
-/* Line 1455 of yacc.c  */
-#line 1752 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1845 "osm_qos_parser_y.y"
     {
                             /* 'mtu-limit' in 'qos-level' - one instance */
                             cl_list_iterator_t   list_iterator;
@@ -3549,20 +3701,20 @@ yyreduce:
                         }
     break;
 
-  case 194:
+  case 200:
 
-/* Line 1455 of yacc.c  */
-#line 1772 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1865 "osm_qos_parser_y.y"
     {
                             /* 'mtu-limit' in 'qos-level' - one instance */
                             RESET_BUFFER;
                         }
     break;
 
-  case 195:
+  case 201:
 
-/* Line 1455 of yacc.c  */
-#line 1778 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1871 "osm_qos_parser_y.y"
     {
                             /* 'rate-limit' in 'qos-level' - one instance */
                             cl_list_iterator_t   list_iterator;
@@ -3583,20 +3735,20 @@ yyreduce:
                         }
     break;
 
-  case 196:
+  case 202:
 
-/* Line 1455 of yacc.c  */
-#line 1798 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1891 "osm_qos_parser_y.y"
     {
                             /* 'rate-limit' in 'qos-level' - one instance */
                             RESET_BUFFER;
                         }
     break;
 
-  case 197:
+  case 203:
 
-/* Line 1455 of yacc.c  */
-#line 1804 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1897 "osm_qos_parser_y.y"
     {
                             /* 'packet-life' in 'qos-level' - one instance */
                             cl_list_iterator_t   list_iterator;
@@ -3617,20 +3769,20 @@ yyreduce:
                         }
     break;
 
-  case 198:
+  case 204:
 
-/* Line 1455 of yacc.c  */
-#line 1824 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1917 "osm_qos_parser_y.y"
     {
                             /* 'packet-life' in 'qos-level' - one instance */
                             RESET_BUFFER;
                         }
     break;
 
-  case 199:
+  case 205:
 
-/* Line 1455 of yacc.c  */
-#line 1830 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1923 "osm_qos_parser_y.y"
     {
                             /* 'path-bits' in 'qos-level' - any num of instances */
                             /* list of path bit ranges */
@@ -3666,19 +3818,19 @@ yyreduce:
                         }
     break;
 
-  case 200:
+  case 206:
 
-/* Line 1455 of yacc.c  */
-#line 1865 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1958 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 201:
+  case 207:
 
-/* Line 1455 of yacc.c  */
-#line 1870 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1963 "osm_qos_parser_y.y"
     {
                             /* 'pkey' in 'qos-level' - num of instances of list of ranges */
                             if (cl_list_count(&tmp_parser_struct.num_pair_list))
@@ -3712,19 +3864,19 @@ yyreduce:
                         }
     break;
 
-  case 202:
+  case 208:
 
-/* Line 1455 of yacc.c  */
-#line 1903 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 1996 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 203:
+  case 209:
 
-/* Line 1455 of yacc.c  */
-#line 1920 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2013 "osm_qos_parser_y.y"
     {
                             /* 'use' of 'qos-match-rule' - one instance */
                             cl_list_iterator_t    list_iterator;
@@ -3748,19 +3900,19 @@ yyreduce:
                         }
     break;
 
-  case 204:
+  case 210:
 
-/* Line 1455 of yacc.c  */
-#line 1943 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2036 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 205:
+  case 211:
 
-/* Line 1455 of yacc.c  */
-#line 1948 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2041 "osm_qos_parser_y.y"
     {
                             /* 'qos-class' in 'qos-match-rule' - num of instances of list of ranges */
                             /* list of class ranges (QoS Class is 12-bit value) */
@@ -3795,19 +3947,19 @@ yyreduce:
                         }
     break;
 
-  case 206:
+  case 212:
 
-/* Line 1455 of yacc.c  */
-#line 1982 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2075 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 207:
+  case 213:
 
-/* Line 1455 of yacc.c  */
-#line 1987 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2080 "osm_qos_parser_y.y"
     {
                             /* 'source' in 'qos-match-rule' - text */
                             cl_list_iterator_t    list_iterator;
@@ -3825,19 +3977,19 @@ yyreduce:
                         }
     break;
 
-  case 208:
+  case 214:
 
-/* Line 1455 of yacc.c  */
-#line 2004 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2097 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 209:
+  case 215:
 
-/* Line 1455 of yacc.c  */
-#line 2009 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2102 "osm_qos_parser_y.y"
     {
                             /* 'destination' in 'qos-match-rule' - text */
                             cl_list_iterator_t    list_iterator;
@@ -3855,19 +4007,19 @@ yyreduce:
                         }
     break;
 
-  case 210:
+  case 216:
 
-/* Line 1455 of yacc.c  */
-#line 2026 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2119 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 211:
+  case 217:
 
-/* Line 1455 of yacc.c  */
-#line 2031 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2124 "osm_qos_parser_y.y"
     {
                             /* 'qos-level-name' in 'qos-match-rule' - single string */
                             cl_list_iterator_t   list_iterator;
@@ -3891,19 +4043,19 @@ yyreduce:
                         }
     break;
 
-  case 212:
+  case 218:
 
-/* Line 1455 of yacc.c  */
-#line 2054 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2147 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 213:
+  case 219:
 
-/* Line 1455 of yacc.c  */
-#line 2059 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2152 "osm_qos_parser_y.y"
     {
                             /* 'service-id' in 'qos-match-rule' - num of instances of list of ranges */
                             if (cl_list_count(&tmp_parser_struct.num_pair_list))
@@ -3937,19 +4089,19 @@ yyreduce:
                         }
     break;
 
-  case 214:
+  case 220:
 
-/* Line 1455 of yacc.c  */
-#line 2092 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2185 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 215:
+  case 221:
 
-/* Line 1455 of yacc.c  */
-#line 2097 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2190 "osm_qos_parser_y.y"
     {
                             /* 'pkey' in 'qos-match-rule' - num of instances of list of ranges */
                             if (cl_list_count(&tmp_parser_struct.num_pair_list))
@@ -3983,19 +4135,19 @@ yyreduce:
                         }
     break;
 
-  case 216:
+  case 222:
 
-/* Line 1455 of yacc.c  */
-#line 2130 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2223 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
     break;
 
-  case 217:
+  case 223:
 
-/* Line 1455 of yacc.c  */
-#line 2141 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2234 "osm_qos_parser_y.y"
     {
                         cl_list_insert_tail(&tmp_parser_struct.str_list,
                                             strdup(__parser_strip_white(tmp_parser_struct.str)));
@@ -4003,20 +4155,20 @@ yyreduce:
                     }
     break;
 
-  case 220:
+  case 226:
 
-/* Line 1455 of yacc.c  */
-#line 2152 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2245 "osm_qos_parser_y.y"
     {
                         strcat(tmp_parser_struct.str,(yyvsp[(1) - (1)]));
                         free((yyvsp[(1) - (1)]));
                     }
     break;
 
-  case 226:
+  case 232:
 
-/* Line 1455 of yacc.c  */
-#line 2172 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2265 "osm_qos_parser_y.y"
     {
                         uint64_t * p_num = (uint64_t*)malloc(sizeof(uint64_t));
                         __parser_str2uint64(p_num,(yyvsp[(1) - (1)]));
@@ -4025,10 +4177,10 @@ yyreduce:
                     }
     break;
 
-  case 227:
+  case 233:
 
-/* Line 1455 of yacc.c  */
-#line 2180 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2273 "osm_qos_parser_y.y"
     {
                         uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);
                         num_pair[0] = tmp_parser_struct.num_pair[0];
@@ -4037,10 +4189,10 @@ yyreduce:
                     }
     break;
 
-  case 228:
+  case 234:
 
-/* Line 1455 of yacc.c  */
-#line 2186 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2279 "osm_qos_parser_y.y"
     {
                         uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);
                         num_pair[0] = tmp_parser_struct.num_pair[0];
@@ -4049,30 +4201,30 @@ yyreduce:
                     }
     break;
 
-  case 229:
+  case 235:
 
-/* Line 1455 of yacc.c  */
-#line 2194 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2287 "osm_qos_parser_y.y"
     {
                         __parser_str2uint64(&tmp_parser_struct.num_pair[0],(yyvsp[(1) - (1)]));
                         free((yyvsp[(1) - (1)]));
                     }
     break;
 
-  case 230:
+  case 236:
 
-/* Line 1455 of yacc.c  */
-#line 2200 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2293 "osm_qos_parser_y.y"
     {
                         __parser_str2uint64(&tmp_parser_struct.num_pair[1],(yyvsp[(1) - (1)]));
                         free((yyvsp[(1) - (1)]));
                     }
     break;
 
-  case 232:
+  case 238:
 
-/* Line 1455 of yacc.c  */
-#line 2209 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2302 "osm_qos_parser_y.y"
     {
                         uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);
                         num_pair[0] = tmp_parser_struct.num_pair[0];
@@ -4081,10 +4233,10 @@ yyreduce:
                     }
     break;
 
-  case 233:
+  case 239:
 
-/* Line 1455 of yacc.c  */
-#line 2215 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2308 "osm_qos_parser_y.y"
     {
                         uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);
                         if (tmp_parser_struct.num_pair[0] <= tmp_parser_struct.num_pair[1]) {
@@ -4099,10 +4251,10 @@ yyreduce:
                     }
     break;
 
-  case 234:
+  case 240:
 
-/* Line 1455 of yacc.c  */
-#line 2227 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2320 "osm_qos_parser_y.y"
     {
                         uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);
                         if (tmp_parser_struct.num_pair[0] <= tmp_parser_struct.num_pair[1]) {
@@ -4117,10 +4269,10 @@ yyreduce:
                     }
     break;
 
-  case 235:
+  case 241:
 
-/* Line 1455 of yacc.c  */
-#line 2239 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2332 "osm_qos_parser_y.y"
     {
                         uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);
                         num_pair[0] = tmp_parser_struct.num_pair[0];
@@ -4129,10 +4281,10 @@ yyreduce:
                     }
     break;
 
-  case 236:
+  case 242:
 
-/* Line 1455 of yacc.c  */
-#line 2247 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2340 "osm_qos_parser_y.y"
     {
                         __parser_str2uint64(&tmp_parser_struct.num_pair[0],(yyvsp[(1) - (1)]));
                         __parser_str2uint64(&tmp_parser_struct.num_pair[1],(yyvsp[(1) - (1)]));
@@ -4140,20 +4292,20 @@ yyreduce:
                     }
     break;
 
-  case 237:
+  case 243:
 
-/* Line 1455 of yacc.c  */
-#line 2254 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2347 "osm_qos_parser_y.y"
     {
                         __parser_str2uint64(&tmp_parser_struct.num_pair[0],(yyvsp[(1) - (1)]));
                         free((yyvsp[(1) - (1)]));
                     }
     break;
 
-  case 238:
+  case 244:
 
-/* Line 1455 of yacc.c  */
-#line 2260 "osm_qos_parser_y.y"
+/* Line 1806 of yacc.c  */
+#line 2353 "osm_qos_parser_y.y"
     {
                         __parser_str2uint64(&tmp_parser_struct.num_pair[1],(yyvsp[(1) - (1)]));
                         free((yyvsp[(1) - (1)]));
@@ -4162,10 +4314,21 @@ yyreduce:
 
 
 
-/* Line 1455 of yacc.c  */
-#line 4167 "osm_qos_parser_y.c"
+/* Line 1806 of yacc.c  */
+#line 4319 "osm_qos_parser_y.c"
       default: break;
     }
+  /* User semantic actions sometimes alter yychar, and that requires
+     that yytoken be updated with the new translation.  We take the
+     approach of translating immediately before every use of yytoken.
+     One alternative is translating here after every semantic action,
+     but that translation would be missed if the semantic action invokes
+     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
+     incorrect destructor might then be invoked immediately.  In the
+     case of YYERROR or YYBACKUP, subsequent parser actions might lead
+     to an incorrect destructor call or verbose syntax error message
+     before the lookahead is translated.  */
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
 
   YYPOPSTACK (yylen);
@@ -4193,6 +4356,10 @@ yyreduce:
 | yyerrlab -- here on detecting error |
 `------------------------------------*/
 yyerrlab:
+  /* Make sure we have latest lookahead translation.  See comments at
+     user semantic actions for why this is necessary.  */
+  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
   /* If not already recovering from an error, report this error.  */
   if (!yyerrstatus)
     {
@@ -4200,37 +4367,36 @@ yyerrlab:
 #if ! YYERROR_VERBOSE
       yyerror (YY_("syntax error"));
 #else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+                                        yyssp, yytoken)
       {
-	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
-	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
-	  {
-	    YYSIZE_T yyalloc = 2 * yysize;
-	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
-	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
-	    if (yymsg != yymsgbuf)
-	      YYSTACK_FREE (yymsg);
-	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
-	    if (yymsg)
-	      yymsg_alloc = yyalloc;
-	    else
-	      {
-		yymsg = yymsgbuf;
-		yymsg_alloc = sizeof yymsgbuf;
-	      }
-	  }
-
-	if (0 < yysize && yysize <= yymsg_alloc)
-	  {
-	    (void) yysyntax_error (yymsg, yystate, yychar);
-	    yyerror (yymsg);
-	  }
-	else
-	  {
-	    yyerror (YY_("syntax error"));
-	    if (yysize != 0)
-	      goto yyexhaustedlab;
-	  }
+        char const *yymsgp = YY_("syntax error");
+        int yysyntax_error_status;
+        yysyntax_error_status = YYSYNTAX_ERROR;
+        if (yysyntax_error_status == 0)
+          yymsgp = yymsg;
+        else if (yysyntax_error_status == 1)
+          {
+            if (yymsg != yymsgbuf)
+              YYSTACK_FREE (yymsg);
+            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+            if (!yymsg)
+              {
+                yymsg = yymsgbuf;
+                yymsg_alloc = sizeof yymsgbuf;
+                yysyntax_error_status = 2;
+              }
+            else
+              {
+                yysyntax_error_status = YYSYNTAX_ERROR;
+                yymsgp = yymsg;
+              }
+          }
+        yyerror (yymsgp);
+        if (yysyntax_error_status == 2)
+          goto yyexhaustedlab;
       }
+# undef YYSYNTAX_ERROR
 #endif
     }
 
@@ -4289,7 +4455,7 @@ yyerrlab1:
   for (;;)
     {
       yyn = yypact[yystate];
-      if (yyn != YYPACT_NINF)
+      if (!yypact_value_is_default (yyn))
 	{
 	  yyn += YYTERROR;
 	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@@ -4348,8 +4514,13 @@ yyexhaustedlab:
 
 yyreturn:
   if (yychar != YYEMPTY)
-     yydestruct ("Cleanup: discarding lookahead",
-		 yytoken, &yylval);
+    {
+      /* Make sure we have latest lookahead translation.  See comments at
+         user semantic actions for why this is necessary.  */
+      yytoken = YYTRANSLATE (yychar);
+      yydestruct ("Cleanup: discarding lookahead",
+                  yytoken, &yylval);
+    }
   /* Do not reclaim the symbols of the rule which action triggered
      this YYABORT or YYACCEPT.  */
   YYPOPSTACK (yylen);
@@ -4374,14 +4545,14 @@ yyreturn:
 
 
 
-/* Line 1675 of yacc.c  */
-#line 2266 "osm_qos_parser_y.y"
+/* Line 2067 of yacc.c  */
+#line 2359 "osm_qos_parser_y.y"
 
 
 /***************************************************
  ***************************************************/
 
-int osm_qos_parse_policy_file(IN osm_subn_t * const p_subn)
+int osm_qos_parse_policy_file(IN osm_subn_t * p_subn)
 {
     int res = 0;
     static boolean_t first_time = TRUE;
@@ -4467,7 +4638,10 @@ int osm_qos_parse_policy_file(IN osm_subn_t * const p_subn)
 
   Exit:
     if (yyin)
+    {
+        yyrestart(yyin);
         fclose(yyin);
+    }
     OSM_LOG_EXIT(p_qos_parser_osm_log);
     return res;
 }
@@ -4507,20 +4681,17 @@ static void yyerror(const char *format, ...)
 
 static char * __parser_strip_white(char * str)
 {
-   int i;
-   for (i = (strlen(str)-1); i >= 0; i--)
-   {
-      if (isspace(str[i]))
-          str[i] = '\0';
-      else
-         break;
-   }
-   for (i = 0; i < strlen(str); i++)
-   {
-      if (!isspace(str[i]))
-         break;
-   }
-   return &(str[i]);
+	char *p;
+
+	while (isspace(*str))
+		str++;
+	if (!*str)
+		return str;
+	p = str + strlen(str) - 1;
+	while (isspace(*p))
+		*p-- = '\0';
+
+	return str;
 }
 
 /***************************************************
@@ -4801,10 +4972,7 @@ static void __process_ulp_match_rules()
 /***************************************************
  ***************************************************/
 
-static int OSM_CDECL
-__cmp_num_range(
-    const void * p1,
-    const void * p2)
+static int __cmp_num_range(const void * p1, const void * p2)
 {
     uint64_t * pair1 = *((uint64_t **)p1);
     uint64_t * pair2 = *((uint64_t **)p2);
diff --git a/opensm/osm_qos_parser_y.h b/opensm/osm_qos_parser_y.h
index efe5d7c..ca39639 100644
--- a/opensm/osm_qos_parser_y.h
+++ b/opensm/osm_qos_parser_y.h
@@ -1,10 +1,8 @@
+/* A Bison parser, made by GNU Bison 2.5.  */
 
-/* A Bison parser, made by GNU Bison 2.4.1.  */
-
-/* Skeleton interface for Bison's Yacc-like parsers in C
+/* Bison interface for Yacc-like parsers in C
    
-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-   Free Software Foundation, Inc.
+      Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -105,15 +103,17 @@
      TK_ULP_ANY_SERVICE_ID = 321,
      TK_ULP_ANY_PKEY = 322,
      TK_ULP_ANY_TARGET_PORT_GUID = 323,
-     TK_ULP_SDP_DEFAULT = 324,
-     TK_ULP_SDP_PORT = 325,
-     TK_ULP_RDS_DEFAULT = 326,
-     TK_ULP_RDS_PORT = 327,
-     TK_ULP_ISER_DEFAULT = 328,
-     TK_ULP_ISER_PORT = 329,
-     TK_ULP_SRP_GUID = 330,
-     TK_ULP_IPOIB_DEFAULT = 331,
-     TK_ULP_IPOIB_PKEY = 332
+     TK_ULP_ANY_SOURCE_PORT_GUID = 324,
+     TK_ULP_ANY_SOURCE_TARGET_PORT_GUID = 325,
+     TK_ULP_SDP_DEFAULT = 326,
+     TK_ULP_SDP_PORT = 327,
+     TK_ULP_RDS_DEFAULT = 328,
+     TK_ULP_RDS_PORT = 329,
+     TK_ULP_ISER_DEFAULT = 330,
+     TK_ULP_ISER_PORT = 331,
+     TK_ULP_SRP_GUID = 332,
+     TK_ULP_IPOIB_DEFAULT = 333,
+     TK_ULP_IPOIB_PKEY = 334
    };
 #endif
 /* Tokens.  */
@@ -183,15 +183,17 @@
 #define TK_ULP_ANY_SERVICE_ID 321
 #define TK_ULP_ANY_PKEY 322
 #define TK_ULP_ANY_TARGET_PORT_GUID 323
-#define TK_ULP_SDP_DEFAULT 324
-#define TK_ULP_SDP_PORT 325
-#define TK_ULP_RDS_DEFAULT 326
-#define TK_ULP_RDS_PORT 327
-#define TK_ULP_ISER_DEFAULT 328
-#define TK_ULP_ISER_PORT 329
-#define TK_ULP_SRP_GUID 330
-#define TK_ULP_IPOIB_DEFAULT 331
-#define TK_ULP_IPOIB_PKEY 332
+#define TK_ULP_ANY_SOURCE_PORT_GUID 324
+#define TK_ULP_ANY_SOURCE_TARGET_PORT_GUID 325
+#define TK_ULP_SDP_DEFAULT 326
+#define TK_ULP_SDP_PORT 327
+#define TK_ULP_RDS_DEFAULT 328
+#define TK_ULP_RDS_PORT 329
+#define TK_ULP_ISER_DEFAULT 330
+#define TK_ULP_ISER_PORT 331
+#define TK_ULP_SRP_GUID 332
+#define TK_ULP_IPOIB_DEFAULT 333
+#define TK_ULP_IPOIB_PKEY 334
 
 
 
diff --git a/opensm/osm_qos_parser_y.y b/opensm/osm_qos_parser_y.y
index 6b5a9b1..4e01ed4 100644
--- a/opensm/osm_qos_parser_y.y
+++ b/opensm/osm_qos_parser_y.y
@@ -1,7 +1,7 @@
 %{
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 HNR Consulting. All rights reserved.
  *
@@ -53,6 +53,8 @@
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_QOS_PARSER_Y_Y
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_qos_policy.h>
 
@@ -149,6 +151,7 @@ extern char * yytext;
 extern int yylex (void);
 extern FILE * yyin;
 extern int errno;
+extern void yyrestart(FILE *input_file);
 int yyparse();
 
 #define RESET_BUFFER  __parser_tmp_struct_reset()
@@ -259,6 +262,8 @@ static cl_list_t __ulp_match_rules;
 %token TK_ULP_ANY_SERVICE_ID
 %token TK_ULP_ANY_PKEY
 %token TK_ULP_ANY_TARGET_PORT_GUID
+%token TK_ULP_ANY_SOURCE_PORT_GUID
+%token TK_ULP_ANY_SOURCE_TARGET_PORT_GUID
 %token TK_ULP_SDP_DEFAULT
 %token TK_ULP_SDP_PORT
 %token TK_ULP_RDS_DEFAULT
@@ -305,6 +310,8 @@ qos_policy_entry:     qos_ulps_section
      *      any, service-id 0x6234        : 2
      *      any, pkey 0x0ABC              : 3
      *      any, target-port-guid 0x0ABC-0xFFFFF : 6
+     *      any, source-port-guid 0x1234  : 7
+     *      any, source-target-port-guid 0x5678 : 8
      *  end-qos-ulps
      */
 
@@ -623,7 +630,7 @@ qos_match_rule_entry: qos_match_rule_use
      *   sdp with port-num
      *   rds
      *   rds with port-num
-     *   srp with port-guid
+     *   srp with target-port-guid
      *   iser
      *   iser with port-num
      *   ipoib
@@ -631,6 +638,8 @@ qos_match_rule_entry: qos_match_rule_use
      *   any with service-id
      *   any with pkey
      *   any with target-port-guid
+     *   any with source-port-guid
+     *   any with source-target-port-guid
      */
 
 qos_ulp:            TK_ULP_DEFAULT single_number {
@@ -728,6 +737,79 @@ qos_ulp:            TK_ULP_DEFAULT single_number {
 
                     } qos_ulp_sl
 
+		    | qos_ulp_type_any_source_port_guid list_of_ranges TK_DOTDOT {
+			/* any, source-port-guid ... : sl */
+			uint64_t ** range_arr;
+			unsigned    range_len;
+
+			if (!cl_list_count(&tmp_parser_struct.num_pair_list))
+			{
+				yyerror("ULP rule doesn't have port guids");
+				return 1;
+			}
+
+                        /* create a new port group with these ports */
+                        __parser_port_group_start();
+
+                        p_current_port_group->name = strdup("_ULP_Sources_");
+                        p_current_port_group->use = strdup("Generated from ULP rules");
+
+                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,
+                                              &range_arr,
+                                              &range_len );
+
+                        __parser_add_guid_range_to_port_map(
+                                              &p_current_port_group->port_map,
+                                              range_arr,
+                                              range_len);
+
+                        /* add this port group to the source
+                           groups of the current match rule */
+                        cl_list_insert_tail(&p_current_qos_match_rule->source_group_list,
+                                            p_current_port_group);
+
+                        __parser_port_group_end();
+
+		    } qos_ulp_sl
+
+		    | qos_ulp_type_any_source_target_port_guid list_of_ranges TK_DOTDOT {
+			/* any, source-target-port-guid ... : sl */
+			uint64_t ** range_arr;
+			unsigned    range_len;
+
+			if (!cl_list_count(&tmp_parser_struct.num_pair_list))
+			{
+				yyerror("ULP rule doesn't have port guids");
+				return 1;
+			}
+
+                        /* create a new port group with these ports */
+                        __parser_port_group_start();
+
+                        p_current_port_group->name = strdup("_ULP_Sources_Targets_");
+                        p_current_port_group->use = strdup("Generated from ULP rules");
+
+                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,
+                                              &range_arr,
+                                              &range_len );
+
+                        __parser_add_guid_range_to_port_map(
+                                              &p_current_port_group->port_map,
+                                              range_arr,
+                                              range_len);
+
+                        /* add this port group to the source and destination
+                           groups of the current match rule */
+                        cl_list_insert_tail(&p_current_qos_match_rule->source_group_list,
+                                            p_current_port_group);
+
+                        cl_list_insert_tail(&p_current_qos_match_rule->destination_group_list,
+                                            p_current_port_group);
+
+                        __parser_port_group_end();
+
+		    } qos_ulp_sl
+
                     | qos_ulp_type_sdp_default {
                         /* "sdp : sl" - default SL for SDP */
                         uint64_t ** range_arr =
@@ -763,6 +845,7 @@ qos_ulp:            TK_ULP_DEFAULT single_number {
                             if (range_arr[i][0] > 0xFFFF || range_arr[i][1] > 0xFFFF)
                             {
                                 yyerror("SDP port number out of range");
+				free(range_arr);
                                 return 1;
                             }
                             range_arr[i][0] += OSM_QOS_POLICY_ULP_SDP_SERVICE_ID;
@@ -809,6 +892,7 @@ qos_ulp:            TK_ULP_DEFAULT single_number {
                             if (range_arr[i][0] > 0xFFFF || range_arr[i][1] > 0xFFFF)
                             {
                                 yyerror("SDP port number out of range");
+				free(range_arr);
                                 return 1;
                             }
                             range_arr[i][0] += OSM_QOS_POLICY_ULP_RDS_SERVICE_ID;
@@ -855,6 +939,7 @@ qos_ulp:            TK_ULP_DEFAULT single_number {
                             if (range_arr[i][0] > 0xFFFF || range_arr[i][1] > 0xFFFF)
                             {
                                 yyerror("SDP port number out of range");
+				free(range_arr);
                                 return 1;
                             }
                             range_arr[i][0] += OSM_QOS_POLICY_ULP_ISER_SERVICE_ID;
@@ -944,8 +1029,10 @@ qos_ulp:            TK_ULP_DEFAULT single_number {
                          * If some problem would be found, parsing will
                          * be aborted with a proper error messages.
                          */
-                        if (__validate_pkeys(range_arr, range_len, TRUE))
+			if (__validate_pkeys(range_arr, range_len, TRUE)) {
+			    free(range_arr);
                             return 1;
+			}
 
                         p_current_qos_match_rule->pkey_range_arr = range_arr;
                         p_current_qos_match_rule->pkey_range_len = range_len;
@@ -962,6 +1049,12 @@ qos_ulp_type_any_pkey: TK_ULP_ANY_PKEY
 qos_ulp_type_any_target_port_guid: TK_ULP_ANY_TARGET_PORT_GUID
                     { __parser_ulp_match_rule_start(); };
 
+qos_ulp_type_any_source_port_guid: TK_ULP_ANY_SOURCE_PORT_GUID
+                    { __parser_ulp_match_rule_start(); };
+
+qos_ulp_type_any_source_target_port_guid: TK_ULP_ANY_SOURCE_TARGET_PORT_GUID
+                    { __parser_ulp_match_rule_start(); };
+
 qos_ulp_type_sdp_default: TK_ULP_SDP_DEFAULT
                     { __parser_ulp_match_rule_start(); };
 
@@ -2268,7 +2361,7 @@ number_from_range_2:  TK_NUMBER {
 /***************************************************
  ***************************************************/
 
-int osm_qos_parse_policy_file(IN osm_subn_t * const p_subn)
+int osm_qos_parse_policy_file(IN osm_subn_t * p_subn)
 {
     int res = 0;
     static boolean_t first_time = TRUE;
@@ -2354,7 +2447,10 @@ int osm_qos_parse_policy_file(IN osm_subn_t * const p_subn)
 
   Exit:
     if (yyin)
+    {
+        yyrestart(yyin);
         fclose(yyin);
+    }
     OSM_LOG_EXIT(p_qos_parser_osm_log);
     return res;
 }
@@ -2394,20 +2490,17 @@ static void yyerror(const char *format, ...)
 
 static char * __parser_strip_white(char * str)
 {
-   int i;
-   for (i = (strlen(str)-1); i >= 0; i--)
-   {
-      if (isspace(str[i]))
-          str[i] = '\0';
-      else
-         break;
-   }
-   for (i = 0; i < strlen(str); i++)
-   {
-      if (!isspace(str[i]))
-         break;
-   }
-   return &(str[i]);
+	char *p;
+
+	while (isspace(*str))
+		str++;
+	if (!*str)
+		return str;
+	p = str + strlen(str) - 1;
+	while (isspace(*p))
+		*p-- = '\0';
+
+	return str;
 }
 
 /***************************************************
@@ -2688,10 +2781,7 @@ static void __process_ulp_match_rules()
 /***************************************************
  ***************************************************/
 
-static int OSM_CDECL
-__cmp_num_range(
-    const void * p1,
-    const void * p2)
+static int __cmp_num_range(const void * p1, const void * p2)
 {
     uint64_t * pair1 = *((uint64_t **)p1);
     uint64_t * pair2 = *((uint64_t **)p2);
diff --git a/opensm/osm_qos_policy.c b/opensm/osm_qos_policy.c
index 094fef2..c8526b9 100644
--- a/opensm/osm_qos_policy.c
+++ b/opensm/osm_qos_policy.c
@@ -1,8 +1,9 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
+ * Copyright (c) 2009 HNR Consulting.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -47,6 +48,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#include <arpa/inet.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_QOS_POLICY_C
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_port.h>
@@ -133,12 +137,9 @@ static void __free_single_element(void *p_element, void *context)
 osm_qos_port_t *osm_qos_policy_port_create(osm_physp_t *p_physp)
 {
 	osm_qos_port_t *p =
-	    (osm_qos_port_t *) malloc(sizeof(osm_qos_port_t));
-	if (!p)
-		return NULL;
-	memset(p, 0, sizeof(osm_qos_port_t));
-
-	p->p_physp = p_physp;
+	    (osm_qos_port_t *) calloc(1, sizeof(osm_qos_port_t));
+	if (p)
+		p->p_physp = p_physp;
 	return p;
 }
 
@@ -148,13 +149,9 @@ osm_qos_port_t *osm_qos_policy_port_create(osm_physp_t *p_physp)
 osm_qos_port_group_t *osm_qos_policy_port_group_create()
 {
 	osm_qos_port_group_t *p =
-	    (osm_qos_port_group_t *) malloc(sizeof(osm_qos_port_group_t));
-	if (!p)
-		return NULL;
-
-	memset(p, 0, sizeof(osm_qos_port_group_t));
-	cl_qmap_init(&p->port_map);
-
+	    (osm_qos_port_group_t *) calloc(1, sizeof(osm_qos_port_group_t));
+	if (p)
+		cl_qmap_init(&p->port_map);
 	return p;
 }
 
@@ -192,17 +189,13 @@ void osm_qos_policy_port_group_destroy(osm_qos_port_group_t * p)
 osm_qos_vlarb_scope_t *osm_qos_policy_vlarb_scope_create()
 {
 	osm_qos_vlarb_scope_t *p =
-	    (osm_qos_vlarb_scope_t *) malloc(sizeof(osm_qos_sl2vl_scope_t));
-	if (!p)
-		return NULL;
-
-	memset(p, 0, sizeof(osm_qos_vlarb_scope_t));
-
-	cl_list_init(&p->group_list, 10);
-	cl_list_init(&p->across_list, 10);
-	cl_list_init(&p->vlarb_high_list, 10);
-	cl_list_init(&p->vlarb_low_list, 10);
-
+	    (osm_qos_vlarb_scope_t *) calloc(1, sizeof(osm_qos_vlarb_scope_t));
+	if (p) {
+		cl_list_init(&p->group_list, 10);
+		cl_list_init(&p->across_list, 10);
+		cl_list_init(&p->vlarb_high_list, 10);
+		cl_list_init(&p->vlarb_low_list, 10);
+	}
 	return p;
 }
 
@@ -238,16 +231,12 @@ void osm_qos_policy_vlarb_scope_destroy(osm_qos_vlarb_scope_t * p)
 osm_qos_sl2vl_scope_t *osm_qos_policy_sl2vl_scope_create()
 {
 	osm_qos_sl2vl_scope_t *p =
-	    (osm_qos_sl2vl_scope_t *) malloc(sizeof(osm_qos_sl2vl_scope_t));
-	if (!p)
-		return NULL;
-
-	memset(p, 0, sizeof(osm_qos_sl2vl_scope_t));
-
-	cl_list_init(&p->group_list, 10);
-	cl_list_init(&p->across_from_list, 10);
-	cl_list_init(&p->across_to_list, 10);
-
+	    (osm_qos_sl2vl_scope_t *) calloc(1, sizeof(osm_qos_sl2vl_scope_t));
+	if (p) {
+		cl_list_init(&p->group_list, 10);
+		cl_list_init(&p->across_from_list, 10);
+		cl_list_init(&p->across_to_list, 10);
+	}
 	return p;
 }
 
@@ -280,10 +269,7 @@ void osm_qos_policy_sl2vl_scope_destroy(osm_qos_sl2vl_scope_t * p)
 osm_qos_level_t *osm_qos_policy_qos_level_create()
 {
 	osm_qos_level_t *p =
-	    (osm_qos_level_t *) malloc(sizeof(osm_qos_level_t));
-	if (!p)
-		return NULL;
-	memset(p, 0, sizeof(osm_qos_level_t));
+	    (osm_qos_level_t *) calloc(1, sizeof(osm_qos_level_t));
 	return p;
 }
 
@@ -320,7 +306,7 @@ boolean_t osm_qos_level_has_pkey(IN const osm_qos_level_t * p_qos_level,
 		return FALSE;
 	return __is_num_in_range_arr(p_qos_level->pkey_range_arr,
 				     p_qos_level->pkey_range_len,
-				     cl_ntoh16(pkey));
+				     cl_ntoh16(ib_pkey_get_base(pkey)));
 }
 
 /***************************************************
@@ -328,7 +314,8 @@ boolean_t osm_qos_level_has_pkey(IN const osm_qos_level_t * p_qos_level,
 
 ib_net16_t osm_qos_level_get_shared_pkey(IN const osm_qos_level_t * p_qos_level,
 					 IN const osm_physp_t * p_src_physp,
-					 IN const osm_physp_t * p_dest_physp)
+					 IN const osm_physp_t * p_dest_physp,
+					 IN const boolean_t allow_both_pkeys)
 {
 	unsigned i;
 	uint16_t pkey_ho = 0;
@@ -346,7 +333,8 @@ ib_net16_t osm_qos_level_get_shared_pkey(IN const osm_qos_level_t * p_qos_level,
 		for (pkey_ho = p_qos_level->pkey_range_arr[i][0];
 		     pkey_ho <= p_qos_level->pkey_range_arr[i][1]; pkey_ho++) {
 			if (osm_physp_share_this_pkey
-			    (p_src_physp, p_dest_physp, cl_hton16(pkey_ho)))
+			    (p_src_physp, p_dest_physp, cl_hton16(pkey_ho),
+			     allow_both_pkeys))
 				return cl_hton16(pkey_ho);
 		}
 	}
@@ -360,17 +348,13 @@ ib_net16_t osm_qos_level_get_shared_pkey(IN const osm_qos_level_t * p_qos_level,
 osm_qos_match_rule_t *osm_qos_policy_match_rule_create()
 {
 	osm_qos_match_rule_t *p =
-	    (osm_qos_match_rule_t *) malloc(sizeof(osm_qos_match_rule_t));
-	if (!p)
-		return NULL;
-
-	memset(p, 0, sizeof(osm_qos_match_rule_t));
-
-	cl_list_init(&p->source_list, 10);
-	cl_list_init(&p->source_group_list, 10);
-	cl_list_init(&p->destination_list, 10);
-	cl_list_init(&p->destination_group_list, 10);
-
+	    (osm_qos_match_rule_t *) calloc(1, sizeof(osm_qos_match_rule_t));
+	if (p) {
+		cl_list_init(&p->source_list, 10);
+		cl_list_init(&p->source_group_list, 10);
+		cl_list_init(&p->destination_list, 10);
+		cl_list_init(&p->destination_group_list, 10);
+	}
 	return p;
 }
 
@@ -426,12 +410,10 @@ void osm_qos_policy_match_rule_destroy(osm_qos_match_rule_t * p)
 
 osm_qos_policy_t * osm_qos_policy_create(osm_subn_t * p_subn)
 {
-	osm_qos_policy_t * p_qos_policy = (osm_qos_policy_t *)malloc(sizeof(osm_qos_policy_t));
+	osm_qos_policy_t * p_qos_policy = (osm_qos_policy_t *)calloc(1, sizeof(osm_qos_policy_t));
 	if (!p_qos_policy)
 		return NULL;
 
-	memset(p_qos_policy, 0, sizeof(osm_qos_policy_t));
-
 	cl_list_construct(&p_qos_policy->port_groups);
 	cl_list_init(&p_qos_policy->port_groups, 10);
 
@@ -600,6 +582,7 @@ static osm_qos_match_rule_t *__qos_policy_get_match_rule_by_params(
 
 	boolean_t matched_by_sguid = FALSE,
 		  matched_by_dguid = FALSE,
+		  matched_by_sordguid = FALSE,
 		  matched_by_class = FALSE,
 		  matched_by_sid = FALSE,
 		  matched_by_pkey = FALSE;
@@ -620,9 +603,11 @@ static osm_qos_match_rule_t *__qos_policy_get_match_rule_by_params(
 			continue;
 		}
 
-		/* If a match rule has Source groups, PR request source has to be in this list */
+		/* If a match rule has Source groups and no Destination groups,
+		 * PR request source has to be in this list */
 
-		if (cl_list_count(&p_qos_match_rule->source_group_list)) {
+		if (cl_list_count(&p_qos_match_rule->source_group_list)
+		    && !cl_list_count(&p_qos_match_rule->destination_group_list)) {
 			if (!__qos_policy_is_port_in_group_list(p_qos_policy,
 								p_src_physp,
 								&p_qos_match_rule->
@@ -634,9 +619,11 @@ static osm_qos_match_rule_t *__qos_policy_get_match_rule_by_params(
 			matched_by_sguid = TRUE;
 		}
 
-		/* If a match rule has Destination groups, PR request dest. has to be in this list */
+		/* If a match rule has Destination groups and no Source groups,
+		 * PR request dest. has to be in this list */
 
-		if (cl_list_count(&p_qos_match_rule->destination_group_list)) {
+		if (cl_list_count(&p_qos_match_rule->destination_group_list)
+		    && !cl_list_count(&p_qos_match_rule->source_group_list)) {
 			if (!__qos_policy_is_port_in_group_list(p_qos_policy,
 								p_dest_physp,
 								&p_qos_match_rule->
@@ -648,6 +635,26 @@ static osm_qos_match_rule_t *__qos_policy_get_match_rule_by_params(
 			matched_by_dguid = TRUE;
 		}
 
+		/* If a match rule has both Source and Destination groups,
+		 * PR request source or dest. must be in respective list
+		 */
+		if (cl_list_count(&p_qos_match_rule->source_group_list)
+		    && cl_list_count(&p_qos_match_rule->destination_group_list)) {
+			if (!__qos_policy_is_port_in_group_list(p_qos_policy,
+								p_src_physp,
+								&p_qos_match_rule->
+								source_group_list)
+			    && !__qos_policy_is_port_in_group_list(p_qos_policy,
+								   p_dest_physp,
+								   &p_qos_match_rule->
+								   destination_group_list))
+			{
+				list_iterator = cl_list_next(list_iterator);
+				continue;
+			}
+			matched_by_sordguid = TRUE;
+		}
+
 		/* If a match rule has QoS classes, PR request HAS
 		   to have a matching QoS class to match the rule */
 
@@ -715,11 +722,12 @@ static osm_qos_match_rule_t *__qos_policy_get_match_rule_by_params(
 
 	if (p_qos_match_rule)
 		OSM_LOG(p_log, OSM_LOG_DEBUG,
-			"request matched rule (%s) by:%s%s%s%s%s\n",
+			"request matched rule (%s) by:%s%s%s%s%s%s\n",
 			(p_qos_match_rule->use) ?
 				p_qos_match_rule->use : "no description",
 			(matched_by_sguid) ? " SGUID" : "",
 			(matched_by_dguid) ? " DGUID" : "",
+			(matched_by_sordguid) ? "SorDGUID" : "",
 			(matched_by_class) ? " QoS_Class" : "",
 			(matched_by_sid)   ? " ServiceID" : "",
 			(matched_by_pkey)  ? " PKey" : "");
@@ -792,10 +800,7 @@ static void __qos_policy_validate_pkey(
 			osm_qos_match_rule_t * p_qos_match_rule,
 			osm_prtn_t * p_prtn)
 {
-	uint8_t sl;
-	uint32_t flow;
-	uint8_t hop;
-	osm_mgrp_t * p_mgrp;
+	int i = 0;
 
 	if (!p_qos_policy || !p_qos_match_rule || !p_prtn)
 		return;
@@ -813,34 +818,30 @@ static void __qos_policy_validate_pkey(
 	p_prtn->sl = p_qos_match_rule->p_qos_level->sl;
 
 
-	/* If this partition is an IPoIB partition, there should
-	   be a matching MCast group. Fix this group's SL too */
-
-	if (!p_prtn->mlid)
-		return;
-
-	p_mgrp = osm_get_mgrp_by_mlid(p_qos_policy->p_subn, p_prtn->mlid);
-	if (!p_mgrp) {
-		OSM_LOG(&p_qos_policy->p_subn->p_osm->log, OSM_LOG_ERROR,
-			"ERR AC16: MCast group for partition with "
-			"pkey 0x%04X not found\n",
-			cl_ntoh16(p_prtn->pkey));
-		return;
-	}
-
-	CL_ASSERT((cl_ntoh16(p_mgrp->mcmember_rec.pkey) & 0x7fff) ==
-		  (cl_ntoh16(p_prtn->pkey) & 0x7fff));
-
-	ib_member_get_sl_flow_hop(p_mgrp->mcmember_rec.sl_flow_hop,
-				  &sl, &flow, &hop);
-	if (sl != p_prtn->sl) {
-		OSM_LOG(&p_qos_policy->p_subn->p_osm->log, OSM_LOG_DEBUG,
-			"Updating MCGroup (MLID 0x%04x) SL to "
-			"match partition SL (%u)\n",
-			cl_hton16(p_mgrp->mcmember_rec.mlid),
-			p_prtn->sl);
-		p_mgrp->mcmember_rec.sl_flow_hop =
-			ib_member_set_sl_flow_hop(p_prtn->sl, flow, hop);
+	/* If this partition has default MCast groups.
+	 * Fix those group's SL too */
+	for (i = 0; i < p_prtn->nmgrps; i++)
+	{
+		uint8_t sl;
+		uint32_t flow;
+		uint8_t hop;
+
+		CL_ASSERT((cl_ntoh16(p_prtn->mgrps[i]->mcmember_rec.pkey) & 0x7fff) ==
+			  (cl_ntoh16(p_prtn->pkey) & 0x7fff));
+
+		ib_member_get_sl_flow_hop(p_prtn->mgrps[i]->mcmember_rec.sl_flow_hop,
+					  &sl, &flow, &hop);
+		if (sl != p_prtn->sl) {
+			char gid_str[INET6_ADDRSTRLEN];
+			OSM_LOG(&p_qos_policy->p_subn->p_osm->log, OSM_LOG_DEBUG,
+				"Updating MCGroup (MGID %s) SL to "
+				"match partition SL (%u)\n",
+				inet_ntop(AF_INET6, p_prtn->mgrps[i]->mcmember_rec.mgid.raw,
+					  gid_str, sizeof gid_str),
+				p_prtn->sl);
+			p_prtn->mgrps[i]->mcmember_rec.sl_flow_hop =
+				ib_member_set_sl_flow_hop(p_prtn->sl, flow, hop);
+		}
 	}
 }
 
diff --git a/opensm/osm_remote_sm.c b/opensm/osm_remote_sm.c
index 96bfd78..4ebbd3f 100644
--- a/opensm/osm_remote_sm.c
+++ b/opensm/osm_remote_sm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -45,35 +45,27 @@
 #endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_REMOTE_SM_C
 #include <opensm/osm_remote_sm.h>
 
-/**********************************************************************
- **********************************************************************/
-void osm_remote_sm_construct(IN osm_remote_sm_t * const p_sm)
+void osm_remote_sm_construct(IN osm_remote_sm_t * p_sm)
 {
 	memset(p_sm, 0, sizeof(*p_sm));
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_remote_sm_destroy(IN osm_remote_sm_t * const p_sm)
+void osm_remote_sm_destroy(IN osm_remote_sm_t * p_sm)
 {
 	memset(p_sm, 0, sizeof(*p_sm));
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_remote_sm_init(IN osm_remote_sm_t * const p_sm,
-		   IN const osm_port_t * const p_port,
-		   IN const ib_sm_info_t * const p_smi)
+void osm_remote_sm_init(IN osm_remote_sm_t * p_sm,
+			IN const ib_sm_info_t * p_smi)
 {
 	CL_ASSERT(p_sm);
-	CL_ASSERT(p_port);
 
 	osm_remote_sm_construct(p_sm);
 
-	p_sm->p_port = p_port;
 	p_sm->smi = *p_smi;
 	return;
 }
diff --git a/opensm/osm_req.c b/opensm/osm_req.c
index 0865ce5..1c3c172 100644
--- a/opensm/osm_req.c
+++ b/opensm/osm_req.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2005,2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -47,6 +48,8 @@
 #include <string.h>
 #include <iba/ib_types.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_REQ_C
 #include <opensm/osm_madw.h>
 #include <opensm/osm_attrib_req.h>
 #include <opensm/osm_log.h>
@@ -55,21 +58,108 @@
 #include <opensm/osm_vl15intf.h>
 #include <opensm/osm_msgdef.h>
 #include <opensm/osm_opensm.h>
+#include <opensm/osm_db_pack.h>
 
 /**********************************************************************
-  The plock MAY or MAY NOT be held before calling this function.
+  The plock must be held before calling this function.
+**********************************************************************/
+static ib_net64_t req_determine_mkey(IN osm_sm_t * sm,
+				     IN const osm_dr_path_t * p_path)
+{
+	osm_node_t *p_node;
+	osm_port_t *p_sm_port;
+	osm_physp_t *p_physp;
+	ib_net64_t dest_port_guid, m_key;
+	uint8_t hop;
+
+	OSM_LOG_ENTER(sm->p_log);
+
+	p_physp = NULL;
+
+	p_sm_port = osm_get_port_by_guid(sm->p_subn, sm->p_subn->sm_port_guid);
+
+	/* hop_count == 0: destination port guid is SM */
+	if (p_path->hop_count == 0) {
+		if (p_sm_port != NULL)
+			dest_port_guid = sm->p_subn->sm_port_guid;
+		else
+			dest_port_guid = sm->p_subn->opt.guid;
+		goto Remote_Guid;
+	}
+
+	if (p_sm_port)
+		p_physp = p_sm_port->p_physp;
+
+	/* hop_count == 1: outgoing physp is SM physp */
+	for (hop = 2; p_physp && hop <= p_path->hop_count; hop++) {
+		p_physp = p_physp->p_remote_physp;
+		if (!p_physp)
+			break;
+		p_node = p_physp->p_node;
+		p_physp = osm_node_get_physp_ptr(p_node, p_path->path[hop]);
+	}
+
+	/* At this point, p_physp points at the outgoing physp on the
+	   last hop, or NULL if we don't know it.
+	*/
+	if (!p_physp) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
+			"req_determine_mkey: ERR 1107: "
+			"Outgoing physp is null on non-hop_0!\n");
+		dest_port_guid = 0;
+		goto Remote_Guid;
+	}
+
+	if (p_physp->p_remote_physp) {
+		dest_port_guid = p_physp->p_remote_physp->port_guid;
+		goto Remote_Guid;
+	}
+
+	OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Target port guid unknown, "
+		"using persistent DB\n");
+	if (!osm_db_neighbor_get(sm->p_subn->p_neighbor,
+				 cl_ntoh64(p_physp->port_guid),
+				 p_physp->port_num,
+				 &dest_port_guid, NULL)) {
+		dest_port_guid = cl_hton64(dest_port_guid);
+	}
+
+Remote_Guid:
+	if (dest_port_guid) {
+		if (!osm_db_guid2mkey_get(sm->p_subn->p_g2m,
+					  cl_ntoh64(dest_port_guid), &m_key)) {
+			m_key = cl_hton64(m_key);
+			OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
+				"Found mkey for guid 0x%"
+				PRIx64 "\n", cl_ntoh64(dest_port_guid));
+		} else {
+			OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
+				"Target port mkey unknown, using default\n");
+			m_key = sm->p_subn->opt.m_key;
+		}
+	} else {
+		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
+			"Target port guid unknown, using default\n");
+		m_key = sm->p_subn->opt.m_key;
+	}
+
+	OSM_LOG_EXIT(sm->p_log);
+
+	return m_key;
+}
+
+/**********************************************************************
+  The plock must be held before calling this function.
 **********************************************************************/
-ib_api_status_t
-osm_req_get(IN osm_sm_t * sm,
-	    IN const osm_dr_path_t * const p_path,
-	    IN const uint16_t attr_id,
-	    IN const uint32_t attr_mod,
-	    IN const cl_disp_msgid_t err_msg,
-	    IN const osm_madw_context_t * const p_context)
+ib_api_status_t osm_req_get(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
+			    IN ib_net16_t attr_id, IN ib_net32_t attr_mod,
+			    IN cl_disp_msgid_t err_msg,
+			    IN const osm_madw_context_t * p_context)
 {
 	osm_madw_t *p_madw;
 	ib_api_status_t status = IB_SUCCESS;
 	ib_net64_t tid;
+	ib_net64_t m_key;
 
 	CL_ASSERT(sm);
 
@@ -84,9 +174,8 @@ osm_req_get(IN osm_sm_t * sm,
 
 	/* p_context may be NULL. */
 
-	p_madw = osm_mad_pool_get(sm->p_mad_pool,
-				  p_path->h_bind, MAD_BLOCK_SIZE, NULL);
-
+	p_madw = osm_mad_pool_get(sm->p_mad_pool, sm->mad_ctrl.h_bind,
+				  MAD_BLOCK_SIZE, NULL);
 	if (p_madw == NULL) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
 			"ERR 1101: Unable to acquire MAD\n");
@@ -94,21 +183,24 @@ osm_req_get(IN osm_sm_t * sm,
 		goto Exit;
 	}
 
-	tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id));
+	tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id)
+						 & (uint64_t)(0xFFFFFFFF));
+	if (tid == 0)
+		tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id)
+							 & (uint64_t)(0xFFFFFFFF));
+
+	m_key = req_determine_mkey(sm, p_path);
 
 	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-		"Getting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64 "\n",
+		"Getting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64
+		", MKey 0x%016" PRIx64 "\n",
 		ib_get_sm_attr_str(attr_id), cl_ntoh16(attr_id),
-		cl_ntoh32(attr_mod), cl_ntoh64(tid));
+		cl_ntoh32(attr_mod), cl_ntoh64(tid), cl_ntoh64(m_key));
 
-	ib_smp_init_new(osm_madw_get_smp_ptr(p_madw),
-			IB_MAD_METHOD_GET,
-			tid,
-			attr_id,
-			attr_mod,
-			p_path->hop_count,
-			sm->p_subn->opt.m_key,
-			p_path->path, IB_LID_PERMISSIVE, IB_LID_PERMISSIVE);
+	ib_smp_init_new(osm_madw_get_smp_ptr(p_madw), IB_MAD_METHOD_GET,
+			tid, attr_id, attr_mod, p_path->hop_count,
+			m_key, p_path->path,
+			IB_LID_PERMISSIVE, IB_LID_PERMISSIVE);
 
 	p_madw->mad_addr.dest_lid = IB_LID_PERMISSIVE;
 	p_madw->mad_addr.addr_type.smi.source_lid = IB_LID_PERMISSIVE;
@@ -128,25 +220,22 @@ osm_req_get(IN osm_sm_t * sm,
 
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
-	return (status);
+	return status;
 }
 
 /**********************************************************************
-  The plock MAY or MAY NOT be held before calling this function.
+  The plock must be held before calling this function.
 **********************************************************************/
-ib_api_status_t
-osm_req_set(IN osm_sm_t * sm,
-	    IN const osm_dr_path_t * const p_path,
-	    IN const uint8_t * const p_payload,
-	    IN const size_t payload_size,
-	    IN const uint16_t attr_id,
-	    IN const uint32_t attr_mod,
-	    IN const cl_disp_msgid_t err_msg,
-	    IN const osm_madw_context_t * const p_context)
+osm_madw_t *osm_prepare_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
+				IN const uint8_t * p_payload,
+				IN size_t payload_size,
+				IN ib_net16_t attr_id, IN ib_net32_t attr_mod,
+				IN cl_disp_msgid_t err_msg,
+				IN const osm_madw_context_t * p_context)
 {
-	osm_madw_t *p_madw;
-	ib_api_status_t status = IB_SUCCESS;
+	osm_madw_t *p_madw = NULL;
 	ib_net64_t tid;
+	ib_net64_t m_key;
 
 	CL_ASSERT(sm);
 
@@ -162,31 +251,32 @@ osm_req_set(IN osm_sm_t * sm,
 
 	/* p_context may be NULL. */
 
-	p_madw = osm_mad_pool_get(sm->p_mad_pool,
-				  p_path->h_bind, MAD_BLOCK_SIZE, NULL);
-
+	p_madw = osm_mad_pool_get(sm->p_mad_pool, sm->mad_ctrl.h_bind,
+				  MAD_BLOCK_SIZE, NULL);
 	if (p_madw == NULL) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
 			"ERR 1102: Unable to acquire MAD\n");
-		status = IB_INSUFFICIENT_RESOURCES;
 		goto Exit;
 	}
 
-	tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id));
+	tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id)
+						 & (uint64_t)(0xFFFFFFFF));
+	if (tid == 0)
+		tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id)
+							 & (uint64_t)(0xFFFFFFFF));
+
+	m_key = req_determine_mkey(sm, p_path);
 
 	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-		"Setting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64 "\n",
+		"Setting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64
+		", MKey 0x%016" PRIx64 "\n",
 		ib_get_sm_attr_str(attr_id), cl_ntoh16(attr_id),
-		cl_ntoh32(attr_mod), cl_ntoh64(tid));
+		cl_ntoh32(attr_mod), cl_ntoh64(tid), cl_ntoh64(m_key));
 
-	ib_smp_init_new(osm_madw_get_smp_ptr(p_madw),
-			IB_MAD_METHOD_SET,
-			tid,
-			attr_id,
-			attr_mod,
-			p_path->hop_count,
-			sm->p_subn->opt.m_key,
-			p_path->path, IB_LID_PERMISSIVE, IB_LID_PERMISSIVE);
+	ib_smp_init_new(osm_madw_get_smp_ptr(p_madw), IB_MAD_METHOD_SET,
+			tid, attr_id, attr_mod, p_path->hop_count,
+			m_key, p_path->path,
+			IB_LID_PERMISSIVE, IB_LID_PERMISSIVE);
 
 	p_madw->mad_addr.dest_lid = IB_LID_PERMISSIVE;
 	p_madw->mad_addr.addr_type.smi.source_lid = IB_LID_PERMISSIVE;
@@ -204,19 +294,48 @@ osm_req_set(IN osm_sm_t * sm,
 
 	memcpy(osm_madw_get_smp_ptr(p_madw)->data, p_payload, payload_size);
 
-	osm_vl15_post(sm->p_vl15, p_madw);
-
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
-	return (status);
+	return p_madw;
 }
 
-int osm_send_trap144(osm_sm_t *sm, ib_net16_t local)
+void osm_send_req_mad(IN osm_sm_t * sm, IN osm_madw_t *p_madw)
+{
+	CL_ASSERT(p_madw);
+	CL_ASSERT(sm);
+
+	osm_vl15_post(sm->p_vl15, p_madw);
+}
+
+/**********************************************************************
+  The plock MAY or MAY NOT be held before calling this function.
+**********************************************************************/
+ib_api_status_t osm_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
+                            IN const uint8_t * p_payload,
+                            IN size_t payload_size,
+                            IN ib_net16_t attr_id, IN ib_net32_t attr_mod,
+                            IN cl_disp_msgid_t err_msg,
+                            IN const osm_madw_context_t * p_context)
+{
+	osm_madw_t *p_madw;
+	ib_api_status_t status = IB_SUCCESS;
+
+	p_madw = osm_prepare_req_set(sm, p_path, p_payload, payload_size,attr_id,
+				     attr_mod, err_msg, p_context);
+	if (p_madw == NULL)
+		status = IB_INSUFFICIENT_RESOURCES;
+	else
+		osm_send_req_mad(sm, p_madw);
+
+	return status;
+}
+
+int osm_send_trap144(osm_sm_t * sm, ib_net16_t local)
 {
 	osm_madw_t *madw;
 	ib_smp_t *smp;
 	ib_mad_notice_attr_t *ntc;
-	osm_port_t *port;
+	osm_port_t *port, *smport;
 	ib_port_info_t *pi;
 
 	port = osm_get_port_by_guid(sm->p_subn, sm->p_subn->sm_port_guid);
@@ -234,6 +353,14 @@ int osm_send_trap144(osm_sm_t *sm, ib_net16_t local)
 	    pi->capability_mask&(IB_PORT_CAP_HAS_TRAP|IB_PORT_CAP_HAS_CAP_NTC))
 		return 0;
 
+	smport = osm_get_port_by_guid(sm->p_subn, sm->master_sm_guid);
+	if (!smport) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
+			"ERR 1106: cannot find master SM port by guid 0x%" PRIx64 "\n",
+			cl_ntoh64(sm->master_sm_guid));
+		return -1;
+	}
+
 	madw = osm_mad_pool_get(sm->p_mad_pool,
 				osm_sm_mad_ctrl_get_bind_handle(&sm->mad_ctrl),
 				MAD_BLOCK_SIZE, NULL);
@@ -243,8 +370,9 @@ int osm_send_trap144(osm_sm_t *sm, ib_net16_t local)
 		return -1;
 	}
 
-	madw->mad_addr.dest_lid = pi->master_sm_base_lid;
+	madw->mad_addr.dest_lid = smport->p_physp->port_info.base_lid;
 	madw->mad_addr.addr_type.smi.source_lid = pi->base_lid;
+	madw->resp_expected = TRUE;
 	madw->fail_msg = CL_DISP_MSGID_NONE;
 
 	smp = osm_madw_get_smp_ptr(madw);
@@ -254,25 +382,29 @@ int osm_send_trap144(osm_sm_t *sm, ib_net16_t local)
 	smp->mgmt_class = IB_MCLASS_SUBN_LID;
 	smp->class_ver = 1;
 	smp->method = IB_MAD_METHOD_TRAP;
-	smp->trans_id = cl_hton64((uint64_t)cl_atomic_inc(&sm->sm_trans_id));
+	smp->trans_id = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id)
+							   & (uint64_t)(0xFFFFFFFF));
+	if (smp->trans_id == 0)
+		smp->trans_id = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id)
+								   & (uint64_t)(0xFFFFFFFF));
+
 	smp->attr_id = IB_MAD_ATTR_NOTICE;
-	smp->m_key = sm->p_subn->opt.m_key;
 
-	ntc = (ib_mad_notice_attr_t *)smp->data;
+	ntc = (ib_mad_notice_attr_t *) smp->data;
 
 	ntc->generic_type = 0x80 | IB_NOTICE_TYPE_INFO;
-	ib_notice_set_prod_type_ho(ntc, IB_NODE_TYPE_CA);
+	ib_notice_set_prod_type_ho(ntc, osm_node_get_type(port->p_node));
 	ntc->g_or_v.generic.trap_num = cl_hton16(144);
 	ntc->issuer_lid = pi->base_lid;
 	ntc->data_details.ntc_144.lid = pi->base_lid;
 	ntc->data_details.ntc_144.local_changes = local ?
-		TRAP_144_MASK_OTHER_LOCAL_CHANGES : 0;
+	    TRAP_144_MASK_OTHER_LOCAL_CHANGES : 0;
 	ntc->data_details.ntc_144.new_cap_mask = pi->capability_mask;
 	ntc->data_details.ntc_144.change_flgs = local;
 
 	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
 		"Sending Trap 144, TID 0x%" PRIx64 " to SM lid %u\n",
-		cl_ntoh64(smp->trans_id), cl_ntoh16(pi->master_sm_base_lid));
+		cl_ntoh64(smp->trans_id), cl_ntoh16(madw->mad_addr.dest_lid));
 
 	osm_vl15_post(sm->p_vl15, madw);
 
diff --git a/opensm/osm_resp.c b/opensm/osm_resp.c
index 9cd44f5..59a73e0 100644
--- a/opensm/osm_resp.c
+++ b/opensm/osm_resp.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -47,6 +47,8 @@
 #include <string.h>
 #include <iba/ib_types.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_RESP_C
 #include <opensm/osm_madw.h>
 #include <opensm/osm_attrib_req.h>
 #include <opensm/osm_log.h>
@@ -56,14 +58,10 @@
 #include <opensm/osm_msgdef.h>
 #include <opensm/osm_opensm.h>
 
-/**********************************************************************
- **********************************************************************/
-static void
-osm_resp_make_resp_smp(IN osm_sm_t * sm,
-		       IN const ib_smp_t * const p_src_smp,
-		       IN const ib_net16_t status,
-		       IN const uint8_t * const p_payload,
-		       OUT ib_smp_t * const p_dest_smp)
+static void resp_make_resp_smp(IN osm_sm_t * sm, IN const ib_smp_t * p_src_smp,
+			       IN ib_net16_t status,
+			       IN const uint8_t * p_payload,
+			       OUT ib_smp_t * p_dest_smp)
 {
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -96,13 +94,10 @@ Exit:
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_resp_send(IN osm_sm_t * sm,
-	      IN const osm_madw_t * const p_req_madw,
-	      IN const ib_net16_t mad_status,
-	      IN const uint8_t * const p_payload)
+ib_api_status_t osm_resp_send(IN osm_sm_t * sm,
+			      IN const osm_madw_t * p_req_madw,
+			      IN ib_net16_t mad_status,
+			      IN const uint8_t * p_payload)
 {
 	const ib_smp_t *p_req_smp;
 	ib_smp_t *p_smp;
@@ -135,7 +130,7 @@ osm_resp_send(IN osm_sm_t * sm,
 	 */
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 	p_req_smp = osm_madw_get_smp_ptr(p_req_madw);
-	osm_resp_make_resp_smp(sm, p_req_smp, mad_status, p_payload, p_smp);
+	resp_make_resp_smp(sm, p_req_smp, mad_status, p_payload, p_smp);
 	p_madw->mad_addr.dest_lid =
 	    p_req_madw->mad_addr.addr_type.smi.source_lid;
 	p_madw->mad_addr.addr_type.smi.source_lid =
@@ -153,5 +148,5 @@ osm_resp_send(IN osm_sm_t * sm,
 
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
-	return (status);
+	return status;
 }
diff --git a/opensm/osm_router.c b/opensm/osm_router.c
index cb5a236..af5fff5 100644
--- a/opensm/osm_router.c
+++ b/opensm/osm_router.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -47,29 +47,27 @@
 #include <stdlib.h>
 #include <string.h>
 #include <iba/ib_types.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_ROUTER_C
 #include <opensm/osm_router.h>
 
-/**********************************************************************
- **********************************************************************/
-void osm_router_delete(IN OUT osm_router_t ** const pp_rtr)
+void osm_router_delete(IN OUT osm_router_t ** pp_rtr)
 {
 	free(*pp_rtr);
 	*pp_rtr = NULL;
 }
 
-/**********************************************************************
- **********************************************************************/
-osm_router_t *osm_router_new(IN osm_port_t * const p_port)
+osm_router_t *osm_router_new(IN osm_port_t * p_port)
 {
 	osm_router_t *p_rtr;
 
 	CL_ASSERT(p_port);
 
-	p_rtr = (osm_router_t *) malloc(sizeof(*p_rtr));
+	p_rtr = malloc(sizeof(*p_rtr));
 	if (p_rtr) {
 		memset(p_rtr, 0, sizeof(*p_rtr));
 		p_rtr->p_port = p_port;
 	}
 
-	return (p_rtr);
+	return p_rtr;
 }
diff --git a/opensm/osm_sa.c b/opensm/osm_sa.c
index 185557f..674b913 100644
--- a/opensm/osm_sa.c
+++ b/opensm/osm_sa.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
  *
@@ -55,6 +55,8 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <iba/ib_types.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_C
 #include <opensm/osm_sa.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
@@ -65,6 +67,7 @@
 #include <opensm/osm_multicast.h>
 #include <opensm/osm_inform.h>
 #include <opensm/osm_service.h>
+#include <opensm/osm_guid.h>
 #include <opensm/osm_helper.h>
 #include <vendor/osm_vendor_api.h>
 
@@ -90,9 +93,7 @@ extern void osm_sir_rcv_process(IN void *context, IN void *data);
 extern void osm_vlarb_rec_rcv_process(IN void *context, IN void *data);
 extern void osm_sr_rcv_lease_cb(IN void *context);
 
-/**********************************************************************
- **********************************************************************/
-void osm_sa_construct(IN osm_sa_t * const p_sa)
+void osm_sa_construct(IN osm_sa_t * p_sa)
 {
 	memset(p_sa, 0, sizeof(*p_sa));
 	p_sa->state = OSM_SA_STATE_INIT;
@@ -101,17 +102,14 @@ void osm_sa_construct(IN osm_sa_t * const p_sa)
 	cl_timer_construct(&p_sa->sr_timer);
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_sa_shutdown(IN osm_sa_t * const p_sa)
+void osm_sa_shutdown(IN osm_sa_t * p_sa)
 {
-	ib_api_status_t status;
 	OSM_LOG_ENTER(p_sa->p_log);
 
 	cl_timer_stop(&p_sa->sr_timer);
 
 	/* unbind from the mad service */
-	status = osm_sa_mad_ctrl_unbind(&p_sa->mad_ctrl);
+	osm_sa_mad_ctrl_unbind(&p_sa->mad_ctrl);
 
 	/* remove any registered dispatcher message */
 	cl_disp_unregister(p_sa->nr_disp_h);
@@ -138,9 +136,7 @@ void osm_sa_shutdown(IN osm_sa_t * const p_sa)
 	OSM_LOG_EXIT(p_sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_sa_destroy(IN osm_sa_t * const p_sa)
+void osm_sa_destroy(IN osm_sa_t * p_sa)
 {
 	OSM_LOG_ENTER(p_sa->p_log);
 
@@ -151,19 +147,13 @@ void osm_sa_destroy(IN osm_sa_t * const p_sa)
 	OSM_LOG_EXIT(p_sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_sa_init(IN osm_sm_t * const p_sm,
-	    IN osm_sa_t * const p_sa,
-	    IN osm_subn_t * const p_subn,
-	    IN osm_vendor_t * const p_vendor,
-	    IN osm_mad_pool_t * const p_mad_pool,
-	    IN osm_log_t * const p_log,
-	    IN osm_stats_t * const p_stats,
-	    IN cl_dispatcher_t * const p_disp, IN cl_plock_t * const p_lock)
+ib_api_status_t osm_sa_init(IN osm_sm_t * p_sm, IN osm_sa_t * p_sa,
+			    IN osm_subn_t * p_subn, IN osm_vendor_t * p_vendor,
+			    IN osm_mad_pool_t * p_mad_pool,
+			    IN osm_log_t * p_log, IN osm_stats_t * p_stats,
+			    IN cl_dispatcher_t * p_disp, IN cl_plock_t * p_lock)
 {
-	ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status;
 
 	OSM_LOG_ENTER(p_log);
 
@@ -177,11 +167,9 @@ osm_sa_init(IN osm_sm_t * const p_sm,
 
 	p_sa->state = OSM_SA_STATE_READY;
 
-	status = osm_sa_mad_ctrl_init(&p_sa->mad_ctrl,
-				      p_sa,
-				      p_sa->p_mad_pool,
-				      p_sa->p_vendor,
-				      p_subn, p_log, p_stats, p_disp);
+	status = osm_sa_mad_ctrl_init(&p_sa->mad_ctrl, p_sa, p_sa->p_mad_pool,
+				      p_sa->p_vendor, p_subn, p_log, p_stats,
+				      p_disp);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
@@ -189,6 +177,7 @@ osm_sa_init(IN osm_sm_t * const p_sm,
 	if (status != IB_SUCCESS)
 		goto Exit;
 
+	status = IB_INSUFFICIENT_RESOURCES;
 	p_sa->cpi_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_CLASS_PORT_INFO,
 					    osm_cpi_rcv_process, p_sa);
 	if (p_sa->cpi_disp_h == CL_DISP_INVALID_HANDLE)
@@ -287,15 +276,13 @@ osm_sa_init(IN osm_sm_t * const p_sm,
 	if (p_sa->mft_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
+	status = IB_SUCCESS;
 Exit:
 	OSM_LOG_EXIT(p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_sa_bind(IN osm_sa_t * const p_sa, IN const ib_net64_t port_guid)
+ib_api_status_t osm_sa_bind(IN osm_sa_t * p_sa, IN ib_net64_t port_guid)
 {
 	ib_api_status_t status;
 
@@ -312,12 +299,11 @@ osm_sa_bind(IN osm_sa_t * const p_sa, IN const ib_net64_t port_guid)
 
 Exit:
 	OSM_LOG_EXIT(p_sa->p_log);
-	return (status);
+	return status;
 }
 
-ib_api_status_t osm_sa_send(osm_sa_t *sa,
-			    IN osm_madw_t * const p_madw,
-			    IN boolean_t const resp_expected)
+ib_api_status_t osm_sa_send(osm_sa_t *sa, IN osm_madw_t * p_madw,
+			    IN boolean_t resp_expected)
 {
 	ib_api_status_t status;
 
@@ -332,10 +318,8 @@ ib_api_status_t osm_sa_send(osm_sa_t *sa,
 	return status;
 }
 
-void
-osm_sa_send_error(IN osm_sa_t * sa,
-		  IN const osm_madw_t * const p_madw,
-		  IN const ib_net16_t sa_status)
+void osm_sa_send_error(IN osm_sa_t * sa, IN const osm_madw_t * p_madw,
+		       IN ib_net16_t sa_status)
 {
 	osm_madw_t *p_resp_madw;
 	ib_sa_mad_t *p_resp_sa_mad;
@@ -386,8 +370,8 @@ osm_sa_send_error(IN osm_sa_t * sa,
 	if (p_resp_sa_mad->attr_id == IB_MAD_ATTR_MULTIPATH_RECORD)
 		p_resp_sa_mad->attr_id = IB_MAD_ATTR_PATH_RECORD;
 
-	if (osm_log_is_active(sa->p_log, OSM_LOG_FRAMES))
-		osm_dump_sa_mad(sa->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_FRAMES))
+		osm_dump_sa_mad_v2(sa->p_log, p_resp_sa_mad, FILE_ID, OSM_LOG_FRAMES);
 
 	osm_sa_send(sa, p_resp_madw, FALSE);
 
@@ -409,7 +393,7 @@ void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size,
 #ifndef VENDOR_RMPP_SUPPORT
 	unsigned trim_num_rec;
 #endif
-	void *p;
+	unsigned char *p;
 
 	sa_mad = osm_madw_get_sa_mad_ptr(madw);
 	num_rec = cl_qlist_count(list);
@@ -420,8 +404,9 @@ void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size,
 	 */
 	if (sa_mad->method == IB_MAD_METHOD_GET && num_rec > 1) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4C05: "
-			"Got more than one record for SubnAdmGet (%u)\n",
-			num_rec);
+			"Got %u records for SubnAdmGet(%s) comp_mask 0x%016" PRIx64 "\n",
+			num_rec, ib_get_sa_attr_str(sa_mad->attr_id),
+			cl_ntoh64(sa_mad->comp_mask));
 		osm_sa_send_error(sa, madw, IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 		goto Exit;
 	}
@@ -498,9 +483,9 @@ void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size,
 		free(item);
 	}
 
+	osm_dump_sa_mad_v2(sa->p_log, resp_sa_mad, FILE_ID, OSM_LOG_FRAMES);
 	osm_sa_send(sa, resp_madw, FALSE);
 
-	osm_dump_sa_mad(sa->p_log, resp_sa_mad, OSM_LOG_FRAMES);
 Exit:
 	/* need to set the mem free ... */
 	item = cl_qlist_remove_head(list);
@@ -510,8 +495,6 @@ Exit:
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
 /*
  *  SA DB Dumper
  *
@@ -551,14 +534,14 @@ opensm_dump_to_file(osm_opensm_t * p_osm, const char *file_name,
 static void mcast_mgr_dump_one_port(cl_map_item_t * p_map_item, void *cxt)
 {
 	FILE *file = ((struct opensm_dump_context *)cxt)->file;
-	osm_mcm_port_t *p_mcm_port = (osm_mcm_port_t *) p_map_item;
+	osm_mcm_alias_guid_t *p_mcm_alias_guid = (osm_mcm_alias_guid_t *) p_map_item;
 
 	fprintf(file, "mcm_port: "
 		"port_gid=0x%016" PRIx64 ":0x%016" PRIx64 " "
 		"scope_state=0x%02x proxy_join=0x%x" "\n\n",
-		cl_ntoh64(p_mcm_port->port_gid.unicast.prefix),
-		cl_ntoh64(p_mcm_port->port_gid.unicast.interface_id),
-		p_mcm_port->scope_state, p_mcm_port->proxy_join);
+		cl_ntoh64(p_mcm_alias_guid->port_gid.unicast.prefix),
+		cl_ntoh64(p_mcm_alias_guid->port_gid.unicast.interface_id),
+		p_mcm_alias_guid->scope_state, p_mcm_alias_guid->proxy_join);
 }
 
 static void sa_dump_one_mgrp(osm_mgrp_t *p_mgrp, void *cxt)
@@ -593,7 +576,7 @@ static void sa_dump_one_mgrp(osm_mgrp_t *p_mgrp, void *cxt)
 	dump_context.p_osm = p_osm;
 	dump_context.file = file;
 
-	cl_qmap_apply_func(&p_mgrp->mcm_port_tbl,
+	cl_qmap_apply_func(&p_mgrp->mcm_alias_port_tbl,
 			   mcast_mgr_dump_one_port, &dump_context);
 }
 
@@ -699,26 +682,60 @@ static void sa_dump_one_service(cl_list_item_t * p_list_item, void *cxt)
 		p_svcr->modified_time, p_svcr->lease_period);
 }
 
+static void sa_dump_one_port_guidinfo(cl_map_item_t * p_map_item, void *cxt)
+{
+	FILE *file = ((struct opensm_dump_context *)cxt)->file;
+	osm_port_t *p_port = (osm_port_t *) p_map_item;
+	uint32_t max_block;
+	int block_num;
+
+	if (!p_port->p_physp->p_guids)
+		return;
+
+	max_block = (p_port->p_physp->port_info.guid_cap + GUID_TABLE_MAX_ENTRIES - 1) /
+		     GUID_TABLE_MAX_ENTRIES;
+
+	for (block_num = 0; block_num < max_block; block_num++) {
+		fprintf(file, "GUIDInfo Record:"
+			" base_guid=0x%016" PRIx64 " lid=0x%04x block_num=0x%x"
+			" guid0=0x%016" PRIx64 " guid1=0x%016" PRIx64
+			" guid2=0x%016" PRIx64 " guid3=0x%016" PRIx64
+			" guid4=0x%016" PRIx64 " guid5=0x%016" PRIx64
+			" guid6=0x%016" PRIx64 " guid7=0x%016" PRIx64
+			"\n\n",
+			cl_ntoh64((*p_port->p_physp->p_guids)[0]),
+			cl_ntoh16(osm_port_get_base_lid(p_port)), block_num,
+			cl_ntoh64((*p_port->p_physp->p_guids)[block_num * GUID_TABLE_MAX_ENTRIES]),
+			cl_ntoh64((*p_port->p_physp->p_guids)[block_num * GUID_TABLE_MAX_ENTRIES + 1]),
+			cl_ntoh64((*p_port->p_physp->p_guids)[block_num * GUID_TABLE_MAX_ENTRIES + 2]),
+			cl_ntoh64((*p_port->p_physp->p_guids)[block_num * GUID_TABLE_MAX_ENTRIES + 3]),
+			cl_ntoh64((*p_port->p_physp->p_guids)[block_num * GUID_TABLE_MAX_ENTRIES + 4]),
+			cl_ntoh64((*p_port->p_physp->p_guids)[block_num * GUID_TABLE_MAX_ENTRIES + 5]),
+			cl_ntoh64((*p_port->p_physp->p_guids)[block_num * GUID_TABLE_MAX_ENTRIES + 6]),
+			cl_ntoh64((*p_port->p_physp->p_guids)[block_num * GUID_TABLE_MAX_ENTRIES + 7]));
+	}
+}
+
 static void sa_dump_all_sa(osm_opensm_t * p_osm, FILE * file)
 {
 	struct opensm_dump_context dump_context;
 	osm_mgrp_t *p_mgrp;
-	int i;
 
 	dump_context.p_osm = p_osm;
 	dump_context.file = file;
-	OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump multicast:\n");
+	OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump guidinfo\n");
 	cl_plock_acquire(&p_osm->lock);
-	for (i = 0; i <= p_osm->subn.max_mcast_lid_ho - IB_LID_MCAST_START_HO;
-	     i++) {
-		p_mgrp = p_osm->subn.mgroups[i];
-		if (p_mgrp)
-			sa_dump_one_mgrp(p_mgrp, &dump_context);
-	}
-	OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump inform:\n");
+	cl_qmap_apply_func(&p_osm->subn.port_guid_tbl,
+			   sa_dump_one_port_guidinfo, &dump_context);
+	OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump multicast\n");
+	for (p_mgrp = (osm_mgrp_t *) cl_fmap_head(&p_osm->subn.mgrp_mgid_tbl);
+	     p_mgrp != (osm_mgrp_t *) cl_fmap_end(&p_osm->subn.mgrp_mgid_tbl);
+	     p_mgrp = (osm_mgrp_t *) cl_fmap_next(&p_mgrp->map_item))
+		sa_dump_one_mgrp(p_mgrp, &dump_context);
+	OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump inform\n");
 	cl_qlist_apply_func(&p_osm->subn.sa_infr_list,
 			    sa_dump_one_inform, &dump_context);
-	OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump services:\n");
+	OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump services\n");
 	cl_qlist_apply_func(&p_osm->subn.sa_sr_list,
 			    sa_dump_one_service, &dump_context);
 	cl_plock_release(&p_osm->lock);
@@ -726,7 +743,13 @@ static void sa_dump_all_sa(osm_opensm_t * p_osm, FILE * file)
 
 int osm_sa_db_file_dump(osm_opensm_t * p_osm)
 {
-	return opensm_dump_to_file(p_osm, "opensm-sa.dump", sa_dump_all_sa);
+	int res = 1;
+	if (p_osm->sa.dirty) {
+		res = opensm_dump_to_file(
+			p_osm, "opensm-sa.dump", sa_dump_all_sa);
+		p_osm->sa.dirty = FALSE;
+	}
+	return res;
 }
 
 /*
@@ -741,10 +764,9 @@ static osm_mgrp_t *load_mcgroup(osm_opensm_t * p_osm, ib_net16_t mlid,
 
 	cl_plock_excl_acquire(&p_osm->lock);
 
-	p_mgrp = osm_get_mgrp_by_mlid(&p_osm->subn, mlid);
+	p_mgrp = osm_get_mgrp_by_mgid(&p_osm->subn, &p_mcm_rec->mgid);
 	if (p_mgrp) {
-		if (!memcmp(&p_mgrp->mcmember_rec.mgid, &p_mcm_rec->mgid,
-			    sizeof(ib_gid_t))) {
+		if (p_mgrp->mlid == mlid) {
 			OSM_LOG(&p_osm->log, OSM_LOG_DEBUG,
 				"mgrp %04x is already here.", cl_ntoh16(mlid));
 			goto _out;
@@ -758,10 +780,10 @@ static osm_mgrp_t *load_mcgroup(osm_opensm_t * p_osm, ib_net16_t mlid,
 
 	comp_mask = IB_MCR_COMPMASK_MTU | IB_MCR_COMPMASK_MTU_SEL
 	    | IB_MCR_COMPMASK_RATE | IB_MCR_COMPMASK_RATE_SEL;
-	if (osm_mcmr_rcv_find_or_create_new_mgrp(&p_osm->sa,
-						 comp_mask, p_mcm_rec,
-						 &p_mgrp) != IB_SUCCESS ||
-	    !p_mgrp || p_mgrp->mlid != mlid) {
+	if (!(p_mgrp = osm_mcmr_rcv_find_or_create_new_mgrp(&p_osm->sa,
+							    comp_mask,
+							    p_mcm_rec)) ||
+	    p_mgrp->mlid != mlid) {
 		OSM_LOG(&p_osm->log, OSM_LOG_ERROR,
 			"cannot create MC group with mlid 0x%04x and mgid "
 			"0x%016" PRIx64 ":0x%016" PRIx64 "\n", cl_ntoh16(mlid),
@@ -851,6 +873,83 @@ _out:
 	return ret;
 }
 
+static int load_guidinfo(osm_opensm_t * p_osm, ib_net64_t base_guid,
+			 ib_guidinfo_record_t *gir)
+{
+	osm_port_t *p_port;
+	uint32_t max_block;
+	int i, ret = 0;
+	osm_alias_guid_t *p_alias_guid, *p_alias_guid_check;
+
+	cl_plock_excl_acquire(&p_osm->lock);
+
+	p_port = osm_get_port_by_guid(&p_osm->subn, base_guid);
+	if (!p_port)
+		goto _out;
+
+	if (!p_port->p_physp->p_guids) {
+		max_block = (p_port->p_physp->port_info.guid_cap + GUID_TABLE_MAX_ENTRIES - 1) /
+			     GUID_TABLE_MAX_ENTRIES;
+		p_port->p_physp->p_guids = calloc(max_block * GUID_TABLE_MAX_ENTRIES,
+						  sizeof(ib_net64_t));
+		if (!p_port->p_physp->p_guids) {
+			OSM_LOG(&p_osm->log, OSM_LOG_ERROR,
+				"cannot allocate GUID table for port "
+				"GUID 0x%" PRIx64 "\n",
+				cl_ntoh64(p_port->p_physp->port_guid));
+			goto _out;
+		}
+	}
+
+	for (i = 0; i < GUID_TABLE_MAX_ENTRIES; i++) {
+		if (!gir->guid_info.guid[i])
+			continue;
+		/* skip block 0 index 0 */
+		if (gir->block_num == 0 && i == 0)
+			continue;
+		if (gir->block_num * GUID_TABLE_MAX_ENTRIES + i >
+		    p_port->p_physp->port_info.guid_cap)
+			break;
+
+		p_alias_guid = osm_alias_guid_new(gir->guid_info.guid[i],
+						  p_port);
+		if (!p_alias_guid) {
+			OSM_LOG(&p_osm->log, OSM_LOG_ERROR,
+				"Alias guid %d memory allocation failed"
+				" for port GUID 0x%" PRIx64 "\n",
+				gir->block_num * GUID_TABLE_MAX_ENTRIES + i,
+				cl_ntoh64(p_port->p_physp->port_guid));
+			goto _out;
+		}
+
+		p_alias_guid_check =
+			(osm_alias_guid_t *) cl_qmap_insert(&p_osm->subn.alias_port_guid_tbl,
+							    p_alias_guid->alias_guid,
+							    &p_alias_guid->map_item);
+		if (p_alias_guid_check != p_alias_guid) {
+			/* alias GUID is a duplicate */
+			OSM_LOG(&p_osm->log, OSM_LOG_ERROR,
+				"Duplicate alias port GUID 0x%" PRIx64
+				" index %d base port GUID 0x%" PRIx64 "\n",
+				cl_ntoh64(p_alias_guid->alias_guid),
+				gir->block_num * GUID_TABLE_MAX_ENTRIES + i,
+				cl_ntoh64(p_alias_guid->p_base_port->guid));
+			osm_alias_guid_delete(&p_alias_guid);
+			goto _out;
+		}
+	}
+
+	memcpy(&(*p_port->p_physp->p_guids)[gir->block_num * GUID_TABLE_MAX_ENTRIES],
+	       &gir->guid_info, sizeof(ib_guid_info_t));
+
+	osm_queue_guidinfo(&p_osm->sa, p_port, gir->block_num);
+
+_out:
+	cl_plock_release(&p_osm->lock);
+
+	return ret;
+}
+
 #define UNPACK_FUNC(name,x) \
 static int unpack_##name##x(char *p, uint##x##_t *val_ptr) \
 { \
@@ -924,6 +1023,12 @@ int osm_sa_db_file_load(osm_opensm_t * p_osm)
 	unsigned rereg_clients = 0;
 	unsigned lineno;
 
+	if (!p_osm->subn.first_time_master_sweep) {
+		OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,
+			"Not first sweep - skip SA DB restore\n");
+		return 0;
+	}
+
 	file_name = p_osm->subn.opt.sa_db_file;
 	if (!file_name) {
 		OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,
@@ -934,11 +1039,15 @@ int osm_sa_db_file_load(osm_opensm_t * p_osm)
 	file = fopen(file_name, "r");
 	if (!file) {
 		OSM_LOG(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS, "ERR 4C02: "
-			"cannot open sa db file \'%s\'. Skip restoring\n",
+			"Can't open sa db file \'%s\'. Skip restoring\n",
 			file_name);
 		return -1;
 	}
 
+	OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,
+		"Restoring SA DB from file \'%s\'\n",
+		file_name);
+
 	lineno = 0;
 
 	while (fgets(line, sizeof(line) - 1, file) != NULL) {
@@ -991,27 +1100,30 @@ int osm_sa_db_file_load(osm_opensm_t * p_osm)
 					      well_known);
 			if (!p_mgrp)
 				rereg_clients = 1;
+			if (cl_ntoh16(mlid) > p_osm->sm.mlids_init_max)
+				p_osm->sm.mlids_init_max = cl_ntoh16(mlid);
 		} else if (p_mgrp && !strncmp(p, "mcm_port", 8)) {
-			ib_gid_t port_gid;
+			ib_member_rec_t mcmr;
 			ib_net64_t guid;
-			uint8_t scope_state;
-			boolean_t proxy_join;
+			osm_port_t *port;
+			boolean_t proxy;
 
 			PARSE_AHEAD(p, net64, " port_gid=0x",
-				    &port_gid.unicast.prefix);
+				    &mcmr.port_gid.unicast.prefix);
 			PARSE_AHEAD(p, net64, ":0x",
-				    &port_gid.unicast.interface_id);
-			PARSE_AHEAD(p, net8, " scope_state=0x", &scope_state);
+				    &mcmr.port_gid.unicast.interface_id);
+			PARSE_AHEAD(p, net8, " scope_state=0x", &mcmr.scope_state);
 			PARSE_AHEAD(p, net8, " proxy_join=0x", &val);
-			proxy_join = val;
-
-			guid = port_gid.unicast.interface_id;
-			if (cl_qmap_get(&p_mgrp->mcm_port_tbl,
-					port_gid.unicast.interface_id) ==
-			    cl_qmap_end(&p_mgrp->mcm_port_tbl))
-				osm_mgrp_add_port(&p_osm->subn, &p_osm->log,
-						  p_mgrp, &port_gid,
-						  scope_state, proxy_join);
+			proxy = val;
+
+			guid = mcmr.port_gid.unicast.interface_id;
+			port = osm_get_port_by_alias_guid(&p_osm->subn, guid);
+			if (port &&
+			    cl_qmap_get(&p_mgrp->mcm_port_tbl, guid) ==
+			    cl_qmap_end(&p_mgrp->mcm_port_tbl) &&
+			    !osm_mgrp_add_port(&p_osm->subn, &p_osm->log,
+						p_mgrp, port, &mcmr, proxy))
+				rereg_clients = 1;
 		} else if (!strncmp(p, "Service Record:", 15)) {
 			ib_service_record_t s_rec;
 			uint32_t modified_time, lease_period;
@@ -1111,11 +1223,49 @@ int osm_sa_db_file_load(osm_opensm_t * p_osm)
 
 			if (load_infr(p_osm, &i_rec, &rep_addr))
 				rereg_clients = 1;
+		} else if (!strncmp(p, "GUIDInfo Record:", 16)) {
+			ib_guidinfo_record_t gi_rec;
+			ib_net64_t base_guid;
+
+			p_mgrp = NULL;
+			memset(&gi_rec, 0, sizeof(gi_rec));
+
+			PARSE_AHEAD(p, net64, " base_guid=0x", &base_guid);
+			PARSE_AHEAD(p, net16, " lid=0x", &gi_rec.lid);
+			PARSE_AHEAD(p, net8, " block_num=0x",
+				    &gi_rec.block_num);
+			PARSE_AHEAD(p, net64, " guid0=0x",
+				    &gi_rec.guid_info.guid[0]);
+			PARSE_AHEAD(p, net64, " guid1=0x",
+				    &gi_rec.guid_info.guid[1]);
+			PARSE_AHEAD(p, net64, " guid2=0x",
+				    &gi_rec.guid_info.guid[2]);
+			PARSE_AHEAD(p, net64, " guid3=0x",
+				    &gi_rec.guid_info.guid[3]);
+			PARSE_AHEAD(p, net64, " guid4=0x",
+				    &gi_rec.guid_info.guid[4]);
+			PARSE_AHEAD(p, net64, " guid5=0x",
+				    &gi_rec.guid_info.guid[5]);
+			PARSE_AHEAD(p, net64, " guid6=0x",
+				    &gi_rec.guid_info.guid[6]);
+			PARSE_AHEAD(p, net64, " guid7=0x",
+				    &gi_rec.guid_info.guid[7]);
+
+			if (load_guidinfo(p_osm, base_guid, &gi_rec))
+				rereg_clients = 1;
 		}
 	}
 
-	if (!rereg_clients)
-		p_osm->subn.opt.no_clients_rereg = TRUE;
+	/*
+	 * If loading succeeded, do whatever 'no_clients_rereg' says.
+	 * If loading failed at some point, turn off the 'no_clients_rereg'
+	 * option (turn on re-registration requests).
+	 */
+	if (rereg_clients)
+		p_osm->subn.opt.no_clients_rereg = FALSE;
+
+	/* We've just finished loading SA DB file - clear the "dirty" flag */
+	p_osm->sa.dirty = FALSE;
 
 _error:
 	fclose(file);
diff --git a/opensm/osm_sa_class_port_info.c b/opensm/osm_sa_class_port_info.c
index a3a2782..2682505 100644
--- a/opensm/osm_sa_class_port_info.c
+++ b/opensm/osm_sa_class_port_info.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -50,6 +50,8 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_CLASS_PORT_INFO_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_sa.h>
@@ -57,7 +59,7 @@
 #define MAX_MSECS_TO_RTV 24
 /* Precalculated table in msec (index is related to encoded value) */
 /* 4.096 usec * 2 ** n (where n = 8 - 31) */
-const static uint32_t __msecs_to_rtv_table[MAX_MSECS_TO_RTV] = {
+const static uint32_t msecs_to_rtv_table[MAX_MSECS_TO_RTV] = {
 	1, 2, 4, 8,
 	16, 33, 67, 134,
 	268, 536, 1073, 2147,
@@ -66,17 +68,14 @@ const static uint32_t __msecs_to_rtv_table[MAX_MSECS_TO_RTV] = {
 	1099511, 2199023, 4398046, 8796093
 };
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_cpi_rcv_respond(IN osm_sa_t * sa,
-		      IN const osm_madw_t * const p_madw)
+static void cpi_rcv_respond(IN osm_sa_t * sa, IN const osm_madw_t * p_madw)
 {
 	osm_madw_t *p_resp_madw;
 	const ib_sa_mad_t *p_sa_mad;
 	ib_sa_mad_t *p_resp_sa_mad;
 	ib_class_port_info_t *p_resp_cpi;
 	ib_gid_t zero_gid;
+	uint32_t cap_mask2;
 	uint8_t rtv;
 
 	OSM_LOG_ENTER(sa->p_log);
@@ -111,12 +110,12 @@ __osm_cpi_rcv_respond(IN osm_sa_t * sa,
 	/* Calculate encoded response time value */
 	/* transaction timeout is in msec */
 	if (sa->p_subn->opt.transaction_timeout >
-	    __msecs_to_rtv_table[MAX_MSECS_TO_RTV - 1])
+	    msecs_to_rtv_table[MAX_MSECS_TO_RTV - 1])
 		rtv = MAX_MSECS_TO_RTV - 1;
 	else {
 		for (rtv = 0; rtv < MAX_MSECS_TO_RTV; rtv++) {
 			if (sa->p_subn->opt.transaction_timeout <=
-			    __msecs_to_rtv_table[rtv])
+			    msecs_to_rtv_table[rtv])
 				break;
 		}
 	}
@@ -160,15 +159,23 @@ __osm_cpi_rcv_respond(IN osm_sa_t * sa,
 	p_resp_cpi->cap_mask = OSM_CAP_IS_SUBN_GET_SET_NOTICE_SUP |
 	    OSM_CAP_IS_PORT_INFO_CAPMASK_MATCH_SUPPORTED;
 #endif
+	cap_mask2 = OSM_CAP2_IS_FULL_PORTINFO_REC_SUPPORTED |
+		    OSM_CAP2_IS_EXTENDED_SPEEDS_SUPPORTED |
+		    OSM_CAP2_IS_ALIAS_GUIDS_SUPPORTED |
+		    OSM_CAP2_IS_MULTICAST_SERVICE_RECS_SUPPORTED |
+		    OSM_CAP2_IS_PORT_INFO_CAPMASK2_MATCH_SUPPORTED;
+	if (sa->p_subn->opt.use_mfttop)
+		cap_mask2 |= OSM_CAP2_IS_MCAST_TOP_SUPPORTED;
 	if (sa->p_subn->opt.qos)
-		ib_class_set_cap_mask2(p_resp_cpi, OSM_CAP2_IS_QOS_SUPPORTED);
+		cap_mask2 |= OSM_CAP2_IS_QOS_SUPPORTED;
+	ib_class_set_cap_mask2(p_resp_cpi, cap_mask2);
 
 	if (!sa->p_subn->opt.disable_multicast)
 		p_resp_cpi->cap_mask |= OSM_CAP_IS_UD_MCAST_SUP;
 	p_resp_cpi->cap_mask = cl_hton16(p_resp_cpi->cap_mask);
 
-	if (osm_log_is_active(sa->p_log, OSM_LOG_FRAMES))
-		osm_dump_sa_mad(sa->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_FRAMES))
+		osm_dump_sa_mad_v2(sa->p_log, p_resp_sa_mad, FILE_ID, OSM_LOG_FRAMES);
 
 	osm_sa_send(sa, p_resp_madw, FALSE);
 
@@ -202,11 +209,9 @@ void osm_cpi_rcv_process(IN void *context, IN void *data)
 
 	CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_CLASS_PORT_INFO);
 
-	/*
-	   CLASS PORT INFO does not really look on the SMDB - no lock required.
-	 */
+	/* CLASS PORT INFO does not really look at the SMDB - no lock required. */
 
-	__osm_cpi_rcv_respond(sa, p_madw);
+	cpi_rcv_respond(sa, p_madw);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
diff --git a/opensm/osm_sa_guidinfo_record.c b/opensm/osm_sa_guidinfo_record.c
index 39dae72..92f3b1a 100644
--- a/opensm/osm_sa_guidinfo_record.c
+++ b/opensm/osm_sa_guidinfo_record.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -50,13 +50,18 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_GUIDINFO_RECORD_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
+#include <opensm/osm_guid.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
 
+#define MOD_GIR_COMP_MASK (IB_GIR_COMPMASK_LID | IB_GIR_COMPMASK_BLOCKNUM)
+
 typedef struct osm_gir_item {
 	cl_list_item_t list_item;
 	ib_guidinfo_record_t rec;
@@ -70,16 +75,13 @@ typedef struct osm_gir_search_ctxt {
 	const osm_physp_t *p_req_physp;
 } osm_gir_search_ctxt_t;
 
-/**********************************************************************
- **********************************************************************/
-static ib_api_status_t
-__osm_gir_rcv_new_gir(IN osm_sa_t * sa,
-		      IN const osm_node_t * const p_node,
-		      IN cl_qlist_t * const p_list,
-		      IN ib_net64_t const match_port_guid,
-		      IN ib_net16_t const match_lid,
-		      IN const osm_physp_t * const p_req_physp,
-		      IN uint8_t const block_num)
+static ib_api_status_t gir_rcv_new_gir(IN osm_sa_t * sa,
+				       IN const osm_node_t * p_node,
+				       IN cl_qlist_t * p_list,
+				       IN ib_net64_t const match_port_guid,
+				       IN ib_net16_t const match_lid,
+				       IN const osm_physp_t * p_physp,
+				       IN uint8_t const block_num)
 {
 	osm_gir_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
@@ -102,27 +104,26 @@ __osm_gir_rcv_new_gir(IN osm_sa_t * sa,
 
 	p_rec_item->rec.lid = match_lid;
 	p_rec_item->rec.block_num = block_num;
-	if (!block_num)
-		p_rec_item->rec.guid_info.guid[0] =
-		    osm_physp_get_port_guid(p_req_physp);
+	if (p_physp->p_guids)
+		memcpy(&p_rec_item->rec.guid_info,
+		       *p_physp->p_guids + block_num * GUID_TABLE_MAX_ENTRIES,
+		       sizeof(ib_guid_info_t));
+	else if (!block_num)
+		p_rec_item->rec.guid_info.guid[0] = osm_physp_get_port_guid(p_physp);
 
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_gir_create_gir(IN osm_sa_t * sa,
-			IN osm_node_t * const p_node,
-			IN cl_qlist_t * const p_list,
-			IN ib_net64_t const match_port_guid,
-			IN ib_net16_t const match_lid,
-			IN const osm_physp_t * const p_req_physp,
-			IN uint8_t const match_block_num)
+static void sa_gir_create_gir(IN osm_sa_t * sa, IN osm_node_t * p_node,
+			      IN cl_qlist_t * p_list,
+			      IN ib_net64_t const match_port_guid,
+			      IN ib_net16_t const match_lid,
+			      IN const osm_physp_t * p_req_physp,
+			      IN uint8_t const match_block_num)
 {
 	const osm_physp_t *p_physp;
 	uint8_t port_num;
@@ -156,7 +157,8 @@ __osm_sa_gir_create_gir(IN osm_sa_t * sa,
 
 		/* Check to see if the found p_physp and the requester physp
 		   share a pkey. If not, continue */
-		if (!osm_physp_share_pkey(sa->p_log, p_physp, p_req_physp))
+		if (!osm_physp_share_pkey(sa->p_log, p_physp, p_req_physp,
+					  sa->p_subn->opt.allow_both_pkeys))
 			continue;
 
 		port_guid = osm_physp_get_port_guid(p_physp);
@@ -206,23 +208,17 @@ __osm_sa_gir_create_gir(IN osm_sa_t * sa,
 
 		for (block_num = start_block_num; block_num <= end_block_num;
 		     block_num++)
-			__osm_gir_rcv_new_gir(sa, p_node, p_list, port_guid,
-					      cl_ntoh16(base_lid_ho), p_physp,
-					      block_num);
-
+			gir_rcv_new_gir(sa, p_node, p_list, port_guid,
+					cl_ntoh16(base_lid_ho), p_physp,
+					block_num);
 	}
 
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_gir_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
-			     IN void *context)
+static void sa_gir_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt)
 {
-	const osm_gir_search_ctxt_t *const p_ctxt =
-	    (osm_gir_search_ctxt_t *) context;
+	const osm_gir_search_ctxt_t *p_ctxt = cxt;
 	osm_node_t *const p_node = (osm_node_t *) p_map_item;
 	const ib_guidinfo_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;
@@ -285,60 +281,432 @@ __osm_sa_gir_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 			goto Exit;
 	}
 
-	__osm_sa_gir_create_gir(sa, p_node, p_ctxt->p_list,
-				match_port_guid, match_lid, p_req_physp,
-				match_block_num);
+	sa_gir_create_gir(sa, p_node, p_ctxt->p_list, match_port_guid,
+			  match_lid, p_req_physp, match_block_num);
 
 Exit:
 	OSM_LOG_EXIT(p_ctxt->sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_gir_rcv_process(IN void *ctx, IN void *data)
+static inline boolean_t check_mod_comp_mask(ib_net64_t comp_mask)
 {
-	osm_sa_t *sa = ctx;
-	osm_madw_t *p_madw = data;
-	const ib_sa_mad_t *p_rcvd_mad;
-	const ib_guidinfo_record_t *p_rcvd_rec;
-	cl_qlist_t rec_list;
-	osm_gir_search_ctxt_t context;
-	osm_physp_t *p_req_physp;
+	return ((comp_mask & MOD_GIR_COMP_MASK) == MOD_GIR_COMP_MASK);
+}
 
-	CL_ASSERT(sa);
+static uint8_t coalesce_comp_mask(IN osm_madw_t *p_madw)
+{
+	uint8_t comp_mask = 0;
+	ib_sa_mad_t *p_sa_mad;
+
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	if (p_sa_mad->comp_mask & IB_GIR_COMPMASK_GID0)
+		comp_mask |= 1<<0;
+	if (p_sa_mad->comp_mask & IB_GIR_COMPMASK_GID1)
+		comp_mask |= 1<<1;
+	if (p_sa_mad->comp_mask & IB_GIR_COMPMASK_GID2)
+		comp_mask |= 1<<2;
+	if (p_sa_mad->comp_mask & IB_GIR_COMPMASK_GID3)
+		comp_mask |= 1<<3;
+	if (p_sa_mad->comp_mask & IB_GIR_COMPMASK_GID4)
+		comp_mask |= 1<<4;
+	if (p_sa_mad->comp_mask & IB_GIR_COMPMASK_GID5)
+		comp_mask |= 1<<5;
+	if (p_sa_mad->comp_mask & IB_GIR_COMPMASK_GID6)
+		comp_mask |= 1<<6;
+	if (p_sa_mad->comp_mask & IB_GIR_COMPMASK_GID7)
+		comp_mask |= 1<<7;
+	return comp_mask;
+}
+
+static void guidinfo_respond(IN osm_sa_t *sa, IN osm_madw_t *p_madw,
+			     IN ib_guidinfo_record_t * p_guidinfo_rec)
+{
+	cl_qlist_t rec_list;
+	osm_gir_item_t *item;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	CL_ASSERT(p_madw);
+	item = malloc(sizeof(*item));
+	if (!item) {
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5101: "
+			"rec_item alloc failed\n");
+		goto Exit;
+	}
 
-	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
-	p_rcvd_rec =
-	    (ib_guidinfo_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+	item->rec = *p_guidinfo_rec;
 
-	CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_GUIDINFO_RECORD);
+	cl_qlist_init(&rec_list);
+	cl_qlist_insert_tail(&rec_list, &item->list_item);
 
-	/* we only support SubnAdmGet and SubnAdmGetTable methods */
-	if (p_rcvd_mad->method != IB_MAD_METHOD_GET &&
-	    p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) {
-		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5105: "
-			"Unsupported Method (%s)\n",
-			ib_get_sa_method_str(p_rcvd_mad->method));
-		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
-		goto Exit;
+	osm_sa_respond(sa, p_madw, sizeof(ib_guidinfo_record_t), &rec_list);
+
+Exit:
+	OSM_LOG_EXIT(sa->p_log);
+}
+
+static void gir_respond(IN osm_sa_t *sa, IN osm_madw_t *p_madw)
+{
+	ib_sa_mad_t *p_sa_mad;
+	ib_guidinfo_record_t *p_rcvd_rec;
+	ib_guidinfo_record_t guidinfo_rec;
+
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_rcvd_rec = (ib_guidinfo_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_guidinfo_record_v2(sa->p_log, p_rcvd_rec, FILE_ID, OSM_LOG_DEBUG);
+
+	guidinfo_rec = *p_rcvd_rec;
+	guidinfo_respond(sa, p_madw, &guidinfo_rec);
+}
+
+static ib_net64_t sm_assigned_guid(uint8_t assigned_byte)
+{
+	static uint32_t uniq_count;
+
+	if (++uniq_count == 0) {
+		uniq_count--;
+		return 0;
 	}
+	return cl_hton64(((uint64_t) uniq_count) |
+			 (((uint64_t) assigned_byte) << 32) |
+			 (((uint64_t) OSM_VENDOR_ID_OPENIB) << 40));
+}
 
-	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
-						osm_madw_get_mad_addr_ptr
-						(p_madw));
-	if (p_req_physp == NULL) {
-		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5104: "
-			"Cannot find requester physical port\n");
+static void del_guidinfo(IN osm_sa_t *sa, IN osm_madw_t *p_madw,
+			 IN osm_port_t *p_port, IN uint8_t block_num)
+{
+	int i;
+	uint32_t max_block;
+	ib_sa_mad_t *p_sa_mad;
+	ib_guidinfo_record_t *p_rcvd_rec;
+	ib_net64_t del_alias_guid;
+	osm_alias_guid_t *p_alias_guid;
+	cl_list_item_t *p_list_item;
+	osm_mcm_port_t *p_mcm_port;
+	osm_mcm_alias_guid_t *p_mcm_alias_guid;
+	uint8_t del_mask;
+	int dirty = 0;
+
+	if (!p_port->p_physp->p_guids)
 		goto Exit;
+
+	max_block = (p_port->p_physp->port_info.guid_cap + GUID_TABLE_MAX_ENTRIES - 1) /
+		     GUID_TABLE_MAX_ENTRIES;
+
+	if (block_num > max_block) {
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5116: "
+			"block_num %d is higher than Max GUID Cap block %d "
+			"for port GUID 0x%" PRIx64 "\n",
+			block_num, max_block, cl_ntoh64(p_port->p_physp->port_guid));
+		osm_sa_send_error(sa, p_madw,
+				  IB_SA_MAD_STATUS_NO_RECORDS);
+		return;
+	}
+
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_rcvd_rec =
+		(ib_guidinfo_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
+
+	del_mask = coalesce_comp_mask(p_madw);
+
+	for (i = block_num * GUID_TABLE_MAX_ENTRIES;
+	     (block_num + 1) * GUID_TABLE_MAX_ENTRIES < p_port->p_physp->port_info.guid_cap ? i < (block_num + 1) * GUID_TABLE_MAX_ENTRIES : i < p_port->p_physp->port_info.guid_cap;
+	     i++) {
+		/* can't delete block 0 index 0 (base guid is RO) for alias guid table */
+		if (i == 0 && p_sa_mad->comp_mask & IB_GIR_COMPMASK_GID0) {
+			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+				"Not allowed to delete RO GID 0\n");
+			osm_sa_send_error(sa, p_madw,
+					  IB_SA_MAD_STATUS_REQ_INVALID);
+			return;
+		}
+		if (!(del_mask & 1<<(i % 8)))
+			continue;
+
+		del_alias_guid = (*p_port->p_physp->p_guids)[i];
+		if (del_alias_guid) {
+			/* Search all of port's multicast groups for alias */
+			p_list_item = cl_qlist_head(&p_port->mcm_list);
+			while (p_list_item != cl_qlist_end(&p_port->mcm_list)) {
+				p_mcm_port = cl_item_obj(p_list_item,
+							 p_mcm_port, list_item);
+				p_list_item = cl_qlist_next(p_list_item);
+				p_mcm_alias_guid = osm_mgrp_get_mcm_alias_guid(p_mcm_port->mgrp, del_alias_guid);
+				if (p_mcm_alias_guid) {
+					osm_sa_send_error(sa, p_madw,
+							  IB_SA_MAD_STATUS_DENIED);
+					return;
+				}
+			}
+		}
+	}
+
+	for (i = block_num * GUID_TABLE_MAX_ENTRIES;
+	     (block_num + 1) * GUID_TABLE_MAX_ENTRIES < p_port->p_physp->port_info.guid_cap ? i < (block_num + 1) * GUID_TABLE_MAX_ENTRIES : i < p_port->p_physp->port_info.guid_cap;
+	     i++) {
+		if (!(del_mask & 1<<(i % 8)))
+			continue;
+
+		del_alias_guid = (*p_port->p_physp->p_guids)[i];
+		if (del_alias_guid) {
+			/* remove original from alias guid table */
+			p_alias_guid = (osm_alias_guid_t *)
+				cl_qmap_remove(&sa->p_subn->alias_port_guid_tbl,
+					       del_alias_guid);
+			if (p_alias_guid != (osm_alias_guid_t *)
+						cl_qmap_end(&sa->p_subn->alias_port_guid_tbl))
+				osm_alias_guid_delete(&p_alias_guid);
+			else
+				OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 510B: "
+					"Original alias GUID 0x%" PRIx64
+					" at index %u not found\n",
+					cl_ntoh64(del_alias_guid), i);
+			/* clear guid at index */
+			(*p_port->p_physp->p_guids)[i] = 0;
+			dirty = 1;
+		}
+	}
+
+	if (dirty) {
+		if (osm_queue_guidinfo(sa, p_port, block_num))
+			osm_sm_signal(sa->sm, OSM_SIGNAL_GUID_PROCESS_REQUEST);
+		sa->dirty = TRUE;
+	}
+
+	memcpy(&p_rcvd_rec->guid_info,
+	       &((*p_port->p_physp->p_guids)[block_num * GUID_TABLE_MAX_ENTRIES]),
+	       sizeof(ib_guid_info_t));
+
+Exit:
+	gir_respond(sa, p_madw);
+}
+
+static void set_guidinfo(IN osm_sa_t *sa, IN osm_madw_t *p_madw,
+			 IN osm_port_t *p_port, IN uint8_t block_num)
+{
+	uint32_t max_block;
+	int i, j, dirty = 0;
+	ib_sa_mad_t *p_sa_mad;
+	ib_guidinfo_record_t *p_rcvd_rec;
+	osm_assigned_guids_t *p_assigned_guids = 0;
+	osm_alias_guid_t *p_alias_guid, *p_alias_guid_check;
+	cl_map_item_t *p_item;
+	ib_net64_t set_alias_guid, del_alias_guid, assigned_guid;
+	uint8_t set_mask;
+
+	max_block = (p_port->p_physp->port_info.guid_cap + GUID_TABLE_MAX_ENTRIES - 1) /
+		     GUID_TABLE_MAX_ENTRIES;
+	if (block_num > max_block) {
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5118: "
+			"block_num %d is higher than Max GUID Cap block %d "
+			"for port GUID 0x%" PRIx64 "\n",
+			block_num, max_block, cl_ntoh64(p_port->p_physp->port_guid));
+		osm_sa_send_error(sa, p_madw,
+				  IB_SA_MAD_STATUS_NO_RECORDS);
+		return;
+	}
+	if (!p_port->p_physp->p_guids) {
+		p_port->p_physp->p_guids = calloc(max_block * GUID_TABLE_MAX_ENTRIES,
+						  sizeof(ib_net64_t));
+		if (!p_port->p_physp->p_guids) {
+			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5103: "
+				"GUID table memory allocation failed for port "
+				"GUID 0x%" PRIx64 "\n",
+				cl_ntoh64(p_port->p_physp->port_guid));
+			osm_sa_send_error(sa, p_madw,
+					  IB_SA_MAD_STATUS_NO_RESOURCES);
+			return;
+		}
+		/* setup base port guid in index 0 */
+		(*p_port->p_physp->p_guids)[0] = p_port->p_physp->port_guid;
+	}
+
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_rcvd_rec = (ib_guidinfo_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
+
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Dump of incoming record\n");
+		osm_dump_guidinfo_record_v2(sa->p_log, p_rcvd_rec, FILE_ID, OSM_LOG_DEBUG);
 	}
 
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
-		osm_dump_guidinfo_record(sa->p_log, p_rcvd_rec, OSM_LOG_DEBUG);
+	set_mask = coalesce_comp_mask(p_madw);
+
+	for (i = block_num * GUID_TABLE_MAX_ENTRIES;
+	     (block_num + 1) * GUID_TABLE_MAX_ENTRIES < p_port->p_physp->port_info.guid_cap ? i < (block_num + 1) * GUID_TABLE_MAX_ENTRIES : i < p_port->p_physp->port_info.guid_cap;
+	     i++) {
+		/* can't set block 0 index 0 (base guid is RO) for alias guid table */
+		if (i == 0 && p_sa_mad->comp_mask & IB_GIR_COMPMASK_GID0) {
+			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+				"Not allowed to set RO GID 0\n");
+			osm_sa_send_error(sa, p_madw,
+					  IB_SA_MAD_STATUS_REQ_INVALID);
+			return;
+		}
+
+		if (!(set_mask & 1<<(i % 8)))
+			continue;
+
+		set_alias_guid = p_rcvd_rec->guid_info.guid[i % 8];
+		if (!set_alias_guid) {
+			/* was a GUID previously assigned for this index ? */
+			set_alias_guid = (*p_port->p_physp->p_guids)[i];
+			if (set_alias_guid) {
+				p_rcvd_rec->guid_info.guid[i % 8] = set_alias_guid;
+				continue;
+			}
+			/* Is there a persistent SA assigned guid for this index ? */
+			if (!p_assigned_guids)
+				p_assigned_guids =
+				    osm_get_assigned_guids_by_guid(sa->p_subn,
+								   p_port->p_physp->port_guid);
+			if (p_assigned_guids) {
+				set_alias_guid = p_assigned_guids->assigned_guid[i];
+				if (set_alias_guid) {
+					p_rcvd_rec->guid_info.guid[i % 8] = set_alias_guid;
+					p_item = cl_qmap_get(&sa->sm->p_subn->alias_port_guid_tbl,
+							     set_alias_guid);
+					if (p_item == cl_qmap_end(&sa->sm->p_subn->alias_port_guid_tbl))
+						goto add_alias_guid;
+					else {
+						p_alias_guid = (osm_alias_guid_t *) p_item;
+						if (p_alias_guid->p_base_port != p_port) {
+							OSM_LOG(sa->p_log,
+								OSM_LOG_ERROR,
+								"ERR 5110: "
+								" Assigned alias port GUID 0x%" PRIx64
+								" index %d base port GUID 0x%" PRIx64
+								" now attempted on port GUID 0x%" PRIx64
+								"\n",
+								cl_ntoh64(p_alias_guid->alias_guid), i,
+								cl_ntoh64(p_alias_guid->p_base_port->guid),
+								cl_ntoh64(p_port->guid));
+							/* clear response guid at index to indicate duplicate */
+							p_rcvd_rec->guid_info.guid[i % 8] = 0;
+						}
+						continue;
+					}
+				}
+			}
+		}
+		if (!set_alias_guid) {
+			for (j = 0; j < 1000; j++) {
+				assigned_guid = sm_assigned_guid(sa->p_subn->opt.sm_assigned_guid);
+				if (!assigned_guid) {
+					OSM_LOG(sa->p_log, OSM_LOG_ERROR,
+						"ERR 510E: No more assigned guids available\n");
+					osm_sa_send_error(sa, p_madw,
+							  IB_SA_MAD_STATUS_NO_RESOURCES);
+					return;
+				}
+				p_item = cl_qmap_get(&sa->sm->p_subn->alias_port_guid_tbl,
+						     assigned_guid);
+				if (p_item == cl_qmap_end(&sa->sm->p_subn->alias_port_guid_tbl)) {
+					set_alias_guid = assigned_guid;
+					p_rcvd_rec->guid_info.guid[i % 8] = assigned_guid;
+					if (!p_assigned_guids) {
+						p_assigned_guids = osm_assigned_guids_new(p_port->p_physp->port_guid,
+											  max_block * GUID_TABLE_MAX_ENTRIES);
+						if (p_assigned_guids) {
+							cl_qmap_insert(&(sa->p_subn->assigned_guids_tbl),
+								       p_assigned_guids->port_guid,
+								       &p_assigned_guids->map_item);
+						} else {
+							OSM_LOG(sa->p_log,
+								OSM_LOG_ERROR,
+								"ERR 510D: osm_assigned_guids_new failed port GUID 0x%" PRIx64 " index %d\n",
+								cl_ntoh64(p_port->p_physp->port_guid), i);
+							osm_sa_send_error(sa, p_madw,
+									  IB_SA_MAD_STATUS_NO_RESOURCES);
+							return;
+						}
+					}
+					if (p_assigned_guids)
+						p_assigned_guids->assigned_guid[i] = assigned_guid;
+					break;
+				}
+			}
+			if (!set_alias_guid) {
+				OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 510A: "
+					"SA assigned GUID %d failed for "
+					"port GUID 0x%" PRIx64 "\n", i,
+					cl_ntoh64(p_port->p_physp->port_guid));
+				continue;
+			}
+		}
+
+add_alias_guid:
+		/* allocate alias guid and add to alias guid table */
+		p_alias_guid = osm_alias_guid_new(set_alias_guid, p_port);
+		if (!p_alias_guid) {
+			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5107: "
+				"Alias guid %d memory allocation failed"
+				" for port GUID 0x%" PRIx64 "\n",
+				i, cl_ntoh64(p_port->p_physp->port_guid));
+			return;
+		}
+
+		p_alias_guid_check =
+			(osm_alias_guid_t *) cl_qmap_insert(&sa->sm->p_subn->alias_port_guid_tbl,
+							    p_alias_guid->alias_guid,
+							    &p_alias_guid->map_item);
+		if (p_alias_guid_check != p_alias_guid) {
+			/* alias GUID is a duplicate */
+			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5108: "
+				"Duplicate alias port GUID 0x%" PRIx64
+				" index %d base port GUID 0x%" PRIx64 "\n",
+				cl_ntoh64(p_alias_guid->alias_guid), i,
+				cl_ntoh64(p_alias_guid->p_base_port->guid));
+			osm_alias_guid_delete(&p_alias_guid);
+			/* clear response guid at index to indicate duplicate */
+			p_rcvd_rec->guid_info.guid[i % 8] = 0;
+		} else {
+			del_alias_guid = (*p_port->p_physp->p_guids)[i];
+			if (del_alias_guid) {
+				/* remove original from alias guid table */
+				p_alias_guid_check = (osm_alias_guid_t *)
+					cl_qmap_remove(&sa->p_subn->alias_port_guid_tbl,
+						       del_alias_guid);
+				if (p_alias_guid_check)
+					osm_alias_guid_delete(&p_alias_guid_check);
+				else
+					OSM_LOG(sa->p_log, OSM_LOG_ERROR,
+						"ERR 510C: Original alias GUID "
+						"0x%" PRIx64 "at index %u "
+						"not found\n",
+						cl_ntoh64(del_alias_guid),
+						i);
+			}
+
+			/* insert or replace guid at index */
+			(*p_port->p_physp->p_guids)[i] = set_alias_guid;
+			dirty = 1;
+		}
+	}
+
+	if (dirty) {
+		if (osm_queue_guidinfo(sa, p_port, block_num))
+			osm_sm_signal(sa->sm, OSM_SIGNAL_GUID_PROCESS_REQUEST);
+		sa->dirty = TRUE;
+	}
+
+	memcpy(&p_rcvd_rec->guid_info,
+	       &((*p_port->p_physp->p_guids)[block_num * GUID_TABLE_MAX_ENTRIES]),
+	       sizeof(ib_guid_info_t));
+
+	gir_respond(sa, p_madw);
+}
+
+static void get_guidinfo(IN osm_sa_t *sa, IN osm_madw_t *p_madw,
+			 IN osm_physp_t *p_req_physp)
+{
+	const ib_sa_mad_t *p_rcvd_mad;
+	const ib_guidinfo_record_t *p_rcvd_rec;
+	cl_qlist_t rec_list;
+	osm_gir_search_ctxt_t context;
+
+	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_rcvd_rec =
+	    (ib_guidinfo_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
 
 	cl_qlist_init(&rec_list);
 
@@ -350,12 +718,88 @@ void osm_gir_rcv_process(IN void *ctx, IN void *data)
 
 	cl_plock_acquire(sa->p_lock);
 
-	cl_qmap_apply_func(&sa->p_subn->node_guid_tbl,
-			   __osm_sa_gir_by_comp_mask_cb, &context);
+	cl_qmap_apply_func(&sa->p_subn->node_guid_tbl, sa_gir_by_comp_mask_cb,
+			   &context);
 
 	cl_plock_release(sa->p_lock);
 
 	osm_sa_respond(sa, p_madw, sizeof(ib_guidinfo_record_t), &rec_list);
+}
+
+void osm_gir_rcv_process(IN void *ctx, IN void *data)
+{
+	osm_sa_t *sa = ctx;
+	osm_madw_t *p_madw = data;
+	const ib_sa_mad_t *p_rcvd_mad;
+	osm_physp_t *p_req_physp;
+	osm_port_t *p_port;
+	const ib_guidinfo_record_t *p_rcvd_rec;
+
+	CL_ASSERT(sa);
+
+	OSM_LOG_ENTER(sa->p_log);
+
+	CL_ASSERT(p_madw);
+
+	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+
+	CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_GUIDINFO_RECORD);
+
+	/* update the requester physical port */
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
+						osm_madw_get_mad_addr_ptr(p_madw));
+	if (p_req_physp == NULL) {
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5104: "
+			"Cannot find requester physical port\n");
+		goto Exit;
+	}
+	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+		"Requester port GUID 0x%" PRIx64 "\n",
+		cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
+
+	switch(p_rcvd_mad->method) {
+	case IB_MAD_METHOD_GET:
+	case IB_MAD_METHOD_GETTABLE:
+		get_guidinfo(sa, p_madw, p_req_physp);
+		break;
+	case IB_MAD_METHOD_SET:
+	case IB_MAD_METHOD_DELETE:
+		if (!check_mod_comp_mask(p_rcvd_mad->comp_mask)) {
+			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5106: "
+				"component mask = 0x%016" PRIx64 ", "
+				"expected comp mask = 0x%016" PRIx64 "\n",
+				cl_ntoh64(p_rcvd_mad->comp_mask),
+				CL_NTOH64(MOD_GIR_COMP_MASK));
+			osm_sa_send_error(sa, p_madw,
+					  IB_SA_MAD_STATUS_INSUF_COMPS);
+			goto Exit;
+		}
+		p_rcvd_rec = (ib_guidinfo_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+		p_port = osm_get_port_by_lid(sa->p_subn, p_rcvd_rec->lid);
+		if (!p_port) {
+			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5117: "
+				"Port with LID %u not found\n",
+				cl_ntoh16(p_rcvd_rec->lid));
+			osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_NO_RECORDS);
+			goto Exit;
+		}
+		if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_port->p_physp,
+					  sa->p_subn->opt.allow_both_pkeys))
+			goto Exit;
+		CL_PLOCK_EXCL_ACQUIRE(sa->p_lock);
+		if (p_rcvd_mad->method == IB_MAD_METHOD_SET)
+			set_guidinfo(sa, p_madw, p_port, p_rcvd_rec->block_num);
+		else
+			del_guidinfo(sa, p_madw, p_port, p_rcvd_rec->block_num);
+		CL_PLOCK_RELEASE(sa->p_lock);
+		break;
+	default:
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5105: "
+			"Unsupported Method (%s)\n",
+			ib_get_sa_method_str(p_rcvd_mad->method));
+		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
+		break;
+	}
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
diff --git a/opensm/osm_sa_informinfo.c b/opensm/osm_sa_informinfo.c
index 5863753..f20d834 100644
--- a/opensm/osm_sa_informinfo.c
+++ b/opensm/osm_sa_informinfo.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -51,6 +52,8 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_INFORMINFO_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
@@ -82,20 +85,14 @@ shall, upon receiving a Set(InformInfo), verify that the requester
 originating the Set(InformInfo) and a Trap() source identified by Inform-
 can access each other - can use path record to verify that.
 **********************************************************************/
-static boolean_t
-__validate_ports_access_rights(IN osm_sa_t * sa,
-			       IN osm_infr_t * p_infr_rec)
+static boolean_t validate_ports_access_rights(IN osm_sa_t * sa,
+					      IN osm_infr_t * p_infr_rec)
 {
 	boolean_t valid = TRUE;
 	osm_physp_t *p_requester_physp;
 	osm_port_t *p_port;
-	osm_physp_t *p_physp;
 	ib_net64_t portguid;
-	ib_net16_t lid_range_begin;
-	ib_net16_t lid_range_end;
-	ib_net16_t lid;
-	const cl_ptr_vector_t *p_tbl;
-	ib_gid_t zero_gid;
+	uint16_t lid_range_begin, lid_range_end, lid;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -103,16 +100,13 @@ __validate_ports_access_rights(IN osm_sa_t * sa,
 	p_requester_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						      &p_infr_rec->report_addr);
 
-	memset(&zero_gid, 0, sizeof(zero_gid));
-	if (memcmp(&(p_infr_rec->inform_record.inform_info.gid),
-		   &zero_gid, sizeof(ib_gid_t))) {
+	if (ib_gid_is_notzero(&p_infr_rec->inform_record.inform_info.gid)) {
 		/* a gid is defined */
 		portguid =
 		    p_infr_rec->inform_record.inform_info.gid.unicast.
 		    interface_id;
 
 		p_port = osm_get_port_by_guid(sa->p_subn, portguid);
-
 		if (p_port == NULL) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4301: "
 				"Invalid port guid: 0x%016" PRIx64 "\n",
@@ -121,19 +115,19 @@ __validate_ports_access_rights(IN osm_sa_t * sa,
 			goto Exit;
 		}
 
-		/* get the destination InformInfo physical port */
-		p_physp = p_port->p_physp;
-
-		/* make sure that the requester and destination port can access each other
-		   according to the current partitioning. */
+		/* make sure that the requester and destination port can access
+		   each other according to the current partitioning. */
 		if (!osm_physp_share_pkey
-		    (sa->p_log, p_physp, p_requester_physp)) {
+		    (sa->p_log, p_port->p_physp, p_requester_physp,
+		     sa->p_subn->opt.allow_both_pkeys)) {
 			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 				"port and requester don't share pkey\n");
 			valid = FALSE;
 			goto Exit;
 		}
 	} else {
+		size_t lids_size;
+
 		/* gid is zero - check if LID range is defined */
 		lid_range_begin =
 		    cl_ntoh16(p_infr_rec->inform_record.inform_info.
@@ -146,33 +140,36 @@ __validate_ports_access_rights(IN osm_sa_t * sa,
 		    cl_ntoh16(p_infr_rec->inform_record.inform_info.
 			      lid_range_end);
 
-		/* lid_range_end is set to zero if no range desired. In this case -
-		   just make it equal to the lid_range_begin. */
+		lids_size = cl_ptr_vector_get_size(&sa->p_subn->port_lid_tbl);
+
+		/* lid_range_end is set to zero if no range desired. In this
+		   case - just make it equal to the lid_range_begin. */
 		if (lid_range_end == 0)
 			lid_range_end = lid_range_begin;
+		else if (lid_range_end >= lids_size)
+			lid_range_end = lids_size - 1;
+
+		if (lid_range_begin >= lids_size) {
+			/* requested lids are out of range */
+			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4302: "
+				"Given LIDs (%u-%u) are out of range (%zu)\n",
+				lid_range_begin, lid_range_end, lids_size);
+			valid = FALSE;
+			goto Exit;
+		}
 
 		/* go over all defined lids within the range and make sure that the
 		   requester port can access them according to current partitioning. */
 		for (lid = lid_range_begin; lid <= lid_range_end; lid++) {
-			p_tbl = &sa->p_subn->port_lid_tbl;
-			if (cl_ptr_vector_get_size(p_tbl) > lid)
-				p_port = cl_ptr_vector_get(p_tbl, lid);
-			else {
-				/* lid requested is out of range */
-				OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4302: "
-					"Given LID (%u) is out of range:%u\n",
-					lid, cl_ptr_vector_get_size(p_tbl));
-				valid = FALSE;
-				goto Exit;
-			}
+			p_port = osm_get_port_by_lid_ho(sa->p_subn, lid);
 			if (p_port == NULL)
 				continue;
 
-			p_physp = p_port->p_physp;
 			/* make sure that the requester and destination port can access
 			   each other according to the current partitioning. */
 			if (!osm_physp_share_pkey
-			    (sa->p_log, p_physp, p_requester_physp)) {
+			    (sa->p_log, p_port->p_physp, p_requester_physp,
+			     sa->p_subn->opt.allow_both_pkeys)) {
 				OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 					"port and requester don't share pkey\n");
 				valid = FALSE;
@@ -186,16 +183,13 @@ Exit:
 	return valid;
 }
 
-/**********************************************************************
- **********************************************************************/
-static boolean_t
-__validate_infr(IN osm_sa_t * sa, IN osm_infr_t * p_infr_rec)
+static boolean_t validate_infr(IN osm_sa_t * sa, IN osm_infr_t * p_infr_rec)
 {
 	boolean_t valid = TRUE;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	valid = __validate_ports_access_rights(sa, p_infr_rec);
+	valid = validate_ports_access_rights(sa, p_infr_rec);
 	if (!valid) {
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"Invalid Access for InformInfo\n");
@@ -211,9 +205,7 @@ o13-12.1.1: Confirm a valid request for event subscription by responding
 with an InformInfo attribute that is a copy of the data in the
 Set(InformInfo) request.
 **********************************************************************/
-static void
-__osm_infr_rcv_respond(IN osm_sa_t * sa,
-		       IN osm_madw_t * const p_madw)
+static void infr_rcv_respond(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 {
 	cl_qlist_t rec_list;
 	osm_iir_item_t *item;
@@ -243,14 +235,10 @@ Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_inform_info_rec_by_comp_mask(IN osm_sa_t * sa,
-				      IN const osm_infr_t * const p_infr,
-				      osm_iir_search_ctxt_t * const p_ctxt)
+static void sa_inform_info_rec_by_comp_mask(IN osm_sa_t * sa,
+					    IN const osm_infr_t * p_infr,
+					    osm_iir_search_ctxt_t * p_ctxt)
 {
-	const ib_inform_info_record_t *p_rcvd_rec = NULL;
 	ib_net64_t comp_mask;
 	ib_net64_t portguid;
 	osm_port_t *p_subscriber_port;
@@ -260,13 +248,12 @@ __osm_sa_inform_info_rec_by_comp_mask(IN osm_sa_t * sa,
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	comp_mask = p_ctxt->comp_mask;
 	p_req_physp = p_ctxt->p_req_physp;
 
 	if (comp_mask & IB_IIR_COMPMASK_SUBSCRIBERGID &&
 	    memcmp(&p_infr->inform_record.subscriber_gid,
-	    	   &p_ctxt->subscriber_gid,
+		   &p_ctxt->subscriber_gid,
 		   sizeof(p_infr->inform_record.subscriber_gid)))
 		goto Exit;
 
@@ -288,10 +275,10 @@ __osm_sa_inform_info_rec_by_comp_mask(IN osm_sa_t * sa,
 
 	/* get the subscriber InformInfo physical port */
 	p_subscriber_physp = p_subscriber_port->p_physp;
-	/* make sure that the requester and subscriber port can access each other
-	   according to the current partitioning. */
-	if (!osm_physp_share_pkey
-	    (sa->p_log, p_req_physp, p_subscriber_physp)) {
+	/* make sure that the requester and subscriber port can access each
+	   other according to the current partitioning. */
+	if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_subscriber_physp,
+				  sa->p_subn->opt.allow_both_pkeys)) {
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"requester and subscriber ports don't share pkey\n");
 		goto Exit;
@@ -304,7 +291,7 @@ __osm_sa_inform_info_rec_by_comp_mask(IN osm_sa_t * sa,
 		goto Exit;
 	}
 
-	memcpy((void *)&p_rec_item->rec, (void *)&p_infr->inform_record,
+	memcpy(&p_rec_item->rec, &p_infr->inform_record,
 	       sizeof(ib_inform_info_record_t));
 	cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);
 
@@ -312,24 +299,19 @@ Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_inform_info_rec_by_comp_mask_cb(IN cl_list_item_t * const p_list_item,
-					 IN void *context)
+static void sa_inform_info_rec_by_comp_mask_cb(IN cl_list_item_t * p_list_item,
+					       IN void *context)
 {
-	const osm_infr_t *const p_infr = (osm_infr_t *) p_list_item;
-	osm_iir_search_ctxt_t *const p_ctxt = (osm_iir_search_ctxt_t *) context;
+	const osm_infr_t *p_infr = (osm_infr_t *) p_list_item;
+	osm_iir_search_ctxt_t *p_ctxt = context;
 
-	__osm_sa_inform_info_rec_by_comp_mask(p_ctxt->sa, p_infr, p_ctxt);
+	sa_inform_info_rec_by_comp_mask(p_ctxt->sa, p_infr, p_ctxt);
 }
 
 /**********************************************************************
 Received a Get(InformInfoRecord) or GetTable(InformInfoRecord) MAD
 **********************************************************************/
-static void
-osm_infr_rcv_process_get_method(IN osm_sa_t * sa,
-				IN osm_madw_t * const p_madw)
+static void infr_rcv_process_get_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 {
 	char gid_str[INET6_ADDRSTRLEN];
 	ib_sa_mad_t *p_rcvd_mad;
@@ -346,7 +328,7 @@ osm_infr_rcv_process_get_method(IN osm_sa_t * sa,
 	p_rcvd_rec =
 	    (ib_inform_info_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
 
-	/* update the requester physical port. */
+	/* update the requester physical port */
 	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
@@ -356,9 +338,13 @@ osm_infr_rcv_process_get_method(IN osm_sa_t * sa,
 		goto Exit;
 	}
 
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
-		osm_dump_inform_info_record(sa->p_log, p_rcvd_rec,
-					    OSM_LOG_DEBUG);
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Requester port GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
+		osm_dump_inform_info_record_v2(sa->p_log, p_rcvd_rec,
+					       FILE_ID, OSM_LOG_DEBUG);
+	}
 
 	cl_qlist_init(&rec_list);
 
@@ -373,7 +359,7 @@ osm_infr_rcv_process_get_method(IN osm_sa_t * sa,
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 		"Query Subscriber GID:%s(%02X) Enum:0x%X(%02X)\n",
 		inet_ntop(AF_INET6, p_rcvd_rec->subscriber_gid.raw,
-			gid_str, sizeof gid_str),
+			  gid_str, sizeof gid_str),
 		(p_rcvd_mad->comp_mask & IB_IIR_COMPMASK_SUBSCRIBERGID) != 0,
 		cl_ntoh16(p_rcvd_rec->subscriber_enum),
 		(p_rcvd_mad->comp_mask & IB_IIR_COMPMASK_ENUM) != 0);
@@ -381,14 +367,14 @@ osm_infr_rcv_process_get_method(IN osm_sa_t * sa,
 	cl_plock_acquire(sa->p_lock);
 
 	cl_qlist_apply_func(&sa->p_subn->sa_infr_list,
-			    __osm_sa_inform_info_rec_by_comp_mask_cb, &context);
+			    sa_inform_info_rec_by_comp_mask_cb, &context);
 
 	cl_plock_release(sa->p_lock);
 
 	/* clear reserved and pad fields in InformInfoRecord */
 	for (item = (osm_iir_item_t *) cl_qlist_head(&rec_list);
 	     item != (osm_iir_item_t *) cl_qlist_end(&rec_list);
-	     item = (osm_iir_item_t *)cl_qlist_next(&item->list_item)) {
+	     item = (osm_iir_item_t *) cl_qlist_next(&item->list_item)) {
 		memset(item->rec.reserved, 0, sizeof(item->rec.reserved));
 		memset(item->rec.pad, 0, sizeof(item->rec.pad));
 	}
@@ -402,9 +388,7 @@ Exit:
 /*********************************************************************
 Received a Set(InformInfo) MAD
 **********************************************************************/
-static void
-osm_infr_rcv_process_set_method(IN osm_sa_t * sa,
-				IN osm_madw_t * const p_madw)
+static void infr_rcv_process_set_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 {
 	ib_sa_mad_t *p_sa_mad;
 	ib_inform_info_t *p_recvd_inform_info;
@@ -423,9 +407,9 @@ osm_infr_rcv_process_set_method(IN osm_sa_t * sa,
 	    (ib_inform_info_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
 
 #if 0
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
-		osm_dump_inform_info(sa->p_log, p_recvd_inform_info,
-				     OSM_LOG_DEBUG);
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_inform_info_v2(sa->p_log, p_recvd_inform_info,
+				        FILE_ID, OSM_LOG_DEBUG);
 #endif
 
 	/* Grab the lock */
@@ -448,7 +432,7 @@ osm_infr_rcv_process_set_method(IN osm_sa_t * sa,
 	if (res != IB_SUCCESS) {
 		cl_plock_release(sa->p_lock);
 
-		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4308 "
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4308: "
 			"Subscribe Request from unknown LID: %u\n",
 			cl_ntoh16(p_madw->mad_addr.dest_lid));
 		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);
@@ -462,7 +446,7 @@ osm_infr_rcv_process_set_method(IN osm_sa_t * sa,
 	if (p_recvd_inform_info->subscribe > 1) {
 		cl_plock_release(sa->p_lock);
 
-		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4308 "
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 430A: "
 			"Invalid subscribe: %d\n",
 			p_recvd_inform_info->subscribe);
 		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);
@@ -497,13 +481,12 @@ osm_infr_rcv_process_set_method(IN osm_sa_t * sa,
 	}
 
 	/* If record exists with matching InformInfo */
-	p_infr =
-	    osm_infr_get_by_rec(sa->p_subn, sa->p_log, &inform_info_rec);
+	p_infr = osm_infr_get_by_rec(sa->p_subn, sa->p_log, &inform_info_rec);
 
 	/* check to see if the request was for subscribe */
 	if (p_recvd_inform_info->subscribe) {
 		/* validate the request for a new or update InformInfo */
-		if (__validate_infr(sa, &inform_info_rec) != TRUE) {
+		if (validate_infr(sa, &inform_info_rec) != TRUE) {
 			cl_plock_release(sa->p_lock);
 
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4305: "
@@ -538,7 +521,7 @@ osm_infr_rcv_process_set_method(IN osm_sa_t * sa,
 		} else
 			/* Update the old instance of the osm_infr_t object */
 			p_infr->inform_record = inform_info_rec.inform_record;
-	/* We got an UnSubscribe request */
+		/* We got an UnSubscribe request */
 	} else if (p_infr == NULL) {
 		cl_plock_release(sa->p_lock);
 
@@ -557,14 +540,12 @@ osm_infr_rcv_process_set_method(IN osm_sa_t * sa,
 	cl_plock_release(sa->p_lock);
 
 	/* send the success response */
-	__osm_infr_rcv_respond(sa, p_madw);
+	infr_rcv_respond(sa, p_madw);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/*********************************************************************
-**********************************************************************/
 void osm_infr_rcv_process(IN void *context, IN void *data)
 {
 	osm_sa_t *sa = context;
@@ -580,21 +561,18 @@ void osm_infr_rcv_process(IN void *context, IN void *data)
 	CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_INFORM_INFO);
 
 	if (p_sa_mad->method != IB_MAD_METHOD_SET) {
-		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
-			"Unsupported Method (%s)\n",
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_sa_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
 
-	osm_infr_rcv_process_set_method(sa, p_madw);
+	infr_rcv_process_set_method(sa, p_madw);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/*********************************************************************
-**********************************************************************/
 void osm_infir_rcv_process(IN void *context, IN void *data)
 {
 	osm_sa_t *sa = context;
@@ -617,7 +595,7 @@ void osm_infir_rcv_process(IN void *context, IN void *data)
 		goto Exit;
 	}
 
-	osm_infr_rcv_process_get_method(sa, p_madw);
+	infr_rcv_process_get_method(sa, p_madw);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
diff --git a/opensm/osm_sa_lft_record.c b/opensm/osm_sa_lft_record.c
index d84a6a5..248d8f1 100644
--- a/opensm/osm_sa_lft_record.c
+++ b/opensm/osm_sa_lft_record.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -48,6 +48,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_LFT_RECORD_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_helper.h>
@@ -67,13 +69,10 @@ typedef struct osm_lftr_search_ctxt {
 	const osm_physp_t *p_req_physp;
 } osm_lftr_search_ctxt_t;
 
-/**********************************************************************
- **********************************************************************/
-static ib_api_status_t
-__osm_lftr_rcv_new_lftr(IN osm_sa_t * sa,
-			IN const osm_switch_t * const p_sw,
-			IN cl_qlist_t * const p_list,
-			IN ib_net16_t const lid, IN uint16_t const block)
+static ib_api_status_t lftr_rcv_new_lftr(IN osm_sa_t * sa,
+					 IN const osm_switch_t * p_sw,
+					 IN cl_qlist_t * p_list,
+					 IN ib_net16_t lid, IN uint16_t block)
 {
 	osm_lftr_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
@@ -106,18 +105,13 @@ __osm_lftr_rcv_new_lftr(IN osm_sa_t * sa,
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_lftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
-			    IN void *context)
+static void lftr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *cxt)
 {
-	const osm_lftr_search_ctxt_t *const p_ctxt =
-	    (osm_lftr_search_ctxt_t *) context;
-	const osm_switch_t *const p_sw = (osm_switch_t *) p_map_item;
+	const osm_lftr_search_ctxt_t *p_ctxt = cxt;
+	const osm_switch_t *p_sw = (osm_switch_t *) p_map_item;
 	const ib_lft_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	osm_sa_t *sa = p_ctxt->sa;
 	ib_net64_t const comp_mask = p_ctxt->comp_mask;
@@ -147,7 +141,8 @@ __osm_lftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 			cl_ntoh64(p_sw->p_node->node_info.node_guid));
 		return;
 	}
-	if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_physp))
+	if (!osm_physp_share_pkey(sa->p_log, p_req_physp,
+				  p_physp, sa->p_subn->opt.allow_both_pkeys))
 		return;
 
 	/* get the port 0 of the switch */
@@ -176,12 +171,10 @@ __osm_lftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 
 	/* so we can add these blocks one by one ... */
 	for (block = min_block; block <= max_block; block++)
-		__osm_lftr_rcv_new_lftr(sa, p_sw, p_ctxt->p_list,
-					osm_port_get_base_lid(p_port), block);
+		lftr_rcv_new_lftr(sa, p_sw, p_ctxt->p_list,
+				  osm_port_get_base_lid(p_port), block);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 {
 	osm_sa_t *sa = ctx;
@@ -213,7 +206,7 @@ void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 		goto Exit;
 	}
 
-	/* update the requester physical port. */
+	/* update the requester physical port */
 	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
@@ -223,6 +216,10 @@ void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 		goto Exit;
 	}
 
+	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+		"Requester port GUID 0x%" PRIx64 "\n",
+		cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
+
 	cl_qlist_init(&rec_list);
 
 	context.p_rcvd_rec = p_rcvd_rec;
@@ -234,8 +231,8 @@ void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 	cl_plock_acquire(sa->p_lock);
 
 	/* Go over all switches */
-	cl_qmap_apply_func(&sa->p_subn->sw_guid_tbl,
-			   __osm_lftr_rcv_by_comp_mask, &context);
+	cl_qmap_apply_func(&sa->p_subn->sw_guid_tbl, lftr_rcv_by_comp_mask,
+			   &context);
 
 	cl_plock_release(sa->p_lock);
 
diff --git a/opensm/osm_sa_link_record.c b/opensm/osm_sa_link_record.c
index b92845e..f91b654 100644
--- a/opensm/osm_sa_link_record.c
+++ b/opensm/osm_sa_link_record.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -48,6 +48,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_LINK_RECORD_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_switch.h>
@@ -60,14 +62,9 @@ typedef struct osm_lr_item {
 	ib_link_record_t link_rec;
 } osm_lr_item_t;
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_lr_rcv_build_physp_link(IN osm_sa_t * sa,
-			      IN const ib_net16_t from_lid,
-			      IN const ib_net16_t to_lid,
-			      IN const uint8_t from_port,
-			      IN const uint8_t to_port, IN cl_qlist_t * p_list)
+static void lr_rcv_build_physp_link(IN osm_sa_t * sa, IN ib_net16_t from_lid,
+				    IN ib_net16_t to_lid, IN uint8_t from_port,
+				    IN uint8_t to_port, IN cl_qlist_t * p_list)
 {
 	osm_lr_item_t *p_lr_item;
 
@@ -75,10 +72,8 @@ __osm_lr_rcv_build_physp_link(IN osm_sa_t * sa,
 	if (p_lr_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1801: "
 			"Unable to acquire link record\n"
-			"\t\t\t\tFrom port %u\n"
-			"\t\t\t\tTo port   %u\n"
-			"\t\t\t\tFrom lid  %u\n"
-			"\t\t\t\tTo lid    %u\n",
+			"\t\t\t\tFrom port %u\n" "\t\t\t\tTo port   %u\n"
+			"\t\t\t\tFrom lid  %u\n" "\t\t\t\tTo lid    %u\n",
 			from_port, to_port,
 			cl_ntoh16(from_lid), cl_ntoh16(to_lid));
 		return;
@@ -93,28 +88,20 @@ __osm_lr_rcv_build_physp_link(IN osm_sa_t * sa,
 	cl_qlist_insert_tail(p_list, &p_lr_item->list_item);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__get_base_lid(IN const osm_physp_t * p_physp, OUT ib_net16_t * p_base_lid)
+static ib_net16_t get_base_lid(IN const osm_physp_t * p_physp)
 {
 	if (p_physp->p_node->node_info.node_type == IB_NODE_TYPE_SWITCH)
-		*p_base_lid = osm_physp_get_base_lid
-			      (osm_node_get_physp_ptr(p_physp->p_node, 0));
-	else
-		*p_base_lid = osm_physp_get_base_lid(p_physp);
+		p_physp = osm_node_get_physp_ptr(p_physp->p_node, 0);
+	return osm_physp_get_base_lid(p_physp);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_lr_rcv_get_physp_link(IN osm_sa_t * sa,
-			    IN const ib_link_record_t * const p_lr,
-			    IN const osm_physp_t * p_src_physp,
-			    IN const osm_physp_t * p_dest_physp,
-			    IN const ib_net64_t comp_mask,
-			    IN cl_qlist_t * const p_list,
-			    IN const osm_physp_t * p_req_physp)
+static void lr_rcv_get_physp_link(IN osm_sa_t * sa,
+				  IN const ib_link_record_t * p_lr,
+				  IN const osm_physp_t * p_src_physp,
+				  IN const osm_physp_t * p_dest_physp,
+				  IN const ib_net64_t comp_mask,
+				  IN cl_qlist_t * p_list,
+				  IN const osm_physp_t * p_req_physp)
 {
 	uint8_t src_port_num;
 	uint8_t dest_port_num;
@@ -152,17 +139,20 @@ __osm_lr_rcv_get_physp_link(IN osm_sa_t * sa,
 
 	/* Check that the p_src_physp, p_dest_physp and p_req_physp
 	   all share a pkey (doesn't have to be the same p_key). */
-	if (!osm_physp_share_pkey(sa->p_log, p_src_physp, p_dest_physp)) {
+	if (!osm_physp_share_pkey(sa->p_log, p_src_physp, p_dest_physp,
+				  sa->p_subn->opt.allow_both_pkeys)) {
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"Source and Dest PhysPorts do not share PKey\n");
 		goto Exit;
 	}
-	if (!osm_physp_share_pkey(sa->p_log, p_src_physp, p_req_physp)) {
+	if (!osm_physp_share_pkey(sa->p_log, p_src_physp, p_req_physp,
+				  sa->p_subn->opt.allow_both_pkeys)) {
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"Source and Requester PhysPorts do not share PKey\n");
 		goto Exit;
 	}
-	if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_dest_physp)) {
+	if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_dest_physp,
+				  sa->p_subn->opt.allow_both_pkeys)) {
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"Requester and Dest PhysPorts do not share PKey\n");
 		goto Exit;
@@ -179,8 +169,8 @@ __osm_lr_rcv_get_physp_link(IN osm_sa_t * sa,
 		if (dest_port_num != p_lr->to_port_num)
 			goto Exit;
 
-	__get_base_lid(p_src_physp, &from_base_lid);
-	__get_base_lid(p_dest_physp, &to_base_lid);
+	from_base_lid = get_base_lid(p_src_physp);
+	to_base_lid = get_base_lid(p_dest_physp);
 
 	lmc_mask = ~((1 << sa->p_subn->opt.lmc) - 1);
 	lmc_mask = cl_hton16(lmc_mask);
@@ -200,29 +190,25 @@ __osm_lr_rcv_get_physp_link(IN osm_sa_t * sa,
 		cl_ntoh64(osm_physp_get_port_guid(p_dest_physp)),
 		dest_port_num);
 
-
-	__osm_lr_rcv_build_physp_link(sa, from_base_lid, to_base_lid,
-				      src_port_num, dest_port_num, p_list);
+	lr_rcv_build_physp_link(sa, from_base_lid, to_base_lid, src_port_num,
+				dest_port_num, p_list);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_lr_rcv_get_port_links(IN osm_sa_t * sa,
-			    IN const ib_link_record_t * const p_lr,
-			    IN const osm_port_t * p_src_port,
-			    IN const osm_port_t * p_dest_port,
-			    IN const ib_net64_t comp_mask,
-			    IN cl_qlist_t * const p_list,
-			    IN const osm_physp_t * p_req_physp)
+static void lr_rcv_get_port_links(IN osm_sa_t * sa,
+				  IN const ib_link_record_t * p_lr,
+				  IN const osm_port_t * p_src_port,
+				  IN const osm_port_t * p_dest_port,
+				  IN const ib_net64_t comp_mask,
+				  IN cl_qlist_t * p_list,
+				  IN const osm_physp_t * p_req_physp)
 {
 	const osm_physp_t *p_src_physp;
 	const osm_physp_t *p_dest_physp;
 	const cl_qmap_t *p_node_tbl;
-	osm_node_t * p_node;
+	osm_node_t *p_node;
 	uint8_t port_num;
 	uint8_t num_ports;
 	uint8_t dest_num_ports;
@@ -254,7 +240,7 @@ __osm_lr_rcv_get_port_links(IN osm_sa_t * sa,
 								   dest_port_num);
 					/* both physical ports should be with data */
 					if (p_src_physp && p_dest_physp)
-						__osm_lr_rcv_get_physp_link
+						lr_rcv_get_physp_link
 						    (sa, p_lr, p_src_physp,
 						     p_dest_physp, comp_mask,
 						     p_list, p_req_physp);
@@ -275,7 +261,7 @@ __osm_lr_rcv_get_port_links(IN osm_sa_t * sa,
 								   p_node,
 								   port_num);
 					if (p_src_physp)
-						__osm_lr_rcv_get_physp_link
+						lr_rcv_get_physp_link
 						    (sa, p_lr, p_src_physp,
 						     NULL, comp_mask, p_list,
 						     p_req_physp);
@@ -290,7 +276,7 @@ __osm_lr_rcv_get_port_links(IN osm_sa_t * sa,
 								   p_node,
 								   port_num);
 					if (p_src_physp)
-						__osm_lr_rcv_get_physp_link
+						lr_rcv_get_physp_link
 						    (sa, p_lr, p_src_physp,
 						     NULL, comp_mask, p_list,
 						     p_req_physp);
@@ -313,7 +299,7 @@ __osm_lr_rcv_get_port_links(IN osm_sa_t * sa,
 								   p_node,
 								   port_num);
 					if (p_dest_physp)
-						__osm_lr_rcv_get_physp_link
+						lr_rcv_get_physp_link
 						    (sa, p_lr, NULL,
 						     p_dest_physp, comp_mask,
 						     p_list, p_req_physp);
@@ -328,7 +314,7 @@ __osm_lr_rcv_get_port_links(IN osm_sa_t * sa,
 								   p_node,
 								   port_num);
 					if (p_dest_physp)
-						__osm_lr_rcv_get_physp_link
+						lr_rcv_get_physp_link
 						    (sa, p_lr, NULL,
 						     p_dest_physp, comp_mask,
 						     p_list, p_req_physp);
@@ -339,9 +325,9 @@ __osm_lr_rcv_get_port_links(IN osm_sa_t * sa,
 			   Process the world (recurse once back into this function).
 			 */
 			p_node_tbl = &sa->p_subn->node_guid_tbl;
-			p_node = (osm_node_t *)cl_qmap_head(p_node_tbl);
+			p_node = (osm_node_t *) cl_qmap_head(p_node_tbl);
 
-			while (p_node != (osm_node_t *)cl_qmap_end(p_node_tbl)) {
+			while (p_node != (osm_node_t *) cl_qmap_end(p_node_tbl)) {
 				num_ports = osm_node_get_num_physp(p_node);
 				for (port_num = 1; port_num < num_ports;
 				     port_num++) {
@@ -349,7 +335,7 @@ __osm_lr_rcv_get_port_links(IN osm_sa_t * sa,
 					    osm_node_get_physp_ptr(p_node,
 								   port_num);
 					if (p_src_physp)
-						__osm_lr_rcv_get_physp_link
+						lr_rcv_get_physp_link
 						    (sa, p_lr, p_src_physp,
 						     NULL, comp_mask, p_list,
 						     p_req_physp);
@@ -366,16 +352,14 @@ __osm_lr_rcv_get_port_links(IN osm_sa_t * sa,
 /**********************************************************************
  Returns the SA status to return to the client.
  **********************************************************************/
-static ib_net16_t
-__osm_lr_rcv_get_end_points(IN osm_sa_t * sa,
-			    IN const osm_madw_t * const p_madw,
-			    OUT const osm_port_t ** const pp_src_port,
-			    OUT const osm_port_t ** const pp_dest_port)
+static ib_net16_t lr_rcv_get_end_points(IN osm_sa_t * sa,
+					IN const osm_madw_t * p_madw,
+					OUT const osm_port_t ** pp_src_port,
+					OUT const osm_port_t ** pp_dest_port)
 {
 	const ib_link_record_t *p_lr;
 	const ib_sa_mad_t *p_sa_mad;
 	ib_net64_t comp_mask;
-	ib_api_status_t status;
 	ib_net16_t sa_status = IB_SA_MAD_STATUS_SUCCESS;
 
 	OSM_LOG_ENTER(sa->p_log);
@@ -391,11 +375,9 @@ __osm_lr_rcv_get_end_points(IN osm_sa_t * sa,
 	*pp_src_port = NULL;
 	*pp_dest_port = NULL;
 
-	if (p_sa_mad->comp_mask & IB_LR_COMPMASK_FROM_LID) {
-		status = osm_get_port_by_base_lid(sa->p_subn,
-						  p_lr->from_lid, pp_src_port);
-
-		if ((status != IB_SUCCESS) || (*pp_src_port == NULL)) {
+	if (comp_mask & IB_LR_COMPMASK_FROM_LID) {
+		*pp_src_port = osm_get_port_by_lid(sa->p_subn, p_lr->from_lid);
+		if (!*pp_src_port) {
 			/*
 			   This 'error' is the client's fault (bad lid) so
 			   don't enter it as an error in our own log.
@@ -410,11 +392,9 @@ __osm_lr_rcv_get_end_points(IN osm_sa_t * sa,
 		}
 	}
 
-	if (p_sa_mad->comp_mask & IB_LR_COMPMASK_TO_LID) {
-		status = osm_get_port_by_base_lid(sa->p_subn,
-						  p_lr->to_lid, pp_dest_port);
-
-		if ((status != IB_SUCCESS) || (*pp_dest_port == NULL)) {
+	if (comp_mask & IB_LR_COMPMASK_TO_LID) {
+		*pp_dest_port = osm_get_port_by_lid(sa->p_subn, p_lr->to_lid);
+		if (!*pp_dest_port) {
 			/*
 			   This 'error' is the client's fault (bad lid) so
 			   don't enter it as an error in our own log.
@@ -431,11 +411,9 @@ __osm_lr_rcv_get_end_points(IN osm_sa_t * sa,
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (sa_status);
+	return sa_status;
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_lr_rcv_process(IN void *context, IN void *data)
 {
 	osm_sa_t *sa = context;
@@ -445,7 +423,7 @@ void osm_lr_rcv_process(IN void *context, IN void *data)
 	const osm_port_t *p_src_port;
 	const osm_port_t *p_dest_port;
 	cl_qlist_t lr_list;
-	ib_net16_t sa_status;
+	ib_net16_t status;
 	osm_physp_t *p_req_physp;
 
 	OSM_LOG_ENTER(sa->p_log);
@@ -453,7 +431,7 @@ void osm_lr_rcv_process(IN void *context, IN void *data)
 	CL_ASSERT(p_madw);
 
 	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
-	p_lr = (ib_link_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
+	p_lr = ib_sa_mad_get_payload_ptr(p_sa_mad);
 
 	CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_LINK_RECORD);
 
@@ -467,7 +445,7 @@ void osm_lr_rcv_process(IN void *context, IN void *data)
 		goto Exit;
 	}
 
-	/* update the requester physical port. */
+	/* update the requester physical port */
 	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
@@ -477,8 +455,12 @@ void osm_lr_rcv_process(IN void *context, IN void *data)
 		goto Exit;
 	}
 
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
-		osm_dump_link_record(sa->p_log, p_lr, OSM_LOG_DEBUG);
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Requester port GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
+		osm_dump_link_record_v2(sa->p_log, p_lr, FILE_ID, OSM_LOG_DEBUG);
+	}
 
 	cl_qlist_init(&lr_list);
 
@@ -488,13 +470,12 @@ void osm_lr_rcv_process(IN void *context, IN void *data)
 	 */
 	cl_plock_acquire(sa->p_lock);
 
-	sa_status = __osm_lr_rcv_get_end_points(sa, p_madw,
-						&p_src_port, &p_dest_port);
+	status = lr_rcv_get_end_points(sa, p_madw, &p_src_port, &p_dest_port);
 
-	if (sa_status == IB_SA_MAD_STATUS_SUCCESS)
-		__osm_lr_rcv_get_port_links(sa, p_lr, p_src_port,
-					    p_dest_port, p_sa_mad->comp_mask,
-					    &lr_list, p_req_physp);
+	if (status == IB_SA_MAD_STATUS_SUCCESS)
+		lr_rcv_get_port_links(sa, p_lr, p_src_port, p_dest_port,
+				      p_sa_mad->comp_mask, &lr_list,
+				      p_req_physp);
 
 	cl_plock_release(sa->p_lock);
 
diff --git a/opensm/osm_sa_mad_ctrl.c b/opensm/osm_sa_mad_ctrl.c
index 49309f9..86c8fda 100644
--- a/opensm/osm_sa_mad_ctrl.c
+++ b/opensm/osm_sa_mad_ctrl.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -46,15 +47,17 @@
 #include <string.h>
 #include <complib/cl_debug.h>
 #include <iba/ib_types.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_MAD_CTRL_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_sa_mad_ctrl.h>
 #include <opensm/osm_msgdef.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_sa.h>
 
-/****f* opensm: SA/__osm_sa_mad_ctrl_disp_done_callback
+/****f* opensm: SA/sa_mad_ctrl_disp_done_callback
  * NAME
- * __osm_sa_mad_ctrl_disp_done_callback
+ * sa_mad_ctrl_disp_done_callback
  *
  * DESCRIPTION
  * This function is the Dispatcher callback that indicates
@@ -62,11 +65,10 @@
  *
  * SYNOPSIS
  */
-static void
-__osm_sa_mad_ctrl_disp_done_callback(IN void *context, IN void *p_data)
+static void sa_mad_ctrl_disp_done_callback(IN void *context, IN void *p_data)
 {
-	osm_sa_mad_ctrl_t *const p_ctrl = (osm_sa_mad_ctrl_t *) context;
-	osm_madw_t *const p_madw = (osm_madw_t *) p_data;
+	osm_sa_mad_ctrl_t *p_ctrl = context;
+	osm_madw_t *p_madw = p_data;
 
 	OSM_LOG_ENTER(p_ctrl->p_log);
 
@@ -80,18 +82,17 @@ __osm_sa_mad_ctrl_disp_done_callback(IN void *context, IN void *p_data)
 
 /************/
 
-/****f* opensm: SA/__osm_sa_mad_ctrl_process
+/****f* opensm: SA/sa_mad_ctrl_process
  * NAME
- * __osm_sa_mad_ctrl_process
+ * sa_mad_ctrl_process
  *
  * DESCRIPTION
  * This function handles known methods for received MADs.
  *
  * SYNOPSIS
  */
-static void
-__osm_sa_mad_ctrl_process(IN osm_sa_mad_ctrl_t * const p_ctrl,
-			  IN osm_madw_t * p_madw)
+static void sa_mad_ctrl_process(IN osm_sa_mad_ctrl_t * p_ctrl,
+				IN osm_madw_t * p_madw)
 {
 	ib_sa_mad_t *p_sa_mad;
 	cl_status_t status;
@@ -103,21 +104,19 @@ __osm_sa_mad_ctrl_process(IN osm_sa_mad_ctrl_t * const p_ctrl,
 
 	/*
 	   If the dispatcher is showing us that it is overloaded
-	   there is no point in placing the request in. We should instead provide
-	   immediate response - IB_RESOURCE_BUSY
+	   there is no point in placing the request in. We should instead
+	   provide immediate response - IB_RESOURCE_BUSY
 	   But how do we know?
-	   The dispatcher reports back the number of outstanding messages and the
-	   time the last message stayed in the queue.
+	   The dispatcher reports back the number of outstanding messages and
+	   the time the last message stayed in the queue.
 	   HACK: Actually, we cannot send a mad from within the receive callback;
 	   thus - we will just drop it.
 	 */
-	cl_disp_get_queue_status(p_ctrl->h_disp,
-				 &num_messages,
+	cl_disp_get_queue_status(p_ctrl->h_disp, &num_messages,
 				 &last_dispatched_msg_queue_time_msec);
-	if ((num_messages > 1) &&
-	    (p_ctrl->p_subn->opt.max_msg_fifo_timeout) &&
-	    (last_dispatched_msg_queue_time_msec >
-	     p_ctrl->p_subn->opt.max_msg_fifo_timeout)) {
+	if (num_messages > 1 && p_ctrl->p_subn->opt.max_msg_fifo_timeout &&
+	    last_dispatched_msg_queue_time_msec >
+	    p_ctrl->p_subn->opt.max_msg_fifo_timeout) {
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_INFO,
 			/*             "Responding BUSY status since the dispatcher is already" */
 			"Dropping MAD since the dispatcher is already"
@@ -217,9 +216,9 @@ __osm_sa_mad_ctrl_process(IN osm_sa_mad_ctrl_t * const p_ctrl,
 
 	default:
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 1A01: "
-			"Unsupported attribute = 0x%X\n",
+			"Unsupported attribute 0x%X\n",
 			cl_ntoh16(p_sa_mad->attr_id));
-		osm_dump_sa_mad(p_ctrl->p_log, p_sa_mad, OSM_LOG_ERROR);
+		osm_dump_sa_mad_v2(p_ctrl->p_log, p_sa_mad, FILE_ID, OSM_LOG_ERROR);
 	}
 
 	if (msg_id != CL_DISP_MSGID_NONE) {
@@ -232,17 +231,15 @@ __osm_sa_mad_ctrl_process(IN osm_sa_mad_ctrl_t * const p_ctrl,
 			"Posting Dispatcher message %s\n",
 			osm_get_disp_msg_str(msg_id));
 
-		status = cl_disp_post(p_ctrl->h_disp,
-				      msg_id,
-				      p_madw,
-				      __osm_sa_mad_ctrl_disp_done_callback,
-				      p_ctrl);
+		status = cl_disp_post(p_ctrl->h_disp, msg_id, p_madw,
+				      sa_mad_ctrl_disp_done_callback, p_ctrl);
 
 		if (status != CL_SUCCESS) {
 			OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 1A02: "
-				"Dispatcher post message failed (%s) for attribute = 0x%X\n",
+				"Dispatcher post message failed (%s) for attribute 0x%X (%s)\n",
 				CL_STATUS_MSG(status),
-				cl_ntoh16(p_sa_mad->attr_id));
+				cl_ntoh16(p_sa_mad->attr_id),
+				ib_get_sa_attr_str(p_sa_mad->attr_id));
 
 			osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
 			goto Exit;
@@ -270,21 +267,19 @@ Exit:
  * SEE ALSO
  *********/
 
-/****f* opensm: SA/__osm_sa_mad_ctrl_rcv_callback
+/****f* opensm: SA/sa_mad_ctrl_rcv_callback
  * NAME
- * __osm_sa_mad_ctrl_rcv_callback
+ * sa_mad_ctrl_rcv_callback
  *
  * DESCRIPTION
  * This is the callback from the transport layer for received MADs.
  *
  * SYNOPSIS
  */
-static void
-__osm_sa_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw,
-			       IN void *bind_context,
-			       IN osm_madw_t * p_req_madw)
+static void sa_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw, IN void *context,
+				     IN osm_madw_t * p_req_madw)
 {
-	osm_sa_mad_ctrl_t *p_ctrl = (osm_sa_mad_ctrl_t *) bind_context;
+	osm_sa_mad_ctrl_t *p_ctrl = context;
 	ib_sa_mad_t *p_sa_mad;
 
 	OSM_LOG_ENTER(p_ctrl->p_log);
@@ -324,21 +319,20 @@ __osm_sa_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw,
 
 	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
 
-	if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_FRAMES))
-		osm_dump_sa_mad(p_ctrl->p_log, p_sa_mad, OSM_LOG_FRAMES);
+	if (OSM_LOG_IS_ACTIVE_V2(p_ctrl->p_log, OSM_LOG_FRAMES))
+		osm_dump_sa_mad_v2(p_ctrl->p_log, p_sa_mad, FILE_ID, OSM_LOG_FRAMES);
 
 	/*
 	 * C15-0.1.5 - Table 185: SA Header - p884
 	 * SM_key should be either 0 or match the current SM_Key
 	 * otherwise discard the MAD.
 	 */
-	if ((p_sa_mad->sm_key != 0) &&
-	    (p_sa_mad->sm_key != p_ctrl->p_subn->opt.sa_key)) {
+	if (p_sa_mad->sm_key != 0 &&
+	    p_sa_mad->sm_key != p_ctrl->p_subn->opt.sa_key) {
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 1A04: "
 			"Non-Zero SA MAD SM_Key: 0x%" PRIx64 " != SM_Key: 0x%"
 			PRIx64 "; MAD ignored\n", cl_ntoh64(p_sa_mad->sm_key),
-			cl_ntoh64(p_ctrl->p_subn->opt.sa_key)
-		    );
+			cl_ntoh64(p_ctrl->p_subn->opt.sa_key));
 		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
 		goto Exit;
 	}
@@ -363,7 +357,7 @@ __osm_sa_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw,
 #endif
 	case IB_MAD_METHOD_SET:
 	case IB_MAD_METHOD_DELETE:
-		__osm_sa_mad_ctrl_process(p_ctrl, p_madw);
+		sa_mad_ctrl_process(p_ctrl, p_madw);
 		break;
 
 	default:
@@ -388,9 +382,9 @@ Exit:
  * SEE ALSO
  *********/
 
-/****f* opensm: SA/__osm_sa_mad_ctrl_send_err_callback
+/****f* opensm: SA/sa_mad_ctrl_send_err_callback
  * NAME
- * __osm_sa_mad_ctrl_send_err_callback
+ * sa_mad_ctrl_send_err_callback
  *
  * DESCRIPTION
  * This is the callback from the transport layer for send errors
@@ -398,18 +392,14 @@ Exit:
  *
  * SYNOPSIS
  */
-static void
-__osm_sa_mad_ctrl_send_err_callback(IN void *bind_context,
-				    IN osm_madw_t * p_madw)
+static void sa_mad_ctrl_send_err_callback(IN void *context,
+					  IN osm_madw_t * p_madw)
 {
-	osm_sa_mad_ctrl_t *p_ctrl = (osm_sa_mad_ctrl_t *) bind_context;
+	osm_sa_mad_ctrl_t *p_ctrl = context;
 	cl_status_t status;
 
 	OSM_LOG_ENTER(p_ctrl->p_log);
 
-	OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 1A06: "
-		"MAD transaction completed in error\n");
-
 	/*
 	   We should never be here since the SA never originates a request.
 	   Unless we generated a Report(Notice)
@@ -417,37 +407,39 @@ __osm_sa_mad_ctrl_send_err_callback(IN void *bind_context,
 
 	CL_ASSERT(p_madw);
 
+	OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 1A06: "
+		"MAD completed in error (%s): "
+		"%s(%s), attr_mod 0x%x, LID %u, TID 0x%" PRIx64 "\n",
+		ib_get_err_str(p_madw->status),
+		ib_get_sa_method_str(p_madw->p_mad->method),
+		ib_get_sa_attr_str(p_madw->p_mad->attr_id),
+		cl_ntoh32(p_madw->p_mad->attr_mod),
+		cl_ntoh16(p_madw->mad_addr.dest_lid),
+		cl_ntoh64(p_madw->p_mad->trans_id));
+
+	osm_dump_sa_mad_v2(p_ctrl->p_log, osm_madw_get_sa_mad_ptr(p_madw),
+			   FILE_ID, OSM_LOG_ERROR);
+
 	/*
 	   An error occurred.  No response was received to a request MAD.
 	   Retire the original request MAD.
 	 */
 
-	osm_dump_sa_mad(p_ctrl->p_log, osm_madw_get_sa_mad_ptr(p_madw),
-			OSM_LOG_ERROR);
-
-	/*  __osm_sm_mad_ctrl_update_wire_stats( p_ctrl ); */
-
 	if (osm_madw_get_err_msg(p_madw) != CL_DISP_MSGID_NONE) {
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG,
 			"Posting Dispatcher message %s\n",
 			osm_get_disp_msg_str(osm_madw_get_err_msg(p_madw)));
 
 		status = cl_disp_post(p_ctrl->h_disp,
-				      osm_madw_get_err_msg(p_madw),
-				      p_madw,
-				      __osm_sa_mad_ctrl_disp_done_callback,
-				      p_ctrl);
+				      osm_madw_get_err_msg(p_madw), p_madw,
+				      sa_mad_ctrl_disp_done_callback, p_ctrl);
 		if (status != CL_SUCCESS) {
 			OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 1A07: "
 				"Dispatcher post message failed (%s)\n",
 				CL_STATUS_MSG(status));
 		}
-	} else {
-		/*
-		   No error message was provided, just retire the MAD.
-		 */
+	} else			/* No error message was provided, just retire the MAD. */
 		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
-	}
 
 	OSM_LOG_EXIT(p_ctrl->p_log);
 }
@@ -462,34 +454,27 @@ __osm_sa_mad_ctrl_send_err_callback(IN void *bind_context,
  * SEE ALSO
  *********/
 
-/**********************************************************************
- **********************************************************************/
-void osm_sa_mad_ctrl_construct(IN osm_sa_mad_ctrl_t * const p_ctrl)
+void osm_sa_mad_ctrl_construct(IN osm_sa_mad_ctrl_t * p_ctrl)
 {
 	CL_ASSERT(p_ctrl);
 	memset(p_ctrl, 0, sizeof(*p_ctrl));
 	p_ctrl->h_disp = CL_DISP_INVALID_HANDLE;
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_sa_mad_ctrl_destroy(IN osm_sa_mad_ctrl_t * const p_ctrl)
+void osm_sa_mad_ctrl_destroy(IN osm_sa_mad_ctrl_t * p_ctrl)
 {
 	CL_ASSERT(p_ctrl);
 	cl_disp_unregister(p_ctrl->h_disp);
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * const p_ctrl,
-		     IN osm_sa_t * sa,
-		     IN osm_mad_pool_t * const p_mad_pool,
-		     IN osm_vendor_t * const p_vendor,
-		     IN osm_subn_t * const p_subn,
-		     IN osm_log_t * const p_log,
-		     IN osm_stats_t * const p_stats,
-		     IN cl_dispatcher_t * const p_disp)
+ib_api_status_t osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * p_ctrl,
+				     IN osm_sa_t * sa,
+				     IN osm_mad_pool_t * p_mad_pool,
+				     IN osm_vendor_t * p_vendor,
+				     IN osm_subn_t * p_subn,
+				     IN osm_log_t * p_log,
+				     IN osm_stats_t * p_stats,
+				     IN cl_dispatcher_t * p_disp)
 {
 	ib_api_status_t status = IB_SUCCESS;
 
@@ -505,8 +490,8 @@ osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * const p_ctrl,
 	p_ctrl->p_stats = p_stats;
 	p_ctrl->p_subn = p_subn;
 
-	p_ctrl->h_disp = cl_disp_register(p_disp,
-					  CL_DISP_MSGID_NONE, NULL, p_ctrl);
+	p_ctrl->h_disp = cl_disp_register(p_disp, CL_DISP_MSGID_NONE, NULL,
+					  p_ctrl);
 
 	if (p_ctrl->h_disp == CL_DISP_INVALID_HANDLE) {
 		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 1A08: "
@@ -517,14 +502,11 @@ osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * const p_ctrl,
 
 Exit:
 	OSM_LOG_EXIT(p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_sa_mad_ctrl_bind(IN osm_sa_mad_ctrl_t * const p_ctrl,
-		     IN const ib_net64_t port_guid)
+ib_api_status_t osm_sa_mad_ctrl_bind(IN osm_sa_mad_ctrl_t * p_ctrl,
+				     IN ib_net64_t port_guid)
 {
 	osm_bind_info_t bind_info;
 	ib_api_status_t status = IB_SUCCESS;
@@ -546,16 +528,16 @@ osm_sa_mad_ctrl_bind(IN osm_sa_mad_ctrl_t * const p_ctrl,
 	bind_info.port_guid = port_guid;
 	bind_info.recv_q_size = OSM_SM_DEFAULT_QP1_RCV_SIZE;
 	bind_info.send_q_size = OSM_SM_DEFAULT_QP1_SEND_SIZE;
+	bind_info.timeout = p_ctrl->sa->p_subn->opt.transaction_timeout;
+	bind_info.retries = p_ctrl->sa->p_subn->opt.transaction_retries;
 
 	OSM_LOG(p_ctrl->p_log, OSM_LOG_VERBOSE,
 		"Binding to port GUID 0x%" PRIx64 "\n", cl_ntoh64(port_guid));
 
-	p_ctrl->h_bind = osm_vendor_bind(p_ctrl->p_vendor,
-					 &bind_info,
+	p_ctrl->h_bind = osm_vendor_bind(p_ctrl->p_vendor, &bind_info,
 					 p_ctrl->p_mad_pool,
-					 __osm_sa_mad_ctrl_rcv_callback,
-					 __osm_sa_mad_ctrl_send_err_callback,
-					 p_ctrl);
+					 sa_mad_ctrl_rcv_callback,
+					 sa_mad_ctrl_send_err_callback, p_ctrl);
 
 	if (p_ctrl->h_bind == OSM_BIND_INVALID_HANDLE) {
 		status = IB_ERROR;
@@ -567,12 +549,10 @@ osm_sa_mad_ctrl_bind(IN osm_sa_mad_ctrl_t * const p_ctrl,
 
 Exit:
 	OSM_LOG_EXIT(p_ctrl->p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t osm_sa_mad_ctrl_unbind(IN osm_sa_mad_ctrl_t * const p_ctrl)
+ib_api_status_t osm_sa_mad_ctrl_unbind(IN osm_sa_mad_ctrl_t * p_ctrl)
 {
 	ib_api_status_t status = IB_SUCCESS;
 
@@ -588,5 +568,5 @@ ib_api_status_t osm_sa_mad_ctrl_unbind(IN osm_sa_mad_ctrl_t * const p_ctrl)
 	osm_vendor_unbind(p_ctrl->h_bind);
 Exit:
 	OSM_LOG_EXIT(p_ctrl->p_log);
-	return (status);
+	return status;
 }
diff --git a/opensm/osm_sa_mcmember_record.c b/opensm/osm_sa_mcmember_record.c
index 99aee1b..c6069d6 100644
--- a/opensm/osm_sa_mcmember_record.c
+++ b/opensm/osm_sa_mcmember_record.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
  *
@@ -53,6 +53,8 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_MCMEMBER_RECORD_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
@@ -87,9 +89,8 @@ typedef struct osm_mcmr_item {
  used during the process of join request to copy data from the mgrp
  to the port record.
 **********************************************************************/
-static inline void
-__copy_from_create_mc_rec(IN ib_member_rec_t * const dest,
-			  IN const ib_member_rec_t * const src)
+static void copy_from_create_mc_rec(IN ib_member_rec_t * dest,
+				    IN const ib_member_rec_t * src)
 {
 	dest->qkey = src->qkey;
 	dest->mlid = src->mlid;
@@ -106,7 +107,7 @@ __copy_from_create_mc_rec(IN ib_member_rec_t * const dest,
  But this implementation is not a pool - it simply scans through
  the MGRP database for unused mlids...
 *********************************************************************/
-static void __free_mlid(IN osm_sa_t * sa, IN uint16_t mlid)
+static void free_mlid(IN osm_sa_t * sa, IN uint16_t mlid)
 {
 	UNUSED_PARAM(sa);
 	UNUSED_PARAM(mlid);
@@ -115,125 +116,81 @@ static void __free_mlid(IN osm_sa_t * sa, IN uint16_t mlid)
 /*********************************************************************
  Get a new unused mlid by scanning all the used ones in the subnet.
 **********************************************************************/
-static ib_net16_t __get_new_mlid(osm_sa_t *sa, ib_net16_t requested_mlid)
-{
-	osm_subn_t *p_subn = sa->p_subn;
-	unsigned i, max;
-
-	if (requested_mlid && cl_ntoh16(requested_mlid) >= IB_LID_MCAST_START_HO
-	    && cl_ntoh16(requested_mlid) <= p_subn->max_mcast_lid_ho
-	    && !osm_get_mgrp_by_mlid(p_subn, requested_mlid))
-		return requested_mlid;
+/* Special Case IPv6 Solicited Node Multicast (SNM) addresses */
+/* 0xff1Z601bXXXX0000 : 0x00000001ffYYYYYY */
+/* Where Z is the scope, XXXX is the P_Key, and
+ * YYYYYY is the last 24 bits of the port guid */
+#define PREFIX_MASK CL_HTON64(0xff10ffff0000ffffULL)
+#define PREFIX_SIGNATURE CL_HTON64(0xff10601b00000000ULL)
+#define INT_ID_MASK CL_HTON64(0xfffffff1ff000000ULL)
+#define INT_ID_SIGNATURE CL_HTON64(0x00000001ff000000ULL)
 
-	max = p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO + 1;
-	for (i = 0; i < max; i++) {
-		osm_mgrp_t *p_mgrp = sa->p_subn->mgroups[i];
-		if (!p_mgrp || p_mgrp->to_be_deleted)
-			return cl_hton16(i + IB_LID_MCAST_START_HO);
-	}
+static int compare_ipv6_snm_mgids(const void *m1, const void *m2)
+{
+	return memcmp(m1, m2, sizeof(ib_gid_t) - 6);
+}
 
+static ib_net16_t find_ipv6_snm_mlid(osm_subn_t *subn, ib_gid_t *mgid)
+{
+	osm_mgrp_t *m = (osm_mgrp_t *)cl_fmap_match(&subn->mgrp_mgid_tbl, mgid,
+						    compare_ipv6_snm_mgids);
+	if (m != (osm_mgrp_t *)cl_fmap_end(&subn->mgrp_mgid_tbl))
+		return m->mlid;
 	return 0;
 }
 
-/*********************************************************************
- This procedure is only invoked to cleanup an INTERMEDIATE mgrp.
- If there is only one port on the mgrp it means that the current
- request was the only member and the group is not really needed. So
- we silently drop it. Since it was an intermediate group no need to
- re-route it.
-**********************************************************************/
-static void __cleanup_mgrp(IN osm_sa_t * sa, IN ib_net16_t const mlid)
+static unsigned match_ipv6_snm_mgid(ib_gid_t * mgid)
 {
-	osm_mgrp_t *p_mgrp = osm_get_mgrp_by_mlid(sa->p_subn, mlid);
-
-	/* Remove MGRP only if osm_mcm_port_t count is 0 and
-	   not a well known group */
-	if (p_mgrp && cl_is_qmap_empty(&p_mgrp->mcm_port_tbl) &&
-	    p_mgrp->well_known == FALSE) {
-		sa->p_subn->mgroups[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO] = NULL;
-		osm_mgrp_delete(p_mgrp);
-	}
+	return ((mgid->unicast.prefix & PREFIX_MASK) == PREFIX_SIGNATURE &&
+		(mgid->unicast.interface_id & INT_ID_MASK) == INT_ID_SIGNATURE);
 }
 
-/*********************************************************************
- Add a port to the group. Calculating its PROXY_JOIN by the Port and
- requester gids.
-**********************************************************************/
-static ib_api_status_t
-__add_new_mgrp_port(IN osm_sa_t * sa,
-		    IN osm_mgrp_t * p_mgrp,
-		    IN ib_member_rec_t * p_recvd_mcmember_rec,
-		    IN osm_mad_addr_t * p_mad_addr,
-		    OUT osm_mcm_port_t ** pp_mcmr_port)
+static ib_net16_t get_new_mlid(osm_sa_t * sa, ib_member_rec_t * mcmr)
 {
-	boolean_t proxy_join;
-	ib_gid_t requester_gid;
-	ib_api_status_t res;
-
-	/* set the proxy_join if the requester gid is not identical to the
-	   joined gid */
-	res = osm_get_gid_by_mad_addr(sa->p_log, sa->p_subn,
-				      p_mad_addr, &requester_gid);
-	if (res != IB_SUCCESS) {
-		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B29: "
-			"Could not find GID for requester\n");
+	osm_subn_t *p_subn = sa->p_subn;
+	ib_net16_t requested_mlid = mcmr->mlid;
+	unsigned i, max;
 
-		return IB_INVALID_PARAMETER;
-	}
+	if (requested_mlid && cl_ntoh16(requested_mlid) >= IB_LID_MCAST_START_HO
+	    && cl_ntoh16(requested_mlid) <= p_subn->max_mcast_lid_ho
+	    && !osm_get_mbox_by_mlid(p_subn, requested_mlid))
+		return requested_mlid;
 
-	if (!memcmp(&p_recvd_mcmember_rec->port_gid, &requester_gid,
-		    sizeof(ib_gid_t))) {
-		proxy_join = FALSE;
+	if (sa->p_subn->opt.consolidate_ipv6_snm_req
+	    && match_ipv6_snm_mgid(&mcmr->mgid)
+	    && (requested_mlid = find_ipv6_snm_mlid(sa->p_subn, &mcmr->mgid))) {
+		char str[INET6_ADDRSTRLEN];
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
-			"Create new port with proxy_join FALSE\n");
-	} else {
-		/* The port is not the one specified in PortGID.
-		   The check that the requester is in the same partition as
-		   the PortGID is done before - just need to update
-		   the proxy_join. */
-		proxy_join = TRUE;
-		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
-			"Create new port with proxy_join TRUE\n");
+			"Special Case Solicited Node Mcast Join for MGID %s\n",
+			inet_ntop(AF_INET6, mcmr->mgid.raw, str, sizeof(str)));
+		return requested_mlid;
 	}
 
-	*pp_mcmr_port = osm_mgrp_add_port(sa->p_subn, sa->p_log, p_mgrp,
-					  &p_recvd_mcmember_rec->port_gid,
-					  p_recvd_mcmember_rec->scope_state,
-					  proxy_join);
-	if (*pp_mcmr_port == NULL) {
-		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B06: "
-			"osm_mgrp_add_port failed\n");
-
-		return IB_INSUFFICIENT_MEMORY;
-	}
+	max = p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO + 1;
+	for (i = 0; i < max; i++)
+		if (!sa->p_subn->mboxes[i])
+			return cl_hton16(i + IB_LID_MCAST_START_HO);
 
-	return IB_SUCCESS;
+	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
-static inline boolean_t __check_join_comp_mask(ib_net64_t comp_mask)
+static inline boolean_t check_join_comp_mask(ib_net64_t comp_mask)
 {
 	return ((comp_mask & JOIN_MC_COMP_MASK) == JOIN_MC_COMP_MASK);
 }
 
-/**********************************************************************
- **********************************************************************/
-static inline boolean_t
-__check_create_comp_mask(ib_net64_t comp_mask,
-			 ib_member_rec_t * p_recvd_mcmember_rec)
+static boolean_t check_create_comp_mask(ib_net64_t comp_mask,
+					ib_member_rec_t * p_recvd_mcmember_rec)
 {
 	return ((comp_mask & REQUIRED_MC_CREATE_COMP_MASK) ==
-		 REQUIRED_MC_CREATE_COMP_MASK);
+		REQUIRED_MC_CREATE_COMP_MASK);
 }
 
 /**********************************************************************
  Generate the response MAD
 **********************************************************************/
-static void
-__osm_mcmr_rcv_respond(IN osm_sa_t * sa,
-		       IN osm_madw_t * const p_madw,
-		       IN ib_member_rec_t * p_mcmember_rec)
+static void mcmr_rcv_respond(IN osm_sa_t * sa, IN osm_madw_t * p_madw,
+			     IN ib_member_rec_t * p_mcmember_rec)
 {
 	cl_qlist_t rec_list;
 	osm_mcmr_item_t *item;
@@ -271,11 +228,11 @@ Exit:
  we make sure the following components provided match: MTU and RATE
  HACK: Currently we ignore the PKT_LIFETIME field.
 **********************************************************************/
-static boolean_t
-__validate_more_comp_fields(osm_log_t * p_log,
-			    const osm_mgrp_t * p_mgrp,
-			    const ib_member_rec_t * p_recvd_mcmember_rec,
-			    ib_net64_t comp_mask)
+static boolean_t validate_more_comp_fields(osm_log_t * p_log,
+					   const osm_mgrp_t * p_mgrp,
+					   const ib_member_rec_t *
+					   p_recvd_mcmember_rec,
+					   ib_net64_t comp_mask)
 {
 	uint8_t mtu_sel;
 	uint8_t mtu_required;
@@ -292,7 +249,7 @@ __validate_more_comp_fields(osm_log_t * p_log,
 		switch (mtu_sel) {
 		case 0:	/* Greater than MTU specified */
 			if (mtu_mgrp <= mtu_required) {
-				OSM_LOG(p_log, OSM_LOG_DEBUG,
+				OSM_LOG(p_log, OSM_LOG_VERBOSE,
 					"Requested mcast group has MTU %x, "
 					"which is not greater than %x\n",
 					mtu_mgrp, mtu_required);
@@ -301,7 +258,7 @@ __validate_more_comp_fields(osm_log_t * p_log,
 			break;
 		case 1:	/* Less than MTU specified */
 			if (mtu_mgrp >= mtu_required) {
-				OSM_LOG(p_log, OSM_LOG_DEBUG,
+				OSM_LOG(p_log, OSM_LOG_VERBOSE,
 					"Requested mcast group has MTU %x, "
 					"which is not less than %x\n",
 					mtu_mgrp, mtu_required);
@@ -310,7 +267,7 @@ __validate_more_comp_fields(osm_log_t * p_log,
 			break;
 		case 2:	/* Exactly MTU specified */
 			if (mtu_mgrp != mtu_required) {
-				OSM_LOG(p_log, OSM_LOG_DEBUG,
+				OSM_LOG(p_log, OSM_LOG_VERBOSE,
 					"Requested mcast group has MTU %x, "
 					"which is not equal to %x\n",
 					mtu_mgrp, mtu_required);
@@ -330,8 +287,8 @@ __validate_more_comp_fields(osm_log_t * p_log,
 		rate_mgrp = (uint8_t) (p_mgrp->mcmember_rec.rate & 0x3F);
 		switch (rate_sel) {
 		case 0:	/* Greater than RATE specified */
-			if (rate_mgrp <= rate_required) {
-				OSM_LOG(p_log, OSM_LOG_DEBUG,
+			if (ib_path_compare_rates(rate_mgrp, rate_required) <= 0) {
+				OSM_LOG(p_log, OSM_LOG_VERBOSE,
 					"Requested mcast group has RATE %x, "
 					"which is not greater than %x\n",
 					rate_mgrp, rate_required);
@@ -339,8 +296,8 @@ __validate_more_comp_fields(osm_log_t * p_log,
 			}
 			break;
 		case 1:	/* Less than RATE specified */
-			if (rate_mgrp >= rate_required) {
-				OSM_LOG(p_log, OSM_LOG_DEBUG,
+			if (ib_path_compare_rates(rate_mgrp, rate_required) >= 0) {
+				OSM_LOG(p_log, OSM_LOG_VERBOSE,
 					"Requested mcast group has RATE %x, "
 					"which is not less than %x\n",
 					rate_mgrp, rate_required);
@@ -348,8 +305,8 @@ __validate_more_comp_fields(osm_log_t * p_log,
 			}
 			break;
 		case 2:	/* Exactly RATE specified */
-			if (rate_mgrp != rate_required) {
-				OSM_LOG(p_log, OSM_LOG_DEBUG,
+			if (ib_path_compare_rates(rate_mgrp, rate_required)) {
+				OSM_LOG(p_log, OSM_LOG_VERBOSE,
 					"Requested mcast group has RATE %x, "
 					"which is not equal to %x\n",
 					rate_mgrp, rate_required);
@@ -368,10 +325,11 @@ __validate_more_comp_fields(osm_log_t * p_log,
  In joining an existing group, we make sure the following components
  are physically realizable: MTU and RATE
 **********************************************************************/
-static boolean_t
-__validate_port_caps(osm_log_t * const p_log,
-		     const osm_mgrp_t * p_mgrp, const osm_physp_t * p_physp)
+static boolean_t validate_port_caps(osm_log_t * p_log,
+				    const osm_mgrp_t * p_mgrp,
+				    const osm_physp_t * p_physp)
 {
+	const ib_port_info_t *p_pi;
 	uint8_t mtu_required;
 	uint8_t mtu_mgrp;
 	uint8_t rate_required;
@@ -380,16 +338,18 @@ __validate_port_caps(osm_log_t * const p_log,
 	mtu_required = ib_port_info_get_mtu_cap(&p_physp->port_info);
 	mtu_mgrp = (uint8_t) (p_mgrp->mcmember_rec.mtu & 0x3F);
 	if (mtu_required < mtu_mgrp) {
-		OSM_LOG(p_log, OSM_LOG_DEBUG,
+		OSM_LOG(p_log, OSM_LOG_VERBOSE,
 			"Port's MTU %x is less than %x\n",
 			mtu_required, mtu_mgrp);
 		return FALSE;
 	}
 
-	rate_required = ib_port_info_compute_rate(&p_physp->port_info);
+	p_pi = &p_physp->port_info;
+	rate_required = ib_port_info_compute_rate(p_pi,
+						  p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);
 	rate_mgrp = (uint8_t) (p_mgrp->mcmember_rec.rate & 0x3F);
-	if (rate_required < rate_mgrp) {
-		OSM_LOG(p_log, OSM_LOG_DEBUG,
+	if (ib_path_compare_rates(rate_required, rate_mgrp) < 0) {
+		OSM_LOG(p_log, OSM_LOG_VERBOSE,
 			"Port's RATE %x is less than %x\n",
 			rate_required, rate_mgrp);
 		return FALSE;
@@ -409,12 +369,10 @@ __validate_port_caps(osm_log_t * const p_log,
  * 2. Saved MCMemberRecord.ProxyJoin is set and the requester is not
  * part of the partition for that MCMemberRecord.
  **********************************************************************/
-static boolean_t
-__validate_modify(IN osm_sa_t * sa,
-		  IN osm_mgrp_t * p_mgrp,
-		  IN osm_mad_addr_t * p_mad_addr,
-		  IN ib_member_rec_t * p_recvd_mcmember_rec,
-		  OUT osm_mcm_port_t ** pp_mcm_port)
+static boolean_t validate_modify(IN osm_sa_t * sa, IN osm_mgrp_t * p_mgrp,
+				 IN osm_mad_addr_t * p_mad_addr,
+				 IN ib_member_rec_t * p_recvd_mcmember_rec,
+				 OUT osm_mcm_alias_guid_t ** pp_mcm_alias_guid)
 {
 	ib_net64_t portguid;
 	ib_gid_t request_gid;
@@ -423,10 +381,10 @@ __validate_modify(IN osm_sa_t * sa,
 
 	portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;
 
-	*pp_mcm_port = NULL;
+	*pp_mcm_alias_guid = osm_mgrp_get_mcm_alias_guid(p_mgrp, portguid);
 
 	/* o15-0.2.1: If this is a new port being added - nothing to check */
-	if (!osm_mgrp_is_port_present(p_mgrp, portguid, pp_mcm_port)) {
+	if (!*pp_mcm_alias_guid) {
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"This is a new port in the MC group\n");
 		return TRUE;
@@ -434,28 +392,26 @@ __validate_modify(IN osm_sa_t * sa,
 
 	/* We validate the request according the the proxy_join.
 	   Check if the proxy_join is set or not */
-	if ((*pp_mcm_port)->proxy_join == FALSE) {
+	if ((*pp_mcm_alias_guid)->proxy_join == FALSE) {
 		/* The proxy_join is not set. Modifying can by done only
 		   if the requester GID == PortGID */
-		res = osm_get_gid_by_mad_addr(sa->p_log,
-					      sa->p_subn,
-					      p_mad_addr, &request_gid);
-
+		res = osm_get_gid_by_mad_addr(sa->p_log, sa->p_subn, p_mad_addr,
+					      &request_gid);
 		if (res != IB_SUCCESS) {
 			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 				"Could not find port for requested address\n");
 			return FALSE;
 		}
 
-		if (memcmp(&((*pp_mcm_port)->port_gid), &request_gid,
-			   sizeof(ib_gid_t))) {
+		if ((*pp_mcm_alias_guid)->p_base_mcm_port->port->guid !=
+		    request_gid.unicast.interface_id ||
+		    (*pp_mcm_alias_guid)->port_gid.unicast.prefix !=
+		    request_gid.unicast.prefix) {
 			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 				"No ProxyJoin but different ports: stored:"
 				"0x%016" PRIx64 " request:0x%016" PRIx64 "\n",
-				cl_ntoh64((*pp_mcm_port)->port_gid.unicast.
-					  interface_id),
-				cl_ntoh64(p_mad_addr->addr_type.gsi.grh_info.
-					  src_gid.unicast.interface_id));
+				cl_ntoh64((*pp_mcm_alias_guid)->p_base_mcm_port->port->guid),
+				cl_ntoh64(request_gid.unicast.interface_id));
 			return FALSE;
 		}
 	} else {
@@ -471,20 +427,15 @@ __validate_modify(IN osm_sa_t * sa,
 					p_request_physp)) {
 			/* the request port is not part of the partition for this mgrp */
 			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
-				"ProxyJoin but port not in partition. stored:"
-				"0x%016" PRIx64 " request:0x%016" PRIx64 "\n",
-				cl_ntoh64((*pp_mcm_port)->port_gid.unicast.
-					  interface_id),
-				cl_ntoh64(p_mad_addr->addr_type.gsi.grh_info.
-					  src_gid.unicast.interface_id));
+				"Requesting port 0x%016" PRIx64 " has no P_Key 0x%04x\n",
+				cl_ntoh64(p_request_physp->port_guid),
+				cl_ntoh16(p_mgrp->mcmember_rec.pkey));
 			return FALSE;
 		}
 	}
 	return TRUE;
 }
 
-/**********************************************************************
- **********************************************************************/
 /*
  * Check legality of the requested MGID DELETE
  * o15-0.1.14 = VALID DELETE:
@@ -505,21 +456,19 @@ __validate_modify(IN osm_sa_t * sa,
  *   0.1.2:); and the MADs source is a member of the partition indicated
  *   by the stored MCMemberRecord:P_Key.
  */
-static boolean_t
-__validate_delete(IN osm_sa_t * sa,
-		  IN osm_mgrp_t * p_mgrp,
-		  IN osm_mad_addr_t * p_mad_addr,
-		  IN ib_member_rec_t * p_recvd_mcmember_rec,
-		  OUT osm_mcm_port_t ** pp_mcm_port)
+static boolean_t validate_delete(IN osm_sa_t * sa, IN osm_mgrp_t * p_mgrp,
+				 IN osm_mad_addr_t * p_mad_addr,
+				 IN ib_member_rec_t * p_recvd_mcmember_rec,
+				 OUT osm_mcm_alias_guid_t ** pp_mcm_alias_guid)
 {
 	ib_net64_t portguid;
 
 	portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;
 
-	*pp_mcm_port = NULL;
+	*pp_mcm_alias_guid = osm_mgrp_get_mcm_alias_guid(p_mgrp, portguid);
 
 	/* 1 */
-	if (!osm_mgrp_is_port_present(p_mgrp, portguid, pp_mcm_port)) {
+	if (!*pp_mcm_alias_guid) {
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"Failed to find the port in the MC group\n");
 		return FALSE;
@@ -527,7 +476,7 @@ __validate_delete(IN osm_sa_t * sa,
 
 	/* 2 */
 	if (!(p_recvd_mcmember_rec->scope_state & 0x0F &
-	      (*pp_mcm_port)->scope_state)) {
+	      (*pp_mcm_alias_guid)->scope_state)) {
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"Could not find any matching bits in the stored "
 			"and requested JoinStates\n");
@@ -536,20 +485,20 @@ __validate_delete(IN osm_sa_t * sa,
 
 	/* 3 */
 	if (((p_recvd_mcmember_rec->scope_state & 0x0F) |
-	     (0x0F & (*pp_mcm_port)->scope_state)) !=
-	    (0x0F & (*pp_mcm_port)->scope_state)) {
+	     (0x0F & (*pp_mcm_alias_guid)->scope_state)) !=
+	    (0x0F & (*pp_mcm_alias_guid)->scope_state)) {
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"Some bits in the request JoinState (0x%X) are not "
 			"set in the stored port (0x%X)\n",
 			(p_recvd_mcmember_rec->scope_state & 0x0F),
-			(0x0F & (*pp_mcm_port)->scope_state));
+			(0x0F & (*pp_mcm_alias_guid)->scope_state));
 		return FALSE;
 	}
 
 	/* 4 */
 	/* Validate according the the proxy_join (o15-0.1.2) */
-	if (__validate_modify(sa, p_mgrp, p_mad_addr, p_recvd_mcmember_rec,
-			      pp_mcm_port) == FALSE) {
+	if (validate_modify(sa, p_mgrp, p_mad_addr, p_recvd_mcmember_rec,
+			    pp_mcm_alias_guid) == FALSE) {
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"proxy_join validation failure\n");
 		return FALSE;
@@ -557,8 +506,6 @@ __validate_delete(IN osm_sa_t * sa,
 	return TRUE;
 }
 
-/**********************************************************************
- **********************************************************************/
 /*
  * Check legality of the requested MGID (note this does not hold for SA
  * created MGIDs)
@@ -599,9 +546,9 @@ __validate_delete(IN osm_sa_t * sa,
  *    scope bits set. (EZ: the idea here is that SA created MGIDs are the
  *    only source for this signature with link-local scope)
  */
-static ib_api_status_t
-__validate_requested_mgid(IN osm_sa_t * sa,
-			  IN const ib_member_rec_t * p_mcm_rec)
+static ib_api_status_t validate_requested_mgid(IN osm_sa_t * sa,
+					       IN const ib_member_rec_t *
+					       p_mcm_rec)
 {
 	uint16_t signature;
 	boolean_t valid = TRUE;
@@ -621,8 +568,7 @@ __validate_requested_mgid(IN osm_sa_t * sa,
 	memcpy(&signature, &(p_mcm_rec->mgid.multicast.raw_group_id),
 	       sizeof(signature));
 	signature = cl_ntoh16(signature);
-	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
-		"MGID Signed as 0x%04X\n", signature);
+	OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "MGID Signed as 0x%04X\n", signature);
 
 	/*
 	 * We skip any checks for MGIDs that follow IPoIB
@@ -663,7 +609,7 @@ __validate_requested_mgid(IN osm_sa_t * sa,
 	   the scope should not be link local */
 	if (signature == 0xA01B &&
 	    (p_mcm_rec->mgid.multicast.header[1] & 0x0F) ==
-	     IB_MC_SCOPE_LINK_LOCAL) {
+	    IB_MC_SCOPE_LINK_LOCAL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B24: "
 			"MGID uses 0xA01B signature but with link-local scope\n");
 		valid = FALSE;
@@ -672,30 +618,30 @@ __validate_requested_mgid(IN osm_sa_t * sa,
 
 	/*
 	 * For SA assigned MGIDs (signature 0xA01B):
-	 * There is no real way to make sure the Unique MGID Prefix is really unique.
+	 * There is no real way to make sure the GID Prefix is really unique.
 	 * If we could enforce using the Subnet Prefix for that purpose it would
 	 * have been nice. But the spec does not require it.
 	 */
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (valid);
+	return valid;
 }
 
 /**********************************************************************
  Check if the requested new MC group parameters are realizable.
  Also set the default MTU and Rate if not provided by the user.
 **********************************************************************/
-static boolean_t
-__mgrp_request_is_realizable(IN osm_sa_t * sa,
-			     IN ib_net64_t comp_mask,
-			     IN ib_member_rec_t * p_mcm_rec,
-			     IN const osm_physp_t * const p_physp)
+static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa,
+					    IN ib_net64_t comp_mask,
+					    IN ib_member_rec_t * p_mcm_rec,
+					    IN const osm_physp_t * p_physp)
 {
 	uint8_t mtu_sel = 2;	/* exactly */
 	uint8_t mtu_required, mtu, port_mtu;
 	uint8_t rate_sel = 2;	/* exactly */
 	uint8_t rate_required, rate, port_rate;
+	const ib_port_info_t *p_pi;
 	osm_log_t *p_log = sa->p_log;
 
 	OSM_LOG_ENTER(sa->p_log);
@@ -713,7 +659,8 @@ __mgrp_request_is_realizable(IN osm_sa_t * sa,
 	 * masked in.
 	 */
 
-	port_mtu = p_physp ? ib_port_info_get_mtu_cap(&p_physp->port_info) : 0;
+	p_pi = &p_physp->port_info;
+	port_mtu = p_physp ? ib_port_info_get_mtu_cap(p_pi) : 0;
 	if (!(comp_mask & IB_MCR_COMPMASK_MTU) ||
 	    !(comp_mask & IB_MCR_COMPMASK_MTU_SEL) ||
 	    (mtu_sel = (p_mcm_rec->mtu >> 6)) == 3)
@@ -724,7 +671,7 @@ __mgrp_request_is_realizable(IN osm_sa_t * sa,
 		switch (mtu_sel) {
 		case 0:	/* Greater than MTU specified */
 			if (port_mtu && mtu_required >= port_mtu) {
-				OSM_LOG(p_log, OSM_LOG_DEBUG,
+				OSM_LOG(p_log, OSM_LOG_VERBOSE,
 					"Requested MTU %x >= the port\'s mtu:%x\n",
 					mtu_required, port_mtu);
 				return FALSE;
@@ -750,9 +697,9 @@ __mgrp_request_is_realizable(IN osm_sa_t * sa,
 		default:
 			break;
 		}
-		/* make sure it still be in the range */
+		/* make sure it still is in the range */
 		if (mtu < IB_MIN_MTU || mtu > IB_MAX_MTU) {
-			OSM_LOG(p_log, OSM_LOG_DEBUG,
+			OSM_LOG(p_log, OSM_LOG_VERBOSE,
 				"Calculated MTU %x is out of range\n", mtu);
 			return FALSE;
 		}
@@ -760,7 +707,8 @@ __mgrp_request_is_realizable(IN osm_sa_t * sa,
 	p_mcm_rec->mtu = (mtu_sel << 6) | mtu;
 
 	port_rate =
-	    p_physp ? ib_port_info_compute_rate(&p_physp->port_info) : 0;
+	    p_physp ? ib_port_info_compute_rate(p_pi,
+						p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) : 0;
 	if (!(comp_mask & IB_MCR_COMPMASK_RATE)
 	    || !(comp_mask & IB_MCR_COMPMASK_RATE_SEL)
 	    || (rate_sel = (p_mcm_rec->rate >> 6)) == 3)
@@ -770,8 +718,8 @@ __mgrp_request_is_realizable(IN osm_sa_t * sa,
 		rate = rate_required;
 		switch (rate_sel) {
 		case 0:	/* Greater than RATE specified */
-			if (port_rate && rate_required >= port_rate) {
-				OSM_LOG(p_log, OSM_LOG_DEBUG,
+			if (ib_path_compare_rates(rate_required, port_rate) >= 0) {
+				OSM_LOG(p_log, OSM_LOG_VERBOSE,
 					"Requested RATE %x >= the port\'s rate:%x\n",
 					rate_required, port_rate);
 				return FALSE;
@@ -779,19 +727,20 @@ __mgrp_request_is_realizable(IN osm_sa_t * sa,
 			/* we provide the largest RATE possible if we can */
 			if (port_rate)
 				rate = port_rate;
-			else if (rate_required < sa->p_subn->min_ca_rate)
+			else if (ib_path_compare_rates(rate_required,
+						       sa->p_subn->min_ca_rate) < 0)
 				rate = sa->p_subn->min_ca_rate;
 			else
-				rate++;
+				rate = ib_path_rate_get_next(rate);
 			break;
 		case 1:	/* Less than RATE specified */
 			/* use the smaller of the two:
 			   a. one lower then the required
 			   b. the rate of the requesting port (if exists) */
-			if (port_rate && rate_required > port_rate)
+			if (ib_path_compare_rates(rate_required, port_rate) > 0)
 				rate = port_rate;
 			else
-				rate--;
+				rate = ib_path_rate_get_prev(rate);
 			break;
 		case 2:	/* Exactly RATE specified */
 		default:
@@ -799,7 +748,7 @@ __mgrp_request_is_realizable(IN osm_sa_t * sa,
 		}
 		/* make sure it still is in the range */
 		if (rate < IB_MIN_RATE || rate > IB_MAX_RATE) {
-			OSM_LOG(p_log, OSM_LOG_DEBUG,
+			OSM_LOG(p_log, OSM_LOG_VERBOSE,
 				"Calculated RATE %x is out of range\n", rate);
 			return FALSE;
 		}
@@ -810,112 +759,108 @@ __mgrp_request_is_realizable(IN osm_sa_t * sa,
 	return TRUE;
 }
 
+static unsigned build_new_mgid(osm_sa_t * sa, ib_net64_t comp_mask,
+			       ib_member_rec_t * mcmr)
+{
+	static uint32_t uniq_count;
+	ib_gid_t *mgid = &mcmr->mgid;
+	uint8_t scope;
+	unsigned i;
+
+	/* use the given scope state only if requested! */
+	if (comp_mask & IB_MCR_COMPMASK_SCOPE)
+		ib_member_get_scope_state(mcmr->scope_state, &scope, NULL);
+	else
+	/* to guarantee no collision with other subnets use local scope! */
+		scope = IB_MC_SCOPE_LINK_LOCAL;
+
+	mgid->raw[0] = 0xff;
+	mgid->raw[1] = 0x10 | scope;
+	mgid->raw[2] = 0xa0;
+	mgid->raw[3] = 0x1b;
+
+	memcpy(&mgid->raw[4], &sa->p_subn->opt.subnet_prefix, sizeof(uint64_t));
+
+	for (i = 0; i < 1000; i++) {
+		memcpy(&mgid->raw[10], &uniq_count, 4);
+		uniq_count++;
+		if (!osm_get_mgrp_by_mgid(sa->p_subn, mgid))
+			return 1;
+	}
+
+	return 0;
+}
+
 /**********************************************************************
  Call this function to create a new mgrp.
 **********************************************************************/
-ib_api_status_t
-osm_mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
-			     IN ib_net64_t comp_mask,
-			     IN const ib_member_rec_t *
-			     const p_recvd_mcmember_rec,
-			     IN const osm_physp_t * const p_physp,
-			     OUT osm_mgrp_t ** pp_mgrp)
+static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
+						IN ib_net64_t comp_mask,
+						IN const ib_member_rec_t *
+						p_recvd_mcmember_rec,
+						IN const osm_physp_t * p_physp,
+						OUT osm_mgrp_t ** pp_mgrp)
 {
 	ib_net16_t mlid;
-	unsigned zero_mgid, i;
-	uint8_t scope;
-	ib_gid_t *p_mgid;
-	osm_mgrp_t *p_prev_mgrp;
 	ib_api_status_t status = IB_SUCCESS;
 	ib_member_rec_t mcm_rec = *p_recvd_mcmember_rec;	/* copy for modifications */
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	/* but what if the given MGID was not 0 ? */
-	zero_mgid = 1;
-	for (i = 0; i < sizeof(p_recvd_mcmember_rec->mgid); i++)
-		if (p_recvd_mcmember_rec->mgid.raw[i] != 0) {
-			zero_mgid = 0;
-			break;
-		}
-
-	/*
-	   we allocate a new mlid number before we might use it
-	   for MGID ...
-	 */
-	mlid = __get_new_mlid(sa, mcm_rec.mlid);
-	if (mlid == 0) {
-		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B19: "
-			"__get_new_mlid failed request mlid 0x%04x\n", cl_ntoh16(mcm_rec.mlid));
-		status = IB_SA_MAD_STATUS_NO_RESOURCES;
-		goto Exit;
-	}
-
-	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
-		"Obtained new mlid 0x%X\n", cl_ntoh16(mlid));
-
 	/* we need to create the new MGID if it was not defined */
-	if (zero_mgid) {
+	if (!ib_gid_is_notzero(&p_recvd_mcmember_rec->mgid)) {
 		/* create a new MGID */
 		char gid_str[INET6_ADDRSTRLEN];
 
-		/* use the given scope state only if requested! */
-		if (comp_mask & IB_MCR_COMPMASK_SCOPE)
-			ib_member_get_scope_state(p_recvd_mcmember_rec->
-						  scope_state, &scope, NULL);
-		else
-			/* to guarantee no collision with other subnets use local scope! */
-			scope = IB_MC_SCOPE_LINK_LOCAL;
-
-		p_mgid = &(mcm_rec.mgid);
-		p_mgid->raw[0] = 0xFF;
-		p_mgid->raw[1] = 0x10 | scope;
-		p_mgid->raw[2] = 0xA0;
-		p_mgid->raw[3] = 0x1B;
-
-		/* HACK: use the SA port gid to make it globally unique */
-		memcpy((&p_mgid->raw[4]),
-		       &sa->p_subn->opt.subnet_prefix, sizeof(uint64_t));
-
-		/* HACK: how do we get a unique number - use the mlid twice */
-		memcpy(&p_mgid->raw[10], &mlid, sizeof(uint16_t));
-		memcpy(&p_mgid->raw[12], &mlid, sizeof(uint16_t));
+		if (!build_new_mgid(sa, comp_mask, &mcm_rec)) {
+			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B23: "
+				"cannot allocate unique MGID value\n");
+			status = IB_SA_MAD_STATUS_NO_RESOURCES;
+			goto Exit;
+		}
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Allocated new MGID:%s\n",
-			inet_ntop(AF_INET6, p_mgid->raw, gid_str,
+			inet_ntop(AF_INET6, mcm_rec.mgid.raw, gid_str,
 				  sizeof gid_str));
-	} else if (!__validate_requested_mgid(sa, &mcm_rec)) {
+	} else if (!validate_requested_mgid(sa, &mcm_rec)) {
 		/* a specific MGID was requested so validate the resulting MGID */
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B22: "
 			"Invalid requested MGID\n");
-		__free_mlid(sa, mlid);
 		status = IB_SA_MAD_STATUS_REQ_INVALID;
 		goto Exit;
 	}
 
 	/* check the requested parameters are realizable */
-	if (__mgrp_request_is_realizable(sa, comp_mask, &mcm_rec, p_physp) ==
+	if (mgrp_request_is_realizable(sa, comp_mask, &mcm_rec, p_physp) ==
 	    FALSE) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B26: "
 			"Requested MGRP parameters are not realizable\n");
-		__free_mlid(sa, mlid);
 		status = IB_SA_MAD_STATUS_REQ_INVALID;
 		goto Exit;
 	}
 
+	mlid = get_new_mlid(sa, &mcm_rec);
+	if (mlid == 0) {
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B19: "
+			"get_new_mlid failed request mlid 0x%04x\n",
+			cl_ntoh16(mcm_rec.mlid));
+		status = IB_SA_MAD_STATUS_NO_RESOURCES;
+		goto Exit;
+	}
+
+	OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Obtained new mlid 0x%X\n",
+		cl_ntoh16(mlid));
+
+	mcm_rec.mlid = mlid;
 	/* create a new MC Group */
-	*pp_mgrp = osm_mgrp_new(mlid);
+	*pp_mgrp = osm_mgrp_new(sa->p_subn, mlid, &mcm_rec);
 	if (*pp_mgrp == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B08: "
 			"osm_mgrp_new failed\n");
-		__free_mlid(sa, mlid);
+		free_mlid(sa, mlid);
 		status = IB_SA_MAD_STATUS_NO_RESOURCES;
 		goto Exit;
 	}
 
-	/* Initialize the mgrp */
-	(*pp_mgrp)->mcmember_rec = mcm_rec;
-	(*pp_mgrp)->mcmember_rec.mlid = mlid;
-
 	/* the mcmember_record should have mtu_sel, rate_sel, and pkt_lifetime_sel = 2 */
 	(*pp_mgrp)->mcmember_rec.mtu &= 0x3f;
 	(*pp_mgrp)->mcmember_rec.mtu |= 2 << 6;	/* exactly */
@@ -924,120 +869,40 @@ osm_mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
 	(*pp_mgrp)->mcmember_rec.pkt_life &= 0x3f;
 	(*pp_mgrp)->mcmember_rec.pkt_life |= 2 << 6;	/* exactly */
 
-	/* Insert the new group in the data base */
-
-	/* since we might have an old group by that mlid
-	   one whose deletion was delayed for an idle time
-	   we need to deallocate it first */
-	p_prev_mgrp = osm_get_mgrp_by_mlid(sa->p_subn, mlid);
-	if (p_prev_mgrp) {
-		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
-			"Found previous group for mlid:0x%04x - "
-			"Destroying it first\n",
-			cl_ntoh16(mlid));
-		sa->p_subn->mgroups[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO] = NULL;
-		osm_mgrp_delete(p_prev_mgrp);
-	}
-
-	sa->p_subn->mgroups[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO] = *pp_mgrp;
-
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
 	return status;
 }
 
 /**********************************************************************
- *********************************************************************/
-static unsigned match_mgrp_by_mgid(IN osm_mgrp_t * const p_mgrp, ib_gid_t *mgid)
-{
-	/* ignore groups marked for deletion */
-	if (p_mgrp->to_be_deleted ||
-	    memcmp(&p_mgrp->mcmember_rec.mgid, mgid, sizeof(ib_gid_t)))
-		return 0;
-	else
-		return 1;
-}
-
-/**********************************************************************
- **********************************************************************/
-#define PREFIX_MASK CL_HTON64(0xff10ffff0000ffffULL)
-#define PREFIX_SIGNATURE CL_HTON64(0xff10601b00000000ULL)
-#define INT_ID_MASK CL_HTON64(0xfffffff1ff000000ULL)
-#define INT_ID_SIGNATURE CL_HTON64(0x00000001ff000000ULL)
-
-/* Special Case IPv6 Solicited Node Multicast (SNM) addresses */
-/* 0xff1Z601bXXXX0000 : 0x00000001ffYYYYYY */
-/* Where Z is the scope, XXXX is the P_Key, and
- * YYYYYY is the last 24 bits of the port guid */
-static unsigned match_and_update_ipv6_snm_mgid(ib_gid_t *mgid)
-{
-	if ((mgid->unicast.prefix & PREFIX_MASK) == PREFIX_SIGNATURE &&
-	    (mgid->unicast.interface_id & INT_ID_MASK) == INT_ID_SIGNATURE) {
-		mgid->unicast.prefix &= PREFIX_MASK;
-		mgid->unicast.interface_id &= INT_ID_MASK;
-		return 1;
-	}
-	return 0;
-}
-
-osm_mgrp_t *osm_get_mgrp_by_mgid(IN osm_sa_t *sa, IN ib_gid_t *p_mgid)
-{
-	int i;
-
-	if (sa->p_subn->opt.consolidate_ipv6_snm_req &&
-	    match_and_update_ipv6_snm_mgid(p_mgid)) {
-		char gid_str[INET6_ADDRSTRLEN];
-		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
-			"Special Case Solicited Node Mcast Join for MGID %s\n",
-			inet_ntop(AF_INET6, p_mgid->raw, gid_str,
-				  sizeof gid_str));
-	}
-
-	for (i = 0; i <= sa->p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO;
-	     i++)
-		if (sa->p_subn->mgroups[i] &&
-		    match_mgrp_by_mgid(sa->p_subn->mgroups[i], p_mgid))
-			return sa->p_subn->mgroups[i];
-
-	return NULL;
-}
-
-/**********************************************************************
  Call this function to find or create a new mgrp.
 **********************************************************************/
-ib_api_status_t
-osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_sa_t * sa,
-				     IN ib_net64_t comp_mask,
-				     IN ib_member_rec_t *
-				     const p_recvd_mcmember_rec,
-				     OUT osm_mgrp_t ** pp_mgrp)
+osm_mgrp_t *osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_sa_t * sa,
+						 IN ib_net64_t comp_mask,
+						 IN ib_member_rec_t *
+						 p_recvd_mcmember_rec)
 {
 	osm_mgrp_t *mgrp;
 
-	if ((mgrp = osm_get_mgrp_by_mgid(sa, &p_recvd_mcmember_rec->mgid))) {
-		*pp_mgrp = mgrp;
-		return IB_SUCCESS;
-	}
-	return osm_mcmr_rcv_create_new_mgrp(sa, comp_mask,
-					    p_recvd_mcmember_rec, NULL,
-					    pp_mgrp);
+	if ((mgrp = osm_get_mgrp_by_mgid(sa->p_subn,
+					 &p_recvd_mcmember_rec->mgid)))
+		return mgrp;
+	if (mcmr_rcv_create_new_mgrp(sa, comp_mask, p_recvd_mcmember_rec, NULL,
+				     &mgrp) == IB_SUCCESS)
+		return mgrp;
+	return NULL;
 }
 
 /*********************************************************************
 Process a request for leaving the group
 **********************************************************************/
-static void
-__osm_mcmr_rcv_leave_mgrp(IN osm_sa_t * sa,
-			  IN osm_madw_t * const p_madw)
+static void mcmr_rcv_leave_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 {
 	osm_mgrp_t *p_mgrp;
 	ib_sa_mad_t *p_sa_mad;
 	ib_member_rec_t *p_recvd_mcmember_rec;
 	ib_member_rec_t mcmember_rec;
-	ib_net16_t mlid;
-	ib_net64_t portguid;
-	osm_mcm_port_t *p_mcm_port;
-	int removed;
+	osm_mcm_alias_guid_t *p_mcm_alias_guid;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -1047,30 +912,39 @@ __osm_mcmr_rcv_leave_mgrp(IN osm_sa_t * sa,
 
 	mcmember_rec = *p_recvd_mcmember_rec;
 
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG)) {
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_physp_t *p_req_physp;
+
+		p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
+							osm_madw_get_mad_addr_ptr(p_madw));
+		if (p_req_physp == NULL) {
+			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B02: "
+				"Cannot find requester physical port\n");
+		} else {
+			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+				"Requester port GUID 0x%" PRIx64 "\n",
+				cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
+		}
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Dump of record\n");
-		osm_dump_mc_record(sa->p_log, &mcmember_rec, OSM_LOG_DEBUG);
+		osm_dump_mc_record_v2(sa->p_log, &mcmember_rec, FILE_ID, OSM_LOG_DEBUG);
 	}
 
 	CL_PLOCK_EXCL_ACQUIRE(sa->p_lock);
-	p_mgrp = osm_get_mgrp_by_mgid(sa, &p_recvd_mcmember_rec->mgid);
+	p_mgrp = osm_get_mgrp_by_mgid(sa->p_subn, &p_recvd_mcmember_rec->mgid);
 	if (!p_mgrp) {
 		char gid_str[INET6_ADDRSTRLEN];
 		CL_PLOCK_RELEASE(sa->p_lock);
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"Failed since multicast group %s not present\n",
 			inet_ntop(AF_INET6, p_recvd_mcmember_rec->mgid.raw,
-				gid_str, sizeof gid_str));
+				  gid_str, sizeof gid_str));
 		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);
 		goto Exit;
 	}
 
-	mlid = p_mgrp->mlid;
-	portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;
-
 	/* check validity of the delete request o15-0.1.14 */
-	if (!__validate_delete(sa, p_mgrp, osm_madw_get_mad_addr_ptr(p_madw),
-			       p_recvd_mcmember_rec, &p_mcm_port)) {
+	if (!validate_delete(sa, p_mgrp, osm_madw_get_mad_addr_ptr(p_madw),
+			     p_recvd_mcmember_rec, &p_mcm_alias_guid)) {
 		char gid_str[INET6_ADDRSTRLEN];
 		char gid_str2[INET6_ADDRSTRLEN];
 		CL_PLOCK_RELEASE(sa->p_lock);
@@ -1085,24 +959,12 @@ __osm_mcmr_rcv_leave_mgrp(IN osm_sa_t * sa,
 		goto Exit;
 	}
 
-	/* store state - we'll need it if the port is removed */
-	mcmember_rec.scope_state = p_mcm_port->scope_state;
-
-	/* remove port or update join state */
-	removed = osm_mgrp_remove_port(sa->p_subn, sa->p_log, p_mgrp, p_mcm_port,
-				       p_recvd_mcmember_rec->scope_state&0x0F);
-	if (!removed)
-		mcmember_rec.scope_state = p_mcm_port->scope_state;
-
+	/* remove port and/or update join state */
+	osm_mgrp_remove_port(sa->p_subn, sa->p_log, p_mgrp, p_mcm_alias_guid,
+			     &mcmember_rec);
 	CL_PLOCK_RELEASE(sa->p_lock);
 
-	/* we can leave if port was deleted from MCG */
-	if (removed && osm_sm_mcgrp_leave(sa->sm, mlid, portguid))
-		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B09: "
-			"osm_sm_mcgrp_leave failed\n");
-
-	/* Send an SA response */
-	__osm_mcmr_rcv_respond(sa, p_madw, &mcmember_rec);
+	mcmr_rcv_respond(sa, p_madw, &mcmember_rec);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
@@ -1111,23 +973,22 @@ Exit:
 /**********************************************************************
  Handle a join (or create) request
 **********************************************************************/
-static void
-__osm_mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * const p_madw)
+static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 {
 	osm_mgrp_t *p_mgrp = NULL;
 	ib_api_status_t status;
 	ib_sa_mad_t *p_sa_mad;
 	ib_member_rec_t *p_recvd_mcmember_rec;
 	ib_member_rec_t mcmember_rec;
-	ib_net16_t mlid;
 	osm_mcm_port_t *p_mcmr_port;
+	osm_mcm_alias_guid_t *p_mcm_alias_guid;
 	ib_net64_t portguid;
 	osm_port_t *p_port;
 	osm_physp_t *p_physp;
 	osm_physp_t *p_request_physp;
 	uint8_t is_new_group;	/* TRUE = there is a need to create a group */
-	osm_mcast_req_type_t req_type;
 	uint8_t join_state;
+	boolean_t proxy;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -1138,18 +999,29 @@ __osm_mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * const p_madw)
 
 	mcmember_rec = *p_recvd_mcmember_rec;
 
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG)) {
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_physp_t *p_req_physp;
+
+		p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
+							osm_madw_get_mad_addr_ptr(p_madw));
+		if (p_req_physp == NULL) {
+			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B03: "
+				"Cannot find requester physical port\n");
+		} else {
+			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+				"Requester port GUID 0x%" PRIx64 "\n",
+				cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
+		}
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Dump of incoming record\n");
-		osm_dump_mc_record(sa->p_log, &mcmember_rec, OSM_LOG_DEBUG);
+		osm_dump_mc_record_v2(sa->p_log, &mcmember_rec, FILE_ID, OSM_LOG_DEBUG);
 	}
 
 	CL_PLOCK_EXCL_ACQUIRE(sa->p_lock);
 
 	/* make sure the requested port guid is known to the SM */
-	p_port = osm_get_port_by_guid(sa->p_subn, portguid);
+	p_port = osm_get_port_by_alias_guid(sa->p_subn, portguid);
 	if (!p_port) {
 		CL_PLOCK_RELEASE(sa->p_lock);
-
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"Unknown port GUID 0x%016" PRIx64 "\n",
 			cl_ntoh64(portguid));
@@ -1168,21 +1040,32 @@ __osm_mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * const p_madw)
 		goto Exit;
 	}
 
-	if (!osm_physp_share_pkey(sa->p_log, p_physp, p_request_physp)) {
-		CL_PLOCK_RELEASE(sa->p_lock);
+	proxy = (p_physp != p_request_physp);
 
-		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+	if (proxy && !osm_physp_share_pkey(sa->p_log, p_physp, p_request_physp,
+					   sa->p_subn->opt.allow_both_pkeys)) {
+		CL_PLOCK_RELEASE(sa->p_lock);
+		OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,
 			"Port and requester don't share pkey\n");
 		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);
 		goto Exit;
 	}
 
+	if ((p_sa_mad->comp_mask & IB_MCR_COMPMASK_PKEY) &&
+	    ib_pkey_is_invalid(p_recvd_mcmember_rec->pkey)) {
+		CL_PLOCK_RELEASE(sa->p_lock);
+		OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,
+			"Invalid PKey supplied in request\n");
+		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);
+		goto Exit;
+	}
+
 	ib_member_get_scope_state(p_recvd_mcmember_rec->scope_state, NULL,
 				  &join_state);
 
 	/* do we need to create a new group? */
-	p_mgrp = osm_get_mgrp_by_mgid(sa, &p_recvd_mcmember_rec->mgid);
-	if (!p_mgrp || p_mgrp->to_be_deleted) {
+	p_mgrp = osm_get_mgrp_by_mgid(sa->p_subn, &p_recvd_mcmember_rec->mgid);
+	if (!p_mgrp) {
 		/* check for JoinState.FullMember = 1 o15.0.1.9 */
 		if ((join_state & 0x01) != 0x01) {
 			char gid_str[INET6_ADDRSTRLEN];
@@ -1192,8 +1075,8 @@ __osm_mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * const p_madw)
 				"required for create, "
 				"MGID: %s from port 0x%016" PRIx64 " (%s)\n",
 				inet_ntop(AF_INET6,
-					p_recvd_mcmember_rec->mgid.raw,
-					gid_str, sizeof gid_str),
+					  p_recvd_mcmember_rec->mgid.raw,
+					  gid_str, sizeof gid_str),
 				cl_ntoh64(portguid),
 				p_port->p_node->print_desc);
 			osm_sa_send_error(sa, p_madw,
@@ -1202,11 +1085,10 @@ __osm_mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * const p_madw)
 		}
 
 		/* check the comp_mask */
-		if (!__check_create_comp_mask(p_sa_mad->comp_mask,
-					      p_recvd_mcmember_rec)) {
+		if (!check_create_comp_mask(p_sa_mad->comp_mask,
+					    p_recvd_mcmember_rec)) {
 			char gid_str[INET6_ADDRSTRLEN];
 			CL_PLOCK_RELEASE(sa->p_lock);
-
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B11: "
 				"method = %s, scope_state = 0x%x, "
 				"component mask = 0x%016" PRIx64 ", "
@@ -1217,19 +1099,18 @@ __osm_mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * const p_madw)
 				cl_ntoh64(p_sa_mad->comp_mask),
 				CL_NTOH64(REQUIRED_MC_CREATE_COMP_MASK),
 				inet_ntop(AF_INET6,
-					p_recvd_mcmember_rec->mgid.raw,
-					gid_str, sizeof gid_str),
+					  p_recvd_mcmember_rec->mgid.raw,
+					  gid_str, sizeof gid_str),
 				cl_ntoh64(portguid),
 				p_port->p_node->print_desc);
-
 			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_INSUF_COMPS);
 			goto Exit;
 		}
 
-		status = osm_mcmr_rcv_create_new_mgrp(sa, p_sa_mad->comp_mask,
-						      p_recvd_mcmember_rec,
-						      p_physp, &p_mgrp);
+		status = mcmr_rcv_create_new_mgrp(sa, p_sa_mad->comp_mask,
+						  p_recvd_mcmember_rec,
+						  p_physp, &p_mgrp);
 		if (status != IB_SUCCESS) {
 			CL_PLOCK_RELEASE(sa->p_lock);
 			osm_sa_send_error(sa, p_madw, status);
@@ -1238,15 +1119,11 @@ __osm_mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * const p_madw)
 		/* copy the MGID to the result */
 		mcmember_rec.mgid = p_mgrp->mcmember_rec.mgid;
 		is_new_group = 1;
-		req_type = OSM_MCAST_REQ_TYPE_CREATE;
-	} else {
+	} else
 		/* no need for a new group */
 		is_new_group = 0;
-		req_type = OSM_MCAST_REQ_TYPE_JOIN;
-	}
 
 	CL_ASSERT(p_mgrp);
-	mlid = p_mgrp->mlid;
 
 	/*
 	 * o15-0.2.4: If SA supports UD multicast, then SA shall cause an
@@ -1267,22 +1144,21 @@ __osm_mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * const p_madw)
 	 *
 	 * We need to check #3 and #5 here:
 	 */
-	if (!__validate_more_comp_fields(sa->p_log, p_mgrp,
-					 p_recvd_mcmember_rec,
-					 p_sa_mad->comp_mask)
-	    || !__validate_port_caps(sa->p_log, p_mgrp, p_physp)
+	if (!validate_more_comp_fields(sa->p_log, p_mgrp, p_recvd_mcmember_rec,
+				       p_sa_mad->comp_mask)
+	    || !validate_port_caps(sa->p_log, p_mgrp, p_physp)
 	    || !(join_state != 0)) {
+		char gid_str[INET6_ADDRSTRLEN];
 		/* since we might have created the new group we need to cleanup */
-		__cleanup_mgrp(sa, mlid);
-
+		osm_mgrp_cleanup(sa->p_subn, p_mgrp);
 		CL_PLOCK_RELEASE(sa->p_lock);
-
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B12: "
-			"__validate_more_comp_fields, __validate_port_caps, "
-			"or JoinState = 0 failed from port 0x%016" PRIx64
+			"validate_more_comp_fields, validate_port_caps, "
+			"or JoinState = 0 failed for MGID: %s port 0x%016" PRIx64
 			" (%s), " "sending IB_SA_MAD_STATUS_REQ_INVALID\n",
+			   inet_ntop(AF_INET6, p_mgrp->mcmember_rec.mgid.raw,
+				     gid_str, sizeof gid_str),
 			cl_ntoh64(portguid), p_port->p_node->print_desc);
-
 		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);
 		goto Exit;
 	}
@@ -1292,76 +1168,40 @@ __osm_mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * const p_madw)
 	 * in the case of modification:
 	 */
 	if (!is_new_group &&
-	    !__validate_modify(sa, p_mgrp, osm_madw_get_mad_addr_ptr(p_madw),
-			       p_recvd_mcmember_rec, &p_mcmr_port)) {
+	    !validate_modify(sa, p_mgrp, osm_madw_get_mad_addr_ptr(p_madw),
+			     p_recvd_mcmember_rec, &p_mcm_alias_guid)) {
 		CL_PLOCK_RELEASE(sa->p_lock);
-
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B13: "
-			"__validate_modify failed from port 0x%016" PRIx64
+			"validate_modify failed from port 0x%016" PRIx64
 			" (%s), sending IB_SA_MAD_STATUS_REQ_INVALID\n",
 			cl_ntoh64(portguid), p_port->p_node->print_desc);
-
 		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);
 		goto Exit;
 	}
 
-	/* create or update existing port (join-state will be updated) */
-	status = __add_new_mgrp_port(sa, p_mgrp, p_recvd_mcmember_rec,
-				     osm_madw_get_mad_addr_ptr(p_madw),
-				     &p_mcmr_port);
+	/* copy qkey mlid tclass pkey sl_flow_hop mtu rate pkt_life sl_flow_hop */
+	copy_from_create_mc_rec(&mcmember_rec, &p_mgrp->mcmember_rec);
 
-	if (status != IB_SUCCESS) {
+	/* create or update existing port (join-state will be updated) */
+	p_mcmr_port = osm_mgrp_add_port(sa->p_subn, sa->p_log, p_mgrp, p_port,
+					&mcmember_rec, proxy);
+	if (!p_mcmr_port) {
 		/* we fail to add the port so we might need to delete the group */
-		__cleanup_mgrp(sa, mlid);
-
+		osm_mgrp_cleanup(sa->p_subn, p_mgrp);
 		CL_PLOCK_RELEASE(sa->p_lock);
-
-		osm_sa_send_error(sa, p_madw, status == IB_INVALID_PARAMETER ?
-				  IB_SA_MAD_STATUS_REQ_INVALID :
-				  IB_SA_MAD_STATUS_NO_RESOURCES);
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B06: "
+			"osm_mgrp_add_port failed\n");
+		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES);
 		goto Exit;
 	}
 
-	/* o15.0.1.11: copy the join state */
-	mcmember_rec.scope_state = p_mcmr_port->scope_state;
-
-	/* copy qkey mlid tclass pkey sl_flow_hop mtu rate pkt_life sl_flow_hop */
-	__copy_from_create_mc_rec(&mcmember_rec, &p_mgrp->mcmember_rec);
-
 	/* Release the lock as we don't need it. */
 	CL_PLOCK_RELEASE(sa->p_lock);
 
-	/* do the actual routing (actually schedule the update) */
-	status = osm_sm_mcgrp_join(sa->sm, mlid,
-				   p_recvd_mcmember_rec->port_gid.unicast.
-				   interface_id, req_type);
-
-	if (status != IB_SUCCESS) {
-		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B14: "
-			"osm_sm_mcgrp_join failed from port 0x%016" PRIx64
-			" (%s), " "sending IB_SA_MAD_STATUS_NO_RESOURCES\n",
-			cl_ntoh64(portguid), p_port->p_node->print_desc);
-
-		CL_PLOCK_EXCL_ACQUIRE(sa->p_lock);
-
-		/* the request for routing failed so we need to remove the port */
-		p_mgrp = osm_get_mgrp_by_mlid(sa->p_subn, mlid);
-		if (p_mgrp != NULL) {
-			osm_mgrp_delete_port(sa->p_subn, sa->p_log, p_mgrp,
-					     p_recvd_mcmember_rec->port_gid.
-					     unicast.interface_id);
-			__cleanup_mgrp(sa, mlid);
-		}
-		CL_PLOCK_RELEASE(sa->p_lock);
-		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES);
-		goto Exit;
-
-	}
-	/* failed to route */
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
-		osm_dump_mc_record(sa->p_log, &mcmember_rec, OSM_LOG_DEBUG);
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_mc_record_v2(sa->p_log, &mcmember_rec, FILE_ID, OSM_LOG_DEBUG);
 
-	__osm_mcmr_rcv_respond(sa, p_madw, &mcmember_rec);
+	mcmr_rcv_respond(sa, p_madw, &mcmember_rec);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
@@ -1370,10 +1210,9 @@ Exit:
 /**********************************************************************
  Add a patched multicast group to the results list
 **********************************************************************/
-static ib_api_status_t
-__osm_mcmr_rcv_new_mcmr(IN osm_sa_t * sa,
-			IN const ib_member_rec_t * p_rcvd_rec,
-			IN cl_qlist_t * const p_list)
+static ib_api_status_t mcmr_rcv_new_mcmr(IN osm_sa_t * sa,
+					 IN const ib_member_rec_t * p_rcvd_rec,
+					 IN cl_qlist_t * p_list)
 {
 	osm_mcmr_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
@@ -1397,20 +1236,20 @@ __osm_mcmr_rcv_new_mcmr(IN osm_sa_t * sa,
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (status);
+	return status;
 }
 
 /**********************************************************************
  Match the given mgrp to the requested mcmr
 **********************************************************************/
-static void mcmr_by_comp_mask(osm_sa_t *sa, const ib_member_rec_t *p_rcvd_rec,
-			      ib_net64_t comp_mask, osm_mgrp_t *p_mgrp,
-			      const osm_physp_t *p_req_physp,
-			      boolean_t trusted_req, cl_qlist_t *list)
+static void mcmr_by_comp_mask(osm_sa_t * sa, const ib_member_rec_t * p_rcvd_rec,
+			      ib_net64_t comp_mask, osm_mgrp_t * p_mgrp,
+			      const osm_physp_t * p_req_physp,
+			      boolean_t trusted_req, cl_qlist_t * list)
 {
 	/* since we might change scope_state */
 	ib_member_rec_t match_rec;
-	osm_mcm_port_t *p_mcm_port;
+	osm_mcm_alias_guid_t *p_mcm_alias_guid;
 	ib_net64_t portguid = p_rcvd_rec->port_gid.unicast.interface_id;
 	/* will be used for group or port info */
 	uint8_t scope_state;
@@ -1424,14 +1263,6 @@ static void mcmr_by_comp_mask(osm_sa_t *sa, const ib_member_rec_t *p_rcvd_rec,
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 		"Checking mlid:0x%X\n", cl_ntoh16(p_mgrp->mlid));
 
-	/* the group might be marked for deletion */
-	if (p_mgrp->to_be_deleted) {
-		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
-			"Group mlid:0x%X is marked to be deleted\n",
-			cl_ntoh16(p_mgrp->mlid));
-		goto Exit;
-	}
-
 	/* first try to eliminate the group by MGID, MLID, or P_Key */
 	if ((IB_MCR_COMPMASK_MGID & comp_mask) &&
 	    memcmp(&p_rcvd_rec->mgid, &p_mgrp->mcmember_rec.mgid,
@@ -1478,7 +1309,7 @@ static void mcmr_by_comp_mask(osm_sa_t *sa, const ib_member_rec_t *p_rcvd_rec,
 			goto Exit;
 
 		if ((IB_MCR_COMPMASK_FLOW & comp_mask) &&
-		     query_flow != mgrp_flow)
+		    query_flow != mgrp_flow)
 			goto Exit;
 
 		if ((IB_MCR_COMPMASK_HOP & comp_mask) && query_hop != mgrp_hop)
@@ -1490,27 +1321,23 @@ static void mcmr_by_comp_mask(osm_sa_t *sa, const ib_member_rec_t *p_rcvd_rec,
 		goto Exit;
 
 	/* need to validate mtu, rate, and pkt_lifetime fields */
-	if (__validate_more_comp_fields(sa->p_log, p_mgrp, p_rcvd_rec,
-					comp_mask) == FALSE)
+	if (validate_more_comp_fields(sa->p_log, p_mgrp, p_rcvd_rec,
+				      comp_mask) == FALSE)
 		goto Exit;
 
 	/* Port specific fields */
 	/* so did we get the PortGUID mask */
 	if (IB_MCR_COMPMASK_PORT_GID & comp_mask) {
 		/* try to find this port */
-		if (osm_mgrp_is_port_present(p_mgrp, portguid, &p_mcm_port)) {
-			scope_state = p_mcm_port->scope_state;
-			memcpy(&port_gid, &(p_mcm_port->port_gid),
-			       sizeof(ib_gid_t));
-			proxy_join = p_mcm_port->proxy_join;
-		} else {
-			/* port not in group */
+		p_mcm_alias_guid = osm_mgrp_get_mcm_alias_guid(p_mgrp, portguid);
+		if (!p_mcm_alias_guid) /* port not in group */
 			goto Exit;
-		}
-	} else {
-		/* point to the group information */
+		scope_state = p_mcm_alias_guid->scope_state;
+		memcpy(&port_gid, &(p_mcm_alias_guid->port_gid),
+		       sizeof(ib_gid_t));
+		proxy_join = p_mcm_alias_guid->proxy_join;
+	} else /* point to the group information */
 		scope_state = p_mgrp->mcmember_rec.scope_state;
-	}
 
 	if (IB_MCR_COMPMASK_SCOPE & comp_mask)
 		scope_state_mask = 0xF0;
@@ -1519,42 +1346,40 @@ static void mcmr_by_comp_mask(osm_sa_t *sa, const ib_member_rec_t *p_rcvd_rec,
 		scope_state_mask = scope_state_mask | 0x0F;
 
 	/* Many MC records returned */
-	if (trusted_req == TRUE
-	    && !(IB_MCR_COMPMASK_PORT_GID & comp_mask)) {
+	if (trusted_req == TRUE && !(IB_MCR_COMPMASK_PORT_GID & comp_mask)) {
 		char gid_str[INET6_ADDRSTRLEN];
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"Trusted req is TRUE and no specific port defined\n");
 
 		/* return all the ports that match in this MC group */
-		p_item = cl_qmap_head(&(p_mgrp->mcm_port_tbl));
-		while (p_item != cl_qmap_end(&(p_mgrp->mcm_port_tbl))) {
-			p_mcm_port = (osm_mcm_port_t *) p_item;
+		p_item = cl_qmap_head(&(p_mgrp->mcm_alias_port_tbl));
+		while (p_item != cl_qmap_end(&(p_mgrp->mcm_alias_port_tbl))) {
+			p_mcm_alias_guid = (osm_mcm_alias_guid_t *) p_item;
 
 			if ((scope_state_mask & p_rcvd_rec->scope_state) ==
-			    (scope_state_mask & p_mcm_port->scope_state)) {
+			    (scope_state_mask & p_mcm_alias_guid->scope_state)) {
 				/* add to the list */
 				match_rec = p_mgrp->mcmember_rec;
-				match_rec.scope_state = p_mcm_port->scope_state;
-				memcpy(&(match_rec.port_gid),
-				       &(p_mcm_port->port_gid),
+				match_rec.scope_state = p_mcm_alias_guid->scope_state;
+				memcpy(&match_rec.port_gid,
+				       &p_mcm_alias_guid->port_gid,
 				       sizeof(ib_gid_t));
 				OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 					"Record of port_gid: %s"
 					" in multicast_lid: 0x%X is returned\n",
-					inet_ntop(AF_INET6, match_rec.port_gid.raw,
+					inet_ntop(AF_INET6,
+						  match_rec.port_gid.raw,
 						  gid_str, sizeof gid_str),
 					cl_ntoh16(p_mgrp->mlid));
 
 				match_rec.proxy_join =
-				    (uint8_t) (p_mcm_port->proxy_join);
+				    (uint8_t) (p_mcm_alias_guid->proxy_join);
 
-				__osm_mcmr_rcv_new_mcmr(sa, &match_rec, list);
+				mcmr_rcv_new_mcmr(sa, &match_rec, list);
 			}
 			p_item = cl_qmap_next(p_item);
 		}
-	}
-	/* One MC record returned */
-	else {
+	} else { /* One MC record returned */
 		if ((scope_state_mask & p_rcvd_rec->scope_state) !=
 		    (scope_state_mask & scope_state))
 			goto Exit;
@@ -1565,7 +1390,7 @@ static void mcmr_by_comp_mask(osm_sa_t *sa, const ib_member_rec_t *p_rcvd_rec,
 		memcpy(&(match_rec.port_gid), &port_gid, sizeof(ib_gid_t));
 		match_rec.proxy_join = (uint8_t) proxy_join;
 
-		__osm_mcmr_rcv_new_mcmr(sa, &match_rec, list);
+		mcmr_rcv_new_mcmr(sa, &match_rec, list);
 	}
 
 Exit:
@@ -1575,9 +1400,7 @@ Exit:
 /**********************************************************************
  Handle a query request
 **********************************************************************/
-static void
-__osm_mcmr_query_mgrp(IN osm_sa_t * sa,
-		      IN osm_madw_t * const p_madw)
+static void mcmr_query_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 {
 	const ib_sa_mad_t *p_rcvd_mad;
 	const ib_member_rec_t *p_rcvd_rec;
@@ -1586,7 +1409,6 @@ __osm_mcmr_query_mgrp(IN osm_sa_t * sa,
 	osm_physp_t *p_req_physp;
 	boolean_t trusted_req;
 	osm_mgrp_t *p_mgrp;
-	int i;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -1600,7 +1422,7 @@ __osm_mcmr_query_mgrp(IN osm_sa_t * sa,
 	 */
 	trusted_req = (p_rcvd_mad->sm_key != 0);
 
-	/* update the requester physical port. */
+	/* update the requester physical port */
 	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
@@ -1610,18 +1432,24 @@ __osm_mcmr_query_mgrp(IN osm_sa_t * sa,
 		goto Exit;
 	}
 
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Requester port GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Dump of record\n");
+		osm_dump_mc_record(sa->p_log, p_rcvd_rec, OSM_LOG_DEBUG);
+	}
+
 	cl_qlist_init(&rec_list);
 
 	CL_PLOCK_ACQUIRE(sa->p_lock);
 
 	/* simply go over all MCGs and match */
-	for (i = 0; i <= sa->p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO;
-	     i++) {
-		p_mgrp = sa->p_subn->mgroups[i];
-		if (p_mgrp)
-			mcmr_by_comp_mask(sa, p_rcvd_rec, comp_mask, p_mgrp,
-					  p_req_physp, trusted_req, &rec_list);
-	}
+	for (p_mgrp = (osm_mgrp_t *) cl_fmap_head(&sa->p_subn->mgrp_mgid_tbl);
+	     p_mgrp != (osm_mgrp_t *) cl_fmap_end(&sa->p_subn->mgrp_mgid_tbl);
+	     p_mgrp = (osm_mgrp_t *) cl_fmap_next(&p_mgrp->map_item))
+		mcmr_by_comp_mask(sa, p_rcvd_rec, comp_mask, p_mgrp,
+				  p_req_physp, trusted_req, &rec_list);
 
 	CL_PLOCK_RELEASE(sa->p_lock);
 
@@ -1637,7 +1465,8 @@ __osm_mcmr_query_mgrp(IN osm_sa_t * sa,
 		osm_mcmr_item_t *item;
 		for (item = (osm_mcmr_item_t *) cl_qlist_head(&rec_list);
 		     item != (osm_mcmr_item_t *) cl_qlist_end(&rec_list);
-		     item = (osm_mcmr_item_t *)cl_qlist_next(&item->list_item)) {
+		     item =
+		     (osm_mcmr_item_t *) cl_qlist_next(&item->list_item)) {
 			memset(&item->rec.port_gid, 0, sizeof(ib_gid_t));
 			ib_member_set_join_state(&item->rec, 0);
 			item->rec.proxy_join = 0;
@@ -1650,8 +1479,34 @@ Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
+static uint8_t rate_is_valid(IN const ib_sa_mad_t *p_sa_mad,
+			     IN const ib_member_rec_t *p_recvd_mcmember_rec)
+{
+	uint8_t rate;
+
+	/* Validate rate if supplied */
+	if ((p_sa_mad->comp_mask & IB_MCR_COMPMASK_RATE_SEL) &&
+	    (p_sa_mad->comp_mask & IB_MCR_COMPMASK_RATE)) {
+		rate = (uint8_t) (p_recvd_mcmember_rec->rate & 0x3F);
+		return ib_rate_is_valid(rate);
+	}
+	return 1;
+}
+
+static int mtu_is_valid(IN const ib_sa_mad_t *p_sa_mad,
+			IN const ib_member_rec_t *p_recvd_mcmember_rec)
+{
+	uint8_t mtu;
+
+	/* Validate MTU if supplied */
+	if ((p_sa_mad->comp_mask & IB_MCR_COMPMASK_MTU_SEL) &&
+	    (p_sa_mad->comp_mask & IB_MCR_COMPMASK_MTU)) {
+		mtu = (uint8_t) (p_recvd_mcmember_rec->mtu & 0x3F);
+		return ib_mtu_is_valid(mtu);
+	}
+	return 1;
+}
+
 void osm_mcmr_rcv_process(IN void *context, IN void *data)
 {
 	osm_sa_t *sa = context;
@@ -1673,7 +1528,7 @@ void osm_mcmr_rcv_process(IN void *context, IN void *data)
 
 	switch (p_sa_mad->method) {
 	case IB_MAD_METHOD_SET:
-		if (!__check_join_comp_mask(p_sa_mad->comp_mask)) {
+		if (!check_join_comp_mask(p_sa_mad->comp_mask)) {
 			char gid_str[INET6_ADDRSTRLEN];
 			char gid_str2[INET6_ADDRSTRLEN];
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B18: "
@@ -1683,12 +1538,17 @@ void osm_mcmr_rcv_process(IN void *context, IN void *data)
 				cl_ntoh64(p_sa_mad->comp_mask),
 				CL_NTOH64(JOIN_MC_COMP_MASK),
 				inet_ntop(AF_INET6,
-					p_recvd_mcmember_rec->mgid.raw,
-					gid_str, sizeof gid_str),
+					  p_recvd_mcmember_rec->mgid.raw,
+					  gid_str, sizeof gid_str),
 				inet_ntop(AF_INET6,
-					p_recvd_mcmember_rec->port_gid.raw,
-					gid_str2, sizeof gid_str2));
-
+					  p_recvd_mcmember_rec->port_gid.raw,
+					  gid_str2, sizeof gid_str2));
+			osm_sa_send_error(sa, p_madw,
+					  IB_SA_MAD_STATUS_INSUF_COMPS);
+			goto Exit;
+		}
+		if (!rate_is_valid(p_sa_mad, p_recvd_mcmember_rec) ||
+		    !mtu_is_valid(p_sa_mad, p_recvd_mcmember_rec)) {
 			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_REQ_INVALID);
 			goto Exit;
@@ -1697,16 +1557,21 @@ void osm_mcmr_rcv_process(IN void *context, IN void *data)
 		/*
 		 * Join or Create Multicast Group
 		 */
-		__osm_mcmr_rcv_join_mgrp(sa, p_madw);
+		mcmr_rcv_join_mgrp(sa, p_madw);
 		break;
 	case IB_MAD_METHOD_DELETE:
-		if (!__check_join_comp_mask(p_sa_mad->comp_mask)) {
+		if (!check_join_comp_mask(p_sa_mad->comp_mask)) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B20: "
 				"component mask = 0x%016" PRIx64 ", "
 				"expected comp mask = 0x%016" PRIx64 "\n",
 				cl_ntoh64(p_sa_mad->comp_mask),
 				CL_NTOH64(JOIN_MC_COMP_MASK));
-
+			osm_sa_send_error(sa, p_madw,
+					  IB_SA_MAD_STATUS_INSUF_COMPS);
+			goto Exit;
+		}
+		if (!rate_is_valid(p_sa_mad, p_recvd_mcmember_rec) ||
+		    !mtu_is_valid(p_sa_mad, p_recvd_mcmember_rec)) {
 			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_REQ_INVALID);
 			goto Exit;
@@ -1715,21 +1580,27 @@ void osm_mcmr_rcv_process(IN void *context, IN void *data)
 		/*
 		 * Leave Multicast Group
 		 */
-		__osm_mcmr_rcv_leave_mgrp(sa, p_madw);
+		mcmr_rcv_leave_mgrp(sa, p_madw);
 		break;
 	case IB_MAD_METHOD_GET:
 	case IB_MAD_METHOD_GETTABLE:
+		if (!rate_is_valid(p_sa_mad, p_recvd_mcmember_rec) ||
+		    !mtu_is_valid(p_sa_mad, p_recvd_mcmember_rec)) {
+			osm_sa_send_error(sa, p_madw,
+					  IB_SA_MAD_STATUS_REQ_INVALID);
+			goto Exit;
+		}
+
 		/*
 		 * Querying a Multicast Group
 		 */
-		__osm_mcmr_query_mgrp(sa, p_madw);
+		mcmr_query_mgrp(sa, p_madw);
 		break;
 	default:
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B21: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_sa_mad->method));
-		osm_sa_send_error(sa, p_madw,
-				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
+		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		break;
 	}
 
diff --git a/opensm/osm_sa_mft_record.c b/opensm/osm_sa_mft_record.c
index bda9aee..c67c923 100644
--- a/opensm/osm_sa_mft_record.c
+++ b/opensm/osm_sa_mft_record.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -48,6 +48,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_MFT_RECORD_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_helper.h>
@@ -67,14 +69,11 @@ typedef struct osm_mftr_search_ctxt {
 	const osm_physp_t *p_req_physp;
 } osm_mftr_search_ctxt_t;
 
-/**********************************************************************
- **********************************************************************/
-static ib_api_status_t
-__osm_mftr_rcv_new_mftr(IN osm_sa_t * sa,
-			IN osm_switch_t * const p_sw,
-			IN cl_qlist_t * const p_list,
-			IN ib_net16_t const lid,
-			IN uint16_t const block, IN uint8_t const position)
+static ib_api_status_t mftr_rcv_new_mftr(IN osm_sa_t * sa,
+					 IN osm_switch_t * p_sw,
+					 IN cl_qlist_t * p_list,
+					 IN ib_net16_t lid, IN uint16_t block,
+					 IN uint8_t position)
 {
 	osm_mftr_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
@@ -111,18 +110,13 @@ __osm_mftr_rcv_new_mftr(IN osm_sa_t * sa,
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_mftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
-			    IN void *context)
+static void mftr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *cxt)
 {
-	const osm_mftr_search_ctxt_t *const p_ctxt =
-	    (osm_mftr_search_ctxt_t *) context;
-	osm_switch_t *const p_sw = (osm_switch_t *) p_map_item;
+	const osm_mftr_search_ctxt_t *p_ctxt = cxt;
+	osm_switch_t *p_sw = (osm_switch_t *) p_map_item;
 	const ib_mft_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	osm_sa_t *sa = p_ctxt->sa;
 	ib_net64_t const comp_mask = p_ctxt->comp_mask;
@@ -154,7 +148,8 @@ __osm_mftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 			cl_ntoh64(p_sw->p_node->node_info.node_guid));
 		return;
 	}
-	if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_physp))
+	if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_physp,
+				  sa->p_subn->opt.allow_both_pkeys))
 		return;
 
 	/* get the port 0 of the switch */
@@ -208,13 +203,11 @@ __osm_mftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 	for (block = min_block; block <= max_block; block++)
 		for (position = min_position; position <= max_position;
 		     position++)
-			__osm_mftr_rcv_new_mftr(sa, p_sw, p_ctxt->p_list,
-						osm_port_get_base_lid(p_port),
-						block, position);
+			mftr_rcv_new_mftr(sa, p_sw, p_ctxt->p_list,
+					  osm_port_get_base_lid(p_port), block,
+					  position);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 {
 	osm_sa_t *sa = ctx;
@@ -246,9 +239,8 @@ void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 		goto Exit;
 	}
 
-	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
-						sa->p_subn,
+	/* update the requester physical port */
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
@@ -256,6 +248,9 @@ void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 			"Cannot find requester physical port\n");
 		goto Exit;
 	}
+	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+		"Requester port GUID 0x%" PRIx64 "\n",
+		cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
 
 	cl_qlist_init(&rec_list);
 
@@ -268,8 +263,8 @@ void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 	cl_plock_acquire(sa->p_lock);
 
 	/* Go over all switches */
-	cl_qmap_apply_func(&sa->p_subn->sw_guid_tbl,
-			   __osm_mftr_rcv_by_comp_mask, &context);
+	cl_qmap_apply_func(&sa->p_subn->sw_guid_tbl, mftr_rcv_by_comp_mask,
+			   &context);
 
 	cl_plock_release(sa->p_lock);
 
diff --git a/opensm/osm_sa_multipath_record.c b/opensm/osm_sa_multipath_record.c
index b9164be..99628af 100644
--- a/opensm/osm_sa_multipath_record.c
+++ b/opensm/osm_sa_multipath_record.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -52,6 +52,8 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_MULTIPATH_RECORD_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
@@ -62,6 +64,7 @@
 #include <opensm/osm_sa.h>
 
 #define OSM_SA_MPR_MAX_NUM_PATH        127
+#define MAX_HOPS 64
 
 typedef struct osm_mpr_item {
 	cl_list_item_t list_item;
@@ -81,10 +84,7 @@ typedef struct osm_path_parms {
 	int hops;
 } osm_path_parms_t;
 
-/**********************************************************************
- **********************************************************************/
-static inline boolean_t
-__osm_sa_multipath_rec_is_tavor_port(IN const osm_port_t * const p_port)
+static boolean_t sa_multipath_rec_is_tavor_port(IN const osm_port_t * p_port)
 {
 	osm_node_t const *p_node;
 	ib_net32_t vend_id;
@@ -99,23 +99,18 @@ __osm_sa_multipath_rec_is_tavor_port(IN const osm_port_t * const p_port)
 		 (vend_id == CL_HTON32(OSM_VENDOR_ID_VOLTAIRE))));
 }
 
-/**********************************************************************
- **********************************************************************/
 static boolean_t
-__osm_sa_multipath_rec_apply_tavor_mtu_limit(IN const ib_multipath_rec_t *
-					     const p_mpr,
-					     IN const osm_port_t *
-					     const p_src_port,
-					     IN const osm_port_t *
-					     const p_dest_port,
-					     IN const ib_net64_t comp_mask)
+sa_multipath_rec_apply_tavor_mtu_limit(IN const ib_multipath_rec_t * p_mpr,
+				       IN const osm_port_t * p_src_port,
+				       IN const osm_port_t * p_dest_port,
+				       IN const ib_net64_t comp_mask)
 {
 	uint8_t required_mtu;
 
 	/* only if at least one of the ports is a Tavor device */
-	if (!__osm_sa_multipath_rec_is_tavor_port(p_src_port) &&
-	    !__osm_sa_multipath_rec_is_tavor_port(p_dest_port))
-		return (FALSE);
+	if (!sa_multipath_rec_is_tavor_port(p_src_port) &&
+	    !sa_multipath_rec_is_tavor_port(p_dest_port))
+		return FALSE;
 
 	/*
 	   we can apply the patch if either:
@@ -131,7 +126,7 @@ __osm_sa_multipath_rec_apply_tavor_mtu_limit(IN const ib_multipath_rec_t *
 		case 0:	/* must be greater than */
 		case 2:	/* exact match */
 			if (IB_MTU_LEN_1024 < required_mtu)
-				return (FALSE);
+				return FALSE;
 			break;
 
 		case 1:	/* must be less than */
@@ -141,7 +136,7 @@ __osm_sa_multipath_rec_apply_tavor_mtu_limit(IN const ib_multipath_rec_t *
 		case 3:	/* largest available */
 			/* the ULP intentionally requested */
 			/* the largest MTU possible */
-			return (FALSE);
+			return FALSE;
 			break;
 
 		default:
@@ -151,26 +146,24 @@ __osm_sa_multipath_rec_apply_tavor_mtu_limit(IN const ib_multipath_rec_t *
 		}
 	}
 
-	return (TRUE);
+	return TRUE;
 }
 
-/**********************************************************************
- **********************************************************************/
-static ib_api_status_t
-__osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
-			     IN const ib_multipath_rec_t * const p_mpr,
-			     IN const osm_port_t * const p_src_port,
-			     IN const osm_port_t * const p_dest_port,
-			     IN const uint16_t dest_lid_ho,
-			     IN const ib_net64_t comp_mask,
-			     OUT osm_path_parms_t * const p_parms)
+static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa,
+					      IN const ib_multipath_rec_t *
+					      p_mpr,
+					      IN const osm_alias_guid_t * p_src_alias_guid,
+					      IN const osm_alias_guid_t * p_dest_alias_guid,
+					      IN const uint16_t dest_lid_ho,
+					      IN const ib_net64_t comp_mask,
+					      OUT osm_path_parms_t * p_parms)
 {
 	const osm_node_t *p_node;
-	const osm_physp_t *p_physp;
+	const osm_physp_t *p_physp, *p_physp0;
 	const osm_physp_t *p_src_physp;
 	const osm_physp_t *p_dest_physp;
 	const osm_prtn_t *p_prtn = NULL;
-	const ib_port_info_t *p_pi;
+	const ib_port_info_t *p_pi, *p_pi0;
 	ib_slvl_table_t *p_slvl_tbl;
 	ib_api_status_t status = IB_SUCCESS;
 	uint8_t mtu;
@@ -192,13 +185,14 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 
 	dest_lid = cl_hton16(dest_lid_ho);
 
-	p_dest_physp = p_dest_port->p_physp;
-	p_physp = p_src_port->p_physp;
+	p_dest_physp = p_dest_alias_guid->p_base_port->p_physp;
+	p_physp = p_src_alias_guid->p_base_port->p_physp;
 	p_src_physp = p_physp;
 	p_pi = &p_physp->port_info;
 
 	mtu = ib_port_info_get_mtu_cap(p_pi);
-	rate = ib_port_info_compute_rate(p_pi);
+	rate = ib_port_info_compute_rate(p_pi,
+					 p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);
 
 	/*
 	   Mellanox Tavor device performance is better using 1K MTU.
@@ -207,9 +201,10 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 	   port MTU with 1K.
 	 */
 	if (sa->p_subn->opt.enable_quirks &&
-	    __osm_sa_multipath_rec_apply_tavor_mtu_limit(p_mpr, p_src_port,
-							 p_dest_port,
-							 comp_mask))
+	    sa_multipath_rec_apply_tavor_mtu_limit(p_mpr,
+						   p_src_alias_guid->p_base_port,
+						   p_dest_alias_guid->p_base_port,
+						   comp_mask))
 		if (mtu > IB_MTU_LEN_1024) {
 			mtu = IB_MTU_LEN_1024;
 			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
@@ -235,8 +230,9 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 		p_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);
 		if (p_physp == 0) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4514: "
-				"Can't find routing to LID %u from switch for GUID 0x%016"
-				PRIx64 "\n", dest_lid_ho,
+				"Can't find routing to LID %u on switch %s "
+				"(GUID 0x%016"PRIx64")\n", dest_lid_ho,
+				p_node->print_desc,
 				cl_ntoh64(osm_node_get_node_guid(p_node)));
 			status = IB_NOT_FOUND;
 			goto Exit;
@@ -274,12 +270,14 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 		/*
 		 * if destination is switch, we want p_dest_physp to point to port 0
 		 */
-		p_dest_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);
+		p_dest_physp =
+		    osm_switch_get_route_by_lid(p_node->sw, dest_lid);
 
 		if (p_dest_physp == 0) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4515: "
-				"Can't find routing to LID %u from switch for GUID 0x%016"
-				PRIx64 "\n", dest_lid_ho,
+				"Can't find routing to LID %u on switch %s "
+				"(GUID 0x%016"PRIx64")\n", dest_lid_ho,
+				p_node->print_desc,
 				cl_ntoh64(osm_node_get_node_guid(p_node)));
 			status = IB_NOT_FOUND;
 			goto Exit;
@@ -293,19 +291,40 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 
 	while (p_physp != p_dest_physp) {
 
+		int tmp_pnum = p_physp->port_num;
 		p_node = osm_physp_get_node_ptr(p_physp);
 		p_physp = osm_physp_get_remote(p_physp);
 
 		if (p_physp == 0) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4505: "
-				"Can't find remote phys port when routing to LID %u from node GUID 0x%016"
-				PRIx64 "\n", dest_lid_ho,
-				cl_ntoh64(osm_node_get_node_guid(p_node)));
+				"Can't find remote phys port of %s (GUID "
+				"0x%016"PRIx64") port %d "
+				"while routing to LID %u",
+				p_node->print_desc,
+				cl_ntoh64(osm_node_get_node_guid(p_node)),
+				tmp_pnum,
+				dest_lid_ho);
 			status = IB_ERROR;
 			goto Exit;
 		}
 
+		/* update number of hops traversed */
 		hops++;
+		if (hops > MAX_HOPS) {
+			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4520: "
+				"Path from GUID 0x%016" PRIx64 " (%s) to"
+				" lid %u GUID 0x%016" PRIx64 " (%s) needs"
+				" more than %d hops, max %d hops allowed\n",
+				cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),
+				p_src_physp->p_node->print_desc, dest_lid_ho,
+				cl_ntoh64(osm_physp_get_port_guid
+					  (p_dest_physp)),
+				p_dest_physp->p_node->print_desc, hops,
+				MAX_HOPS);
+			status = IB_NOT_FOUND;
+			goto Exit;
+		}
+
 		in_port_num = osm_physp_get_port_num(p_physp);
 
 		/*
@@ -323,7 +342,18 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 			   the destination by now!
 			 */
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4503: "
-				"Internal error, bad path\n");
+				"Internal error, bad path while routing "
+				"from %s (GUID: 0x%016"PRIx64") port %d "
+				"to %s (GUID: 0x%016"PRIx64") port %d; "
+				"ended at %s port %d\n",
+				p_src_alias_guid->p_base_port->p_node->print_desc,
+				cl_ntoh64(p_src_alias_guid->p_base_port->p_node->node_info.node_guid),
+				p_src_alias_guid->p_base_port->p_physp->port_num,
+				p_dest_alias_guid->p_base_port->p_node->print_desc,
+				cl_ntoh64(p_dest_alias_guid->p_base_port->p_node->node_info.node_guid),
+				p_dest_alias_guid->p_base_port->p_physp->port_num,
+				p_node->print_desc,
+				p_physp->port_num);
 			status = IB_ERROR;
 			goto Exit;
 		}
@@ -336,8 +366,13 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 		if (mtu > ib_port_info_get_mtu_cap(p_pi))
 			mtu = ib_port_info_get_mtu_cap(p_pi);
 
-		if (rate > ib_port_info_compute_rate(p_pi))
-			rate = ib_port_info_compute_rate(p_pi);
+		p_physp0 = osm_node_get_physp_ptr((osm_node_t *)p_node, 0);
+		p_pi0 = &p_physp0->port_info;
+		if (ib_path_compare_rates(rate,
+					  ib_port_info_compute_rate(p_pi,
+								    p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0)
+			rate = ib_port_info_compute_rate(p_pi,
+							 p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);
 
 		/*
 		   Continue with the egress port on this switch.
@@ -345,9 +380,11 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 		p_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);
 		if (p_physp == 0) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4516: "
-				"Dead end on path to LID %u from switch for GUID 0x%016"
-				PRIx64 "\n", dest_lid_ho,
-				cl_ntoh64(osm_node_get_node_guid(p_node)));
+				"Dead end path on switch "
+				"%s (GUID: 0x%016"PRIx64") to LID %u\n",
+				p_node->print_desc,
+				cl_ntoh64(osm_node_get_node_guid(p_node)),
+				dest_lid_ho);
 			status = IB_ERROR;
 			goto Exit;
 		}
@@ -357,17 +394,24 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 		if (mtu > ib_port_info_get_mtu_cap(p_pi))
 			mtu = ib_port_info_get_mtu_cap(p_pi);
 
-		if (rate > ib_port_info_compute_rate(p_pi))
-			rate = ib_port_info_compute_rate(p_pi);
+		p_physp0 = osm_node_get_physp_ptr((osm_node_t *)p_node, 0);
+		p_pi0 = &p_physp0->port_info;
+		if (ib_path_compare_rates(rate,
+					  ib_port_info_compute_rate(p_pi,
+								    p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0)
+			rate = ib_port_info_compute_rate(p_pi,
+							 p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);
 
 		if (sa->p_subn->opt.qos) {
 			/*
 			 * Check SL2VL table of the switch and update valid SLs
 			 */
-			p_slvl_tbl = osm_physp_get_slvl_tbl(p_physp, in_port_num);
+			p_slvl_tbl =
+			    osm_physp_get_slvl_tbl(p_physp, in_port_num);
 			for (i = 0; i < IB_MAX_NUM_VLS; i++) {
 				if (valid_sl_mask & (1 << i) &&
-				    ib_slvl_table_get(p_slvl_tbl, i) == IB_DROP_VL)
+				    ib_slvl_table_get(p_slvl_tbl,
+						      i) == IB_DROP_VL)
 					valid_sl_mask &= ~(1 << i);
 			}
 			if (!valid_sl_mask) {
@@ -388,8 +432,11 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 	if (mtu > ib_port_info_get_mtu_cap(p_pi))
 		mtu = ib_port_info_get_mtu_cap(p_pi);
 
-	if (rate > ib_port_info_compute_rate(p_pi))
-		rate = ib_port_info_compute_rate(p_pi);
+	if (ib_path_compare_rates(rate,
+				  ib_port_info_compute_rate(p_pi,
+							    p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0)
+		rate = ib_port_info_compute_rate(p_pi,
+						 p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);
 
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 		"Path min MTU = %u, min rate = %u\n", mtu, rate);
@@ -398,8 +445,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 	 * Get QoS Level object according to the MultiPath request
 	 * and adjust MultiPath parameters according to QoS settings
 	 */
-	if (sa->p_subn->opt.qos &&
-	    sa->p_subn->p_qos_policy &&
+	if (sa->p_subn->opt.qos && sa->p_subn->p_qos_policy &&
 	    (p_qos_level =
 	     osm_qos_policy_get_qos_level_by_mpr(sa->p_subn->p_qos_policy,
 						 p_mpr, p_src_physp,
@@ -415,7 +461,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 			mtu = p_qos_level->mtu_limit;
 
 		if (p_qos_level->rate_limit_set
-		    && (rate > p_qos_level->rate_limit))
+		    && (ib_path_compare_rates(rate, p_qos_level->rate_limit) > 0))
 			rate = p_qos_level->rate_limit;
 
 		if (p_qos_level->sl_set) {
@@ -479,23 +525,22 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 		required_rate = ib_multipath_rec_rate(p_mpr);
 		switch (ib_multipath_rec_rate_sel(p_mpr)) {
 		case 0:	/* must be greater than */
-			if (rate <= required_rate)
+			if (ib_path_compare_rates(rate, required_rate) <= 0)
 				status = IB_NOT_FOUND;
 			break;
 
 		case 1:	/* must be less than */
-			if (rate >= required_rate) {
+			if (ib_path_compare_rates(rate, required_rate) >= 0) {
 				/* adjust the rate to use the highest rate
 				   lower then the required one */
-				if (required_rate > 2)
-					rate = required_rate - 1;
-				else
+				rate = ib_path_rate_get_prev(required_rate);
+				if (!rate)
 					status = IB_NOT_FOUND;
 			}
 			break;
 
 		case 2:	/* exact match */
-			if (rate < required_rate)
+			if (ib_path_compare_rates(rate, required_rate))
 				status = IB_NOT_FOUND;
 			else
 				rate = required_rate;
@@ -518,7 +563,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 	/* Verify the pkt_life_time */
 	/* According to spec definition IBA 1.2 Table 205 PacketLifeTime description,
 	   for loopback paths, packetLifeTime shall be zero. */
-	if (p_src_port == p_dest_port)
+	if (p_src_alias_guid->p_base_port == p_dest_alias_guid->p_base_port)
 		pkt_life = 0;	/* loopback */
 	else if (p_qos_level && p_qos_level->pkt_life_set)
 		pkt_life = p_qos_level->pkt_life;
@@ -575,7 +620,8 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 	if (comp_mask & IB_MPR_COMPMASK_RAWTRAFFIC &&
 	    cl_ntoh32(p_mpr->hop_flow_raw) & (1 << 31))
 		required_pkey =
-		    osm_physp_find_common_pkey(p_src_physp, p_dest_physp);
+		    osm_physp_find_common_pkey(p_src_physp, p_dest_physp,
+					       sa->p_subn->opt.allow_both_pkeys);
 
 	else if (comp_mask & IB_MPR_COMPMASK_PKEY) {
 		/*
@@ -587,21 +633,39 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 		 */
 		required_pkey = p_mpr->pkey;
 		if (!osm_physp_share_this_pkey
-		    (p_src_physp, p_dest_physp, required_pkey)) {
+		    (p_src_physp, p_dest_physp, required_pkey,
+		     sa->p_subn->opt.allow_both_pkeys)) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4518: "
-				"Ports do not share specified PKey 0x%04x\n"
-				"\t\tsrc %" PRIx64 " dst %" PRIx64 "\n",
-				cl_ntoh16(required_pkey),
+				"Ports src 0x%016"PRIx64" (%s port %d) "
+				"and dst 0x%016"PRIx64" (%s port %d) "
+				"do not share the specified PKey 0x%04x\n",
 				cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),
+				p_src_physp->p_node->print_desc,
+				p_src_physp->port_num,
 				cl_ntoh64(osm_physp_get_port_guid
-					  (p_dest_physp)));
+					  (p_dest_physp)),
+				p_dest_physp->p_node->print_desc,
+				p_dest_physp->port_num,
+				cl_ntoh16(required_pkey));
 			status = IB_NOT_FOUND;
 			goto Exit;
 		}
 		if (p_qos_level && p_qos_level->pkey_range_len &&
 		    !osm_qos_level_has_pkey(p_qos_level, required_pkey)) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 451C: "
-				"Ports do not share PKeys defined by QoS level\n");
+				"Ports src 0x%016"PRIx64" (%s port %d) "
+				"and dst 0x%016"PRIx64" (%s port %d) "
+				"do not share specified PKey (0x%04x) as "
+				"defined by QoS level \"%s\"\n",
+				cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),
+				p_src_physp->p_node->print_desc,
+				p_src_physp->port_num,
+				cl_ntoh64(osm_physp_get_port_guid
+					  (p_dest_physp)),
+				p_dest_physp->p_node->print_desc,
+				p_dest_physp->port_num,
+				cl_ntoh16(required_pkey),
+				p_qos_level->name);
 			status = IB_NOT_FOUND;
 			goto Exit;
 		}
@@ -613,10 +677,22 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 		 */
 		required_pkey = osm_qos_level_get_shared_pkey(p_qos_level,
 							      p_src_physp,
-							      p_dest_physp);
+							      p_dest_physp,
+							      sa->p_subn->opt.allow_both_pkeys);
 		if (!required_pkey) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 451D: "
-				"Ports do not share PKeys defined by QoS level\n");
+				"Ports src 0x%016"PRIx64" (%s port %d) "
+				"and dst 0x%016"PRIx64" (%s port %d) "
+				"do not share a PKey as defined by QoS "
+				"level \"%s\"\n",
+				cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),
+				p_src_physp->p_node->print_desc,
+				p_src_physp->port_num,
+				cl_ntoh64(osm_physp_get_port_guid
+					  (p_dest_physp)),
+				p_dest_physp->p_node->print_desc,
+				p_dest_physp->port_num,
+				p_qos_level->name);
 			status = IB_NOT_FOUND;
 			goto Exit;
 		}
@@ -627,14 +703,20 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 		 * Just get any shared pkey.
 		 */
 		required_pkey =
-		    osm_physp_find_common_pkey(p_src_physp, p_dest_physp);
+		    osm_physp_find_common_pkey(p_src_physp, p_dest_physp,
+					       sa->p_subn->opt.allow_both_pkeys);
 		if (!required_pkey) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4519: "
-				"Ports do not have any shared PKeys\n"
-				"\t\tsrc %" PRIx64 " dst %" PRIx64 "\n",
-				cl_ntoh64(osm_physp_get_port_guid(p_physp)),
+				"Ports src 0x%016"PRIx64" (%s port %d) "
+				"and dst 0x%016"PRIx64" (%s port %d) "
+				"do not have any shared PKeys\n",
+				cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),
+				p_src_physp->p_node->print_desc,
+				p_src_physp->port_num,
 				cl_ntoh64(osm_physp_get_port_guid
-					  (p_dest_physp)));
+					  (p_dest_physp)),
+				p_dest_physp->p_node->print_desc,
+				p_dest_physp->port_num);
 			status = IB_NOT_FOUND;
 			goto Exit;
 		}
@@ -663,9 +745,15 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 		if (p_qos_level && p_qos_level->sl_set &&
 		    p_qos_level->sl != required_sl) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 451E: "
-				"QoS constaraints: required MultiPathRecord SL (%u) "
-				"doesn't match QoS policy SL (%u)\n",
-				required_sl, p_qos_level->sl);
+				"QoS constraints: required MultiPathRecord SL "
+				"(%u) doesn't match QoS policy \"%s\" SL (%u) "
+				"[%s port %d <-> %s port %d]\n", required_sl,
+				p_qos_level->name,
+				p_qos_level->sl,
+				p_src_alias_guid->p_base_port->p_node->print_desc,
+				p_src_alias_guid->p_base_port->p_physp->port_num,
+				p_dest_alias_guid->p_base_port->p_node->print_desc,
+				p_dest_alias_guid->p_base_port->p_physp->port_num);
 			status = IB_NOT_FOUND;
 			goto Exit;
 		}
@@ -695,8 +783,14 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 			/* this may be possible when pkey tables are created somehow in
 			   previous runs or things are going wrong here */
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 451A: "
-				"No partition found for PKey 0x%04x - using default SL %d\n",
-				cl_ntoh16(required_pkey), required_sl);
+				"No partition found for PKey 0x%04x - "
+				"using default SL %d "
+				"[%s port %d <-> %s port %d]\n",
+				cl_ntoh16(required_pkey), required_sl,
+				p_src_alias_guid->p_base_port->p_node->print_desc,
+				p_src_alias_guid->p_base_port->p_physp->port_num,
+				p_dest_alias_guid->p_base_port->p_node->print_desc,
+				p_dest_alias_guid->p_base_port->p_physp->port_num);
 		} else
 			required_sl = p_prtn->sl;
 
@@ -714,7 +808,13 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 
 	if (sa->p_subn->opt.qos && !(valid_sl_mask & (1 << required_sl))) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 451F: "
-			"Selected SL (%u) leads to VL15\n", required_sl);
+			"Selected SL (%u) leads to VL15 "
+			"[%s port %d <-> %s port %d]\n",
+			required_sl,
+			p_src_alias_guid->p_base_port->p_node->print_desc,
+			p_src_alias_guid->p_base_port->p_physp->port_num,
+			p_dest_alias_guid->p_base_port->p_node->print_desc,
+			p_dest_alias_guid->p_base_port->p_physp->port_num);
 		status = IB_NOT_FOUND;
 		goto Exit;
 	}
@@ -738,28 +838,23 @@ __osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_mpr_rcv_build_pr(IN osm_sa_t * sa,
-		       IN const osm_port_t * const p_src_port,
-		       IN const osm_port_t * const p_dest_port,
-		       IN const uint16_t src_lid_ho,
-		       IN const uint16_t dest_lid_ho,
-		       IN const uint8_t preference,
-		       IN const osm_path_parms_t * const p_parms,
-		       OUT ib_path_rec_t * const p_pr)
+static void mpr_rcv_build_pr(IN osm_sa_t * sa,
+			     IN const osm_alias_guid_t * p_src_alias_guid,
+			     IN const osm_alias_guid_t * p_dest_alias_guid,
+			     IN uint16_t src_lid_ho, IN uint16_t dest_lid_ho,
+			     IN uint8_t preference,
+			     IN const osm_path_parms_t * p_parms,
+			     OUT ib_path_rec_t * p_pr)
 {
-	const osm_physp_t *p_src_physp;
-	const osm_physp_t *p_dest_physp;
+	const osm_physp_t *p_src_physp, *p_dest_physp;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	p_src_physp = p_src_port->p_physp;
-	p_dest_physp = p_dest_port->p_physp;
+	p_src_physp = p_src_alias_guid->p_base_port->p_physp;
+	p_dest_physp = p_dest_alias_guid->p_base_port->p_physp;
 
 	p_pr->dgid.unicast.prefix = osm_physp_get_subnet_prefix(p_dest_physp);
 	p_pr->dgid.unicast.interface_id = osm_physp_get_port_guid(p_dest_physp);
@@ -780,7 +875,7 @@ __osm_mpr_rcv_build_pr(IN osm_sa_t * sa,
 
 	/* According to 1.2 spec definition Table 205 PacketLifeTime description,
 	   for loopback paths, packetLifeTime shall be zero. */
-	if (p_src_port == p_dest_port)
+	if (p_src_alias_guid->p_base_port == p_dest_alias_guid->p_base_port)
 		p_pr->pkt_life = 0x80;	/* loopback */
 	else
 		p_pr->pkt_life = (uint8_t) (p_parms->pkt_life | 0x80);
@@ -794,17 +889,17 @@ __osm_mpr_rcv_build_pr(IN osm_sa_t * sa,
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static osm_mpr_item_t *
-__osm_mpr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
-				IN const ib_multipath_rec_t * const p_mpr,
-				IN const osm_port_t * const p_src_port,
-				IN const osm_port_t * const p_dest_port,
-				IN const uint16_t src_lid_ho,
-				IN const uint16_t dest_lid_ho,
-				IN const ib_net64_t comp_mask,
-				IN const uint8_t preference)
+static osm_mpr_item_t *mpr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
+						 IN const ib_multipath_rec_t *
+						 p_mpr,
+						 IN const osm_alias_guid_t *
+						 p_src_alias_guid,
+						 IN const osm_alias_guid_t *
+						 p_dest_alias_guid,
+						 IN const uint16_t src_lid_ho,
+						 IN const uint16_t dest_lid_ho,
+						 IN const ib_net64_t comp_mask,
+						 IN const uint8_t preference)
 {
 	osm_path_parms_t path_parms;
 	osm_path_parms_t rev_path_parms;
@@ -824,9 +919,9 @@ __osm_mpr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 	}
 	memset(p_pr_item, 0, sizeof(*p_pr_item));
 
-	status = __osm_mpr_rcv_get_path_parms(sa, p_mpr, p_src_port,
-					      p_dest_port, dest_lid_ho,
-					      comp_mask, &path_parms);
+	status = mpr_rcv_get_path_parms(sa, p_mpr, p_src_alias_guid,
+					p_dest_alias_guid, dest_lid_ho,
+					comp_mask, &path_parms);
 
 	if (status != IB_SUCCESS) {
 		free(p_pr_item);
@@ -835,10 +930,9 @@ __osm_mpr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 	}
 
 	/* now try the reversible path */
-	rev_path_status =
-	    __osm_mpr_rcv_get_path_parms(sa, p_mpr, p_dest_port, p_src_port,
-					 src_lid_ho, comp_mask,
-					 &rev_path_parms);
+	rev_path_status = mpr_rcv_get_path_parms(sa, p_mpr, p_dest_alias_guid,
+						 p_src_alias_guid, src_lid_ho,
+						 comp_mask, &rev_path_parms);
 	path_parms.reversible = (rev_path_status == IB_SUCCESS);
 
 	/* did we get a Reversible Path compmask ? */
@@ -858,30 +952,27 @@ __osm_mpr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 		}
 	}
 
-	p_pr_item->p_src_port = p_src_port;
-	p_pr_item->p_dest_port = p_dest_port;
+	p_pr_item->p_src_port = p_src_alias_guid->p_base_port;
+	p_pr_item->p_dest_port = p_dest_alias_guid->p_base_port;
 	p_pr_item->hops = path_parms.hops;
 
-	__osm_mpr_rcv_build_pr(sa, p_src_port, p_dest_port, src_lid_ho,
-			       dest_lid_ho, preference, &path_parms,
-			       &p_pr_item->path_rec);
+	mpr_rcv_build_pr(sa, p_src_alias_guid, p_dest_alias_guid, src_lid_ho,
+			 dest_lid_ho, preference, &path_parms,
+			 &p_pr_item->path_rec);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (p_pr_item);
+	return p_pr_item;
 }
 
-/**********************************************************************
- **********************************************************************/
-static uint32_t
-__osm_mpr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
-				  IN const ib_multipath_rec_t * const p_mpr,
-				  IN const osm_port_t * const p_req_port,
-				  IN const osm_port_t * const p_src_port,
-				  IN const osm_port_t * const p_dest_port,
-				  IN const uint32_t rem_paths,
-				  IN const ib_net64_t comp_mask,
-				  IN cl_qlist_t * const p_list)
+static uint32_t mpr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
+					    IN const ib_multipath_rec_t * p_mpr,
+					    IN const osm_port_t * p_req_port,
+					    IN const osm_alias_guid_t * p_src_alias_guid,
+					    IN const osm_alias_guid_t * p_dest_alias_guid,
+					    IN const uint32_t rem_paths,
+					    IN const ib_net64_t comp_mask,
+					    IN cl_qlist_t * p_list)
 {
 	osm_mpr_item_t *p_pr_item;
 	uint16_t src_lid_min_ho;
@@ -892,23 +983,26 @@ __osm_mpr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
 	uint16_t dest_lid_ho;
 	uint32_t path_num = 0;
 	uint8_t preference;
-	uintn_t src_offset;
-	uintn_t dest_offset;
+	unsigned src_offset, dest_offset;
 
 	OSM_LOG_ENTER(sa->p_log);
 
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 		"Src port 0x%016" PRIx64 ", Dst port 0x%016" PRIx64 "\n",
-		cl_ntoh64(osm_port_get_guid(p_src_port)),
-		cl_ntoh64(osm_port_get_guid(p_dest_port)));
+		cl_ntoh64(p_src_alias_guid->alias_guid),
+		cl_ntoh64(p_dest_alias_guid->alias_guid));
 
 	/* Check that the req_port, src_port and dest_port all share a
 	   pkey. The check is done on the default physical port of the ports. */
-	if (osm_port_share_pkey(sa->p_log, p_req_port, p_src_port) == FALSE
+	if (osm_port_share_pkey(sa->p_log, p_req_port,
+				p_src_alias_guid->p_base_port,
+				sa->p_subn->opt.allow_both_pkeys) == FALSE
 	    || osm_port_share_pkey(sa->p_log, p_req_port,
-				   p_dest_port) == FALSE
-	    || osm_port_share_pkey(sa->p_log, p_src_port,
-				   p_dest_port) == FALSE)
+				   p_dest_alias_guid->p_base_port,
+				   sa->p_subn->opt.allow_both_pkeys) == FALSE
+	    || osm_port_share_pkey(sa->p_log, p_src_alias_guid->p_base_port,
+				   p_dest_alias_guid->p_base_port,
+				   sa->p_subn->opt.allow_both_pkeys) == FALSE)
 		/* One of the pairs doesn't share a pkey so the path is disqualified. */
 		goto Exit;
 
@@ -957,9 +1051,10 @@ __osm_mpr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
 	   redundancy, but I'm not going to bother with that now.
 	 */
 
-	osm_port_get_lid_range_ho(p_src_port, &src_lid_min_ho, &src_lid_max_ho);
-	osm_port_get_lid_range_ho(p_dest_port, &dest_lid_min_ho,
-				  &dest_lid_max_ho);
+	osm_port_get_lid_range_ho(p_src_alias_guid->p_base_port,
+				  &src_lid_min_ho, &src_lid_max_ho);
+	osm_port_get_lid_range_ho(p_dest_alias_guid->p_base_port,
+				  &dest_lid_min_ho, &dest_lid_max_ho);
 
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Src LID [%u-%u], Dest LID [%u-%u]\n",
 		src_lid_min_ho, src_lid_max_ho,
@@ -977,13 +1072,11 @@ __osm_mpr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
 		/*
 		   These paths are "fully redundant"
 		 */
-		p_pr_item = __osm_mpr_rcv_get_lid_pair_path(sa, p_mpr,
-							    p_src_port,
-							    p_dest_port,
-							    src_lid_ho,
-							    dest_lid_ho,
-							    comp_mask,
-							    preference);
+		p_pr_item = mpr_rcv_get_lid_pair_path(sa, p_mpr,
+						      p_src_alias_guid,
+						      p_dest_alias_guid,
+						      src_lid_ho, dest_lid_ho,
+						      comp_mask, preference);
 
 		if (p_pr_item) {
 			cl_qlist_insert_tail(p_list, &p_pr_item->list_item);
@@ -1043,13 +1136,11 @@ __osm_mpr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
 		if (src_offset == dest_offset)
 			continue;	/* already reported */
 
-		p_pr_item = __osm_mpr_rcv_get_lid_pair_path(sa, p_mpr,
-							    p_src_port,
-							    p_dest_port,
-							    src_lid_ho,
-							    dest_lid_ho,
-							    comp_mask,
-							    preference);
+		p_pr_item = mpr_rcv_get_lid_pair_path(sa, p_mpr,
+						      p_src_alias_guid,
+						      p_dest_alias_guid,
+						      src_lid_ho, dest_lid_ho,
+						      comp_mask, preference);
 
 		if (p_pr_item) {
 			cl_qlist_insert_tail(p_list, &p_pr_item->list_item);
@@ -1065,16 +1156,18 @@ Exit:
 #undef min
 #define min(x,y)	(((x) < (y)) ? (x) : (y))
 
-/**********************************************************************
- **********************************************************************/
-static osm_mpr_item_t *
-__osm_mpr_rcv_get_apm_port_pair_paths(IN osm_sa_t * sa,
-				      IN const ib_multipath_rec_t * const p_mpr,
-				      IN const osm_port_t * const p_src_port,
-				      IN const osm_port_t * const p_dest_port,
-				      IN int base_offs,
-				      IN const ib_net64_t comp_mask,
-				      IN cl_qlist_t * const p_list)
+static osm_mpr_item_t *mpr_rcv_get_apm_port_pair_paths(IN osm_sa_t * sa,
+						       IN const
+						       ib_multipath_rec_t *
+						       p_mpr,
+						       IN const osm_alias_guid_t *
+						       p_src_alias_guid,
+						       IN const osm_alias_guid_t *
+						       p_dest_alias_guid,
+						       IN int base_offs,
+						       IN const ib_net64_t
+						       comp_mask,
+						       IN cl_qlist_t * p_list)
 {
 	osm_mpr_item_t *p_pr_item = 0;
 	uint16_t src_lid_min_ho;
@@ -1083,19 +1176,21 @@ __osm_mpr_rcv_get_apm_port_pair_paths(IN osm_sa_t * sa,
 	uint16_t dest_lid_max_ho;
 	uint16_t src_lid_ho;
 	uint16_t dest_lid_ho;
-	uintn_t iterations;
+	unsigned iterations;
 	int src_lids, dest_lids;
 
 	OSM_LOG_ENTER(sa->p_log);
 
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Src port 0x%016" PRIx64 ", "
 		"Dst port 0x%016" PRIx64 ", base offs %d\n",
-		cl_ntoh64(osm_port_get_guid(p_src_port)),
-		cl_ntoh64(osm_port_get_guid(p_dest_port)), base_offs);
+		cl_ntoh64(p_src_alias_guid->alias_guid),
+		cl_ntoh64(p_dest_alias_guid->alias_guid),
+		base_offs);
 
-	osm_port_get_lid_range_ho(p_src_port, &src_lid_min_ho, &src_lid_max_ho);
-	osm_port_get_lid_range_ho(p_dest_port, &dest_lid_min_ho,
-				  &dest_lid_max_ho);
+	osm_port_get_lid_range_ho(p_src_alias_guid->p_base_port,
+				  &src_lid_min_ho, &src_lid_max_ho);
+	osm_port_get_lid_range_ho(p_dest_alias_guid->p_base_port,
+				  &dest_lid_min_ho, &dest_lid_max_ho);
 
 	src_lid_ho = src_lid_min_ho;
 	dest_lid_ho = dest_lid_min_ho;
@@ -1118,12 +1213,11 @@ __osm_mpr_rcv_get_apm_port_pair_paths(IN osm_sa_t * sa,
 		/*
 		   These paths are "fully redundant"
 		 */
-		p_pr_item = __osm_mpr_rcv_get_lid_pair_path(sa, p_mpr,
-							    p_src_port,
-							    p_dest_port,
-							    src_lid_ho,
-							    dest_lid_ho,
-							    comp_mask, 0);
+		p_pr_item = mpr_rcv_get_lid_pair_path(sa, p_mpr,
+						      p_src_alias_guid,
+						      p_dest_alias_guid,
+						      src_lid_ho, dest_lid_ho,
+						      comp_mask, 0);
 
 		if (p_pr_item) {
 			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
@@ -1143,14 +1237,11 @@ __osm_mpr_rcv_get_apm_port_pair_paths(IN osm_sa_t * sa,
 	return p_pr_item;
 }
 
-/**********************************************************************
- **********************************************************************/
-static ib_net16_t
-__osm_mpr_rcv_get_gids(IN osm_sa_t * sa,
-		       IN const ib_gid_t * gids,
-		       IN int ngids, IN int is_sgid, OUT osm_port_t ** pp_port)
+static ib_net16_t mpr_rcv_get_gids(IN osm_sa_t * sa, IN const ib_gid_t * gids,
+				   IN int ngids, IN int is_sgid,
+				   OUT osm_alias_guid_t ** pp_alias_guid)
 {
-	osm_port_t *p_port;
+	osm_alias_guid_t *p_alias_guid;
 	ib_net16_t ib_status = IB_SUCCESS;
 	int i;
 
@@ -1177,10 +1268,10 @@ __osm_mpr_rcv_get_gids(IN osm_sa_t * sa,
 			}
 		}
 
-		p_port =
-		    osm_get_port_by_guid(sa->p_subn,
-					 gids->unicast.interface_id);
-		if (!p_port) {
+		p_alias_guid =
+		    osm_get_alias_guid_by_guid(sa->p_subn,
+					       gids->unicast.interface_id);
+		if (!p_alias_guid) {
 			/*
 			   This 'error' is the client's fault (bad gid) so
 			   don't enter it as an error in our own log.
@@ -1194,7 +1285,7 @@ __osm_mpr_rcv_get_gids(IN osm_sa_t * sa,
 			goto Exit;
 		}
 
-		pp_port[i] = p_port;
+		pp_alias_guid[i] = p_alias_guid;
 	}
 
 Exit:
@@ -1203,13 +1294,10 @@ Exit:
 	return ib_status;
 }
 
-/**********************************************************************
- **********************************************************************/
-static ib_net16_t
-__osm_mpr_rcv_get_end_points(IN osm_sa_t * sa,
-			     IN const osm_madw_t * const p_madw,
-			     OUT osm_port_t ** pp_ports,
-			     OUT int *nsrc, OUT int *ndest)
+static ib_net16_t mpr_rcv_get_end_points(IN osm_sa_t * sa,
+					 IN const osm_madw_t * p_madw,
+					 OUT osm_alias_guid_t ** pp_alias_guids,
+					 OUT int *nsrc, OUT int *ndest)
 {
 	const ib_multipath_rec_t *p_mpr;
 	const ib_sa_mad_t *p_sa_mad;
@@ -1239,8 +1327,7 @@ __osm_mpr_rcv_get_end_points(IN osm_sa_t * sa,
 		*nsrc = p_mpr->sgid_count;
 		if (*nsrc > IB_MULTIPATH_MAX_GIDS)
 			*nsrc = IB_MULTIPATH_MAX_GIDS;
-		sa_status =
-		    __osm_mpr_rcv_get_gids(sa, gids, *nsrc, 1, pp_ports);
+		sa_status = mpr_rcv_get_gids(sa, gids, *nsrc, 1, pp_alias_guids);
 		if (sa_status != IB_SUCCESS)
 			goto Exit;
 	}
@@ -1250,29 +1337,26 @@ __osm_mpr_rcv_get_end_points(IN osm_sa_t * sa,
 		if (*ndest + *nsrc > IB_MULTIPATH_MAX_GIDS)
 			*ndest = IB_MULTIPATH_MAX_GIDS - *nsrc;
 		sa_status =
-		    __osm_mpr_rcv_get_gids(sa, gids + *nsrc, *ndest, 0,
-					   pp_ports + *nsrc);
+		    mpr_rcv_get_gids(sa, gids + *nsrc, *ndest, 0,
+				     pp_alias_guids + *nsrc);
 	}
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (sa_status);
+	return sa_status;
 }
 
-#define __hash_lids(a, b, lmc)	\
+#define hash_lids(a, b, lmc)	\
 	(((((a) >> (lmc)) << 4) | ((b) >> (lmc))) % 103)
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_mpr_rcv_get_apm_paths(IN osm_sa_t * sa,
-			    IN const ib_multipath_rec_t * const p_mpr,
-			    IN const osm_port_t * const p_req_port,
-			    IN osm_port_t ** _pp_ports,
-			    IN const ib_net64_t comp_mask,
-			    IN cl_qlist_t * const p_list)
+static void mpr_rcv_get_apm_paths(IN osm_sa_t * sa,
+				  IN const ib_multipath_rec_t * p_mpr,
+				  IN const osm_port_t * p_req_port,
+				  IN osm_alias_guid_t ** _pp_alias_guids,
+				  IN const ib_net64_t comp_mask,
+				  IN cl_qlist_t * p_list)
 {
-	osm_port_t *pp_ports[4];
+	osm_alias_guid_t *pp_alias_guids[4];
 	osm_mpr_item_t *matrix[2][2];
 	int base_offs, src_lid_ho, dest_lid_ho;
 	int sumA, sumB, minA, minB;
@@ -1287,50 +1371,52 @@ __osm_mpr_rcv_get_apm_paths(IN osm_sa_t * sa,
 	 *    2. keep consistent paths no matter of direction and order of ports
 	 *    3. distibute the lid offsets to balance the load
 	 * So, we sort the ports (within the srcs, and within the dests),
-	 * hash the lids of S0, D0 (after the sort), and call __osm_mpr_rcv_get_apm_port_pair_paths
+	 * hash the lids of S0, D0 (after the sort), and call mpr_rcv_get_apm_port_pair_paths
 	 * with base_lid for S0, D0 and base_lid + 1 for S1, D1. This way we will get
-	 * always the same offsets - order indepentent, and make sure different spines are used.
+	 * always the same offsets - order independent, and make sure different spines are used.
 	 * Note that the diagonals on a Clos have the same number of hops, so it doesn't
 	 * really matter which diagonal we use.
 	 */
-	if (_pp_ports[0]->guid < _pp_ports[1]->guid) {
-		pp_ports[0] = _pp_ports[0];
-		pp_ports[1] = _pp_ports[1];
+	if (_pp_alias_guids[0]->p_base_port->guid <
+	    _pp_alias_guids[1]->p_base_port->guid) {
+		pp_alias_guids[0] = _pp_alias_guids[0];
+		pp_alias_guids[1] = _pp_alias_guids[1];
 	} else {
-		pp_ports[0] = _pp_ports[1];
-		pp_ports[1] = _pp_ports[0];
+		pp_alias_guids[0] = _pp_alias_guids[1];
+		pp_alias_guids[1] = _pp_alias_guids[0];
 	}
-	if (_pp_ports[2]->guid < _pp_ports[3]->guid) {
-		pp_ports[2] = _pp_ports[2];
-		pp_ports[3] = _pp_ports[3];
+	if (_pp_alias_guids[2]->p_base_port->guid <
+	    _pp_alias_guids[3]->p_base_port->guid) {
+		pp_alias_guids[2] = _pp_alias_guids[2];
+		pp_alias_guids[3] = _pp_alias_guids[3];
 	} else {
-		pp_ports[2] = _pp_ports[3];
-		pp_ports[3] = _pp_ports[2];
+		pp_alias_guids[2] = _pp_alias_guids[3];
+		pp_alias_guids[3] = _pp_alias_guids[2];
 	}
 
-	src_lid_ho = osm_port_get_base_lid(pp_ports[0]);
-	dest_lid_ho = osm_port_get_base_lid(pp_ports[2]);
+	src_lid_ho = osm_port_get_base_lid(pp_alias_guids[0]->p_base_port);
+	dest_lid_ho = osm_port_get_base_lid(pp_alias_guids[2]->p_base_port);
 
 	base_offs = src_lid_ho < dest_lid_ho ?
-	    __hash_lids(src_lid_ho, dest_lid_ho, sa->p_subn->opt.lmc) :
-	    __hash_lids(dest_lid_ho, src_lid_ho, sa->p_subn->opt.lmc);
+	    hash_lids(src_lid_ho, dest_lid_ho, sa->p_subn->opt.lmc) :
+	    hash_lids(dest_lid_ho, src_lid_ho, sa->p_subn->opt.lmc);
 
 	matrix[0][0] =
-	    __osm_mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_ports[0],
-						  pp_ports[2], base_offs,
-						  comp_mask, p_list);
+	    mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_alias_guids[0],
+					    pp_alias_guids[2], base_offs,
+					    comp_mask, p_list);
 	matrix[0][1] =
-	    __osm_mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_ports[0],
-						  pp_ports[3], base_offs,
-						  comp_mask, p_list);
+	    mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_alias_guids[0],
+					    pp_alias_guids[3], base_offs,
+					    comp_mask, p_list);
 	matrix[1][0] =
-	    __osm_mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_ports[1],
-						  pp_ports[2], base_offs + 1,
-						  comp_mask, p_list);
+	    mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_alias_guids[1],
+					    pp_alias_guids[2], base_offs + 1,
+					    comp_mask, p_list);
 	matrix[1][1] =
-	    __osm_mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_ports[1],
-						  pp_ports[3], base_offs + 1,
-						  comp_mask, p_list);
+	    mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_alias_guids[1],
+					    pp_alias_guids[3], base_offs + 1,
+					    comp_mask, p_list);
 
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "APM matrix:\n"
 		"\t{0,0} 0x%X->0x%X (%d)\t| {0,1} 0x%X->0x%X (%d)\n"
@@ -1382,20 +1468,16 @@ __osm_mpr_rcv_get_apm_paths(IN osm_sa_t * sa,
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_mpr_rcv_process_pairs(IN osm_sa_t * sa,
-			    IN const ib_multipath_rec_t * const p_mpr,
-			    IN osm_port_t * const p_req_port,
-			    IN osm_port_t ** pp_ports,
-			    IN const int nsrc,
-			    IN const int ndest,
-			    IN const ib_net64_t comp_mask,
-			    IN cl_qlist_t * const p_list)
+static void mpr_rcv_process_pairs(IN osm_sa_t * sa,
+				  IN const ib_multipath_rec_t * p_mpr,
+				  IN osm_port_t * p_req_port,
+				  IN osm_alias_guid_t ** pp_alias_guids,
+				  IN const int nsrc, IN int ndest,
+				  IN ib_net64_t comp_mask,
+				  IN cl_qlist_t * p_list)
 {
-	osm_port_t **pp_src_port, **pp_es;
-	osm_port_t **pp_dest_port, **pp_ed;
+	osm_alias_guid_t **pp_src_alias_guid, **pp_es;
+	osm_alias_guid_t **pp_dest_alias_guid, **pp_ed;
 	uint32_t max_paths, num_paths, total_paths = 0;
 
 	OSM_LOG_ENTER(sa->p_log);
@@ -1405,19 +1487,16 @@ __osm_mpr_rcv_process_pairs(IN osm_sa_t * sa,
 	else
 		max_paths = OSM_SA_MPR_MAX_NUM_PATH;
 
-	for (pp_src_port = pp_ports, pp_es = pp_ports + nsrc;
-	     pp_src_port < pp_es; pp_src_port++) {
-		for (pp_dest_port = pp_es, pp_ed = pp_es + ndest;
-		     pp_dest_port < pp_ed; pp_dest_port++) {
+	for (pp_src_alias_guid = pp_alias_guids, pp_es = pp_alias_guids + nsrc;
+	     pp_src_alias_guid < pp_es; pp_src_alias_guid++) {
+		for (pp_dest_alias_guid = pp_es, pp_ed = pp_es + ndest;
+		     pp_dest_alias_guid < pp_ed; pp_dest_alias_guid++) {
 			num_paths =
-			    __osm_mpr_rcv_get_port_pair_paths(sa, p_mpr,
-							      p_req_port,
-							      *pp_src_port,
-							      *pp_dest_port,
-							      max_paths -
-							      total_paths,
-							      comp_mask,
-							      p_list);
+			    mpr_rcv_get_port_pair_paths(sa, p_mpr, p_req_port,
+							*pp_src_alias_guid,
+							*pp_dest_alias_guid,
+							max_paths - total_paths,
+							comp_mask, p_list);
 			total_paths += num_paths;
 			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 				"%d paths %d total paths %d max paths\n",
@@ -1432,8 +1511,6 @@ Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_mpr_rcv_process(IN void *context, IN void *data)
 {
 	osm_sa_t *sa = context;
@@ -1441,10 +1518,11 @@ void osm_mpr_rcv_process(IN void *context, IN void *data)
 	const ib_multipath_rec_t *p_mpr;
 	ib_sa_mad_t *p_sa_mad;
 	osm_port_t *requester_port;
-	osm_port_t *pp_ports[IB_MULTIPATH_MAX_GIDS];
+	osm_alias_guid_t *pp_alias_guids[IB_MULTIPATH_MAX_GIDS];
 	cl_qlist_t pr_list;
 	ib_net16_t sa_status;
 	int nsrc, ndest;
+	uint8_t rate, mtu;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -1471,7 +1549,7 @@ void osm_mpr_rcv_process(IN void *context, IN void *data)
 		goto Exit;
 	}
 
-	/* update the requester physical port. */
+	/* update the requester physical port */
 	requester_port = osm_get_port_by_mad_addr(sa->p_log, sa->p_subn,
 						  osm_madw_get_mad_addr_ptr
 						  (p_madw));
@@ -1481,8 +1559,33 @@ void osm_mpr_rcv_process(IN void *context, IN void *data)
 		goto Exit;
 	}
 
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
-		osm_dump_multipath_record(sa->p_log, p_mpr, OSM_LOG_DEBUG);
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Requester port GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_port_get_guid(requester_port)));
+		osm_dump_multipath_record_v2(sa->p_log, p_mpr, FILE_ID, OSM_LOG_DEBUG);
+	}
+
+	/* Validatg rate if supplied */
+	if ((p_sa_mad->comp_mask & IB_MPR_COMPMASK_RATESELEC) &&
+	    (p_sa_mad->comp_mask & IB_MPR_COMPMASK_RATE)) {
+		rate = ib_multipath_rec_rate(p_mpr);
+		if (!ib_rate_is_valid(rate)) {
+			osm_sa_send_error(sa, p_madw,
+					  IB_SA_MAD_STATUS_REQ_INVALID);
+			goto Exit;
+		}
+	}
+	/* Validate MTU if supplied */
+	if ((p_sa_mad->comp_mask & IB_MPR_COMPMASK_MTUSELEC) &&
+	    (p_sa_mad->comp_mask & IB_MPR_COMPMASK_MTU)) {
+		mtu = ib_multipath_rec_mtu(p_mpr);
+		if (!ib_mtu_is_valid(mtu)) {
+			osm_sa_send_error(sa, p_madw,
+					  IB_SA_MAD_STATUS_REQ_INVALID);
+			goto Exit;
+		}
+	}
 
 	cl_qlist_init(&pr_list);
 
@@ -1492,14 +1595,14 @@ void osm_mpr_rcv_process(IN void *context, IN void *data)
 	 */
 	cl_plock_acquire(sa->p_lock);
 
-	sa_status = __osm_mpr_rcv_get_end_points(sa, p_madw, pp_ports,
-						 &nsrc, &ndest);
+	sa_status = mpr_rcv_get_end_points(sa, p_madw, pp_alias_guids,
+					   &nsrc, &ndest);
 
 	if (sa_status != IB_SA_MAD_STATUS_SUCCESS || !nsrc || !ndest) {
 		if (sa_status == IB_SA_MAD_STATUS_SUCCESS && (!nsrc || !ndest))
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4512: "
-				"__osm_mpr_rcv_get_end_points failed, not enough GIDs "
-				"(nsrc %d ndest %d)\n", nsrc, ndest);
+				"mpr_rcv_get_end_points failed, # GIDs found; "
+				"src %d; dest %d)\n", nsrc, ndest);
 		cl_plock_release(sa->p_lock);
 		if (sa_status == IB_SA_MAD_STATUS_SUCCESS)
 			osm_sa_send_error(sa, p_madw,
@@ -1511,13 +1614,12 @@ void osm_mpr_rcv_process(IN void *context, IN void *data)
 
 	/* APM request */
 	if (nsrc == 2 && ndest == 2 && (p_mpr->num_path & 0x7F) == 2)
-		__osm_mpr_rcv_get_apm_paths(sa, p_mpr, requester_port,
-					    pp_ports, p_sa_mad->comp_mask,
-					    &pr_list);
+		mpr_rcv_get_apm_paths(sa, p_mpr, requester_port, pp_alias_guids,
+				      p_sa_mad->comp_mask, &pr_list);
 	else
-		__osm_mpr_rcv_process_pairs(sa, p_mpr, requester_port,
-					    pp_ports, nsrc, ndest,
-					    p_sa_mad->comp_mask, &pr_list);
+		mpr_rcv_process_pairs(sa, p_mpr, requester_port, pp_alias_guids,
+				      nsrc, ndest, p_sa_mad->comp_mask,
+				      &pr_list);
 
 	cl_plock_release(sa->p_lock);
 
diff --git a/opensm/osm_sa_node_record.c b/opensm/osm_sa_node_record.c
index 4df2c91..c7a079e 100644
--- a/opensm/osm_sa_node_record.c
+++ b/opensm/osm_sa_node_record.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -48,6 +48,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_NODE_RECORD_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_helper.h>
@@ -67,13 +69,11 @@ typedef struct osm_nr_search_ctxt {
 	const osm_physp_t *p_req_physp;
 } osm_nr_search_ctxt_t;
 
-/**********************************************************************
- **********************************************************************/
-static ib_api_status_t
-__osm_nr_rcv_new_nr(IN osm_sa_t * sa,
-		    IN const osm_node_t * const p_node,
-		    IN cl_qlist_t * const p_list,
-		    IN ib_net64_t const port_guid, IN ib_net16_t const lid)
+static ib_api_status_t nr_rcv_new_nr(osm_sa_t * sa,
+				     IN const osm_node_t * p_node,
+				     IN cl_qlist_t * p_list,
+				     IN ib_net64_t port_guid, IN ib_net16_t lid,
+	                             IN unsigned int port_num)
 {
 	osm_nr_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
@@ -100,24 +100,25 @@ __osm_nr_rcv_new_nr(IN osm_sa_t * sa,
 
 	p_rec_item->rec.node_info = p_node->node_info;
 	p_rec_item->rec.node_info.port_guid = port_guid;
+	p_rec_item->rec.node_info.port_num_vendor_id =
+		(p_rec_item->rec.node_info.port_num_vendor_id & IB_NODE_INFO_VEND_ID_MASK) |
+		((port_num << IB_NODE_INFO_PORT_NUM_SHIFT) & IB_NODE_INFO_PORT_NUM_MASK);
 	memcpy(&(p_rec_item->rec.node_desc), &(p_node->node_desc),
 	       IB_NODE_DESCRIPTION_SIZE);
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_nr_rcv_create_nr(IN osm_sa_t * sa,
-		       IN osm_node_t * const p_node,
-		       IN cl_qlist_t * const p_list,
-		       IN ib_net64_t const match_port_guid,
-		       IN ib_net16_t const match_lid,
-		       IN const osm_physp_t * const p_req_physp)
+static void nr_rcv_create_nr(IN osm_sa_t * sa, IN osm_node_t * p_node,
+			     IN cl_qlist_t * p_list,
+			     IN ib_net64_t const match_port_guid,
+			     IN ib_net16_t const match_lid,
+			     IN unsigned int const match_port_num,
+			     IN const osm_physp_t * p_req_physp,
+			     IN const ib_net64_t comp_mask)
 {
 	const osm_physp_t *p_physp;
 	uint8_t port_num;
@@ -132,9 +133,8 @@ __osm_nr_rcv_create_nr(IN osm_sa_t * sa,
 	OSM_LOG_ENTER(sa->p_log);
 
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
-		"Looking for NodeRecord with LID: %u GUID:0x%016"
-		PRIx64 "\n", cl_ntoh16(match_lid),
-		cl_ntoh64(match_port_guid));
+		"Looking for NodeRecord with LID: %u GUID: 0x%016"
+		PRIx64 "\n", cl_ntoh16(match_lid), cl_ntoh64(match_port_guid));
 
 	/*
 	   For switches, do not return the NodeInfo record
@@ -152,21 +152,24 @@ __osm_nr_rcv_create_nr(IN osm_sa_t * sa,
 
 		/* Check to see if the found p_physp and the requester physp
 		   share a pkey. If not - continue */
-		if (!osm_physp_share_pkey(sa->p_log, p_physp, p_req_physp))
+		if (!osm_physp_share_pkey(sa->p_log, p_physp, p_req_physp,
+					  sa->p_subn->opt.allow_both_pkeys))
 			continue;
 
 		port_guid = osm_physp_get_port_guid(p_physp);
 
-		if (match_port_guid && (port_guid != match_port_guid))
+		if ((comp_mask & IB_NR_COMPMASK_PORTGUID)
+		    && (port_guid != match_port_guid))
 			continue;
 
 		base_lid = osm_physp_get_base_lid(p_physp);
-		base_lid_ho = cl_ntoh16(base_lid);
-		lmc = osm_physp_get_lmc(p_physp);
-		max_lid_ho = (uint16_t) (base_lid_ho + (1 << lmc) - 1);
-		match_lid_ho = cl_ntoh16(match_lid);
 
-		if (match_lid_ho) {
+		if (comp_mask & IB_NR_COMPMASK_LID) {
+			base_lid_ho = cl_ntoh16(base_lid);
+			lmc = osm_physp_get_lmc(p_physp);
+			max_lid_ho = (uint16_t) (base_lid_ho + (1 << lmc) - 1);
+			match_lid_ho = cl_ntoh16(match_lid);
+
 			/*
 			   We validate that the lid belongs to this node.
 			 */
@@ -179,32 +182,32 @@ __osm_nr_rcv_create_nr(IN osm_sa_t * sa,
 				continue;
 		}
 
-		__osm_nr_rcv_new_nr(sa, p_node, p_list, port_guid, base_lid);
+		if ((comp_mask & IB_NR_COMPMASK_PORTNUM) &&
+		    (port_num != match_port_num))
+			continue;
 
+		nr_rcv_new_nr(sa, p_node, p_list, port_guid, base_lid, port_num);
 	}
 
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_nr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item, IN void *context)
+static void nr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *context)
 {
-	const osm_nr_search_ctxt_t *const p_ctxt =
-	    (osm_nr_search_ctxt_t *) context;
-	osm_node_t *const p_node = (osm_node_t *) p_map_item;
+	const osm_nr_search_ctxt_t *p_ctxt = context;
+	osm_node_t *p_node = (osm_node_t *) p_map_item;
 	const ib_node_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;
 	osm_sa_t *sa = p_ctxt->sa;
-	ib_net64_t const comp_mask = p_ctxt->comp_mask;
+	ib_net64_t comp_mask = p_ctxt->comp_mask;
 	ib_net64_t match_port_guid = 0;
 	ib_net16_t match_lid = 0;
+	unsigned int match_port_num = 0;
 
 	OSM_LOG_ENTER(p_ctxt->sa->p_log);
 
-	osm_dump_node_info(p_ctxt->sa->p_log,
-			   &p_node->node_info, OSM_LOG_VERBOSE);
+	osm_dump_node_info_v2(p_ctxt->sa->p_log, &p_node->node_info,
+			      FILE_ID, OSM_LOG_DEBUG);
 
 	if (comp_mask & IB_NR_COMPMASK_LID)
 		match_lid = p_rcvd_rec->lid;
@@ -216,79 +219,70 @@ __osm_nr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item, IN void *context)
 			cl_ntoh64(p_rcvd_rec->node_info.node_guid),
 			cl_ntoh64(osm_node_get_node_guid(p_node)));
 
-		if ((p_node->node_info.node_guid !=
-		     p_rcvd_rec->node_info.node_guid))
+		if (p_node->node_info.node_guid !=
+		    p_rcvd_rec->node_info.node_guid)
 			goto Exit;
 	}
-	if (comp_mask & IB_NR_COMPMASK_PORTGUID) {
+
+	if (comp_mask & IB_NR_COMPMASK_PORTGUID)
 		match_port_guid = p_rcvd_rec->node_info.port_guid;
-	}
-	if (comp_mask & IB_NR_COMPMASK_SYSIMAGEGUID) {
-		if ((p_node->node_info.sys_guid !=
-		     p_rcvd_rec->node_info.sys_guid))
-			goto Exit;
-	}
-	if (comp_mask & IB_NR_COMPMASK_BASEVERSION) {
-		if ((p_node->node_info.base_version !=
-		     p_rcvd_rec->node_info.base_version))
-			goto Exit;
-	}
-	if (comp_mask & IB_NR_COMPMASK_CLASSVERSION) {
-		if ((p_node->node_info.class_version !=
-		     p_rcvd_rec->node_info.class_version))
-			goto Exit;
-	}
-	if (comp_mask & IB_NR_COMPMASK_NODETYPE) {
-		if ((p_node->node_info.node_type !=
-		     p_rcvd_rec->node_info.node_type))
-			goto Exit;
-	}
-	if (comp_mask & IB_NR_COMPMASK_NUMPORTS) {
-		if ((p_node->node_info.num_ports !=
-		     p_rcvd_rec->node_info.num_ports))
-			goto Exit;
-	}
-	if (comp_mask & IB_NR_COMPMASK_PARTCAP) {
-		if ((p_node->node_info.partition_cap !=
-		     p_rcvd_rec->node_info.partition_cap))
-			goto Exit;
-	}
-	if (comp_mask & IB_NR_COMPMASK_DEVID) {
-		if ((p_node->node_info.device_id !=
-		     p_rcvd_rec->node_info.device_id))
-			goto Exit;
-	}
-	if (comp_mask & IB_NR_COMPMASK_REV) {
-		if ((p_node->node_info.revision !=
-		     p_rcvd_rec->node_info.revision))
-			goto Exit;
-	}
-	if (comp_mask & IB_NR_COMPMASK_PORTNUM) {
-		if (ib_node_info_get_local_port_num(&p_node->node_info) !=
-		    ib_node_info_get_local_port_num(&p_rcvd_rec->node_info))
-			goto Exit;
-	}
-	if (comp_mask & IB_NR_COMPMASK_VENDID) {
-		if (ib_node_info_get_vendor_id(&p_node->node_info) !=
-		    ib_node_info_get_vendor_id(&p_rcvd_rec->node_info))
+
+	if ((comp_mask & IB_NR_COMPMASK_SYSIMAGEGUID) &&
+	    p_node->node_info.sys_guid != p_rcvd_rec->node_info.sys_guid)
 			goto Exit;
-	}
-	if (comp_mask & IB_NR_COMPMASK_NODEDESC) {
-		if (strncmp((char *)&p_node->node_desc,
-			    (char *)&p_rcvd_rec->node_desc,
-			    sizeof(ib_node_desc_t)))
+
+	if ((comp_mask & IB_NR_COMPMASK_BASEVERSION) &&
+	    p_node->node_info.base_version !=
+	    p_rcvd_rec->node_info.base_version)
 			goto Exit;
-	}
 
-	__osm_nr_rcv_create_nr(sa, p_node, p_ctxt->p_list,
-			       match_port_guid, match_lid, p_req_physp);
+	if ((comp_mask & IB_NR_COMPMASK_CLASSVERSION) &&
+	    p_node->node_info.class_version !=
+	    p_rcvd_rec->node_info.class_version)
+		goto Exit;
+
+	if ((comp_mask & IB_NR_COMPMASK_NODETYPE) &&
+	    p_node->node_info.node_type != p_rcvd_rec->node_info.node_type)
+		goto Exit;
+
+	if ((comp_mask & IB_NR_COMPMASK_NUMPORTS) &&
+	    p_node->node_info.num_ports != p_rcvd_rec->node_info.num_ports)
+		goto Exit;
+
+	if ((comp_mask & IB_NR_COMPMASK_PARTCAP) &&
+	    p_node->node_info.partition_cap !=
+	    p_rcvd_rec->node_info.partition_cap)
+		goto Exit;
+
+	if ((comp_mask & IB_NR_COMPMASK_DEVID) &&
+	    p_node->node_info.device_id != p_rcvd_rec->node_info.device_id)
+		goto Exit;
+
+	if ((comp_mask & IB_NR_COMPMASK_REV) &&
+	    p_node->node_info.revision !=
+	    p_rcvd_rec->node_info.revision)
+		goto Exit;
+
+	if (comp_mask & IB_NR_COMPMASK_PORTNUM)
+		match_port_num = ib_node_info_get_local_port_num(&p_rcvd_rec->node_info);
+
+	if ((comp_mask & IB_NR_COMPMASK_VENDID) &&
+	    ib_node_info_get_vendor_id(&p_node->node_info) !=
+	    ib_node_info_get_vendor_id(&p_rcvd_rec->node_info))
+		goto Exit;
+
+	if ((comp_mask & IB_NR_COMPMASK_NODEDESC) &&
+	    strncmp((char *)&p_node->node_desc, (char *)&p_rcvd_rec->node_desc,
+		    sizeof(ib_node_desc_t)))
+		goto Exit;
+
+	nr_rcv_create_nr(sa, p_node, p_ctxt->p_list, match_port_guid,
+			 match_lid, match_port_num, p_req_physp, comp_mask);
 
 Exit:
 	OSM_LOG_EXIT(p_ctxt->sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_nr_rcv_process(IN void *ctx, IN void *data)
 {
 	osm_sa_t *sa = ctx;
@@ -320,7 +314,7 @@ void osm_nr_rcv_process(IN void *ctx, IN void *data)
 		goto Exit;
 	}
 
-	/* update the requester physical port. */
+	/* update the requester physical port */
 	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
@@ -330,8 +324,12 @@ void osm_nr_rcv_process(IN void *ctx, IN void *data)
 		goto Exit;
 	}
 
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
-		osm_dump_node_record(sa->p_log, p_rcvd_rec, OSM_LOG_DEBUG);
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Requester port GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
+		osm_dump_node_record_v2(sa->p_log, p_rcvd_rec, FILE_ID, OSM_LOG_DEBUG);
+	}
 
 	cl_qlist_init(&rec_list);
 
@@ -343,8 +341,8 @@ void osm_nr_rcv_process(IN void *ctx, IN void *data)
 
 	cl_plock_acquire(sa->p_lock);
 
-	cl_qmap_apply_func(&sa->p_subn->node_guid_tbl,
-			   __osm_nr_rcv_by_comp_mask, &context);
+	cl_qmap_apply_func(&sa->p_subn->node_guid_tbl, nr_rcv_by_comp_mask,
+			   &context);
 
 	cl_plock_release(sa->p_lock);
 
diff --git a/opensm/osm_sa_path_record.c b/opensm/osm_sa_path_record.c
index 5de496e..3ab37e3 100644
--- a/opensm/osm_sa_path_record.c
+++ b/opensm/osm_sa_path_record.c
@@ -1,8 +1,11 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
- * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
+ * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2009-2011 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -52,6 +55,8 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_PATH_RECORD_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_base.h>
 #include <opensm/osm_port.h>
@@ -66,10 +71,9 @@
 #include <opensm/osm_sa.h>
 #include <opensm/osm_router.h>
 #include <opensm/osm_prefix_route.h>
+#include <opensm/osm_ucast_lash.h>
 
-extern uint8_t osm_get_lash_sl(osm_opensm_t * p_osm,
-			       const osm_port_t * p_src_port,
-			       const osm_port_t * p_dst_port);
+#define MAX_HOPS 64
 
 typedef struct osm_pr_item {
 	cl_list_item_t list_item;
@@ -85,16 +89,7 @@ typedef struct osm_path_parms {
 	boolean_t reversible;
 } osm_path_parms_t;
 
-static const ib_gid_t zero_gid = { {0x00, 0x00, 0x00, 0x00,
-				    0x00, 0x00, 0x00, 0x00,
-				    0x00, 0x00, 0x00, 0x00,
-				    0x00, 0x00, 0x00, 0x00},
-};
-
-/**********************************************************************
- **********************************************************************/
-static inline boolean_t
-__osm_sa_path_rec_is_tavor_port(IN const osm_port_t * const p_port)
+static inline boolean_t sa_path_rec_is_tavor_port(IN const osm_port_t * p_port)
 {
 	osm_node_t const *p_node;
 	ib_net32_t vend_id;
@@ -109,20 +104,18 @@ __osm_sa_path_rec_is_tavor_port(IN const osm_port_t * const p_port)
 		 (vend_id == CL_HTON32(OSM_VENDOR_ID_VOLTAIRE))));
 }
 
-/**********************************************************************
- **********************************************************************/
 static boolean_t
-__osm_sa_path_rec_apply_tavor_mtu_limit(IN const ib_path_rec_t * const p_pr,
-					IN const osm_port_t * const p_src_port,
-					IN const osm_port_t * const p_dest_port,
-					IN const ib_net64_t comp_mask)
+sa_path_rec_apply_tavor_mtu_limit(IN const ib_path_rec_t * p_pr,
+				  IN const osm_port_t * p_src_port,
+				  IN const osm_port_t * p_dest_port,
+				  IN const ib_net64_t comp_mask)
 {
 	uint8_t required_mtu;
 
 	/* only if at least one of the ports is a Tavor device */
-	if (!__osm_sa_path_rec_is_tavor_port(p_src_port) &&
-	    !__osm_sa_path_rec_is_tavor_port(p_dest_port))
-		return (FALSE);
+	if (!sa_path_rec_is_tavor_port(p_src_port) &&
+	    !sa_path_rec_is_tavor_port(p_dest_port))
+		return FALSE;
 
 	/*
 	   we can apply the patch if either:
@@ -138,7 +131,7 @@ __osm_sa_path_rec_apply_tavor_mtu_limit(IN const ib_path_rec_t * const p_pr,
 		case 0:	/* must be greater than */
 		case 2:	/* exact match */
 			if (IB_MTU_LEN_1024 < required_mtu)
-				return (FALSE);
+				return FALSE;
 			break;
 
 		case 1:	/* must be less than */
@@ -148,8 +141,7 @@ __osm_sa_path_rec_apply_tavor_mtu_limit(IN const ib_path_rec_t * const p_pr,
 		case 3:	/* largest available */
 			/* the ULP intentionally requested */
 			/* the largest MTU possible */
-			return (FALSE);
-			break;
+			return FALSE;
 
 		default:
 			/* if we're here, there's a bug in ib_path_rec_mtu_sel() */
@@ -158,27 +150,26 @@ __osm_sa_path_rec_apply_tavor_mtu_limit(IN const ib_path_rec_t * const p_pr,
 		}
 	}
 
-	return (TRUE);
+	return TRUE;
 }
 
-/**********************************************************************
- **********************************************************************/
-static ib_api_status_t
-__osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
-			    IN const ib_path_rec_t * const p_pr,
-			    IN const osm_port_t * const p_src_port,
-			    IN const osm_port_t * const p_dest_port,
-			    IN const uint16_t dest_lid_ho,
-			    IN const ib_net64_t comp_mask,
-			    OUT osm_path_parms_t * const p_parms)
+static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa,
+					     IN const ib_path_rec_t * p_pr,
+					     IN const osm_alias_guid_t * p_src_alias_guid,
+					     IN const uint16_t src_lid_ho,
+					     IN const osm_alias_guid_t * p_dest_alias_guid,
+					     IN const uint16_t dest_lid_ho,
+					     IN const ib_net64_t comp_mask,
+					     OUT osm_path_parms_t * p_parms)
 {
 	const osm_node_t *p_node;
-	const osm_physp_t *p_physp;
+	const osm_physp_t *p_physp, *p_physp0;
 	const osm_physp_t *p_src_physp;
 	const osm_physp_t *p_dest_physp;
 	const osm_prtn_t *p_prtn = NULL;
 	osm_opensm_t *p_osm;
-	const ib_port_info_t *p_pi;
+	struct osm_routing_engine *p_re;
+	const ib_port_info_t *p_pi, *p_pi0;
 	ib_api_status_t status = IB_SUCCESS;
 	ib_net16_t pkey;
 	uint8_t mtu;
@@ -194,20 +185,22 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 	ib_slvl_table_t *p_slvl_tbl = NULL;
 	osm_qos_level_t *p_qos_level = NULL;
 	uint16_t valid_sl_mask = 0xffff;
-	int is_lash;
+	int hops = 0;
 
 	OSM_LOG_ENTER(sa->p_log);
 
 	dest_lid = cl_hton16(dest_lid_ho);
 
-	p_dest_physp = p_dest_port->p_physp;
-	p_physp = p_src_port->p_physp;
+	p_dest_physp = p_dest_alias_guid->p_base_port->p_physp;
+	p_physp = p_src_alias_guid->p_base_port->p_physp;
 	p_src_physp = p_physp;
 	p_pi = &p_physp->port_info;
 	p_osm = sa->p_subn->p_osm;
+	p_re = p_osm->routing_engine_used;
 
 	mtu = ib_port_info_get_mtu_cap(p_pi);
-	rate = ib_port_info_compute_rate(p_pi);
+	rate = ib_port_info_compute_rate(p_pi,
+					 p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);
 
 	/*
 	   Mellanox Tavor device performance is better using 1K MTU.
@@ -216,8 +209,10 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 	   port MTU with 1K.
 	 */
 	if (sa->p_subn->opt.enable_quirks &&
-	    __osm_sa_path_rec_apply_tavor_mtu_limit(p_pr, p_src_port,
-						    p_dest_port, comp_mask))
+	    sa_path_rec_apply_tavor_mtu_limit(p_pr,
+					      p_src_alias_guid->p_base_port,
+					      p_dest_alias_guid->p_base_port,
+					      comp_mask))
 		if (mtu > IB_MTU_LEN_1024) {
 			mtu = IB_MTU_LEN_1024;
 			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
@@ -243,8 +238,9 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 		p_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);
 		if (p_physp == 0) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F02: "
-				"Cannot find routing to LID %u from switch for GUID 0x%016"
-				PRIx64 "\n", dest_lid_ho,
+				"Cannot find routing to LID %u on switch "
+				"%s (GUID: 0x%016" PRIx64 ")\n", dest_lid_ho,
+				p_node->print_desc,
 				cl_ntoh64(osm_node_get_node_guid(p_node)));
 			status = IB_NOT_FOUND;
 			goto Exit;
@@ -252,7 +248,6 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 	}
 
 	if (sa->p_subn->opt.qos) {
-
 		/*
 		 * Whether this node is switch or CA, the IN port for
 		 * the sl2vl table is 0, because this is a source node.
@@ -282,12 +277,14 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 		/*
 		 * if destination is switch, we want p_dest_physp to point to port 0
 		 */
-		p_dest_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);
+		p_dest_physp =
+		    osm_switch_get_route_by_lid(p_node->sw, dest_lid);
 
 		if (p_dest_physp == 0) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F03: "
-				"Cannot find routing to LID %u from switch for GUID 0x%016"
-				PRIx64 "\n", dest_lid_ho,
+				"Cannot find routing to LID %u on switch "
+				"%s (GUID: 0x%016" PRIx64 ")\n", dest_lid_ho,
+				p_node->print_desc,
 				cl_ntoh64(osm_node_get_node_guid(p_node)));
 			status = IB_NOT_FOUND;
 			goto Exit;
@@ -301,14 +298,19 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 
 	while (p_physp != p_dest_physp) {
 
+		int tmp_pnum = p_physp->port_num;
 		p_node = osm_physp_get_node_ptr(p_physp);
 		p_physp = osm_physp_get_remote(p_physp);
 
 		if (p_physp == 0) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F05: "
-				"Cannot find remote phys port when routing to LID %u from node GUID 0x%016"
-				PRIx64 "\n", dest_lid_ho,
-				cl_ntoh64(osm_node_get_node_guid(p_node)));
+				"Can't find remote phys port of %s (GUID: "
+				"0x%016"PRIx64") port %d "
+				"while routing to LID %u\n",
+				p_node->print_desc,
+				cl_ntoh64(osm_node_get_node_guid(p_node)),
+				tmp_pnum,
+				dest_lid_ho);
 			status = IB_ERROR;
 			goto Exit;
 		}
@@ -330,7 +332,18 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 			   the destination by now!
 			 */
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F06: "
-				"Internal error, bad path\n");
+				"Internal error, bad path while routing "
+				"%s (GUID: 0x%016"PRIx64") port %d to "
+				"%s (GUID: 0x%016"PRIx64") port %d; "
+				"ended at %s port %d\n",
+				p_src_alias_guid->p_base_port->p_node->print_desc,
+				cl_ntoh64(p_src_alias_guid->p_base_port->p_node->node_info.node_guid),
+				p_src_alias_guid->p_base_port->p_physp->port_num,
+				p_dest_alias_guid->p_base_port->p_node->print_desc,
+				cl_ntoh64(p_dest_alias_guid->p_base_port->p_node->node_info.node_guid),
+				p_dest_alias_guid->p_base_port->p_physp->port_num,
+				p_node->print_desc,
+				p_physp->port_num);
 			status = IB_ERROR;
 			goto Exit;
 		}
@@ -343,8 +356,13 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 		if (mtu > ib_port_info_get_mtu_cap(p_pi))
 			mtu = ib_port_info_get_mtu_cap(p_pi);
 
-		if (rate > ib_port_info_compute_rate(p_pi))
-			rate = ib_port_info_compute_rate(p_pi);
+		p_physp0 = osm_node_get_physp_ptr((osm_node_t *)p_node, 0);
+		p_pi0 = &p_physp0->port_info;
+		if (ib_path_compare_rates(rate,
+					  ib_port_info_compute_rate(p_pi,
+								    p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0)
+			rate = ib_port_info_compute_rate(p_pi,
+							 p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);
 
 		/*
 		   Continue with the egress port on this switch.
@@ -352,9 +370,11 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 		p_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);
 		if (p_physp == 0) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F07: "
-				"Dead end on path to LID %u from switch for GUID 0x%016"
-				PRIx64 "\n", dest_lid_ho,
-				cl_ntoh64(osm_node_get_node_guid(p_node)));
+				"Dead end path on switch "
+				"%s (GUID: 0x%016"PRIx64") to LID %u\n",
+				p_node->print_desc,
+				cl_ntoh64(osm_node_get_node_guid(p_node)),
+				dest_lid_ho);
 			status = IB_ERROR;
 			goto Exit;
 		}
@@ -364,17 +384,24 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 		if (mtu > ib_port_info_get_mtu_cap(p_pi))
 			mtu = ib_port_info_get_mtu_cap(p_pi);
 
-		if (rate > ib_port_info_compute_rate(p_pi))
-			rate = ib_port_info_compute_rate(p_pi);
+		p_physp0 = osm_node_get_physp_ptr((osm_node_t *)p_node, 0);
+		p_pi0 = &p_physp0->port_info;
+		if (ib_path_compare_rates(rate,
+					  ib_port_info_compute_rate(p_pi,
+								    p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0)
+			rate = ib_port_info_compute_rate(p_pi,
+							 p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);
 
 		if (sa->p_subn->opt.qos) {
 			/*
 			 * Check SL2VL table of the switch and update valid SLs
 			 */
-			p_slvl_tbl = osm_physp_get_slvl_tbl(p_physp, in_port_num);
+			p_slvl_tbl =
+			    osm_physp_get_slvl_tbl(p_physp, in_port_num);
 			for (i = 0; i < IB_MAX_NUM_VLS; i++) {
 				if (valid_sl_mask & (1 << i) &&
-				    ib_slvl_table_get(p_slvl_tbl, i) == IB_DROP_VL)
+				    ib_slvl_table_get(p_slvl_tbl,
+						      i) == IB_DROP_VL)
 					valid_sl_mask &= ~(1 << i);
 			}
 			if (!valid_sl_mask) {
@@ -384,6 +411,27 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 				goto Exit;
 			}
 		}
+
+		/* update number of hops traversed */
+		hops++;
+		if (hops > MAX_HOPS) {
+			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F25: "
+				"Path from GUID 0x%016" PRIx64 " (%s port %d) "
+				"to lid %u GUID 0x%016" PRIx64 " (%s port %d) "
+				"needs more than %d hops, max %d hops allowed\n",
+				cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),
+				p_src_physp->p_node->print_desc,
+				p_src_physp->port_num,
+				dest_lid_ho,
+				cl_ntoh64(osm_physp_get_port_guid
+					  (p_dest_physp)),
+				p_dest_physp->p_node->print_desc,
+				p_dest_physp->port_num,
+				hops,
+				MAX_HOPS);
+			status = IB_NOT_FOUND;
+			goto Exit;
+		}
 	}
 
 	/*
@@ -394,8 +442,11 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 	if (mtu > ib_port_info_get_mtu_cap(p_pi))
 		mtu = ib_port_info_get_mtu_cap(p_pi);
 
-	if (rate > ib_port_info_compute_rate(p_pi))
-		rate = ib_port_info_compute_rate(p_pi);
+	if (ib_path_compare_rates(rate,
+				  ib_port_info_compute_rate(p_pi,
+							    p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0)
+		rate = ib_port_info_compute_rate(p_pi,
+						 p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);
 
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 		"Path min MTU = %u, min rate = %u\n", mtu, rate);
@@ -420,7 +471,7 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 			mtu = p_qos_level->mtu_limit;
 
 		if (p_qos_level->rate_limit_set
-		    && (rate > p_qos_level->rate_limit))
+		    && (ib_path_compare_rates(rate, p_qos_level->rate_limit) > 0))
 			rate = p_qos_level->rate_limit;
 
 		if (p_qos_level->sl_set) {
@@ -438,7 +489,7 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 	 * PacketLifeTime description, for loopback paths,
 	 * packetLifeTime shall be zero.
 	 */
-	if (p_src_port == p_dest_port)
+	if (p_src_alias_guid->p_base_port == p_dest_alias_guid->p_base_port)
 		pkt_life = 0;
 	else if (p_qos_level && p_qos_level->pkt_life_set)
 		pkt_life = p_qos_level->pkt_life;
@@ -498,23 +549,22 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 		required_rate = ib_path_rec_rate(p_pr);
 		switch (ib_path_rec_rate_sel(p_pr)) {
 		case 0:	/* must be greater than */
-			if (rate <= required_rate)
+			if (ib_path_compare_rates(rate, required_rate) <= 0)
 				status = IB_NOT_FOUND;
 			break;
 
 		case 1:	/* must be less than */
-			if (rate >= required_rate) {
+			if (ib_path_compare_rates(rate, required_rate) >= 0) {
 				/* adjust the rate to use the highest rate
 				   lower then the required one */
-				if (required_rate > 2)
-					rate = required_rate - 1;
-				else
+				rate = ib_path_rate_get_prev(required_rate);
+				if (!rate)
 					status = IB_NOT_FOUND;
 			}
 			break;
 
 		case 2:	/* exact match */
-			if (rate < required_rate)
+			if (ib_path_compare_rates(rate, required_rate))
 				status = IB_NOT_FOUND;
 			else
 				rate = required_rate;
@@ -583,7 +633,8 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 
 	if ((comp_mask & IB_PR_COMPMASK_RAWTRAFFIC) &&
 	    (cl_ntoh32(p_pr->hop_flow_raw) & (1 << 31)))
-		pkey = osm_physp_find_common_pkey(p_src_physp, p_dest_physp);
+		pkey = osm_physp_find_common_pkey(p_src_physp, p_dest_physp,
+						  sa->p_subn->opt.allow_both_pkeys);
 
 	else if (comp_mask & IB_PR_COMPMASK_PKEY) {
 		/*
@@ -594,12 +645,19 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 		 * PR returned pkey is the requested pkey.
 		 */
 		pkey = p_pr->pkey;
-		if (!osm_physp_share_this_pkey(p_src_physp, p_dest_physp, pkey)) {
+		if (!osm_physp_share_this_pkey(p_src_physp, p_dest_physp, pkey,
+					       sa->p_subn->opt.allow_both_pkeys)) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F1A: "
-				"Ports 0x%016" PRIx64 " 0x%016" PRIx64
+				"Ports 0x%016" PRIx64 " (%s port %d) and "
+				"0x%016" PRIx64 " (%s port %d) "
 				" do not share specified PKey 0x%04x\n",
 				cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),
-				cl_ntoh64(osm_physp_get_port_guid(p_dest_physp)),
+				p_src_physp->p_node->print_desc,
+				p_src_physp->port_num,
+				cl_ntoh64(osm_physp_get_port_guid
+					  (p_dest_physp)),
+				p_dest_physp->p_node->print_desc,
+				p_dest_physp->port_num,
 				cl_ntoh16(pkey));
 			status = IB_NOT_FOUND;
 			goto Exit;
@@ -607,7 +665,18 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 		if (p_qos_level && p_qos_level->pkey_range_len &&
 		    !osm_qos_level_has_pkey(p_qos_level, pkey)) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F1D: "
-				"Ports do not share PKeys defined by QoS level\n");
+				"Ports 0x%016" PRIx64 " (%s port %d) and "
+				"0x%016"PRIx64" (%s port %d) "
+				"do not share PKeys defined by QoS level "
+				"\"%s\"\n",
+				cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),
+				p_src_physp->p_node->print_desc,
+				p_src_alias_guid->p_base_port->p_physp->port_num,
+				cl_ntoh64(osm_physp_get_port_guid
+					  (p_dest_physp)),
+				p_dest_physp->p_node->print_desc,
+				p_dest_alias_guid->p_base_port->p_physp->port_num,
+				p_qos_level->name);
 			status = IB_NOT_FOUND;
 			goto Exit;
 		}
@@ -618,13 +687,19 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 		 * has pkeys - get shared pkey from QoS level pkeys
 		 */
 		pkey = osm_qos_level_get_shared_pkey(p_qos_level,
-						     p_src_physp, p_dest_physp);
+						     p_src_physp, p_dest_physp,
+						     sa->p_subn->opt.allow_both_pkeys);
 		if (!pkey) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F1E: "
-				"Ports 0x%016" PRIx64 " 0x%016" PRIx64
-				" do not share PKeys defined by QoS level\n",
+				"Ports 0x%016" PRIx64 " (%s) and "
+				"0x%016" PRIx64 " (%s) do not share "
+				"PKeys defined by QoS level \"%s\"\n",
 				cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),
-				cl_ntoh64(osm_physp_get_port_guid(p_dest_physp)));
+				p_src_physp->p_node->print_desc,
+				cl_ntoh64(osm_physp_get_port_guid
+					  (p_dest_physp)),
+				p_dest_physp->p_node->print_desc,
+				p_qos_level->name);
 			status = IB_NOT_FOUND;
 			goto Exit;
 		}
@@ -633,13 +708,20 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 		 * Neither PR request nor QoS level have pkey.
 		 * Just get any shared pkey.
 		 */
-		pkey = osm_physp_find_common_pkey(p_src_physp, p_dest_physp);
+		pkey = osm_physp_find_common_pkey(p_src_physp, p_dest_physp,
+						  sa->p_subn->opt.allow_both_pkeys);
 		if (!pkey) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F1B: "
-				"Ports 0x%016" PRIx64 " 0x%016" PRIx64
-				" do not have any shared PKeys\n",
+				"Ports src 0x%016"PRIx64" (%s port %d) and "
+				"dst 0x%016"PRIx64" (%s port %d) do not have "
+				"any shared PKeys\n",
 				cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),
-				cl_ntoh64(osm_physp_get_port_guid(p_dest_physp)));
+				p_src_physp->p_node->print_desc,
+				p_src_physp->port_num,
+				cl_ntoh64(osm_physp_get_port_guid
+					  (p_dest_physp)),
+				p_dest_physp->p_node->print_desc,
+				p_dest_physp->port_num);
 			status = IB_NOT_FOUND;
 			goto Exit;
 		}
@@ -656,11 +738,9 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 	}
 
 	/*
-	 * Set PathRecord SL.
+	 * Set PathRecord SL
 	 */
 
-	is_lash = (p_osm->routing_engine_used == OSM_ROUTING_ENGINE_TYPE_LASH);
-
 	if (comp_mask & IB_PR_COMPMASK_SL) {
 		/*
 		 * Specific SL was requested
@@ -670,33 +750,23 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 		if (p_qos_level && p_qos_level->sl_set
 		    && (p_qos_level->sl != sl)) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F1F: "
-				"QoS constaraints: required PathRecord SL (%u) "
-				"doesn't match QoS policy SL (%u)\n", sl,
-				p_qos_level->sl);
-			status = IB_NOT_FOUND;
-			goto Exit;
-		}
-
-		if (is_lash
-		    && osm_get_lash_sl(p_osm, p_src_port, p_dest_port) != sl) {
-			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F23: "
-				"Required PathRecord SL (%u) doesn't "
-				"match LASH SL\n", sl);
+				"QoS constraints: required PathRecord SL (%u) "
+				"doesn't match QoS policy \"%s\" SL (%u) "
+				"[%s port %d <-> %s port %d]\n", sl,
+				p_qos_level->name,
+				p_qos_level->sl,
+				p_src_alias_guid->p_base_port->p_node->print_desc,
+				p_src_alias_guid->p_base_port->p_physp->port_num,
+				p_dest_alias_guid->p_base_port->p_node->print_desc,
+				p_dest_alias_guid->p_base_port->p_physp->port_num);
 			status = IB_NOT_FOUND;
 			goto Exit;
 		}
 
-	} else if (is_lash) {
-		/*
-		 * No specific SL in PathRecord request.
-		 * If it's LASH routing - use its SL.
-		 * slid and dest_lid are stored in network in lash.
-		 */
-		sl = osm_get_lash_sl(p_osm, p_src_port, p_dest_port);
 	} else if (p_qos_level && p_qos_level->sl_set) {
 		/*
-		 * No specific SL was requested, and we're not in
-		 * LASH routing, but there is an SL in QoS level.
+		 * No specific SL was requested, but there is an SL in
+		 * QoS level.
 		 */
 		sl = p_qos_level->sl;
 
@@ -714,8 +784,14 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 			/* this may be possible when pkey tables are created somehow in
 			   previous runs or things are going wrong here */
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F1C: "
-				"No partition found for PKey 0x%04x - using default SL %d\n",
-				cl_ntoh16(pkey), sl);
+				"No partition found for PKey 0x%04x - "
+				"using default SL %d "
+				"[%s port %d <-> %s port %d]\n",
+				cl_ntoh16(pkey), sl,
+				p_src_alias_guid->p_base_port->p_node->print_desc,
+				p_src_alias_guid->p_base_port->p_physp->port_num,
+				p_dest_alias_guid->p_base_port->p_node->print_desc,
+				p_dest_alias_guid->p_base_port->p_physp->port_num);
 		} else
 			sl = p_prtn->sl;
 	} else if (sa->p_subn->opt.qos) {
@@ -732,11 +808,26 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 
 	if (sa->p_subn->opt.qos && !(valid_sl_mask & (1 << sl))) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F24: "
-			"Selected SL (%u) leads to VL15\n", sl);
+			"Selected SL (%u) leads to VL15 "
+			"[%s port %d <-> %s port %d]\n",
+			sl,
+			p_src_alias_guid->p_base_port->p_node->print_desc,
+			p_src_alias_guid->p_base_port->p_physp->port_num,
+			p_dest_alias_guid->p_base_port->p_node->print_desc,
+			p_dest_alias_guid->p_base_port->p_physp->port_num);
 		status = IB_NOT_FOUND;
 		goto Exit;
 	}
 
+	/*
+	 * If the routing engine wants to have a say in path SL selection,
+	 * send the currently computed SL value as a hint and let the routing
+	 * engine override it.
+	 */
+	if (p_re && p_re->path_sl)
+		sl = p_re->path_sl(p_re->context, sl,
+				   cl_hton16(src_lid_ho), cl_hton16(dest_lid_ho));
+
 	/* reset pkey when raw traffic */
 	if (comp_mask & IB_PR_COMPMASK_RAWTRAFFIC &&
 	    cl_ntoh32(p_pr->hop_flow_raw) & (1 << 31))
@@ -753,48 +844,61 @@ __osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 		mtu, rate, pkt_life, cl_ntoh16(pkey), sl);
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_pr_rcv_build_pr(IN osm_sa_t * sa,
-		      IN const osm_port_t * const p_src_port,
-		      IN const osm_port_t * const p_dest_port,
-		      IN const ib_gid_t * const p_dgid,
-		      IN const uint16_t src_lid_ho,
-		      IN const uint16_t dest_lid_ho,
-		      IN const uint8_t preference,
-		      IN const osm_path_parms_t * const p_parms,
-		      OUT ib_path_rec_t * const p_pr)
+ib_api_status_t osm_get_path_params(IN osm_sa_t * sa,
+				    IN const osm_port_t * p_src_port,
+				    IN const uint16_t slid_ho,
+				    IN const osm_port_t * p_dest_port,
+				    IN const uint16_t dlid_ho,
+				    OUT osm_path_parms_t * p_parms)
 {
-	const osm_physp_t *p_src_physp;
-	const osm_physp_t *p_dest_physp;
-	boolean_t is_nonzero_gid = 0;
-
-	OSM_LOG_ENTER(sa->p_log);
+	osm_alias_guid_t *p_src_alias_guid, *p_dest_alias_guid;
+	ib_path_rec_t pr;
+
+	memset(&pr, 0, sizeof(ib_path_rec_t));
+	p_src_alias_guid = osm_get_alias_guid_by_guid(sa->p_subn,
+						      osm_port_get_guid(p_src_port));
+	p_dest_alias_guid = osm_get_alias_guid_by_guid(sa->p_subn,
+						       osm_port_get_guid(p_dest_port));
+	return pr_rcv_get_path_parms(sa, &pr,
+				     p_src_alias_guid, slid_ho,
+				     p_dest_alias_guid, dlid_ho, 0, p_parms);
+}
 
-	p_src_physp = p_src_port->p_physp;
+static void pr_rcv_build_pr(IN osm_sa_t * sa,
+			    IN const osm_alias_guid_t * p_src_alias_guid,
+			    IN const osm_alias_guid_t * p_dest_alias_guid,
+			    IN const ib_gid_t * p_sgid,
+			    IN const ib_gid_t * p_dgid,
+			    IN const uint16_t src_lid_ho,
+			    IN const uint16_t dest_lid_ho,
+			    IN const uint8_t preference,
+			    IN const osm_path_parms_t * p_parms,
+			    OUT ib_path_rec_t * p_pr)
+{
+	const osm_physp_t *p_src_physp, *p_dest_physp;
 
-	if (p_dgid) {
-		if (memcmp(p_dgid, &zero_gid, sizeof(*p_dgid)))
-			is_nonzero_gid = 1;
-	}
+	OSM_LOG_ENTER(sa->p_log);
 
-	if (is_nonzero_gid)
+	if (p_dgid)
 		p_pr->dgid = *p_dgid;
 	else {
-		p_dest_physp = p_dest_port->p_physp;
+		p_dest_physp = p_dest_alias_guid->p_base_port->p_physp;
 
 		p_pr->dgid.unicast.prefix =
 		    osm_physp_get_subnet_prefix(p_dest_physp);
-		p_pr->dgid.unicast.interface_id =
-		    osm_physp_get_port_guid(p_dest_physp);
+		p_pr->dgid.unicast.interface_id = p_dest_alias_guid->alias_guid;
 	}
+	if (p_sgid)
+		p_pr->sgid = *p_sgid;
+	else {
+		p_src_physp = p_src_alias_guid->p_base_port->p_physp;
 
-	p_pr->sgid.unicast.prefix = osm_physp_get_subnet_prefix(p_src_physp);
-	p_pr->sgid.unicast.interface_id = osm_physp_get_port_guid(p_src_physp);
+		p_pr->sgid.unicast.prefix = osm_physp_get_subnet_prefix(p_src_physp);
+		p_pr->sgid.unicast.interface_id = p_src_alias_guid->alias_guid;
+	}
 
 	p_pr->dlid = cl_hton16(dest_lid_ho);
 	p_pr->slid = cl_hton16(src_lid_ho);
@@ -802,7 +906,7 @@ __osm_pr_rcv_build_pr(IN osm_sa_t * sa,
 	p_pr->hop_flow_raw &= cl_hton32(1 << 31);
 
 	/* Only set HopLimit if going through a router */
-	if (is_nonzero_gid)
+	if (p_dgid)
 		p_pr->hop_flow_raw |= cl_hton32(IB_HOPLIMIT_MAX);
 
 	p_pr->pkey = p_parms->pkey;
@@ -813,7 +917,7 @@ __osm_pr_rcv_build_pr(IN osm_sa_t * sa,
 
 	/* According to 1.2 spec definition Table 205 PacketLifeTime description,
 	   for loopback paths, packetLifeTime shall be zero. */
-	if (p_src_port == p_dest_port)
+	if (p_src_alias_guid->p_base_port == p_dest_alias_guid->p_base_port)
 		p_pr->pkt_life = 0x80;	/* loopback */
 	else
 		p_pr->pkt_life = (uint8_t) (p_parms->pkt_life | 0x80);
@@ -827,18 +931,16 @@ __osm_pr_rcv_build_pr(IN osm_sa_t * sa,
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static osm_pr_item_t *
-__osm_pr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
-			       IN const ib_path_rec_t * const p_pr,
-			       IN const osm_port_t * const p_src_port,
-			       IN const osm_port_t * const p_dest_port,
-			       IN const ib_gid_t * const p_dgid,
-			       IN const uint16_t src_lid_ho,
-			       IN const uint16_t dest_lid_ho,
-			       IN const ib_net64_t comp_mask,
-			       IN const uint8_t preference)
+static osm_pr_item_t *pr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
+					       IN const ib_path_rec_t * p_pr,
+					       IN const osm_alias_guid_t * p_src_alias_guid,
+					       IN const osm_alias_guid_t * p_dest_alias_guid,
+					       IN const ib_gid_t * p_sgid,
+					       IN const ib_gid_t * p_dgid,
+					       IN const uint16_t src_lid_ho,
+					       IN const uint16_t dest_lid_ho,
+					       IN const ib_net64_t comp_mask,
+					       IN const uint8_t preference)
 {
 	osm_path_parms_t path_parms;
 	osm_path_parms_t rev_path_parms;
@@ -858,9 +960,9 @@ __osm_pr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 	}
 	memset(p_pr_item, 0, sizeof(*p_pr_item));
 
-	status = __osm_pr_rcv_get_path_parms(sa, p_pr, p_src_port,
-					     p_dest_port, dest_lid_ho,
-					     comp_mask, &path_parms);
+	status = pr_rcv_get_path_parms(sa, p_pr, p_src_alias_guid, src_lid_ho,
+				       p_dest_alias_guid, dest_lid_ho,
+				       comp_mask, &path_parms);
 
 	if (status != IB_SUCCESS) {
 		free(p_pr_item);
@@ -869,10 +971,11 @@ __osm_pr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 	}
 
 	/* now try the reversible path */
-	rev_path_status = __osm_pr_rcv_get_path_parms(sa, p_pr, p_dest_port,
-						      p_src_port, src_lid_ho,
-						      comp_mask,
-						      &rev_path_parms);
+	rev_path_status = pr_rcv_get_path_parms(sa, p_pr, p_dest_alias_guid,
+						dest_lid_ho, p_src_alias_guid,
+						src_lid_ho, comp_mask,
+						&rev_path_parms);
+
 	path_parms.reversible = (rev_path_status == IB_SUCCESS);
 
 	/* did we get a Reversible Path compmask ? */
@@ -881,40 +984,35 @@ __osm_pr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 	   rather then requiring non-reversible paths ...
 	   see Vol1 Ver1.2 p900 l16
 	 */
-	if (comp_mask & IB_PR_COMPMASK_REVERSIBLE) {
-		if ((!path_parms.reversible && (p_pr->num_path & 0x80))) {
-			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
-				"Requested reversible path but failed to get one\n");
-
-			free(p_pr_item);
-			p_pr_item = NULL;
-			goto Exit;
-		}
+	if ((comp_mask & IB_PR_COMPMASK_REVERSIBLE) &&
+	    !path_parms.reversible && (p_pr->num_path & 0x80)) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Requested reversible path but failed to get one\n");
+		free(p_pr_item);
+		p_pr_item = NULL;
+		goto Exit;
 	}
 
-	__osm_pr_rcv_build_pr(sa, p_src_port, p_dest_port, p_dgid,
-			      src_lid_ho, dest_lid_ho, preference, &path_parms,
-			      &p_pr_item->path_rec);
+	pr_rcv_build_pr(sa, p_src_alias_guid, p_dest_alias_guid, p_sgid, p_dgid,
+			src_lid_ho, dest_lid_ho, preference, &path_parms,
+			&p_pr_item->path_rec);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (p_pr_item);
+	return p_pr_item;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_pr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
-				 IN const osm_madw_t * const p_madw,
-				 IN const osm_port_t * const p_req_port,
-				 IN const osm_port_t * const p_src_port,
-				 IN const osm_port_t * const p_dest_port,
-				 IN const ib_gid_t * const p_dgid,
-				 IN const ib_net64_t comp_mask,
-				 IN cl_qlist_t * const p_list)
+static void pr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
+				       IN const ib_sa_mad_t *sa_mad,
+				       IN const osm_port_t * p_req_port,
+				       IN const osm_alias_guid_t * p_src_alias_guid,
+				       IN const osm_alias_guid_t * p_dest_alias_guid,
+				       IN const ib_gid_t * p_sgid,
+				       IN const ib_gid_t * p_dgid,
+				       IN cl_qlist_t * p_list)
 {
-	const ib_path_rec_t *p_pr;
-	const ib_sa_mad_t *p_sa_mad;
+	const ib_path_rec_t *p_pr = ib_sa_mad_get_payload_ptr(sa_mad);
+	ib_net64_t comp_mask = sa_mad->comp_mask;
 	osm_pr_item_t *p_pr_item;
 	uint16_t src_lid_min_ho;
 	uint16_t src_lid_max_ho;
@@ -924,30 +1022,29 @@ __osm_pr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
 	uint16_t dest_lid_ho;
 	uint32_t path_num;
 	uint8_t preference;
-	uintn_t iterations;
-	uintn_t src_offset;
-	uintn_t dest_offset;
+	unsigned iterations, src_offset, dest_offset;
 
 	OSM_LOG_ENTER(sa->p_log);
 
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 		"Src port 0x%016" PRIx64 ", Dst port 0x%016" PRIx64 "\n",
-		cl_ntoh64(osm_port_get_guid(p_src_port)),
-		cl_ntoh64(osm_port_get_guid(p_dest_port)));
+		cl_ntoh64(p_src_alias_guid->alias_guid),
+		cl_ntoh64(p_dest_alias_guid->alias_guid));
 
 	/* Check that the req_port, src_port and dest_port all share a
 	   pkey. The check is done on the default physical port of the ports. */
-	if (osm_port_share_pkey(sa->p_log, p_req_port, p_src_port) == FALSE
+	if (osm_port_share_pkey(sa->p_log, p_req_port,
+				p_src_alias_guid->p_base_port,
+				sa->p_subn->opt.allow_both_pkeys) == FALSE
 	    || osm_port_share_pkey(sa->p_log, p_req_port,
-				   p_dest_port) == FALSE
-	    || osm_port_share_pkey(sa->p_log, p_src_port,
-				   p_dest_port) == FALSE)
+				   p_dest_alias_guid->p_base_port,
+				   sa->p_subn->opt.allow_both_pkeys) == FALSE
+	    || osm_port_share_pkey(sa->p_log, p_src_alias_guid->p_base_port,
+				   p_dest_alias_guid->p_base_port,
+				   sa->p_subn->opt.allow_both_pkeys) == FALSE)
 		/* One of the pairs doesn't share a pkey so the path is disqualified. */
 		goto Exit;
 
-	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
-	p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
-
 	/*
 	   We shouldn't be here if the paths are disqualified in some way...
 	   Thus, we assume every possible connection is valid.
@@ -996,29 +1093,33 @@ __osm_pr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
 	/*
 	   Refine our search if the client specified end-point LIDs
 	 */
-	if (comp_mask & IB_PR_COMPMASK_DLID) {
-		dest_lid_min_ho = cl_ntoh16(p_pr->dlid);
-		dest_lid_max_ho = cl_ntoh16(p_pr->dlid);
-	} else
-		osm_port_get_lid_range_ho(p_dest_port, &dest_lid_min_ho,
-					  &dest_lid_max_ho);
+	if (comp_mask & IB_PR_COMPMASK_DLID)
+		dest_lid_max_ho = dest_lid_min_ho = cl_ntoh16(p_pr->dlid);
+	else
+		osm_port_get_lid_range_ho(p_dest_alias_guid->p_base_port,
+					  &dest_lid_min_ho, &dest_lid_max_ho);
 
-	if (comp_mask & IB_PR_COMPMASK_SLID) {
-		src_lid_min_ho = cl_ntoh16(p_pr->slid);
-		src_lid_max_ho = cl_ntoh16(p_pr->slid);
-	} else
-		osm_port_get_lid_range_ho(p_src_port, &src_lid_min_ho,
-					  &src_lid_max_ho);
+	if (comp_mask & IB_PR_COMPMASK_SLID)
+		src_lid_max_ho = src_lid_min_ho = cl_ntoh16(p_pr->slid);
+	else
+		osm_port_get_lid_range_ho(p_src_alias_guid->p_base_port,
+					  &src_lid_min_ho, &src_lid_max_ho);
 
 	if (src_lid_min_ho == 0) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F20:"
-			"Obtained source LID of 0. No such LID possible\n");
+			"Obtained source LID of 0. No such LID possible "
+			"(%s port %d)\n",
+			p_src_alias_guid->p_base_port->p_node->print_desc,
+			p_src_alias_guid->p_base_port->p_physp->port_num);
 		goto Exit;
 	}
 
 	if (dest_lid_min_ho == 0) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F21:"
-			"Obtained destination LID of 0. No such LID possible\n");
+			"Obtained destination LID of 0. No such LID possible "
+			"(%s port %d)\n",
+			p_dest_alias_guid->p_base_port->p_node->print_desc,
+			p_dest_alias_guid->p_base_port->p_physp->port_num);
 		goto Exit;
 	}
 
@@ -1037,26 +1138,23 @@ __osm_pr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
 	path_num = 0;
 
 	/* If SubnAdmGet, assume NumbPaths 1 (1.2 erratum) */
-	if (p_sa_mad->method != IB_MAD_METHOD_GET)
-		if (comp_mask & IB_PR_COMPMASK_NUMBPATH)
-			iterations = ib_path_rec_num_path(p_pr);
-		else
-			iterations = (uintn_t) (-1);
-	else
+	if (sa_mad->method == IB_MAD_METHOD_GET)
 		iterations = 1;
+	else if (comp_mask & IB_PR_COMPMASK_NUMBPATH)
+		iterations = ib_path_rec_num_path(p_pr);
+	else
+		iterations = (unsigned) (-1);
 
 	while (path_num < iterations) {
 		/*
 		   These paths are "fully redundant"
 		 */
 
-		p_pr_item = __osm_pr_rcv_get_lid_pair_path(sa, p_pr,
-							   p_src_port,
-							   p_dest_port, p_dgid,
-							   src_lid_ho,
-							   dest_lid_ho,
-							   comp_mask,
-							   preference);
+		p_pr_item = pr_rcv_get_lid_pair_path(sa, p_pr, p_src_alias_guid,
+						     p_dest_alias_guid,
+						     p_sgid, p_dgid,
+						     src_lid_ho, dest_lid_ho,
+						     comp_mask, preference);
 
 		if (p_pr_item) {
 			cl_qlist_insert_tail(p_list, &p_pr_item->list_item);
@@ -1116,13 +1214,11 @@ __osm_pr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
 		if (src_offset == dest_offset)
 			continue;	/* already reported */
 
-		p_pr_item = __osm_pr_rcv_get_lid_pair_path(sa, p_pr,
-							   p_src_port,
-							   p_dest_port, p_dgid,
-							   src_lid_ho,
-							   dest_lid_ho,
-							   comp_mask,
-							   preference);
+		p_pr_item = pr_rcv_get_lid_pair_path(sa, p_pr, p_src_alias_guid,
+						     p_dest_alias_guid, p_sgid,
+						     p_dgid, src_lid_ho,
+						     dest_lid_ho, comp_mask,
+						     preference);
 
 		if (p_pr_item) {
 			cl_qlist_insert_tail(p_list, &p_pr_item->list_item);
@@ -1134,23 +1230,52 @@ Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static ib_net16_t
-__osm_pr_rcv_get_end_points(IN osm_sa_t * sa,
-			    IN const osm_madw_t * const p_madw,
-			    OUT const osm_port_t ** const pp_src_port,
-			    OUT const osm_port_t ** const pp_dest_port,
-			    OUT ib_gid_t * const p_dgid)
+/* Find the router port that is configured to handle this prefix, if any */
+static ib_net64_t find_router(const osm_sa_t *sa, ib_net64_t prefix)
 {
-	const ib_path_rec_t *p_pr;
-	const ib_sa_mad_t *p_sa_mad;
-	ib_net64_t comp_mask;
+	osm_prefix_route_t *route = NULL;
+	osm_router_t *rtr;
+	cl_qlist_t *l = &sa->p_subn->prefix_routes_list;
+	cl_list_item_t *i;
+
+	OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, "Non local DGID subnet prefix "
+		"0x%016" PRIx64 "\n", cl_ntoh64(prefix));
+
+	for (i = cl_qlist_head(l); i != cl_qlist_end(l); i = cl_qlist_next(i)) {
+		osm_prefix_route_t *r = (osm_prefix_route_t *)i;
+		if (!r->prefix || r->prefix == prefix) {
+			route = r;
+			break;
+		}
+	}
+	if (!route)
+		return 0;
+
+	if (route->guid == 0) /* first router */
+		rtr = (osm_router_t *) cl_qmap_head(&sa->p_subn->rtr_guid_tbl);
+	else
+		rtr = (osm_router_t *) cl_qmap_get(&sa->p_subn->rtr_guid_tbl,
+						   route->guid);
+
+	if (rtr == (osm_router_t *) cl_qmap_end(&sa->p_subn->rtr_guid_tbl))
+		return 0;
+
+	return osm_port_get_guid(osm_router_get_port_ptr(rtr));
+}
+
+static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,
+					IN const ib_sa_mad_t *sa_mad,
+					OUT const osm_alias_guid_t ** pp_src_alias_guid,
+					OUT const osm_alias_guid_t ** pp_dest_alias_guid,
+					OUT const osm_port_t ** pp_src_port,
+					OUT const osm_port_t ** pp_dest_port,
+					OUT const ib_gid_t ** pp_sgid,
+					OUT const ib_gid_t ** pp_dgid)
+{
+	const ib_path_rec_t *p_pr = ib_sa_mad_get_payload_ptr(sa_mad);
+	ib_net64_t comp_mask = sa_mad->comp_mask;
 	ib_net64_t dest_guid;
-	ib_api_status_t status;
 	ib_net16_t sa_status = IB_SA_MAD_STATUS_SUCCESS;
-	osm_router_t *p_rtr;
-	osm_port_t *p_rtr_port;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -1159,16 +1284,13 @@ __osm_pr_rcv_get_end_points(IN osm_sa_t * sa,
 	   to the source and destination port objects, if possible.
 	 */
 
-	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
-	p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
-
-	comp_mask = p_sa_mad->comp_mask;
-
 	/*
 	   Check a few easy disqualifying cases up front before getting
 	   into the endpoints.
 	 */
 
+	*pp_src_alias_guid = NULL;
+	*pp_src_port = NULL;
 	if (comp_mask & IB_PR_COMPMASK_SGID) {
 		if (!ib_gid_is_link_local(&p_pr->sgid)) {
 			if (ib_gid_get_subnet_prefix(&p_pr->sgid) !=
@@ -1182,16 +1304,14 @@ __osm_pr_rcv_get_end_points(IN osm_sa_t * sa,
 					"Non local SGID subnet prefix 0x%016"
 					PRIx64 "\n",
 					cl_ntoh64(p_pr->sgid.unicast.prefix));
-
 				sa_status = IB_SA_MAD_STATUS_INVALID_GID;
 				goto Exit;
 			}
 		}
 
-		*pp_src_port = osm_get_port_by_guid(sa->p_subn,
-						    p_pr->sgid.unicast.
-						    interface_id);
-		if (!*pp_src_port) {
+		*pp_src_alias_guid = osm_get_alias_guid_by_guid(sa->p_subn,
+								p_pr->sgid.unicast.interface_id);
+		if (!*pp_src_alias_guid) {
 			/*
 			   This 'error' is the client's fault (bad gid) so
 			   don't enter it as an error in our own log.
@@ -1200,109 +1320,52 @@ __osm_pr_rcv_get_end_points(IN osm_sa_t * sa,
 			OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,
 				"No source port with GUID 0x%016" PRIx64 "\n",
 				cl_ntoh64(p_pr->sgid.unicast.interface_id));
-
 			sa_status = IB_SA_MAD_STATUS_INVALID_GID;
 			goto Exit;
 		}
-	} else {
-		*pp_src_port = 0;
-		if (comp_mask & IB_PR_COMPMASK_SLID) {
-			status = cl_ptr_vector_at(&sa->p_subn->port_lid_tbl,
-						  cl_ntoh16(p_pr->slid),
-						  (void **)pp_src_port);
-
-			if ((status != CL_SUCCESS) || (*pp_src_port == NULL)) {
-				/*
-				   This 'error' is the client's fault (bad lid) so
-				   don't enter it as an error in our own log.
-				   Return an error response to the client.
-				 */
-				OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,
-					"No source port with LID %u\n",
-					cl_ntoh16(p_pr->slid));
-
-				sa_status = IB_SA_MAD_STATUS_NO_RECORDS;
-				goto Exit;
-			}
+		if (pp_sgid)
+			*pp_sgid = &p_pr->sgid;
+	} else if (comp_mask & IB_PR_COMPMASK_SLID) {
+		*pp_src_port = osm_get_port_by_lid(sa->p_subn, p_pr->slid);
+		if (!*pp_src_port) {
+			/*
+			   This 'error' is the client's fault (bad lid) so
+			   don't enter it as an error in our own log.
+			   Return an error response to the client.
+			 */
+			OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, "No source port "
+				"with LID %u\n", cl_ntoh16(p_pr->slid));
+			sa_status = IB_SA_MAD_STATUS_NO_RECORDS;
+			goto Exit;
 		}
 	}
 
-	if (p_dgid)
-		memset(p_dgid, 0, sizeof(*p_dgid));
-
+	*pp_dest_alias_guid = NULL;
+	*pp_dest_port = NULL;
 	if (comp_mask & IB_PR_COMPMASK_DGID) {
-		dest_guid = p_pr->dgid.unicast.interface_id;
-		if (!ib_gid_is_link_local(&p_pr->dgid)) {
-			if (!ib_gid_is_multicast(&p_pr->dgid) &&
-			    ib_gid_get_subnet_prefix(&p_pr->dgid) !=
-			    sa->p_subn->opt.subnet_prefix) {
+		if (!ib_gid_is_link_local(&p_pr->dgid) &&
+		    !ib_gid_is_multicast(&p_pr->dgid) &&
+		    ib_gid_get_subnet_prefix(&p_pr->dgid) !=
+		    sa->p_subn->opt.subnet_prefix) {
+			dest_guid = find_router(sa, p_pr->dgid.unicast.prefix);
+			if (!dest_guid) {
+				char gid_str[INET6_ADDRSTRLEN];
 				OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,
-					"Non local DGID subnet prefix 0x%016"
-					PRIx64 "\n",
-					cl_ntoh64(p_pr->dgid.unicast.prefix));
-
-				/* Find the router port that is configured to
-				   handle this prefix, if any */
-				osm_prefix_route_t *route = NULL;
-				osm_prefix_route_t *r = (osm_prefix_route_t *)
-					cl_qlist_head(&sa->p_subn->prefix_routes_list);
-
-				while (r != (osm_prefix_route_t *)
-				       cl_qlist_end(&sa->p_subn->prefix_routes_list))
-				{
-					if (r->prefix == p_pr->dgid.unicast.prefix ||
-					    r->prefix == 0)
-					{
-						route = r;
-						break;
-					}
-					r = (osm_prefix_route_t *) cl_qlist_next(&r->list_item);
-				}
-
-				if (!route) {
-					/*
-					  This 'error' is the client's fault (bad gid) so
-					  don't enter it as an error in our own log.
-					  Return an error response to the client.
-					*/
-					sa_status = IB_SA_MAD_STATUS_INVALID_GID;
-					goto Exit;
-				} else if (route->guid == 0) {
-					/* first router */
-					p_rtr = (osm_router_t *)
-						cl_qmap_head(&sa->
-							     p_subn->
-							     rtr_guid_tbl);
-				} else {
-					p_rtr = (osm_router_t *)
-						cl_qmap_get(&sa->
-							    p_subn->
-							    rtr_guid_tbl,
-							    route->guid);
-				}
-
-				if (p_rtr ==
-				    (osm_router_t *) cl_qmap_end(&sa->
-								 p_subn->
-								 rtr_guid_tbl))
-				{
-					OSM_LOG(sa->p_log, OSM_LOG_ERROR,
-						"ERR 1F22: "
-						"Off subnet DGID but router not found\n");
-					sa_status =
-					    IB_SA_MAD_STATUS_INVALID_GID;
-					goto Exit;
-				}
-
-				p_rtr_port = osm_router_get_port_ptr(p_rtr);
-				dest_guid = osm_port_get_guid(p_rtr_port);
-				if (p_dgid)
-					*p_dgid = p_pr->dgid;
+					"Off subnet DGID %s, but router not "
+					"found\n",
+					inet_ntop(AF_INET6, p_pr->dgid.raw,
+						  gid_str, sizeof(gid_str)));
+				sa_status = IB_SA_MAD_STATUS_INVALID_GID;
+				goto Exit;
 			}
-		}
+			if (pp_dgid)
+				*pp_dgid = &p_pr->dgid;
+		} else
+			dest_guid = p_pr->dgid.unicast.interface_id;
 
-		*pp_dest_port = osm_get_port_by_guid(sa->p_subn, dest_guid);
-		if (!*pp_dest_port) {
+		*pp_dest_alias_guid = osm_get_alias_guid_by_guid(sa->p_subn,
+								 dest_guid);
+		if (!*pp_dest_alias_guid) {
 			/*
 			   This 'error' is the client's fault (bad gid) so
 			   don't enter it as an error in our own log.
@@ -1311,51 +1374,37 @@ __osm_pr_rcv_get_end_points(IN osm_sa_t * sa,
 			OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,
 				"No dest port with GUID 0x%016" PRIx64 "\n",
 				cl_ntoh64(dest_guid));
-
 			sa_status = IB_SA_MAD_STATUS_INVALID_GID;
 			goto Exit;
 		}
-	} else {
-		*pp_dest_port = 0;
-		if (comp_mask & IB_PR_COMPMASK_DLID) {
-			status = cl_ptr_vector_at(&sa->p_subn->port_lid_tbl,
-						  cl_ntoh16(p_pr->dlid),
-						  (void **)pp_dest_port);
-
-			if ((status != CL_SUCCESS) || (*pp_dest_port == NULL)) {
-				/*
-				   This 'error' is the client's fault (bad lid)
-				   so don't enter it as an error in our own log.
-				   Return an error response to the client.
-				 */
-				OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,
-					"No dest port with LID %u\n",
-					cl_ntoh16(p_pr->dlid));
-
-				sa_status = IB_SA_MAD_STATUS_NO_RECORDS;
-				goto Exit;
-			}
+	} else if (comp_mask & IB_PR_COMPMASK_DLID) {
+		*pp_dest_port = osm_get_port_by_lid(sa->p_subn, p_pr->dlid);
+		if (!*pp_dest_port) {
+			/*
+			   This 'error' is the client's fault (bad lid)
+			   so don't enter it as an error in our own log.
+			   Return an error response to the client.
+			 */
+			OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, "No dest port "
+				"with LID %u\n", cl_ntoh16(p_pr->dlid));
+			sa_status = IB_SA_MAD_STATUS_NO_RECORDS;
+			goto Exit;
 		}
 	}
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (sa_status);
+	return sa_status;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_pr_rcv_process_world(IN osm_sa_t * sa,
-			   IN const osm_madw_t * const p_madw,
-			   IN const osm_port_t * const requester_port,
-			   IN const ib_gid_t * const p_dgid,
-			   IN const ib_net64_t comp_mask,
-			   IN cl_qlist_t * const p_list)
+static void pr_rcv_process_world(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad,
+				 IN const osm_port_t * requester_port,
+				 IN const ib_gid_t * p_sgid,
+				 IN const ib_gid_t * p_dgid,
+				 IN cl_qlist_t * p_list)
 {
 	const cl_qmap_t *p_tbl;
-	const osm_port_t *p_dest_port;
-	const osm_port_t *p_src_port;
+	const osm_alias_guid_t *p_dest_alias_guid, *p_src_alias_guid;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -1367,43 +1416,42 @@ __osm_pr_rcv_process_world(IN osm_sa_t * sa,
 	   We compute both A -> B and B -> A, since we don't have
 	   any check to determine the reversability of the paths.
 	 */
-	p_tbl = &sa->p_subn->port_guid_tbl;
-
-	p_dest_port = (osm_port_t *) cl_qmap_head(p_tbl);
-	while (p_dest_port != (osm_port_t *) cl_qmap_end(p_tbl)) {
-		p_src_port = (osm_port_t *) cl_qmap_head(p_tbl);
-		while (p_src_port != (osm_port_t *) cl_qmap_end(p_tbl)) {
-			__osm_pr_rcv_get_port_pair_paths(sa, p_madw,
-							 requester_port,
-							 p_src_port,
-							 p_dest_port, p_dgid,
-							 comp_mask, p_list);
-
-			p_src_port =
-			    (osm_port_t *) cl_qmap_next(&p_src_port->map_item);
+	p_tbl = &sa->p_subn->alias_port_guid_tbl;
+
+	p_dest_alias_guid = (osm_alias_guid_t *) cl_qmap_head(p_tbl);
+	while (p_dest_alias_guid != (osm_alias_guid_t *) cl_qmap_end(p_tbl)) {
+		p_src_alias_guid = (osm_alias_guid_t *) cl_qmap_head(p_tbl);
+		while (p_src_alias_guid != (osm_alias_guid_t *) cl_qmap_end(p_tbl)) {
+			pr_rcv_get_port_pair_paths(sa, sa_mad, requester_port,
+						   p_src_alias_guid,
+						   p_dest_alias_guid,
+						   p_sgid, p_dgid, p_list);
+			if (sa_mad->method == IB_MAD_METHOD_GET &&
+			    cl_qlist_count(p_list) > 0)
+				goto Exit;
+
+			p_src_alias_guid =
+			    (osm_alias_guid_t *) cl_qmap_next(&p_src_alias_guid->map_item);
 		}
 
-		p_dest_port =
-		    (osm_port_t *) cl_qmap_next(&p_dest_port->map_item);
+		p_dest_alias_guid =
+		    (osm_alias_guid_t *) cl_qmap_next(&p_dest_alias_guid->map_item);
 	}
 
+Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_pr_rcv_process_half(IN osm_sa_t * sa,
-			  IN const osm_madw_t * const p_madw,
-			  IN const osm_port_t * const requester_port,
-			  IN const osm_port_t * const p_src_port,
-			  IN const osm_port_t * const p_dest_port,
-			  IN const ib_gid_t * const p_dgid,
-			  IN const ib_net64_t comp_mask,
-			  IN cl_qlist_t * const p_list)
+static void pr_rcv_process_half(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad,
+				IN const osm_port_t * requester_port,
+				IN const osm_alias_guid_t * p_src_alias_guid,
+				IN const osm_alias_guid_t * p_dest_alias_guid,
+				IN const ib_gid_t * p_sgid,
+				IN const ib_gid_t * p_dgid,
+				IN cl_qlist_t * p_list)
 {
 	const cl_qmap_t *p_tbl;
-	const osm_port_t *p_port;
+	const osm_alias_guid_t *p_alias_guid;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -1412,236 +1460,254 @@ __osm_pr_rcv_process_half(IN osm_sa_t * sa,
 	   A path record from a port to itself is legit, so no
 	   need to special case that one.
 	 */
-	p_tbl = &sa->p_subn->port_guid_tbl;
+	p_tbl = &sa->p_subn->alias_port_guid_tbl;
 
-	if (p_src_port) {
+	if (p_src_alias_guid) {
 		/*
 		   The src port if fixed, so iterate over destination ports.
 		 */
-		p_port = (osm_port_t *) cl_qmap_head(p_tbl);
-		while (p_port != (osm_port_t *) cl_qmap_end(p_tbl)) {
-			__osm_pr_rcv_get_port_pair_paths(sa, p_madw,
-							 requester_port,
-							 p_src_port, p_port,
-							 p_dgid, comp_mask,
-							 p_list);
-			p_port = (osm_port_t *) cl_qmap_next(&p_port->map_item);
+		p_alias_guid = (osm_alias_guid_t *) cl_qmap_head(p_tbl);
+		while (p_alias_guid != (osm_alias_guid_t *) cl_qmap_end(p_tbl)) {
+			pr_rcv_get_port_pair_paths(sa, sa_mad, requester_port,
+						   p_src_alias_guid,
+						   p_alias_guid,
+						   p_sgid, p_dgid, p_list);
+			if (sa_mad->method == IB_MAD_METHOD_GET &&
+			    cl_qlist_count(p_list) > 0)
+				break;
+			p_alias_guid = (osm_alias_guid_t *) cl_qmap_next(&p_alias_guid->map_item);
 		}
 	} else {
 		/*
 		   The dest port if fixed, so iterate over source ports.
 		 */
-		p_port = (osm_port_t *) cl_qmap_head(p_tbl);
-		while (p_port != (osm_port_t *) cl_qmap_end(p_tbl)) {
-			__osm_pr_rcv_get_port_pair_paths(sa, p_madw,
-							 requester_port, p_port,
-							 p_dest_port, p_dgid,
-							 comp_mask, p_list);
-			p_port = (osm_port_t *) cl_qmap_next(&p_port->map_item);
+		p_alias_guid = (osm_alias_guid_t *) cl_qmap_head(p_tbl);
+		while (p_alias_guid != (osm_alias_guid_t *) cl_qmap_end(p_tbl)) {
+			pr_rcv_get_port_pair_paths(sa, sa_mad, requester_port,
+						   p_alias_guid,
+						   p_dest_alias_guid, p_sgid,
+						   p_dgid, p_list);
+			if (sa_mad->method == IB_MAD_METHOD_GET &&
+			    cl_qlist_count(p_list) > 0)
+				break;
+			p_alias_guid = (osm_alias_guid_t *) cl_qmap_next(&p_alias_guid->map_item);
 		}
 	}
 
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_pr_rcv_process_pair(IN osm_sa_t * sa,
-			  IN const osm_madw_t * const p_madw,
-			  IN const osm_port_t * const requester_port,
-			  IN const osm_port_t * const p_src_port,
-			  IN const osm_port_t * const p_dest_port,
-			  IN const ib_gid_t * const p_dgid,
-			  IN const ib_net64_t comp_mask,
-			  IN cl_qlist_t * const p_list)
+static void pr_rcv_process_pair(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad,
+				IN const osm_port_t * requester_port,
+				IN const osm_alias_guid_t * p_src_alias_guid,
+				IN const osm_alias_guid_t * p_dest_alias_guid,
+				IN const ib_gid_t * p_sgid,
+				IN const ib_gid_t * p_dgid,
+				IN cl_qlist_t * p_list)
 {
 	OSM_LOG_ENTER(sa->p_log);
 
-	__osm_pr_rcv_get_port_pair_paths(sa, p_madw, requester_port,
-					 p_src_port, p_dest_port, p_dgid,
-					 comp_mask, p_list);
+	pr_rcv_get_port_pair_paths(sa, sa_mad, requester_port, p_src_alias_guid,
+				   p_dest_alias_guid, p_sgid, p_dgid, p_list);
 
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static osm_mgrp_t *pr_get_mgrp(IN osm_sa_t * sa,
-			       IN const osm_madw_t * const p_madw)
+static ib_api_status_t pr_match_mgrp_attributes(IN osm_sa_t * sa,
+						IN const ib_sa_mad_t * sa_mad,
+						IN const osm_mgrp_t * p_mgrp)
 {
-	ib_path_rec_t *p_pr;
-	const ib_sa_mad_t *p_sa_mad;
-	ib_net64_t comp_mask;
-	osm_mgrp_t *mgrp = NULL;
-
-	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
-	p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
+	const ib_path_rec_t *p_pr = ib_sa_mad_get_payload_ptr(sa_mad);
+	ib_net64_t comp_mask = sa_mad->comp_mask;
+	const osm_port_t *port;
+	ib_api_status_t status = IB_ERROR;
+	uint32_t flow_label;
+	uint8_t sl, hop_limit;
 
-	comp_mask = p_sa_mad->comp_mask;
+	OSM_LOG_ENTER(sa->p_log);
 
-	if ((comp_mask & IB_PR_COMPMASK_DGID) &&
-	    !(mgrp = osm_get_mgrp_by_mgid(sa, &p_pr->dgid))) {
-		char gid_str[INET6_ADDRSTRLEN];
-		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F09: "
-			"No MC group found for PathRecord destination GID %s\n",
-			inet_ntop(AF_INET6, p_pr->dgid.raw, gid_str,
-				  sizeof gid_str));
+	/* check that MLID of the MC group matches the PathRecord DLID */
+	if ((comp_mask & IB_PR_COMPMASK_DLID) && p_mgrp->mlid != p_pr->dlid) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"DLID 0x%x is not MLID 0x%x for MC group\n",
+			 cl_ntoh16(p_pr->dlid), cl_ntoh16(p_mgrp->mlid));
 		goto Exit;
 	}
 
-	if (comp_mask & IB_PR_COMPMASK_DLID) {
-		if (mgrp) {
-			/* check that the MLID in the MC group is */
-			/* the same as the DLID in the PathRecord */
-			if (mgrp->mlid != p_pr->dlid) {
-				/* Note: perhaps this might be better indicated as an invalid request */
-				OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F10: "
-					"MC group MLID 0x%x does not match "
-					"PathRecord destination LID 0x%x\n",
-					mgrp->mlid, p_pr->dlid);
-				mgrp = NULL;
-				goto Exit;
-			}
-		} else if (!(mgrp = osm_get_mgrp_by_mlid(sa->p_subn, p_pr->dlid)))
-			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F11: "
-				"No MC group found for PathRecord "
-				"destination LID 0x%x\n", p_pr->dlid);
+	/* If SGID and/or SLID specified, should validate as member of MC group */
+	if (comp_mask & IB_PR_COMPMASK_SGID) {
+		if (!osm_mgrp_get_mcm_alias_guid(p_mgrp,
+						 p_pr->sgid.unicast.interface_id)) {
+			char gid_str[INET6_ADDRSTRLEN];
+			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+				"SGID %s is not a member of MC group\n",
+				inet_ntop(AF_INET6, p_pr->sgid.raw,
+					  gid_str, sizeof gid_str));
+			goto Exit;
+		}
 	}
 
-Exit:
-	return mgrp;
-}
-
-/**********************************************************************
- **********************************************************************/
-static ib_api_status_t
-__osm_pr_match_mgrp_attributes(IN osm_sa_t * sa,
-			       IN const osm_madw_t * const p_madw,
-			       IN const osm_mgrp_t * const p_mgrp)
-{
-	const ib_path_rec_t *p_pr;
-	const ib_sa_mad_t *p_sa_mad;
-	ib_net64_t comp_mask;
-	ib_api_status_t status = IB_ERROR;
-	uint32_t flow_label;
-	uint8_t sl;
-	uint8_t hop_limit;
-
-	OSM_LOG_ENTER(sa->p_log);
-
-	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
-	p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
-
-	comp_mask = p_sa_mad->comp_mask;
+	if (comp_mask & IB_PR_COMPMASK_SLID) {
+		port = osm_get_port_by_lid(sa->p_subn, p_pr->slid);
+		if (!port || !osm_mgrp_get_mcm_port(p_mgrp, port->guid)) {
+			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+				"Either no port with SLID %u found or "
+				"SLID not a member of MC group\n",
+				cl_ntoh16(p_pr->slid));
+			goto Exit;
+		}
+	}
 
-	/* If SGID and/or SLID specified, should validate as member of MC group */
 	/* Also, MTU, rate, packet lifetime, and raw traffic requested are not currently checked */
-	if (comp_mask & IB_PR_COMPMASK_PKEY) {
-		if (p_pr->pkey != p_mgrp->mcmember_rec.pkey)
-			goto Exit;
+	if ((comp_mask & IB_PR_COMPMASK_PKEY) &&
+	    p_pr->pkey != p_mgrp->mcmember_rec.pkey) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Pkey 0x%x doesn't match MC group Pkey 0x%x\n",
+			cl_ntoh16(p_pr->pkey),
+			cl_ntoh16(p_mgrp->mcmember_rec.pkey));
+		goto Exit;
 	}
 
 	ib_member_get_sl_flow_hop(p_mgrp->mcmember_rec.sl_flow_hop,
 				  &sl, &flow_label, &hop_limit);
 
-	if (comp_mask & IB_PR_COMPMASK_SL) {
-		if (ib_path_rec_sl(p_pr) != sl)
-			goto Exit;
+	if ((comp_mask & IB_PR_COMPMASK_SL) && ib_path_rec_sl(p_pr) != sl) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"SL %d doesn't match MC group SL %d\n",
+			ib_path_rec_sl(p_pr), sl);
+		goto Exit;
 	}
 
 	/* If SubnAdmGet, assume NumbPaths of 1 (1.2 erratum) */
 	if ((comp_mask & IB_PR_COMPMASK_NUMBPATH) &&
-	    (p_sa_mad->method != IB_MAD_METHOD_GET)) {
-		if (ib_path_rec_num_path(p_pr) == 0)
-			goto Exit;
+	    sa_mad->method != IB_MAD_METHOD_GET &&
+	    ib_path_rec_num_path(p_pr) == 0) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Number of paths requested is 0\n");
+		goto Exit;
 	}
 
-	if (comp_mask & IB_PR_COMPMASK_FLOWLABEL) {
-		if (ib_path_rec_flow_lbl(p_pr) != flow_label)
-			goto Exit;
+	if ((comp_mask & IB_PR_COMPMASK_FLOWLABEL) &&
+	    ib_path_rec_flow_lbl(p_pr) != flow_label) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Flow label 0x%x doesn't match MC group "
+			" flow label 0x%x\n",
+			ib_path_rec_flow_lbl(p_pr), flow_label);
+		goto Exit;
 	}
 
-	if (comp_mask & IB_PR_COMPMASK_HOPLIMIT) {
-		if (ib_path_rec_hop_limit(p_pr) != hop_limit)
-			goto Exit;
+	if ((comp_mask & IB_PR_COMPMASK_HOPLIMIT) &&
+	    ib_path_rec_hop_limit(p_pr) != hop_limit) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Hop limit %u doesn't match MC group hop limit %u\n",
+			ib_path_rec_hop_limit(p_pr), hop_limit);
+		goto Exit;
 	}
 
-	if (comp_mask & IB_PR_COMPMASK_TCLASS) {
-		if (p_pr->tclass != p_mgrp->mcmember_rec.tclass)
-			goto Exit;
+
+	if ((comp_mask & IB_PR_COMPMASK_TCLASS) &&
+	    p_pr->tclass != p_mgrp->mcmember_rec.tclass) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"TClass 0x%02x doesn't match MC group TClass 0x%02x\n",
+			p_pr->tclass, p_mgrp->mcmember_rec.tclass);
+		goto Exit;
 	}
 
 	status = IB_SUCCESS;
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-static int
-__osm_pr_rcv_check_mcast_dest(IN osm_sa_t * sa,
-			      IN const osm_madw_t * const p_madw)
+static void pr_process_multicast(osm_sa_t * sa, const ib_sa_mad_t *sa_mad,
+				 cl_qlist_t *list)
 {
-	const ib_path_rec_t *p_pr;
-	const ib_sa_mad_t *p_sa_mad;
-	ib_net64_t comp_mask;
-	int is_multicast = 0;
-
-	OSM_LOG_ENTER(sa->p_log);
+	ib_path_rec_t *pr = ib_sa_mad_get_payload_ptr(sa_mad);
+	osm_mgrp_t *mgrp;
+	ib_api_status_t status;
+	osm_pr_item_t *pr_item;
+	uint32_t flow_label;
+	uint8_t sl, hop_limit;
 
-	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
-	p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
+	OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Multicast destination requested\n");
 
-	comp_mask = p_sa_mad->comp_mask;
+	mgrp = osm_get_mgrp_by_mgid(sa->p_subn, &pr->dgid);
+	if (!mgrp) {
+		char gid_str[INET6_ADDRSTRLEN];
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F09: "
+			"No MC group found for PathRecord destination GID %s\n",
+			inet_ntop(AF_INET6, pr->dgid.raw, gid_str,
+				  sizeof gid_str));
+		return;
+	}
 
-	if (comp_mask & IB_PR_COMPMASK_DGID) {
-		is_multicast = ib_gid_is_multicast(&p_pr->dgid);
-		if (!is_multicast)
-			goto Exit;
+	/* Make sure the rest of the PathRecord matches the MC group attributes */
+	status = pr_match_mgrp_attributes(sa, sa_mad, mgrp);
+	if (status != IB_SUCCESS) {
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F19: "
+			"MC group attributes don't match PathRecord request\n");
+		return;
 	}
 
-	if (comp_mask & IB_PR_COMPMASK_DLID) {
-		if (cl_ntoh16(p_pr->dlid) >= IB_LID_MCAST_START_HO &&
-		    cl_ntoh16(p_pr->dlid) <= IB_LID_MCAST_END_HO)
-			is_multicast = 1;
-		else if (is_multicast) {
-			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F12: "
-				"PathRecord request indicates MGID but not MLID\n");
-			is_multicast = -1;
-		}
+	pr_item = malloc(sizeof(*pr_item));
+	if (pr_item == NULL) {
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F18: "
+			"Unable to allocate path record for MC group\n");
+		return;
 	}
+	memset(pr_item, 0, sizeof(*pr_item));
 
-Exit:
-	OSM_LOG_EXIT(sa->p_log);
-	return (is_multicast);
+	/* Copy PathRecord request into response */
+	pr_item->path_rec = *pr;
+
+	/* Now, use the MC info to cruft up the PathRecord response */
+	pr_item->path_rec.dgid = mgrp->mcmember_rec.mgid;
+	pr_item->path_rec.dlid = mgrp->mcmember_rec.mlid;
+	pr_item->path_rec.tclass = mgrp->mcmember_rec.tclass;
+	pr_item->path_rec.num_path = 1;
+	pr_item->path_rec.pkey = mgrp->mcmember_rec.pkey;
+
+	/* MTU, rate, and packet lifetime should be exactly */
+	pr_item->path_rec.mtu = (2 << 6) | mgrp->mcmember_rec.mtu;
+	pr_item->path_rec.rate = (2 << 6) | mgrp->mcmember_rec.rate;
+	pr_item->path_rec.pkt_life = (2 << 6) | mgrp->mcmember_rec.pkt_life;
+
+	/* SL, Hop Limit, and Flow Label */
+	ib_member_get_sl_flow_hop(mgrp->mcmember_rec.sl_flow_hop,
+				  &sl, &flow_label, &hop_limit);
+	ib_path_rec_set_sl(&pr_item->path_rec, sl);
+	ib_path_rec_set_qos_class(&pr_item->path_rec, 0);
+
+	/* HopLimit is not yet set in non link local MC groups */
+	/* If it were, this would not be needed */
+	if (ib_mgid_get_scope(&mgrp->mcmember_rec.mgid) !=
+	    IB_MC_SCOPE_LINK_LOCAL)
+		hop_limit = IB_HOPLIMIT_MAX;
+
+	pr_item->path_rec.hop_flow_raw =
+	    cl_hton32(hop_limit) | (flow_label << 8);
+
+	cl_qlist_insert_tail(list, &pr_item->list_item);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_pr_rcv_process(IN void *context, IN void *data)
 {
 	osm_sa_t *sa = context;
 	osm_madw_t *p_madw = data;
-	const ib_path_rec_t *p_pr;
-	const ib_sa_mad_t *p_sa_mad;
-	const osm_port_t *p_src_port;
-	const osm_port_t *p_dest_port;
+	const ib_sa_mad_t *p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	ib_path_rec_t *p_pr = ib_sa_mad_get_payload_ptr(p_sa_mad);
 	cl_qlist_t pr_list;
-	ib_gid_t dgid;
-	ib_net16_t sa_status;
+	const ib_gid_t *p_sgid = NULL, *p_dgid = NULL;
+	const osm_alias_guid_t *p_src_alias_guid, *p_dest_alias_guid;
+	const osm_port_t *p_src_port, *p_dest_port;
 	osm_port_t *requester_port;
-	int ret;
+	uint8_t rate, mtu;
 
 	OSM_LOG_ENTER(sa->p_log);
 
 	CL_ASSERT(p_madw);
 
-	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
-	p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
-
 	CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_PATH_RECORD);
 
 	/* we only support SubnAdmGet and SubnAdmGetTable methods */
@@ -1654,7 +1720,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 		goto Exit;
 	}
 
-	/* update the requester physical port. */
+	/* update the requester physical port */
 	requester_port = osm_get_port_by_mad_addr(sa->p_log, sa->p_subn,
 						  osm_madw_get_mad_addr_ptr
 						  (p_madw));
@@ -1664,8 +1730,33 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 		goto Exit;
 	}
 
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
-		osm_dump_path_record(sa->p_log, p_pr, OSM_LOG_DEBUG);
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Requester port GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_port_get_guid(requester_port)));
+		osm_dump_path_record_v2(sa->p_log, p_pr, FILE_ID, OSM_LOG_DEBUG);
+	}
+
+	/* Validate rate if supplied */
+	if ((p_sa_mad->comp_mask & IB_PR_COMPMASK_RATESELEC) &&
+	    (p_sa_mad->comp_mask & IB_PR_COMPMASK_RATE)) {
+		rate = ib_path_rec_rate(p_pr);
+		if (!ib_rate_is_valid(rate)) {
+			osm_sa_send_error(sa, p_madw,
+					  IB_SA_MAD_STATUS_REQ_INVALID);
+			goto Exit;
+		}
+	}
+	/* Validate MTU if supplied */
+	if ((p_sa_mad->comp_mask & IB_PR_COMPMASK_MTUSELEC) &&
+	    (p_sa_mad->comp_mask & IB_PR_COMPMASK_MTU)) {
+		mtu = ib_path_rec_mtu(p_pr);
+		if (!ib_mtu_is_valid(mtu)) {
+			osm_sa_send_error(sa, p_madw,
+					  IB_SA_MAD_STATUS_REQ_INVALID);
+			goto Exit;
+		}
+	}
 
 	cl_qlist_init(&pr_list);
 
@@ -1676,128 +1767,129 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 	cl_plock_acquire(sa->p_lock);
 
 	/* Handle multicast destinations separately */
-	if ((ret = __osm_pr_rcv_check_mcast_dest(sa, p_madw)) < 0) {
-		/* Multicast DGID with unicast DLID */
-		cl_plock_release(sa->p_lock);
-		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_INVALID_FIELD);
-		goto Exit;
+	if ((p_sa_mad->comp_mask & IB_PR_COMPMASK_DGID) &&
+	    ib_gid_is_multicast(&p_pr->dgid)) {
+		pr_process_multicast(sa, p_sa_mad, &pr_list);
+		goto Unlock;
 	}
 
-	if (ret > 0)
-		goto McastDest;
-
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Unicast destination requested\n");
 
-	sa_status = __osm_pr_rcv_get_end_points(sa, p_madw,
-						&p_src_port, &p_dest_port,
-						&dgid);
-
-	if (sa_status == IB_SA_MAD_STATUS_SUCCESS) {
-		/*
-		   What happens next depends on the type of endpoint information
-		   that was specified....
-		 */
-		if (p_src_port) {
-			if (p_dest_port)
-				__osm_pr_rcv_process_pair(sa, p_madw,
-							  requester_port,
-							  p_src_port,
-							  p_dest_port, &dgid,
-							  p_sa_mad->comp_mask,
-							  &pr_list);
-			else
-				__osm_pr_rcv_process_half(sa, p_madw,
-							  requester_port,
-							  p_src_port, NULL,
-							  &dgid,
-							  p_sa_mad->comp_mask,
-							  &pr_list);
-		} else {
-			if (p_dest_port)
-				__osm_pr_rcv_process_half(sa, p_madw,
-							  requester_port, NULL,
-							  p_dest_port, &dgid,
-							  p_sa_mad->comp_mask,
-							  &pr_list);
-			else
-				/*
-				   Katie, bar the door!
-				 */
-				__osm_pr_rcv_process_world(sa, p_madw,
-							   requester_port,
-							   &dgid,
-							   p_sa_mad->comp_mask,
-							   &pr_list);
-		}
-	}
-	goto Unlock;
+	if (pr_rcv_get_end_points(sa, p_sa_mad,
+				  &p_src_alias_guid, &p_dest_alias_guid,
+				  &p_src_port, &p_dest_port,
+				  &p_sgid, &p_dgid) != IB_SA_MAD_STATUS_SUCCESS)
+		goto Unlock;
+	/*
+	   What happens next depends on the type of endpoint information
+	   that was specified....
+	 */
+	if (p_src_alias_guid) {
+		if (p_dest_alias_guid)
+			pr_rcv_process_pair(sa, p_sa_mad, requester_port,
+					    p_src_alias_guid, p_dest_alias_guid,
+					    p_sgid, p_dgid, &pr_list);
+		else if (!p_dest_port)
+			pr_rcv_process_half(sa, p_sa_mad, requester_port,
+					    p_src_alias_guid, NULL, p_sgid,
+					    p_dgid, &pr_list);
+		else {
+			/* Get all alias GUIDs for the dest port */
+			p_dest_alias_guid = (osm_alias_guid_t *) cl_qmap_head(&sa->p_subn->alias_port_guid_tbl);
+			while (p_dest_alias_guid !=
+			       (osm_alias_guid_t *) cl_qmap_end(&sa->p_subn->alias_port_guid_tbl)) {
+				if (osm_get_port_by_alias_guid(sa->p_subn, p_dest_alias_guid->alias_guid) ==
+				    p_dest_port)
+					pr_rcv_process_pair(sa, p_sa_mad,
+							    requester_port,
+							    p_src_alias_guid,
+							    p_dest_alias_guid,
+							    p_sgid, p_dgid,
+							    &pr_list);
+				if (p_sa_mad->method == IB_MAD_METHOD_GET &&
+				    cl_qlist_count(&pr_list) > 0)
+					break;
 
-McastDest:
-	OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Multicast destination requested\n");
-	{
-		osm_mgrp_t *p_mgrp = NULL;
-		ib_api_status_t status;
-		osm_pr_item_t *p_pr_item;
-		uint32_t flow_label;
-		uint8_t sl;
-		uint8_t hop_limit;
-
-		/* First, get the MC info */
-		p_mgrp = pr_get_mgrp(sa, p_madw);
-
-		if (!p_mgrp)
-			goto Unlock;
-
-		/* Make sure the rest of the PathRecord matches the MC group attributes */
-		status = __osm_pr_match_mgrp_attributes(sa, p_madw, p_mgrp);
-		if (status != IB_SUCCESS) {
-			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F19: "
-				"MC group attributes don't match PathRecord request\n");
-			goto Unlock;
+				p_dest_alias_guid = (osm_alias_guid_t *) cl_qmap_next(&p_dest_alias_guid->map_item);
+			}
 		}
-
-		p_pr_item = malloc(sizeof(*p_pr_item));
-		if (p_pr_item == NULL) {
-			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F18: "
-				"Unable to allocate path record for MC group\n");
-			goto Unlock;
+	} else {
+		if (p_dest_alias_guid)
+			pr_rcv_process_half(sa, p_sa_mad, requester_port,
+					    NULL, p_dest_alias_guid, p_sgid,
+					    p_dgid, &pr_list);
+		else if (!p_src_port && !p_dest_port)
+			/*
+			   Katie, bar the door!
+			 */
+			pr_rcv_process_world(sa, p_sa_mad, requester_port,
+					     p_sgid, p_dgid, &pr_list);
+		else if (p_src_port && !p_dest_port) {
+			/* Get all alias GUIDs for the src port */
+			p_src_alias_guid = (osm_alias_guid_t *) cl_qmap_head(&sa->p_subn->alias_port_guid_tbl);
+			while (p_src_alias_guid !=
+			       (osm_alias_guid_t *) cl_qmap_end(&sa->p_subn->alias_port_guid_tbl)) {
+				if (osm_get_port_by_alias_guid(sa->p_subn,
+							       p_src_alias_guid->alias_guid) ==
+				    p_src_port)
+					pr_rcv_process_half(sa, p_sa_mad,
+							    requester_port,
+							    p_src_alias_guid,
+							    NULL, p_sgid,
+							    p_dgid, &pr_list);
+				p_src_alias_guid = (osm_alias_guid_t *) cl_qmap_next(&p_src_alias_guid->map_item);
+			}
+		} else if (p_dest_port && !p_src_port) {
+			/* Get all alias GUIDs for the dest port */
+			p_dest_alias_guid = (osm_alias_guid_t *) cl_qmap_head(&sa->p_subn->alias_port_guid_tbl);
+			while (p_dest_alias_guid !=
+			       (osm_alias_guid_t *) cl_qmap_end(&sa->p_subn->alias_port_guid_tbl)) {
+				if (osm_get_port_by_alias_guid(sa->p_subn,
+							       p_dest_alias_guid->alias_guid) ==
+				    p_dest_port)
+					pr_rcv_process_half(sa, p_sa_mad,
+							    requester_port,
+							    NULL,
+							    p_dest_alias_guid,
+							    p_sgid, p_dgid,
+							    &pr_list);
+				p_dest_alias_guid = (osm_alias_guid_t *) cl_qmap_next(&p_dest_alias_guid->map_item);
+			}
+		} else {
+			/* Get all alias GUIDs for the src port */
+			p_src_alias_guid = (osm_alias_guid_t *) cl_qmap_head(&sa->p_subn->alias_port_guid_tbl);
+			while (p_src_alias_guid !=
+			       (osm_alias_guid_t *) cl_qmap_end(&sa->p_subn->alias_port_guid_tbl)) {
+				if (osm_get_port_by_alias_guid(sa->p_subn,
+							       p_src_alias_guid->alias_guid) ==
+				    p_src_port) {
+					/* Get all alias GUIDs for the dest port */
+					p_dest_alias_guid = (osm_alias_guid_t *) cl_qmap_head(&sa->p_subn->alias_port_guid_tbl);
+					while (p_dest_alias_guid !=
+					       (osm_alias_guid_t *) cl_qmap_end(&sa->p_subn->alias_port_guid_tbl)) {
+						if (osm_get_port_by_alias_guid(sa->p_subn,
+									       p_dest_alias_guid->alias_guid) ==
+						    p_dest_port)
+						pr_rcv_process_pair(sa,
+								    p_sa_mad,
+								    requester_port,
+								    p_src_alias_guid,
+								    p_dest_alias_guid,
+								    p_sgid,
+								    p_dgid,
+								    &pr_list);
+						if (p_sa_mad->method == IB_MAD_METHOD_GET &&
+						    cl_qlist_count(&pr_list) > 0)
+							break;
+						p_dest_alias_guid = (osm_alias_guid_t *) cl_qmap_next(&p_dest_alias_guid->map_item);
+					}
+				}
+				if (p_sa_mad->method == IB_MAD_METHOD_GET &&
+				    cl_qlist_count(&pr_list) > 0)
+					break;
+				p_src_alias_guid = (osm_alias_guid_t *) cl_qmap_next(&p_src_alias_guid->map_item);
+			}
 		}
-		memset(p_pr_item, 0, sizeof(*p_pr_item));
-
-		/* Copy PathRecord request into response */
-		p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
-		p_pr = (ib_path_rec_t *)
-		    ib_sa_mad_get_payload_ptr(p_sa_mad);
-		p_pr_item->path_rec = *p_pr;
-
-		/* Now, use the MC info to cruft up the PathRecord response */
-		p_pr_item->path_rec.dgid = p_mgrp->mcmember_rec.mgid;
-		p_pr_item->path_rec.dlid = p_mgrp->mcmember_rec.mlid;
-		p_pr_item->path_rec.tclass = p_mgrp->mcmember_rec.tclass;
-		p_pr_item->path_rec.num_path = 1;
-		p_pr_item->path_rec.pkey = p_mgrp->mcmember_rec.pkey;
-
-		/* MTU, rate, and packet lifetime should be exactly */
-		p_pr_item->path_rec.mtu = (2 << 6) | p_mgrp->mcmember_rec.mtu;
-		p_pr_item->path_rec.rate = (2 << 6) | p_mgrp->mcmember_rec.rate;
-		p_pr_item->path_rec.pkt_life =
-		    (2 << 6) | p_mgrp->mcmember_rec.pkt_life;
-
-		/* SL, Hop Limit, and Flow Label */
-		ib_member_get_sl_flow_hop(p_mgrp->mcmember_rec.sl_flow_hop,
-					  &sl, &flow_label, &hop_limit);
-		ib_path_rec_set_sl(&p_pr_item->path_rec, sl);
-		ib_path_rec_set_qos_class(&p_pr_item->path_rec, 0);
-
-		/* HopLimit is not yet set in non link local MC groups */
-		/* If it were, this would not be needed */
-		if (ib_mgid_get_scope(&p_mgrp->mcmember_rec.mgid) != IB_MC_SCOPE_LINK_LOCAL)
-			hop_limit = IB_HOPLIMIT_MAX;
-
-		p_pr_item->path_rec.hop_flow_raw =
-			cl_hton32(hop_limit) | (flow_label << 8);
-
-		cl_qlist_insert_tail(&pr_list, &p_pr_item->list_item);
 	}
 
 Unlock:
diff --git a/opensm/osm_sa_pkey_record.c b/opensm/osm_sa_pkey_record.c
index d57c239..691a716 100644
--- a/opensm/osm_sa_pkey_record.c
+++ b/opensm/osm_sa_pkey_record.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -43,6 +43,8 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_PKEY_RECORD_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
@@ -64,17 +66,13 @@ typedef struct osm_pkey_search_ctxt {
 	const osm_physp_t *p_req_physp;
 } osm_pkey_search_ctxt_t;
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_pkey_create(IN osm_sa_t * sa,
-		     IN osm_physp_t * const p_physp,
-		     IN osm_pkey_search_ctxt_t * const p_ctxt,
-		     IN uint16_t block)
+static void sa_pkey_create(IN osm_sa_t * sa, IN osm_physp_t * p_physp,
+			   IN osm_pkey_search_ctxt_t * p_ctxt,
+			   IN uint16_t block)
 {
 	osm_pkey_item_t *p_rec_item;
 	uint16_t lid;
-	ib_api_status_t status = IB_SUCCESS;
+	ib_pkey_table_t *tbl;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -82,7 +80,6 @@ __osm_sa_pkey_create(IN osm_sa_t * sa,
 	if (p_rec_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4602: "
 			"rec_item alloc failed\n");
-		status = IB_INSUFFICIENT_RESOURCES;
 		goto Exit;
 	}
 
@@ -102,8 +99,15 @@ __osm_sa_pkey_create(IN osm_sa_t * sa,
 	p_rec_item->rec.lid = lid;
 	p_rec_item->rec.block_num = block;
 	p_rec_item->rec.port_num = osm_physp_get_port_num(p_physp);
-	p_rec_item->rec.pkey_tbl =
-	    *(osm_pkey_tbl_block_get(osm_physp_get_pkey_tbl(p_physp), block));
+	/* FIXME: There are ninf.PartitionCap or swinf.PartitionEnforcementCap
+	   pkey entries so everything in that range is a valid block number
+	   even if opensm is not using it. Return 0. However things outside
+	   that range should return no entries.. Not sure how to figure that
+	   here? The range of pkey_tbl can be less than the cap, so
+	   this falsely triggers. */
+	tbl = osm_pkey_tbl_block_get(osm_physp_get_pkey_tbl(p_physp), block);
+	if (tbl)
+		p_rec_item->rec.pkey_tbl = *tbl;
 
 	cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);
 
@@ -111,12 +115,8 @@ Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_pkey_check_physp(IN osm_sa_t * sa,
-			  IN osm_physp_t * const p_physp,
-			  osm_pkey_search_ctxt_t * const p_ctxt)
+static void sa_pkey_check_physp(IN osm_sa_t * sa, IN osm_physp_t * p_physp,
+				osm_pkey_search_ctxt_t * p_ctxt)
 {
 	ib_net64_t comp_mask = p_ctxt->comp_mask;
 	uint16_t block, num_blocks;
@@ -125,25 +125,20 @@ __osm_sa_pkey_check_physp(IN osm_sa_t * sa,
 
 	/* we got here with the phys port - all is left is to get the right block */
 	if (comp_mask & IB_PKEY_COMPMASK_BLOCK) {
-		__osm_sa_pkey_create(sa, p_physp, p_ctxt, p_ctxt->block_num);
+		sa_pkey_create(sa, p_physp, p_ctxt, p_ctxt->block_num);
 	} else {
 		num_blocks =
 		    osm_pkey_tbl_get_num_blocks(osm_physp_get_pkey_tbl
 						(p_physp));
-		for (block = 0; block < num_blocks; block++) {
-			__osm_sa_pkey_create(sa, p_physp, p_ctxt, block);
-		}
+		for (block = 0; block < num_blocks; block++)
+			sa_pkey_create(sa, p_physp, p_ctxt, block);
 	}
 
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_pkey_by_comp_mask(IN osm_sa_t * sa,
-			   IN const osm_port_t * const p_port,
-			   osm_pkey_search_ctxt_t * const p_ctxt)
+static void sa_pkey_by_comp_mask(IN osm_sa_t * sa, IN const osm_port_t * p_port,
+				 osm_pkey_search_ctxt_t * p_ctxt)
 {
 	const ib_pkey_table_record_t *p_rcvd_rec;
 	ib_net64_t comp_mask;
@@ -177,10 +172,9 @@ __osm_sa_pkey_by_comp_mask(IN osm_sa_t * sa,
 			/* Check that the p_physp is valid, and that is shares a pkey
 			   with the p_req_physp. */
 			if (p_physp &&
-			    (osm_physp_share_pkey
-			     (sa->p_log, p_req_physp, p_physp)))
-				__osm_sa_pkey_check_physp(sa, p_physp,
-							  p_ctxt);
+			    osm_physp_share_pkey(sa->p_log, p_req_physp,
+						 p_physp, sa->p_subn->opt.allow_both_pkeys))
+				sa_pkey_check_physp(sa, p_physp, p_ctxt);
 		} else {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4603: "
 				"Given Physical Port Number: 0x%X is out of range should be < 0x%X\n",
@@ -199,43 +193,33 @@ __osm_sa_pkey_by_comp_mask(IN osm_sa_t * sa,
 			/* if the requester and the p_physp don't share a pkey -
 			   continue */
 			if (!osm_physp_share_pkey
-			    (sa->p_log, p_req_physp, p_physp))
+			    (sa->p_log, p_req_physp, p_physp, sa->p_subn->opt.allow_both_pkeys))
 				continue;
 
-			__osm_sa_pkey_check_physp(sa, p_physp, p_ctxt);
+			sa_pkey_check_physp(sa, p_physp, p_ctxt);
 		}
 	}
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_pkey_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
-			      IN void *context)
+static void sa_pkey_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt)
 {
-	const osm_port_t *const p_port = (osm_port_t *) p_map_item;
-	osm_pkey_search_ctxt_t *const p_ctxt =
-	    (osm_pkey_search_ctxt_t *) context;
+	const osm_port_t *p_port = (osm_port_t *) p_map_item;
+	osm_pkey_search_ctxt_t *p_ctxt = cxt;
 
-	__osm_sa_pkey_by_comp_mask(p_ctxt->sa, p_port, p_ctxt);
+	sa_pkey_by_comp_mask(p_ctxt->sa, p_port, p_ctxt);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 {
 	osm_sa_t *sa = ctx;
 	osm_madw_t *p_madw = data;
 	const ib_sa_mad_t *p_rcvd_mad;
 	const ib_pkey_table_record_t *p_rcvd_rec;
-	const cl_ptr_vector_t *p_tbl;
 	const osm_port_t *p_port = NULL;
-	const ib_pkey_table_t *p_pkey;
 	cl_qlist_t rec_list;
 	osm_pkey_search_ctxt_t context;
-	ib_api_status_t status = IB_SUCCESS;
 	ib_net64_t comp_mask;
 	osm_physp_t *p_req_physp;
 
@@ -277,7 +261,7 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 		goto Exit;
 	}
 
-	/* update the requester physical port. */
+	/* update the requester physical port */
 	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
@@ -286,8 +270,9 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 			"Cannot find requester physical port\n");
 		goto Exit;
 	}
-
-	p_pkey = (ib_pkey_table_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+		"Requester port GUID 0x%" PRIx64 "\n",
+		cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
 
 	cl_qlist_init(&rec_list);
 
@@ -295,14 +280,14 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 	context.p_list = &rec_list;
 	context.comp_mask = p_rcvd_mad->comp_mask;
 	context.sa = sa;
-	context.block_num = p_rcvd_rec->block_num;
+	context.block_num = cl_ntoh16(p_rcvd_rec->block_num);
 	context.p_req_physp = p_req_physp;
 
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 		"Got Query Lid:%u(%02X), Block:0x%02X(%02X), Port:0x%02X(%02X)\n",
 		cl_ntoh16(p_rcvd_rec->lid),
 		(comp_mask & IB_PKEY_COMPMASK_LID) != 0, p_rcvd_rec->port_num,
-		(comp_mask & IB_PKEY_COMPMASK_PORT) != 0, p_rcvd_rec->block_num,
+		(comp_mask & IB_PKEY_COMPMASK_PORT) != 0, context.block_num,
 		(comp_mask & IB_PKEY_COMPMASK_BLOCK) != 0);
 
 	cl_plock_acquire(sa->p_lock);
@@ -312,31 +297,16 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 	   work load, since we don't have to search every port
 	 */
 	if (comp_mask & IB_PKEY_COMPMASK_LID) {
-
-		p_tbl = &sa->p_subn->port_lid_tbl;
-
-		CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000);
-
-		status = osm_get_port_by_base_lid(sa->p_subn, p_rcvd_rec->lid,
-						  &p_port);
-		if (status != IB_SUCCESS || p_port == NULL) {
-			status = IB_NOT_FOUND;
+		p_port = osm_get_port_by_lid(sa->p_subn, p_rcvd_rec->lid);
+		if (!p_port)
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 460B: "
 				"No port found with LID %u\n",
 				cl_ntoh16(p_rcvd_rec->lid));
-		}
-	}
-
-	if (status == IB_SUCCESS) {
-		/* if we got a unique port - no need for a port search */
-		if (p_port)
-			/* this does the loop on all the port phys ports */
-			__osm_sa_pkey_by_comp_mask(sa, p_port, &context);
 		else
-			cl_qmap_apply_func(&sa->p_subn->port_guid_tbl,
-					   __osm_sa_pkey_by_comp_mask_cb,
-					   &context);
-	}
+			sa_pkey_by_comp_mask(sa, p_port, &context);
+	} else
+		cl_qmap_apply_func(&sa->p_subn->port_guid_tbl,
+				   sa_pkey_by_comp_mask_cb, &context);
 
 	cl_plock_release(sa->p_lock);
 
diff --git a/opensm/osm_sa_portinfo_record.c b/opensm/osm_sa_portinfo_record.c
index 753c3db..b9627c9 100644
--- a/opensm/osm_sa_portinfo_record.c
+++ b/opensm/osm_sa_portinfo_record.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -50,6 +50,8 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_PORTINFO_RECORD_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
@@ -72,14 +74,14 @@ typedef struct osm_pir_search_ctxt {
 	boolean_t is_enhanced_comp_mask;
 } osm_pir_search_ctxt_t;
 
-/**********************************************************************
- **********************************************************************/
-static ib_api_status_t
-__osm_pir_rcv_new_pir(IN osm_sa_t * sa,
-		      IN const osm_physp_t * const p_physp,
-		      IN cl_qlist_t * const p_list, IN ib_net16_t const lid)
+static ib_api_status_t pir_rcv_new_pir(IN osm_sa_t * sa,
+				       IN const osm_physp_t * p_physp,
+				       IN osm_pir_search_ctxt_t * p_ctxt,
+				       IN ib_net16_t const lid)
 {
 	osm_pir_item_t *p_rec_item;
+	ib_port_info_t *p_pi;
+	osm_physp_t *p_physp0;
 	ib_api_status_t status = IB_SUCCESS;
 
 	OSM_LOG_ENTER(sa->p_log);
@@ -102,21 +104,43 @@ __osm_pir_rcv_new_pir(IN osm_sa_t * sa,
 
 	p_rec_item->rec.lid = lid;
 	p_rec_item->rec.port_info = p_physp->port_info;
+	if (p_ctxt->comp_mask & IB_PIR_COMPMASK_OPTIONS)
+		p_rec_item->rec.options = p_ctxt->p_rcvd_rec->options;
+	if ((p_ctxt->comp_mask & IB_PIR_COMPMASK_OPTIONS) == 0 ||
+	    (p_ctxt->p_rcvd_rec->options & 0x80) == 0) {
+		/* Does requested port have an extended link speed active ? */
+		if (osm_node_get_type(p_physp->p_node) ==
+		    IB_NODE_TYPE_SWITCH) {
+			p_physp0 = osm_node_get_physp_ptr(p_physp->p_node, 0);
+			p_pi = &p_physp0->port_info;
+		} else
+			p_pi = (ib_port_info_t *) &p_physp->port_info;
+		if ((p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) > 0) {
+			if (ib_port_info_get_link_speed_ext_active(&p_physp->port_info)) {
+				/* Add QDR bits to original link speed components */
+				p_pi = &p_rec_item->rec.port_info;
+				ib_port_info_set_link_speed_enabled(p_pi,
+								    ib_port_info_get_link_speed_enabled(p_pi) | IB_LINK_SPEED_ACTIVE_10);
+				p_pi->state_info1 =
+				    (uint8_t) ((p_pi->state_info1 & IB_PORT_STATE_MASK) |
+					       (ib_port_info_get_link_speed_sup(p_pi) | IB_LINK_SPEED_ACTIVE_10) << IB_PORT_LINK_SPEED_SHIFT);
+				p_pi->link_speed =
+				    (uint8_t) ((p_pi->link_speed & IB_PORT_LINK_SPEED_ENABLED_MASK) |
+					       (ib_port_info_get_link_speed_active(p_pi) | IB_LINK_SPEED_ACTIVE_10) << IB_PORT_LINK_SPEED_SHIFT);
+			}
+		}
+	}
 	p_rec_item->rec.port_num = osm_physp_get_port_num(p_physp);
 
-	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
+	cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_pir_create(IN osm_sa_t * sa,
-		    IN const osm_physp_t * const p_physp,
-		    IN osm_pir_search_ctxt_t * const p_ctxt)
+static void sa_pir_create(IN osm_sa_t * sa, IN const osm_physp_t * p_physp,
+			  IN osm_pir_search_ctxt_t * p_ctxt)
 {
 	uint8_t lmc;
 	uint16_t max_lid_ho;
@@ -131,8 +155,7 @@ __osm_sa_pir_create(IN osm_sa_t * sa,
 		base_lid_ho = cl_ntoh16(osm_physp_get_base_lid(p_node_physp));
 		lmc =
 		    osm_switch_sp0_is_lmc_capable(p_physp->p_node->sw,
-						  sa->
-						  p_subn) ?
+						  sa->p_subn) ?
 		    osm_physp_get_lmc(p_node_physp) : 0;
 	} else {
 		lmc = osm_physp_get_lmc(p_physp);
@@ -154,24 +177,21 @@ __osm_sa_pir_create(IN osm_sa_t * sa,
 			goto Exit;
 	}
 
-	__osm_pir_rcv_new_pir(sa, p_physp, p_ctxt->p_list,
-			      cl_hton16(base_lid_ho));
+	pir_rcv_new_pir(sa, p_physp, p_ctxt, cl_hton16(base_lid_ho));
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_pir_check_physp(IN osm_sa_t * sa,
-			 IN const osm_physp_t * const p_physp,
-			 osm_pir_search_ctxt_t * const p_ctxt)
+static void sa_pir_check_physp(IN osm_sa_t * sa, IN const osm_physp_t * p_physp,
+			       osm_pir_search_ctxt_t * p_ctxt)
 {
 	const ib_portinfo_record_t *p_rcvd_rec;
 	ib_net64_t comp_mask;
 	const ib_port_info_t *p_comp_pi;
 	const ib_port_info_t *p_pi;
+	const osm_physp_t * p_physp0;
+	ib_net32_t cap_mask;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -180,11 +200,9 @@ __osm_sa_pir_check_physp(IN osm_sa_t * sa,
 	p_comp_pi = &p_rcvd_rec->port_info;
 	p_pi = &p_physp->port_info;
 
-	osm_dump_port_info(sa->p_log,
-			   osm_node_get_node_guid(p_physp->p_node),
-			   p_physp->port_guid,
-			   p_physp->port_num,
-			   &p_physp->port_info, OSM_LOG_DEBUG);
+	osm_dump_port_info_v2(sa->p_log, osm_node_get_node_guid(p_physp->p_node),
+			      p_physp->port_guid, p_physp->port_num,
+			      &p_physp->port_info, FILE_ID, OSM_LOG_DEBUG);
 
 	/* We have to re-check the base_lid, since if the given
 	   base_lid in p_pi is zero - we are comparing on all ports. */
@@ -209,8 +227,8 @@ __osm_sa_pir_check_physp(IN osm_sa_t * sa,
 	   of the attribute modifier of the Get/GetTable is set */
 	if (comp_mask & IB_PIR_COMPMASK_CAPMASK) {
 		if (p_ctxt->is_enhanced_comp_mask) {
-			if (((p_comp_pi->capability_mask & p_pi->
-			      capability_mask) != p_comp_pi->capability_mask))
+			if ((p_comp_pi->capability_mask & p_pi->
+			     capability_mask) != p_comp_pi->capability_mask)
 				goto Exit;
 		} else {
 			if (p_comp_pi->capability_mask != p_pi->capability_mask)
@@ -387,18 +405,51 @@ __osm_sa_pir_check_physp(IN osm_sa_t * sa,
 			goto Exit;
 	}
 
-	__osm_sa_pir_create(sa, p_physp, p_ctxt);
+	/* IBTA 1.2 errata provides support for bitwise compare if the bit 31
+	   of the attribute modifier of the Get/GetTable is set */
+	if (comp_mask & IB_PIR_COMPMASK_CAPMASK2) {
+		if (p_ctxt->is_enhanced_comp_mask) {
+			if ((cl_ntoh16(p_comp_pi->capability_mask2) &
+			     cl_ntoh16(p_pi->capability_mask2)) !=
+			     cl_ntoh16(p_comp_pi->capability_mask2))
+				goto Exit;
+		} else {
+			if (cl_ntoh16(p_comp_pi->capability_mask2) !=
+			    cl_ntoh16(p_pi->capability_mask2))
+				goto Exit;
+		}
+	}
+	if (osm_node_get_type(p_physp->p_node) == IB_NODE_TYPE_SWITCH) {
+		p_physp0 = osm_node_get_physp_ptr(p_physp->p_node, 0);
+		cap_mask = p_physp0->port_info.capability_mask;
+	} else
+		cap_mask = p_pi->capability_mask;
+	if (comp_mask & IB_PIR_COMPMASK_LINKSPDEXTACT) {
+		if (((cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) > 0) &&
+		    (ib_port_info_get_link_speed_ext_active(p_comp_pi) !=
+		     ib_port_info_get_link_speed_ext_active(p_pi)))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_LINKSPDEXTSUPP) {
+		if (((cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) > 0) &&
+		    (ib_port_info_get_link_speed_ext_sup(p_comp_pi) !=
+		     ib_port_info_get_link_speed_ext_sup(p_pi)))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_LINKSPDEXTENAB) {
+		if (((cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) > 0) &&
+		    (ib_port_info_get_link_speed_ext_enabled(p_comp_pi) !=
+		     ib_port_info_get_link_speed_ext_enabled(p_pi)))
+			goto Exit;
+	}
+	sa_pir_create(sa, p_physp, p_ctxt);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_pir_by_comp_mask(IN osm_sa_t * sa,
-			  IN osm_node_t * const p_node,
-			  osm_pir_search_ctxt_t * const p_ctxt)
+static void sa_pir_by_comp_mask(IN osm_sa_t * sa, IN osm_node_t * p_node,
+				osm_pir_search_ctxt_t * p_ctxt)
 {
 	const ib_portinfo_record_t *p_rcvd_rec;
 	ib_net64_t comp_mask;
@@ -423,57 +474,46 @@ __osm_sa_pir_by_comp_mask(IN osm_sa_t * sa,
 			/* Check that the p_physp is valid, and that the
 			   p_physp and the p_req_physp share a pkey. */
 			if (p_physp &&
-			    osm_physp_share_pkey(sa->p_log, p_req_physp,
-						 p_physp))
-				__osm_sa_pir_check_physp(sa, p_physp,
-							 p_ctxt);
+			    osm_physp_share_pkey(sa->p_log, p_req_physp, p_physp,
+						 sa->p_subn->opt.allow_both_pkeys))
+				sa_pir_check_physp(sa, p_physp, p_ctxt);
 		}
 	} else {
 		for (port_num = 0; port_num < num_ports; port_num++) {
-			p_physp =
-			    osm_node_get_physp_ptr(p_node, port_num);
+			p_physp = osm_node_get_physp_ptr(p_node, port_num);
 			if (!p_physp)
 				continue;
 
 			/* if the requester and the p_physp don't share a pkey -
 			   continue */
-			if (!osm_physp_share_pkey
-			    (sa->p_log, p_req_physp, p_physp))
+			if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_physp,
+						  sa->p_subn->opt.allow_both_pkeys))
 				continue;
 
-			__osm_sa_pir_check_physp(sa, p_physp, p_ctxt);
+			sa_pir_check_physp(sa, p_physp, p_ctxt);
 		}
 	}
 
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_pir_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
-			     IN void *context)
+static void sa_pir_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt)
 {
-	osm_node_t *const p_node = (osm_node_t *) p_map_item;
-	osm_pir_search_ctxt_t *const p_ctxt = (osm_pir_search_ctxt_t *) context;
+	osm_node_t *p_node = (osm_node_t *) p_map_item;
+	osm_pir_search_ctxt_t *p_ctxt = cxt;
 
-	__osm_sa_pir_by_comp_mask(p_ctxt->sa, p_node, p_ctxt);
+	sa_pir_by_comp_mask(p_ctxt->sa, p_node, p_ctxt);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_pir_rcv_process(IN void *ctx, IN void *data)
 {
 	osm_sa_t *sa = ctx;
 	osm_madw_t *p_madw = data;
 	const ib_sa_mad_t *p_rcvd_mad;
 	const ib_portinfo_record_t *p_rcvd_rec;
-	const cl_ptr_vector_t *p_tbl;
 	const osm_port_t *p_port = NULL;
-	const ib_port_info_t *p_pi;
 	cl_qlist_t rec_list;
 	osm_pir_search_ctxt_t context;
-	ib_api_status_t status = IB_SUCCESS;
 	ib_net64_t comp_mask;
 	osm_physp_t *p_req_physp;
 
@@ -500,7 +540,7 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 		goto Exit;
 	}
 
-	/* update the requester physical port. */
+	/* update the requester physical port */
 	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
@@ -510,11 +550,12 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 		goto Exit;
 	}
 
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
-		osm_dump_portinfo_record(sa->p_log, p_rcvd_rec, OSM_LOG_DEBUG);
-
-	p_tbl = &sa->p_subn->port_lid_tbl;
-	p_pi = &p_rcvd_rec->port_info;
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Requester port GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
+		osm_dump_portinfo_record_v2(sa->p_log, p_rcvd_rec, FILE_ID, OSM_LOG_DEBUG);
+	}
 
 	cl_qlist_init(&rec_list);
 
@@ -528,45 +569,21 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 
 	cl_plock_acquire(sa->p_lock);
 
-	CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000);
-
 	/*
 	   If the user specified a LID, it obviously narrows our
 	   work load, since we don't have to search every port
 	 */
-	if (comp_mask & IB_PIR_COMPMASK_LID) {
-		status =
-		    osm_get_port_by_base_lid(sa->p_subn, p_rcvd_rec->lid,
-					     &p_port);
-		if ((status != IB_SUCCESS) || (p_port == NULL)) {
-			status = IB_NOT_FOUND;
+	if (comp_mask & (IB_PIR_COMPMASK_LID | IB_PIR_COMPMASK_BASELID)) {
+		p_port = osm_get_port_by_lid(sa->p_subn, p_rcvd_rec->lid);
+		if (p_port)
+			sa_pir_by_comp_mask(sa, p_port->p_node, &context);
+		else
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2109: "
 				"No port found with LID %u\n",
 				cl_ntoh16(p_rcvd_rec->lid));
-		}
-	} else if (comp_mask & IB_PIR_COMPMASK_BASELID) {
-		if ((uint16_t) cl_ptr_vector_get_size(p_tbl) >
-		    cl_ntoh16(p_pi->base_lid))
-			p_port = cl_ptr_vector_get(p_tbl,
-						   cl_ntoh16(p_pi->base_lid));
-		else {
-			status = IB_NOT_FOUND;
-			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2103: "
-				"Given LID (%u) is out of range:%u\n",
-				cl_ntoh16(p_pi->base_lid),
-				cl_ptr_vector_get_size(p_tbl));
-		}
-	}
-
-	if (status == IB_SUCCESS) {
-		if (p_port)
-			__osm_sa_pir_by_comp_mask(sa, p_port->p_node,
-						  &context);
-		else
-			cl_qmap_apply_func(&sa->p_subn->node_guid_tbl,
-					   __osm_sa_pir_by_comp_mask_cb,
-					   &context);
-	}
+	} else
+		cl_qmap_apply_func(&sa->p_subn->node_guid_tbl,
+				   sa_pir_by_comp_mask_cb, &context);
 
 	cl_plock_release(sa->p_lock);
 
@@ -581,7 +598,7 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 		osm_pir_item_t *item;
 		for (item = (osm_pir_item_t *) cl_qlist_head(&rec_list);
 		     item != (osm_pir_item_t *) cl_qlist_end(&rec_list);
-		     item = (osm_pir_item_t *)cl_qlist_next(&item->list_item))
+		     item = (osm_pir_item_t *) cl_qlist_next(&item->list_item))
 			item->rec.port_info.m_key = 0;
 	}
 
diff --git a/opensm/osm_sa_service_record.c b/opensm/osm_sa_service_record.c
index 66b4cb7..fe21712 100644
--- a/opensm/osm_sa_service_record.c
+++ b/opensm/osm_sa_service_record.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -50,6 +50,8 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_SERVICE_RECORD_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
@@ -76,22 +78,19 @@ typedef struct osm_sr_search_ctxt {
 	const osm_physp_t *p_req_physp;
 } osm_sr_search_ctxt_t;
 
-/**********************************************************************
- **********************************************************************/
 static boolean_t
-__match_service_pkey_with_ports_pkey(IN osm_sa_t * sa,
-				     IN const osm_madw_t * const p_madw,
-				     ib_service_record_t * const p_service_rec,
-				     ib_net64_t const comp_mask)
+match_service_pkey_with_ports_pkey(IN osm_sa_t * sa,
+				   IN const osm_madw_t * p_madw,
+				   ib_service_record_t * p_service_rec,
+				   ib_net64_t const comp_mask)
 {
 	boolean_t valid = TRUE;
 	osm_physp_t *p_req_physp;
 	ib_net64_t service_guid;
 	osm_port_t *service_port;
 
-	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
-						sa->p_subn,
+	/* update the requester physical port */
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
@@ -100,10 +99,13 @@ __match_service_pkey_with_ports_pkey(IN osm_sa_t * sa,
 		valid = FALSE;
 		goto Exit;
 	}
+	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+		"Requester port GUID 0x%" PRIx64 "\n",
+		cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
 
 	if ((comp_mask & IB_SR_COMPMASK_SPKEY) == IB_SR_COMPMASK_SPKEY) {
-		/* We have a ServiceP_Key - check matching on requester port, and
-		   ServiceGid port (if such exists) */
+		/* We have a ServiceP_Key - check matching on requester port,
+		   and ServiceGid port (if such exists) */
 		/* Make sure it matches the p_req_physp */
 		if (!osm_physp_has_pkey
 		    (sa->p_log, p_service_rec->service_pkey, p_req_physp)) {
@@ -111,12 +113,13 @@ __match_service_pkey_with_ports_pkey(IN osm_sa_t * sa,
 			goto Exit;
 		}
 
-		/* Make sure it matches the port of the ServiceGid */
-		if ((comp_mask & IB_SR_COMPMASK_SGID) == IB_SR_COMPMASK_SGID) {
+		/* If unicast, make sure it matches the port of the ServiceGid */
+		if (comp_mask & IB_SR_COMPMASK_SGID &&
+		    !ib_gid_is_multicast(&p_service_rec->service_gid)) {
 			service_guid =
 			    p_service_rec->service_gid.unicast.interface_id;
 			service_port =
-			    osm_get_port_by_guid(sa->p_subn, service_guid);
+			    osm_get_port_by_alias_guid(sa->p_subn, service_guid);
 			if (!service_port) {
 				OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2405: "
 					"No port object for port 0x%016" PRIx64
@@ -138,12 +141,10 @@ Exit:
 	return valid;
 }
 
-/**********************************************************************
- **********************************************************************/
 static boolean_t
-__match_name_to_key_association(IN osm_sa_t * sa,
-				ib_service_record_t * p_service_rec,
-				ib_net64_t comp_mask)
+match_name_to_key_association(IN osm_sa_t * sa,
+			      ib_service_record_t * p_service_rec,
+			      ib_net64_t comp_mask)
 {
 	UNUSED_PARAM(p_service_rec);
 	UNUSED_PARAM(sa);
@@ -159,10 +160,7 @@ __match_name_to_key_association(IN osm_sa_t * sa,
 	return TRUE;
 }
 
-/**********************************************************************
- **********************************************************************/
-static boolean_t
-__validate_sr(IN osm_sa_t * sa, IN const osm_madw_t * const p_madw)
+static boolean_t validate_sr(IN osm_sa_t * sa, IN const osm_madw_t * p_madw)
 {
 	boolean_t valid = TRUE;
 	ib_sa_mad_t *p_sa_mad;
@@ -174,11 +172,9 @@ __validate_sr(IN osm_sa_t * sa, IN const osm_madw_t * const p_madw)
 	p_recvd_service_rec =
 	    (ib_service_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
 
-	valid = __match_service_pkey_with_ports_pkey(sa,
-						     p_madw,
-						     p_recvd_service_rec,
-						     p_sa_mad->comp_mask);
-
+	valid = match_service_pkey_with_ports_pkey(sa, p_madw,
+						   p_recvd_service_rec,
+						   p_sa_mad->comp_mask);
 	if (!valid) {
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"No Match for Service Pkey\n");
@@ -186,10 +182,8 @@ __validate_sr(IN osm_sa_t * sa, IN const osm_madw_t * const p_madw)
 		goto Exit;
 	}
 
-	valid = __match_name_to_key_association(sa,
-						p_recvd_service_rec,
-						p_sa_mad->comp_mask);
-
+	valid = match_name_to_key_association(sa, p_recvd_service_rec,
+					      p_sa_mad->comp_mask);
 	if (!valid) {
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"Service Record Name to key matching failed\n");
@@ -202,12 +196,8 @@ Exit:
 	return valid;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sr_rcv_respond(IN osm_sa_t * sa,
-		     IN osm_madw_t * const p_madw,
-		     IN cl_qlist_t * const p_list)
+static void sr_rcv_respond(IN osm_sa_t * sa, IN osm_madw_t * p_madw,
+			   IN cl_qlist_t * p_list)
 {
 	/* p923 - The ServiceKey shall be set to 0, except in the case of
 	   a trusted request.
@@ -219,7 +209,7 @@ __osm_sr_rcv_respond(IN osm_sa_t * sa,
 		osm_sr_item_t *item;
 		for (item = (osm_sr_item_t *) cl_qlist_head(p_list);
 		     item != (osm_sr_item_t *) cl_qlist_end(p_list);
-		     item = (osm_sr_item_t *)cl_qlist_next(&item->list_item))
+		     item = (osm_sr_item_t *) cl_qlist_next(&item->list_item))
 			memset(item->service_rec.service_key, 0,
 			       sizeof(item->service_rec.service_key));
 	}
@@ -227,201 +217,198 @@ __osm_sr_rcv_respond(IN osm_sa_t * sa,
 	osm_sa_respond(sa, p_madw, sizeof(ib_service_record_t), p_list);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__get_matching_sr(IN cl_list_item_t * const p_list_item, IN void *context)
+static void get_matching_sr(IN cl_list_item_t * p_list_item, IN void *context)
 {
-	osm_sr_search_ctxt_t *const p_ctxt = (osm_sr_search_ctxt_t *) context;
+	osm_sr_search_ctxt_t *p_ctxt = context;
 	osm_svcr_t *p_svcr = (osm_svcr_t *) p_list_item;
 	osm_sr_item_t *p_sr_pool_item;
 	osm_sr_match_item_t *p_sr_item = p_ctxt->p_sr_item;
 	ib_net64_t comp_mask = p_sr_item->comp_mask;
 	const osm_physp_t *p_req_physp = p_ctxt->p_req_physp;
 
-	if ((comp_mask & IB_SR_COMPMASK_SID) == IB_SR_COMPMASK_SID) {
+	if (comp_mask & IB_SR_COMPMASK_SID) {
 		if (p_sr_item->p_service_rec->service_id !=
 		    p_svcr->service_record.service_id)
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SGID) == IB_SR_COMPMASK_SGID) {
+	if (comp_mask & IB_SR_COMPMASK_SGID) {
 		if (memcmp(&p_sr_item->p_service_rec->service_gid,
 			   &p_svcr->service_record.service_gid,
 			   sizeof(p_svcr->service_record.service_gid)) != 0)
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SPKEY) == IB_SR_COMPMASK_SPKEY) {
+	if (comp_mask & IB_SR_COMPMASK_SPKEY) {
 		if (p_sr_item->p_service_rec->service_pkey !=
 		    p_svcr->service_record.service_pkey)
 			return;
 	}
 
-	if ((comp_mask & IB_SR_COMPMASK_SKEY) == IB_SR_COMPMASK_SKEY) {
+	if (comp_mask & IB_SR_COMPMASK_SKEY) {
 		if (memcmp(p_sr_item->p_service_rec->service_key,
 			   p_svcr->service_record.service_key,
 			   16 * sizeof(uint8_t)))
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SNAME) == IB_SR_COMPMASK_SNAME) {
+	if (comp_mask & IB_SR_COMPMASK_SNAME) {
 		if (memcmp(p_sr_item->p_service_rec->service_name,
 			   p_svcr->service_record.service_name,
 			   sizeof(p_svcr->service_record.service_name)) != 0)
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_0) == IB_SR_COMPMASK_SDATA8_0) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_0) {
 		if (p_sr_item->p_service_rec->service_data8[0] !=
 		    p_svcr->service_record.service_data8[0])
 			return;
 	}
 
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_1) == IB_SR_COMPMASK_SDATA8_1) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_1) {
 		if (p_sr_item->p_service_rec->service_data8[1] !=
 		    p_svcr->service_record.service_data8[1])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_2) == IB_SR_COMPMASK_SDATA8_2) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_2) {
 		if (p_sr_item->p_service_rec->service_data8[2] !=
 		    p_svcr->service_record.service_data8[2])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_3) == IB_SR_COMPMASK_SDATA8_3) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_3) {
 		if (p_sr_item->p_service_rec->service_data8[3] !=
 		    p_svcr->service_record.service_data8[3])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_4) == IB_SR_COMPMASK_SDATA8_4) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_4) {
 		if (p_sr_item->p_service_rec->service_data8[4] !=
 		    p_svcr->service_record.service_data8[4])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_5) == IB_SR_COMPMASK_SDATA8_5) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_5) {
 		if (p_sr_item->p_service_rec->service_data8[5] !=
 		    p_svcr->service_record.service_data8[5])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_6) == IB_SR_COMPMASK_SDATA8_6) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_6) {
 		if (p_sr_item->p_service_rec->service_data8[6] !=
 		    p_svcr->service_record.service_data8[6])
 			return;
 	}
 
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_7) == IB_SR_COMPMASK_SDATA8_7) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_7) {
 		if (p_sr_item->p_service_rec->service_data8[7] !=
 		    p_svcr->service_record.service_data8[7])
 			return;
 	}
 
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_8) == IB_SR_COMPMASK_SDATA8_8) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_8) {
 		if (p_sr_item->p_service_rec->service_data8[8] !=
 		    p_svcr->service_record.service_data8[8])
 			return;
 	}
 
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_9) == IB_SR_COMPMASK_SDATA8_9) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_9) {
 		if (p_sr_item->p_service_rec->service_data8[9] !=
 		    p_svcr->service_record.service_data8[9])
 			return;
 	}
 
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_10) == IB_SR_COMPMASK_SDATA8_10) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_10) {
 		if (p_sr_item->p_service_rec->service_data8[10] !=
 		    p_svcr->service_record.service_data8[10])
 			return;
 	}
 
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_11) == IB_SR_COMPMASK_SDATA8_11) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_11) {
 		if (p_sr_item->p_service_rec->service_data8[11] !=
 		    p_svcr->service_record.service_data8[11])
 			return;
 	}
 
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_12) == IB_SR_COMPMASK_SDATA8_12) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_12) {
 		if (p_sr_item->p_service_rec->service_data8[12] !=
 		    p_svcr->service_record.service_data8[12])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_13) == IB_SR_COMPMASK_SDATA8_13) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_13) {
 		if (p_sr_item->p_service_rec->service_data8[13] !=
 		    p_svcr->service_record.service_data8[13])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_14) == IB_SR_COMPMASK_SDATA8_14) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_14) {
 		if (p_sr_item->p_service_rec->service_data8[14] !=
 		    p_svcr->service_record.service_data8[14])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA8_15) == IB_SR_COMPMASK_SDATA8_15) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA8_15) {
 		if (p_sr_item->p_service_rec->service_data8[15] !=
 		    p_svcr->service_record.service_data8[15])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA16_0) == IB_SR_COMPMASK_SDATA16_0) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA16_0) {
 		if (p_sr_item->p_service_rec->service_data16[0] !=
 		    p_svcr->service_record.service_data16[0])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA16_1) == IB_SR_COMPMASK_SDATA16_1) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA16_1) {
 		if (p_sr_item->p_service_rec->service_data16[1] !=
 		    p_svcr->service_record.service_data16[1])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA16_2) == IB_SR_COMPMASK_SDATA16_2) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA16_2) {
 		if (p_sr_item->p_service_rec->service_data16[2] !=
 		    p_svcr->service_record.service_data16[2])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA16_3) == IB_SR_COMPMASK_SDATA16_3) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA16_3) {
 		if (p_sr_item->p_service_rec->service_data16[3] !=
 		    p_svcr->service_record.service_data16[3])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA16_4) == IB_SR_COMPMASK_SDATA16_4) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA16_4) {
 		if (p_sr_item->p_service_rec->service_data16[4] !=
 		    p_svcr->service_record.service_data16[4])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA16_5) == IB_SR_COMPMASK_SDATA16_5) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA16_5) {
 		if (p_sr_item->p_service_rec->service_data16[5] !=
 		    p_svcr->service_record.service_data16[5])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA16_6) == IB_SR_COMPMASK_SDATA16_6) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA16_6) {
 		if (p_sr_item->p_service_rec->service_data16[6] !=
 		    p_svcr->service_record.service_data16[6])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA16_7) == IB_SR_COMPMASK_SDATA16_7) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA16_7) {
 		if (p_sr_item->p_service_rec->service_data16[7] !=
 		    p_svcr->service_record.service_data16[7])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA32_0) == IB_SR_COMPMASK_SDATA32_0) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA32_0) {
 		if (p_sr_item->p_service_rec->service_data32[0] !=
 		    p_svcr->service_record.service_data32[0])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA32_1) == IB_SR_COMPMASK_SDATA32_1) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA32_1) {
 		if (p_sr_item->p_service_rec->service_data32[1] !=
 		    p_svcr->service_record.service_data32[1])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA32_2) == IB_SR_COMPMASK_SDATA32_2) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA32_2) {
 		if (p_sr_item->p_service_rec->service_data32[2] !=
 		    p_svcr->service_record.service_data32[2])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA32_3) == IB_SR_COMPMASK_SDATA32_3) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA32_3) {
 		if (p_sr_item->p_service_rec->service_data32[3] !=
 		    p_svcr->service_record.service_data32[3])
 			return;
 	}
 
-	if ((comp_mask & IB_SR_COMPMASK_SDATA64_0) == IB_SR_COMPMASK_SDATA64_0) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA64_0) {
 		if (p_sr_item->p_service_rec->service_data64[0] !=
 		    p_svcr->service_record.service_data64[0])
 			return;
 	}
-	if ((comp_mask & IB_SR_COMPMASK_SDATA64_1) == IB_SR_COMPMASK_SDATA64_1) {
+	if (comp_mask & IB_SR_COMPMASK_SDATA64_1) {
 		if (p_sr_item->p_service_rec->service_data64[1] !=
 		    p_svcr->service_record.service_data64[1])
 			return;
@@ -456,11 +443,7 @@ Exit:
 	return;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-osm_sr_rcv_process_get_method(IN osm_sa_t * sa,
-			      IN osm_madw_t * const p_madw)
+static void sr_rcv_process_get_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 {
 	ib_sa_mad_t *p_sa_mad;
 	ib_service_record_t *p_recvd_service_rec;
@@ -472,9 +455,8 @@ osm_sr_rcv_process_get_method(IN osm_sa_t * sa,
 
 	CL_ASSERT(p_madw);
 
-	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
-						sa->p_subn,
+	/* update the requester physical port */
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
@@ -487,9 +469,13 @@ osm_sr_rcv_process_get_method(IN osm_sa_t * sa,
 	p_recvd_service_rec =
 	    (ib_service_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
 
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
-		osm_dump_service_record(sa->p_log, p_recvd_service_rec,
-					OSM_LOG_DEBUG);
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Requester port GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
+		osm_dump_service_record_v2(sa->p_log, p_recvd_service_rec,
+					   FILE_ID, OSM_LOG_DEBUG);
+	}
 
 	cl_qlist_init(&sr_match_item.sr_list);
 	sr_match_item.p_service_rec = p_recvd_service_rec;
@@ -502,8 +488,7 @@ osm_sr_rcv_process_get_method(IN osm_sa_t * sa,
 	/* Grab the lock */
 	cl_plock_excl_acquire(sa->p_lock);
 
-	cl_qlist_apply_func(&sa->p_subn->sa_sr_list,
-			    __get_matching_sr, &context);
+	cl_qlist_apply_func(&sa->p_subn->sa_sr_list, get_matching_sr, &context);
 
 	cl_plock_release(sa->p_lock);
 
@@ -511,23 +496,18 @@ osm_sr_rcv_process_get_method(IN osm_sa_t * sa,
 	    cl_qlist_count(&sr_match_item.sr_list) == 0) {
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"No records matched the Service Record query\n");
-
 		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	}
 
-	__osm_sr_rcv_respond(sa, p_madw, &sr_match_item.sr_list);
+	sr_rcv_respond(sa, p_madw, &sr_match_item.sr_list);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
 	return;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-osm_sr_rcv_process_set_method(IN osm_sa_t * sa,
-			      IN osm_madw_t * const p_madw)
+static void sr_rcv_process_set_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 {
 	ib_sa_mad_t *p_sa_mad;
 	ib_service_record_t *p_recvd_service_rec;
@@ -546,9 +526,9 @@ osm_sr_rcv_process_set_method(IN osm_sa_t * sa,
 
 	comp_mask = p_sa_mad->comp_mask;
 
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
-		osm_dump_service_record(sa->p_log, p_recvd_service_rec,
-					OSM_LOG_DEBUG);
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_service_record_v2(sa->p_log, p_recvd_service_rec,
+					   FILE_ID, OSM_LOG_DEBUG);
 
 	if ((comp_mask & (IB_SR_COMPMASK_SID | IB_SR_COMPMASK_SGID)) !=
 	    (IB_SR_COMPMASK_SID | IB_SR_COMPMASK_SGID)) {
@@ -558,9 +538,8 @@ osm_sr_rcv_process_set_method(IN osm_sa_t * sa,
 		goto Exit;
 	}
 
-	/* if we were not provided with a service lease make it
-	   infinite */
-	if ((comp_mask & IB_SR_COMPMASK_SLEASE) != IB_SR_COMPMASK_SLEASE) {
+	/* if we were not provided with a service lease make it infinite */
+	if (!(comp_mask & IB_SR_COMPMASK_SLEASE)) {
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"ServiceLease Component Mask not set - using infinite lease\n");
 		p_recvd_service_rec->service_lease = 0xFFFFFFFF;
@@ -570,8 +549,8 @@ osm_sr_rcv_process_set_method(IN osm_sa_t * sa,
 	cl_plock_excl_acquire(sa->p_lock);
 
 	/* If Record exists with matching RID */
-	p_svcr = osm_svcr_get_by_rid(sa->p_subn,
-				     sa->p_log, p_recvd_service_rec);
+	p_svcr = osm_svcr_get_by_rid(sa->p_subn, sa->p_log,
+				     p_recvd_service_rec);
 
 	if (p_svcr == NULL) {
 		/* Create the instance of the osm_svcr_t object */
@@ -590,10 +569,8 @@ osm_sr_rcv_process_set_method(IN osm_sa_t * sa,
 		/* Add this new osm_svcr_t object to subnet object */
 		osm_svcr_insert_to_db(sa->p_subn, sa->p_log, p_svcr);
 
-	} else {
-		/* Update the old instance of the osm_svcr_t object */
+	} else			/* Update the old instance of the osm_svcr_t object */
 		osm_svcr_init(p_svcr, p_recvd_service_rec);
-	}
 
 	cl_plock_release(sa->p_lock);
 
@@ -616,31 +593,25 @@ osm_sr_rcv_process_set_method(IN osm_sa_t * sa,
 		goto Exit;
 	}
 
-	if ((comp_mask & IB_SR_COMPMASK_SPKEY) != IB_SR_COMPMASK_SPKEY) {
+	if ((comp_mask & IB_SR_COMPMASK_SPKEY) != IB_SR_COMPMASK_SPKEY)
 		/* Set the Default Service P_Key in the response */
 		p_recvd_service_rec->service_pkey = IB_DEFAULT_PKEY;
-	}
 
 	p_sr_item->service_rec = *p_recvd_service_rec;
 	cl_qlist_init(&sr_list);
 
 	cl_qlist_insert_tail(&sr_list, &p_sr_item->list_item);
 
-	__osm_sr_rcv_respond(sa, p_madw, &sr_list);
+	sr_rcv_respond(sa, p_madw, &sr_list);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-osm_sr_rcv_process_delete_method(IN osm_sa_t * sa,
-				 IN osm_madw_t * const p_madw)
+static void sr_rcv_process_delete_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 {
 	ib_sa_mad_t *p_sa_mad;
 	ib_service_record_t *p_recvd_service_rec;
-	ib_net64_t comp_mask;
 	osm_svcr_t *p_svcr;
 	osm_sr_item_t *p_sr_item;
 	cl_qlist_t sr_list;
@@ -653,18 +624,16 @@ osm_sr_rcv_process_delete_method(IN osm_sa_t * sa,
 	p_recvd_service_rec =
 	    (ib_service_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
 
-	comp_mask = p_sa_mad->comp_mask;
-
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
-		osm_dump_service_record(sa->p_log, p_recvd_service_rec,
-					OSM_LOG_DEBUG);
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_service_record_v2(sa->p_log, p_recvd_service_rec,
+					   FILE_ID, OSM_LOG_DEBUG);
 
 	/* Grab the lock */
 	cl_plock_excl_acquire(sa->p_lock);
 
 	/* If Record exists with matching RID */
-	p_svcr = osm_svcr_get_by_rid(sa->p_subn,
-				     sa->p_log, p_recvd_service_rec);
+	p_svcr = osm_svcr_get_by_rid(sa->p_subn, sa->p_log,
+				     p_recvd_service_rec);
 
 	if (p_svcr == NULL) {
 		cl_plock_release(sa->p_lock);
@@ -672,10 +641,9 @@ osm_sr_rcv_process_delete_method(IN osm_sa_t * sa,
 			"No records matched the RID\n");
 		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
-	} else {
-		osm_svcr_remove_from_db(sa->p_subn, sa->p_log, p_svcr);
 	}
 
+	osm_svcr_remove_from_db(sa->p_subn, sa->p_log, p_svcr);
 	cl_plock_release(sa->p_lock);
 
 	p_sr_item = malloc(sizeof(*p_sr_item));
@@ -683,6 +651,7 @@ osm_sr_rcv_process_delete_method(IN osm_sa_t * sa,
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2413: "
 			"Unable to acquire Service record\n");
 		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES);
+		osm_svcr_delete(p_svcr);
 		goto Exit;
 	}
 
@@ -692,18 +661,15 @@ osm_sr_rcv_process_delete_method(IN osm_sa_t * sa,
 
 	cl_qlist_insert_tail(&sr_list, &p_sr_item->list_item);
 
-	if (p_svcr)
-		osm_svcr_delete(p_svcr);
+	osm_svcr_delete(p_svcr);
 
-	__osm_sr_rcv_respond(sa, p_madw, &sr_list);
+	sr_rcv_respond(sa, p_madw, &sr_list);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
 	return;
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_sr_rcv_process(IN void *context, IN void *data)
 {
 	osm_sa_t *sa = context;
@@ -721,7 +687,7 @@ void osm_sr_rcv_process(IN void *context, IN void *data)
 
 	switch (p_sa_mad->method) {
 	case IB_MAD_METHOD_SET:
-		valid = __validate_sr(sa, p_madw);
+		valid = validate_sr(sa, p_madw);
 		if (!valid) {
 			OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,
 				"Component Mask check failed for set request\n");
@@ -729,10 +695,10 @@ void osm_sr_rcv_process(IN void *context, IN void *data)
 					  IB_SA_MAD_STATUS_REQ_INVALID);
 			goto Exit;
 		}
-		osm_sr_rcv_process_set_method(sa, p_madw);
+		sr_rcv_process_set_method(sa, p_madw);
 		break;
 	case IB_MAD_METHOD_DELETE:
-		valid = __validate_sr(sa, p_madw);
+		valid = validate_sr(sa, p_madw);
 		if (!valid) {
 			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 				"Component Mask check failed for delete request\n");
@@ -740,11 +706,11 @@ void osm_sr_rcv_process(IN void *context, IN void *data)
 					  IB_SA_MAD_STATUS_REQ_INVALID);
 			goto Exit;
 		}
-		osm_sr_rcv_process_delete_method(sa, p_madw);
+		sr_rcv_process_delete_method(sa, p_madw);
 		break;
 	case IB_MAD_METHOD_GET:
 	case IB_MAD_METHOD_GETTABLE:
-		osm_sr_rcv_process_get_method(sa, p_madw);
+		sr_rcv_process_get_method(sa, p_madw);
 		break;
 	default:
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
@@ -758,8 +724,6 @@ Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_sr_rcv_lease_cb(IN void *context)
 {
 	osm_sa_t *sa = context;
@@ -821,8 +785,7 @@ void osm_sr_rcv_lease_cb(IN void *context)
 			p_next_list_item = cl_qlist_next(p_list_item);
 
 			/* Remove the service Record */
-			osm_svcr_remove_from_db(sa->p_subn,
-						sa->p_log, p_svcr);
+			osm_svcr_remove_from_db(sa->p_subn, sa->p_log, p_svcr);
 
 			osm_svcr_delete(p_svcr);
 
diff --git a/opensm/osm_sa_slvl_record.c b/opensm/osm_sa_slvl_record.c
index 34320c5..6ff8bae 100644
--- a/opensm/osm_sa_slvl_record.c
+++ b/opensm/osm_sa_slvl_record.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -50,6 +50,8 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_SLVL_RECORD_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
@@ -71,17 +73,12 @@ typedef struct osm_slvl_search_ctxt {
 	const osm_physp_t *p_req_physp;
 } osm_slvl_search_ctxt_t;
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_slvl_create(IN osm_sa_t * sa,
-		     IN const osm_physp_t * const p_physp,
-		     IN osm_slvl_search_ctxt_t * const p_ctxt,
-		     IN uint8_t in_port_idx)
+static void sa_slvl_create(IN osm_sa_t * sa, IN const osm_physp_t * p_physp,
+			   IN osm_slvl_search_ctxt_t * p_ctxt,
+			   IN uint8_t in_port_idx)
 {
 	osm_slvl_item_t *p_rec_item;
 	uint16_t lid;
-	ib_api_status_t status = IB_SUCCESS;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -89,7 +86,6 @@ __osm_sa_slvl_create(IN osm_sa_t * sa,
 	if (p_rec_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2602: "
 			"rec_item alloc failed\n");
-		status = IB_INSUFFICIENT_RESOURCES;
 		goto Exit;
 	}
 
@@ -118,12 +114,8 @@ Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_slvl_by_comp_mask(IN osm_sa_t * sa,
-			   IN const osm_port_t * const p_port,
-			   osm_slvl_search_ctxt_t * const p_ctxt)
+static void sa_slvl_by_comp_mask(IN osm_sa_t * sa, IN const osm_port_t * p_port,
+				 osm_slvl_search_ctxt_t * p_ctxt)
 {
 	const ib_slvl_table_record_t *p_rcvd_rec;
 	ib_net64_t comp_mask;
@@ -151,9 +143,9 @@ __osm_sa_slvl_by_comp_mask(IN osm_sa_t * sa,
 			p_port->p_physp->port_num);
 		p_out_physp = p_port->p_physp;
 		/* check that the p_out_physp and the p_req_physp share a pkey */
-		if (osm_physp_share_pkey
-		    (sa->p_log, p_req_physp, p_out_physp))
-			__osm_sa_slvl_create(sa, p_out_physp, p_ctxt, 0);
+		if (osm_physp_share_pkey(sa->p_log, p_req_physp, p_out_physp,
+					 sa->p_subn->opt.allow_both_pkeys))
+			sa_slvl_create(sa, p_out_physp, p_ctxt, 0);
 	} else {
 		if (comp_mask & IB_SLVL_COMPMASK_OUT_PORT)
 			out_port_start = out_port_end =
@@ -184,40 +176,32 @@ __osm_sa_slvl_by_comp_mask(IN osm_sa_t * sa,
 
 				/* if the requester and the p_out_physp don't share a pkey -
 				   continue */
-				if (!osm_physp_share_pkey
-				    (sa->p_log, p_req_physp, p_out_physp))
+				if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_out_physp,
+							  sa->p_subn->opt.allow_both_pkeys))
 					continue;
 
-				__osm_sa_slvl_create(sa, p_out_physp, p_ctxt,
-						     in_port_num);
+				sa_slvl_create(sa, p_out_physp, p_ctxt,
+					       in_port_num);
 			}
 		}
 	}
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_slvl_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
-			      IN void *context)
+static void sa_slvl_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt)
 {
-	const osm_port_t *const p_port = (osm_port_t *) p_map_item;
-	osm_slvl_search_ctxt_t *const p_ctxt =
-	    (osm_slvl_search_ctxt_t *) context;
+	const osm_port_t *p_port = (osm_port_t *) p_map_item;
+	osm_slvl_search_ctxt_t *p_ctxt = cxt;
 
-	__osm_sa_slvl_by_comp_mask(p_ctxt->sa, p_port, p_ctxt);
+	sa_slvl_by_comp_mask(p_ctxt->sa, p_port, p_ctxt);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 {
 	osm_sa_t *sa = ctx;
 	osm_madw_t *p_madw = data;
 	const ib_sa_mad_t *p_rcvd_mad;
 	const ib_slvl_table_record_t *p_rcvd_rec;
-	const cl_ptr_vector_t *p_tbl;
 	const osm_port_t *p_port = NULL;
 	cl_qlist_t rec_list;
 	osm_slvl_search_ctxt_t context;
@@ -248,7 +232,7 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 		goto Exit;
 	}
 
-	/* update the requester physical port. */
+	/* update the requester physical port */
 	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
@@ -257,6 +241,9 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 			"Cannot find requester physical port\n");
 		goto Exit;
 	}
+	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+		"Requester port GUID 0x%" PRIx64 "\n",
+		cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
 
 	cl_qlist_init(&rec_list);
 
@@ -283,15 +270,8 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 	   work load, since we don't have to search every port
 	 */
 	if (comp_mask & IB_SLVL_COMPMASK_LID) {
-
-		p_tbl = &sa->p_subn->port_lid_tbl;
-
-		CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000);
-
-		status =
-		    osm_get_port_by_base_lid(sa->p_subn, p_rcvd_rec->lid,
-					     &p_port);
-		if ((status != IB_SUCCESS) || (p_port == NULL)) {
+		p_port = osm_get_port_by_lid(sa->p_subn, p_rcvd_rec->lid);
+		if (!p_port) {
 			status = IB_NOT_FOUND;
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2608: "
 				"No port found with LID %u\n",
@@ -303,11 +283,10 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 		/* if we have a unique port - no need for a port search */
 		if (p_port)
 			/*  this does the loop on all the port phys ports */
-			__osm_sa_slvl_by_comp_mask(sa, p_port, &context);
+			sa_slvl_by_comp_mask(sa, p_port, &context);
 		else
 			cl_qmap_apply_func(&sa->p_subn->port_guid_tbl,
-					   __osm_sa_slvl_by_comp_mask_cb,
-					   &context);
+					   sa_slvl_by_comp_mask_cb, &context);
 	}
 
 	cl_plock_release(sa->p_lock);
diff --git a/opensm/osm_sa_sminfo_record.c b/opensm/osm_sa_sminfo_record.c
index de99065..c60316d 100644
--- a/opensm/osm_sa_sminfo_record.c
+++ b/opensm/osm_sa_sminfo_record.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -50,6 +50,8 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_SMINFO_RECORD_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
@@ -76,14 +78,13 @@ typedef struct osm_smir_search_ctxt {
 	const osm_physp_t *p_req_physp;
 } osm_smir_search_ctxt_t;
 
-static ib_api_status_t
-__osm_smir_rcv_new_smir(IN osm_sa_t * sa,
-			IN const osm_port_t * const p_port,
-			IN cl_qlist_t * const p_list,
-			IN ib_net64_t const guid,
-			IN ib_net32_t const act_count,
-			IN uint8_t const pri_state,
-			IN const osm_physp_t * const p_req_physp)
+static ib_api_status_t smir_rcv_new_smir(IN osm_sa_t * sa,
+					 IN const osm_port_t * p_port,
+					 IN cl_qlist_t * p_list,
+					 IN ib_net64_t const guid,
+					 IN ib_net32_t const act_count,
+					 IN uint8_t const pri_state,
+					 IN const osm_physp_t * p_req_physp)
 {
 	osm_smir_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
@@ -112,19 +113,17 @@ __osm_smir_rcv_new_smir(IN osm_sa_t * sa,
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_smir_by_comp_mask(IN osm_sa_t * sa,
-			   IN const osm_remote_sm_t * const p_rem_sm,
-			   osm_smir_search_ctxt_t * const p_ctxt)
+static void sa_smir_by_comp_mask(IN osm_sa_t * sa,
+				 IN const osm_remote_sm_t * p_rem_sm,
+				 osm_smir_search_ctxt_t * p_ctxt)
 {
 	const ib_sminfo_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;
 	ib_net64_t const comp_mask = p_ctxt->comp_mask;
+	osm_port_t *p_port;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -146,31 +145,30 @@ __osm_sa_smir_by_comp_mask(IN osm_sa_t * sa,
 	}
 
 	/* Implement any other needed search cases */
+	p_port = osm_get_port_by_guid(sa->p_subn, p_rem_sm->smi.guid);
 
-	__osm_smir_rcv_new_smir(sa, p_rem_sm->p_port, p_ctxt->p_list,
-				p_rem_sm->smi.guid,
-				p_rem_sm->smi.act_count,
-				p_rem_sm->smi.pri_state, p_req_physp);
+        if (p_port == NULL) {
+                OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2810: "
+                        "No port for remote sm\n");
+                goto Exit;
+        }
+
+	smir_rcv_new_smir(sa, p_port, p_ctxt->p_list,
+			  p_rem_sm->smi.guid, p_rem_sm->smi.act_count,
+			  p_rem_sm->smi.pri_state, p_req_physp);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_smir_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
-			      IN void *context)
+static void sa_smir_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt)
 {
-	const osm_remote_sm_t *const p_rem_sm = (osm_remote_sm_t *) p_map_item;
-	osm_smir_search_ctxt_t *const p_ctxt =
-	    (osm_smir_search_ctxt_t *) context;
+	const osm_remote_sm_t *p_rem_sm = (osm_remote_sm_t *) p_map_item;
+	osm_smir_search_ctxt_t *p_ctxt = cxt;
 
-	__osm_sa_smir_by_comp_mask(p_ctxt->sa, p_rem_sm, p_ctxt);
+	sa_smir_by_comp_mask(p_ctxt->sa, p_rem_sm, p_ctxt);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_smir_rcv_process(IN void *ctx, IN void *data)
 {
 	osm_sa_t *sa = ctx;
@@ -197,8 +195,7 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 	CL_ASSERT(p_madw);
 
 	sad_mad = osm_madw_get_sa_mad_ptr(p_madw);
-	p_rcvd_rec =
-	    (ib_sminfo_record_t *) ib_sa_mad_get_payload_ptr(sad_mad);
+	p_rcvd_rec = (ib_sminfo_record_t *) ib_sa_mad_get_payload_ptr(sad_mad);
 	comp_mask = sad_mad->comp_mask;
 
 	CL_ASSERT(sad_mad->attr_id == IB_MAD_ATTR_SMINFO_RECORD);
@@ -213,7 +210,7 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 		goto Exit;
 	}
 
-	/* update the requester physical port. */
+	/* update the requester physical port */
 	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
@@ -223,8 +220,12 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 		goto Exit;
 	}
 
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
-		osm_dump_sm_info_record(sa->p_log, p_rcvd_rec, OSM_LOG_DEBUG);
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Requester port GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
+		osm_dump_sm_info_record_v2(sa->p_log, p_rcvd_rec, FILE_ID, OSM_LOG_DEBUG);
+	}
 
 	p_smi = &p_rcvd_rec->sm_info;
 
@@ -243,10 +244,8 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 	   work load, since we don't have to search every port
 	 */
 	if (comp_mask & IB_SMIR_COMPMASK_LID) {
-		status =
-		    osm_get_port_by_base_lid(sa->p_subn, p_rcvd_rec->lid,
-					     &p_port);
-		if ((status != IB_SUCCESS) || (p_port == NULL)) {
+		p_port = osm_get_port_by_lid(sa->p_subn, p_rcvd_rec->lid);
+		if (!p_port) {
 			status = IB_NOT_FOUND;
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2806: "
 				"No port found with LID %u\n",
@@ -269,7 +268,8 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 		if (!p_port || local_port == p_port) {
 			if (FALSE ==
 			    osm_physp_share_pkey(sa->p_log, p_req_physp,
-						 local_port->p_physp)) {
+						 local_port->p_physp,
+						 sa->p_subn->opt.allow_both_pkeys)) {
 				cl_plock_release(sa->p_lock);
 				OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2805: "
 					"Cannot get SMInfo record due to pkey violation\n");
@@ -282,7 +282,7 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 				goto Remotes;
 			if ((comp_mask & IB_SMIR_COMPMASK_PRIORITY) &&
 			    sa->p_subn->opt.sm_priority !=
-			       ib_sminfo_get_priority(p_smi))
+			    ib_sminfo_get_priority(p_smi))
 				goto Remotes;
 			if ((comp_mask & IB_SMIR_COMPMASK_SMSTATE) &&
 			    sa->p_subn->sm_state != ib_sminfo_get_state(p_smi))
@@ -290,12 +290,12 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 
 			/* Now, add local SMInfo to list */
 			pri_state = sa->p_subn->sm_state & 0x0F;
-			pri_state |=
-			    (sa->p_subn->opt.sm_priority & 0x0F) << 4;
-			__osm_smir_rcv_new_smir(sa, local_port, context.p_list,
-						sa->p_subn->sm_port_guid,
-						cl_ntoh32(sa->p_subn->p_osm->stats.qp0_mads_sent),
-						pri_state, p_req_physp);
+			pri_state |= (sa->p_subn->opt.sm_priority & 0x0F) << 4;
+			smir_rcv_new_smir(sa, local_port, context.p_list,
+					  sa->p_subn->sm_port_guid,
+					  cl_ntoh32(sa->p_subn->p_osm->stats.
+						    qp0_mads_sent), pri_state,
+					  p_req_physp);
 		}
 
 	      Remotes:
@@ -308,8 +308,7 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 							    port_guid);
 			if (p_rem_sm !=
 			    (osm_remote_sm_t *) cl_qmap_end(p_sm_guid_tbl))
-				__osm_sa_smir_by_comp_mask(sa, p_rem_sm,
-							   &context);
+				sa_smir_by_comp_mask(sa, p_rem_sm, &context);
 			else
 				OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 280A: "
 					"No remote SM for GUID 0x%016" PRIx64
@@ -317,8 +316,7 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 		} else {
 			/* Go over all other known (remote) SMs */
 			cl_qmap_apply_func(&sa->p_subn->sm_guid_tbl,
-					   __osm_sa_smir_by_comp_mask_cb,
-					   &context);
+					   sa_smir_by_comp_mask_cb, &context);
 		}
 	}
 
diff --git a/opensm/osm_sa_sw_info_record.c b/opensm/osm_sa_sw_info_record.c
index 649b0ac..d83e621 100644
--- a/opensm/osm_sa_sw_info_record.c
+++ b/opensm/osm_sa_sw_info_record.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -48,6 +48,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_SW_INFO_RECORD_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_helper.h>
@@ -67,12 +69,10 @@ typedef struct osm_sir_search_ctxt {
 	const osm_physp_t *p_req_physp;
 } osm_sir_search_ctxt_t;
 
-/**********************************************************************
- **********************************************************************/
-static ib_api_status_t
-__osm_sir_rcv_new_sir(IN osm_sa_t * sa,
-		      IN const osm_switch_t * const p_sw,
-		      IN cl_qlist_t * const p_list, IN ib_net16_t const lid)
+static ib_api_status_t sir_rcv_new_sir(IN osm_sa_t * sa,
+				       IN const osm_switch_t * p_sw,
+				       IN cl_qlist_t * p_list,
+				       IN ib_net16_t lid)
 {
 	osm_sir_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
@@ -99,17 +99,12 @@ __osm_sir_rcv_new_sir(IN osm_sa_t * sa,
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sir_rcv_create_sir(IN osm_sa_t * sa,
-			 IN const osm_switch_t * const p_sw,
-			 IN cl_qlist_t * const p_list,
-			 IN ib_net16_t const match_lid,
-			 IN const osm_physp_t * const p_req_physp)
+static void sir_rcv_create_sir(IN osm_sa_t * sa, IN const osm_switch_t * p_sw,
+			       IN cl_qlist_t * p_list, IN ib_net16_t match_lid,
+			       IN const osm_physp_t * p_req_physp)
 {
 	osm_port_t *p_port;
 	const osm_physp_t *p_physp;
@@ -143,7 +138,8 @@ __osm_sir_rcv_create_sir(IN osm_sa_t * sa,
 			cl_ntoh64(p_sw->p_node->node_info.node_guid));
 		goto Exit;
 	}
-	if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_physp))
+	if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_physp,
+				  sa->p_subn->opt.allow_both_pkeys))
 		goto Exit;
 
 	/* get the port 0 of the switch */
@@ -163,21 +159,16 @@ __osm_sir_rcv_create_sir(IN osm_sa_t * sa,
 
 	}
 
-	__osm_sir_rcv_new_sir(sa, p_sw, p_list, osm_port_get_base_lid(p_port));
+	sir_rcv_new_sir(sa, p_sw, p_list, osm_port_get_base_lid(p_port));
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sir_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
-			   IN void *context)
+static void sir_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *cxt)
 {
-	const osm_sir_search_ctxt_t *const p_ctxt =
-	    (osm_sir_search_ctxt_t *) context;
-	const osm_switch_t *const p_sw = (osm_switch_t *) p_map_item;
+	const osm_sir_search_ctxt_t *p_ctxt = cxt;
+	const osm_switch_t *p_sw = (osm_switch_t *) p_map_item;
 	const ib_switch_info_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;
 	osm_sa_t *sa = p_ctxt->sa;
@@ -186,8 +177,8 @@ __osm_sir_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 
 	OSM_LOG_ENTER(p_ctxt->sa->p_log);
 
-	osm_dump_switch_info(p_ctxt->sa->p_log,
-			     &p_sw->switch_info, OSM_LOG_VERBOSE);
+	osm_dump_switch_info_v2(p_ctxt->sa->p_log, &p_sw->switch_info,
+			        FILE_ID, OSM_LOG_VERBOSE);
 
 	if (comp_mask & IB_SWIR_COMPMASK_LID) {
 		match_lid = p_rcvd_rec->lid;
@@ -195,15 +186,12 @@ __osm_sir_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 			goto Exit;
 	}
 
-	__osm_sir_rcv_create_sir(sa, p_sw, p_ctxt->p_list,
-				 match_lid, p_req_physp);
+	sir_rcv_create_sir(sa, p_sw, p_ctxt->p_list, match_lid, p_req_physp);
 
 Exit:
 	OSM_LOG_EXIT(p_ctxt->sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_sir_rcv_process(IN void *ctx, IN void *data)
 {
 	osm_sa_t *sa = ctx;
@@ -236,7 +224,7 @@ void osm_sir_rcv_process(IN void *ctx, IN void *data)
 		goto Exit;
 	}
 
-	/* update the requester physical port. */
+	/* update the requester physical port */
 	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
@@ -246,9 +234,13 @@ void osm_sir_rcv_process(IN void *ctx, IN void *data)
 		goto Exit;
 	}
 
-	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
-		osm_dump_switch_info_record(sa->p_log, p_rcvd_rec,
-					    OSM_LOG_DEBUG);
+	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Requester port GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
+		osm_dump_switch_info_record_v2(sa->p_log, p_rcvd_rec,
+					       FILE_ID, OSM_LOG_DEBUG);
+	}
 
 	cl_qlist_init(&rec_list);
 
@@ -261,8 +253,8 @@ void osm_sir_rcv_process(IN void *ctx, IN void *data)
 	cl_plock_acquire(sa->p_lock);
 
 	/* Go over all switches */
-	cl_qmap_apply_func(&sa->p_subn->sw_guid_tbl,
-			   __osm_sir_rcv_by_comp_mask, &context);
+	cl_qmap_apply_func(&sa->p_subn->sw_guid_tbl, sir_rcv_by_comp_mask,
+			   &context);
 
 	cl_plock_release(sa->p_lock);
 
diff --git a/opensm/osm_sa_vlarb_record.c b/opensm/osm_sa_vlarb_record.c
index 43c0d65..2ada36b 100644
--- a/opensm/osm_sa_vlarb_record.c
+++ b/opensm/osm_sa_vlarb_record.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -50,6 +50,8 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SA_VLARB_RECORD_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
@@ -71,17 +73,12 @@ typedef struct osm_vl_arb_search_ctxt {
 	const osm_physp_t *p_req_physp;
 } osm_vl_arb_search_ctxt_t;
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_vl_arb_create(IN osm_sa_t * sa,
-		       IN osm_physp_t * const p_physp,
-		       IN osm_vl_arb_search_ctxt_t * const p_ctxt,
-		       IN uint8_t block)
+static void sa_vl_arb_create(IN osm_sa_t * sa, IN osm_physp_t * p_physp,
+			     IN osm_vl_arb_search_ctxt_t * p_ctxt,
+			     IN uint8_t block)
 {
 	osm_vl_arb_item_t *p_rec_item;
 	uint16_t lid;
-	ib_api_status_t status = IB_SUCCESS;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -89,7 +86,6 @@ __osm_sa_vl_arb_create(IN osm_sa_t * sa,
 	if (p_rec_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2A02: "
 			"rec_item alloc failed\n");
-		status = IB_INSUFFICIENT_RESOURCES;
 		goto Exit;
 	}
 
@@ -117,12 +113,8 @@ Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_vl_arb_check_physp(IN osm_sa_t * sa,
-			    IN osm_physp_t * const p_physp,
-			    osm_vl_arb_search_ctxt_t * const p_ctxt)
+static void sa_vl_arb_check_physp(IN osm_sa_t * sa, IN osm_physp_t * p_physp,
+				  osm_vl_arb_search_ctxt_t * p_ctxt)
 {
 	ib_net64_t comp_mask = p_ctxt->comp_mask;
 	uint8_t block;
@@ -132,20 +124,15 @@ __osm_sa_vl_arb_check_physp(IN osm_sa_t * sa,
 	/* we got here with the phys port - all that's left is to get the right block */
 	for (block = 1; block <= 4; block++) {
 		if (!(comp_mask & IB_VLA_COMPMASK_BLOCK)
-		    || block == p_ctxt->block_num) {
-			__osm_sa_vl_arb_create(sa, p_physp, p_ctxt, block);
-		}
+		    || block == p_ctxt->block_num)
+			sa_vl_arb_create(sa, p_physp, p_ctxt, block);
 	}
 
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_vl_arb_by_comp_mask(IN osm_sa_t * sa,
-			     IN const osm_port_t * const p_port,
-			     osm_vl_arb_search_ctxt_t * const p_ctxt)
+static void sa_vl_arb_by_comp_mask(osm_sa_t * sa, IN const osm_port_t * p_port,
+				   osm_vl_arb_search_ctxt_t * p_ctxt)
 {
 	const ib_vl_arb_table_record_t *p_rcvd_rec;
 	ib_net64_t comp_mask;
@@ -179,10 +166,9 @@ __osm_sa_vl_arb_by_comp_mask(IN osm_sa_t * sa,
 			/* check that the p_physp is valid, and that the requester
 			   and the p_physp share a pkey. */
 			if (p_physp &&
-			    osm_physp_share_pkey(sa->p_log, p_req_physp,
-						 p_physp))
-				__osm_sa_vl_arb_check_physp(sa, p_physp,
-							    p_ctxt);
+			    osm_physp_share_pkey(sa->p_log, p_req_physp, p_physp,
+						 sa->p_subn->opt.allow_both_pkeys))
+				sa_vl_arb_check_physp(sa, p_physp, p_ctxt);
 		} else {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2A03: "
 				"Given Physical Port Number: 0x%X is out of range should be < 0x%X\n",
@@ -200,41 +186,32 @@ __osm_sa_vl_arb_by_comp_mask(IN osm_sa_t * sa,
 
 			/* if the requester and the p_physp don't share a pkey -
 			   continue */
-			if (!osm_physp_share_pkey
-			    (sa->p_log, p_req_physp, p_physp))
+			if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_physp,
+						  sa->p_subn->opt.allow_both_pkeys))
 				continue;
 
-			__osm_sa_vl_arb_check_physp(sa, p_physp, p_ctxt);
+			sa_vl_arb_check_physp(sa, p_physp, p_ctxt);
 		}
 	}
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sa_vl_arb_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
-				IN void *context)
+static void sa_vl_arb_by_comp_mask_cb(IN cl_map_item_t * p_map_item, void *cxt)
 {
-	const osm_port_t *const p_port = (osm_port_t *) p_map_item;
-	osm_vl_arb_search_ctxt_t *const p_ctxt =
-	    (osm_vl_arb_search_ctxt_t *) context;
+	const osm_port_t *p_port = (osm_port_t *) p_map_item;
+	osm_vl_arb_search_ctxt_t *p_ctxt = cxt;
 
-	__osm_sa_vl_arb_by_comp_mask(p_ctxt->sa, p_port, p_ctxt);
+	sa_vl_arb_by_comp_mask(p_ctxt->sa, p_port, p_ctxt);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 {
 	osm_sa_t *sa = ctx;
 	osm_madw_t *p_madw = data;
 	const ib_sa_mad_t *sad_mad;
 	const ib_vl_arb_table_record_t *p_rcvd_rec;
-	const cl_ptr_vector_t *p_tbl;
 	const osm_port_t *p_port = NULL;
-	const ib_vl_arb_table_t *p_vl_arb;
 	cl_qlist_t rec_list;
 	osm_vl_arb_search_ctxt_t context;
 	ib_api_status_t status = IB_SUCCESS;
@@ -264,7 +241,7 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 		goto Exit;
 	}
 
-	/* update the requester physical port. */
+	/* update the requester physical port */
 	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
@@ -273,8 +250,9 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 			"Cannot find requester physical port\n");
 		goto Exit;
 	}
-
-	p_vl_arb = (ib_vl_arb_table_t *) ib_sa_mad_get_payload_ptr(sad_mad);
+	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+		"Requester port GUID 0x%" PRIx64 "\n",
+		cl_ntoh64(osm_physp_get_port_guid(p_req_physp)));
 
 	cl_qlist_init(&rec_list);
 
@@ -300,15 +278,8 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 	   work load, since we don't have to search every port
 	 */
 	if (comp_mask & IB_VLA_COMPMASK_LID) {
-
-		p_tbl = &sa->p_subn->port_lid_tbl;
-
-		CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000);
-
-		status =
-		    osm_get_port_by_base_lid(sa->p_subn, p_rcvd_rec->lid,
-					     &p_port);
-		if ((status != IB_SUCCESS) || (p_port == NULL)) {
+		p_port = osm_get_port_by_lid(sa->p_subn, p_rcvd_rec->lid);
+		if (!p_port) {
 			status = IB_NOT_FOUND;
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2A09: "
 				"No port found with LID %u\n",
@@ -320,11 +291,10 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 		/* if we got a unique port - no need for a port search */
 		if (p_port)
 			/*  this does the loop on all the port phys ports */
-			__osm_sa_vl_arb_by_comp_mask(sa, p_port, &context);
+			sa_vl_arb_by_comp_mask(sa, p_port, &context);
 		else
 			cl_qmap_apply_func(&sa->p_subn->port_guid_tbl,
-					   __osm_sa_vl_arb_by_comp_mask_cb,
-					   &context);
+					   sa_vl_arb_by_comp_mask_cb, &context);
 	}
 
 	cl_plock_release(sa->p_lock);
diff --git a/opensm/osm_service.c b/opensm/osm_service.c
index b7c1270..f4644d5 100644
--- a/opensm/osm_service.c
+++ b/opensm/osm_service.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -45,20 +45,18 @@
 #include <stdlib.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_timer.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SERVICE_C
 #include <opensm/osm_service.h>
+#include <opensm/osm_opensm.h>
 
-/**********************************************************************
- **********************************************************************/
-void osm_svcr_delete(IN osm_svcr_t * const p_svcr)
+void osm_svcr_delete(IN osm_svcr_t * p_svcr)
 {
 	free(p_svcr);
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_svcr_init(IN osm_svcr_t * const p_svcr,
-	      IN const ib_service_record_t * p_svc_rec)
+void osm_svcr_init(IN osm_svcr_t * p_svcr,
+		   IN const ib_service_record_t * p_svc_rec)
 {
 	CL_ASSERT(p_svcr);
 
@@ -71,8 +69,6 @@ osm_svcr_init(IN osm_svcr_t * const p_svcr,
 	p_svcr->service_record = *p_svc_rec;
 }
 
-/**********************************************************************
- **********************************************************************/
 osm_svcr_t *osm_svcr_new(IN const ib_service_record_t * p_svc_rec)
 {
 	osm_svcr_t *p_svcr;
@@ -85,47 +81,34 @@ osm_svcr_t *osm_svcr_new(IN const ib_service_record_t * p_svc_rec)
 		osm_svcr_init(p_svcr, p_svc_rec);
 	}
 
-	return (p_svcr);
+	return p_svcr;
 }
 
-/**********************************************************************
- **********************************************************************/
-static
-    cl_status_t
-__match_rid_of_svc_rec(IN const cl_list_item_t * const p_list_item,
-		       IN void *context)
+static cl_status_t match_rid_of_svc_rec(IN const cl_list_item_t * p_list_item,
+					IN void *context)
 {
 	ib_service_record_t *p_svc_rec = (ib_service_record_t *) context;
 	osm_svcr_t *p_svcr = (osm_svcr_t *) p_list_item;
-	int32_t count;
 
-	count = memcmp(&p_svcr->service_record,
-		       p_svc_rec,
-		       sizeof(p_svc_rec->service_id) +
-		       sizeof(p_svc_rec->service_gid) +
-		       sizeof(p_svc_rec->service_pkey));
-
-	if (count == 0)
-		return CL_SUCCESS;
-	else
+	if (memcmp(&p_svcr->service_record, p_svc_rec,
+		   sizeof(p_svc_rec->service_id) +
+		   sizeof(p_svc_rec->service_gid) +
+		   sizeof(p_svc_rec->service_pkey)))
 		return CL_NOT_FOUND;
-
+	else
+		return CL_SUCCESS;
 }
 
-/**********************************************************************
- **********************************************************************/
 osm_svcr_t *osm_svcr_get_by_rid(IN osm_subn_t const *p_subn,
 				IN osm_log_t * p_log,
-				IN ib_service_record_t * const p_svc_rec)
+				IN ib_service_record_t * p_svc_rec)
 {
 	cl_list_item_t *p_list_item;
 
 	OSM_LOG_ENTER(p_log);
 
 	p_list_item = cl_qlist_find_from_head(&p_subn->sa_sr_list,
-					      __match_rid_of_svc_rec,
-					      p_svc_rec);
-
+					      match_rid_of_svc_rec, p_svc_rec);
 	if (p_list_item == cl_qlist_end(&p_subn->sa_sr_list))
 		p_list_item = NULL;
 
@@ -133,11 +116,8 @@ osm_svcr_t *osm_svcr_get_by_rid(IN osm_subn_t const *p_subn,
 	return (osm_svcr_t *) p_list_item;
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_svcr_insert_to_db(IN osm_subn_t * p_subn,
-		      IN osm_log_t * p_log, IN osm_svcr_t * p_svcr)
+void osm_svcr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
+			   IN osm_svcr_t * p_svcr)
 {
 	OSM_LOG_ENTER(p_log);
 
@@ -145,13 +125,13 @@ osm_svcr_insert_to_db(IN osm_subn_t * p_subn,
 		"Inserting new Service Record into Database\n");
 
 	cl_qlist_insert_head(&p_subn->sa_sr_list, &p_svcr->list_item);
+	p_subn->p_osm->sa.dirty = TRUE;
 
 	OSM_LOG_EXIT(p_log);
 }
 
-void
-osm_svcr_remove_from_db(IN osm_subn_t * p_subn,
-			IN osm_log_t * p_log, IN osm_svcr_t * p_svcr)
+void osm_svcr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
+			     IN osm_svcr_t * p_svcr)
 {
 	OSM_LOG_ENTER(p_log);
 
@@ -161,6 +141,7 @@ osm_svcr_remove_from_db(IN osm_subn_t * p_subn,
 		p_svcr->service_record.service_id);
 
 	cl_qlist_remove_item(&p_subn->sa_sr_list, &p_svcr->list_item);
+	p_subn->p_osm->sa.dirty = TRUE;
 
 	OSM_LOG_EXIT(p_log);
 }
diff --git a/opensm/osm_slvl_map_rcv.c b/opensm/osm_slvl_map_rcv.c
index e177345..f5f4240 100644
--- a/opensm/osm_slvl_map_rcv.c
+++ b/opensm/osm_slvl_map_rcv.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -48,6 +49,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SLVL_MAP_RCV_C
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
@@ -55,10 +58,8 @@
 #include <opensm/osm_helper.h>
 #include <opensm/osm_sm.h>
 
-/**********************************************************************
- **********************************************************************/
 /*
- * WE MIGHT ONLY RECEIVE A GET or SET responses
+ * WE ONLY RECEIVE GET or SET responses
  */
 void osm_slvl_rcv_process(IN void *context, IN void *p_data)
 {
@@ -72,7 +73,9 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data)
 	osm_slvl_context_t *p_context;
 	ib_net64_t port_guid;
 	ib_net64_t node_guid;
-	uint8_t out_port_num, in_port_num;
+	uint32_t attr_mod;
+	uint8_t startinport, endinport, startoutport, endoutport;
+	uint8_t in_port, out_port;
 
 	CL_ASSERT(sm);
 
@@ -82,7 +85,7 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data)
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 	p_context = osm_madw_get_slvl_context_ptr(p_madw);
-	p_slvl_tbl = (ib_slvl_table_t *) ib_smp_get_payload_ptr(p_smp);
+	p_slvl_tbl = ib_smp_get_payload_ptr(p_smp);
 
 	port_guid = p_context->port_guid;
 	node_guid = p_context->node_guid;
@@ -93,12 +96,10 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data)
 	p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
 
 	if (!p_port) {
-		cl_plock_release(sm->p_lock);
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2C06: "
 			"No port object for port with GUID 0x%" PRIx64
 			"\n\t\t\t\tfor parent node GUID 0x%" PRIx64
-			", TID 0x%" PRIx64 "\n",
-			cl_ntoh64(port_guid),
+			", TID 0x%" PRIx64 "\n", cl_ntoh64(port_guid),
 			cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));
 		goto Exit;
 	}
@@ -108,43 +109,53 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data)
 
 	/* in case of a non switch node the attr modifier should be ignored */
 	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH) {
-		out_port_num =
-		    (uint8_t) cl_ntoh32(p_smp->attr_mod & 0xFF000000);
-		in_port_num =
-		    (uint8_t) cl_ntoh32((p_smp->attr_mod & 0x00FF0000) << 8);
-		p_physp = osm_node_get_physp_ptr(p_node, out_port_num);
+		unsigned num_ports = osm_node_get_num_physp(p_node) - 1;
+		attr_mod = cl_ntoh32(p_smp->attr_mod);
+
+		if (attr_mod & 0x10000) {
+			startoutport = ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) ? 0 : 1;
+			endoutport = osm_node_get_num_physp(p_node) - 1;
+		} else
+			startoutport = endoutport = attr_mod & 0xff;
+
+		if (attr_mod & 0x20000) {
+			startinport = ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) ? 0 : 1;
+			endinport = osm_node_get_num_physp(p_node) - 1;
+		} else
+			startinport = endinport = (attr_mod >> 8) & 0xff;
+
+		if (startinport > num_ports || startoutport > num_ports) {
+			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2C07"
+				"Invalid attribute modifier 0x%x received in"
+				" response from switch 0x%" PRIx64 "\n",
+				cl_ntoh32(attr_mod), cl_ntoh64(node_guid));
+			goto Exit;
+		}
+
 	} else {
-		p_physp = p_port->p_physp;
-		out_port_num = p_physp->port_num;
-		in_port_num = 0;
+		startoutport = endoutport = p_port->p_physp->port_num;
+		startinport = endinport = 0;
 	}
 
-	/*
-	   We do not mind if this is a result of a set or get - all we want is to update
-	   the subnet.
-	 */
-	OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-		"Got SLtoVL get response in_port_num %u out_port_num %u with "
-		"GUID 0x%" PRIx64 " for parent node GUID 0x%" PRIx64 ", TID 0x%"
-		PRIx64 "\n", in_port_num, out_port_num, cl_ntoh64(port_guid),
-		cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));
-
-	/*
-	   Determine if we encountered a new Physical Port.
-	   If so, Ignore it.
-	 */
-	if (!p_physp) {
-		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
-			"Got invalid port number %u\n", out_port_num);
-		goto Exit;
+	OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Received SLtoVL GetResp"
+		" in_port_num %u out_port_num %u with GUID 0x%" PRIx64
+		" for parent node GUID 0x%" PRIx64 ", TID 0x%" PRIx64 "\n",
+		startinport == endinport ? startinport : 0xff,
+		startoutport == endoutport ? startoutport : 0xff,
+		cl_ntoh64(port_guid), cl_ntoh64(node_guid),
+		cl_ntoh64(p_smp->trans_id));
+
+	osm_dump_slvl_map_table_v2(sm->p_log, port_guid,
+				   startinport == endinport ? startinport : 0xff,
+				   startoutport == endoutport ? startoutport : 0xff,
+				   p_slvl_tbl, FILE_ID, OSM_LOG_DEBUG);
+
+	for (out_port = startoutport; out_port <= endoutport; out_port++) {
+		p_physp = osm_node_get_physp_ptr(p_node, out_port);
+		for (in_port = startinport; in_port <= endinport; in_port++)
+			osm_physp_set_slvl_tbl(p_physp, p_slvl_tbl, in_port);
 	}
 
-	osm_dump_slvl_map_table(sm->p_log,
-				port_guid, in_port_num,
-				out_port_num, p_slvl_tbl, OSM_LOG_DEBUG);
-
-	osm_physp_set_slvl_tbl(p_physp, p_slvl_tbl, in_port_num);
-
 Exit:
 	cl_plock_release(sm->p_lock);
 
diff --git a/opensm/osm_sm.c b/opensm/osm_sm.c
index efebf4a..6f88f59 100644
--- a/opensm/osm_sm.c
+++ b/opensm/osm_sm.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
  *
@@ -52,12 +52,13 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_thread.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SM_C
 #include <opensm/osm_sm.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_msgdef.h>
-#include <opensm/osm_mcm_info.h>
 #include <opensm/osm_perfmgr.h>
 #include <opensm/osm_opensm.h>
 
@@ -69,18 +70,18 @@ extern void osm_nd_rcv_process(IN void *context, IN void *data);
 extern void osm_ni_rcv_process(IN void *context, IN void *data);
 extern void osm_pkey_rcv_process(IN void *context, IN void *data);
 extern void osm_pi_rcv_process(IN void *context, IN void *data);
+extern void osm_gi_rcv_process(IN void *context, IN void *data);
 extern void osm_slvl_rcv_process(IN void *context, IN void *p_data);
 extern void osm_sminfo_rcv_process(IN void *context, IN void *data);
 extern void osm_si_rcv_process(IN void *context, IN void *data);
 extern void osm_trap_rcv_process(IN void *context, IN void *data);
 extern void osm_vla_rcv_process(IN void *context, IN void *data);
+extern void osm_mlnx_epi_rcv_process(IN void *context, IN void *data);
 
 extern void osm_state_mgr_process(IN osm_sm_t * sm, IN osm_signal_t signal);
 extern void osm_sm_state_mgr_polling_callback(IN void *context);
 
-/**********************************************************************
- **********************************************************************/
-static void osm_sm_process(osm_sm_t * sm, osm_signal_t signal)
+static void sm_process(osm_sm_t * sm, osm_signal_t signal)
 {
 #ifdef ENABLE_OSM_PERF_MGR
 	if (signal == OSM_SIGNAL_PERFMGR_SWEEP)
@@ -90,10 +91,10 @@ static void osm_sm_process(osm_sm_t * sm, osm_signal_t signal)
 		osm_state_mgr_process(sm, signal);
 }
 
-static void __osm_sm_sweeper(IN void *p_ptr)
+static void sm_sweeper(IN void *p_ptr)
 {
 	ib_api_status_t status;
-	osm_sm_t *const p_sm = (osm_sm_t *) p_ptr;
+	osm_sm_t * p_sm = p_ptr;
 	unsigned signals, i;
 
 	OSM_LOG_ENTER(p_sm->p_log);
@@ -127,7 +128,7 @@ static void __osm_sm_sweeper(IN void *p_ptr)
 
 		for (i = 0; signals; signals >>= 1, i++)
 			if (signals & 1)
-				osm_sm_process(p_sm, i);
+				sm_process(p_sm, i);
 	}
 
 	OSM_LOG_EXIT(p_sm->p_log);
@@ -152,9 +153,7 @@ static void sweep_fail_process(IN void *context, IN void *p_data)
 	sm->p_subn->force_heavy_sweep = TRUE;
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_sm_construct(IN osm_sm_t * const p_sm)
+void osm_sm_construct(IN osm_sm_t * p_sm)
 {
 	memset(p_sm, 0, sizeof(*p_sm));
 	p_sm->thread_state = OSM_THREAD_STATE_NONE;
@@ -166,15 +165,12 @@ void osm_sm_construct(IN osm_sm_t * const p_sm)
 	cl_event_construct(&p_sm->subnet_up_event);
 	cl_event_wheel_construct(&p_sm->trap_aging_tracker);
 	cl_thread_construct(&p_sm->sweeper);
-	cl_spinlock_construct(&p_sm->mgrp_lock);
 	osm_sm_mad_ctrl_construct(&p_sm->mad_ctrl);
 	osm_lid_mgr_construct(&p_sm->lid_mgr);
 	osm_ucast_mgr_construct(&p_sm->ucast_mgr);
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_sm_shutdown(IN osm_sm_t * const p_sm)
+void osm_sm_shutdown(IN osm_sm_t * p_sm)
 {
 	boolean_t signal_event = FALSE;
 
@@ -207,6 +203,7 @@ void osm_sm_shutdown(IN osm_sm_t * const p_sm)
 	osm_sm_mad_ctrl_destroy(&p_sm->mad_ctrl);
 	cl_disp_unregister(p_sm->ni_disp_h);
 	cl_disp_unregister(p_sm->pi_disp_h);
+	cl_disp_unregister(p_sm->gi_disp_h);
 	cl_disp_unregister(p_sm->si_disp_h);
 	cl_disp_unregister(p_sm->nd_disp_h);
 	cl_disp_unregister(p_sm->lft_disp_h);
@@ -216,14 +213,13 @@ void osm_sm_shutdown(IN osm_sm_t * const p_sm)
 	cl_disp_unregister(p_sm->slvl_disp_h);
 	cl_disp_unregister(p_sm->vla_disp_h);
 	cl_disp_unregister(p_sm->pkey_disp_h);
+	cl_disp_unregister(p_sm->mlnx_epi_disp_h);
 	cl_disp_unregister(p_sm->sweep_fail_disp_h);
 
 	OSM_LOG_EXIT(p_sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_sm_destroy(IN osm_sm_t * const p_sm)
+void osm_sm_destroy(IN osm_sm_t * p_sm)
 {
 	OSM_LOG_ENTER(p_sm->p_log);
 	osm_lid_mgr_destroy(&p_sm->lid_mgr);
@@ -234,27 +230,21 @@ void osm_sm_destroy(IN osm_sm_t * const p_sm)
 	cl_event_destroy(&p_sm->signal_event);
 	cl_event_destroy(&p_sm->subnet_up_event);
 	cl_spinlock_destroy(&p_sm->signal_lock);
-	cl_spinlock_destroy(&p_sm->mgrp_lock);
 	cl_spinlock_destroy(&p_sm->state_lock);
+	free(p_sm->mlids_req);
 
-	osm_log(p_sm->p_log, OSM_LOG_SYS, "Exiting SM\n");	/* Format Waived */
+	osm_log_v2(p_sm->p_log, OSM_LOG_SYS, FILE_ID, "Exiting SM\n");	/* Format Waived */
 	OSM_LOG_EXIT(p_sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_sm_init(IN osm_sm_t * const p_sm,
-	    IN osm_subn_t * const p_subn,
-	    IN osm_db_t * const p_db,
-	    IN osm_vendor_t * const p_vendor,
-	    IN osm_mad_pool_t * const p_mad_pool,
-	    IN osm_vl15_t * const p_vl15,
-	    IN osm_log_t * const p_log,
-	    IN osm_stats_t * const p_stats,
-	    IN cl_dispatcher_t * const p_disp, IN cl_plock_t * const p_lock)
+ib_api_status_t osm_sm_init(IN osm_sm_t * p_sm, IN osm_subn_t * p_subn,
+			    IN osm_db_t * p_db, IN osm_vendor_t * p_vendor,
+			    IN osm_mad_pool_t * p_mad_pool,
+			    IN osm_vl15_t * p_vl15, IN osm_log_t * p_log,
+			    IN osm_stats_t * p_stats,
+			    IN cl_dispatcher_t * p_disp, IN cl_plock_t * p_lock)
 {
-	ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status;
 
 	OSM_LOG_ENTER(p_log);
 
@@ -292,16 +282,17 @@ osm_sm_init(IN osm_sm_t * const p_sm,
 	if (status != CL_SUCCESS)
 		goto Exit;
 
-	cl_qlist_init(&p_sm->mgrp_list);
-
-	status = cl_spinlock_init(&p_sm->mgrp_lock);
-	if (status != CL_SUCCESS)
+	p_sm->mlids_req_max = 0;
+	p_sm->mlids_req = malloc((IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO +
+				  1) * sizeof(p_sm->mlids_req[0]));
+	if (!p_sm->mlids_req)
 		goto Exit;
+	memset(p_sm->mlids_req, 0,
+	       (IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO +
+		1) * sizeof(p_sm->mlids_req[0]));
 
-	status = osm_sm_mad_ctrl_init(&p_sm->mad_ctrl,
-				      p_sm->p_subn,
-				      p_sm->p_mad_pool,
-				      p_sm->p_vl15,
+	status = osm_sm_mad_ctrl_init(&p_sm->mad_ctrl, p_sm->p_subn,
+				      p_sm->p_mad_pool, p_sm->p_vl15,
 				      p_sm->p_vendor,
 				      p_log, p_stats, p_lock, p_disp);
 	if (status != IB_SUCCESS)
@@ -319,6 +310,7 @@ osm_sm_init(IN osm_sm_t * const p_sm,
 	if (status != IB_SUCCESS)
 		goto Exit;
 
+	status = IB_INSUFFICIENT_RESOURCES;
 	p_sm->sweep_fail_disp_h = cl_disp_register(p_disp,
 						   OSM_MSG_LIGHT_SWEEP_FAIL,
 						   sweep_fail_process, p_sm);
@@ -335,6 +327,11 @@ osm_sm_init(IN osm_sm_t * const p_sm,
 	if (p_sm->pi_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
+	p_sm->gi_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_GUID_INFO,
+					   osm_gi_rcv_process, p_sm);
+	if (p_sm->gi_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
 	p_sm->si_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SWITCH_INFO,
 					   osm_si_rcv_process, p_sm);
 	if (p_sm->si_disp_h == CL_DISP_INVALID_HANDLE)
@@ -380,6 +377,12 @@ osm_sm_init(IN osm_sm_t * const p_sm,
 	if (p_sm->pkey_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
+	p_sm->mlnx_epi_disp_h = cl_disp_register(p_disp,
+						 OSM_MSG_MAD_MLNX_EXT_PORT_INFO,
+						 osm_mlnx_epi_rcv_process, p_sm);
+	if (p_sm->mlnx_epi_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
 	p_subn->sm_state = p_subn->opt.sm_inactive ?
 	    IB_SMINFO_STATE_NOTACTIVE : IB_SMINFO_STATE_DISCOVERING;
 	osm_report_sm_state(p_sm);
@@ -389,7 +392,7 @@ osm_sm_init(IN osm_sm_t * const p_sm,
 	 * the sweeper thread if the user wants sweeping.
 	 */
 	p_sm->thread_state = OSM_THREAD_STATE_RUN;
-	status = cl_thread_init(&p_sm->sweeper, __osm_sm_sweeper, p_sm,
+	status = cl_thread_init(&p_sm->sweeper, sm_sweeper, p_sm,
 				"opensm sweeper");
 	if (status != IB_SUCCESS)
 		goto Exit;
@@ -400,11 +403,9 @@ osm_sm_init(IN osm_sm_t * const p_sm,
 
 Exit:
 	OSM_LOG_EXIT(p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_sm_signal(osm_sm_t * p_sm, osm_signal_t signal)
 {
 	cl_spinlock_acquire(&p_sm->signal_lock);
@@ -413,19 +414,14 @@ void osm_sm_signal(osm_sm_t * p_sm, osm_signal_t signal)
 	cl_spinlock_release(&p_sm->signal_lock);
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_sm_sweep(IN osm_sm_t * const p_sm)
+void osm_sm_sweep(IN osm_sm_t * p_sm)
 {
 	OSM_LOG_ENTER(p_sm->p_log);
 	osm_sm_signal(p_sm, OSM_SIGNAL_SWEEP);
 	OSM_LOG_EXIT(p_sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_sm_bind(IN osm_sm_t * const p_sm, IN const ib_net64_t port_guid)
+ib_api_status_t osm_sm_bind(IN osm_sm_t * p_sm, IN ib_net64_t port_guid)
 {
 	ib_api_status_t status;
 
@@ -442,224 +438,21 @@ osm_sm_bind(IN osm_sm_t * const p_sm, IN const ib_net64_t port_guid)
 
 Exit:
 	OSM_LOG_EXIT(p_sm->p_log);
-	return (status);
-}
-
-/**********************************************************************
- **********************************************************************/
-static ib_api_status_t
-__osm_sm_mgrp_process(IN osm_sm_t * const p_sm,
-		      IN osm_mgrp_t * const p_mgrp,
-		      IN const ib_net64_t port_guid,
-		      IN osm_mcast_req_type_t req_type)
-{
-	osm_mcast_mgr_ctxt_t *ctx;
-
-	/*
-	 * 'Schedule' all the QP0 traffic for when the state manager
-	 * isn't busy trying to do something else.
-	 */
-	ctx = malloc(sizeof(*ctx));
-	if (!ctx)
-		return IB_ERROR;
-	memset(ctx, 0, sizeof(*ctx));
-	ctx->mlid = p_mgrp->mlid;
-	ctx->req_type = req_type;
-	ctx->port_guid = port_guid;
-
-	cl_spinlock_acquire(&p_sm->mgrp_lock);
-	cl_qlist_insert_tail(&p_sm->mgrp_list, &ctx->list_item);
-	cl_spinlock_release(&p_sm->mgrp_lock);
-
-	osm_sm_signal(p_sm, OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST);
-
-	return IB_SUCCESS;
-}
-
-/**********************************************************************
- **********************************************************************/
-static ib_api_status_t
-__osm_sm_mgrp_connect(IN osm_sm_t * const p_sm,
-		      IN osm_mgrp_t * const p_mgrp,
-		      IN const ib_net64_t port_guid,
-		      IN osm_mcast_req_type_t req_type)
-{
-	return __osm_sm_mgrp_process(p_sm, p_mgrp, port_guid, req_type);
-}
-
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sm_mgrp_disconnect(IN osm_sm_t * const p_sm,
-			 IN osm_mgrp_t * const p_mgrp,
-			 IN const ib_net64_t port_guid)
-{
-	__osm_sm_mgrp_process(p_sm, p_mgrp, port_guid,
-			      OSM_MCAST_REQ_TYPE_LEAVE);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_sm_mcgrp_join(IN osm_sm_t * const p_sm,
-		  IN const ib_net16_t mlid,
-		  IN const ib_net64_t port_guid,
-		  IN osm_mcast_req_type_t req_type)
-{
-	osm_mgrp_t *p_mgrp;
-	osm_port_t *p_port;
-	ib_api_status_t status = IB_SUCCESS;
-	osm_mcm_info_t *p_mcm;
-
-	OSM_LOG_ENTER(p_sm->p_log);
-
-	OSM_LOG(p_sm->p_log, OSM_LOG_VERBOSE,
-		"Port 0x%016" PRIx64 " joining MLID 0x%X\n",
-		cl_ntoh64(port_guid), cl_ntoh16(mlid));
-
-	/*
-	 * Acquire the port object for the port joining this group.
-	 */
-	CL_PLOCK_EXCL_ACQUIRE(p_sm->p_lock);
-	p_port = osm_get_port_by_guid(p_sm->p_subn, port_guid);
-	if (!p_port) {
-		CL_PLOCK_RELEASE(p_sm->p_lock);
-		OSM_LOG(p_sm->p_log, OSM_LOG_ERROR, "ERR 2E05: "
-			"No port object for port 0x%016" PRIx64 "\n",
-			cl_ntoh64(port_guid));
-		status = IB_INVALID_PARAMETER;
-		goto Exit;
-	}
-
-	/*
-	 * If this multicast group does not already exist, create it.
-	 */
-	p_mgrp = osm_get_mgrp_by_mlid(p_sm->p_subn, mlid);
-	if (!p_mgrp) {
-		OSM_LOG(p_sm->p_log, OSM_LOG_VERBOSE,
-			"Creating group, MLID 0x%X\n", cl_ntoh16(mlid));
-
-		p_mgrp = osm_mgrp_new(mlid);
-		if (p_mgrp == NULL) {
-			CL_PLOCK_RELEASE(p_sm->p_lock);
-			OSM_LOG(p_sm->p_log, OSM_LOG_ERROR, "ERR 2E06: "
-				"Unable to allocate multicast group object\n");
-			status = IB_INSUFFICIENT_MEMORY;
-			goto Exit;
-		}
-
-		p_sm->p_subn->mgroups[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO] = p_mgrp;
-	} else {
-		/*
-		 * The group already exists.  If the port is not a
-		 * member of the group, then fail immediately.
-		 * This can happen since the spinlock is released briefly
-		 * before the SA calls this function.
-		 */
-		if (!osm_mgrp_is_guid(p_mgrp, port_guid)) {
-			CL_PLOCK_RELEASE(p_sm->p_lock);
-			OSM_LOG(p_sm->p_log, OSM_LOG_ERROR, "ERR 2E12: "
-				"Port 0x%016" PRIx64
-				" not in mcast group 0x%X\n",
-				cl_ntoh64(port_guid), cl_ntoh16(mlid));
-			status = IB_NOT_FOUND;
-			goto Exit;
-		}
-	}
-
-	/*
-	 * Check if the object (according to mlid) already exists on this port.
-	 * If it does - then no need to update it again, and no need to
-	 * create the mc tree again. Just goto Exit.
-	 */
-	p_mcm = (osm_mcm_info_t *) cl_qlist_head(&p_port->mcm_list);
-	while (p_mcm != (osm_mcm_info_t *) cl_qlist_end(&p_port->mcm_list)) {
-		if (p_mcm->mlid == mlid) {
-			CL_PLOCK_RELEASE(p_sm->p_lock);
-			OSM_LOG(p_sm->p_log, OSM_LOG_DEBUG,
-				"Found mlid object for Port:"
-				"0x%016" PRIx64 " lid:0x%X\n",
-				cl_ntoh64(port_guid), cl_ntoh16(mlid));
-			goto Exit;
-		}
-		p_mcm = (osm_mcm_info_t *) cl_qlist_next(&p_mcm->list_item);
-	}
-
-	status = osm_port_add_mgrp(p_port, mlid);
-	if (status != IB_SUCCESS) {
-		CL_PLOCK_RELEASE(p_sm->p_lock);
-		OSM_LOG(p_sm->p_log, OSM_LOG_ERROR, "ERR 2E03: "
-			"Unable to associate port 0x%" PRIx64 " to mlid 0x%X\n",
-			cl_ntoh64(osm_port_get_guid(p_port)),
-			cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)));
-		goto Exit;
-	}
-
-	status = __osm_sm_mgrp_connect(p_sm, p_mgrp, port_guid, req_type);
-	CL_PLOCK_RELEASE(p_sm->p_lock);
-
-Exit:
-	OSM_LOG_EXIT(p_sm->p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_sm_mcgrp_leave(IN osm_sm_t * const p_sm,
-		   IN const ib_net16_t mlid, IN const ib_net64_t port_guid)
+void osm_sm_reroute_mlid(osm_sm_t * sm, ib_net16_t mlid)
 {
-	osm_mgrp_t *p_mgrp;
-	osm_port_t *p_port;
-	ib_api_status_t status = IB_SUCCESS;
-
-	OSM_LOG_ENTER(p_sm->p_log);
-
-	OSM_LOG(p_sm->p_log, OSM_LOG_VERBOSE,
-		"Port 0x%" PRIx64 " leaving MLID 0x%X\n",
-		cl_ntoh64(port_guid), cl_ntoh16(mlid));
-
-	/*
-	 * Acquire the port object for the port leaving this group.
-	 */
-	CL_PLOCK_EXCL_ACQUIRE(p_sm->p_lock);
-
-	p_port = osm_get_port_by_guid(p_sm->p_subn, port_guid);
-	if (!p_port) {
-		CL_PLOCK_RELEASE(p_sm->p_lock);
-		OSM_LOG(p_sm->p_log, OSM_LOG_ERROR, "ERR 2E04: "
-			"No port object for port 0x%" PRIx64 "\n",
-			cl_ntoh64(port_guid));
-		status = IB_INVALID_PARAMETER;
-		goto Exit;
-	}
-
-	/*
-	 * Get the multicast group object for this group.
-	 */
-	p_mgrp = osm_get_mgrp_by_mlid(p_sm->p_subn, mlid);
-	if (!p_mgrp) {
-		CL_PLOCK_RELEASE(p_sm->p_lock);
-		OSM_LOG(p_sm->p_log, OSM_LOG_ERROR, "ERR 2E08: "
-			"No multicast group for MLID 0x%X\n", cl_ntoh16(mlid));
-		status = IB_INVALID_PARAMETER;
-		goto Exit;
-	}
-
-	/*
-	 * Walk the list of ports in the group, and remove the appropriate one.
-	 */
-	osm_port_remove_mgrp(p_port, mlid);
-
-	__osm_sm_mgrp_disconnect(p_sm, p_mgrp, port_guid);
-	CL_PLOCK_RELEASE(p_sm->p_lock);
-
-Exit:
-	OSM_LOG_EXIT(p_sm->p_log);
-	return (status);
+	mlid = cl_ntoh16(mlid) - IB_LID_MCAST_START_HO;
+	sm->mlids_req[mlid] = 1;
+	if (sm->mlids_req_max < mlid)
+		sm->mlids_req_max = mlid;
+	osm_sm_signal(sm, OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST);
+	OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "rerouting requested for MLID 0x%x\n",
+		mlid + IB_LID_MCAST_START_HO);
 }
 
-void osm_set_sm_priority(osm_sm_t *sm, uint8_t priority)
+void osm_set_sm_priority(osm_sm_t * sm, uint8_t priority)
 {
 	uint8_t old_pri = sm->p_subn->opt.sm_priority;
 
diff --git a/opensm/osm_sm_mad_ctrl.c b/opensm/osm_sm_mad_ctrl.c
index 267ec85..c384eca 100644
--- a/opensm/osm_sm_mad_ctrl.c
+++ b/opensm/osm_sm_mad_ctrl.c
@@ -1,7 +1,9 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -47,6 +49,8 @@
 #include <string.h>
 #include <complib/cl_debug.h>
 #include <iba/ib_types.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SM_MAD_CTRL_C
 #include <opensm/osm_sm_mad_ctrl.h>
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_madw.h>
@@ -54,9 +58,9 @@
 #include <opensm/osm_helper.h>
 #include <opensm/osm_opensm.h>
 
-/****f* opensm: SM/__osm_sm_mad_ctrl_retire_trans_mad
+/****f* opensm: SM/sm_mad_ctrl_retire_trans_mad
  * NAME
- * __osm_sm_mad_ctrl_retire_trans_mad
+ * sm_mad_ctrl_retire_trans_mad
  *
  * DESCRIPTION
  * This function handles clean-up of MADs associated with the SM's
@@ -65,9 +69,8 @@
  * SYNOPSIS
  */
 
-static void
-__osm_sm_mad_ctrl_retire_trans_mad(IN osm_sm_mad_ctrl_t * const p_ctrl,
-				   IN osm_madw_t * const p_madw)
+static void sm_mad_ctrl_retire_trans_mad(IN osm_sm_mad_ctrl_t * p_ctrl,
+					 IN osm_madw_t * p_madw)
 {
 	uint32_t outstanding;
 
@@ -94,9 +97,9 @@ __osm_sm_mad_ctrl_retire_trans_mad(IN osm_sm_mad_ctrl_t * const p_ctrl,
 
 /************/
 
-/****f* opensm: SM/__osm_sm_mad_ctrl_disp_done_callback
+/****f* opensm: SM/sm_mad_ctrl_disp_done_callback
  * NAME
- * __osm_sm_mad_ctrl_disp_done_callback
+ * sm_mad_ctrl_disp_done_callback
  *
  * DESCRIPTION
  * This function is the Dispatcher callback that indicates
@@ -104,11 +107,10 @@ __osm_sm_mad_ctrl_retire_trans_mad(IN osm_sm_mad_ctrl_t * const p_ctrl,
  *
  * SYNOPSIS
  */
-static void
-__osm_sm_mad_ctrl_disp_done_callback(IN void *context, IN void *p_data)
+static void sm_mad_ctrl_disp_done_callback(IN void *context, IN void *p_data)
 {
-	osm_sm_mad_ctrl_t *const p_ctrl = (osm_sm_mad_ctrl_t *) context;
-	osm_madw_t *const p_madw = (osm_madw_t *) p_data;
+	osm_sm_mad_ctrl_t *p_ctrl = context;
+	osm_madw_t *p_madw = p_data;
 	ib_smp_t *p_smp;
 
 	OSM_LOG_ENTER(p_ctrl->p_log);
@@ -126,9 +128,9 @@ __osm_sm_mad_ctrl_disp_done_callback(IN void *context, IN void *p_data)
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 	if (ib_smp_is_response(p_smp)) {
 		CL_ASSERT(p_madw->resp_expected == FALSE);
-		__osm_sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);
+		sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);
 	} else if (p_madw->resp_expected == TRUE)
-		__osm_sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);
+		sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);
 	else
 		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
 
@@ -137,17 +139,16 @@ __osm_sm_mad_ctrl_disp_done_callback(IN void *context, IN void *p_data)
 
 /************/
 
-/****f* opensm: SM/__osm_sm_mad_ctrl_update_wire_stats
+/****f* opensm: SM/sm_mad_ctrl_update_wire_stats
  * NAME
- * __osm_sm_mad_ctrl_update_wire_stats
+ * sm_mad_ctrl_update_wire_stats
  *
  * DESCRIPTION
  * Updates wire stats for outstanding MADs and calls the VL15 poller.
  *
  * SYNOPSIS
  */
-static void
-__osm_sm_mad_ctrl_update_wire_stats(IN osm_sm_mad_ctrl_t * const p_ctrl)
+static void sm_mad_ctrl_update_wire_stats(IN osm_sm_mad_ctrl_t * p_ctrl)
 {
 	uint32_t mads_on_wire;
 
@@ -168,9 +169,9 @@ __osm_sm_mad_ctrl_update_wire_stats(IN osm_sm_mad_ctrl_t * const p_ctrl)
 	OSM_LOG_EXIT(p_ctrl->p_log);
 }
 
-/****f* opensm: SM/__osm_sm_mad_ctrl_process_get_resp
+/****f* opensm: SM/sm_mad_ctrl_process_get_resp
  * NAME
- * __osm_sm_mad_ctrl_process_get_resp
+ * sm_mad_ctrl_process_get_resp
  *
  * DESCRIPTION
  * This function handles method GetResp() for received MADs.
@@ -178,10 +179,9 @@ __osm_sm_mad_ctrl_update_wire_stats(IN osm_sm_mad_ctrl_t * const p_ctrl)
  *
  * SYNOPSIS
  */
-static void
-__osm_sm_mad_ctrl_process_get_resp(IN osm_sm_mad_ctrl_t * const p_ctrl,
-				   IN osm_madw_t * p_madw,
-				   IN void *transaction_context)
+static void sm_mad_ctrl_process_get_resp(IN osm_sm_mad_ctrl_t * p_ctrl,
+					 IN osm_madw_t * p_madw,
+					 IN void *transaction_context)
 {
 	ib_smp_t *p_smp;
 	cl_status_t status;
@@ -198,12 +198,12 @@ __osm_sm_mad_ctrl_process_get_resp(IN osm_sm_mad_ctrl_t * const p_ctrl,
 	if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR && !ib_smp_is_d(p_smp)) {
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3102: "
 			"'D' bit not set in returned SMP\n");
-		osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);
+		osm_dump_dr_smp_v2(p_ctrl->p_log, p_smp, FILE_ID, OSM_LOG_ERROR);
 	}
 
-	p_old_madw = (osm_madw_t *) transaction_context;
+	p_old_madw = transaction_context;
 
-	__osm_sm_mad_ctrl_update_wire_stats(p_ctrl);
+	sm_mad_ctrl_update_wire_stats(p_ctrl);
 
 	/*
 	   Copy the MAD Wrapper context from the requesting MAD
@@ -226,6 +226,9 @@ __osm_sm_mad_ctrl_process_get_resp(IN osm_sm_mad_ctrl_t * const p_ctrl,
 	case IB_MAD_ATTR_NODE_INFO:
 		msg_id = OSM_MSG_MAD_NODE_INFO;
 		break;
+	case IB_MAD_ATTR_GUID_INFO:
+		msg_id = OSM_MSG_MAD_GUID_INFO;
+		break;
 	case IB_MAD_ATTR_SWITCH_INFO:
 		msg_id = OSM_MSG_MAD_SWITCH_INFO;
 		break;
@@ -250,23 +253,22 @@ __osm_sm_mad_ctrl_process_get_resp(IN osm_sm_mad_ctrl_t * const p_ctrl,
 	case IB_MAD_ATTR_P_KEY_TABLE:
 		msg_id = OSM_MSG_MAD_PKEY;
 		break;
-
-	case IB_MAD_ATTR_GUID_INFO:
+	case IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO:
+		msg_id = OSM_MSG_MAD_MLNX_EXT_PORT_INFO;
+		break;
 	case IB_MAD_ATTR_CLASS_PORT_INFO:
 	case IB_MAD_ATTR_NOTICE:
 	case IB_MAD_ATTR_INFORM_INFO:
 	default:
 		cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown);
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3103: "
-			"Unsupported attribute = 0x%X\n",
+			"Unsupported attribute 0x%X\n",
 			cl_ntoh16(p_smp->attr_id));
-		osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);
+		osm_dump_dr_smp_v2(p_ctrl->p_log, p_smp, FILE_ID, OSM_LOG_ERROR);
+		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
 		goto Exit;
 	}
 
-	if (msg_id == CL_DISP_MSGID_NONE)
-		goto Exit;
-
 	/*
 	   Post this MAD to the dispatcher for asynchronous
 	   processing by the appropriate controller.
@@ -276,12 +278,13 @@ __osm_sm_mad_ctrl_process_get_resp(IN osm_sm_mad_ctrl_t * const p_ctrl,
 		osm_get_disp_msg_str(msg_id));
 
 	status = cl_disp_post(p_ctrl->h_disp, msg_id, p_madw,
-			      __osm_sm_mad_ctrl_disp_done_callback, p_ctrl);
+			      sm_mad_ctrl_disp_done_callback, p_ctrl);
 
 	if (status != CL_SUCCESS) {
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3104: "
-			"Dispatcher post message failed (%s) for attribute = 0x%X\n",
-			CL_STATUS_MSG(status), cl_ntoh16(p_smp->attr_id));
+			"Dispatcher post message failed (%s) for attribute 0x%X (%s)\n",
+			CL_STATUS_MSG(status), cl_ntoh16(p_smp->attr_id),
+			ib_get_sm_attr_str(p_smp->attr_id));
 		goto Exit;
 	}
 
@@ -289,18 +292,17 @@ Exit:
 	OSM_LOG_EXIT(p_ctrl->p_log);
 }
 
-/****f* opensm: SM/__osm_sm_mad_ctrl_process_get
+/****f* opensm: SM/sm_mad_ctrl_process_get
  * NAME
- * __osm_sm_mad_ctrl_process_get
+ * sm_mad_ctrl_process_get
  *
  * DESCRIPTION
  * This function handles method Get() for received MADs.
  *
  * SYNOPSIS
  */
-static void
-__osm_sm_mad_ctrl_process_get(IN osm_sm_mad_ctrl_t * const p_ctrl,
-			      IN osm_madw_t * p_madw)
+static void sm_mad_ctrl_process_get(IN osm_sm_mad_ctrl_t * p_ctrl,
+				    IN osm_madw_t * p_madw)
 {
 	ib_smp_t *p_smp;
 	cl_status_t status;
@@ -318,20 +320,11 @@ __osm_sm_mad_ctrl_process_get(IN osm_sm_mad_ctrl_t * const p_ctrl,
 	case IB_MAD_ATTR_SM_INFO:
 		msg_id = OSM_MSG_MAD_SM_INFO;
 		break;
-
 	default:
 		cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown);
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_VERBOSE,
-			"Ignoring SubnGet MAD - unsupported attribute = 0x%X\n",
+			"Ignoring SubnGet MAD - unsupported attribute 0x%X\n",
 			cl_ntoh16(p_smp->attr_id));
-		break;
-	}
-
-	if (msg_id == CL_DISP_MSGID_NONE) {
-		/*
-		   There is an unknown MAD attribute type for which there is
-		   no recipient.  Simply retire the MAD here.
-		 */
 		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
 		goto Exit;
 	}
@@ -345,7 +338,7 @@ __osm_sm_mad_ctrl_process_get(IN osm_sm_mad_ctrl_t * const p_ctrl,
 		osm_get_disp_msg_str(msg_id));
 
 	status = cl_disp_post(p_ctrl->h_disp, msg_id, p_madw,
-			      __osm_sm_mad_ctrl_disp_done_callback, p_ctrl);
+			      sm_mad_ctrl_disp_done_callback, p_ctrl);
 
 	if (status != CL_SUCCESS) {
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3106: "
@@ -368,18 +361,17 @@ Exit:
  * SEE ALSO
  *********/
 
-/****f* opensm: SM/__osm_sm_mad_ctrl_process_set
+/****f* opensm: SM/sm_mad_ctrl_process_set
  * NAME
- * __osm_sm_mad_ctrl_process_set
+ * sm_mad_ctrl_process_set
  *
  * DESCRIPTION
  * This function handles method Set() for received MADs.
  *
  * SYNOPSIS
  */
-static void
-__osm_sm_mad_ctrl_process_set(IN osm_sm_mad_ctrl_t * const p_ctrl,
-			      IN osm_madw_t * p_madw)
+static void sm_mad_ctrl_process_set(IN osm_sm_mad_ctrl_t * p_ctrl,
+				    IN osm_madw_t * p_madw)
 {
 	ib_smp_t *p_smp;
 	cl_status_t status;
@@ -397,21 +389,12 @@ __osm_sm_mad_ctrl_process_set(IN osm_sm_mad_ctrl_t * const p_ctrl,
 	case IB_MAD_ATTR_SM_INFO:
 		msg_id = OSM_MSG_MAD_SM_INFO;
 		break;
-
 	default:
 		cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown);
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3107: "
-			"Unsupported attribute = 0x%X\n",
+			"Unsupported attribute 0x%X\n",
 			cl_ntoh16(p_smp->attr_id));
-		osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);
-		break;
-	}
-
-	if (msg_id == CL_DISP_MSGID_NONE) {
-		/*
-		   There is an unknown MAD attribute type for which there is
-		   no recipient.  Simply retire the MAD here.
-		 */
+		osm_dump_dr_smp_v2(p_ctrl->p_log, p_smp, FILE_ID, OSM_LOG_ERROR);
 		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
 		goto Exit;
 	}
@@ -425,7 +408,7 @@ __osm_sm_mad_ctrl_process_set(IN osm_sm_mad_ctrl_t * const p_ctrl,
 		osm_get_disp_msg_str(msg_id));
 
 	status = cl_disp_post(p_ctrl->h_disp, msg_id, p_madw,
-			      __osm_sm_mad_ctrl_disp_done_callback, p_ctrl);
+			      sm_mad_ctrl_disp_done_callback, p_ctrl);
 
 	if (status != CL_SUCCESS) {
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3108: "
@@ -448,18 +431,17 @@ Exit:
  * SEE ALSO
  *********/
 
-/****f* opensm: SM/__osm_sm_mad_ctrl_process_trap
+/****f* opensm: SM/sm_mad_ctrl_process_trap
  * NAME
- * __osm_sm_mad_ctrl_process_trap
+ * sm_mad_ctrl_process_trap
  *
  * DESCRIPTION
  * This function handles method Trap() for received MADs.
  *
  * SYNOPSIS
  */
-static void
-__osm_sm_mad_ctrl_process_trap(IN osm_sm_mad_ctrl_t * const p_ctrl,
-			       IN osm_madw_t * p_madw)
+static void sm_mad_ctrl_process_trap(IN osm_sm_mad_ctrl_t * p_ctrl,
+				     IN osm_madw_t * p_madw)
 {
 	ib_smp_t *p_smp;
 	cl_status_t status;
@@ -486,21 +468,12 @@ __osm_sm_mad_ctrl_process_trap(IN osm_sm_mad_ctrl_t * const p_ctrl,
 	case IB_MAD_ATTR_NOTICE:
 		msg_id = OSM_MSG_MAD_NOTICE;
 		break;
-
 	default:
 		cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown);
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3109: "
-			"Unsupported attribute = 0x%X\n",
+			"Unsupported attribute 0x%X\n",
 			cl_ntoh16(p_smp->attr_id));
-		osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);
-		break;
-	}
-
-	if (msg_id == CL_DISP_MSGID_NONE) {
-		/*
-		   There is an unknown MAD attribute type for which there is
-		   no recipient.  Simply retire the MAD here.
-		 */
+		osm_dump_dr_smp_v2(p_ctrl->p_log, p_smp, FILE_ID, OSM_LOG_ERROR);
 		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
 		goto Exit;
 	}
@@ -514,7 +487,7 @@ __osm_sm_mad_ctrl_process_trap(IN osm_sm_mad_ctrl_t * const p_ctrl,
 		osm_get_disp_msg_str(msg_id));
 
 	status = cl_disp_post(p_ctrl->h_disp, msg_id, p_madw,
-			      __osm_sm_mad_ctrl_disp_done_callback, p_ctrl);
+			      sm_mad_ctrl_disp_done_callback, p_ctrl);
 
 	if (status != CL_SUCCESS) {
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3110: "
@@ -537,21 +510,98 @@ Exit:
  * SEE ALSO
  *********/
 
-/****f* opensm: SM/__osm_sm_mad_ctrl_rcv_callback
+/****f* opensm: SM/sm_mad_ctrl_process_trap_repress
  * NAME
- * __osm_sm_mad_ctrl_rcv_callback
+ * sm_mad_ctrl_process_trap_repress
+ *
+ * DESCRIPTION
+ * This function handles method TrapRepress() for received MADs.
+ *
+ * SYNOPSIS
+ */
+static void sm_mad_ctrl_process_trap_repress(IN osm_sm_mad_ctrl_t * p_ctrl,
+					     IN osm_madw_t * p_madw)
+{
+	ib_smp_t *p_smp;
+
+	OSM_LOG_ENTER(p_ctrl->p_log);
+
+	p_smp = osm_madw_get_smp_ptr(p_madw);
+
+	/*
+	   Note that attr_id (like the rest of the MAD) is in
+	   network byte order.
+	 */
+	switch (p_smp->attr_id) {
+	case IB_MAD_ATTR_NOTICE:
+		sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);
+		break;
+	default:
+		cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown);
+		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3105: "
+			"Unsupported attribute 0x%X\n",
+			cl_ntoh16(p_smp->attr_id));
+		osm_dump_dr_smp_v2(p_ctrl->p_log, p_smp, FILE_ID, OSM_LOG_ERROR);
+		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
+		break;
+	}
+
+	OSM_LOG_EXIT(p_ctrl->p_log);
+}
+
+static void log_rcv_cb_error(osm_log_t *p_log, ib_smp_t *p_smp, ib_net16_t status)
+{
+	char buf[BUF_SIZE];
+	uint32_t i;
+
+	if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {
+		char ipath[BUF_SIZE], rpath[BUF_SIZE];
+		int ni = sprintf(ipath, "%d", p_smp->initial_path[0]);
+		int nr = sprintf(rpath, "%d", p_smp->return_path[0]);
+		for (i = 1; i <= p_smp->hop_count; i++) {
+			ni += sprintf(ipath + ni, ",%d", p_smp->initial_path[i]);
+			nr += sprintf(rpath + nr, ",%d", p_smp->return_path[i]);
+		}
+		snprintf(buf, sizeof(buf),
+			 "\n\t\t\tInitial path: %s Return path: %s",
+			 ipath, rpath);
+	}
+
+	OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 3111: "
+		"Received MAD with error status = 0x%X\n"
+		"\t\t\t%s(%s), attr_mod 0x%x, TID 0x%" PRIx64 "%s\n",
+		cl_ntoh16(status), ib_get_sm_method_str(p_smp->method),
+		ib_get_sm_attr_str(p_smp->attr_id), cl_ntoh32(p_smp->attr_mod),
+		cl_ntoh64(p_smp->trans_id),
+		p_smp->mgmt_class == IB_MCLASS_SUBN_DIR ? buf : "");
+
+	osm_dump_dr_smp_v2(p_log, p_smp, FILE_ID, OSM_LOG_VERBOSE);
+}
+
+/*
+ * PARAMETERS
+ *
+ * RETURN VALUES
+ *
+ * NOTES
+ *
+ * SEE ALSO
+ *********/
+
+/****f* opensm: SM/sm_mad_ctrl_rcv_callback
+ * NAME
+ * sm_mad_ctrl_rcv_callback
  *
  * DESCRIPTION
  * This is the callback from the transport layer for received MADs.
  *
  * SYNOPSIS
  */
-static void
-__osm_sm_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw,
-			       IN void *bind_context,
-			       IN osm_madw_t * p_req_madw)
+static void sm_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw,
+				     IN void *bind_context,
+				     IN osm_madw_t * p_req_madw)
 {
-	osm_sm_mad_ctrl_t *p_ctrl = (osm_sm_mad_ctrl_t *) bind_context;
+	osm_sm_mad_ctrl_t *p_ctrl = bind_context;
 	ib_smp_t *p_smp;
 	ib_net16_t status;
 
@@ -574,65 +624,60 @@ __osm_sm_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw,
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR,
 			"Ignoring received mad - since we are exiting\n");
 
-		osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_DEBUG);
+		osm_dump_dr_smp_v2(p_ctrl->p_log, p_smp, FILE_ID, OSM_LOG_DEBUG);
 
 		/* retire the mad or put it back */
-		if (ib_smp_is_response(p_smp) ||
-		    (p_smp->method == IB_MAD_METHOD_TRAP_REPRESS)) {
+		if (ib_smp_is_response(p_smp)) {
 			CL_ASSERT(p_madw->resp_expected == FALSE);
-			__osm_sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);
+			sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);
 		} else if (p_madw->resp_expected == TRUE)
-			__osm_sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);
+			sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);
 		else
 			osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
 
 		goto Exit;
 	}
 
-	if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_FRAMES))
-		osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_FRAMES);
+	if (OSM_LOG_IS_ACTIVE_V2(p_ctrl->p_log, OSM_LOG_FRAMES))
+		osm_dump_dr_smp_v2(p_ctrl->p_log, p_smp, FILE_ID, OSM_LOG_FRAMES);
 
 	if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR)
 		status = ib_smp_get_status(p_smp);
 	else
 		status = p_smp->status;
 
-	if (status != 0) {
-		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3111: "
-			"Error status = 0x%X\n", status);
-		osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);
-	}
+	if (status != 0)
+		log_rcv_cb_error(p_ctrl->p_log, p_smp, status);
 
 	switch (p_smp->method) {
 	case IB_MAD_METHOD_GET_RESP:
 		CL_ASSERT(p_req_madw != NULL);
-		__osm_sm_mad_ctrl_process_get_resp(p_ctrl, p_madw, p_req_madw);
+		sm_mad_ctrl_process_get_resp(p_ctrl, p_madw, p_req_madw);
 		break;
-
 	case IB_MAD_METHOD_GET:
 		CL_ASSERT(p_req_madw == NULL);
-		__osm_sm_mad_ctrl_process_get(p_ctrl, p_madw);
+		sm_mad_ctrl_process_get(p_ctrl, p_madw);
 		break;
-
 	case IB_MAD_METHOD_TRAP:
 		CL_ASSERT(p_req_madw == NULL);
-		__osm_sm_mad_ctrl_process_trap(p_ctrl, p_madw);
+		sm_mad_ctrl_process_trap(p_ctrl, p_madw);
 		break;
-
 	case IB_MAD_METHOD_SET:
 		CL_ASSERT(p_req_madw == NULL);
-		__osm_sm_mad_ctrl_process_set(p_ctrl, p_madw);
+		sm_mad_ctrl_process_set(p_ctrl, p_madw);
+		break;
+	case IB_MAD_METHOD_TRAP_REPRESS:
+		CL_ASSERT(p_req_madw != NULL);
+		sm_mad_ctrl_process_trap_repress(p_ctrl, p_madw);
 		break;
-
 	case IB_MAD_METHOD_SEND:
 	case IB_MAD_METHOD_REPORT:
 	case IB_MAD_METHOD_REPORT_RESP:
-	case IB_MAD_METHOD_TRAP_REPRESS:
 	default:
 		cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown);
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3112: "
 			"Unsupported method = 0x%X\n", p_smp->method);
-		osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);
+		osm_dump_dr_smp_v2(p_ctrl->p_log, p_smp, FILE_ID, OSM_LOG_ERROR);
 		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
 		goto Exit;
 	}
@@ -651,9 +696,9 @@ Exit:
  * SEE ALSO
  *********/
 
-/****f* opensm: SM/__osm_sm_mad_ctrl_send_err_cb
+/****f* opensm: SM/sm_mad_ctrl_send_err_cb
  * NAME
- * __osm_sm_mad_ctrl_send_err_cb
+ * sm_mad_ctrl_send_err_cb
  *
  * DESCRIPTION
  * This is the callback from the transport layer for send errors
@@ -661,10 +706,9 @@ Exit:
  *
  * SYNOPSIS
  */
-static void
-__osm_sm_mad_ctrl_send_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)
+static void sm_mad_ctrl_send_err_cb(IN void *context, IN osm_madw_t * p_madw)
 {
-	osm_sm_mad_ctrl_t *p_ctrl = (osm_sm_mad_ctrl_t *) bind_context;
+	osm_sm_mad_ctrl_t *p_ctrl = context;
 	ib_api_status_t status;
 	ib_smp_t *p_smp;
 
@@ -672,9 +716,14 @@ __osm_sm_mad_ctrl_send_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)
 
 	CL_ASSERT(p_madw);
 
+	p_smp = osm_madw_get_smp_ptr(p_madw);
 	OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3113: "
-		"MAD completed in error (%s)\n",
-		ib_get_err_str(p_madw->status));
+		"MAD completed in error (%s): "
+		"%s(%s), attr_mod 0x%x, TID 0x%" PRIx64 "\n",
+		ib_get_err_str(p_madw->status),
+		ib_get_sm_method_str(p_smp->method),
+		ib_get_sm_attr_str(p_smp->attr_id), cl_ntoh32(p_smp->attr_mod),
+		cl_ntoh64(p_smp->trans_id));
 
 	/*
 	   If this was a SubnSet MAD, then this error might indicate a problem
@@ -682,17 +731,29 @@ __osm_sm_mad_ctrl_send_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)
 	   such a problem. The subnet will not be up, and the next sweep should
 	   be a heavy sweep as well.
 	 */
-	p_smp = osm_madw_get_smp_ptr(p_madw);
 	if (p_smp->method == IB_MAD_METHOD_SET &&
 	    (p_smp->attr_id == IB_MAD_ATTR_PORT_INFO ||
+	     p_smp->attr_id == IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO ||
 	     p_smp->attr_id == IB_MAD_ATTR_MCAST_FWD_TBL ||
 	     p_smp->attr_id == IB_MAD_ATTR_SWITCH_INFO ||
-	     p_smp->attr_id == IB_MAD_ATTR_LIN_FWD_TBL)) {
+	     p_smp->attr_id == IB_MAD_ATTR_LIN_FWD_TBL ||
+	     p_smp->attr_id == IB_MAD_ATTR_P_KEY_TABLE)) {
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3119: "
-			"Set method failed\n");
+			"Set method failed for attribute 0x%X (%s)\n",
+			cl_ntoh16(p_smp->attr_id),
+			ib_get_sm_attr_str(p_smp->attr_id));
 		p_ctrl->p_subn->subnet_initialization_error = TRUE;
+	} else if (p_madw->status == IB_TIMEOUT &&
+		   p_smp->method == IB_MAD_METHOD_GET) {
+		OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3120 "
+			"Timeout while getting attribute 0x%X (%s); "
+			"Possible mis-set mkey?\n",
+			cl_ntoh16(p_smp->attr_id),
+			ib_get_sm_attr_str(p_smp->attr_id));
 	}
 
+	osm_dump_dr_smp_v2(p_ctrl->p_log, p_smp, FILE_ID, OSM_LOG_VERBOSE);
+
 	/*
 	   Since we did not get any response we suspect the DR path
 	   used for the target port.
@@ -704,10 +765,10 @@ __osm_sm_mad_ctrl_send_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)
 	/* For now - do not add the alternate dr path to the release */
 #if 0
 	if (p_madw->mad_addr.dest_lid != 0xFFFF) {
-		osm_physp_t *p_physp =
-		    osm_get_physp_by_mad_addr(p_ctrl->p_log,
-					      p_ctrl->p_subn,
-					      &(p_madw->mad_addr));
+		osm_physp_t *p_physp = osm_get_physp_by_mad_addr(p_ctrl->p_log,
+								 p_ctrl->p_subn,
+								 &(p_madw->
+								   mad_addr));
 		if (!p_physp) {
 			OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3114: "
 				"Failed to find the corresponding phys port\n");
@@ -723,11 +784,7 @@ __osm_sm_mad_ctrl_send_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)
 	   An error occurred.  No response was received to a request MAD.
 	   Retire the original request MAD.
 	 */
-
-	osm_dump_dr_smp(p_ctrl->p_log, osm_madw_get_smp_ptr(p_madw),
-			OSM_LOG_ERROR);
-
-	__osm_sm_mad_ctrl_update_wire_stats(p_ctrl);
+	sm_mad_ctrl_update_wire_stats(p_ctrl);
 
 	if (osm_madw_get_err_msg(p_madw) != CL_DISP_MSGID_NONE) {
 		OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG,
@@ -735,10 +792,8 @@ __osm_sm_mad_ctrl_send_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)
 			osm_get_disp_msg_str(osm_madw_get_err_msg(p_madw)));
 
 		status = cl_disp_post(p_ctrl->h_disp,
-				      osm_madw_get_err_msg(p_madw),
-				      p_madw,
-				      __osm_sm_mad_ctrl_disp_done_callback,
-				      p_ctrl);
+				      osm_madw_get_err_msg(p_madw), p_madw,
+				      sm_mad_ctrl_disp_done_callback, p_ctrl);
 		if (status != CL_SUCCESS)
 			OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3115: "
 				"Dispatcher post message failed (%s)\n",
@@ -747,7 +802,7 @@ __osm_sm_mad_ctrl_send_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)
 		/*
 		   No error message was provided, just retire the MAD.
 		 */
-		__osm_sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);
+		sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);
 
 	OSM_LOG_EXIT(p_ctrl->p_log);
 }
@@ -762,18 +817,14 @@ __osm_sm_mad_ctrl_send_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)
  * SEE ALSO
  *********/
 
-/**********************************************************************
- **********************************************************************/
-void osm_sm_mad_ctrl_construct(IN osm_sm_mad_ctrl_t * const p_ctrl)
+void osm_sm_mad_ctrl_construct(IN osm_sm_mad_ctrl_t * p_ctrl)
 {
 	CL_ASSERT(p_ctrl);
 	memset(p_ctrl, 0, sizeof(*p_ctrl));
 	p_ctrl->h_disp = CL_DISP_INVALID_HANDLE;
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_sm_mad_ctrl_destroy(IN osm_sm_mad_ctrl_t * const p_ctrl)
+void osm_sm_mad_ctrl_destroy(IN osm_sm_mad_ctrl_t * p_ctrl)
 {
 	CL_ASSERT(p_ctrl);
 
@@ -782,18 +833,15 @@ void osm_sm_mad_ctrl_destroy(IN osm_sm_mad_ctrl_t * const p_ctrl)
 	cl_disp_unregister(p_ctrl->h_disp);
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_sm_mad_ctrl_init(IN osm_sm_mad_ctrl_t * const p_ctrl,
-		     IN osm_subn_t * const p_subn,
-		     IN osm_mad_pool_t * const p_mad_pool,
-		     IN osm_vl15_t * const p_vl15,
-		     IN osm_vendor_t * const p_vendor,
-		     IN osm_log_t * const p_log,
-		     IN osm_stats_t * const p_stats,
-		     IN cl_plock_t * const p_lock,
-		     IN cl_dispatcher_t * const p_disp)
+ib_api_status_t osm_sm_mad_ctrl_init(IN osm_sm_mad_ctrl_t * p_ctrl,
+				     IN osm_subn_t * p_subn,
+				     IN osm_mad_pool_t * p_mad_pool,
+				     IN osm_vl15_t * p_vl15,
+				     IN osm_vendor_t * p_vendor,
+				     IN osm_log_t * p_log,
+				     IN osm_stats_t * p_stats,
+				     IN cl_plock_t * p_lock,
+				     IN cl_dispatcher_t * p_disp)
 {
 	ib_api_status_t status = IB_SUCCESS;
 
@@ -810,8 +858,8 @@ osm_sm_mad_ctrl_init(IN osm_sm_mad_ctrl_t * const p_ctrl,
 	p_ctrl->p_lock = p_lock;
 	p_ctrl->p_vl15 = p_vl15;
 
-	p_ctrl->h_disp = cl_disp_register(p_disp,
-					  CL_DISP_MSGID_NONE, NULL, NULL);
+	p_ctrl->h_disp = cl_disp_register(p_disp, CL_DISP_MSGID_NONE, NULL,
+					  NULL);
 
 	if (p_ctrl->h_disp == CL_DISP_INVALID_HANDLE) {
 		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 3116: "
@@ -822,14 +870,11 @@ osm_sm_mad_ctrl_init(IN osm_sm_mad_ctrl_t * const p_ctrl,
 
 Exit:
 	OSM_LOG_EXIT(p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_sm_mad_ctrl_bind(IN osm_sm_mad_ctrl_t * const p_ctrl,
-		     IN const ib_net64_t port_guid)
+ib_api_status_t osm_sm_mad_ctrl_bind(IN osm_sm_mad_ctrl_t * p_ctrl,
+				     IN ib_net64_t port_guid)
 {
 	osm_bind_info_t bind_info;
 	ib_api_status_t status = IB_SUCCESS;
@@ -851,15 +896,16 @@ osm_sm_mad_ctrl_bind(IN osm_sm_mad_ctrl_t * const p_ctrl,
 	bind_info.port_guid = port_guid;
 	bind_info.recv_q_size = OSM_SM_DEFAULT_QP0_RCV_SIZE;
 	bind_info.send_q_size = OSM_SM_DEFAULT_QP0_SEND_SIZE;
+	bind_info.timeout = p_ctrl->p_subn->opt.transaction_timeout;
+	bind_info.retries = p_ctrl->p_subn->opt.transaction_retries;
 
 	OSM_LOG(p_ctrl->p_log, OSM_LOG_VERBOSE,
 		"Binding to port 0x%" PRIx64 "\n", cl_ntoh64(port_guid));
 
-	p_ctrl->h_bind = osm_vendor_bind(p_ctrl->p_vendor,
-					 &bind_info,
+	p_ctrl->h_bind = osm_vendor_bind(p_ctrl->p_vendor, &bind_info,
 					 p_ctrl->p_mad_pool,
-					 __osm_sm_mad_ctrl_rcv_callback,
-					 __osm_sm_mad_ctrl_send_err_cb, p_ctrl);
+					 sm_mad_ctrl_rcv_callback,
+					 sm_mad_ctrl_send_err_cb, p_ctrl);
 
 	if (p_ctrl->h_bind == OSM_BIND_INVALID_HANDLE) {
 		status = IB_ERROR;
@@ -870,5 +916,5 @@ osm_sm_mad_ctrl_bind(IN osm_sm_mad_ctrl_t * const p_ctrl,
 
 Exit:
 	OSM_LOG_EXIT(p_ctrl->p_log);
-	return (status);
+	return status;
 }
diff --git a/opensm/osm_sm_state_mgr.c b/opensm/osm_sm_state_mgr.c
index 343a9e3..7da8258 100644
--- a/opensm/osm_sm_state_mgr.c
+++ b/opensm/osm_sm_state_mgr.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -48,6 +48,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SM_STATE_MGR_C
 #include <opensm/osm_sm.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_switch.h>
@@ -61,57 +63,64 @@
 #include <opensm/osm_helper.h>
 #include <opensm/osm_opensm.h>
 
-/**********************************************************************
- **********************************************************************/
 void osm_report_sm_state(osm_sm_t * sm)
 {
 	char buf[64];
 	const char *state_str = osm_get_sm_mgr_state_str(sm->p_subn->sm_state);
 
-	osm_log(sm->p_log, OSM_LOG_SYS, "Entering %s state\n", state_str);
+	osm_log_v2(sm->p_log, OSM_LOG_SYS, FILE_ID, "Entering %s state\n", state_str);
 	snprintf(buf, sizeof(buf), "ENTERING SM %s STATE", state_str);
 	OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, buf);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void __osm_sm_state_mgr_send_master_sm_info_req(osm_sm_t * sm)
+static void sm_state_mgr_send_master_sm_info_req(osm_sm_t * sm)
 {
 	osm_madw_context_t context;
 	const osm_port_t *p_port;
 	ib_api_status_t status;
+	osm_dr_path_t dr_path;
+	ib_net64_t guid;
 
 	OSM_LOG_ENTER(sm->p_log);
 
 	memset(&context, 0, sizeof(context));
+	CL_PLOCK_ACQUIRE(sm->p_lock);
 	if (sm->p_subn->sm_state == IB_SMINFO_STATE_STANDBY) {
 		/*
-		 * We are in STANDBY state - this means we need to poll on the master
-		 * SM (according to master_guid)
-		 * Send a query of SubnGet(SMInfo) to the subn master_sm_base_lid object.
+		 * We are in STANDBY state - this means we need to poll the
+		 * master SM (according to master_guid).
+		 * Send a query of SubnGet(SMInfo) to the subn
+		 * master_sm_base_lid object.
 		 */
-		p_port = osm_get_port_by_guid(sm->p_subn, sm->master_sm_guid);
+		guid = sm->master_sm_guid;
 	} else {
 		/*
-		 * We are not in STANDBY - this means we are in MASTER state - so we need
-		 * to poll on the SM that is saved in p_polling_sm under sm.
+		 * We are not in STANDBY - this means we are in MASTER state -
+		 * so we need to poll the SM that is saved in p_polling_sm
+		 * under sm.
 		 * Send a query of SubnGet(SMInfo) to that SM.
 		 */
-		p_port = sm->p_polling_sm->p_port;
+		guid = sm->p_polling_sm->smi.guid;
 	}
+
+	p_port = osm_get_port_by_guid(sm->p_subn, guid);
+
 	if (p_port == NULL) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3203: "
 			"No port object for GUID 0x%016" PRIx64 "\n",
-			cl_ntoh64(sm->master_sm_guid));
+			cl_ntoh64(guid));
+		CL_PLOCK_RELEASE(sm->p_lock);
 		goto Exit;
 	}
 
-	context.smi_context.port_guid = p_port->guid;
+	context.smi_context.port_guid = guid;
 	context.smi_context.set_method = FALSE;
+	memcpy(&dr_path, osm_physp_get_dr_path_ptr(p_port->p_physp), sizeof(osm_dr_path_t));
 
-	status = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_port->p_physp),
+	status = osm_req_get(sm, &dr_path,
 			     IB_MAD_ATTR_SM_INFO, 0, CL_DISP_MSGID_NONE,
 			     &context);
+	CL_PLOCK_RELEASE(sm->p_lock);
 
 	if (status != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3204: "
@@ -122,9 +131,7 @@ Exit:
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void __osm_sm_state_mgr_start_polling(osm_sm_t * sm)
+static void sm_state_mgr_start_polling(osm_sm_t * sm)
 {
 	uint32_t timeout = sm->p_subn->opt.sminfo_polling_timeout;
 	cl_status_t cl_status;
@@ -139,7 +146,7 @@ static void __osm_sm_state_mgr_start_polling(osm_sm_t * sm)
 	/*
 	 * Send a SubnGet(SMInfo) query to the current (or new) master found.
 	 */
-	__osm_sm_state_mgr_send_master_sm_info_req(sm);
+	sm_state_mgr_send_master_sm_info_req(sm);
 
 	/*
 	 * Start a timer that will wake up every sminfo_polling_timeout milliseconds.
@@ -154,8 +161,6 @@ static void __osm_sm_state_mgr_start_polling(osm_sm_t * sm)
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_sm_state_mgr_polling_callback(IN void *context)
 {
 	osm_sm_t *sm = context;
@@ -172,7 +177,7 @@ void osm_sm_state_mgr_polling_callback(IN void *context)
 	 */
 	if (!((sm->p_subn->sm_state == IB_SMINFO_STATE_MASTER &&
 	       sm->p_polling_sm != NULL) ||
-	      (sm->p_subn->sm_state == IB_SMINFO_STATE_STANDBY)))
+	      sm->p_subn->sm_state == IB_SMINFO_STATE_STANDBY))
 		goto Exit;
 
 	/*
@@ -195,8 +200,8 @@ void osm_sm_state_mgr_polling_callback(IN void *context)
 	 * osm_sm_state_mgr_process with signal OSM_SM_SIGNAL_POLLING_TIMEOUT
 	 */
 	sm->retry_number++;
-	OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-		"Retry number:%d\n", sm->retry_number);
+	OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Retry number:%d\n",
+		sm->retry_number);
 
 	if (sm->retry_number >= sm->p_subn->opt.polling_retry_number) {
 		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
@@ -207,7 +212,7 @@ void osm_sm_state_mgr_polling_callback(IN void *context)
 	}
 
 	/* Send a SubnGet(SMInfo) request to the remote sm (depends on our state) */
-	__osm_sm_state_mgr_send_master_sm_info_req(sm);
+	sm_state_mgr_send_master_sm_info_req(sm);
 
 	/* restart the timer */
 	cl_status = cl_timer_start(&sm->polling_timer, timeout);
@@ -217,13 +222,9 @@ void osm_sm_state_mgr_polling_callback(IN void *context)
 
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
-	return;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void __osm_sm_state_mgr_signal_error(osm_sm_t * sm,
-					    IN const osm_sm_signal_t signal)
+static void sm_state_mgr_signal_error(osm_sm_t * sm, IN osm_sm_signal_t signal)
 {
 	OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3207: "
 		"Invalid signal %s in state %s\n",
@@ -231,8 +232,6 @@ static void __osm_sm_state_mgr_signal_error(osm_sm_t * sm,
 		osm_get_sm_mgr_state_str(sm->p_subn->sm_state));
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_sm_state_mgr_signal_master_is_alive(osm_sm_t * sm)
 {
 	OSM_LOG_ENTER(sm->p_log);
@@ -240,8 +239,6 @@ void osm_sm_state_mgr_signal_master_is_alive(osm_sm_t * sm)
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm,
 					 IN osm_sm_signal_t signal)
 {
@@ -293,7 +290,7 @@ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm,
 			 */
 			sm->p_subn->ignore_existing_lfts = FALSE;
 
-			__osm_sm_state_mgr_start_polling(sm);
+			sm_state_mgr_start_polling(sm);
 			break;
 		case OSM_SM_SIGNAL_HANDOVER:
 			/*
@@ -304,7 +301,7 @@ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm,
 			 */
 			break;
 		default:
-			__osm_sm_state_mgr_signal_error(sm, signal);
+			sm_state_mgr_signal_error(sm, signal);
 			status = IB_INVALID_PARAMETER;
 			break;
 		}
@@ -340,8 +337,10 @@ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm,
 			 */
 			/* Turn on the first_time_master_sweep flag */
 			sm->p_subn->first_time_master_sweep = TRUE;
-			/* Turn on the force_heavy_sweep - we want a
-			 * heavy sweep to occur on the first sweep of this SM. */
+			/*
+			 * Turn on the force_heavy_sweep - we want a
+			 * heavy sweep to occur on the first sweep of this SM.
+			 */
 			sm->p_subn->force_heavy_sweep = TRUE;
 
 			sm->p_subn->sm_state = IB_SMINFO_STATE_MASTER;
@@ -361,7 +360,7 @@ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm,
 			 */
 			break;
 		default:
-			__osm_sm_state_mgr_signal_error(sm, signal);
+			sm_state_mgr_signal_error(sm, signal);
 			status = IB_INVALID_PARAMETER;
 			break;
 		}
@@ -376,10 +375,10 @@ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm,
 			 */
 			sm->p_subn->sm_state = IB_SMINFO_STATE_STANDBY;
 			osm_report_sm_state(sm);
-			__osm_sm_state_mgr_start_polling(sm);
+			sm_state_mgr_start_polling(sm);
 			break;
 		default:
-			__osm_sm_state_mgr_signal_error(sm, signal);
+			sm_state_mgr_signal_error(sm, signal);
 			status = IB_INVALID_PARAMETER;
 			break;
 		}
@@ -389,28 +388,36 @@ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm,
 		switch (signal) {
 		case OSM_SM_SIGNAL_POLLING_TIMEOUT:
 			/*
-			 * we received a polling timeout - this means that we waited for
-			 * a remote master sm to send us a handover, but didn't get it, and
-			 * didn't get a response from that remote sm.
-			 * We want to force a heavy sweep - hopefully this occurred because
-			 * the remote sm died, and we'll find this out and configure the
-			 * subnet after a heavy sweep.
-			 * We also want to clear the p_polling_sm object - since we are
-			 * done polling on that remote sm - we are sweeping again.
+			 * We received a polling timeout - this means that we
+			 * waited for a remote master sm to send us a handover,
+			 * but didn't get it, and didn't get a response from
+			 * that remote sm.
+			 * We want to force a heavy sweep - hopefully this
+			 * occurred because the remote sm died, and we'll find
+			 * this out and configure the subnet after a heavy sweep.
+			 * We also want to clear the p_polling_sm object - since
+			 * we are done polling on that remote sm - we are
+			 * sweeping again.
 			 */
 		case OSM_SM_SIGNAL_HANDOVER:
 			/*
-			 * If we received a handover in a master state - then we want to
-			 * force a heavy sweep. This means that either we are in a sweep
-			 * currently - in this case - no change, or we are in idle state -
-			 * since we recognized a master SM before - so we want to make a
+			 * If we received a handover in a master state - then we
+			 * want to force a heavy sweep. This means that either
+			 * we are in a sweep currently - in this case - no
+			 * change, or we are in idle state - since we
+			 * recognized a master SM before - so we want to make a
 			 * heavy sweep and reconfigure the new subnet.
-			 * We also want to clear the p_polling_sm object - since we are
-			 * done polling on that remote sm - we got a handover from it.
+			 * We also want to clear the p_polling_sm object - since
+			 * we are done polling on that remote sm - we got a
+			 * handover from it.
 			 */
 			OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 				"Forcing heavy sweep. "
 				"Received OSM_SM_SIGNAL_HANDOVER or OSM_SM_SIGNAL_POLLING_TIMEOUT\n");
+			/* Force set_client_rereg_on_sweep, we don't know what the other
+			 * SM may have configure/done on the fabric.
+			 */
+			sm->p_subn->set_client_rereg_on_sweep = TRUE;
 			sm->p_polling_sm = NULL;
 			sm->p_subn->force_heavy_sweep = TRUE;
 			osm_sm_signal(sm, OSM_SIGNAL_SWEEP);
@@ -422,24 +429,24 @@ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm,
 			 */
 			sm->p_subn->sm_state = IB_SMINFO_STATE_STANDBY;
 			osm_report_sm_state(sm);
-			__osm_sm_state_mgr_start_polling(sm);
+			sm_state_mgr_start_polling(sm);
 			break;
 		case OSM_SM_SIGNAL_WAIT_FOR_HANDOVER:
 			/*
-			 * We found a remote master SM, and we are waiting for it
-			 * to handover the mastership to us. Need to start polling
-			 * on that SM, to make sure it is alive, if it isn't - then
-			 * we should move back to discovering, since something must
-			 * have happened to it.
+			 * We found a remote master SM, and we are waiting for
+			 * it to handover the mastership to us. Need to start
+			 * polling that SM, to make sure it is alive, if it
+			 * isn't - then we should move back to discovering,
+			 * since something must have happened to it.
 			 */
-			__osm_sm_state_mgr_start_polling(sm);
+			sm_state_mgr_start_polling(sm);
 			break;
 		case OSM_SM_SIGNAL_DISCOVER:
 			sm->p_subn->sm_state = IB_SMINFO_STATE_DISCOVERING;
 			osm_report_sm_state(sm);
 			break;
 		default:
-			__osm_sm_state_mgr_signal_error(sm, signal);
+			sm_state_mgr_signal_error(sm, signal);
 			status = IB_INVALID_PARAMETER;
 			break;
 		}
@@ -455,11 +462,9 @@ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm,
 	cl_spinlock_release(&sm->state_lock);
 
 	OSM_LOG_EXIT(sm->p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t osm_sm_state_mgr_check_legality(osm_sm_t * sm,
 						IN osm_sm_signal_t signal)
 {
@@ -475,8 +480,7 @@ ib_api_status_t osm_sm_state_mgr_check_legality(osm_sm_t * sm,
 	 */
 	cl_spinlock_acquire(&sm->state_lock);
 
-	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-		"Received signal %s in state %s\n",
+	OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Received signal %s in state %s\n",
 		osm_get_sm_mgr_signal_str(signal),
 		osm_get_sm_mgr_state_str(sm->p_subn->sm_state));
 
@@ -489,7 +493,7 @@ ib_api_status_t osm_sm_state_mgr_check_legality(osm_sm_t * sm,
 			status = IB_SUCCESS;
 			break;
 		default:
-			__osm_sm_state_mgr_signal_error(sm, signal);
+			sm_state_mgr_signal_error(sm, signal);
 			status = IB_INVALID_PARAMETER;
 			break;
 		}
@@ -505,7 +509,7 @@ ib_api_status_t osm_sm_state_mgr_check_legality(osm_sm_t * sm,
 			status = IB_SUCCESS;
 			break;
 		default:
-			__osm_sm_state_mgr_signal_error(sm, signal);
+			sm_state_mgr_signal_error(sm, signal);
 			status = IB_INVALID_PARAMETER;
 			break;
 		}
@@ -517,7 +521,7 @@ ib_api_status_t osm_sm_state_mgr_check_legality(osm_sm_t * sm,
 			status = IB_SUCCESS;
 			break;
 		default:
-			__osm_sm_state_mgr_signal_error(sm, signal);
+			sm_state_mgr_signal_error(sm, signal);
 			status = IB_INVALID_PARAMETER;
 			break;
 		}
@@ -530,7 +534,7 @@ ib_api_status_t osm_sm_state_mgr_check_legality(osm_sm_t * sm,
 			status = IB_SUCCESS;
 			break;
 		default:
-			__osm_sm_state_mgr_signal_error(sm, signal);
+			sm_state_mgr_signal_error(sm, signal);
 			status = IB_INVALID_PARAMETER;
 			break;
 		}
@@ -547,5 +551,5 @@ ib_api_status_t osm_sm_state_mgr_check_legality(osm_sm_t * sm,
 	cl_spinlock_release(&sm->state_lock);
 
 	OSM_LOG_EXIT(sm->p_log);
-	return (status);
+	return status;
 }
diff --git a/opensm/osm_sminfo_rcv.c b/opensm/osm_sminfo_rcv.c
index 98c1994..a0092a5 100644
--- a/opensm/osm_sminfo_rcv.c
+++ b/opensm/osm_sminfo_rcv.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -50,6 +50,8 @@
 #include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SMINFO_RCV_C
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
@@ -64,25 +66,20 @@
  By higher - we mean: SM with higher priority or with same priority
  and lower GUID.
 **********************************************************************/
-static inline boolean_t
-__osm_sminfo_rcv_remote_sm_is_higher(IN osm_sm_t * sm,
-				     IN const ib_sm_info_t * p_remote_smi)
+static boolean_t smi_rcv_remote_sm_is_higher(IN osm_sm_t * sm,
+					     IN const ib_sm_info_t * p_rem_smi)
 {
-	return (osm_sm_is_greater_than(ib_sminfo_get_priority(p_remote_smi),
-				       p_remote_smi->guid,
-				       sm->p_subn->opt.sm_priority,
-				       sm->p_subn->sm_port_guid));
+	return osm_sm_is_greater_than(ib_sminfo_get_priority(p_rem_smi),
+				      p_rem_smi->guid,
+				      sm->p_subn->opt.sm_priority,
+				      sm->p_subn->sm_port_guid);
 
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sminfo_rcv_process_get_request(IN osm_sm_t * sm,
-				     IN const osm_madw_t * const p_madw)
+static void smi_rcv_process_get_request(IN osm_sm_t * sm,
+					IN const osm_madw_t * p_madw)
 {
 	uint8_t payload[IB_SMP_DATA_SIZE];
-	ib_smp_t *p_smp;
 	ib_sm_info_t *p_smi = (ib_sm_info_t *) payload;
 	ib_api_status_t status;
 	ib_sm_info_t *p_remote_smi;
@@ -94,9 +91,7 @@ __osm_sminfo_rcv_process_get_request(IN osm_sm_t * sm,
 	/* No real need to grab the lock for this function. */
 	memset(payload, 0, sizeof(payload));
 
-	p_smp = osm_madw_get_smp_ptr(p_madw);
-
-	CL_ASSERT(p_smp->method == IB_MAD_METHOD_GET);
+	CL_ASSERT(osm_madw_get_smp_ptr(p_madw)->method == IB_MAD_METHOD_GET);
 
 	p_smi->guid = sm->p_subn->sm_port_guid;
 	p_smi->act_count = cl_hton32(sm->p_subn->p_osm->stats.qp0_mads_sent);
@@ -140,8 +135,7 @@ Exit:
  * FUTURE - TO DO:
  *   Check that the SM_Key matches.
  **********************************************************************/
-static ib_api_status_t
-__osm_sminfo_rcv_check_set_req_legality(IN const ib_smp_t * const p_smp)
+static ib_api_status_t smi_rcv_check_set_req_legality(IN const ib_smp_t * p_smp)
 {
 	ib_sm_info_t *p_smi;
 
@@ -149,23 +143,20 @@ __osm_sminfo_rcv_check_set_req_legality(IN const ib_smp_t * const p_smp)
 
 	if (p_smp->attr_mod == IB_SMINFO_ATTR_MOD_ACKNOWLEDGE) {
 		if (ib_sminfo_get_state(p_smi) == IB_SMINFO_STATE_STANDBY)
-			return (IB_SUCCESS);
+			return IB_SUCCESS;
 	} else if (p_smp->attr_mod == IB_SMINFO_ATTR_MOD_HANDOVER ||
 		   p_smp->attr_mod == IB_SMINFO_ATTR_MOD_DISABLE ||
 		   p_smp->attr_mod == IB_SMINFO_ATTR_MOD_STANDBY ||
 		   p_smp->attr_mod == IB_SMINFO_ATTR_MOD_DISCOVER) {
 		if (ib_sminfo_get_state(p_smi) == IB_SMINFO_STATE_MASTER)
-			return (IB_SUCCESS);
+			return IB_SUCCESS;
 	}
 
-	return (IB_INVALID_PARAMETER);
+	return IB_INVALID_PARAMETER;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sminfo_rcv_process_set_request(IN osm_sm_t * sm,
-				     IN const osm_madw_t * const p_madw)
+static void smi_rcv_process_set_request(IN osm_sm_t * sm,
+					IN const osm_madw_t * p_madw)
 {
 	uint8_t payload[IB_SMP_DATA_SIZE];
 	ib_smp_t *p_smp;
@@ -190,7 +181,7 @@ __osm_sminfo_rcv_process_set_request(IN osm_sm_t * sm,
 		goto Exit;
 	}
 
-	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
+	CL_PLOCK_ACQUIRE(sm->p_lock);
 
 	p_smi->guid = sm->p_subn->sm_port_guid;
 	p_smi->act_count = cl_hton32(sm->p_subn->p_osm->stats.qp0_mads_sent);
@@ -213,7 +204,7 @@ __osm_sminfo_rcv_process_set_request(IN osm_sm_t * sm,
 	}
 
 	/* Check the legality of the packet */
-	status = __osm_sminfo_rcv_check_set_req_legality(p_smp);
+	status = smi_rcv_check_set_req_legality(p_smp);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F04: "
 			"Check legality failed. AttributeModifier:0x%X RemoteState:%s\n",
@@ -256,11 +247,14 @@ __osm_sminfo_rcv_process_set_request(IN osm_sm_t * sm,
 		goto Exit;
 	}
 
+	CL_PLOCK_RELEASE(sm->p_lock);
+
 	/* check legality of the needed transition in the SM state machine */
 	status = osm_sm_state_mgr_check_legality(sm, sm_signal);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F07: "
-			"Failed check of legality of needed SM transition. AttributeModifier:0x%X RemoteState:%s\n",
+			"Failed check of legality of needed SM transition. "
+			"AttributeModifier:0x%X RemoteState:%s\n",
 			p_smp->attr_mod,
 			osm_get_sm_mgr_state_str(ib_sminfo_get_state(sm_smi)));
 		status = osm_resp_send(sm, p_madw, 7, payload);
@@ -268,7 +262,6 @@ __osm_sminfo_rcv_process_set_request(IN osm_sm_t * sm,
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F08: "
 				"Error sending response (%s)\n",
 				ib_get_err_str(status));
-		CL_PLOCK_RELEASE(sm->p_lock);
 		goto Exit;
 	}
 
@@ -288,10 +281,11 @@ __osm_sminfo_rcv_process_set_request(IN osm_sm_t * sm,
 			"Received a STANDBY signal. Updating "
 			"sm_state_mgr master_guid: 0x%016" PRIx64 "\n",
 			cl_ntoh64(sm_smi->guid));
+		CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
 		sm->master_sm_guid = sm_smi->guid;
+		CL_PLOCK_RELEASE(sm->p_lock);
 	}
 
-	CL_PLOCK_RELEASE(sm->p_lock);
 	status = osm_sm_state_mgr_process(sm, sm_signal);
 
 	if (status != IB_SUCCESS)
@@ -303,12 +297,9 @@ Exit:
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static osm_signal_t
-__osm_sminfo_rcv_process_get_sm(IN osm_sm_t * sm,
-				IN const osm_remote_sm_t * const p_sm,
-				boolean_t light_sweep)
+static void smi_rcv_process_get_sm(IN osm_sm_t * sm,
+				   IN const osm_remote_sm_t * p_sm,
+				   boolean_t light_sweep)
 {
 	const ib_sm_info_t *p_smi;
 
@@ -334,13 +325,12 @@ __osm_sminfo_rcv_process_get_sm(IN osm_sm_t * sm,
 			/* save on the sm the guid of the current master. */
 			OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 				"Found master SM. Updating sm_state_mgr master_guid: 0x%016"
-				PRIx64 "\n", cl_ntoh64(p_sm->p_port->guid));
-			sm->master_sm_guid = p_sm->p_port->guid;
+				PRIx64 "\n", cl_ntoh64(p_smi->guid));
+			sm->master_sm_guid = p_smi->guid;
 			break;
 		case IB_SMINFO_STATE_DISCOVERING:
 		case IB_SMINFO_STATE_STANDBY:
-			if (__osm_sminfo_rcv_remote_sm_is_higher(sm, p_smi)
-			    == TRUE) {
+			if (smi_rcv_remote_sm_is_higher(sm, p_smi)) {
 				/* the remote is a higher sm - need to stop sweeping */
 				sm->master_sm_found = 1;
 				/* save on the sm the guid of the higher SM we found - */
@@ -348,8 +338,8 @@ __osm_sminfo_rcv_process_get_sm(IN osm_sm_t * sm,
 				OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 					"Found higher SM. Updating sm_state_mgr master_guid:"
 					" 0x%016" PRIx64 "\n",
-					cl_ntoh64(p_sm->p_port->guid));
-				sm->master_sm_guid = p_sm->p_port->guid;
+					cl_ntoh64(p_smi->guid));
+				sm->master_sm_guid = p_smi->guid;
 			}
 			break;
 		default:
@@ -365,18 +355,22 @@ __osm_sminfo_rcv_process_get_sm(IN osm_sm_t * sm,
 			/* This means the master is alive */
 			/* Signal that to the SM state mgr */
 			osm_sm_state_mgr_signal_master_is_alive(sm);
+
+			if (!smi_rcv_remote_sm_is_higher(sm, p_smi))
+				osm_send_trap144(sm,
+						 TRAP_144_MASK_SM_PRIORITY_CHANGE);
 			break;
 		case IB_SMINFO_STATE_STANDBY:
 			/* This should be the response from the sm we are polling. */
 			/* If it is - then signal master is alive */
-			if (sm->master_sm_guid == p_sm->p_port->guid) {
+			if (sm->master_sm_guid == p_sm->smi.guid) {
 				/* Make sure that it is an SM with higher priority than us.
 				   If we started polling it when it was master, and it moved
 				   to standby - then it might be with a lower priority than
 				   us - and then we don't want to continue polling it. */
-				if (__osm_sminfo_rcv_remote_sm_is_higher
-				    (sm, p_smi) == TRUE)
-					osm_sm_state_mgr_signal_master_is_alive(sm);
+				if (smi_rcv_remote_sm_is_higher(sm, p_smi))
+					osm_sm_state_mgr_signal_master_is_alive
+					    (sm);
 			}
 			break;
 		default:
@@ -395,13 +389,27 @@ __osm_sminfo_rcv_process_get_sm(IN osm_sm_t * sm,
 				osm_sm_state_mgr_signal_master_is_alive(sm);
 			else {
 				/* This is a response we got while sweeping the subnet.
-				   We will handle a case of handover needed later on, when the sweep
-				   is done and all SMs are recongnized. */
+				 *
+				 * If this is during a heavy sweep, we will handle a case of
+				 * handover needed later on, when the sweep is done and all
+				 * SMs are recognized.
+				 *
+				 * If this is during a light sweep, initiate a heavy sweep
+				 * to initiate handover scenarios.
+				 *
+				 * Note that it does not matter if the remote SM is lower
+				 * or higher priority.  If it is lower priority, we must
+				 * wait for it HANDOVER.  If it is higher priority, we need
+				 * to HANDOVER to it.  Both cases are handled after doing
+				 * a heavy sweep.
+				 */
+				if (light_sweep)
+					sm->p_subn->force_heavy_sweep = TRUE;
 			}
 			break;
 		case IB_SMINFO_STATE_STANDBY:
 			if (light_sweep &&
-			    __osm_sminfo_rcv_remote_sm_is_higher(sm, p_smi))
+			    smi_rcv_remote_sm_is_higher(sm, p_smi))
 				sm->p_subn->force_heavy_sweep = TRUE;
 			break;
 		default:
@@ -415,14 +423,10 @@ __osm_sminfo_rcv_process_get_sm(IN osm_sm_t * sm,
 	}
 
 	OSM_LOG_EXIT(sm->p_log);
-	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sminfo_rcv_process_get_response(IN osm_sm_t * sm,
-				      IN const osm_madw_t * const p_madw)
+static void smi_rcv_process_get_response(IN osm_sm_t * sm,
+					 IN const osm_madw_t * p_madw)
 {
 	const ib_smp_t *p_smp;
 	const ib_sm_info_t *p_smi;
@@ -447,7 +451,7 @@ __osm_sminfo_rcv_process_get_response(IN osm_sm_t * sm,
 	p_sm_tbl = &sm->p_subn->sm_guid_tbl;
 	port_guid = p_smi->guid;
 
-	osm_dump_sm_info(sm->p_log, p_smi, OSM_LOG_DEBUG);
+	osm_dump_sm_info_v2(sm->p_log, p_smi, FILE_ID, OSM_LOG_DEBUG);
 
 	/* Check that the sm_key of the found SM is the same as ours,
 	   or is zero. If not - OpenSM cannot continue with configuration!. */
@@ -455,8 +459,8 @@ __osm_sminfo_rcv_process_get_response(IN osm_sm_t * sm,
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F18: "
 			"Got SM with sm_key that doesn't match our "
 			"local key. Exiting\n");
-		osm_log(sm->p_log, OSM_LOG_SYS,
-			"Found remote SM with non-matching sm_key. Exiting\n");
+		osm_log_v2(sm->p_log, OSM_LOG_SYS, FILE_ID,
+			   "Found remote SM with non-matching sm_key. Exiting\n");
 		osm_exit_flag = TRUE;
 		goto Exit;
 	}
@@ -496,15 +500,16 @@ __osm_sminfo_rcv_process_get_response(IN osm_sm_t * sm,
 			goto _unlock_and_exit;
 		}
 
-		osm_remote_sm_init(p_sm, p_port, p_smi);
+		osm_remote_sm_init(p_sm, p_smi);
 
 		cl_qmap_insert(p_sm_tbl, port_guid, &p_sm->map_item);
 	} else
 		/* We already know this SM. Update the SMInfo attribute. */
 		p_sm->smi = *p_smi;
 
-	__osm_sminfo_rcv_process_get_sm(sm, p_sm,
-					osm_madw_get_smi_context_ptr(p_madw)->light_sweep);
+	smi_rcv_process_get_sm(sm, p_sm,
+			       osm_madw_get_smi_context_ptr(p_madw)->
+			       light_sweep);
 
 _unlock_and_exit:
 	CL_PLOCK_RELEASE(sm->p_lock);
@@ -513,11 +518,8 @@ Exit:
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_sminfo_rcv_process_set_response(IN osm_sm_t * sm,
-				      IN const osm_madw_t * const p_madw)
+static void smi_rcv_process_set_response(IN osm_sm_t * sm,
+					 IN const osm_madw_t * p_madw)
 {
 	const ib_smp_t *p_smp;
 	const ib_sm_info_t *p_smi;
@@ -535,7 +537,7 @@ __osm_sminfo_rcv_process_set_response(IN osm_sm_t * sm,
 	}
 
 	p_smi = ib_smp_get_payload_ptr(p_smp);
-	osm_dump_sm_info(sm->p_log, p_smi, OSM_LOG_DEBUG);
+	osm_dump_sm_info_v2(sm->p_log, p_smi, FILE_ID, OSM_LOG_DEBUG);
 
 	/* Check the AttributeModifier */
 	if (p_smp->attr_mod != IB_SMINFO_ATTR_MOD_HANDOVER) {
@@ -551,8 +553,6 @@ Exit:
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_sminfo_rcv_process(IN void *context, IN void *data)
 {
 	osm_sm_t *sm = context;
@@ -565,6 +565,12 @@ void osm_sminfo_rcv_process(IN void *context, IN void *data)
 	CL_ASSERT(p_madw);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
+	if (ib_smp_get_status(p_smp)) {
+		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
+			"MAD status 0x%x received\n",
+			cl_ntoh16(ib_smp_get_status(p_smp)));
+		goto Exit;
+	}
 
 	/* Determine if this is a request for our own SMInfo or if
 	   this is a response to our request for another SM's SMInfo. */
@@ -588,16 +594,16 @@ void osm_sminfo_rcv_process(IN void *context, IN void *data)
 
 		if (p_smi_context->set_method == FALSE)
 			/* this is a response to a Get method */
-			__osm_sminfo_rcv_process_get_response(sm, p_madw);
+			smi_rcv_process_get_response(sm, p_madw);
 		else
 			/* this is a response to a Set method */
-			__osm_sminfo_rcv_process_set_response(sm, p_madw);
+			smi_rcv_process_set_response(sm, p_madw);
 	} else if (p_smp->method == IB_MAD_METHOD_GET)
 		/* This is a SubnGet request */
-		__osm_sminfo_rcv_process_get_request(sm, p_madw);
+		smi_rcv_process_get_request(sm, p_madw);
 	else
 		/* This should be a SubnSet request */
-		__osm_sminfo_rcv_process_set_request(sm, p_madw);
+		smi_rcv_process_set_request(sm, p_madw);
 
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
diff --git a/opensm/osm_state_mgr.c b/opensm/osm_state_mgr.c
index b2a4a2e..31f994a 100644
--- a/opensm/osm_state_mgr.c
+++ b/opensm/osm_state_mgr.c
@@ -1,7 +1,9 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -50,6 +52,8 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qmap.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_STATE_MGR_C
 #include <opensm/osm_sm.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_switch.h>
@@ -59,71 +63,60 @@
 #include <opensm/osm_msgdef.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_port.h>
-#include <opensm/osm_pkey_mgr.h>
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_inform.h>
 #include <opensm/osm_opensm.h>
+#include <opensm/osm_congestion_control.h>
+#include <opensm/osm_db.h>
 
 extern void osm_drop_mgr_process(IN osm_sm_t * sm);
-extern osm_signal_t osm_qos_setup(IN osm_opensm_t * p_osm);
-extern osm_signal_t osm_pkey_mgr_process(IN osm_opensm_t * p_osm);
-extern osm_signal_t osm_mcast_mgr_process(IN osm_sm_t * sm);
-extern osm_signal_t osm_mcast_mgr_process_mgroups(IN osm_sm_t * sm);
-extern osm_signal_t osm_link_mgr_process(IN osm_sm_t * sm, IN uint8_t state);
+extern int osm_qos_setup(IN osm_opensm_t * p_osm);
+extern int osm_pkey_mgr_process(IN osm_opensm_t * p_osm);
+extern int osm_mcast_mgr_process(IN osm_sm_t * sm, boolean_t config_all);
+extern int osm_link_mgr_process(IN osm_sm_t * sm, IN uint8_t state);
+extern void osm_guid_mgr_process(IN osm_sm_t * sm);
 
-/**********************************************************************
- **********************************************************************/
-static void __osm_state_mgr_up_msg(IN const osm_sm_t * sm)
+static void state_mgr_up_msg(IN const osm_sm_t * sm)
 {
 	/*
 	 * This message should be written only once - when the
 	 * SM moves to Master state and the subnet is up for
 	 * the first time.
 	 */
-	osm_log(sm->p_log, sm->p_subn->first_time_master_sweep ?
-		OSM_LOG_SYS : OSM_LOG_INFO, "SUBNET UP\n");
+	osm_log_v2(sm->p_log, sm->p_subn->first_time_master_sweep ?
+		   OSM_LOG_SYS : OSM_LOG_INFO, FILE_ID, "SUBNET UP\n");
 
 	OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,
 			sm->p_subn->opt.sweep_interval ?
 			"SUBNET UP" : "SUBNET UP (sweep disabled)");
 }
 
-/**********************************************************************
- **********************************************************************/
-static void __osm_state_mgr_reset_node_count(IN cl_map_item_t *
-					     const p_map_item, IN void *context)
+static void state_mgr_reset_node_count(IN cl_map_item_t * p_map_item,
+				       IN void *context)
 {
 	osm_node_t *p_node = (osm_node_t *) p_map_item;
 
 	p_node->discovery_count = 0;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void __osm_state_mgr_reset_port_count(IN cl_map_item_t *
-					     const p_map_item, IN void *context)
+static void state_mgr_reset_port_count(IN cl_map_item_t * p_map_item,
+				       IN void *context)
 {
 	osm_port_t *p_port = (osm_port_t *) p_map_item;
 
 	p_port->discovery_count = 0;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_state_mgr_reset_switch_count(IN cl_map_item_t * const p_map_item,
-				   IN void *context)
+static void state_mgr_reset_switch_count(IN cl_map_item_t * p_map_item,
+					 IN void *context)
 {
 	osm_switch_t *p_sw = (osm_switch_t *) p_map_item;
 
-	p_sw->discovery_count = 0;
-	p_sw->need_update = 1;
+	if (p_sw->max_lid_ho != 0)
+		p_sw->need_update = 1;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void __osm_state_mgr_get_sw_info(IN cl_map_item_t * const p_object,
-					IN void *context)
+static void state_mgr_get_sw_info(IN cl_map_item_t * p_object, IN void *context)
 {
 	osm_node_t *p_node;
 	osm_dr_path_t *p_dr_path;
@@ -135,7 +128,8 @@ static void __osm_state_mgr_get_sw_info(IN cl_map_item_t * const p_object,
 	OSM_LOG_ENTER(sm->p_log);
 
 	p_node = p_sw->p_node;
-	p_dr_path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));
+	p_dr_path =
+	    osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));
 
 	memset(&mad_context, 0, sizeof(mad_context));
 
@@ -145,10 +139,10 @@ static void __osm_state_mgr_get_sw_info(IN cl_map_item_t * const p_object,
 
 	status = osm_req_get(sm, p_dr_path, IB_MAD_ATTR_SWITCH_INFO, 0,
 			     OSM_MSG_LIGHT_SWEEP_FAIL, &mad_context);
-
 	if (status != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3304: "
-			"Request for SwitchInfo failed\n");
+			"Request for SwitchInfo failed (%s)\n",
+			ib_get_err_str(status));
 
 	OSM_LOG_EXIT(sm->p_log);
 }
@@ -156,9 +150,8 @@ static void __osm_state_mgr_get_sw_info(IN cl_map_item_t * const p_object,
 /**********************************************************************
  Initiate a remote port info request for the given physical port
  **********************************************************************/
-static void
-__osm_state_mgr_get_remote_port_info(IN osm_sm_t * sm,
-				     IN osm_physp_t * const p_physp)
+static void state_mgr_get_remote_port_info(IN osm_sm_t * sm,
+					   IN osm_physp_t * p_physp)
 {
 	osm_dr_path_t *p_dr_path;
 	osm_dr_path_t rem_node_dr_path;
@@ -170,7 +163,13 @@ __osm_state_mgr_get_remote_port_info(IN osm_sm_t * sm,
 	/* generate a dr path leaving on the physp to the remote node */
 	p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
 	memcpy(&rem_node_dr_path, p_dr_path, sizeof(osm_dr_path_t));
-	osm_dr_path_extend(&rem_node_dr_path, osm_physp_get_port_num(p_physp));
+	if (osm_dr_path_extend(&rem_node_dr_path, osm_physp_get_port_num(p_physp))) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 332D: "
+			"DR path with hop count %d couldn't be extended "
+			"so skipping PortInfo query\n",
+			p_dr_path->hop_count);
+		goto Exit;
+	}
 
 	memset(&mad_context, 0, sizeof(mad_context));
 
@@ -181,16 +180,16 @@ __osm_state_mgr_get_remote_port_info(IN osm_sm_t * sm,
 	mad_context.pi_context.light_sweep = TRUE;
 	mad_context.pi_context.active_transition = FALSE;
 
-	/* note that with some negative logic - if the query failed it means that
-	 * there is no point in going to heavy sweep */
-	status = osm_req_get(sm, &rem_node_dr_path,
-			     IB_MAD_ATTR_PORT_INFO, 0, CL_DISP_MSGID_NONE,
-			     &mad_context);
-
+	/* note that with some negative logic - if the query failed it means
+	 * that there is no point in going to heavy sweep */
+	status = osm_req_get(sm, &rem_node_dr_path, IB_MAD_ATTR_PORT_INFO, 0,
+			     CL_DISP_MSGID_NONE, &mad_context);
 	if (status != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 332E: "
-			"Request for PortInfo failed\n");
+			"Request for PortInfo failed (%s)\n",
+			ib_get_err_str(status));
 
+Exit:
 	OSM_LOG_EXIT(sm->p_log);
 }
 
@@ -198,7 +197,7 @@ __osm_state_mgr_get_remote_port_info(IN osm_sm_t * sm,
  Initiates a thorough sweep of the subnet.
  Used when there is suspicion that something on the subnet has changed.
 **********************************************************************/
-static ib_api_status_t __osm_state_mgr_sweep_hop_0(IN osm_sm_t * sm)
+static ib_api_status_t state_mgr_sweep_hop_0(IN osm_sm_t * sm)
 {
 	ib_api_status_t status;
 	osm_dr_path_t dr_path;
@@ -223,13 +222,13 @@ static ib_api_status_t __osm_state_mgr_sweep_hop_0(IN osm_sm_t * sm)
 		CL_PLOCK_ACQUIRE(sm->p_lock);
 
 		cl_qmap_apply_func(&sm->p_subn->node_guid_tbl,
-				   __osm_state_mgr_reset_node_count, sm);
+				   state_mgr_reset_node_count, sm);
 
 		cl_qmap_apply_func(&sm->p_subn->port_guid_tbl,
-				   __osm_state_mgr_reset_port_count, sm);
+				   state_mgr_reset_port_count, sm);
 
 		cl_qmap_apply_func(&sm->p_subn->sw_guid_tbl,
-				   __osm_state_mgr_reset_switch_count, sm);
+				   state_mgr_reset_switch_count, sm);
 
 		/* Set the in_sweep_hop_0 flag in subn to be TRUE.
 		 * This will indicate the sweeping not to continue beyond the
@@ -241,13 +240,15 @@ static ib_api_status_t __osm_state_mgr_sweep_hop_0(IN osm_sm_t * sm)
 
 		CL_PLOCK_RELEASE(sm->p_lock);
 
-		osm_dr_path_init(&dr_path, h_bind, 0, path_array);
+		osm_dr_path_init(&dr_path, 0, path_array);
+		CL_PLOCK_ACQUIRE(sm->p_lock);
 		status = osm_req_get(sm, &dr_path, IB_MAD_ATTR_NODE_INFO, 0,
 				     CL_DISP_MSGID_NONE, NULL);
-
+		CL_PLOCK_RELEASE(sm->p_lock);
 		if (status != IB_SUCCESS)
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3305: "
-				"Request for NodeInfo failed\n");
+				"Request for NodeInfo failed (%s)\n",
+				ib_get_err_str(status));
 	} else {
 		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
 			"No bound ports. Deferring sweep...\n");
@@ -255,13 +256,13 @@ static ib_api_status_t __osm_state_mgr_sweep_hop_0(IN osm_sm_t * sm)
 	}
 
 	OSM_LOG_EXIT(sm->p_log);
-	return (status);
+	return status;
 }
 
 /**********************************************************************
  Clear out all existing port lid assignments
 **********************************************************************/
-static ib_api_status_t __osm_state_mgr_clean_known_lids(IN osm_sm_t * sm)
+static ib_api_status_t state_mgr_clean_known_lids(IN osm_sm_t * sm)
 {
 	ib_api_status_t status = IB_SUCCESS;
 	cl_ptr_vector_t *p_vec = &(sm->p_subn->port_lid_tbl);
@@ -278,14 +279,14 @@ static ib_api_status_t __osm_state_mgr_clean_known_lids(IN osm_sm_t * sm)
 	CL_PLOCK_RELEASE(sm->p_lock);
 
 	OSM_LOG_EXIT(sm->p_log);
-	return (status);
+	return status;
 }
 
 /**********************************************************************
  Notifies the transport layer that the local LID has changed,
  which give it a chance to update address vectors, etc..
 **********************************************************************/
-static ib_api_status_t __osm_state_mgr_notify_lid_change(IN osm_sm_t * sm)
+static ib_api_status_t state_mgr_notify_lid_change(IN osm_sm_t * sm)
 {
 	ib_api_status_t status;
 	osm_bind_handle_t h_bind;
@@ -314,14 +315,14 @@ static ib_api_status_t __osm_state_mgr_notify_lid_change(IN osm_sm_t * sm)
 
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
-	return (status);
+	return status;
 }
 
 /**********************************************************************
  Returns true if the SM port is down.
  The SM's port object must exist in the port_guid table.
 **********************************************************************/
-static boolean_t __osm_state_mgr_is_sm_port_down(IN osm_sm_t * sm)
+static boolean_t state_mgr_is_sm_port_down(IN osm_sm_t * sm)
 {
 	ib_net64_t port_guid;
 	osm_port_t *p_port;
@@ -359,7 +360,11 @@ static boolean_t __osm_state_mgr_is_sm_port_down(IN osm_sm_t * sm)
 
 	CL_ASSERT(p_physp);
 
-	state = osm_physp_get_port_state(p_physp);
+	if (p_port->p_node->sw &&
+	    !ib_switch_info_is_enhanced_port0(&p_port->p_node->sw->switch_info))
+		state = IB_LINK_ACTIVE;	/* base SP0 */
+	else
+		state = osm_physp_get_port_state(p_physp);
 	CL_PLOCK_RELEASE(sm->p_lock);
 
 Exit:
@@ -372,15 +377,12 @@ Exit:
  This sets off a "chain reaction" that causes discovery of the subnet.
  Used when there is suspicion that something on the subnet has changed.
 **********************************************************************/
-static ib_api_status_t __osm_state_mgr_sweep_hop_1(IN osm_sm_t * sm)
+static ib_api_status_t state_mgr_sweep_hop_1(IN osm_sm_t * sm)
 {
 	ib_api_status_t status = IB_SUCCESS;
-	osm_bind_handle_t h_bind;
 	osm_madw_context_t context;
 	osm_node_t *p_node;
 	osm_port_t *p_port;
-	osm_physp_t *p_physp;
-	osm_dr_path_t *p_dr_path;
 	osm_dr_path_t hop_1_path;
 	ib_net64_t port_guid;
 	uint8_t port_num;
@@ -421,15 +423,6 @@ static ib_api_status_t __osm_state_mgr_sweep_hop_1(IN osm_sm_t * sm)
 	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
 		"Probing hop 1 on local port %u\n", port_num);
 
-	p_physp = osm_node_get_physp_ptr(p_node, port_num);
-
-	CL_ASSERT(p_physp);
-
-	p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
-	h_bind = osm_dr_path_get_bind_handle(p_dr_path);
-
-	CL_ASSERT(h_bind != OSM_BIND_INVALID_HANDLE);
-
 	memset(path_array, 0, sizeof(path_array));
 	/* the hop_1 operations depend on the type of our node.
 	 * Currently - legal nodes that can host SM are SW and CA */
@@ -442,24 +435,27 @@ static ib_api_status_t __osm_state_mgr_sweep_hop_1(IN osm_sm_t * sm)
 
 		path_array[1] = port_num;
 
-		osm_dr_path_init(&hop_1_path, h_bind, 1, path_array);
+		osm_dr_path_init(&hop_1_path, 1, path_array);
+		CL_PLOCK_ACQUIRE(sm->p_lock);
 		status = osm_req_get(sm, &hop_1_path, IB_MAD_ATTR_NODE_INFO, 0,
 				     CL_DISP_MSGID_NONE, &context);
+		CL_PLOCK_RELEASE(sm->p_lock);
 		if (status != IB_SUCCESS)
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3311: "
-				"Request for NodeInfo failed\n");
+				"Request for NodeInfo failed (%s)\n",
+				ib_get_err_str(status));
 		break;
 
 	case IB_NODE_TYPE_SWITCH:
-		/* Need to go over all the ports of the switch, and send a node_info
-		 * from them. This doesn't include the port 0 of the switch, which
-		 * hosts the SM.
-		 * Note: We'll send another switchInfo on port 0, since if no ports
-		 * are connected, we still want to get some response, and have the
-		 * subnet come up.
+		/* Need to go over all the ports of the switch, and send a
+		 * node_info from them. This doesn't include the port 0 of the
+		 * switch, which hosts the SM.
+		 * Note: We'll send another switchInfo on port 0, since if no
+		 * ports are connected, we still want to get some response, and
+		 * have the subnet come up.
 		 */
 		num_ports = osm_node_get_num_physp(p_node);
-		for (port_num = 0; port_num < num_ports; port_num++) {
+		for (port_num = 1; port_num < num_ports; port_num++) {
 			/* go through the port only if the port is not DOWN */
 			p_ext_physp = osm_node_get_physp_ptr(p_node, port_num);
 			if (p_ext_physp && ib_port_info_get_port_state
@@ -470,16 +466,18 @@ static ib_api_status_t __osm_state_mgr_sweep_hop_1(IN osm_sm_t * sm)
 				context.ni_context.port_num = port_num;
 
 				path_array[1] = port_num;
-				osm_dr_path_init(&hop_1_path, h_bind, 1,
-						 path_array);
+				osm_dr_path_init(&hop_1_path, 1, path_array);
+				CL_PLOCK_ACQUIRE(sm->p_lock);
 				status = osm_req_get(sm, &hop_1_path,
 						     IB_MAD_ATTR_NODE_INFO, 0,
 						     CL_DISP_MSGID_NONE,
 						     &context);
-
+				CL_PLOCK_RELEASE(sm->p_lock);
 				if (status != IB_SUCCESS)
-					OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3312: "
-						"Request for NodeInfo failed\n");
+					OSM_LOG(sm->p_log, OSM_LOG_ERROR,
+						"ERR 3312: "
+						"Request for NodeInfo failed (%s)\n",
+						ib_get_err_str(status));
 			}
 		}
 		break;
@@ -492,21 +490,29 @@ static ib_api_status_t __osm_state_mgr_sweep_hop_1(IN osm_sm_t * sm)
 
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
-	return (status);
+	return status;
 }
 
-static void query_sm_info(cl_map_item_t *item, void *cxt)
+static void query_sm_info(cl_map_item_t * item, void *cxt)
 {
 	osm_madw_context_t context;
 	osm_remote_sm_t *r_sm = cl_item_obj(item, r_sm, map_item);
 	osm_sm_t *sm = cxt;
 	ib_api_status_t ret;
+	osm_port_t *p_port;
 
-	context.smi_context.port_guid = r_sm->p_port->guid;
+	p_port= osm_get_port_by_guid(sm->p_subn, r_sm->smi.guid);
+	if (p_port == NULL) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3340: "
+			"No port object on given sm object\n");
+		return;
+        }
+
+	context.smi_context.port_guid = r_sm->smi.guid;
 	context.smi_context.set_method = FALSE;
 	context.smi_context.light_sweep = TRUE;
 
-	ret = osm_req_get(sm, osm_physp_get_dr_path_ptr(r_sm->p_port->p_physp),
+	ret = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_port->p_physp),
 			  IB_MAD_ATTR_SM_INFO, 0, CL_DISP_MSGID_NONE, &context);
 	if (ret != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3314: "
@@ -514,15 +520,10 @@ static void query_sm_info(cl_map_item_t *item, void *cxt)
 			ib_get_err_str(ret));
 }
 
-/**********************************************************************
- During a light sweep check each node to see if the node descriptor is valid
- if not issue a ND query.
-**********************************************************************/
-static void __osm_state_mgr_get_node_desc(IN cl_map_item_t * const p_object,
-					  IN void *context)
+static void state_mgr_update_node_desc(IN cl_map_item_t * obj, IN void *context)
 {
 	osm_madw_context_t mad_context;
-	osm_node_t *const p_node = (osm_node_t *) p_object;
+	osm_node_t *p_node = (osm_node_t *) obj;
 	osm_sm_t *sm = context;
 	osm_physp_t *p_physp = NULL;
 	unsigned i, num_ports;
@@ -532,14 +533,9 @@ static void __osm_state_mgr_get_node_desc(IN cl_map_item_t * const p_object,
 
 	CL_ASSERT(p_node);
 
-	if (p_node->print_desc && strcmp(p_node->print_desc, OSM_NODE_DESC_UNKNOWN))
-		/* if ND is valid, do nothing */
-		goto exit;
-
-	OSM_LOG(sm->p_log, OSM_LOG_ERROR,
-		"ERR 3319: Unknown node description for node GUID "
-		"0x%016" PRIx64 ".  Reissuing ND query\n",
-		cl_ntoh64(osm_node_get_node_guid (p_node)));
+	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
+		"Updating NodeDesc for 0x%016" PRIx64 "\n",
+		cl_ntoh64(osm_node_get_node_guid(p_node)));
 
 	/* get a physp to request from. */
 	num_ports = osm_node_get_num_physp(p_node);
@@ -567,11 +563,48 @@ exit:
 	OSM_LOG_EXIT(sm->p_log);
 }
 
+void osm_update_node_desc(IN osm_opensm_t *osm)
+{
+	CL_PLOCK_ACQUIRE(&osm->lock);
+	cl_qmap_apply_func(&osm->subn.node_guid_tbl, state_mgr_update_node_desc,
+			   &osm->sm);
+	CL_PLOCK_RELEASE(&osm->lock);
+}
+
+/**********************************************************************
+ During a light sweep, check each node to see if the node description
+ is valid and if not issue a ND query.
+**********************************************************************/
+static void state_mgr_get_node_desc(IN cl_map_item_t * obj, IN void *context)
+{
+	osm_node_t *p_node = (osm_node_t *) obj;
+	osm_sm_t *sm = context;
+
+	OSM_LOG_ENTER(sm->p_log);
+
+	CL_ASSERT(p_node);
+
+	if (p_node->print_desc
+	    && strcmp(p_node->print_desc, OSM_NODE_DESC_UNKNOWN))
+		/* if ND is valid, do nothing */
+		goto exit;
+
+	OSM_LOG(sm->p_log, OSM_LOG_ERROR,
+		"ERR 3319: Unknown node description for node GUID "
+		"0x%016" PRIx64 ".  Reissuing ND query\n",
+		cl_ntoh64(osm_node_get_node_guid(p_node)));
+
+	state_mgr_update_node_desc(obj, context);
+
+exit:
+	OSM_LOG_EXIT(sm->p_log);
+}
+
 /**********************************************************************
  Initiates a lightweight sweep of the subnet.
  Used during normal sweeps after the subnet is up.
 **********************************************************************/
-static ib_api_status_t __osm_state_mgr_light_sweep_start(IN osm_sm_t * sm)
+static ib_api_status_t state_mgr_light_sweep_start(IN osm_sm_t * sm)
 {
 	ib_api_status_t status = IB_SUCCESS;
 	osm_bind_handle_t h_bind;
@@ -598,11 +631,12 @@ static ib_api_status_t __osm_state_mgr_light_sweep_start(IN osm_sm_t * sm)
 
 	OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, "INITIATING LIGHT SWEEP");
 	CL_PLOCK_ACQUIRE(sm->p_lock);
-	cl_qmap_apply_func(p_sw_tbl, __osm_state_mgr_get_sw_info, sm);
+	cl_qmap_apply_func(p_sw_tbl, state_mgr_get_sw_info, sm);
 	CL_PLOCK_RELEASE(sm->p_lock);
 
 	CL_PLOCK_ACQUIRE(sm->p_lock);
-	cl_qmap_apply_func(&sm->p_subn->node_guid_tbl, __osm_state_mgr_get_node_desc, sm);
+	cl_qmap_apply_func(&sm->p_subn->node_guid_tbl, state_mgr_get_node_desc,
+			   sm);
 	CL_PLOCK_RELEASE(sm->p_lock);
 
 	/* now scan the list of physical ports that were not down but have no remote port */
@@ -621,17 +655,16 @@ static ib_api_status_t __osm_state_mgr_light_sweep_start(IN osm_sm_t * sm)
 				OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3315: "
 					"Unknown remote side for node 0x%016"
 					PRIx64
-					"(%s) port %u. Adding to light sweep sampling list\n",
+					" (%s) port %u. Adding to light sweep sampling list\n",
 					cl_ntoh64(osm_node_get_node_guid
 						  (p_node)),
 					p_node->print_desc, port_num);
 
-				osm_dump_dr_path(sm->p_log,
-						 osm_physp_get_dr_path_ptr
-						 (p_physp), OSM_LOG_ERROR);
+				osm_dump_dr_path_v2(sm->p_log,
+						    osm_physp_get_dr_path_ptr
+						    (p_physp), FILE_ID, OSM_LOG_ERROR);
 
-				__osm_state_mgr_get_remote_port_info(sm,
-								     p_physp);
+				state_mgr_get_remote_port_info(sm, p_physp);
 			}
 		}
 	}
@@ -642,7 +675,7 @@ static ib_api_status_t __osm_state_mgr_light_sweep_start(IN osm_sm_t * sm)
 
 _exit:
 	OSM_LOG_EXIT(sm->p_log);
-	return (status);
+	return status;
 }
 
 /**********************************************************************
@@ -651,11 +684,12 @@ _exit:
  * If there is a remote master SM - return a pointer to it,
  * else - return NULL.
  **********************************************************************/
-static osm_remote_sm_t *__osm_state_mgr_exists_other_master_sm(IN osm_sm_t * sm)
+static osm_remote_sm_t *state_mgr_exists_other_master_sm(IN osm_sm_t * sm)
 {
 	cl_qmap_t *p_sm_tbl;
 	osm_remote_sm_t *p_sm;
 	osm_remote_sm_t *p_sm_res = NULL;
+	osm_node_t *p_node;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -666,12 +700,12 @@ static osm_remote_sm_t *__osm_state_mgr_exists_other_master_sm(IN osm_sm_t * sm)
 	     p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_tbl);
 	     p_sm = (osm_remote_sm_t *) cl_qmap_next(&p_sm->map_item)) {
 		/* If the sm is in MASTER state - return a pointer to it */
+		p_node = osm_get_node_by_guid(sm->p_subn, p_sm->smi.guid);
 		if (ib_sminfo_get_state(&p_sm->smi) == IB_SMINFO_STATE_MASTER) {
 			OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 				"Found remote master SM with guid:0x%016" PRIx64
 				" (node %s)\n", cl_ntoh64(p_sm->smi.guid),
-				p_sm->p_port->p_node ? p_sm->p_port->p_node->
-				print_desc : "UNKNOWN");
+				p_node ? p_node->print_desc : "UNKNOWN");
 			p_sm_res = p_sm;
 			goto Exit;
 		}
@@ -679,7 +713,7 @@ static osm_remote_sm_t *__osm_state_mgr_exists_other_master_sm(IN osm_sm_t * sm)
 
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
-	return (p_sm_res);
+	return p_sm_res;
 }
 
 /**********************************************************************
@@ -688,13 +722,14 @@ Exit:
  * Compare this SM to the local SM. If the local SM is higher -
  * return NULL, if the remote SM is higher - return a pointer to it.
  **********************************************************************/
-static osm_remote_sm_t *__osm_state_mgr_get_highest_sm(IN osm_sm_t * sm)
+static osm_remote_sm_t *state_mgr_get_highest_sm(IN osm_sm_t * sm)
 {
 	cl_qmap_t *p_sm_tbl;
 	osm_remote_sm_t *p_sm = NULL;
 	osm_remote_sm_t *p_highest_sm;
 	uint8_t highest_sm_priority;
 	ib_net64_t highest_sm_guid;
+	osm_node_t *p_node;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -727,24 +762,22 @@ static osm_remote_sm_t *__osm_state_mgr_get_highest_sm(IN osm_sm_t * sm)
 		}
 	}
 
-	if (p_highest_sm != NULL)
+	if (p_highest_sm != NULL) {
+		p_node = osm_get_node_by_guid(sm->p_subn, p_highest_sm->smi.guid);
 		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
 			"Found higher SM with guid: %016" PRIx64 " (node %s)\n",
 			cl_ntoh64(p_highest_sm->smi.guid),
-			p_highest_sm->p_port->p_node ?
-			p_highest_sm->p_port->p_node->print_desc : "UNKNOWN");
-
+			p_node ? p_node->print_desc : "UNKNOWN");
+	}
 	OSM_LOG_EXIT(sm->p_log);
-	return (p_highest_sm);
+	return p_highest_sm;
 }
 
 /**********************************************************************
  * Send SubnSet(SMInfo) SMP with HANDOVER attribute to the
  * remote_sm indicated.
  **********************************************************************/
-static void
-__osm_state_mgr_send_handover(IN osm_sm_t * const sm,
-			      IN osm_remote_sm_t * const p_sm)
+static void state_mgr_send_handover(IN osm_sm_t * sm, IN osm_remote_sm_t * p_sm)
 {
 	uint8_t payload[IB_SMP_DATA_SIZE];
 	ib_sm_info_t *p_smi = (ib_sm_info_t *) payload;
@@ -759,7 +792,7 @@ __osm_state_mgr_send_handover(IN osm_sm_t * const sm,
 	 */
 
 	memset(&context, 0, sizeof(context));
-	p_port = p_sm->p_port;
+	p_port = osm_get_port_by_guid(sm->p_subn, p_sm->smi.guid);
 	if (p_port == NULL) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3316: "
 			"No port object on given remote_sm object\n");
@@ -796,10 +829,12 @@ __osm_state_mgr_send_handover(IN osm_sm_t * const sm,
 		p_smi->sm_key = 0;
 	}
 
+	CL_PLOCK_ACQUIRE(sm->p_lock);
 	status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p_port->p_physp),
 			     payload, sizeof(payload), IB_MAD_ATTR_SM_INFO,
 			     IB_SMINFO_ATTR_MOD_HANDOVER, CL_DISP_MSGID_NONE,
 			     &context);
+	CL_PLOCK_RELEASE(sm->p_lock);
 
 	if (status != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3317: "
@@ -813,7 +848,7 @@ Exit:
 /**********************************************************************
  * Send Trap 64 on all new ports.
  **********************************************************************/
-static void __osm_state_mgr_report_new_ports(IN osm_sm_t * sm)
+static void state_mgr_report_new_ports(IN osm_sm_t * sm)
 {
 	ib_gid_t port_gid;
 	ib_mad_notice_attr_t notice;
@@ -841,7 +876,7 @@ static void __osm_state_mgr_report_new_ports(IN osm_sm_t * sm)
 		/* details of the notice */
 		notice.generic_type = 0x83;	/* is generic subn mgt type */
 		ib_notice_set_prod_type_ho(&notice, 4);	/* A Class Manager generator */
-		/* endport becomes to be reachable */
+		/* endport becomes reachable */
 		notice.g_or_v.generic.trap_num = CL_HTON16(64);
 		/* The sm_base_lid is saved in network order already. */
 		notice.issuer_lid = sm->p_subn->sm_base_lid;
@@ -868,7 +903,7 @@ static void __osm_state_mgr_report_new_ports(IN osm_sm_t * sm)
 		osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);
 		OSM_LOG(sm->p_log, OSM_LOG_INFO,
 			"Discovered new port with GUID:0x%016" PRIx64
-			" LID range [%u,%u] of node:%s\n",
+			" LID range [%u,%u] of node: %s\n",
 			cl_ntoh64(port_gid.unicast.interface_id),
 			min_lid_ho, max_lid_ho,
 			p_port->p_node ? p_port->p_node->
@@ -891,7 +926,7 @@ static void __osm_state_mgr_report_new_ports(IN osm_sm_t * sm)
  * initialization), but here we'll clean the database from incorrect
  * information.
  **********************************************************************/
-static void __osm_state_mgr_check_tbl_consistency(IN osm_sm_t * sm)
+static void state_mgr_check_tbl_consistency(IN osm_sm_t * sm)
 {
 	cl_qmap_t *p_port_guid_tbl;
 	osm_port_t *p_port;
@@ -933,7 +968,7 @@ static void __osm_state_mgr_check_tbl_consistency(IN osm_sm_t * sm)
 	/* They should be the same, but compare it anyway */
 	max_lid = (ref_size > curr_size) ? ref_size : curr_size;
 
-	for (lid = 1; lid <= max_lid; lid++) {
+	for (lid = 1; lid < max_lid; lid++) {
 		p_port_ref = NULL;
 		p_port_stored = NULL;
 		cl_ptr_vector_at(p_port_lid_tbl, lid, (void *)&p_port_stored);
@@ -1001,25 +1036,24 @@ static void __osm_state_mgr_check_tbl_consistency(IN osm_sm_t * sm)
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-static void cleanup_switch(cl_map_item_t *item, void *log)
+static void cleanup_switch(cl_map_item_t * item, void *log)
 {
-	osm_switch_t *sw = (osm_switch_t *)item;
+	osm_switch_t *sw = (osm_switch_t *) item;
 
 	if (!sw->new_lft)
 		return;
-	
-	if (memcmp(sw->lft, sw->new_lft, IB_LID_UCAST_END_HO + 1))
-		osm_log(log, OSM_LOG_ERROR, "ERR 331D: "
-			"LFT of switch 0x%016" PRIx64 " is not up to date.\n",
-			cl_ntoh64(sw->p_node->node_info.node_guid));
+
+	if (memcmp(sw->lft, sw->new_lft, sw->max_lid_ho + 1))
+		osm_log_v2(log, OSM_LOG_ERROR, FILE_ID, "ERR 331D: "
+			   "LFT of switch 0x%016" PRIx64 " (%s) is not up to date\n",
+			   cl_ntoh64(sw->p_node->node_info.node_guid),
+			   sw->p_node->print_desc);
 	else {
 		free(sw->new_lft);
 		sw->new_lft = NULL;
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
 int wait_for_pending_transactions(osm_stats_t * stats)
 {
 #ifdef HAVE_LIBPTHREAD
@@ -1042,18 +1076,34 @@ static void do_sweep(osm_sm_t * sm)
 {
 	ib_api_status_t status;
 	osm_remote_sm_t *p_remote_sm;
+	unsigned config_parsed = 0;
+
+	if (sm->p_subn->force_heavy_sweep) {
+		if (osm_subn_rescan_conf_files(sm->p_subn) < 0)
+			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 331A: "
+				"osm_subn_rescan_conf_file failed\n");
+		else
+			config_parsed = 1;
+	}
 
 	if (sm->p_subn->sm_state != IB_SMINFO_STATE_MASTER &&
 	    sm->p_subn->sm_state != IB_SMINFO_STATE_DISCOVERING)
 		return;
 
-	if (sm->p_subn->coming_out_of_standby)
+	if (sm->p_subn->coming_out_of_standby) {
 		/*
 		 * Need to force re-write of sm_base_lid to all ports
 		 * to do that we want all the ports to be considered
 		 * foreign
 		 */
-		__osm_state_mgr_clean_known_lids(sm);
+		state_mgr_clean_known_lids(sm);
+
+		/*
+		 * Need to reconfigure LFTs, PKEYs, and QoS on all switches
+		 * when coming out of STANDBY
+		 */
+		sm->p_subn->need_update = 1;
+	}
 
 	sm->master_sm_found = 0;
 
@@ -1074,10 +1124,15 @@ static void do_sweep(osm_sm_t * sm)
 	    && sm->p_subn->force_heavy_sweep == FALSE
 	    && sm->p_subn->force_reroute == FALSE
 	    && sm->p_subn->subnet_initialization_error == FALSE
-	    && (__osm_state_mgr_light_sweep_start(sm) == IB_SUCCESS)) {
+	    && (state_mgr_light_sweep_start(sm) == IB_SUCCESS)) {
 		if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))
 			return;
 		if (!sm->p_subn->force_heavy_sweep) {
+			if (sm->p_subn->opt.sa_db_dump &&
+			    !osm_sa_db_file_dump(sm->p_subn->p_osm))
+				osm_opensm_report_event(sm->p_subn->p_osm,
+							OSM_EVENT_ID_SA_DB_DUMPED,
+							NULL);
 			OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,
 					"LIGHT SWEEP COMPLETE");
 			return;
@@ -1109,7 +1164,12 @@ static void do_sweep(osm_sm_t * sm)
 		/* Re-program the switches fully */
 		sm->p_subn->ignore_existing_lfts = TRUE;
 
-		osm_ucast_mgr_process(&sm->ucast_mgr);
+		if (osm_ucast_mgr_process(&sm->ucast_mgr)) {
+			OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,
+					"REROUTE FAILED");
+			return;
+		}
+		osm_qos_setup(sm->p_subn->p_osm);
 
 		/* Reset flag */
 		sm->p_subn->ignore_existing_lfts = FALSE;
@@ -1117,52 +1177,83 @@ static void do_sweep(osm_sm_t * sm)
 		if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))
 			return;
 
+		osm_congestion_control_setup(sm->p_subn->p_osm);
+
+		if (osm_congestion_control_wait_pending_transactions (sm->p_subn->p_osm))
+			return;
+
 		if (!sm->p_subn->subnet_initialization_error) {
 			OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,
 					"REROUTE COMPLETE");
+			osm_opensm_report_event(sm->p_subn->p_osm,
+						OSM_EVENT_ID_UCAST_ROUTING_DONE,
+						NULL);
 			return;
 		}
 	}
 
+	osm_opensm_report_event(sm->p_subn->p_osm,
+				OSM_EVENT_ID_HEAVY_SWEEP_START, NULL);
+
 	/* go to heavy sweep */
-_repeat_discovery:
+repeat_discovery:
 
 	/* First of all - unset all flags */
 	sm->p_subn->force_heavy_sweep = FALSE;
 	sm->p_subn->force_reroute = FALSE;
 	sm->p_subn->subnet_initialization_error = FALSE;
 
+	/* Reset tracking values in case limiting component got removed
+	 * from fabric. */
+	sm->p_subn->min_ca_mtu = IB_MAX_MTU;
+	sm->p_subn->min_ca_rate = IB_MAX_RATE;
+	sm->p_subn->min_data_vls = IB_MAX_NUM_VLS - 1;
+
 	/* rescan configuration updates */
-	if (osm_subn_rescan_conf_files(sm->p_subn) < 0)
+	if (!config_parsed && osm_subn_rescan_conf_files(sm->p_subn) < 0)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 331A: "
 			"osm_subn_rescan_conf_file failed\n");
 
 	if (sm->p_subn->sm_state != IB_SMINFO_STATE_MASTER)
 		sm->p_subn->need_update = 1;
 
-	status = __osm_state_mgr_sweep_hop_0(sm);
+	status = state_mgr_sweep_hop_0(sm);
 	if (status != IB_SUCCESS ||
 	    wait_for_pending_transactions(&sm->p_subn->p_osm->stats))
 		return;
 
-	if (__osm_state_mgr_is_sm_port_down(sm) == TRUE) {
-		osm_log(sm->p_log, OSM_LOG_SYS, "SM port is down\n");
-		OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, "SM PORT DOWN");
+	if (state_mgr_is_sm_port_down(sm) == TRUE) {
+		if (sm->p_subn->last_sm_port_state) {
+			sm->p_subn->last_sm_port_state = 0;
+			osm_log_v2(sm->p_log, OSM_LOG_SYS, FILE_ID, "SM port is down\n");
+			OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,
+					"SM PORT DOWN");
+		}
 
 		/* Run the drop manager - we want to clear all records */
 		osm_drop_mgr_process(sm);
 
 		/* Move to DISCOVERING state */
-		osm_sm_state_mgr_process(sm, OSM_SM_SIGNAL_DISCOVER);
+		if (sm->p_subn->sm_state != IB_SMINFO_STATE_DISCOVERING)
+			osm_sm_state_mgr_process(sm, OSM_SM_SIGNAL_DISCOVER);
+		osm_opensm_report_event(sm->p_subn->p_osm,
+					OSM_EVENT_ID_STATE_CHANGE, NULL);
 		return;
+	} else {
+		if (!sm->p_subn->last_sm_port_state) {
+			sm->p_subn->last_sm_port_state = 1;
+			osm_log_v2(sm->p_log, OSM_LOG_SYS, FILE_ID, "SM port is up\n");
+			OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,
+					"SM PORT UP");
+		}
 	}
 
-	status = __osm_state_mgr_sweep_hop_1(sm);
+	status = state_mgr_sweep_hop_1(sm);
 	if (status != IB_SUCCESS ||
 	    wait_for_pending_transactions(&sm->p_subn->p_osm->stats))
 		return;
 
-	/* discovery completed - check other sm presense */
+	/* discovery completed - check other sm presence */
 	if (sm->master_sm_found) {
 		/*
 		 * Call the sm_state_mgr with signal
@@ -1174,35 +1265,43 @@ _repeat_discovery:
 				"ENTERING STANDBY STATE");
 		/* notify master SM about us */
 		osm_send_trap144(sm, 0);
+		osm_opensm_report_event(sm->p_subn->p_osm,
+					OSM_EVENT_ID_STATE_CHANGE, NULL);
 		return;
 	}
 
 	/* if new sweep requested - don't bother with the rest */
-	if (sm->p_subn->force_heavy_sweep)
-		goto _repeat_discovery;
+	if (sm->p_subn->force_heavy_sweep) {
+		config_parsed = 0;
+		goto repeat_discovery;
+	}
+
+	osm_opensm_report_event(sm->p_subn->p_osm,
+				OSM_EVENT_ID_HEAVY_SWEEP_DONE, NULL);
 
 	OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, "HEAVY SWEEP COMPLETE");
 
+	osm_drop_mgr_process(sm);
+
 	/* If we are MASTER - get the highest remote_sm, and
 	 * see if it is higher than our local sm.
 	 */
 	if (sm->p_subn->sm_state == IB_SMINFO_STATE_MASTER) {
-		p_remote_sm = __osm_state_mgr_get_highest_sm(sm);
+		p_remote_sm = state_mgr_get_highest_sm(sm);
 		if (p_remote_sm != NULL) {
 			/* report new ports (trap 64) before leaving MASTER */
-			__osm_state_mgr_report_new_ports(sm);
+			state_mgr_report_new_ports(sm);
 
 			/* need to handover the mastership
 			 * to the remote sm, and move to standby */
-			__osm_state_mgr_send_handover(sm, p_remote_sm);
+			state_mgr_send_handover(sm, p_remote_sm);
 			osm_sm_state_mgr_process(sm,
 						 OSM_SM_SIGNAL_HANDOVER_SENT);
 			return;
 		} else {
 			/* We are the highest sm - check to see if there is
 			 * a remote SM that is in master state. */
-			p_remote_sm =
-			    __osm_state_mgr_exists_other_master_sm(sm);
+			p_remote_sm = state_mgr_exists_other_master_sm(sm);
 			if (p_remote_sm != NULL) {
 				/* There is a remote SM that is master.
 				 * need to wait for that SM to relinquish control
@@ -1216,9 +1315,6 @@ _repeat_discovery:
 		}
 	}
 
-	/* Need to continue with lid assignment */
-	osm_drop_mgr_process(sm);
-
 	/*
 	 * If we are not MASTER already - this means that we are
 	 * in discovery state. call osm_sm_state_mgr with signal
@@ -1229,8 +1325,6 @@ _repeat_discovery:
 
 	osm_pkey_mgr_process(sm->p_subn->p_osm);
 
-	osm_qos_setup(sm->p_subn->p_osm);
-
 	/* try to restore SA DB (this should be before lid_mgr
 	   because we may want to disable clients reregistration
 	   when SA DB is restored) */
@@ -1239,13 +1333,16 @@ _repeat_discovery:
 	if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))
 		return;
 
+	OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,
+			"PKEY setup completed - STARTING SM LID CONFIG");
+
 	osm_lid_mgr_process_sm(&sm->lid_mgr);
 	if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))
 		return;
 
 	OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,
 			"SM LID ASSIGNMENT COMPLETE - STARTING SUBNET LID CONFIG");
-	__osm_state_mgr_notify_lid_change(sm);
+	state_mgr_notify_lid_change(sm);
 
 	osm_lid_mgr_process_subnet(&sm->lid_mgr);
 	if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))
@@ -1255,18 +1352,22 @@ _repeat_discovery:
 	 * the port_lid_tbl under the subnet. There might be
 	 * errors in it if PortInfo Set requests didn't reach
 	 * their destination. */
-	__osm_state_mgr_check_tbl_consistency(sm);
+	state_mgr_check_tbl_consistency(sm);
 
 	OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,
 			"LID ASSIGNMENT COMPLETE - STARTING SWITCH TABLE CONFIG");
 
 	/*
-	 * Proceed with unicast forwarding table configuration.
+	 * Proceed with unicast forwarding table configuration; if it fails
+	 * return early to wait for a trap or the next sweep interval.
 	 */
 
 	if (!sm->ucast_mgr.cache_valid ||
 	    osm_ucast_cache_process(&sm->ucast_mgr))
-		osm_ucast_mgr_process(&sm->ucast_mgr);
+		if (osm_ucast_mgr_process(&sm->ucast_mgr))
+			return;
+
+	osm_qos_setup(sm->p_subn->p_osm);
 
 	if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))
 		return;
@@ -1281,15 +1382,22 @@ _repeat_discovery:
 
 	OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,
 			"SWITCHES CONFIGURED FOR UNICAST");
+	osm_opensm_report_event(sm->p_subn->p_osm,
+				OSM_EVENT_ID_UCAST_ROUTING_DONE, NULL);
 
 	if (!sm->p_subn->opt.disable_multicast) {
-		osm_mcast_mgr_process(sm);
+		osm_mcast_mgr_process(sm, TRUE);
 		if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))
 			return;
 		OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,
 				"SWITCHES CONFIGURED FOR MULTICAST");
 	}
 
+	osm_guid_mgr_process(sm);
+	if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))
+		return;
+	OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, "ALIAS GUIDS CONFIGURED");
+
 	/*
 	 * The LINK_PORTS state is required since we cannot count on
 	 * the port state change MADs to succeed. This is an artifact
@@ -1320,27 +1428,36 @@ _repeat_discovery:
 	 * The sweep completed!
 	 */
 
+	/* Now do GSI configuration */
+
+	osm_congestion_control_setup(sm->p_subn->p_osm);
+
+	if (osm_congestion_control_wait_pending_transactions (sm->p_subn->p_osm))
+		return;
+
 	/*
 	 * Send trap 64 on newly discovered endports
 	 */
-	__osm_state_mgr_report_new_ports(sm);
+	state_mgr_report_new_ports(sm);
 
 	/* in any case we zero this flag */
 	sm->p_subn->coming_out_of_standby = FALSE;
 
 	/* If there were errors - then the subnet is not really up */
 	if (sm->p_subn->subnet_initialization_error == TRUE) {
-		osm_log(sm->p_log, OSM_LOG_SYS,
-			"Errors during initialization\n");
+		osm_log_v2(sm->p_log, OSM_LOG_SYS, FILE_ID,
+			   "Errors during initialization\n");
 		OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_ERROR,
 				"ERRORS DURING INITIALIZATION");
 	} else {
 		sm->p_subn->need_update = 0;
 		osm_dump_all(sm->p_subn->p_osm);
-		__osm_state_mgr_up_msg(sm);
+		state_mgr_up_msg(sm);
 		sm->p_subn->first_time_master_sweep = FALSE;
+		sm->p_subn->set_client_rereg_on_sweep = FALSE;
 
-		if (osm_log_is_active(sm->p_log, OSM_LOG_VERBOSE))
+		if (OSM_LOG_IS_ACTIVE_V2(sm->p_log, OSM_LOG_VERBOSE) ||
+		    sm->p_subn->opt.sa_db_dump)
 			osm_sa_db_file_dump(sm->p_subn->p_osm);
 	}
 
@@ -1349,20 +1466,33 @@ _repeat_discovery:
 	 */
 	cl_event_signal(&sm->subnet_up_event);
 
-	osm_opensm_report_event(sm->p_subn->p_osm, OSM_EVENT_ID_SUBNET_UP, NULL);
+	osm_opensm_report_event(sm->p_subn->p_osm, OSM_EVENT_ID_SUBNET_UP,
+				NULL);
 
 	/* if we got a signal to force heavy sweep or errors
 	 * in the middle of the sweep - try another sweep. */
 	if (sm->p_subn->force_heavy_sweep
 	    || sm->p_subn->subnet_initialization_error)
 		osm_sm_signal(sm, OSM_SIGNAL_SWEEP);
+
+	/* Write a new copy of our persistent guid2mkey database */
+	osm_db_store(sm->p_subn->p_g2m);
+	osm_db_store(sm->p_subn->p_neighbor);
 }
 
 static void do_process_mgrp_queue(osm_sm_t * sm)
 {
 	if (sm->p_subn->sm_state != IB_SMINFO_STATE_MASTER)
 		return;
-	osm_mcast_mgr_process_mgroups(sm);
+	if (!sm->p_subn->opt.disable_multicast) {
+		osm_mcast_mgr_process(sm, FALSE);
+		wait_for_pending_transactions(&sm->p_subn->p_osm->stats);
+	}
+}
+
+static void do_process_guid_queue(osm_sm_t *sm)
+{
+	osm_guid_mgr_process(sm);
 	wait_for_pending_transactions(&sm->p_subn->p_osm->stats);
 }
 
@@ -1372,20 +1502,26 @@ void osm_state_mgr_process(IN osm_sm_t * sm, IN osm_signal_t signal)
 
 	OSM_LOG_ENTER(sm->p_log);
 
-	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-		"Received signal %s in state %s\n",
+	OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Received signal %s in state %s\n",
 		osm_get_sm_signal_str(signal),
 		osm_get_sm_mgr_state_str(sm->p_subn->sm_state));
 
 	switch (signal) {
 	case OSM_SIGNAL_SWEEP:
-		do_sweep(sm);
+		if (!sm->p_subn->sweeping_enabled) {
+			OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "sweeping disabled - "
+				"ignoring signal %s in state %s\n",
+				osm_get_sm_signal_str(signal),
+				osm_get_sm_mgr_state_str(sm->p_subn->sm_state));
+		} else
+			do_sweep(sm);
 		break;
-
 	case OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST:
 		do_process_mgrp_queue(sm);
 		break;
-
+	case OSM_SIGNAL_GUID_PROCESS_REQUEST:
+		do_process_guid_queue(sm);
+		break;
 	default:
 		CL_ASSERT(FALSE);
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3320: "
diff --git a/opensm/osm_subnet.c b/opensm/osm_subnet.c
index c41962d..195adb8 100644
--- a/opensm/osm_subnet.c
+++ b/opensm/osm_subnet.c
@@ -1,8 +1,11 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
+ * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2009-2011 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -53,6 +56,8 @@
 #include <ctype.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_log.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SUBNET_C
 #include <opensm/osm_subnet.h>
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_log.h>
@@ -62,44 +67,980 @@
 #include <opensm/osm_remote_sm.h>
 #include <opensm/osm_partition.h>
 #include <opensm/osm_node.h>
+#include <opensm/osm_guid.h>
 #include <opensm/osm_multicast.h>
 #include <opensm/osm_inform.h>
 #include <opensm/osm_console.h>
 #include <opensm/osm_perfmgr.h>
+#include <opensm/osm_congestion_control.h>
 #include <opensm/osm_event_plugin.h>
 #include <opensm/osm_qos_policy.h>
+#include <opensm/osm_service.h>
+#include <opensm/osm_db.h>
+#include <opensm/osm_db_pack.h>
 
 static const char null_str[] = "(null)";
 
-/**********************************************************************
- **********************************************************************/
-void osm_subn_construct(IN osm_subn_t * const p_subn)
+#define OPT_OFFSET(opt) offsetof(osm_subn_opt_t, opt)
+#define ARR_SIZE(a) (sizeof(a)/sizeof((a)[0]))
+
+typedef struct opt_rec {
+	const char *name;
+	unsigned long opt_offset;
+	void (*parse_fn)(osm_subn_t *p_subn, char *p_key, char *p_val_str,
+			 void *p_val1, void *p_val2,
+			 void (*)(osm_subn_t *, void *));
+	void (*setup_fn)(osm_subn_t *p_subn, void *p_val);
+	int  can_update;
+} opt_rec_t;
+
+static const char *module_name_str[] = {
+	"main.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_helper.c",
+	"osm_inform.c",
+	"osm_lid_mgr.c",
+	"osm_lin_fwd_rcv.c",
+	"osm_link_mgr.c",
+	"osm_log.c",
+	"osm_mad_pool.c",
+	"osm_mcast_fwd_rcv.c",
+	"osm_mcast_mgr.c",
+	"osm_mcast_tbl.c",
+	"osm_mcm_port.c",
+	"osm_mesh.c",
+	"osm_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.c",
+	"osm_qos_parser_y.c",
+	"osm_qos_policy.c",
+	"osm_remote_sm.c",
+	"osm_req.c",
+	"osm_resp.c",
+	"osm_router.c",
+	"osm_sa.c",
+	"osm_sa_class_port_info.c",
+	"osm_sa_guidinfo_record.c",
+	"osm_sa_informinfo.c",
+	"osm_sa_lft_record.c",
+	"osm_sa_link_record.c",
+	"osm_sa_mad_ctrl.c",
+	"osm_sa_mcmember_record.c",
+	"osm_sa_mft_record.c",
+	"osm_sa_multipath_record.c",
+	"osm_sa_node_record.c",
+	"osm_sa_path_record.c",
+	"osm_sa_pkey_record.c",
+	"osm_sa_portinfo_record.c",
+	"osm_sa_service_record.c",
+	"osm_sa_slvl_record.c",
+	"osm_sa_sminfo_record.c",
+	"osm_sa_sw_info_record.c",
+	"osm_sa_vlarb_record.c",
+	"osm_service.c",
+	"osm_slvl_map_rcv.c",
+	"osm_sm.c",
+	"osm_sminfo_rcv.c",
+	"osm_sm_mad_ctrl.c",
+	"osm_sm_state_mgr.c",
+	"osm_state_mgr.c",
+	"osm_subnet.c",
+	"osm_sw_info_rcv.c",
+	"osm_switch.c",
+	"osm_torus.c",
+	"osm_trap_rcv.c",
+	"osm_ucast_cache.c",
+	"osm_ucast_dnup.c",
+	"osm_ucast_file.c",
+	"osm_ucast_ftree.c",
+	"osm_ucast_lash.c",
+	"osm_ucast_mgr.c",
+	"osm_ucast_updn.c",
+	"osm_vendor_ibumad.c",
+	"osm_vl15intf.c",
+	"osm_vl_arb_rcv.c",
+	"st.c",
+	"osm_ucast_dfsssp.c",
+	/* Add new module names here ... */
+	/* FILE_ID define in those modules must be identical to index here */
+	/* last FILE_ID is currently 88 */
+};
+
+#define MOD_NAME_STR_UNKNOWN_VAL (ARR_SIZE(module_name_str))
+
+static int find_module_name(const char *name, uint8_t *file_id)
+{
+	uint8_t i;
+
+	for (i = 0; i < MOD_NAME_STR_UNKNOWN_VAL; i++) {
+		if (strcmp(name, module_name_str[i]) == 0) {
+			if (file_id)
+				*file_id = i;
+			return 0;
+		}
+	}
+	return 1;
+}
+
+static void log_report(const char *fmt, ...)
+{
+	char buf[128];
+	va_list args;
+	va_start(args, fmt);
+	vsnprintf(buf, sizeof(buf), fmt, args);
+	va_end(args);
+	printf("%s", buf);
+	cl_log_event("OpenSM", CL_LOG_INFO, buf, NULL, 0);
+}
+
+static void log_config_value(char *name, const char *fmt, ...)
+{
+	char buf[128];
+	va_list args;
+	unsigned n;
+	va_start(args, fmt);
+	n = snprintf(buf, sizeof(buf), " Loading Cached Option:%s = ", name);
+	if (n > sizeof(buf))
+		n = sizeof(buf);
+	n += vsnprintf(buf + n, sizeof(buf) - n, fmt, args);
+	if (n > sizeof(buf) - 2)
+		n = sizeof(buf) - 2;
+	snprintf(buf + n, sizeof(buf) - n, "\n");
+	va_end(args);
+	printf("%s", buf);
+	cl_log_event("OpenSM", CL_LOG_INFO, buf, NULL, 0);
+}
+
+static void opts_setup_log_flags(osm_subn_t *p_subn, void *p_val)
+{
+	p_subn->p_osm->log.level = *((uint8_t *) p_val);
+}
+
+static void opts_setup_force_log_flush(osm_subn_t *p_subn, void *p_val)
+{
+	p_subn->p_osm->log.flush = *((boolean_t *) p_val);
+}
+
+static void opts_setup_accum_log_file(osm_subn_t *p_subn, void *p_val)
+{
+	p_subn->p_osm->log.accum_log_file = *((boolean_t *) p_val);
+}
+
+static void opts_setup_log_max_size(osm_subn_t *p_subn, void *p_val)
+{
+	uint32_t log_max_size = *((uint32_t *) p_val);
+
+	p_subn->p_osm->log.max_size = log_max_size << 20; /* convert from MB to bytes */
+}
+
+static void opts_setup_sminfo_polling_timeout(osm_subn_t *p_subn, void *p_val)
+{
+	osm_sm_t *p_sm = &p_subn->p_osm->sm;
+	uint32_t sminfo_polling_timeout = *((uint32_t *) p_val);
+
+	cl_timer_stop(&p_sm->polling_timer);
+	cl_timer_start(&p_sm->polling_timer, sminfo_polling_timeout);
+}
+
+static void opts_setup_sm_priority(osm_subn_t *p_subn, void *p_val)
+{
+	osm_sm_t *p_sm = &p_subn->p_osm->sm;
+	uint8_t sm_priority = *((uint8_t *) p_val);
+
+	osm_set_sm_priority(p_sm, sm_priority);
+}
+
+static void opts_parse_net64(IN osm_subn_t *p_subn, IN char *p_key,
+			     IN char *p_val_str, void *p_v1, void *p_v2,
+			     void (*pfn)(osm_subn_t *, void *))
+{
+	uint64_t *p_val1 = p_v1, *p_val2 = p_v2;
+	uint64_t val = strtoull(p_val_str, NULL, 0);
+
+	if (cl_hton64(val) != *p_val1) {
+		log_config_value(p_key, "0x%016" PRIx64, val);
+		if (pfn)
+			pfn(p_subn, &val);
+		*p_val1 = *p_val2 = cl_ntoh64(val);
+	}
+}
+
+static void opts_parse_uint32(IN osm_subn_t *p_subn, IN char *p_key,
+			      IN char *p_val_str, void *p_v1, void *p_v2,
+			      void (*pfn)(osm_subn_t *, void *))
+{
+	uint32_t *p_val1 = p_v1, *p_val2 = p_v2;
+	uint32_t val = strtoul(p_val_str, NULL, 0);
+
+	if (val != *p_val1) {
+		log_config_value(p_key, "%u", val);
+		if (pfn)
+			pfn(p_subn, &val);
+		*p_val1 = *p_val2 = val;
+	}
+}
+
+static void opts_parse_net32(IN osm_subn_t *p_subn, IN char *p_key,
+			     IN char *p_val_str, void *p_v1, void *p_v2,
+			     void (*pfn)(osm_subn_t *, void *))
+{
+	uint32_t *p_val1 = p_v1, *p_val2 = p_v2;
+	uint32_t val = strtoul(p_val_str, NULL, 0);
+
+	if (cl_hton32(val) != *p_val1) {
+		log_config_value(p_key, "%u", val);
+		if (pfn)
+			pfn(p_subn, &val);
+		*p_val1 = *p_val2 = cl_hton32(val);
+	}
+}
+
+
+static void opts_parse_int32(IN osm_subn_t *p_subn, IN char *p_key,
+			     IN char *p_val_str, void *p_v1, void *p_v2,
+			     void (*pfn)(osm_subn_t *, void *))
+{
+	int32_t *p_val1 = p_v1, *p_val2 = p_v2;
+	int32_t val = strtol(p_val_str, NULL, 0);
+
+	if (val != *p_val1) {
+		log_config_value(p_key, "%d", val);
+		if (pfn)
+			pfn(p_subn, &val);
+		*p_val1 = *p_val2 = val;
+	}
+}
+
+static void opts_parse_uint16(IN osm_subn_t *p_subn, IN char *p_key,
+			      IN char *p_val_str, void *p_v1, void *p_v2,
+			      void (*pfn)(osm_subn_t *, void *))
+{
+	uint16_t *p_val1 = p_v1, *p_val2 = p_v2;
+	uint16_t val = (uint16_t) strtoul(p_val_str, NULL, 0);
+
+	if (val != *p_val1) {
+		log_config_value(p_key, "%u", val);
+		if (pfn)
+			pfn(p_subn, &val);
+		*p_val1 = *p_val2 = val;
+	}
+}
+
+static void opts_parse_net16(IN osm_subn_t *p_subn, IN char *p_key,
+			     IN char *p_val_str, void *p_v1, void *p_v2,
+			     void (*pfn)(osm_subn_t *, void *))
+{
+	uint16_t *p_val1 = p_v1, *p_val2 = p_v2;
+	uint16_t val = strtoul(p_val_str, NULL, 0);
+
+	if (cl_hton16(val) != *p_val1) {
+		log_config_value(p_key, "0x%04x", val);
+		if (pfn)
+			pfn(p_subn, &val);
+		*p_val1 = *p_val2 = cl_hton16(val);
+	}
+}
+
+static void opts_parse_uint8(IN osm_subn_t *p_subn, IN char *p_key,
+			     IN char *p_val_str, void *p_v1, void *p_v2,
+			     void (*pfn)(osm_subn_t *, void *))
+{
+	uint8_t *p_val1 = p_v1, *p_val2 = p_v2;
+	uint8_t val = strtoul(p_val_str, NULL, 0);
+
+	if (val != *p_val1) {
+		log_config_value(p_key, "%u", val);
+		if (pfn)
+			pfn(p_subn, &val);
+		*p_val1 = *p_val2 = val;
+	}
+}
+
+static void opts_parse_boolean(IN osm_subn_t *p_subn, IN char *p_key,
+			       IN char *p_val_str, void *p_v1, void *p_v2,
+			       void (*pfn)(osm_subn_t *, void *))
+{
+	boolean_t *p_val1 = p_v1, *p_val2 = p_v2;
+	boolean_t val;
+
+	if (!p_val_str)
+		return;
+
+	if (strcmp("TRUE", p_val_str))
+		val = FALSE;
+	else
+		val = TRUE;
+
+	if (val != *p_val1) {
+		log_config_value(p_key, "%s", p_val_str);
+		if (pfn)
+			pfn(p_subn, &val);
+		*p_val1 = *p_val2 = val;
+	}
+}
+
+static void opts_parse_charp(IN osm_subn_t *p_subn, IN char *p_key,
+			     IN char *p_val_str, void *p_v1, void *p_v2,
+			     void (*pfn)(osm_subn_t *, void *))
+{
+	char **p_val1 = p_v1, **p_val2 = p_v2;
+	const char *current_str = *p_val1 ? *p_val1 : null_str ;
+
+	if (p_val_str && strcmp(p_val_str, current_str)) {
+		char *new;
+		log_config_value(p_key, "%s", p_val_str);
+		/* special case the "(null)" string */
+		new = strcmp(null_str, p_val_str) ? strdup(p_val_str) : NULL;
+		if (pfn)
+			pfn(p_subn, new);
+		if (*p_val1 && *p_val1 != *p_val2)
+			free(*p_val1);
+		if (*p_val2)
+			free(*p_val2);
+		*p_val1 = *p_val2 = new;
+	}
+}
+
+static void opts_parse_256bit(IN osm_subn_t *p_subn, IN char *p_key,
+			      IN char *p_val_str, void *p_v1, void *p_v2,
+			      void (*pfn)(osm_subn_t *, void *))
+{
+	uint8_t *p_val1 = p_v1, *p_val2 = p_v2;
+	uint8_t val[IB_CC_PORT_MASK_DATA_SIZE] = { 0 };
+	char tmpbuf[3] = { 0 };
+	uint8_t tmpint;
+	int numdigits = 0;
+	int startindex;
+	char *strptr = p_val_str;
+	char *ptr;
+	int i;
+
+	/* parse like it's hypothetically a 256 bit integer code
+	 *
+	 * store "big endian"
+	 */
+
+	if (!strncmp(strptr, "0x", 2) || !strncmp(strptr, "0X", 2))
+		strptr+=2;
+
+	for (ptr = strptr; *ptr; ptr++) {
+		if (!isxdigit(*ptr)) {
+			log_report("invalid hex digit in bitmask\n");
+			return;
+		}
+		numdigits++;
+	}
+
+	if (!numdigits) {
+		log_report("invalid length bitmask\n");
+		return;
+	}
+
+	/* max of 2 hex chars per byte */
+	if (numdigits > IB_CC_PORT_MASK_DATA_SIZE * 2)
+		numdigits = IB_CC_PORT_MASK_DATA_SIZE * 2;
+
+	startindex = IB_CC_PORT_MASK_DATA_SIZE - ((numdigits - 1) / 2) - 1;
+
+	if (numdigits % 2) {
+		memcpy(tmpbuf, strptr, 1);
+		strptr += 1;
+	}
+	else {
+		memcpy(tmpbuf, strptr, 2);
+		strptr += 2;
+	}
+
+	tmpint = strtoul(tmpbuf, NULL, 16);
+	val[startindex] = tmpint;
+
+	for (i = (startindex + 1); i < IB_CC_PORT_MASK_DATA_SIZE; i++) {
+		memcpy(tmpbuf, strptr, 2);
+		strptr += 2;
+		tmpint = strtoul(tmpbuf, NULL, 16);
+		val[i] = tmpint;
+	}
+
+	if (memcmp(val, p_val1, IB_CC_PORT_MASK_DATA_SIZE)) {
+		log_config_value(p_key, "%s", p_val_str);
+		if (pfn)
+			pfn(p_subn, val);
+		memcpy(p_val1, val, IB_CC_PORT_MASK_DATA_SIZE);
+		memcpy(p_val2, val, IB_CC_PORT_MASK_DATA_SIZE);
+	}
+
+}
+
+static void opts_parse_cct_entry(IN osm_subn_t *p_subn, IN char *p_key,
+				 IN char *p_val_str, void *p_v1, void *p_v2,
+				 void (*pfn)(osm_subn_t *, void *))
+{
+	osm_cct_entry_t *p_cct1 = p_v1, *p_cct2 = p_v2;
+	osm_cct_entry_t cct;
+	char buf[512] = { 0 };
+	char *ptr;
+
+	strncpy(buf, p_val_str, 511);
+
+	if (!(ptr = strchr(buf, ':'))) {
+		log_report("invalid CCT entry\n");
+		return;
+	}
+
+	*ptr = '\0';
+	ptr++;
+
+	cct.shift = strtoul(buf, NULL, 0);
+	cct.multiplier = strtoul(ptr, NULL, 0);
+
+	if (cct.shift != p_cct1->shift
+	    || cct.multiplier != p_cct1->multiplier) {
+		log_config_value(p_key, "%s", p_val_str);
+		if (pfn)
+			pfn(p_subn, &cct);
+		p_cct1->shift = p_cct2->shift = cct.shift;
+		p_cct1->multiplier = p_cct2->multiplier = cct.multiplier;
+	}
+}
+
+static void opts_parse_cc_cct(IN osm_subn_t *p_subn, IN char *p_key,
+			      IN char *p_val_str, void *p_v1, void *p_v2,
+			      void (*pfn)(osm_subn_t *, void *))
+{
+	osm_cct_t *p_val1 = p_v1, *p_val2 = p_v2;
+	const char *current_str = p_val1->input_str ? p_val1->input_str : null_str;
+
+	if (p_val_str && strcmp(p_val_str, current_str)) {
+		osm_cct_t newcct;
+		char *new;
+		unsigned int len = 0;
+		char *lasts;
+		char *tok;
+		char *ptr;
+
+		/* special case the "(null)" string */
+		new = strcmp(null_str, p_val_str) ? strdup(p_val_str) : NULL;
+
+		if (!new) {
+			log_config_value(p_key, "%s", p_val_str);
+			if (pfn)
+				pfn(p_subn, NULL);
+			memset(p_val1->entries, '\0', sizeof(p_val1->entries));
+			memset(p_val2->entries, '\0', sizeof(p_val2->entries));
+			p_val1->entries_len = p_val2->entries_len = 0;
+			p_val1->input_str = p_val2->input_str = NULL;
+			return;
+		}
+
+		memset(&newcct, '\0', sizeof(newcct));
+
+		tok = strtok_r(new, ",", &lasts);
+		while (tok && len < OSM_CCT_ENTRY_MAX) {
+
+			if (!(ptr = strchr(tok, ':'))) {
+				log_report("invalid CCT entry\n");
+				free(new);
+				return;
+			}
+			*ptr = '\0';
+			ptr++;
+
+			newcct.entries[len].shift = strtoul(tok, NULL, 0);
+			newcct.entries[len].multiplier = strtoul(ptr, NULL, 0);
+			len++;
+			tok = strtok_r(NULL, ",", &lasts);
+		}
+
+		free(new);
+
+		newcct.entries_len = len;
+		newcct.input_str = strdup(p_val_str);
+
+		log_config_value(p_key, "%s", p_val_str);
+		if (pfn)
+			pfn(p_subn, &newcct);
+		if (p_val1->input_str && p_val1->input_str != p_val2->input_str)
+			free(p_val1->input_str);
+		if (p_val2->input_str)
+			free(p_val2->input_str);
+		memcpy(p_val1->entries, newcct.entries, sizeof(newcct.entries));
+		memcpy(p_val2->entries, newcct.entries, sizeof(newcct.entries));
+		p_val1->entries_len = p_val2->entries_len = newcct.entries_len;
+		p_val1->input_str = p_val2->input_str = newcct.input_str;
+	}
+}
+
+static int parse_ca_cong_common(char *p_val_str, uint8_t *sl, unsigned int *val_offset) {
+	char *new, *lasts, *sl_str, *val_str;
+	uint8_t sltmp;
+
+	new = strcmp(null_str, p_val_str) ? strdup(p_val_str) : NULL;
+	if (!new)
+		return -1;
+
+	sl_str = strtok_r(new, " \t", &lasts);
+	val_str = strtok_r(NULL, " \t", &lasts);
+
+	if (!val_str) {
+		log_report("value must be specified in addition to SL\n");
+		free(new);
+		return -1;
+	}
+
+	sltmp = strtoul(sl_str, NULL, 0);
+	if (sltmp >= IB_CA_CONG_ENTRY_DATA_SIZE) {
+		log_report("invalid SL specified\n");
+		free(new);
+		return -1;
+	}
+
+	*sl = sltmp;
+	*val_offset = (unsigned int)(val_str - new);
+
+	free(new);
+	return 0;
+}
+
+static void opts_parse_ccti_timer(IN osm_subn_t *p_subn, IN char *p_key,
+				  IN char *p_val_str, void *p_v1, void *p_v2,
+				  void (*pfn)(osm_subn_t *, void *))
+{
+	osm_cacongestion_entry_t *p_val1 = p_v1, *p_val2 = p_v2;
+	unsigned int val_offset = 0;
+	uint8_t sl = 0;
+
+	if (parse_ca_cong_common(p_val_str, &sl, &val_offset) < 0)
+		return;
+
+	opts_parse_net16(p_subn, p_key, p_val_str + val_offset,
+			 &p_val1[sl].ccti_timer,
+			 &p_val2[sl].ccti_timer,
+			 pfn);
+}
+
+static void opts_parse_ccti_increase(IN osm_subn_t *p_subn, IN char *p_key,
+				     IN char *p_val_str, void *p_v1, void *p_v2,
+				     void (*pfn)(osm_subn_t *, void *))
+{
+	osm_cacongestion_entry_t *p_val1 = p_v1, *p_val2 = p_v2;
+	unsigned int val_offset = 0;
+	uint8_t sl = 0;
+
+	if (parse_ca_cong_common(p_val_str, &sl, &val_offset) < 0)
+		return;
+
+	opts_parse_uint8(p_subn, p_key, p_val_str + val_offset,
+			 &p_val1[sl].ccti_increase,
+			 &p_val2[sl].ccti_increase,
+			 pfn);
+}
+
+static void opts_parse_trigger_threshold(IN osm_subn_t *p_subn, IN char *p_key,
+					 IN char *p_val_str, void *p_v1, void *p_v2,
+					 void (*pfn)(osm_subn_t *, void *))
+{
+	osm_cacongestion_entry_t *p_val1 = p_v1, *p_val2 = p_v2;
+	unsigned int val_offset = 0;
+	uint8_t sl = 0;
+
+	if (parse_ca_cong_common(p_val_str, &sl, &val_offset) < 0)
+		return;
+
+	opts_parse_uint8(p_subn, p_key, p_val_str + val_offset,
+			 &p_val1[sl].trigger_threshold,
+			 &p_val2[sl].trigger_threshold,
+			 pfn);
+}
+
+static void opts_parse_ccti_min(IN osm_subn_t *p_subn, IN char *p_key,
+				IN char *p_val_str, void *p_v1, void *p_v2,
+				void (*pfn)(osm_subn_t *, void *))
+{
+	osm_cacongestion_entry_t *p_val1 = p_v1, *p_val2 = p_v2;
+	unsigned int val_offset = 0;
+	uint8_t sl = 0;
+
+	if (parse_ca_cong_common(p_val_str, &sl, &val_offset) < 0)
+		return;
+
+	opts_parse_uint8(p_subn, p_key, p_val_str + val_offset,
+			 &p_val1[sl].ccti_min,
+			 &p_val2[sl].ccti_min,
+			 pfn);
+}
+
+static const opt_rec_t opt_tbl[] = {
+	{ "guid", OPT_OFFSET(guid), opts_parse_net64, NULL, 0 },
+	{ "m_key", OPT_OFFSET(m_key), opts_parse_net64, NULL, 1 },
+	{ "sm_key", OPT_OFFSET(sm_key), opts_parse_net64, NULL, 1 },
+	{ "sa_key", OPT_OFFSET(sa_key), opts_parse_net64, NULL, 1 },
+	{ "subnet_prefix", OPT_OFFSET(subnet_prefix), opts_parse_net64, NULL, 1 },
+	{ "m_key_lease_period", OPT_OFFSET(m_key_lease_period), opts_parse_net16, NULL, 1 },
+	{ "m_key_protection_level", OPT_OFFSET(m_key_protect_bits), opts_parse_uint8, NULL, 1 },
+	{ "sweep_interval", OPT_OFFSET(sweep_interval), opts_parse_uint32, NULL, 1 },
+	{ "max_wire_smps", OPT_OFFSET(max_wire_smps), opts_parse_uint32, NULL, 1 },
+	{ "max_wire_smps2", OPT_OFFSET(max_wire_smps2), opts_parse_uint32, NULL, 1 },
+	{ "max_smps_timeout", OPT_OFFSET(max_smps_timeout), opts_parse_uint32, NULL, 1 },
+	{ "console", OPT_OFFSET(console), opts_parse_charp, NULL, 0 },
+	{ "console_port", OPT_OFFSET(console_port), opts_parse_uint16, NULL, 0 },
+	{ "transaction_timeout", OPT_OFFSET(transaction_timeout), opts_parse_uint32, NULL, 0 },
+	{ "transaction_retries", OPT_OFFSET(transaction_retries), opts_parse_uint32, NULL, 0 },
+	{ "max_msg_fifo_timeout", OPT_OFFSET(max_msg_fifo_timeout), opts_parse_uint32, NULL, 1 },
+	{ "sm_priority", OPT_OFFSET(sm_priority), opts_parse_uint8, opts_setup_sm_priority, 1 },
+	{ "lmc", OPT_OFFSET(lmc), opts_parse_uint8, NULL, 0 },
+	{ "lmc_esp0", OPT_OFFSET(lmc_esp0), opts_parse_boolean, NULL, 0 },
+	{ "max_op_vls", OPT_OFFSET(max_op_vls), opts_parse_uint8, NULL, 1 },
+	{ "force_link_speed", OPT_OFFSET(force_link_speed), opts_parse_uint8, NULL, 1 },
+	{ "force_link_speed_ext", OPT_OFFSET(force_link_speed_ext), opts_parse_uint8, NULL, 1 },
+	{ "fdr10", OPT_OFFSET(fdr10), opts_parse_uint8, NULL, 1 },
+	{ "reassign_lids", OPT_OFFSET(reassign_lids), opts_parse_boolean, NULL, 1 },
+	{ "ignore_other_sm", OPT_OFFSET(ignore_other_sm), opts_parse_boolean, NULL, 1 },
+	{ "single_thread", OPT_OFFSET(single_thread), opts_parse_boolean, NULL, 0 },
+	{ "disable_multicast", OPT_OFFSET(disable_multicast), opts_parse_boolean, NULL, 1 },
+	{ "subnet_timeout", OPT_OFFSET(subnet_timeout), opts_parse_uint8, NULL, 1 },
+	{ "packet_life_time", OPT_OFFSET(packet_life_time), opts_parse_uint8, NULL, 1 },
+	{ "vl_stall_count", OPT_OFFSET(vl_stall_count), opts_parse_uint8, NULL, 1 },
+	{ "leaf_vl_stall_count", OPT_OFFSET(leaf_vl_stall_count), opts_parse_uint8, NULL, 1 },
+	{ "head_of_queue_lifetime", OPT_OFFSET(head_of_queue_lifetime), opts_parse_uint8, NULL, 1 },
+	{ "leaf_head_of_queue_lifetime", OPT_OFFSET(leaf_head_of_queue_lifetime), opts_parse_uint8, NULL, 1 },
+	{ "local_phy_errors_threshold", OPT_OFFSET(local_phy_errors_threshold), opts_parse_uint8, NULL, 1 },
+	{ "overrun_errors_threshold", OPT_OFFSET(overrun_errors_threshold), opts_parse_uint8, NULL, 1 },
+	{ "use_mfttop", OPT_OFFSET(use_mfttop), opts_parse_boolean, NULL, 1},
+	{ "sminfo_polling_timeout", OPT_OFFSET(sminfo_polling_timeout), opts_parse_uint32, opts_setup_sminfo_polling_timeout, 1 },
+	{ "polling_retry_number", OPT_OFFSET(polling_retry_number), opts_parse_uint32, NULL, 1 },
+	{ "force_heavy_sweep", OPT_OFFSET(force_heavy_sweep), opts_parse_boolean, NULL, 1 },
+	{ "port_prof_ignore_file", OPT_OFFSET(port_prof_ignore_file), opts_parse_charp, NULL, 0 },
+	{ "hop_weights_file", OPT_OFFSET(hop_weights_file), opts_parse_charp, NULL, 0 },
+	{ "dimn_ports_file", OPT_OFFSET(port_search_ordering_file), opts_parse_charp, NULL, 0 },
+	{ "port_search_ordering_file", OPT_OFFSET(port_search_ordering_file), opts_parse_charp, NULL, 0 },
+	{ "port_profile_switch_nodes", OPT_OFFSET(port_profile_switch_nodes), opts_parse_boolean, NULL, 1 },
+	{ "sweep_on_trap", OPT_OFFSET(sweep_on_trap), opts_parse_boolean, NULL, 1 },
+	{ "routing_engine", OPT_OFFSET(routing_engine_names), opts_parse_charp, NULL, 0 },
+	{ "connect_roots", OPT_OFFSET(connect_roots), opts_parse_boolean, NULL, 1 },
+	{ "use_ucast_cache", OPT_OFFSET(use_ucast_cache), opts_parse_boolean, NULL, 0 },
+	{ "log_file", OPT_OFFSET(log_file), opts_parse_charp, NULL, 0 },
+	{ "log_max_size", OPT_OFFSET(log_max_size), opts_parse_uint32, opts_setup_log_max_size, 1 },
+	{ "log_flags", OPT_OFFSET(log_flags), opts_parse_uint8, opts_setup_log_flags, 1 },
+	{ "force_log_flush", OPT_OFFSET(force_log_flush), opts_parse_boolean, opts_setup_force_log_flush, 1 },
+	{ "accum_log_file", OPT_OFFSET(accum_log_file), opts_parse_boolean, opts_setup_accum_log_file, 1 },
+	{ "partition_config_file", OPT_OFFSET(partition_config_file), opts_parse_charp, NULL, 0 },
+	{ "no_partition_enforcement", OPT_OFFSET(no_partition_enforcement), opts_parse_boolean, NULL, 1 },
+	{ "part_enforce", OPT_OFFSET(part_enforce), opts_parse_charp, NULL, 1 },
+	{ "allow_both_pkeys", OPT_OFFSET(allow_both_pkeys), opts_parse_boolean, NULL, 1 },
+	{ "sm_assigned_guid", OPT_OFFSET(sm_assigned_guid), opts_parse_uint8, NULL, 1 },
+	{ "qos", OPT_OFFSET(qos), opts_parse_boolean, NULL, 1 },
+	{ "qos_policy_file", OPT_OFFSET(qos_policy_file), opts_parse_charp, NULL, 0 },
+	{ "dump_files_dir", OPT_OFFSET(dump_files_dir), opts_parse_charp, NULL, 0 },
+	{ "lid_matrix_dump_file", OPT_OFFSET(lid_matrix_dump_file), opts_parse_charp, NULL, 0 },
+	{ "lfts_file", OPT_OFFSET(lfts_file), opts_parse_charp, NULL, 0 },
+	{ "root_guid_file", OPT_OFFSET(root_guid_file), opts_parse_charp, NULL, 0 },
+	{ "cn_guid_file", OPT_OFFSET(cn_guid_file), opts_parse_charp, NULL, 0 },
+	{ "io_guid_file", OPT_OFFSET(io_guid_file), opts_parse_charp, NULL, 0 },
+	{ "port_shifting", OPT_OFFSET(port_shifting), opts_parse_boolean, NULL, 1 },
+	{ "scatter_ports", OPT_OFFSET(scatter_ports), opts_parse_uint32, NULL, 1 },
+	{ "max_reverse_hops", OPT_OFFSET(max_reverse_hops), opts_parse_uint16, NULL, 0 },
+	{ "ids_guid_file", OPT_OFFSET(ids_guid_file), opts_parse_charp, NULL, 0 },
+	{ "guid_routing_order_file", OPT_OFFSET(guid_routing_order_file), opts_parse_charp, NULL, 0 },
+	{ "sa_db_file", OPT_OFFSET(sa_db_file), opts_parse_charp, NULL, 0 },
+	{ "sa_db_dump", OPT_OFFSET(sa_db_dump), opts_parse_boolean, NULL, 1 },
+	{ "torus_config", OPT_OFFSET(torus_conf_file), opts_parse_charp, NULL, 1 },
+	{ "do_mesh_analysis", OPT_OFFSET(do_mesh_analysis), opts_parse_boolean, NULL, 1 },
+	{ "exit_on_fatal", OPT_OFFSET(exit_on_fatal), opts_parse_boolean, NULL, 1 },
+	{ "honor_guid2lid_file", OPT_OFFSET(honor_guid2lid_file), opts_parse_boolean, NULL, 1 },
+	{ "daemon", OPT_OFFSET(daemon), opts_parse_boolean, NULL, 0 },
+	{ "sm_inactive", OPT_OFFSET(sm_inactive), opts_parse_boolean, NULL, 1 },
+	{ "babbling_port_policy", OPT_OFFSET(babbling_port_policy), opts_parse_boolean, NULL, 1 },
+	{ "use_optimized_slvl", OPT_OFFSET(use_optimized_slvl), opts_parse_boolean, NULL, 1 },
+#ifdef ENABLE_OSM_PERF_MGR
+	{ "perfmgr", OPT_OFFSET(perfmgr), opts_parse_boolean, NULL, 0 },
+	{ "perfmgr_redir", OPT_OFFSET(perfmgr_redir), opts_parse_boolean, NULL, 0 },
+	{ "perfmgr_sweep_time_s", OPT_OFFSET(perfmgr_sweep_time_s), opts_parse_uint16, NULL, 0 },
+	{ "perfmgr_max_outstanding_queries", OPT_OFFSET(perfmgr_max_outstanding_queries), opts_parse_uint32, NULL, 0 },
+	{ "perfmgr_ignore_cas", OPT_OFFSET(perfmgr_ignore_cas), opts_parse_boolean, NULL, 0 },
+	{ "event_db_dump_file", OPT_OFFSET(event_db_dump_file), opts_parse_charp, NULL, 0 },
+	{ "perfmgr_rm_nodes", OPT_OFFSET(perfmgr_rm_nodes), opts_parse_boolean, NULL, 0 },
+	{ "perfmgr_log_errors", OPT_OFFSET(perfmgr_log_errors), opts_parse_boolean, NULL, 0 },
+#endif				/* ENABLE_OSM_PERF_MGR */
+	{ "event_plugin_name", OPT_OFFSET(event_plugin_name), opts_parse_charp, NULL, 0 },
+	{ "event_plugin_options", OPT_OFFSET(event_plugin_options), opts_parse_charp, NULL, 0 },
+	{ "node_name_map_name", OPT_OFFSET(node_name_map_name), opts_parse_charp, NULL, 0 },
+	{ "qos_max_vls", OPT_OFFSET(qos_options.max_vls), opts_parse_uint32, NULL, 1 },
+	{ "qos_high_limit", OPT_OFFSET(qos_options.high_limit), opts_parse_int32, NULL, 1 },
+	{ "qos_vlarb_high", OPT_OFFSET(qos_options.vlarb_high), opts_parse_charp, NULL, 1 },
+	{ "qos_vlarb_low", OPT_OFFSET(qos_options.vlarb_low), opts_parse_charp, NULL, 1 },
+	{ "qos_sl2vl", OPT_OFFSET(qos_options.sl2vl), opts_parse_charp, NULL, 1 },
+	{ "qos_ca_max_vls", OPT_OFFSET(qos_ca_options.max_vls), opts_parse_uint32, NULL, 1 },
+	{ "qos_ca_high_limit", OPT_OFFSET(qos_ca_options.high_limit), opts_parse_int32, NULL, 1 },
+	{ "qos_ca_vlarb_high", OPT_OFFSET(qos_ca_options.vlarb_high), opts_parse_charp, NULL, 1 },
+	{ "qos_ca_vlarb_low", OPT_OFFSET(qos_ca_options.vlarb_low), opts_parse_charp, NULL, 1 },
+	{ "qos_ca_sl2vl", OPT_OFFSET(qos_ca_options.sl2vl), opts_parse_charp, NULL, 1 },
+	{ "qos_sw0_max_vls", OPT_OFFSET(qos_sw0_options.max_vls), opts_parse_uint32, NULL, 1 },
+	{ "qos_sw0_high_limit", OPT_OFFSET(qos_sw0_options.high_limit), opts_parse_int32, NULL, 1 },
+	{ "qos_sw0_vlarb_high", OPT_OFFSET(qos_sw0_options.vlarb_high), opts_parse_charp, NULL, 1 },
+	{ "qos_sw0_vlarb_low", OPT_OFFSET(qos_sw0_options.vlarb_low), opts_parse_charp, NULL, 1 },
+	{ "qos_sw0_sl2vl", OPT_OFFSET(qos_sw0_options.sl2vl), opts_parse_charp, NULL, 1 },
+	{ "qos_swe_max_vls", OPT_OFFSET(qos_swe_options.max_vls), opts_parse_uint32, NULL, 1 },
+	{ "qos_swe_high_limit", OPT_OFFSET(qos_swe_options.high_limit), opts_parse_int32, NULL, 1 },
+	{ "qos_swe_vlarb_high", OPT_OFFSET(qos_swe_options.vlarb_high), opts_parse_charp, NULL, 1 },
+	{ "qos_swe_vlarb_low", OPT_OFFSET(qos_swe_options.vlarb_low), opts_parse_charp, NULL, 1 },
+	{ "qos_swe_sl2vl", OPT_OFFSET(qos_swe_options.sl2vl), opts_parse_charp, NULL, 1 },
+	{ "qos_rtr_max_vls", OPT_OFFSET(qos_rtr_options.max_vls), opts_parse_uint32, NULL, 1 },
+	{ "qos_rtr_high_limit", OPT_OFFSET(qos_rtr_options.high_limit), opts_parse_int32, NULL, 1 },
+	{ "qos_rtr_vlarb_high", OPT_OFFSET(qos_rtr_options.vlarb_high), opts_parse_charp, NULL, 1 },
+	{ "qos_rtr_vlarb_low", OPT_OFFSET(qos_rtr_options.vlarb_low), opts_parse_charp, NULL, 1 },
+	{ "qos_rtr_sl2vl", OPT_OFFSET(qos_rtr_options.sl2vl), opts_parse_charp, NULL, 1 },
+	{ "congestion_control", OPT_OFFSET(congestion_control), opts_parse_boolean, NULL, 1 },
+	{ "cc_key", OPT_OFFSET(cc_key), opts_parse_net64, NULL, 0},
+	{ "cc_max_outstanding_mads", OPT_OFFSET(cc_max_outstanding_mads), opts_parse_uint32, NULL, 0 },
+	{ "cc_sw_cong_setting_control_map", OPT_OFFSET(cc_sw_cong_setting_control_map), opts_parse_net32, NULL, 1},
+	{ "cc_sw_cong_setting_victim_mask", OPT_OFFSET(cc_sw_cong_setting_victim_mask), opts_parse_256bit, NULL, 1},
+	{ "cc_sw_cong_setting_credit_mask", OPT_OFFSET(cc_sw_cong_setting_credit_mask), opts_parse_256bit, NULL, 1},
+	{ "cc_sw_cong_setting_threshold", OPT_OFFSET(cc_sw_cong_setting_threshold), opts_parse_uint8, NULL, 1},
+	{ "cc_sw_cong_setting_packet_size", OPT_OFFSET(cc_sw_cong_setting_packet_size), opts_parse_uint8, NULL, 1},
+	{ "cc_sw_cong_setting_credit_starvation_threshold", OPT_OFFSET(cc_sw_cong_setting_credit_starvation_threshold), opts_parse_uint8, NULL, 1},
+	{ "cc_sw_cong_setting_credit_starvation_return_delay", OPT_OFFSET(cc_sw_cong_setting_credit_starvation_return_delay), opts_parse_cct_entry, NULL, 1},
+	{ "cc_sw_cong_setting_marking_rate", OPT_OFFSET(cc_sw_cong_setting_marking_rate), opts_parse_net16, NULL, 1},
+	{ "cc_ca_cong_setting_port_control", OPT_OFFSET(cc_ca_cong_setting_port_control), opts_parse_net16, NULL, 1},
+	{ "cc_ca_cong_setting_control_map", OPT_OFFSET(cc_ca_cong_setting_control_map), opts_parse_net16, NULL, 1},
+	{ "cc_ca_cong_setting_ccti_timer", OPT_OFFSET(cc_ca_cong_entries), opts_parse_ccti_timer, NULL, 1},
+	{ "cc_ca_cong_setting_ccti_increase", OPT_OFFSET(cc_ca_cong_entries), opts_parse_ccti_increase, NULL, 1},
+	{ "cc_ca_cong_setting_trigger_threshold", OPT_OFFSET(cc_ca_cong_entries), opts_parse_trigger_threshold, NULL, 1},
+	{ "cc_ca_cong_setting_ccti_min", OPT_OFFSET(cc_ca_cong_entries), opts_parse_ccti_min, NULL, 1},
+	{ "cc_cct", OPT_OFFSET(cc_cct), opts_parse_cc_cct, NULL, 1},
+	{ "enable_quirks", OPT_OFFSET(enable_quirks), opts_parse_boolean, NULL, 1 },
+	{ "no_clients_rereg", OPT_OFFSET(no_clients_rereg), opts_parse_boolean, NULL, 1 },
+	{ "prefix_routes_file", OPT_OFFSET(prefix_routes_file), opts_parse_charp, NULL, 0 },
+	{ "consolidate_ipv6_snm_req", OPT_OFFSET(consolidate_ipv6_snm_req), opts_parse_boolean, NULL, 1 },
+	{ "lash_start_vl", OPT_OFFSET(lash_start_vl), opts_parse_uint8, NULL, 1 },
+	{ "sm_sl", OPT_OFFSET(sm_sl), opts_parse_uint8, NULL, 1 },
+	{ "log_prefix", OPT_OFFSET(log_prefix), opts_parse_charp, NULL, 1 },
+	{ "per_module_logging_file", OPT_OFFSET(per_module_logging_file), opts_parse_charp, NULL, 0 },
+	{0}
+};
+
+static int compar_mgids(const void *m1, const void *m2)
+{
+	return memcmp(m1, m2, sizeof(ib_gid_t));
+}
+
+static void subn_validate_g2m(osm_subn_t *p_subn)
+{
+	cl_qlist_t guids;
+	osm_db_guid_elem_t *p_item;
+	uint64_t mkey;
+	boolean_t valid_entry;
+
+	OSM_LOG_ENTER(&(p_subn->p_osm->log));
+	cl_qlist_init(&guids);
+
+	if (osm_db_guid2mkey_guids(p_subn->p_g2m, &guids)) {
+		OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR, "ERR 7506: "
+			"could not get mkey guid list\n");
+		goto Exit;
+	}
+
+	while ((p_item = (osm_db_guid_elem_t *) cl_qlist_remove_head(&guids))
+	       != (osm_db_guid_elem_t *) cl_qlist_end(&guids)) {
+		valid_entry = TRUE;
+
+		if (p_item->guid == 0) {
+			OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
+				"ERR 7507: found invalid zero guid");
+			valid_entry = FALSE;
+		} else if (osm_db_guid2mkey_get(p_subn->p_g2m, p_item->guid,
+						&mkey)) {
+			OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
+				"ERR 7508: could not get mkey for guid:0x%016"
+				PRIx64 "\n", p_item->guid);
+			valid_entry = FALSE;
+		}
+
+		if (valid_entry == FALSE) {
+			if (osm_db_guid2mkey_delete(p_subn->p_g2m,
+						    p_item->guid))
+				OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
+					"ERR 7509: failed to delete entry for "
+					"guid:0x%016" PRIx64 "\n",
+					p_item->guid);
+		}
+	}
+
+Exit:
+	OSM_LOG_EXIT(&(p_subn->p_osm->log));
+}
+
+static void subn_validate_neighbor(osm_subn_t *p_subn)
+{
+	cl_qlist_t entries;
+	osm_db_neighbor_elem_t *p_item;
+	boolean_t valid_entry;
+	uint64_t guid;
+	uint8_t port;
+
+	OSM_LOG_ENTER(&(p_subn->p_osm->log));
+	cl_qlist_init(&entries);
+
+	if (osm_db_neighbor_guids(p_subn->p_neighbor, &entries)) {
+		OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR, "ERR 7512: "
+			"could not get neighbor entry list\n");
+		goto Exit;
+	}
+
+	while ((p_item =
+		(osm_db_neighbor_elem_t *) cl_qlist_remove_head(&entries))
+	       != (osm_db_neighbor_elem_t *) cl_qlist_end(&entries)) {
+		valid_entry = TRUE;
+
+		OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_DEBUG,
+			"Validating neighbor for 0x%016" PRIx64 ", port %d\n",
+			p_item->guid, p_item->portnum);
+		if (p_item->guid == 0) {
+			OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
+				"ERR 7513: found invalid zero guid\n");
+			valid_entry = FALSE;
+		} else if (p_item->portnum == 0) {
+			OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
+				"ERR 7514: found invalid zero port\n");
+			valid_entry = FALSE;
+		} else if (osm_db_neighbor_get(p_subn->p_neighbor,
+					       p_item->guid, p_item->portnum,
+					       &guid, &port)) {
+			OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
+				"ERR 7515: could not find neighbor for "
+				"guid: 0x%016" PRIx64 "\n", p_item->guid);
+			valid_entry = FALSE;
+		} else if (guid == 0) {
+			OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
+				"ERR 7516: found invalid neighbor "
+				"zero guid");
+			valid_entry = FALSE;
+		} else if (port == 0) {
+			OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
+				"ERR 7517: found invalid neighbor "
+				"zero port\n");
+			valid_entry = FALSE;
+		} else if (osm_db_neighbor_get(p_subn->p_neighbor,
+					       guid, port, &guid, &port) ||
+			guid != p_item->guid || port != p_item->portnum) {
+			OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
+				"ERR 7518: neighbor does not point "
+				"back at us\n");
+			valid_entry = FALSE;
+		}
+
+		if (valid_entry == FALSE) {
+			if (osm_db_neighbor_delete(p_subn->p_neighbor,
+						   p_item->guid,
+						   p_item->portnum))
+				OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
+					"ERR 7519: failed to delete entry for "
+					"guid:0x%016" PRIx64 " port:%u\n",
+					p_item->guid, p_item->portnum);
+		}
+	}
+
+Exit:
+	OSM_LOG_EXIT(&(p_subn->p_osm->log));
+}
+
+void osm_subn_construct(IN osm_subn_t * p_subn)
 {
 	memset(p_subn, 0, sizeof(*p_subn));
 	cl_ptr_vector_construct(&p_subn->port_lid_tbl);
 	cl_qmap_init(&p_subn->sw_guid_tbl);
 	cl_qmap_init(&p_subn->node_guid_tbl);
 	cl_qmap_init(&p_subn->port_guid_tbl);
+	cl_qmap_init(&p_subn->alias_port_guid_tbl);
+	cl_qmap_init(&p_subn->assigned_guids_tbl);
 	cl_qmap_init(&p_subn->sm_guid_tbl);
 	cl_qlist_init(&p_subn->sa_sr_list);
 	cl_qlist_init(&p_subn->sa_infr_list);
+	cl_qlist_init(&p_subn->alias_guid_list);
 	cl_qlist_init(&p_subn->prefix_routes_list);
 	cl_qmap_init(&p_subn->rtr_guid_tbl);
 	cl_qmap_init(&p_subn->prtn_pkey_tbl);
+	cl_fmap_init(&p_subn->mgrp_mgid_tbl, compar_mgids);
+}
+
+static void subn_destroy_qos_options(osm_qos_options_t *opt)
+{
+	free(opt->vlarb_high);
+	free(opt->vlarb_low);
+	free(opt->sl2vl);
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_subn_destroy(IN osm_subn_t * const p_subn)
+static void subn_opt_destroy(IN osm_subn_opt_t * p_opt)
+{
+	free(p_opt->console);
+	free(p_opt->port_prof_ignore_file);
+	free(p_opt->hop_weights_file);
+	free(p_opt->port_search_ordering_file);
+	free(p_opt->routing_engine_names);
+	free(p_opt->log_file);
+	free(p_opt->partition_config_file);
+	free(p_opt->qos_policy_file);
+	free(p_opt->dump_files_dir);
+	free(p_opt->part_enforce);
+	free(p_opt->lid_matrix_dump_file);
+	free(p_opt->lfts_file);
+	free(p_opt->root_guid_file);
+	free(p_opt->cn_guid_file);
+	free(p_opt->io_guid_file);
+	free(p_opt->ids_guid_file);
+	free(p_opt->guid_routing_order_file);
+	free(p_opt->sa_db_file);
+	free(p_opt->torus_conf_file);
+#ifdef ENABLE_OSM_PERF_MGR
+	free(p_opt->event_db_dump_file);
+#endif /* ENABLE_OSM_PERF_MGR */
+	free(p_opt->event_plugin_name);
+	free(p_opt->event_plugin_options);
+	free(p_opt->node_name_map_name);
+	free(p_opt->prefix_routes_file);
+	free(p_opt->log_prefix);
+	subn_destroy_qos_options(&p_opt->qos_options);
+	subn_destroy_qos_options(&p_opt->qos_ca_options);
+	subn_destroy_qos_options(&p_opt->qos_sw0_options);
+	subn_destroy_qos_options(&p_opt->qos_swe_options);
+	subn_destroy_qos_options(&p_opt->qos_rtr_options);
+	free(p_opt->cc_cct.input_str);
+}
+
+void osm_subn_destroy(IN osm_subn_t * p_subn)
 {
 	int i;
 	osm_node_t *p_node, *p_next_node;
+	osm_assigned_guids_t *p_assigned_guids, *p_next_assigned_guids;
+	osm_alias_guid_t *p_alias_guid, *p_next_alias_guid;
 	osm_port_t *p_port, *p_next_port;
 	osm_switch_t *p_sw, *p_next_sw;
 	osm_remote_sm_t *p_rsm, *p_next_rsm;
 	osm_prtn_t *p_prtn, *p_next_prtn;
-	osm_mgrp_t *p_mgrp;
 	osm_infr_t *p_infr, *p_next_infr;
+	osm_svcr_t *p_svcr, *p_next_svcr;
 
 	/* it might be a good idea to de-allocate all known objects */
 	p_next_node = (osm_node_t *) cl_qmap_head(&p_subn->node_guid_tbl);
@@ -110,6 +1051,25 @@ void osm_subn_destroy(IN osm_subn_t * const p_subn)
 		osm_node_delete(&p_node);
 	}
 
+	p_next_assigned_guids = (osm_assigned_guids_t *) cl_qmap_head(&p_subn->assigned_guids_tbl);
+	while (p_next_assigned_guids !=
+	       (osm_assigned_guids_t *) cl_qmap_end(&p_subn->assigned_guids_tbl)) {
+		p_assigned_guids = p_next_assigned_guids;
+		p_next_assigned_guids = (osm_assigned_guids_t *) cl_qmap_next(&p_assigned_guids->map_item);
+		osm_assigned_guids_delete(&p_assigned_guids);
+	}
+
+	p_next_alias_guid = (osm_alias_guid_t *) cl_qmap_head(&p_subn->alias_port_guid_tbl);
+	while (p_next_alias_guid !=
+	       (osm_alias_guid_t *) cl_qmap_end(&p_subn->alias_port_guid_tbl)) {
+		p_alias_guid = p_next_alias_guid;
+		p_next_alias_guid = (osm_alias_guid_t *) cl_qmap_next(&p_alias_guid->map_item);
+		osm_alias_guid_delete(&p_alias_guid);
+	}
+
+	while (cl_qlist_count(&p_subn->alias_guid_list))
+		osm_guid_work_obj_delete((osm_guidinfo_work_obj_t *) cl_qlist_remove_head(&p_subn->alias_guid_list));
+
 	p_next_port = (osm_port_t *) cl_qmap_head(&p_subn->port_guid_tbl);
 	while (p_next_port !=
 	       (osm_port_t *) cl_qmap_end(&p_subn->port_guid_tbl)) {
@@ -138,16 +1098,15 @@ void osm_subn_destroy(IN osm_subn_t * const p_subn)
 	       (osm_prtn_t *) cl_qmap_end(&p_subn->prtn_pkey_tbl)) {
 		p_prtn = p_next_prtn;
 		p_next_prtn = (osm_prtn_t *) cl_qmap_next(&p_prtn->map_item);
-		osm_prtn_delete(&p_prtn);
+		osm_prtn_delete(p_subn, &p_prtn);
 	}
 
+	cl_fmap_remove_all(&p_subn->mgrp_mgid_tbl);
+
 	for (i = 0; i <= p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO;
-	     i++) {
-		p_mgrp = p_subn->mgroups[i];
-		p_subn->mgroups[i] = NULL;
-		if (p_mgrp)
-			osm_mgrp_delete(p_mgrp);
-	}
+	     i++)
+		if (p_subn->mboxes[i])
+			osm_mgrp_box_delete(p_subn->mboxes[i]);
 
 	p_next_infr = (osm_infr_t *) cl_qlist_head(&p_subn->sa_infr_list);
 	while (p_next_infr !=
@@ -157,6 +1116,14 @@ void osm_subn_destroy(IN osm_subn_t * const p_subn)
 		osm_infr_delete(p_infr);
 	}
 
+	p_next_svcr = (osm_svcr_t *) cl_qlist_head(&p_subn->sa_sr_list);
+	while (p_next_svcr !=
+	       (osm_svcr_t *) cl_qlist_end(&p_subn->sa_sr_list)) {
+		p_svcr = p_next_svcr;
+		p_next_svcr = (osm_svcr_t *) cl_qlist_next(&p_svcr->list_item);
+		osm_svcr_delete(p_svcr);
+	}
+
 	cl_ptr_vector_destroy(&p_subn->port_lid_tbl);
 
 	osm_qos_policy_destroy(p_subn->p_qos_policy);
@@ -165,14 +1132,13 @@ void osm_subn_destroy(IN osm_subn_t * const p_subn)
 		cl_list_item_t *item = cl_qlist_remove_head(&p_subn->prefix_routes_list);
 		free(item);
 	}
+
+	subn_opt_destroy(&p_subn->opt);
+	free(p_subn->opt.file_opts);
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_subn_init(IN osm_subn_t * const p_subn,
-	      IN osm_opensm_t * const p_osm,
-	      IN const osm_subn_opt_t * const p_opt)
+ib_api_status_t osm_subn_init(IN osm_subn_t * p_subn, IN osm_opensm_t * p_osm,
+			      IN const osm_subn_opt_t * p_opt)
 {
 	cl_status_t status;
 
@@ -182,12 +1148,12 @@ osm_subn_init(IN osm_subn_t * const p_subn,
 				    OSM_SUBNET_VECTOR_MIN_SIZE,
 				    OSM_SUBNET_VECTOR_GROW_SIZE);
 	if (status != CL_SUCCESS)
-		return (status);
+		return status;
 
 	status = cl_ptr_vector_set_capacity(&p_subn->port_lid_tbl,
 					    OSM_SUBNET_VECTOR_CAPACITY);
 	if (status != CL_SUCCESS)
-		return (status);
+		return status;
 
 	/*
 	   LID zero is not valid.  NULL out this entry for the
@@ -200,130 +1166,124 @@ osm_subn_init(IN osm_subn_t * const p_subn,
 	p_subn->max_mcast_lid_ho = IB_LID_MCAST_END_HO;
 	p_subn->min_ca_mtu = IB_MAX_MTU;
 	p_subn->min_ca_rate = IB_MAX_RATE;
+	p_subn->min_data_vls = IB_MAX_NUM_VLS - 1;
 	p_subn->ignore_existing_lfts = TRUE;
 
 	/* we assume master by default - so we only need to set it true if STANDBY */
 	p_subn->coming_out_of_standby = FALSE;
+	p_subn->sweeping_enabled = TRUE;
+	p_subn->last_sm_port_state = 1;
+
+	/* Initialize the guid2mkey database */
+	p_subn->p_g2m = osm_db_domain_init(&(p_osm->db), "guid2mkey");
+	if (!p_subn->p_g2m) {
+		OSM_LOG(&(p_osm->log), OSM_LOG_ERROR, "ERR 7510: "
+			"Error initializing Guid-to-MKey persistent database\n");
+		return IB_ERROR;
+	}
 
-	return (IB_SUCCESS);
-}
+	if (osm_db_restore(p_subn->p_g2m)) {
+#ifndef __WIN__
+		/*
+		 * When Windows is BSODing, it might corrupt files that
+		 * were previously opened for writing, even if the files
+		 * are closed, so we might see corrupted guid2mkey file.
+		 */
+		if (p_subn->opt.exit_on_fatal) {
+			osm_log(&(p_osm->log), OSM_LOG_SYS,
+				"FATAL: Error restoring Guid-to-Mkey "
+				"persistent database\n");
+			return IB_ERROR;
+		} else
+#endif
+			OSM_LOG(&(p_osm->log), OSM_LOG_ERROR,
+				"ERR 7511: Error restoring Guid-to-Mkey "
+				"persistent database\n");
+	}
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_get_gid_by_mad_addr(IN osm_log_t * p_log,
-			IN const osm_subn_t * p_subn,
-			IN const osm_mad_addr_t * p_mad_addr,
-			OUT ib_gid_t * p_gid)
-{
-	const cl_ptr_vector_t *p_tbl;
-	const osm_port_t *p_port = NULL;
+	subn_validate_g2m(p_subn);
 
-	if (p_gid == NULL) {
-		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 7505: "
-			"Provided output GID is NULL\n");
-		return (IB_INVALID_PARAMETER);
+	/* Initialize the neighbor database */
+	p_subn->p_neighbor = osm_db_domain_init(&(p_osm->db), "neighbors");
+	if (!p_subn->p_neighbor) {
+		OSM_LOG(&(p_osm->log), OSM_LOG_ERROR, "ERR 7520: Error "
+			"initializing neighbor link persistent database\n");
+		return IB_ERROR;
 	}
 
-	/* Find the port gid of the request in the subnet */
-	p_tbl = &p_subn->port_lid_tbl;
+	if (osm_db_restore(p_subn->p_neighbor)) {
+#ifndef __WIN__
+		/*
+		 * When Windows is BSODing, it might corrupt files that
+		 * were previously opened for writing, even if the files
+		 * are closed, so we might see corrupted neighbors file.
+		 */
+		if (p_subn->opt.exit_on_fatal) {
+			osm_log(&(p_osm->log), OSM_LOG_SYS,
+				"FATAL: Error restoring neighbor link "
+				"persistent database\n");
+			return IB_ERROR;
+		} else
+#endif
+			OSM_LOG(&(p_osm->log), OSM_LOG_ERROR,
+				"ERR 7521: Error restoring neighbor link "
+				"persistent database\n");
+	}
 
-	CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000);
+	subn_validate_neighbor(p_subn);
 
-	if ((uint16_t) cl_ptr_vector_get_size(p_tbl) >
-	    cl_ntoh16(p_mad_addr->dest_lid)) {
-		p_port =
-		    cl_ptr_vector_get(p_tbl, cl_ntoh16(p_mad_addr->dest_lid));
-		if (p_port == NULL) {
-			OSM_LOG(p_log, OSM_LOG_DEBUG,
-				"Did not find any port with LID: %u\n",
-				cl_ntoh16(p_mad_addr->dest_lid));
-			return (IB_INVALID_PARAMETER);
-		}
-		p_gid->unicast.interface_id = p_port->p_physp->port_guid;
-		p_gid->unicast.prefix = p_subn->opt.subnet_prefix;
-	} else {
-		/* The dest_lid is not in the subnet table - this is an error */
-		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 7501: "
-			"LID is out of range: %u\n",
+	return IB_SUCCESS;
+}
+
+osm_port_t *osm_get_port_by_mad_addr(IN osm_log_t * p_log,
+				     IN const osm_subn_t * p_subn,
+				     IN osm_mad_addr_t * p_mad_addr)
+{
+	osm_port_t *port = osm_get_port_by_lid(p_subn, p_mad_addr->dest_lid);
+	if (!port)
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 7504: "
+			"Lid is out of range: %u\n",
 			cl_ntoh16(p_mad_addr->dest_lid));
-		return (IB_INVALID_PARAMETER);
-	}
 
-	return (IB_SUCCESS);
+	return port;
 }
 
-/**********************************************************************
- **********************************************************************/
-osm_physp_t *osm_get_physp_by_mad_addr(IN osm_log_t * p_log,
-				       IN const osm_subn_t * p_subn,
-				       IN osm_mad_addr_t * p_mad_addr)
+ib_api_status_t osm_get_gid_by_mad_addr(IN osm_log_t * p_log,
+					IN const osm_subn_t * p_subn,
+					IN osm_mad_addr_t * p_mad_addr,
+					OUT ib_gid_t * p_gid)
 {
-	const cl_ptr_vector_t *p_port_lid_tbl;
-	osm_port_t *p_port = NULL;
-	osm_physp_t *p_physp = NULL;
+	const osm_port_t *p_port;
 
-	/* Find the port gid of the request in the subnet */
-	p_port_lid_tbl = &p_subn->port_lid_tbl;
+	if (p_gid == NULL) {
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 7505: "
+			"Provided output GID is NULL\n");
+		return IB_INVALID_PARAMETER;
+	}
 
-	CL_ASSERT(cl_ptr_vector_get_size(p_port_lid_tbl) < 0x10000);
+	p_port = osm_get_port_by_mad_addr(p_log, p_subn, p_mad_addr);
+	if (!p_port)
+		return IB_INVALID_PARAMETER;
 
-	if ((uint16_t) cl_ptr_vector_get_size(p_port_lid_tbl) >
-	    cl_ntoh16(p_mad_addr->dest_lid)) {
-		p_port =
-		    cl_ptr_vector_get(p_port_lid_tbl,
-				      cl_ntoh16(p_mad_addr->dest_lid));
-		if (p_port == NULL) {
-			/* The port is not in the port_lid table - this is an error */
-			OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 7502: "
-				"Cannot locate port object by lid: %u\n",
-				cl_ntoh16(p_mad_addr->dest_lid));
+	p_gid->unicast.interface_id = p_port->p_physp->port_guid;
+	p_gid->unicast.prefix = p_subn->opt.subnet_prefix;
 
-			goto Exit;
-		}
-		p_physp = p_port->p_physp;
-	} else {
-		/* The dest_lid is not in the subnet table - this is an error */
-		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 7503: "
-			"Lid is out of range: %u\n",
-			cl_ntoh16(p_mad_addr->dest_lid));
-	}
-
-Exit:
-	return p_physp;
+	return IB_SUCCESS;
 }
 
-/**********************************************************************
- **********************************************************************/
-osm_port_t *osm_get_port_by_mad_addr(IN osm_log_t * p_log,
-				     IN const osm_subn_t * p_subn,
-				     IN osm_mad_addr_t * p_mad_addr)
+osm_physp_t *osm_get_physp_by_mad_addr(IN osm_log_t * p_log,
+				       IN const osm_subn_t * p_subn,
+				       IN osm_mad_addr_t * p_mad_addr)
 {
-	const cl_ptr_vector_t *p_port_lid_tbl;
-	osm_port_t *p_port = NULL;
-
-	/* Find the port gid of the request in the subnet */
-	p_port_lid_tbl = &p_subn->port_lid_tbl;
+	osm_port_t *p_port;
 
-	CL_ASSERT(cl_ptr_vector_get_size(p_port_lid_tbl) < 0x10000);
+	p_port = osm_get_port_by_mad_addr(p_log, p_subn, p_mad_addr);
+	if (!p_port)
+		return NULL;
 
-	if ((uint16_t) cl_ptr_vector_get_size(p_port_lid_tbl) >
-	    cl_ntoh16(p_mad_addr->dest_lid)) {
-		p_port =
-		    cl_ptr_vector_get(p_port_lid_tbl,
-				      cl_ntoh16(p_mad_addr->dest_lid));
-	} else {
-		/* The dest_lid is not in the subnet table - this is an error */
-		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 7504: "
-			"Lid is out of range: %u\n",
-			cl_ntoh16(p_mad_addr->dest_lid));
-	}
-
-	return p_port;
+	return p_port->p_physp;
 }
 
-/**********************************************************************
- **********************************************************************/
 osm_switch_t *osm_get_switch_by_guid(IN const osm_subn_t * p_subn,
 				     IN uint64_t guid)
 {
@@ -335,8 +1295,6 @@ osm_switch_t *osm_get_switch_by_guid(IN const osm_subn_t * p_subn,
 	return p_switch;
 }
 
-/**********************************************************************
- **********************************************************************/
 osm_node_t *osm_get_node_by_guid(IN osm_subn_t const *p_subn, IN uint64_t guid)
 {
 	osm_node_t *p_node;
@@ -347,8 +1305,6 @@ osm_node_t *osm_get_node_by_guid(IN osm_subn_t const *p_subn, IN uint64_t guid)
 	return p_node;
 }
 
-/**********************************************************************
- **********************************************************************/
 osm_port_t *osm_get_port_by_guid(IN osm_subn_t const *p_subn, IN ib_net64_t guid)
 {
 	osm_port_t *p_port;
@@ -359,29 +1315,104 @@ osm_port_t *osm_get_port_by_guid(IN osm_subn_t const *p_subn, IN ib_net64_t guid
 	return p_port;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void subn_set_default_qos_options(IN osm_qos_options_t * opt)
+osm_alias_guid_t *osm_get_alias_guid_by_guid(IN osm_subn_t const *p_subn,
+					     IN ib_net64_t guid)
+{
+	osm_alias_guid_t *p_alias_guid;
+
+	p_alias_guid = (osm_alias_guid_t *) cl_qmap_get(&(p_subn->alias_port_guid_tbl), guid);
+	if (p_alias_guid == (osm_alias_guid_t *) cl_qmap_end(&(p_subn->alias_port_guid_tbl)))
+		return NULL;
+	return p_alias_guid;
+}
+
+osm_port_t *osm_get_port_by_alias_guid(IN osm_subn_t const *p_subn,
+				       IN ib_net64_t guid)
+{
+	osm_alias_guid_t *p_alias_guid;
+
+	p_alias_guid = osm_get_alias_guid_by_guid(p_subn, guid);
+	if (!p_alias_guid)
+		return NULL;
+	return p_alias_guid->p_base_port;
+}
+
+osm_assigned_guids_t *osm_assigned_guids_new(IN const ib_net64_t port_guid,
+					     IN const uint32_t num_guids)
+{
+	osm_assigned_guids_t *p_assigned_guids;
+
+	p_assigned_guids = calloc(1, sizeof(*p_assigned_guids) +
+				     sizeof(ib_net64_t) * (num_guids - 1));
+	if (p_assigned_guids)
+		p_assigned_guids->port_guid = port_guid;
+	return p_assigned_guids;
+}
+
+void osm_assigned_guids_delete(IN OUT osm_assigned_guids_t ** pp_assigned_guids)
+{
+	free(*pp_assigned_guids);
+	*pp_assigned_guids = NULL;
+}
+
+osm_assigned_guids_t *osm_get_assigned_guids_by_guid(IN osm_subn_t const *p_subn,
+						     IN ib_net64_t port_guid)
+{
+	osm_assigned_guids_t *p_assigned_guids;
+
+	p_assigned_guids = (osm_assigned_guids_t *) cl_qmap_get(&(p_subn->assigned_guids_tbl), port_guid);
+	if (p_assigned_guids == (osm_assigned_guids_t *) cl_qmap_end(&(p_subn->assigned_guids_tbl)))
+		return NULL;
+	return p_assigned_guids;
+}
+
+osm_port_t *osm_get_port_by_lid_ho(IN osm_subn_t const * subn, IN uint16_t lid)
+{
+	if (lid < cl_ptr_vector_get_size(&subn->port_lid_tbl))
+		return cl_ptr_vector_get(&subn->port_lid_tbl, lid);
+	return NULL;
+}
+
+osm_mgrp_t *osm_get_mgrp_by_mgid(IN osm_subn_t * subn, IN ib_gid_t * mgid)
+{
+	osm_mgrp_t *mgrp;
+
+	mgrp = (osm_mgrp_t *)cl_fmap_get(&subn->mgrp_mgid_tbl, mgid);
+	if (mgrp != (osm_mgrp_t *)cl_fmap_end(&subn->mgrp_mgid_tbl))
+		return mgrp;
+	return NULL;
+}
+
+int is_mlnx_ext_port_info_supported(ib_net16_t devid)
 {
-	opt->max_vls = OSM_DEFAULT_QOS_MAX_VLS;
-	opt->high_limit = OSM_DEFAULT_QOS_HIGH_LIMIT;
-	opt->vlarb_high = OSM_DEFAULT_QOS_VLARB_HIGH;
-	opt->vlarb_low = OSM_DEFAULT_QOS_VLARB_LOW;
-	opt->sl2vl = OSM_DEFAULT_QOS_SL2VL;
+	uint16_t devid_ho;
+
+	devid_ho = cl_ntoh16(devid);
+	if (devid_ho == 0xc738)
+		return 1;
+	if (devid_ho >= 0x1003 && devid_ho <= 0x1011)
+		return 1;
+	return 0;
 }
 
-static void subn_init_qos_options(IN osm_qos_options_t * opt)
+static void subn_init_qos_options(osm_qos_options_t *opt, osm_qos_options_t *f)
 {
 	opt->max_vls = 0;
 	opt->high_limit = -1;
+	if (opt->vlarb_high)
+		free(opt->vlarb_high);
 	opt->vlarb_high = NULL;
+	if (opt->vlarb_low)
+		free(opt->vlarb_low);
 	opt->vlarb_low = NULL;
+	if (opt->sl2vl)
+		free(opt->sl2vl);
 	opt->sl2vl = NULL;
+	if (f)
+		memcpy(f, opt, sizeof(*f));
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_subn_set_default_opt(IN osm_subn_opt_t * const p_opt)
+void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt)
 {
 	memset(p_opt, 0, sizeof(osm_subn_opt_t));
 	p_opt->guid = 0;
@@ -390,11 +1421,16 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * const p_opt)
 	p_opt->sa_key = OSM_DEFAULT_SA_KEY;
 	p_opt->subnet_prefix = IB_DEFAULT_SUBNET_PREFIX;
 	p_opt->m_key_lease_period = 0;
+	p_opt->m_key_protect_bits = 0;
 	p_opt->sweep_interval = OSM_DEFAULT_SWEEP_INTERVAL_SECS;
 	p_opt->max_wire_smps = OSM_DEFAULT_SMP_MAX_ON_WIRE;
-	p_opt->console = OSM_DEFAULT_CONSOLE;
+	p_opt->max_wire_smps2 = p_opt->max_wire_smps;
+	p_opt->console = strdup(OSM_DEFAULT_CONSOLE);
 	p_opt->console_port = OSM_DEFAULT_CONSOLE_PORT;
 	p_opt->transaction_timeout = OSM_DEFAULT_TRANS_TIMEOUT_MILLISEC;
+	p_opt->transaction_retries = OSM_DEFAULT_RETRY_COUNT;
+	p_opt->max_smps_timeout = 1000 * p_opt->transaction_timeout *
+				  p_opt->transaction_retries;
 	/* by default we will consider waiting for 50x transaction timeout normal */
 	p_opt->max_msg_fifo_timeout = 50 * OSM_DEFAULT_TRANS_TIMEOUT_MILLISEC;
 	p_opt->sm_priority = OSM_DEFAULT_SM_PRIORITY;
@@ -402,6 +1438,8 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * const p_opt)
 	p_opt->lmc_esp0 = FALSE;
 	p_opt->max_op_vls = OSM_DEFAULT_MAX_OP_VLS;
 	p_opt->force_link_speed = 15;
+	p_opt->force_link_speed_ext = 31;
+	p_opt->fdr10 = 1;
 	p_opt->reassign_lids = FALSE;
 	p_opt->ignore_other_sm = FALSE;
 	p_opt->single_thread = FALSE;
@@ -416,6 +1454,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * const p_opt)
 	    OSM_DEFAULT_LEAF_HEAD_OF_QUEUE_LIFE;
 	p_opt->local_phy_errors_threshold = OSM_DEFAULT_ERROR_THRESHOLD;
 	p_opt->overrun_errors_threshold = OSM_DEFAULT_ERROR_THRESHOLD;
+	p_opt->use_mfttop = TRUE;
 	p_opt->sminfo_polling_timeout =
 	    OSM_SM_DEFAULT_POLLING_TIMEOUT_MILLISECS;
 	p_opt->polling_retry_number = OSM_SM_DEFAULT_POLLING_RETRY_NUMBER;
@@ -425,223 +1464,80 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * const p_opt)
 	p_opt->daemon = FALSE;
 	p_opt->sm_inactive = FALSE;
 	p_opt->babbling_port_policy = FALSE;
+	p_opt->use_optimized_slvl = FALSE;
 #ifdef ENABLE_OSM_PERF_MGR
 	p_opt->perfmgr = FALSE;
 	p_opt->perfmgr_redir = TRUE;
 	p_opt->perfmgr_sweep_time_s = OSM_PERFMGR_DEFAULT_SWEEP_TIME_S;
 	p_opt->perfmgr_max_outstanding_queries =
 	    OSM_PERFMGR_DEFAULT_MAX_OUTSTANDING_QUERIES;
+	p_opt->perfmgr_ignore_cas = FALSE;
 	p_opt->event_db_dump_file = NULL; /* use default */
+	p_opt->perfmgr_rm_nodes = TRUE;
+	p_opt->perfmgr_log_errors = TRUE;
 #endif				/* ENABLE_OSM_PERF_MGR */
 
 	p_opt->event_plugin_name = NULL;
+	p_opt->event_plugin_options = NULL;
 	p_opt->node_name_map_name = NULL;
-
-	p_opt->dump_files_dir = getenv("OSM_TMP_DIR");
-	if (!p_opt->dump_files_dir || !(*p_opt->dump_files_dir))
-		p_opt->dump_files_dir = OSM_DEFAULT_TMP_DIR;
-
-	p_opt->log_file = OSM_DEFAULT_LOG_FILE;
-	p_opt->log_max_size = 0;
-	p_opt->partition_config_file = OSM_DEFAULT_PARTITION_CONFIG_FILE;
-	p_opt->no_partition_enforcement = FALSE;
-	p_opt->qos = FALSE;
-	p_opt->qos_policy_file = OSM_DEFAULT_QOS_POLICY_FILE;
-	p_opt->accum_log_file = TRUE;
-	p_opt->port_prof_ignore_file = NULL;
-	p_opt->port_profile_switch_nodes = FALSE;
-	p_opt->sweep_on_trap = TRUE;
-	p_opt->use_ucast_cache = FALSE;
-	p_opt->routing_engine_names = NULL;
-	p_opt->connect_roots = FALSE;
-	p_opt->lid_matrix_dump_file = NULL;
-	p_opt->lfts_file = NULL;
-	p_opt->root_guid_file = NULL;
-	p_opt->cn_guid_file = NULL;
-	p_opt->ids_guid_file = NULL;
-	p_opt->guid_routing_order_file = NULL;
-	p_opt->sa_db_file = NULL;
-	p_opt->exit_on_fatal = TRUE;
-	p_opt->enable_quirks = FALSE;
-	p_opt->no_clients_rereg = FALSE;
-	p_opt->prefix_routes_file = OSM_DEFAULT_PREFIX_ROUTES_FILE;
-	p_opt->consolidate_ipv6_snm_req = FALSE;
-	subn_init_qos_options(&p_opt->qos_options);
-	subn_init_qos_options(&p_opt->qos_ca_options);
-	subn_init_qos_options(&p_opt->qos_sw0_options);
-	subn_init_qos_options(&p_opt->qos_swe_options);
-	subn_init_qos_options(&p_opt->qos_rtr_options);
-}
-
-/**********************************************************************
- **********************************************************************/
-static void log_report(const char *fmt, ...)
-{
-	char buf[128];
-	va_list args;
-	va_start(args, fmt);
-	vsnprintf(buf, sizeof(buf), fmt, args);
-	va_end(args);
-	printf(buf);
-	cl_log_event("OpenSM", CL_LOG_INFO, buf, NULL, 0);
-}
-
-static void log_config_value(char *name, const char *fmt, ...)
-{
-	char buf[128];
-	va_list args;
-	unsigned n;
-	va_start(args, fmt);
-	n = snprintf(buf, sizeof(buf), " Loading Cached Option:%s = ", name);
-	if (n > sizeof(buf))
-		n = sizeof(buf);
-	n += vsnprintf(buf + n, sizeof(buf) - n, fmt, args);
-	if (n > sizeof(buf))
-		n = sizeof(buf);
-	snprintf(buf + n, sizeof(buf) - n, "\n");
-	va_end(args);
-	printf(buf);
-	cl_log_event("OpenSM", CL_LOG_INFO, buf, NULL, 0);
-}
-
-static void
-opts_unpack_net64(IN char *p_req_key,
-		  IN char *p_key, IN char *p_val_str, IN uint64_t * p_val)
-{
-	if (!strcmp(p_req_key, p_key)) {
-		uint64_t val = strtoull(p_val_str, NULL, 0);
-		if (cl_hton64(val) != *p_val) {
-			log_config_value(p_key, "0x%016" PRIx64, val);
-			*p_val = cl_ntoh64(val);
-		}
-	}
-}
-
-/**********************************************************************
- **********************************************************************/
-static void
-opts_unpack_uint32(IN char *p_req_key,
-		   IN char *p_key, IN char *p_val_str, IN uint32_t * p_val)
-{
-	if (!strcmp(p_req_key, p_key)) {
-		uint32_t val = strtoul(p_val_str, NULL, 0);
-		if (val != *p_val) {
-			log_config_value(p_key, "%u", val);
-			*p_val = val;
-		}
-	}
-}
-
-/**********************************************************************
- **********************************************************************/
-static void
-opts_unpack_int32(IN char *p_req_key,
-		  IN char *p_key, IN char *p_val_str, IN int32_t * p_val)
-{
-	if (!strcmp(p_req_key, p_key)) {
-		int32_t val = strtol(p_val_str, NULL, 0);
-		if (val != *p_val) {
-			log_config_value(p_key, "%d", val);
-			*p_val = val;
-		}
-	}
-}
-
-/**********************************************************************
- **********************************************************************/
-static void
-opts_unpack_uint16(IN char *p_req_key,
-		   IN char *p_key, IN char *p_val_str, IN uint16_t * p_val)
-{
-	if (!strcmp(p_req_key, p_key)) {
-		uint16_t val = (uint16_t) strtoul(p_val_str, NULL, 0);
-		if (val != *p_val) {
-			log_config_value(p_key, "%u", val);
-			*p_val = val;
-		}
-	}
-}
-
-/**********************************************************************
- **********************************************************************/
-static void
-opts_unpack_net16(IN char *p_req_key,
-		  IN char *p_key, IN char *p_val_str, IN uint16_t * p_val)
-{
-	if (!strcmp(p_req_key, p_key)) {
-		uint32_t val;
-		val = strtoul(p_val_str, NULL, 0);
-		CL_ASSERT(val < 0x10000);
-		if (cl_hton32(val) != *p_val) {
-			log_config_value(p_key, "0x%04x", val);
-			*p_val = cl_hton16((uint16_t) val);
-		}
-	}
-}
-
-/**********************************************************************
- **********************************************************************/
-static void
-opts_unpack_uint8(IN char *p_req_key,
-		  IN char *p_key, IN char *p_val_str, IN uint8_t * p_val)
-{
-	if (!strcmp(p_req_key, p_key)) {
-		uint32_t val;
-		val = strtoul(p_val_str, NULL, 0);
-		CL_ASSERT(val < 0x100);
-		if (val != *p_val) {
-			log_config_value(p_key, "%u", val);
-			*p_val = (uint8_t) val;
-		}
-	}
-}
-
-/**********************************************************************
- **********************************************************************/
-static void
-opts_unpack_boolean(IN char *p_req_key,
-		    IN char *p_key, IN char *p_val_str, IN boolean_t * p_val)
-{
-	if (!strcmp(p_req_key, p_key) && p_val_str) {
-		boolean_t val;
-		if (strcmp("TRUE", p_val_str))
-			val = FALSE;
-		else
-			val = TRUE;
-
-		if (val != *p_val) {
-			log_config_value(p_key, "%s", p_val_str);
-			*p_val = val;
-		}
-	}
-}
-
-/**********************************************************************
- **********************************************************************/
-static void
-opts_unpack_charp(IN char *p_req_key,
-		  IN char *p_key, IN char *p_val_str, IN char **p_val)
-{
-	if (!strcmp(p_req_key, p_key) && p_val_str) {
-		const char *current_str = *p_val ? *p_val : null_str ;
-		if (strcmp(p_val_str, current_str)) {
-			log_config_value(p_key, "%s", p_val_str);
-			/* special case the "(null)" string */
-			if (strcmp(null_str, p_val_str) == 0) {
-				*p_val = NULL;
-			} else {
-				/*
-				  Ignore the possible memory leak here;
-				  the pointer may be to a static default.
-				*/
-				*p_val = strdup(p_val_str);
-			}
-		}
-	}
+
+	p_opt->dump_files_dir = getenv("OSM_TMP_DIR");
+	if (!p_opt->dump_files_dir || !(*p_opt->dump_files_dir))
+		p_opt->dump_files_dir = OSM_DEFAULT_TMP_DIR;
+	p_opt->dump_files_dir = strdup(p_opt->dump_files_dir);
+	p_opt->log_file = strdup(OSM_DEFAULT_LOG_FILE);
+	p_opt->log_max_size = 0;
+	p_opt->partition_config_file = strdup(OSM_DEFAULT_PARTITION_CONFIG_FILE);
+	p_opt->no_partition_enforcement = FALSE;
+	p_opt->part_enforce = strdup(OSM_PARTITION_ENFORCE_BOTH);
+	p_opt->allow_both_pkeys = FALSE;
+	p_opt->sm_assigned_guid = 0;
+	p_opt->qos = FALSE;
+	p_opt->qos_policy_file = strdup(OSM_DEFAULT_QOS_POLICY_FILE);
+	p_opt->accum_log_file = TRUE;
+	p_opt->port_prof_ignore_file = NULL;
+	p_opt->hop_weights_file = NULL;
+	p_opt->port_search_ordering_file = NULL;
+	p_opt->port_profile_switch_nodes = FALSE;
+	p_opt->sweep_on_trap = TRUE;
+	p_opt->use_ucast_cache = FALSE;
+	p_opt->routing_engine_names = NULL;
+	p_opt->connect_roots = FALSE;
+	p_opt->lid_matrix_dump_file = NULL;
+	p_opt->lfts_file = NULL;
+	p_opt->root_guid_file = NULL;
+	p_opt->cn_guid_file = NULL;
+	p_opt->io_guid_file = NULL;
+	p_opt->port_shifting = FALSE;
+	p_opt->scatter_ports = OSM_DEFAULT_SCATTER_PORTS;
+	p_opt->max_reverse_hops = 0;
+	p_opt->ids_guid_file = NULL;
+	p_opt->guid_routing_order_file = NULL;
+	p_opt->sa_db_file = NULL;
+	p_opt->sa_db_dump = FALSE;
+	p_opt->torus_conf_file = strdup(OSM_DEFAULT_TORUS_CONF_FILE);
+	p_opt->do_mesh_analysis = FALSE;
+	p_opt->exit_on_fatal = TRUE;
+	p_opt->congestion_control = FALSE;
+	p_opt->cc_key = OSM_DEFAULT_CC_KEY;
+	p_opt->cc_max_outstanding_mads = OSM_PERFMGR_DEFAULT_MAX_OUTSTANDING_QUERIES;
+	p_opt->enable_quirks = FALSE;
+	p_opt->no_clients_rereg = FALSE;
+	p_opt->prefix_routes_file = strdup(OSM_DEFAULT_PREFIX_ROUTES_FILE);
+	p_opt->consolidate_ipv6_snm_req = FALSE;
+	p_opt->lash_start_vl = 0;
+	p_opt->sm_sl = OSM_DEFAULT_SL;
+	p_opt->log_prefix = NULL;
+	p_opt->per_module_logging_file = strdup(OSM_DEFAULT_PER_MOD_LOGGING_CONF_FILE);
+	subn_init_qos_options(&p_opt->qos_options, NULL);
+	subn_init_qos_options(&p_opt->qos_ca_options, NULL);
+	subn_init_qos_options(&p_opt->qos_sw0_options, NULL);
+	subn_init_qos_options(&p_opt->qos_swe_options, NULL);
+	subn_init_qos_options(&p_opt->qos_rtr_options, NULL);
+	p_opt->cc_cct.entries_len = 0;
+	p_opt->cc_cct.input_str = NULL;
 }
 
-/**********************************************************************
- **********************************************************************/
 static char *clean_val(char *val)
 {
 	char *p = val;
@@ -659,36 +1555,13 @@ static char *clean_val(char *val)
 	/* clean quotas */
 	if ((*val == '\"' && *p == '\"') || (*val == '\'' && *p == '\'')) {
 		val++;
-		p--;
+		*p-- = '\0';
 	}
 	return val;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-subn_parse_qos_options(IN const char *prefix,
-		       IN char *p_key,
-		       IN char *p_val_str, IN osm_qos_options_t * opt)
-{
-	char name[256];
-
-	snprintf(name, sizeof(name), "%s_max_vls", prefix);
-	opts_unpack_uint32(name, p_key, p_val_str, &opt->max_vls);
-	snprintf(name, sizeof(name), "%s_high_limit", prefix);
-	opts_unpack_int32(name, p_key, p_val_str, &opt->high_limit);
-	snprintf(name, sizeof(name), "%s_vlarb_high", prefix);
-	opts_unpack_charp(name, p_key, p_val_str, &opt->vlarb_high);
-	snprintf(name, sizeof(name), "%s_vlarb_low", prefix);
-	opts_unpack_charp(name, p_key, p_val_str, &opt->vlarb_low);
-	snprintf(name, sizeof(name), "%s_sl2vl", prefix);
-	opts_unpack_charp(name, p_key, p_val_str, &opt->sl2vl);
-}
-
-static int
-subn_dump_qos_options(FILE * file,
-		      const char *set_name,
-		      const char *prefix, osm_qos_options_t * opt)
+static int subn_dump_qos_options(FILE * file, const char *set_name,
+				 const char *prefix, osm_qos_options_t * opt)
 {
 	return fprintf(file, "# %s\n"
 		       "%s_max_vls %u\n"
@@ -703,10 +1576,8 @@ subn_dump_qos_options(FILE * file,
 		       prefix, opt->vlarb_low, prefix, opt->sl2vl);
 }
 
-/**********************************************************************
- **********************************************************************/
-static ib_api_status_t
-append_prefix_route(IN osm_subn_t * const p_subn, uint64_t prefix, uint64_t guid)
+static ib_api_status_t append_prefix_route(IN osm_subn_t * p_subn,
+					   uint64_t prefix, uint64_t guid)
 {
 	osm_prefix_route_t *route;
 
@@ -722,8 +1593,7 @@ append_prefix_route(IN osm_subn_t * const p_subn, uint64_t prefix, uint64_t guid
 	return IB_SUCCESS;
 }
 
-static ib_api_status_t
-osm_parse_prefix_routes_file(IN osm_subn_t * const p_subn)
+static ib_api_status_t parse_prefix_routes_file(IN osm_subn_t * p_subn)
 {
 	osm_log_t *log = &p_subn->p_osm->log;
 	FILE *fp;
@@ -809,38 +1679,114 @@ osm_parse_prefix_routes_file(IN osm_subn_t * const p_subn)
 	return (errors == 0) ? IB_SUCCESS : IB_ERROR;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void subn_verify_max_vls(unsigned *max_vls, const char *prefix, unsigned dflt)
+static ib_api_status_t insert_per_module_debug(IN osm_subn_t * p_subn,
+					       char *mod_name,
+					       osm_log_level_t level)
+{
+	uint8_t index;
+
+	if (find_module_name(mod_name, &index)) {
+		OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR,
+			"Module name %s not found\n", mod_name);
+		return IB_ERROR;
+	}
+	osm_set_log_per_module(&p_subn->p_osm->log, index, level);
+	return IB_SUCCESS;
+}
+
+static ib_api_status_t parse_per_mod_logging_file(IN osm_subn_t * p_subn)
+{
+	osm_log_t *log = &p_subn->p_osm->log;
+	FILE *fp;
+	char buf[1024];
+	int line = 0;
+	int errors = 0;
+
+	osm_reset_log_per_module(log);
+
+	if (p_subn->opt.per_module_logging_file == NULL)
+		return IB_SUCCESS;
+
+	fp = fopen(p_subn->opt.per_module_logging_file, "r");
+	if (!fp) {
+		if (errno == ENOENT)
+			return IB_SUCCESS;
+
+		OSM_LOG(log, OSM_LOG_ERROR, "fopen(%s) failed: %s",
+			p_subn->opt.per_module_logging_file, strerror(errno));
+		return IB_ERROR;
+	}
+
+	while (fgets(buf, sizeof buf, fp) != NULL) {
+		char *p_mod_name, *p_level, *p_extra, *p_last;
+		osm_log_level_t level;
+
+		line++;
+		if (errors > 10)
+			break;
+
+		p_mod_name = strtok_r(buf, " =,\t\n", &p_last);
+		if (!p_mod_name)
+			continue; /* ignore blank lines */
+
+		if (*p_mod_name == '#')
+			continue; /* ignore comment lines */
+
+		p_level = strtok_r(NULL, " \t\n", &p_last);
+		if (!p_level) {
+			OSM_LOG(log, OSM_LOG_ERROR, "%s:%d: missing log level\n",
+				p_subn->opt.per_module_logging_file, line);
+			errors++;
+			continue;
+		}
+		p_extra = strtok_r(NULL, " \t\n", &p_last);
+		if (p_extra && *p_extra != '#') {
+			OSM_LOG(log, OSM_LOG_INFO, "%s:%d: extra tokens ignored\n",
+				p_subn->opt.per_module_logging_file, line);
+		}
+
+		level = strtoul(p_level, NULL, 0);
+		if (insert_per_module_debug(p_subn, p_mod_name, level) != IB_SUCCESS) {
+			errors++;
+			break;
+		}
+	}
+
+	fclose(fp);
+	return (errors == 0) ? IB_SUCCESS : IB_ERROR;
+}
+
+static void subn_verify_max_vls(unsigned *max_vls, const char *prefix)
 {
-	if (!(*max_vls) || *max_vls > 15) {
-		log_report(" Invalid Cached Option: %s_max_vls=%u: "
-			   "Using Default = %u\n", prefix, *max_vls, dflt);
-		*max_vls = dflt;
+	if (!*max_vls || *max_vls > 15) {
+		if (*max_vls)
+			log_report(" Invalid Cached Option: %s_max_vls=%u: "
+				   "Using Default = %u\n",
+				   prefix, *max_vls, OSM_DEFAULT_QOS_MAX_VLS);
+		*max_vls = 0;
 	}
 }
 
-static void subn_verify_high_limit(int *high_limit, const char *prefix, int dflt)
+static void subn_verify_high_limit(int *high_limit, const char *prefix)
 {
 	if (*high_limit < 0 || *high_limit > 255) {
-		log_report(" Invalid Cached Option: %s_high_limit=%d: "
-			   "Using Default: %d\n", prefix, *high_limit, dflt);
-		*high_limit = dflt;
+		if (*high_limit > 255)
+			log_report(" Invalid Cached Option: %s_high_limit=%d: "
+				   "Using Default: %d\n",
+				   prefix, *high_limit,
+				   OSM_DEFAULT_QOS_HIGH_LIMIT);
+		*high_limit = -1;
 	}
 }
 
 static void subn_verify_vlarb(char **vlarb, const char *prefix,
-			      const char *suffix, char *dflt)
+			      const char *suffix)
 {
 	char *str, *tok, *end, *ptr;
 	int count = 0;
 
-	if (*vlarb == NULL) {
-		log_report(" Invalid Cached Option: %s_vlarb_%s: "
-		"Using Default\n", prefix, suffix);
-		*vlarb = dflt;
+	if (*vlarb == NULL)
 		return;
-	}
 
 	str = strdup(*vlarb);
 
@@ -899,17 +1845,13 @@ static void subn_verify_vlarb(char **vlarb, const char *prefix,
 	free(str);
 }
 
-static void subn_verify_sl2vl(char **sl2vl, const char *prefix, char *dflt)
+static void subn_verify_sl2vl(char **sl2vl, const char *prefix)
 {
 	char *str, *tok, *end, *ptr;
 	int count = 0;
 
-	if (*sl2vl == NULL) {
-		log_report(" Invalid Cached Option: %s_sl2vl: Using Default\n",
-			   prefix);
-		*sl2vl = dflt;
+	if (*sl2vl == NULL)
 		return;
-	}
 
 	str = strdup(*sl2vl);
 
@@ -931,25 +1873,23 @@ static void subn_verify_sl2vl(char **sl2vl, const char *prefix, char *dflt)
 	if (count < 16)
 		log_report(" Warning: Cached Option %s_sl2vl: < 16 VLs "
 			   "listed\n", prefix);
-
-	if (count > 16)
+	else if (count > 16)
 		log_report(" Warning: Cached Option %s_sl2vl: > 16 listed: "
 			   "excess VLs will be dropped\n", prefix);
 
 	free(str);
 }
 
-static void subn_verify_qos_set(osm_qos_options_t *set, const char *prefix,
-				osm_qos_options_t *dflt)
+static void subn_verify_qos_set(osm_qos_options_t *set, const char *prefix)
 {
-	subn_verify_max_vls(&set->max_vls, prefix, dflt->max_vls);
-	subn_verify_high_limit(&set->high_limit, prefix, dflt->high_limit);
-	subn_verify_vlarb(&set->vlarb_low, prefix, "low", dflt->vlarb_low);
-	subn_verify_vlarb(&set->vlarb_high, prefix, "high", dflt->vlarb_high);
-	subn_verify_sl2vl(&set->sl2vl, prefix, dflt->sl2vl);
+	subn_verify_max_vls(&set->max_vls, prefix);
+	subn_verify_high_limit(&set->high_limit, prefix);
+	subn_verify_vlarb(&set->vlarb_low, prefix, "low");
+	subn_verify_vlarb(&set->vlarb_high, prefix, "high");
+	subn_verify_sl2vl(&set->sl2vl, prefix);
 }
 
-int osm_subn_verify_config(IN osm_subn_opt_t * const p_opts)
+int osm_subn_verify_config(IN osm_subn_opt_t * p_opts)
 {
 	if (p_opts->lmc > 7) {
 		log_report(" Invalid Cached Option Value:lmc = %u:"
@@ -972,38 +1912,79 @@ int osm_subn_verify_config(IN osm_subn_opt_t * const p_opts)
 		p_opts->force_link_speed = IB_PORT_LINK_SPEED_ENABLED_MASK;
 	}
 
+	if ((31 < p_opts->force_link_speed_ext) ||
+	    (p_opts->force_link_speed_ext > 3 && p_opts->force_link_speed_ext < 30)) {
+		log_report(" Invalid Cached Option Value:force_link_speed_ext = %u:"
+			   "Using Default:%u\n", p_opts->force_link_speed_ext,
+			   31);
+		p_opts->force_link_speed_ext = 31;
+	}
+
+	if (2 < p_opts->fdr10) {
+		log_report(" Invalid Cached Option Value:fdr10 = %u:"
+			   "Using Default:%u\n", p_opts->fdr10, 1);
+		p_opts->fdr10 = 1;
+	}
+
+	if (p_opts->max_wire_smps == 0)
+		p_opts->max_wire_smps = 0x7FFFFFFF;
+	else if (p_opts->max_wire_smps > 0x7FFFFFFF) {
+		log_report(" Invalid Cached Option Value: max_wire_smps = %u,"
+			   " Using Default: %u\n",
+			   p_opts->max_wire_smps, OSM_DEFAULT_SMP_MAX_ON_WIRE);
+		p_opts->max_wire_smps = OSM_DEFAULT_SMP_MAX_ON_WIRE;
+	}
+
+	if (p_opts->max_wire_smps2 > 0x7FFFFFFF) {
+		log_report(" Invalid Cached Option Value: max_wire_smps2 = %u,"
+			   " Using Default: %u",
+			   p_opts->max_wire_smps2, p_opts->max_wire_smps);
+		p_opts->max_wire_smps2 = p_opts->max_wire_smps;
+	}
+
 	if (strcmp(p_opts->console, OSM_DISABLE_CONSOLE)
 	    && strcmp(p_opts->console, OSM_LOCAL_CONSOLE)
-#ifdef ENABLE_OSM_CONSOLE_SOCKET
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
 	    && strcmp(p_opts->console, OSM_LOOPBACK_CONSOLE)
+#endif
+#ifdef ENABLE_OSM_CONSOLE_SOCKET
 	    && strcmp(p_opts->console, OSM_REMOTE_CONSOLE)
 #endif
 	    ) {
 		log_report(" Invalid Cached Option Value:console = %s"
 			   ", Using Default:%s\n",
 			   p_opts->console, OSM_DEFAULT_CONSOLE);
-		p_opts->console = OSM_DEFAULT_CONSOLE;
+		free(p_opts->console);
+		p_opts->console = strdup(OSM_DEFAULT_CONSOLE);
 	}
 
-	if (p_opts->qos) {
-		osm_qos_options_t dflt;
-
-		/* the default options in qos_options must be correct.
-		 * every other one need not be, b/c those will default
-		 * back to whatever is in qos_options.
-		 */
-
-		subn_set_default_qos_options(&dflt);
+	if (p_opts->no_partition_enforcement == TRUE) {
+		strcpy(p_opts->part_enforce, OSM_PARTITION_ENFORCE_OFF);
+		p_opts->part_enforce_enum = OSM_PARTITION_ENFORCE_TYPE_OFF;
+	} else {
+		if (strcmp(p_opts->part_enforce, OSM_PARTITION_ENFORCE_BOTH) == 0)
+			p_opts->part_enforce_enum = OSM_PARTITION_ENFORCE_TYPE_BOTH;
+		else if (strcmp(p_opts->part_enforce, OSM_PARTITION_ENFORCE_IN) == 0)
+			p_opts->part_enforce_enum = OSM_PARTITION_ENFORCE_TYPE_IN;
+		else if (strcmp(p_opts->part_enforce, OSM_PARTITION_ENFORCE_OUT) == 0)
+			p_opts->part_enforce_enum = OSM_PARTITION_ENFORCE_TYPE_OUT;
+		else if (strcmp(p_opts->part_enforce, OSM_PARTITION_ENFORCE_OFF) == 0)
+			p_opts->part_enforce_enum = OSM_PARTITION_ENFORCE_TYPE_OFF;
+		else {
+			log_report(" Invalid Cached Option Value:part_enforce = %s"
+	                           ", Using Default:%s\n",
+	                           p_opts->part_enforce = OSM_PARTITION_ENFORCE_BOTH);
+			p_opts->part_enforce = OSM_PARTITION_ENFORCE_BOTH;
+			p_opts->part_enforce_enum = OSM_PARTITION_ENFORCE_TYPE_BOTH;
+		}
+	}
 
-		subn_verify_qos_set(&p_opts->qos_options, "qos", &dflt);
-		subn_verify_qos_set(&p_opts->qos_ca_options, "qos_ca",
-				    &p_opts->qos_options);
-		subn_verify_qos_set(&p_opts->qos_sw0_options, "qos_sw0",
-				    &p_opts->qos_options);
-		subn_verify_qos_set(&p_opts->qos_swe_options, "qos_swe",
-				    &p_opts->qos_options);
-		subn_verify_qos_set(&p_opts->qos_rtr_options, "qos_rtr",
-				    &p_opts->qos_options);
+	if (p_opts->qos) {
+		subn_verify_qos_set(&p_opts->qos_options, "qos");
+		subn_verify_qos_set(&p_opts->qos_ca_options, "qos_ca");
+		subn_verify_qos_set(&p_opts->qos_sw0_options, "qos_sw0");
+		subn_verify_qos_set(&p_opts->qos_swe_options, "qos_swe");
+		subn_verify_qos_set(&p_opts->qos_rtr_options, "qos_rtr");
 	}
 
 #ifdef ENABLE_OSM_PERF_MGR
@@ -1025,16 +2006,55 @@ int osm_subn_verify_config(IN osm_subn_opt_t * const p_opts)
 	}
 #endif
 
+	if (p_opts->m_key_protect_bits > 3) {
+		log_report(" Invalid Cached Option Value:"
+			   "m_key_protection_level = %u Setting to %u "
+			   "instead\n", p_opts->m_key_protect_bits, 2);
+		p_opts->m_key_protect_bits = 2;
+	}
+	if (p_opts->m_key_protect_bits && p_opts->m_key_lease_period) {
+		if (!p_opts->sweep_interval) {
+			log_report(" Sweep disabled with protected mkey "
+				   "leases in effect; re-enabling sweeping "
+				   "with interval %u\n",
+				   cl_ntoh16(p_opts->m_key_lease_period) - 1);
+			p_opts->sweep_interval =
+				cl_ntoh16(p_opts->m_key_lease_period) - 1;
+		}
+		if (p_opts->sweep_interval >=
+			cl_ntoh16(p_opts->m_key_lease_period)) {
+			log_report(" Sweep interval %u >= mkey lease period "
+				   "%u. Setting lease period to %u\n",
+				   p_opts->sweep_interval,
+				   cl_ntoh16(p_opts->m_key_lease_period),
+				   p_opts->sweep_interval + 1);
+			p_opts->m_key_lease_period =
+				cl_hton16(p_opts->sweep_interval + 1);
+		}
+	}
+
+	if (p_opts->root_guid_file != NULL) {
+		FILE *root_file = fopen(p_opts->root_guid_file, "r");
+		if (!root_file) {
+			log_report("Root guid file provided: %s doesn't exist.\n"
+				    "Using default roots discovery algorithm\n",
+				    p_opts->root_guid_file);
+			p_opts->root_guid_file = NULL;
+		} else
+			fclose(root_file);
+	}
+
 	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
-int osm_subn_parse_conf_file(char *file_name, osm_subn_opt_t * const p_opts)
+int osm_subn_parse_conf_file(char *file_name, osm_subn_opt_t * p_opts)
 {
 	char line[1024];
 	FILE *opts_file;
-	char *p_key, *p_val;
+	char *p_key, *p_val, *pound_sign;
+	const opt_rec_t *r;
+	void *p_field1, *p_field2;
+	int token_matched;
 
 	opts_file = fopen(file_name, "r");
 	if (!opts_file) {
@@ -1049,8 +2069,20 @@ int osm_subn_parse_conf_file(char *file_name, osm_subn_opt_t * const p_opts)
 	cl_log_event("OpenSM", CL_LOG_INFO, line, NULL, 0);
 
 	p_opts->config_file = file_name;
+	if (!p_opts->file_opts && !(p_opts->file_opts = malloc(sizeof(*p_opts)))) {
+		fclose(opts_file);
+		return -1;
+	}
+	memcpy(p_opts->file_opts, p_opts, sizeof(*p_opts));
+	p_opts->file_opts->file_opts = NULL;
 
 	while (fgets(line, 1023, opts_file) != NULL) {
+		pound_sign = strchr(line,'#');
+		token_matched = 0;
+		/* Truncate any comments. */
+		if (pound_sign)
+			*pound_sign = '\0';
+
 		/* get the first token */
 		p_key = strtok_r(line, " \t\n", &p_val);
 		if (!p_key)
@@ -1058,232 +2090,21 @@ int osm_subn_parse_conf_file(char *file_name, osm_subn_opt_t * const p_opts)
 
 		p_val = clean_val(p_val);
 
-		opts_unpack_net64("guid", p_key, p_val, &p_opts->guid);
-
-		opts_unpack_net64("m_key", p_key, p_val, &p_opts->m_key);
-
-		opts_unpack_net64("sm_key", p_key, p_val, &p_opts->sm_key);
-
-		opts_unpack_net64("sa_key", p_key, p_val, &p_opts->sa_key);
-
-		opts_unpack_net64("subnet_prefix",
-				  p_key, p_val, &p_opts->subnet_prefix);
-
-		opts_unpack_net16("m_key_lease_period",
-				  p_key, p_val, &p_opts->m_key_lease_period);
-
-		opts_unpack_uint32("sweep_interval",
-				   p_key, p_val, &p_opts->sweep_interval);
-
-		opts_unpack_uint32("max_wire_smps",
-				   p_key, p_val, &p_opts->max_wire_smps);
-
-		opts_unpack_charp("console", p_key, p_val, &p_opts->console);
-
-		opts_unpack_uint16("console_port",
-				   p_key, p_val, &p_opts->console_port);
-
-		opts_unpack_uint32("transaction_timeout",
-				   p_key, p_val, &p_opts->transaction_timeout);
-
-		opts_unpack_uint32("max_msg_fifo_timeout",
-				   p_key, p_val, &p_opts->max_msg_fifo_timeout);
-
-		opts_unpack_uint8("sm_priority",
-				  p_key, p_val, &p_opts->sm_priority);
-
-		opts_unpack_uint8("lmc", p_key, p_val, &p_opts->lmc);
-
-		opts_unpack_boolean("lmc_esp0",
-				    p_key, p_val, &p_opts->lmc_esp0);
-
-		opts_unpack_uint8("max_op_vls",
-				  p_key, p_val, &p_opts->max_op_vls);
-
-		opts_unpack_uint8("force_link_speed",
-				  p_key, p_val, &p_opts->force_link_speed);
-
-		opts_unpack_boolean("reassign_lids",
-				    p_key, p_val, &p_opts->reassign_lids);
-
-		opts_unpack_boolean("ignore_other_sm",
-				    p_key, p_val, &p_opts->ignore_other_sm);
-
-		opts_unpack_boolean("single_thread",
-				    p_key, p_val, &p_opts->single_thread);
-
-		opts_unpack_boolean("disable_multicast",
-				    p_key, p_val, &p_opts->disable_multicast);
-
-		opts_unpack_boolean("force_log_flush",
-				    p_key, p_val, &p_opts->force_log_flush);
-
-		opts_unpack_uint8("subnet_timeout",
-				  p_key, p_val, &p_opts->subnet_timeout);
-
-		opts_unpack_uint8("packet_life_time",
-				  p_key, p_val, &p_opts->packet_life_time);
-
-		opts_unpack_uint8("vl_stall_count",
-				  p_key, p_val, &p_opts->vl_stall_count);
-
-		opts_unpack_uint8("leaf_vl_stall_count",
-				  p_key, p_val, &p_opts->leaf_vl_stall_count);
-
-		opts_unpack_uint8("head_of_queue_lifetime",
-				  p_key, p_val,
-				  &p_opts->head_of_queue_lifetime);
-
-		opts_unpack_uint8("leaf_head_of_queue_lifetime", p_key, p_val,
-				  &p_opts->leaf_head_of_queue_lifetime);
-
-		opts_unpack_uint8("local_phy_errors_threshold", p_key, p_val,
-				  &p_opts->local_phy_errors_threshold);
-
-		opts_unpack_uint8("overrun_errors_threshold",
-				  p_key, p_val,
-				  &p_opts->overrun_errors_threshold);
-
-		opts_unpack_uint32("sminfo_polling_timeout",
-				   p_key, p_val,
-				   &p_opts->sminfo_polling_timeout);
-
-		opts_unpack_uint32("polling_retry_number",
-				   p_key, p_val, &p_opts->polling_retry_number);
-
-		opts_unpack_boolean("force_heavy_sweep",
-				    p_key, p_val, &p_opts->force_heavy_sweep);
-
-		opts_unpack_uint8("log_flags",
-				  p_key, p_val, &p_opts->log_flags);
-
-		opts_unpack_charp("port_prof_ignore_file", p_key, p_val,
-				  &p_opts->port_prof_ignore_file);
-
-		opts_unpack_boolean("port_profile_switch_nodes", p_key, p_val,
-				    &p_opts->port_profile_switch_nodes);
-
-		opts_unpack_boolean("sweep_on_trap",
-				    p_key, p_val, &p_opts->sweep_on_trap);
-
-		opts_unpack_charp("routing_engine",
-				  p_key, p_val, &p_opts->routing_engine_names);
-
-		opts_unpack_boolean("connect_roots",
-				    p_key, p_val, &p_opts->connect_roots);
-
-		opts_unpack_boolean("use_ucast_cache",
-				    p_key, p_val, &p_opts->use_ucast_cache);
-
-		opts_unpack_charp("log_file", p_key, p_val, &p_opts->log_file);
-
-		opts_unpack_uint32("log_max_size",
-				   p_key, p_val,
-				   (void *) & p_opts->log_max_size);
-		p_opts->log_max_size *= 1024 * 1024; /* convert to MB */
-
-		opts_unpack_charp("partition_config_file",
-				  p_key, p_val, &p_opts->partition_config_file);
-
-		opts_unpack_boolean("no_partition_enforcement", p_key, p_val,
-				    &p_opts->no_partition_enforcement);
-
-		opts_unpack_boolean("qos", p_key, p_val, &p_opts->qos);
-
-		opts_unpack_charp("qos_policy_file",
-				  p_key, p_val, &p_opts->qos_policy_file);
-
-		opts_unpack_boolean("accum_log_file",
-				    p_key, p_val, &p_opts->accum_log_file);
-
-		opts_unpack_charp("dump_files_dir",
-				  p_key, p_val, &p_opts->dump_files_dir);
-
-		opts_unpack_charp("lid_matrix_dump_file",
-				  p_key, p_val, &p_opts->lid_matrix_dump_file);
-
-		opts_unpack_charp("lfts_file",
-				  p_key, p_val, &p_opts->lfts_file);
-
-		opts_unpack_charp("root_guid_file",
-				  p_key, p_val, &p_opts->root_guid_file);
-
-		opts_unpack_charp("cn_guid_file",
-				  p_key, p_val, &p_opts->cn_guid_file);
-
-		opts_unpack_charp("ids_guid_file",
-				  p_key, p_val, &p_opts->ids_guid_file);
-
-		opts_unpack_charp("guid_routing_order_file",
-				  p_key, p_val, &p_opts->guid_routing_order_file);
-
-		opts_unpack_charp("sa_db_file",
-				  p_key, p_val, &p_opts->sa_db_file);
-
-		opts_unpack_boolean("exit_on_fatal",
-				    p_key, p_val, &p_opts->exit_on_fatal);
-
-		opts_unpack_boolean("honor_guid2lid_file",
-				    p_key, p_val, &p_opts->honor_guid2lid_file);
-
-		opts_unpack_boolean("daemon", p_key, p_val, &p_opts->daemon);
-
-		opts_unpack_boolean("sm_inactive",
-				    p_key, p_val, &p_opts->sm_inactive);
-
-		opts_unpack_boolean("babbling_port_policy",
-				    p_key, p_val,
-				    &p_opts->babbling_port_policy);
-
-#ifdef ENABLE_OSM_PERF_MGR
-		opts_unpack_boolean("perfmgr", p_key, p_val, &p_opts->perfmgr);
-
-		opts_unpack_boolean("perfmgr_redir",
-				    p_key, p_val, &p_opts->perfmgr_redir);
-
-		opts_unpack_uint16("perfmgr_sweep_time_s",
-				   p_key, p_val, &p_opts->perfmgr_sweep_time_s);
-
-		opts_unpack_uint32("perfmgr_max_outstanding_queries",
-				   p_key, p_val,
-				   &p_opts->perfmgr_max_outstanding_queries);
-
-		opts_unpack_charp("event_db_dump_file",
-				  p_key, p_val, &p_opts->event_db_dump_file);
-#endif				/* ENABLE_OSM_PERF_MGR */
-
-		opts_unpack_charp("event_plugin_name",
-				  p_key, p_val, &p_opts->event_plugin_name);
-
-		opts_unpack_charp("node_name_map_name",
-				  p_key, p_val, &p_opts->node_name_map_name);
-
-		subn_parse_qos_options("qos",
-				       p_key, p_val, &p_opts->qos_options);
-
-		subn_parse_qos_options("qos_ca",
-				       p_key, p_val, &p_opts->qos_ca_options);
-
-		subn_parse_qos_options("qos_sw0",
-				       p_key, p_val, &p_opts->qos_sw0_options);
-
-		subn_parse_qos_options("qos_swe",
-				       p_key, p_val, &p_opts->qos_swe_options);
-
-		subn_parse_qos_options("qos_rtr",
-				       p_key, p_val, &p_opts->qos_rtr_options);
-
-		opts_unpack_boolean("enable_quirks",
-				    p_key, p_val, &p_opts->enable_quirks);
-
-		opts_unpack_boolean("no_clients_rereg",
-				    p_key, p_val, &p_opts->no_clients_rereg);
+		for (r = opt_tbl; r->name; r++) {
+			if (strcmp(r->name, p_key))
+				continue;
 
-		opts_unpack_charp("prefix_routes_file",
-				  p_key, p_val, &p_opts->prefix_routes_file);
+			token_matched = 1;
+			p_field1 = (void *)p_opts->file_opts + r->opt_offset;
+			p_field2 = (void *)p_opts + r->opt_offset;
+			/* don't call setup function first time */
+			r->parse_fn(NULL, p_key, p_val, p_field1, p_field2,
+				    NULL);
+			break;
+		}
 
-		opts_unpack_boolean("consolidate_ipv6_snm_req",
-				p_key, p_val, &p_opts->consolidate_ipv6_snm_req);
+		if (!token_matched)
+			log_report(" Unrecognized token: \"%s\"\n", p_key);
 	}
 	fclose(opts_file);
 
@@ -1292,67 +2113,89 @@ int osm_subn_parse_conf_file(char *file_name, osm_subn_opt_t * const p_opts)
 	return 0;
 }
 
-int osm_subn_rescan_conf_files(IN osm_subn_t * const p_subn)
+int osm_subn_rescan_conf_files(IN osm_subn_t * p_subn)
 {
-	FILE *opts_file;
 	char line[1024];
-	char *p_key, *p_val, *p_last;
+	osm_subn_opt_t *p_opts = &p_subn->opt;
+	const opt_rec_t *r;
+	FILE *opts_file;
+	char *p_key, *p_val, *pound_sign;
+	void *p_field1, *p_field2;
+	int token_matched;
 
-	if (!p_subn->opt.config_file)
+	if (!p_opts->config_file)
 		return 0;
 
-	opts_file = fopen(p_subn->opt.config_file, "r");
+	opts_file = fopen(p_opts->config_file, "r");
 	if (!opts_file) {
 		if (errno == ENOENT)
 			return 1;
 		OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR,
 			"cannot open file \'%s\': %s\n",
-			p_subn->opt.config_file, strerror(errno));
+			p_opts->config_file, strerror(errno));
 		return -1;
 	}
 
-	subn_init_qos_options(&p_subn->opt.qos_options);
-	subn_init_qos_options(&p_subn->opt.qos_ca_options);
-	subn_init_qos_options(&p_subn->opt.qos_sw0_options);
-	subn_init_qos_options(&p_subn->opt.qos_swe_options);
-	subn_init_qos_options(&p_subn->opt.qos_rtr_options);
+	subn_init_qos_options(&p_opts->qos_options,
+			      &p_opts->file_opts->qos_options);
+	subn_init_qos_options(&p_opts->qos_ca_options,
+			      &p_opts->file_opts->qos_ca_options);
+	subn_init_qos_options(&p_opts->qos_sw0_options,
+			      &p_opts->file_opts->qos_sw0_options);
+	subn_init_qos_options(&p_opts->qos_swe_options,
+			      &p_opts->file_opts->qos_swe_options);
+	subn_init_qos_options(&p_opts->qos_rtr_options,
+			      &p_opts->file_opts->qos_rtr_options);
 
 	while (fgets(line, 1023, opts_file) != NULL) {
-		/* get the first token */
-		p_key = strtok_r(line, " \t\n", &p_last);
-		if (p_key) {
-			p_val = strtok_r(NULL, " \t\n", &p_last);
+		pound_sign = strchr(line,'#');
+		token_matched = 0;
+
+		/* Truncate any comments. */
+		if (pound_sign)
+			*pound_sign = '\0';
 
-			subn_parse_qos_options("qos", p_key, p_val,
-					       &p_subn->opt.qos_options);
+		/* get the first token */
+		p_key = strtok_r(line, " \t\n", &p_val);
+		if (!p_key)
+			continue;
 
-			subn_parse_qos_options("qos_ca", p_key, p_val,
-					       &p_subn->opt.qos_ca_options);
+		p_val = clean_val(p_val);
 
-			subn_parse_qos_options("qos_sw0", p_key, p_val,
-					       &p_subn->opt.qos_sw0_options);
+		for (r = opt_tbl; r->name; r++) {
+			if (strcmp(r->name, p_key))
+				continue;
 
-			subn_parse_qos_options("qos_swe", p_key, p_val,
-					       &p_subn->opt.qos_swe_options);
+			token_matched = 1;
 
-			subn_parse_qos_options("qos_rtr", p_key, p_val,
-					       &p_subn->opt.qos_rtr_options);
+			if (strcmp(r->name, p_key))
+				continue;
 
+			p_field1 = (void *)p_opts->file_opts + r->opt_offset;
+			p_field2 = (void *)p_opts + r->opt_offset;
+			r->parse_fn(p_subn, p_key, p_val, p_field1, p_field2,
+				    r->setup_fn);
+			break;
 		}
+		if (!token_matched)
+                       log_report(" Unrecognized token: \"%s\"\n", p_key);
 	}
 	fclose(opts_file);
 
-	osm_subn_verify_config(&p_subn->opt);
+	osm_subn_verify_config(p_opts);
+
+	parse_prefix_routes_file(p_subn);
 
-	osm_parse_prefix_routes_file(p_subn);
+	parse_per_mod_logging_file(p_subn);
 
 	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
-int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
+int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
 {
+	int cacongoutputcount = 0;
+	int i;
+
 	fprintf(out,
 		"#\n# DEVICE ATTRIBUTES OPTIONS\n#\n"
 		"# The port GUID on which the OpenSM is running\n"
@@ -1361,6 +2204,8 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		"m_key 0x%016" PRIx64 "\n\n"
 		"# The lease period used for the M_Key on this subnet in [sec]\n"
 		"m_key_lease_period %u\n\n"
+		"# The protection level used for the M_Key on this subnet\n"
+		"m_key_protection_level %u\n\n"
 		"# SM_Key value of the SM used for SM authentication\n"
 		"sm_key 0x%016" PRIx64 "\n\n"
 		"# SM_Key value to qualify rcv SA queries as 'trusted'\n"
@@ -1378,6 +2223,8 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		"# enhanced switch port 0. If TRUE, LMC value for subnet is used for\n"
 		"# ESP0. Otherwise, LMC value for ESP0s is 0.\n"
 		"lmc_esp0 %s\n\n"
+		"# sm_sl determines SMSL used for SM/SA communication\n"
+		"sm_sl %u\n\n"
 		"# The code of maximal time a packet can live in a switch\n"
 		"# The actual time is 4.096usec * 2^<packet_life_time>\n"
 		"# The value 0x14 disables this mechanism\n"
@@ -1412,21 +2259,41 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		"#    2,4,6,8-14 Reserved\n"
 		"#    Default 15: set to PortInfo:LinkSpeedSupported\n"
 		"force_link_speed %u\n\n"
+		"# Force PortInfo:LinkSpeedExtEnabled on ports\n"
+		"# If 0, don't modify PortInfo:LinkSpeedExtEnabled on port\n"
+		"# Otherwise, use value for PortInfo:LinkSpeedExtEnabled on port\n"
+		"# Values are (MgtWG RefID #4722)\n"
+		"#    1: 14.0625 Gbps\n"
+		"#    2: 25.78125 Gbps\n"
+		"#    3: 14.0625 Gbps or 25.78125 Gbps\n"
+		"#    30: Disable extended link speeds\n"
+		"#    Default 31: set to PortInfo:LinkSpeedExtSupported\n"
+		"force_link_speed_ext %u\n\n"
+		"# FDR10 on ports on devices that support FDR10\n"
+		"# Values are:\n"
+		"#    0: don't use fdr10 (no MLNX ExtendedPortInfo MADs)\n"
+		"#    Default 1: enable fdr10 when supported\n"
+		"#    2: disable fdr10 when supported\n"
+		"fdr10 %u\n\n"
 		"# The subnet_timeout code that will be set for all the ports\n"
 		"# The actual timeout is 4.096usec * 2^<subnet_timeout>\n"
 		"subnet_timeout %u\n\n"
 		"# Threshold of local phy errors for sending Trap 129\n"
 		"local_phy_errors_threshold 0x%02x\n\n"
 		"# Threshold of credit overrun errors for sending Trap 130\n"
-		"overrun_errors_threshold 0x%02x\n\n",
+		"overrun_errors_threshold 0x%02x\n\n"
+		"# Use SwitchInfo:MulticastFDBTop if advertised in PortInfo:CapabilityMask\n"
+		"use_mfttop %s\n\n",
 		cl_ntoh64(p_opts->guid),
 		cl_ntoh64(p_opts->m_key),
 		cl_ntoh16(p_opts->m_key_lease_period),
+		p_opts->m_key_protect_bits,
 		cl_ntoh64(p_opts->sm_key),
 		cl_ntoh64(p_opts->sa_key),
 		cl_ntoh64(p_opts->subnet_prefix),
 		p_opts->lmc,
 		p_opts->lmc_esp0 ? "TRUE" : "FALSE",
+		p_opts->sm_sl,
 		p_opts->packet_life_time,
 		p_opts->vl_stall_count,
 		p_opts->leaf_vl_stall_count,
@@ -1434,18 +2301,36 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		p_opts->leaf_head_of_queue_lifetime,
 		p_opts->max_op_vls,
 		p_opts->force_link_speed,
+		p_opts->force_link_speed_ext,
+		p_opts->fdr10,
 		p_opts->subnet_timeout,
 		p_opts->local_phy_errors_threshold,
-		p_opts->overrun_errors_threshold);
+		p_opts->overrun_errors_threshold,
+		p_opts->use_mfttop ? "TRUE" : "FALSE");
 
 	fprintf(out,
 		"#\n# PARTITIONING OPTIONS\n#\n"
 		"# Partition configuration file to be used\n"
 		"partition_config_file %s\n\n"
-		"# Disable partition enforcement by switches\n"
-		"no_partition_enforcement %s\n\n",
+		"# Disable partition enforcement by switches (DEPRECATED)\n"
+		"# This option is DEPRECATED. Please use part_enforce instead\n"
+		"no_partition_enforcement %s\n\n"
+		"# Partition enforcement type (for switches)\n"
+		"# Values are both, out, in and off\n"
+		"# Default is both (outbound and inbound enforcement)\n"
+		"part_enforce %s\n\n"
+		"# Allow both full and limited membership on the same partition\n"
+		"allow_both_pkeys %s\n\n"
+		"# SM assigned GUID byte where GUID is formed from OpenFabrics OUI\n"
+		"# followed by 40 bits xy 00 ab cd ef where xy is the SM assigned GUID byte\n"
+		"# and ab cd ef is an SM autogenerated 24 bits\n"
+		"# SM assigned GUID byte should be configured as subnet unique\n"
+		"sm_assigned_guid 0x%02x\n\n",
 		p_opts->partition_config_file,
-		p_opts->no_partition_enforcement ? "TRUE" : "FALSE");
+		p_opts->no_partition_enforcement ? "TRUE" : "FALSE",
+		p_opts->part_enforce,
+		p_opts->allow_both_pkeys ? "TRUE" : "FALSE",
+		p_opts->sm_assigned_guid);
 
 	fprintf(out,
 		"#\n# SWEEP OPTIONS\n#\n"
@@ -1475,11 +2360,23 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		p_opts->port_prof_ignore_file : null_str);
 
 	fprintf(out,
+		"# The file holding routing weighting factors per output port\n"
+		"hop_weights_file %s\n\n",
+		p_opts->hop_weights_file ? p_opts->hop_weights_file : null_str);
+
+	fprintf(out,
+		"# The file holding non-default port order per switch for routing\n"
+		"port_search_ordering_file %s\n\n",
+		p_opts->port_search_ordering_file ?
+		p_opts->port_search_ordering_file : null_str);
+
+	fprintf(out,
 		"# Routing engine\n"
 		"# Multiple routing engines can be specified separated by\n"
 		"# commas so that specific ordering of routing algorithms will\n"
 		"# be tried if earlier routing engines fail.\n"
-		"# Supported engines: minhop, updn, file, ftree, lash, dor\n"
+		"# Supported engines: minhop, updn, dnup, file, ftree, lash,\n"
+		"#    dor, torus-2QoS, dfsssp, sssp\n"
 		"routing_engine %s\n\n", p_opts->routing_engine_names ?
 		p_opts->routing_engine_names : null_str);
 
@@ -1513,6 +2410,16 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		p_opts->cn_guid_file ? p_opts->cn_guid_file : null_str);
 
 	fprintf(out,
+		"# The file holding the fat-tree I/O node guids\n"
+		"# One guid in each line\nio_guid_file %s\n\n",
+		p_opts->io_guid_file ? p_opts->io_guid_file : null_str);
+
+	fprintf(out,
+		"# Number of reverse hops allowed for I/O nodes \n"
+		"# Used for connectivity between I/O nodes connected to Top Switches\nmax_reverse_hops %d\n\n",
+		p_opts->max_reverse_hops);
+
+	fprintf(out,
 		"# The file holding the node ids which will be used by"
 		" Up/Down algorithm instead\n# of GUIDs (one guid and"
 		" id in each line)\nids_guid_file %s\n\n",
@@ -1524,10 +2431,41 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		p_opts->guid_routing_order_file ? p_opts->guid_routing_order_file : null_str);
 
 	fprintf(out,
+		"# Do mesh topology analysis (for LASH algorithm)\n"
+		"do_mesh_analysis %s\n\n",
+		p_opts->do_mesh_analysis ? "TRUE" : "FALSE");
+
+	fprintf(out,
+		"# Starting VL for LASH algorithm\n"
+		"lash_start_vl %u\n\n",
+		p_opts->lash_start_vl);
+
+	fprintf(out,
+		"# Port Shifting (use FALSE if unsure)\n"
+		"port_shifting %s\n\n",
+		p_opts->port_shifting ? "TRUE" : "FALSE");
+
+	fprintf(out,
+		"# Assign ports in a random order instead of round-robin.\n"
+		"# If zero disable, otherwise use the value as a random seed\n"
+		"scatter_ports %d\n\n",
+		p_opts->scatter_ports);
+
+	fprintf(out,
 		"# SA database file name\nsa_db_file %s\n\n",
 		p_opts->sa_db_file ? p_opts->sa_db_file : null_str);
 
 	fprintf(out,
+		"# If TRUE causes OpenSM to dump SA database at the end of\n"
+		"# every light sweep, regardless of the verbosity level\n"
+		"sa_db_dump %s\n\n",
+		p_opts->sa_db_dump ? "TRUE" : "FALSE");
+
+	fprintf(out,
+		"# Torus-2QoS configuration file name\ntorus_config %s\n\n",
+		p_opts->torus_conf_file ? p_opts->torus_conf_file : null_str);
+
+	fprintf(out,
 		"#\n# HANDOVER - MULTIPLE SMs OPTIONS\n#\n"
 		"# SM priority used for deciding who is the master\n"
 		"# Range goes from 0 (lowest priority) to 15 (highest).\n"
@@ -1551,17 +2489,27 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		"#\n# TIMING AND THREADING OPTIONS\n#\n"
 		"# Maximum number of SMPs sent in parallel\n"
 		"max_wire_smps %u\n\n"
+		"# Maximum number of timeout based SMPs allowed to be outstanding\n"
+		"# A value less than or equal to max_wire_smps disables this mechanism\n"
+		"max_wire_smps2 %u\n\n"
+		"# The timeout in [usec] used for sending SMPs above max_wire_smps limit and below max_wire_smps2 limit\n"
+		"max_smps_timeout %u\n\n"
 		"# The maximum time in [msec] allowed for a transaction to complete\n"
 		"transaction_timeout %u\n\n"
+		"# The maximum number of retries allowed for a transaction to complete\n"
+		"transaction_retries %u\n\n"
 		"# Maximal time in [msec] a message can stay in the incoming message queue.\n"
 		"# If there is more than one message in the queue and the last message\n"
 		"# stayed in the queue more than this value, any SA request will be\n"
-		"# immediately returned with a BUSY status.\n"
+		"# immediately be dropped but BUSY status is not currently returned.\n"
 		"max_msg_fifo_timeout %u\n\n"
 		"# Use a single thread for handling SA queries\n"
 		"single_thread %s\n\n",
 		p_opts->max_wire_smps,
+		p_opts->max_wire_smps2,
+		p_opts->max_smps_timeout,
 		p_opts->transaction_timeout,
+		p_opts->transaction_retries,
 		p_opts->max_msg_fifo_timeout,
 		p_opts->single_thread ? "TRUE" : "FALSE");
 
@@ -1572,10 +2520,13 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		"# SM Inactive\n"
 		"sm_inactive %s\n\n"
 		"# Babbling Port Policy\n"
-		"babbling_port_policy %s\n\n",
+		"babbling_port_policy %s\n\n"
+		"# Use Optimized SLtoVLMapping programming if supported by device\n"
+		"use_optimized_slvl %s\n\n",
 		p_opts->daemon ? "TRUE" : "FALSE",
 		p_opts->sm_inactive ? "TRUE" : "FALSE",
-		p_opts->babbling_port_policy ? "TRUE" : "FALSE");
+		p_opts->babbling_port_policy ? "TRUE" : "FALSE",
+		p_opts->use_optimized_slvl ? "TRUE" : "FALSE");
 
 #ifdef ENABLE_OSM_PERF_MGR
 	fprintf(out,
@@ -1587,11 +2538,19 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		"# sweep time in seconds\n"
 		"perfmgr_sweep_time_s %u\n\n"
 		"# Max outstanding queries\n"
-		"perfmgr_max_outstanding_queries %u\n\n",
+		"perfmgr_max_outstanding_queries %u\n"
+		"perfmgr_ignore_cas %s\n\n"
+		"# Remove missing nodes from DB\n"
+		"perfmgr_rm_nodes %s\n\n"
+		"# Log error counters to opensm.log\n"
+		"perfmgr_log_errors %s\n\n",
 		p_opts->perfmgr ? "TRUE" : "FALSE",
 		p_opts->perfmgr_redir ? "TRUE" : "FALSE",
 		p_opts->perfmgr_sweep_time_s,
-		p_opts->perfmgr_max_outstanding_queries);
+		p_opts->perfmgr_max_outstanding_queries,
+		p_opts->perfmgr_ignore_cas ? "TRUE" : "FALSE",
+		p_opts->perfmgr_rm_nodes ? "TRUE" : "FALSE",
+		p_opts->perfmgr_log_errors ? "TRUE" : "FALSE");
 
 	fprintf(out,
 		"#\n# Event DB Options\n#\n"
@@ -1602,8 +2561,14 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 
 	fprintf(out,
 		"#\n# Event Plugin Options\n#\n"
-		"event_plugin_name %s\n\n", p_opts->event_plugin_name ?
-		p_opts->event_plugin_name : null_str);
+		"# Event plugin name(s)\n"
+		"event_plugin_name %s\n\n"
+		"# Options string that would be passed to the plugin(s)\n"
+		"event_plugin_options %s\n\n",
+		p_opts->event_plugin_name ?
+		p_opts->event_plugin_name : null_str,
+		p_opts->event_plugin_options ?
+		p_opts->event_plugin_options : null_str);
 
 	fprintf(out,
 		"#\n# Node name map for mapping node's to more descriptive node descriptions\n"
@@ -1623,6 +2588,12 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		"log_max_size %lu\n\n"
 		"# If TRUE will accumulate the log over multiple OpenSM sessions\n"
 		"accum_log_file %s\n\n"
+		"# Per module logging configuration file\n"
+		"# Each line in config file contains <module_name><separator><log_flags>\n"
+		"# where module_name is file name including .c\n"
+		"# separator is either = , space, or tab\n"
+		"# log_flags is the same flags as used in the coarse/overall logging\n"
+		"per_module_logging_file %s\n\n"
 		"# The directory to hold the file OpenSM dumps\n"
 		"dump_files_dir %s\n\n"
 		"# If TRUE enables new high risk options and hardware specific quirks\n"
@@ -1634,8 +2605,11 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		"disable_multicast %s\n\n"
 		"# If TRUE opensm will exit on fatal initialization issues\n"
 		"exit_on_fatal %s\n\n" "# console [off|local"
+#ifdef ENABLE_OSM_CONSOLE_LOOPBACK
+		"|loopback"
+#endif
 #ifdef ENABLE_OSM_CONSOLE_SOCKET
-		"|loopback|socket]\n"
+		"|socket]\n"
 #else
 		"]\n"
 #endif
@@ -1645,8 +2619,10 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		p_opts->log_flags,
 		p_opts->force_log_flush ? "TRUE" : "FALSE",
 		p_opts->log_file,
-		p_opts->log_max_size/1024/1024,
+		p_opts->log_max_size,
 		p_opts->accum_log_file ? "TRUE" : "FALSE",
+		p_opts->per_module_logging_file ?
+			p_opts->per_module_logging_file : null_str,
 		p_opts->dump_files_dir,
 		p_opts->enable_quirks ? "TRUE" : "FALSE",
 		p_opts->no_clients_rereg ? "TRUE" : "FALSE",
@@ -1685,6 +2661,164 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 	fprintf(out, "\n");
 
 	fprintf(out,
+		"#\n# Congestion Control OPTIONS (EXPERIMENTAL)\n#\n\n"
+		"# Enable Congestion Control Configuration\n"
+		"congestion_control %s\n\n"
+		"# CCKey to use when configuring congestion control\n"
+		"# note that this does not configure a new CCkey, only the CCkey to use\n"
+		"cc_key 0x%016" PRIx64 "\n\n"
+		"# Congestion Control Max outstanding MAD\n"
+		"cc_max_outstanding_mads %u\n\n",
+		p_opts->congestion_control ? "TRUE" : "FALSE",
+		cl_ntoh64(p_opts->cc_key),
+		p_opts->cc_max_outstanding_mads);
+
+	fprintf(out,
+		"#\n# Congestion Control SwitchCongestionSetting options\n#\n"
+		"# Control Map - bitmask indicating which of the following attributes are to be used\n"
+		"# bit 0 - victim mask\n"
+		"# bit 1 - credit mask\n"
+		"# bit 2 - threshold + packet size\n"
+		"# bit 3 - credit starvation threshold + return delay valid\n"
+		"# bit 4 - marking rate valid\n"
+		"cc_sw_cong_setting_control_map 0x%X\n\n",
+		cl_ntoh32(p_opts->cc_sw_cong_setting_control_map));
+
+	fprintf(out,
+		"# Victim Mask - 256 bit mask representing switch ports, mark packets with FECN\n"
+		"# whether they are the source or victim of congestion\n"
+		"# bit 0 - port 0 (enhanced port)\n"
+		"# bit 1 - port 1\n"
+		"# ...\n"
+		"# bit 254 - port 254\n"
+		"# bit 255 - reserved\n"
+		"cc_sw_cong_setting_victim_mask 0x");
+
+	for (i = 0; i < IB_CC_PORT_MASK_DATA_SIZE; i++)
+		fprintf(out, "%02X", p_opts->cc_sw_cong_setting_victim_mask[i]);
+	fprintf(out, "\n\n");
+
+	fprintf(out,
+		"# Credit Mask - 256 bit mask representing switch ports to apply credit starvation\n"
+		"# bit 0 - port 0 (enhanced port)\n"
+		"# bit 1 - port 1\n"
+		"# ...\n"
+		"# bit 254 - port 254\n"
+		"# bit 255 - reserved\n"
+		"cc_sw_cong_setting_credit_mask 0x");
+
+	for (i = 0; i < IB_CC_PORT_MASK_DATA_SIZE; i++)
+		fprintf(out, "%02X", p_opts->cc_sw_cong_setting_credit_mask[i]);
+	fprintf(out, "\n\n");
+
+	fprintf(out,
+		"# Threshold - value indicating aggressiveness of congestion marking\n"
+		"# 0x0 - none, 0x1 - loose, ..., 0xF - aggressive\n"
+		"cc_sw_cong_setting_threshold 0x%02X\n\n"
+		"# Packet Size - any packet less than this size will not be marked with a FECN\n"
+		"# units are in credits\n"
+		"cc_sw_cong_setting_packet_size %u\n\n"
+		"# Credit Starvation Threshold - value indicating aggressiveness of credit starvation\n"
+		"# 0x0 - none, 0x1 - loose, ..., 0xF - aggressive\n"
+		"cc_sw_cong_setting_credit_starvation_threshold 0x%02X\n\n"
+		"# Credit Starvation Return Delay - in CCT entry shift:multiplier format, see IB spec\n"
+		"cc_sw_cong_setting_credit_starvation_return_delay %u:%u\n\n"
+		"# Marking Rate - mean number of packets between markings\n"
+		"cc_sw_cong_setting_marking_rate %u\n\n",
+		p_opts->cc_sw_cong_setting_threshold,
+		p_opts->cc_sw_cong_setting_packet_size,
+		p_opts->cc_sw_cong_setting_credit_starvation_threshold,
+		p_opts->cc_sw_cong_setting_credit_starvation_return_delay.shift,
+		p_opts->cc_sw_cong_setting_credit_starvation_return_delay.multiplier,
+		cl_ntoh16(p_opts->cc_sw_cong_setting_marking_rate));
+
+	fprintf(out,
+		"#\n# Congestion Control CA Congestion Setting options\n#\n"
+		"# Port Control\n"
+		"# bit 0 = 0, QP based congestion control\n"
+		"# bit 0 = 1, SL/port based congestion control\n"
+		"cc_ca_cong_setting_port_control 0x%04X\n\n"
+		"# Control Map - 16 bit bitmask indicating which SLs should be configured\n"
+		"cc_ca_cong_setting_control_map 0x%04X\n\n",
+		cl_ntoh16(p_opts->cc_ca_cong_setting_port_control),
+		cl_ntoh16(p_opts->cc_ca_cong_setting_control_map));
+
+	fprintf(out,
+		"#\n# CA Congestion Setting Entries\n#\n"
+		"# Each of congestion control settings below configures the CA Congestion\n"
+		"# Settings for an individual SL.  The SL must be specified before the value.\n"
+		"# These options may be specified multiple times to configure different values\n"
+		"# for different SLs.\n"
+		"#\n"
+		"# ccti timer - when expires decrements 1 from the CCTI\n"
+		"# ccti increase - number to be added to the table index on receipt of a BECN\n"
+		"# trigger threshold - when the ccti is equal to this, an event is logged\n"
+		"# ccti min - the minimum value for the ccti.  This imposes a minimum rate\n"
+		"#            on the injection rate\n\n");
+
+	for (i = 0; i < IB_CA_CONG_ENTRY_DATA_SIZE; i++) {
+		/* Don't output unless one of the settings has been set, there's no need
+		 * to output 16 chunks of this with all defaults of 0 */
+		if (p_opts->cc_ca_cong_entries[i].ccti_timer
+		    || p_opts->cc_ca_cong_entries[i].ccti_increase
+		    || p_opts->cc_ca_cong_entries[i].trigger_threshold
+		    || p_opts->cc_ca_cong_entries[i].ccti_min) {
+			fprintf(out,
+				"# SL = %u\n"
+				"cc_ca_cong_setting_ccti_timer %u %u\n"
+				"cc_ca_cong_setting_ccti_increase %u %u\n"
+				"cc_ca_cong_setting_trigger_threshold %u %u\n"
+				"cc_ca_cong_setting_ccti_min %u %u\n\n",
+				i,
+				i,
+				cl_ntoh16(p_opts->cc_ca_cong_entries[i].ccti_timer),
+				i,
+				p_opts->cc_ca_cong_entries[i].ccti_increase,
+				i,
+				p_opts->cc_ca_cong_entries[i].trigger_threshold,
+				i,
+				p_opts->cc_ca_cong_entries[i].ccti_min);
+			cacongoutputcount++;
+		}
+	}
+
+	/* If by chance all the CA Cong Settings are default, output atleast 1 chunk
+         * for illustration */
+	if (!cacongoutputcount)
+		fprintf(out,
+			"# SL = 0\n"
+			"cc_ca_cong_setting_ccti_timer 0 %u\n"
+			"cc_ca_cong_setting_ccti_increase 0 %u\n"
+			"cc_ca_cong_setting_trigger_threshold 0 %u\n"
+			"cc_ca_cong_setting_ccti_min 0 %u\n\n",
+			cl_ntoh16(p_opts->cc_ca_cong_entries[0].ccti_timer),
+			p_opts->cc_ca_cong_entries[0].ccti_increase,
+			p_opts->cc_ca_cong_entries[0].trigger_threshold,
+			p_opts->cc_ca_cong_entries[0].ccti_min);
+
+	fprintf(out,
+		"#\n# Congestion Control Table\n#\n"
+		"# Comma separated list of CCT entries representing CCT.\n"
+		"# Format is shift:multipler,shift_multiplier,shift:multiplier,...\n"
+		"cc_cct ");
+
+	if (!p_opts->cc_cct.entries_len) {
+		fprintf(out, "%s\n", null_str);
+	}
+	else {
+		fprintf(out, "%u:%u",
+			p_opts->cc_cct.entries[0].shift,
+			p_opts->cc_cct.entries[0].multiplier);
+		for (i = 0; i < p_opts->cc_cct.entries_len; i++) {
+			fprintf(out, ",%u:%u",
+				p_opts->cc_cct.entries[0].shift,
+				p_opts->cc_cct.entries[0].multiplier);
+		}
+		fprintf(out, "\n");
+	}
+	fprintf(out, "\n");
+
+	fprintf(out,
 		"# Prefix routes file name\n"
 		"prefix_routes_file %s\n\n",
 		p_opts->prefix_routes_file);
@@ -1694,12 +2828,14 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		"consolidate_ipv6_snm_req %s\n\n",
 		p_opts->consolidate_ipv6_snm_req ? "TRUE" : "FALSE");
 
+	fprintf(out, "# Log prefix\nlog_prefix %s\n\n", p_opts->log_prefix);
+
 	/* optional string attributes ... */
 
 	return 0;
 }
 
-int osm_subn_write_conf_file(char *file_name, IN osm_subn_opt_t *const p_opts)
+int osm_subn_write_conf_file(char *file_name, IN osm_subn_opt_t * p_opts)
 {
 	FILE *opts_file;
 
diff --git a/opensm/osm_sw_info_rcv.c b/opensm/osm_sw_info_rcv.c
index ce86adb..84e7fe0 100644
--- a/opensm/osm_sw_info_rcv.c
+++ b/opensm/osm_sw_info_rcv.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -49,66 +50,19 @@
 #include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SW_INFO_RCV_C
 #include <opensm/osm_log.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_subnet.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_opensm.h>
 
-/**********************************************************************
- The plock must be held before calling this function.
-**********************************************************************/
-static void
-__osm_si_rcv_get_port_info(IN osm_sm_t * sm, IN osm_switch_t * const p_sw)
-{
-	osm_madw_context_t context;
-	uint8_t port_num;
-	osm_physp_t *p_physp;
-	osm_node_t *p_node;
-	uint8_t num_ports;
-	ib_api_status_t status = IB_SUCCESS;
-
-	OSM_LOG_ENTER(sm->p_log);
-
-	CL_ASSERT(p_sw);
-
-	p_node = p_sw->p_node;
-
-	CL_ASSERT(osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH);
-
-	/*
-	   Request PortInfo attribute for each port on the switch.
-	 */
-	p_physp = osm_node_get_physp_ptr(p_node, 0);
-
-	context.pi_context.node_guid = osm_node_get_node_guid(p_node);
-	context.pi_context.port_guid = osm_physp_get_port_guid(p_physp);
-	context.pi_context.set_method = FALSE;
-	context.pi_context.light_sweep = FALSE;
-	context.pi_context.active_transition = FALSE;
-
-	num_ports = osm_node_get_num_physp(p_node);
-
-	for (port_num = 0; port_num < num_ports; port_num++) {
-		status = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_physp),
-				     IB_MAD_ATTR_PORT_INFO, cl_hton32(port_num),
-				     CL_DISP_MSGID_NONE, &context);
-		if (status != IB_SUCCESS)
-			/* continue the loop despite the error */
-			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3602: "
-				"Failure initiating PortInfo request (%s)\n",
-				ib_get_err_str(status));
-	}
-
-	OSM_LOG_EXIT(sm->p_log);
-}
-
 #if 0
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
-static void
-__osm_si_rcv_get_fwd_tbl(IN osm_sm_t * sm, IN osm_switch_t * const p_sw)
+static void si_rcv_get_fwd_tbl(IN osm_sm_t * sm, IN osm_switch_t * p_sw)
 {
 	osm_madw_context_t context;
 	osm_dr_path_t *p_dr_path;
@@ -154,8 +108,7 @@ __osm_si_rcv_get_fwd_tbl(IN osm_sm_t * sm, IN osm_switch_t * const p_sw)
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
-static void
-__osm_si_rcv_get_mcast_fwd_tbl(IN osm_sm_t * sm, IN osm_switch_t * const p_sw)
+static void si_rcv_get_mcast_fwd_tbl(IN osm_sm_t * sm, IN osm_switch_t * p_sw)
 {
 	osm_madw_context_t context;
 	osm_dr_path_t *p_dr_path;
@@ -240,10 +193,8 @@ Exit:
 /**********************************************************************
    Lock must be held on entry to this function.
 **********************************************************************/
-static void
-__osm_si_rcv_process_new(IN osm_sm_t * sm,
-			 IN osm_node_t * const p_node,
-			 IN const osm_madw_t * const p_madw)
+static void si_rcv_process_new(IN osm_sm_t * sm, IN osm_node_t * p_node,
+			       IN const osm_madw_t * p_madw)
 {
 	osm_switch_t *p_sw;
 	osm_switch_t *p_check;
@@ -258,16 +209,11 @@ __osm_si_rcv_process_new(IN osm_sm_t * sm,
 	CL_ASSERT(p_madw);
 
 	p_sw_guid_tbl = &sm->p_subn->sw_guid_tbl;
-
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_si = (ib_switch_info_t *) ib_smp_get_payload_ptr(p_smp);
+	p_si = ib_smp_get_payload_ptr(p_smp);
 
-	osm_dump_switch_info(sm->p_log, p_si, OSM_LOG_DEBUG);
+	osm_dump_switch_info_v2(sm->p_log, p_si, FILE_ID, OSM_LOG_DEBUG);
 
-	/*
-	   Allocate a new switch object for this switch,
-	   and place it in the switch table.
-	 */
 	p_sw = osm_switch_new(p_node, p_madw);
 	if (p_sw == NULL) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3608: "
@@ -276,8 +222,10 @@ __osm_si_rcv_process_new(IN osm_sm_t * sm,
 	}
 
 	/* set subnet max mlid to the minimum MulticastFDBCap of all switches */
-	if (p_sw->mcast_tbl.max_mlid_ho < sm->p_subn->max_mcast_lid_ho) {
-		sm->p_subn->max_mcast_lid_ho = p_sw->mcast_tbl.max_mlid_ho;
+	if (cl_ntoh16(p_si->mcast_cap) + IB_LID_MCAST_START_HO - 1 <
+	    sm->p_subn->max_mcast_lid_ho) {
+		sm->p_subn->max_mcast_lid_ho = cl_ntoh16(p_si->mcast_cap) +
+			IB_LID_MCAST_START_HO - 1;
 		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 			"Subnet max multicast lid is 0x%X\n",
 			sm->p_subn->max_mcast_lid_ho);
@@ -294,11 +242,8 @@ __osm_si_rcv_process_new(IN osm_sm_t * sm,
 	p_check = (osm_switch_t *) cl_qmap_insert(p_sw_guid_tbl,
 						  osm_node_get_node_guid
 						  (p_node), &p_sw->map_item);
-
 	if (p_check != p_sw) {
-		/*
-		   This shouldn't happen since we hold the lock!
-		 */
+		/* This shouldn't happen since we hold the lock! */
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3605: "
 			"Unable to add new switch object to database\n");
 		osm_switch_delete(&p_sw);
@@ -307,20 +252,11 @@ __osm_si_rcv_process_new(IN osm_sm_t * sm,
 
 	p_node->sw = p_sw;
 
-	/*
-	   Update the switch info according to the
-	   info we just received.
-	 */
+	/* Update the switch info according to the info we just received. */
 	osm_switch_set_switch_info(p_sw, p_si);
-	p_sw->discovery_count++;
-
-	/*
-	   Get the PortInfo attribute for every port.
-	 */
-	__osm_si_rcv_get_port_info(sm, p_sw);
 
-	/*
-	   Don't bother retrieving the current unicast and multicast tables
+#if 0
+	/* Don't bother retrieving the current unicast and multicast tables
 	   from the switches.  The current version of SM does
 	   not support silent take-over of an existing multicast
 	   configuration.
@@ -328,12 +264,11 @@ __osm_si_rcv_process_new(IN osm_sm_t * sm,
 	   Gathering the multicast tables can also generate large amounts
 	   of extra subnet-init traffic.
 
-	   The code to retrieve the tables was fully debugged.
-	 */
-#if 0
-	__osm_si_rcv_get_fwd_tbl(sm, p_sw);
+	   The code to retrieve the tables was fully debugged. */
+
+	si_rcv_get_fwd_tbl(sm, p_sw);
 	if (!sm->p_subn->opt.disable_multicast)
-		__osm_si_rcv_get_mcast_fwd_tbl(sm, p_sw);
+		si_rcv_get_mcast_fwd_tbl(sm, p_sw);
 #endif
 
 Exit:
@@ -345,10 +280,9 @@ Exit:
    Return 1 if the caller is expected to send a change_detected event.
    this can not be done internally as the event needs the lock...
 **********************************************************************/
-static boolean_t
-__osm_si_rcv_process_existing(IN osm_sm_t * sm,
-			      IN osm_node_t * const p_node,
-			      IN const osm_madw_t * const p_madw)
+static boolean_t si_rcv_process_existing(IN osm_sm_t * sm,
+					 IN osm_node_t * p_node,
+					 IN const osm_madw_t * p_madw)
 {
 	osm_switch_t *p_sw = p_node->sw;
 	ib_switch_info_t *p_si;
@@ -361,63 +295,25 @@ __osm_si_rcv_process_existing(IN osm_sm_t * sm,
 	CL_ASSERT(p_madw);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_si = (ib_switch_info_t *) ib_smp_get_payload_ptr(p_smp);
+	p_si = ib_smp_get_payload_ptr(p_smp);
 	p_si_context = osm_madw_get_si_context_ptr(p_madw);
 
-	if (p_si_context->set_method) {
-		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-			"Received logical SetResp()\n");
+	OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Received logical %cetResp()\n",
+		p_si_context->set_method ? 'S' : 'G');
 
-		osm_switch_set_switch_info(p_sw, p_si);
-	} else {
-		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-			"Received logical GetResp()\n");
-
-		osm_switch_set_switch_info(p_sw, p_si);
-
-		/*
-		   Check the port state change bit.  If true, then this switch
-		   has seen a port state transition, so continue probing.
-		 */
-		if (p_si_context->light_sweep == TRUE) {
-			/* This is a light sweep */
-			/* If the mad was returned with an error -
-			   signal a change to the state manager. */
-			if (ib_smp_get_status(p_smp) != 0) {
-				OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-					"GetResp() received with error in light sweep. "
-					"Commencing heavy sweep\n");
-				is_change_detected = TRUE;
-			} else {
-				/*
-				   If something changed, then just signal the
-				   state manager.  Don't attempt to probe
-				   further during a light sweep.
-				 */
-				if (ib_switch_info_get_state_change(p_si)) {
-					osm_dump_switch_info(sm->p_log, p_si,
-							     OSM_LOG_DEBUG);
-					is_change_detected = TRUE;
-				}
-			}
-		} else {
-			/*
-			   This is a heavy sweep.  Get information regardless
-			   of the state change bit.
-			 */
-			p_sw->discovery_count++;
+	osm_switch_set_switch_info(p_sw, p_si);
+
+	if (p_si_context->light_sweep == TRUE && !p_si_context->set_method) {
+		/* If state changed bit is on the mad was returned with an
+		   error - signal a change to the state manager. */
+		if (ib_smp_get_status(p_smp) != 0) {
 			OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-				"discovery_count is:%u\n",
-				p_sw->discovery_count);
-
-			/* If this is the first discovery - then get the port_info */
-			if (p_sw->discovery_count == 1)
-				__osm_si_rcv_get_port_info(sm, p_sw);
-			else
-				OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-					"Not discovering again through switch:0x%"
-					PRIx64 "\n",
-					osm_node_get_node_guid(p_sw->p_node));
+				"GetResp() received with error in light sweep. "
+				"Commencing heavy sweep\n");
+			is_change_detected = TRUE;
+		} else if (ib_switch_info_get_state_change(p_si)) {
+			osm_dump_switch_info_v2(sm->p_log, p_si, FILE_ID, OSM_LOG_DEBUG);
+			is_change_detected = TRUE;
 		}
 	}
 
@@ -425,8 +321,6 @@ __osm_si_rcv_process_existing(IN osm_sm_t * sm,
 	return is_change_detected;
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_si_rcv_process(IN void *context, IN void *data)
 {
 	osm_sm_t *sm = context;
@@ -444,13 +338,8 @@ void osm_si_rcv_process(IN void *context, IN void *data)
 	CL_ASSERT(p_madw);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_si = (ib_switch_info_t *) ib_smp_get_payload_ptr(p_smp);
-
-	/*
-	   Acquire the switch object and add the switch info.
-	 */
+	p_si = ib_smp_get_payload_ptr(p_smp);
 	p_context = osm_madw_get_si_context_ptr(p_madw);
-
 	node_guid = p_context->node_guid;
 
 	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
@@ -460,46 +349,35 @@ void osm_si_rcv_process(IN void *context, IN void *data)
 	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
 
 	p_node = osm_get_node_by_guid(sm->p_subn, node_guid);
-	if (!p_node)
+	if (!p_node) {
+		CL_PLOCK_RELEASE(sm->p_lock);
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3606: "
 			"SwitchInfo received for nonexistent node "
 			"with GUID 0x%" PRIx64 "\n", cl_ntoh64(node_guid));
-	else {
-
-		/*
-		   Hack for bad value in Mellanox switch
-		 */
-		if (cl_ntoh16(p_si->lin_top) > IB_LID_UCAST_END_HO) {
-			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3610: "
-				"\n\t\t\t\tBad LinearFDBTop value = 0x%X "
-				"on switch 0x%" PRIx64
-				"\n\t\t\t\tForcing internal correction to 0x%X\n",
-				cl_ntoh16(p_si->lin_top),
-				cl_ntoh64(osm_node_get_node_guid(p_node)), 0);
-
-			p_si->lin_top = 0;
-		}
+		goto Exit;
+	}
 
-		/*
-		   Acquire the switch object for this switch.
-		 */
-		if (!p_node->sw) {
-			__osm_si_rcv_process_new(sm, p_node, p_madw);
-			/*
-			   A new switch was found during the sweep so we need
-			   to ignore the current LFT settings.
-			 */
-			sm->p_subn->ignore_existing_lfts = TRUE;
-		} else {
-			/* we might get back a request for signaling change was detected */
-			if (__osm_si_rcv_process_existing(sm, p_node, p_madw)) {
-				CL_PLOCK_RELEASE(sm->p_lock);
-				sm->p_subn->force_heavy_sweep = TRUE;
-				goto Exit;
-			}
-		}
+	/* Hack for bad value in Mellanox switch */
+	if (cl_ntoh16(p_si->lin_top) > IB_LID_UCAST_END_HO) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3610: "
+			"\n\t\t\t\tBad LinearFDBTop value = 0x%X "
+			"on switch 0x%" PRIx64
+			"\n\t\t\t\tForcing internal correction to 0x%X\n",
+			cl_ntoh16(p_si->lin_top),
+			cl_ntoh64(osm_node_get_node_guid(p_node)), 0);
+		p_si->lin_top = 0;
 	}
 
+	/* Acquire the switch object for this switch. */
+	if (!p_node->sw) {
+		si_rcv_process_new(sm, p_node, p_madw);
+		/* A new switch was found during the sweep so we need
+		   to ignore the current LFT settings. */
+		sm->p_subn->ignore_existing_lfts = TRUE;
+	} else if (si_rcv_process_existing(sm, p_node, p_madw))
+		/* we might get back a request for signaling change was detected */
+		sm->p_subn->force_heavy_sweep = TRUE;
+
 	CL_PLOCK_RELEASE(sm->p_lock);
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
diff --git a/opensm/osm_switch.c b/opensm/osm_switch.c
index 9807791..acc7b26 100644
--- a/opensm/osm_switch.c
+++ b/opensm/osm_switch.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -48,16 +49,24 @@
 #include <string.h>
 #include <complib/cl_math.h>
 #include <iba/ib_types.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_SWITCH_C
 #include <opensm/osm_switch.h>
 
-/**********************************************************************
- **********************************************************************/
-cl_status_t
-osm_switch_set_hops(IN osm_switch_t * const p_sw,
-		    IN const uint16_t lid_ho,
-		    IN const uint8_t port_num, IN const uint8_t num_hops)
+struct switch_port_path {
+	uint8_t port_num;
+	uint32_t path_count;
+	int found_sys_guid;
+	int found_node_guid;
+	uint32_t forwarded_to;
+};
+
+cl_status_t osm_switch_set_hops(IN osm_switch_t * p_sw, IN uint16_t lid_ho,
+				IN uint8_t port_num, IN uint8_t num_hops)
 {
-	if (lid_ho > p_sw->max_lid_ho)
+	if (!lid_ho || lid_ho > p_sw->max_lid_ho)
+		return -1;
+	if (port_num >= p_sw->num_ports)
 		return -1;
 	if (!p_sw->hops[lid_ho]) {
 		p_sw->hops[lid_ho] = malloc(p_sw->num_ports);
@@ -73,77 +82,16 @@ osm_switch_set_hops(IN osm_switch_t * const p_sw,
 	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
-static ib_api_status_t
-osm_switch_init(IN osm_switch_t * const p_sw,
-		IN osm_node_t * const p_node,
-		IN const osm_madw_t * const p_madw)
-{
-	ib_api_status_t status = IB_SUCCESS;
-	ib_switch_info_t *p_si;
-	ib_smp_t *p_smp;
-	uint8_t num_ports;
-	uint32_t port_num;
-
-	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_si = (ib_switch_info_t *) ib_smp_get_payload_ptr(p_smp);
-	num_ports = osm_node_get_num_physp(p_node);
-
-	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_SWITCH_INFO);
-
-	p_sw->p_node = p_node;
-	p_sw->switch_info = *p_si;
-	p_sw->num_ports = num_ports;
-	p_sw->need_update = 2;
-
-	/* Initiate the linear forwarding table */
-
-	if (!p_si->lin_cap) {
-		/* This switch does not support linear forwarding tables */
-		status = IB_UNSUPPORTED;
-		goto Exit;
-	}
-
-	p_sw->lft = malloc(IB_LID_UCAST_END_HO + 1);
-	if (!p_sw->lft) {
-		status = IB_INSUFFICIENT_MEMORY;
-		goto Exit;
-	}
-
-	/* Initialize the table to OSM_NO_PATH, which is "invalid port" */
-	memset(p_sw->lft, OSM_NO_PATH, IB_LID_UCAST_END_HO + 1);
-
-	p_sw->p_prof = malloc(sizeof(*p_sw->p_prof) * num_ports);
-	if (p_sw->p_prof == NULL) {
-		status = IB_INSUFFICIENT_MEMORY;
-		goto Exit;
-	}
-
-	memset(p_sw->p_prof, 0, sizeof(*p_sw->p_prof) * num_ports);
-
-	status = osm_mcast_tbl_init(&p_sw->mcast_tbl,
-				    osm_node_get_num_physp(p_node),
-				    cl_ntoh16(p_si->mcast_cap));
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	for (port_num = 0; port_num < num_ports; port_num++)
-		osm_port_prof_construct(&p_sw->p_prof[port_num]);
-
-Exit:
-	return (status);
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_switch_delete(IN OUT osm_switch_t ** const pp_sw)
+void osm_switch_delete(IN OUT osm_switch_t ** pp_sw)
 {
 	osm_switch_t *p_sw = *pp_sw;
 	unsigned i;
 
 	osm_mcast_tbl_destroy(&p_sw->mcast_tbl);
-	free(p_sw->p_prof);
+	if (p_sw->p_prof)
+		free(p_sw->p_prof);
+	if (p_sw->search_ordering_ports)
+		free(p_sw->search_ordering_ports);
 	if (p_sw->lft)
 		free(p_sw->lft);
 	if (p_sw->new_lft)
@@ -158,34 +106,59 @@ void osm_switch_delete(IN OUT osm_switch_t ** const pp_sw)
 	*pp_sw = NULL;
 }
 
-/**********************************************************************
- **********************************************************************/
-osm_switch_t *osm_switch_new(IN osm_node_t * const p_node,
-			     IN const osm_madw_t * const p_madw)
+osm_switch_t *osm_switch_new(IN osm_node_t * p_node,
+			     IN const osm_madw_t * p_madw)
 {
-	ib_api_status_t status;
 	osm_switch_t *p_sw;
+	ib_switch_info_t *p_si;
+	ib_smp_t *p_smp;
+	uint8_t num_ports;
+	uint32_t port_num;
 
 	CL_ASSERT(p_madw);
 	CL_ASSERT(p_node);
 
-	p_sw = (osm_switch_t *) malloc(sizeof(*p_sw));
-	if (p_sw) {
-		memset(p_sw, 0, sizeof(*p_sw));
-		status = osm_switch_init(p_sw, p_node, p_madw);
-		if (status != IB_SUCCESS)
-			osm_switch_delete(&p_sw);
-	}
+	p_smp = osm_madw_get_smp_ptr(p_madw);
+	p_si = ib_smp_get_payload_ptr(p_smp);
+	num_ports = osm_node_get_num_physp(p_node);
+
+	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_SWITCH_INFO);
+
+	if (!p_si->lin_cap) /* The switch doesn't support LFT */
+		return NULL;
+
+	p_sw = malloc(sizeof(*p_sw));
+	if (!p_sw)
+		return NULL;
+
+	memset(p_sw, 0, sizeof(*p_sw));
+
+	p_sw->p_node = p_node;
+	p_sw->switch_info = *p_si;
+	p_sw->num_ports = num_ports;
+	p_sw->need_update = 2;
+
+	p_sw->p_prof = malloc(sizeof(*p_sw->p_prof) * num_ports);
+	if (!p_sw->p_prof)
+		goto err;
 
-	return (p_sw);
+	memset(p_sw->p_prof, 0, sizeof(*p_sw->p_prof) * num_ports);
+
+	osm_mcast_tbl_init(&p_sw->mcast_tbl, osm_node_get_num_physp(p_node),
+			   cl_ntoh16(p_si->mcast_cap));
+
+	for (port_num = 0; port_num < num_ports; port_num++)
+		osm_port_prof_construct(&p_sw->p_prof[port_num]);
+
+	return p_sw;
+
+err:
+	osm_switch_delete(&p_sw);
+	return NULL;
 }
 
-/**********************************************************************
- **********************************************************************/
-boolean_t
-osm_switch_get_lft_block(IN const osm_switch_t * const p_sw,
-			 IN const uint16_t block_id,
-			 OUT uint8_t * const p_block)
+boolean_t osm_switch_get_lft_block(IN const osm_switch_t * p_sw,
+				   IN uint16_t block_id, OUT uint8_t * p_block)
 {
 	uint16_t base_lid_ho = block_id * IB_SMP_DATA_SIZE;
 
@@ -200,14 +173,11 @@ osm_switch_get_lft_block(IN const osm_switch_t * const p_sw,
 	return TRUE;
 }
 
-/**********************************************************************
- **********************************************************************/
 static struct osm_remote_node *
-osm_switch_find_guid_common(IN const osm_switch_t * const p_sw,
-			    IN struct osm_remote_guids_count *r,
-			    IN uint8_t port_num,
-			    IN int find_sys_guid,
-			    IN int find_node_guid)
+switch_find_guid_common(IN const osm_switch_t * p_sw,
+			IN struct osm_remote_guids_count *r,
+			IN uint8_t port_num, IN int find_sys_guid,
+			IN int find_node_guid)
 {
 	struct osm_remote_node *p_remote_guid = NULL;
 	osm_physp_t *p_physp;
@@ -215,10 +185,13 @@ osm_switch_find_guid_common(IN const osm_switch_t * const p_sw,
 	osm_node_t *p_rem_node;
 	uint64_t sys_guid;
 	uint64_t node_guid;
-	int i;
+	unsigned int i;
 
 	CL_ASSERT(p_sw);
 
+	if (!r)
+		goto out;
+
 	p_physp = osm_node_get_physp_ptr(p_sw->p_node, port_num);
 	p_rem_physp = osm_physp_get_remote(p_physp);
 	p_rem_node = osm_physp_get_node_ptr(p_rem_physp);
@@ -235,34 +208,34 @@ osm_switch_find_guid_common(IN const osm_switch_t * const p_sw,
 		}
 	}
 
+out:
 	return p_remote_guid;
 }
 
 static struct osm_remote_node *
-osm_switch_find_sys_guid_count(IN const osm_switch_t * const p_sw,
-			       IN struct osm_remote_guids_count *r,
-			       IN uint8_t port_num)
+switch_find_sys_guid_count(IN const osm_switch_t * p_sw,
+			   IN struct osm_remote_guids_count *r,
+			   IN uint8_t port_num)
 {
-	return osm_switch_find_guid_common(p_sw, r, port_num, 1, 0);
+	return switch_find_guid_common(p_sw, r, port_num, 1, 0);
 }
 
 static struct osm_remote_node *
-osm_switch_find_node_guid_count(IN const osm_switch_t * const p_sw,
-				IN struct osm_remote_guids_count *r,
-				IN uint8_t port_num)
+switch_find_node_guid_count(IN const osm_switch_t * p_sw,
+			    IN struct osm_remote_guids_count *r,
+			    IN uint8_t port_num)
 {
-	return osm_switch_find_guid_common(p_sw, r, port_num, 0, 1);
+	return switch_find_guid_common(p_sw, r, port_num, 0, 1);
 }
 
-/**********************************************************************
- **********************************************************************/
-uint8_t
-osm_switch_recommend_path(IN const osm_switch_t * const p_sw,
-			  IN osm_port_t * p_port,
-			  IN const uint16_t lid_ho,
-			  IN unsigned start_from,
-			  IN const boolean_t ignore_existing,
-			  IN const boolean_t dor)
+uint8_t osm_switch_recommend_path(IN const osm_switch_t * p_sw,
+				  IN osm_port_t * p_port, IN uint16_t lid_ho,
+				  IN unsigned start_from,
+				  IN boolean_t ignore_existing,
+				  IN boolean_t routing_for_lmc,
+				  IN boolean_t dor,
+				  IN boolean_t port_shifting,
+				  IN uint32_t scatter_ports)
 {
 	/*
 	   We support an enhanced LMC aware routing mode:
@@ -271,10 +244,10 @@ osm_switch_recommend_path(IN const osm_switch_t * const p_sw,
 	   and try and avoid routing again through the same
 	   system / node.
 
-	   If this procedure is provided with the tracking array
-	   and counter we can conduct this algorithm.
+	   Assume if routing_for_lmc is true that this procedure was
+	   provided the tracking array and counter via p_port->priv,
+	   and we can conduct this algorithm.
 	 */
-	boolean_t routing_for_lmc = (p_port->priv != NULL);
 	uint16_t base_lid;
 	uint8_t hops;
 	uint8_t least_hops;
@@ -303,6 +276,14 @@ osm_switch_recommend_path(IN const osm_switch_t * const p_sw,
 	osm_node_t *p_rem_node;
 	osm_node_t *p_rem_node_first = NULL;
 	struct osm_remote_node *p_remote_guid = NULL;
+	struct osm_remote_node null_remote_node = {NULL, 0, 0};
+	struct switch_port_path port_paths[IB_NODE_NUM_PORTS_MAX];
+	unsigned int port_paths_total_paths = 0;
+	unsigned int port_paths_count = 0;
+	uint8_t scatter_possible_ports[IB_NODE_NUM_PORTS_MAX];
+	unsigned int scatter_possible_ports_count = 0;
+	int found_sys_guid = 0;
+	int found_node_guid = 0;
 
 	CL_ASSERT(lid_ho > 0);
 
@@ -327,7 +308,7 @@ osm_switch_recommend_path(IN const osm_switch_t * const p_sw,
 
 	least_hops = osm_switch_get_least_hops(p_sw, base_lid);
 	if (least_hops == OSM_NO_PATH)
-		return (OSM_NO_PATH);
+		return OSM_NO_PATH;
 
 	/*
 	   First, inquire with the forwarding table for an existing
@@ -367,7 +348,7 @@ osm_switch_recommend_path(IN const osm_switch_t * const p_sw,
 				   hop function.
 				 */
 				if (hops == least_hops)
-					return (port_num);
+					return port_num;
 			}
 		}
 	}
@@ -388,7 +369,7 @@ osm_switch_recommend_path(IN const osm_switch_t * const p_sw,
 
 	/* port number starts with one and num_ports is 1 + num phys ports */
 	for (i = start_from; i < start_from + num_ports; i++) {
-		port_num = i%num_ports;
+		port_num = osm_switch_get_dimn_port(p_sw, i % num_ports);
 		if (!port_num ||
 		    osm_switch_get_hop_count(p_sw, base_lid, port_num) !=
 		    least_hops)
@@ -413,16 +394,42 @@ osm_switch_recommend_path(IN const osm_switch_t * const p_sw,
 		check_count =
 		    osm_port_prof_path_count_get(&p_sw->p_prof[port_num]);
 
+
+		if (dor) {
+			/* Get the Remote Node */
+			p_rem_physp = osm_physp_get_remote(p_physp);
+			p_rem_node = osm_physp_get_node_ptr(p_rem_physp);
+			/* use the first dimension, but spread traffic
+			 * out among the group of ports representing
+			 * that dimension */
+			if (!p_rem_node_first)
+				p_rem_node_first = p_rem_node;
+			else if (p_rem_node != p_rem_node_first)
+				continue;
+			if (routing_for_lmc) {
+				struct osm_remote_guids_count *r = p_port->priv;
+				uint8_t rem_port = osm_physp_get_port_num(p_rem_physp);
+				unsigned int j;
+
+				for (j = 0; j < r->count; j++) {
+					p_remote_guid = &r->guids[j];
+					if ((p_remote_guid->node == p_rem_node)
+					    && (p_remote_guid->port == rem_port))
+						break;
+				}
+				if (j == r->count)
+					p_remote_guid = &null_remote_node;
+			}
 		/*
 		   Advanced LMC routing requires tracking of the
 		   best port by the node connected to the other side of
 		   it.
 		 */
-		if (routing_for_lmc) {
+		} else if (routing_for_lmc) {
 			/* Is the sys guid already used ? */
-			p_remote_guid = osm_switch_find_sys_guid_count(p_sw,
-								       p_port->priv,
-								       port_num);
+			p_remote_guid = switch_find_sys_guid_count(p_sw,
+								   p_port->priv,
+								   port_num);
 
 			/* If not update the least hops for this case */
 			if (!p_remote_guid) {
@@ -431,11 +438,14 @@ osm_switch_recommend_path(IN const osm_switch_t * const p_sw,
 					best_port_other_sys = port_num;
 					least_forwarded_to = 0;
 				}
+				found_sys_guid = 0;
 			} else {	/* same sys found - try node */
+
+
 				/* Else is the node guid already used ? */
-				p_remote_guid = osm_switch_find_node_guid_count(p_sw,
-										p_port->priv,
-										port_num);
+				p_remote_guid = switch_find_node_guid_count(p_sw,
+									    p_port->priv,
+									    port_num);
 
 				/* If not update the least hops for this case */
 				if (!p_remote_guid
@@ -446,35 +456,44 @@ osm_switch_recommend_path(IN const osm_switch_t * const p_sw,
 				}
 				/* else prior sys and node guid already used */
 
+				if (!p_remote_guid)
+					found_node_guid = 0;
+				else
+					found_node_guid = 1;
+				found_sys_guid = 1;
 			}	/* same sys found */
 		}
 
+		port_paths[port_paths_count].port_num = port_num;
+		port_paths[port_paths_count].path_count = check_count;
+		if (routing_for_lmc) {
+			port_paths[port_paths_count].found_sys_guid = found_sys_guid;
+			port_paths[port_paths_count].found_node_guid = found_node_guid;
+		}
+		if (routing_for_lmc && p_remote_guid)
+			port_paths[port_paths_count].forwarded_to = p_remote_guid->forwarded_to;
+		else
+			port_paths[port_paths_count].forwarded_to = 0;
+		port_paths_total_paths += check_count;
+		port_paths_count++;
+
 		/* routing for LMC mode */
 		/*
 		   the count is min but also lower then the max subscribed
 		 */
 		if (check_count < least_paths) {
-			if (dor) {
-				/* Get the Remote Node */
-				p_rem_physp = osm_physp_get_remote(p_physp);
-				p_rem_node =
-				    osm_physp_get_node_ptr(p_rem_physp);
-				/* use the first dimension, but spread
-				 * traffic out among the group of ports
-				 * representing that dimension */
-				if (port_found) {
-					if (p_rem_node != p_rem_node_first)
-						continue;
-				} else
-					p_rem_node_first = p_rem_node;
-			}
 			port_found = TRUE;
 			best_port = port_num;
 			least_paths = check_count;
+			scatter_possible_ports_count = 0;
+			scatter_possible_ports[scatter_possible_ports_count++] = port_num;
 			if (routing_for_lmc
 			    && p_remote_guid
 			    && p_remote_guid->forwarded_to < least_forwarded_to)
 				least_forwarded_to = p_remote_guid->forwarded_to;
+		} else if (scatter_ports
+			   && check_count == least_paths) {
+			scatter_possible_ports[scatter_possible_ports_count++] = port_num;
 		} else if (routing_for_lmc
 			   && p_remote_guid
 			   && check_count == least_paths
@@ -485,25 +504,90 @@ osm_switch_recommend_path(IN const osm_switch_t * const p_sw,
 	}
 
 	if (port_found == FALSE)
-		return (OSM_NO_PATH);
+		return OSM_NO_PATH;
+
+	if (port_shifting && port_paths_count) {
+		/* In the port_paths[] array, we now have all the ports that we
+		 * can route out of.  Using some shifting math below, possibly
+		 * select a different one so that lids won't align in LFTs
+		 *
+		 * If lmc > 0, we need to loop through these ports to find the
+		 * least_forwarded_to port, best_port_other_sys, and
+		 * best_port_other_node just like before but through the different
+		 * ordering.
+		 */
+
+		least_paths = 0xFFFFFFFF;
+		least_paths_other_sys = 0xFFFFFFFF;
+		least_paths_other_nodes = 0xFFFFFFFF;
+	        least_forwarded_to = 0xFFFFFFFF;
+		best_port = 0;
+		best_port_other_sys = 0;
+		best_port_other_node = 0;
+
+		for (i = 0; i < port_paths_count; i++) {
+			unsigned int idx;
+
+			idx = (port_paths_total_paths/port_paths_count + i) % port_paths_count;
+
+			if (routing_for_lmc) {
+				if (!port_paths[idx].found_sys_guid
+				    && port_paths[idx].path_count < least_paths_other_sys) {
+					least_paths_other_sys = port_paths[idx].path_count;
+					best_port_other_sys = port_paths[idx].port_num;
+					least_forwarded_to = 0;
+				}
+				else if (!port_paths[idx].found_node_guid
+					 && port_paths[idx].path_count < least_paths_other_nodes) {
+					least_paths_other_nodes = port_paths[idx].path_count;
+					best_port_other_node = port_paths[idx].port_num;
+					least_forwarded_to = 0;
+				}
+			}
+
+			if (port_paths[idx].path_count < least_paths) {
+				best_port = port_paths[idx].port_num;
+				least_paths = port_paths[idx].path_count;
+				if (routing_for_lmc
+				    && (port_paths[idx].found_sys_guid
+					|| port_paths[idx].found_node_guid)
+				    && port_paths[idx].forwarded_to < least_forwarded_to)
+					least_forwarded_to = port_paths[idx].forwarded_to;
+			}
+			else if (routing_for_lmc
+				 && (port_paths[idx].found_sys_guid
+				     || port_paths[idx].found_node_guid)
+				 && port_paths[idx].path_count == least_paths
+				 && port_paths[idx].forwarded_to < least_forwarded_to) {
+				least_forwarded_to = port_paths[idx].forwarded_to;
+				best_port = port_paths[idx].port_num;
+			}
+
+		}
+	}
 
 	/*
 	   if we are in enhanced routing mode and the best port is not
 	   the local port 0
 	 */
-	if (routing_for_lmc && best_port) {
+	if (routing_for_lmc && best_port && !scatter_ports) {
 		/* Select the least hop port of the non used sys first */
 		if (best_port_other_sys)
 			best_port = best_port_other_sys;
 		else if (best_port_other_node)
 			best_port = best_port_other_node;
+	} else if (scatter_ports) {
+		/*
+		 * There is some danger that this random could "rebalance" the routes
+		 * every time, to combat this there is a global srandom that
+		 * occurs at the start of every sweep.
+		 */
+		unsigned int idx = random() % scatter_possible_ports_count;
+		best_port = scatter_possible_ports[idx];
 	}
-
-	return (best_port);
+	return best_port;
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_switch_clear_hops(IN osm_switch_t * p_sw)
 {
 	unsigned i;
@@ -513,24 +597,42 @@ void osm_switch_clear_hops(IN osm_switch_t * p_sw)
 			memset(p_sw->hops[i], OSM_NO_PATH, p_sw->num_ports);
 }
 
-/**********************************************************************
- **********************************************************************/
-int
-osm_switch_prepare_path_rebuild(IN osm_switch_t * p_sw, IN uint16_t max_lids)
+static int alloc_lft(IN osm_switch_t * p_sw, uint16_t lids)
+{
+	uint16_t lft_size;
+
+	/* Ensure LFT is in units of LFT block size */
+	lft_size = (lids / IB_SMP_DATA_SIZE + 1) * IB_SMP_DATA_SIZE;
+	if (lft_size > p_sw->lft_size) {
+		uint8_t *new_lft = realloc(p_sw->lft, lft_size);
+		if (!new_lft)
+			return -1;
+		memset(new_lft + p_sw->lft_size, OSM_NO_PATH,
+		       lft_size - p_sw->lft_size);
+		p_sw->lft = new_lft;
+		p_sw->lft_size = lft_size;
+	}
+
+	return 0;
+}
+
+int osm_switch_prepare_path_rebuild(IN osm_switch_t * p_sw, IN uint16_t max_lids)
 {
 	uint8_t **hops;
 	unsigned i;
 
+	if (alloc_lft(p_sw, max_lids))
+		return -1;
+
 	for (i = 0; i < p_sw->num_ports; i++)
 		osm_port_prof_construct(&p_sw->p_prof[i]);
 
 	osm_switch_clear_hops(p_sw);
 
-	if (!p_sw->new_lft &&
-	    !(p_sw->new_lft = malloc(IB_LID_UCAST_END_HO + 1)))
-		return IB_INSUFFICIENT_MEMORY;
+	if (!(p_sw->new_lft = realloc(p_sw->new_lft, p_sw->lft_size)))
+		return -1;
 
-	memset(p_sw->new_lft, OSM_NO_PATH, IB_LID_UCAST_END_HO + 1);
+	memset(p_sw->new_lft, OSM_NO_PATH, p_sw->lft_size);
 
 	if (!p_sw->hops) {
 		hops = malloc((max_lids + 1) * sizeof(hops[0]));
@@ -540,29 +642,21 @@ osm_switch_prepare_path_rebuild(IN osm_switch_t * p_sw, IN uint16_t max_lids)
 		p_sw->hops = hops;
 		p_sw->num_hops = max_lids + 1;
 	} else if (max_lids + 1 > p_sw->num_hops) {
-		uint8_t **old_hops;
-
-		hops = malloc((max_lids + 1) * sizeof(hops[0]));
+		hops = realloc(p_sw->hops, (max_lids + 1) * sizeof(hops[0]));
 		if (!hops)
 			return -1;
-		memcpy(hops, p_sw->hops, p_sw->num_hops * sizeof(hops[0]));
 		memset(hops + p_sw->num_hops, 0,
 		       (max_lids + 1 - p_sw->num_hops) * sizeof(hops[0]));
-		old_hops = p_sw->hops;
 		p_sw->hops = hops;
 		p_sw->num_hops = max_lids + 1;
-		free(old_hops);
 	}
 	p_sw->max_lid_ho = max_lids;
 
 	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
-uint8_t
-osm_switch_get_port_least_hops(IN const osm_switch_t * const p_sw,
-			       IN const osm_port_t * p_port)
+uint8_t osm_switch_get_port_least_hops(IN const osm_switch_t * p_sw,
+				       IN const osm_port_t * p_port)
 {
 	uint16_t lid;
 
@@ -585,13 +679,10 @@ osm_switch_get_port_least_hops(IN const osm_switch_t * const p_sw,
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-uint8_t
-osm_switch_recommend_mcast_path(IN osm_switch_t * const p_sw,
-				IN osm_port_t * p_port,
-				IN uint16_t const mlid_ho,
-				IN boolean_t const ignore_existing)
+uint8_t osm_switch_recommend_mcast_path(IN osm_switch_t * p_sw,
+					IN osm_port_t * p_port,
+					IN uint16_t mlid_ho,
+					IN boolean_t ignore_existing)
 {
 	uint16_t base_lid;
 	uint8_t hops;
@@ -638,7 +729,7 @@ osm_switch_recommend_mcast_path(IN osm_switch_t * const p_sw,
 			hops =
 			    osm_switch_get_hop_count(p_sw, base_lid, port_num);
 			if (hops != OSM_NO_PATH)
-				return (port_num);
+				return port_num;
 		}
 	}
 
@@ -657,11 +748,13 @@ osm_switch_recommend_mcast_path(IN osm_switch_t * const p_sw,
 	   a black hole that will destroy the Earth in a firey conflagration.
 	 */
 	least_hops = osm_switch_get_least_hops(p_sw, base_lid);
+	if (least_hops == OSM_NO_PATH)
+		return OSM_NO_PATH;
 	for (port_num = 1; port_num < num_ports; port_num++)
 		if (osm_switch_get_hop_count(p_sw, base_lid, port_num) ==
 		    least_hops)
 			break;
 
 	CL_ASSERT(port_num < num_ports);
-	return (port_num);
+	return port_num;
 }
diff --git a/opensm/osm_torus.c b/opensm/osm_torus.c
new file mode 100644
index 0000000..addda89
--- /dev/null
+++ b/opensm/osm_torus.c
@@ -0,0 +1,9324 @@
+/*
+ * Copyright 2009 Sandia Corporation.  Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
+ * certain rights in this software.
+ * Copyright (c) 2009-2011 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved.
+ *
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+/* for getline() in stdio.h */
+#define _GNU_SOURCE
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif				/* HAVE_CONFIG_H */
+
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_TORUS_C
+#include <opensm/osm_log.h>
+#include <opensm/osm_port.h>
+#include <opensm/osm_switch.h>
+#include <opensm/osm_node.h>
+#include <opensm/osm_opensm.h>
+
+#define TORUS_MAX_DIM        3
+#define PORTGRP_MAX_PORTS    16
+#define SWITCH_MAX_PORTGRPS  (1 + 2 * TORUS_MAX_DIM)
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+typedef ib_net64_t guid_t;
+
+/*
+ * An endpoint terminates a link, and is one of three types:
+ *   UNKNOWN  - Uninitialized endpoint.
+ *   SRCSINK  - generates or consumes traffic, and thus has an associated LID;
+ *		  i.e. a CA or router port.
+ *   PASSTHRU - Has no associated LID; i.e. a switch port.
+ *
+ * If it is possible to communicate in-band with a switch, it will require
+ * a port with a GUID in the switch to source/sink that traffic, but there
+ * will be no attached link.  This code assumes there is only one such port.
+ *
+ * Here is an endpoint taxonomy:
+ *
+ *   type == SRCSINK
+ *   link == pointer to a valid struct link
+ *     ==> This endpoint is a CA or router port connected via a link to
+ *	     either a switch or another CA/router.  Thus:
+ *	   n_id ==> identifies the CA/router node GUID
+ *	   sw   ==> NULL
+ *	   port ==> identifies the port on the CA/router this endpoint uses
+ *	   pgrp ==> NULL
+ *
+ *   type == SRCSINK
+ *   link == NULL pointer
+ *     ==> This endpoint is the switch port used for in-band communication
+ *	     with the switch itself.  Thus:
+ *	   n_id ==> identifies the node GUID used to talk to the switch
+ *		      containing this endpoint
+ *	   sw   ==> pointer to valid struct switch containing this endpoint
+ *	   port ==> identifies the port on the switch this endpoint uses
+ *	   pgrp ==> NULL, or pointer to the valid struct port_grp holding
+ *		      the port in a t_switch.
+ *
+ *   type == PASSTHRU
+ *   link == pointer to valid struct link
+ *     ==> This endpoint is a switch port connected via a link to either
+ *	     another switch or a CA/router.  Thus:
+ *	   n_id ==> identifies the node GUID used to talk to the switch
+ *		      containing this endpoint - since each switch is assumed
+ *		      to have only one in-band communication port, this is a
+ *		      convenient unique name for the switch itself.
+ *	   sw   ==> pointer to valid struct switch containing this endpoint,
+ *		      or NULL, in the case of a fabric link that has been
+ *		      disconnected after being transferred to a torus link.
+ *	   port ==> identifies the port on the switch this endpoint uses.
+ *		      Note that in the special case of the coordinate direction
+ *		      links, the port value is -1, as those links aren't
+ *		      really connected to anything.
+ *	   pgrp ==> NULL, or pointer to the valid struct port_grp holding
+ *		      the port in a t_switch.
+ */
+enum endpt_type { UNKNOWN = 0, SRCSINK, PASSTHRU };
+struct torus;
+struct t_switch;
+struct port_grp;
+
+struct endpoint {
+	enum endpt_type type;
+	int port;
+	guid_t n_id;		/* IBA node GUID */
+	void *sw;		/* void* can point to either switch type */
+	struct link *link;
+	struct port_grp *pgrp;
+	void *tmp;
+	/*
+	 * Note: osm_port is only guaranteed to contain a valid pointer
+	 * when the call stack contains torus_build_lfts() or
+	 * osm_port_relink_endpoint().
+	 *
+	 * Otherwise, the opensm core could have deleted an osm_port object
+	 * without notifying us, invalidating the pointer we hold.
+	 *
+	 * When presented with a pointer to an osm_port_t, it is generally
+	 * safe and required to cast osm_port_t:priv to struct endpoint, and
+	 * check that the endpoint's osm_port is the same as the original
+	 * osm_port_t pointer.  Failure to do so means that invalidated
+	 * pointers will go undetected.
+	 */
+	struct osm_port *osm_port;
+};
+
+struct link {
+	struct endpoint end[2];
+};
+
+/*
+ * A port group is a collection of endpoints on a switch that share certain
+ * characteristics.  All the endpoints in a port group must have the same
+ * type.  Furthermore, if that type is PASSTHRU, then the connected links:
+ *   1) are parallel to a given coordinate direction
+ *   2) share the same two switches as endpoints.
+ *
+ * Torus-2QoS uses one master spanning tree for multicast, of which every
+ * multicast group spanning tree is a subtree.  to_stree_root is a pointer
+ * to the next port_grp on the path to the master spanning tree root.
+ * to_stree_tip is a pointer to the next port_grp on the path to a master
+ * spanning tree branch tip.
+ *
+ * Each t_switch can have at most one port_grp with a non-NULL to_stree_root.
+ * Exactly one t_switch in the fabric will have all port_grp objects with
+ * to_stree_root NULL; it is the master spanning tree root.
+ *
+ * A t_switch with all port_grp objects where to_stree_tip is NULL is at a
+ * master spanning tree branch tip.
+ */
+struct port_grp {
+	enum endpt_type type;
+	size_t port_cnt;	/* number of attached ports in group */
+	size_t port_grp;	/* what switch port_grp we're in */
+	unsigned sw_dlid_cnt;	/* switch dlids routed through this group */
+	unsigned ca_dlid_cnt;	/* CA dlids routed through this group */
+	struct t_switch *sw;	/* what switch we're attached to */
+	struct port_grp *to_stree_root;
+	struct port_grp *to_stree_tip;
+	struct endpoint **port;
+};
+
+/*
+ * A struct t_switch is used to represent a switch as placed in a torus.
+ *
+ * A t_switch used to build an N-dimensional torus will have 2N+1 port groups,
+ * used as follows, assuming 0 <= d < N:
+ *   port_grp[2d]   => links leaving in negative direction for coordinate d
+ *   port_grp[2d+1] => links leaving in positive direction for coordinate d
+ *   port_grp[2N]   => endpoints local to switch; i.e., hosts on switch
+ *
+ * struct link objects referenced by a t_switch are assumed to be oriented:
+ * traversing a link from link.end[0] to link.end[1] is always in the positive
+ * coordinate direction.
+ */
+struct t_switch {
+	guid_t n_id;		/* IBA node GUID */
+	int i, j, k;
+	unsigned port_cnt;	/* including management port */
+	struct torus *torus;
+	void *tmp;
+	/*
+	 * Note: osm_switch is only guaranteed to contain a valid pointer
+	 * when the call stack contains torus_build_lfts().
+	 *
+	 * Otherwise, the opensm core could have deleted an osm_switch object
+	 * without notifying us, invalidating the pointer we hold.
+	 *
+	 * When presented with a pointer to an osm_switch_t, it is generally
+	 * safe and required to cast osm_switch_t:priv to struct t_switch, and
+	 * check that the switch's osm_switch is the same as the original
+	 * osm_switch_t pointer.  Failure to do so means that invalidated
+	 * pointers will go undetected.
+	 */
+	struct osm_switch *osm_switch;
+
+	struct port_grp ptgrp[SWITCH_MAX_PORTGRPS];
+	struct endpoint **port;
+};
+
+/*
+ * We'd like to be able to discover the torus topology in a pile of switch
+ * links if we can.  We'll use a struct f_switch to store raw topology for a
+ * fabric description, then contruct the torus topology from struct t_switch
+ * objects as we process the fabric and recover it.
+ */
+struct f_switch {
+	guid_t n_id;		/* IBA node GUID */
+	unsigned port_cnt;	/* including management port */
+	void *tmp;
+	/*
+	 * Same rules apply here as for a struct t_switch member osm_switch.
+	 */
+	struct osm_switch *osm_switch;
+	struct endpoint **port;
+};
+
+struct fabric {
+	osm_opensm_t *osm;
+	unsigned ca_cnt;
+	unsigned link_cnt;
+	unsigned switch_cnt;
+
+	unsigned link_cnt_max;
+	unsigned switch_cnt_max;
+
+	struct link **link;
+	struct f_switch **sw;
+};
+
+struct coord_dirs {
+	/*
+	 * These links define the coordinate directions for the torus.
+	 * They are duplicates of links connected to switches.  Each of
+	 * these links must connect to a common switch.
+	 *
+	 * In the event that a failed switch was specified as one of these
+	 * link endpoints, our algorithm would not be able to find the
+	 * torus in the fabric.  So, we'll allow multiple instances of
+	 * this in the config file to allow improved resiliency.
+	 */
+	struct link xm_link, ym_link, zm_link;
+	struct link xp_link, yp_link, zp_link;
+	/*
+	 * A torus dimension has coordinate values 0, 1, ..., radix - 1.
+	 * The dateline, where we need to change VLs to avoid credit loops,
+	 * for a torus dimension is always between coordinate values
+	 * radix - 1 and 0.  The following specify the dateline location
+	 * relative to the coordinate links shared switch location.
+	 *
+	 * E.g. if the shared switch is at 0,0,0, the following are all
+	 * zero; if the shared switch is at 1,1,1, the following are all
+	 * -1, etc.
+	 *
+	 * Since our SL/VL assignment for a path depends on the position
+	 * of the path endpoints relative to the torus datelines, we need
+	 * this information to keep SL/VL assignment constant in the event
+	 * one of the switches used to specify coordinate directions fails.
+	 */
+	int x_dateline, y_dateline, z_dateline;
+};
+
+struct torus {
+	osm_opensm_t *osm;
+	unsigned ca_cnt;
+	unsigned link_cnt;
+	unsigned switch_cnt;
+	unsigned seed_cnt, seed_idx;
+	unsigned x_sz, y_sz, z_sz;
+
+	unsigned port_order[IB_NODE_NUM_PORTS_MAX+1];
+
+	unsigned sw_pool_sz;
+	unsigned link_pool_sz;
+	unsigned seed_sz;
+	unsigned portgrp_sz;	/* max ports for port groups in this torus */
+
+	struct fabric *fabric;
+	struct t_switch **sw_pool;
+	struct link *link_pool;
+
+	struct coord_dirs *seed;
+	struct t_switch ****sw;
+	struct t_switch *master_stree_root;
+
+	unsigned flags;
+	int debug;
+};
+
+/*
+ * Bits to use in torus.flags
+ */
+#define X_MESH (1U << 0)
+#define Y_MESH (1U << 1)
+#define Z_MESH (1U << 2)
+#define MSG_DEADLOCK (1U << 29)
+#define NOTIFY_CHANGES (1U << 30)
+
+#define ALL_MESH(flags) \
+	((flags & (X_MESH | Y_MESH | Z_MESH)) == (X_MESH | Y_MESH | Z_MESH))
+
+
+struct torus_context {
+	osm_opensm_t *osm;
+	struct torus *torus;
+	struct fabric fabric;
+};
+
+static
+void teardown_fabric(struct fabric *f)
+{
+	unsigned l, p, s;
+	struct endpoint *port;
+	struct f_switch *sw;
+
+	if (!f)
+		return;
+
+	if (f->sw) {
+		/*
+		 * Need to free switches, and also find/free the endpoints
+		 * we allocated for switch management ports.
+		 */
+		for (s = 0; s < f->switch_cnt; s++) {
+			sw = f->sw[s];
+			if (!sw)
+				continue;
+
+			for (p = 0; p < sw->port_cnt; p++) {
+				port = sw->port[p];
+				if (port && !port->link)
+					free(port);	/* management port */
+			}
+			free(sw);
+		}
+		free(f->sw);
+	}
+	if (f->link) {
+		for (l = 0; l < f->link_cnt; l++)
+			if (f->link[l])
+				free(f->link[l]);
+
+		free(f->link);
+	}
+	memset(f, 0, sizeof(*f));
+}
+
+void teardown_torus(struct torus *t)
+{
+	unsigned p, s;
+	struct endpoint *port;
+	struct t_switch *sw;
+
+	if (!t)
+		return;
+
+	if (t->sw_pool) {
+		/*
+		 * Need to free switches, and also find/free the endpoints
+		 * we allocated for switch management ports.
+		 */
+		for (s = 0; s < t->switch_cnt; s++) {
+			sw = t->sw_pool[s];
+			if (!sw)
+				continue;
+
+			for (p = 0; p < sw->port_cnt; p++) {
+				port = sw->port[p];
+				if (port && !port->link)
+					free(port);	/* management port */
+			}
+			free(sw);
+		}
+		free(t->sw_pool);
+	}
+	if (t->link_pool)
+		free(t->link_pool);
+
+	if (t->sw)
+		free(t->sw);
+
+	if (t->seed)
+		free(t->seed);
+
+	free(t);
+}
+
+static
+struct torus_context *torus_context_create(osm_opensm_t *osm)
+{
+	struct torus_context *ctx;
+
+	ctx = calloc(1, sizeof(*ctx));
+	if (ctx)
+		ctx->osm = osm;
+	else
+		OSM_LOG(&osm->log, OSM_LOG_ERROR,
+			"ERR 4E01: calloc: %s\n", strerror(errno));
+
+	return ctx;
+}
+
+static
+void torus_context_delete(void *context)
+{
+	struct torus_context *ctx = context;
+
+	teardown_fabric(&ctx->fabric);
+	if (ctx->torus)
+		teardown_torus(ctx->torus);
+	free(ctx);
+}
+
+static
+bool grow_seed_array(struct torus *t, int new_seeds)
+{
+	unsigned cnt;
+	void *ptr;
+
+	cnt = t->seed_cnt + new_seeds;
+	if (cnt > t->seed_sz) {
+		cnt += 2 + cnt / 2;
+		ptr = realloc(t->seed, cnt * sizeof(*t->seed));
+		if (!ptr)
+			return false;
+		t->seed = ptr;
+		t->seed_sz = cnt;
+		memset(&t->seed[t->seed_cnt], 0,
+		       (cnt - t->seed_cnt) * sizeof(*t->seed));
+	}
+	return true;
+}
+
+static
+struct f_switch *find_f_sw(struct fabric *f, guid_t sw_guid)
+{
+	unsigned s;
+	struct f_switch *sw;
+
+	if (f->sw) {
+		for (s = 0; s < f->switch_cnt; s++) {
+			sw = f->sw[s];
+			if (sw->n_id == sw_guid)
+				return sw;
+		}
+	}
+	return NULL;
+}
+
+static
+struct link *find_f_link(struct fabric *f,
+			 guid_t guid0, int port0, guid_t guid1, int port1)
+{
+	unsigned l;
+	struct link *link;
+
+	if (f->link) {
+		for (l = 0; l < f->link_cnt; l++) {
+			link = f->link[l];
+			if ((link->end[0].n_id == guid0 &&
+			     link->end[0].port == port0 &&
+			     link->end[1].n_id == guid1 &&
+			     link->end[1].port == port1) ||
+			    (link->end[0].n_id == guid1 &&
+			     link->end[0].port == port1 &&
+			     link->end[1].n_id == guid0 &&
+			     link->end[1].port == port0))
+				return link;
+		}
+	}
+	return NULL;
+}
+
+static
+struct f_switch *alloc_fswitch(struct fabric *f,
+			       guid_t sw_id, unsigned port_cnt)
+{
+	size_t new_sw_sz;
+	unsigned cnt_max;
+	struct f_switch *sw = NULL;
+	void *ptr;
+
+	if (f->switch_cnt >= f->switch_cnt_max) {
+
+		cnt_max = 16 + 5 * f->switch_cnt_max / 4;
+		ptr = realloc(f->sw, cnt_max * sizeof(*f->sw));
+		if (!ptr) {
+			OSM_LOG(&f->osm->log, OSM_LOG_ERROR,
+				"ERR 4E02: realloc: %s\n", strerror(errno));
+			goto out;
+		}
+		f->sw = ptr;
+		f->switch_cnt_max = cnt_max;
+		memset(&f->sw[f->switch_cnt], 0,
+		       (f->switch_cnt_max - f->switch_cnt)*sizeof(*f->sw));
+	}
+	new_sw_sz = sizeof(*sw) + port_cnt * sizeof(*sw->port);
+	sw = calloc(1, new_sw_sz);
+	if (!sw) {
+		OSM_LOG(&f->osm->log, OSM_LOG_ERROR,
+			"ERR 4E03: calloc: %s\n", strerror(errno));
+		goto out;
+	}
+	sw->port = (void *)(sw + 1);
+	sw->n_id = sw_id;
+	sw->port_cnt = port_cnt;
+	f->sw[f->switch_cnt++] = sw;
+out:
+	return sw;
+}
+
+static
+struct link *alloc_flink(struct fabric *f)
+{
+	unsigned cnt_max;
+	struct link *l = NULL;
+	void *ptr;
+
+	if (f->link_cnt >= f->link_cnt_max) {
+
+		cnt_max = 16 + 5 * f->link_cnt_max / 4;
+		ptr = realloc(f->link, cnt_max * sizeof(*f->link));
+		if (!ptr) {
+			OSM_LOG(&f->osm->log, OSM_LOG_ERROR,
+				"ERR 4E04: realloc: %s\n", strerror(errno));
+			goto out;
+		}
+		f->link = ptr;
+		f->link_cnt_max = cnt_max;
+		memset(&f->link[f->link_cnt], 0,
+		       (f->link_cnt_max - f->link_cnt) * sizeof(*f->link));
+	}
+	l = calloc(1, sizeof(*l));
+	if (!l) {
+		OSM_LOG(&f->osm->log, OSM_LOG_ERROR,
+			"ERR 4E05: calloc: %s\n", strerror(errno));
+		goto out;
+	}
+	f->link[f->link_cnt++] = l;
+out:
+	return l;
+}
+
+/*
+ * Caller must ensure osm_port points to a valid port which contains
+ * a valid osm_physp_t pointer for port 0, the switch management port.
+ */
+static
+bool build_sw_endpoint(struct fabric *f, osm_port_t *osm_port)
+{
+	int sw_port;
+	guid_t sw_guid;
+	struct osm_switch *osm_sw;
+	struct f_switch *sw;
+	struct endpoint *ep;
+	bool success = false;
+
+	sw_port = osm_physp_get_port_num(osm_port->p_physp);
+	sw_guid = osm_node_get_node_guid(osm_port->p_node);
+	osm_sw = osm_port->p_node->sw;
+
+	/*
+	 * The switch must already exist.
+	 */
+	sw = find_f_sw(f, sw_guid);
+	if (!sw) {
+		OSM_LOG(&f->osm->log, OSM_LOG_ERROR,
+			"ERR 4E06: missing switch w/GUID 0x%04"PRIx64"\n",
+			cl_ntoh64(sw_guid));
+		goto out;
+	}
+	/*
+	 * The endpoint may already exist.
+	 */
+	if (sw->port[sw_port]) {
+		if (sw->port[sw_port]->n_id == sw_guid) {
+			ep = sw->port[sw_port];
+			goto success;
+		} else
+			OSM_LOG(&f->osm->log, OSM_LOG_ERROR,
+				"ERR 4E07: switch port %d has id "
+				"0x%04"PRIx64", expected 0x%04"PRIx64"\n",
+				sw_port, cl_ntoh64(sw->port[sw_port]->n_id),
+				cl_ntoh64(sw_guid));
+		goto out;
+	}
+	ep = calloc(1, sizeof(*ep));
+	if (!ep) {
+		OSM_LOG(&f->osm->log, OSM_LOG_ERROR,
+			"ERR 4E08: allocating endpoint: %s\n", strerror(errno));
+		goto out;
+	}
+	ep->type = SRCSINK;
+	ep->port = sw_port;
+	ep->n_id = sw_guid;
+	ep->link = NULL;
+	ep->sw = sw;
+
+	sw->port[sw_port] = ep;
+
+success:
+	/*
+	 * Fabric objects are temporary, so don't set osm_sw/osm_port priv
+	 * pointers using them.  Wait until torus objects get constructed.
+	 */
+	sw->osm_switch = osm_sw;
+	ep->osm_port = osm_port;
+
+	success = true;
+out:
+	return success;
+}
+
+static
+bool build_ca_link(struct fabric *f,
+		   osm_port_t *osm_port_ca, guid_t sw_guid, int sw_port)
+{
+	int ca_port;
+	guid_t ca_guid;
+	struct link *l;
+	struct f_switch *sw;
+	bool success = false;
+
+	ca_port = osm_physp_get_port_num(osm_port_ca->p_physp);
+	ca_guid = osm_node_get_node_guid(osm_port_ca->p_node);
+
+	/*
+	 * The link may already exist.
+	 */
+	l = find_f_link(f, sw_guid, sw_port, ca_guid, ca_port);
+	if (l) {
+		success = true;
+		goto out;
+	}
+	/*
+	 * The switch must already exist.
+	 */
+	sw = find_f_sw(f, sw_guid);
+	if (!sw) {
+		OSM_LOG(&f->osm->log, OSM_LOG_ERROR,
+			"ERR 4E09: missing switch w/GUID 0x%04"PRIx64"\n",
+			cl_ntoh64(sw_guid));
+		goto out;
+	}
+	l = alloc_flink(f);
+	if (!l)
+		goto out;
+
+	l->end[0].type = PASSTHRU;
+	l->end[0].port = sw_port;
+	l->end[0].n_id = sw_guid;
+	l->end[0].sw = sw;
+	l->end[0].link = l;
+
+	sw->port[sw_port] = &l->end[0];
+
+	l->end[1].type = SRCSINK;
+	l->end[1].port = ca_port;
+	l->end[1].n_id = ca_guid;
+	l->end[1].sw = NULL;		/* Correct for a CA */
+	l->end[1].link = l;
+
+	/*
+	 * Fabric objects are temporary, so don't set osm_sw/osm_port priv
+	 * pointers using them.  Wait until torus objects get constructed.
+	 */
+	l->end[1].osm_port = osm_port_ca;
+
+	++f->ca_cnt;
+	success = true;
+out:
+	return success;
+}
+
+static
+bool build_link(struct fabric *f,
+		guid_t sw_guid0, int sw_port0, guid_t sw_guid1, int sw_port1)
+{
+	struct link *l;
+	struct f_switch *sw0, *sw1;
+	bool success = false;
+
+	/*
+	 * The link may already exist.
+	 */
+	l = find_f_link(f, sw_guid0, sw_port0, sw_guid1, sw_port1);
+	if (l) {
+		success = true;
+		goto out;
+	}
+	/*
+	 * The switches must already exist.
+	 */
+	sw0 = find_f_sw(f, sw_guid0);
+	if (!sw0) {
+		OSM_LOG(&f->osm->log, OSM_LOG_ERROR,
+			"ERR 4E0A: missing switch w/GUID 0x%04"PRIx64"\n",
+			cl_ntoh64(sw_guid0));
+		goto out;
+	}
+	sw1 = find_f_sw(f, sw_guid1);
+	if (!sw1) {
+		OSM_LOG(&f->osm->log, OSM_LOG_ERROR,
+			"ERR 4E0B: missing switch w/GUID 0x%04"PRIx64"\n",
+			cl_ntoh64(sw_guid1));
+		goto out;
+	}
+	l = alloc_flink(f);
+	if (!l)
+		goto out;
+
+	l->end[0].type = PASSTHRU;
+	l->end[0].port = sw_port0;
+	l->end[0].n_id = sw_guid0;
+	l->end[0].sw = sw0;
+	l->end[0].link = l;
+
+	sw0->port[sw_port0] = &l->end[0];
+
+	l->end[1].type = PASSTHRU;
+	l->end[1].port = sw_port1;
+	l->end[1].n_id = sw_guid1;
+	l->end[1].sw = sw1;
+	l->end[1].link = l;
+
+	sw1->port[sw_port1] = &l->end[1];
+
+	success = true;
+out:
+	return success;
+}
+
+static
+bool parse_size(unsigned *tsz, unsigned *tflags, unsigned mask,
+		const char *parse_sep)
+{
+	char *val, *nextchar;
+
+	val = strtok(NULL, parse_sep);
+	if (!val)
+		return false;
+	*tsz = strtoul(val, &nextchar, 0);
+	if (*tsz) {
+		if (*nextchar == 't' || *nextchar == 'T')
+			*tflags &= ~mask;
+		else if (*nextchar == 'm' || *nextchar == 'M')
+			*tflags |= mask;
+		/*
+		 * A torus of radix two is also a mesh of radix two
+		 * with multiple links between switches in that direction.
+		 *
+		 * Make it so always, otherwise the failure case routing
+		 * logic gets confused.
+		 */
+		if (*tsz == 2)
+			*tflags |= mask;
+	}
+	return true;
+}
+
+static
+bool parse_torus(struct torus *t, const char *parse_sep)
+{
+	unsigned i, j, k, cnt;
+	char *ptr;
+	bool success = false;
+
+	/*
+	 * There can be only one.  Ignore the imposters.
+	 */
+	if (t->sw_pool)
+		goto out;
+
+	if (!parse_size(&t->x_sz, &t->flags, X_MESH, parse_sep))
+		goto out;
+
+	if (!parse_size(&t->y_sz, &t->flags, Y_MESH, parse_sep))
+		goto out;
+
+	if (!parse_size(&t->z_sz, &t->flags, Z_MESH, parse_sep))
+		goto out;
+
+	/*
+	 * Set up a linear array of switch pointers big enough to hold
+	 * all expected switches.
+	 */
+	t->sw_pool_sz = t->x_sz * t->y_sz * t->z_sz;
+	t->sw_pool = calloc(t->sw_pool_sz, sizeof(*t->sw_pool));
+	if (!t->sw_pool) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E0C: Torus switch array calloc: %s\n",
+			strerror(errno));
+		goto out;
+	}
+	/*
+	 * Set things up so that t->sw[i][j][k] can point to the i,j,k switch.
+	 */
+	cnt = t->x_sz * (1 + t->y_sz * (1 + t->z_sz));
+	t->sw = malloc(cnt * sizeof(void *));
+	if (!t->sw) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E0D: Torus switch array malloc: %s\n",
+			strerror(errno));
+		goto out;
+	}
+	ptr = (void *)(t->sw);
+
+	ptr += t->x_sz * sizeof(void *);
+	for (i = 0; i < t->x_sz; i++) {
+		t->sw[i] = (void *)ptr;
+		ptr += t->y_sz * sizeof(void *);
+	}
+	for (i = 0; i < t->x_sz; i++)
+		for (j = 0; j < t->y_sz; j++) {
+			t->sw[i][j] = (void *)ptr;
+			ptr += t->z_sz * sizeof(void *);
+		}
+
+	for (i = 0; i < t->x_sz; i++)
+		for (j = 0; j < t->y_sz; j++)
+			for (k = 0; k < t->z_sz; k++)
+				t->sw[i][j][k] = NULL;
+
+	success = true;
+out:
+	return success;
+}
+
+static
+bool parse_port(unsigned *pnum, const char *parse_sep)
+{
+	char *val, *nextchar;
+
+	val = strtok(NULL, parse_sep);
+	if (!val)
+		return false;
+	*pnum = strtoul(val, &nextchar, 0);
+	return true;
+}
+
+static
+bool parse_port_order(struct torus *t, const char *parse_sep)
+{
+	unsigned i, j, k, n;
+
+	for (i = 0; i < ARRAY_SIZE(t->port_order); i++) {
+		if (!parse_port(&(t->port_order[i]), parse_sep))
+			break;
+
+		for (j = 0; j < i; j++) {
+			if (t->port_order[j] == t->port_order[i]) {
+				OSM_LOG(&t->osm->log, OSM_LOG_INFO,
+					"Ignored duplicate port %u in"
+					" port_order parsing\n",
+					t->port_order[j]);
+				i--;	/* Ignore duplicate port number */
+				break;
+			}
+		}
+	}
+
+	n = i;
+	for (j = 0; j < ARRAY_SIZE(t->port_order); j++) {
+		for (k = 0; k < i; k++)
+			if (t->port_order[k] == j)
+				break;
+		if (k >= i)
+			t->port_order[n++] = j;
+	}
+
+	return true;
+}
+
+static
+bool parse_pg_max_ports(struct torus *t, const char *parse_sep)
+{
+	char *val, *nextchar;
+
+	val = strtok(NULL, parse_sep);
+	if (!val)
+		return false;
+	t->portgrp_sz = strtoul(val, &nextchar, 0);
+	return true;
+}
+
+static
+bool parse_guid(struct torus *t, guid_t *guid, const char *parse_sep)
+{
+	char *val;
+	bool success = false;
+
+	val = strtok(NULL, parse_sep);
+	if (!val)
+		goto out;
+	*guid = strtoull(val, NULL, 0);
+	*guid = cl_hton64(*guid);
+
+	success = true;
+out:
+	return success;
+}
+
+static
+bool parse_dir_link(int c_dir, struct torus *t, const char *parse_sep)
+{
+	guid_t sw_guid0, sw_guid1;
+	struct link *l;
+	bool success = false;
+
+	if (!parse_guid(t, &sw_guid0, parse_sep))
+		goto out;
+
+	if (!parse_guid(t, &sw_guid1, parse_sep))
+		goto out;
+
+	if (!t) {
+		success = true;
+		goto out;
+	}
+
+	switch (c_dir) {
+	case -1:
+		l = &t->seed[t->seed_cnt - 1].xm_link;
+		break;
+	case  1:
+		l = &t->seed[t->seed_cnt - 1].xp_link;
+		break;
+	case -2:
+		l = &t->seed[t->seed_cnt - 1].ym_link;
+		break;
+	case  2:
+		l = &t->seed[t->seed_cnt - 1].yp_link;
+		break;
+	case -3:
+		l = &t->seed[t->seed_cnt - 1].zm_link;
+		break;
+	case  3:
+		l = &t->seed[t->seed_cnt - 1].zp_link;
+		break;
+	default:
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E0E: unknown link direction %d\n", c_dir);
+		goto out;
+	}
+	l->end[0].type = PASSTHRU;
+	l->end[0].port = -1;		/* We don't really connect. */
+	l->end[0].n_id = sw_guid0;
+	l->end[0].sw = NULL;		/* Fix this up later. */
+	l->end[0].link = NULL;		/* Fix this up later. */
+
+	l->end[1].type = PASSTHRU;
+	l->end[1].port = -1;		/* We don't really connect. */
+	l->end[1].n_id = sw_guid1;
+	l->end[1].sw = NULL;		/* Fix this up later. */
+	l->end[1].link = NULL;		/* Fix this up later. */
+
+	success = true;
+out:
+	return success;
+}
+
+static
+bool parse_dir_dateline(int c_dir, struct torus *t, const char *parse_sep)
+{
+	char *val;
+	int *dl, max_dl;
+	bool success = false;
+
+	val = strtok(NULL, parse_sep);
+	if (!val)
+		goto out;
+
+	if (!t) {
+		success = true;
+		goto out;
+	}
+
+	switch (c_dir) {
+	case  1:
+		dl = &t->seed[t->seed_cnt - 1].x_dateline;
+		max_dl = t->x_sz;
+		break;
+	case  2:
+		dl = &t->seed[t->seed_cnt - 1].y_dateline;
+		max_dl = t->y_sz;
+		break;
+	case  3:
+		dl = &t->seed[t->seed_cnt - 1].z_dateline;
+		max_dl = t->z_sz;
+		break;
+	default:
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E0F: unknown dateline direction %d\n", c_dir);
+		goto out;
+	}
+	*dl = strtol(val, NULL, 0);
+
+	if ((*dl < 0 && *dl <= -max_dl) || *dl >= max_dl)
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E10: dateline value for coordinate direction %d "
+			"must be %d < dl < %d\n",
+			c_dir, -max_dl, max_dl);
+	else
+		success = true;
+out:
+	return success;
+}
+
+static
+bool parse_config(const char *fn, struct fabric *f, struct torus *t)
+{
+	FILE *fp;
+	unsigned i;
+	char *keyword;
+	char *line_buf = NULL;
+	const char *parse_sep = " \n\t\015";
+	size_t line_buf_sz = 0;
+	size_t line_cntr = 0;
+	ssize_t llen;
+	bool kw_success, success = true;
+
+	if (!grow_seed_array(t, 2))
+		return false;
+
+	for (i = 0; i < ARRAY_SIZE(t->port_order); i++)
+		t->port_order[i] = i;
+
+	fp = fopen(fn, "r");
+	if (!fp) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E11: Opening %s: %s\n", fn, strerror(errno));
+		return false;
+	}
+	t->flags |= NOTIFY_CHANGES;
+	t->portgrp_sz = PORTGRP_MAX_PORTS;
+
+next_line:
+	llen = getline(&line_buf, &line_buf_sz, fp);
+	if (llen < 0)
+		goto out;
+
+	++line_cntr;
+
+	keyword = strtok(line_buf, parse_sep);
+	if (!keyword)
+		goto next_line;
+
+	if (strcmp("torus", keyword) == 0) {
+		kw_success = parse_torus(t, parse_sep);
+	} else if (strcmp("mesh", keyword) == 0) {
+		t->flags |= X_MESH | Y_MESH | Z_MESH;
+		kw_success = parse_torus(t, parse_sep);
+	} else if (strcmp("port_order", keyword) == 0) {
+		kw_success = parse_port_order(t, parse_sep);
+	} else if (strcmp("next_seed", keyword) == 0) {
+		kw_success = grow_seed_array(t, 1);
+		t->seed_cnt++;
+	} else if (strcmp("portgroup_max_ports", keyword) == 0) {
+		kw_success = parse_pg_max_ports(t, parse_sep);
+	} else if (strcmp("xp_link", keyword) == 0) {
+		if (!t->seed_cnt)
+			t->seed_cnt++;
+		kw_success = parse_dir_link(1, t, parse_sep);
+	} else if (strcmp("xm_link", keyword) == 0) {
+		if (!t->seed_cnt)
+			t->seed_cnt++;
+		kw_success = parse_dir_link(-1, t, parse_sep);
+	} else if (strcmp("x_dateline", keyword) == 0) {
+		if (!t->seed_cnt)
+			t->seed_cnt++;
+		kw_success = parse_dir_dateline(1, t, parse_sep);
+	} else if (strcmp("yp_link", keyword) == 0) {
+		if (!t->seed_cnt)
+			t->seed_cnt++;
+		kw_success = parse_dir_link(2, t, parse_sep);
+	} else if (strcmp("ym_link", keyword) == 0) {
+		if (!t->seed_cnt)
+			t->seed_cnt++;
+		kw_success = parse_dir_link(-2, t, parse_sep);
+	} else if (strcmp("y_dateline", keyword) == 0) {
+		if (!t->seed_cnt)
+			t->seed_cnt++;
+		kw_success = parse_dir_dateline(2, t, parse_sep);
+	} else if (strcmp("zp_link", keyword) == 0) {
+		if (!t->seed_cnt)
+			t->seed_cnt++;
+		kw_success = parse_dir_link(3, t, parse_sep);
+	} else if (strcmp("zm_link", keyword) == 0) {
+		if (!t->seed_cnt)
+			t->seed_cnt++;
+		kw_success = parse_dir_link(-3, t, parse_sep);
+	} else if (strcmp("z_dateline", keyword) == 0) {
+		if (!t->seed_cnt)
+			t->seed_cnt++;
+		kw_success = parse_dir_dateline(3, t, parse_sep);
+	} else if (keyword[0] == '#')
+		goto next_line;
+	else {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E12: no keyword found: line %u\n",
+			(unsigned)line_cntr);
+		kw_success = false;
+	}
+	if (!kw_success) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E13: parsing '%s': line %u\n",
+			keyword, (unsigned)line_cntr);
+	}
+	success = success && kw_success;
+	goto next_line;
+
+out:
+	if (line_buf)
+		free(line_buf);
+	fclose(fp);
+	return success;
+}
+
+static
+bool capture_fabric(struct fabric *fabric)
+{
+	osm_subn_t *subnet = &fabric->osm->subn;
+	osm_switch_t *osm_sw;
+	osm_physp_t *lphysp, *rphysp;
+	osm_port_t *lport;
+	osm_node_t *osm_node;
+	cl_map_item_t *item;
+	uint8_t ltype, rtype;
+	int p, port_cnt;
+	guid_t sw_guid;
+	bool success = true;
+
+	OSM_LOG_ENTER(&fabric->osm->log);
+
+	/*
+	 * On OpenSM data structures:
+	 *
+	 * Apparently, every port in a fabric has an associated osm_physp_t,
+	 * but not every port has an associated osm_port_t.  Apparently every
+	 * osm_port_t has an associated osm_physp_t.
+	 *
+	 * So, in order to find the inter-switch links we need to walk the
+	 * switch list and examine each port, via its osm_physp_t object.
+	 *
+	 * But, we need to associate our CA and switch management port
+	 * endpoints with the corresponding osm_port_t objects, in order
+	 * to simplify computation of LFT entries and perform SL lookup for
+	 * path records. Since it is apparently difficult to locate the
+	 * osm_port_t that corresponds to a given osm_physp_t, we also
+	 * need to walk the list of ports indexed by GUID to get access
+	 * to the appropriate osm_port_t objects.
+	 *
+	 * Need to allocate our switches before we do anything else.
+	 */
+	item = cl_qmap_head(&subnet->sw_guid_tbl);
+	while (item != cl_qmap_end(&subnet->sw_guid_tbl)) {
+
+		osm_sw = (osm_switch_t *)item;
+		item = cl_qmap_next(item);
+		osm_node = osm_sw->p_node;
+
+		if (osm_node_get_type(osm_node) != IB_NODE_TYPE_SWITCH)
+			continue;
+
+		port_cnt = osm_node_get_num_physp(osm_node);
+		sw_guid = osm_node_get_node_guid(osm_node);
+
+		success = alloc_fswitch(fabric, sw_guid, port_cnt);
+		if (!success)
+			goto out;
+	}
+	/*
+	 * Now build all our endpoints.
+	 */
+	item = cl_qmap_head(&subnet->port_guid_tbl);
+	while (item != cl_qmap_end(&subnet->port_guid_tbl)) {
+
+		lport = (osm_port_t *)item;
+		item = cl_qmap_next(item);
+
+		lphysp = lport->p_physp;
+		if (!(lphysp && osm_physp_is_valid(lphysp)))
+			continue;
+
+		ltype = osm_node_get_type(lphysp->p_node);
+		/*
+		 * Switch management port is always port 0.
+		 */
+		if (lphysp->port_num == 0 && ltype == IB_NODE_TYPE_SWITCH) {
+			success = build_sw_endpoint(fabric, lport);
+			if (!success)
+				goto out;
+			continue;
+		}
+		rphysp = lphysp->p_remote_physp;
+		if (!(rphysp && osm_physp_is_valid(rphysp)))
+			continue;
+
+		rtype = osm_node_get_type(rphysp->p_node);
+
+		if ((ltype != IB_NODE_TYPE_CA &&
+		     ltype != IB_NODE_TYPE_ROUTER) ||
+		    rtype != IB_NODE_TYPE_SWITCH)
+			continue;
+
+		success =
+			build_ca_link(fabric, lport,
+				      osm_node_get_node_guid(rphysp->p_node),
+				      osm_physp_get_port_num(rphysp));
+		if (!success)
+			goto out;
+	}
+	/*
+	 * Lastly, build all our interswitch links.
+	 */
+	item = cl_qmap_head(&subnet->sw_guid_tbl);
+	while (item != cl_qmap_end(&subnet->sw_guid_tbl)) {
+
+		osm_sw = (osm_switch_t *)item;
+		item = cl_qmap_next(item);
+
+		port_cnt = osm_node_get_num_physp(osm_sw->p_node);
+		for (p = 0; p < port_cnt; p++) {
+
+			lphysp = osm_node_get_physp_ptr(osm_sw->p_node, p);
+			if (!(lphysp && osm_physp_is_valid(lphysp)))
+				continue;
+
+			rphysp = lphysp->p_remote_physp;
+			if (!(rphysp && osm_physp_is_valid(rphysp)))
+				continue;
+
+			if (lphysp == rphysp)
+				continue;	/* ignore loopbacks */
+
+			ltype = osm_node_get_type(lphysp->p_node);
+			rtype = osm_node_get_type(rphysp->p_node);
+
+			if (ltype != IB_NODE_TYPE_SWITCH ||
+			    rtype != IB_NODE_TYPE_SWITCH)
+				continue;
+
+			success =
+				build_link(fabric,
+					   osm_node_get_node_guid(lphysp->p_node),
+					   osm_physp_get_port_num(lphysp),
+					   osm_node_get_node_guid(rphysp->p_node),
+					   osm_physp_get_port_num(rphysp));
+			if (!success)
+				goto out;
+		}
+	}
+out:
+	OSM_LOG_EXIT(&fabric->osm->log);
+	return success;
+}
+
+/*
+ * diagnose_fabric() is just intended to report on fabric elements that
+ * could not be placed into the torus.  We want to warn that there were
+ * non-torus fabric elements, but they will be ignored for routing purposes.
+ * Having them is not an error, and diagnose_fabric() thus has no return
+ * value.
+ */
+static
+void diagnose_fabric(struct fabric *f)
+{
+	struct link *l;
+	struct endpoint *ep;
+	unsigned k, p;
+
+	/*
+	 * Report on any links that didn't get transferred to the torus.
+	 */
+	for (k = 0; k < f->link_cnt; k++) {
+		l = f->link[k];
+
+		if (!(l->end[0].sw && l->end[1].sw))
+			continue;
+
+		OSM_LOG(&f->osm->log, OSM_LOG_INFO,
+			"Found non-torus fabric link:"
+			" sw GUID 0x%04"PRIx64" port %d <->"
+			" sw GUID 0x%04"PRIx64" port %d\n",
+			cl_ntoh64(l->end[0].n_id), l->end[0].port,
+			cl_ntoh64(l->end[1].n_id), l->end[1].port);
+	}
+	/*
+	 * Report on any switches with ports using endpoints that didn't
+	 * get transferred to the torus.
+	 */
+	for (k = 0; k < f->switch_cnt; k++)
+		for (p = 0; p < f->sw[k]->port_cnt; p++) {
+
+			if (!f->sw[k]->port[p])
+				continue;
+
+			ep = f->sw[k]->port[p];
+
+			/*
+			 * We already reported on inter-switch links above.
+			 */
+			if (ep->type == PASSTHRU)
+				continue;
+
+			OSM_LOG(&f->osm->log, OSM_LOG_INFO,
+				"Found non-torus fabric port:"
+				" sw GUID 0x%04"PRIx64" port %d\n",
+				cl_ntoh64(f->sw[k]->n_id), p);
+		}
+}
+
+static
+struct t_switch *alloc_tswitch(struct torus *t, struct f_switch *fsw)
+{
+	unsigned g;
+	size_t new_sw_sz;
+	struct t_switch *sw = NULL;
+	void *ptr;
+
+	if (!fsw)
+		goto out;
+
+	if (t->switch_cnt >= t->sw_pool_sz) {
+		/*
+		 * This should never happen, but occasionally a particularly
+		 * pathological fabric can induce it.  So log an error.
+		 */
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E14: unexpectedly requested too many switch "
+			"structures!\n");
+		goto out;
+	}
+	new_sw_sz = sizeof(*sw)
+		+ fsw->port_cnt * sizeof(*sw->port)
+		+ SWITCH_MAX_PORTGRPS * t->portgrp_sz * sizeof(*sw->ptgrp[0].port);
+	sw = calloc(1, new_sw_sz);
+	if (!sw) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E15: calloc: %s\n", strerror(errno));
+		goto out;
+	}
+	sw->port = (void *)(sw + 1);
+	sw->n_id = fsw->n_id;
+	sw->port_cnt = fsw->port_cnt;
+	sw->torus = t;
+	sw->tmp = fsw;
+
+	ptr = &sw->port[sw->port_cnt];
+
+	for (g = 0; g < SWITCH_MAX_PORTGRPS; g++) {
+		sw->ptgrp[g].port_grp = g;
+		sw->ptgrp[g].sw = sw;
+		sw->ptgrp[g].port = ptr;
+		ptr = &sw->ptgrp[g].port[t->portgrp_sz];
+	}
+	t->sw_pool[t->switch_cnt++] = sw;
+out:
+	return sw;
+}
+
+/*
+ * install_tswitch() expects the switch coordinates i,j,k to be canonicalized
+ * by caller.
+ */
+static
+bool install_tswitch(struct torus *t,
+		     int i, int j, int k, struct f_switch *fsw)
+{
+	struct t_switch **sw = &t->sw[i][j][k];
+
+	if (!*sw)
+		*sw = alloc_tswitch(t, fsw);
+
+	if (*sw) {
+		(*sw)->i = i;
+		(*sw)->j = j;
+		(*sw)->k = k;
+	}
+	return !!*sw;
+}
+
+static
+struct link *alloc_tlink(struct torus *t)
+{
+	if (t->link_cnt >= t->link_pool_sz) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E16: unexpectedly out of pre-allocated link "
+			"structures!\n");
+		return NULL;
+	}
+	return &t->link_pool[t->link_cnt++];
+}
+
+static
+int canonicalize(int v, int vmax)
+{
+	if (v >= 0 && v < vmax)
+		return v;
+
+	if (v < 0)
+		v += vmax * (1 - v/vmax);
+
+	return v % vmax;
+}
+
+static
+unsigned set_fp_bit(bool present, int i, int j, int k)
+{
+	return (unsigned)(!present) << (i + 2 * j + 4 * k);
+}
+
+/*
+ * Returns an 11-bit fingerprint of what switches are absent in a cube of
+ * neighboring switches.  Each bit 0-7 corresponds to a corner of the cube;
+ * if a bit is set the corresponding switch is absent.
+ *
+ * Bits 8-10 distinguish between 2D and 3D cases.  If bit 8+d is set,
+ * for 0 <= d < 3;  the d dimension of the desired torus has radix greater
+ * than 1. Thus, if all bits 8-10 are set, the desired torus is 3D.
+ */
+static
+unsigned fingerprint(struct torus *t, int i, int j, int k)
+{
+	unsigned fp;
+	int ip1, jp1, kp1;
+	int x_sz_gt1, y_sz_gt1, z_sz_gt1;
+
+	x_sz_gt1 = t->x_sz > 1;
+	y_sz_gt1 = t->y_sz > 1;
+	z_sz_gt1 = t->z_sz > 1;
+
+	ip1 = canonicalize(i + 1, t->x_sz);
+	jp1 = canonicalize(j + 1, t->y_sz);
+	kp1 = canonicalize(k + 1, t->z_sz);
+
+	fp  = set_fp_bit(t->sw[i][j][k], 0, 0, 0);
+	fp |= set_fp_bit(t->sw[ip1][j][k], x_sz_gt1, 0, 0);
+	fp |= set_fp_bit(t->sw[i][jp1][k], 0, y_sz_gt1, 0);
+	fp |= set_fp_bit(t->sw[ip1][jp1][k], x_sz_gt1, y_sz_gt1, 0);
+	fp |= set_fp_bit(t->sw[i][j][kp1], 0, 0, z_sz_gt1);
+	fp |= set_fp_bit(t->sw[ip1][j][kp1], x_sz_gt1, 0, z_sz_gt1);
+	fp |= set_fp_bit(t->sw[i][jp1][kp1], 0, y_sz_gt1, z_sz_gt1);
+	fp |= set_fp_bit(t->sw[ip1][jp1][kp1], x_sz_gt1, y_sz_gt1, z_sz_gt1);
+
+	fp |= x_sz_gt1 << 8;
+	fp |= y_sz_gt1 << 9;
+	fp |= z_sz_gt1 << 10;
+
+	return fp;
+}
+
+static
+bool connect_tlink(struct port_grp *pg0, struct endpoint *f_ep0,
+		   struct port_grp *pg1, struct endpoint *f_ep1,
+		   struct torus *t)
+{
+	struct link *l;
+	bool success = false;
+
+	if (pg0->port_cnt == t->portgrp_sz) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E17: exceeded port group max "
+			"port count (%d): switch GUID 0x%04"PRIx64"\n",
+			t->portgrp_sz, cl_ntoh64(pg0->sw->n_id));
+		goto out;
+	}
+	if (pg1->port_cnt == t->portgrp_sz) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E18: exceeded port group max "
+			"port count (%d): switch GUID 0x%04"PRIx64"\n",
+			t->portgrp_sz, cl_ntoh64(pg1->sw->n_id));
+		goto out;
+	}
+	l = alloc_tlink(t);
+	if (!l)
+		goto out;
+
+	l->end[0].type = f_ep0->type;
+	l->end[0].port = f_ep0->port;
+	l->end[0].n_id = f_ep0->n_id;
+	l->end[0].sw = pg0->sw;
+	l->end[0].link = l;
+	l->end[0].pgrp = pg0;
+	pg0->port[pg0->port_cnt++] = &l->end[0];
+	pg0->sw->port[f_ep0->port] = &l->end[0];
+
+	if (f_ep0->osm_port) {
+		l->end[0].osm_port = f_ep0->osm_port;
+		l->end[0].osm_port->priv = &l->end[0];
+		f_ep0->osm_port = NULL;
+	}
+
+	l->end[1].type = f_ep1->type;
+	l->end[1].port = f_ep1->port;
+	l->end[1].n_id = f_ep1->n_id;
+	l->end[1].sw = pg1->sw;
+	l->end[1].link = l;
+	l->end[1].pgrp = pg1;
+	pg1->port[pg1->port_cnt++] = &l->end[1];
+	pg1->sw->port[f_ep1->port] = &l->end[1];
+
+	if (f_ep1->osm_port) {
+		l->end[1].osm_port = f_ep1->osm_port;
+		l->end[1].osm_port->priv = &l->end[1];
+		f_ep1->osm_port = NULL;
+	}
+	/*
+	 * Disconnect fabric link, so that later we can see if any were
+	 * left unconnected in the torus.
+	 */
+	((struct f_switch *)f_ep0->sw)->port[f_ep0->port] = NULL;
+	f_ep0->sw = NULL;
+	f_ep0->port = -1;
+
+	((struct f_switch *)f_ep1->sw)->port[f_ep1->port] = NULL;
+	f_ep1->sw = NULL;
+	f_ep1->port = -1;
+
+	success = true;
+out:
+	return success;
+}
+
+static
+bool link_tswitches(struct torus *t, int cdir,
+		    struct t_switch *t_sw0, struct t_switch *t_sw1)
+{
+	int p;
+	struct port_grp *pg0, *pg1;
+	struct f_switch *f_sw0, *f_sw1;
+	char *cdir_name = "unknown";
+	unsigned port_cnt;
+	int success = false;
+
+	/*
+	 * If this is a 2D torus, it is possible for this function to be
+	 * called with its two switch arguments being the same switch, in
+	 * which case there are no links to install.
+	 */
+	if (t_sw0 == t_sw1 &&
+	    ((cdir == 0 && t->x_sz == 1) ||
+	     (cdir == 1 && t->y_sz == 1) ||
+	     (cdir == 2 && t->z_sz == 1))) {
+		success = true;
+		goto out;
+	}
+	/*
+	 * Ensure that t_sw1 is in the positive cdir direction wrt. t_sw0.
+	 * ring_next_sw() relies on it.
+	 */
+	switch (cdir) {
+	case 0:
+		if (t->x_sz > 1 &&
+		    canonicalize(t_sw0->i + 1, t->x_sz) != t_sw1->i) {
+			cdir_name = "x";
+			goto cdir_error;
+		}
+		break;
+	case 1:
+		if (t->y_sz > 1 &&
+		    canonicalize(t_sw0->j + 1, t->y_sz) != t_sw1->j) {
+			cdir_name = "y";
+			goto cdir_error;
+		}
+		break;
+	case 2:
+		if (t->z_sz > 1 &&
+		    canonicalize(t_sw0->k + 1, t->z_sz) != t_sw1->k) {
+			cdir_name = "z";
+			goto cdir_error;
+		}
+		break;
+	default:
+	cdir_error:
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR, "ERR 4E19: "
+			"sw 0x%04"PRIx64" (%d,%d,%d) <--> "
+			"sw 0x%04"PRIx64" (%d,%d,%d) "
+			"invalid torus %s link orientation\n",
+			cl_ntoh64(t_sw0->n_id), t_sw0->i, t_sw0->j, t_sw0->k,
+			cl_ntoh64(t_sw1->n_id), t_sw1->i, t_sw1->j, t_sw1->k,
+			cdir_name);
+		goto out;
+	}
+
+	f_sw0 = t_sw0->tmp;
+	f_sw1 = t_sw1->tmp;
+
+	if (!f_sw0 || !f_sw1) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E1A: missing fabric switches!\n"
+			"  switch GUIDs: 0x%04"PRIx64" 0x%04"PRIx64"\n",
+			cl_ntoh64(t_sw0->n_id), cl_ntoh64(t_sw1->n_id));
+		goto out;
+	}
+	pg0 = &t_sw0->ptgrp[2*cdir + 1];
+	pg0->type = PASSTHRU;
+
+	pg1 = &t_sw1->ptgrp[2*cdir];
+	pg1->type = PASSTHRU;
+
+	port_cnt = f_sw0->port_cnt;
+	/*
+	 * Find all the links between these two switches.
+	 */
+	for (p = 0; p < port_cnt; p++) {
+		struct endpoint *f_ep0 = NULL, *f_ep1 = NULL;
+
+		if (!f_sw0->port[p] || !f_sw0->port[p]->link)
+			continue;
+
+		if (f_sw0->port[p]->link->end[0].n_id == t_sw0->n_id &&
+		    f_sw0->port[p]->link->end[1].n_id == t_sw1->n_id) {
+
+			f_ep0 = &f_sw0->port[p]->link->end[0];
+			f_ep1 = &f_sw0->port[p]->link->end[1];
+		} else if (f_sw0->port[p]->link->end[1].n_id == t_sw0->n_id &&
+			   f_sw0->port[p]->link->end[0].n_id == t_sw1->n_id) {
+
+			f_ep0 = &f_sw0->port[p]->link->end[1];
+			f_ep1 = &f_sw0->port[p]->link->end[0];
+		} else
+			continue;
+
+		if (!(f_ep0->type == PASSTHRU && f_ep1->type == PASSTHRU)) {
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"ERR 4E1B: not interswitch "
+				"link:\n  0x%04"PRIx64"/%d <-> 0x%04"PRIx64"/%d\n",
+				cl_ntoh64(f_ep0->n_id), f_ep0->port,
+				cl_ntoh64(f_ep1->n_id), f_ep1->port);
+			goto out;
+		}
+		/*
+		 * Skip over links that already have been established in the
+		 * torus.
+		 */
+		if (!(f_ep0->sw && f_ep1->sw))
+			continue;
+
+		if (!connect_tlink(pg0, f_ep0, pg1, f_ep1, t))
+			goto out;
+	}
+	success = true;
+out:
+	return success;
+}
+
+static
+bool link_srcsink(struct torus *t, int i, int j, int k)
+{
+	struct endpoint *f_ep0;
+	struct endpoint *f_ep1;
+	struct t_switch *tsw;
+	struct f_switch *fsw;
+	struct port_grp *pg;
+	struct link *fl, *tl;
+	unsigned p, port_cnt;
+	bool success = false;
+
+	i = canonicalize(i, t->x_sz);
+	j = canonicalize(j, t->y_sz);
+	k = canonicalize(k, t->z_sz);
+
+	tsw = t->sw[i][j][k];
+	if (!tsw)
+		return true;
+
+	fsw = tsw->tmp;
+	/*
+	 * link_srcsink is supposed to get called once for every switch in
+	 * the fabric.  At this point every fsw we encounter must have a
+	 * non-null osm_switch.  Otherwise something has gone horribly
+	 * wrong with topology discovery; the most likely reason is that
+	 * the fabric contains a radix-4 torus dimension, but the user gave
+	 * a config that didn't say so, breaking all the checking in
+	 * safe_x_perpendicular and friends.
+	 */
+	if (!(fsw && fsw->osm_switch)) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E1C: Invalid topology discovery. "
+			"Verify torus-2QoS.conf contents.\n");
+		return false;
+	}
+
+	pg = &tsw->ptgrp[2 * TORUS_MAX_DIM];
+	pg->type = SRCSINK;
+	tsw->osm_switch = fsw->osm_switch;
+	tsw->osm_switch->priv = tsw;
+	fsw->osm_switch = NULL;
+
+	port_cnt = fsw->port_cnt;
+	for (p = 0; p < port_cnt; p++) {
+
+		if (!fsw->port[p])
+			continue;
+
+		if (fsw->port[p]->type == SRCSINK) {
+			/*
+			 * If the endpoint is the switch port used for in-band
+			 * communication with the switch itself, move it to
+			 * the torus.
+			 */
+			if (pg->port_cnt == t->portgrp_sz) {
+				OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+					"ERR 4E1D: exceeded port group max port "
+					"count (%d): switch GUID 0x%04"PRIx64"\n",
+					t->portgrp_sz, cl_ntoh64(tsw->n_id));
+				goto out;
+			}
+			fsw->port[p]->sw = tsw;
+			fsw->port[p]->pgrp = pg;
+			tsw->port[p] = fsw->port[p];
+			tsw->port[p]->osm_port->priv = tsw->port[p];
+			pg->port[pg->port_cnt++] = fsw->port[p];
+			fsw->port[p] = NULL;
+
+		} else if (fsw->port[p]->link &&
+			   fsw->port[p]->type == PASSTHRU) {
+			/*
+			 * If the endpoint is a link to a CA, create a new link
+			 * in the torus.  Disconnect the fabric link.
+			 */
+
+			fl = fsw->port[p]->link;
+
+			if (fl->end[0].sw == fsw) {
+				f_ep0 = &fl->end[0];
+				f_ep1 = &fl->end[1];
+			} else if (fl->end[1].sw == fsw) {
+				f_ep1 = &fl->end[0];
+				f_ep0 = &fl->end[1];
+			} else
+				continue;
+
+			if (f_ep1->type != SRCSINK)
+				continue;
+
+			if (pg->port_cnt == t->portgrp_sz) {
+				OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+					"ERR 4E1E: exceeded port group max port "
+					"count (%d): switch GUID 0x%04"PRIx64"\n",
+					t->portgrp_sz, cl_ntoh64(tsw->n_id));
+				goto out;
+			}
+			/*
+			 * Switch ports connected to links don't get
+			 * associated with osm_port_t objects; see
+			 * capture_fabric().  So just check CA end.
+			 */
+			if (!f_ep1->osm_port) {
+				OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+					"ERR 4E1F: NULL osm_port->priv port "
+					"GUID 0x%04"PRIx64"\n",
+					cl_ntoh64(f_ep1->n_id));
+				goto out;
+			}
+			tl = alloc_tlink(t);
+			if (!tl)
+				continue;
+
+			tl->end[0].type = f_ep0->type;
+			tl->end[0].port = f_ep0->port;
+			tl->end[0].n_id = f_ep0->n_id;
+			tl->end[0].sw = tsw;
+			tl->end[0].link = tl;
+			tl->end[0].pgrp = pg;
+			pg->port[pg->port_cnt++] = &tl->end[0];
+			pg->sw->port[f_ep0->port] =  &tl->end[0];
+
+			tl->end[1].type = f_ep1->type;
+			tl->end[1].port = f_ep1->port;
+			tl->end[1].n_id = f_ep1->n_id;
+			tl->end[1].sw = NULL;	/* Correct for a CA */
+			tl->end[1].link = tl;
+			tl->end[1].pgrp = NULL;	/* Correct for a CA */
+
+			tl->end[1].osm_port = f_ep1->osm_port;
+			tl->end[1].osm_port->priv = &tl->end[1];
+			f_ep1->osm_port = NULL;
+
+			t->ca_cnt++;
+			f_ep0->sw = NULL;
+			f_ep0->port = -1;
+			fsw->port[p] = NULL;
+		}
+	}
+	success = true;
+out:
+	return success;
+}
+
+static
+struct f_switch *ffind_face_corner(struct f_switch *fsw0,
+				   struct f_switch *fsw1,
+				   struct f_switch *fsw2)
+{
+	int p0, p3;
+	struct link *l;
+	struct endpoint *far_end;
+	struct f_switch *fsw, *fsw3 = NULL;
+
+	if (!(fsw0 && fsw1 && fsw2))
+		goto out;
+
+	for (p0 = 0; p0 < fsw0->port_cnt; p0++) {
+		/*
+		 * Ignore everything except switch links that haven't
+		 * been installed into the torus.
+		 */
+		if (!(fsw0->port[p0] && fsw0->port[p0]->sw &&
+		      fsw0->port[p0]->type == PASSTHRU))
+			continue;
+
+		l = fsw0->port[p0]->link;
+
+		if (l->end[0].n_id == fsw0->n_id)
+			far_end = &l->end[1];
+		else
+			far_end = &l->end[0];
+
+		/*
+		 * Ignore CAs
+		 */
+		if (!(far_end->type == PASSTHRU && far_end->sw))
+			continue;
+
+		fsw3 = far_end->sw;
+		if (fsw3->n_id == fsw1->n_id)	/* existing corner */
+			continue;
+
+		for (p3 = 0; p3 < fsw3->port_cnt; p3++) {
+			/*
+			 * Ignore everything except switch links that haven't
+			 * been installed into the torus.
+			 */
+			if (!(fsw3->port[p3] && fsw3->port[p3]->sw &&
+			      fsw3->port[p3]->type == PASSTHRU))
+				continue;
+
+			l = fsw3->port[p3]->link;
+
+			if (l->end[0].n_id == fsw3->n_id)
+				far_end = &l->end[1];
+			else
+				far_end = &l->end[0];
+
+			/*
+			 * Ignore CAs
+			 */
+			if (!(far_end->type == PASSTHRU && far_end->sw))
+				continue;
+
+			fsw = far_end->sw;
+			if (fsw->n_id == fsw2->n_id)
+				goto out;
+		}
+	}
+	fsw3 = NULL;
+out:
+	return fsw3;
+}
+
+static
+struct f_switch *tfind_face_corner(struct t_switch *tsw0,
+				   struct t_switch *tsw1,
+				   struct t_switch *tsw2)
+{
+	if (!(tsw0 && tsw1 && tsw2))
+		return NULL;
+
+	return ffind_face_corner(tsw0->tmp, tsw1->tmp, tsw2->tmp);
+}
+
+/*
+ * This code can break on any torus with a dimension that has radix four.
+ *
+ * What is supposed to happen is that this code will find the
+ * two faces whose shared edge is the desired perpendicular.
+ *
+ * What actually happens is while searching we send two connected
+ * edges that are colinear in a torus dimension with radix four to
+ * ffind_face_corner(), which tries to complete a face by finding a
+ * 4-loop of edges.
+ *
+ * In the radix four torus case, it can find a 4-loop which is a ring in a
+ * dimension with radix four, rather than the desired face.  It thus returns
+ * true when it shouldn't, so the wrong edge is returned as the perpendicular.
+ *
+ * The appropriate instance of safe_N_perpendicular() (where N == x, y, z)
+ * should be used to determine if it is safe to call ffind_perpendicular();
+ * these functions will return false it there is a possibility of finding
+ * a wrong perpendicular.
+ */
+struct f_switch *ffind_3d_perpendicular(struct f_switch *fsw0,
+					struct f_switch *fsw1,
+					struct f_switch *fsw2,
+					struct f_switch *fsw3)
+{
+	int p1;
+	struct link *l;
+	struct endpoint *far_end;
+	struct f_switch *fsw4 = NULL;
+
+	if (!(fsw0 && fsw1 && fsw2 && fsw3))
+		goto out;
+
+	/*
+	 * Look at all the ports on the switch, fsw1,  that is the base of
+	 * the perpendicular.
+	 */
+	for (p1 = 0; p1 < fsw1->port_cnt; p1++) {
+		/*
+		 * Ignore everything except switch links that haven't
+		 * been installed into the torus.
+		 */
+		if (!(fsw1->port[p1] && fsw1->port[p1]->sw &&
+		      fsw1->port[p1]->type == PASSTHRU))
+			continue;
+
+		l = fsw1->port[p1]->link;
+
+		if (l->end[0].n_id == fsw1->n_id)
+			far_end = &l->end[1];
+		else
+			far_end = &l->end[0];
+		/*
+		 * Ignore CAs
+		 */
+		if (!(far_end->type == PASSTHRU && far_end->sw))
+			continue;
+
+		fsw4 = far_end->sw;
+		if (fsw4->n_id == fsw3->n_id)	/* wrong perpendicular */
+			continue;
+
+		if (ffind_face_corner(fsw0, fsw1, fsw4) &&
+		    ffind_face_corner(fsw2, fsw1, fsw4))
+			goto out;
+	}
+	fsw4 = NULL;
+out:
+	return fsw4;
+}
+struct f_switch *ffind_2d_perpendicular(struct f_switch *fsw0,
+					struct f_switch *fsw1,
+					struct f_switch *fsw2)
+{
+	int p1;
+	struct link *l;
+	struct endpoint *far_end;
+	struct f_switch *fsw3 = NULL;
+
+	if (!(fsw0 && fsw1 && fsw2))
+		goto out;
+
+	/*
+	 * Look at all the ports on the switch, fsw1,  that is the base of
+	 * the perpendicular.
+	 */
+	for (p1 = 0; p1 < fsw1->port_cnt; p1++) {
+		/*
+		 * Ignore everything except switch links that haven't
+		 * been installed into the torus.
+		 */
+		if (!(fsw1->port[p1] && fsw1->port[p1]->sw &&
+		      fsw1->port[p1]->type == PASSTHRU))
+			continue;
+
+		l = fsw1->port[p1]->link;
+
+		if (l->end[0].n_id == fsw1->n_id)
+			far_end = &l->end[1];
+		else
+			far_end = &l->end[0];
+		/*
+		 * Ignore CAs
+		 */
+		if (!(far_end->type == PASSTHRU && far_end->sw))
+			continue;
+
+		fsw3 = far_end->sw;
+		if (fsw3->n_id == fsw2->n_id)	/* wrong perpendicular */
+			continue;
+
+		if (ffind_face_corner(fsw0, fsw1, fsw3))
+			goto out;
+	}
+	fsw3 = NULL;
+out:
+	return fsw3;
+}
+
+static
+struct f_switch *tfind_3d_perpendicular(struct t_switch *tsw0,
+					struct t_switch *tsw1,
+					struct t_switch *tsw2,
+					struct t_switch *tsw3)
+{
+	if (!(tsw0 && tsw1 && tsw2 && tsw3))
+		return NULL;
+
+	return ffind_3d_perpendicular(tsw0->tmp, tsw1->tmp,
+				      tsw2->tmp, tsw3->tmp);
+}
+
+static
+struct f_switch *tfind_2d_perpendicular(struct t_switch *tsw0,
+					struct t_switch *tsw1,
+					struct t_switch *tsw2)
+{
+	if (!(tsw0 && tsw1 && tsw2))
+		return NULL;
+
+	return ffind_2d_perpendicular(tsw0->tmp, tsw1->tmp, tsw2->tmp);
+}
+
+static
+bool safe_x_ring(struct torus *t, int i, int j, int k)
+{
+	int im1, ip1, ip2;
+	bool success = true;
+
+	/*
+	 * If this x-direction radix-4 ring has at least two links
+	 * already installed into the torus,  then this ring does not
+	 * prevent us from looking for y or z direction perpendiculars.
+	 *
+	 * It is easier to check for the appropriate switches being installed
+	 * into the torus than it is to check for the links, so force the
+	 * link installation if the appropriate switches are installed.
+	 *
+	 * Recall that canonicalize(n - 2, 4) == canonicalize(n + 2, 4).
+	 */
+	if (t->x_sz != 4 || t->flags & X_MESH)
+		goto out;
+
+	im1 = canonicalize(i - 1, t->x_sz);
+	ip1 = canonicalize(i + 1, t->x_sz);
+	ip2 = canonicalize(i + 2, t->x_sz);
+
+	if (!!t->sw[im1][j][k] +
+	    !!t->sw[ip1][j][k] + !!t->sw[ip2][j][k] < 2) {
+		success = false;
+		goto out;
+	}
+	if (t->sw[ip2][j][k] && t->sw[im1][j][k])
+		success = link_tswitches(t, 0,
+					 t->sw[ip2][j][k],
+					 t->sw[im1][j][k])
+			&& success;
+
+	if (t->sw[im1][j][k] && t->sw[i][j][k])
+		success = link_tswitches(t, 0,
+					 t->sw[im1][j][k],
+					 t->sw[i][j][k])
+			&& success;
+
+	if (t->sw[i][j][k] && t->sw[ip1][j][k])
+		success = link_tswitches(t, 0,
+					 t->sw[i][j][k],
+					 t->sw[ip1][j][k])
+			&& success;
+
+	if (t->sw[ip1][j][k] && t->sw[ip2][j][k])
+		success = link_tswitches(t, 0,
+					 t->sw[ip1][j][k],
+					 t->sw[ip2][j][k])
+			&& success;
+out:
+	return success;
+}
+
+static
+bool safe_y_ring(struct torus *t, int i, int j, int k)
+{
+	int jm1, jp1, jp2;
+	bool success = true;
+
+	/*
+	 * If this y-direction radix-4 ring has at least two links
+	 * already installed into the torus,  then this ring does not
+	 * prevent us from looking for x or z direction perpendiculars.
+	 *
+	 * It is easier to check for the appropriate switches being installed
+	 * into the torus than it is to check for the links, so force the
+	 * link installation if the appropriate switches are installed.
+	 *
+	 * Recall that canonicalize(n - 2, 4) == canonicalize(n + 2, 4).
+	 */
+	if (t->y_sz != 4 || (t->flags & Y_MESH))
+		goto out;
+
+	jm1 = canonicalize(j - 1, t->y_sz);
+	jp1 = canonicalize(j + 1, t->y_sz);
+	jp2 = canonicalize(j + 2, t->y_sz);
+
+	if (!!t->sw[i][jm1][k] +
+	    !!t->sw[i][jp1][k] + !!t->sw[i][jp2][k] < 2) {
+		success = false;
+		goto out;
+	}
+	if (t->sw[i][jp2][k] && t->sw[i][jm1][k])
+		success = link_tswitches(t, 1,
+					 t->sw[i][jp2][k],
+					 t->sw[i][jm1][k])
+			&& success;
+
+	if (t->sw[i][jm1][k] && t->sw[i][j][k])
+		success = link_tswitches(t, 1,
+					 t->sw[i][jm1][k],
+					 t->sw[i][j][k])
+			&& success;
+
+	if (t->sw[i][j][k] && t->sw[i][jp1][k])
+		success = link_tswitches(t, 1,
+					 t->sw[i][j][k],
+					 t->sw[i][jp1][k])
+			&& success;
+
+	if (t->sw[i][jp1][k] && t->sw[i][jp2][k])
+		success = link_tswitches(t, 1,
+					 t->sw[i][jp1][k],
+					 t->sw[i][jp2][k])
+			&& success;
+out:
+	return success;
+}
+
+static
+bool safe_z_ring(struct torus *t, int i, int j, int k)
+{
+	int km1, kp1, kp2;
+	bool success = true;
+
+	/*
+	 * If this z-direction radix-4 ring has at least two links
+	 * already installed into the torus,  then this ring does not
+	 * prevent us from looking for x or y direction perpendiculars.
+	 *
+	 * It is easier to check for the appropriate switches being installed
+	 * into the torus than it is to check for the links, so force the
+	 * link installation if the appropriate switches are installed.
+	 *
+	 * Recall that canonicalize(n - 2, 4) == canonicalize(n + 2, 4).
+	 */
+	if (t->z_sz != 4 || t->flags & Z_MESH)
+		goto out;
+
+	km1 = canonicalize(k - 1, t->z_sz);
+	kp1 = canonicalize(k + 1, t->z_sz);
+	kp2 = canonicalize(k + 2, t->z_sz);
+
+	if (!!t->sw[i][j][km1] +
+	    !!t->sw[i][j][kp1] + !!t->sw[i][j][kp2] < 2) {
+		success = false;
+		goto out;
+	}
+	if (t->sw[i][j][kp2] && t->sw[i][j][km1])
+		success = link_tswitches(t, 2,
+					 t->sw[i][j][kp2],
+					 t->sw[i][j][km1])
+			&& success;
+
+	if (t->sw[i][j][km1] && t->sw[i][j][k])
+		success = link_tswitches(t, 2,
+					 t->sw[i][j][km1],
+					 t->sw[i][j][k])
+			&& success;
+
+	if (t->sw[i][j][k] && t->sw[i][j][kp1])
+		success = link_tswitches(t, 2,
+					 t->sw[i][j][k],
+					 t->sw[i][j][kp1])
+			&& success;
+
+	if (t->sw[i][j][kp1] && t->sw[i][j][kp2])
+		success = link_tswitches(t, 2,
+					 t->sw[i][j][kp1],
+					 t->sw[i][j][kp2])
+			&& success;
+out:
+	return success;
+}
+
+/*
+ * These functions return true when it safe to call
+ * tfind_3d_perpendicular()/ffind_3d_perpendicular().
+ */
+static
+bool safe_x_perpendicular(struct torus *t, int i, int j, int k)
+{
+	/*
+	 * If the dimensions perpendicular to the search direction are
+	 * not radix 4 torus dimensions, it is always safe to search for
+	 * a perpendicular.
+	 *
+	 * Here we are checking for enough appropriate links having been
+	 * installed into the torus to prevent an incorrect link from being
+	 * considered as a perpendicular candidate.
+	 */
+	return safe_y_ring(t, i, j, k) && safe_z_ring(t, i, j, k);
+}
+
+static
+bool safe_y_perpendicular(struct torus *t, int i, int j, int k)
+{
+	/*
+	 * If the dimensions perpendicular to the search direction are
+	 * not radix 4 torus dimensions, it is always safe to search for
+	 * a perpendicular.
+	 *
+	 * Here we are checking for enough appropriate links having been
+	 * installed into the torus to prevent an incorrect link from being
+	 * considered as a perpendicular candidate.
+	 */
+	return safe_x_ring(t, i, j, k) && safe_z_ring(t, i, j, k);
+}
+
+static
+bool safe_z_perpendicular(struct torus *t, int i, int j, int k)
+{
+	/*
+	 * If the dimensions perpendicular to the search direction are
+	 * not radix 4 torus dimensions, it is always safe to search for
+	 * a perpendicular.
+	 *
+	 * Implement this by checking for enough appropriate links having
+	 * been installed into the torus to prevent an incorrect link from
+	 * being considered as a perpendicular candidate.
+	 */
+	return safe_x_ring(t, i, j, k) && safe_y_ring(t, i, j, k);
+}
+
+/*
+ * Templates for determining 2D/3D case fingerprints. Recall that if
+ * a fingerprint bit is set the corresponding switch is absent from
+ * the all-switches-present template.
+ *
+ * I.e., for the 2D case where the x,y dimensions have a radix greater
+ * than one, and the z dimension has radix 1, fingerprint bits 4-7 are
+ * always zero.
+ *
+ * For the 2D case where the x,z dimensions have a radix greater than
+ * one, and the y dimension has radix 1, fingerprint bits 2,3,6,7 are
+ * always zero.
+ *
+ * For the 2D case where the y,z dimensions have a radix greater than
+ * one, and the x dimension has radix 1, fingerprint bits 1,3,5,7 are
+ * always zero.
+ *
+ * Recall also that bits 8-10 distinguish between 2D and 3D cases.
+ * If bit 8+d is set, for 0 <= d < 3;  the d dimension of the desired
+ * torus has radix greater than 1.
+ */
+
+/*
+ * 2D case 0x300
+ *  b0: t->sw[i  ][j  ][0  ]
+ *  b1: t->sw[i+1][j  ][0  ]
+ *  b2: t->sw[i  ][j+1][0  ]
+ *  b3: t->sw[i+1][j+1][0  ]
+ *                                    O . . . . . O
+ * 2D case 0x500                      .           .
+ *  b0: t->sw[i  ][0  ][k  ]          .           .
+ *  b1: t->sw[i+1][0  ][k  ]          .           .
+ *  b4: t->sw[i  ][0  ][k+1]          .           .
+ *  b5: t->sw[i+1][0  ][k+1]          .           .
+ *                                    @ . . . . . O
+ * 2D case 0x600
+ *  b0: t->sw[0  ][j  ][k  ]
+ *  b2: t->sw[0  ][j+1][k  ]
+ *  b4: t->sw[0  ][j  ][k+1]
+ *  b6: t->sw[0  ][j+1][k+1]
+ */
+
+/*
+ * 3D case 0x700:                           O
+ *                                        . . .
+ *  b0: t->sw[i  ][j  ][k  ]            .   .   .
+ *  b1: t->sw[i+1][j  ][k  ]          .     .     .
+ *  b2: t->sw[i  ][j+1][k  ]        .       .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O       . .
+ *  b5: t->sw[i+1][j  ][k+1]      .   .   .   .   .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .     .
+ *  b7: t->sw[i+1][j+1][k+1]      .   .   .   .   .   .
+ *                                . .       O       . .
+ *                                O         .         O
+ *                                  .       .       .
+ *                                    .     .     .
+ *                                      .   .   .
+ *                                        . . .
+ *                                          @
+ */
+
+static
+void log_no_crnr(struct torus *t, unsigned n,
+		 int case_i, int case_j, int case_k,
+		 int crnr_i, int crnr_j, int crnr_k)
+{
+	if (t->debug)
+		OSM_LOG(&t->osm->log, OSM_LOG_INFO, "Case 0x%03x "
+			"@ %d %d %d: no corner @ %d %d %d\n",
+			n, case_i, case_j, case_k, crnr_i, crnr_j, crnr_k);
+}
+
+static
+void log_no_perp(struct torus *t, unsigned n,
+		 int case_i, int case_j, int case_k,
+		 int perp_i, int perp_j, int perp_k)
+{
+	if (t->debug)
+		OSM_LOG(&t->osm->log, OSM_LOG_INFO, "Case 0x%03x "
+			"@ %d %d %d: no perpendicular @ %d %d %d\n",
+			n, case_i, case_j, case_k, perp_i, perp_j, perp_k);
+}
+
+/*
+ * Handle the 2D cases with a single existing edge.
+ *
+ */
+
+/*
+ * 2D case 0x30c
+ *  b0: t->sw[i  ][j  ][0  ]
+ *  b1: t->sw[i+1][j  ][0  ]
+ *  b2:
+ *  b3:
+ *                                    O           O
+ * 2D case 0x530
+ *  b0: t->sw[i  ][0  ][k  ]
+ *  b1: t->sw[i+1][0  ][k  ]
+ *  b4:
+ *  b5:
+ *                                    @ . . . . . O
+ * 2D case 0x650
+ *  b0: t->sw[0  ][j  ][k  ]
+ *  b2: t->sw[0  ][j+1][k  ]
+ *  b4:
+ *  b6:
+ */
+static
+bool handle_case_0x30c(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jm1 = canonicalize(j - 1, t->y_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+
+	if (safe_y_perpendicular(t, i, j, k) &&
+	    install_tswitch(t, i, jp1, k,
+			    tfind_2d_perpendicular(t->sw[ip1][j][k],
+						   t->sw[i][j][k],
+						   t->sw[i][jm1][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x30c, i, j, k, i, j, k);
+
+	if (safe_y_perpendicular(t, ip1, j, k) &&
+	    install_tswitch(t, ip1, jp1, k,
+			    tfind_2d_perpendicular(t->sw[i][j][k],
+						   t->sw[ip1][j][k],
+						   t->sw[ip1][jm1][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x30c, i, j, k, ip1, j, k);
+	return false;
+}
+
+static
+bool handle_case_0x530(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int km1 = canonicalize(k - 1, t->z_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_z_perpendicular(t, i, j, k) &&
+	    install_tswitch(t, i, j, kp1,
+			    tfind_2d_perpendicular(t->sw[ip1][j][k],
+						   t->sw[i][j][k],
+						   t->sw[i][j][km1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x530, i, j, k, i, j, k);
+
+	if (safe_z_perpendicular(t, ip1, j, k) &&
+	      install_tswitch(t, ip1, j, kp1,
+			      tfind_2d_perpendicular(t->sw[i][j][k],
+						     t->sw[ip1][j][k],
+						     t->sw[ip1][j][km1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x530, i, j, k, ip1, j, k);
+	return false;
+}
+
+static
+bool handle_case_0x650(struct torus *t, int i, int j, int k)
+{
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int km1 = canonicalize(k - 1, t->z_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_z_perpendicular(t, i, j, k) &&
+	    install_tswitch(t, i, j, kp1,
+			    tfind_2d_perpendicular(t->sw[i][jp1][k],
+						   t->sw[i][j][k],
+						   t->sw[i][j][km1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x650, i, j, k, i, j, k);
+
+	if (safe_z_perpendicular(t, i, jp1, k) &&
+	    install_tswitch(t, i, jp1, kp1,
+			    tfind_2d_perpendicular(t->sw[i][j][k],
+						   t->sw[i][jp1][k],
+						   t->sw[i][jp1][km1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x650, i, j, k, i, jp1, k);
+	return false;
+}
+
+/*
+ * 2D case 0x305
+ *  b0:
+ *  b1: t->sw[i+1][j  ][0  ]
+ *  b2:
+ *  b3: t->sw[i+1][j+1][0  ]
+ *                                    O           O
+ * 2D case 0x511                                  .
+ *  b0:                                           .
+ *  b1: t->sw[i+1][0  ][k  ]                      .
+ *  b4:                                           .
+ *  b5: t->sw[i+1][0  ][k+1]                      .
+ *                                    @           O
+ * 2D case 0x611
+ *  b0:
+ *  b2: t->sw[0  ][j+1][k  ]
+ *  b4:
+ *  b6: t->sw[0  ][j+1][k+1]
+ */
+static
+bool handle_case_0x305(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int ip2 = canonicalize(i + 2, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+
+	if (safe_x_perpendicular(t, ip1, j, k) &&
+	    install_tswitch(t, i, j, k,
+			    tfind_2d_perpendicular(t->sw[ip1][jp1][k],
+						   t->sw[ip1][j][k],
+						   t->sw[ip2][j][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x305, i, j, k, ip1, j, k);
+
+	if (safe_x_perpendicular(t, ip1, jp1, k) &&
+	    install_tswitch(t, i, jp1, k,
+			    tfind_2d_perpendicular(t->sw[ip1][j][k],
+						   t->sw[ip1][jp1][k],
+						   t->sw[ip2][jp1][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x305, i, j, k, ip1, jp1, k);
+	return false;
+}
+
+static
+bool handle_case_0x511(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int ip2 = canonicalize(i + 2, t->x_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_x_perpendicular(t, ip1, j, k) &&
+	    install_tswitch(t, i, j, k,
+			    tfind_2d_perpendicular(t->sw[ip1][j][kp1],
+						   t->sw[ip1][j][k],
+						   t->sw[ip2][j][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x511, i, j, k, ip1, j, k);
+
+	if (safe_x_perpendicular(t, ip1, j, kp1) &&
+	    install_tswitch(t, i, j, kp1,
+			    tfind_2d_perpendicular(t->sw[ip1][j][k],
+						   t->sw[ip1][j][kp1],
+						   t->sw[ip2][j][kp1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x511, i, j, k, ip1, j, kp1);
+	return false;
+}
+
+static
+bool handle_case_0x611(struct torus *t, int i, int j, int k)
+{
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int jp2 = canonicalize(j + 2, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_y_perpendicular(t, i, jp1, k) &&
+	    install_tswitch(t, i, j, k,
+			    tfind_2d_perpendicular(t->sw[i][jp1][kp1],
+						   t->sw[i][jp1][k],
+						   t->sw[i][jp2][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x611, i, j, k, i, jp1, k);
+
+	if (safe_y_perpendicular(t, i, jp1, kp1) &&
+	    install_tswitch(t, i, j, kp1,
+			    tfind_2d_perpendicular(t->sw[i][jp1][k],
+						   t->sw[i][jp1][kp1],
+						   t->sw[i][jp2][kp1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x611, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * 2D case 0x303
+ *  b0:
+ *  b1:
+ *  b2: t->sw[i  ][j+1][0  ]
+ *  b3: t->sw[i+1][j+1][0  ]
+ *                                    O . . . . . O
+ * 2D case 0x503
+ *  b0:
+ *  b1:
+ *  b4: t->sw[i  ][0  ][k+1]
+ *  b5: t->sw[i+1][0  ][k+1]
+ *                                    @           O
+ * 2D case 0x605
+ *  b0:
+ *  b2:
+ *  b4: t->sw[0  ][j  ][k+1]
+ *  b6: t->sw[0  ][j+1][k+1]
+ */
+static
+bool handle_case_0x303(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int jp2 = canonicalize(j + 2, t->y_sz);
+
+	if (safe_y_perpendicular(t, i, jp1, k) &&
+	    install_tswitch(t, i, j, k,
+			    tfind_2d_perpendicular(t->sw[ip1][jp1][k],
+						   t->sw[i][jp1][k],
+						   t->sw[i][jp2][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x303, i, j, k, i, jp1, k);
+
+	if (safe_y_perpendicular(t, ip1, jp1, k) &&
+	    install_tswitch(t, ip1, j, k,
+			    tfind_2d_perpendicular(t->sw[i][jp1][k],
+						   t->sw[ip1][jp1][k],
+						   t->sw[ip1][jp2][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x303, i, j, k, ip1, jp1, k);
+	return false;
+}
+
+static
+bool handle_case_0x503(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+	int kp2 = canonicalize(k + 2, t->z_sz);
+
+	if (safe_z_perpendicular(t, i, j, kp1) &&
+	    install_tswitch(t, i, j, k,
+			    tfind_2d_perpendicular(t->sw[ip1][j][kp1],
+						   t->sw[i][j][kp1],
+						   t->sw[i][j][kp2]))) {
+		return true;
+	}
+	log_no_perp(t, 0x503, i, j, k, i, j, kp1);
+
+	if (safe_z_perpendicular(t, ip1, j, kp1) &&
+	    install_tswitch(t, ip1, j, k,
+			    tfind_2d_perpendicular(t->sw[i][j][kp1],
+						   t->sw[ip1][j][kp1],
+						   t->sw[ip1][j][kp2]))) {
+		return true;
+	}
+	log_no_perp(t, 0x503, i, j, k, ip1, j, kp1);
+	return false;
+}
+
+static
+bool handle_case_0x605(struct torus *t, int i, int j, int k)
+{
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+	int kp2 = canonicalize(k + 2, t->z_sz);
+
+	if (safe_z_perpendicular(t, i, j, kp1) &&
+	    install_tswitch(t, i, j, k,
+			    tfind_2d_perpendicular(t->sw[i][jp1][kp1],
+						   t->sw[i][j][kp1],
+						   t->sw[i][j][kp2]))) {
+		return true;
+	}
+	log_no_perp(t, 0x605, i, j, k, i, j, kp1);
+
+	if (safe_z_perpendicular(t, i, jp1, kp1) &&
+	    install_tswitch(t, i, jp1, k,
+			    tfind_2d_perpendicular(t->sw[i][j][kp1],
+						   t->sw[i][jp1][kp1],
+						   t->sw[i][jp1][kp2]))) {
+		return true;
+	}
+	log_no_perp(t, 0x605, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * 2D case 0x30a
+ *  b0: t->sw[i  ][j  ][0  ]
+ *  b1:
+ *  b2: t->sw[i  ][j+1][0  ]
+ *  b3:
+ *                                    O           O
+ * 2D case 0x522                      .
+ *  b0: t->sw[i  ][0  ][k  ]          .
+ *  b1:                               .
+ *  b4: t->sw[i  ][0  ][k+1]          .
+ *  b5:                               .
+ *                                    @           O
+ * 2D case 0x644
+ *  b0: t->sw[0  ][j  ][k  ]
+ *  b2:
+ *  b4: t->sw[0  ][j  ][k+1]
+ *  b6:
+ */
+static
+bool handle_case_0x30a(struct torus *t, int i, int j, int k)
+{
+	int im1 = canonicalize(i - 1, t->x_sz);
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+
+	if (safe_x_perpendicular(t, i, j, k) &&
+	    install_tswitch(t, ip1, j, k,
+			    tfind_2d_perpendicular(t->sw[i][jp1][k],
+						   t->sw[i][j][k],
+						   t->sw[im1][j][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x30a, i, j, k, i, j, k);
+
+	if (safe_x_perpendicular(t, i, jp1, k) &&
+	    install_tswitch(t, ip1, jp1, k,
+			    tfind_2d_perpendicular(t->sw[i][j][k],
+						   t->sw[i][jp1][k],
+						   t->sw[im1][jp1][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x30a, i, j, k, i, jp1, k);
+	return false;
+}
+
+static
+bool handle_case_0x522(struct torus *t, int i, int j, int k)
+{
+	int im1 = canonicalize(i - 1, t->x_sz);
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_x_perpendicular(t, i, j, k) &&
+	    install_tswitch(t, ip1, j, k,
+			    tfind_2d_perpendicular(t->sw[i][j][kp1],
+						   t->sw[i][j][k],
+						   t->sw[im1][j][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x522, i, j, k, i, j, k);
+
+	if (safe_x_perpendicular(t, i, j, kp1) &&
+	    install_tswitch(t, ip1, j, kp1,
+			    tfind_2d_perpendicular(t->sw[i][j][k],
+						   t->sw[i][j][kp1],
+						   t->sw[im1][j][kp1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x522, i, j, k, i, j, kp1);
+	return false;
+}
+
+static
+bool handle_case_0x644(struct torus *t, int i, int j, int k)
+{
+	int jm1 = canonicalize(j - 1, t->y_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_y_perpendicular(t, i, j, k) &&
+	    install_tswitch(t, i, jp1, k,
+			    tfind_2d_perpendicular(t->sw[i][j][kp1],
+						   t->sw[i][j][k],
+						   t->sw[i][jm1][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x644, i, j, k, i, j, k);
+
+	if (safe_y_perpendicular(t, i, j, kp1) &&
+	    install_tswitch(t, i, jp1, kp1,
+			    tfind_2d_perpendicular(t->sw[i][j][k],
+						   t->sw[i][j][kp1],
+						   t->sw[i][jm1][kp1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x644, i, j, k, i, j, kp1);
+	return false;
+}
+
+/*
+ * Handle the 2D cases where two existing edges meet at a corner.
+ *
+ */
+
+/*
+ * 2D case 0x301
+ *  b0:
+ *  b1: t->sw[i+1][j  ][0  ]
+ *  b2: t->sw[i  ][j+1][0  ]
+ *  b3: t->sw[i+1][j+1][0  ]
+ *                                    O . . . . . O
+ * 2D case 0x501                                  .
+ *  b0:                                           .
+ *  b1: t->sw[i+1][0  ][k  ]                      .
+ *  b4: t->sw[i  ][0  ][k+1]                      .
+ *  b5: t->sw[i+1][0  ][k+1]                      .
+ *                                    @           O
+ * 2D case 0x601
+ *  b0:
+ *  b2: t->sw[0  ][j+1][k  ]
+ *  b4: t->sw[0  ][j  ][k+1]
+ *  b6: t->sw[0  ][j+1][k+1]
+ */
+static
+bool handle_case_0x301(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k],
+					      t->sw[i][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x301, i, j, k, i, j, k);
+	return false;
+}
+
+static
+bool handle_case_0x501(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][j][kp1],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x501, i, j, k, i, j, k);
+	return false;
+}
+
+static
+bool handle_case_0x601(struct torus *t, int i, int j, int k)
+{
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[i][jp1][kp1],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x601, i, j, k, i, j, k);
+	return false;
+}
+
+/*
+ * 2D case 0x302
+ *  b0: t->sw[i  ][j  ][0  ]
+ *  b1:
+ *  b2: t->sw[i  ][j+1][0  ]
+ *  b3: t->sw[i+1][j+1][0  ]
+ *                                    O . . . . . O
+ * 2D case 0x502                      .
+ *  b0: t->sw[i  ][0  ][k  ]          .
+ *  b1:                               .
+ *  b4: t->sw[i  ][0  ][k+1]          .
+ *  b5: t->sw[i+1][0  ][k+1]          .
+ *                                    @           O
+ * 2D case 0x604
+ *  b0: t->sw[0  ][j  ][k  ]
+ *  b2:
+ *  b4: t->sw[0  ][j  ][k+1]
+ *  b6: t->sw[0  ][j+1][k+1]
+ */
+static
+bool handle_case_0x302(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+
+	if (install_tswitch(t, ip1, j, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][jp1][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x302, i, j, k, ip1, j, k);
+	return false;
+}
+
+static
+bool handle_case_0x502(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][j][kp1],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x502, i, j, k, ip1, j, k);
+	return false;
+}
+
+static
+bool handle_case_0x604(struct torus *t, int i, int j, int k)
+{
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, jp1, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][j][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x604, i, j, k, i, jp1, k);
+	return false;
+}
+
+
+/*
+ * 2D case 0x308
+ *  b0: t->sw[i  ][j  ][0  ]
+ *  b1: t->sw[i+1][j  ][0  ]
+ *  b2: t->sw[i  ][j+1][0  ]
+ *  b3:
+ *                                    O           O
+ * 2D case 0x520                      .
+ *  b0: t->sw[i  ][0  ][k  ]          .
+ *  b1: t->sw[i+1][0  ][k  ]          .
+ *  b4: t->sw[i  ][0  ][k+1]          .
+ *  b5:                               .
+ *                                    @ . . . . . O
+ * 2D case 0x640
+ *  b0: t->sw[0  ][j  ][k  ]
+ *  b2: t->sw[0  ][j+1][k  ]
+ *  b4: t->sw[0  ][j  ][k+1]
+ *  b6:
+ */
+static
+bool handle_case_0x308(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+
+	if (install_tswitch(t, ip1, jp1, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[i][j][k],
+					      t->sw[i][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x308, i, j, k, ip1, jp1, k);
+	return false;
+}
+
+static
+bool handle_case_0x520(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, kp1,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[i][j][k],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x520, i, j, k, ip1, j, kp1);
+	return false;
+}
+
+static
+bool handle_case_0x640(struct torus *t, int i, int j, int k)
+{
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, jp1, kp1,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[i][j][k],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x640, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * 2D case 0x304
+ *  b0: t->sw[i  ][j  ][0  ]
+ *  b1: t->sw[i+1][j  ][0  ]
+ *  b2:
+ *  b3: t->sw[i+1][j+1][0  ]
+ *                                    O           O
+ * 2D case 0x510                                  .
+ *  b0: t->sw[i  ][0  ][k  ]                      .
+ *  b1: t->sw[i+1][0  ][k  ]                      .
+ *  b4:                                           .
+ *  b5: t->sw[i+1][0  ][k+1]                      .
+ *                                    @ . . . . . O
+ * 2D case 0x610
+ *  b0: t->sw[0  ][j  ][k  ]
+ *  b2: t->sw[0  ][j+1][k  ]
+ *  b4:
+ *  b6: t->sw[0  ][j+1][k+1]
+ */
+static
+bool handle_case_0x304(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+
+	if (install_tswitch(t, i, jp1, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x304, i, j, k, i, jp1, k);
+	return false;
+}
+
+static
+bool handle_case_0x510(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, kp1,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[ip1][j][k],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x510, i, j, k, i, j, kp1);
+	return false;
+}
+
+static
+bool handle_case_0x610(struct torus *t, int i, int j, int k)
+{
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, kp1,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][jp1][k],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x610, i, j, k, i, j, kp1);
+	return false;
+}
+
+/*
+ * Handle the 3D cases where two existing edges meet at a corner.
+ *
+ */
+
+/*
+ * 3D case 0x71f:                           O
+ *                                        .   .
+ *  b0:                                 .       .
+ *  b1:                               .           .
+ *  b2:                             .               .
+ *  b3:                           O                   O
+ *  b4:                                     O
+ *  b5: t->sw[i+1][j  ][k+1]
+ *  b6: t->sw[i  ][j+1][k+1]
+ *  b7: t->sw[i+1][j+1][k+1]
+ *                                          O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x71f(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+	int kp2 = canonicalize(k + 2, t->z_sz);
+
+	if (safe_z_perpendicular(t, ip1, jp1, kp1) &&
+	    install_tswitch(t, ip1, jp1, k,
+			    tfind_3d_perpendicular(t->sw[ip1][j][kp1],
+						   t->sw[ip1][jp1][kp1],
+						   t->sw[i][jp1][kp1],
+						   t->sw[ip1][jp1][kp2]))) {
+		return true;
+	}
+	log_no_perp(t, 0x71f, i, j, k, ip1, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x72f:                           O
+ *                                        .
+ *  b0:                                 .
+ *  b1:                               .
+ *  b2:                             .
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]        .       O
+ *  b5:                               .
+ *  b6: t->sw[i  ][j+1][k+1]            .
+ *  b7: t->sw[i+1][j+1][k+1]              .
+ *                                          O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x72f(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+	int kp2 = canonicalize(k + 2, t->z_sz);
+
+	if (safe_z_perpendicular(t, i, jp1, kp1) &&
+	    install_tswitch(t, i, jp1, k,
+			    tfind_3d_perpendicular(t->sw[i][j][kp1],
+						   t->sw[i][jp1][kp1],
+						   t->sw[ip1][jp1][kp1],
+						   t->sw[i][jp1][kp2]))) {
+		return true;
+	}
+	log_no_perp(t, 0x72f, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x737:                           O
+ *                                        . .
+ *  b0:                                 .   .
+ *  b1:                               .     .
+ *  b2:                             .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                                     O
+ *  b5:
+ *  b6: t->sw[i  ][j+1][k+1]
+ *  b7: t->sw[i+1][j+1][k+1]
+ *                                          O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x737(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int jp2 = canonicalize(j + 2, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_y_perpendicular(t, ip1, jp1, kp1) &&
+	    install_tswitch(t, ip1, j, kp1,
+			    tfind_3d_perpendicular(t->sw[i][jp1][kp1],
+						   t->sw[ip1][jp1][kp1],
+						   t->sw[ip1][jp1][k],
+						   t->sw[ip1][jp2][kp1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x737, i, j, k, ip1, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x73b:                           O
+ *                                        .
+ *  b0:                                 .
+ *  b1:                               .
+ *  b2: t->sw[i  ][j+1][k  ]        .
+ *  b3:                           O                   O
+ *  b4:                           .         O
+ *  b5:                           .
+ *  b6: t->sw[i  ][j+1][k+1]      .
+ *  b7: t->sw[i+1][j+1][k+1]      .
+ *                                .         O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x73b(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int jp2 = canonicalize(j + 2, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_y_perpendicular(t, i, jp1, kp1) &&
+	    install_tswitch(t, i, j, kp1,
+			    tfind_3d_perpendicular(t->sw[i][jp1][k],
+						   t->sw[i][jp1][kp1],
+						   t->sw[ip1][jp1][kp1],
+						   t->sw[i][jp2][kp1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x73b, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x74f:                           O
+ *                                            .
+ *  b0:                                         .
+ *  b1:                                           .
+ *  b2:                                             .
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]                O       .
+ *  b5: t->sw[i+1][j  ][k+1]                      .
+ *  b6:                                         .
+ *  b7: t->sw[i+1][j+1][k+1]                  .
+ *                                          O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x74f(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+	int kp2 = canonicalize(k + 2, t->z_sz);
+
+	if (safe_z_perpendicular(t, ip1, j, kp1) &&
+	    install_tswitch(t, ip1, j, k,
+			    tfind_3d_perpendicular(t->sw[i][j][kp1],
+						   t->sw[ip1][j][kp1],
+						   t->sw[ip1][jp1][kp1],
+						   t->sw[ip1][j][kp2]))) {
+		return true;
+	}
+	log_no_perp(t, 0x74f, i, j, k, ip1, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x757:                           O
+ *                                          . .
+ *  b0:                                     .   .
+ *  b1:                                     .     .
+ *  b2:                                     .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                                     O
+ *  b5: t->sw[i+1][j  ][k+1]
+ *  b6:
+ *  b7: t->sw[i+1][j+1][k+1]
+ *                                          O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x757(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int ip2 = canonicalize(i + 2, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_x_perpendicular(t, ip1, jp1, kp1) &&
+	    install_tswitch(t, i, jp1, kp1,
+			    tfind_3d_perpendicular(t->sw[ip1][j][kp1],
+						   t->sw[ip1][jp1][kp1],
+						   t->sw[ip1][jp1][k],
+						   t->sw[ip2][jp1][kp1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x757, i, j, k, ip1, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x75d:                           O
+ *                                            .
+ *  b0:                                         .
+ *  b1: t->sw[i+1][j  ][k  ]                      .
+ *  b2:                                             .
+ *  b3:                           O                   O
+ *  b4:                                     O         .
+ *  b5: t->sw[i+1][j  ][k+1]                          .
+ *  b6:                                               .
+ *  b7: t->sw[i+1][j+1][k+1]                          .
+ *                                          O         .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x75d(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int ip2 = canonicalize(i + 2, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_x_perpendicular(t, ip1, j, kp1) &&
+	    install_tswitch(t, i, j, kp1,
+			    tfind_3d_perpendicular(t->sw[ip1][j][k],
+						   t->sw[ip1][j][kp1],
+						   t->sw[ip1][jp1][kp1],
+						   t->sw[ip2][j][kp1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x75d, i, j, k, ip1, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x773:                           O
+ *                                          .
+ *  b0:                                     .
+ *  b1:                                     .
+ *  b2: t->sw[i  ][j+1][k  ]                .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                                     O
+ *  b5:                                   .
+ *  b6:                                 .
+ *  b7: t->sw[i+1][j+1][k+1]          .
+ *                                  .       O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x773(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int jp2 = canonicalize(j + 2, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_y_perpendicular(t, ip1, jp1, k) &&
+	    install_tswitch(t, ip1, j, k,
+			    tfind_3d_perpendicular(t->sw[i][jp1][k],
+						   t->sw[ip1][jp1][k],
+						   t->sw[ip1][jp1][kp1],
+						   t->sw[ip1][jp2][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x773, i, j, k, ip1, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x775:                           O
+ *                                          .
+ *  b0:                                     .
+ *  b1: t->sw[i+1][j  ][k  ]                .
+ *  b2:                                     .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                                     O
+ *  b5:                                       .
+ *  b6:                                         .
+ *  b7: t->sw[i+1][j+1][k+1]                      .
+ *                                          O       .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x775(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int ip2 = canonicalize(i + 2, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_x_perpendicular(t, ip1, jp1, k) &&
+	    install_tswitch(t, i, jp1, k,
+			    tfind_3d_perpendicular(t->sw[ip1][j][k],
+						   t->sw[ip1][jp1][k],
+						   t->sw[ip1][jp1][kp1],
+						   t->sw[ip2][jp1][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x775, i, j, k, ip1, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x78f:                           O
+ *
+ *  b0:
+ *  b1:
+ *  b2:
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]        .       O       .
+ *  b5: t->sw[i+1][j  ][k+1]          .           .
+ *  b6: t->sw[i  ][j+1][k+1]            .       .
+ *  b7:                                   .   .
+ *                                          O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x78f(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+	int kp2 = canonicalize(k + 2, t->z_sz);
+
+	if (safe_z_perpendicular(t, i, j, kp1) &&
+	    install_tswitch(t, i, j, k,
+			    tfind_3d_perpendicular(t->sw[ip1][j][kp1],
+						   t->sw[i][j][kp1],
+						   t->sw[i][jp1][kp1],
+						   t->sw[i][j][kp2]))) {
+		return true;
+	}
+	log_no_perp(t, 0x78f, i, j, k, i, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7ab:                           O
+ *
+ *  b0:
+ *  b1:
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O
+ *  b5:                           .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .
+ *  b7:                           .       .
+ *                                .         O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x7ab(struct torus *t, int i, int j, int k)
+{
+	int im1 = canonicalize(i - 1, t->x_sz);
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_x_perpendicular(t, i, jp1, kp1) &&
+	    install_tswitch(t, ip1, jp1, kp1,
+			    tfind_3d_perpendicular(t->sw[i][j][kp1],
+						   t->sw[i][jp1][kp1],
+						   t->sw[i][jp1][k],
+						   t->sw[im1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x7ab, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7ae:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1:
+ *  b2:
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]        .       O
+ *  b5:                               .
+ *  b6: t->sw[i  ][j+1][k+1]            .
+ *  b7:                                   .
+ *                                          O
+ *                                O         .         O
+ *                                          .
+ *                                          .
+ *                                          .
+ *                                          .
+ *                                          @
+ */
+static
+bool handle_case_0x7ae(struct torus *t, int i, int j, int k)
+{
+	int im1 = canonicalize(i - 1, t->x_sz);
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_x_perpendicular(t, i, j, kp1) &&
+	    install_tswitch(t, ip1, j, kp1,
+			    tfind_3d_perpendicular(t->sw[i][j][k],
+						   t->sw[i][j][kp1],
+						   t->sw[i][jp1][kp1],
+						   t->sw[im1][j][kp1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x7ae, i, j, k, i, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7b3:                           O
+ *
+ *  b0:
+ *  b1:
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4:                           .         O
+ *  b5:                           .       .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .
+ *  b7:                           .   .
+ *                                . .       O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x7b3(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int jp2 = canonicalize(j + 2, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_y_perpendicular(t, i, jp1, k) &&
+	    install_tswitch(t, i, j, k,
+			    tfind_3d_perpendicular(t->sw[i][jp1][kp1],
+						   t->sw[i][jp1][k],
+						   t->sw[ip1][jp1][k],
+						   t->sw[i][jp2][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x7b3, i, j, k, i, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x7ba:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1:
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3:                           O                   O
+ *  b4:                           .         O
+ *  b5:                           .
+ *  b6: t->sw[i  ][j+1][k+1]      .
+ *  b7:                           .
+ *                                .         O
+ *                                O                   O
+ *                                  .
+ *                                    .
+ *                                      .
+ *                                        .
+ *                                          @
+ */
+static
+bool handle_case_0x7ba(struct torus *t, int i, int j, int k)
+{
+	int im1 = canonicalize(i - 1, t->x_sz);
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_x_perpendicular(t, i, jp1, k) &&
+	    install_tswitch(t, ip1, jp1, k,
+			    tfind_3d_perpendicular(t->sw[i][j][k],
+						   t->sw[i][jp1][k],
+						   t->sw[i][jp1][kp1],
+						   t->sw[im1][jp1][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x7ba, i, j, k, i, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x7cd:                           O
+ *
+ *  b0:
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2:
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]                O       . .
+ *  b5: t->sw[i+1][j  ][k+1]                      .   .
+ *  b6:                                         .     .
+ *  b7:                                       .       .
+ *                                          O         .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x7cd(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int jm1 = canonicalize(j - 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_y_perpendicular(t, ip1, j, kp1) &&
+	    install_tswitch(t, ip1, jp1, kp1,
+			    tfind_3d_perpendicular(t->sw[i][j][kp1],
+						   t->sw[ip1][j][kp1],
+						   t->sw[ip1][j][k],
+						   t->sw[ip1][jm1][kp1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x7cd, i, j, k, ip1, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7ce:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1:
+ *  b2:
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]                O       .
+ *  b5: t->sw[i+1][j  ][k+1]                      .
+ *  b6:                                         .
+ *  b7:                                       .
+ *                                          O
+ *                                O         .         O
+ *                                          .
+ *                                          .
+ *                                          .
+ *                                          .
+ *                                          @
+ */
+static
+bool handle_case_0x7ce(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int jm1 = canonicalize(j - 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_y_perpendicular(t, i, j, kp1) &&
+	    install_tswitch(t, i, jp1, kp1,
+			    tfind_3d_perpendicular(t->sw[i][j][k],
+						   t->sw[i][j][kp1],
+						   t->sw[ip1][j][kp1],
+						   t->sw[i][jm1][kp1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x7ce, i, j, k, i, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7d5:                           O
+ *
+ *  b0:
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2:
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4:                                     O         .
+ *  b5: t->sw[i+1][j  ][k+1]                  .       .
+ *  b6:                                         .     .
+ *  b7:                                           .   .
+ *                                          O       . .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x7d5(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int ip2 = canonicalize(i + 2, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_x_perpendicular(t, ip1, j, k) &&
+	    install_tswitch(t, i, j, k,
+			    tfind_3d_perpendicular(t->sw[ip1][j][kp1],
+						   t->sw[ip1][j][k],
+						   t->sw[ip1][jp1][k],
+						   t->sw[ip2][j][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x7d5, i, j, k, ip1, j, k);
+	return false;
+}
+
+/*
+ * 3D case 0x7dc:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2:
+ *  b3:                           O                   O
+ *  b4:                                     O         .
+ *  b5: t->sw[i+1][j  ][k+1]                          .
+ *  b6:                                               .
+ *  b7:                                               .
+ *                                          O         .
+ *                                O                   O
+ *                                                  .
+ *                                                .
+ *                                              .
+ *                                            .
+ *                                          @
+ */
+static
+bool handle_case_0x7dc(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int jm1 = canonicalize(j - 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_y_perpendicular(t, ip1, j, k) &&
+	    install_tswitch(t, ip1, jp1, k,
+			    tfind_3d_perpendicular(t->sw[i][j][k],
+						   t->sw[ip1][j][k],
+						   t->sw[ip1][j][kp1],
+						   t->sw[ip1][jm1][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x7dc, i, j, k, ip1, j, k);
+	return false;
+}
+
+/*
+ * 3D case 0x7ea:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1:
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3:                            O                   O
+ *  b4: t->sw[i  ][j  ][k+1]                 O
+ *  b5:
+ *  b6:
+ *  b7:
+ *                                          O
+ *                                O         .         O
+ *                                  .       .
+ *                                    .     .
+ *                                      .   .
+ *                                        . .
+ *                                          @
+ */
+static
+bool handle_case_0x7ea(struct torus *t, int i, int j, int k)
+{
+	int im1 = canonicalize(i - 1, t->x_sz);
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_x_perpendicular(t, i, j, k) &&
+	    install_tswitch(t, ip1, j, k,
+			    tfind_3d_perpendicular(t->sw[i][j][kp1],
+						   t->sw[i][j][k],
+						   t->sw[i][jp1][k],
+						   t->sw[im1][j][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x7ea, i, j, k, i, j, k);
+	return false;
+}
+
+/*
+ * 3D case 0x7ec:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2:
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]                O
+ *  b5:
+ *  b6:
+ *  b7:
+ *                                          O
+ *                                O         .         O
+ *                                          .       .
+ *                                          .     .
+ *                                          .   .
+ *                                          . .
+ *                                          @
+ */
+static
+bool handle_case_0x7ec(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int jm1 = canonicalize(j - 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_y_perpendicular(t, i, j, k) &&
+	    install_tswitch(t, i, jp1, k,
+			    tfind_3d_perpendicular(t->sw[i][j][kp1],
+						   t->sw[i][j][k],
+						   t->sw[ip1][j][k],
+						   t->sw[i][jm1][k]))) {
+		return true;
+	}
+	log_no_perp(t, 0x7ec, i, j, k, i, j, k);
+	return false;
+}
+
+/*
+ * 3D case 0x7f1:                           O
+ *
+ *  b0:
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4:                                     O
+ *  b5:                                   .   .
+ *  b6:                                 .       .
+ *  b7:                               .           .
+ *                                  .       O       .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x7f1(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int km1 = canonicalize(k - 1, t->z_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_z_perpendicular(t, ip1, jp1, k) &&
+	    install_tswitch(t, ip1, jp1, kp1,
+			    tfind_3d_perpendicular(t->sw[ip1][j][k],
+						   t->sw[ip1][jp1][k],
+						   t->sw[i][jp1][k],
+						   t->sw[ip1][jp1][km1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x7f1, i, j, k, ip1, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x7f2:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1:
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4:                                     O
+ *  b5:                                   .
+ *  b6:                                 .
+ *  b7:                               .
+ *                                  .       O
+ *                                O                   O
+ *                                  .
+ *                                    .
+ *                                      .
+ *                                        .
+ *                                          @
+ */
+static
+bool handle_case_0x7f2(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int km1 = canonicalize(k - 1, t->z_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_z_perpendicular(t, i, jp1, k) &&
+	    install_tswitch(t, i, jp1, kp1,
+			    tfind_3d_perpendicular(t->sw[i][j][k],
+						   t->sw[i][jp1][k],
+						   t->sw[ip1][jp1][k],
+						   t->sw[i][jp1][km1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x7f2, i, j, k, i, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x7f4:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2:
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4:                                     O
+ *  b5:                                       .
+ *  b6:                                         .
+ *  b7:                                           .
+ *                                          O       .
+ *                                O                   O
+ *                                                  .
+ *                                                .
+ *                                              .
+ *                                            .
+ *                                          @
+ */
+static
+bool handle_case_0x7f4(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int km1 = canonicalize(k - 1, t->z_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_z_perpendicular(t, ip1, j, k) &&
+	    install_tswitch(t, ip1, j, kp1,
+			    tfind_3d_perpendicular(t->sw[i][j][k],
+						   t->sw[ip1][j][k],
+						   t->sw[ip1][jp1][k],
+						   t->sw[ip1][j][km1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x7f4, i, j, k, ip1, j, k);
+	return false;
+}
+
+/*
+ * 3D case 0x7f8:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3:                           O                   O
+ *  b4:                                     O
+ *  b5:
+ *  b6:
+ *  b7:
+ *                                          O
+ *                                O                   O
+ *                                  .               .
+ *                                    .           .
+ *                                      .       .
+ *                                        .   .
+ *                                          @
+ */
+static
+bool handle_case_0x7f8(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int km1 = canonicalize(k - 1, t->z_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (safe_z_perpendicular(t, i, j, k) &&
+	    install_tswitch(t, i, j, kp1,
+			    tfind_3d_perpendicular(t->sw[ip1][j][k],
+						   t->sw[i][j][k],
+						   t->sw[i][jp1][k],
+						   t->sw[i][j][km1]))) {
+		return true;
+	}
+	log_no_perp(t, 0x7f8, i, j, k, i, j, k);
+	return false;
+}
+
+/*
+ * Handle the cases where three existing edges meet at a corner.
+ */
+
+/*
+ * 3D case 0x717:                           O
+ *                                        . . .
+ *  b0:                                 .   .   .
+ *  b1:                               .     .     .
+ *  b2:                             .       .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                                     O
+ *  b5: t->sw[i+1][j  ][k+1]
+ *  b6: t->sw[i  ][j+1][k+1]
+ *  b7: t->sw[i+1][j+1][k+1]
+ *                                          O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x717(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, kp1,
+			    tfind_face_corner(t->sw[i][jp1][kp1],
+					      t->sw[ip1][jp1][kp1],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x717, i, j, k, i, j, kp1);
+
+	if (install_tswitch(t, ip1, j, k,
+			    tfind_face_corner(t->sw[ip1][jp1][k],
+					      t->sw[ip1][jp1][kp1],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x717, i, j, k, ip1, j, k);
+
+	if (install_tswitch(t, i, jp1, k,
+			    tfind_face_corner(t->sw[ip1][jp1][k],
+					      t->sw[ip1][jp1][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x717, i, j, k, i, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x72b:                           O
+ *                                        .
+ *  b0:                                 .
+ *  b1:                               .
+ *  b2: t->sw[i  ][j+1][k  ]        .
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O
+ *  b5:                           .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .
+ *  b7: t->sw[i+1][j+1][k+1]      .       .
+ *                                .         O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x72b(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, kp1,
+			    tfind_face_corner(t->sw[i][j][kp1],
+					      t->sw[i][jp1][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x72b, i, j, k, ip1, j, kp1);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[i][jp1][kp1],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x72b, i, j, k, i, j, k);
+
+	if (install_tswitch(t, ip1, jp1, k,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[i][jp1][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x72b, i, j, k, ip1, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x74d:                           O
+ *                                            .
+ *  b0:                                         .
+ *  b1: t->sw[i+1][j  ][k  ]                      .
+ *  b2:                                             .
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]                O       . .
+ *  b5: t->sw[i+1][j  ][k+1]                      .   .
+ *  b6:                                         .     .
+ *  b7: t->sw[i+1][j+1][k+1]                  .       .
+ *                                          O         .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x74d(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, jp1, kp1,
+			    tfind_face_corner(t->sw[i][j][kp1],
+					      t->sw[ip1][j][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x74d, i, j, k, i, jp1, kp1);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][j][kp1],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x74d, i, j, k, i, j, k);
+
+	if (install_tswitch(t, ip1, jp1, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][j][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x74d, i, j, k, ip1, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x771:                           O
+ *                                          .
+ *  b0:                                     .
+ *  b1: t->sw[i+1][j  ][k  ]                .
+ *  b2: t->sw[i  ][j+1][k  ]                .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                                     O
+ *  b5:                                   .   .
+ *  b6:                                 .       .
+ *  b7: t->sw[i+1][j+1][k+1]          .           .
+ *                                  .       O       .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x771(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[ip1][jp1][k],
+					      t->sw[ip1][j][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x771, i, j, k, i, j, k);
+
+	if (install_tswitch(t, ip1, j, kp1,
+			    tfind_face_corner(t->sw[ip1][jp1][kp1],
+					      t->sw[ip1][jp1][k],
+					      t->sw[ip1][j][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x771, i, j, k, ip1, j, kp1);
+
+	if (install_tswitch(t, i, jp1, kp1,
+			    tfind_face_corner(t->sw[ip1][jp1][kp1],
+					      t->sw[ip1][jp1][k],
+					      t->sw[i][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x771, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x78e:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1:
+ *  b2:
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]        .       O       .
+ *  b5: t->sw[i+1][j  ][k+1]          .           .
+ *  b6: t->sw[i  ][j+1][k+1]            .       .
+ *  b7:                                   .   .
+ *                                          O
+ *                                O         .         O
+ *                                          .
+ *                                          .
+ *                                          .
+ *                                          .
+ *                                          @
+ */
+static
+bool handle_case_0x78e(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, jp1, kp1,
+			    tfind_face_corner(t->sw[ip1][j][kp1],
+					      t->sw[i][j][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x78e, i, j, k, ip1, jp1, kp1);
+
+	if (install_tswitch(t, ip1, j, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][j][kp1],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x78e, i, j, k, ip1, j, k);
+
+	if (install_tswitch(t, i, jp1, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][j][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x78e, i, j, k, i, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x7b2:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1:
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4:                           .         O
+ *  b5:                           .       .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .
+ *  b7:                           .   .
+ *                                . .       O
+ *                                O                   O
+ *                                  .
+ *                                    .
+ *                                      .
+ *                                        .
+ *                                          @
+ */
+static
+bool handle_case_0x7b2(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][jp1][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7b2, i, j, k, ip1, j, k);
+
+	if (install_tswitch(t, ip1, jp1, kp1,
+			    tfind_face_corner(t->sw[i][jp1][kp1],
+					      t->sw[i][jp1][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7b2, i, j, k, ip1, jp1, kp1);
+
+	if (install_tswitch(t, i, j, kp1,
+			    tfind_face_corner(t->sw[i][jp1][kp1],
+					      t->sw[i][jp1][k],
+					      t->sw[i][j][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7b2, i, j, k, i, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7d4:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2:
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4:                                     O         .
+ *  b5: t->sw[i+1][j  ][k+1]                  .       .
+ *  b6:                                         .     .
+ *  b7:                                           .   .
+ *                                          O       . .
+ *                                O                   O
+ *                                                  .
+ *                                                .
+ *                                              .
+ *                                            .
+ *                                          @
+ */
+static
+bool handle_case_0x7d4(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, jp1, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7d4, i, j, k, i, jp1, k);
+
+	if (install_tswitch(t, i, j, kp1,
+			    tfind_face_corner(t->sw[ip1][j][kp1],
+					      t->sw[ip1][j][k],
+					      t->sw[i][j][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7d4, i, j, k, i, j, kp1);
+
+	if (install_tswitch(t, ip1, jp1, kp1,
+			    tfind_face_corner(t->sw[ip1][j][kp1],
+					      t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7d4, i, j, k, ip1, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7e8:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]                O
+ *  b5:
+ *  b6:
+ *  b7:
+ *                                          O
+ *                                O         .         O
+ *                                  .       .       .
+ *                                    .     .     .
+ *                                      .   .   .
+ *                                        . . .
+ *                                          @
+ */
+static
+bool handle_case_0x7e8(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, jp1, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[i][j][k],
+					      t->sw[i][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7e8, i, j, k, ip1, jp1, k);
+
+	if (install_tswitch(t, ip1, j, kp1,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[i][j][k],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7e8, i, j, k, ip1, j, kp1);
+
+	if (install_tswitch(t, i, jp1, kp1,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[i][j][k],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7e8, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * Handle the cases where four corners on a single face are missing.
+ */
+
+/*
+ * 3D case 0x70f:                           O
+ *                                        .   .
+ *  b0:                                 .       .
+ *  b1:                               .           .
+ *  b2:                             .               .
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]        .       O       .
+ *  b5: t->sw[i+1][j  ][k+1]          .           .
+ *  b6: t->sw[i  ][j+1][k+1]            .       .
+ *  b7: t->sw[i+1][j+1][k+1]              .   .
+ *                                          O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x70f(struct torus *t, int i, int j, int k)
+{
+	if (handle_case_0x71f(t, i, j, k))
+		return true;
+
+	if (handle_case_0x72f(t, i, j, k))
+		return true;
+
+	if (handle_case_0x74f(t, i, j, k))
+		return true;
+
+	return handle_case_0x78f(t, i, j, k);
+}
+
+/*
+ * 3D case 0x733:                           O
+ *                                        . .
+ *  b0:                                 .   .
+ *  b1:                               .     .
+ *  b2: t->sw[i  ][j+1][k  ]        .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                           .         O
+ *  b5:                           .       .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .
+ *  b7: t->sw[i+1][j+1][k+1]      .   .
+ *                                . .       O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x733(struct torus *t, int i, int j, int k)
+{
+	if (handle_case_0x737(t, i, j, k))
+		return true;
+
+	if (handle_case_0x73b(t, i, j, k))
+		return true;
+
+	if (handle_case_0x773(t, i, j, k))
+		return true;
+
+	return handle_case_0x7b3(t, i, j, k);
+}
+
+/*
+ * 3D case 0x755:                           O
+ *                                          . .
+ *  b0:                                     .   .
+ *  b1: t->sw[i+1][j  ][k  ]                .     .
+ *  b2:                                     .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                                     O         .
+ *  b5: t->sw[i+1][j  ][k+1]                  .       .
+ *  b6:                                         .     .
+ *  b7: t->sw[i+1][j+1][k+1]                      .   .
+ *                                          O       . .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x755(struct torus *t, int i, int j, int k)
+{
+	if (handle_case_0x757(t, i, j, k))
+		return true;
+
+	if (handle_case_0x75d(t, i, j, k))
+		return true;
+
+	if (handle_case_0x775(t, i, j, k))
+		return true;
+
+	return handle_case_0x7d5(t, i, j, k);
+}
+
+/*
+ * 3D case 0x7aa:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1:
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O
+ *  b5:                           .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .
+ *  b7:                           .       .
+ *                                .         O
+ *                                O         .         O
+ *                                  .       .
+ *                                    .     .
+ *                                      .   .
+ *                                        . .
+ *                                          @
+ */
+static
+bool handle_case_0x7aa(struct torus *t, int i, int j, int k)
+{
+	if (handle_case_0x7ab(t, i, j, k))
+		return true;
+
+	if (handle_case_0x7ae(t, i, j, k))
+		return true;
+
+	if (handle_case_0x7ba(t, i, j, k))
+		return true;
+
+	return handle_case_0x7ea(t, i, j, k);
+}
+
+/*
+ * 3D case 0x7cc:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2:
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]                O       . .
+ *  b5: t->sw[i+1][j  ][k+1]                      .   .
+ *  b6:                                         .     .
+ *  b7:                                       .       .
+ *                                          O         .
+ *                                O         .         O
+ *                                          .       .
+ *                                          .     .
+ *                                          .   .
+ *                                          . .
+ *                                          @
+ */
+static
+bool handle_case_0x7cc(struct torus *t, int i, int j, int k)
+{
+	if (handle_case_0x7cd(t, i, j, k))
+		return true;
+
+	if (handle_case_0x7ce(t, i, j, k))
+		return true;
+
+	if (handle_case_0x7dc(t, i, j, k))
+		return true;
+
+	return handle_case_0x7ec(t, i, j, k);
+}
+
+/*
+ * 3D case 0x7f0:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4:                                     O
+ *  b5:                                   .   .
+ *  b6:                                 .       .
+ *  b7:                               .           .
+ *                                  .       O       .
+ *                                O                   O
+ *                                  .               .
+ *                                    .           .
+ *                                      .       .
+ *                                        .   .
+ *                                          @
+ */
+static
+bool handle_case_0x7f0(struct torus *t, int i, int j, int k)
+{
+	if (handle_case_0x7f1(t, i, j, k))
+		return true;
+
+	if (handle_case_0x7f2(t, i, j, k))
+		return true;
+
+	if (handle_case_0x7f4(t, i, j, k))
+		return true;
+
+	return handle_case_0x7f8(t, i, j, k);
+}
+
+/*
+ * Handle the cases where three corners on a single face are missing.
+ */
+
+
+/*
+ * 3D case 0x707:                           O
+ *                                        . . .
+ *  b0:                                 .   .   .
+ *  b1:                               .     .     .
+ *  b2:                             .       .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4: t->sw[i  ][j  ][k+1]        .       O       .
+ *  b5: t->sw[i+1][j  ][k+1]          .           .
+ *  b6: t->sw[i  ][j+1][k+1]            .       .
+ *  b7: t->sw[i+1][j+1][k+1]              .   .
+ *                                          O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x707(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, k,
+			    tfind_face_corner(t->sw[ip1][jp1][k],
+					      t->sw[ip1][jp1][kp1],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x707, i, j, k, ip1, j, k);
+
+	if (install_tswitch(t, i, jp1, k,
+			    tfind_face_corner(t->sw[ip1][jp1][k],
+					      t->sw[ip1][jp1][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x707, i, j, k, i, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x70b:                           O
+ *                                        .   .
+ *  b0:                                 .       .
+ *  b1:                               .           .
+ *  b2: t->sw[i  ][j+1][k  ]        .               .
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O       .
+ *  b5: t->sw[i+1][j  ][k+1]      .   .           .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .
+ *  b7: t->sw[i+1][j+1][k+1]      .       .   .
+ *                                .         O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x70b(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[i][jp1][kp1],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x70b, i, j, k, i, j, k);
+
+	if (install_tswitch(t, ip1, jp1, k,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[i][jp1][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x70b, i, j, k, ip1, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x70d:                           O
+ *                                        .   .
+ *  b0:                                 .       .
+ *  b1: t->sw[i+1][j  ][k  ]          .           .
+ *  b2:                             .               .
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]        .       O       . .
+ *  b5: t->sw[i+1][j  ][k+1]          .           .   .
+ *  b6: t->sw[i  ][j+1][k+1]            .       .     .
+ *  b7: t->sw[i+1][j+1][k+1]              .   .       .
+ *                                          O         .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x70d(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][j][kp1],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x70d, i, j, k, i, j, k);
+
+	if (install_tswitch(t, ip1, jp1, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][j][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x70d, i, j, k, ip1, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x70e:                           O
+ *                                        .   .
+ *  b0: t->sw[i  ][j  ][k  ]            .       .
+ *  b1:                               .           .
+ *  b2:                             .               .
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]        .       O       .
+ *  b5: t->sw[i+1][j  ][k+1]          .           .
+ *  b6: t->sw[i  ][j+1][k+1]            .       .
+ *  b7: t->sw[i+1][j+1][k+1]              .   .
+ *                                          O
+ *                                O         .         O
+ *                                          .
+ *                                          .
+ *                                          .
+ *                                          .
+ *                                          @
+ */
+static
+bool handle_case_0x70e(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][j][kp1],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x70e, i, j, k, ip1, j, k);
+
+	if (install_tswitch(t, i, jp1, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][j][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x70e, i, j, k, i, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x713:                           O
+ *                                        . . .
+ *  b0:                                 .   .   .
+ *  b1:                               .     .     .
+ *  b2: t->sw[i  ][j+1][k  ]        .       .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                           .         O
+ *  b5: t->sw[i+1][j  ][k+1]      .       .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .
+ *  b7: t->sw[i+1][j+1][k+1]      .   .
+ *                                . .       O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x713(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, k,
+			    tfind_face_corner(t->sw[ip1][jp1][k],
+					      t->sw[ip1][jp1][kp1],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x713, i, j, k, ip1, j, k);
+
+	if (install_tswitch(t, i, j, kp1,
+			    tfind_face_corner(t->sw[ip1][j][kp1],
+					      t->sw[ip1][jp1][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x713, i, j, k, i, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x715:                           O
+ *                                        . . .
+ *  b0:                                 .   .   .
+ *  b1: t->sw[i+1][j  ][k  ]          .     .     .
+ *  b2:                             .       .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                                     O         .
+ *  b5: t->sw[i+1][j  ][k+1]                  .       .
+ *  b6: t->sw[i  ][j+1][k+1]                    .     .
+ *  b7: t->sw[i+1][j+1][k+1]                      .   .
+ *                                          O       . .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x715(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, jp1, k,
+			    tfind_face_corner(t->sw[ip1][jp1][k],
+					      t->sw[ip1][jp1][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x715, i, j, k, i, jp1, k);
+
+	if (install_tswitch(t, i, j, kp1,
+			    tfind_face_corner(t->sw[ip1][j][kp1],
+					      t->sw[ip1][jp1][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x715, i, j, k, i, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x723:                           O
+ *                                        . .
+ *  b0:                                 .   .
+ *  b1:                               .     .
+ *  b2: t->sw[i  ][j+1][k  ]        .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O
+ *  b5:                           .   .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .
+ *  b7: t->sw[i+1][j+1][k+1]      .   .   .
+ *                                . .       O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x723(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[i][jp1][kp1],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x723, i, j, k, i, j, k);
+
+	if (install_tswitch(t, ip1, j, kp1,
+			    tfind_face_corner(t->sw[i][j][kp1],
+					      t->sw[i][jp1][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x723, i, j, k, ip1, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x72a:                           O
+ *                                        .
+ *  b0: t->sw[i  ][j  ][k  ]            .
+ *  b1:                               .
+ *  b2: t->sw[i  ][j+1][k  ]        .
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O
+ *  b5:                           .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .
+ *  b7: t->sw[i+1][j+1][k+1]      .       .
+ *                                .         O
+ *                                O         .         O
+ *                                  .       .
+ *                                    .     .
+ *                                      .   .
+ *                                        . .
+ *                                          @
+ */
+static
+bool handle_case_0x72a(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, jp1, k,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[i][jp1][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x72a, i, j, k, ip1, jp1, k);
+
+	if (install_tswitch(t, ip1, j, kp1,
+			    tfind_face_corner(t->sw[i][j][kp1],
+					      t->sw[i][jp1][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x72a, i, j, k, ip1, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x731:                           O
+ *                                        . .
+ *  b0:                                 .   .
+ *  b1: t->sw[i+1][j  ][k  ]          .     .
+ *  b2: t->sw[i  ][j+1][k  ]        .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                           .         O
+ *  b5:                           .       .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .
+ *  b7: t->sw[i+1][j+1][k+1]      .   .           .
+ *                                . .       O       .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x731(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k],
+					      t->sw[i][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x731, i, j, k, i, j, k);
+
+	if (install_tswitch(t, ip1, j, kp1,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x731, i, j, k, ip1, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x732:                           O
+ *                                        . .
+ *  b0: t->sw[i  ][j  ][k  ]            .   .
+ *  b1:                               .     .
+ *  b2: t->sw[i  ][j+1][k  ]        .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                           .         O
+ *  b5:                           .       .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .
+ *  b7: t->sw[i+1][j+1][k+1]      .   .
+ *                                . .       O
+ *                                O                   O
+ *                                  .
+ *                                    .
+ *                                      .
+ *                                        .
+ *                                          @
+ */
+static
+bool handle_case_0x732(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][jp1][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x732, i, j, k, ip1, j, k);
+
+	if (install_tswitch(t, i, j, kp1,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][jp1][k],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x732, i, j, k, i, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x745:                           O
+ *                                          . .
+ *  b0:                                     .   .
+ *  b1: t->sw[i+1][j  ][k  ]                .     .
+ *  b2:                                     .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4: t->sw[i  ][j  ][k+1]                O       . .
+ *  b5: t->sw[i+1][j  ][k+1]                  .   .   .
+ *  b6:                                         .     .
+ *  b7: t->sw[i+1][j+1][k+1]                  .   .   .
+ *                                          O       . .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x745(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][j][kp1],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x745, i, j, k, i, j, k);
+
+	if (install_tswitch(t, i, jp1, kp1,
+			    tfind_face_corner(t->sw[i][j][kp1],
+					      t->sw[ip1][j][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x745, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x74c:                           O
+ *                                            .
+ *  b0: t->sw[i  ][j  ][k  ]                    .
+ *  b1: t->sw[i+1][j  ][k  ]                      .
+ *  b2:                                             .
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]                O       . .
+ *  b5: t->sw[i+1][j  ][k+1]                      .   .
+ *  b6:                                         .     .
+ *  b7: t->sw[i+1][j+1][k+1]                  .       .
+ *                                          O         .
+ *                                O         .         O
+ *                                          .       .
+ *                                          .     .
+ *                                          .   .
+ *                                          . .
+ *                                          @
+ */
+static
+bool handle_case_0x74c(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, jp1, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][j][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x74c, i, j, k, ip1, jp1, k);
+
+	if (install_tswitch(t, i, jp1, kp1,
+			    tfind_face_corner(t->sw[i][j][kp1],
+					      t->sw[ip1][j][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x74c, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x751:                           O
+ *                                          . .
+ *  b0:                                     .   .
+ *  b1: t->sw[i+1][j  ][k  ]                .     .
+ *  b2: t->sw[i  ][j+1][k  ]                .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                                     O         .
+ *  b5: t->sw[i+1][j  ][k+1]              .   .       .
+ *  b6:                                 .       .     .
+ *  b7: t->sw[i+1][j+1][k+1]          .           .   .
+ *                                  .       O       . .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x751(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k],
+					      t->sw[i][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x751, i, j, k, i, j, k);
+
+	if (install_tswitch(t, i, jp1, kp1,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[ip1][jp1][k],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x751, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x754:                           O
+ *                                          . .
+ *  b0: t->sw[i  ][j  ][k  ]                .   .
+ *  b1: t->sw[i+1][j  ][k  ]                .     .
+ *  b2:                                     .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                                     O         .
+ *  b5: t->sw[i+1][j  ][k+1]                  .       .
+ *  b6:                                         .     .
+ *  b7: t->sw[i+1][j+1][k+1]                      .   .
+ *                                          O       . .
+ *                                O                   O
+ *                                                  .
+ *                                                .
+ *                                              .
+ *                                            .
+ *                                          @
+ */
+static
+bool handle_case_0x754(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, jp1, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x754, i, j, k, i, jp1, k);
+
+	if (install_tswitch(t, i, j, kp1,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[ip1][j][k],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x754, i, j, k, i, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x770:                           O
+ *                                          .
+ *  b0: t->sw[i  ][j  ][k  ]                .
+ *  b1: t->sw[i+1][j  ][k  ]                .
+ *  b2: t->sw[i  ][j+1][k  ]                .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                                     O
+ *  b5:                                   .   .
+ *  b6:                                 .       .
+ *  b7: t->sw[i+1][j+1][k+1]          .           .
+ *                                  .       O       .
+ *                                O                   O
+ *                                  .               .
+ *                                    .           .
+ *                                      .       .
+ *                                        .   .
+ *                                          @
+ */
+static
+bool handle_case_0x770(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, kp1,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x770, i, j, k, ip1, j, kp1);
+
+	if (install_tswitch(t, i, jp1, kp1,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[ip1][jp1][k],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x770, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x78a:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1:
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O       .
+ *  b5: t->sw[i+1][j  ][k+1]      .   .           .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .
+ *  b7:                           .       .   .
+ *                                .         O
+ *                                O         .         O
+ *                                  .       .
+ *                                    .     .
+ *                                      .   .
+ *                                        . .
+ *                                          @
+ */
+static
+bool handle_case_0x78a(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][j][kp1],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x78a, i, j, k, ip1, j, k);
+
+	if (install_tswitch(t, ip1, jp1, kp1,
+			    tfind_face_corner(t->sw[ip1][j][kp1],
+					      t->sw[i][j][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x78a, i, j, k, ip1, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x78c:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2:
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]        .       O       . .
+ *  b5: t->sw[i+1][j  ][k+1]          .           .   .
+ *  b6: t->sw[i  ][j+1][k+1]            .       .     .
+ *  b7:                                   .   .       .
+ *                                          O         .
+ *                                O         .         O
+ *                                          .       .
+ *                                          .     .
+ *                                          .   .
+ *                                          . .
+ *                                          @
+ */
+static
+bool handle_case_0x78c(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, jp1, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][j][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x78c, i, j, k, i, jp1, k);
+
+	if (install_tswitch(t, ip1, jp1, kp1,
+			    tfind_face_corner(t->sw[ip1][j][kp1],
+					      t->sw[i][j][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x78c, i, j, k, ip1, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7a2:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1:
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O
+ *  b5:                           .   .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .
+ *  b7:                           .   .   .
+ *                                . .       O
+ *                                O         .         O
+ *                                  .       .
+ *                                    .     .
+ *                                      .   .
+ *                                        . .
+ *                                          @
+ */
+static
+bool handle_case_0x7a2(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][jp1][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7a2, i, j, k, ip1, j, k);
+
+	if (install_tswitch(t, ip1, jp1, kp1,
+			    tfind_face_corner(t->sw[i][jp1][kp1],
+					      t->sw[i][jp1][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7a2, i, j, k, ip1, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7a8:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[ip1][j  ][k  ]
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O
+ *  b5:                           .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .
+ *  b7:                           .       .
+ *                                .         O
+ *                                O         .         O
+ *                                  .       .       .
+ *                                    .     .     .
+ *                                      .   .   .
+ *                                        . . .
+ *                                          @
+ */
+static
+bool handle_case_0x7a8(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, jp1, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[i][j][k],
+					      t->sw[i][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7a8, i, j, k, ip1, jp1, k);
+
+	if (install_tswitch(t, ip1, j, kp1,
+			    tfind_face_corner(t->sw[i][j][kp1],
+					      t->sw[i][j][k],
+					      t->sw[ip1][j][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7a8, i, j, k, ip1, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7b0:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4:                           .         O
+ *  b5:                           .       .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .
+ *  b7:                           .   .           .
+ *                                . .       O       .
+ *                                O                   O
+ *                                  .               .
+ *                                    .           .
+ *                                      .       .
+ *                                        .   .
+ *                                          @
+ */
+static
+bool handle_case_0x7b0(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, kp1,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][jp1][k],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7b0, i, j, k, i, j, kp1);
+
+	if (install_tswitch(t, ip1, jp1, kp1,
+			    tfind_face_corner(t->sw[i][jp1][kp1],
+					      t->sw[i][jp1][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7b0, i, j, k, ip1, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7c4:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2:
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4: t->sw[i  ][j  ][k+1]                O       . .
+ *  b5: t->sw[i+1][j  ][k+1]                  .   .   .
+ *  b6:                                         .     .
+ *  b7:                                       .   .   .
+ *                                          O       . .
+ *                                O         .         O
+ *                                          .       .
+ *                                          .     .
+ *                                          .   .
+ *                                          . .
+ *                                          @
+ */
+static
+bool handle_case_0x7c4(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, jp1, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7c4, i, j, k, i, jp1, k);
+
+	if (install_tswitch(t, ip1, jp1, kp1,
+			    tfind_face_corner(t->sw[ip1][j][kp1],
+					      t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7c4, i, j, k, ip1, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7c8:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]                O       . .
+ *  b5: t->sw[i+1][j  ][k+1]                      .   .
+ *  b6:                                         .     .
+ *  b7:                                       .       .
+ *                                          O         .
+ *                                O         .         O
+ *                                  .       .       .
+ *                                    .     .     .
+ *                                      .   .   .
+ *                                        . . .
+ *                                          @
+ */
+static
+bool handle_case_0x7c8(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, jp1, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[i][j][k],
+					      t->sw[i][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7c8, i, j, k, ip1, jp1, k);
+
+	if (install_tswitch(t, i, jp1, kp1,
+			    tfind_face_corner(t->sw[i][j][kp1],
+					      t->sw[i][j][k],
+					      t->sw[i][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7c8, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7d0:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4:                                     O         .
+ *  b5: t->sw[i+1][j  ][k+1]              .   .       .
+ *  b6:                                 .       .     .
+ *  b7:                               .           .   .
+ *                                  .       O       . .
+ *                                O                   O
+ *                                  .               .
+ *                                    .           .
+ *                                      .       .
+ *                                        .   .
+ *                                          @
+ */
+static
+bool handle_case_0x7d0(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, kp1,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[ip1][j][k],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7d0, i, j, k, i, j, kp1);
+
+	if (install_tswitch(t, ip1, jp1, kp1,
+			    tfind_face_corner(t->sw[ip1][j][kp1],
+					      t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7d0, i, j, k, ip1, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7e0:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4: t->sw[i  ][j  ][k+1]                O
+ *  b5:                                   .   .
+ *  b6:                                 .       .
+ *  b7:                               .           .
+ *                                  .       O       .
+ *                                O         .         O
+ *                                  .       .       .
+ *                                    .     .     .
+ *                                      .   .   .
+ *                                        . . .
+ *                                          @
+ */
+static
+bool handle_case_0x7e0(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, kp1,
+			    tfind_face_corner(t->sw[i][j][kp1],
+					      t->sw[i][j][k],
+					      t->sw[ip1][j][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7e0, i, j, k, ip1, j, kp1);
+
+	if (install_tswitch(t, i, jp1, kp1,
+			    tfind_face_corner(t->sw[i][j][kp1],
+					      t->sw[i][j][k],
+					      t->sw[i][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7e0, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * Handle the cases where two corners on a single edge are missing.
+ */
+
+/*
+ * 3D case 0x703:                           O
+ *                                        . . .
+ *  b0:                                 .   .   .
+ *  b1:                               .     .     .
+ *  b2: t->sw[i  ][j+1][k  ]        .       .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O       .
+ *  b5: t->sw[i+1][j  ][k+1]      .   .   .       .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .
+ *  b7: t->sw[i+1][j+1][k+1]      .   .   .   .
+ *                                . .       O
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x703(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[i][jp1][kp1],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x703, i, j, k, i, j, k);
+
+	if (install_tswitch(t, ip1, j, k,
+			    tfind_face_corner(t->sw[ip1][jp1][k],
+					      t->sw[ip1][jp1][kp1],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x703, i, j, k, ip1, j, k);
+	return false;
+}
+
+/*
+ * 3D case 0x705:                           O
+ *                                        . . .
+ *  b0:                                 .   .   .
+ *  b1: t->sw[i+1][j  ][k  ]          .     .     .
+ *  b2:                             .       .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4: t->sw[i  ][j  ][k+1]        .       O       . .
+ *  b5: t->sw[i+1][j  ][k+1]          .       .   .   .
+ *  b6: t->sw[i  ][j+1][k+1]            .       .     .
+ *  b7: t->sw[i+1][j+1][k+1]              .   .   .   .
+ *                                          O       . .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x705(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][j][kp1],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x705, i, j, k, i, j, k);
+
+	if (install_tswitch(t, i, jp1, k,
+			    tfind_face_corner(t->sw[ip1][jp1][k],
+					      t->sw[ip1][jp1][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x705, i, j, k, i, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x70a:                           O
+ *                                        . . .
+ *  b0: t->sw[i  ][j  ][k  ]            .       .
+ *  b1:                               .           .
+ *  b2: t->sw[i  ][j+1][k  ]        .               .
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O       .
+ *  b5: t->sw[i+1][j  ][k+1]      .   .           .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .
+ *  b7: t->sw[i+1][j+1][k+1]      .       .   .
+ *                                .         O
+ *                                O         .         O
+ *                                  .       .
+ *                                    .     .
+ *                                      .   .
+ *                                        . .
+ *                                          @
+ */
+static
+bool handle_case_0x70a(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][j][kp1],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x70a, i, j, k, ip1, j, k);
+
+	if (install_tswitch(t, ip1, jp1, k,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[i][jp1][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x70a, i, j, k, ip1, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x70c:                           O
+ *                                        .   .
+ *  b0: t->sw[i  ][j  ][k  ]            .       .
+ *  b1: t->sw[i+1][j  ][k  ]          .           .
+ *  b2:                             .               .
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]        .       O       . .
+ *  b5: t->sw[i+1][j  ][k+1]          .           .   .
+ *  b6: t->sw[i  ][j+1][k+1]            .       .     .
+ *  b7: t->sw[i+1][j+1][k+1]              .   .       .
+ *                                          O         .
+ *                                O         .         O
+ *                                          .       .
+ *                                          .     .
+ *                                          .   .
+ *                                          . .
+ *                                          @
+ */
+static
+bool handle_case_0x70c(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, jp1, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][j][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x70c, i, j, k, i, jp1, k);
+
+	if (install_tswitch(t, ip1, jp1, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][j][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x70c, i, j, k, ip1, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x711:                           O
+ *                                        . . .
+ *  b0:                                 .   .   .
+ *  b1: t->sw[i+1][j  ][k  ]          .     .     .
+ *  b2: t->sw[i  ][j+1][k  ]        .       .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                           .         O         .
+ *  b5: t->sw[i+1][j  ][k+1]      .       .   .       .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .     .
+ *  b7: t->sw[i+1][j+1][k+1]      .   .           .   .
+ *                                . .       O       . .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x711(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k],
+					      t->sw[i][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x711, i, j, k, i, j, k);
+
+	if (install_tswitch(t, i, j, kp1,
+			    tfind_face_corner(t->sw[ip1][j][kp1],
+					      t->sw[ip1][jp1][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x711, i, j, k, i, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x722:                           O
+ *                                        . .
+ *  b0: t->sw[i  ][j  ][k  ]            .   .
+ *  b1:                               .     .
+ *  b2: t->sw[i  ][j+1][k  ]        .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O
+ *  b5:                           .   .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .
+ *  b7: t->sw[i+1][j+1][k+1]      .   .   .
+ *                                . .       O
+ *                                O         .         O
+ *                                  .       .
+ *                                    .     .
+ *                                      .   .
+ *                                        . .
+ *                                          @
+ */
+static
+bool handle_case_0x722(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][jp1][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x722, i, j, k, ip1, j, k);
+
+	if (install_tswitch(t, ip1, j, kp1,
+			    tfind_face_corner(t->sw[i][j][kp1],
+					      t->sw[i][jp1][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x722, i, j, k, ip1, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x730:                           O
+ *                                        . .
+ *  b0: t->sw[i  ][j  ][k  ]            .   .
+ *  b1: t->sw[i+1][j  ][k  ]          .     .
+ *  b2: t->sw[i  ][j+1][k  ]        .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                           .         O
+ *  b5:                           .       .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .
+ *  b7: t->sw[i+1][j+1][k+1]      .   .           .
+ *                                . .       O       .
+ *                                O                   O
+ *                                  .               .
+ *                                    .           .
+ *                                      .       .
+ *                                        .   .
+ *                                          @
+ */
+static
+bool handle_case_0x730(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, kp1,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][jp1][k],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x730, i, j, k, i, j, kp1);
+
+	if (install_tswitch(t, ip1, j, kp1,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x730, i, j, k, ip1, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x744:                           O
+ *                                          . .
+ *  b0: t->sw[i  ][j  ][k  ]                .   .
+ *  b1: t->sw[i+1][j  ][k  ]                .     .
+ *  b2:                                     .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4: t->sw[i  ][j  ][k+1]                O       . .
+ *  b5: t->sw[i+1][j  ][k+1]                  .   .   .
+ *  b6:                                         .     .
+ *  b7: t->sw[i+1][j+1][k+1]                  .   .   .
+ *                                          O       . .
+ *                                O         .         O
+ *                                          .       .
+ *                                          .     .
+ *                                          .   .
+ *                                          . .
+ *                                          @
+ */
+static
+bool handle_case_0x744(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, jp1, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x744, i, j, k, i, jp1, k);
+
+	if (install_tswitch(t, i, jp1, kp1,
+			    tfind_face_corner(t->sw[i][j][kp1],
+					      t->sw[ip1][j][kp1],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x744, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x750:                           O
+ *                                          . .
+ *  b0: t->sw[i  ][j  ][k  ]                .   .
+ *  b1: t->sw[i+1][j  ][k  ]                .     .
+ *  b2: t->sw[i  ][j+1][k  ]                .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                                     O         .
+ *  b5: t->sw[i+1][j  ][k+1]              .   .       .
+ *  b6:                                 .       .     .
+ *  b7: t->sw[i+1][j+1][k+1]          .           .   .
+ *                                  .       O       . .
+ *                                O                   O
+ *                                  .               .
+ *                                    .           .
+ *                                      .       .
+ *                                        .   .
+ *                                          @
+ */
+static
+bool handle_case_0x750(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, kp1,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[ip1][j][k],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x750, i, j, k, i, j, kp1);
+
+	if (install_tswitch(t, i, jp1, kp1,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[ip1][jp1][k],
+					      t->sw[ip1][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x750, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x788:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[ip1][j  ][k  ]
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O       . .
+ *  b5: t->sw[i+1][j  ][k+1]      .   .           .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .     .
+ *  b7:                           .       .   .       .
+ *                                .         O         .
+ *                                O         .         O
+ *                                  .       .       .
+ *                                    .     .     .
+ *                                      .   .   .
+ *                                        . . .
+ *                                          @
+ */
+static
+bool handle_case_0x788(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, jp1, k,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[i][j][k],
+					      t->sw[i][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x788, i, j, k, ip1, jp1, k);
+
+	if (install_tswitch(t, ip1, jp1, kp1,
+			    tfind_face_corner(t->sw[ip1][j][kp1],
+					      t->sw[i][j][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x788, i, j, k, ip1, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7a0:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O
+ *  b5:                           .   .   .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .
+ *  b7:                           .   .   .       .
+ *                                . .       O       .
+ *                                O         .         O
+ *                                  .       .       .
+ *                                    .     .     .
+ *                                      .   .   .
+ *                                        . . .
+ *                                          @
+ */
+static
+bool handle_case_0x7a0(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, kp1,
+			    tfind_face_corner(t->sw[i][j][kp1],
+					      t->sw[i][j][k],
+					      t->sw[ip1][j][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7a0, i, j, k, ip1, j, kp1);
+
+	if (install_tswitch(t, ip1, jp1, kp1,
+			    tfind_face_corner(t->sw[i][jp1][kp1],
+					      t->sw[i][jp1][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7a0, i, j, k, ip1, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x7c0:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4: t->sw[i  ][j  ][k+1]                O       . .
+ *  b5: t->sw[i+1][j  ][k+1]              .   .   .   .
+ *  b6:                                 .       .     .
+ *  b7:                               .       .   .   .
+ *                                  .       O       . .
+ *                                O         .         O
+ *                                  .       .       .
+ *                                    .     .     .
+ *                                      .   .   .
+ *                                        . . .
+ *                                          @
+ */
+static
+bool handle_case_0x7c0(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, jp1, kp1,
+			    tfind_face_corner(t->sw[i][j][kp1],
+					      t->sw[i][j][k],
+					      t->sw[i][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7c0, i, j, k, i, jp1, kp1);
+
+	if (install_tswitch(t, ip1, jp1, kp1,
+			    tfind_face_corner(t->sw[ip1][j][kp1],
+					      t->sw[ip1][j][k],
+					      t->sw[ip1][jp1][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x7c0, i, j, k, ip1, jp1, kp1);
+	return false;
+}
+
+/*
+ * Handle the cases where a single corner is missing.
+ */
+
+/*
+ * 3D case 0x701:                           O
+ *                                        . . .
+ *  b0:                                     .   .   .
+ *  b1: t->sw[i+1][j  ][k  ]          .     .     .
+ *  b2: t->sw[i  ][j+1][k  ]        .       .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O       . .
+ *  b5: t->sw[i+1][j  ][k+1]      .   .   .   .   .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .     .
+ *  b7: t->sw[i+1][j+1][k+1]      .   .   .   .   .   .
+ *                                . .       O       . .
+ *                                O                   O
+ *
+ *
+ *
+ *
+ *                                          @
+ */
+static
+bool handle_case_0x701(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+
+	if (install_tswitch(t, i, j, k,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[ip1][jp1][k],
+					      t->sw[ip1][j][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x701, i, j, k, i, j, k);
+	return false;
+}
+
+/*
+ * 3D case 0x702:                           O
+ *                                        . . .
+ *  b0: t->sw[i  ][j  ][k  ]            .   .   .
+ *  b1:                               .     .     .
+ *  b2: t->sw[i  ][j+1][k  ]        .       .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O       .
+ *  b5: t->sw[i+1][j  ][k+1]      .   .   .       .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .
+ *  b7: t->sw[i+1][j+1][k+1]      .   .   .   .
+ *                                . .       O
+ *                                O         .         O
+ *                                  .       .
+ *                                    .     .
+ *                                      .   .
+ *                                        . .
+ *                                          @
+ */
+static
+bool handle_case_0x702(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][j][kp1],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x702, i, j, k, ip1, j, k);
+	return false;
+}
+
+/*
+ * 3D case 0x704:                           O
+ *                                        . . .
+ *  b0: t->sw[i  ][j  ][k  ]            .   .   .
+ *  b1: t->sw[i+1][j  ][k  ]          .     .     .
+ *  b2:                             .       .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4: t->sw[i  ][j  ][k+1]        .       O       . .
+ *  b5: t->sw[i+1][j  ][k+1]          .       .   .   .
+ *  b6: t->sw[i  ][j+1][k+1]            .       .     .
+ *  b7: t->sw[i+1][j+1][k+1]              .   .   .   .
+ *                                          O       . .
+ *                                O         .         O
+ *                                          .       .
+ *                                          .     .
+ *                                          .   .
+ *                                          . .
+ *                                          @
+ */
+static
+bool handle_case_0x704(struct torus *t, int i, int j, int k)
+{
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, jp1, k,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[i][j][kp1],
+					      t->sw[i][jp1][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x704, i, j, k, i, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x708:                           O
+ *                                        .   .
+ *  b0: t->sw[i  ][j  ][k  ]            .       .
+ *  b1: t->sw[i+1][j  ][k  ]          .           .
+ *  b2: t->sw[i  ][j+1][k  ]        .               .
+ *  b3:                           O                   O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O       . .
+ *  b5: t->sw[i+1][j  ][k+1]      .   .           .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .     .
+ *  b7: t->sw[i+1][j+1][k+1]      .       .   .       .
+ *                                .         O         .
+ *                                O         .         O
+ *                                  .       .       .
+ *                                    .     .     .
+ *                                      .   .   .
+ *                                        . . .
+ *                                          @
+ */
+static
+bool handle_case_0x708(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+
+	if (install_tswitch(t, ip1, jp1, k,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[i][j][k],
+					      t->sw[ip1][j][k]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x708, i, j, k, ip1, jp1, k);
+	return false;
+}
+
+/*
+ * 3D case 0x710:                           O
+ *                                        . . .
+ *  b0: t->sw[i  ][j  ][k  ]            .   .   .
+ *  b1: t->sw[i+1][j  ][k  ]          .     .     .
+ *  b2: t->sw[i  ][j+1][k  ]        .       .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4:                           .         O         .
+ *  b5: t->sw[i+1][j  ][k+1]      .       .   .       .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .     .
+ *  b7: t->sw[i+1][j+1][k+1]      .   .           .   .
+ *                                . .       O       . .
+ *                                O                   O
+ *                                  .               .
+ *                                    .           .
+ *                                      .       .
+ *                                        .   .
+ *                                          @
+ */
+static
+bool handle_case_0x710(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, j, kp1,
+			    tfind_face_corner(t->sw[i][j][k],
+					      t->sw[ip1][j][k],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x710, i, j, k, i, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x720:                           O
+ *                                        . .
+ *  b0: t->sw[i  ][j  ][k  ]            .   .
+ *  b1: t->sw[i+1][j  ][k  ]          .     .
+ *  b2: t->sw[i  ][j+1][k  ]        .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O
+ *  b5:                           .   .   .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .
+ *  b7: t->sw[i+1][j+1][k+1]      .   .   .       .
+ *                                . .       O       .
+ *                                O         .         O
+ *                                  .       .       .
+ *                                    .     .     .
+ *                                      .   .   .
+ *                                        . . .
+ *                                          @
+ */
+static
+bool handle_case_0x720(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, j, kp1,
+			    tfind_face_corner(t->sw[ip1][j][k],
+					      t->sw[i][j][k],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x720, i, j, k, ip1, j, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x740:                           O
+ *                                          . .
+ *  b0: t->sw[i  ][j  ][k  ]                .   .
+ *  b1: t->sw[i+1][j  ][k  ]                .     .
+ *  b2: t->sw[i  ][j+1][k  ]                .       .
+ *  b3: t->sw[i+1][j+1][k  ]      O         .         O
+ *  b4: t->sw[i  ][j  ][k+1]                O       . .
+ *  b5: t->sw[i+1][j  ][k+1]              .   .   .   .
+ *  b6:                                 .       .     .
+ *  b7: t->sw[i+1][j+1][k+1]          .       .   .   .
+ *                                  .       O       . .
+ *                                O         .         O
+ *                                  .       .       .
+ *                                    .     .     .
+ *                                      .   .   .
+ *                                        . . .
+ *                                          @
+ */
+static
+bool handle_case_0x740(struct torus *t, int i, int j, int k)
+{
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, i, jp1, kp1,
+			    tfind_face_corner(t->sw[i][jp1][k],
+					      t->sw[i][j][k],
+					      t->sw[i][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x740, i, j, k, i, jp1, kp1);
+	return false;
+}
+
+/*
+ * 3D case 0x780:                           O
+ *
+ *  b0: t->sw[i  ][j  ][k  ]
+ *  b1: t->sw[i+1][j  ][k  ]
+ *  b2: t->sw[i  ][j+1][k  ]
+ *  b3: t->sw[i+1][j+1][k  ]      O                   O
+ *  b4: t->sw[i  ][j  ][k+1]      . .       O       . .
+ *  b5: t->sw[i+1][j  ][k+1]      .   .   .   .   .   .
+ *  b6: t->sw[i  ][j+1][k+1]      .     .       .     .
+ *  b7:                           .   .   .   .   .   .
+ *                                . .       O       . .
+ *                                O         .         O
+ *                                  .       .       .
+ *                                    .     .     .
+ *                                      .   .   .
+ *                                        . . .
+ *                                          @
+ */
+static
+bool handle_case_0x780(struct torus *t, int i, int j, int k)
+{
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	if (install_tswitch(t, ip1, jp1, kp1,
+			    tfind_face_corner(t->sw[i][jp1][kp1],
+					      t->sw[i][j][kp1],
+					      t->sw[ip1][j][kp1]))) {
+		return true;
+	}
+	log_no_crnr(t, 0x780, i, j, k, ip1, jp1, kp1);
+	return false;
+}
+
+/*
+ * Make sure links between all known torus/mesh switches are installed.
+ *
+ * We don't have to worry about links that wrap on a mesh coordinate, as
+ * there shouldn't be any; if there are it indicates an input error.
+ */
+static
+void check_tlinks(struct torus *t, int i, int j, int k)
+{
+	struct t_switch ****sw = t->sw;
+	int ip1 = canonicalize(i + 1, t->x_sz);
+	int jp1 = canonicalize(j + 1, t->y_sz);
+	int kp1 = canonicalize(k + 1, t->z_sz);
+
+	/*
+	 * Don't waste time/code checking return status of link_tswitches()
+	 * here.  It is unlikely to fail, and the result of any failure here
+	 * will be caught elsewhere anyway.
+	 */
+	if (sw[i][j][k] && sw[ip1][j][k])
+		link_tswitches(t, 0, sw[i][j][k], sw[ip1][j][k]);
+
+	if (sw[i][jp1][k] && sw[ip1][jp1][k])
+		link_tswitches(t, 0, sw[i][jp1][k], sw[ip1][jp1][k]);
+
+	if (sw[i][j][kp1] && sw[ip1][j][kp1])
+		link_tswitches(t, 0, sw[i][j][kp1], sw[ip1][j][kp1]);
+
+	if (sw[i][jp1][kp1] && sw[ip1][jp1][kp1])
+		link_tswitches(t, 0, sw[i][jp1][kp1], sw[ip1][jp1][kp1]);
+
+
+	if (sw[i][j][k] && sw[i][jp1][k])
+		link_tswitches(t, 1, sw[i][j][k], sw[i][jp1][k]);
+
+	if (sw[ip1][j][k] && sw[ip1][jp1][k])
+		link_tswitches(t, 1, sw[ip1][j][k], sw[ip1][jp1][k]);
+
+	if (sw[i][j][kp1] && sw[i][jp1][kp1])
+		link_tswitches(t, 1, sw[i][j][kp1], sw[i][jp1][kp1]);
+
+	if (sw[ip1][j][kp1] && sw[ip1][jp1][kp1])
+		link_tswitches(t, 1, sw[ip1][j][kp1], sw[ip1][jp1][kp1]);
+
+
+	if (sw[i][j][k] && sw[i][j][kp1])
+		link_tswitches(t, 2, sw[i][j][k], sw[i][j][kp1]);
+
+	if (sw[ip1][j][k] && sw[ip1][j][kp1])
+		link_tswitches(t, 2, sw[ip1][j][k], sw[ip1][j][kp1]);
+
+	if (sw[i][jp1][k] && sw[i][jp1][kp1])
+		link_tswitches(t, 2, sw[i][jp1][k], sw[i][jp1][kp1]);
+
+	if (sw[ip1][jp1][k] && sw[ip1][jp1][kp1])
+		link_tswitches(t, 2, sw[ip1][jp1][k], sw[ip1][jp1][kp1]);
+}
+
+static
+void locate_sw(struct torus *t, int i, int j, int k)
+{
+	unsigned fp;
+	bool success;
+
+	i = canonicalize(i, t->x_sz);
+	j = canonicalize(j, t->y_sz);
+	k = canonicalize(k, t->z_sz);
+
+	/*
+	 * By definition, if a coordinate direction is meshed, we don't
+	 * allow it to wrap to zero.
+	 */
+	if (t->flags & X_MESH) {
+		int ip1 = canonicalize(i + 1, t->x_sz);
+		if (ip1 < i)
+			goto out;
+	}
+	if (t->flags & Y_MESH) {
+		int jp1 = canonicalize(j + 1, t->y_sz);
+		if (jp1 < j)
+			goto out;
+	}
+	if (t->flags & Z_MESH) {
+		int kp1 = canonicalize(k + 1, t->z_sz);
+		if (kp1 < k)
+			goto out;
+	}
+	/*
+	 * There are various reasons that the links are not installed between
+	 * known torus switches.  These include cases where the search for
+	 * new switches only partially succeeds due to missing switches, and
+	 * cases where we haven't processed this position yet, but processing
+	 * of multiple independent neighbor positions has installed switches
+	 * into corners of our case.
+	 *
+	 * In any event, the topology assumptions made in handling the
+	 * fingerprint for this position require that all links be installed
+	 * between installed switches for this position.
+	 */
+again:
+	check_tlinks(t, i, j, k);
+	fp = fingerprint(t, i, j, k);
+
+	switch (fp) {
+	/*
+	 * When all switches are present, we are done.  Otherwise, one of
+	 * the cases below will be unsuccessful, and we'll be done also.
+	 *
+	 * Note that check_tlinks() above will ensure all links that are
+	 * present are connected, in the event that all our switches are
+	 * present due to successful case handling in the surrounding
+	 * torus/mesh.
+	 */
+	case 0x300:
+	case 0x500:
+	case 0x600:
+	case 0x700:
+		goto out;
+	/*
+	 * Ignore the 2D cases where there isn't enough information to uniquely
+	 * locate/place a switch into the cube.
+	 */
+	case 0x30f: 	/* 0 corners available */
+	case 0x533: 	/* 0 corners available */
+	case 0x655: 	/* 0 corners available */
+	case 0x30e:	/* 1 corner available */
+	case 0x532:	/* 1 corner available */
+	case 0x654:	/* 1 corner available */
+	case 0x30d:	/* 1 corner available */
+	case 0x531:	/* 1 corner available */
+	case 0x651:	/* 1 corner available */
+	case 0x30b:	/* 1 corner available */
+	case 0x523:	/* 1 corner available */
+	case 0x645:	/* 1 corner available */
+	case 0x307:	/* 1 corner available */
+	case 0x513:	/* 1 corner available */
+	case 0x615:	/* 1 corner available */
+		goto out;
+	/*
+	 * Handle the 2D cases with a single existing edge.
+	 *
+	 */
+	case 0x30c:
+		success = handle_case_0x30c(t, i, j, k);
+		break;
+	case 0x303:
+		success = handle_case_0x303(t, i, j, k);
+		break;
+	case 0x305:
+		success = handle_case_0x305(t, i, j, k);
+		break;
+	case 0x30a:
+		success = handle_case_0x30a(t, i, j, k);
+		break;
+	case 0x503:
+		success = handle_case_0x503(t, i, j, k);
+		break;
+	case 0x511:
+		success = handle_case_0x511(t, i, j, k);
+		break;
+	case 0x522:
+		success = handle_case_0x522(t, i, j, k);
+		break;
+	case 0x530:
+		success = handle_case_0x530(t, i, j, k);
+		break;
+	case 0x605:
+		success = handle_case_0x605(t, i, j, k);
+		break;
+	case 0x611:
+		success = handle_case_0x611(t, i, j, k);
+		break;
+	case 0x644:
+		success = handle_case_0x644(t, i, j, k);
+		break;
+	case 0x650:
+		success = handle_case_0x650(t, i, j, k);
+		break;
+	/*
+	 * Handle the 2D cases where two existing edges meet at a corner.
+	 */
+	case 0x301:
+		success = handle_case_0x301(t, i, j, k);
+		break;
+	case 0x302:
+		success = handle_case_0x302(t, i, j, k);
+		break;
+	case 0x304:
+		success = handle_case_0x304(t, i, j, k);
+		break;
+	case 0x308:
+		success = handle_case_0x308(t, i, j, k);
+		break;
+	case 0x501:
+		success = handle_case_0x501(t, i, j, k);
+		break;
+	case 0x502:
+		success = handle_case_0x502(t, i, j, k);
+		break;
+	case 0x520:
+		success = handle_case_0x520(t, i, j, k);
+		break;
+	case 0x510:
+		success = handle_case_0x510(t, i, j, k);
+		break;
+	case 0x601:
+		success = handle_case_0x601(t, i, j, k);
+		break;
+	case 0x604:
+		success = handle_case_0x604(t, i, j, k);
+		break;
+	case 0x610:
+		success = handle_case_0x610(t, i, j, k);
+		break;
+	case 0x640:
+		success = handle_case_0x640(t, i, j, k);
+		break;
+	/*
+	 * Ignore the 3D cases where there isn't enough information to uniquely
+	 * locate/place a switch into the cube.
+	 */
+	case 0x7ff:	/* 0 corners available */
+	case 0x7fe:	/* 1 corner available */
+	case 0x7fd:	/* 1 corner available */
+	case 0x7fb:	/* 1 corner available */
+	case 0x7f7:	/* 1 corner available */
+	case 0x7ef:	/* 1 corner available */
+	case 0x7df:	/* 1 corner available */
+	case 0x7bf:	/* 1 corner available */
+	case 0x77f:	/* 1 corner available */
+	case 0x7fc:	/* 2 adj corners available */
+	case 0x7fa:	/* 2 adj corners available */
+	case 0x7f5:	/* 2 adj corners available */
+	case 0x7f3:	/* 2 adj corners available */
+	case 0x7cf:	/* 2 adj corners available */
+	case 0x7af:	/* 2 adj corners available */
+	case 0x75f:	/* 2 adj corners available */
+	case 0x73f:	/* 2 adj corners available */
+	case 0x7ee:	/* 2 adj corners available */
+	case 0x7dd:	/* 2 adj corners available */
+	case 0x7bb:	/* 2 adj corners available */
+	case 0x777:	/* 2 adj corners available */
+		goto out;
+	/*
+	 * Handle the 3D cases where two existing edges meet at a corner.
+	 *
+	 */
+	case 0x71f:
+		success = handle_case_0x71f(t, i, j, k);
+		break;
+	case 0x72f:
+		success = handle_case_0x72f(t, i, j, k);
+		break;
+	case 0x737:
+		success = handle_case_0x737(t, i, j, k);
+		break;
+	case 0x73b:
+		success = handle_case_0x73b(t, i, j, k);
+		break;
+	case 0x74f:
+		success = handle_case_0x74f(t, i, j, k);
+		break;
+	case 0x757:
+		success = handle_case_0x757(t, i, j, k);
+		break;
+	case 0x75d:
+		success = handle_case_0x75d(t, i, j, k);
+		break;
+	case 0x773:
+		success = handle_case_0x773(t, i, j, k);
+		break;
+	case 0x775:
+		success = handle_case_0x775(t, i, j, k);
+		break;
+	case 0x78f:
+		success = handle_case_0x78f(t, i, j, k);
+		break;
+	case 0x7ab:
+		success = handle_case_0x7ab(t, i, j, k);
+		break;
+	case 0x7ae:
+		success = handle_case_0x7ae(t, i, j, k);
+		break;
+	case 0x7b3:
+		success = handle_case_0x7b3(t, i, j, k);
+		break;
+	case 0x7ba:
+		success = handle_case_0x7ba(t, i, j, k);
+		break;
+	case 0x7cd:
+		success = handle_case_0x7cd(t, i, j, k);
+		break;
+	case 0x7ce:
+		success = handle_case_0x7ce(t, i, j, k);
+		break;
+	case 0x7d5:
+		success = handle_case_0x7d5(t, i, j, k);
+		break;
+	case 0x7dc:
+		success = handle_case_0x7dc(t, i, j, k);
+		break;
+	case 0x7ea:
+		success = handle_case_0x7ea(t, i, j, k);
+		break;
+	case 0x7ec:
+		success = handle_case_0x7ec(t, i, j, k);
+		break;
+	case 0x7f1:
+		success = handle_case_0x7f1(t, i, j, k);
+		break;
+	case 0x7f2:
+		success = handle_case_0x7f2(t, i, j, k);
+		break;
+	case 0x7f4:
+		success = handle_case_0x7f4(t, i, j, k);
+		break;
+	case 0x7f8:
+		success = handle_case_0x7f8(t, i, j, k);
+		break;
+	/*
+	 * Handle the cases where three existing edges meet at a corner.
+	 *
+	 */
+	case 0x717:
+		success = handle_case_0x717(t, i, j, k);
+		break;
+	case 0x72b:
+		success = handle_case_0x72b(t, i, j, k);
+		break;
+	case 0x74d:
+		success = handle_case_0x74d(t, i, j, k);
+		break;
+	case 0x771:
+		success = handle_case_0x771(t, i, j, k);
+		break;
+	case 0x78e:
+		success = handle_case_0x78e(t, i, j, k);
+		break;
+	case 0x7b2:
+		success = handle_case_0x7b2(t, i, j, k);
+		break;
+	case 0x7d4:
+		success = handle_case_0x7d4(t, i, j, k);
+		break;
+	case 0x7e8:
+		success = handle_case_0x7e8(t, i, j, k);
+		break;
+	/*
+	 * Handle the cases where four corners on a single face are missing.
+	 */
+	case 0x70f:
+		success = handle_case_0x70f(t, i, j, k);
+		break;
+	case 0x733:
+		success = handle_case_0x733(t, i, j, k);
+		break;
+	case 0x755:
+		success = handle_case_0x755(t, i, j, k);
+		break;
+	case 0x7aa:
+		success = handle_case_0x7aa(t, i, j, k);
+		break;
+	case 0x7cc:
+		success = handle_case_0x7cc(t, i, j, k);
+		break;
+	case 0x7f0:
+		success = handle_case_0x7f0(t, i, j, k);
+		break;
+	/*
+	 * Handle the cases where three corners on a single face are missing.
+	 */
+	case 0x707:
+		success = handle_case_0x707(t, i, j, k);
+		break;
+	case 0x70b:
+		success = handle_case_0x70b(t, i, j, k);
+		break;
+	case 0x70d:
+		success = handle_case_0x70d(t, i, j, k);
+		break;
+	case 0x70e:
+		success = handle_case_0x70e(t, i, j, k);
+		break;
+	case 0x713:
+		success = handle_case_0x713(t, i, j, k);
+		break;
+	case 0x715:
+		success = handle_case_0x715(t, i, j, k);
+		break;
+	case 0x723:
+		success = handle_case_0x723(t, i, j, k);
+		break;
+	case 0x72a:
+		success = handle_case_0x72a(t, i, j, k);
+		break;
+	case 0x731:
+		success = handle_case_0x731(t, i, j, k);
+		break;
+	case 0x732:
+		success = handle_case_0x732(t, i, j, k);
+		break;
+	case 0x745:
+		success = handle_case_0x745(t, i, j, k);
+		break;
+	case 0x74c:
+		success = handle_case_0x74c(t, i, j, k);
+		break;
+	case 0x751:
+		success = handle_case_0x751(t, i, j, k);
+		break;
+	case 0x754:
+		success = handle_case_0x754(t, i, j, k);
+		break;
+	case 0x770:
+		success = handle_case_0x770(t, i, j, k);
+		break;
+	case 0x78a:
+		success = handle_case_0x78a(t, i, j, k);
+		break;
+	case 0x78c:
+		success = handle_case_0x78c(t, i, j, k);
+		break;
+	case 0x7a2:
+		success = handle_case_0x7a2(t, i, j, k);
+		break;
+	case 0x7a8:
+		success = handle_case_0x7a8(t, i, j, k);
+		break;
+	case 0x7b0:
+		success = handle_case_0x7b0(t, i, j, k);
+		break;
+	case 0x7c4:
+		success = handle_case_0x7c4(t, i, j, k);
+		break;
+	case 0x7c8:
+		success = handle_case_0x7c8(t, i, j, k);
+		break;
+	case 0x7d0:
+		success = handle_case_0x7d0(t, i, j, k);
+		break;
+	case 0x7e0:
+		success = handle_case_0x7e0(t, i, j, k);
+		break;
+	/*
+	 * Handle the cases where two corners on a single edge are missing.
+	 */
+	case 0x703:
+		success = handle_case_0x703(t, i, j, k);
+		break;
+	case 0x705:
+		success = handle_case_0x705(t, i, j, k);
+		break;
+	case 0x70a:
+		success = handle_case_0x70a(t, i, j, k);
+		break;
+	case 0x70c:
+		success = handle_case_0x70c(t, i, j, k);
+		break;
+	case 0x711:
+		success = handle_case_0x711(t, i, j, k);
+		break;
+	case 0x722:
+		success = handle_case_0x722(t, i, j, k);
+		break;
+	case 0x730:
+		success = handle_case_0x730(t, i, j, k);
+		break;
+	case 0x744:
+		success = handle_case_0x744(t, i, j, k);
+		break;
+	case 0x750:
+		success = handle_case_0x750(t, i, j, k);
+		break;
+	case 0x788:
+		success = handle_case_0x788(t, i, j, k);
+		break;
+	case 0x7a0:
+		success = handle_case_0x7a0(t, i, j, k);
+		break;
+	case 0x7c0:
+		success = handle_case_0x7c0(t, i, j, k);
+		break;
+	/*
+	 * Handle the cases where a single corner is missing.
+	 */
+	case 0x701:
+		success = handle_case_0x701(t, i, j, k);
+		break;
+	case 0x702:
+		success = handle_case_0x702(t, i, j, k);
+		break;
+	case 0x704:
+		success = handle_case_0x704(t, i, j, k);
+		break;
+	case 0x708:
+		success = handle_case_0x708(t, i, j, k);
+		break;
+	case 0x710:
+		success = handle_case_0x710(t, i, j, k);
+		break;
+	case 0x720:
+		success = handle_case_0x720(t, i, j, k);
+		break;
+	case 0x740:
+		success = handle_case_0x740(t, i, j, k);
+		break;
+	case 0x780:
+		success = handle_case_0x780(t, i, j, k);
+		break;
+
+	default:
+		/*
+		 * There's lots of unhandled cases still, but it's not clear
+		 * we care.  Let debugging show us what they are so we can
+		 * learn if we care.
+		 */
+		if (t->debug)
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"Unhandled fingerprint 0x%03x @ %d %d %d\n",
+				fp, i, j, k);
+		goto out;
+	}
+	/*
+	 * If we successfully handled a case, we may be able to make more
+	 * progress at this position, so try again.  Otherwise, even though
+	 * we didn't successfully handle a case, we may have installed a
+	 * switch into the torus/mesh, so try to install links as well.
+	 * Then we'll have another go at the next position.
+	 */
+	if (success) {
+		if (t->debug)
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"Success on fingerprint 0x%03x @ %d %d %d\n",
+				fp, i, j, k);
+		goto again;
+	} else {
+		check_tlinks(t, i, j, k);
+		if (t->debug)
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"Failed on fingerprint 0x%03x @ %d %d %d\n",
+				fp, i, j, k);
+	}
+out:
+	return;
+}
+
+#define LINK_ERR_STR " direction link required!\n"
+#define SEED_ERR_STR " direction links with different seed switches!\n"
+
+static
+bool verify_setup(struct torus *t, struct fabric *f)
+{
+	struct coord_dirs *o;
+	struct f_switch *sw;
+	unsigned p, s, n = 0;
+	bool success = false;
+	bool all_sw_present, need_seed = true;
+
+	if (!(t->x_sz && t->y_sz && t->z_sz)) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E20: missing required torus size specification!\n");
+		goto out;
+	}
+	if (t->osm->subn.min_data_vls < 2)
+		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
+			"Warning: Too few data VLs to support torus routing "
+			"without credit loops (have %d need 2)\n",
+			(int)t->osm->subn.min_data_vls);
+	if (t->osm->subn.min_data_vls < 4)
+		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
+			"Warning: Too few data VLs to support torus routing "
+			"with a failed switch without credit loops"
+			"(have %d need 4)\n",
+			(int)t->osm->subn.min_data_vls);
+	if (t->osm->subn.min_data_vls < 8)
+		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
+			"Warning: Too few data VLs to support torus routing "
+			"with two QoS levels (have %d need 8)\n",
+			(int)t->osm->subn.min_data_vls);
+	/*
+	 * Be sure all the switches in the torus support the port
+	 * ordering that might have been configured.
+	 */
+	for (s = 0; s < f->switch_cnt; s++) {
+		sw = f->sw[s];
+		for (p = 0; p < sw->port_cnt; p++) {
+			if (t->port_order[p] >= sw->port_cnt) {
+				OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+					"ERR 4E21: port_order configured using "
+					"port %u, but only %u ports in "
+					"switch w/ GUID 0x%04"PRIx64"\n",
+					t->port_order[p], sw->port_cnt - 1,
+					cl_ntoh64(sw->n_id));
+				goto out;
+			}
+		}
+	}
+	/*
+	 * Unfortunately, there is a problem with non-unique topology for any
+	 * torus dimension which has radix four.  This problem requires extra
+	 * input, in the form of specifying both the positive and negative
+	 * coordinate directions from a common switch, for any torus dimension
+	 * with radix four (see also build_torus()).
+	 *
+	 * Do the checking required to ensure that the required information
+	 * is present, but more than the needed information is not required.
+	 *
+	 * So, verify that we learned the coordinate directions correctly for
+	 * the fabric.  The coordinate direction links get an invalid port
+	 * set on their ends when parsed.
+	 */
+again:
+	all_sw_present = true;
+	o = &t->seed[n];
+
+	if (t->x_sz == 4 && !(t->flags & X_MESH)) {
+		if (o->xp_link.end[0].port >= 0) {
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"ERR 4E22: Positive x" LINK_ERR_STR);
+			goto out;
+		}
+		if (o->xm_link.end[0].port >= 0) {
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"ERR 4E23: Negative x" LINK_ERR_STR);
+			goto out;
+		}
+		if (o->xp_link.end[0].n_id != o->xm_link.end[0].n_id) {
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"ERR 4E24: Positive/negative x" SEED_ERR_STR);
+			goto out;
+		}
+	}
+	if (t->y_sz == 4 && !(t->flags & Y_MESH)) {
+		if (o->yp_link.end[0].port >= 0) {
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"ERR 4E25: Positive y" LINK_ERR_STR);
+			goto out;
+		}
+		if (o->ym_link.end[0].port >= 0) {
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"ERR 4E26: Negative y" LINK_ERR_STR);
+			goto out;
+		}
+		if (o->yp_link.end[0].n_id != o->ym_link.end[0].n_id) {
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"ERR 4E27: Positive/negative y" SEED_ERR_STR);
+			goto out;
+		}
+	}
+	if (t->z_sz == 4 && !(t->flags & Z_MESH)) {
+		if (o->zp_link.end[0].port >= 0) {
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"ERR 4E28: Positive z" LINK_ERR_STR);
+			goto out;
+		}
+		if (o->zm_link.end[0].port >= 0) {
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"ERR 4E29: Negative z" LINK_ERR_STR);
+			goto out;
+		}
+		if (o->zp_link.end[0].n_id != o->zm_link.end[0].n_id) {
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"ERR 4E2A: Positive/negative z" SEED_ERR_STR);
+			goto out;
+		}
+	}
+	if (t->x_sz > 1) {
+		if (o->xp_link.end[0].port >= 0 &&
+		    o->xm_link.end[0].port >= 0) {
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"ERR 4E2B: Positive or negative x" LINK_ERR_STR);
+			goto out;
+		}
+		if (o->xp_link.end[0].port < 0 &&
+		    !find_f_sw(f, o->xp_link.end[0].n_id))
+			all_sw_present = false;
+
+		if (o->xp_link.end[1].port < 0 &&
+		    !find_f_sw(f, o->xp_link.end[1].n_id))
+			all_sw_present = false;
+
+		if (o->xm_link.end[0].port < 0 &&
+		    !find_f_sw(f, o->xm_link.end[0].n_id))
+			all_sw_present = false;
+
+		if (o->xm_link.end[1].port < 0 &&
+		    !find_f_sw(f, o->xm_link.end[1].n_id))
+			all_sw_present = false;
+	}
+	if (t->z_sz > 1) {
+		if (o->zp_link.end[0].port >= 0 &&
+		    o->zm_link.end[0].port >= 0) {
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"ERR 4E2C: Positive or negative z" LINK_ERR_STR);
+			goto out;
+		}
+		if ((o->xp_link.end[0].port < 0 &&
+		     o->zp_link.end[0].port < 0 &&
+		     o->zp_link.end[0].n_id != o->xp_link.end[0].n_id) ||
+
+		    (o->xp_link.end[0].port < 0 &&
+		     o->zm_link.end[0].port < 0 &&
+		     o->zm_link.end[0].n_id != o->xp_link.end[0].n_id) ||
+
+		    (o->xm_link.end[0].port < 0 &&
+		     o->zp_link.end[0].port < 0 &&
+		     o->zp_link.end[0].n_id != o->xm_link.end[0].n_id) ||
+
+		    (o->xm_link.end[0].port < 0 &&
+		     o->zm_link.end[0].port < 0 &&
+		     o->zm_link.end[0].n_id != o->xm_link.end[0].n_id)) {
+
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"ERR 4E2D: x and z" SEED_ERR_STR);
+			goto out;
+		}
+		if (o->zp_link.end[0].port < 0 &&
+		    !find_f_sw(f, o->zp_link.end[0].n_id))
+			all_sw_present = false;
+
+		if (o->zp_link.end[1].port < 0 &&
+		    !find_f_sw(f, o->zp_link.end[1].n_id))
+			all_sw_present = false;
+
+		if (o->zm_link.end[0].port < 0 &&
+		    !find_f_sw(f, o->zm_link.end[0].n_id))
+			all_sw_present = false;
+
+		if (o->zm_link.end[1].port < 0 &&
+		    !find_f_sw(f, o->zm_link.end[1].n_id))
+			all_sw_present = false;
+	}
+	if (t->y_sz > 1) {
+		if (o->yp_link.end[0].port >= 0 &&
+		    o->ym_link.end[0].port >= 0) {
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"ERR 4E2E: Positive or negative y" LINK_ERR_STR);
+			goto out;
+		}
+		if ((o->xp_link.end[0].port < 0 &&
+		     o->yp_link.end[0].port < 0 &&
+		     o->yp_link.end[0].n_id != o->xp_link.end[0].n_id) ||
+
+		    (o->xp_link.end[0].port < 0 &&
+		     o->ym_link.end[0].port < 0 &&
+		     o->ym_link.end[0].n_id != o->xp_link.end[0].n_id) ||
+
+		    (o->xm_link.end[0].port < 0 &&
+		     o->yp_link.end[0].port < 0 &&
+		     o->yp_link.end[0].n_id != o->xm_link.end[0].n_id) ||
+
+		    (o->xm_link.end[0].port < 0 &&
+		     o->ym_link.end[0].port < 0 &&
+		     o->ym_link.end[0].n_id != o->xm_link.end[0].n_id)) {
+
+			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+				"ERR 4E2F: x and y" SEED_ERR_STR);
+			goto out;
+		}
+		if (o->yp_link.end[0].port < 0 &&
+		    !find_f_sw(f, o->yp_link.end[0].n_id))
+			all_sw_present = false;
+
+		if (o->yp_link.end[1].port < 0 &&
+		    !find_f_sw(f, o->yp_link.end[1].n_id))
+			all_sw_present = false;
+
+		if (o->ym_link.end[0].port < 0 &&
+		    !find_f_sw(f, o->ym_link.end[0].n_id))
+			all_sw_present = false;
+
+		if (o->ym_link.end[1].port < 0 &&
+		    !find_f_sw(f, o->ym_link.end[1].n_id))
+			all_sw_present = false;
+	}
+	if (all_sw_present && need_seed) {
+		t->seed_idx = n;
+		need_seed = false;
+	}
+	if (++n < t->seed_cnt)
+		goto again;
+
+	if (need_seed)
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E30: Every configured torus seed has at "
+			"least one switch missing in fabric!\n");
+	else
+		success = true;
+out:
+	return success;
+}
+
+static
+void build_torus(struct fabric *f, struct torus *t)
+{
+	int i, j, k;
+	int im1, jm1, km1;
+	int ip1, jp1, kp1;
+	unsigned nlink;
+	struct coord_dirs *o;
+	struct f_switch *fsw0, *fsw1;
+	struct t_switch ****sw = t->sw;
+	bool success = true;
+
+	t->link_pool_sz = f->link_cnt;
+	t->link_pool = calloc(1, t->link_pool_sz * sizeof(*t->link_pool));
+	if (!t->link_pool) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E31: Allocating torus link pool: %s\n",
+			strerror(errno));
+		goto out;
+	}
+	t->fabric = f;
+
+	/*
+	 * Get things started by locating the up to seven switches that
+	 * define the torus "seed", coordinate directions, and datelines.
+	 */
+	o = &t->seed[t->seed_idx];
+
+	i = canonicalize(-o->x_dateline, t->x_sz);
+	j = canonicalize(-o->y_dateline, t->y_sz);
+	k = canonicalize(-o->z_dateline, t->z_sz);
+
+	if (o->xp_link.end[0].port < 0) {
+		ip1 = canonicalize(1 - o->x_dateline, t->x_sz);
+		fsw0 = find_f_sw(f, o->xp_link.end[0].n_id);
+		fsw1 = find_f_sw(f, o->xp_link.end[1].n_id);
+		success =
+			install_tswitch(t, i, j, k, fsw0) &&
+			install_tswitch(t, ip1, j, k, fsw1) && success;
+	}
+	if (o->xm_link.end[0].port < 0) {
+		im1 = canonicalize(-1 - o->x_dateline, t->x_sz);
+		fsw0 = find_f_sw(f, o->xm_link.end[0].n_id);
+		fsw1 = find_f_sw(f, o->xm_link.end[1].n_id);
+		success =
+			install_tswitch(t, i, j, k, fsw0) &&
+			install_tswitch(t, im1, j, k, fsw1) && success;
+	}
+	if (o->yp_link.end[0].port < 0) {
+		jp1 = canonicalize(1 - o->y_dateline, t->y_sz);
+		fsw0 = find_f_sw(f, o->yp_link.end[0].n_id);
+		fsw1 = find_f_sw(f, o->yp_link.end[1].n_id);
+		success =
+			install_tswitch(t, i, j, k, fsw0) &&
+			install_tswitch(t, i, jp1, k, fsw1) && success;
+	}
+	if (o->ym_link.end[0].port < 0) {
+		jm1 = canonicalize(-1 - o->y_dateline, t->y_sz);
+		fsw0 = find_f_sw(f, o->ym_link.end[0].n_id);
+		fsw1 = find_f_sw(f, o->ym_link.end[1].n_id);
+		success =
+			install_tswitch(t, i, j, k, fsw0) &&
+			install_tswitch(t, i, jm1, k, fsw1) && success;
+	}
+	if (o->zp_link.end[0].port < 0) {
+		kp1 = canonicalize(1 - o->z_dateline, t->z_sz);
+		fsw0 = find_f_sw(f, o->zp_link.end[0].n_id);
+		fsw1 = find_f_sw(f, o->zp_link.end[1].n_id);
+		success =
+			install_tswitch(t, i, j, k, fsw0) &&
+			install_tswitch(t, i, j, kp1, fsw1) && success;
+	}
+	if (o->zm_link.end[0].port < 0) {
+		km1 = canonicalize(-1 - o->z_dateline, t->z_sz);
+		fsw0 = find_f_sw(f, o->zm_link.end[0].n_id);
+		fsw1 = find_f_sw(f, o->zm_link.end[1].n_id);
+		success =
+			install_tswitch(t, i, j, k, fsw0) &&
+			install_tswitch(t, i, j, km1, fsw1) && success;
+	}
+	if (!success)
+		goto out;
+
+	if (!t->seed_idx)
+		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
+			"Using torus seed configured as default "
+			"(seed sw %d,%d,%d GUID 0x%04"PRIx64").\n",
+			i, j, k, cl_ntoh64(sw[i][j][k]->n_id));
+	else
+		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
+			"Using torus seed configured as backup #%u "
+			"(seed sw %d,%d,%d GUID 0x%04"PRIx64").\n",
+			t->seed_idx, i, j, k, cl_ntoh64(sw[i][j][k]->n_id));
+
+	/*
+	 * Search the fabric and construct the expected torus topology.
+	 *
+	 * The algorithm is to consider the "cube" formed by eight switch
+	 * locations bounded by the corners i, j, k and i+1, j+1, k+1.
+	 * For each such cube look at the topology of the switches already
+	 * placed in the torus, and deduce which new switches can be placed
+	 * into their proper locations in the torus.  Examine each cube
+	 * multiple times, until the number of links moved into the torus
+	 * topology does not change.
+	 */
+again:
+	nlink = t->link_cnt;
+
+	for (k = 0; k < (int)t->z_sz; k++)
+		for (j = 0; j < (int)t->y_sz; j++)
+			for (i = 0; i < (int)t->x_sz; i++)
+				locate_sw(t, i, j, k);
+
+	if (t->link_cnt != nlink)
+		goto again;
+
+	/*
+	 * Move all other endpoints into torus/mesh.
+	 */
+	for (k = 0; k < (int)t->z_sz; k++)
+		for (j = 0; j < (int)t->y_sz; j++)
+			for (i = 0; i < (int)t->x_sz; i++)
+				link_srcsink(t, i, j, k);
+out:
+	return;
+}
+
+/*
+ * Returns a count of differences between old and new switches.
+ */
+static
+unsigned tsw_changes(struct t_switch *nsw, struct t_switch *osw)
+{
+	unsigned p, cnt = 0, port_cnt;
+	struct endpoint *npt, *opt;
+	struct endpoint *rnpt, *ropt;
+
+	if (nsw && !osw) {
+		cnt++;
+		OSM_LOG(&nsw->torus->osm->log, OSM_LOG_INFO,
+			"New torus switch %d,%d,%d GUID 0x%04"PRIx64"\n",
+			nsw->i, nsw->j, nsw->k, cl_ntoh64(nsw->n_id));
+		goto out;
+	}
+	if (osw && !nsw) {
+		cnt++;
+		OSM_LOG(&osw->torus->osm->log, OSM_LOG_INFO,
+			"Lost torus switch %d,%d,%d GUID 0x%04"PRIx64"\n",
+			osw->i, osw->j, osw->k, cl_ntoh64(osw->n_id));
+		goto out;
+	}
+	if (!(nsw && osw))
+		goto out;
+
+	if (nsw->n_id != osw->n_id) {
+		cnt++;
+		OSM_LOG(&nsw->torus->osm->log, OSM_LOG_INFO,
+			"Torus switch %d,%d,%d GUID "
+			"was 0x%04"PRIx64", now 0x%04"PRIx64"\n",
+			nsw->i, nsw->j, nsw->k,
+			cl_ntoh64(osw->n_id), cl_ntoh64(nsw->n_id));
+	}
+
+	if (nsw->port_cnt != osw->port_cnt) {
+		cnt++;
+		OSM_LOG(&nsw->torus->osm->log, OSM_LOG_INFO,
+			"Torus switch %d,%d,%d GUID 0x%04"PRIx64" "
+			"had %d ports, now has %d\n",
+			nsw->i, nsw->j, nsw->k, cl_ntoh64(nsw->n_id),
+			osw->port_cnt, nsw->port_cnt);
+	}
+	port_cnt = nsw->port_cnt;
+	if (port_cnt > osw->port_cnt)
+		port_cnt = osw->port_cnt;
+
+	for (p = 0; p < port_cnt; p++) {
+		npt = nsw->port[p];
+		opt = osw->port[p];
+
+		if (npt && npt->link) {
+			if (&npt->link->end[0] == npt)
+				rnpt = &npt->link->end[1];
+			else
+				rnpt = &npt->link->end[0];
+		} else
+			rnpt = NULL;
+
+		if (opt && opt->link) {
+			if (&opt->link->end[0] == opt)
+				ropt = &opt->link->end[1];
+			else
+				ropt = &opt->link->end[0];
+		} else
+			ropt = NULL;
+
+		if (rnpt && !ropt) {
+			++cnt;
+			OSM_LOG(&nsw->torus->osm->log, OSM_LOG_INFO,
+				"Torus switch %d,%d,%d GUID 0x%04"PRIx64"[%d] "
+				"remote now %s GUID 0x%04"PRIx64"[%d], "
+				"was missing\n",
+				nsw->i, nsw->j, nsw->k, cl_ntoh64(nsw->n_id),
+				p, rnpt->type == PASSTHRU ? "sw" : "node",
+				cl_ntoh64(rnpt->n_id), rnpt->port);
+			continue;
+		}
+		if (ropt && !rnpt) {
+			++cnt;
+			OSM_LOG(&nsw->torus->osm->log, OSM_LOG_INFO,
+				"Torus switch %d,%d,%d GUID 0x%04"PRIx64"[%d] "
+				"remote now missing, "
+				"was %s GUID 0x%04"PRIx64"[%d]\n",
+				osw->i, osw->j, osw->k, cl_ntoh64(nsw->n_id),
+				p, ropt->type == PASSTHRU ? "sw" : "node",
+				cl_ntoh64(ropt->n_id), ropt->port);
+			continue;
+		}
+		if (!(rnpt && ropt))
+			continue;
+
+		if (rnpt->n_id != ropt->n_id) {
+			++cnt;
+			OSM_LOG(&nsw->torus->osm->log, OSM_LOG_INFO,
+				"Torus switch %d,%d,%d GUID 0x%04"PRIx64"[%d] "
+				"remote now %s GUID 0x%04"PRIx64"[%d], "
+				"was %s GUID 0x%04"PRIx64"[%d]\n",
+				nsw->i, nsw->j, nsw->k, cl_ntoh64(nsw->n_id),
+				p, rnpt->type == PASSTHRU ? "sw" : "node",
+				cl_ntoh64(rnpt->n_id), rnpt->port,
+				ropt->type == PASSTHRU ? "sw" : "node",
+				cl_ntoh64(ropt->n_id), ropt->port);
+			continue;
+		}
+	}
+out:
+	return cnt;
+}
+
+static
+void report_torus_changes(struct torus *nt, struct torus *ot)
+{
+	unsigned cnt = 0;
+	unsigned i, j, k;
+	unsigned x_sz = nt->x_sz;
+	unsigned y_sz = nt->y_sz;
+	unsigned z_sz = nt->z_sz;
+
+	if (!(nt && ot))
+		return;
+
+	if (x_sz != ot->x_sz) {
+		cnt++;
+		OSM_LOG(&nt->osm->log, OSM_LOG_INFO,
+			"Torus x radix was %d now %d\n",
+			ot->x_sz, nt->x_sz);
+		if (x_sz > ot->x_sz)
+			x_sz = ot->x_sz;
+	}
+	if (y_sz != ot->y_sz) {
+		cnt++;
+		OSM_LOG(&nt->osm->log, OSM_LOG_INFO,
+			"Torus y radix was %d now %d\n",
+			ot->y_sz, nt->y_sz);
+		if (y_sz > ot->y_sz)
+			y_sz = ot->y_sz;
+	}
+	if (z_sz != ot->z_sz) {
+		cnt++;
+		OSM_LOG(&nt->osm->log, OSM_LOG_INFO,
+			"Torus z radix was %d now %d\n",
+			ot->z_sz, nt->z_sz);
+		if (z_sz > ot->z_sz)
+			z_sz = ot->z_sz;
+	}
+
+	for (k = 0; k < z_sz; k++)
+		for (j = 0; j < y_sz; j++)
+			for (i = 0; i < x_sz; i++) {
+				cnt += tsw_changes(nt->sw[i][j][k],
+						   ot->sw[i][j][k]);
+				/*
+				 * Booting a big fabric will cause lots of
+				 * changes as hosts come up, so don't spew.
+				 * We want to log changes to learn more about
+				 * bouncing links, etc, so they can be fixed.
+				 */
+				if (cnt > 32) {
+					OSM_LOG(&nt->osm->log, OSM_LOG_INFO,
+						"Too many torus changes; "
+						"stopping reporting early\n");
+					return;
+				}
+			}
+}
+
+static
+void rpt_torus_missing(struct torus *t, int i, int j, int k,
+		       struct t_switch *sw, int *missing_z)
+{
+	uint64_t guid_ho;
+
+	if (!sw) {
+		/*
+		 * We can have multiple missing switches without deadlock
+		 * if and only if they are adajacent in the Z direction.
+		 */
+		if ((t->switch_cnt + 1) < t->sw_pool_sz) {
+			if (t->sw[i][j][canonicalize(k - 1, t->z_sz)] &&
+			    t->sw[i][j][canonicalize(k + 1, t->z_sz)])
+				t->flags |= MSG_DEADLOCK;
+		}
+		/*
+		 * There can be only one such Z-column of missing switches.
+		 */
+		if (*missing_z < 0)
+			*missing_z = i + j * t->x_sz;
+		else if (*missing_z != i + j * t->x_sz)
+			t->flags |= MSG_DEADLOCK;
+
+		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
+			"Missing torus switch at %d,%d,%d\n", i, j, k);
+		return;
+	}
+	guid_ho = cl_ntoh64(sw->n_id);
+
+	if (!(sw->ptgrp[0].port_cnt || (t->x_sz == 1) ||
+	      ((t->flags & X_MESH) && i == 0)))
+		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
+			"Missing torus -x link on "
+			"switch %d,%d,%d GUID 0x%04"PRIx64"\n",
+			i, j, k, guid_ho);
+	if (!(sw->ptgrp[1].port_cnt || (t->x_sz == 1) ||
+	      ((t->flags & X_MESH) && (i + 1) == t->x_sz)))
+		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
+			"Missing torus +x link on "
+			"switch %d,%d,%d GUID 0x%04"PRIx64"\n",
+			i, j, k, guid_ho);
+	if (!(sw->ptgrp[2].port_cnt || (t->y_sz == 1) ||
+	      ((t->flags & Y_MESH) && j == 0)))
+		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
+			"Missing torus -y link on "
+			"switch %d,%d,%d GUID 0x%04"PRIx64"\n",
+			i, j, k, guid_ho);
+	if (!(sw->ptgrp[3].port_cnt || (t->y_sz == 1) ||
+	      ((t->flags & Y_MESH) && (j + 1) == t->y_sz)))
+		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
+			"Missing torus +y link on "
+			"switch %d,%d,%d GUID 0x%04"PRIx64"\n",
+			i, j, k, guid_ho);
+	if (!(sw->ptgrp[4].port_cnt || (t->z_sz == 1) ||
+	      ((t->flags & Z_MESH) && k == 0)))
+		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
+			"Missing torus -z link on "
+			"switch %d,%d,%d GUID 0x%04"PRIx64"\n",
+			i, j, k, guid_ho);
+	if (!(sw->ptgrp[5].port_cnt || (t->z_sz == 1) ||
+	      ((t->flags & Z_MESH) && (k + 1) == t->z_sz)))
+		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
+			"Missing torus +z link on "
+			"switch %d,%d,%d GUID 0x%04"PRIx64"\n",
+			i, j, k, guid_ho);
+}
+
+/*
+ * Returns true if the torus can be successfully routed, false otherwise.
+ */
+static
+bool routable_torus(struct torus *t, struct fabric *f)
+{
+	int i, j, k, tmp = -1;
+	unsigned b2g_cnt, g2b_cnt;
+	bool success = true;
+
+	t->flags &= ~MSG_DEADLOCK;
+
+	if (t->link_cnt != f->link_cnt || t->switch_cnt != f->switch_cnt)
+		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
+			"Warning: Could not construct torus using all "
+			"known fabric switches and/or links.\n");
+
+	for (k = 0; k < (int)t->z_sz; k++)
+		for (j = 0; j < (int)t->y_sz; j++)
+			for (i = 0; i < (int)t->x_sz; i++)
+				rpt_torus_missing(t, i, j, k,
+						  t->sw[i][j][k], &tmp);
+	/*
+	 * Check for multiple failures that create disjoint regions on a ring.
+	 */
+	for (k = 0; k < (int)t->z_sz; k++)
+		for (j = 0; j < (int)t->y_sz; j++) {
+			b2g_cnt = 0;
+			g2b_cnt = 0;
+			for (i = 0; i < (int)t->x_sz; i++) {
+
+				if (!t->sw[i][j][k])
+					continue;
+
+				if (!t->sw[i][j][k]->ptgrp[0].port_cnt)
+					b2g_cnt++;
+				if (!t->sw[i][j][k]->ptgrp[1].port_cnt)
+					g2b_cnt++;
+			}
+			if (b2g_cnt != g2b_cnt) {
+				OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+					"ERR 4E32: strange failures in "
+					"x ring at y=%d  z=%d"
+					" b2g_cnt %u g2b_cnt %u\n",
+					j, k, b2g_cnt, g2b_cnt);
+				success = false;
+			}
+			if (b2g_cnt > 1) {
+				OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+					"ERR 4E33: disjoint failures in "
+					"x ring at y=%d  z=%d\n", j, k);
+				success = false;
+			}
+		}
+
+	for (i = 0; i < (int)t->x_sz; i++)
+		for (k = 0; k < (int)t->z_sz; k++) {
+			b2g_cnt = 0;
+			g2b_cnt = 0;
+			for (j = 0; j < (int)t->y_sz; j++) {
+
+				if (!t->sw[i][j][k])
+					continue;
+
+				if (!t->sw[i][j][k]->ptgrp[2].port_cnt)
+					b2g_cnt++;
+				if (!t->sw[i][j][k]->ptgrp[3].port_cnt)
+					g2b_cnt++;
+			}
+			if (b2g_cnt != g2b_cnt) {
+				OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+					"ERR 4E34: strange failures in "
+					"y ring at x=%d  z=%d"
+					" b2g_cnt %u g2b_cnt %u\n",
+					i, k, b2g_cnt, g2b_cnt);
+				success = false;
+			}
+			if (b2g_cnt > 1) {
+				OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+					"ERR 4E35: disjoint failures in "
+					"y ring at x=%d  z=%d\n", i, k);
+				success = false;
+			}
+		}
+
+	for (j = 0; j < (int)t->y_sz; j++)
+		for (i = 0; i < (int)t->x_sz; i++) {
+			b2g_cnt = 0;
+			g2b_cnt = 0;
+			for (k = 0; k < (int)t->z_sz; k++) {
+
+				if (!t->sw[i][j][k])
+					continue;
+
+				if (!t->sw[i][j][k]->ptgrp[4].port_cnt)
+					b2g_cnt++;
+				if (!t->sw[i][j][k]->ptgrp[5].port_cnt)
+					g2b_cnt++;
+			}
+			if (b2g_cnt != g2b_cnt) {
+				OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+					"ERR 4E36: strange failures in "
+					"z ring at x=%d  y=%d"
+					" b2g_cnt %u g2b_cnt %u\n",
+					i, j, b2g_cnt, g2b_cnt);
+				success = false;
+			}
+			if (b2g_cnt > 1) {
+				OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+					"ERR 4E37: disjoint failures in "
+					"z ring at x=%d  y=%d\n", i, j);
+				success = false;
+			}
+		}
+
+	if (t->flags & MSG_DEADLOCK) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E38: missing switch topology "
+			"==> message deadlock!\n");
+		success = false;
+	}
+	return success;
+}
+
+/*
+ * Use this function to re-establish the pointers between a torus endpoint
+ * and an opensm osm_port_t.
+ *
+ * Typically this is only needed when "opensm --ucast-cache" is used, and
+ * a CA link bounces.  When the CA port goes away, the osm_port_t object
+ * is destroyed, invalidating the endpoint osm_port_t pointer.  When the
+ * link comes back, a new osm_port_t object is created with a NULL priv
+ * member.  Thus, when osm_get_torus_sl() is called it is missing the data
+ * needed to do its work.  Use this function to fix things up.
+ */
+static
+struct endpoint *osm_port_relink_endpoint(const osm_port_t *osm_port)
+{
+	guid_t node_guid;
+	uint8_t port_num, r_port_num;
+	struct t_switch *sw;
+	struct endpoint *ep = NULL;
+	osm_switch_t *osm_sw;
+	osm_physp_t *osm_physp;
+	osm_node_t *osm_node, *r_osm_node;
+
+	/*
+	 * We need to find the torus endpoint that has the same GUID as
+	 * the osm_port.  Rather than search the entire set of endpoints,
+	 * we'll try to follow pointers.
+	 */
+	osm_physp = osm_port->p_physp;
+	osm_node = osm_port->p_node;
+	port_num = osm_physp_get_port_num(osm_physp);
+	node_guid = osm_node_get_node_guid(osm_node);
+	/*
+	 * Switch management port?
+	 */
+	if (port_num == 0 &&
+	    osm_node_get_type(osm_node) == IB_NODE_TYPE_SWITCH) {
+
+		osm_sw = osm_node->sw;
+		if (osm_sw && osm_sw->priv) {
+			sw = osm_sw->priv;
+			if (sw->osm_switch == osm_sw &&
+			    sw->port[0]->n_id == node_guid) {
+
+				ep = sw->port[0];
+				goto relink_priv;
+			}
+		}
+	}
+	/*
+	 * CA port?  Try other end of link.  This should also catch a
+	 * router port if it is connected to a switch.
+	 */
+	r_osm_node = osm_node_get_remote_node(osm_node, port_num, &r_port_num);
+	if (!r_osm_node)
+		goto out;
+
+	osm_sw = r_osm_node->sw;
+	if (!osm_sw)
+		goto out;
+
+	sw = osm_sw->priv;
+	if (!(sw && sw->osm_switch == osm_sw))
+		goto out;
+
+	ep = sw->port[r_port_num];
+	if (!(ep && ep->link))
+		goto out;
+
+	if (ep->link->end[0].n_id == node_guid) {
+		ep = &ep->link->end[0];
+		goto relink_priv;
+	}
+	if (ep->link->end[1].n_id == node_guid) {
+		ep = &ep->link->end[1];
+		goto relink_priv;
+	}
+	ep = NULL;
+	goto out;
+
+relink_priv:
+	/* FIXME:
+	 * Unfortunately, we need to cast away const to rebuild the links
+	 * between the torus endpoint and the osm_port_t.
+	 *
+	 * What is really needed is to check whether pr_rcv_get_path_parms()
+	 * needs its port objects to be const.  If so, why, and whether
+	 * anything can be done about it.
+	 */
+	((osm_port_t *)osm_port)->priv = ep;
+	ep->osm_port = (osm_port_t *)osm_port;
+out:
+	return ep;
+}
+
+/*
+ * Computing LFT entries and path SL values:
+ *
+ * For a pristine torus, we compute LFT entries using XYZ DOR, and select
+ * which direction to route on a ring (i.e., the 1-D torus for the coordinate
+ * in question) based on shortest path.  We compute the SL to use for the
+ * path based on whether we crossed a dateline (where a ring coordinate
+ * wraps to zero) for each coordinate.
+ *
+ * When there is a link/switch failure, we want to compute LFT entries
+ * to route around the failure, without changing the path SL.  I.e., we
+ * want the SL to reach a given destination from a given source to be
+ * independent of the presence or number of failed components in the fabric.
+ *
+ * In order to make this feasible, we will assume that no ring is broken
+ * into disjoint pieces by multiple failures
+ *
+ * We handle failure by attempting to take the long way around any ring
+ * with connectivity interrupted by failed components, unless the path
+ * requires a turn on a failed switch.
+ *
+ * For paths that require a turn on a failed switch, we head towards the
+ * failed switch, then turn when progress is blocked by a failure, using a
+ * turn allowed under XYZ DOR.  However, such a path will also require a turn
+ * that is not a legal XYZ DOR turn, so we construct the SL2VL mapping tables
+ * such that XYZ DOR turns use one set of VLs and ZYX DOR turns use a
+ * separate set of VLs.
+ *
+ * Under these rules the algorithm guarantees credit-loop-free routing for a
+ * single failed switch, without any change in path SL values.  We can also
+ * guarantee credit-loop-free routing for failures of multiple switches, if
+ * they are adjacent in the last DOR direction.  Since we use XYZ-DOR,
+ * that means failed switches at i,j,k and i,j,k+1 will not cause credit
+ * loops.
+ *
+ * These failure routing rules are intended to prevent paths that cross any
+ * coordinate dateline twice (over and back), so we don't need to worry about
+ * any ambiguity over which SL to use for such a case.  Also, we cannot have
+ * a ring deadlock when a ring is broken by failure and we route the long
+ * way around, so we don't need to worry about the impact of such routing
+ * on SL choice.
+ */
+
+/*
+ * Functions to set our SL bit encoding for routing/QoS info.  Combine the
+ * resuts of these functions with bitwise or to get final SL.
+ *
+ * SL bits 0-2 encode whether we "looped" in a given direction
+ * on the torus on the path from source to destination.
+ *
+ * SL bit 3 encodes the QoS level.  We only support two QoS levels.
+ *
+ * Below we assume TORUS_MAX_DIM == 3 and 0 <= coord_dir < TORUS_MAX_DIM.
+ */
+static inline
+unsigned sl_set_use_loop_vl(bool use_loop_vl, unsigned coord_dir)
+{
+	return (coord_dir < TORUS_MAX_DIM)
+		? ((unsigned)use_loop_vl << coord_dir) : 0;
+}
+
+static inline
+unsigned sl_set_qos(unsigned qos)
+{
+	return (unsigned)(!!qos) << TORUS_MAX_DIM;
+}
+
+/*
+ * Functions to crack our SL bit encoding for routing/QoS info.
+ */
+static inline
+bool sl_get_use_loop_vl(unsigned sl, unsigned coord_dir)
+{
+	return (coord_dir < TORUS_MAX_DIM)
+		? (sl >> coord_dir) & 0x1 : false;
+}
+
+static inline
+unsigned sl_get_qos(unsigned sl)
+{
+	return (sl >> TORUS_MAX_DIM) & 0x1;
+}
+
+/*
+ * Functions to encode routing/QoS info into VL bits.  Combine the resuts of
+ * these functions with bitwise or to get final VL.
+ *
+ * VL bit 0 encodes whether we need to leave on the "loop" VL.
+ *
+ * VL bit 1 encodes whether turn is XYZ DOR or ZYX DOR. A 3d mesh/torus
+ * has 6 turn types: x-y, y-z, x-z, y-x, z-y, z-x.  The first three are
+ * legal XYZ DOR turns, and the second three are legal ZYX DOR turns.
+ * Straight-through (x-x, y-y, z-z) paths are legal in both DOR variants,
+ * so we'll assign them to XYZ DOR VLs.
+ *
+ * Note that delivery to switch-local ports (i.e. those that source/sink
+ * traffic, rather than forwarding it) cannot cause a deadlock, so that
+ * can also use either XYZ or ZYX DOR.
+ *
+ * VL bit 2 encodes QoS level.
+ *
+ * Note that if VL bit encodings are changed here, the available fabric VL
+ * verification in verify_setup() needs to be updated as well.
+ */
+static inline
+unsigned vl_set_loop_vl(bool use_loop_vl)
+{
+	return use_loop_vl;
+}
+
+static inline
+unsigned vl_set_qos_vl(unsigned qos)
+{
+	return (qos & 0x1) << 2;
+}
+
+static inline
+unsigned vl_set_turn_vl(unsigned in_coord_dir, unsigned out_coord_dir)
+{
+	unsigned vl = 0;
+
+	if (in_coord_dir != TORUS_MAX_DIM &&
+	    out_coord_dir != TORUS_MAX_DIM)
+		vl = (in_coord_dir > out_coord_dir)
+			? 0x1 << 1 : 0;
+
+	return vl;
+}
+
+static
+unsigned sl2vl_entry(struct torus *t, struct t_switch *sw,
+		     int input_pt, int output_pt, unsigned sl)
+{
+	unsigned id, od, vl, data_vls;
+
+	if (sw && sw->port[input_pt])
+		id = sw->port[input_pt]->pgrp->port_grp / 2;
+	else
+		id = TORUS_MAX_DIM;
+
+	if (sw && sw->port[output_pt])
+		od = sw->port[output_pt]->pgrp->port_grp / 2;
+	else
+		od = TORUS_MAX_DIM;
+
+	data_vls = t->osm->subn.min_data_vls;
+	vl = 0;
+
+	if (data_vls >= 2)
+		vl |= vl_set_loop_vl(sl_get_use_loop_vl(sl, od));
+	if (data_vls >= 4)
+		vl |= vl_set_turn_vl(id, od);
+	if (data_vls >= 8)
+		vl |= vl_set_qos_vl(sl_get_qos(sl));
+
+	return vl;
+}
+
+static
+void torus_update_osm_sl2vl(void *context, osm_physp_t *osm_phys_port,
+			    uint8_t iport_num, uint8_t oport_num,
+			    ib_slvl_table_t *osm_oport_sl2vl)
+{
+	osm_node_t *node = osm_physp_get_node_ptr(osm_phys_port);
+	struct torus_context *ctx = context;
+	struct t_switch *sw = NULL;
+	int sl, vl;
+
+	if (node->sw) {
+		sw = node->sw->priv;
+		if (sw && sw->osm_switch != node->sw) {
+			osm_log_t *log = &ctx->osm->log;
+			guid_t guid;
+
+			guid = osm_node_get_node_guid(node);
+			OSM_LOG(log, OSM_LOG_INFO,
+				"Error: osm_switch (GUID 0x%04"PRIx64") "
+				"not in our fabric description\n",
+				cl_ntoh64(guid));
+		return;
+		}
+	}
+	for (sl = 0; sl < 16; sl++) {
+		vl = sl2vl_entry(ctx->torus, sw, iport_num, oport_num, sl);
+		ib_slvl_table_set(osm_oport_sl2vl, sl, vl);
+	}
+}
+
+/*
+ * Computes the path lengths *vl0_len and *vl1_len to get from src
+ * to dst on a ring with count switches.
+ *
+ * *vl0_len is the path length for a direct path; it corresponds to a path
+ * that should be assigned to use VL0 in a switch.  *vl1_len is the path
+ * length for a path that wraps aroung the ring, i.e. where the ring index
+ * goes from count to zero or from zero to count.  It corresponds to the path
+ * that should be assigned to use VL1 in a switch.
+ */
+static
+void get_pathlen(unsigned src, unsigned dst, unsigned count,
+		 unsigned *vl0_len, unsigned *vl1_len)
+{
+	unsigned s, l;		/* assume s < l */
+
+	if (dst > src) {
+		s = src;
+		l = dst;
+	} else {
+		s = dst;
+		l = src;
+	}
+	*vl0_len = l - s;
+	*vl1_len = s + count - l;
+}
+
+/*
+ * Returns a positive number if we should take the "positive" ring direction
+ * to reach dst from src, a negative number if we should take the "negative"
+ * ring direction, and 0 if src and dst are the same.  The choice is strictly
+ * based on which path is shorter.
+ */
+static
+int ring_dir_idx(unsigned src, unsigned dst, unsigned count)
+{
+	int r;
+	unsigned vl0_len, vl1_len;
+
+	if (dst == src)
+		return 0;
+
+	get_pathlen(src, dst, count, &vl0_len, &vl1_len);
+
+	if (dst > src)
+		r = vl0_len <= vl1_len ? 1 : -1;
+	else
+		r = vl0_len <= vl1_len ? -1 : 1;
+
+	return r;
+}
+
+/*
+ * Returns true if the VL1 path should be used to reach src from dst on a
+ * ring, based on which path is shorter.
+ */
+static
+bool use_vl1(unsigned src, unsigned dst, unsigned count)
+{
+	unsigned vl0_len, vl1_len;
+
+	get_pathlen(src, dst, count, &vl0_len, &vl1_len);
+
+	return vl0_len <= vl1_len ? false : true;
+}
+
+/*
+ * Returns the next switch in the ring of switches along coordinate direction
+ * cdir, in the positive ring direction if rdir is positive, and in the
+ * negative ring direction if rdir is negative.
+ *
+ * Returns NULL if rdir is zero, or there is no next switch.
+ */
+static
+struct t_switch *ring_next_sw(struct t_switch *sw, unsigned cdir, int rdir)
+{
+	unsigned pt_grp, far_end = 0;
+
+	if (!rdir)
+		return NULL;
+	/*
+	 * Recall that links are installed into the torus so that their 1 end
+	 * is in the "positive" coordinate direction relative to their 0 end
+	 * (see link_tswitches() and connect_tlink()).  Recall also that for
+	 * interswitch links, all links in a given switch port group have the
+	 * same endpoints, so we just need to look at the first link.
+	 */
+	pt_grp = 2 * cdir;
+	if (rdir > 0) {
+		pt_grp++;
+		far_end = 1;
+	}
+
+	if (!sw->ptgrp[pt_grp].port_cnt)
+		return NULL;
+
+	return sw->ptgrp[pt_grp].port[0]->link->end[far_end].sw;
+}
+
+/*
+ * Returns a positive number if we should take the "positive" ring direction
+ * to reach dsw from ssw, a negative number if we should take the "negative"
+ * ring direction, and 0 if src and dst are the same, or if dsw is not
+ * reachable from ssw because the path is interrupted by failure.
+ */
+static
+int ring_dir_path(struct torus *t, unsigned cdir,
+		  struct t_switch *ssw, struct t_switch *dsw)
+{
+	int d = 0;
+	struct t_switch *sw;
+
+	switch (cdir) {
+	case 0:
+		d = ring_dir_idx(ssw->i, dsw->i, t->x_sz);
+		break;
+	case 1:
+		d = ring_dir_idx(ssw->j, dsw->j, t->y_sz);
+		break;
+	case 2:
+		d = ring_dir_idx(ssw->k, dsw->k, t->z_sz);
+		break;
+	default:
+		break;
+	}
+	if (!d)
+		goto out;
+
+	sw = ssw;
+	while (sw) {
+		sw = ring_next_sw(sw, cdir, d);
+		if (sw == dsw)
+			goto out;
+	}
+	d *= -1;
+	sw = ssw;
+	while (sw) {
+		sw = ring_next_sw(sw, cdir, d);
+		if (sw == dsw)
+			goto out;
+	}
+	d = 0;
+out:
+	return d;
+}
+
+/*
+ * Returns true, and sets *pt_grp to the port group index to use for the
+ * next hop, if it is possible to make progress from ssw to dsw along the
+ * coordinate direction cdir, taking into account whether there are
+ * interruptions in the path.
+ *
+ * This next hop result can be used without worrying about ring deadlocks -
+ * if we don't choose the shortest path it is because there is a failure in
+ * the ring, which removes the possibilility of a ring deadlock on that ring.
+ */
+static
+bool next_hop_path(struct torus *t, unsigned cdir,
+		   struct t_switch *ssw, struct t_switch *dsw,
+		   unsigned *pt_grp)
+{
+	struct t_switch *tsw = NULL;
+	bool success = false;
+	int d;
+
+	/*
+	 * If the path from ssw to dsw turns, this is the switch where the
+	 * turn happens.
+	 */
+	switch (cdir) {
+	case 0:
+		tsw = t->sw[dsw->i][ssw->j][ssw->k];
+		break;
+	case 1:
+		tsw = t->sw[ssw->i][dsw->j][ssw->k];
+		break;
+	case 2:
+		tsw = t->sw[ssw->i][ssw->j][dsw->k];
+		break;
+	default:
+		goto out;
+	}
+	if (tsw) {
+		d = ring_dir_path(t, cdir, ssw, tsw);
+		cdir *= 2;
+		if (d > 0)
+			*pt_grp = cdir + 1;
+		else if (d < 0)
+			*pt_grp = cdir;
+		else
+			goto out;
+		success = true;
+	}
+out:
+	return success;
+}
+
+/*
+ * Returns true, and sets *pt_grp to the port group index to use for the
+ * next hop, if it is possible to make progress from ssw to dsw along the
+ * coordinate direction cdir.  This decision is made strictly on a
+ * shortest-path basis without regard for path availability.
+ */
+static
+bool next_hop_idx(struct torus *t, unsigned cdir,
+		  struct t_switch *ssw, struct t_switch *dsw,
+		  unsigned *pt_grp)
+{
+	int d;
+	unsigned g;
+	bool success = false;
+
+	switch (cdir) {
+	case 0:
+		d = ring_dir_idx(ssw->i, dsw->i, t->x_sz);
+		break;
+	case 1:
+		d = ring_dir_idx(ssw->j, dsw->j, t->y_sz);
+		break;
+	case 2:
+		d = ring_dir_idx(ssw->k, dsw->k, t->z_sz);
+		break;
+	default:
+		goto out;
+	}
+
+	cdir *= 2;
+	if (d > 0)
+		g = cdir + 1;
+	else if (d < 0)
+		g = cdir;
+	else
+		goto out;
+
+	if (!ssw->ptgrp[g].port_cnt)
+		goto out;
+
+	*pt_grp = g;
+	success = true;
+out:
+	return success;
+}
+
+static
+void warn_on_routing(const char *msg,
+		     struct t_switch *sw, struct t_switch *dsw)
+{
+	OSM_LOG(&sw->torus->osm->log, OSM_LOG_ERROR,
+		"%s from sw 0x%04"PRIx64" (%d,%d,%d) "
+		"to sw 0x%04"PRIx64" (%d,%d,%d)\n",
+		msg, cl_ntoh64(sw->n_id), sw->i, sw->j, sw->k,
+		cl_ntoh64(dsw->n_id), dsw->i, dsw->j, dsw->k);
+}
+
+static
+bool next_hop_x(struct torus *t,
+		struct t_switch *ssw, struct t_switch *dsw, unsigned *pt_grp)
+{
+	if (t->sw[dsw->i][ssw->j][ssw->k])
+		/*
+		 * The next turning switch on this path is available,
+		 * so head towards it by the shortest available path.
+		 */
+		return next_hop_path(t, 0, ssw, dsw, pt_grp);
+	else
+		/*
+		 * The next turning switch on this path is not
+		 * available, so head towards it in the shortest
+		 * path direction.
+		 */
+		return next_hop_idx(t, 0, ssw, dsw, pt_grp);
+}
+
+static
+bool next_hop_y(struct torus *t,
+		struct t_switch *ssw, struct t_switch *dsw, unsigned *pt_grp)
+{
+	if (t->sw[ssw->i][dsw->j][ssw->k])
+		/*
+		 * The next turning switch on this path is available,
+		 * so head towards it by the shortest available path.
+		 */
+		return next_hop_path(t, 1, ssw, dsw, pt_grp);
+	else
+		/*
+		 * The next turning switch on this path is not
+		 * available, so head towards it in the shortest
+		 * path direction.
+		 */
+		return next_hop_idx(t, 1, ssw, dsw, pt_grp);
+}
+
+static
+bool next_hop_z(struct torus *t,
+		struct t_switch *ssw, struct t_switch *dsw, unsigned *pt_grp)
+{
+	return next_hop_path(t, 2, ssw, dsw, pt_grp);
+}
+
+/*
+ * Returns the port number on *sw to use to reach *dsw, or -1 if unable to
+ * route.
+ */
+static
+int lft_port(struct torus *t,
+	     struct t_switch *sw, struct t_switch *dsw,
+	     bool update_port_cnt, bool ca)
+{
+	unsigned g, p;
+	struct port_grp *pg;
+
+	/*
+	 * The IBA does not provide a way to preserve path history for
+	 * routing decisions and VL assignment, and the only mechanism to
+	 * provide global fabric knowledge to the routing engine is via
+	 * the four SL bits.  This severely constrains the ability to deal
+	 * with missing/dead switches.
+	 *
+	 * Also, if routing a torus with XYZ-DOR, the only way to route
+	 * around a missing/dead switch is to introduce a turn that is
+	 * illegal under XYZ-DOR.
+	 *
+	 * But here's what we can do:
+	 *
+	 * We have a VL bit we use to flag illegal turns, thus putting the
+	 * hop directly after an illegal turn on a separate set of VLs.
+	 * Unfortunately, since there is no path history,  the _second_
+	 * and subsequent hops after an illegal turn use the standard
+	 * XYZ-DOR VL set.  This is enough to introduce credit loops in
+	 * many cases.
+	 *
+	 * To minimize the number of cases such illegal turns can introduce
+	 * credit loops, we try to introduce the illegal turn as late in a
+	 * path as possible.
+	 *
+	 * Define a turning switch as a switch where a path turns from one
+	 * coordinate direction onto another.  If a turning switch in a path
+	 * is missing, construct the LFT entries so that the path progresses
+	 * as far as possible on the shortest path to the turning switch.
+	 * When progress is not possible, turn onto the next coordinate
+	 * direction.
+	 *
+	 * The next turn after that will be an illegal turn, after which
+	 * point the path will continue to use a standard XYZ-DOR path.
+	 */
+	if (dsw->i != sw->i) {
+
+		if (next_hop_x(t, sw, dsw, &g))
+			goto done;
+		/*
+		 * This path has made as much progress in this direction as
+		 * is possible, so turn it now.
+		 */
+		if (dsw->j != sw->j && next_hop_y(t, sw, dsw, &g))
+			goto done;
+
+		if (dsw->k != sw->k && next_hop_z(t, sw, dsw, &g))
+			goto done;
+
+		warn_on_routing("Error: unable to route", sw, dsw);
+		goto no_route;
+	} else if (dsw->j != sw->j) {
+
+		if (next_hop_y(t, sw, dsw, &g))
+			goto done;
+
+		if (dsw->k != sw->k && next_hop_z(t, sw, dsw, &g))
+			goto done;
+
+		warn_on_routing("Error: unable to route", sw, dsw);
+		goto no_route;
+	} else {
+		if (dsw->k == sw->k)
+			warn_on_routing("Warning: bad routing", sw, dsw);
+
+		if (next_hop_z(t, sw, dsw, &g))
+			goto done;
+
+		warn_on_routing("Error: unable to route", sw, dsw);
+		goto no_route;
+	}
+done:
+	pg = &sw->ptgrp[g];
+	if (!pg->port_cnt)
+		goto no_route;
+
+	if (update_port_cnt) {
+		if (ca)
+			p = pg->ca_dlid_cnt++ % pg->port_cnt;
+		else
+			p = pg->sw_dlid_cnt++ % pg->port_cnt;
+	} else {
+		/*
+		 * If we're not updating port counts, then we're just running
+		 * routes for SL path checking, and it doesn't matter which
+		 * of several parallel links we use.  Use the first one.
+		 */
+		p = 0;
+	}
+	p = pg->port[p]->port;
+
+	return p;
+
+no_route:
+	/*
+	 * We can't get there from here.
+	 */
+	OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+		"ERR 4E39: routing on sw 0x%04"PRIx64": sending "
+		"traffic for dest sw 0x%04"PRIx64" to port %u\n",
+		cl_ntoh64(sw->n_id), cl_ntoh64(dsw->n_id), OSM_NO_PATH);
+	return -1;
+}
+
+static
+bool get_lid(struct port_grp *pg, unsigned p,
+	     uint16_t *dlid_base, uint8_t *dlid_lmc, bool *ca)
+{
+	struct endpoint *ep;
+	osm_port_t *osm_port;
+
+	if (p >= pg->port_cnt) {
+		OSM_LOG(&pg->sw->torus->osm->log, OSM_LOG_ERROR,
+			"ERR 4E3A: Port group index %u too large: sw "
+			"0x%04"PRIx64" pt_grp %u pt_grp_cnt %u\n",
+			p, cl_ntoh64(pg->sw->n_id),
+			(unsigned)pg->port_grp, (unsigned)pg->port_cnt);
+		return false;
+	}
+	if (pg->port[p]->type == SRCSINK) {
+		ep = pg->port[p];
+		if (ca)
+			*ca = false;
+	} else if (pg->port[p]->type == PASSTHRU &&
+		   pg->port[p]->link->end[1].type == SRCSINK) {
+		/*
+		 * If this port is connected via a link to a CA, then we
+		 * know link->end[0] is the switch end and link->end[1] is
+		 * the CA end; see build_ca_link() and link_srcsink().
+		 */
+		ep = &pg->port[p]->link->end[1];
+		if (ca)
+			*ca = true;
+	} else {
+		OSM_LOG(&pg->sw->torus->osm->log, OSM_LOG_ERROR,
+			"ERR 4E3B: Switch 0x%04"PRIx64" port %d improperly connected\n",
+			cl_ntoh64(pg->sw->n_id), pg->port[p]->port);
+		return false;
+	}
+	osm_port = ep->osm_port;
+	if (!(osm_port && osm_port->priv == ep)) {
+		OSM_LOG(&pg->sw->torus->osm->log, OSM_LOG_ERROR,
+			"ERR 4E3C: ep->osm_port->priv != ep "
+			"for sw 0x%04"PRIx64" port %d\n",
+			cl_ntoh64(((struct t_switch *)(ep->sw))->n_id), ep->port);
+		return false;
+	}
+	*dlid_base = cl_ntoh16(osm_physp_get_base_lid(osm_port->p_physp));
+	*dlid_lmc = osm_physp_get_lmc(osm_port->p_physp);
+
+	return true;
+}
+
+static
+bool torus_lft(struct torus *t, struct t_switch *sw)
+{
+	bool success = true;
+	int dp;
+	unsigned p, s;
+	uint16_t l, dlid_base;
+	uint8_t dlid_lmc;
+	bool ca;
+	struct port_grp *pgrp;
+	struct t_switch *dsw;
+	osm_switch_t *osm_sw;
+	uint8_t order[IB_NODE_NUM_PORTS_MAX+1];
+
+	if (!(sw->osm_switch && sw->osm_switch->priv == sw)) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E3D: sw->osm_switch->priv != sw "
+			"for sw 0x%04"PRIx64"\n", cl_ntoh64(sw->n_id));
+		return false;
+	}
+	osm_sw = sw->osm_switch;
+	memset(osm_sw->new_lft, OSM_NO_PATH, osm_sw->lft_size);
+
+	for (s = 0; s < t->switch_cnt; s++) {
+
+		dsw = t->sw_pool[s];
+		pgrp = &dsw->ptgrp[2 * TORUS_MAX_DIM];
+
+		memset(order, IB_INVALID_PORT_NUM, sizeof(order));
+		for (p = 0; p < pgrp->port_cnt; p++)
+			order[pgrp->port[p]->port] = p;
+
+		for (p = 0; p < ARRAY_SIZE(order); p++) {
+
+			uint8_t px = order[t->port_order[p]];
+
+			if (px == IB_INVALID_PORT_NUM)
+				continue;
+
+			if (!get_lid(pgrp, px, &dlid_base, &dlid_lmc, &ca))
+				return false;
+
+			if (sw->n_id == dsw->n_id)
+				dp = pgrp->port[px]->port;
+			else
+				dp = lft_port(t, sw, dsw, true, ca);
+			/*
+			 * LMC > 0 doesn't really make sense for torus-2QoS.
+			 * So, just make sure traffic gets delivered if
+			 * non-zero LMC is used.
+			 */
+			if (dp >= 0)
+				for (l = 0; l < (1U << dlid_lmc); l++)
+					osm_sw->new_lft[dlid_base + l] = dp;
+			else
+				success = false;
+		}
+	}
+	return success;
+}
+
+static
+osm_mtree_node_t *mcast_stree_branch(struct t_switch *sw, osm_switch_t *osm_sw,
+				     osm_mgrp_box_t *mgb, unsigned depth,
+				     unsigned *port_cnt, unsigned *max_depth)
+{
+	osm_mtree_node_t *mtn = NULL;
+	osm_mcast_tbl_t *mcast_tbl, *ds_mcast_tbl;
+	osm_node_t *ds_node;
+	struct t_switch *ds_sw;
+	struct port_grp *ptgrp;
+	struct link *link;
+	struct endpoint *port;
+	unsigned g, p;
+	unsigned mcast_fwd_ports = 0, mcast_end_ports = 0;
+
+	depth++;
+
+	if (osm_sw->priv != sw) {
+		OSM_LOG(&sw->torus->osm->log, OSM_LOG_ERROR,
+			"ERR 4E3E: osm_sw (GUID 0x%04"PRIx64") "
+			"not in our fabric description\n",
+			cl_ntoh64(osm_node_get_node_guid(osm_sw->p_node)));
+		goto out;
+	}
+	if (!osm_switch_supports_mcast(osm_sw)) {
+		OSM_LOG(&sw->torus->osm->log, OSM_LOG_ERROR,
+			"ERR 4E3F: osm_sw (GUID 0x%04"PRIx64") "
+			"does not support multicast\n",
+			cl_ntoh64(osm_node_get_node_guid(osm_sw->p_node)));
+		goto out;
+	}
+	mtn = osm_mtree_node_new(osm_sw);
+	if (!mtn) {
+		OSM_LOG(&sw->torus->osm->log, OSM_LOG_ERROR,
+			"Insufficient memory to build multicast tree\n");
+		goto out;
+	}
+	mcast_tbl = osm_switch_get_mcast_tbl_ptr(osm_sw);
+	/*
+	 * Recurse to downstream switches, i.e. those closer to master
+	 * spanning tree branch tips.
+	 *
+	 * Note that if there are multiple ports in this port group, i.e.,
+	 * multiple parallel links, we can pick any one of them to use for
+	 * any individual MLID without causing loops.  Pick one based on MLID
+	 * for now, until someone turns up evidence we need to be smarter.
+	 *
+	 * Also, it might be we got called in a window between a switch getting
+	 * removed from the fabric, and torus-2QoS getting to rebuild its
+	 * fabric representation.  If that were to happen, our next hop
+	 * osm_switch pointer might be stale.  Look it up via opensm's fabric
+	 * description to be sure it's not.
+	 */
+	for (g = 0; g < 2 * TORUS_MAX_DIM; g++) {
+		ptgrp = &sw->ptgrp[g];
+		if (!ptgrp->to_stree_tip)
+			continue;
+
+		p = mgb->mlid % ptgrp->port_cnt;/* port # in port group */
+		p = ptgrp->port[p]->port;	/* now port # in switch */
+
+		ds_node = osm_node_get_remote_node(osm_sw->p_node, p, NULL);
+		ds_sw = ptgrp->to_stree_tip->sw;
+
+		if (!(ds_node && ds_node->sw &&
+		      ds_sw->osm_switch == ds_node->sw)) {
+			OSM_LOG(&sw->torus->osm->log, OSM_LOG_ERROR,
+				"ERR 4E40: stale pointer to osm_sw "
+				"(GUID 0x%04"PRIx64")\n", cl_ntoh64(ds_sw->n_id));
+			continue;
+		}
+		mtn->child_array[p] =
+			mcast_stree_branch(ds_sw, ds_node->sw, mgb,
+					   depth, port_cnt, max_depth);
+		if (!mtn->child_array[p])
+			continue;
+
+		osm_mcast_tbl_set(mcast_tbl, mgb->mlid, p);
+		mcast_fwd_ports++;
+		/*
+		 * Since we forward traffic for this multicast group on this
+		 * port, cause the switch on the other end of the link
+		 * to forward traffic back to us.  Do it now since have at
+		 * hand the link used; otherwise it'll be hard to figure out
+		 * later, and if we get it wrong we get a MC routing loop.
+		 */
+		link = sw->port[p]->link;
+		ds_mcast_tbl = osm_switch_get_mcast_tbl_ptr(ds_node->sw);
+
+		if (&link->end[0] == sw->port[p])
+			osm_mcast_tbl_set(ds_mcast_tbl, mgb->mlid,
+					  link->end[1].port);
+		else
+			osm_mcast_tbl_set(ds_mcast_tbl, mgb->mlid,
+					  link->end[0].port);
+	}
+	/*
+	 * Add any host ports marked as in mcast group into spanning tree.
+	 */
+	ptgrp = &sw->ptgrp[2 * TORUS_MAX_DIM];
+	for (p = 0; p < ptgrp->port_cnt; p++) {
+		port = ptgrp->port[p];
+		if (port->tmp) {
+			port->tmp = NULL;
+			mtn->child_array[port->port] = OSM_MTREE_LEAF;
+			osm_mcast_tbl_set(mcast_tbl, mgb->mlid, port->port);
+			mcast_end_ports++;
+		}
+	}
+	if (!(mcast_end_ports || mcast_fwd_ports)) {
+		free(mtn);
+		mtn = NULL;
+	} else if (depth > *max_depth)
+		*max_depth = depth;
+
+	*port_cnt += mcast_end_ports;
+out:
+	return mtn;
+}
+
+static
+osm_port_t *next_mgrp_box_port(osm_mgrp_box_t *mgb,
+			       cl_list_item_t **list_iterator,
+			       cl_map_item_t **map_iterator)
+{
+	osm_mgrp_t *mgrp;
+	osm_mcm_port_t *mcm_port;
+	osm_port_t *osm_port = NULL;
+	cl_map_item_t *m_item = *map_iterator;
+	cl_list_item_t *l_item = *list_iterator;
+
+next_mgrp:
+	if (!l_item)
+		l_item = cl_qlist_head(&mgb->mgrp_list);
+	if (l_item == cl_qlist_end(&mgb->mgrp_list)) {
+		l_item = NULL;
+		goto out;
+	}
+	mgrp = cl_item_obj(l_item, mgrp, list_item);
+
+	if (!m_item)
+		m_item = cl_qmap_head(&mgrp->mcm_port_tbl);
+	if (m_item == cl_qmap_end(&mgrp->mcm_port_tbl)) {
+		m_item = NULL;
+		l_item = cl_qlist_next(l_item);
+		goto next_mgrp;
+	}
+	mcm_port = cl_item_obj(m_item, mcm_port, map_item);
+	m_item = cl_qmap_next(m_item);
+	osm_port = mcm_port->port;
+out:
+	*list_iterator = l_item;
+	*map_iterator = m_item;
+	return osm_port;
+}
+
+static
+ib_api_status_t torus_mcast_stree(void *context, osm_mgrp_box_t *mgb)
+{
+	struct torus_context *ctx = context;
+	struct torus *t = ctx->torus;
+	cl_map_item_t *m_item = NULL;
+	cl_list_item_t *l_item = NULL;
+	osm_port_t *osm_port;
+	osm_switch_t *osm_sw;
+	struct endpoint *port;
+	unsigned port_cnt = 0, max_depth = 0;
+
+	osm_purge_mtree(&ctx->osm->sm, mgb);
+
+	/*
+	 * Build a spanning tree for a multicast group by first marking
+	 * the torus endpoints that are participating in the group.
+	 * Then do a depth-first search of the torus master spanning
+	 * tree to build up the spanning tree specific to this group.
+	 *
+	 * Since the torus master spanning tree is constructed specifically
+	 * to guarantee that multicast will not deadlock against unicast
+	 * when they share VLs, we can be sure that any multicast group
+	 * spanning tree constructed this way has the same property.
+	 */
+	while ((osm_port = next_mgrp_box_port(mgb, &l_item, &m_item))) {
+		port = osm_port->priv;
+		if (!(port && port->osm_port == osm_port)) {
+			port = osm_port_relink_endpoint(osm_port);
+			if (!port) {
+				guid_t id;
+				id = osm_node_get_node_guid(osm_port->p_node);
+				OSM_LOG(&ctx->osm->log, OSM_LOG_ERROR,
+					"ERR 4E41: osm_port (GUID 0x%04"PRIx64") "
+					"not in our fabric description\n",
+					cl_ntoh64(id));
+				continue;
+			}
+		}
+		/*
+		 * If this is a CA port, mark the switch port at the
+		 * other end of this port's link.
+		 *
+		 * By definition, a CA port is connected to end[1] of a link,
+		 * and the switch port is end[0].  See build_ca_link() and
+		 * link_srcsink().
+		 */
+		if (port->link)
+			port = &port->link->end[0];
+		port->tmp = osm_port;
+	}
+	/*
+	 * It might be we got called in a window between a switch getting
+	 * removed from the fabric, and torus-2QoS getting to rebuild its
+	 * fabric representation.  If that were to happen, our
+	 * master_stree_root->osm_switch pointer might be stale.  Look up
+	 * the osm_switch by GUID to be sure it's not.
+	 *
+	 * Also, call into mcast_stree_branch with depth = -1, because
+	 * depth at root switch needs to be 0.
+	 */
+	osm_sw = (osm_switch_t *)cl_qmap_get(&ctx->osm->subn.sw_guid_tbl,
+					     t->master_stree_root->n_id);
+	if (!(osm_sw && t->master_stree_root->osm_switch == osm_sw)) {
+		OSM_LOG(&ctx->osm->log, OSM_LOG_ERROR,
+			"ERR 4E42: stale pointer to osm_sw (GUID 0x%04"PRIx64")\n",
+			cl_ntoh64(t->master_stree_root->n_id));
+		return IB_ERROR;
+	}
+	mgb->root = mcast_stree_branch(t->master_stree_root, osm_sw,
+				       mgb, -1, &port_cnt, &max_depth);
+
+	OSM_LOG(&ctx->osm->log, OSM_LOG_VERBOSE,
+		"Configured MLID 0x%X for %u ports, max tree depth = %u\n",
+		mgb->mlid, port_cnt, max_depth);
+
+	return IB_SUCCESS;
+}
+
+static
+bool good_xy_ring(struct torus *t, const int x, const int y, const int z)
+{
+	struct t_switch ****sw = t->sw;
+	bool good_ring = true;
+	int x_tst, y_tst;
+
+	for (x_tst = 0; x_tst < t->x_sz && good_ring; x_tst++)
+		good_ring = sw[x_tst][y][z];
+
+	for (y_tst = 0; y_tst < t->y_sz && good_ring; y_tst++)
+		good_ring = sw[x][y_tst][z];
+
+	return good_ring;
+}
+
+static
+struct t_switch *find_plane_mid(struct torus *t, const int z)
+{
+	int x, dx, xm = t->x_sz / 2;
+	int y, dy, ym = t->y_sz / 2;
+	struct t_switch ****sw = t->sw;
+
+	if (good_xy_ring(t, xm, ym, z))
+		return sw[xm][ym][z];
+
+	for (dx = 1, dy = 1; dx <= xm && dy <= ym; dx++, dy++) {
+
+		x = canonicalize(xm - dx, t->x_sz);
+		y = canonicalize(ym - dy, t->y_sz);
+		if (good_xy_ring(t, x, y, z))
+			return sw[x][y][z];
+
+		x = canonicalize(xm + dx, t->x_sz);
+		y = canonicalize(ym + dy, t->y_sz);
+		if (good_xy_ring(t, x, y, z))
+			return sw[x][y][z];
+	}
+	return NULL;
+}
+
+static
+struct t_switch *find_stree_root(struct torus *t)
+{
+	int x, y, z, dz, zm = t->z_sz / 2;
+	struct t_switch ****sw = t->sw;
+	struct t_switch *root;
+	bool good_plane;
+
+	/*
+	 * Look for a switch near the "center" (wrt. the datelines) of the
+	 * torus, as that will be the most optimum spanning tree root.  Use
+	 * a search that is not exhaustive, on the theory that this routing
+	 * engine isn't useful anyway if too many switches are missing.
+	 *
+	 * Also, want to pick an x-y plane with no missing switches, so that
+	 * the master spanning tree construction algorithm doesn't have to
+	 * deal with needing a turn on a missing switch.
+	 */
+	for (dz = 0; dz <= zm; dz++) {
+
+		z = canonicalize(zm - dz, t->z_sz);
+		good_plane = true;
+		for (y = 0; y < t->y_sz && good_plane; y++)
+			for (x = 0; x < t->x_sz && good_plane; x++)
+				good_plane = sw[x][y][z];
+
+		if (good_plane) {
+			root = find_plane_mid(t, z);
+			if (root)
+				goto out;
+		}
+		if (!dz)
+			continue;
+
+		z = canonicalize(zm + dz, t->z_sz);
+		good_plane = true;
+		for (y = 0; y < t->y_sz && good_plane; y++)
+			for (x = 0; x < t->x_sz && good_plane; x++)
+				good_plane = sw[x][y][z];
+
+		if (good_plane) {
+			root = find_plane_mid(t, z);
+			if (root)
+				goto out;
+		}
+	}
+	/*
+	 * Note that torus-2QoS can route a torus that is missing an entire
+	 * column (switches with x,y constant, for all z values) without
+	 * deadlocks.
+	 *
+	 * if we've reached this point, we must have a column of missing
+	 * switches, as routable_torus() would have returned false for
+	 * any other configuration of missing switches that made it through
+	 * the above.
+	 *
+	 * So any switch in the mid-z plane will do as the root.
+	 */
+	root = find_plane_mid(t, zm);
+out:
+	return root;
+}
+
+static
+bool sw_in_master_stree(struct t_switch *sw)
+{
+	int g;
+	bool connected;
+
+	connected = sw == sw->torus->master_stree_root;
+	for (g = 0; g < 2 * TORUS_MAX_DIM; g++)
+		connected = connected || sw->ptgrp[g].to_stree_root;
+
+	return connected;
+}
+
+static
+void grow_master_stree_branch(struct t_switch *root, struct t_switch *tip,
+			      unsigned to_root_pg, unsigned to_tip_pg)
+{
+	root->ptgrp[to_tip_pg].to_stree_tip = &tip->ptgrp[to_root_pg];
+	tip->ptgrp[to_root_pg].to_stree_root = &root->ptgrp[to_tip_pg];
+}
+
+static
+void build_master_stree_branch(struct t_switch *branch_root, int cdir)
+{
+	struct t_switch *sw, *n_sw, *p_sw;
+	unsigned l, idx, cnt, pg, ng;
+
+	switch (cdir) {
+	case 0:
+		idx = branch_root->i;
+		cnt = branch_root->torus->x_sz;
+		break;
+	case 1:
+		idx = branch_root->j;
+		cnt = branch_root->torus->y_sz;
+		break;
+	case 2:
+		idx = branch_root->k;
+		cnt = branch_root->torus->z_sz;
+		break;
+	default:
+		goto out;
+	}
+	/*
+	 * This algorithm intends that a spanning tree branch never crosses
+	 * a dateline unless the 1-D ring for which we're building the branch
+	 * is interrupted by failure.  We need that guarantee to prevent
+	 * multicast/unicast credit loops.
+	 */
+	n_sw = branch_root;		/* tip of negative cdir branch */
+	ng = 2 * cdir;			/* negative cdir port group index */
+	p_sw = branch_root;		/* tip of positive cdir branch */
+	pg = 2 * cdir + 1;		/* positive cdir port group index */
+
+	for (l = idx; n_sw && l >= 1; l--) {
+		sw = ring_next_sw(n_sw, cdir, -1);
+		if (sw && !sw_in_master_stree(sw)) {
+			grow_master_stree_branch(n_sw, sw, pg, ng);
+			n_sw = sw;
+		} else
+			n_sw = NULL;
+	}
+	for (l = idx; p_sw && l < (cnt - 1); l++) {
+		sw = ring_next_sw(p_sw, cdir, 1);
+		if (sw && !sw_in_master_stree(sw)) {
+			grow_master_stree_branch(p_sw, sw, ng, pg);
+			p_sw = sw;
+		} else
+			p_sw = NULL;
+	}
+	if (n_sw && p_sw)
+		goto out;
+	/*
+	 * At least one branch couldn't grow to the dateline for this ring.
+	 * That means it is acceptable to grow the branch by crossing the
+	 * dateline.
+	 */
+	for (l = 0; l < cnt; l++) {
+		if (n_sw) {
+			sw = ring_next_sw(n_sw, cdir, -1);
+			if (sw && !sw_in_master_stree(sw)) {
+				grow_master_stree_branch(n_sw, sw, pg, ng);
+				n_sw = sw;
+			} else
+				n_sw = NULL;
+		}
+		if (p_sw) {
+			sw = ring_next_sw(p_sw, cdir, 1);
+			if (sw && !sw_in_master_stree(sw)) {
+				grow_master_stree_branch(p_sw, sw, ng, pg);
+				p_sw = sw;
+			} else
+				p_sw = NULL;
+		}
+		if (!(n_sw || p_sw))
+			break;
+	}
+out:
+	return;
+}
+
+static
+bool torus_master_stree(struct torus *t)
+{
+	int i, j, k;
+	bool success = false;
+	struct t_switch *stree_root = find_stree_root(t);
+
+	if (stree_root)
+		build_master_stree_branch(stree_root, 0);
+	else
+		goto out;
+
+	k = stree_root->k;
+	for (i = 0; i < t->x_sz; i++) {
+		j = stree_root->j;
+		if (t->sw[i][j][k])
+			build_master_stree_branch(t->sw[i][j][k], 1);
+
+		for (j = 0; j < t->y_sz; j++)
+			if (t->sw[i][j][k])
+				build_master_stree_branch(t->sw[i][j][k], 2);
+	}
+	t->master_stree_root = stree_root;
+	/*
+	 * At this point we should have a master spanning tree that contains
+	 * every present switch, for all fabrics that torus-2QoS can route
+	 * without deadlocks.  Make sure this is the case; otherwise warn
+	 * and return failure so we get bug reports.
+	 */
+	success = true;
+	for (i = 0; i < t->x_sz; i++)
+		for (j = 0; j < t->y_sz; j++)
+			for (k = 0; k < t->z_sz; k++) {
+				struct t_switch *sw = t->sw[i][j][k];
+				if (!sw || sw_in_master_stree(sw))
+					continue;
+
+				success = false;
+				OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+					"ERR 4E43: sw 0x%04"PRIx64" (%d,%d,%d) not in "
+					"torus multicast master spanning tree\n",
+					cl_ntoh64(sw->n_id), i, j, k);
+			}
+out:
+	return success;
+}
+
+int route_torus(struct torus *t)
+{
+	int s;
+	bool success = true;
+
+	for (s = 0; s < (int)t->switch_cnt; s++)
+		success = torus_lft(t, t->sw_pool[s]) && success;
+
+	success = success && torus_master_stree(t);
+
+	return success ? 0 : -1;
+}
+
+uint8_t torus_path_sl(void *context, uint8_t path_sl_hint,
+		      const ib_net16_t slid, const ib_net16_t dlid)
+{
+	struct torus_context *ctx = context;
+	osm_opensm_t *p_osm = ctx->osm;
+	osm_log_t *log = &p_osm->log;
+	osm_port_t *osm_sport, *osm_dport;
+	struct endpoint *sport, *dport;
+	struct t_switch *ssw, *dsw;
+	struct torus *t;
+	guid_t guid;
+	unsigned sl = 0;
+
+	osm_sport = osm_get_port_by_lid(&p_osm->subn, slid);
+	if (!osm_sport)
+		goto out;
+
+	osm_dport = osm_get_port_by_lid(&p_osm->subn, dlid);
+	if (!osm_dport)
+		goto out;
+
+	sport = osm_sport->priv;
+	if (!(sport && sport->osm_port == osm_sport)) {
+		sport = osm_port_relink_endpoint(osm_sport);
+		if (!sport) {
+			guid = osm_node_get_node_guid(osm_sport->p_node);
+			OSM_LOG(log, OSM_LOG_INFO,
+				"Error: osm_sport (GUID 0x%04"PRIx64") "
+				"not in our fabric description\n",
+				cl_ntoh64(guid));
+			goto out;
+		}
+	}
+	dport = osm_dport->priv;
+	if (!(dport && dport->osm_port == osm_dport)) {
+		dport = osm_port_relink_endpoint(osm_dport);
+		if (!dport) {
+			guid = osm_node_get_node_guid(osm_dport->p_node);
+			OSM_LOG(log, OSM_LOG_INFO,
+				"Error: osm_dport (GUID 0x%04"PRIx64") "
+				"not in our fabric description\n",
+				cl_ntoh64(guid));
+			goto out;
+		}
+	}
+	/*
+	 * We're only supposed to be called for CA ports, and maybe
+	 * switch management ports.
+	 */
+	if (sport->type != SRCSINK) {
+		guid = osm_node_get_node_guid(osm_sport->p_node);
+		OSM_LOG(log, OSM_LOG_INFO,
+			"Error: osm_sport (GUID 0x%04"PRIx64") "
+			"not a data src/sink port\n", cl_ntoh64(guid));
+		goto out;
+	}
+	if (dport->type != SRCSINK) {
+		guid = osm_node_get_node_guid(osm_dport->p_node);
+		OSM_LOG(log, OSM_LOG_INFO,
+			"Error: osm_dport (GUID 0x%04"PRIx64") "
+			"not a data src/sink port\n", cl_ntoh64(guid));
+		goto out;
+	}
+	/*
+	 * By definition, a CA port is connected to end[1] of a link, and
+	 * the switch port is end[0].  See build_ca_link() and link_srcsink().
+	 */
+	if (sport->link) {
+		ssw = sport->link->end[0].sw;
+	} else {
+		ssw = sport->sw;
+	}
+	if (dport->link)
+		dsw = dport->link->end[0].sw;
+	else
+		dsw = dport->sw;
+
+	t = ssw->torus;
+
+	sl  = sl_set_use_loop_vl(use_vl1(ssw->i, dsw->i, t->x_sz), 0);
+	sl |= sl_set_use_loop_vl(use_vl1(ssw->j, dsw->j, t->y_sz), 1);
+	sl |= sl_set_use_loop_vl(use_vl1(ssw->k, dsw->k, t->z_sz), 2);
+	sl |= sl_set_qos(sl_get_qos(path_sl_hint));
+out:
+	return sl;
+}
+
+static
+void check_vlarb_config(const char *vlarb_str, bool is_default,
+			const char *str, const char *pri, osm_log_t *log)
+{
+	unsigned total_weight[IB_MAX_NUM_VLS] = {0,};
+	unsigned i = 0, v, vl = 0;
+	char *end;
+	bool uniform;
+
+	while (*vlarb_str && i++ < 2 * IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK) {
+		v = strtoul(vlarb_str, &end, 0);
+		if (*end)
+			end++;
+		vlarb_str = end;
+		if (i & 0x1)
+			vl = v & 0xf;
+		else
+			total_weight[vl] += v & 0xff;
+	}
+	uniform = true;
+	v = total_weight[0];
+	for (i = 1; i < 8; i++) {
+		if (i == 4)
+			v = total_weight[i];
+		if (total_weight[i] != v)
+			uniform = false;
+	}
+	if (!uniform)
+		OSM_LOG(log, OSM_LOG_INFO,
+			"Warning: torus-2QoS requires same VLarb weights for "
+			"VLs 0-3; also for VLs 4-7: not true for %s "
+			"%s_vlarb_%s\n",
+			(is_default ? "default" : "configured"), str, pri);
+}
+
+static
+void check_qos_config(osm_qos_options_t *opt, bool tgt_is_default,
+		      const char *str, osm_log_t *log)
+{
+	const char *vlarb_str;
+	bool is_default;
+
+	if (opt->max_vls > 0 && opt->max_vls < 8)
+		OSM_LOG(log, OSM_LOG_INFO,
+			"Warning: full torus-2QoS functionality not available "
+			"for configured %s_max_vls = %d\n", str, opt->max_vls);
+
+	if (opt->vlarb_high) {
+		is_default = false;
+		vlarb_str = opt->vlarb_high;
+	} else{
+		is_default = true;
+		vlarb_str = OSM_DEFAULT_QOS_VLARB_HIGH;
+	}
+	/*
+	 * Only check values that were actually configured, or the overall
+	 * defaults that target-specific (CA, switch port, etc) defaults
+	 * are set from.
+	 */
+	if (!is_default || tgt_is_default)
+		check_vlarb_config(vlarb_str, is_default, str, "high", log);
+
+	if (opt->vlarb_low) {
+		is_default = false;
+		vlarb_str = opt->vlarb_low;
+	} else {
+		is_default = true;
+		vlarb_str = OSM_DEFAULT_QOS_VLARB_LOW;
+	}
+	if (!is_default || tgt_is_default)
+		check_vlarb_config(vlarb_str, is_default, str, "low", log);
+
+	if (opt->sl2vl)
+		OSM_LOG(log, OSM_LOG_INFO,
+			"Warning: torus-2QoS must override configured "
+			"%s_sl2vl to generate deadlock-free routes\n", str);
+}
+
+static
+int torus_build_lfts(void *context)
+{
+	int status = -1;
+	struct torus_context *ctx = context;
+	struct fabric *fabric;
+	struct torus *torus;
+
+	if (!ctx->osm->subn.opt.qos) {
+		OSM_LOG(&ctx->osm->log, OSM_LOG_ERROR,
+			"ERR 4E44: Routing engine list contains torus-2QoS. "
+			"Enable QoS for correct operation "
+			"(-Q or 'qos TRUE' in opensm.conf).\n");
+		return status;
+	}
+
+	fabric = &ctx->fabric;
+	teardown_fabric(fabric);
+
+	torus = calloc(1, sizeof(*torus));
+	if (!torus) {
+		OSM_LOG(&ctx->osm->log, OSM_LOG_ERROR,
+			"ERR 4E45: allocating torus: %s\n", strerror(errno));
+		goto out;
+	}
+	torus->osm = ctx->osm;
+	fabric->osm = ctx->osm;
+
+	if (!parse_config(ctx->osm->subn.opt.torus_conf_file,
+			  fabric, torus))
+		goto out;
+
+	if (!capture_fabric(fabric))
+		goto out;
+
+	OSM_LOG(&torus->osm->log, OSM_LOG_INFO,
+		"Found fabric w/ %d links, %d switches, %d CA ports, "
+		"minimum %d data VLs\n",
+		(int)fabric->link_cnt, (int)fabric->switch_cnt,
+		(int)fabric->ca_cnt, (int)ctx->osm->subn.min_data_vls);
+
+	if (!verify_setup(torus, fabric))
+		goto out;
+
+	OSM_LOG(&torus->osm->log, OSM_LOG_INFO,
+		"Looking for %d x %d x %d %s\n",
+		(int)torus->x_sz, (int)torus->y_sz, (int)torus->z_sz,
+		(ALL_MESH(torus->flags) ? "mesh" : "torus"));
+
+	build_torus(fabric, torus);
+
+	OSM_LOG(&torus->osm->log, OSM_LOG_INFO,
+		"Built %d x %d x %d %s w/ %d links, %d switches, %d CA ports\n",
+		(int)torus->x_sz, (int)torus->y_sz, (int)torus->z_sz,
+		(ALL_MESH(torus->flags) ? "mesh" : "torus"),
+		(int)torus->link_cnt, (int)torus->switch_cnt,
+		(int)torus->ca_cnt);
+
+	diagnose_fabric(fabric);
+	/*
+	 * Since we found some sort of torus fabric, report on any topology
+	 * changes vs. the last torus we found.
+	 */
+	if (torus->flags & NOTIFY_CHANGES)
+		report_torus_changes(torus, ctx->torus);
+
+	if (routable_torus(torus, fabric))
+		status = route_torus(torus);
+
+out:
+	if (status) {		/* bad torus!! */
+		if (torus)
+			teardown_torus(torus);
+	} else {
+		osm_subn_opt_t *opt = &torus->osm->subn.opt;
+		osm_log_t *log = &torus->osm->log;
+
+		if (ctx->torus)
+			teardown_torus(ctx->torus);
+		ctx->torus = torus;
+
+		check_qos_config(&opt->qos_options, 1, "qos", log);
+		check_qos_config(&opt->qos_ca_options, 0, "qos_ca", log);
+		check_qos_config(&opt->qos_sw0_options, 0, "qos_sw0", log);
+		check_qos_config(&opt->qos_swe_options, 0, "qos_swe", log);
+		check_qos_config(&opt->qos_rtr_options, 0, "qos_rtr", log);
+	}
+	teardown_fabric(fabric);
+	return status;
+}
+
+int osm_ucast_torus2QoS_setup(struct osm_routing_engine *r,
+			      osm_opensm_t *osm)
+{
+	struct torus_context *ctx;
+
+	ctx = torus_context_create(osm);
+	if (!ctx)
+		return -1;
+
+	r->context = ctx;
+	r->ucast_build_fwd_tables = torus_build_lfts;
+	r->update_sl2vl = torus_update_osm_sl2vl;
+	r->path_sl = torus_path_sl;
+	r->mcast_build_stree = torus_mcast_stree;
+	r->destroy = torus_context_delete;
+	return 0;
+}
diff --git a/opensm/osm_trap_rcv.c b/opensm/osm_trap_rcv.c
index 46fbad7..4a59cfe 100644
--- a/opensm/osm_trap_rcv.c
+++ b/opensm/osm_trap_rcv.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009,2010 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -48,6 +49,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_TRAP_RCV_C
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
@@ -72,7 +75,7 @@ extern void osm_req_get_node_desc(IN osm_sm_t * sm, osm_physp_t *p_physp);
  *
  * A timer running in the background will toggle a timer counter
  * that should be referenced by the aging algorithm.
- * To provide an efficient handling of aging. We also track all traps
+ * To provide an efficient handling of aging, we also track all traps
  * in a sorted list by their aging.
  *
  * The generic Aging Tracker mechanism is implemented in the
@@ -80,23 +83,10 @@ extern void osm_req_get_node_desc(IN osm_sm_t * sm, osm_physp_t *p_physp);
  *
  **********************************************************************/
 
-typedef struct osm_trap_agingracker_context {
-	osm_log_t *p_log;
-	osm_physp_t *p_physp;
-} osm_trap_aging_tracker_context_t;
-
-/**********************************************************************
- **********************************************************************/
 static osm_physp_t *get_physp_by_lid_and_num(IN osm_sm_t * sm,
-					     IN uint16_t lid, IN uint8_t num)
+					     IN ib_net16_t lid, IN uint8_t num)
 {
-	cl_ptr_vector_t *p_vec = &(sm->p_subn->port_lid_tbl);
-	osm_port_t *p_port;
-
-	if (lid > cl_ptr_vector_get_size(p_vec))
-		return NULL;
-
-	p_port = (osm_port_t *) cl_ptr_vector_get(p_vec, lid);
+	osm_port_t *p_port = osm_get_port_by_lid(sm->p_subn, lid);
 	if (!p_port)
 		return NULL;
 
@@ -106,14 +96,11 @@ static osm_physp_t *get_physp_by_lid_and_num(IN osm_sm_t * sm,
 	return osm_node_get_physp_ptr(p_port->p_node, num);
 }
 
-/**********************************************************************
- **********************************************************************/
-uint64_t
-osm_trap_rcv_aging_tracker_callback(IN uint64_t key,
-				    IN uint32_t num_regs, IN void *context)
+static uint64_t aging_tracker_callback(IN uint64_t key, IN uint32_t num_regs,
+				       IN void *context)
 {
 	osm_sm_t *sm = context;
-	uint16_t lid;
+	ib_net16_t lid;
 	uint8_t port_num;
 	osm_physp_t *p_physp;
 
@@ -123,20 +110,20 @@ osm_trap_rcv_aging_tracker_callback(IN uint64_t key,
 		/* We got an exit flag - do nothing */
 		return 0;
 
-	lid = cl_ntoh16((uint16_t) ((key & 0x0000FFFF00000000ULL) >> 32));
+	lid = (ib_net16_t) ((key & 0x0000FFFF00000000ULL) >> 32);
 	port_num = (uint8_t) ((key & 0x00FF000000000000ULL) >> 48);
 
 	p_physp = get_physp_by_lid_and_num(sm, lid, port_num);
 	if (!p_physp)
 		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 			"Cannot find port num:%u with lid:%u\n",
-			port_num, lid);
+			port_num, cl_ntoh16(lid));
 	/* make sure the physp is still valid */
 	/* If the health port was false - set it to true */
 	else if (!osm_physp_is_healthy(p_physp)) {
 		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 			"Clearing health bit of port num:%u with lid:%u\n",
-			port_num, lid);
+			port_num, cl_ntoh16(lid));
 
 		/* Clear its health bit */
 		osm_physp_set_health(p_physp, TRUE);
@@ -156,12 +143,12 @@ osm_trap_rcv_aging_tracker_callback(IN uint64_t key,
 #define CRC32_POLYNOMIAL   0xEDB88320L
 
 /* calculate the crc for a given buffer */
-static uint32_t __osm_trap_calc_crc32(void *buffer, uint32_t count)
+static uint32_t trap_calc_crc32(void *buffer, uint32_t count)
 {
 	uint32_t temp1, temp2;
 	uint32_t crc = -1L;
 	unsigned char *p = (unsigned char *)buffer;
-	/* pre - calculated table for faster crc calculation */
+	/* precalculated table for faster crc calculation */
 	static uint32_t crc_table[256];
 	static boolean_t first = TRUE;
 	int i, j;
@@ -191,30 +178,19 @@ static uint32_t __osm_trap_calc_crc32(void *buffer, uint32_t count)
 	return crc;
 }
 
-/********************************************************************
- ********************************************************************/
-
 /* The key is created in the following manner:
    port_num  lid   crc
    \______/ \___/ \___/
      16b     16b   32b
 */
-static void
-__osm_trap_get_key(IN uint16_t lid,
-		   IN uint8_t port_num,
-		   IN ib_mad_notice_attr_t * p_ntci, OUT uint64_t * trap_key)
+static uint64_t trap_get_key(IN uint16_t lid, IN uint8_t port_num,
+			     IN ib_mad_notice_attr_t * p_ntci)
 {
-	uint32_t crc = 0;
-
-	CL_ASSERT(trap_key);
-
-	crc = __osm_trap_calc_crc32(p_ntci, sizeof(ib_mad_notice_attr_t));
-	*trap_key = ((uint64_t) port_num << 48) | ((uint64_t) lid << 32) | crc;
+	uint32_t crc = trap_calc_crc32(p_ntci, sizeof(ib_mad_notice_attr_t));
+	return ((uint64_t) port_num << 48) | ((uint64_t) lid << 32) | crc;
 }
 
-/**********************************************************************
- **********************************************************************/
-static int __print_num_received(IN uint32_t num_received)
+static int print_num_received(IN uint32_t num_received)
 {
 	uint32_t i;
 
@@ -237,7 +213,7 @@ static int disable_port(osm_sm_t *sm, osm_physp_t *p)
 	uint8_t payload[IB_SMP_DATA_SIZE];
 	osm_madw_context_t context;
 	ib_port_info_t *pi = (ib_port_info_t *)payload;
-	int ret;
+	ib_api_status_t status;
 
 	/* select the nearest port to master opensm */
 	if (p->p_remote_physp &&
@@ -247,10 +223,6 @@ static int disable_port(osm_sm_t *sm, osm_physp_t *p)
 	/* If trap 131, might want to disable peer port if available */
 	/* but peer port has been observed not to respond to SM requests */
 
-	OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3810: "
-		"Disabling physical port 0x%016" PRIx64 " num:%u\n",
-		cl_ntoh64(osm_physp_get_port_guid(p)), p->port_num);
-
 	memcpy(payload, &p->port_info, sizeof(ib_port_info_t));
 
 	/* Set port to disabled/down */
@@ -264,22 +236,106 @@ static int disable_port(osm_sm_t *sm, osm_physp_t *p)
 	context.pi_context.light_sweep = FALSE;
 	context.pi_context.active_transition = FALSE;
 
-	ret = osm_req_set(sm, osm_physp_get_dr_path_ptr(p),
-			  payload, sizeof(payload), IB_MAD_ATTR_PORT_INFO,
-			  cl_hton32(osm_physp_get_port_num(p)),
-			  CL_DISP_MSGID_NONE, &context);
-	if (ret)
-		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3811: "
-			"Request to set PortInfo failed\n");
+	CL_PLOCK_ACQUIRE(sm->p_lock);
+	status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p),
+			   payload, sizeof(payload), IB_MAD_ATTR_PORT_INFO,
+			   cl_hton32(osm_physp_get_port_num(p)),
+			   CL_DISP_MSGID_NONE, &context);
+	CL_PLOCK_RELEASE(sm->p_lock);
+	return status;
+}
+
+static void log_trap_info(osm_log_t *p_log, ib_mad_notice_attr_t *p_ntci,
+			  ib_net16_t source_lid, ib_net64_t trans_id)
+{
+	if (!OSM_LOG_IS_ACTIVE_V2(p_log, OSM_LOG_ERROR))
+		return;
+
+	if (ib_notice_is_generic(p_ntci)) {
+		char str[32];
 
-	return ret;
+		if ((p_ntci->g_or_v.generic.trap_num == CL_HTON16(129)) ||
+		    (p_ntci->g_or_v.generic.trap_num == CL_HTON16(130)) ||
+		    (p_ntci->g_or_v.generic.trap_num == CL_HTON16(131)))
+			snprintf(str, sizeof(str), " Port %u",
+				 p_ntci->data_details.ntc_129_131.port_num);
+		else
+			str[0] = '\0';
+
+		OSM_LOG(p_log, OSM_LOG_ERROR,
+			"Received Generic Notice type:%u "
+			"num:%u (%s) Producer:%u (%s) "
+			"from LID:%u%s TID:0x%016" PRIx64 "\n",
+			ib_notice_get_type(p_ntci),
+			cl_ntoh16(p_ntci->g_or_v.generic.trap_num),
+			ib_get_trap_str(p_ntci->g_or_v.generic.trap_num),
+			cl_ntoh32(ib_notice_get_prod_type(p_ntci)),
+			ib_get_producer_type_str(ib_notice_get_prod_type(p_ntci)),
+			cl_hton16(source_lid), str, cl_ntoh64(trans_id));
+		if ((p_ntci->g_or_v.generic.trap_num == CL_HTON16(257)) ||
+		    (p_ntci->g_or_v.generic.trap_num == CL_HTON16(258))) {
+			OSM_LOG(p_log, OSM_LOG_ERROR,
+				"Bad %s_Key:0x%x on SL:%d from "
+				"LID1:%u QP1:0x%x to "
+				"LID2:%u QP2:0x%x\n",
+				(p_ntci->g_or_v.generic.trap_num == CL_HTON16(257)) ? "P" : "Q",
+				cl_ntoh32(p_ntci->data_details.ntc_257_258.key),
+				cl_ntoh32(p_ntci->data_details.ntc_257_258.qp1) >> 28,
+				cl_ntoh16(p_ntci->data_details.ntc_257_258.lid1),
+				cl_ntoh32(p_ntci->data_details.ntc_257_258.qp1) & 0xfff,
+				cl_ntoh16(p_ntci->data_details.ntc_257_258.lid2),
+				cl_ntoh32(p_ntci->data_details.ntc_257_258.qp2));
+		}
+	} else
+		OSM_LOG(p_log, OSM_LOG_ERROR,
+			"Received Vendor Notice type:%u vend:0x%06X "
+			"dev:%u from LID:%u TID:0x%016" PRIx64 "\n",
+			ib_notice_get_type(p_ntci),
+			cl_ntoh32(ib_notice_get_vend_id(p_ntci)),
+			cl_ntoh16(p_ntci->g_or_v.vend.dev_id),
+			cl_ntoh16(source_lid), cl_ntoh64(trans_id));
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_trap_rcv_process_request(IN osm_sm_t * sm,
-			       IN const osm_madw_t * const p_madw)
+static int shutup_noisy_port(osm_sm_t *sm, ib_net16_t lid, uint8_t port,
+			     unsigned num)
+{
+	osm_physp_t *p = get_physp_by_lid_and_num(sm, lid, port);
+	if (!p) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3805: "
+			"Failed to find physical port by lid:%u num:%u\n",
+			cl_ntoh16(lid), port);
+		return -1;
+	}
+
+	/* When babbling port policy option is enabled and
+	   Threshold for disabling a "babbling" port is exceeded */
+	if (sm->p_subn->opt.babbling_port_policy && num >= 250) {
+		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
+			"Disabling noisy physical port 0x%016" PRIx64
+			": lid %u, num %u\n",
+			cl_ntoh64(osm_physp_get_port_guid(p)),
+			cl_ntoh16(lid), port);
+		if (disable_port(sm, p))
+			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3811: "
+				"Failed to disable.\n");
+		else
+			return 1;
+	}
+
+	/* check if the current state of the p_physp is healthy. If
+	   it is - then this is a first change of state. Run a heavy sweep. */
+	if (osm_physp_is_healthy(p)) {
+		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
+			"Marking unhealthy physical port by lid:%u num:%u\n",
+			cl_ntoh16(lid), port);
+		osm_physp_set_health(p, FALSE);
+		return 2;
+	}
+	return 0;
+}
+
+static void trap_rcv_process_request(IN osm_sm_t * sm,
+				     IN const osm_madw_t * p_madw)
 {
 	uint8_t payload[sizeof(ib_mad_notice_attr_t)];
 	ib_smp_t *p_smp;
@@ -289,7 +345,6 @@ __osm_trap_rcv_process_request(IN osm_sm_t * sm,
 	uint64_t trap_key;
 	uint32_t num_received;
 	osm_physp_t *p_physp;
-	cl_ptr_vector_t *p_tbl;
 	osm_port_t *p_port;
 	ib_net16_t source_lid = 0;
 	boolean_t is_gsi = TRUE;
@@ -333,13 +388,13 @@ __osm_trap_rcv_process_request(IN osm_sm_t * sm,
 	 * payload.
 	 */
 
-	memcpy(payload, &(p_smp->data), IB_SMP_DATA_SIZE);
+	memcpy(payload, &p_smp->data, IB_SMP_DATA_SIZE);
 	memcpy(&tmp_madw, p_madw, sizeof(tmp_madw));
 
 	if (is_gsi == FALSE) {
 		/* We are in smi flow */
 		/*
-		 * When we received a TRAP with dlid = 0 - it means it
+		 * When we receive a TRAP with dlid = 0 - it means it
 		 * came from our own node. So we need to fix it.
 		 */
 
@@ -362,59 +417,13 @@ __osm_trap_rcv_process_request(IN osm_sm_t * sm,
 		source_lid = tmp_madw.mad_addr.addr_type.smi.source_lid;
 
 		/* Print some info about the incoming Trap */
-		if (ib_notice_is_generic(p_ntci)) {
-			if ((p_ntci->g_or_v.generic.trap_num == CL_HTON16(129))
-			    || (p_ntci->g_or_v.generic.trap_num ==
-				CL_HTON16(130))
-			    || (p_ntci->g_or_v.generic.trap_num ==
-				CL_HTON16(131)))
-				OSM_LOG(sm->p_log, OSM_LOG_ERROR,
-					"Received Generic Notice type:%u "
-					"num:%u (%s) Producer:%u (%s) "
-					"from LID:%u Port %d TID:0x%016"
-					PRIx64 "\n", ib_notice_get_type(p_ntci),
-					cl_ntoh16(p_ntci->g_or_v.generic.
-						  trap_num),
-					ib_get_trap_str(p_ntci->g_or_v.generic.
-							trap_num),
-					cl_ntoh32(ib_notice_get_prod_type
-						  (p_ntci)),
-					ib_get_producer_type_str
-					(ib_notice_get_prod_type(p_ntci)),
-					cl_hton16(source_lid),
-					p_ntci->data_details.ntc_129_131.
-					port_num, cl_ntoh64(p_smp->trans_id));
-			else
-				OSM_LOG(sm->p_log, OSM_LOG_ERROR,
-					"Received Generic Notice type:%u "
-					"num:%u (%s) Producer:%u (%s) "
-					"from LID:%u TID:0x%016" PRIx64
-					"\n", ib_notice_get_type(p_ntci),
-					cl_ntoh16(p_ntci->g_or_v.generic.
-						  trap_num),
-					ib_get_trap_str(p_ntci->g_or_v.generic.
-							trap_num),
-					cl_ntoh32(ib_notice_get_prod_type
-						  (p_ntci)),
-					ib_get_producer_type_str
-					(ib_notice_get_prod_type(p_ntci)),
-					cl_hton16(source_lid),
-					cl_ntoh64(p_smp->trans_id));
-		} else
-			OSM_LOG(sm->p_log, OSM_LOG_ERROR,
-				"Received Vendor Notice type:%u vend:0x%06X "
-				"dev:%u from LID:%u TID:0x%016" PRIx64 "\n",
-				ib_notice_get_type(p_ntci),
-				cl_ntoh32(ib_notice_get_vend_id(p_ntci)),
-				cl_ntoh16(p_ntci->g_or_v.vend.dev_id),
-				cl_ntoh16(source_lid),
-				cl_ntoh64(p_smp->trans_id));
+		log_trap_info(sm->p_log, p_ntci, source_lid, p_smp->trans_id);
 	}
 
-	osm_dump_notice(sm->p_log, p_ntci, OSM_LOG_VERBOSE);
+	osm_dump_notice_v2(sm->p_log, p_ntci, FILE_ID, OSM_LOG_VERBOSE);
 
-	p_physp = osm_get_physp_by_mad_addr(sm->p_log,
-					    sm->p_subn, &tmp_madw.mad_addr);
+	p_physp = osm_get_physp_by_mad_addr(sm->p_log, sm->p_subn,
+					    &tmp_madw.mad_addr);
 	if (p_physp)
 		p_smp->m_key = p_physp->port_info.m_key;
 	else
@@ -438,9 +447,9 @@ __osm_trap_rcv_process_request(IN osm_sm_t * sm,
 
 	if (is_gsi == FALSE) {
 		if (ib_notice_is_generic(p_ntci) &&
-		    ((p_ntci->g_or_v.generic.trap_num == CL_HTON16(129)) ||
-		     (p_ntci->g_or_v.generic.trap_num == CL_HTON16(130)) ||
-		     (p_ntci->g_or_v.generic.trap_num == CL_HTON16(131)))) {
+		    (p_ntci->g_or_v.generic.trap_num == CL_HTON16(129) ||
+		     p_ntci->g_or_v.generic.trap_num == CL_HTON16(130) ||
+		     p_ntci->g_or_v.generic.trap_num == CL_HTON16(131))) {
 			/* If this is a trap 129, 130, or 131 - then this is a
 			 * trap signaling a change on a physical port.
 			 * Mark the physp_change_trap flag as TRUE.
@@ -448,26 +457,18 @@ __osm_trap_rcv_process_request(IN osm_sm_t * sm,
 			physp_change_trap = TRUE;
 			/* The source_lid should be based on the source_lid from the trap */
 			source_lid = p_ntci->data_details.ntc_129_131.lid;
-		}
-
-		/* If physp_change_trap is TRUE - the key will include the port number.
-		   If not - the port_number in the key will be zero. */
-		if (physp_change_trap == TRUE) {
 			port_num = p_ntci->data_details.ntc_129_131.port_num;
-			__osm_trap_get_key(source_lid, port_num, p_ntci,
-					   &trap_key);
-		} else
-			__osm_trap_get_key(source_lid, 0, p_ntci, &trap_key);
+		}
 
 		/* try to find it in the aging tracker */
-		num_received =
-		    cl_event_wheel_num_regs(&sm->trap_aging_tracker,
-					    trap_key);
+		trap_key = trap_get_key(source_lid, port_num, p_ntci);
+		num_received = cl_event_wheel_num_regs(&sm->trap_aging_tracker,
+						       trap_key);
 
 		/* Now we know how many times it provided this trap */
 		if (num_received > 10) {
-			if (__print_num_received(num_received))
-				OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3804: "
+			if (print_num_received(num_received))
+				OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 					"Received trap %u times consecutively\n",
 					num_received);
 			/*
@@ -475,108 +476,84 @@ __osm_trap_rcv_process_request(IN osm_sm_t * sm,
 			 * we mark it as unhealthy.
 			 */
 			if (physp_change_trap == TRUE) {
-				/* get the port */
-				p_physp = get_physp_by_lid_and_num(sm,
-								   cl_ntoh16
-								   (p_ntci->
-								    data_details.
-								    ntc_129_131.
-								    lid),
-								   port_num);
-
-				if (!p_physp)
-					OSM_LOG(sm->p_log, OSM_LOG_ERROR,
-						"ERR 3805: "
-						"Failed to find physical port by lid:%u num:%u\n",
-						cl_ntoh16(p_ntci->data_details.
-							  ntc_129_131.lid),
-						p_ntci->data_details.
-						ntc_129_131.port_num);
-				else {
-					/* When babbling port policy option is enabled and
-					   Threshold for disabling a "babbling" port is exceeded */
-					if (sm->p_subn->opt.
-					    babbling_port_policy
-					    && num_received >= 250
-					    && disable_port(sm, p_physp) == 0)
-						goto Exit;
-
-					OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-						"Marking unhealthy physical port by lid:%u num:%u\n",
-						cl_ntoh16(p_ntci->data_details.
-							  ntc_129_131.lid),
-						p_ntci->data_details.
-						ntc_129_131.port_num);
-					/* check if the current state of the p_physp is healthy. If
-					   it is - then this is a first change of state. Run a heavy sweep.
-					   if it is not - no need to mark it again - just restart the timer. */
-					if (osm_physp_is_healthy(p_physp)) {
-						osm_physp_set_health(p_physp,
-								     FALSE);
-						/* Make sure we sweep again - force a heavy sweep. */
-						/* The sweep should be done only after the re-registration, or
-						   else we'll be losing track of the timer. */
-						run_heavy_sweep = TRUE;
-					}
-					/* If we are marking the port as unhealthy - we want to
-					   keep this for a longer period of time than the
-					   OSM_DEFAULT_TRAP_SUPRESSION_TIMEOUT. Use the
-					   OSM_DEFAULT_UNHEALTHY_TIMEOUT */
-					event_wheel_timeout =
-					    OSM_DEFAULT_UNHEALTHY_TIMEOUT;
-				}
+				int ret = shutup_noisy_port(sm, source_lid,
+							    port_num,
+							    num_received);
+				if (ret == 1) /* port disabled */
+					goto Exit;
+				else if (ret == 2) /* unhealthy - run sweep */
+					run_heavy_sweep = TRUE;
+				/* in any case increase timeout interval */
+				event_wheel_timeout =
+				    OSM_DEFAULT_UNHEALTHY_TIMEOUT;
 			}
 		}
 
 		/* restart the aging anyway */
-		/* If physp_change_trap is TRUE - then use a callback to unset the
-		   healthy bit. If not - no need to use a callback. */
+		/* If physp_change_trap is TRUE - then use a callback to unset
+		   the healthy bit. If not - no need to use a callback. */
 		if (physp_change_trap == TRUE)
-			cl_event_wheel_reg(&sm->trap_aging_tracker, trap_key, cl_get_time_stamp() + event_wheel_timeout, osm_trap_rcv_aging_tracker_callback,	/* no callback */
-					   sm	/* no context */ );
+			cl_event_wheel_reg(&sm->trap_aging_tracker, trap_key,
+					   cl_get_time_stamp() + event_wheel_timeout,
+					   aging_tracker_callback, sm);
 		else
-			cl_event_wheel_reg(&sm->trap_aging_tracker, trap_key, cl_get_time_stamp() + event_wheel_timeout, NULL,	/* no callback */
-					   NULL	/* no context */ );
+			cl_event_wheel_reg(&sm->trap_aging_tracker, trap_key,
+					   cl_get_time_stamp() + event_wheel_timeout,
+					   NULL, NULL);
 
 		/* If was already registered do nothing more */
 		if (num_received > 10 && run_heavy_sweep == FALSE) {
-			if (__print_num_received(num_received))
+			if (print_num_received(num_received))
 				OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-					"Continuously received this trap %u times. Ignoring\n",
-					num_received);
+					"Ignoring noisy traps.\n");
 			goto Exit;
 		}
 	}
 
 	/* Check for node description update. IB Spec v1.2.1 pg 823 */
-	if ((p_ntci->data_details.ntc_144.local_changes & TRAP_144_MASK_OTHER_LOCAL_CHANGES) &&
-		(p_ntci->data_details.ntc_144.change_flgs & TRAP_144_MASK_NODE_DESCRIPTION_CHANGE)
-		) {
+	if (!ib_notice_is_generic(p_ntci))
+		goto check_sweep;
+	if (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144 &&
+	    p_ntci->data_details.ntc_144.local_changes & TRAP_144_MASK_OTHER_LOCAL_CHANGES &&
+	    p_ntci->data_details.ntc_144.change_flgs & TRAP_144_MASK_NODE_DESCRIPTION_CHANGE) {
 		OSM_LOG(sm->p_log, OSM_LOG_INFO, "Trap 144 Node description update\n");
 
 		if (p_physp) {
 			CL_PLOCK_ACQUIRE(sm->p_lock);
 			osm_req_get_node_desc(sm, p_physp);
 			CL_PLOCK_RELEASE(sm->p_lock);
-		} else {
+			if (!(p_ntci->data_details.ntc_144.change_flgs & ~TRAP_144_MASK_NODE_DESCRIPTION_CHANGE) &&
+			    p_ntci->data_details.ntc_144.new_cap_mask == p_physp->port_info.capability_mask)
+				goto check_report;
+		} else
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR,
 				"ERR 3812: No physical port found for "
 				"trap 144: \"node description update\"\n");
-		}
+		goto check_sweep;
+	} else if (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 145) {
+		if (p_physp)
+			/* this assumes that trap 145 content is not broken? */
+			p_physp->p_node->node_info.sys_guid =
+				p_ntci->data_details.ntc_145.new_sys_guid;
+		else
+			OSM_LOG(sm->p_log, OSM_LOG_ERROR,
+				"ERR 3813: No physical port found for "
+				"trap 145: \"SystemImageGUID update\"\n");
+		goto check_report;
 	}
 
+check_sweep:
 	/* do a sweep if we received a trap */
 	if (sm->p_subn->opt.sweep_on_trap) {
-		/* if this is trap number 128 or run_heavy_sweep is TRUE - update the
-		   force_single_heavy_sweep flag of the subnet.
-		   Sweep also on traps 144/145 - these traps signal a change of a certain
-		   port capability/system image guid.
-		   TODO: In the future we can change this to just getting PortInfo on
-		   this port instead of sweeping the entire subnet. */
+		/* if this is trap number 128 or run_heavy_sweep is TRUE -
+		   update the force_heavy_sweep flag of the subnet.
+		   Sweep also on traps 144 - these traps signal a change of
+		   certain port capabilities.
+		   TODO: In the future this can be changed to just getting
+		   PortInfo on this port instead of sweeping the entire subnet. */
 		if (ib_notice_is_generic(p_ntci) &&
-		    ((cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 128) ||
-		     (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144) ||
-		     (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 145) ||
+		    (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 128 ||
+		     cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144 ||
 		     run_heavy_sweep)) {
 			OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 				"Forcing heavy sweep. Received trap:%u\n",
@@ -593,7 +570,7 @@ __osm_trap_rcv_process_request(IN osm_sm_t * sm,
 	if (physp_change_trap == TRUE)
 		goto Exit;
 
-	/* Add a call to osm_report_notice */
+check_report:
 	/* We are going to report the notice - so need to fix the IssuerGID
 	   accordingly. See IBA 1.2 p.739 or IBA 1.1 p.653 for details. */
 	if (is_gsi) {
@@ -603,27 +580,13 @@ __osm_trap_rcv_process_request(IN osm_sm_t * sm,
 				"Cannot update issuer_gid!\n");
 			goto Exit;
 		}
-		memcpy(&(p_ntci->issuer_gid),
-		       &(tmp_madw.mad_addr.addr_type.gsi.grh_info.src_gid),
+		memcpy(&p_ntci->issuer_gid,
+		       &tmp_madw.mad_addr.addr_type.gsi.grh_info.src_gid,
 		       sizeof(ib_gid_t));
 	} else {
 		/* Need to use the IssuerLID */
-		p_tbl = &sm->p_subn->port_lid_tbl;
-
-		CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000);
-
-		if ((uint16_t) cl_ptr_vector_get_size(p_tbl) <=
-		    cl_ntoh16(source_lid)) {
-			/*  the source lid is out of range */
-			OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-				"source lid is out of range:%u\n",
-				cl_ntoh16(source_lid));
-
-			goto Exit;
-		}
-		p_port = cl_ptr_vector_get(p_tbl, cl_ntoh16(source_lid));
-		if (p_port == 0) {
-			/* We have the lid - but no corresponding port */
+		p_port = osm_get_port_by_lid(sm->p_subn, source_lid);
+		if (!p_port) {
 			OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 				"Cannot find port corresponding to lid:%u\n",
 				cl_ntoh16(source_lid));
@@ -651,31 +614,8 @@ Exit:
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-#if 0
-/**********************************************************************
- CURRENTLY WE ARE NOT CREATING TRAPS - SO THIS CALL IS AN ERROR
-**********************************************************************/
-static void
-__osm_trap_rcv_process_sm(IN osm_sm_t * sm,
-			  IN const osm_remote_sm_t * const p_sm)
-{
-	/* const ib_sm_info_t*        p_smi; */
-
-	OSM_LOG_ENTER(sm->p_log);
-
-	OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3807: "
-		"This function is not supported yet\n");
-
-	OSM_LOG_EXIT(sm->p_log);
-}
-#endif
-
-/**********************************************************************
- CURRENTLY WE ARE NOT CREATING TRAPS - SO THIS CALL IN AN ERROR
-**********************************************************************/
-static void
-__osm_trap_rcv_process_response(IN osm_sm_t * sm,
-				IN const osm_madw_t * const p_madw)
+static void trap_rcv_process_response(IN osm_sm_t * sm,
+				      IN const osm_madw_t * p_madw)
 {
 
 	OSM_LOG_ENTER(sm->p_log);
@@ -686,8 +626,6 @@ __osm_trap_rcv_process_response(IN osm_sm_t * sm,
 	OSM_LOG_EXIT(sm->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osm_trap_rcv_process(IN void *context, IN void *data)
 {
 	osm_sm_t *sm = context;
@@ -706,9 +644,9 @@ void osm_trap_rcv_process(IN void *context, IN void *data)
 	   SM's Trap.
 	 */
 	if (ib_smp_is_response(p_smp))
-		__osm_trap_rcv_process_response(sm, p_madw);
+		trap_rcv_process_response(sm, p_madw);
 	else
-		__osm_trap_rcv_process_request(sm, p_madw);
+		trap_rcv_process_request(sm, p_madw);
 
 	OSM_LOG_EXIT(sm->p_log);
 }
diff --git a/opensm/osm_ucast_cache.c b/opensm/osm_ucast_cache.c
index c89e24d..f0b2346 100644
--- a/opensm/osm_ucast_cache.c
+++ b/opensm/osm_ucast_cache.c
@@ -1,5 +1,6 @@
 /*
- * Copyright (c) 2008      Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2008-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2008-2009 Mellanox Technologies LTD. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -52,6 +53,8 @@
 #include <complib/cl_qmap.h>
 #include <complib/cl_pool.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_UCAST_CACHE_C
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_ucast_mgr.h>
 #include <opensm/osm_ucast_cache.h>
@@ -59,8 +62,6 @@
 #include <opensm/osm_node.h>
 #include <opensm/osm_port.h>
 
-#define CACHE_SW_PORTS 36
-
 typedef struct cache_port {
 	boolean_t is_leaf;
 	uint16_t remote_lid_ho;
@@ -77,34 +78,22 @@ typedef struct cache_switch {
 	cache_port_t ports[0];
 } cache_switch_t;
 
-/**********************************************************************
- **********************************************************************/
-
-static uint16_t __cache_sw_get_base_lid_ho(cache_switch_t * p_sw)
+static uint16_t cache_sw_get_base_lid_ho(cache_switch_t * p_sw)
 {
 	return p_sw->ports[0].remote_lid_ho;
 }
 
-/**********************************************************************
- **********************************************************************/
-
-static boolean_t __cache_sw_is_leaf(cache_switch_t * p_sw)
+static boolean_t cache_sw_is_leaf(cache_switch_t * p_sw)
 {
 	return p_sw->ports[0].is_leaf;
 }
 
-/**********************************************************************
- **********************************************************************/
-
-static void __cache_sw_set_leaf(cache_switch_t * p_sw)
+static void cache_sw_set_leaf(cache_switch_t * p_sw)
 {
 	p_sw->ports[0].is_leaf = TRUE;
 }
 
-/**********************************************************************
- **********************************************************************/
-
-static cache_switch_t *__cache_sw_new(uint16_t lid_ho, unsigned num_ports)
+static cache_switch_t *cache_sw_new(uint16_t lid_ho, unsigned num_ports)
 {
 	cache_switch_t *p_cache_sw = malloc(sizeof(cache_switch_t) +
 					    num_ports * sizeof(cache_port_t));
@@ -123,10 +112,7 @@ static cache_switch_t *__cache_sw_new(uint16_t lid_ho, unsigned num_ports)
 	return p_cache_sw;
 }
 
-/**********************************************************************
- **********************************************************************/
-
-static void __cache_sw_destroy(cache_switch_t * p_sw)
+static void cache_sw_destroy(cache_switch_t * p_sw)
 {
 	if (!p_sw)
 		return;
@@ -138,10 +124,7 @@ static void __cache_sw_destroy(cache_switch_t * p_sw)
 	free(p_sw);
 }
 
-/**********************************************************************
- **********************************************************************/
-
-static cache_switch_t *__cache_get_sw(osm_ucast_mgr_t * p_mgr, uint16_t lid_ho)
+static cache_switch_t *cache_get_sw(osm_ucast_mgr_t * p_mgr, uint16_t lid_ho)
 {
 	cache_switch_t *p_cache_sw = (cache_switch_t *)
 	    cl_qmap_get(&p_mgr->cache_sw_tbl, lid_ho);
@@ -152,10 +135,8 @@ static cache_switch_t *__cache_get_sw(osm_ucast_mgr_t * p_mgr, uint16_t lid_ho)
 	return p_cache_sw;
 }
 
-/**********************************************************************
- **********************************************************************/
-static void __cache_add_sw_link(osm_ucast_mgr_t * p_mgr, osm_physp_t *p,
-				uint16_t remote_lid_ho, boolean_t is_ca)
+static void cache_add_sw_link(osm_ucast_mgr_t * p_mgr, osm_physp_t *p,
+			      uint16_t remote_lid_ho, boolean_t is_ca)
 {
 	cache_switch_t *p_cache_sw;
 	uint16_t lid_ho = cl_ntoh16(osm_node_get_base_lid(p->p_node, 0));
@@ -169,9 +150,9 @@ static void __cache_add_sw_link(osm_ucast_mgr_t * p_mgr, osm_physp_t *p,
 		"Caching switch port: lid %u [port %u] -> lid %u (%s)\n",
 		lid_ho, p->port_num, remote_lid_ho, (is_ca) ? "CA/RTR" : "SW");
 
-	p_cache_sw = __cache_get_sw(p_mgr, lid_ho);
+	p_cache_sw = cache_get_sw(p_mgr, lid_ho);
 	if (!p_cache_sw) {
-		p_cache_sw = __cache_sw_new(lid_ho, p->p_node->sw->num_ports);
+		p_cache_sw = cache_sw_new(lid_ho, p->p_node->sw->num_ports);
 		if (!p_cache_sw) {
 			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
 				"ERR AD01: Out of memory - cache is invalid\n");
@@ -190,7 +171,7 @@ static void __cache_add_sw_link(osm_ucast_mgr_t * p_mgr, osm_physp_t *p,
 	}
 
 	if (is_ca)
-		__cache_sw_set_leaf(p_cache_sw);
+		cache_sw_set_leaf(p_cache_sw);
 
 	if (p_cache_sw->ports[p->port_num].remote_lid_ho == 0) {
 		/* cache this link only if it hasn't been already cached */
@@ -201,10 +182,7 @@ Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-
-static void __cache_cleanup_switches(osm_ucast_mgr_t * p_mgr)
+static void cache_cleanup_switches(osm_ucast_mgr_t * p_mgr)
 {
 	cache_switch_t *p_sw;
 	cache_switch_t *p_next_sw;
@@ -228,17 +206,14 @@ static void __cache_cleanup_switches(osm_ucast_mgr_t * p_mgr)
 		if (!found_port) {
 			cl_qmap_remove_item(&p_mgr->cache_sw_tbl,
 					    &p_sw->map_item);
-			__cache_sw_destroy(p_sw);
+			cache_sw_destroy(p_sw);
 		}
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-
 static void
-__cache_check_link_change(osm_ucast_mgr_t * p_mgr,
-			  osm_physp_t * p_physp_1, osm_physp_t * p_physp_2)
+cache_check_link_change(osm_ucast_mgr_t * p_mgr,
+			osm_physp_t * p_physp_1, osm_physp_t * p_physp_2)
 {
 	OSM_LOG_ENTER(p_mgr->p_log);
 	CL_ASSERT(p_physp_1 && p_physp_2);
@@ -256,8 +231,8 @@ __cache_check_link_change(osm_ucast_mgr_t * p_mgr,
 	     p_physp_1->p_remote_physp->p_remote_physp) ||
 	    (p_physp_2->p_remote_physp &&
 	     p_physp_2->p_remote_physp->p_remote_physp)) {
-		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-			"Link location change discovered - cache is invalid\n");
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+			"Link location change discovered\n");
 		osm_ucast_cache_invalidate(p_mgr);
 		goto Exit;
 	}
@@ -265,12 +240,9 @@ Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-
-static void __cache_remove_port(osm_ucast_mgr_t * p_mgr, uint16_t lid_ho,
-				uint8_t port_num, uint16_t remote_lid_ho,
-				boolean_t is_ca)
+static void cache_remove_port(osm_ucast_mgr_t * p_mgr, uint16_t lid_ho,
+			      uint8_t port_num, uint16_t remote_lid_ho,
+			      boolean_t is_ca)
 {
 	cache_switch_t *p_cache_sw;
 
@@ -279,29 +251,28 @@ static void __cache_remove_port(osm_ucast_mgr_t * p_mgr, uint16_t lid_ho,
 	if (!p_mgr->cache_valid)
 		goto Exit;
 
-	p_cache_sw = __cache_get_sw(p_mgr, lid_ho);
+	p_cache_sw = cache_get_sw(p_mgr, lid_ho);
 	if (!p_cache_sw) {
-		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-			"Found uncached switch/link (lid %u, port %u) - "
-			"cache is invalid\n", lid_ho, port_num);
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+			"Found uncached switch/link (lid %u, port %u)\n",
+			lid_ho, port_num);
 		osm_ucast_cache_invalidate(p_mgr);
 		goto Exit;
 	}
 
 	if (port_num >= p_cache_sw->num_ports ||
 	    !p_cache_sw->ports[port_num].remote_lid_ho) {
-		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-			"Found uncached switch link (lid %u, port %u) - "
-			"cache is invalid\n", lid_ho, port_num);
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+			"Found uncached switch link (lid %u, port %u)\n",
+			lid_ho, port_num);
 		osm_ucast_cache_invalidate(p_mgr);
 		goto Exit;
 	}
 
 	if (p_cache_sw->ports[port_num].remote_lid_ho != remote_lid_ho) {
-		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 			"Remote lid change on switch lid %u, port %u "
-			"(was %u, now %u) - cache is invalid\n",
-			lid_ho, port_num,
+			"(was %u, now %u)\n", lid_ho, port_num,
 			p_cache_sw->ports[port_num].remote_lid_ho,
 			remote_lid_ho);
 		osm_ucast_cache_invalidate(p_mgr);
@@ -310,9 +281,9 @@ static void __cache_remove_port(osm_ucast_mgr_t * p_mgr, uint16_t lid_ho,
 
 	if ((p_cache_sw->ports[port_num].is_leaf && !is_ca) ||
 	    (!p_cache_sw->ports[port_num].is_leaf && is_ca)) {
-		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-			"Remote node type change on switch lid %u, port %u - "
-			"cache is invalid\n", lid_ho, port_num);
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+			"Remote node type change on switch lid %u, port %u\n",
+			lid_ho, port_num);
 		osm_ucast_cache_invalidate(p_mgr);
 		goto Exit;
 	}
@@ -327,14 +298,11 @@ static void __cache_remove_port(osm_ucast_mgr_t * p_mgr, uint16_t lid_ho,
 	p_cache_sw->ports[port_num].is_leaf = FALSE;
 Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
-}				/* __cache_remove_port() */
-
-/**********************************************************************
- **********************************************************************/
+}				/* cache_remove_port() */
 
 static void
-__cache_restore_ucast_info(osm_ucast_mgr_t * p_mgr,
-			   cache_switch_t * p_cache_sw, osm_switch_t * p_sw)
+cache_restore_ucast_info(osm_ucast_mgr_t * p_mgr,
+			 cache_switch_t * p_cache_sw, osm_switch_t * p_sw)
 {
 	if (!p_mgr->cache_valid)
 		return;
@@ -357,19 +325,18 @@ __cache_restore_ucast_info(osm_ucast_mgr_t * p_mgr,
 		free(p_sw->hops);
 	p_sw->hops = p_cache_sw->hops;
 	p_cache_sw->hops = NULL;
-}
 
-/**********************************************************************
- **********************************************************************/
+	p_sw->need_update = 2;
+}
 
-static void __ucast_cache_dump(osm_ucast_mgr_t * p_mgr)
+static void ucast_cache_dump(osm_ucast_mgr_t * p_mgr)
 {
 	cache_switch_t *p_sw;
 	unsigned i;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 
-	if (!osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG))
+	if (!OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log, OSM_LOG_DEBUG))
 		goto Exit;
 
 	OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
@@ -380,8 +347,8 @@ static void __ucast_cache_dump(osm_ucast_mgr_t * p_mgr)
 
 		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 			"\t Switch lid %u %s%s\n",
-			__cache_sw_get_base_lid_ho(p_sw),
-			(__cache_sw_is_leaf(p_sw)) ? "[leaf switch] " : "",
+			cache_sw_get_base_lid_ho(p_sw),
+			(cache_sw_is_leaf(p_sw)) ? "[leaf switch] " : "",
 			(p_sw->dropped) ? "[whole switch missing]" : "");
 
 		for (i = 1; i < p_sw->num_ports; i++)
@@ -397,16 +364,12 @@ Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-
 void osm_ucast_cache_invalidate(osm_ucast_mgr_t * p_mgr)
 {
 	cache_switch_t *p_sw;
 	cache_switch_t *p_next_sw;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
-	OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "Invalidating unicast cache\n");
 
 	if (!p_mgr->cache_valid)
 		goto Exit;
@@ -418,16 +381,15 @@ void osm_ucast_cache_invalidate(osm_ucast_mgr_t * p_mgr)
 	       (cache_switch_t *) cl_qmap_end(&p_mgr->cache_sw_tbl)) {
 		p_sw = p_next_sw;
 		p_next_sw = (cache_switch_t *) cl_qmap_next(&p_sw->map_item);
-		__cache_sw_destroy(p_sw);
+		cache_sw_destroy(p_sw);
 	}
 	cl_qmap_remove_all(&p_mgr->cache_sw_tbl);
+
+	OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE, "Unicast Cache invalidated\n");
 Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-
 static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 {
 	cache_switch_t *p_cache_sw;
@@ -469,7 +431,7 @@ static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 		p_node = p_sw->p_node;
 
 		lid_ho = cl_ntoh16(osm_node_get_base_lid(p_node, 0));
-		p_cache_sw = __cache_get_sw(p_mgr, lid_ho);
+		p_cache_sw = cache_get_sw(p_mgr, lid_ho);
 
 		max_ports = osm_node_get_num_physp(p_node);
 
@@ -490,11 +452,11 @@ static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 			 */
 			if (p_cache_sw &&
 			    !p_cache_sw->dropped &&
-			    !__cache_sw_is_leaf(p_cache_sw) &&
+			    !cache_sw_is_leaf(p_cache_sw) &&
 			    p_physp->p_remote_physp->p_node &&
 			    osm_node_get_type(p_physp->p_remote_physp->
 					      p_node) != IB_NODE_TYPE_SWITCH)
-				__cache_sw_set_leaf(p_cache_sw);
+				cache_sw_set_leaf(p_cache_sw);
 
 			if (!p_physp->need_update)
 				continue;
@@ -563,9 +525,9 @@ static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 				 *    then its port should have is_new flag on.
 				 */
 				if (p_sw->need_update == 2) {
-					OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-						"New switch found (lid %u) - "
-						"cache is invalid\n", lid_ho);
+					OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+						"New switch found (lid %u)\n",
+						lid_ho);
 					osm_ucast_cache_invalidate(p_mgr);
 					goto Exit;
 				}
@@ -580,9 +542,8 @@ static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 						   additional link that it
 						   didn't have before */
 						OSM_LOG(p_mgr->p_log,
-							OSM_LOG_INFO,
-							"New switch/link found (lid %u) - "
-							"cache is invalid\n",
+							OSM_LOG_DEBUG,
+							"New switch/link found (lid %u)\n",
 							remote_lid_ho);
 						osm_ucast_cache_invalidate
 						    (p_mgr);
@@ -600,9 +561,8 @@ static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 								 (p_remote_physp));
 					if (p_remote_port->is_new) {
 						OSM_LOG(p_mgr->p_log,
-							OSM_LOG_INFO,
-							"New CA/RTR found (lid %u) - "
-							"cache is invalid\n",
+							OSM_LOG_DEBUG,
+							"New CA/RTR found (lid %u)\n",
 							remote_lid_ho);
 						osm_ucast_cache_invalidate
 						    (p_mgr);
@@ -626,9 +586,8 @@ static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 				     remote_node_type == IB_NODE_TYPE_SWITCH) ||
 				    (!p_cache_sw->ports[port_num].is_leaf &&
 				     remote_node_type != IB_NODE_TYPE_SWITCH)) {
-					OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-						"Remote node type change on switch lid %u, port %u - "
-						"cache is invalid\n",
+					OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+						"Remote node type change on switch lid %u, port %u\n",
 						lid_ho, port_num);
 					osm_ucast_cache_invalidate(p_mgr);
 					goto Exit;
@@ -636,9 +595,9 @@ static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 
 				if (p_cache_sw->ports[port_num].remote_lid_ho !=
 				    remote_lid_ho) {
-					OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+					OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 						"Remote lid change on switch lid %u, port %u"
-						"(was %u, now %u) - cache is invalid\n",
+						"(was %u, now %u)\n",
 						lid_ho, port_num,
 						p_cache_sw->ports[port_num].
 						remote_lid_ho, remote_lid_ho);
@@ -657,9 +616,9 @@ static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 				p_cache_sw->ports[port_num].remote_lid_ho = 0;
 				p_cache_sw->ports[port_num].is_leaf = FALSE;
 				if (p_cache_sw->dropped) {
-					__cache_restore_ucast_info(p_mgr,
-								   p_cache_sw,
-								   p_sw);
+					cache_restore_ucast_info(p_mgr,
+								 p_cache_sw,
+								 p_sw);
 					p_cache_sw->dropped = FALSE;
 				}
 
@@ -672,7 +631,7 @@ static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 
 	/* Remove all the cached switches that
 	   have all their ports restored */
-	__cache_cleanup_switches(p_mgr);
+	cache_cleanup_switches(p_mgr);
 
 	/*
 	 * Done scanning all the physical switch ports in the subnet.
@@ -695,11 +654,10 @@ static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 	     (cache_switch_t *) cl_qmap_next(&p_cache_sw->map_item)) {
 
 		if (p_cache_sw->dropped) {
-			if (!__cache_sw_is_leaf(p_cache_sw)) {
-				OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-					"Missing non-leaf switch (lid %u) - "
-					"cache is invalid\n",
-					__cache_sw_get_base_lid_ho(p_cache_sw));
+			if (!cache_sw_is_leaf(p_cache_sw)) {
+				OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+					"Missing non-leaf switch (lid %u)\n",
+					cache_sw_get_base_lid_ho(p_cache_sw));
 				osm_ucast_cache_invalidate(p_mgr);
 				goto Exit;
 			}
@@ -707,7 +665,7 @@ static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 				"Missing leaf switch (lid %u) - "
 				"continuing validation\n",
-				__cache_sw_get_base_lid_ho(p_cache_sw));
+				cache_sw_get_base_lid_ho(p_cache_sw));
 			continue;
 		}
 
@@ -716,35 +674,33 @@ static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 				continue;
 
 			if (p_cache_sw->ports[port_num].is_leaf) {
-				CL_ASSERT(__cache_sw_is_leaf(p_cache_sw));
+				CL_ASSERT(cache_sw_is_leaf(p_cache_sw));
 				OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 					"Switch lid %u, port %u: missing link to CA/RTR - "
 					"continuing validation\n",
-					__cache_sw_get_base_lid_ho(p_cache_sw),
+					cache_sw_get_base_lid_ho(p_cache_sw),
 					port_num);
 				continue;
 			}
 
-			p_remote_cache_sw = __cache_get_sw(p_mgr,
-							   p_cache_sw->
-							   ports[port_num].
-							   remote_lid_ho);
+			p_remote_cache_sw = cache_get_sw(p_mgr,
+							 p_cache_sw->
+							 ports[port_num].
+							 remote_lid_ho);
 
 			if (!p_remote_cache_sw || !p_remote_cache_sw->dropped) {
-				OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-					"Switch lid %u, port %u: missing link to existing switch - "
-					"cache is invalid\n",
-					__cache_sw_get_base_lid_ho(p_cache_sw),
+				OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+					"Switch lid %u, port %u: missing link to existing switch\n",
+					cache_sw_get_base_lid_ho(p_cache_sw),
 					port_num);
 				osm_ucast_cache_invalidate(p_mgr);
 				goto Exit;
 			}
 
-			if (!__cache_sw_is_leaf(p_remote_cache_sw)) {
-				OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-					"Switch lid %u, port %u: missing link to non-leaf switch - "
-					"cache is invalid\n",
-					__cache_sw_get_base_lid_ho(p_cache_sw),
+			if (!cache_sw_is_leaf(p_remote_cache_sw)) {
+				OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+					"Switch lid %u, port %u: missing link to non-leaf switch\n",
+					cache_sw_get_base_lid_ho(p_cache_sw),
 					port_num);
 				osm_ucast_cache_invalidate(p_mgr);
 				goto Exit;
@@ -759,12 +715,11 @@ static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 			 * that use leaf switches to get from switch to switch
 			 * and not just to get to the CAs behind the leaf switch.
 			 */
-			if (__cache_sw_is_leaf(p_cache_sw) &&
-			    __cache_sw_is_leaf(p_remote_cache_sw)) {
-				OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-					"Switch lid %u, port %u: missing leaf-2-leaf link - "
-					"cache is invalid\n",
-					__cache_sw_get_base_lid_ho(p_cache_sw),
+			if (cache_sw_is_leaf(p_cache_sw) &&
+			    cache_sw_is_leaf(p_remote_cache_sw)) {
+				OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+					"Switch lid %u, port %u: missing leaf-2-leaf link\n",
+					cache_sw_get_base_lid_ho(p_cache_sw),
 					port_num);
 				osm_ucast_cache_invalidate(p_mgr);
 				goto Exit;
@@ -773,20 +728,17 @@ static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 				"Switch lid %u, port %u: missing remote leaf switch - "
 				"continuing validation\n",
-				__cache_sw_get_base_lid_ho(p_cache_sw),
+				cache_sw_get_base_lid_ho(p_cache_sw),
 				port_num);
 		}
 	}
 
 	OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "Unicast cache is valid\n");
-	__ucast_cache_dump(p_mgr);
+	ucast_cache_dump(p_mgr);
 Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
 }				/* osm_ucast_cache_validate() */
 
-/**********************************************************************
- **********************************************************************/
-
 void osm_ucast_cache_check_new_link(osm_ucast_mgr_t * p_mgr,
 				    osm_node_t * p_node_1, uint8_t port_num_1,
 				    osm_node_t * p_node_2, uint8_t port_num_2)
@@ -799,17 +751,16 @@ void osm_ucast_cache_check_new_link(osm_ucast_mgr_t * p_mgr,
 	if (!p_mgr->cache_valid)
 		goto Exit;
 
-	__cache_check_link_change(p_mgr,
-				  osm_node_get_physp_ptr(p_node_1, port_num_1),
-				  osm_node_get_physp_ptr(p_node_2, port_num_2));
+	cache_check_link_change(p_mgr,
+				osm_node_get_physp_ptr(p_node_1, port_num_1),
+				osm_node_get_physp_ptr(p_node_2, port_num_2));
 
 	if (!p_mgr->cache_valid)
 		goto Exit;
 
 	if (osm_node_get_type(p_node_1) != IB_NODE_TYPE_SWITCH &&
 	    osm_node_get_type(p_node_2) != IB_NODE_TYPE_SWITCH) {
-		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-			"Found CA/RTR-2-CA/RTR link - cache is invalid\n");
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "Found CA-2-CA link\n");
 		osm_ucast_cache_invalidate(p_mgr);
 		goto Exit;
 	}
@@ -845,23 +796,20 @@ void osm_ucast_cache_check_new_link(osm_ucast_mgr_t * p_mgr,
 		goto Exit;
 	}
 
-	__cache_remove_port(p_mgr, lid_ho_1, port_num_1, lid_ho_2,
-			    (osm_node_get_type(p_node_2) !=
-			     IB_NODE_TYPE_SWITCH));
+	cache_remove_port(p_mgr, lid_ho_1, port_num_1, lid_ho_2,
+			  (osm_node_get_type(p_node_2) !=
+			  IB_NODE_TYPE_SWITCH));
 
 	/* if node_2 is a switch, the link should be cleaned from its cache */
 
 	if (osm_node_get_type(p_node_2) == IB_NODE_TYPE_SWITCH)
-		__cache_remove_port(p_mgr, lid_ho_2,
-				    port_num_2, lid_ho_1, FALSE);
+		cache_remove_port(p_mgr, lid_ho_2,
+				  port_num_2, lid_ho_1, FALSE);
 
 Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
 }				/* osm_ucast_cache_check_new_link() */
 
-/**********************************************************************
- **********************************************************************/
-
 void osm_ucast_cache_add_link(osm_ucast_mgr_t * p_mgr,
 			      osm_physp_t * p_physp1, osm_physp_t * p_physp2)
 {
@@ -875,8 +823,7 @@ void osm_ucast_cache_add_link(osm_ucast_mgr_t * p_mgr,
 
 	if (osm_node_get_type(p_node_1) != IB_NODE_TYPE_SWITCH &&
 	    osm_node_get_type(p_node_2) != IB_NODE_TYPE_SWITCH) {
-		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-			"Dropping CA-2-CA link - cache invalid\n");
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "Dropping CA-2-CA link\n");
 		osm_ucast_cache_invalidate(p_mgr);
 		goto Exit;
 	}
@@ -924,22 +871,19 @@ void osm_ucast_cache_add_link(osm_ucast_mgr_t * p_mgr,
 		lid_ho_2 = cl_ntoh16(osm_node_get_base_lid(p_node_2, 0));
 
 		/* lost switch-2-switch link - cache both sides */
-		__cache_add_sw_link(p_mgr, p_physp1, lid_ho_2, FALSE);
-		__cache_add_sw_link(p_mgr, p_physp2, lid_ho_1, FALSE);
+		cache_add_sw_link(p_mgr, p_physp1, lid_ho_2, FALSE);
+		cache_add_sw_link(p_mgr, p_physp2, lid_ho_1, FALSE);
 	} else {
 		lid_ho_2 = cl_ntoh16(osm_physp_get_base_lid(p_physp2));
 
 		/* lost link to CA/RTR - cache only switch side */
-		__cache_add_sw_link(p_mgr, p_physp1, lid_ho_2, TRUE);
+		cache_add_sw_link(p_mgr, p_physp1, lid_ho_2, TRUE);
 	}
 
 Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
 }				/* osm_ucast_cache_add_link() */
 
-/**********************************************************************
- **********************************************************************/
-
 void osm_ucast_cache_add_node(osm_ucast_mgr_t * p_mgr, osm_node_t * p_node)
 {
 	uint16_t lid_ho;
@@ -957,6 +901,14 @@ void osm_ucast_cache_add_node(osm_ucast_mgr_t * p_mgr, osm_node_t * p_node)
 
 		lid_ho = cl_ntoh16(osm_node_get_base_lid(p_node, 0));
 
+		if (!lid_ho) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE,
+				"Skip caching. Switch dropped before "
+				"it gets a valid lid.\n");
+			osm_ucast_cache_invalidate(p_mgr);
+			goto Exit;
+		}
+
 		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 			"Caching dropped switch lid %u\n", lid_ho);
 
@@ -989,13 +941,12 @@ void osm_ucast_cache_add_node(osm_ucast_mgr_t * p_mgr, osm_node_t * p_node)
 		 * and cache can't handle it.
 		 */
 
-		p_cache_sw = __cache_get_sw(p_mgr, lid_ho);
-		CL_ASSERT(p_cache_sw);
+		p_cache_sw = cache_get_sw(p_mgr, lid_ho);
 
-		if (!__cache_sw_is_leaf(p_cache_sw)) {
-			OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-				"Dropped non-leaf switch (lid %u) - "
-				"cache is invalid\n", lid_ho);
+		/* p_cache_sw could be NULL if it has no remote phys ports */
+		if (!p_cache_sw || !cache_sw_is_leaf(p_cache_sw)) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+				"Dropped non-leaf switch (lid %u)\n", lid_ho);
 			osm_ucast_cache_invalidate(p_mgr);
 			goto Exit;
 		}
@@ -1003,9 +954,8 @@ void osm_ucast_cache_add_node(osm_ucast_mgr_t * p_mgr, osm_node_t * p_node)
 		p_cache_sw->dropped = TRUE;
 
 		if (!p_node->sw->num_hops || !p_node->sw->hops) {
-			OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-				"No LID matrices for switch lid %u - "
-				"cache is invalid\n", lid_ho);
+			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+				"No LID matrices for switch lid %u\n", lid_ho);
 			osm_ucast_cache_invalidate(p_mgr);
 			goto Exit;
 		}
@@ -1028,6 +978,7 @@ void osm_ucast_cache_add_node(osm_ucast_mgr_t * p_mgr, osm_node_t * p_node)
 			/* no LFT buffer, so we use the switch's LFT */
 			p_cache_sw->lft = p_node->sw->lft;
 			p_node->sw->lft = NULL;
+			p_node->sw->lft_size = 0;
 		}
 		p_cache_sw->max_lid_ho = p_node->sw->max_lid_ho;
 	} else {
@@ -1052,14 +1003,12 @@ Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
 }				/* osm_ucast_cache_add_node() */
 
-/**********************************************************************
- **********************************************************************/
-
 int osm_ucast_cache_process(osm_ucast_mgr_t * p_mgr)
 {
 	cl_qmap_t *tbl = &p_mgr->p_subn->sw_guid_tbl;
 	cl_map_item_t *item;
 	osm_switch_t *p_sw;
+	uint16_t lft_size;
 
 	if (!p_mgr->p_subn->opt.use_ucast_cache)
 		return 1;
@@ -1075,21 +1024,24 @@ int osm_ucast_cache_process(osm_ucast_mgr_t * p_mgr)
 	     item = cl_qmap_next(item)) {
 		p_sw = (osm_switch_t *) item;
 
-		if (p_sw->need_update && !p_sw->new_lft) {
-			/* no new routing was recently calculated for this
-			   switch, but the LFT needs to be updated anyway */
-			p_sw->new_lft = p_sw->lft;
-			p_sw->lft = malloc(IB_LID_UCAST_END_HO + 1);
+		if (p_sw->need_update) {
+			if (!p_sw->new_lft)
+				/* no new routing was recently calculated for this
+				   switch, but the LFT needs to be updated anyway */
+				p_sw->new_lft = p_sw->lft;
+
+			lft_size = (p_sw->max_lid_ho / IB_SMP_DATA_SIZE + 1)
+				   * IB_SMP_DATA_SIZE;
+			p_sw->lft = malloc(lft_size);
 			if (!p_sw->lft)
 				return IB_INSUFFICIENT_MEMORY;
-			memset(p_sw->lft, OSM_NO_PATH, IB_LID_UCAST_END_HO + 1);
+			p_sw->lft_size = lft_size;
+			memset(p_sw->lft, OSM_NO_PATH, p_sw->lft_size);
 		}
 
-		osm_ucast_mgr_set_fwd_table(p_mgr, p_sw);
 	}
 
+	osm_ucast_mgr_set_fwd_tables(p_mgr);
+
 	return 0;
 }
-
-/**********************************************************************
- **********************************************************************/
diff --git a/opensm/osm_ucast_dfsssp.c b/opensm/osm_ucast_dfsssp.c
new file mode 100644
index 0000000..d6d65b1
--- /dev/null
+++ b/opensm/osm_ucast_dfsssp.c
@@ -0,0 +1,2188 @@
+/*
+ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009-2011 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+/*
+ * Abstract:
+ *    Implementation of OpenSM (deadlock-free) single-source-shortest-path routing
+ *    (with dijkstra algorithm)
+ */
+
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif				/* HAVE_CONFIG_H */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_UCAST_DFSSSP_C
+#include <opensm/osm_ucast_mgr.h>
+#include <opensm/osm_opensm.h>
+#include <opensm/osm_node.h>
+
+/* "infinity" for dijkstra */
+#define INF      0x7FFFFFFF
+
+enum {
+	UNDISCOVERED = 0,
+	DISCOVERED
+};
+
+enum {
+	UNKNOWN = 0,
+	GRAY,
+	BLACK,
+};
+
+typedef struct link {
+	uint64_t guid;		/* guid of the neighbor behind the link */
+	uint32_t from;		/* base_index in the adjazenz list (start of the link) */
+	uint8_t from_port;	/* port on the base_side (needed for weight update to identify the correct link for multigraphs) */
+	uint32_t to;		/* index of the neighbor in the adjazenz list (end of the link) */
+	uint8_t to_port;	/* port on the side of the neighbor (needed for the LFT) */
+	uint64_t weight;	/* link weight */
+	struct link *next;
+} link_t;
+
+typedef struct vertex {
+	/* informations of the fabric */
+	uint64_t guid;
+	uint16_t lid;		/* for lft filling */
+	uint32_t num_hca;	/* numbers of Hca/LIDs on the switch, for weight calculation */
+	link_t *links;
+	uint8_t hops;
+	/* for dijkstra routing */
+	link_t *used_link;	/* link between the vertex discovered before and this vertex */
+	uint64_t distance;	/* distance from source to this vertex */
+	uint8_t state;
+	/* for the binary heap */
+	uint32_t heap_id;
+	/* for LFT writing and debug */
+	osm_switch_t *sw;	/* selfpointer */
+} vertex_t;
+
+typedef struct binary_heap {
+	uint32_t size;		/* size of the heap */
+	vertex_t **nodes;	/* array with pointers to elements of the adj_list */
+} binary_heap_t;
+
+typedef struct vltable {
+	uint64_t num_lids;	/* size of the lids array */
+	uint16_t *lids;		/* sorted array of all lids in the subnet */
+	uint8_t *vls;		/* matrix form assignment lid X lid -> virtual lane */
+} vltable_t;
+
+typedef struct cdg_link {
+	struct cdg_node *node;
+	uint32_t num_pairs;	/* number of src->dest pairs incremented in path adding step */
+	uint32_t max_len;	/* length of the srcdest array */
+	uint32_t removed;	/* number of pairs removed in path deletion step */
+	uint32_t *srcdest_pairs;
+	struct cdg_link *next;
+} cdg_link_t;
+
+/* struct for a node of a binary tree with additional parent pointer */
+typedef struct cdg_node {
+	uint64_t channelID;	/* unique key consist of src lid + port + dest lid + port */
+	cdg_link_t *linklist;	/* edges to adjazent nodes */
+	uint8_t status;		/* node status in cycle search to avoid recursive function */
+	uint8_t visited;	/* needed to traverse the binary tree */
+	struct cdg_node *pre;	/* to save the path in cycle detection algorithm */
+	struct cdg_node *left, *right, *parent;
+} cdg_node_t;
+
+typedef struct dfsssp_context {
+	osm_routing_engine_type_t routing_type;
+	osm_ucast_mgr_t *p_mgr;
+	vertex_t *adj_list;
+	uint32_t adj_list_size;
+	vltable_t *srcdest2vl_table;
+} dfsssp_context_t;
+
+/**************** set initial values for structs **********************
+ **********************************************************************/
+static inline void set_default_link(link_t * link)
+{
+	link->guid = 0;
+	link->from = 0;
+	link->from_port = 0;
+	link->to = 0;
+	link->to_port = 0;
+	link->weight = 0;
+	link->next = NULL;
+}
+
+static inline void set_default_vertex(vertex_t * vertex)
+{
+	vertex->guid = 0;
+	vertex->lid = 0;
+	vertex->num_hca = 0;
+	vertex->links = NULL;
+	vertex->hops = 0;
+	vertex->used_link = NULL;
+	vertex->distance = 0;
+	vertex->state = UNDISCOVERED;
+	vertex->heap_id = 0;
+	vertex->sw = NULL;
+}
+
+static inline void set_default_cdg_node(cdg_node_t * node)
+{
+	node->channelID = 0;
+	node->linklist = NULL;
+	node->status = UNKNOWN;
+	node->visited = 0;
+	node->pre = NULL;
+	node->left = NULL;
+	node->right = NULL;
+	node->parent = NULL;
+}
+
+/**********************************************************************
+ **********************************************************************/
+
+/************ helper functions for heap in dijkstra *******************
+ **********************************************************************/
+/* returns true if element 1 is smaller than element 2 */
+static inline uint32_t heap_smaller(binary_heap_t * heap, uint32_t i,
+				    uint32_t j)
+{
+	return (heap->nodes[i]->distance < heap->nodes[j]->distance) ? 1 : 0;
+}
+
+/* swap two elements */
+static void heap_exchange(binary_heap_t * heap, uint32_t i, uint32_t j)
+{
+	uint32_t tmp_heap_id = 0;
+	vertex_t *tmp_node = NULL;
+
+	/* 1. swap the heap_id */
+	tmp_heap_id = heap->nodes[i]->heap_id;
+	heap->nodes[i]->heap_id = heap->nodes[j]->heap_id;
+	heap->nodes[j]->heap_id = tmp_heap_id;
+	/* 2. swap pointers */
+	tmp_node = heap->nodes[i];
+	heap->nodes[i] = heap->nodes[j];
+	heap->nodes[j] = tmp_node;
+}
+
+/* changes position of element with parent until children are bigger */
+static uint32_t heap_up(binary_heap_t * heap, uint32_t i)
+{
+	uint32_t curr = i, father = 0;
+
+	if (curr > 0) {
+		father = (curr - 1) >> 1;
+		while (heap_smaller(heap, curr, father)) {
+			heap_exchange(heap, curr, father);
+			/* try to go up when we arent already root */
+			curr = father;
+			if (curr > 0)
+				father = (curr - 1) >> 1;
+		}
+	}
+
+	return curr;
+}
+
+/* changes position of element with children until parent is smaller */
+static uint32_t heap_down(binary_heap_t * heap, uint32_t i)
+{
+	uint32_t curr = i;
+	uint32_t son1 = 0, son2 = 0, smaller_son = 0;
+	uint32_t exchanged = 0;
+
+	do {
+		son1 = ((curr + 1) << 1) - 1;
+		son2 = (curr + 1) << 1;
+		exchanged = 0;
+
+		/* exchange with smaller son */
+		if (son1 < heap->size && son2 < heap->size) {
+			if (heap_smaller(heap, son1, son2))
+				smaller_son = son1;
+			else
+				smaller_son = son2;
+		} else if (son1 < heap->size) {
+			/* only one son */
+			smaller_son = son1;
+		} else {
+			/* finished */
+			break;
+		}
+
+		/* only exchange when smaller */
+		if (heap_smaller(heap, smaller_son, curr)) {
+			heap_exchange(heap, curr, smaller_son);
+			exchanged = 1;
+			curr = smaller_son;
+		}
+	} while (exchanged);
+
+	return curr;
+}
+
+/* reheapify element */
+static inline void heap_heapify(binary_heap_t * heap, uint32_t i)
+{
+	heap_down(heap, heap_up(heap, i));
+}
+
+/* creates heap for graph */
+static int heap_create(vertex_t * adj_list, uint32_t adj_list_size,
+		       binary_heap_t ** binheap)
+{
+	binary_heap_t *heap = NULL;
+	uint32_t i = 0;
+
+	/* allocate the memory for the heap object */
+	heap = (binary_heap_t *) malloc(sizeof(binary_heap_t));
+	if (!heap)
+		return 1;
+
+	/* the heap size is equivalent to the size of the adj_list */
+	heap->size = adj_list_size;
+
+	/* allocate the pointer array, fill with the pointers to the elements of the adj_list and set the initial heap_id */
+	heap->nodes = (vertex_t **) malloc(heap->size * sizeof(vertex_t *));
+	if (!heap->nodes) {
+		free(heap);
+		return 1;
+	}
+	for (i = 0; i < heap->size; i++) {
+		heap->nodes[i] = &adj_list[i];
+		heap->nodes[i]->heap_id = i;
+	}
+
+	/* sort elements */
+	for (i = heap->size; i > 0; i--)
+		heap_down(heap, i - 1);
+
+	*binheap = heap;
+	return 0;
+}
+
+/* returns current minimum and removes it from heap */
+static vertex_t *heap_getmin(binary_heap_t * heap)
+{
+	vertex_t *min = NULL;
+
+	if (heap->size > 0)
+		min = heap->nodes[0];
+
+	if (min == NULL)
+		return min;
+
+	if (heap->size > 0) {
+		if (heap->size > 1) {
+			heap_exchange(heap, 0, heap->size - 1);
+			heap->size--;
+			heap_down(heap, 0);
+		} else {
+			heap->size--;
+		}
+	}
+
+	return min;
+}
+
+/* cleanup heap */
+static void heap_free(binary_heap_t * heap)
+{
+	if (heap) {
+		if (heap->nodes) {
+			free(heap->nodes);
+			heap->nodes = NULL;
+		}
+		free(heap);
+	}
+}
+
+/**********************************************************************
+ **********************************************************************/
+
+/************ helper functions to save src/dest X vl kombination ******
+ **********************************************************************/
+/* compare function of two lids for stdlib qsort */
+static int cmp_lids(const void *l1, const void *l2)
+{
+	uint16_t lid1 = *((uint16_t *) l1), lid2 = *((uint16_t *) l2);
+
+	if (lid1 < lid2)
+		return -1;
+	else if (lid1 > lid2)
+		return 1;
+	else
+		return 0;
+}
+
+/* use stdlib to sort the lid array */
+static inline void vltable_sort_lids(vltable_t * vltable)
+{
+	qsort(vltable->lids, vltable->num_lids, sizeof(uint16_t), cmp_lids);
+}
+
+/* use stdlib to get index of key in lid array;
+   return -1 if lid isn't found in lids array
+*/
+static inline int64_t vltable_get_lidindex(uint16_t * key, vltable_t * vltable)
+{
+	uint16_t *found_lid = NULL;
+
+	found_lid =
+	    (uint16_t *) bsearch(key, vltable->lids, vltable->num_lids,
+				 sizeof(uint16_t), cmp_lids);
+	if (found_lid)
+		return found_lid - vltable->lids;
+	else
+		return -1;
+}
+
+/* get virtual lane from src lid X dest lid kombination;
+   return -1 for invalid lids
+*/
+static int32_t vltable_get_vl(vltable_t * vltable, uint16_t slid, uint16_t dlid)
+{
+	int64_t ind1 = vltable_get_lidindex(&slid, vltable);
+	int64_t ind2 = vltable_get_lidindex(&dlid, vltable);
+
+	if (ind1 > -1 && ind2 > -1)
+		return (int32_t) (vltable->
+				  vls[ind1 + ind2 * vltable->num_lids]);
+	else
+		return -1;
+}
+
+/* set a virtual lane in the matrix */
+static inline void vltable_insert(vltable_t * vltable, uint16_t slid,
+				  uint16_t dlid, uint8_t vl)
+{
+	int64_t ind1 = vltable_get_lidindex(&slid, vltable);
+	int64_t ind2 = vltable_get_lidindex(&dlid, vltable);
+
+	if (ind1 > -1 && ind2 > -1)
+		vltable->vls[ind1 + ind2 * vltable->num_lids] = vl;
+}
+
+/* change a number of lanes from lane xy to lane yz */
+static void vltable_change_vl(vltable_t * vltable, uint8_t from, uint8_t to,
+			      uint64_t count)
+{
+	uint64_t set = 0, stop = 0;
+	uint64_t ind1 = 0, ind2 = 0;
+
+	for (ind1 = 0; ind1 < vltable->num_lids; ind1++) {
+		for (ind2 = 0; ind2 < vltable->num_lids; ind2++) {
+			if (set == count) {
+				stop = 1;
+				break;
+			}
+			if (ind1 != ind2) {
+				if (vltable->
+				    vls[ind1 + ind2 * vltable->num_lids] ==
+				    from) {
+					vltable->vls[ind1 +
+						     ind2 * vltable->num_lids] =
+					    to;
+					set++;
+				}
+			}
+		}
+		if (stop)
+			break;
+	}
+}
+
+static void vltable_print(osm_ucast_mgr_t * p_mgr, vltable_t * vltable)
+{
+	uint64_t ind1 = 0, ind2 = 0;
+
+	for (ind1 = 0; ind1 < vltable->num_lids; ind1++) {
+		for (ind2 = 0; ind2 < vltable->num_lids; ind2++) {
+			if (ind1 != ind2) {
+				OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+					"   route from src_lid=%" PRIu16
+					" to dest_lid=%" PRIu16 " on vl=%" PRIu8
+					"\n", vltable->lids[ind1],
+					vltable->lids[ind2],
+					vltable->vls[ind1 +
+						     ind2 * vltable->num_lids]);
+			}
+		}
+	}
+}
+
+static void vltable_dealloc(vltable_t ** vltable)
+{
+	if (*vltable) {
+		if ((*vltable)->lids)
+			free((*vltable)->lids);
+		if ((*vltable)->vls)
+			free((*vltable)->vls);
+		free(*vltable);
+		*vltable = NULL;
+	}
+}
+
+static int vltable_alloc(vltable_t ** vltable, uint64_t size)
+{
+	/* allocate VL table and indexing array */
+	*vltable = (vltable_t *) malloc(sizeof(vltable_t));
+	if (!(*vltable))
+		goto ERROR;
+	(*vltable)->num_lids = size;
+	(*vltable)->lids = (uint16_t *) malloc(size * sizeof(uint16_t));
+	if (!((*vltable)->lids))
+		goto ERROR;
+	(*vltable)->vls = (uint8_t *) malloc(size * size * sizeof(uint8_t));
+	if (!((*vltable)->vls))
+		goto ERROR;
+	memset((*vltable)->vls, OSM_DEFAULT_SL, size * size);
+
+	return 0;
+
+ERROR:
+	vltable_dealloc(vltable);
+
+	return 1;
+}
+
+/**********************************************************************
+ **********************************************************************/
+
+/************ helper functions to save/manage the channel dep. graph **
+ **********************************************************************/
+/* update the srcdest array;
+   realloc array (double the size) if size is not large enough
+*/
+static void set_next_srcdest_pair(cdg_link_t * link, uint32_t srcdest)
+{
+	uint32_t new_size = 0, start_size = 2;
+	uint32_t *tmp = NULL, *tmp2 = NULL;
+
+	if (link->num_pairs == 0) {
+		link->srcdest_pairs =
+		    (uint32_t *) malloc(start_size * sizeof(uint32_t));
+		link->srcdest_pairs[link->num_pairs] = srcdest;
+		link->max_len = start_size;
+		link->removed = 0;
+	} else if (link->num_pairs == link->max_len) {
+		new_size = link->max_len << 1;
+		tmp = (uint32_t *) malloc(new_size * sizeof(uint32_t));
+		tmp =
+		    memcpy(tmp, link->srcdest_pairs,
+			   link->max_len * sizeof(uint32_t));
+		tmp2 = link->srcdest_pairs;
+		link->srcdest_pairs = tmp;
+		link->srcdest_pairs[link->num_pairs] = srcdest;
+		free(tmp2);
+		link->max_len = new_size;
+	} else {
+		link->srcdest_pairs[link->num_pairs] = srcdest;
+	}
+	link->num_pairs++;
+}
+
+static inline uint32_t get_next_srcdest_pair(cdg_link_t * link, uint32_t index)
+{
+	return link->srcdest_pairs[index];
+}
+
+/* traverse binary tree to find a node */
+static cdg_node_t *cdg_search(cdg_node_t * root, uint64_t channelID)
+{
+	while (root) {
+		if (channelID < root->channelID)
+			root = root->left;
+		else if (channelID > root->channelID)
+			root = root->right;
+		else if (channelID == root->channelID)
+			return root;
+	}
+	return NULL;
+}
+
+/* insert new node into the binary tree */
+static void cdg_insert(cdg_node_t ** root, cdg_node_t * new_node)
+{
+	cdg_node_t *current = *root;
+
+	if (!current) {
+		current = new_node;
+		*root = current;
+		return;
+	}
+
+	while (current) {
+		if (new_node->channelID < current->channelID) {
+			if (current->left) {
+				current = current->left;
+			} else {
+				current->left = new_node;
+				new_node->parent = current;
+				break;
+			}
+		} else if (new_node->channelID > current->channelID) {
+			if (current->right) {
+				current = current->right;
+			} else {
+				current->right = new_node;
+				new_node->parent = current;
+				break;
+			}
+		} else if (new_node->channelID == current->channelID) {
+			/* not really possible, maybe programming error */
+			break;
+		}
+	}
+}
+
+static void cdg_node_dealloc(cdg_node_t * node)
+{
+	cdg_link_t *link = node->linklist, *tmp = NULL;
+
+	/* dealloc linklist */
+	while (link) {
+		tmp = link;
+		link = link->next;
+
+		if (tmp->num_pairs)
+			free(tmp->srcdest_pairs);
+		free(tmp);
+	}
+	/* dealloc node */
+	free(node);
+}
+
+static void cdg_dealloc(cdg_node_t ** root)
+{
+	cdg_node_t *current = *root;
+
+	while (current) {
+		if (current->left) {
+			current = current->left;
+		} else if (current->right) {
+			current = current->right;
+		} else {
+			if (current->parent == NULL) {
+				cdg_node_dealloc(current);
+				*root = NULL;
+				break;
+			}
+			if (current->parent->left == current) {
+				current = current->parent;
+				cdg_node_dealloc(current->left);
+				current->left = NULL;
+			} else if (current->parent->right == current) {
+				current = current->parent;
+				cdg_node_dealloc(current->right);
+				current->right = NULL;
+			}
+		}
+	}
+}
+
+/* search for a edge in the cdg which should be removed to break a cycle */
+static cdg_link_t *get_weakest_link_in_cycle(cdg_node_t * cycle)
+{
+	cdg_node_t *current = cycle, *node_with_weakest_link = NULL;
+	cdg_link_t *link = NULL, *weakest_link = NULL;
+
+	link = current->linklist;
+	while (link) {
+		if (link->node->status == GRAY) {
+			weakest_link = link;
+			node_with_weakest_link = current;
+			current = link->node;
+			break;
+		}
+		link = link->next;
+	}
+
+	while (1) {
+		current->status = UNKNOWN;
+		link = current->linklist;
+		while (link) {
+			if (link->node->status == GRAY) {
+				if ((link->num_pairs - link->removed) <
+				    (weakest_link->num_pairs -
+				     weakest_link->removed)) {
+					weakest_link = link;
+					node_with_weakest_link = current;
+				}
+				current = link->node;
+				break;
+			}
+			link = link->next;
+		}
+		/* if complete cycle is traversed */
+		if (current == cycle) {
+			current->status = UNKNOWN;
+			break;
+		}
+	}
+
+	if (node_with_weakest_link->linklist == weakest_link) {
+		node_with_weakest_link->linklist = weakest_link->next;
+	} else {
+		link = node_with_weakest_link->linklist;
+		while (link) {
+			if (link->next == weakest_link) {
+				link->next = weakest_link->next;
+				break;
+			}
+			link = link->next;
+		}
+	}
+
+	return weakest_link;
+}
+
+/* search for nodes in the cdg not yet reached in the cycle search process;
+   (some nodes are unreachable, e.g. a node is a source or the cdg has not connected parts)
+*/
+static cdg_node_t *get_next_cdg_node(cdg_node_t * root)
+{
+	cdg_node_t *current = root, *res = NULL;
+
+	while (current) {
+		current->visited = 1;
+		if (current->status == UNKNOWN) {
+			res = current;
+			break;
+		}
+		if (current->left && !current->left->visited) {
+			current = current->left;
+		} else if (current->right && !current->right->visited) {
+			current = current->right;
+		} else {
+			if (current->left)
+				current->left->visited = 0;
+			if (current->right)
+				current->right->visited = 0;
+			if (current->parent == NULL)
+				break;
+			else
+				current = current->parent;
+		}
+	}
+
+	/* Clean up */
+	while (current) {
+		current->visited = 0;
+		if (current->left)
+			current->left->visited = 0;
+		if (current->right)
+			current->right->visited = 0;
+		current = current->parent;
+	}
+
+	return res;
+}
+
+/* make a DFS on the cdg to check for a cycle */
+static cdg_node_t *search_cycle_in_channel_dep_graph(cdg_node_t * cdg,
+						     cdg_node_t * start_node)
+{
+	cdg_node_t *cycle = NULL;
+	cdg_node_t *current = start_node, *next_node = NULL, *tmp = NULL;
+	cdg_link_t *link = NULL;
+
+	while (current) {
+		current->status = GRAY;
+		link = current->linklist;
+		next_node = NULL;
+		while (link) {
+			if (link->node->status == UNKNOWN) {
+				next_node = link->node;
+				break;
+			}
+			if (link->node->status == GRAY) {
+				cycle = link->node;
+				goto Exit;
+			}
+			link = link->next;
+		}
+		if (next_node) {
+			next_node->pre = current;
+			current = next_node;
+		} else {
+			/* found a sink in the graph, go to last node */
+			current->status = BLACK;
+
+			/* srcdest_pairs of this node aren't relevant, free the allocated memory */
+			link = current->linklist;
+			while (link) {
+				if (link->num_pairs)
+					free(link->srcdest_pairs);
+				link->srcdest_pairs = NULL;
+				link->num_pairs = 0;
+				link->removed = 0;
+				link = link->next;
+			}
+
+			if (current->pre) {
+				tmp = current;
+				current = current->pre;
+				tmp->pre = NULL;
+			} else {
+				/* search for other subgraphs in cdg */
+				current = get_next_cdg_node(cdg);
+				if (!current)
+					break;	/* all relevant nodes traversed, no more cycles found */
+			}
+		}
+	}
+
+Exit:
+	return cycle;
+}
+
+/* calculate the path from source to destination port;
+   new channels are added directly to the cdg
+*/
+static int update_channel_dep_graph(cdg_node_t ** cdg_root,
+				    osm_port_t * src_port, uint16_t slid,
+				    osm_port_t * dest_port, uint16_t dlid)
+{
+	osm_node_t *local_node = NULL, *remote_node = NULL;
+	uint16_t local_lid = 0, remote_lid = 0;
+	uint32_t srcdest = 0;
+	uint8_t local_port = 0, remote_port = 0;
+	uint64_t channelID = 0;
+
+	cdg_node_t *channel_head = NULL, *channel = NULL, *last_channel = NULL;
+	cdg_link_t *linklist = NULL;
+
+	/* set the identifier for the src/dest pair to save this on each edge of the cdg */
+	srcdest = (((uint32_t) slid) << 16) + ((uint32_t) dlid);
+
+	channel_head = (cdg_node_t *) malloc(sizeof(cdg_node_t));
+	if (!channel_head)
+		goto ERROR;
+	set_default_cdg_node(channel_head);
+	last_channel = channel_head;
+
+	/* if src is a Hca, then the channel from Hca to switch would be a source in the graph
+	   sources can't be part of a cycle -> skip this channel
+	 */
+	remote_node =
+	    osm_node_get_remote_node(src_port->p_node,
+				     src_port->p_physp->port_num, &remote_port);
+
+	while (remote_node && remote_node->sw) {
+		local_node = remote_node;
+		local_port = local_node->sw->new_lft[dlid];
+		local_lid = cl_ntoh16(osm_node_get_base_lid(local_node, 0));
+		/* each port belonging to a switch has lmc==0 -> get_base_lid is fine
+		   (local/remote port in this function are always part of a switch)
+		 */
+
+		remote_node =
+		    osm_node_get_remote_node(local_node, local_port,
+					     &remote_port);
+		/* if remote_node is a Hca, then the last channel from switch to Hca would be a sink in the cdg -> skip */
+		if (!remote_node->sw)
+			break;
+		remote_lid = cl_ntoh16(osm_node_get_base_lid(remote_node, 0));
+
+		channelID =
+		    (((uint64_t) local_lid) << 48) +
+		    (((uint64_t) local_port) << 32) +
+		    (((uint64_t) remote_lid) << 16) + ((uint64_t) remote_port);
+		channel = cdg_search(*cdg_root, channelID);
+		if (channel) {
+			/* check whether last channel has connection to this channel, i.e. subpath already exists in cdg */
+			linklist = last_channel->linklist;
+			while (linklist && linklist->node != channel
+			       && linklist->next)
+				linklist = linklist->next;
+			/* if there is no connection, add one */
+			if (linklist) {
+				if (linklist->node == channel) {
+					set_next_srcdest_pair(linklist,
+							      srcdest);
+				} else {
+					linklist->next =
+					    (cdg_link_t *)
+					    malloc(sizeof(cdg_link_t));
+					if (!linklist->next)
+						goto ERROR;
+					linklist = linklist->next;
+					linklist->node = channel;
+					linklist->num_pairs = 0;
+					linklist->srcdest_pairs = NULL;
+					set_next_srcdest_pair(linklist,
+							      srcdest);
+					linklist->next = NULL;
+				}
+			} else {
+				/* either this is the first channel of the path, or the last channel was a new channel, or last channel was a sink */
+				last_channel->linklist =
+				    (cdg_link_t *) malloc(sizeof(cdg_link_t));
+				if (!last_channel->linklist)
+					goto ERROR;
+				last_channel->linklist->node = channel;
+				last_channel->linklist->num_pairs = 0;
+				last_channel->linklist->srcdest_pairs = NULL;
+				set_next_srcdest_pair(last_channel->linklist,
+						      srcdest);
+				last_channel->linklist->next = NULL;
+			}
+		} else {
+			/* create new channel */
+			channel = (cdg_node_t *) malloc(sizeof(cdg_node_t));
+			if (!channel)
+				goto ERROR;
+			set_default_cdg_node(channel);
+			channel->channelID = channelID;
+			cdg_insert(cdg_root, channel);
+
+			/* go to end of link list of last channel */
+			linklist = last_channel->linklist;
+			while (linklist && linklist->next)
+				linklist = linklist->next;
+			if (linklist) {
+				/* update last link of an existing channel */
+				linklist->next =
+				    (cdg_link_t *) malloc(sizeof(cdg_link_t));
+				if (!linklist->next)
+					goto ERROR;
+				linklist = linklist->next;
+				linklist->node = channel;
+				linklist->num_pairs = 0;
+				linklist->srcdest_pairs = NULL;
+				set_next_srcdest_pair(linklist, srcdest);
+				linklist->next = NULL;
+			} else {
+				/* either this is the first channel of the path, or the last channel was a new channel, or last channel was a sink */
+				last_channel->linklist =
+				    (cdg_link_t *) malloc(sizeof(cdg_link_t));
+				if (!last_channel->linklist)
+					goto ERROR;
+				last_channel->linklist->node = channel;
+				last_channel->linklist->num_pairs = 0;
+				last_channel->linklist->srcdest_pairs = NULL;
+				set_next_srcdest_pair(last_channel->linklist,
+						      srcdest);
+				last_channel->linklist->next = NULL;
+			}
+		}
+		last_channel = channel;
+	}
+
+	if (channel_head->linklist) {
+		if (channel_head->linklist->srcdest_pairs)
+			free(channel_head->linklist->srcdest_pairs);
+		free(channel_head->linklist);
+	}
+	free(channel_head);
+
+	return 0;
+
+ERROR:
+	/* cleanup data and exit */
+	if (channel_head) {
+		if (channel_head->linklist)
+			free(channel_head->linklist);
+		free(channel_head);
+	}
+
+	return 1;
+}
+
+/* calculate the path from source to destination port;
+   the links in the cdg representing this path are decremented to simulate the removal
+*/
+static int remove_path_from_cdg(cdg_node_t ** cdg_root, osm_port_t * src_port,
+				uint16_t slid, osm_port_t * dest_port,
+				uint16_t dlid)
+{
+	osm_node_t *local_node = NULL, *remote_node = NULL;
+	uint16_t local_lid = 0, remote_lid = 0;
+	uint8_t local_port = 0, remote_port = 0;
+	uint64_t channelID = 0;
+
+	cdg_node_t *channel_head = NULL, *channel = NULL, *last_channel = NULL;
+	cdg_link_t *linklist = NULL;
+
+	channel_head = (cdg_node_t *) malloc(sizeof(cdg_node_t));
+	if (!channel_head)
+		goto ERROR;
+	set_default_cdg_node(channel_head);
+	last_channel = channel_head;
+
+	/* if src is a Hca, then the channel from Hca to switch would be a source in the graph
+	   sources can't be part of a cycle -> skip this channel
+	 */
+	remote_node =
+	    osm_node_get_remote_node(src_port->p_node,
+				     src_port->p_physp->port_num, &remote_port);
+
+	while (remote_node && remote_node->sw) {
+		local_node = remote_node;
+		local_port = local_node->sw->new_lft[dlid];
+		local_lid = cl_ntoh16(osm_node_get_base_lid(local_node, 0));
+
+		remote_node =
+		    osm_node_get_remote_node(local_node, local_port,
+					     &remote_port);
+		/* if remote_node is a Hca, then the last channel from switch to Hca would be a sink in the cdg -> skip */
+		if (!remote_node->sw)
+			break;
+		remote_lid = cl_ntoh16(osm_node_get_base_lid(remote_node, 0));
+
+		channelID =
+		    (((uint64_t) local_lid) << 48) +
+		    (((uint64_t) local_port) << 32) +
+		    (((uint64_t) remote_lid) << 16) + ((uint64_t) remote_port);
+		channel = cdg_search(*cdg_root, channelID);
+		if (channel) {
+			/* check whether last channel has connection to this channel, i.e. subpath already exists in cdg */
+			linklist = last_channel->linklist;
+			while (linklist && linklist->node != channel
+			       && linklist->next)
+				linklist = linklist->next;
+			/* remove the srcdest from the link */
+			if (linklist) {
+				if (linklist->node == channel) {
+					linklist->removed++;
+				} else {
+					/* may happen if the link is missing (thru cycle detect algorithm) */
+				}
+			} else {
+				/* may happen if the link is missing (thru cycle detect algorithm or last_channel==channel_head (dummy channel)) */
+			}
+		} else {
+			/* must be an error, channels for the path are added before, so a missing channel would be a corrupt data structure */
+			goto ERROR;
+		}
+		last_channel = channel;
+	}
+
+	if (channel_head->linklist)
+		free(channel_head->linklist);
+	free(channel_head);
+
+	return 0;
+
+ERROR:
+	/* cleanup data and exit */
+	if (channel_head) {
+		if (channel_head->linklist)
+			free(channel_head->linklist);
+		free(channel_head);
+	}
+
+	return 1;
+}
+
+/**********************************************************************
+ **********************************************************************/
+
+static void dfsssp_print_graph(osm_ucast_mgr_t * p_mgr, vertex_t * adj_list,
+			       uint32_t size)
+{
+	uint32_t i = 0, c = 0;
+	link_t *link = NULL;
+
+	/* index 0 is for the source in dijkstra -> ignore */
+	for (i = 1; i < size; i++) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "adj_list[%" PRIu32 "]:\n",
+			i);
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+			"   guid = 0x%" PRIx64 " lid = %" PRIu16 " (%s)\n",
+			adj_list[i].guid, adj_list[i].lid,
+			adj_list[i].sw->p_node->print_desc);
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+			"   num_hca = %" PRIu32 "\n", adj_list[i].num_hca);
+
+		c = 1;
+		for (link = adj_list[i].links; link != NULL;
+		     link = link->next, c++) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+				"   link[%" PRIu32 "]:\n", c);
+			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+				"      to guid = 0x%" PRIx64 " (%s) port %"
+				PRIu8 "\n", link->guid,
+				adj_list[link->to].sw->p_node->print_desc,
+				link->to_port);
+			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+				"      weight on this link = %" PRIu64 "\n",
+				link->weight);
+		}
+	}
+}
+
+/* predefine, to use this in next function */
+static void dfsssp_context_destroy(void *context);
+
+/* traverse subnet to gather information about the connected switches */
+static int dfsssp_build_graph(void *context)
+{
+	dfsssp_context_t *dfsssp_ctx = (dfsssp_context_t *) context;
+	osm_ucast_mgr_t *p_mgr = (osm_ucast_mgr_t *) (dfsssp_ctx->p_mgr);
+
+	cl_qmap_t *port_tbl = &p_mgr->p_subn->port_guid_tbl;	/* 1 managment port per switch + 1 or 2 ports for each Hca */
+	osm_port_t *p_port = NULL;
+	cl_qmap_t *sw_tbl = &p_mgr->p_subn->sw_guid_tbl;
+	cl_map_item_t *item = NULL;
+	osm_switch_t *sw = NULL;
+	osm_node_t *remote_node = NULL;
+	uint8_t port = 0, remote_port = 0;
+	uint32_t i = 0, j = 0;
+	uint64_t total_num_hca = 0;
+	vertex_t *adj_list = NULL;
+	osm_physp_t *p_physp = NULL;
+	link_t *link = NULL, *head = NULL;
+	uint32_t num_sw = 0, adj_list_size = 0;
+	uint8_t lmc = 0;
+
+	OSM_LOG_ENTER(p_mgr->p_log);
+	OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE,
+		"Building graph for df-/sssp routing\n");
+
+	/* if this pointer isn't NULL, this is a reroute step;
+	   old context will be destroyed (adj_list and srcdest2vl_table)
+	 */
+	if (dfsssp_ctx->adj_list)
+		dfsssp_context_destroy(context);
+
+	num_sw = cl_qmap_count(sw_tbl);
+	adj_list_size = num_sw + 1;
+	/* allocate an adjazenz list (array), 0. element is reserved for the source (Hca) in the routing algo, others are switches */
+	adj_list = (vertex_t *) malloc(adj_list_size * sizeof(vertex_t));
+	if (!adj_list) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+			"ERR AD02: cannot allocate memory for adj_list\n");
+		return 1;
+	}
+	for (i = 0; i < adj_list_size; i++)
+		set_default_vertex(&adj_list[i]);
+
+	/* count the total number of Hca / LIDs (for lmc>0) in the fabric */
+	for (item = cl_qmap_head(port_tbl); item != cl_qmap_end(port_tbl);
+	     item = cl_qmap_next(item)) {
+		p_port = (osm_port_t *) item;
+		if (osm_node_get_type(p_port->p_node) == IB_NODE_TYPE_CA) {
+			lmc = osm_port_get_lmc(p_port);
+			total_num_hca += (1 << lmc);
+		}
+	}
+
+	i = 1;			/* fill adj_list -> start with index 1 */
+	for (item = cl_qmap_head(sw_tbl); item != cl_qmap_end(sw_tbl);
+	     item = cl_qmap_next(item), i++) {
+		sw = (osm_switch_t *) item;
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+			"Processing switch with GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_node_get_node_guid(sw->p_node)));
+
+		adj_list[i].guid =
+		    cl_ntoh64(osm_node_get_node_guid(sw->p_node));
+		adj_list[i].lid =
+		    cl_ntoh16(osm_node_get_base_lid(sw->p_node, 0));
+		adj_list[i].sw = sw;
+
+		link = (link_t *) malloc(sizeof(link_t));
+		if (!link) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+				"ERR AD03: cannot allocate memory for a link\n");
+			dfsssp_context_destroy(context);
+			return 1;
+		}
+		head = link;
+		head->next = NULL;
+
+		/* iterate over all ports in the switch, start with port 1 (port 0 is a managment port) */
+		for (port = 1; port < sw->num_ports; port++) {
+			/* get the node behind the port */
+			remote_node =
+			    osm_node_get_remote_node(sw->p_node, port,
+						     &remote_port);
+			/* if there is no remote node on this port or it's the same switch -> try next port */
+			if (!remote_node || remote_node->sw == sw)
+				continue;
+			/* make sure the link is healthy */
+			p_physp = osm_node_get_physp_ptr(sw->p_node, port);
+			if (!p_physp || !osm_link_is_healthy(p_physp))
+				continue;
+			/* if there is a Hca connected -> count and cycle */
+			if (!remote_node->sw) {
+				lmc = osm_port_get_lmc(p_port);
+				adj_list[i].num_hca += (1 << lmc);
+				continue;
+			}
+			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+				"Node 0x%" PRIx64 ", remote node 0x%" PRIx64
+				", port %" PRIu8 ", remote port %" PRIu8 "\n",
+				cl_ntoh64(osm_node_get_node_guid(sw->p_node)),
+				cl_ntoh64(osm_node_get_node_guid(remote_node)),
+				port, remote_port);
+
+			link->next = (link_t *) malloc(sizeof(link_t));
+			if (!link->next) {
+				OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+					"ERR AD08: cannot allocate memory for a link\n");
+				dfsssp_context_destroy(context);
+				return 1;
+			}
+			link = link->next;
+			set_default_link(link);
+			link->guid =
+			    cl_ntoh64(osm_node_get_node_guid(remote_node));
+			link->from = i;
+			link->from_port = port;
+			link->to_port = remote_port;
+			link->weight = total_num_hca * total_num_hca;	/* initilize with P^2 to force shortest paths */
+		}
+
+		adj_list[i].links = head->next;
+		free(head);
+	}
+	/* connect the links with it's second adjacent node in the list */
+	for (i = 1; i < adj_list_size; i++) {
+		link = adj_list[i].links;
+		while (link) {
+			for (j = 1; j < adj_list_size; j++) {
+				if (link->guid == adj_list[j].guid) {
+					link->to = j;
+					break;
+				}
+			}
+			link = link->next;
+		}
+	}
+	/* print the discovered graph */
+	if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log, OSM_LOG_DEBUG))
+		dfsssp_print_graph(p_mgr, adj_list, adj_list_size);
+
+	dfsssp_ctx->adj_list = adj_list;
+	dfsssp_ctx->adj_list_size = adj_list_size;
+
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return 0;
+}
+
+static void print_routes(osm_ucast_mgr_t * p_mgr, vertex_t * adj_list,
+			 uint32_t adj_list_size, osm_port_t * port)
+{
+	uint32_t i = 0, j = 0;
+
+	for (i = 1; i < adj_list_size; i++) {
+		if (adj_list[i].state == DISCOVERED) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+				"Route from 0x%" PRIx64 " (%s) to 0x%" PRIx64
+				" (%s):\n", adj_list[i].guid,
+				adj_list[i].sw->p_node->print_desc,
+				cl_ntoh64(osm_node_get_node_guid(port->p_node)),
+				port->p_node->print_desc);
+			j = i;
+			while (adj_list[j].used_link) {
+				if (j > 0) {
+					OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+						"   0x%" PRIx64
+						" (%s) routes thru port %" PRIu8
+						"\n", adj_list[j].guid,
+						adj_list[j].sw->p_node->
+						print_desc,
+						adj_list[j].used_link->to_port);
+				} else {
+					OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+						"   0x%" PRIx64
+						" (%s) routes thru port %" PRIu8
+						"\n", adj_list[j].guid,
+						port->p_node->print_desc,
+						adj_list[j].used_link->to_port);
+				}
+				j = adj_list[j].used_link->from;
+			}
+		}
+	}
+}
+
+/* dijkstra step from one source to all switches in the df-/sssp graph */
+static int dijkstra(osm_ucast_mgr_t * p_mgr, vertex_t * adj_list,
+		    uint32_t adj_list_size, osm_port_t * port, uint16_t lid)
+{
+	uint32_t i = 0, j = 0, index = 0;
+	osm_node_t *remote_node = NULL;
+	uint8_t remote_port = 0;
+	vertex_t *current = NULL;
+	link_t *link = NULL;
+	uint64_t guid = 0;
+	binary_heap_t *heap = NULL;
+	int err = 0;
+
+	OSM_LOG_ENTER(p_mgr->p_log);
+
+	/* reset all switches for new round with a new source for dijkstra */
+	for (i = 1; i < adj_list_size; i++) {
+		adj_list[i].hops = 0;
+		adj_list[i].used_link = NULL;
+		adj_list[i].distance = INF;
+		adj_list[i].state = UNDISCOVERED;
+	}
+
+	/* if behind port is a Hca -> set adj_list[0] */
+	if (osm_node_get_type(port->p_node) == IB_NODE_TYPE_CA) {
+		/* save old link to prevent many mallocs after set_default_... */
+		link = adj_list[0].links;
+		/* initialize adj_list[0] (the source for the routing, a Hca) */
+		set_default_vertex(&adj_list[0]);
+		adj_list[0].guid =
+		    cl_ntoh64(osm_node_get_node_guid(port->p_node));
+		adj_list[0].lid = lid;
+		index = 0;
+		/* write saved link back to new adj_list[0] */
+		adj_list[0].links = link;
+
+		/* initialize link to neighbor for adj_list[0];
+		   make sure the link is healthy
+		 */
+		if (port->p_physp && osm_link_is_healthy(port->p_physp)) {
+			remote_node =
+			    osm_node_get_remote_node(port->p_node,
+						     port->p_physp->port_num,
+						     &remote_port);
+			/* if there is no remote node on this port or it's the same Hca -> ignore */
+			if (remote_node
+			    && (osm_node_get_type(remote_node) ==
+				IB_NODE_TYPE_SWITCH)) {
+				if (!(adj_list[0].links)) {
+					adj_list[0].links =
+					    (link_t *) malloc(sizeof(link_t));
+					if (!(adj_list[0].links)) {
+						OSM_LOG(p_mgr->p_log,
+							OSM_LOG_ERROR,
+							"ERR AD07: cannot allocate memory for a link\n");
+						return 1;
+					}
+				}
+				set_default_link(adj_list[0].links);
+				adj_list[0].links->guid =
+				    cl_ntoh64(osm_node_get_node_guid
+					      (remote_node));
+				adj_list[0].links->from_port =
+				    port->p_physp->port_num;
+				adj_list[0].links->to_port = remote_port;
+				adj_list[0].links->weight = 1;
+				for (j = 1; j < adj_list_size; j++) {
+					if (adj_list[0].links->guid ==
+					    adj_list[j].guid) {
+						adj_list[0].links->to = j;
+						break;
+					}
+				}
+			}
+		}
+		/* if behind port is a switch -> search switch in adj_list */
+	} else {
+		/* reset adj_list[0], if links=NULL reset was done before, then skip */
+		if (adj_list[0].links) {
+			free(adj_list[0].links);
+			set_default_vertex(&adj_list[0]);
+		}
+		/* search for the switch which is the source in this round */
+		guid = cl_ntoh64(osm_node_get_node_guid(port->p_node));
+		for (i = 1; i < adj_list_size; i++) {
+			if (guid == adj_list[i].guid) {
+				index = i;
+				break;
+			}
+		}
+	}
+
+	/* source in dijkstra */
+	adj_list[index].distance = 0;
+	adj_list[index].state = DISCOVERED;
+	adj_list[index].hops = 0;	/* the source has hop count = 0 */
+
+	/* create a heap to find (efficient) the node with the smallest distance */
+	if (osm_node_get_type(port->p_node) == IB_NODE_TYPE_CA)
+		err = heap_create(adj_list, adj_list_size, &heap);
+	else
+		err = heap_create(&adj_list[1], adj_list_size - 1, &heap);
+	if (err) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+			"ERR AD09: cannot allocate memory for heap or heap->node in heap_create(...)\n");
+		return err;
+	}
+
+	current = heap_getmin(heap);
+	while (current) {
+		current->state = DISCOVERED;
+		if (current->used_link)	/* increment the number of hops to the source for each new node */
+			current->hops =
+			    adj_list[current->used_link->from].hops + 1;
+
+		/* add/update nodes which aren't discovered but accessible */
+		for (link = current->links; link != NULL; link = link->next) {
+			if ((adj_list[link->to].state != DISCOVERED)
+			    && (current->distance + link->weight <
+				adj_list[link->to].distance)) {
+				adj_list[link->to].used_link = link;
+				adj_list[link->to].distance =
+				    current->distance + link->weight;
+				heap_heapify(heap, adj_list[link->to].heap_id);
+			}
+		}
+
+		current = heap_getmin(heap);
+	}
+
+	/* destroy the heap */
+	heap_free(heap);
+	heap = NULL;
+
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return 0;
+}
+
+/* update the linear forwarding tables of all switches with the informations
+   from the last dijsktra step
+*/
+static int update_lft(osm_ucast_mgr_t * p_mgr, vertex_t * adj_list,
+		      uint32_t adj_list_size, osm_port_t * p_port)
+{
+	uint32_t i = 0;
+	int32_t index = -1;
+	uint64_t guid;
+	uint16_t lid = 0;
+	uint8_t port = 0;
+	uint8_t hops = 0;
+	osm_switch_t *p_sw = NULL;
+	boolean_t is_ignored_by_port_prof = FALSE;
+	osm_physp_t *p = NULL;
+	cl_status_t ret;
+
+	OSM_LOG_ENTER(p_mgr->p_log);
+
+	if (osm_node_get_type(p_port->p_node) == IB_NODE_TYPE_SWITCH) {
+		/* we have to search for the right switch, with it's lid to update the LFT */
+		guid = cl_ntoh64(osm_node_get_node_guid(p_port->p_node));
+		for (i = 0; i < adj_list_size; i++) {
+			if (adj_list[i].guid == guid) {
+				index = i;
+				break;
+			}
+		}
+	} else {
+		/* update the routing to a Hca -> index 0 contains the Hca */
+		index = 0;
+	}
+
+	if (index >= 0) {
+		lid = adj_list[index].lid;
+	} else {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+			"ERR AD06: cannot find port in adj_list to run update_lft\n");
+		return 1;
+	}
+
+	for (i = 1; i < adj_list_size; i++) {
+		/* for each switch the port to the 'self'lid is the managment port (=0) */
+		adj_list[i].sw->new_lft[adj_list[i].lid] = 0;
+		/* the hop count to to the 'self'lid is 0 for each switch */
+		osm_switch_set_hops(adj_list[i].sw, adj_list[i].lid, 0, 0);
+
+		/* if no route goes thru this switch -> cycle */
+		if (!(adj_list[i].used_link))
+			continue;
+
+		p_sw = adj_list[i].sw;
+		hops = adj_list[i].hops;
+		port = adj_list[i].used_link->to_port;
+		/* the used_link is the link that was used in dijkstra to reach this node,
+		   so the to_port is the local port on this node
+		 */
+
+		if (port == OSM_NO_PATH) {	/* if clause shouldn't be possible in this routing, but who cares */
+			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+				"No path to get to LID %" PRIu16
+				" from switch 0x%" PRIx64 "\n", lid,
+				cl_ntoh64(osm_node_get_node_guid
+					  (p_sw->p_node)));
+
+			/* do not try to overwrite the ppro of non existing port ... */
+			is_ignored_by_port_prof = TRUE;
+		} else {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+				"Routing LID %" PRIu16 " to port %" PRIu8
+				" for switch 0x%" PRIx64 "\n", lid, port,
+				cl_ntoh64(osm_node_get_node_guid
+					  (p_sw->p_node)));
+
+			p = osm_node_get_physp_ptr(p_sw->p_node, port);
+
+			/* we would like to optionally ignore this port in equalization
+			   as in the case of the Mellanox Anafa Internal PCI TCA port
+			 */
+			is_ignored_by_port_prof = p->is_prof_ignored;
+
+			/* We also would ignore this route if the target lid is of
+			   a switch and the port_profile_switch_node is not TRUE
+			 */
+			if (!p_mgr->p_subn->opt.port_profile_switch_nodes)
+				is_ignored_by_port_prof |=
+				    (osm_node_get_type(p_port->p_node) ==
+				     IB_NODE_TYPE_SWITCH);
+		}
+
+		/* to support lmc > 0 the functions alloc_ports_priv, free_ports_priv, find_and_add_remote_sys
+		   from minhop aren't needed cause osm_switch_recommend_path is implicit calulated
+		   for each LID pair thru dijkstra;
+		   for each port the dijkstra algorithm calculates (max_lid_ho - min_lid_ho)-times maybe
+		   disjoint routes to spread the bandwidth -> diffent routes for one port and lmc>0
+		 */
+
+		/* set port in LFT */
+		p_sw->new_lft[lid] = port;
+		if (!is_ignored_by_port_prof) {
+			/* update the number of path routing thru this port */
+			osm_switch_count_path(p_sw, port);
+		}
+		/* set te hop count from this switch to the lid */
+		ret = osm_switch_set_hops(p_sw, lid, port, hops);
+		if (ret != CL_SUCCESS)
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+				"ERR AD05: cannot set hops for LID %" PRIu16
+				" at switch 0x%" PRIx64 "\n", lid,
+				cl_ntoh64(osm_node_get_node_guid
+					  (p_sw->p_node)));
+	}
+
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return 0;
+}
+
+/* increment the edge weights of the df-/sssp graph which represent the number
+   of paths on this link
+*/
+static void update_weights(osm_ucast_mgr_t * p_mgr, vertex_t * adj_list,
+			   uint32_t adj_list_size, osm_port_t * port)
+{
+	uint32_t i = 0, j = 0;
+	uint32_t additional_weight = 0;
+
+	OSM_LOG_ENTER(p_mgr->p_log);
+
+	for (i = 1; i < adj_list_size; i++) {
+		/* if no route goes thru this switch -> cycle */
+		if (!(adj_list[i].used_link))
+			continue;
+		/* if the source of dijkstra was a Hca -> add num_hca for the weight, else a weight of 1 */
+		if (osm_node_get_type(port->p_node) == IB_NODE_TYPE_CA)
+			additional_weight = adj_list[i].num_hca;
+		else
+			additional_weight = 1;
+
+		j = i;
+		while (adj_list[j].used_link) {
+			/* update the link from pre to this node */
+			adj_list[j].used_link->weight += additional_weight;
+
+			j = adj_list[j].used_link->from;
+		}
+	}
+
+	OSM_LOG_EXIT(p_mgr->p_log);
+}
+
+/* get the larges number of virtual lanes which is supported by all switches
+   in the subnet
+*/
+static uint8_t get_avail_vl_in_subn(osm_ucast_mgr_t * p_mgr)
+{
+	uint32_t i = 0;
+	uint8_t vls_avail = 0xFF, port_vls_avail = 0;
+	cl_qmap_t *sw_tbl = &p_mgr->p_subn->sw_guid_tbl;
+	cl_map_item_t *item = NULL;
+	osm_switch_t *sw = NULL;
+
+	/* traverse all switches to get the number of available virtual lanes in the subnet */
+	for (item = cl_qmap_head(sw_tbl); item != cl_qmap_end(sw_tbl);
+	     item = cl_qmap_next(item)) {
+		sw = (osm_switch_t *) item;
+
+		/* ignore managment port 0 */
+		for (i = 1; i < osm_node_get_num_physp(sw->p_node); i++) {
+			osm_physp_t *p_physp =
+			    osm_node_get_physp_ptr(sw->p_node, i);
+
+			if (p_physp && p_physp->p_remote_physp) {
+				port_vls_avail =
+				    ib_port_info_get_op_vls(&p_physp->
+							    port_info);
+				if (port_vls_avail
+				    && port_vls_avail < vls_avail)
+					vls_avail = port_vls_avail;
+			}
+		}
+	}
+
+	/* ib_port_info_get_op_vls gives values 1 ... 5 (s. IBAS 14.2.5.6) */
+	vls_avail = 1 << (vls_avail - 1);
+
+	/* set boundaries (s. IBAS 3.5.7) */
+	if (vls_avail > 15)
+		vls_avail = 15;
+	if (vls_avail < 1)
+		vls_avail = 1;
+
+	return vls_avail;
+}
+
+/* search for cycles in the channel dependency graph to identify possible
+   deadlocks in the network;
+   assign new virtual lanes to some paths to break the deadlocks
+*/
+static int dfsssp_remove_deadlocks(dfsssp_context_t * dfsssp_ctx)
+{
+	osm_ucast_mgr_t *p_mgr = (osm_ucast_mgr_t *) dfsssp_ctx->p_mgr;
+
+	cl_qmap_t *port_tbl = &p_mgr->p_subn->port_guid_tbl;	/* 1 managment port per switch + 1 or 2 ports for each Hca */
+	cl_map_item_t *item1 = NULL, *item2 = NULL;
+	osm_port_t *src_port = NULL, *dest_port = NULL;
+
+	uint32_t i = 0, err = 0;
+	uint8_t test_vl = 0, vl_avail = 0, vl_needed = 1;
+	cdg_node_t **cdg = NULL, *start_here = NULL, *cycle = NULL;
+	cdg_link_t *weakest_link = NULL;
+	uint32_t srcdest = 0;
+
+	vltable_t *srcdest2vl_table = NULL;
+	uint8_t lmc = 0;
+	uint16_t slid = 0, dlid = 0, min_lid_ho = 0, max_lid_ho =
+	    0, min_lid_ho2 = 0, max_lid_ho2 = 0;;
+	uint64_t *paths_per_vl = NULL;
+	uint64_t from = 0, to = 0, count = 0;
+	uint8_t *split_count = NULL;
+
+	OSM_LOG_ENTER(p_mgr->p_log);
+	OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE,
+		"Assign each src/dest pair a Virtual Lanes, to remove deadlocks in the routing\n");
+
+	vl_avail = get_avail_vl_in_subn(p_mgr);
+	OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+		"Virtual Lanes available: %" PRIu8 "\n", vl_avail);
+
+	paths_per_vl = (uint64_t *) malloc(vl_avail * sizeof(uint64_t));
+	if (!paths_per_vl) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+			"ERR AD22: cannot allocate memory for paths_per_vl\n");
+		return 1;
+	}
+	memset(paths_per_vl, 0, vl_avail * sizeof(uint64_t));
+
+	cdg = (cdg_node_t **) malloc(vl_avail * sizeof(cdg_node_t *));
+	if (!cdg) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+			"ERR AD23: cannot allocate memory for cdg\n");
+		free(paths_per_vl);
+		return 1;
+	}
+	for (i = 0; i < vl_avail; i++)
+		cdg[i] = NULL;
+
+	count = 0;
+	/* count all ports (also multiple LIDs) of type CA for size of VL table */
+	for (item1 = cl_qmap_head(port_tbl); item1 != cl_qmap_end(port_tbl);
+	     item1 = cl_qmap_next(item1)) {
+		dest_port = (osm_port_t *) item1;
+		if (osm_node_get_type(dest_port->p_node) == IB_NODE_TYPE_CA) {
+			lmc = osm_port_get_lmc(dest_port);
+			count += (1 << lmc);
+		}
+	}
+	/* allocate VL table and indexing array */
+	err = vltable_alloc(&srcdest2vl_table, count);
+	if (err) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+			"ERR AD26: cannot allocate memory for srcdest2vl_table\n");
+		goto ERROR;
+	}
+
+	i = 0;
+	/* fill lids into indexing array */
+	for (item1 = cl_qmap_head(port_tbl); item1 != cl_qmap_end(port_tbl);
+	     item1 = cl_qmap_next(item1)) {
+		dest_port = (osm_port_t *) item1;
+		if (osm_node_get_type(dest_port->p_node) == IB_NODE_TYPE_CA) {
+			osm_port_get_lid_range_ho(dest_port, &min_lid_ho,
+						  &max_lid_ho);
+			for (dlid = min_lid_ho; dlid <= max_lid_ho; dlid++, i++)
+				srcdest2vl_table->lids[i] = dlid;
+		}
+	}
+	/* sort lids */
+	vltable_sort_lids(srcdest2vl_table);
+
+	test_vl = 0;
+	/* fill cdg[0] with routes from each src/dest port combination for all Hca in the subnet */
+	for (item1 = cl_qmap_head(port_tbl); item1 != cl_qmap_end(port_tbl);
+	     item1 = cl_qmap_next(item1)) {
+		dest_port = (osm_port_t *) item1;
+		if (osm_node_get_type(dest_port->p_node) == IB_NODE_TYPE_CA) {
+
+			for (item2 = cl_qmap_head(port_tbl);
+			     item2 != cl_qmap_end(port_tbl);
+			     item2 = cl_qmap_next(item2)) {
+				src_port = (osm_port_t *) item2;
+				if (osm_node_get_type(src_port->p_node) ==
+				    IB_NODE_TYPE_CA && src_port != dest_port) {
+
+					/* iterate over LIDs of src and dest port */
+					osm_port_get_lid_range_ho(src_port,
+								  &min_lid_ho,
+								  &max_lid_ho);
+					for (slid = min_lid_ho;
+					     slid <= max_lid_ho; slid++) {
+						osm_port_get_lid_range_ho
+						    (dest_port, &min_lid_ho2,
+						     &max_lid_ho2);
+						for (dlid = min_lid_ho2;
+						     dlid <= max_lid_ho2;
+						     dlid++) {
+
+							/* try to add the path to cdg[0] */
+							err =
+							    update_channel_dep_graph
+							    (&(cdg[test_vl]),
+							     src_port, slid,
+							     dest_port, dlid);
+							if (err) {
+								OSM_LOG(p_mgr->
+									p_log,
+									OSM_LOG_ERROR,
+									"ERR AD14: cannot allocate memory for cdg node or link in update_channel_dep_graph(...)\n");
+								goto ERROR;
+							}
+							/* add the <s,d> kombination / coresponding virtual lane to the VL table */
+							vltable_insert
+							    (srcdest2vl_table,
+							     slid, dlid,
+							     test_vl);
+							paths_per_vl[test_vl]++;
+
+						}
+					}
+
+				}
+			}
+
+		}
+	}
+	dfsssp_ctx->srcdest2vl_table = srcdest2vl_table;
+
+	/* test all cdg for cycles and break the cycles by moving paths on the weakest link to the next cdg */
+	for (test_vl = 0; test_vl < vl_avail - 1; test_vl++) {
+		start_here = cdg[test_vl];
+		while (start_here) {
+			cycle =
+			    search_cycle_in_channel_dep_graph(cdg[test_vl],
+							      start_here);
+
+			if (cycle) {
+				vl_needed = test_vl + 2;
+
+				/* calc weakest link n cycle */
+				weakest_link = get_weakest_link_in_cycle(cycle);
+				if (!weakest_link) {
+					OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+						"ERR AD27: something went wrong in get_weakest_link_in_cycle(...)\n");
+					goto ERROR;
+				}
+
+				paths_per_vl[test_vl] -=
+				    weakest_link->num_pairs;
+				paths_per_vl[test_vl + 1] +=
+				    weakest_link->num_pairs;
+
+				/* move all <s,d> paths on this link to the next cdg */
+				for (i = 0; i < weakest_link->num_pairs; i++) {
+					srcdest =
+					    get_next_srcdest_pair(weakest_link,
+								  i);
+					slid = (uint16_t) (srcdest >> 16);
+					dlid =
+					    (uint16_t) ((srcdest << 16) >> 16);
+
+					/* only move if not moved in a previous step */
+					if (test_vl !=
+					    (uint8_t)
+					    vltable_get_vl(srcdest2vl_table,
+							   slid, dlid))
+						continue;
+
+					src_port =
+					    osm_get_port_by_lid(p_mgr->p_subn,
+								cl_hton16
+								(slid));
+					dest_port =
+					    osm_get_port_by_lid(p_mgr->p_subn,
+								cl_hton16
+								(dlid));
+
+					/* remove path from current cdg / vl */
+					err =
+					    remove_path_from_cdg(&
+								 (cdg[test_vl]),
+								 src_port, slid,
+								 dest_port,
+								 dlid);
+					if (err) {
+						OSM_LOG(p_mgr->p_log,
+							OSM_LOG_ERROR,
+							"ERR AD44: something went wrong in remove_path_from_cdg(...)\n");
+						goto ERROR;
+					}
+
+					/* add path to next cdg / vl */
+					err =
+					    update_channel_dep_graph(&
+								     (cdg
+								      [test_vl +
+								       1]),
+								     src_port,
+								     slid,
+								     dest_port,
+								     dlid);
+					if (err) {
+						OSM_LOG(p_mgr->p_log,
+							OSM_LOG_ERROR,
+							"ERR AD14: cannot allocate memory for cdg node or link in update_channel_dep_graph(...)\n");
+						goto ERROR;
+					}
+					vltable_insert(srcdest2vl_table, slid,
+						       dlid, test_vl + 1);
+				}
+
+				if (weakest_link->num_pairs)
+					free(weakest_link->srcdest_pairs);
+				if (weakest_link)
+					free(weakest_link);
+			}
+
+			start_here = cycle;
+		}
+	}
+
+	/* test the last avail cdg for a cycle;
+	   if there is one, than vl_needed > vl_avail
+	 */
+	start_here = cdg[vl_avail - 1];
+	if (start_here) {
+		cycle =
+		    search_cycle_in_channel_dep_graph(cdg[vl_avail - 1],
+						      start_here);
+		if (cycle) {
+			vl_needed = vl_avail + 1;
+		}
+	}
+
+	OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+		"Virtual Lanes needed: %" PRIu8 "\n", vl_needed);
+	if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log, OSM_LOG_INFO)) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+			"Paths per VL (before balancing):\n");
+		for (i = 0; i < vl_avail; i++)
+			OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+				"   %" PRIu32 ". lane: %" PRIu64 "\n", i,
+				paths_per_vl[i]);
+	}
+
+	OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE,
+		"Balancing the paths on the available Virtual Lanes\n");
+
+	/* balancing virtual lanes, but avoid additional cycle check -> balancing suboptimal */
+	if (vl_needed == 1) {
+		from = 0;
+		count = paths_per_vl[0] / vl_avail;
+		for (to = 1; to < vl_avail; to++) {
+			vltable_change_vl(srcdest2vl_table, from, to, count);
+			paths_per_vl[from] -= count;
+			paths_per_vl[to] += count;
+		}
+	} else if (vl_needed < vl_avail) {
+		split_count = (uint8_t *) malloc(vl_needed * sizeof(uint8_t));
+		if (!split_count) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+				"ERR AD24: cannot allocate memory for split_count, skip balancing\n");
+		} else {
+			memset(split_count, 0, vl_needed * sizeof(uint8_t));
+			for (i = vl_needed; i < vl_avail; i++)
+				split_count[(i - vl_needed) % vl_needed]++;
+
+			to = vl_needed;
+			for (from = 0; from < vl_needed; from++) {
+				count =
+				    paths_per_vl[from] / (split_count[from] +
+							  1);
+				for (i = 0; i < split_count[from]; i++) {
+					vltable_change_vl(srcdest2vl_table,
+							  from, to, count);
+					paths_per_vl[from] -= count;
+					paths_per_vl[to] += count;
+					to++;
+				}
+			}
+
+			free(split_count);
+		}
+	} else if (vl_needed > vl_avail) {
+		/* routing not possible, a further development would be the LASH-TOR approach (update: LASH-TOR isn't possible, there is a mistake in the theory) */
+		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+			"ERR AD25: Not enough VL available (avail=%d, needed=%d); Stop dfsssp routing!\n",
+			vl_avail, vl_needed);
+		goto ERROR;
+	}
+	/* else { no balancing } */
+	if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log, OSM_LOG_INFO)) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+			"Virtual Lanes per src/dest combination after balancing:\n");
+		vltable_print(p_mgr, srcdest2vl_table);
+		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+			"Paths per VL (after balancing):\n");
+		for (i = 0; i < vl_avail; i++)
+			OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+				"   %" PRIu32 ". lane: %" PRIu64 "\n", i,
+				paths_per_vl[i]);
+	}
+
+	free(paths_per_vl);
+
+	/* deallocate channel dependency graphs */
+	for (i = 0; i < vl_avail; i++)
+		cdg_dealloc(&cdg[i]);
+	free(cdg);
+
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return 0;
+
+ERROR:
+	free(paths_per_vl);
+
+	for (i = 0; i < vl_avail; i++)
+		cdg_dealloc(&cdg[i]);
+	free(cdg);
+
+	vltable_dealloc(&srcdest2vl_table);
+	dfsssp_ctx->srcdest2vl_table = NULL;
+
+	return err;
+}
+
+/* meta function which calls subfunctions for dijkstra, update lft and weights,
+   (and remove deadklocks) to calculate the routing for the subnet
+*/
+static int dfsssp_do_dijkstra_routing(void *context)
+{
+	dfsssp_context_t *dfsssp_ctx = (dfsssp_context_t *) context;
+	osm_ucast_mgr_t *p_mgr = (osm_ucast_mgr_t *) dfsssp_ctx->p_mgr;
+	vertex_t *adj_list = (vertex_t *) dfsssp_ctx->adj_list;
+	uint32_t adj_list_size = dfsssp_ctx->adj_list_size;
+
+	cl_qmap_t *port_tbl = &p_mgr->p_subn->port_guid_tbl;	/* 1 managment port per switch + 1 or 2 ports for each Hca */
+	cl_qmap_t *sw_tbl = &p_mgr->p_subn->sw_guid_tbl;
+	cl_map_item_t *item = NULL;
+	osm_switch_t *sw = NULL;
+	osm_port_t *port = NULL;
+	uint32_t i = 0, err = 0;
+	uint16_t lid = 0, min_lid_ho = 0, max_lid_ho = 0;
+
+	OSM_LOG_ENTER(p_mgr->p_log);
+	OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE,
+		"Calculating shortest path from all Hca/switches to all\n");
+
+	/* reset the new_lft for each switch */
+	for (item = cl_qmap_head(sw_tbl); item != cl_qmap_end(sw_tbl);
+	     item = cl_qmap_next(item)) {
+		sw = (osm_switch_t *) item;
+		/* initialize LIDs in buffer to invalid port number */
+		memset(sw->new_lft, OSM_NO_PATH, sw->max_lid_ho + 1);
+	}
+
+	/* do the routing for the each Hca in the subnet */
+	for (item = cl_qmap_head(port_tbl); item != cl_qmap_end(port_tbl);
+	     item = cl_qmap_next(item)) {
+		port = (osm_port_t *) item;
+
+		/* if behind port is a Hca -> calculate shortest path with dijkstra from node to all switches/Hca */
+		if (osm_node_get_type(port->p_node) == IB_NODE_TYPE_CA) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+				"Processing Hca with GUID 0x%" PRIx64 "\n",
+				cl_ntoh64(osm_node_get_node_guid
+					  (port->p_node)));
+
+			/* distribute the LID range across the ports that can reach those LIDs
+			   to have disjoint paths for one destination port with lmc>0
+			 */
+			osm_port_get_lid_range_ho(port, &min_lid_ho,
+						  &max_lid_ho);
+			for (lid = min_lid_ho; lid <= max_lid_ho; lid++) {
+				/* do dijkstra from this Hca/LID to each switch */
+				err =
+				    dijkstra(p_mgr, adj_list, adj_list_size,
+					     port, lid);
+				if (err)
+					return err;
+				if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log,
+				    OSM_LOG_DEBUG))
+					print_routes(p_mgr, adj_list,
+						     adj_list_size, port);
+
+				/* make an update for the linear forwarding tables of the switches */
+				err =
+				    update_lft(p_mgr, adj_list, adj_list_size,
+					       port);
+				if (err)
+					return err;
+
+				/* add weights for calculated routes to adjust the weights for the next cycle */
+				update_weights(p_mgr, adj_list, adj_list_size,
+					       port);
+
+				if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log,
+				    OSM_LOG_DEBUG))
+					dfsssp_print_graph(p_mgr, adj_list,
+							   adj_list_size);
+			}
+		}
+	}
+	/* do the routing for the each switch in the subnet to add the routes from switch to switch */
+	for (item = cl_qmap_head(port_tbl); item != cl_qmap_end(port_tbl);
+	     item = cl_qmap_next(item)) {
+		port = (osm_port_t *) item;
+
+		if (osm_node_get_type(port->p_node) == IB_NODE_TYPE_SWITCH) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+				"Processing switch with GUID 0x%" PRIx64 "\n",
+				cl_ntoh64(osm_node_get_node_guid
+					  (port->p_node)));
+
+			lid = cl_ntoh16(osm_node_get_base_lid(port->p_node, 0));
+			/* do dijkstra from this switch to each switch */
+			err =
+			    dijkstra(p_mgr, adj_list, adj_list_size, port, lid);
+			if (err)
+				return err;
+			if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log, OSM_LOG_DEBUG))
+				print_routes(p_mgr, adj_list, adj_list_size,
+					     port);
+
+			/* make an update for the linear forwarding tables of the switches */
+			err = update_lft(p_mgr, adj_list, adj_list_size, port);
+			if (err)
+				return err;
+
+			/* add weights for calculated routes to adjust the weights for the next cycle */
+			update_weights(p_mgr, adj_list, adj_list_size, port);
+
+			if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log, OSM_LOG_DEBUG))
+				dfsssp_print_graph(p_mgr, adj_list,
+						   adj_list_size);
+		}
+	}
+
+	/* try deadlock removal only for the dfsssp routing (not for the sssp case, which is a subset of the dfsssp algorithm) */
+	if (dfsssp_ctx->routing_type == OSM_ROUTING_ENGINE_TYPE_DFSSSP) {
+		/* remove potential deadlocks by assigning different virtual lanes to src/dest paths and balance the lanes */
+		err = dfsssp_remove_deadlocks(dfsssp_ctx);
+		if (err)
+			return err;
+	} else if (dfsssp_ctx->routing_type == OSM_ROUTING_ENGINE_TYPE_SSSP) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+			"SSSP routing specified -> skipping deadlock removal thru dfsssp_remove_deadlocks(...)\n");
+	} else {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+			"ERR AD28: wrong routing engine specified in dfsssp_ctx\n");
+		return 1;
+	}
+
+	/* print the new_lft for each switch after routing is done */
+	if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log, OSM_LOG_DEBUG)) {
+		for (item = cl_qmap_head(sw_tbl); item != cl_qmap_end(sw_tbl);
+		     item = cl_qmap_next(item)) {
+			sw = (osm_switch_t *) item;
+			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+				"Summary of the (new) LFT for switch 0x%" PRIx64
+				" (%s):\n",
+				cl_ntoh64(osm_node_get_node_guid(sw->p_node)),
+				sw->p_node->print_desc);
+			for (i = 0; i < sw->max_lid_ho + 1; i++)
+				if (sw->new_lft[i] != OSM_NO_PATH) {
+					OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+						"   for LID=%" PRIu32
+						" use port=%" PRIu8 "\n", i,
+						sw->new_lft[i]);
+				}
+		}
+	}
+
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return 0;
+}
+
+/* called from extern in QP creation process to gain the the service level and
+   the virtual lane respectively for a <s,d> pair
+*/
+static uint8_t get_dfsssp_sl(void *context, uint8_t hint_for_default_sl,
+			     const ib_net16_t slid, const ib_net16_t dlid)
+{
+	dfsssp_context_t *dfsssp_ctx = (dfsssp_context_t *) context;
+	osm_ucast_mgr_t *p_mgr = (osm_ucast_mgr_t *) dfsssp_ctx->p_mgr;
+	osm_port_t *src_port, *dest_port;
+	vltable_t *srcdest2vl_table = NULL;
+	int32_t res = 0;
+
+	if (dfsssp_ctx
+	    && dfsssp_ctx->routing_type == OSM_ROUTING_ENGINE_TYPE_DFSSSP)
+		srcdest2vl_table = (vltable_t *) (dfsssp_ctx->srcdest2vl_table);
+	else
+		return hint_for_default_sl;
+
+	src_port = osm_get_port_by_lid(p_mgr->p_subn, slid);
+	if (!src_port)
+		return hint_for_default_sl;
+
+	dest_port = osm_get_port_by_lid(p_mgr->p_subn, dlid);
+	if (!dest_port)
+		return hint_for_default_sl;
+
+	if (!srcdest2vl_table)
+		return hint_for_default_sl;
+
+	res = vltable_get_vl(srcdest2vl_table, slid, dlid);
+
+	if (res > -1)
+		return (uint8_t) res;
+	else
+		return hint_for_default_sl;
+}
+
+static dfsssp_context_t *dfsssp_context_create(osm_opensm_t * p_osm,
+					       osm_routing_engine_type_t
+					       routing_type)
+{
+	dfsssp_context_t *dfsssp_ctx = NULL;
+
+	/* allocate memory */
+	dfsssp_ctx = (dfsssp_context_t *) malloc(sizeof(dfsssp_context_t));
+	if (dfsssp_ctx) {
+		/* set initial values */
+		dfsssp_ctx->routing_type = routing_type;
+		dfsssp_ctx->p_mgr = (osm_ucast_mgr_t *) & (p_osm->sm.ucast_mgr);
+		dfsssp_ctx->adj_list = NULL;
+		dfsssp_ctx->srcdest2vl_table = NULL;
+	} else {
+		OSM_LOG(p_osm->sm.ucast_mgr.p_log, OSM_LOG_ERROR,
+			"ERR AD04: cannot allocate memory for dfsssp_ctx in dfsssp_context_create\n");
+		return NULL;
+	}
+
+	return dfsssp_ctx;
+}
+
+static void dfsssp_context_destroy(void *context)
+{
+	dfsssp_context_t *dfsssp_ctx = (dfsssp_context_t *) context;
+	vertex_t *adj_list = (vertex_t *) (dfsssp_ctx->adj_list);
+	uint32_t i = 0;
+	link_t *link = NULL, *tmp = NULL;
+
+	/* free adj_list */
+	for (i = 0; i < dfsssp_ctx->adj_list_size; i++) {
+		link = adj_list[i].links;
+		while (link) {
+			tmp = link;
+			link = link->next;
+			free(tmp);
+		}
+	}
+	free(adj_list);
+	dfsssp_ctx->adj_list = NULL;
+
+	/* free srcdest2vl table (can be done because, dfsssp_context_destroy is called after osm_get_dfsssp_sl) */
+	vltable_dealloc(&(dfsssp_ctx->srcdest2vl_table));
+	dfsssp_ctx->srcdest2vl_table = NULL;
+
+	free(context);
+}
+
+static void delete(void *context)
+{
+	if (!context)
+		return;
+	dfsssp_context_destroy(context);
+}
+
+int osm_ucast_dfsssp_setup(struct osm_routing_engine *r, osm_opensm_t * p_osm)
+{
+	/* create context container and add ucast managment object */
+	dfsssp_context_t *dfsssp_context =
+	    dfsssp_context_create(p_osm, OSM_ROUTING_ENGINE_TYPE_DFSSSP);
+	if (!dfsssp_context) {
+		return 1;	/* alloc failed -> skip this routing */
+	}
+
+	/* reset function pointers to dfsssp routines */
+	r->context = (void *)dfsssp_context;
+	r->build_lid_matrices = dfsssp_build_graph;
+	r->ucast_build_fwd_tables = dfsssp_do_dijkstra_routing;
+	r->path_sl = get_dfsssp_sl;
+	r->destroy = delete;
+
+	return 0;
+}
+
+int osm_ucast_sssp_setup(struct osm_routing_engine *r, osm_opensm_t * p_osm)
+{
+	/* create context container and add ucast managment object */
+	dfsssp_context_t *dfsssp_context =
+	    dfsssp_context_create(p_osm, OSM_ROUTING_ENGINE_TYPE_SSSP);
+	if (!dfsssp_context) {
+		return 1;	/* alloc failed -> skip this routing */
+	}
+
+	/* reset function pointers to sssp routines */
+	r->context = (void *)dfsssp_context;
+	r->build_lid_matrices = dfsssp_build_graph;
+	r->ucast_build_fwd_tables = dfsssp_do_dijkstra_routing;
+	r->destroy = delete;
+
+	return 0;
+}
diff --git a/opensm/osm_ucast_dnup.c b/opensm/osm_ucast_dnup.c
new file mode 100644
index 0000000..d3e5383
--- /dev/null
+++ b/opensm/osm_ucast_dnup.c
@@ -0,0 +1,499 @@
+/*
+ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2007,2009 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2009 Battelle Memorial Institue. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+/*
+ * Abstract:
+ *      Implementation of Up Down Algorithm using ranking & Min Hop
+ *      Calculation functions
+ */
+
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif				/* HAVE_CONFIG_H */
+
+#include <stdlib.h>
+#include <ctype.h>
+#include <complib/cl_debug.h>
+#include <complib/cl_qmap.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_UCAST_DNUP_C
+#include <opensm/osm_switch.h>
+#include <opensm/osm_opensm.h>
+#include <opensm/osm_ucast_mgr.h>
+
+/* //////////////////////////// */
+/*  Local types                 */
+/* //////////////////////////// */
+
+/* direction */
+typedef enum dnup_switch_dir {
+	UP = 0,
+	DOWN,
+	EQUAL
+} dnup_switch_dir_t;
+
+/* dnup structure */
+typedef struct dnup {
+	osm_opensm_t *p_osm;
+} dnup_t;
+
+struct dnup_node {
+	cl_list_item_t list;
+	osm_switch_t *sw;
+	dnup_switch_dir_t dir;
+	unsigned rank;
+	unsigned visited;
+};
+
+/* This function returns direction based on rank and guid info of current &
+   remote ports */
+static dnup_switch_dir_t dnup_get_dir(unsigned cur_rank, unsigned rem_rank)
+{
+	/* HACK: comes to solve root nodes connection, in a classic subnet root nodes do not connect
+	   directly, but in case they are we assign to root node an UP direction to allow DNUP to discover
+	   the subnet correctly (and not from the point of view of the last root node).
+	 */
+	if (!cur_rank && !rem_rank)
+		return EQUAL;
+
+	if (cur_rank < rem_rank)
+		return DOWN;
+	else if (cur_rank > rem_rank)
+		return UP;
+	else
+		return EQUAL;
+}
+
+/**********************************************************************
+ * This function does the bfs of min hop table calculation by guid index
+ * as a starting point.
+ **********************************************************************/
+static int dnup_bfs_by_node(IN osm_log_t * p_log, IN osm_subn_t * p_subn,
+			    IN osm_switch_t * p_sw, IN uint8_t prune_weight,
+			    OUT uint8_t * max_hops)
+{
+	uint8_t pn, pn_rem;
+	cl_qlist_t list;
+	uint16_t lid;
+	struct dnup_node *u;
+	dnup_switch_dir_t next_dir, current_dir;
+
+	OSM_LOG_ENTER(p_log);
+
+	lid = osm_node_get_base_lid(p_sw->p_node, 0);
+	lid = cl_ntoh16(lid);
+	osm_switch_set_hops(p_sw, lid, 0, 0);
+
+	OSM_LOG(p_log, OSM_LOG_DEBUG,
+		"Starting from switch - port GUID 0x%" PRIx64 " lid %u\n",
+		cl_ntoh64(p_sw->p_node->node_info.port_guid), lid);
+
+	u = p_sw->priv;
+	u->dir = DOWN;
+
+	/* Update list with the new element */
+	cl_qlist_init(&list);
+	cl_qlist_insert_tail(&list, &u->list);
+
+	/* BFS the list till no next element */
+	while (!cl_is_qlist_empty(&list)) {
+		u = (struct dnup_node *)cl_qlist_remove_head(&list);
+		u->visited = 0;	/* cleanup */
+		current_dir = u->dir;
+		/* Go over all ports of the switch and find unvisited remote nodes */
+		for (pn = 1; pn < u->sw->num_ports; pn++) {
+			osm_node_t *p_remote_node;
+			struct dnup_node *rem_u;
+			uint8_t current_min_hop, remote_min_hop,
+			    set_hop_return_value;
+			osm_switch_t *p_remote_sw;
+
+			p_remote_node =
+			    osm_node_get_remote_node(u->sw->p_node, pn,
+						     &pn_rem);
+			/* If no remote node OR remote node is not a SWITCH
+			   continue to next pn */
+			if (!p_remote_node || !p_remote_node->sw)
+				continue;
+			/* Fetch remote guid only after validation of remote node */
+			p_remote_sw = p_remote_node->sw;
+			rem_u = p_remote_sw->priv;
+			/* Decide which direction to mark it (UP/DOWN) */
+			next_dir = dnup_get_dir(u->rank, rem_u->rank);
+
+			/* Set MinHop value for the current lid */
+			current_min_hop = osm_switch_get_least_hops(u->sw, lid);
+			/* Check hop count if better insert into list && update
+			   the remote node Min Hop Table */
+			remote_min_hop =
+			    osm_switch_get_hop_count(p_remote_sw, lid, pn_rem);
+
+			/* Check if this is a legal step : the only illegal step is going
+			   from UP to DOWN */
+			if ((current_dir == UP) && (next_dir == DOWN)) {
+				OSM_LOG(p_log, OSM_LOG_DEBUG,
+					"Avoiding move from 0x%016" PRIx64
+					" to 0x%016" PRIx64 "\n",
+					cl_ntoh64(osm_node_get_node_guid(u->sw->p_node)),
+					cl_ntoh64(osm_node_get_node_guid(p_remote_node)));
+				/* Illegal step. If prune_weight is set, allow it with an
+				 * additional weight
+				 */
+				if(prune_weight) {
+					current_min_hop+=prune_weight;
+					if(current_min_hop >= 64) {
+						OSM_LOG(p_log, OSM_LOG_ERROR,
+							"ERR AE02: Too many hops on subnet,"
+							" can't relax illegal Dn/Up transition.");
+						osm_switch_set_hops(p_remote_sw, lid,
+								    pn_rem, OSM_NO_PATH);
+					}
+				} else {
+					continue;
+				}
+			}
+			if (current_min_hop + 1 < remote_min_hop) {
+				set_hop_return_value =
+				    osm_switch_set_hops(p_remote_sw, lid,
+							pn_rem,
+							current_min_hop + 1);
+				if(max_hops && current_min_hop + 1 > *max_hops) {
+					*max_hops = current_min_hop + 1;
+				}
+				if (set_hop_return_value) {
+					OSM_LOG(p_log, OSM_LOG_ERROR, "ERR AE01: "
+						"Invalid value returned from set min hop is: %d\n",
+						set_hop_return_value);
+				}
+				/* Check if remote port has already been visited */
+				if (!rem_u->visited) {
+					/* Insert dnup_switch item into the list */
+					rem_u->dir = next_dir;
+					rem_u->visited = 1;
+					cl_qlist_insert_tail(&list,
+							     &rem_u->list);
+				}
+			}
+		}
+	}
+
+	OSM_LOG_EXIT(p_log);
+	return 0;
+}
+
+/* NOTE : PLS check if we need to decide that the first */
+/*        rank is a SWITCH for BFS purpose */
+static int dnup_subn_rank(IN dnup_t * p_dnup)
+{
+	osm_switch_t *p_sw;
+	osm_physp_t *p_physp, *p_remote_physp;
+	cl_qlist_t list;
+	cl_map_item_t *item;
+	struct dnup_node *u, *remote_u;
+	uint8_t num_ports, port_num;
+	osm_log_t *p_log = &p_dnup->p_osm->log;
+	unsigned max_rank = 0;
+
+	OSM_LOG_ENTER(p_log);
+	cl_qlist_init(&list);
+
+	/* add all node level switches to the list */
+	for (item = cl_qmap_head(&p_dnup->p_osm->subn.sw_guid_tbl);
+	     item != cl_qmap_end(&p_dnup->p_osm->subn.sw_guid_tbl);
+	     item = cl_qmap_next(item)) {
+		p_sw = (osm_switch_t *)item;
+		u = p_sw->priv;
+		if (u->rank == 0)
+			cl_qlist_insert_tail(&list, &u->list);
+	}
+
+	/* BFS the list till it's empty */
+	while (!cl_is_qlist_empty(&list)) {
+		u = (struct dnup_node *)cl_qlist_remove_head(&list);
+		/* Go over all remote nodes and rank them (if not already visited) */
+		p_sw = u->sw;
+		num_ports = p_sw->num_ports;
+		OSM_LOG(p_log, OSM_LOG_DEBUG,
+			"Handling switch GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)));
+		for (port_num = 1; port_num < num_ports; port_num++) {
+			ib_net64_t port_guid;
+
+			/* Current port fetched in order to get remote side */
+			p_physp =
+			    osm_node_get_physp_ptr(p_sw->p_node, port_num);
+
+			if (!p_physp)
+				continue;
+
+			p_remote_physp = p_physp->p_remote_physp;
+
+			/*
+			   make sure that all the following occur on p_remote_physp:
+			   1. The port isn't NULL
+			   2. It is a switch
+			 */
+			if (p_remote_physp && p_remote_physp->p_node->sw) {
+				remote_u = p_remote_physp->p_node->sw->priv;
+				port_guid = p_remote_physp->port_guid;
+
+				if (remote_u->rank > u->rank + 1) {
+					remote_u->rank = u->rank + 1;
+					max_rank = remote_u->rank;
+					cl_qlist_insert_tail(&list,
+							     &remote_u->list);
+					OSM_LOG(p_log, OSM_LOG_DEBUG,
+						"Rank of port GUID 0x%" PRIx64
+						" = %u\n", cl_ntoh64(port_guid),
+						remote_u->rank);
+				}
+			}
+		}
+	}
+
+	/* Print Summary of ranking */
+	OSM_LOG(p_log, OSM_LOG_VERBOSE,
+		"Subnet ranking completed. Max Node Rank = %d\n", max_rank);
+	OSM_LOG_EXIT(p_log);
+	return 0;
+}
+
+static int dnup_set_min_hop_table(IN dnup_t * p_dnup)
+{
+	osm_subn_t *p_subn = &p_dnup->p_osm->subn;
+	osm_log_t *p_log = &p_dnup->p_osm->log;
+	osm_switch_t *p_sw;
+	struct dnup_node *u;
+	cl_map_item_t *item;
+	uint8_t max_hops = 0;
+
+	OSM_LOG_ENTER(p_log);
+
+	/* Go over all the switches in the subnet - for each init their Min Hop
+	   Table */
+	OSM_LOG(p_log, OSM_LOG_VERBOSE,
+		"Init Min Hop Table of all switches [\n");
+
+	for (item = cl_qmap_head(&p_dnup->p_osm->subn.sw_guid_tbl);
+	     item != cl_qmap_end(&p_dnup->p_osm->subn.sw_guid_tbl);
+	     item = cl_qmap_next(item)) {
+		p_sw = (osm_switch_t *)item;
+		/* Clear Min Hop Table */
+		osm_switch_clear_hops(p_sw);
+	}
+
+	OSM_LOG(p_log, OSM_LOG_VERBOSE,
+		"Init Min Hop Table of all switches ]\n");
+
+	/* Now do the BFS for each port  in the subnet */
+	OSM_LOG(p_log, OSM_LOG_VERBOSE,
+		"BFS through all port guids in the subnet [\n");
+
+	for (item = cl_qmap_head(&p_dnup->p_osm->subn.sw_guid_tbl);
+	     item != cl_qmap_end(&p_dnup->p_osm->subn.sw_guid_tbl);
+	     item = cl_qmap_next(item)) {
+		p_sw = (osm_switch_t *)item;
+		dnup_bfs_by_node(p_log, p_subn, p_sw, 0, &max_hops);
+	}
+	if(p_subn->opt.connect_roots) {
+		/*This is probably not necessary, by I am more comfortable
+		 * clearing any possible side effects from the previous
+		 * dnup routing pass
+		 */
+		for (item = cl_qmap_head(&p_dnup->p_osm->subn.sw_guid_tbl);
+		     item != cl_qmap_end(&p_dnup->p_osm->subn.sw_guid_tbl);
+		     item = cl_qmap_next(item)) {
+			p_sw = (osm_switch_t *)item;
+			osm_switch_clear_hops(p_sw);
+			u = (struct dnup_node *) p_sw->priv;
+			u->visited = 0;
+		}
+		for (item = cl_qmap_head(&p_dnup->p_osm->subn.sw_guid_tbl);
+		     item != cl_qmap_end(&p_dnup->p_osm->subn.sw_guid_tbl);
+		     item = cl_qmap_next(item)) {
+			p_sw = (osm_switch_t *)item;
+			dnup_bfs_by_node(p_log, p_subn, p_sw, max_hops + 1, NULL);
+		}
+	}
+
+	OSM_LOG(p_log, OSM_LOG_VERBOSE,
+		"BFS through all port guids in the subnet ]\n");
+	/* Cleanup */
+	OSM_LOG_EXIT(p_log);
+	return 0;
+}
+
+static int dnup_build_lid_matrices(IN dnup_t * p_dnup)
+{
+	int status;
+
+	OSM_LOG_ENTER(&p_dnup->p_osm->log);
+
+	OSM_LOG(&p_dnup->p_osm->log, OSM_LOG_VERBOSE,
+		"Ranking all port guids in the list\n");
+	/* Check if it's not a switched subnet */
+	if (cl_is_qmap_empty(&p_dnup->p_osm->subn.sw_guid_tbl)) {
+		OSM_LOG(&p_dnup->p_osm->log, OSM_LOG_ERROR, "ERR AEOB: "
+			"This is not a switched subnet, cannot perform DNUP algorithm\n");
+		status = -1;
+		goto _exit;
+	}
+
+	/* Rank the subnet switches */
+	dnup_subn_rank(p_dnup);
+
+	/* After multiple ranking need to set Min Hop Table by DnUp algorithm  */
+	OSM_LOG(&p_dnup->p_osm->log, OSM_LOG_VERBOSE,
+		"Setting all switches' Min Hop Table\n");
+	status = dnup_set_min_hop_table(p_dnup);
+
+_exit:
+	OSM_LOG_EXIT(&p_dnup->p_osm->log);
+	return status;
+}
+
+static struct dnup_node *create_dnup_node(osm_switch_t * sw)
+{
+	struct dnup_node *u;
+
+	u = malloc(sizeof(*u));
+	if (!u)
+		return NULL;
+	memset(u, 0, sizeof(*u));
+	u->sw = sw;
+	u->rank = 0xffffffff;
+	return u;
+}
+
+static void delete_dnup_node(struct dnup_node *u)
+{
+	u->sw->priv = NULL;
+	free(u);
+}
+
+/* DNUP callback function */
+static int dnup_lid_matrices(void *ctx)
+{
+	dnup_t *p_dnup = ctx;
+	cl_map_item_t *item;
+	osm_switch_t *p_sw;
+	int ret = 0;
+	int num_leafs = 0;
+	uint8_t pn, pn_rem;
+
+	OSM_LOG_ENTER(&p_dnup->p_osm->log);
+
+	for (item = cl_qmap_head(&p_dnup->p_osm->subn.sw_guid_tbl);
+	     item != cl_qmap_end(&p_dnup->p_osm->subn.sw_guid_tbl);
+	     item = cl_qmap_next(item)) {
+		p_sw = (osm_switch_t *)item;
+		p_sw->priv = create_dnup_node(p_sw);
+		if (!p_sw->priv) {
+			OSM_LOG(&(p_dnup->p_osm->log), OSM_LOG_ERROR, "ERR AE0C: "
+				"cannot create dnup node\n");
+			OSM_LOG_EXIT(&p_dnup->p_osm->log);
+			return -1;
+		}
+	}
+
+
+	/* First setup node level nodes */
+	for (item = cl_qmap_head(&p_dnup->p_osm->subn.sw_guid_tbl);
+	     item != cl_qmap_end(&p_dnup->p_osm->subn.sw_guid_tbl);
+	     item = cl_qmap_next(item)) {
+		p_sw = (osm_switch_t *)item;
+
+		for (pn = 0; pn < p_sw->num_ports; pn++) {
+			osm_node_t *p_remote_node;
+			p_remote_node = osm_node_get_remote_node(p_sw->p_node, pn, &pn_rem);
+			if(p_remote_node && !p_remote_node->sw) {
+				struct dnup_node *u = p_sw->priv;
+				u->rank = 0;
+				OSM_LOG(&(p_dnup->p_osm->log),
+					OSM_LOG_VERBOSE, "(%s) rank 0 leaf switch\n",
+					p_sw->p_node->print_desc);
+				num_leafs++;
+				break;
+			}
+		}
+	}
+
+	if(num_leafs == 0) {
+		OSM_LOG(&(p_dnup->p_osm->log),
+			OSM_LOG_ERROR, "ERR AE0D: No leaf switches found, DnUp routing failed\n");
+		OSM_LOG_EXIT(&p_dnup->p_osm->log);
+		return -1;
+	}
+
+	ret = dnup_build_lid_matrices(p_dnup);
+
+	for (item = cl_qmap_head(&p_dnup->p_osm->subn.sw_guid_tbl);
+	     item != cl_qmap_end(&p_dnup->p_osm->subn.sw_guid_tbl);
+	     item = cl_qmap_next(item)) {
+		p_sw = (osm_switch_t *) item;
+		delete_dnup_node(p_sw->priv);
+	}
+
+	OSM_LOG_EXIT(&p_dnup->p_osm->log);
+	return ret;
+}
+
+static void dnup_delete(void *context)
+{
+	free(context);
+}
+
+int osm_ucast_dnup_setup(struct osm_routing_engine *r, osm_opensm_t *osm)
+{
+	dnup_t *dnup;
+
+	OSM_LOG_ENTER(&osm->log);
+
+	dnup = malloc(sizeof(dnup_t));
+	if (!dnup)
+		return -1;
+	memset(dnup, 0, sizeof(dnup_t));
+
+	dnup->p_osm = osm;
+
+	r->context = dnup;
+	r->destroy = dnup_delete;
+	r->build_lid_matrices = dnup_lid_matrices;
+
+	OSM_LOG_EXIT(&osm->log);
+	return 0;
+}
diff --git a/opensm/osm_ucast_file.c b/opensm/osm_ucast_file.c
index 2505c46..6eeb144 100644
--- a/opensm/osm_ucast_file.c
+++ b/opensm/osm_ucast_file.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2006,2007 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2008      Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2006,2008-2009 Mellanox Technologies LTD. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -49,6 +49,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_UCAST_FILE_C
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_log.h>
@@ -108,10 +110,8 @@ static void add_lid_hops(osm_opensm_t * p_osm, osm_switch_t * p_sw,
 			 uint16_t lid, ib_net64_t guid,
 			 uint8_t hops[], unsigned len)
 {
-	uint16_t new_lid;
 	uint8_t i;
 
-	new_lid = guid ? remap_lid(p_osm, lid, guid) : lid;
 	if (len > p_sw->num_ports)
 		len = p_sw->num_ports;
 
@@ -130,6 +130,7 @@ static int do_ucast_file_load(void *context)
 	uint16_t lid;
 	uint8_t port_num;
 	unsigned lineno;
+	int status = -1;
 
 	file_name = p_osm->subn.opt.lfts_file;
 	if (!file_name) {
@@ -142,8 +143,8 @@ static int do_ucast_file_load(void *context)
 	file = fopen(file_name, "r");
 	if (!file) {
 		OSM_LOG(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS, "ERR 6302: "
-			"cannot open ucast dump file \'%s\': %m\n", file_name);
-		return -1;
+			"Can't open ucast dump file \'%s\': %m\n", file_name);
+		goto Exit;
 	}
 
 	lineno = 0;
@@ -167,16 +168,13 @@ static int do_ucast_file_load(void *context)
 				"skipping parsing. Using default "
 				"routing algorithm\n");
 		} else if (!strncmp(p, "Unicast lids", 12)) {
-			if (p_sw)
-				osm_ucast_mgr_set_fwd_table(&p_osm->sm.
-							    ucast_mgr, p_sw);
 			q = strstr(p, " guid 0x");
 			if (!q) {
 				OSM_LOG(&p_osm->log, OSM_LOG_ERROR,
 					"PARSE ERROR: %s:%u: "
 					"cannot parse switch definition\n",
 					file_name, lineno);
-				return -1;
+				goto Exit;
 			}
 			p = q + 8;
 			sw_guid = strtoull(p, &q, 16);
@@ -185,7 +183,7 @@ static int do_ucast_file_load(void *context)
 					"PARSE ERROR: %s:%u: "
 					"cannot parse switch guid: \'%s\'\n",
 					file_name, lineno, p);
-				return -1;
+				goto Exit;
 			}
 			sw_guid = cl_hton64(sw_guid);
 
@@ -196,8 +194,7 @@ static int do_ucast_file_load(void *context)
 					cl_ntoh64(sw_guid));
 				continue;
 			}
-			memset(p_sw->new_lft, OSM_NO_PATH,
-			       IB_LID_UCAST_END_HO + 1);
+			memset(p_sw->new_lft, OSM_NO_PATH, p_sw->lft_size);
 		} else if (p_sw && !strncmp(p, "0x", 2)) {
 			p += 2;
 			lid = (uint16_t) strtoul(p, &q, 16);
@@ -206,7 +203,7 @@ static int do_ucast_file_load(void *context)
 					"PARSE ERROR: %s:%u: "
 					"cannot parse lid: \'%s\'\n",
 					file_name, lineno, p);
-				return -1;
+				goto Exit;
 			}
 			p = q;
 			while (isspace(*p))
@@ -217,10 +214,10 @@ static int do_ucast_file_load(void *context)
 					"PARSE ERROR: %s:%u: "
 					"cannot parse port: \'%s\'\n",
 					file_name, lineno, p);
-				return -1;
+				goto Exit;
 			}
 			p = q;
-			/* additionally try to exract guid */
+			/* additionally try to extract guid */
 			q = strstr(p, " portguid 0x");
 			if (!q) {
 				OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,
@@ -245,12 +242,11 @@ static int do_ucast_file_load(void *context)
 			add_path(p_osm, p_sw, lid, port_num, port_guid);
 		}
 	}
-
-	if (p_sw)
-		osm_ucast_mgr_set_fwd_table(&p_osm->sm.ucast_mgr, p_sw);
-
-	fclose(file);
-	return 0;
+	status = 0;
+Exit:
+	if (file)
+		fclose(file);
+	return status;
 }
 
 static int do_lid_matrix_file_load(void *context)
@@ -264,6 +260,7 @@ static int do_lid_matrix_file_load(void *context)
 	osm_switch_t *p_sw;
 	unsigned lineno;
 	uint16_t lid;
+	int status = -1;
 
 	file_name = p_osm->subn.opt.lid_matrix_dump_file;
 	if (!file_name) {
@@ -276,8 +273,8 @@ static int do_lid_matrix_file_load(void *context)
 	file = fopen(file_name, "r");
 	if (!file) {
 		OSM_LOG(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS, "ERR 6305: "
-			"cannot open lid matrix file \'%s\': %m\n", file_name);
-		return -1;
+			"Can't open lid matrix file \'%s\': %m\n", file_name);
+		goto Exit;
 	}
 
 	lineno = 0;
@@ -301,7 +298,7 @@ static int do_lid_matrix_file_load(void *context)
 					"PARSE ERROR: %s:%u: "
 					"cannot parse switch definition\n",
 					file_name, lineno);
-				return -1;
+				goto Exit;
 			}
 			p = q + 8;
 			guid = strtoull(p, &q, 16);
@@ -310,7 +307,7 @@ static int do_lid_matrix_file_load(void *context)
 					"PARSE ERROR: %s:%u: "
 					"cannot parse switch guid: \'%s\'\n",
 					file_name, lineno, p);
-				return -1;
+				goto Exit;
 			}
 			guid = cl_hton64(guid);
 
@@ -335,7 +332,7 @@ static int do_lid_matrix_file_load(void *context)
 					"PARSE ERROR: %s:%u: "
 					"cannot parse lid: \'%s\'\n",
 					file_name, lineno, p);
-				return -1;
+				goto Exit;
 			}
 			/* Just checked the range, so casting is safe */
 			lid = (uint16_t) num;
@@ -349,7 +346,7 @@ static int do_lid_matrix_file_load(void *context)
 						"PARSE ERROR: %s:%u: "
 						"cannot parse hops number: \'%s\'\n",
 						file_name, lineno, p);
-					return -1;
+					goto Exit;
 				}
 				/* Just checked the range, so casting is safe */
 				hops[len++] = (uint8_t) num;
@@ -382,9 +379,11 @@ static int do_lid_matrix_file_load(void *context)
 			add_lid_hops(p_osm, p_sw, lid, guid, hops, len);
 		}
 	}
-
-	fclose(file);
-	return 0;
+	status = 0;
+Exit:
+	if (file)
+		fclose(file);
+	return status;
 }
 
 int osm_ucast_file_setup(struct osm_routing_engine *r, osm_opensm_t *osm)
diff --git a/opensm/osm_ucast_ftree.c b/opensm/osm_ucast_ftree.c
index aa51d23..532a29f 100644
--- a/opensm/osm_ucast_ftree.c
+++ b/opensm/osm_ucast_ftree.c
@@ -1,6 +1,8 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2009 Simula Research Laboratory. All rights reserved.
+ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -49,6 +51,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_UCAST_FTREE_C
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_switch.h>
 
@@ -61,7 +65,7 @@
  *    Switches are stored in two cl_qmaps - one is
  *    ordered by guid, and the other by a key that is
  *    generated from tuple. Since cl_qmap supports only
- *    a 64-bit key, the maximal tuple lenght is 8 bytes.
+ *    a 64-bit key, the maximal tuple length is 8 bytes.
  *    which means that maximal tree rank is 8.
  * Note that the above also implies that each switch
  * can have at max 255 up/down ports.
@@ -81,7 +85,6 @@ typedef enum {
  **  Forward references
  **
  ***************************************************/
-
 struct ftree_sw_t_;
 struct ftree_hca_t_;
 struct ftree_port_t_;
@@ -100,11 +103,6 @@ struct ftree_fabric_t_;
 typedef uint8_t ftree_tuple_t[FTREE_TUPLE_LEN];
 typedef uint64_t ftree_tuple_key_t;
 
-struct guid_list_item {
-	cl_list_item_t list;
-	uint64_t guid;
-};
-
 /***************************************************
  **
  **  ftree_sw_table_element_t definition
@@ -126,8 +124,8 @@ typedef struct ftree_port_t_ {
 	cl_map_item_t map_item;
 	uint8_t port_num;	/* port number on the current node */
 	uint8_t remote_port_num;	/* port number on the remote node */
-	uint32_t counter_up;	/* number of allocated routs upwards */
-	uint32_t counter_down;	/* number of allocated routs downwards */
+	uint32_t counter_up;	/* number of allocated routes upwards */
+	uint32_t counter_down;	/* number of allocated routes downwards */
 } ftree_port_t;
 
 /***************************************************
@@ -143,8 +141,8 @@ typedef union ftree_hca_or_sw_ {
 
 typedef struct ftree_port_group_t_ {
 	cl_map_item_t map_item;
-	ib_net16_t base_lid;	/* base lid of the current node */
-	ib_net16_t remote_base_lid;	/* base lid of the remote node */
+	uint16_t base_lid;	/* base lid of the current node */
+	uint16_t remote_base_lid;	/* base lid of the remote node */
 	ib_net64_t port_guid;	/* port guid of this port */
 	ib_net64_t node_guid;	/* this node's guid */
 	uint8_t node_type;	/* this node's type */
@@ -155,7 +153,9 @@ typedef struct ftree_port_group_t_ {
 	ftree_hca_or_sw remote_hca_or_sw;	/* pointer to remote hca/switch */
 	cl_ptr_vector_t ports;	/* vector of ports to the same lid */
 	boolean_t is_cn;	/* whether this port is a compute node */
-	uint32_t counter_down;	/* number of allocated routs downwards */
+	boolean_t is_io;	/* whether this port is an I/O node */
+	uint32_t counter_down;	/* number of allocated routes downwards */
+	uint32_t counter_up;	/* number of allocated routes upwards */
 } ftree_port_group_t;
 
 /***************************************************
@@ -169,13 +169,18 @@ typedef struct ftree_sw_t_ {
 	osm_switch_t *p_osm_sw;
 	uint32_t rank;
 	ftree_tuple_t tuple;
-	ib_net16_t base_lid;
+	uint16_t base_lid;
 	ftree_port_group_t **down_port_groups;
 	uint8_t down_port_groups_num;
+	ftree_port_group_t **sibling_port_groups;
+	uint8_t sibling_port_groups_num;
 	ftree_port_group_t **up_port_groups;
 	uint8_t up_port_groups_num;
 	boolean_t is_leaf;
-	int down_port_groups_idx;
+	unsigned down_port_groups_idx;
+	uint8_t *hops;
+	uint32_t min_counter_down;
+	boolean_t counter_up_changed;
 } ftree_sw_t;
 
 /***************************************************
@@ -203,15 +208,16 @@ typedef struct ftree_fabric_t_ {
 	cl_qmap_t hca_tbl;
 	cl_qmap_t sw_tbl;
 	cl_qmap_t sw_by_tuple_tbl;
-	cl_qlist_t root_guid_list;
 	cl_qmap_t cn_guid_tbl;
+	cl_qmap_t io_guid_tbl;
 	unsigned cn_num;
+	unsigned ca_ports;
 	uint8_t leaf_switch_rank;
 	uint8_t max_switch_rank;
 	ftree_sw_t **leaf_switches;
 	uint32_t leaf_switches_num;
 	uint16_t max_cn_per_leaf;
-	uint16_t lft_max_lid_ho;
+	uint16_t lft_max_lid;
 	boolean_t fabric_built;
 } ftree_fabric_t;
 
@@ -221,8 +227,7 @@ typedef struct ftree_fabric_t_ {
  **
  ***************************************************/
 
-static int OSM_CDECL __osm_ftree_compare_switches_by_index(IN const void *p1,
-							   IN const void *p2)
+static int compare_switches_by_index(IN const void *p1, IN const void *p2)
 {
 	ftree_sw_t **pp_sw1 = (ftree_sw_t **) p1;
 	ftree_sw_t **pp_sw2 = (ftree_sw_t **) p2;
@@ -239,19 +244,15 @@ static int OSM_CDECL __osm_ftree_compare_switches_by_index(IN const void *p1,
 
 /***************************************************/
 
-static int OSM_CDECL
-__osm_ftree_compare_port_groups_by_remote_switch_index(IN const void *p1,
-						       IN const void *p2)
+static int
+compare_port_groups_by_remote_switch_index(IN const void *p1, IN const void *p2)
 {
 	ftree_port_group_t **pp_g1 = (ftree_port_group_t **) p1;
 	ftree_port_group_t **pp_g2 = (ftree_port_group_t **) p2;
 
 	return
-	    __osm_ftree_compare_switches_by_index(&
-						  ((*pp_g1)->remote_hca_or_sw.
-						   p_sw),
-						  &((*pp_g2)->remote_hca_or_sw.
-						    p_sw));
+	    compare_switches_by_index(&((*pp_g1)->remote_hca_or_sw.p_sw),
+				      &((*pp_g2)->remote_hca_or_sw.p_sw));
 }
 
 /***************************************************
@@ -260,14 +261,14 @@ __osm_ftree_compare_port_groups_by_remote_switch_index(IN const void *p1,
  **
  ***************************************************/
 
-static void __osm_ftree_tuple_init(IN ftree_tuple_t tuple)
+static void tuple_init(IN ftree_tuple_t tuple)
 {
 	memset(tuple, 0xFF, FTREE_TUPLE_LEN);
 }
 
 /***************************************************/
 
-static inline boolean_t __osm_ftree_tuple_assigned(IN ftree_tuple_t tuple)
+static inline boolean_t tuple_assigned(IN ftree_tuple_t tuple)
 {
 	return (tuple[0] != 0xFF);
 }
@@ -276,14 +277,14 @@ static inline boolean_t __osm_ftree_tuple_assigned(IN ftree_tuple_t tuple)
 
 #define FTREE_TUPLE_BUFFERS_NUM 6
 
-static char *__osm_ftree_tuple_to_str(IN ftree_tuple_t tuple)
+static char *tuple_to_str(IN ftree_tuple_t tuple)
 {
 	static char buffer[FTREE_TUPLE_BUFFERS_NUM][FTREE_TUPLE_BUFF_LEN];
 	static uint8_t ind = 0;
 	char *ret_buffer;
 	uint32_t i;
 
-	if (!__osm_ftree_tuple_assigned(tuple))
+	if (!tuple_assigned(tuple))
 		return "INDEX.NOT.ASSIGNED";
 
 	buffer[ind][0] = '\0';
@@ -299,11 +300,11 @@ static char *__osm_ftree_tuple_to_str(IN ftree_tuple_t tuple)
 	ret_buffer = buffer[ind];
 	ind = (ind + 1) % FTREE_TUPLE_BUFFERS_NUM;
 	return ret_buffer;
-}				/* __osm_ftree_tuple_to_str() */
+}				/* tuple_to_str() */
 
 /***************************************************/
 
-static inline ftree_tuple_key_t __osm_ftree_tuple_to_key(IN ftree_tuple_t tuple)
+static inline ftree_tuple_key_t tuple_to_key(IN ftree_tuple_t tuple)
 {
 	ftree_tuple_key_t key;
 	memcpy(&key, tuple, FTREE_TUPLE_LEN);
@@ -312,8 +313,8 @@ static inline ftree_tuple_key_t __osm_ftree_tuple_to_key(IN ftree_tuple_t tuple)
 
 /***************************************************/
 
-static inline void __osm_ftree_tuple_from_key(IN ftree_tuple_t tuple,
-					      IN ftree_tuple_key_t key)
+static inline void tuple_from_key(IN ftree_tuple_t tuple,
+				  IN ftree_tuple_key_t key)
 {
 	memcpy(tuple, &key, FTREE_TUPLE_LEN);
 }
@@ -324,8 +325,7 @@ static inline void __osm_ftree_tuple_from_key(IN ftree_tuple_t tuple,
  **
  ***************************************************/
 
-static ftree_sw_tbl_element_t *__osm_ftree_sw_tbl_element_create(IN ftree_sw_t *
-								 p_sw)
+static ftree_sw_tbl_element_t *sw_tbl_element_create(IN ftree_sw_t * p_sw)
 {
 	ftree_sw_tbl_element_t *p_element =
 	    (ftree_sw_tbl_element_t *) malloc(sizeof(ftree_sw_tbl_element_t));
@@ -339,8 +339,7 @@ static ftree_sw_tbl_element_t *__osm_ftree_sw_tbl_element_create(IN ftree_sw_t *
 
 /***************************************************/
 
-static void __osm_ftree_sw_tbl_element_destroy(IN ftree_sw_tbl_element_t *
-					       p_element)
+static void sw_tbl_element_destroy(IN ftree_sw_tbl_element_t * p_element)
 {
 	if (!p_element)
 		return;
@@ -353,8 +352,8 @@ static void __osm_ftree_sw_tbl_element_destroy(IN ftree_sw_tbl_element_t *
  **
  ***************************************************/
 
-static ftree_port_t *__osm_ftree_port_create(IN uint8_t port_num,
-					     IN uint8_t remote_port_num)
+static ftree_port_t *port_create(IN uint8_t port_num,
+				 IN uint8_t remote_port_num)
 {
 	ftree_port_t *p_port = (ftree_port_t *) malloc(sizeof(ftree_port_t));
 	if (!p_port)
@@ -369,7 +368,7 @@ static ftree_port_t *__osm_ftree_port_create(IN uint8_t port_num,
 
 /***************************************************/
 
-static void __osm_ftree_port_destroy(IN ftree_port_t * p_port)
+static void port_destroy(IN ftree_port_t * p_port)
 {
 	if (p_port)
 		free(p_port);
@@ -381,18 +380,18 @@ static void __osm_ftree_port_destroy(IN ftree_port_t * p_port)
  **
  ***************************************************/
 
-static ftree_port_group_t *
-__osm_ftree_port_group_create(IN ib_net16_t base_lid,
-			      IN ib_net16_t remote_base_lid,
-			      IN ib_net64_t port_guid,
-			      IN ib_net64_t node_guid,
-			      IN uint8_t node_type,
-		              IN void *p_hca_or_sw,
-			      IN ib_net64_t remote_port_guid,
-			      IN ib_net64_t remote_node_guid,
-			      IN uint8_t remote_node_type,
-			      IN void *p_remote_hca_or_sw,
-			      IN boolean_t is_cn)
+static ftree_port_group_t *port_group_create(IN uint16_t base_lid,
+					     IN uint16_t remote_base_lid,
+					     IN ib_net64_t port_guid,
+					     IN ib_net64_t node_guid,
+					     IN uint8_t node_type,
+					     IN void *p_hca_or_sw,
+					     IN ib_net64_t remote_port_guid,
+					     IN ib_net64_t remote_node_guid,
+					     IN uint8_t remote_node_type,
+					     IN void *p_remote_hca_or_sw,
+					     IN boolean_t is_cn,
+					     IN boolean_t is_io)
 {
 	ftree_port_group_t *p_group =
 	    (ftree_port_group_t *) malloc(sizeof(ftree_port_group_t));
@@ -440,12 +439,13 @@ __osm_ftree_port_group_create(IN ib_net16_t base_lid,
 	cl_ptr_vector_init(&p_group->ports, 0,	/* min size */
 			   8);	/* grow size */
 	p_group->is_cn = is_cn;
+	p_group->is_io = is_io;
 	return p_group;
-}				/* __osm_ftree_port_group_create() */
+}				/* port_group_create() */
 
 /***************************************************/
 
-static void __osm_ftree_port_group_destroy(IN ftree_port_group_t * p_group)
+static void port_group_destroy(IN ftree_port_group_t * p_group)
 {
 	uint32_t i;
 	uint32_t size;
@@ -458,16 +458,15 @@ static void __osm_ftree_port_group_destroy(IN ftree_port_group_t * p_group)
 	size = cl_ptr_vector_get_size(&p_group->ports);
 	for (i = 0; i < size; i++) {
 		cl_ptr_vector_at(&p_group->ports, i, (void *)&p_port);
-		__osm_ftree_port_destroy(p_port);
+		port_destroy(p_port);
 	}
 	cl_ptr_vector_destroy(&p_group->ports);
 	free(p_group);
-}				/* __osm_ftree_port_group_destroy() */
+}				/* port_group_destroy() */
 
 /***************************************************/
 
-static void
-__osm_ftree_port_group_dump(IN ftree_fabric_t * p_ftree,
+static void port_group_dump(IN ftree_fabric_t * p_ftree,
 			    IN ftree_port_group_t * p_group,
 			    IN ftree_direction_t direction)
 {
@@ -479,7 +478,7 @@ __osm_ftree_port_group_dump(IN ftree_fabric_t * p_ftree,
 	if (!p_group)
 		return;
 
-	if (!osm_log_is_active(&p_ftree->p_osm->log, OSM_LOG_DEBUG))
+	if (!OSM_LOG_IS_ACTIVE_V2(&p_ftree->p_osm->log, OSM_LOG_DEBUG))
 		return;
 
 	size = cl_ptr_vector_get_size(&p_group->ports);
@@ -498,20 +497,18 @@ __osm_ftree_port_group_dump(IN ftree_fabric_t * p_ftree,
 		"    Port Group of size %u, port(s): %s, direction: %s\n"
 		"                  Local <--> Remote GUID (LID):"
 		"0x%016" PRIx64 " (0x%04x) <--> 0x%016" PRIx64 " (0x%04x)\n",
-		size,
-		buff,
-		(direction == FTREE_DIRECTION_DOWN) ? "DOWN" : "UP",
-		cl_ntoh64(p_group->port_guid),
-		cl_ntoh16(p_group->base_lid),
-		cl_ntoh64(p_group->remote_port_guid),
-		cl_ntoh16(p_group->remote_base_lid));
+		size, buff,
+		(direction == FTREE_DIRECTION_DOWN) ? "DOWN" : (direction ==
+								FTREE_DIRECTION_SAME)
+		? "SIBLING" : "UP", cl_ntoh64(p_group->port_guid),
+		p_group->base_lid, cl_ntoh64(p_group->remote_port_guid),
+		p_group->remote_base_lid);
 
-}				/* __osm_ftree_port_group_dump() */
+}				/* port_group_dump() */
 
 /***************************************************/
 
-static void
-__osm_ftree_port_group_add_port(IN ftree_port_group_t * p_group,
+static void port_group_add_port(IN ftree_port_group_t * p_group,
 				IN uint8_t port_num, IN uint8_t remote_port_num)
 {
 	uint16_t i;
@@ -523,7 +520,8 @@ __osm_ftree_port_group_add_port(IN ftree_port_group_t * p_group,
 			return;
 	}
 
-	p_port = __osm_ftree_port_create(port_num, remote_port_num);
+	p_port = port_create(port_num, remote_port_num);
+	CL_ASSERT(p_port);
 	cl_ptr_vector_insert(&p_group->ports, p_port, NULL);
 }
 
@@ -533,8 +531,8 @@ __osm_ftree_port_group_add_port(IN ftree_port_group_t * p_group,
  **
  ***************************************************/
 
-static ftree_sw_t *__osm_ftree_sw_create(IN ftree_fabric_t * p_ftree,
-					 IN osm_switch_t * p_osm_sw)
+static ftree_sw_t *sw_create(IN ftree_fabric_t * p_ftree,
+			     IN osm_switch_t * p_osm_sw)
 {
 	ftree_sw_t *p_sw;
 	uint8_t ports_num;
@@ -550,55 +548,80 @@ static ftree_sw_t *__osm_ftree_sw_create(IN ftree_fabric_t * p_ftree,
 
 	p_sw->p_osm_sw = p_osm_sw;
 	p_sw->rank = 0xFFFFFFFF;
-	__osm_ftree_tuple_init(p_sw->tuple);
+	tuple_init(p_sw->tuple);
 
-	p_sw->base_lid = osm_node_get_base_lid(p_sw->p_osm_sw->p_node, 0);
+	p_sw->base_lid =
+	    cl_ntoh16(osm_node_get_base_lid(p_sw->p_osm_sw->p_node, 0));
 
 	ports_num = osm_node_get_num_physp(p_sw->p_osm_sw->p_node);
 	p_sw->down_port_groups =
 	    (ftree_port_group_t **) malloc(ports_num *
 					   sizeof(ftree_port_group_t *));
+	if (p_sw->down_port_groups == NULL)
+		goto FREE_P_SW;
+
 	p_sw->up_port_groups =
 	    (ftree_port_group_t **) malloc(ports_num *
 					   sizeof(ftree_port_group_t *));
-	if (!p_sw->down_port_groups || !p_sw->up_port_groups)
-		return NULL;
-	p_sw->down_port_groups_num = 0;
-	p_sw->up_port_groups_num = 0;
+	if (p_sw->up_port_groups == NULL)
+		goto FREE_DOWN;
+
+	p_sw->sibling_port_groups =
+	    (ftree_port_group_t **) malloc(ports_num *
+					   sizeof(ftree_port_group_t *));
+	if (p_sw->sibling_port_groups == NULL)
+		goto FREE_UP;
 
 	/* initialize lft buffer */
-	memset(p_osm_sw->new_lft, OSM_NO_PATH, IB_LID_UCAST_END_HO + 1);
+	memset(p_osm_sw->new_lft, OSM_NO_PATH, p_osm_sw->lft_size);
+	p_sw->hops = malloc((p_osm_sw->max_lid_ho + 1) * sizeof(*(p_sw->hops)));
+	if (p_sw->hops == NULL)
+		goto FREE_SIBLING;
 
-	p_sw->down_port_groups_idx = -1;
+	memset(p_sw->hops, OSM_NO_PATH, p_osm_sw->max_lid_ho + 1);
 
 	return p_sw;
-}				/* __osm_ftree_sw_create() */
+
+FREE_SIBLING:
+	free(p_sw->sibling_port_groups);
+FREE_UP:
+	free(p_sw->up_port_groups);
+FREE_DOWN:
+	free(p_sw->down_port_groups);
+FREE_P_SW:
+	free(p_sw);
+	return NULL;
+}				/* sw_create() */
 
 /***************************************************/
 
-static void __osm_ftree_sw_destroy(IN ftree_fabric_t * p_ftree,
-				   IN ftree_sw_t * p_sw)
+static void sw_destroy(IN ftree_fabric_t * p_ftree, IN ftree_sw_t * p_sw)
 {
 	uint8_t i;
 
 	if (!p_sw)
 		return;
+	free(p_sw->hops);
 
 	for (i = 0; i < p_sw->down_port_groups_num; i++)
-		__osm_ftree_port_group_destroy(p_sw->down_port_groups[i]);
+		port_group_destroy(p_sw->down_port_groups[i]);
+	for (i = 0; i < p_sw->sibling_port_groups_num; i++)
+		port_group_destroy(p_sw->sibling_port_groups[i]);
 	for (i = 0; i < p_sw->up_port_groups_num; i++)
-		__osm_ftree_port_group_destroy(p_sw->up_port_groups[i]);
+		port_group_destroy(p_sw->up_port_groups[i]);
 	if (p_sw->down_port_groups)
 		free(p_sw->down_port_groups);
+	if (p_sw->sibling_port_groups)
+		free(p_sw->sibling_port_groups);
 	if (p_sw->up_port_groups)
 		free(p_sw->up_port_groups);
 
 	free(p_sw);
-}				/* __osm_ftree_sw_destroy() */
+}				/* sw_destroy() */
 
 /***************************************************/
 
-static uint64_t __osm_ftree_sw_get_guid_no(IN ftree_sw_t * p_sw)
+static uint64_t sw_get_guid_no(IN ftree_sw_t * p_sw)
 {
 	if (!p_sw)
 		return 0;
@@ -607,54 +630,56 @@ static uint64_t __osm_ftree_sw_get_guid_no(IN ftree_sw_t * p_sw)
 
 /***************************************************/
 
-static uint64_t __osm_ftree_sw_get_guid_ho(IN ftree_sw_t * p_sw)
+static uint64_t sw_get_guid_ho(IN ftree_sw_t * p_sw)
 {
-	return cl_ntoh64(__osm_ftree_sw_get_guid_no(p_sw));
+	return cl_ntoh64(sw_get_guid_no(p_sw));
 }
 
 /***************************************************/
 
-static void __osm_ftree_sw_dump(IN ftree_fabric_t * p_ftree,
-				IN ftree_sw_t * p_sw)
+static void sw_dump(IN ftree_fabric_t * p_ftree, IN ftree_sw_t * p_sw)
 {
 	uint32_t i;
 
 	if (!p_sw)
 		return;
 
-	if (!osm_log_is_active(&p_ftree->p_osm->log, OSM_LOG_DEBUG))
+	if (!OSM_LOG_IS_ACTIVE_V2(&p_ftree->p_osm->log, OSM_LOG_DEBUG))
 		return;
 
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 		"Switch index: %s, GUID: 0x%016" PRIx64
-		", Ports: %u DOWN, %u UP\n",
-		__osm_ftree_tuple_to_str(p_sw->tuple),
-		__osm_ftree_sw_get_guid_ho(p_sw), p_sw->down_port_groups_num,
+		", Ports: %u DOWN, %u SIBLINGS, %u UP\n",
+		tuple_to_str(p_sw->tuple), sw_get_guid_ho(p_sw),
+		p_sw->down_port_groups_num, p_sw->sibling_port_groups_num,
 		p_sw->up_port_groups_num);
 
 	for (i = 0; i < p_sw->down_port_groups_num; i++)
-		__osm_ftree_port_group_dump(p_ftree,
-					    p_sw->down_port_groups[i],
-					    FTREE_DIRECTION_DOWN);
+		port_group_dump(p_ftree, p_sw->down_port_groups[i],
+				FTREE_DIRECTION_DOWN);
+	for (i = 0; i < p_sw->sibling_port_groups_num; i++)
+		port_group_dump(p_ftree, p_sw->sibling_port_groups[i],
+				FTREE_DIRECTION_SAME);
 	for (i = 0; i < p_sw->up_port_groups_num; i++)
-		__osm_ftree_port_group_dump(p_ftree, p_sw->up_port_groups[i],
-					    FTREE_DIRECTION_UP);
+		port_group_dump(p_ftree, p_sw->up_port_groups[i],
+				FTREE_DIRECTION_UP);
 
-}				/* __osm_ftree_sw_dump() */
+}				/* sw_dump() */
 
 /***************************************************/
 
-static boolean_t __osm_ftree_sw_ranked(IN ftree_sw_t * p_sw)
+static boolean_t sw_ranked(IN ftree_sw_t * p_sw)
 {
 	return (p_sw->rank != 0xFFFFFFFF);
 }
 
 /***************************************************/
 
-static ftree_port_group_t *
-__osm_ftree_sw_get_port_group_by_remote_lid(IN ftree_sw_t * p_sw,
-					    IN ib_net16_t remote_base_lid,
-					    IN ftree_direction_t direction)
+static ftree_port_group_t *sw_get_port_group_by_remote_lid(IN ftree_sw_t * p_sw,
+							   IN uint16_t
+							   remote_base_lid,
+							   IN ftree_direction_t
+							   direction)
 {
 	uint32_t i;
 	uint32_t size;
@@ -663,6 +688,9 @@ __osm_ftree_sw_get_port_group_by_remote_lid(IN ftree_sw_t * p_sw,
 	if (direction == FTREE_DIRECTION_UP) {
 		port_groups = p_sw->up_port_groups;
 		size = p_sw->up_port_groups_num;
+	} else if (direction == FTREE_DIRECTION_SAME) {
+		port_groups = p_sw->sibling_port_groups;
+		size = p_sw->sibling_port_groups_num;
 	} else {
 		port_groups = p_sw->down_port_groups;
 		size = p_sw->down_port_groups_num;
@@ -673,17 +701,13 @@ __osm_ftree_sw_get_port_group_by_remote_lid(IN ftree_sw_t * p_sw,
 			return port_groups[i];
 
 	return NULL;
-}				/* __osm_ftree_sw_get_port_group_by_remote_lid() */
+}				/* sw_get_port_group_by_remote_lid() */
 
 /***************************************************/
 
-static void
-__osm_ftree_sw_add_port(IN ftree_sw_t * p_sw,
-			IN uint8_t port_num,
-			IN uint8_t remote_port_num,
-			IN ib_net16_t base_lid,
-			IN ib_net16_t remote_base_lid,
-			IN ib_net64_t port_guid,
+static void sw_add_port(IN ftree_sw_t * p_sw, IN uint8_t port_num,
+			IN uint8_t remote_port_num, IN uint16_t base_lid,
+			IN uint16_t remote_base_lid, IN ib_net64_t port_guid,
 			IN ib_net64_t remote_port_guid,
 			IN ib_net64_t remote_node_guid,
 			IN uint8_t remote_node_type,
@@ -691,43 +715,81 @@ __osm_ftree_sw_add_port(IN ftree_sw_t * p_sw,
 			IN ftree_direction_t direction)
 {
 	ftree_port_group_t *p_group =
-	    __osm_ftree_sw_get_port_group_by_remote_lid(p_sw, remote_base_lid,
-							direction);
+	    sw_get_port_group_by_remote_lid(p_sw, remote_base_lid, direction);
 
 	if (!p_group) {
-		p_group = __osm_ftree_port_group_create(base_lid,
-							remote_base_lid,
-							port_guid,
-							__osm_ftree_sw_get_guid_no
-							(p_sw),
-							IB_NODE_TYPE_SWITCH,
-							p_sw, remote_port_guid,
-							remote_node_guid,
-							remote_node_type,
-							p_remote_hca_or_sw,
-							FALSE);
+		p_group = port_group_create(base_lid, remote_base_lid,
+					    port_guid, sw_get_guid_no(p_sw),
+					    IB_NODE_TYPE_SWITCH, p_sw,
+					    remote_port_guid, remote_node_guid,
+					    remote_node_type,
+					    p_remote_hca_or_sw, FALSE, FALSE);
 		CL_ASSERT(p_group);
 
-		if (direction == FTREE_DIRECTION_UP)
+		if (direction == FTREE_DIRECTION_UP) {
 			p_sw->up_port_groups[p_sw->up_port_groups_num++] =
 			    p_group;
-		else
+		} else if (direction == FTREE_DIRECTION_SAME) {
+			p_sw->
+			    sibling_port_groups[p_sw->sibling_port_groups_num++]
+			    = p_group;
+		} else
 			p_sw->down_port_groups[p_sw->down_port_groups_num++] =
 			    p_group;
 	}
-	__osm_ftree_port_group_add_port(p_group, port_num, remote_port_num);
+	port_group_add_port(p_group, port_num, remote_port_num);
 
-}				/* __osm_ftree_sw_add_port() */
+}				/* sw_add_port() */
 
 /***************************************************/
 
-static inline cl_status_t
-__osm_ftree_sw_set_hops(IN ftree_sw_t * p_sw,
-			IN uint16_t lid_ho, IN uint8_t port_num,
-			IN uint8_t hops)
+static inline cl_status_t sw_set_hops(IN ftree_sw_t * p_sw, IN uint16_t lid,
+				      IN uint8_t port_num, IN uint8_t hops,
+				      IN boolean_t is_target_sw)
 {
 	/* set local min hop table(LID) */
-	return osm_switch_set_hops(p_sw->p_osm_sw, lid_ho, port_num, hops);
+	p_sw->hops[lid] = hops;
+	if (is_target_sw)
+		return osm_switch_set_hops(p_sw->p_osm_sw, lid, port_num, hops);
+	return 0;
+}
+
+/***************************************************/
+
+static int set_hops_on_remote_sw(IN ftree_port_group_t * p_group,
+				 IN uint16_t target_lid, IN uint8_t hops,
+				 IN boolean_t is_target_sw)
+{
+	ftree_port_t *p_port;
+	uint8_t i, ports_num;
+	ftree_sw_t *p_remote_sw = p_group->remote_hca_or_sw.p_sw;
+
+	/* if lid is a switch, we set the min hop table in the osm_switch struct */
+	CL_ASSERT(p_group->remote_node_type == IB_NODE_TYPE_SWITCH);
+	p_remote_sw->hops[target_lid] = hops;
+
+	/* If target lid is a switch we set the min hop table values
+	 * for each port on the associated osm_sw struct */
+	if (!is_target_sw)
+		return 0;
+
+	ports_num = (uint8_t) cl_ptr_vector_get_size(&p_group->ports);
+	for (i = 0; i < ports_num; i++) {
+		cl_ptr_vector_at(&p_group->ports, i, (void *)&p_port);
+		if (sw_set_hops(p_remote_sw, target_lid,
+				p_port->remote_port_num, hops, is_target_sw))
+			return -1;
+	}
+	return 0;
+}
+
+/***************************************************/
+
+static inline uint8_t
+sw_get_least_hops(IN ftree_sw_t * p_sw, IN uint16_t target_lid)
+{
+	CL_ASSERT(p_sw->hops != NULL);
+	return p_sw->hops[target_lid];
 }
 
 /***************************************************
@@ -736,7 +798,7 @@ __osm_ftree_sw_set_hops(IN ftree_sw_t * p_sw,
  **
  ***************************************************/
 
-static ftree_hca_t *__osm_ftree_hca_create(IN osm_node_t * p_osm_node)
+static ftree_hca_t *hca_create(IN osm_node_t * p_osm_node)
 {
 	ftree_hca_t *p_hca = (ftree_hca_t *) malloc(sizeof(ftree_hca_t));
 	if (p_hca == NULL)
@@ -747,15 +809,17 @@ static ftree_hca_t *__osm_ftree_hca_create(IN osm_node_t * p_osm_node)
 	p_hca->up_port_groups = (ftree_port_group_t **)
 	    malloc(osm_node_get_num_physp(p_hca->p_osm_node) *
 		   sizeof(ftree_port_group_t *));
-	if (!p_hca->up_port_groups)
+	if (!p_hca->up_port_groups) {
+		free(p_hca);
 		return NULL;
+	}
 	p_hca->up_port_groups_num = 0;
 	return p_hca;
 }
 
 /***************************************************/
 
-static void __osm_ftree_hca_destroy(IN ftree_hca_t * p_hca)
+static void hca_destroy(IN ftree_hca_t * p_hca)
 {
 	uint32_t i;
 
@@ -763,7 +827,7 @@ static void __osm_ftree_hca_destroy(IN ftree_hca_t * p_hca)
 		return;
 
 	for (i = 0; i < p_hca->up_port_groups_num; i++)
-		__osm_ftree_port_group_destroy(p_hca->up_port_groups[i]);
+		port_group_destroy(p_hca->up_port_groups[i]);
 
 	if (p_hca->up_port_groups)
 		free(p_hca->up_port_groups);
@@ -773,7 +837,7 @@ static void __osm_ftree_hca_destroy(IN ftree_hca_t * p_hca)
 
 /***************************************************/
 
-static uint64_t __osm_ftree_hca_get_guid_no(IN ftree_hca_t * p_hca)
+static uint64_t hca_get_guid_no(IN ftree_hca_t * p_hca)
 {
 	if (!p_hca)
 		return 0;
@@ -782,38 +846,38 @@ static uint64_t __osm_ftree_hca_get_guid_no(IN ftree_hca_t * p_hca)
 
 /***************************************************/
 
-static uint64_t __osm_ftree_hca_get_guid_ho(IN ftree_hca_t * p_hca)
+static uint64_t hca_get_guid_ho(IN ftree_hca_t * p_hca)
 {
-	return cl_ntoh64(__osm_ftree_hca_get_guid_no(p_hca));
+	return cl_ntoh64(hca_get_guid_no(p_hca));
 }
 
 /***************************************************/
 
-static void __osm_ftree_hca_dump(IN ftree_fabric_t * p_ftree,
-				 IN ftree_hca_t * p_hca)
+static void hca_dump(IN ftree_fabric_t * p_ftree, IN ftree_hca_t * p_hca)
 {
 	uint32_t i;
 
 	if (!p_hca)
 		return;
 
-	if (!osm_log_is_active(&p_ftree->p_osm->log, OSM_LOG_DEBUG))
+	if (!OSM_LOG_IS_ACTIVE_V2(&p_ftree->p_osm->log, OSM_LOG_DEBUG))
 		return;
 
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 		"CA GUID: 0x%016" PRIx64 ", Ports: %u UP\n",
-		__osm_ftree_hca_get_guid_ho(p_hca), p_hca->up_port_groups_num);
+		hca_get_guid_ho(p_hca), p_hca->up_port_groups_num);
 
 	for (i = 0; i < p_hca->up_port_groups_num; i++)
-		__osm_ftree_port_group_dump(p_ftree, p_hca->up_port_groups[i],
-					    FTREE_DIRECTION_UP);
+		port_group_dump(p_ftree, p_hca->up_port_groups[i],
+				FTREE_DIRECTION_UP);
 }
 
 /***************************************************/
 
-static ftree_port_group_t *
-__osm_ftree_hca_get_port_group_by_remote_lid(IN ftree_hca_t * p_hca,
-					     IN ib_net16_t remote_base_lid)
+static ftree_port_group_t *hca_get_port_group_by_remote_lid(IN ftree_hca_t *
+							    p_hca,
+							    IN uint16_t
+							    remote_base_lid)
 {
 	uint32_t i;
 	for (i = 0; i < p_hca->up_port_groups_num; i++)
@@ -826,17 +890,14 @@ __osm_ftree_hca_get_port_group_by_remote_lid(IN ftree_hca_t * p_hca,
 
 /***************************************************/
 
-static void
-__osm_ftree_hca_add_port(IN ftree_hca_t * p_hca,
-			 IN uint8_t port_num,
-			 IN uint8_t remote_port_num,
-			 IN ib_net16_t base_lid,
-			 IN ib_net16_t remote_base_lid,
-			 IN ib_net64_t port_guid,
+static void hca_add_port(IN ftree_hca_t * p_hca, IN uint8_t port_num,
+			 IN uint8_t remote_port_num, IN uint16_t base_lid,
+			 IN uint16_t remote_base_lid, IN ib_net64_t port_guid,
 			 IN ib_net64_t remote_port_guid,
 			 IN ib_net64_t remote_node_guid,
 			 IN uint8_t remote_node_type,
-			 IN void *p_remote_hca_or_sw, IN boolean_t is_cn)
+			 IN void *p_remote_hca_or_sw, IN boolean_t is_cn,
+			 IN boolean_t is_io)
 {
 	ftree_port_group_t *p_group;
 
@@ -844,27 +905,21 @@ __osm_ftree_hca_add_port(IN ftree_hca_t * p_hca,
 	   in hca's that lead to switches */
 	CL_ASSERT(remote_node_type == IB_NODE_TYPE_SWITCH);
 
-	p_group =
-	    __osm_ftree_hca_get_port_group_by_remote_lid(p_hca,
-							 remote_base_lid);
+	p_group = hca_get_port_group_by_remote_lid(p_hca, remote_base_lid);
 
 	if (!p_group) {
-		p_group = __osm_ftree_port_group_create(base_lid,
-							remote_base_lid,
-							port_guid,
-							__osm_ftree_hca_get_guid_no
-							(p_hca),
-							IB_NODE_TYPE_CA, p_hca,
-							remote_port_guid,
-							remote_node_guid,
-							remote_node_type,
-							p_remote_hca_or_sw,
-							is_cn);
+		p_group = port_group_create(base_lid, remote_base_lid,
+					    port_guid, hca_get_guid_no(p_hca),
+					    IB_NODE_TYPE_CA, p_hca,
+					    remote_port_guid, remote_node_guid,
+					    remote_node_type,
+					    p_remote_hca_or_sw, is_cn, is_io);
+		CL_ASSERT(p_group);
 		p_hca->up_port_groups[p_hca->up_port_groups_num++] = p_group;
 	}
-	__osm_ftree_port_group_add_port(p_group, port_num, remote_port_num);
+	port_group_add_port(p_group, port_num, remote_port_num);
 
-}				/* __osm_ftree_hca_add_port() */
+}				/* hca_add_port() */
 
 /***************************************************
  **
@@ -872,7 +927,7 @@ __osm_ftree_hca_add_port(IN ftree_hca_t * p_hca,
  **
  ***************************************************/
 
-static ftree_fabric_t *__osm_ftree_fabric_create()
+static ftree_fabric_t *fabric_create()
 {
 	ftree_fabric_t *p_ftree =
 	    (ftree_fabric_t *) malloc(sizeof(ftree_fabric_t));
@@ -885,15 +940,14 @@ static ftree_fabric_t *__osm_ftree_fabric_create()
 	cl_qmap_init(&p_ftree->sw_tbl);
 	cl_qmap_init(&p_ftree->sw_by_tuple_tbl);
 	cl_qmap_init(&p_ftree->cn_guid_tbl);
-
-	cl_qlist_init(&p_ftree->root_guid_list);
+	cl_qmap_init(&p_ftree->io_guid_tbl);
 
 	return p_ftree;
 }
 
 /***************************************************/
 
-static void __osm_ftree_fabric_clear(ftree_fabric_t * p_ftree)
+static void fabric_clear(ftree_fabric_t * p_ftree)
 {
 	ftree_hca_t *p_hca;
 	ftree_hca_t *p_next_hca;
@@ -912,7 +966,7 @@ static void __osm_ftree_fabric_clear(ftree_fabric_t * p_ftree)
 	while (p_next_hca != (ftree_hca_t *) cl_qmap_end(&p_ftree->hca_tbl)) {
 		p_hca = p_next_hca;
 		p_next_hca = (ftree_hca_t *) cl_qmap_next(&p_hca->map_item);
-		__osm_ftree_hca_destroy(p_hca);
+		hca_destroy(p_hca);
 	}
 	cl_qmap_remove_all(&p_ftree->hca_tbl);
 
@@ -922,7 +976,7 @@ static void __osm_ftree_fabric_clear(ftree_fabric_t * p_ftree)
 	while (p_next_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl)) {
 		p_sw = p_next_sw;
 		p_next_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item);
-		__osm_ftree_sw_destroy(p_ftree, p_sw);
+		sw_destroy(p_ftree, p_sw);
 	}
 	cl_qmap_remove_all(&p_ftree->sw_tbl);
 
@@ -930,14 +984,12 @@ static void __osm_ftree_fabric_clear(ftree_fabric_t * p_ftree)
 
 	p_next_element =
 	    (ftree_sw_tbl_element_t *) cl_qmap_head(&p_ftree->sw_by_tuple_tbl);
-	while (p_next_element !=
-	       (ftree_sw_tbl_element_t *) cl_qmap_end(&p_ftree->
-						      sw_by_tuple_tbl)) {
+	while (p_next_element != (ftree_sw_tbl_element_t *)
+	       cl_qmap_end(&p_ftree->sw_by_tuple_tbl)) {
 		p_element = p_next_element;
-		p_next_element =
-		    (ftree_sw_tbl_element_t *) cl_qmap_next(&p_element->
-							    map_item);
-		__osm_ftree_sw_tbl_element_destroy(p_element);
+		p_next_element = (ftree_sw_tbl_element_t *)
+		    cl_qmap_next(&p_element->map_item);
+		sw_tbl_element_destroy(p_element);
 	}
 	cl_qmap_remove_all(&p_ftree->sw_by_tuple_tbl);
 
@@ -953,9 +1005,17 @@ static void __osm_ftree_fabric_clear(ftree_fabric_t * p_ftree)
 	}
 	cl_qmap_remove_all(&p_ftree->cn_guid_tbl);
 
-	/* remove all the elements of root_guid_list */
-	while (!cl_is_qlist_empty(&p_ftree->root_guid_list))
-		free(cl_qlist_remove_head(&p_ftree->root_guid_list));
+	/* remove all the elements of io_guid_tbl */
+	p_next_guid_element =
+	    (name_map_item_t *) cl_qmap_head(&p_ftree->io_guid_tbl);
+	while (p_next_guid_element !=
+	       (name_map_item_t *) cl_qmap_end(&p_ftree->io_guid_tbl)) {
+		p_guid_element = p_next_guid_element;
+		p_next_guid_element =
+		    (name_map_item_t *) cl_qmap_next(&p_guid_element->item);
+		free(p_guid_element);
+	}
+	cl_qmap_remove_all(&p_ftree->io_guid_tbl);
 
 	/* free the leaf switches array */
 	if ((p_ftree->leaf_switches_num > 0) && (p_ftree->leaf_switches))
@@ -963,90 +1023,94 @@ static void __osm_ftree_fabric_clear(ftree_fabric_t * p_ftree)
 
 	p_ftree->leaf_switches_num = 0;
 	p_ftree->cn_num = 0;
+	p_ftree->ca_ports = 0;
 	p_ftree->leaf_switch_rank = 0;
 	p_ftree->max_switch_rank = 0;
 	p_ftree->max_cn_per_leaf = 0;
-	p_ftree->lft_max_lid_ho = 0;
+	p_ftree->lft_max_lid = 0;
 	p_ftree->leaf_switches = NULL;
 	p_ftree->fabric_built = FALSE;
 
-}				/* __osm_ftree_fabric_destroy() */
+}				/* fabric_destroy() */
 
 /***************************************************/
 
-static void __osm_ftree_fabric_destroy(ftree_fabric_t * p_ftree)
+static void fabric_destroy(ftree_fabric_t * p_ftree)
 {
 	if (!p_ftree)
 		return;
-	__osm_ftree_fabric_clear(p_ftree);
+	fabric_clear(p_ftree);
 	free(p_ftree);
 }
 
 /***************************************************/
 
-static uint8_t __osm_ftree_fabric_get_rank(ftree_fabric_t * p_ftree)
+static uint8_t fabric_get_rank(ftree_fabric_t * p_ftree)
 {
 	return p_ftree->leaf_switch_rank + 1;
 }
 
 /***************************************************/
 
-static void __osm_ftree_fabric_add_hca(ftree_fabric_t * p_ftree,
-				       osm_node_t * p_osm_node)
+static void fabric_add_hca(ftree_fabric_t * p_ftree, osm_node_t * p_osm_node)
 {
-	ftree_hca_t *p_hca = __osm_ftree_hca_create(p_osm_node);
+	ftree_hca_t *p_hca;
 
 	CL_ASSERT(osm_node_get_type(p_osm_node) == IB_NODE_TYPE_CA);
 
+	p_hca = hca_create(p_osm_node);
+	if (!p_hca)
+		return;
+
 	cl_qmap_insert(&p_ftree->hca_tbl, p_osm_node->node_info.node_guid,
 		       &p_hca->map_item);
 }
 
 /***************************************************/
 
-static void __osm_ftree_fabric_add_sw(ftree_fabric_t * p_ftree,
-				      osm_switch_t * p_osm_sw)
+static void fabric_add_sw(ftree_fabric_t * p_ftree, osm_switch_t * p_osm_sw)
 {
-	ftree_sw_t *p_sw = __osm_ftree_sw_create(p_ftree, p_osm_sw);
+	ftree_sw_t *p_sw;
 
 	CL_ASSERT(osm_node_get_type(p_osm_sw->p_node) == IB_NODE_TYPE_SWITCH);
 
+	p_sw = sw_create(p_ftree, p_osm_sw);
+	if (!p_sw)
+		return;
+
 	cl_qmap_insert(&p_ftree->sw_tbl, p_osm_sw->p_node->node_info.node_guid,
 		       &p_sw->map_item);
 
 	/* track the max lid (in host order) that exists in the fabric */
-	if (cl_ntoh16(p_sw->base_lid) > p_ftree->lft_max_lid_ho)
-		p_ftree->lft_max_lid_ho = cl_ntoh16(p_sw->base_lid);
+	if (p_sw->base_lid > p_ftree->lft_max_lid)
+		p_ftree->lft_max_lid = p_sw->base_lid;
 }
 
 /***************************************************/
 
-static void __osm_ftree_fabric_add_sw_by_tuple(IN ftree_fabric_t * p_ftree,
-					       IN ftree_sw_t * p_sw)
+static void fabric_add_sw_by_tuple(IN ftree_fabric_t * p_ftree,
+				   IN ftree_sw_t * p_sw)
 {
-	CL_ASSERT(__osm_ftree_tuple_assigned(p_sw->tuple));
+	CL_ASSERT(tuple_assigned(p_sw->tuple));
 
-	cl_qmap_insert(&p_ftree->sw_by_tuple_tbl,
-		       __osm_ftree_tuple_to_key(p_sw->tuple),
-		       &__osm_ftree_sw_tbl_element_create(p_sw)->map_item);
+	cl_qmap_insert(&p_ftree->sw_by_tuple_tbl, tuple_to_key(p_sw->tuple),
+		       &sw_tbl_element_create(p_sw)->map_item);
 }
 
 /***************************************************/
 
-static ftree_sw_t *__osm_ftree_fabric_get_sw_by_tuple(IN ftree_fabric_t *
-						      p_ftree,
-						      IN ftree_tuple_t tuple)
+static ftree_sw_t *fabric_get_sw_by_tuple(IN ftree_fabric_t * p_ftree,
+					  IN ftree_tuple_t tuple)
 {
 	ftree_sw_tbl_element_t *p_element;
 
-	CL_ASSERT(__osm_ftree_tuple_assigned(tuple));
+	CL_ASSERT(tuple_assigned(tuple));
 
-	__osm_ftree_tuple_to_key(tuple);
+	tuple_to_key(tuple);
 
 	p_element =
 	    (ftree_sw_tbl_element_t *) cl_qmap_get(&p_ftree->sw_by_tuple_tbl,
-						   __osm_ftree_tuple_to_key
-						   (tuple));
+						   tuple_to_key(tuple));
 	if (p_element ==
 	    (ftree_sw_tbl_element_t *) cl_qmap_end(&p_ftree->sw_by_tuple_tbl))
 		return NULL;
@@ -1056,8 +1120,8 @@ static ftree_sw_t *__osm_ftree_fabric_get_sw_by_tuple(IN ftree_fabric_t *
 
 /***************************************************/
 
-static ftree_sw_t *__osm_ftree_fabric_get_sw_by_guid(IN ftree_fabric_t *
-						     p_ftree, IN uint64_t guid)
+static ftree_sw_t *fabric_get_sw_by_guid(IN ftree_fabric_t * p_ftree,
+					 IN uint64_t guid)
 {
 	ftree_sw_t *p_sw;
 	p_sw = (ftree_sw_t *) cl_qmap_get(&p_ftree->sw_tbl, guid);
@@ -1068,9 +1132,8 @@ static ftree_sw_t *__osm_ftree_fabric_get_sw_by_guid(IN ftree_fabric_t *
 
 /***************************************************/
 
-static ftree_hca_t *__osm_ftree_fabric_get_hca_by_guid(IN ftree_fabric_t *
-						       p_ftree,
-						       IN uint64_t guid)
+static ftree_hca_t *fabric_get_hca_by_guid(IN ftree_fabric_t * p_ftree,
+					   IN uint64_t guid)
 {
 	ftree_hca_t *p_hca;
 	p_hca = (ftree_hca_t *) cl_qmap_get(&p_ftree->hca_tbl, guid);
@@ -1081,13 +1144,13 @@ static ftree_hca_t *__osm_ftree_fabric_get_hca_by_guid(IN ftree_fabric_t *
 
 /***************************************************/
 
-static void __osm_ftree_fabric_dump(ftree_fabric_t * p_ftree)
+static void fabric_dump(ftree_fabric_t * p_ftree)
 {
 	uint32_t i;
 	ftree_hca_t *p_hca;
 	ftree_sw_t *p_sw;
 
-	if (!osm_log_is_active(&p_ftree->p_osm->log, OSM_LOG_DEBUG))
+	if (!OSM_LOG_IS_ACTIVE_V2(&p_ftree->p_osm->log, OSM_LOG_DEBUG))
 		return;
 
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG, "\n"
@@ -1100,17 +1163,17 @@ static void __osm_ftree_fabric_dump(ftree_fabric_t * p_ftree)
 	for (p_hca = (ftree_hca_t *) cl_qmap_head(&p_ftree->hca_tbl);
 	     p_hca != (ftree_hca_t *) cl_qmap_end(&p_ftree->hca_tbl);
 	     p_hca = (ftree_hca_t *) cl_qmap_next(&p_hca->map_item)) {
-		__osm_ftree_hca_dump(p_ftree, p_hca);
+		hca_dump(p_ftree, p_hca);
 	}
 
-	for (i = 0; i < p_ftree->max_switch_rank; i++) {
+	for (i = 0; i <= p_ftree->max_switch_rank; i++) {
 		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 			"-- Rank %u switches\n", i);
 		for (p_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);
 		     p_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl);
 		     p_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item)) {
 			if (p_sw->rank == i)
-				__osm_ftree_sw_dump(p_ftree, p_sw);
+				sw_dump(p_ftree, p_sw);
 		}
 	}
 
@@ -1118,11 +1181,11 @@ static void __osm_ftree_fabric_dump(ftree_fabric_t * p_ftree)
 		"                       |---------------------------------------|\n"
 		"                       |- Full fabric topology dump completed -|\n"
 		"                       |---------------------------------------|\n\n");
-}				/* __osm_ftree_fabric_dump() */
+}				/* fabric_dump() */
 
 /***************************************************/
 
-static void __osm_ftree_fabric_dump_general_info(IN ftree_fabric_t * p_ftree)
+static void fabric_dump_general_info(IN ftree_fabric_t * p_ftree)
 {
 	uint32_t i, j;
 	ftree_sw_t *p_sw;
@@ -1138,11 +1201,11 @@ static void __osm_ftree_fabric_dump_general_info(IN ftree_fabric_t * p_ftree)
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO,
 		"  - FatTree max switch rank: %u\n", p_ftree->max_switch_rank);
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO,
-		"  - Fabric has %u CAs (%u of them CNs), %u switches\n",
-		cl_qmap_count(&p_ftree->hca_tbl), p_ftree->cn_num,
-		cl_qmap_count(&p_ftree->sw_tbl));
+		"  - Fabric has %u CAs, %u CA ports (%u of them CNs), %u switches\n",
+		cl_qmap_count(&p_ftree->hca_tbl), p_ftree->ca_ports,
+		p_ftree->cn_num, cl_qmap_count(&p_ftree->sw_tbl));
 
-	CL_ASSERT(cl_qmap_count(&p_ftree->hca_tbl) >= p_ftree->cn_num);
+	CL_ASSERT(p_ftree->ca_ports >= p_ftree->cn_num);
 
 	for (i = 0; i <= p_ftree->max_switch_rank; i++) {
 		j = 0;
@@ -1166,7 +1229,7 @@ static void __osm_ftree_fabric_dump_general_info(IN ftree_fabric_t * p_ftree)
 				i);
 	}
 
-	if (osm_log_is_active(&p_ftree->p_osm->log, OSM_LOG_VERBOSE)) {
+	if (OSM_LOG_IS_ACTIVE_V2(&p_ftree->p_osm->log, OSM_LOG_VERBOSE)) {
 		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
 			"  - Root switches:\n");
 		for (p_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);
@@ -1176,9 +1239,9 @@ static void __osm_ftree_fabric_dump_general_info(IN ftree_fabric_t * p_ftree)
 				OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
 					"      GUID: 0x%016" PRIx64
 					", LID: %u, Index %s\n",
-					__osm_ftree_sw_get_guid_ho(p_sw),
-					cl_ntoh16(p_sw->base_lid),
-					__osm_ftree_tuple_to_str(p_sw->tuple));
+					sw_get_guid_ho(p_sw),
+					p_sw->base_lid,
+					tuple_to_str(p_sw->tuple));
 		}
 
 		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
@@ -1187,19 +1250,16 @@ static void __osm_ftree_fabric_dump_general_info(IN ftree_fabric_t * p_ftree)
 			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
 				"      GUID: 0x%016" PRIx64
 				", LID: %u, Index %s\n",
-				__osm_ftree_sw_get_guid_ho(p_ftree->
-							   leaf_switches[i]),
-				cl_ntoh16(p_ftree->leaf_switches[i]->base_lid),
-				__osm_ftree_tuple_to_str(p_ftree->
-							 leaf_switches[i]->
-							 tuple));
+				sw_get_guid_ho(p_ftree->leaf_switches[i]),
+				p_ftree->leaf_switches[i]->base_lid,
+				tuple_to_str(p_ftree->leaf_switches[i]->tuple));
 		}
 	}
-}				/* __osm_ftree_fabric_dump_general_info() */
+}				/* fabric_dump_general_info() */
 
 /***************************************************/
 
-static void __osm_ftree_fabric_dump_hca_ordering(IN ftree_fabric_t * p_ftree)
+static void fabric_dump_hca_ordering(IN ftree_fabric_t * p_ftree)
 {
 	ftree_hca_t *p_hca;
 	ftree_sw_t *p_sw;
@@ -1237,16 +1297,16 @@ static void __osm_ftree_fabric_dump_hca_ordering(IN ftree_fabric_t * p_ftree)
 
 			p_hca = p_group_on_sw->remote_hca_or_sw.p_hca;
 			p_group_on_hca =
-			    __osm_ftree_hca_get_port_group_by_remote_lid(p_hca,
-									 p_group_on_sw->
-									 base_lid);
+			    hca_get_port_group_by_remote_lid(p_hca,
+							     p_group_on_sw->
+							     base_lid);
 
 			/* treat non-compute nodes as dummies */
 			if (!p_group_on_hca->is_cn)
 				continue;
 
 			fprintf(p_hca_ordering_file, "0x%04x\t%s\n",
-				cl_ntoh16(p_group_on_hca->base_lid),
+				p_group_on_hca->base_lid,
 				p_hca->p_osm_node->print_desc);
 
 			printed_hcas_on_leaf++;
@@ -1261,39 +1321,37 @@ static void __osm_ftree_fabric_dump_hca_ordering(IN ftree_fabric_t * p_ftree)
 	/* done going through all the leaf switches */
 
 	fclose(p_hca_ordering_file);
-}				/* __osm_ftree_fabric_dump_hca_ordering() */
+}				/* fabric_dump_hca_ordering() */
 
 /***************************************************/
 
-static void
-__osm_ftree_fabric_assign_tuple(IN ftree_fabric_t * p_ftree,
+static void fabric_assign_tuple(IN ftree_fabric_t * p_ftree,
 				IN ftree_sw_t * p_sw,
 				IN ftree_tuple_t new_tuple)
 {
 	memcpy(p_sw->tuple, new_tuple, FTREE_TUPLE_LEN);
-	__osm_ftree_fabric_add_sw_by_tuple(p_ftree, p_sw);
+	fabric_add_sw_by_tuple(p_ftree, p_sw);
 }
 
 /***************************************************/
 
-static void __osm_ftree_fabric_assign_first_tuple(IN ftree_fabric_t * p_ftree,
-						  IN ftree_sw_t * p_sw)
+static void fabric_assign_first_tuple(IN ftree_fabric_t * p_ftree,
+				      IN ftree_sw_t * p_sw)
 {
 	uint8_t i;
 	ftree_tuple_t new_tuple;
 
-	__osm_ftree_tuple_init(new_tuple);
+	tuple_init(new_tuple);
 	new_tuple[0] = (uint8_t) p_sw->rank;
 	for (i = 1; i <= p_sw->rank; i++)
 		new_tuple[i] = 0;
 
-	__osm_ftree_fabric_assign_tuple(p_ftree, p_sw, new_tuple);
+	fabric_assign_tuple(p_ftree, p_sw, new_tuple);
 }
 
 /***************************************************/
 
-static void
-__osm_ftree_fabric_get_new_tuple(IN ftree_fabric_t * p_ftree,
+static void fabric_get_new_tuple(IN ftree_fabric_t * p_ftree,
 				 OUT ftree_tuple_t new_tuple,
 				 IN ftree_tuple_t from_tuple,
 				 IN ftree_direction_t direction)
@@ -1303,7 +1361,7 @@ __osm_ftree_fabric_get_new_tuple(IN ftree_fabric_t * p_ftree,
 	uint8_t var_index;
 	uint8_t i;
 
-	__osm_ftree_tuple_init(new_tuple);
+	tuple_init(new_tuple);
 	memcpy(temp_tuple, from_tuple, FTREE_TUPLE_LEN);
 
 	if (direction == FTREE_DIRECTION_DOWN) {
@@ -1316,7 +1374,7 @@ __osm_ftree_fabric_get_new_tuple(IN ftree_fabric_t * p_ftree,
 
 	for (i = 0; i < 0xFF; i++) {
 		temp_tuple[var_index] = i;
-		p_sw = __osm_ftree_fabric_get_sw_by_tuple(p_ftree, temp_tuple);
+		p_sw = fabric_get_sw_by_tuple(p_ftree, temp_tuple);
 		if (p_sw == NULL)	/* found free tuple */
 			break;
 	}
@@ -1327,27 +1385,32 @@ __osm_ftree_fabric_get_new_tuple(IN ftree_fabric_t * p_ftree,
 	}
 	memcpy(new_tuple, temp_tuple, FTREE_TUPLE_LEN);
 
-}				/* __osm_ftree_fabric_get_new_tuple() */
+}				/* fabric_get_new_tuple() */
 
 /***************************************************/
 
-static inline boolean_t __osm_ftree_fabric_roots_provided(IN ftree_fabric_t *
-							  p_ftree)
+static inline boolean_t fabric_roots_provided(IN ftree_fabric_t * p_ftree)
 {
 	return (p_ftree->p_osm->subn.opt.root_guid_file != NULL);
 }
 
 /***************************************************/
 
-static inline boolean_t __osm_ftree_fabric_cns_provided(IN ftree_fabric_t *
-							p_ftree)
+static inline boolean_t fabric_cns_provided(IN ftree_fabric_t * p_ftree)
 {
 	return (p_ftree->p_osm->subn.opt.cn_guid_file != NULL);
 }
 
 /***************************************************/
 
-static int __osm_ftree_fabric_mark_leaf_switches(IN ftree_fabric_t * p_ftree)
+static inline boolean_t fabric_ios_provided(IN ftree_fabric_t * p_ftree)
+{
+	return (p_ftree->p_osm->subn.opt.io_guid_file != NULL);
+}
+
+/***************************************************/
+
+static int fabric_mark_leaf_switches(IN ftree_fabric_t * p_ftree)
 {
 	ftree_sw_t *p_sw;
 	ftree_hca_t *p_hca;
@@ -1392,10 +1455,10 @@ static int __osm_ftree_fabric_mark_leaf_switches(IN ftree_fabric_t * p_ftree)
 					" is connected to switch 0x%" PRIx64
 					" with rank %u, "
 					"while FatTree leaf rank is %u\n",
-					cl_ntoh64(p_hca->up_port_groups[i]->
-						  port_guid),
-					__osm_ftree_sw_get_guid_ho(p_sw),
-					p_sw->rank, p_ftree->leaf_switch_rank);
+					cl_ntoh64(p_hca->
+						  up_port_groups[i]->port_guid),
+					sw_get_guid_ho(p_sw), p_sw->rank,
+					p_ftree->leaf_switch_rank);
 				res = -1;
 				goto Exit;
 
@@ -1406,11 +1469,11 @@ static int __osm_ftree_fabric_mark_leaf_switches(IN ftree_fabric_t * p_ftree)
 Exit:
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
 	return res;
-}				/* __osm_ftree_fabric_mark_leaf_switches() */
+}				/* fabric_mark_leaf_switches() */
 
 /***************************************************/
 
-static void __osm_ftree_fabric_make_indexing(IN ftree_fabric_t * p_ftree)
+static void fabric_make_indexing(IN ftree_fabric_t * p_ftree)
 {
 	ftree_sw_t *p_remote_sw;
 	ftree_sw_t *p_sw = NULL;
@@ -1418,7 +1481,6 @@ static void __osm_ftree_fabric_make_indexing(IN ftree_fabric_t * p_ftree)
 	ftree_tuple_t new_tuple;
 	uint32_t i;
 	cl_list_t bfs_list;
-	ftree_sw_tbl_element_t *p_sw_tbl_element;
 
 	OSM_LOG_ENTER(&p_ftree->p_osm->log);
 
@@ -1439,7 +1501,7 @@ static void __osm_ftree_fabric_make_indexing(IN ftree_fabric_t * p_ftree)
 	/* Assign the first tuple to the switch that is used as BFS starting point.
 	   The tuple will be as follows: [rank].0.0.0...
 	   This fuction also adds the switch it into the switch_by_tuple table. */
-	__osm_ftree_fabric_assign_first_tuple(p_ftree, p_sw);
+	fabric_assign_first_tuple(p_ftree, p_sw);
 
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
 		"Indexing starting point:\n"
@@ -1447,8 +1509,8 @@ static void __osm_ftree_fabric_make_indexing(IN ftree_fabric_t * p_ftree)
 		"                                            - Switch index : %s\n"
 		"                                            - Node LID     : %u\n"
 		"                                            - Node GUID    : 0x%016"
-		PRIx64 "\n", p_sw->rank, __osm_ftree_tuple_to_str(p_sw->tuple),
-		cl_ntoh16(p_sw->base_lid), __osm_ftree_sw_get_guid_ho(p_sw));
+		PRIx64 "\n", p_sw->rank, tuple_to_str(p_sw->tuple),
+		p_sw->base_lid, sw_get_guid_ho(p_sw));
 
 	/*
 	 * Now run BFS and assign indexes to all switches
@@ -1465,14 +1527,10 @@ static void __osm_ftree_fabric_make_indexing(IN ftree_fabric_t * p_ftree)
 	 */
 
 	cl_list_init(&bfs_list, cl_qmap_count(&p_ftree->sw_tbl));
-	cl_list_insert_tail(&bfs_list,
-			    &__osm_ftree_sw_tbl_element_create(p_sw)->map_item);
+	cl_list_insert_tail(&bfs_list, p_sw);
 
 	while (!cl_is_list_empty(&bfs_list)) {
-		p_sw_tbl_element =
-		    (ftree_sw_tbl_element_t *) cl_list_remove_head(&bfs_list);
-		p_sw = p_sw_tbl_element->p_sw;
-		__osm_ftree_sw_tbl_element_destroy(p_sw_tbl_element);
+		p_sw = (ftree_sw_t *) cl_list_remove_head(&bfs_list);
 
 		/* Discover all the nodes from ports that are pointing down */
 
@@ -1485,33 +1543,29 @@ static void __osm_ftree_fabric_make_indexing(IN ftree_fabric_t * p_ftree)
 			for (i = 0; i < p_sw->down_port_groups_num; i++) {
 				/* Work with port groups that are pointing to switches only.
 				   No need to assign indexing to HCAs */
-				if (p_sw->down_port_groups[i]->
-				    remote_node_type != IB_NODE_TYPE_SWITCH)
+				if (p_sw->
+				    down_port_groups[i]->remote_node_type !=
+				    IB_NODE_TYPE_SWITCH)
 					continue;
 
 				p_remote_sw =
-				    p_sw->down_port_groups[i]->remote_hca_or_sw.
-				    p_sw;
-				if (__osm_ftree_tuple_assigned
-				    (p_remote_sw->tuple)) {
+				    p_sw->down_port_groups[i]->
+				    remote_hca_or_sw.p_sw;
+				if (tuple_assigned(p_remote_sw->tuple)) {
 					/* this switch has been already indexed */
 					continue;
 				}
 				/* allocate new tuple */
-				__osm_ftree_fabric_get_new_tuple(p_ftree,
-								 new_tuple,
-								 p_sw->tuple,
-								 FTREE_DIRECTION_DOWN);
+				fabric_get_new_tuple(p_ftree, new_tuple,
+						     p_sw->tuple,
+						     FTREE_DIRECTION_DOWN);
 				/* Assign the new tuple to the remote switch.
 				   This fuction also adds the switch into the switch_by_tuple table. */
-				__osm_ftree_fabric_assign_tuple(p_ftree,
-								p_remote_sw,
-								new_tuple);
+				fabric_assign_tuple(p_ftree, p_remote_sw,
+						    new_tuple);
 
 				/* add the newly discovered switch to the BFS queue */
-				cl_list_insert_tail(&bfs_list,
-						    &__osm_ftree_sw_tbl_element_create
-						    (p_remote_sw)->map_item);
+				cl_list_insert_tail(&bfs_list, p_remote_sw);
 			}
 			/* Done assigning indexes to all the remote switches
 			   that are pointed by the downgoing ports.
@@ -1519,7 +1573,7 @@ static void __osm_ftree_fabric_make_indexing(IN ftree_fabric_t * p_ftree)
 			qsort(p_sw->down_port_groups,	/* array */
 			      p_sw->down_port_groups_num,	/* number of elements */
 			      sizeof(ftree_port_group_t *),	/* size of each element */
-			      __osm_ftree_compare_port_groups_by_remote_switch_index);	/* comparator */
+			      compare_port_groups_by_remote_switch_index);	/* comparator */
 		}
 
 		/* Done indexing switches from ports that go down.
@@ -1530,26 +1584,21 @@ static void __osm_ftree_fabric_make_indexing(IN ftree_fabric_t * p_ftree)
 			   that are pointing up are taking us to another switches. */
 			for (i = 0; i < p_sw->up_port_groups_num; i++) {
 				p_remote_sw =
-				    p_sw->up_port_groups[i]->remote_hca_or_sw.
-				    p_sw;
-				if (__osm_ftree_tuple_assigned
-				    (p_remote_sw->tuple))
+				    p_sw->up_port_groups[i]->
+				    remote_hca_or_sw.p_sw;
+				if (tuple_assigned(p_remote_sw->tuple))
 					continue;
 				/* allocate new tuple */
-				__osm_ftree_fabric_get_new_tuple(p_ftree,
-								 new_tuple,
-								 p_sw->tuple,
-								 FTREE_DIRECTION_UP);
+				fabric_get_new_tuple(p_ftree, new_tuple,
+						     p_sw->tuple,
+						     FTREE_DIRECTION_UP);
 				/* Assign the new tuple to the remote switch.
 				   This fuction also adds the switch to the
 				   switch_by_tuple table. */
-				__osm_ftree_fabric_assign_tuple(p_ftree,
-								p_remote_sw,
-								new_tuple);
+				fabric_assign_tuple(p_ftree,
+						    p_remote_sw, new_tuple);
 				/* add the newly discovered switch to the BFS queue */
-				cl_list_insert_tail(&bfs_list,
-						    &__osm_ftree_sw_tbl_element_create
-						    (p_remote_sw)->map_item);
+				cl_list_insert_tail(&bfs_list, p_remote_sw);
 			}
 			/* Done assigning indexes to all the remote switches
 			   that are pointed by the upgoing ports.
@@ -1557,7 +1606,7 @@ static void __osm_ftree_fabric_make_indexing(IN ftree_fabric_t * p_ftree)
 			qsort(p_sw->up_port_groups,	/* array */
 			      p_sw->up_port_groups_num,	/* number of elements */
 			      sizeof(ftree_port_group_t *),	/* size of each element */
-			      __osm_ftree_compare_port_groups_by_remote_switch_index);	/* comparator */
+			      compare_port_groups_by_remote_switch_index);	/* comparator */
 		}
 		/* Done assigning indexes to all the switches that are directly connected
 		   to the current switch - go to the next switch in the BFS queue */
@@ -1565,12 +1614,11 @@ static void __osm_ftree_fabric_make_indexing(IN ftree_fabric_t * p_ftree)
 	cl_list_destroy(&bfs_list);
 
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
-}				/* __osm_ftree_fabric_make_indexing() */
+}				/* fabric_make_indexing() */
 
 /***************************************************/
 
-static int __osm_ftree_fabric_create_leaf_switch_array(IN ftree_fabric_t *
-						       p_ftree)
+static int fabric_create_leaf_switch_array(IN ftree_fabric_t * p_ftree)
 {
 	ftree_sw_t *p_sw;
 	ftree_sw_t *p_next_sw;
@@ -1587,8 +1635,8 @@ static int __osm_ftree_fabric_create_leaf_switch_array(IN ftree_fabric_t *
 	all_switches_at_leaf_level = (ftree_sw_t **)
 	    malloc(cl_qmap_count(&p_ftree->sw_tbl) * sizeof(ftree_sw_t *));
 	if (!all_switches_at_leaf_level) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"Fat-tree routing: Memory allocation failed\n");
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_SYS, FILE_ID,
+			   "Fat-tree routing: Memory allocation failed\n");
 		res = -1;
 		goto Exit;
 	}
@@ -1603,9 +1651,8 @@ static int __osm_ftree_fabric_create_leaf_switch_array(IN ftree_fabric_t *
 			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 				"Adding switch 0x%" PRIx64
 				" to full leaf switch array\n",
-				__osm_ftree_sw_get_guid_ho(p_sw));
+				sw_get_guid_ho(p_sw));
 			all_switches_at_leaf_level[all_leaf_idx++] = p_sw;
-
 		}
 	}
 
@@ -1613,7 +1660,7 @@ static int __osm_ftree_fabric_create_leaf_switch_array(IN ftree_fabric_t *
 	qsort(all_switches_at_leaf_level,	/* array */
 	      all_leaf_idx,	/* number of elements */
 	      sizeof(ftree_sw_t *),	/* size of each element */
-	      __osm_ftree_compare_switches_by_index);	/* comparator */
+	      compare_switches_by_index);	/* comparator */
 
 	/* check the first and the last REAL leaf (the one
 	   that has CNs) in the array of all the leafs */
@@ -1640,8 +1687,9 @@ static int __osm_ftree_fabric_create_leaf_switch_array(IN ftree_fabric_t *
 	p_ftree->leaf_switches = (ftree_sw_t **)
 	    malloc(p_ftree->leaf_switches_num * sizeof(ftree_sw_t *));
 	if (!p_ftree->leaf_switches) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"Fat-tree routing: Memory allocation failed\n");
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_SYS, FILE_ID,
+			   "Fat-tree routing: Memory allocation failed\n");
+		free(all_switches_at_leaf_level);
 		res = -1;
 		goto Exit;
 	}
@@ -1650,20 +1698,20 @@ static int __osm_ftree_fabric_create_leaf_switch_array(IN ftree_fabric_t *
 	       &(all_switches_at_leaf_level[first_leaf_idx]),
 	       p_ftree->leaf_switches_num * sizeof(ftree_sw_t *));
 
-	free(all_switches_at_leaf_level);
-
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 		"Created array of %u leaf switches\n",
 		p_ftree->leaf_switches_num);
 
 Exit:
+	if (all_switches_at_leaf_level)
+		free(all_switches_at_leaf_level);
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
 	return res;
-}				/* __osm_ftree_fabric_create_leaf_switch_array() */
+}				/* fabric_create_leaf_switch_array() */
 
 /***************************************************/
 
-static void __osm_ftree_fabric_set_max_cn_per_leaf(IN ftree_fabric_t * p_ftree)
+static void fabric_set_max_cn_per_leaf(IN ftree_fabric_t * p_ftree)
 {
 	unsigned i;
 	unsigned j;
@@ -1684,19 +1732,18 @@ static void __osm_ftree_fabric_set_max_cn_per_leaf(IN ftree_fabric_t * p_ftree)
 		if (cns_on_this_leaf > p_ftree->max_cn_per_leaf)
 			p_ftree->max_cn_per_leaf = cns_on_this_leaf;
 	}
-}				/* __osm_ftree_fabric_set_max_cn_per_leaf() */
+}				/* fabric_set_max_cn_per_leaf() */
 
 /***************************************************/
 
-static boolean_t __osm_ftree_fabric_validate_topology(IN ftree_fabric_t *
-						      p_ftree)
+static boolean_t fabric_validate_topology(IN ftree_fabric_t * p_ftree)
 {
 	ftree_port_group_t *p_group;
 	ftree_port_group_t *p_ref_group;
 	ftree_sw_t *p_sw;
 	ftree_sw_t *p_next_sw;
 	ftree_sw_t **reference_sw_arr;
-	uint16_t tree_rank = __osm_ftree_fabric_get_rank(p_ftree);
+	uint16_t tree_rank = fabric_get_rank(p_ftree);
 	boolean_t res = TRUE;
 	uint8_t i;
 
@@ -1708,8 +1755,8 @@ static boolean_t __osm_ftree_fabric_validate_topology(IN ftree_fabric_t *
 	reference_sw_arr =
 	    (ftree_sw_t **) malloc(tree_rank * sizeof(ftree_sw_t *));
 	if (reference_sw_arr == NULL) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"Fat-tree routing: Memory allocation failed\n");
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_SYS, FILE_ID,
+			   "Fat-tree routing: Memory allocation failed\n");
 		return FALSE;
 	}
 	memset(reference_sw_arr, 0, tree_rank * sizeof(ftree_sw_t *));
@@ -1734,25 +1781,24 @@ static boolean_t __osm_ftree_fabric_validate_topology(IN ftree_fabric_t *
 					", LID %u, Index %s - %u groups\n"
 					"       GUID 0x%016" PRIx64
 					", LID %u, Index %s - %u groups\n",
-					__osm_ftree_sw_get_guid_ho
+					sw_get_guid_ho
 					(reference_sw_arr[p_sw->rank]),
-					cl_ntoh16(reference_sw_arr[p_sw->rank]->
-						  base_lid),
-					__osm_ftree_tuple_to_str
+					reference_sw_arr[p_sw->rank]->base_lid,
+					tuple_to_str
 					(reference_sw_arr[p_sw->rank]->tuple),
-					reference_sw_arr[p_sw->rank]->
+					reference_sw_arr[p_sw->
+							 rank]->
 					up_port_groups_num,
-					__osm_ftree_sw_get_guid_ho(p_sw),
-					cl_ntoh16(p_sw->base_lid),
-					__osm_ftree_tuple_to_str(p_sw->tuple),
+					sw_get_guid_ho(p_sw), p_sw->base_lid,
+					tuple_to_str(p_sw->tuple),
 					p_sw->up_port_groups_num);
 				res = FALSE;
 				break;
 			}
 
 			if (p_sw->rank != (tree_rank - 1) &&
-			    reference_sw_arr[p_sw->rank]->
-			    down_port_groups_num !=
+			    reference_sw_arr[p_sw->
+					     rank]->down_port_groups_num !=
 			    p_sw->down_port_groups_num) {
 				/* we're allowing some hca's to be missing */
 				OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,
@@ -1761,17 +1807,16 @@ static boolean_t __osm_ftree_fabric_validate_topology(IN ftree_fabric_t *
 					", LID %u, Index %s - %u port groups\n"
 					"       GUID 0x%016" PRIx64
 					", LID %u, Index %s - %u port groups\n",
-					__osm_ftree_sw_get_guid_ho
+					sw_get_guid_ho
 					(reference_sw_arr[p_sw->rank]),
-					cl_ntoh16(reference_sw_arr[p_sw->rank]->
-						  base_lid),
-					__osm_ftree_tuple_to_str
+					reference_sw_arr[p_sw->rank]->base_lid,
+					tuple_to_str
 					(reference_sw_arr[p_sw->rank]->tuple),
-					reference_sw_arr[p_sw->rank]->
+					reference_sw_arr[p_sw->
+							 rank]->
 					down_port_groups_num,
-					__osm_ftree_sw_get_guid_ho(p_sw),
-					cl_ntoh16(p_sw->base_lid),
-					__osm_ftree_tuple_to_str(p_sw->tuple),
+					sw_get_guid_ho(p_sw), p_sw->base_lid,
+					tuple_to_str(p_sw->tuple),
 					p_sw->down_port_groups_num);
 				res = FALSE;
 				break;
@@ -1780,14 +1825,14 @@ static boolean_t __osm_ftree_fabric_validate_topology(IN ftree_fabric_t *
 			if (reference_sw_arr[p_sw->rank]->up_port_groups_num !=
 			    0) {
 				p_ref_group =
-				    reference_sw_arr[p_sw->rank]->
-				    up_port_groups[0];
+				    reference_sw_arr[p_sw->
+						     rank]->up_port_groups[0];
 				for (i = 0; i < p_sw->up_port_groups_num; i++) {
 					p_group = p_sw->up_port_groups[i];
 					if (cl_ptr_vector_get_size
 					    (&p_ref_group->ports) !=
-					    cl_ptr_vector_get_size(&p_group->
-								   ports)) {
+					    cl_ptr_vector_get_size
+					    (&p_group->ports)) {
 						OSM_LOG(&p_ftree->p_osm->log,
 							OSM_LOG_ERROR,
 							"ERR AB0B: Different number of ports in an upward port group on switches:\n"
@@ -1797,24 +1842,21 @@ static boolean_t __osm_ftree_fabric_validate_topology(IN ftree_fabric_t *
 							"       GUID 0x%016"
 							PRIx64
 							", LID %u, Index %s - %u ports\n",
-							__osm_ftree_sw_get_guid_ho
+							sw_get_guid_ho
 							(reference_sw_arr
 							 [p_sw->rank]),
-							cl_ntoh16
-							(reference_sw_arr
-							 [p_sw->rank]->
-							 base_lid),
-							__osm_ftree_tuple_to_str
+							reference_sw_arr[p_sw->
+									 rank]->
+							base_lid,
+							tuple_to_str
 							(reference_sw_arr
 							 [p_sw->rank]->tuple),
 							cl_ptr_vector_get_size
 							(&p_ref_group->ports),
-							__osm_ftree_sw_get_guid_ho
-							(p_sw),
-							cl_ntoh16(p_sw->
-								  base_lid),
-							__osm_ftree_tuple_to_str
-							(p_sw->tuple),
+							sw_get_guid_ho(p_sw),
+							p_sw->base_lid,
+							tuple_to_str(p_sw->
+								     tuple),
 							cl_ptr_vector_get_size
 							(&p_group->ports));
 						res = FALSE;
@@ -1822,19 +1864,18 @@ static boolean_t __osm_ftree_fabric_validate_topology(IN ftree_fabric_t *
 					}
 				}
 			}
-			if (reference_sw_arr[p_sw->rank]->
-			    down_port_groups_num != 0
-			    && p_sw->rank != (tree_rank - 1)) {
+			if (reference_sw_arr[p_sw->rank]->down_port_groups_num
+			    != 0 && p_sw->rank != (tree_rank - 1)) {
 				/* we're allowing some hca's to be missing */
 				p_ref_group =
-				    reference_sw_arr[p_sw->rank]->
-				    down_port_groups[0];
+				    reference_sw_arr[p_sw->
+						     rank]->down_port_groups[0];
 				for (i = 0; i < p_sw->down_port_groups_num; i++) {
 					p_group = p_sw->down_port_groups[0];
 					if (cl_ptr_vector_get_size
 					    (&p_ref_group->ports) !=
-					    cl_ptr_vector_get_size(&p_group->
-								   ports)) {
+					    cl_ptr_vector_get_size
+					    (&p_group->ports)) {
 						OSM_LOG(&p_ftree->p_osm->log,
 							OSM_LOG_ERROR,
 							"ERR AB0C: Different number of ports in an downward port group on switches:\n"
@@ -1844,24 +1885,21 @@ static boolean_t __osm_ftree_fabric_validate_topology(IN ftree_fabric_t *
 							"       GUID 0x%016"
 							PRIx64
 							", LID %u, Index %s - %u ports\n",
-							__osm_ftree_sw_get_guid_ho
+							sw_get_guid_ho
 							(reference_sw_arr
 							 [p_sw->rank]),
-							cl_ntoh16
-							(reference_sw_arr
-							 [p_sw->rank]->
-							 base_lid),
-							__osm_ftree_tuple_to_str
+							reference_sw_arr[p_sw->
+									 rank]->
+							base_lid,
+							tuple_to_str
 							(reference_sw_arr
 							 [p_sw->rank]->tuple),
 							cl_ptr_vector_get_size
 							(&p_ref_group->ports),
-							__osm_ftree_sw_get_guid_ho
-							(p_sw),
-							cl_ntoh16(p_sw->
-								  base_lid),
-							__osm_ftree_tuple_to_str
-							(p_sw->tuple),
+							sw_get_guid_ho(p_sw),
+							p_sw->base_lid,
+							tuple_to_str(p_sw->
+								     tuple),
 							cl_ptr_vector_get_size
 							(&p_group->ports));
 						res = FALSE;
@@ -1882,20 +1920,200 @@ static boolean_t __osm_ftree_fabric_validate_topology(IN ftree_fabric_t *
 	free(reference_sw_arr);
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
 	return res;
-}				/* __osm_ftree_fabric_validate_topology() */
+}				/* fabric_validate_topology() */
 
 /***************************************************
  ***************************************************/
 
-static void __osm_ftree_set_sw_fwd_table(IN cl_map_item_t * const p_map_item,
-					 IN void *context)
+static void set_sw_fwd_table(IN cl_map_item_t * const p_map_item,
+			     IN void *context)
 {
 	ftree_sw_t *p_sw = (ftree_sw_t * const)p_map_item;
 	ftree_fabric_t *p_ftree = (ftree_fabric_t *) context;
 
-	p_sw->p_osm_sw->max_lid_ho = p_ftree->lft_max_lid_ho;
-	osm_ucast_mgr_set_fwd_table(&p_ftree->p_osm->sm.ucast_mgr,
-				    p_sw->p_osm_sw);
+	p_sw->p_osm_sw->max_lid_ho = p_ftree->lft_max_lid;
+}
+
+/***************************************************
+ ***************************************************/
+
+/*
+ * Function: Finds the least loaded port group and stores its counter
+ * Given   : A switch
+ */
+static inline void recalculate_min_counter_down(ftree_sw_t * p_sw)
+{
+	uint32_t min = (1 << 30);
+	uint32_t i;
+	for (i = 0; i < p_sw->down_port_groups_num; i++) {
+		if (p_sw->down_port_groups[i]->counter_down < min) {
+			min = p_sw->down_port_groups[i]->counter_down;
+		}
+	}
+	p_sw->min_counter_down = min;
+	return;
+}
+
+/*
+ * Function: Return the counter value of the least loaded down port group
+ * Given   : A switch
+ */
+static inline uint32_t find_lowest_loaded_group_on_sw(ftree_sw_t * p_sw)
+{
+	return p_sw->min_counter_down;
+}
+
+/*
+ * Function: Compare the load of two port groups and return which is the least loaded
+ * Given   : Two port groups with remote switch
+ * When both port groups are equally loaded, it picks the one whom
+ * remote switch down ports are least loaded.
+ * This way, it prefers the switch from where it will be easier to go down (creating upward routes).
+ * If both are equal, it picks the bigger GUID to be deterministic.
+ */
+static inline int port_group_compare_load_down(const ftree_port_group_t * p1,
+					       const ftree_port_group_t * p2)
+{
+	int temp = p1->counter_down - p2->counter_down;
+	if (temp > 0)
+		return 1;
+	if (temp < 0)
+		return -1;
+
+	/* Find the less loaded remote sw and choose this one */
+	do {
+		uint32_t load1 =
+		    find_lowest_loaded_group_on_sw(p1->remote_hca_or_sw.p_sw);
+		uint32_t load2 =
+		    find_lowest_loaded_group_on_sw(p2->remote_hca_or_sw.p_sw);
+		temp = load1 - load2;
+		if (temp > 0)
+			return 1;
+	} while (0);
+	/* If they are both equal, choose the biggest GUID */
+	if (p1->remote_port_guid > p2->remote_port_guid)
+		return 1;
+
+	return -1;
+
+}
+
+/*
+ * Function: Sorts an array of port group by up load order
+ * Given   : A port group array and its length
+ * As the list is mostly sorted, we used a bubble sort instead of qsort
+ * as it is much faster.
+ *
+ * Important note:
+ * This function and bubble_sort_down must NOT be factorized.
+ * Although most of the code is the same and a function pointer could be used
+ * for the compareason function, it would prevent the compareason function to be inlined
+ * and cost a great deal to performances.
+ */
+static inline void
+bubble_sort_up(ftree_port_group_t ** p_group_array, uint32_t nmemb)
+{
+	uint32_t i = 0;
+	uint32_t j = 0;
+	ftree_port_group_t *tmp = p_group_array[0];
+
+	/* As this function is a great number of times, we only go into the loop
+	 * if one of the port counters has changed, thus saving some tests */
+	if (tmp->hca_or_sw.p_sw->counter_up_changed == FALSE) {
+		return;
+	}
+	/* While we did modifications on the array order */
+	/* i may grew above array length but next loop will fail and tmp will be null for the next time
+	 * this way we save a test i < nmemb for each pass through the loop */
+	for (i = 0; tmp; i++) {
+		/* Assume the array is orderd */
+		tmp = NULL;
+		/* Comparing elements j and j-1 */
+		for (j = 1; j < (nmemb - i); j++) {
+			/* If they are the wrong way around */
+			if (p_group_array[j]->counter_up <
+			    p_group_array[j - 1]->counter_up) {
+				/* We invert them */
+				tmp = p_group_array[j - 1];
+				p_group_array[j - 1] = p_group_array[j];
+				p_group_array[j] = tmp;
+				/* This sets tmp != NULL so the main loop will make another pass */
+			}
+		}
+	}
+
+	/* We have reordered the array so as long noone changes the counter
+	 * it's not necessary to do it again */
+	p_group_array[0]->hca_or_sw.p_sw->counter_up_changed = FALSE;
+}
+
+static inline void
+bubble_sort_siblings(ftree_port_group_t ** p_group_array, uint32_t nmemb)
+{
+	uint32_t i = 0;
+	uint32_t j = 0;
+	ftree_port_group_t *tmp = p_group_array[0];
+
+	/* While we did modifications on the array order */
+	/* i may grew above array length but next loop will fail and tmp will be null for the next time
+	 * this way we save a test i < nmemb for each pass through the loop */
+	for (i = 0; tmp != NULL; i++) {
+		/* Assume the array is orderd */
+		tmp = NULL;
+		/* Comparing elements j and j-1 */
+		for (j = 1; j < (nmemb - i); j++) {
+			/* If they are the wrong way around */
+			if (p_group_array[j]->counter_up <
+			    p_group_array[j - 1]->counter_up) {
+				/* We invert them */
+				tmp = p_group_array[j - 1];
+				p_group_array[j - 1] = p_group_array[j];
+				p_group_array[j] = tmp;
+
+			}
+		}
+	}
+}
+
+/*
+ * Function: Sorts an array of port group. Order is decide through
+ * port_group_compare_load_down ( up counters, least load remote switch, biggest GUID)
+ * Given   : A port group array and its length. Each port group points to a remote switch (not a HCA)
+ * As the list is mostly sorted, we used a bubble sort instead of qsort
+ * as it is much faster.
+ *
+ * Important note:
+ * This function and bubble_sort_up must NOT be factorized.
+ * Although most of the code is the same and a function pointer could be used
+ * for the compareason function, it would prevent the compareason function to be inlined
+ * and cost a great deal to performances.
+ */
+static inline void
+bubble_sort_down(ftree_port_group_t ** p_group_array, uint32_t nmemb)
+{
+	uint32_t i = 0;
+	uint32_t j = 0;
+	ftree_port_group_t *tmp = p_group_array[0];
+
+	/* While we did modifications on the array order */
+	/* i may grew above array length but next loop will fail and tmp will be null for the next time
+	 * this way we save a test i < nmemb for each pass through the loop */
+	for (i = 0; tmp; i++) {
+		/* Assume the array is orderd */
+		tmp = NULL;
+		/* Comparing elements j and j-1 */
+		for (j = 1; j < (nmemb - i); j++) {
+			/* If they are the wrong way around */
+			if (port_group_compare_load_down
+			    (p_group_array[j], p_group_array[j - 1]) < 0) {
+				/* We invert them */
+				tmp = p_group_array[j - 1];
+				p_group_array[j - 1] = p_group_array[j];
+				p_group_array[j] = tmp;
+
+			}
+		}
+	}
 }
 
 /***************************************************
@@ -1914,50 +2132,64 @@ static void __osm_ftree_set_sw_fwd_table(IN cl_map_item_t * const p_map_item,
  *        assign-up-going-port-by-descending-down to r-port node (recursion)
  */
 
-static void
-__osm_ftree_fabric_route_upgoing_by_going_down(IN ftree_fabric_t * p_ftree,
-					       IN ftree_sw_t * p_sw,
-					       IN ftree_sw_t * p_prev_sw,
-					       IN ib_net16_t target_lid,
-					       IN uint8_t target_rank,
-					       IN boolean_t is_real_lid,
-					       IN boolean_t is_main_path,
-					       IN uint8_t highest_rank_in_route)
+static boolean_t
+fabric_route_upgoing_by_going_down(IN ftree_fabric_t * p_ftree,
+				   IN ftree_sw_t * p_sw,
+				   IN ftree_sw_t * p_prev_sw,
+				   IN uint16_t target_lid,
+				   IN boolean_t is_real_lid,
+				   IN boolean_t is_main_path,
+				   IN boolean_t is_target_a_sw,
+				   IN uint8_t current_hops)
 {
 	ftree_sw_t *p_remote_sw;
 	uint16_t ports_num;
 	ftree_port_group_t *p_group;
 	ftree_port_t *p_port;
 	ftree_port_t *p_min_port;
-	uint16_t i;
 	uint16_t j;
 	uint16_t k;
+	boolean_t created_route = FALSE;
+	boolean_t routed = 0;
+	uint8_t least_hops;
 
 	/* we shouldn't enter here if both real_lid and main_path are false */
 	CL_ASSERT(is_real_lid || is_main_path);
 
 	/* if there is no down-going ports */
 	if (p_sw->down_port_groups_num == 0)
-		return;
+		return FALSE;
 
-	/* promote the index that indicates which group should we
-	   start with when going through all the downgoing groups */
-	p_sw->down_port_groups_idx =
-		(p_sw->down_port_groups_idx + 1) % p_sw->down_port_groups_num;
+	/* foreach down-going port group (in load order) */
+	bubble_sort_up(p_sw->down_port_groups, p_sw->down_port_groups_num);
 
-	/* foreach down-going port group (in indexing order) */
-	i = p_sw->down_port_groups_idx;
-	for (k = 0; k < p_sw->down_port_groups_num; k++) {
+	if (p_sw->sibling_port_groups_num > 0)
+		bubble_sort_siblings(p_sw->sibling_port_groups,
+				     p_sw->sibling_port_groups_num);
 
-		p_group = p_sw->down_port_groups[i];
-		i = (i + 1) % p_sw->down_port_groups_num;
+	for (k = 0;
+	     k <
+	     (p_sw->down_port_groups_num +
+	      (is_real_lid ? p_sw->sibling_port_groups_num : 0)); k++) {
 
-		/* Skip this port group unless it points to a switch */
-		if (p_group->remote_node_type != IB_NODE_TYPE_SWITCH)
+		if (k < p_sw->down_port_groups_num) {
+			p_group = p_sw->down_port_groups[k];
+		} else {
+			p_group =
+			    p_sw->sibling_port_groups[k -
+						      p_sw->
+						      down_port_groups_num];
+		}
+
+		/* If this port group doesn't point to a switch, mark
+		   that the route was created and skip to the next group */
+		if (p_group->remote_node_type != IB_NODE_TYPE_SWITCH) {
+			created_route = TRUE;
 			continue;
+		}
 
 		if (p_prev_sw
-		    && (p_group->remote_base_lid == p_prev_sw->base_lid)) {
+		    && p_group->remote_base_lid == p_prev_sw->base_lid) {
 			/* This port group has a port that was used when we entered this switch,
 			   which means that the current group points to the switch where we were
 			   at the previous step of the algorithm (before going up).
@@ -1968,38 +2200,36 @@ __osm_ftree_fabric_route_upgoing_by_going_down(IN ftree_fabric_t * p_ftree,
 		/* find the least loaded port of the group (in indexing order) */
 		p_min_port = NULL;
 		ports_num = (uint16_t) cl_ptr_vector_get_size(&p_group->ports);
-		/* ToDo: no need to select a least loaded port for non-main path.
-		   Think about optimization. */
+
 		for (j = 0; j < ports_num; j++) {
 			cl_ptr_vector_at(&p_group->ports, j, (void *)&p_port);
-			if (!p_min_port) {
-				/* first port that we're checking - set as port with the lowest load */
+			/* first port that we're checking - set as port with the lowest load */
+			/* or this port is less loaded - use it as min */
+			if (!p_min_port ||
+			    p_port->counter_up < p_min_port->counter_up)
 				p_min_port = p_port;
-			} else if (p_port->counter_up < p_min_port->counter_up) {
-				/* this port is less loaded - use it as min */
-				p_min_port = p_port;
-			}
 		}
 		/* At this point we have selected a port in this group with the
 		   lowest load of upgoing routes.
 		   Set on the remote switch how to get to the target_lid -
 		   set LFT(target_lid) on the remote switch to the remote port */
 		p_remote_sw = p_group->remote_hca_or_sw.p_sw;
+		least_hops = sw_get_least_hops(p_remote_sw, target_lid);
 
-		if (osm_switch_get_least_hops(p_remote_sw->p_osm_sw,
-					      cl_ntoh16(target_lid)) !=
-		    OSM_NO_PATH) {
+		if (least_hops != OSM_NO_PATH) {
 			/* Loop in the fabric - we already routed the remote switch
 			   on our way UP, and now we see it again on our way DOWN */
 			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
-				"Loop of lenght %d in the fabric:\n                             "
+				"Loop of length %d in the fabric:\n                             "
 				"Switch %s (LID %u) closes loop through switch %s (LID %u)\n",
-				(p_remote_sw->rank - highest_rank_in_route) * 2,
-				__osm_ftree_tuple_to_str(p_remote_sw->tuple),
-				cl_ntoh16(p_group->base_lid),
-				__osm_ftree_tuple_to_str(p_sw->tuple),
-				cl_ntoh16(p_group->remote_base_lid));
-			continue;
+				current_hops,
+				tuple_to_str(p_remote_sw->tuple),
+				p_group->base_lid,
+				tuple_to_str(p_sw->tuple),
+				p_group->remote_base_lid);
+			/* We skip only if we have come through a longer path */
+			if (current_hops + 1 >= least_hops)
+				continue;
 		}
 
 		/* Four possible cases:
@@ -2013,8 +2243,8 @@ __osm_ftree_fabric_route_upgoing_by_going_down(IN ftree_fabric_t * p_ftree,
 		 *  2. is_real_lid == TRUE && is_main_path == FALSE:
 		 *      - going DOWN(TRUE,FALSE) through ALL the groups but only if
 		 *        the remote (lower) switch hasn't been already configured
-		 *        for this target LID
-		 *         + NOT promoting port counter
+		 *        for this target LID (or with a longer path)
+		 *         + promoting port counter
 		 *         + setting path in remote switch fwd tbl if it hasn't been set yet
 		 *         + setting hops in remote switch on all the ports of each group
 		 *           if it hasn't been set yet
@@ -2029,61 +2259,50 @@ __osm_ftree_fabric_route_upgoing_by_going_down(IN ftree_fabric_t * p_ftree,
 		 *      - illegal state - we shouldn't get here
 		 */
 
-		/* second case: skip the port group if the remote (lower)
-		   switch has been already configured for this target LID */
-		if (is_real_lid && !is_main_path &&
-		    p_remote_sw->p_osm_sw->new_lft[cl_ntoh16(target_lid)] != OSM_NO_PATH)
-			continue;
-
 		/* setting fwd tbl port only if this is real LID */
 		if (is_real_lid) {
-			p_remote_sw->p_osm_sw->new_lft[cl_ntoh16(target_lid)] =
-				p_min_port->remote_port_num;
+			p_remote_sw->p_osm_sw->new_lft[target_lid] =
+			    p_min_port->remote_port_num;
 			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 				"Switch %s: set path to CA LID %u through port %u\n",
-				__osm_ftree_tuple_to_str(p_remote_sw->tuple),
-				cl_ntoh16(target_lid),
-				p_min_port->remote_port_num);
+				tuple_to_str(p_remote_sw->tuple),
+				target_lid, p_min_port->remote_port_num);
 
 			/* On the remote switch that is pointed by the p_group,
 			   set hops for ALL the ports in the remote group. */
 
-			for (j = 0; j < ports_num; j++) {
-				cl_ptr_vector_at(&p_group->ports, j,
-						 (void *)&p_port);
-
-				__osm_ftree_sw_set_hops(p_remote_sw,
-							cl_ntoh16(target_lid),
-							p_port->remote_port_num,
-							((target_rank -
-							  highest_rank_in_route)
-							 + (p_remote_sw->rank -
-							    highest_rank_in_route)));
-			}
-
+			set_hops_on_remote_sw(p_group, target_lid,
+					      current_hops + 1, is_target_a_sw);
 		}
 
-		/* The number of upgoing routes is tracked in the
-		   p_port->counter_up counter of the port that belongs to
-		   the upper side of the link (on switch with lower rank).
-		   Counter is promoted only if we're routing LID on the main
-		   path (whether it's a real LID or a dummy one). */
-		if (is_main_path)
-			p_min_port->counter_up++;
-
 		/* Recursion step:
 		   Assign upgoing ports by stepping down, starting on REMOTE switch */
-		__osm_ftree_fabric_route_upgoing_by_going_down(p_ftree, p_remote_sw,	/* remote switch - used as a route-upgoing alg. start point */
-							       NULL,	/* prev. position - NULL to mark that we went down and not up */
-							       target_lid,	/* LID that we're routing to */
-							       target_rank,	/* rank of the LID that we're routing to */
-							       is_real_lid,	/* whether the target LID is real or dummy */
-							       is_main_path,	/* whether this is path to HCA that should by tracked by counters */
-							       highest_rank_in_route);	/* highest visited point in the tree before going down */
+		routed = fabric_route_upgoing_by_going_down(p_ftree, p_remote_sw,	/* remote switch - used as a route-upgoing alg. start point */
+							    NULL,	/* prev. position - NULL to mark that we went down and not up */
+							    target_lid,	/* LID that we're routing to */
+							    is_real_lid,	/* whether the target LID is real or dummy */
+							    is_main_path,	/* whether this is path to HCA that should by tracked by counters */
+							    is_target_a_sw,	/* Whether target lid is a switch or not */
+							    current_hops + 1);	/* Number of hops done to this point */
+		created_route |= routed;
+		/* Counters are promoted only if a route toward a node is created */
+		if (routed) {
+			p_min_port->counter_up++;
+			p_group->counter_up++;
+			p_group->hca_or_sw.p_sw->counter_up_changed = TRUE;
+		}
 	}
 	/* done scanning all the down-going port groups */
 
-}				/* __osm_ftree_fabric_route_upgoing_by_going_down() */
+	/* if the route was created, promote the index that
+	   indicates which group should we start with when
+	   going through all the downgoing groups */
+	if (created_route)
+		p_sw->down_port_groups_idx = (p_sw->down_port_groups_idx + 1)
+		    % p_sw->down_port_groups_num;
+
+	return created_route;
+}				/* fabric_route_upgoing_by_going_down() */
 
 /***************************************************/
 
@@ -2098,14 +2317,17 @@ __osm_ftree_fabric_route_upgoing_by_going_down(IN ftree_fabric_t * p_ftree,
  *    assign-down-going-port-by-ascending-up on REMOTE switch (recursion)
  */
 
-static void
-__osm_ftree_fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
-					       IN ftree_sw_t * p_sw,
-					       IN ftree_sw_t * p_prev_sw,
-					       IN ib_net16_t target_lid,
-					       IN uint8_t target_rank,
-					       IN boolean_t is_real_lid,
-					       IN boolean_t is_main_path)
+static boolean_t
+fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
+				   IN ftree_sw_t * p_sw,
+				   IN ftree_sw_t * p_prev_sw,
+				   IN uint16_t target_lid,
+				   IN boolean_t is_real_lid,
+				   IN boolean_t is_main_path,
+				   IN boolean_t is_target_a_sw,
+				   IN uint16_t reverse_hop_credit,
+				   IN uint16_t reverse_hops,
+				   IN uint8_t current_hops)
 {
 	ftree_sw_t *p_remote_sw;
 	uint16_t ports_num;
@@ -2115,37 +2337,63 @@ __osm_ftree_fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 	ftree_port_t *p_min_port;
 	uint16_t i;
 	uint16_t j;
+	boolean_t created_route = FALSE;
+	boolean_t routed = FALSE;
 
 	/* we shouldn't enter here if both real_lid and main_path are false */
 	CL_ASSERT(is_real_lid || is_main_path);
 
 	/* Assign upgoing ports by stepping down, starting on THIS switch */
-	__osm_ftree_fabric_route_upgoing_by_going_down(p_ftree, p_sw,	/* local switch - used as a route-upgoing alg. start point */
-						       p_prev_sw,	/* switch that we went up from (NULL means that we went down) */
-						       target_lid,	/* LID that we're routing to */
-						       target_rank,	/* rank of the LID that we're routing to */
-						       is_real_lid,	/* whether this target LID is real or dummy */
-						       is_main_path,	/* whether this path to HCA should by tracked by counters */
-						       p_sw->rank);	/* the highest visited point in the tree before going down */
+	created_route = fabric_route_upgoing_by_going_down(p_ftree, p_sw,	/* local switch - used as a route-upgoing alg. start point */
+							   p_prev_sw,	/* switch that we went up from (NULL means that we went down) */
+							   target_lid,	/* LID that we're routing to */
+							   is_real_lid,	/* whether this target LID is real or dummy */
+							   is_main_path,	/* whether this path to HCA should by tracked by counters */
+							   is_target_a_sw,	/* Whether target lid is a switch or not */
+							   current_hops);	/* Number of hops done up to this point */
 
 	/* recursion stop condition - if it's a root switch, */
-	if (p_sw->rank == 0)
-		return;
+	if (p_sw->rank == 0) {
+		if (reverse_hop_credit > 0) {
+			/* We go up by going down as we have some reverse_hop_credit left */
+			/* We use the index to scatter a bit the reverse up routes */
+			p_sw->down_port_groups_idx =
+			    (p_sw->down_port_groups_idx +
+			     1) % p_sw->down_port_groups_num;
+			i = p_sw->down_port_groups_idx;
+			for (j = 0; j < p_sw->down_port_groups_num; j++) {
+
+				p_group = p_sw->down_port_groups[i];
+				i = (i + 1) % p_sw->down_port_groups_num;
+
+				/* Skip this port group unless it points to a switch */
+				if (p_group->remote_node_type !=
+				    IB_NODE_TYPE_SWITCH)
+					continue;
+				p_remote_sw = p_group->remote_hca_or_sw.p_sw;
+
+				created_route |= fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,	/* remote switch - used as a route-downgoing alg. next step point */
+										    p_sw,	/* this switch - prev. position switch for the function */
+										    target_lid,	/* LID that we're routing to */
+										    is_real_lid,	/* whether this target LID is real or dummy */
+										    is_main_path,	/* whether this is path to HCA that should by tracked by counters */
+										    is_target_a_sw,	/* Whether target lid is a switch or not */
+										    reverse_hop_credit - 1,	/* Remaining reverse_hops allowed */
+										    reverse_hops + 1,	/* Number of reverse_hops done up to this point */
+										    current_hops
+										    +
+										    1);
+			}
 
-	/* Find the least loaded upgoing port group */
-	p_min_group = NULL;
-	for (i = 0; i < p_sw->up_port_groups_num; i++) {
-		p_group = p_sw->up_port_groups[i];
-		if (!p_min_group) {
-			/* first group that we're checking - use
-			   it as a group with the lowest load */
-			p_min_group = p_group;
-		} else if (p_group->counter_down < p_min_group->counter_down) {
-			/* this group is less loaded - use it as min */
-			p_min_group = p_group;
 		}
+		return created_route;
 	}
 
+	/* We should generate a list of port sorted by load so we can find easily the least
+	 * going port and explore the other pots on secondary routes more easily (and quickly) */
+	bubble_sort_down(p_sw->up_port_groups, p_sw->up_port_groups_num);
+
+	p_min_group = p_sw->up_port_groups[0];
 	/* Find the least loaded upgoing port in the selected group */
 	p_min_port = NULL;
 	ports_num = (uint16_t) cl_ptr_vector_get_size(&p_min_group->ports);
@@ -2205,9 +2453,9 @@ __osm_ftree_fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 				" - Routing MAIN path for %s CA LID %u: %s --> %s\n",
 				(is_real_lid) ? "real" : "DUMMY",
-				cl_ntoh16(target_lid),
-				__osm_ftree_tuple_to_str(p_sw->tuple),
-				__osm_ftree_tuple_to_str(p_remote_sw->tuple));
+				target_lid,
+				tuple_to_str(p_sw->tuple),
+				tuple_to_str(p_remote_sw->tuple));
 		}
 		/* The number of downgoing routes is tracked in the
 		   p_group->counter_down p_port->counter_down counters of the
@@ -2215,45 +2463,61 @@ __osm_ftree_fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 		   (on switch with higher rank) */
 		p_min_group->counter_down++;
 		p_min_port->counter_down++;
-		if (is_real_lid) {
-			p_remote_sw->p_osm_sw->new_lft[cl_ntoh16(target_lid)] =
-				p_min_port->remote_port_num;
-			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
-				"Switch %s: set path to CA LID %u through port %u\n",
-				__osm_ftree_tuple_to_str(p_remote_sw->tuple),
-				cl_ntoh16(target_lid),
-				p_min_port->remote_port_num);
-
-			/* On the remote switch that is pointed by the min_group,
-			   set hops for ALL the ports in the remote group. */
+		if (p_min_group->counter_down ==
+		    (p_min_group->remote_hca_or_sw.p_sw->min_counter_down +
+		     1)) {
+			recalculate_min_counter_down
+			    (p_min_group->remote_hca_or_sw.p_sw);
+		}
 
-			ports_num =
-			    (uint16_t) cl_ptr_vector_get_size(&p_min_group->
-							      ports);
-			for (j = 0; j < ports_num; j++) {
-				cl_ptr_vector_at(&p_min_group->ports, j,
-						 (void *)&p_port);
-				__osm_ftree_sw_set_hops(p_remote_sw,
-							cl_ntoh16(target_lid),
-							p_port->remote_port_num,
-							target_rank -
-							p_remote_sw->rank);
+		if (is_real_lid) {
+			/* This LID may already be in the LFT in the reverse_hop feature is used */
+			/* We update the LFT only if this LID isn't already present. */
+
+			/* skip if target lid has been already set on remote switch fwd tbl (with a bigger hop count) */
+			if ((p_remote_sw->p_osm_sw->new_lft[target_lid] ==
+			     OSM_NO_PATH)
+			    ||
+			    ((p_remote_sw->p_osm_sw->new_lft[target_lid] !=
+			      OSM_NO_PATH)
+			     &&
+			     (current_hops + 1 <
+			      sw_get_least_hops(p_remote_sw, target_lid)))) {
+
+				p_remote_sw->p_osm_sw->new_lft[target_lid] =
+				    p_min_port->remote_port_num;
+				OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
+					"Switch %s: set path to CA LID %u through port %u\n",
+					tuple_to_str(p_remote_sw->tuple),
+					target_lid,
+					p_min_port->remote_port_num);
+
+				/* On the remote switch that is pointed by the min_group,
+				   set hops for ALL the ports in the remote group. */
+
+				set_hops_on_remote_sw(p_min_group, target_lid,
+						      current_hops + 1,
+						      is_target_a_sw);
+
+				/* Recursion step:
+				   Assign downgoing ports by stepping up, starting on REMOTE switch. */
+				created_route |= fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,	/* remote switch - used as a route-downgoing alg. next step point */
+										    p_sw,	/* this switch - prev. position switch for the function */
+										    target_lid,	/* LID that we're routing to */
+										    is_real_lid,	/* whether this target LID is real or dummy */
+										    is_main_path,	/* whether this is path to HCA that should by tracked by counters */
+										    is_target_a_sw,	/* Whether target lid is a switch or not */
+										    reverse_hop_credit,	/* Remaining reverse_hops allowed */
+										    reverse_hops,	/* Number of reverse_hops done up to this point */
+										    current_hops
+										    +
+										    1);
 			}
 		}
-
-		/* Recursion step:
-		   Assign downgoing ports by stepping up, starting on REMOTE switch. */
-		__osm_ftree_fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,	/* remote switch - used as a route-downgoing alg. next step point */
-							       p_sw,	/* this switch - prev. position switch for the function */
-							       target_lid,	/* LID that we're routing to */
-							       target_rank,	/* rank of the LID that we're routing to */
-							       is_real_lid,	/* whether this target LID is real or dummy */
-							       is_main_path);	/* whether this is path to HCA that should by tracked by counters */
 	}
-
 	/* we're done for the third case */
 	if (!is_real_lid)
-		return;
+		return created_route;
 
 	/* What's left to do at this point:
 	 *
@@ -2287,56 +2551,174 @@ __osm_ftree_fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 	 *         - go UP(TRUE,FALSE) to the remote switch
 	 */
 
-	for (i = 0; i < p_sw->up_port_groups_num; i++) {
+	for (i = is_main_path ? 1 : 0; i < p_sw->up_port_groups_num; i++) {
 		p_group = p_sw->up_port_groups[i];
 		p_remote_sw = p_group->remote_hca_or_sw.p_sw;
 
-		/* skip if target lid has been already set on remote switch fwd tbl */
-		if (p_remote_sw->p_osm_sw->new_lft[cl_ntoh16(target_lid)] != OSM_NO_PATH)
-			continue;
+		/* skip if target lid has been already set on remote switch fwd tbl (with a bigger hop count) */
+		if (p_remote_sw->p_osm_sw->new_lft[target_lid] != OSM_NO_PATH)
+			if (current_hops + 1 >=
+			    sw_get_least_hops(p_remote_sw, target_lid))
+				continue;
 
 		if (p_sw->is_leaf) {
 			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 				" - Routing SECONDARY path for LID %u: %s --> %s\n",
-				cl_ntoh16(target_lid),
-				__osm_ftree_tuple_to_str(p_sw->tuple),
-				__osm_ftree_tuple_to_str(p_remote_sw->tuple));
+				target_lid,
+				tuple_to_str(p_sw->tuple),
+				tuple_to_str(p_remote_sw->tuple));
 		}
 
 		/* Routing REAL lids on SECONDARY path means routing
 		   switch-to-switch or switch-to-CA paths.
 		   We can safely assume that switch will initiate very
-		   few traffic, so there's no point waisting runtime on
+		   few traffic, so there's no point wasting runtime on
 		   trying to balance these routes - always pick port 0. */
+		p_min_port = NULL;
+		ports_num = (uint16_t) cl_ptr_vector_get_size(&p_group->ports);
+		for (j = 0; j < ports_num; j++) {
+			cl_ptr_vector_at(&p_group->ports, j, (void *)&p_port);
+			if (!p_min_port) {
+				/* first port that we're checking - use
+				   it as a port with the lowest load */
+				p_min_port = p_port;
+			} else if (p_port->counter_down <
+				   p_min_port->counter_down) {
+				/* this port is less loaded - use it as min */
+				p_min_port = p_port;
+			}
+		}
 
-		cl_ptr_vector_at(&p_group->ports, 0, (void *)&p_port);
-		p_remote_sw->p_osm_sw->new_lft[cl_ntoh16(target_lid)] =
-			p_port->remote_port_num;
+		p_port = p_min_port;
+		p_remote_sw->p_osm_sw->new_lft[target_lid] =
+		    p_port->remote_port_num;
 
 		/* On the remote switch that is pointed by the p_group,
 		   set hops for ALL the ports in the remote group. */
 
+		set_hops_on_remote_sw(p_group, target_lid,
+				      current_hops + 1, is_target_a_sw);
+
+		/* Recursion step:
+		   Assign downgoing ports by stepping up, starting on REMOTE switch. */
+		routed = fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,	/* remote switch - used as a route-downgoing alg. next step point */
+							    p_sw,	/* this switch - prev. position switch for the function */
+							    target_lid,	/* LID that we're routing to */
+							    TRUE,	/* whether the target LID is real or dummy */
+							    FALSE,	/* whether this is path to HCA that should by tracked by counters */
+							    is_target_a_sw,	/* Whether target lid is a switch or not */
+							    reverse_hop_credit,	/* Remaining reverse_hops allowed */
+							    reverse_hops,	/* Number of reverse_hops done up to this point */
+							    current_hops + 1);
+		created_route |= routed;
+	}
+
+	/* Now doing the same thing with horizontal links */
+	if (p_sw->sibling_port_groups_num > 0)
+		bubble_sort_down(p_sw->sibling_port_groups,
+				 p_sw->sibling_port_groups_num);
+
+	for (i = 0; i < p_sw->sibling_port_groups_num; i++) {
+		p_group = p_sw->sibling_port_groups[i];
+		p_remote_sw = p_group->remote_hca_or_sw.p_sw;
+
+		/* skip if target lid has been already set on remote switch fwd tbl (with a bigger hop count) */
+		if (p_remote_sw->p_osm_sw->new_lft[target_lid] != OSM_NO_PATH)
+			if (current_hops + 1 >=
+			    sw_get_least_hops(p_remote_sw, target_lid))
+				continue;
+
+		if (p_sw->is_leaf) {
+			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
+				" - Routing SECONDARY path for LID %u: %s --> %s\n",
+				target_lid,
+				tuple_to_str(p_sw->tuple),
+				tuple_to_str(p_remote_sw->tuple));
+		}
+
+		/* Routing REAL lids on SECONDARY path means routing
+		   switch-to-switch or switch-to-CA paths.
+		   We can safely assume that switch will initiate very
+		   few traffic, so there's no point wasting runtime on
+		   trying to balance these routes - always pick port 0. */
+
+		p_min_port = NULL;
 		ports_num = (uint16_t) cl_ptr_vector_get_size(&p_group->ports);
 		for (j = 0; j < ports_num; j++) {
 			cl_ptr_vector_at(&p_group->ports, j, (void *)&p_port);
-
-			__osm_ftree_sw_set_hops(p_remote_sw,
-						cl_ntoh16(target_lid),
-						p_port->remote_port_num,
-						target_rank -
-						p_remote_sw->rank);
+			if (!p_min_port) {
+				/* first port that we're checking - use
+				   it as a port with the lowest load */
+				p_min_port = p_port;
+			} else if (p_port->counter_down <
+				   p_min_port->counter_down) {
+				/* this port is less loaded - use it as min */
+				p_min_port = p_port;
+			}
 		}
 
+		p_port = p_min_port;
+		p_remote_sw->p_osm_sw->new_lft[target_lid] =
+		    p_port->remote_port_num;
+
+		/* On the remote switch that is pointed by the p_group,
+		   set hops for ALL the ports in the remote group. */
+
+		set_hops_on_remote_sw(p_group, target_lid,
+				      current_hops + 1, is_target_a_sw);
+
 		/* Recursion step:
 		   Assign downgoing ports by stepping up, starting on REMOTE switch. */
-		__osm_ftree_fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,	/* remote switch - used as a route-downgoing alg. next step point */
-							       p_sw,	/* this switch - prev. position switch for the function */
-							       target_lid,	/* LID that we're routing to */
-							       target_rank,	/* rank of the LID that we're routing to */
-							       TRUE,	/* whether the target LID is real or dummy */
-							       FALSE);	/* whether this is path to HCA that should by tracked by counters */
+		routed = fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,	/* remote switch - used as a route-downgoing alg. next step point */
+							    p_sw,	/* this switch - prev. position switch for the function */
+							    target_lid,	/* LID that we're routing to */
+							    TRUE,	/* whether the target LID is real or dummy */
+							    FALSE,	/* whether this is path to HCA that should by tracked by counters */
+							    is_target_a_sw,	/* Whether target lid is a switch or not */
+							    reverse_hop_credit,	/* Remaining reverse_hops allowed */
+							    reverse_hops,	/* Number of reverse_hops done up to this point */
+							    current_hops + 1);
+		created_route |= routed;
+		if (routed) {
+			p_min_group->counter_down++;
+			p_min_port->counter_down++;
+		}
 	}
 
+	/* If we don't have any reverse hop credits, we are done */
+	if (reverse_hop_credit == 0)
+		return created_route;
+
+	if (p_sw->is_leaf)
+		return created_route;
+
+	/* We explore all the down group ports */
+	/* We try to reverse jump for each of them */
+	/* They already have a route to us from the upgoing_by_going_down started earlier */
+	/* This is only so it'll continue exploring up, after this step backwards */
+	for (i = 0; i < p_sw->down_port_groups_num; i++) {
+		p_group = p_sw->down_port_groups[i];
+		p_remote_sw = p_group->remote_hca_or_sw.p_sw;
+
+		/* Skip this port group unless it points to a switch */
+		if (p_group->remote_node_type != IB_NODE_TYPE_SWITCH)
+			continue;
+
+		/* Recursion step:
+		   Assign downgoing ports by stepping up, fter doing one step down starting on REMOTE switch. */
+		created_route |= fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,	/* remote switch - used as a route-downgoing alg. next step point */
+								    p_sw,	/* this switch - prev. position switch for the function */
+								    target_lid,	/* LID that we're routing to */
+								    TRUE,	/* whether the target LID is real or dummy */
+								    TRUE,	/* whether this is path to HCA that should by tracked by counters */
+								    is_target_a_sw,	/* Whether target lid is a switch or not */
+								    reverse_hop_credit - 1,	/* Remaining reverse_hops allowed */
+								    reverse_hops + 1,	/* Number of reverse_hops done up to this point */
+								    current_hops
+								    + 1);
+	}
+	return created_route;
+
 }				/* ftree_fabric_route_downgoing_by_going_up() */
 
 /***************************************************/
@@ -2352,16 +2734,15 @@ __osm_ftree_fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
  *          call assign-down-going-port-by-ascending-up(FALSE,TRUE) on CURRENT switch
  */
 
-static void __osm_ftree_fabric_route_to_cns(IN ftree_fabric_t * p_ftree)
+static void fabric_route_to_cns(IN ftree_fabric_t * p_ftree)
 {
 	ftree_sw_t *p_sw;
 	ftree_hca_t *p_hca;
 	ftree_port_group_t *p_leaf_port_group;
 	ftree_port_group_t *p_hca_port_group;
 	ftree_port_t *p_port;
-	uint32_t i;
-	uint32_t j;
-	ib_net16_t hca_lid;
+	unsigned int i, j;
+	uint16_t hca_lid;
 	unsigned routed_targets_on_leaf;
 
 	OSM_LOG_ENTER(&p_ftree->p_osm->log);
@@ -2387,9 +2768,9 @@ static void __osm_ftree_fabric_route_to_cns(IN ftree_fabric_t * p_ftree)
 				continue;
 
 			p_hca_port_group =
-			    __osm_ftree_hca_get_port_group_by_remote_lid(p_hca,
-									 p_leaf_port_group->
-									 base_lid);
+			    hca_get_port_group_by_remote_lid(p_hca,
+							     p_leaf_port_group->
+							     base_lid);
 			CL_ASSERT(p_hca_port_group);
 
 			/* work with this port group only if remote port is CN */
@@ -2402,27 +2783,28 @@ static void __osm_ftree_fabric_route_to_cns(IN ftree_fabric_t * p_ftree)
 			/* set local LFT(LID) to the port that is connected to HCA */
 			cl_ptr_vector_at(&p_leaf_port_group->ports, 0,
 					 (void *)&p_port);
-			p_sw->p_osm_sw->new_lft[cl_ntoh16(hca_lid)] = p_port->port_num;
+			p_sw->p_osm_sw->new_lft[hca_lid] = p_port->port_num;
 
 			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 				"Switch %s: set path to CN LID %u through port %u\n",
-				__osm_ftree_tuple_to_str(p_sw->tuple),
-				cl_ntoh16(hca_lid), p_port->port_num);
+				tuple_to_str(p_sw->tuple),
+				hca_lid, p_port->port_num);
 
 			/* set local min hop table(LID) to route to the CA */
-			__osm_ftree_sw_set_hops(p_sw,
-						cl_ntoh16(hca_lid),
-						p_port->port_num, 1);
+			sw_set_hops(p_sw, hca_lid, p_port->port_num, 1, FALSE);
 
 			/* Assign downgoing ports by stepping up.
 			   Since we're routing here only CNs, we're routing it as REAL
 			   LID and updating fat-tree balancing counters. */
-			__osm_ftree_fabric_route_downgoing_by_going_up(p_ftree, p_sw,	/* local switch - used as a route-downgoing alg. start point */
-								       NULL,	/* prev. position switch */
-								       hca_lid,	/* LID that we're routing to */
-								       p_sw->rank + 1,	/* rank of the LID that we're routing to */
-								       TRUE,	/* whether this HCA LID is real or dummy */
-								       TRUE);	/* whether this path to HCA should by tracked by counters */
+			fabric_route_downgoing_by_going_up(p_ftree, p_sw,	/* local switch - used as a route-downgoing alg. start point */
+							   NULL,	/* prev. position switch */
+							   hca_lid,	/* LID that we're routing to */
+							   TRUE,	/* whether this HCA LID is real or dummy */
+							   TRUE,	/* whether this path to HCA should by tracked by counters */
+							   FALSE,	/* whether target lid is a switch or not */
+							   0,	/* Number of reverse hops allowed */
+							   0,	/* Number of reverse hops done yet */
+							   1);	/* Number of hops done yet */
 
 			/* count how many real targets have been routed from this leaf switch */
 			routed_targets_on_leaf++;
@@ -2431,29 +2813,30 @@ static void __osm_ftree_fabric_route_to_cns(IN ftree_fabric_t * p_ftree)
 		/* We're done with the real targets (all CNs) of this leaf switch.
 		   Now route the dummy HCAs that are missing or that are non-CNs.
 		   When routing to dummy HCAs we don't fill lid matrices. */
-
 		if (p_ftree->max_cn_per_leaf > routed_targets_on_leaf) {
 			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 				"Routing %u dummy CAs\n",
 				p_ftree->max_cn_per_leaf -
 				p_sw->down_port_groups_num);
-			for (j = 0;
-			     ((int)j) <
-			     (p_ftree->max_cn_per_leaf -
-			      routed_targets_on_leaf); j++) {
+			for (j = 0; j <
+			     p_ftree->max_cn_per_leaf - routed_targets_on_leaf;
+			     j++) {
 				/* assign downgoing ports by stepping up */
-				__osm_ftree_fabric_route_downgoing_by_going_up(p_ftree, p_sw,	/* local switch - used as a route-downgoing alg. start point */
-									       NULL,	/* prev. position switch */
-									       0,	/* LID that we're routing to - ignored for dummy HCA */
-									       0,	/* rank of the LID that we're routing to - ignored for dummy HCA */
-									       FALSE,	/* whether this HCA LID is real or dummy */
-									       TRUE);	/* whether this path to HCA should by tracked by counters */
+				fabric_route_downgoing_by_going_up(p_ftree, p_sw,	/* local switch - used as a route-downgoing alg. start point */
+								   NULL,	/* prev. position switch */
+								   0,	/* LID that we're routing to - ignored for dummy HCA */
+								   FALSE,	/* whether this HCA LID is real or dummy */
+								   TRUE,	/* whether this path to HCA should by tracked by counters */
+								   FALSE,	/* Whether the target LID is a switch or not */
+								   0,	/* Number of reverse hops allowed */
+								   0,	/* Number of reverse hops done yet */
+								   1);	/* Number of hops done yet */
 			}
 		}
 	}
 	/* done going through all the leaf switches */
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
-}				/* __osm_ftree_fabric_route_to_cns() */
+}				/* fabric_route_to_cns() */
 
 /***************************************************/
 
@@ -2462,11 +2845,11 @@ static void __osm_ftree_fabric_route_to_cns(IN ftree_fabric_t * p_ftree)
  *    foreach HCA non-CN port in fabric
  *       obtain the LID of the HCA port
  *       get switch that is connected to this HCA port
- *       set switch LFT(LID) to the port connecting to compute node
- *       call assign-down-going-port-by-ascending-up(TRUE,FALSE) on CURRENT switch
+ *       set switch LFT(LID) to the port connected to the HCA port
+ *       call assign-down-going-port-by-ascending-up(TRUE,TRUE) on the switch
  *
- * Routing to these HCAs is routing a REAL hca lid on SECONDARY path.
- * However, we do want to allow load-leveling of the traffic to the non-CNs,
+ * Routing to these HCAs is routing a REAL hca lid on MAIN path.
+ * We want to allow load-leveling of the traffic to the non-CNs,
  * because such nodes may include IO nodes with heavy usage
  *   - we should set fwd tables
  *   - we should update port counters
@@ -2474,14 +2857,14 @@ static void __osm_ftree_fabric_route_to_cns(IN ftree_fabric_t * p_ftree)
  * counters will not affect CN-to-CN routing.
  */
 
-static void __osm_ftree_fabric_route_to_non_cns(IN ftree_fabric_t * p_ftree)
+static void fabric_route_to_non_cns(IN ftree_fabric_t * p_ftree)
 {
 	ftree_sw_t *p_sw;
 	ftree_hca_t *p_hca;
 	ftree_hca_t *p_next_hca;
 	ftree_port_t *p_hca_port;
 	ftree_port_group_t *p_hca_port_group;
-	ib_net16_t hca_lid;
+	uint16_t hca_lid;
 	unsigned port_num_on_switch;
 	unsigned i;
 
@@ -2511,34 +2894,36 @@ static void __osm_ftree_fabric_route_to_non_cns(IN ftree_fabric_t * p_ftree)
 			cl_ptr_vector_at(&p_hca_port_group->ports, 0,
 					 (void *)&p_hca_port);
 			port_num_on_switch = p_hca_port->remote_port_num;
-			p_sw->p_osm_sw->new_lft[cl_ntoh16(hca_lid)] = port_num_on_switch;
+			p_sw->p_osm_sw->new_lft[hca_lid] = port_num_on_switch;
 
 			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 				"Switch %s: set path to non-CN HCA LID %u through port %u\n",
-				__osm_ftree_tuple_to_str(p_sw->tuple),
-				cl_ntoh16(hca_lid), port_num_on_switch);
+				tuple_to_str(p_sw->tuple),
+				hca_lid, port_num_on_switch);
 
 			/* set local min hop table(LID) to route to the CA */
-			__osm_ftree_sw_set_hops(p_sw, cl_ntoh16(hca_lid),
-						port_num_on_switch,	/* port num */
-						1);	/* hops */
+			sw_set_hops(p_sw, hca_lid, port_num_on_switch,	/* port num */
+				    1, FALSE);	/* hops */
 
 			/* Assign downgoing ports by stepping up.
 			   We're routing REAL targets. They are not CNs and not included
 			   in the leafs array, but we treat them as MAIN path to allow load
 			   leveling, which means that the counters will be updated. */
-			__osm_ftree_fabric_route_downgoing_by_going_up(p_ftree, p_sw,	/* local switch - used as a route-downgoing alg. start point */
-								       NULL,	/* prev. position switch */
-								       hca_lid,	/* LID that we're routing to */
-								       p_sw->rank + 1,	/* rank of the LID that we're routing to */
-								       TRUE,	/* whether this HCA LID is real or dummy */
-								       TRUE);	/* whether this path to HCA should by tracked by counters */
+			fabric_route_downgoing_by_going_up(p_ftree, p_sw,	/* local switch - used as a route-downgoing alg. start point */
+							   NULL,	/* prev. position switch */
+							   hca_lid,	/* LID that we're routing to */
+							   TRUE,	/* whether this HCA LID is real or dummy */
+							   TRUE,	/* whether this path to HCA should by tracked by counters */
+							   FALSE,	/* Whether the target LID is a switch or not */
+							   p_hca_port_group->is_io ? p_ftree->p_osm->subn.opt.max_reverse_hops : 0,	/* Number or reverse hops allowed */
+							   0,	/* Number or reverse hops done yet */
+							   1);	/* Number of hops done yet */
 		}
 		/* done with all the port groups of this HCA - go to next HCA */
 	}
 
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
-}				/* __osm_ftree_fabric_route_to_non_cns() */
+}				/* fabric_route_to_non_cns() */
 
 /***************************************************/
 
@@ -2554,7 +2939,7 @@ static void __osm_ftree_fabric_route_to_non_cns(IN ftree_fabric_t * p_ftree)
  *   - we should NOT update port counters
  */
 
-static void __osm_ftree_fabric_route_to_switches(IN ftree_fabric_t * p_ftree)
+static void fabric_route_to_switches(IN ftree_fabric_t * p_ftree)
 {
 	ftree_sw_t *p_sw;
 	ftree_sw_t *p_next_sw;
@@ -2567,33 +2952,119 @@ static void __osm_ftree_fabric_route_to_switches(IN ftree_fabric_t * p_ftree)
 		p_next_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item);
 
 		/* set local LFT(LID) to 0 (route to itself) */
-		p_sw->p_osm_sw->new_lft[cl_ntoh16(p_sw->base_lid)] = 0;
+		p_sw->p_osm_sw->new_lft[p_sw->base_lid] = 0;
 
 		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 			"Switch %s (LID %u): routing switch-to-switch paths\n",
-			__osm_ftree_tuple_to_str(p_sw->tuple),
-			cl_ntoh16(p_sw->base_lid));
+			tuple_to_str(p_sw->tuple), p_sw->base_lid);
 
 		/* set min hop table of the switch to itself */
-		__osm_ftree_sw_set_hops(p_sw, cl_ntoh16(p_sw->base_lid),
-					0,	/* port_num */
-					0);	/* hops     */
-
-		__osm_ftree_fabric_route_downgoing_by_going_up(p_ftree, p_sw,	/* local switch - used as a route-downgoing alg. start point */
-							       NULL,	/* prev. position switch */
-							       p_sw->base_lid,	/* LID that we're routing to */
-							       p_sw->rank,	/* rank of the LID that we're routing to */
-							       TRUE,	/* whether the target LID is a real or dummy */
-							       FALSE);	/* whether this path should by tracked by counters */
+		sw_set_hops(p_sw, p_sw->base_lid, 0,	/* port_num */
+			    0, TRUE);	/* hops     */
+
+		fabric_route_downgoing_by_going_up(p_ftree, p_sw,	/* local switch - used as a route-downgoing alg. start point */
+						   NULL,	/* prev. position switch */
+						   p_sw->base_lid,	/* LID that we're routing to */
+						   TRUE,	/* whether the target LID is a real or dummy */
+						   FALSE,	/* whether this path to HCA should by tracked by counters */
+						   TRUE,	/* Whether the target LID is a switch or not */
+						   0,	/* Number of reverse hops allowed */
+						   0,	/* Number of reverse hops done yet */
+						   0);	/* Number of hops done yet */
 	}
 
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
-}				/* __osm_ftree_fabric_route_to_switches() */
+}				/* fabric_route_to_switches() */
 
 /***************************************************
  ***************************************************/
 
-static int __osm_ftree_fabric_populate_nodes(IN ftree_fabric_t * p_ftree)
+static void fabric_route_roots(IN ftree_fabric_t * p_ftree)
+{
+	uint16_t lid;
+	uint8_t port_num;
+	osm_port_t *p_port;
+	ftree_sw_t *p_sw;
+	ftree_sw_t *p_leaf_sw;
+
+	OSM_LOG_ENTER(&p_ftree->p_osm->log);
+
+	/*
+	 * We need a switch that will accomodate all the down/up turns in
+	 * the fabric. Having these turn in a single place in the fabric
+	 * will not create credit loops.
+	 * So we need to select this switch.
+	 * The idea here is to chose leaf with the highest index. I don't
+	 * have any theory to back me up on this. It's just a general thought
+	 * that this way the switch that might be a bottleneck for many mcast
+	 * groups will be far away from the OpenSM, so it will draw the
+	 * multicast traffic away from the SM.
+	 */
+
+	p_leaf_sw = p_ftree->leaf_switches[p_ftree->leaf_switches_num-1];
+
+	/*
+	 * Now go over all the switches in the fabric that
+	 * have lower rank, and route the missing LIDs to
+	 * the selected leaf switch.
+	 * In short, this leaf switch now poses a target
+	 * for all those missing LIDs.
+	 */
+
+	for (p_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);
+	     p_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl);
+	     p_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item)) {
+
+		if (p_sw->rank >= p_ftree->leaf_switch_rank)
+			continue;
+
+		for (lid = 1; lid <= p_leaf_sw->p_osm_sw->max_lid_ho; lid ++) {
+
+			if (p_sw->p_osm_sw->new_lft[lid] != OSM_NO_PATH ||
+			    p_leaf_sw->hops[lid] == OSM_NO_PATH)
+				continue;
+
+			p_port = osm_get_port_by_lid_ho(&p_ftree->p_osm->subn,
+							lid);
+
+			/* we're interested only in switches */
+			if (!p_port || !p_port->p_node->sw)
+				continue;
+
+			/*
+			 * the missing LID will be routed through the same
+			 * port that routes to the selected leaf switch
+			 */
+			port_num = p_sw->p_osm_sw->new_lft[p_leaf_sw->base_lid];
+
+			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
+				"Switch %s: setting path to LID %u "
+				"through port %u\n",
+				tuple_to_str(p_sw->tuple), lid, port_num);
+
+			if (p_ftree->p_osm->subn.opt.connect_roots) {
+				/* set local lft */
+				p_sw->p_osm_sw->new_lft[lid] = port_num;
+			}
+
+			/*
+			 * Set local min hop table.
+			 * The distance to the target LID is a distance
+			 * to the selected leaf switch plus the distance
+			 * from the leaf to the target LID.
+			 */
+			sw_set_hops(p_sw, lid, port_num,
+				p_sw->hops[p_leaf_sw->base_lid] +
+				p_leaf_sw->hops[lid], TRUE);
+		}
+	}
+
+	OSM_LOG_EXIT(&p_ftree->p_osm->log);
+}				/* fabric_route_roots() */
+
+/***************************************************/
+
+static int fabric_populate_nodes(IN ftree_fabric_t * p_ftree)
 {
 	osm_node_t *p_osm_node;
 	osm_node_t *p_next_osm_node;
@@ -2603,23 +3074,23 @@ static int __osm_ftree_fabric_populate_nodes(IN ftree_fabric_t * p_ftree)
 	p_next_osm_node =
 	    (osm_node_t *) cl_qmap_head(&p_ftree->p_osm->subn.node_guid_tbl);
 	while (p_next_osm_node !=
-	       (osm_node_t *) cl_qmap_end(&p_ftree->p_osm->subn.
-					  node_guid_tbl)) {
+	       (osm_node_t *) cl_qmap_end(&p_ftree->p_osm->
+					  subn.node_guid_tbl)) {
 		p_osm_node = p_next_osm_node;
 		p_next_osm_node =
 		    (osm_node_t *) cl_qmap_next(&p_osm_node->map_item);
 		switch (osm_node_get_type(p_osm_node)) {
 		case IB_NODE_TYPE_CA:
-			__osm_ftree_fabric_add_hca(p_ftree, p_osm_node);
+			fabric_add_hca(p_ftree, p_osm_node);
 			break;
 		case IB_NODE_TYPE_ROUTER:
 			break;
 		case IB_NODE_TYPE_SWITCH:
-			__osm_ftree_fabric_add_sw(p_ftree, p_osm_node->sw);
+			fabric_add_sw(p_ftree, p_osm_node->sw);
 			break;
 		default:
-			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR, "ERR AB0E: "
-				"Node GUID 0x%016" PRIx64
+			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,
+				"ERR AB0E: " "Node GUID 0x%016" PRIx64
 				" - Unknown node type: %s\n",
 				cl_ntoh64(osm_node_get_node_guid(p_osm_node)),
 				ib_get_node_type_str(osm_node_get_type
@@ -2631,15 +3102,14 @@ static int __osm_ftree_fabric_populate_nodes(IN ftree_fabric_t * p_ftree)
 
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
 	return 0;
-}				/* __osm_ftree_fabric_populate_nodes() */
+}				/* fabric_populate_nodes() */
 
 /***************************************************
  ***************************************************/
 
-static boolean_t __osm_ftree_sw_update_rank(IN ftree_sw_t * p_sw,
-					    IN uint32_t new_rank)
+static boolean_t sw_update_rank(IN ftree_sw_t * p_sw, IN uint32_t new_rank)
 {
-	if (__osm_ftree_sw_ranked(p_sw) && p_sw->rank <= new_rank)
+	if (sw_ranked(p_sw) && p_sw->rank <= new_rank)
 		return FALSE;
 	p_sw->rank = new_rank;
 	return TRUE;
@@ -2648,8 +3118,7 @@ static boolean_t __osm_ftree_sw_update_rank(IN ftree_sw_t * p_sw,
 
 /***************************************************/
 
-static void
-__osm_ftree_rank_switches_from_leafs(IN ftree_fabric_t * p_ftree,
+static void rank_switches_from_leafs(IN ftree_fabric_t * p_ftree,
 				     IN cl_list_t * p_ranking_bfs_list)
 {
 	ftree_sw_t *p_sw;
@@ -2678,17 +3147,16 @@ __osm_ftree_rank_switches_from_leafs(IN ftree_fabric_t * p_ftree,
 			    IB_NODE_TYPE_SWITCH)
 				continue;
 
-			p_remote_sw = __osm_ftree_fabric_get_sw_by_guid(p_ftree,
-									osm_node_get_node_guid
-									(p_remote_node));
+			p_remote_sw = fabric_get_sw_by_guid(p_ftree,
+							    osm_node_get_node_guid
+							    (p_remote_node));
 			if (!p_remote_sw) {
 				/* remote node is not a switch */
 				continue;
 			}
 
 			/* if needed, rank the remote switch and add it to the BFS list */
-			if (__osm_ftree_sw_update_rank
-			    (p_remote_sw, p_sw->rank + 1)) {
+			if (sw_update_rank(p_remote_sw, p_sw->rank + 1)) {
 				max_rank = p_remote_sw->rank;
 				cl_list_insert_tail(p_ranking_bfs_list,
 						    p_remote_sw);
@@ -2699,14 +3167,13 @@ __osm_ftree_rank_switches_from_leafs(IN ftree_fabric_t * p_ftree,
 	/* set FatTree maximal switch rank */
 	p_ftree->max_switch_rank = max_rank;
 
-}				/* __osm_ftree_rank_switches_from_leafs() */
+}				/* rank_switches_from_leafs() */
 
 /***************************************************/
 
-static int
-__osm_ftree_rank_leaf_switches(IN ftree_fabric_t * p_ftree,
-			       IN ftree_hca_t * p_hca,
-			       IN cl_list_t * p_ranking_bfs_list)
+static int rank_leaf_switches(IN ftree_fabric_t * p_ftree,
+			      IN ftree_hca_t * p_hca,
+			      IN cl_list_t * p_ranking_bfs_list)
 {
 	ftree_sw_t *p_sw;
 	osm_node_t *p_osm_node = p_hca->p_osm_node;
@@ -2730,10 +3197,11 @@ __osm_ftree_rank_leaf_switches(IN ftree_fabric_t * p_ftree,
 		switch (osm_node_get_type(p_remote_osm_node)) {
 		case IB_NODE_TYPE_CA:
 			/* HCA connected directly to another HCA - not FatTree */
-			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR, "ERR AB0F: "
-				"CA conected directly to another CA: "
-				"0x%016" PRIx64 " <---> 0x%016" PRIx64 "\n",
-				__osm_ftree_hca_get_guid_ho(p_hca),
+			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,
+				"ERR AB0F: "
+				"CA conected directly to another CA: " "0x%016"
+				PRIx64 " <---> 0x%016" PRIx64 "\n",
+				hca_get_guid_ho(p_hca),
 				cl_ntoh64(osm_node_get_node_guid
 					  (p_remote_osm_node)));
 			res = -1;
@@ -2761,16 +3229,15 @@ __osm_ftree_rank_leaf_switches(IN ftree_fabric_t * p_ftree,
 
 		/* remote node is switch */
 
-		p_sw = __osm_ftree_fabric_get_sw_by_guid(p_ftree,
-							 osm_node_get_node_guid
-							 (p_osm_port->
-							  p_remote_physp->
-							  p_node));
+		p_sw = fabric_get_sw_by_guid(p_ftree,
+					     osm_node_get_node_guid
+					     (p_osm_port->p_remote_physp->
+					      p_node));
 		CL_ASSERT(p_sw);
 
 		/* if needed, rank the remote switch and add it to the BFS list */
 
-		if (!__osm_ftree_sw_update_rank(p_sw, 0))
+		if (!sw_update_rank(p_sw, 0))
 			continue;
 		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 			"Marking rank of switch that is directly connected to CA:\n"
@@ -2779,21 +3246,20 @@ __osm_ftree_rank_leaf_switches(IN ftree_fabric_t * p_ftree,
 			"                                            - Switch guid: 0x%016"
 			PRIx64 "\n"
 			"                                            - Switch LID : %u\n",
-			__osm_ftree_hca_get_guid_ho(p_hca),
-			__osm_ftree_sw_get_guid_ho(p_sw),
-			cl_ntoh16(p_sw->base_lid));
+			hca_get_guid_ho(p_hca),
+			sw_get_guid_ho(p_sw), p_sw->base_lid);
 		cl_list_insert_tail(p_ranking_bfs_list, p_sw);
 	}
 
 Exit:
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
 	return res;
-}				/* __osm_ftree_rank_leaf_switches() */
+}				/* rank_leaf_switches() */
 
 /***************************************************/
 
-static void __osm_ftree_sw_reverse_rank(IN cl_map_item_t * const p_map_item,
-					IN void *context)
+static void sw_reverse_rank(IN cl_map_item_t * const p_map_item,
+			    IN void *context)
 {
 	ftree_fabric_t *p_ftree = (ftree_fabric_t *) context;
 	ftree_sw_t *p_sw = (ftree_sw_t * const)p_map_item;
@@ -2804,8 +3270,7 @@ static void __osm_ftree_sw_reverse_rank(IN cl_map_item_t * const p_map_item,
  ***************************************************/
 
 static int
-__osm_ftree_fabric_construct_hca_ports(IN ftree_fabric_t * p_ftree,
-				       IN ftree_hca_t * p_hca)
+fabric_construct_hca_ports(IN ftree_fabric_t * p_ftree, IN ftree_hca_t * p_hca)
 {
 	ftree_sw_t *p_remote_sw;
 	osm_node_t *p_node = p_hca->p_osm_node;
@@ -2816,6 +3281,7 @@ __osm_ftree_fabric_construct_hca_ports(IN ftree_fabric_t * p_ftree,
 	uint8_t i;
 	uint8_t remote_port_num;
 	boolean_t is_cn = FALSE;
+	boolean_t is_io = FALSE;
 	int res = 0;
 
 	for (i = 0; i < osm_node_get_num_physp(p_node); i++) {
@@ -2827,7 +3293,7 @@ __osm_ftree_fabric_construct_hca_ports(IN ftree_fabric_t * p_ftree,
 		p_remote_node =
 		    osm_node_get_remote_node(p_node, i, &remote_port_num);
 
-		if (!p_remote_osm_port)
+		if (!p_remote_osm_port || !p_remote_node)
 			continue;
 
 		remote_node_type = osm_node_get_type(p_remote_node);
@@ -2840,9 +3306,10 @@ __osm_ftree_fabric_construct_hca_ports(IN ftree_fabric_t * p_ftree,
 
 		case IB_NODE_TYPE_CA:
 			/* HCA connected directly to another HCA - not FatTree */
-			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR, "ERR AB11: "
-				"CA conected directly to another CA: "
-				"0x%016" PRIx64 " <---> 0x%016" PRIx64 "\n",
+			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,
+				"ERR AB11: "
+				"CA conected directly to another CA: " "0x%016"
+				PRIx64 " <---> 0x%016" PRIx64 "\n",
 				cl_ntoh64(osm_node_get_node_guid(p_node)),
 				cl_ntoh64(remote_node_guid));
 			res = -1;
@@ -2864,25 +3331,21 @@ __osm_ftree_fabric_construct_hca_ports(IN ftree_fabric_t * p_ftree,
 
 		/* remote node is switch */
 
-		p_remote_sw =
-		    __osm_ftree_fabric_get_sw_by_guid(p_ftree,
-						      remote_node_guid);
+		p_remote_sw = fabric_get_sw_by_guid(p_ftree, remote_node_guid);
 		CL_ASSERT(p_remote_sw);
 
 		/* If CN file is not supplied, then all the CAs considered as Compute Nodes.
 		   Otherwise all the CAs are not CNs, and only guids that are present in the
 		   CN file will be marked as compute nodes. */
-		if (!__osm_ftree_fabric_cns_provided(p_ftree)) {
+		if (!fabric_cns_provided(p_ftree)) {
 			is_cn = TRUE;
 		} else {
-			name_map_item_t *p_elem =
-			    (name_map_item_t *) cl_qmap_get(&p_ftree->
-							    cn_guid_tbl,
-							    cl_ntoh64(osm_physp_get_port_guid
-							    (p_osm_port)));
-			if (p_elem !=
-			    (name_map_item_t *) cl_qmap_end(&p_ftree->
-							    cn_guid_tbl))
+			name_map_item_t *p_elem = (name_map_item_t *)
+			    cl_qmap_get(&p_ftree->cn_guid_tbl,
+					cl_ntoh64(osm_physp_get_port_guid
+						  (p_osm_port)));
+			if (p_elem != (name_map_item_t *)
+			    cl_qmap_end(&p_ftree->cn_guid_tbl))
 				is_cn = TRUE;
 		}
 
@@ -2893,39 +3356,60 @@ __osm_ftree_fabric_construct_hca_ports(IN ftree_fabric_t * p_ftree,
 				"Marking CN port GUID 0x%016" PRIx64 "\n",
 				cl_ntoh64(osm_physp_get_port_guid(p_osm_port)));
 		} else {
-			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
-				"Marking non-CN port GUID 0x%016" PRIx64 "\n",
-				cl_ntoh64(osm_physp_get_port_guid(p_osm_port)));
-		}
+			if (fabric_ios_provided(p_ftree)) {
+				name_map_item_t *p_elem = (name_map_item_t *)
+				    cl_qmap_get(&p_ftree->io_guid_tbl,
+						cl_ntoh64
+						(osm_physp_get_port_guid
+						 (p_osm_port)));
+				if (p_elem != (name_map_item_t *)
+				    cl_qmap_end(&p_ftree->io_guid_tbl))
+					is_io = TRUE;
 
-		__osm_ftree_hca_add_port(p_hca,	/* local ftree_hca object */
-					 i,	/* local port number */
-					 remote_port_num,	/* remote port number */
-					 osm_node_get_base_lid(p_node, i),	/* local lid */
-					 osm_node_get_base_lid(p_remote_node, 0),	/* remote lid */
-					 osm_physp_get_port_guid(p_osm_port),	/* local port guid */
-					 osm_physp_get_port_guid(p_remote_osm_port),	/* remote port guid */
-					 remote_node_guid,	/* remote node guid */
-					 remote_node_type,	/* remote node type */
-					 (void *)p_remote_sw,	/* remote ftree_hca/sw object */
-					 is_cn);	/* whether this port is compute node */
+				OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
+					"Marking I/O port GUID 0x%016" PRIx64
+					"\n",
+					cl_ntoh64(osm_physp_get_port_guid
+						  (p_osm_port)));
+
+			} else {
+				OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
+					"Marking non-CN port GUID 0x%016" PRIx64
+					"\n",
+					cl_ntoh64(osm_physp_get_port_guid
+						  (p_osm_port)));
+			}
+		}
+		p_ftree->ca_ports++;
+
+		hca_add_port(p_hca,	/* local ftree_hca object */
+			     i,	/* local port number */
+			     remote_port_num,	/* remote port number */
+			     cl_ntoh16(osm_node_get_base_lid(p_node, i)),	/* local lid */
+			     cl_ntoh16(osm_node_get_base_lid(p_remote_node, 0)),	/* remote lid */
+			     osm_physp_get_port_guid(p_osm_port),	/* local port guid */
+			     osm_physp_get_port_guid(p_remote_osm_port),	/* remote port guid */
+			     remote_node_guid,	/* remote node guid */
+			     remote_node_type,	/* remote node type */
+			     (void *)p_remote_sw,	/* remote ftree_hca/sw object */
+			     is_cn, is_io);	/* whether this port is compute node */
 	}
 
 Exit:
 	return res;
-}				/* __osm_ftree_fabric_construct_hca_ports() */
+}				/* fabric_construct_hca_ports() */
 
 /***************************************************
  ***************************************************/
 
-static int __osm_ftree_fabric_construct_sw_ports(IN ftree_fabric_t * p_ftree,
-						 IN ftree_sw_t * p_sw)
+static int fabric_construct_sw_ports(IN ftree_fabric_t * p_ftree,
+				     IN ftree_sw_t * p_sw)
 {
 	ftree_hca_t *p_remote_hca;
 	ftree_sw_t *p_remote_sw;
 	osm_node_t *p_node = p_sw->p_osm_sw->p_node;
 	osm_node_t *p_remote_node;
-	ib_net16_t remote_base_lid;
+	uint16_t remote_base_lid;
 	uint8_t remote_node_type;
 	ib_net64_t remote_node_guid;
 	osm_physp_t *p_remote_osm_port;
@@ -2948,15 +3432,16 @@ static int __osm_ftree_fabric_construct_sw_ports(IN ftree_fabric_t * p_ftree,
 
 		p_remote_node =
 		    osm_node_get_remote_node(p_node, i, &remote_port_num);
+		if (!p_remote_node)
+			continue;
 
 		/* ignore any loopback connection on switch */
 		if (p_node == p_remote_node) {
 			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 				"Ignoring loopback on switch GUID 0x%016" PRIx64
 				", LID %u, rank %u\n",
-				__osm_ftree_sw_get_guid_ho(p_sw),
-				cl_ntoh16(p_sw->base_lid),
-				p_sw->rank);
+				sw_get_guid_ho(p_sw),
+				p_sw->base_lid, p_sw->rank);
 			continue;
 		}
 
@@ -2972,53 +3457,36 @@ static int __osm_ftree_fabric_construct_sw_ports(IN ftree_fabric_t * p_ftree,
 			/* switch connected to hca */
 
 			p_remote_hca =
-			    __osm_ftree_fabric_get_hca_by_guid(p_ftree,
-							       remote_node_guid);
+			    fabric_get_hca_by_guid(p_ftree, remote_node_guid);
 			CL_ASSERT(p_remote_hca);
 
 			p_remote_hca_or_sw = (void *)p_remote_hca;
 			direction = FTREE_DIRECTION_DOWN;
 
 			remote_base_lid =
-			    osm_physp_get_base_lid(p_remote_osm_port);
+			    cl_ntoh16(osm_physp_get_base_lid
+				      (p_remote_osm_port));
 			break;
 
 		case IB_NODE_TYPE_SWITCH:
 			/* switch connected to another switch */
 
 			p_remote_sw =
-			    __osm_ftree_fabric_get_sw_by_guid(p_ftree,
-							      remote_node_guid);
+			    fabric_get_sw_by_guid(p_ftree, remote_node_guid);
 			CL_ASSERT(p_remote_sw);
 
 			p_remote_hca_or_sw = (void *)p_remote_sw;
 
-			if (abs(p_sw->rank - p_remote_sw->rank) != 1) {
-				OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,
-					"ERR AB16: "
-					"Illegal link between switches with ranks %u and %u:\n"
-					"       GUID 0x%016" PRIx64
-					", LID %u, rank %u\n"
-					"       GUID 0x%016" PRIx64
-					", LID %u, rank %u\n", p_sw->rank,
-					p_remote_sw->rank,
-					__osm_ftree_sw_get_guid_ho(p_sw),
-					cl_ntoh16(p_sw->base_lid), p_sw->rank,
-					__osm_ftree_sw_get_guid_ho(p_remote_sw),
-					cl_ntoh16(p_remote_sw->base_lid),
-					p_remote_sw->rank);
-				res = -1;
-				goto Exit;
-			}
-
-			if (p_sw->rank > p_remote_sw->rank)
+			if (p_sw->rank > p_remote_sw->rank) {
 				direction = FTREE_DIRECTION_UP;
-			else
+			} else if (p_sw->rank == p_remote_sw->rank) {
+				direction = FTREE_DIRECTION_SAME;
+			} else
 				direction = FTREE_DIRECTION_DOWN;
 
 			/* switch LID is only in port 0 port_info structure */
 			remote_base_lid =
-			    osm_node_get_base_lid(p_remote_node, 0);
+			    cl_ntoh16(osm_node_get_base_lid(p_remote_node, 0));
 
 			break;
 
@@ -3031,39 +3499,64 @@ static int __osm_ftree_fabric_construct_sw_ports(IN ftree_fabric_t * p_ftree,
 			res = -1;
 			goto Exit;
 		}
-		__osm_ftree_sw_add_port(p_sw,	/* local ftree_sw object */
-					i,	/* local port number */
-					remote_port_num,	/* remote port number */
-					p_sw->base_lid,	/* local lid */
-					remote_base_lid,	/* remote lid */
-					osm_physp_get_port_guid(p_osm_port),	/* local port guid */
-					osm_physp_get_port_guid(p_remote_osm_port),	/* remote port guid */
-					remote_node_guid,	/* remote node guid */
-					remote_node_type,	/* remote node type */
-					p_remote_hca_or_sw,	/* remote ftree_hca/sw object */
-					direction);	/* port direction (up or down) */
+		sw_add_port(p_sw,	/* local ftree_sw object */
+			    i,	/* local port number */
+			    remote_port_num,	/* remote port number */
+			    p_sw->base_lid,	/* local lid */
+			    remote_base_lid,	/* remote lid */
+			    osm_physp_get_port_guid(p_osm_port),	/* local port guid */
+			    osm_physp_get_port_guid(p_remote_osm_port),	/* remote port guid */
+			    remote_node_guid,	/* remote node guid */
+			    remote_node_type,	/* remote node type */
+			    p_remote_hca_or_sw,	/* remote ftree_hca/sw object */
+			    direction);	/* port direction (up or down) */
 
 		/* Track the max lid (in host order) that exists in the fabric */
-		if (cl_ntoh16(remote_base_lid) > p_ftree->lft_max_lid_ho)
-			p_ftree->lft_max_lid_ho = cl_ntoh16(remote_base_lid);
+		if (remote_base_lid > p_ftree->lft_max_lid)
+			p_ftree->lft_max_lid = remote_base_lid;
 	}
 
 Exit:
 	return res;
-}				/* __osm_ftree_fabric_construct_sw_ports() */
+}				/* fabric_construct_sw_ports() */
 
 /***************************************************
  ***************************************************/
+struct rank_root_cxt {
+	ftree_fabric_t *fabric;
+	cl_list_t *list;
+};
+
+static int rank_root_sw_by_guid(void *cxt, uint64_t guid, char *p)
+{
+	struct rank_root_cxt *c = cxt;
+	ftree_sw_t *sw;
+
+	sw = fabric_get_sw_by_guid(c->fabric, cl_hton64(guid));
+	if (!sw) {
+		/* the specified root guid wasn't found in the fabric */
+		OSM_LOG(&c->fabric->p_osm->log, OSM_LOG_ERROR, "ERR AB24: "
+			"Root switch GUID 0x%" PRIx64 " not found\n", guid);
+		return 0;
+	}
 
-static int __osm_ftree_fabric_rank_from_roots(IN ftree_fabric_t * p_ftree)
+	OSM_LOG(&c->fabric->p_osm->log, OSM_LOG_DEBUG,
+		"Ranking root switch with GUID 0x%" PRIx64 "\n", guid);
+	sw->rank = 0;
+	cl_list_insert_tail(c->list, sw);
+
+	return 0;
+}
+
+static int fabric_rank_from_roots(IN ftree_fabric_t * p_ftree)
 {
+	struct rank_root_cxt context;
 	osm_node_t *p_osm_node;
 	osm_node_t *p_remote_osm_node;
 	osm_physp_t *p_osm_physp;
 	ftree_sw_t *p_sw;
 	ftree_sw_t *p_remote_sw;
 	cl_list_t ranking_bfs_list;
-	struct guid_list_item *item;
 	int res = 0;
 	unsigned num_roots;
 	unsigned max_rank = 0;
@@ -3073,25 +3566,16 @@ static int __osm_ftree_fabric_rank_from_roots(IN ftree_fabric_t * p_ftree)
 	cl_list_init(&ranking_bfs_list, 10);
 
 	/* Rank all the roots and add them to list */
-	for (item = (void *)cl_qlist_head(&p_ftree->root_guid_list);
-	     item != (void *)cl_qlist_end(&p_ftree->root_guid_list);
-	     item = (void *)cl_qlist_next(&item->list)) {
-		p_sw =
-		    __osm_ftree_fabric_get_sw_by_guid(p_ftree,
-						      cl_hton64(item->guid));
-		if (!p_sw) {
-			/* the specified root guid wasn't found in the fabric */
-			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR, "ERR AB24: "
-				"Root switch GUID 0x%" PRIx64 " not found\n",
-				item->guid);
-			continue;
-		}
+	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
+		"Fetching root nodes from file %s\n",
+		p_ftree->p_osm->subn.opt.root_guid_file);
 
-		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
-			"Ranking root switch with GUID 0x%" PRIx64 "\n",
-			item->guid);
-		p_sw->rank = 0;
-		cl_list_insert_tail(&ranking_bfs_list, p_sw);
+	context.fabric = p_ftree;
+	context.list = &ranking_bfs_list;
+	if (parse_node_map(p_ftree->p_osm->subn.opt.root_guid_file,
+			   rank_root_sw_by_guid, &context)) {
+		res = -1;
+		goto Exit;
 	}
 
 	num_roots = cl_list_count(&ranking_bfs_list);
@@ -3115,7 +3599,7 @@ static int __osm_ftree_fabric_rank_from_roots(IN ftree_fabric_t * p_ftree)
 		/* note: skipping port 0 on switches */
 		for (i = 1; i < osm_node_get_num_physp(p_osm_node); i++) {
 			p_osm_physp = osm_node_get_physp_ptr(p_osm_node, i);
-			if (!p_osm_physp  || !osm_link_is_healthy(p_osm_physp))
+			if (!p_osm_physp || !osm_link_is_healthy(p_osm_physp))
 				continue;
 
 			p_remote_osm_node =
@@ -3127,18 +3611,17 @@ static int __osm_ftree_fabric_rank_from_roots(IN ftree_fabric_t * p_ftree)
 			    IB_NODE_TYPE_SWITCH)
 				continue;
 
-			p_remote_sw = __osm_ftree_fabric_get_sw_by_guid(p_ftree,
-									osm_node_get_node_guid
-									(p_remote_osm_node));
+			p_remote_sw = fabric_get_sw_by_guid(p_ftree,
+							    osm_node_get_node_guid
+							    (p_remote_osm_node));
 			CL_ASSERT(p_remote_sw);
 
 			/* if needed, rank the remote switch and add it to the BFS list */
-			if (__osm_ftree_sw_update_rank
-			    (p_remote_sw, p_sw->rank + 1)) {
+			if (sw_update_rank(p_remote_sw, p_sw->rank + 1)) {
 				OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 					"Ranking switch 0x%" PRIx64
 					" with rank %u\n",
-					__osm_ftree_sw_get_guid_ho(p_remote_sw),
+					sw_get_guid_ho(p_remote_sw),
 					p_remote_sw->rank);
 				max_rank = p_remote_sw->rank;
 				cl_list_insert_tail(&ranking_bfs_list,
@@ -3158,12 +3641,12 @@ Exit:
 	cl_list_destroy(&ranking_bfs_list);
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
 	return res;
-}				/* __osm_ftree_fabric_rank_from_roots() */
+}				/* fabric_rank_from_roots() */
 
 /***************************************************
  ***************************************************/
 
-static int __osm_ftree_fabric_rank_from_hcas(IN ftree_fabric_t * p_ftree)
+static int fabric_rank_from_hcas(IN ftree_fabric_t * p_ftree)
 {
 	ftree_hca_t *p_hca;
 	ftree_hca_t *p_next_hca;
@@ -3181,10 +3664,10 @@ static int __osm_ftree_fabric_rank_from_hcas(IN ftree_fabric_t * p_ftree)
 	while (p_next_hca != (ftree_hca_t *) cl_qmap_end(&p_ftree->hca_tbl)) {
 		p_hca = p_next_hca;
 		p_next_hca = (ftree_hca_t *) cl_qmap_next(&p_hca->map_item);
-		if (__osm_ftree_rank_leaf_switches
-		    (p_ftree, p_hca, &ranking_bfs_list) != 0) {
+		if (rank_leaf_switches(p_ftree, p_hca, &ranking_bfs_list) != 0) {
 			res = -1;
-			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR, "ERR AB14: "
+			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,
+				"ERR AB14: "
 				"Subnet ranking failed - subnet is not FatTree");
 			goto Exit;
 		}
@@ -3192,47 +3675,46 @@ static int __osm_ftree_fabric_rank_from_hcas(IN ftree_fabric_t * p_ftree)
 
 	/* Now rank rest of the switches in the fabric, while the
 	   list already contains all the ranked leaf switches */
-	__osm_ftree_rank_switches_from_leafs(p_ftree, &ranking_bfs_list);
+	rank_switches_from_leafs(p_ftree, &ranking_bfs_list);
 
 	/* fix ranking of the switches by reversing the ranking direction */
-	cl_qmap_apply_func(&p_ftree->sw_tbl, __osm_ftree_sw_reverse_rank,
-			   (void *)p_ftree);
+	cl_qmap_apply_func(&p_ftree->sw_tbl, sw_reverse_rank, (void *)p_ftree);
 
 Exit:
 	cl_list_destroy(&ranking_bfs_list);
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
 	return res;
-}				/* __osm_ftree_fabric_rank_from_hcas() */
+}				/* fabric_rank_from_hcas() */
 
 /***************************************************
  ***************************************************/
 
-static int __osm_ftree_fabric_rank(IN ftree_fabric_t * p_ftree)
+static int fabric_rank(IN ftree_fabric_t * p_ftree)
 {
 	int res = 0;
 
 	OSM_LOG_ENTER(&p_ftree->p_osm->log);
 
-	if (__osm_ftree_fabric_roots_provided(p_ftree))
-		res = __osm_ftree_fabric_rank_from_roots(p_ftree);
+	if (fabric_roots_provided(p_ftree))
+		res = fabric_rank_from_roots(p_ftree);
 	else
-		res = __osm_ftree_fabric_rank_from_hcas(p_ftree);
+		res = fabric_rank_from_hcas(p_ftree);
 
 	if (res)
 		goto Exit;
 
-	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO,
+	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
 		"FatTree max switch rank is %u\n", p_ftree->max_switch_rank);
 
 Exit:
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
 	return res;
-}				/* __osm_ftree_fabric_rank() */
+}				/* fabric_rank() */
 
 /***************************************************
  ***************************************************/
 
-static void __osm_ftree_fabric_set_leaf_rank(IN ftree_fabric_t * p_ftree)
+static void fabric_set_leaf_rank(IN ftree_fabric_t * p_ftree)
 {
 	unsigned i;
 	ftree_sw_t *p_sw;
@@ -3241,7 +3723,7 @@ static void __osm_ftree_fabric_set_leaf_rank(IN ftree_fabric_t * p_ftree)
 
 	OSM_LOG_ENTER(&p_ftree->p_osm->log);
 
-	if (!__osm_ftree_fabric_roots_provided(p_ftree)) {
+	if (!fabric_roots_provided(p_ftree)) {
 		/* If root file is not provided, the fabric has to be pure fat-tree
 		   in terms of ranking. Thus, leaf switches rank is the max rank. */
 		p_ftree->leaf_switch_rank = p_ftree->max_switch_rank;
@@ -3264,7 +3746,7 @@ static void __osm_ftree_fabric_set_leaf_rank(IN ftree_fabric_t * p_ftree)
 
 		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 			"Selected CN port GUID 0x%" PRIx64 "\n",
-			__osm_ftree_hca_get_guid_ho(p_hca));
+			hca_get_guid_ho(p_hca));
 
 		for (i = 0; (i < p_hca->up_port_groups_num)
 		     && (!p_hca->up_port_groups[i]->is_cn); i++) ;
@@ -3275,19 +3757,19 @@ static void __osm_ftree_fabric_set_leaf_rank(IN ftree_fabric_t * p_ftree)
 		p_sw = p_hca->up_port_groups[i]->remote_hca_or_sw.p_sw;
 		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 			"Selected leaf switch GUID 0x%" PRIx64 ", rank %u\n",
-			__osm_ftree_sw_get_guid_ho(p_sw), p_sw->rank);
+			sw_get_guid_ho(p_sw), p_sw->rank);
 		p_ftree->leaf_switch_rank = p_sw->rank;
 	}
 
-	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO,
+	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
 		"FatTree leaf switch rank is %u\n", p_ftree->leaf_switch_rank);
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
-}				/* __osm_ftree_fabric_set_leaf_rank() */
+}				/* fabric_set_leaf_rank() */
 
 /***************************************************
  ***************************************************/
 
-static int __osm_ftree_fabric_populate_ports(IN ftree_fabric_t * p_ftree)
+static int fabric_populate_ports(IN ftree_fabric_t * p_ftree)
 {
 	ftree_hca_t *p_hca;
 	ftree_hca_t *p_next_hca;
@@ -3301,7 +3783,7 @@ static int __osm_ftree_fabric_populate_ports(IN ftree_fabric_t * p_ftree)
 	while (p_next_hca != (ftree_hca_t *) cl_qmap_end(&p_ftree->hca_tbl)) {
 		p_hca = p_next_hca;
 		p_next_hca = (ftree_hca_t *) cl_qmap_next(&p_hca->map_item);
-		if (__osm_ftree_fabric_construct_hca_ports(p_ftree, p_hca) != 0) {
+		if (fabric_construct_hca_ports(p_ftree, p_hca) != 0) {
 			res = -1;
 			goto Exit;
 		}
@@ -3311,7 +3793,7 @@ static int __osm_ftree_fabric_populate_ports(IN ftree_fabric_t * p_ftree)
 	while (p_next_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl)) {
 		p_sw = p_next_sw;
 		p_next_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item);
-		if (__osm_ftree_fabric_construct_sw_ports(p_ftree, p_sw) != 0) {
+		if (fabric_construct_sw_ports(p_ftree, p_sw) != 0) {
 			res = -1;
 			goto Exit;
 		}
@@ -3319,25 +3801,10 @@ static int __osm_ftree_fabric_populate_ports(IN ftree_fabric_t * p_ftree)
 Exit:
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
 	return res;
-}				/* __osm_ftree_fabric_populate_ports() */
+}				/* fabric_populate_ports() */
 
 /***************************************************
  ***************************************************/
-static int add_guid_item_to_list(void *cxt, uint64_t guid, char *p)
-{
-	cl_qlist_t *list = cxt;
-	struct guid_list_item *item;
-
-	item = malloc(sizeof(*item));
-	if (!item)
-		return -1;
-
-	item->guid = guid;
-	cl_qlist_insert_tail(list, &item->list);
-
-	return 0;
-}
-
 static int add_guid_item_to_map(void *cxt, uint64_t guid, char *p)
 {
 	cl_qmap_t *map = cxt;
@@ -3353,93 +3820,98 @@ static int add_guid_item_to_map(void *cxt, uint64_t guid, char *p)
 	return 0;
 }
 
-static int __osm_ftree_fabric_read_guid_files(IN ftree_fabric_t * p_ftree)
+static int fabric_read_guid_files(IN ftree_fabric_t * p_ftree)
 {
 	int status = 0;
 
 	OSM_LOG_ENTER(&p_ftree->p_osm->log);
 
-	if (__osm_ftree_fabric_roots_provided(p_ftree)) {
+	if (fabric_cns_provided(p_ftree)) {
 		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
-			"Fetching root nodes from file %s\n",
-			p_ftree->p_osm->subn.opt.root_guid_file);
+			"Fetching compute nodes from file %s\n",
+			p_ftree->p_osm->subn.opt.cn_guid_file);
 
-		if (parse_node_map(p_ftree->p_osm->subn.opt.root_guid_file,
-				   add_guid_item_to_list,
-				   &p_ftree->root_guid_list)) {
+		if (parse_node_map(p_ftree->p_osm->subn.opt.cn_guid_file,
+				   add_guid_item_to_map,
+				   &p_ftree->cn_guid_tbl)) {
+			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,
+				"ERR AB23: " "Problem parsing CN guid file\n");
 			status = -1;
 			goto Exit;
 		}
 
-		if (!cl_qlist_count(&p_ftree->root_guid_list)) {
-			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR, "ERR AB22: "
-				"Root guids file has no valid guids\n");
+		if (!cl_qmap_count(&p_ftree->cn_guid_tbl)) {
+			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,
+				"ERR AB27: "
+				"Compute node guids file has no valid guids\n");
 			status = -1;
 			goto Exit;
 		}
 	}
 
-	if (__osm_ftree_fabric_cns_provided(p_ftree)) {
+	if (fabric_ios_provided(p_ftree)) {
 		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
-			"Fetching compute nodes from file %s\n",
-			p_ftree->p_osm->subn.opt.cn_guid_file);
+			"Fetching I/O nodes from file %s\n",
+			p_ftree->p_osm->subn.opt.io_guid_file);
 
-		if (parse_node_map(p_ftree->p_osm->subn.opt.cn_guid_file,
+		if (parse_node_map(p_ftree->p_osm->subn.opt.io_guid_file,
 				   add_guid_item_to_map,
-				   &p_ftree->cn_guid_tbl)) {
+				   &p_ftree->io_guid_tbl)) {
+			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,
+				"ERR AB28: Problem parsing I/O guid file\n");
 			status = -1;
 			goto Exit;
 		}
 
-		if (!cl_qmap_count(&p_ftree->cn_guid_tbl)) {
-			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR, "ERR AB23: "
-				"Compute node guids file has no valid guids\n");
+		if (!cl_qmap_count(&p_ftree->io_guid_tbl)) {
+			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,
+				"ERR AB29: "
+				"I/O node guids file has no valid guids\n");
 			status = -1;
 			goto Exit;
 		}
 	}
-
 Exit:
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
 	return status;
-} /*__osm_ftree_fabric_read_guid_files() */
+}				/*fabric_read_guid_files() */
 
 /***************************************************
  ***************************************************/
 
-static int __osm_ftree_construct_fabric(IN void *context)
+static int construct_fabric(IN void *context)
 {
 	ftree_fabric_t *p_ftree = context;
 	int status = 0;
 
 	OSM_LOG_ENTER(&p_ftree->p_osm->log);
 
-	__osm_ftree_fabric_clear(p_ftree);
+	fabric_clear(p_ftree);
 
 	if (p_ftree->p_osm->subn.opt.lmc > 0) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"LMC > 0 is not supported by fat-tree routing.\n"
-			"Falling back to default routing\n");
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID,
+			   "LMC > 0 is not supported by fat-tree routing.\n"
+			   "Falling back to default routing\n");
 		status = -1;
 		goto Exit;
 	}
 
 	if (cl_qmap_count(&p_ftree->p_osm->subn.sw_guid_tbl) < 2) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"Fabric has %u switches - topology is not fat-tree.\n"
-			"Falling back to default routing\n",
-			cl_qmap_count(&p_ftree->p_osm->subn.sw_guid_tbl));
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID,
+			   "Fabric has %u switches - topology is not fat-tree.\n"
+			   "Falling back to default routing\n",
+			   cl_qmap_count(&p_ftree->p_osm->subn.sw_guid_tbl));
 		status = -1;
 		goto Exit;
 	}
 
 	if ((cl_qmap_count(&p_ftree->p_osm->subn.node_guid_tbl) -
 	     cl_qmap_count(&p_ftree->p_osm->subn.sw_guid_tbl)) < 2) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"Fabric has %u nodes (%u switches) - topology is not fat-tree.\n"
-			"Falling back to default routing\n",
-			cl_qmap_count(&p_ftree->p_osm->subn.node_guid_tbl),
-			cl_qmap_count(&p_ftree->p_osm->subn.sw_guid_tbl));
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID,
+			   "Fabric has %u nodes (%u switches) - topology is not fat-tree.\n"
+			   "Falling back to default routing\n",
+			   cl_qmap_count(&p_ftree->p_osm->subn.node_guid_tbl),
+			   cl_qmap_count(&p_ftree->p_osm->subn.sw_guid_tbl));
 		status = -1;
 		goto Exit;
 	}
@@ -3451,29 +3923,29 @@ static int __osm_ftree_construct_fabric(IN void *context)
 
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
 		"Populating FatTree Switch and CA tables\n");
-	if (__osm_ftree_fabric_populate_nodes(p_ftree) != 0) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"Fabric topology is not fat-tree - "
-			"falling back to default routing\n");
+	if (fabric_populate_nodes(p_ftree) != 0) {
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID,
+			   "Fabric topology is not fat-tree - "
+			   "falling back to default routing\n");
 		status = -1;
 		goto Exit;
 	}
 
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
 		"Reading guid files provided by user\n");
-	if (__osm_ftree_fabric_read_guid_files(p_ftree) != 0) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"Failed reading guid files - "
-			"falling back to default routing\n");
+	if (fabric_read_guid_files(p_ftree) != 0) {
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID,
+			   "Failed reading guid files - "
+			   "falling back to default routing\n");
 		status = -1;
 		goto Exit;
 	}
 
 	if (cl_qmap_count(&p_ftree->hca_tbl) < 2) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"Fabric has %u CAa - topology is not fat-tree.\n"
-			"Falling back to default routing\n",
-			cl_qmap_count(&p_ftree->hca_tbl));
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID,
+			   "Fabric has %u CAs - topology is not fat-tree.\n"
+			   "Falling back to default routing\n",
+			   cl_qmap_count(&p_ftree->hca_tbl));
 		status = -1;
 		goto Exit;
 	}
@@ -3483,9 +3955,9 @@ static int __osm_ftree_construct_fabric(IN void *context)
 	   We will be able to check leaf switches rank and the
 	   whole tree rank after filling ports and marking CNs. */
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE, "Ranking FatTree\n");
-	if (__osm_ftree_fabric_rank(p_ftree) != 0) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"Failed ranking the tree\n");
+	if (fabric_rank(p_ftree) != 0) {
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID,
+			   "Failed ranking the tree\n");
 		status = -1;
 		goto Exit;
 	}
@@ -3497,28 +3969,28 @@ static int __osm_ftree_construct_fabric(IN void *context)
 	   that's how the port direction is determined. */
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
 		"Populating CA & switch ports\n");
-	if (__osm_ftree_fabric_populate_ports(p_ftree) != 0) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"Fabric topology is not a fat-tree\n");
+	if (fabric_populate_ports(p_ftree) != 0) {
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID,
+			   "Fabric topology is not a fat-tree\n");
 		status = -1;
 		goto Exit;
 	} else if (p_ftree->cn_num == 0) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"Fabric has no valid compute nodes\n");
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID,
+			   "Fabric has no valid compute nodes\n");
 		status = -1;
 		goto Exit;
 	}
 
 	/* Now that the CA ports have been created and CNs were marked,
 	   we can complete the fabric ranking - set leaf switches rank. */
-	__osm_ftree_fabric_set_leaf_rank(p_ftree);
-
-	if (__osm_ftree_fabric_get_rank(p_ftree) > FAT_TREE_MAX_RANK ||
-	    __osm_ftree_fabric_get_rank(p_ftree) < FAT_TREE_MIN_RANK) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"Fabric rank is %u (should be between %u and %u)\n",
-			__osm_ftree_fabric_get_rank(p_ftree), FAT_TREE_MIN_RANK,
-			FAT_TREE_MAX_RANK);
+	fabric_set_leaf_rank(p_ftree);
+
+	if (fabric_get_rank(p_ftree) > FAT_TREE_MAX_RANK ||
+	    fabric_get_rank(p_ftree) < FAT_TREE_MIN_RANK) {
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID,
+			   "Fabric rank is %u (should be between %u and %u)\n",
+			   fabric_get_rank(p_ftree), FAT_TREE_MIN_RANK,
+			   FAT_TREE_MAX_RANK);
 		status = -1;
 		goto Exit;
 	}
@@ -3527,9 +3999,9 @@ static int __osm_ftree_construct_fabric(IN void *context)
 	   p_ftree->leaf_switch_rank and that are also connected to CNs.
 	   As a by-product, this function also runs basic topology
 	   validation - it checks that all the CNs are at the same rank. */
-	if (__osm_ftree_fabric_mark_leaf_switches(p_ftree)) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"Fabric topology is not a fat-tree\n");
+	if (fabric_mark_leaf_switches(p_ftree)) {
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID,
+			   "Fabric topology is not a fat-tree\n");
 		status = -1;
 		goto Exit;
 	}
@@ -3538,49 +4010,48 @@ static int __osm_ftree_construct_fabric(IN void *context)
 	   This function also sorts leaf switch array by the switch index,
 	   sorts all the port arrays of the indexed switches by remote
 	   switch index, and creates switch-by-tuple table (sw_by_tuple_tbl) */
-	__osm_ftree_fabric_make_indexing(p_ftree);
+	fabric_make_indexing(p_ftree);
 
 	/* Create leaf switch array sorted by index.
 	   This array contains switches with rank equal to p_ftree->leaf_switch_rank
 	   and that are also connected to CNs (REAL leafs), and it may contain
 	   switches at the same leaf rank w/o CNs, if this is the order of indexing.
 	   In any case, the first and the last switches in the array are REAL leafs. */
-	if (__osm_ftree_fabric_create_leaf_switch_array(p_ftree)) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"Fabric topology is not a fat-tree\n");
+	if (fabric_create_leaf_switch_array(p_ftree)) {
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID,
+			   "Fabric topology is not a fat-tree\n");
 		status = -1;
 		goto Exit;
 	}
 
 	/* calculate and set ftree.max_cn_per_leaf field */
-	__osm_ftree_fabric_set_max_cn_per_leaf(p_ftree);
+	fabric_set_max_cn_per_leaf(p_ftree);
 
 	/* print general info about fabric topology */
-	__osm_ftree_fabric_dump_general_info(p_ftree);
+	fabric_dump_general_info(p_ftree);
 
 	/* dump full tree topology */
-	if (osm_log_is_active(&p_ftree->p_osm->log, OSM_LOG_DEBUG))
-		__osm_ftree_fabric_dump(p_ftree);
+	if (OSM_LOG_IS_ACTIVE_V2(&p_ftree->p_osm->log, OSM_LOG_DEBUG))
+		fabric_dump(p_ftree);
 
 	/* the fabric is required to be PURE fat-tree only if the root
 	   guid file hasn't been provided by user */
-	if (!__osm_ftree_fabric_roots_provided(p_ftree) &&
-	    !__osm_ftree_fabric_validate_topology(p_ftree)) {
-		osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-			"Fabric topology is not a fat-tree\n");
+	if (!fabric_roots_provided(p_ftree) &&
+	    !fabric_validate_topology(p_ftree)) {
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID,
+			   "Fabric topology is not a fat-tree\n");
 		status = -1;
 		goto Exit;
 	}
 
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
-		"Max LID in switch LFTs: %u\n",
-		p_ftree->lft_max_lid_ho);
+		"Max LID in switch LFTs: %u\n", p_ftree->lft_max_lid);
 
 Exit:
 	if (status != 0) {
 		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
 			"Clearing FatTree Fabric data structures\n");
-		__osm_ftree_fabric_clear(p_ftree);
+		fabric_clear(p_ftree);
 	} else
 		p_ftree->fabric_built = TRUE;
 
@@ -3592,12 +4063,12 @@ Exit:
 
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
 	return status;
-}				/* __osm_ftree_construct_fabric() */
+}				/* construct_fabric() */
 
 /***************************************************
  ***************************************************/
 
-static int __osm_ftree_do_routing(IN void *context)
+static int do_routing(IN void *context)
 {
 	ftree_fabric_t *p_ftree = context;
 	int status = 0;
@@ -3614,22 +4085,26 @@ static int __osm_ftree_do_routing(IN void *context)
 
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
 		"Filling switch forwarding tables for Compute Nodes\n");
-	__osm_ftree_fabric_route_to_cns(p_ftree);
+	fabric_route_to_cns(p_ftree);
 
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
 		"Filling switch forwarding tables for non-CN targets\n");
-	__osm_ftree_fabric_route_to_non_cns(p_ftree);
+	fabric_route_to_non_cns(p_ftree);
 
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
 		"Filling switch forwarding tables for switch-to-switch paths\n");
-	__osm_ftree_fabric_route_to_switches(p_ftree);
+	fabric_route_to_switches(p_ftree);
+
+	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
+		"Connecting switches that are unreachable within "
+		"Up/Down rules\n");
+	fabric_route_roots(p_ftree);
 
 	/* for each switch, set its fwd table */
-	cl_qmap_apply_func(&p_ftree->sw_tbl, __osm_ftree_set_sw_fwd_table,
-			   (void *)p_ftree);
+	cl_qmap_apply_func(&p_ftree->sw_tbl, set_sw_fwd_table, (void *)p_ftree);
 
 	/* write out hca ordering file */
-	__osm_ftree_fabric_dump_hca_ordering(p_ftree);
+	fabric_dump_hca_ordering(p_ftree);
 
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
 		"FatTree routing is done\n");
@@ -3642,11 +4117,11 @@ Exit:
 /***************************************************
  ***************************************************/
 
-static void __osm_ftree_delete(IN void *context)
+static void delete(IN void *context)
 {
 	if (!context)
 		return;
-	__osm_ftree_fabric_destroy((ftree_fabric_t *) context);
+	fabric_destroy((ftree_fabric_t *) context);
 }
 
 /***************************************************
@@ -3654,16 +4129,16 @@ static void __osm_ftree_delete(IN void *context)
 
 int osm_ucast_ftree_setup(struct osm_routing_engine *r, osm_opensm_t * p_osm)
 {
-	ftree_fabric_t *p_ftree = __osm_ftree_fabric_create();
+	ftree_fabric_t *p_ftree = fabric_create();
 	if (!p_ftree)
 		return -1;
 
 	p_ftree->p_osm = p_osm;
 
 	r->context = (void *)p_ftree;
-	r->build_lid_matrices = __osm_ftree_construct_fabric;
-	r->ucast_build_fwd_tables = __osm_ftree_do_routing;
-	r->delete = __osm_ftree_delete;
+	r->build_lid_matrices = construct_fabric;
+	r->ucast_build_fwd_tables = do_routing;
+	r->destroy = delete;
 
 	return 0;
 }
diff --git a/opensm/osm_ucast_lash.c b/opensm/osm_ucast_lash.c
index f6795f6..6de7d31 100644
--- a/opensm/osm_ucast_lash.c
+++ b/opensm/osm_ucast_lash.c
@@ -1,9 +1,12 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2007      Simula Research Laboratory. All rights reserved.
  * Copyright (c) 2007      Silicon Graphics Inc. All rights reserved.
+ * Copyright (c) 2008,2009 System Fabric Works, Inc. All rights reserved.
+ * Copyright (c) 2009      HNR Consulting. All rights reserved.
+ * Copyright (c) 2009-2011 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -49,92 +52,71 @@
 #include <errno.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qmap.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_UCAST_LASH_C
 #include <opensm/osm_switch.h>
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_log.h>
-
-/* //////////////////////////// */
-/*  Local types                 */
-/* //////////////////////////// */
-
-enum {
-	UNQUEUED,
-	Q_MEMBER,
-	MST_MEMBER,
-	MAX_INT = 9999,
-	NONE = MAX_INT
-};
-
-typedef struct _cdg_vertex {
-	int num_dependencies;
-	struct _cdg_vertex **dependency;
-	int from;
-	int to;
-	int seen;
-	int temp;
-	int visiting_number;
-	struct _cdg_vertex *next;
-	int num_temp_depend;
-	int num_using_vertex;
-	int *num_using_this_depend;
-} cdg_vertex_t;
+#include <opensm/osm_mesh.h>
+#include <opensm/osm_ucast_lash.h>
 
 typedef struct _reachable_dest {
 	int switch_id;
 	struct _reachable_dest *next;
 } reachable_dest_t;
 
-typedef struct _switch {
-	osm_switch_t *p_sw;
-	int *dij_channels;
-	int id;
-	int used_channels;
-	int q_state;
-	struct routing_table {
-		unsigned out_link;
-		unsigned lane;
-	} *routing_table;
-	unsigned int num_connections;
-	int *virtual_physical_port_table;
-	int *phys_connections;
-} switch_t;
-
-typedef struct _lash {
-	osm_opensm_t *p_osm;
-	int num_switches;
-	uint8_t vl_min;
-	int balance_limit;
-	switch_t **switches;
-	cdg_vertex_t ****cdg_vertex_matrix;
-	int *num_mst_in_lane;
-	int ***virtual_location;
-} lash_t;
-
-static cdg_vertex_t *create_cdg_vertex(unsigned num_switches)
-{
-	cdg_vertex_t *cdg_vertex = (cdg_vertex_t *) malloc(sizeof(cdg_vertex_t));
-
-	cdg_vertex->dependency = malloc((num_switches - 1) * sizeof(cdg_vertex_t *));
-	cdg_vertex->num_using_this_depend = (int *)malloc((num_switches - 1) * sizeof(int));
-	return cdg_vertex;
-}
-
 static void connect_switches(lash_t * p_lash, int sw1, int sw2, int phy_port_1)
 {
 	osm_log_t *p_log = &p_lash->p_osm->log;
-	unsigned num = p_lash->switches[sw1]->num_connections;
+	unsigned num = p_lash->switches[sw1]->node->num_links;
+	switch_t *s1 = p_lash->switches[sw1];
+	mesh_node_t *node = s1->node;
+	switch_t *s2;
+	link_t *l;
+	unsigned int i;
 
-	p_lash->switches[sw1]->phys_connections[num] = sw2;
-	p_lash->switches[sw1]->virtual_physical_port_table[num] = phy_port_1;
-	p_lash->switches[sw1]->num_connections++;
+	/*
+	 * if doing mesh analysis:
+	 *  - do not consider connections to self
+	 *  - collapse multiple connections between
+	 *    pair of switches to a single locical link
+	 */
+	if (p_lash->p_osm->subn.opt.do_mesh_analysis) {
+		if (sw1 == sw2)
+			return;
+
+		/* see if we are already linked to sw2 */
+		for (i = 0; i < num; i++) {
+			l = node->links[i];
+
+			if (node->links[i]->switch_id == sw2) {
+				l->ports[l->num_ports++] = phy_port_1;
+				return;
+			}
+		}
+	}
 
-	OSM_LOG(p_log, OSM_LOG_VERBOSE,
-		"LASH connect: %d, %d, %d\n", sw1, sw2,
-		phy_port_1);
+	l = node->links[num];
+	l->switch_id = sw2;
+	l->link_id = -1;
+	l->ports[l->num_ports++] = phy_port_1;
+
+	s2 = p_lash->switches[sw2];
+	for (i = 0; i < s2->node->num_links; i++) {
+		if (s2->node->links[i]->switch_id == sw1) {
+			s2->node->links[i]->link_id = num;
+			l->link_id = i;
+			break;
+		}
+	}
+
+	node->num_links++;
 
+	OSM_LOG(p_log, OSM_LOG_VERBOSE,
+		"LASH connect: %d, %d, %d\n", sw1, sw2, phy_port_1);
 }
 
-static osm_switch_t *get_osm_switch_from_port(osm_port_t * port)
+static osm_switch_t *get_osm_switch_from_port(const osm_port_t * port)
 {
 	osm_physp_t *p = port->p_physp;
 	if (p->p_node->sw)
@@ -144,29 +126,14 @@ static osm_switch_t *get_osm_switch_from_port(osm_port_t * port)
 	return NULL;
 }
 
-#if 0
-static int randint(int high)
-{
-	int r;
-
-	if (high == 0)
-		return 0;
-	r = rand();
-	high++;
-	return (r % high);
-}
-#endif
-
 static int cycle_exists(cdg_vertex_t * start, cdg_vertex_t * current,
 			cdg_vertex_t * prev, int visit_num)
 {
-	cdg_vertex_t *h;
 	int i, new_visit_num;
 	int cycle_found = 0;
 
 	if (current != NULL && current->visiting_number > 0) {
 		if (visit_num > current->visiting_number && current->seen == 0) {
-			h = start;
 			cycle_found = 1;
 		}
 	} else {
@@ -185,12 +152,12 @@ static int cycle_exists(cdg_vertex_t * start, cdg_vertex_t * current,
 
 		new_visit_num = visit_num + 1;
 
-		for (i = 0; i < current->num_dependencies; i++) {
+		for (i = 0; i < current->num_deps; i++) {
 			cycle_found =
-			    cycle_exists(start, current->dependency[i], current,
+			    cycle_exists(start, current->deps[i].v, current,
 					 new_visit_num);
 			if (cycle_found == 1)
-				i = current->num_dependencies;
+				i = current->num_deps;
 		}
 
 		current->seen = 1;
@@ -201,6 +168,11 @@ static int cycle_exists(cdg_vertex_t * start, cdg_vertex_t * current,
 	return cycle_found;
 }
 
+static inline int get_next_switch(lash_t *p_lash, int sw, int link)
+{
+	return p_lash->switches[sw]->node->links[link]->switch_id;
+}
+
 static void remove_semipermanent_depend_for_sp(lash_t * p_lash, int sw,
 					       int dest_switch, int lane)
 {
@@ -209,10 +181,10 @@ static void remove_semipermanent_depend_for_sp(lash_t * p_lash, int sw,
 	int i_next_switch, output_link, i, next_link, i_next_next_switch,
 	    depend = 0;
 	cdg_vertex_t *v;
-	int found;
+	int __attribute__((unused)) found;
 
 	output_link = switches[sw]->routing_table[dest_switch].out_link;
-	i_next_switch = switches[sw]->phys_connections[output_link];
+	i_next_switch = get_next_switch(p_lash, sw, output_link);
 
 	while (sw != dest_switch) {
 		v = cdg_vertex_matrix[lane][sw][i_next_switch];
@@ -228,12 +200,11 @@ static void remove_semipermanent_depend_for_sp(lash_t * p_lash, int sw,
 			if (i_next_switch != dest_switch) {
 				next_link =
 				    switches[i_next_switch]->routing_table[dest_switch].out_link;
-				i_next_next_switch =
-				    switches[i_next_switch]->phys_connections[next_link];
+				i_next_next_switch = get_next_switch(p_lash, i_next_switch, next_link);
 				found = 0;
 
-				for (i = 0; i < v->num_dependencies; i++)
-					if (v->dependency[i] ==
+				for (i = 0; i < v->num_deps; i++)
+					if (v->deps[i].v ==
 					    cdg_vertex_matrix[lane][i_next_switch]
 					    [i_next_next_switch]) {
 						found = 1;
@@ -242,19 +213,17 @@ static void remove_semipermanent_depend_for_sp(lash_t * p_lash, int sw,
 
 				CL_ASSERT(found);
 
-				if (v->num_using_this_depend[depend] == 1) {
+				if (v->deps[depend].num_used == 1) {
 					for (i = depend;
-					     i < v->num_dependencies - 1; i++) {
-						v->dependency[i] =
-						    v->dependency[i + 1];
-						v->num_using_this_depend[i] =
-						    v->num_using_this_depend[i +
-									     1];
+					     i < v->num_deps - 1; i++) {
+						v->deps[i].v = v->deps[i + 1].v;
+						v->deps[i].num_used =
+						    v->deps[i + 1].num_used;
 					}
 
-					v->num_dependencies--;
+					v->num_deps--;
 				} else
-					v->num_using_this_depend[depend]--;
+					v->deps[depend].num_used--;
 			}
 		}
 
@@ -262,8 +231,7 @@ static void remove_semipermanent_depend_for_sp(lash_t * p_lash, int sw,
 		output_link = switches[sw]->routing_table[dest_switch].out_link;
 
 		if (sw != dest_switch)
-			i_next_switch =
-			    switches[sw]->phys_connections[output_link];
+			i_next_switch = get_next_switch(p_lash, sw, output_link);
 	}
 }
 
@@ -283,10 +251,10 @@ inline static void dequeue(cl_list_t * bfsq, switch_t ** sw)
 
 static int get_phys_connection(switch_t *sw, int switch_to)
 {
-	unsigned int i = 0;
+	unsigned int i;
 
-	for (i = 0; i < sw->num_connections; i++)
-		if (sw->phys_connections[i] == switch_to)
+	for (i = 0; i < sw->node->num_links; i++)
+		if (sw->node->links[i]->switch_id == switch_to)
 			return i;
 	return i;
 }
@@ -304,8 +272,8 @@ static void shortest_path(lash_t * p_lash, int ir)
 
 	while (!cl_is_list_empty(&bfsq)) {
 		dequeue(&bfsq, &sw);
-		for (i = 0; i < sw->num_connections; i++) {
-			swi = switches[sw->phys_connections[i]];
+		for (i = 0; i < sw->node->num_links; i++) {
+			swi = switches[sw->node->links[i]->switch_id];
 			if (swi->q_state == UNQUEUED) {
 				enqueue(&bfsq, swi);
 				sw->dij_channels[sw->used_channels++] = swi->id;
@@ -316,8 +284,8 @@ static void shortest_path(lash_t * p_lash, int ir)
 	cl_list_destroy(&bfsq);
 }
 
-static void generate_routing_func_for_mst(lash_t * p_lash, int sw_id,
-					  reachable_dest_t ** destinations)
+static int generate_routing_func_for_mst(lash_t * p_lash, int sw_id,
+					 reachable_dest_t ** destinations)
 {
 	int i, next_switch;
 	switch_t *sw = p_lash->switches[sw_id];
@@ -326,17 +294,17 @@ static void generate_routing_func_for_mst(lash_t * p_lash, int sw_id,
 
 	for (i = 0; i < num_channels; i++) {
 		next_switch = sw->dij_channels[i];
-		generate_routing_func_for_mst(p_lash, next_switch, &dest);
+		if (generate_routing_func_for_mst(p_lash, next_switch, &dest))
+			return -1;
 
 		i_dest = dest;
 		prev = i_dest;
 
 		while (i_dest != NULL) {
 			if (sw->routing_table[i_dest->switch_id].out_link ==
-			    NONE) {
+			    NONE)
 				sw->routing_table[i_dest->switch_id].out_link =
 				    get_phys_connection(sw, next_switch);
-			}
 
 			prev = i_dest;
 			i_dest = i_dest->next;
@@ -348,13 +316,16 @@ static void generate_routing_func_for_mst(lash_t * p_lash, int sw_id,
 	}
 
 	i_dest = (reachable_dest_t *) malloc(sizeof(reachable_dest_t));
+	if (!i_dest)
+		return -1;
 	i_dest->switch_id = sw->id;
 	i_dest->next = concat_dest;
 	*destinations = i_dest;
+	return 0;
 }
 
-static void generate_cdg_for_sp(lash_t * p_lash, int sw, int dest_switch,
-				int lane)
+static int generate_cdg_for_sp(lash_t * p_lash, int sw, int dest_switch,
+			       int lane)
 {
 	unsigned num_switches = p_lash->num_switches;
 	switch_t **switches = p_lash->switches;
@@ -363,29 +334,17 @@ static void generate_cdg_for_sp(lash_t * p_lash, int sw, int dest_switch,
 	cdg_vertex_t *v, *prev = NULL;
 
 	output_link = switches[sw]->routing_table[dest_switch].out_link;
-	next_switch = switches[sw]->phys_connections[output_link];
+	next_switch = get_next_switch(p_lash, sw, output_link);
 
 	while (sw != dest_switch) {
 
 		if (cdg_vertex_matrix[lane][sw][next_switch] == NULL) {
-			unsigned i;
-			v = create_cdg_vertex(num_switches);
-
-			for (i = 0; i < num_switches - 1; i++) {
-				v->dependency[i] = NULL;
-				v->num_using_this_depend[i] = 0;
-			}
-
-			v->num_using_vertex = 0;
-			v->num_dependencies = 0;
+			v = calloc(1, sizeof(*v) + (num_switches - 1) * sizeof(v->deps[0]));
+			if (!v)
+				return -1;
 			v->from = sw;
 			v->to = next_switch;
-			v->seen = 0;
-			v->visiting_number = 0;
-			v->next = NULL;
 			v->temp = 1;
-			v->num_temp_depend = 0;
-
 			cdg_vertex_matrix[lane][sw][next_switch] = v;
 		} else
 			v = cdg_vertex_matrix[lane][sw][next_switch];
@@ -395,18 +354,18 @@ static void generate_cdg_for_sp(lash_t * p_lash, int sw, int dest_switch,
 		if (prev != NULL) {
 			exists = 0;
 
-			for (j = 0; j < prev->num_dependencies; j++)
-				if (prev->dependency[j] == v) {
+			for (j = 0; j < prev->num_deps; j++)
+				if (prev->deps[j].v == v) {
 					exists = 1;
-					prev->num_using_this_depend[j]++;
+					prev->deps[j].num_used++;
 				}
 
 			if (exists == 0) {
-				prev->dependency[prev->num_dependencies] = v;
-				prev->num_using_this_depend[prev->num_dependencies]++;
-				prev->num_dependencies++;
+				prev->deps[prev->num_deps].v = v;
+				prev->deps[prev->num_deps].num_used++;
+				prev->num_deps++;
 
-				CL_ASSERT(prev->num_dependencies < (int)num_switches);
+				CL_ASSERT(prev->num_deps < (int)num_switches);
 
 				if (prev->temp == 0)
 					prev->num_temp_depend++;
@@ -419,11 +378,12 @@ static void generate_cdg_for_sp(lash_t * p_lash, int sw, int dest_switch,
 
 		if (sw != dest_switch) {
 			CL_ASSERT(output_link != NONE);
-			next_switch = switches[sw]->phys_connections[output_link];
+			next_switch = get_next_switch(p_lash, sw, output_link);
 		}
 
 		prev = v;
 	}
+	return 0;
 }
 
 static void set_temp_depend_to_permanent_for_sp(lash_t * p_lash, int sw,
@@ -435,7 +395,7 @@ static void set_temp_depend_to_permanent_for_sp(lash_t * p_lash, int sw,
 	cdg_vertex_t *v;
 
 	output_link = switches[sw]->routing_table[dest_switch].out_link;
-	next_switch = switches[sw]->phys_connections[output_link];
+	next_switch = get_next_switch(p_lash, sw, output_link);
 
 	while (sw != dest_switch) {
 		v = cdg_vertex_matrix[lane][sw][next_switch];
@@ -450,8 +410,7 @@ static void set_temp_depend_to_permanent_for_sp(lash_t * p_lash, int sw,
 		output_link = switches[sw]->routing_table[dest_switch].out_link;
 
 		if (sw != dest_switch)
-			next_switch =
-			    switches[sw]->phys_connections[output_link];
+			next_switch = get_next_switch(p_lash, sw, output_link);
 	}
 
 }
@@ -465,7 +424,7 @@ static void remove_temp_depend_for_sp(lash_t * p_lash, int sw, int dest_switch,
 	cdg_vertex_t *v;
 
 	output_link = switches[sw]->routing_table[dest_switch].out_link;
-	next_switch = switches[sw]->phys_connections[output_link];
+	next_switch = get_next_switch(p_lash, sw, output_link);
 
 	while (sw != dest_switch) {
 		v = cdg_vertex_matrix[lane][sw][next_switch];
@@ -475,34 +434,31 @@ static void remove_temp_depend_for_sp(lash_t * p_lash, int sw, int dest_switch,
 			cdg_vertex_matrix[lane][sw][next_switch] = NULL;
 			free(v);
 		} else {
-			CL_ASSERT(v->num_temp_depend <= v->num_dependencies);
-			v->num_dependencies =
-			    v->num_dependencies - v->num_temp_depend;
+			CL_ASSERT(v->num_temp_depend <= v->num_deps);
+			v->num_deps = v->num_deps - v->num_temp_depend;
 			v->num_temp_depend = 0;
 			v->num_using_vertex--;
 
-			for (i = v->num_dependencies;
-			     i < p_lash->num_switches - 1; i++)
-				v->num_using_this_depend[i] = 0;
+			for (i = v->num_deps; i < p_lash->num_switches - 1; i++)
+				v->deps[i].num_used = 0;
 		}
 
 		sw = next_switch;
 		output_link = switches[sw]->routing_table[dest_switch].out_link;
 
 		if (sw != dest_switch)
-			next_switch =
-			    switches[sw]->phys_connections[output_link];
+			next_switch = get_next_switch(p_lash, sw, output_link);
 
 	}
 }
 
-static void balance_virtual_lanes(lash_t * p_lash, unsigned lanes_needed)
+static int balance_virtual_lanes(lash_t * p_lash, unsigned lanes_needed)
 {
 	unsigned num_switches = p_lash->num_switches;
 	cdg_vertex_t ****cdg_vertex_matrix = p_lash->cdg_vertex_matrix;
 	int *num_mst_in_lane = p_lash->num_mst_in_lane;
 	int ***virtual_location = p_lash->virtual_location;
-	int min_filled_lane, max_filled_lane, medium_filled_lane, trials;
+	int min_filled_lane, max_filled_lane, trials;
 	int old_min_filled_lane, old_max_filled_lane, new_num_min_lane,
 	    new_num_max_lane;
 	unsigned int i, j;
@@ -510,13 +466,11 @@ static void balance_virtual_lanes(lash_t * p_lash, unsigned lanes_needed)
 	int next_switch2, output_link2;
 	int stop = 0, cycle_found;
 	int cycle_found2;
+	unsigned start_vl = p_lash->p_osm->subn.opt.lash_start_vl;
 
 	max_filled_lane = 0;
 	min_filled_lane = lanes_needed - 1;
 
-	if (max_filled_lane > 1)
-		medium_filled_lane = max_filled_lane - 1;
-
 	trials = num_mst_in_lane[max_filled_lane];
 	if (lanes_needed == 1)
 		stop = 1;
@@ -549,14 +503,15 @@ static void balance_virtual_lanes(lash_t * p_lash, unsigned lanes_needed)
 			}
 		}
 
-		generate_cdg_for_sp(p_lash, src, dest, min_filled_lane);
-		generate_cdg_for_sp(p_lash, dest, src, min_filled_lane);
+		if (generate_cdg_for_sp(p_lash, src, dest, min_filled_lane) ||
+		    generate_cdg_for_sp(p_lash, dest, src, min_filled_lane))
+			return -1;
 
 		output_link = p_lash->switches[src]->routing_table[dest].out_link;
-		next_switch = p_lash->switches[src]->phys_connections[output_link];
+		next_switch = get_next_switch(p_lash, src, output_link);
 
 		output_link2 = p_lash->switches[dest]->routing_table[src].out_link;
-		next_switch2 = p_lash->switches[dest]->phys_connections[output_link2];
+		next_switch2 = get_next_switch(p_lash, dest, output_link2);
 
 		CL_ASSERT(cdg_vertex_matrix[min_filled_lane][src][next_switch] != NULL);
 		CL_ASSERT(cdg_vertex_matrix[min_filled_lane][dest][next_switch2] != NULL);
@@ -599,8 +554,8 @@ static void balance_virtual_lanes(lash_t * p_lash, unsigned lanes_needed)
 			virtual_location[dest][src][max_filled_lane] = 0;
 			virtual_location[src][dest][min_filled_lane] = 1;
 			virtual_location[dest][src][min_filled_lane] = 1;
-			p_lash->switches[src]->routing_table[dest].lane = min_filled_lane;
-			p_lash->switches[dest]->routing_table[src].lane = min_filled_lane;
+			p_lash->switches[src]->routing_table[dest].lane = min_filled_lane + start_vl;
+			p_lash->switches[dest]->routing_table[src].lane = min_filled_lane + start_vl;
 		}
 
 		if (trials == 0)
@@ -646,6 +601,7 @@ static void balance_virtual_lanes(lash_t * p_lash, unsigned lanes_needed)
 						virtual_location[i][j][old_max_filled_lane] = 1;
 		}
 	}
+	return 0;
 }
 
 static switch_t *switch_create(lash_t * p_lash, unsigned id, osm_switch_t * p_sw)
@@ -655,11 +611,15 @@ static switch_t *switch_create(lash_t * p_lash, unsigned id, osm_switch_t * p_sw
 	switch_t *sw;
 	unsigned int i;
 
-	sw = malloc(sizeof(*sw));
+	sw = malloc(sizeof(*sw) + num_switches * sizeof(sw->routing_table[0]));
 	if (!sw)
 		return NULL;
 
 	memset(sw, 0, sizeof(*sw));
+	for (i = 0; i < num_switches; i++) {
+		sw->routing_table[i].out_link = NONE;
+		sw->routing_table[i].lane = NONE;
+	}
 
 	sw->id = id;
 	sw->dij_channels = malloc(num_ports * sizeof(int));
@@ -668,60 +628,36 @@ static switch_t *switch_create(lash_t * p_lash, unsigned id, osm_switch_t * p_sw
 		return NULL;
 	}
 
-	sw->virtual_physical_port_table = malloc(num_ports * sizeof(int));
-	if (!sw->virtual_physical_port_table) {
-		free(sw->dij_channels);
-		free(sw);
-		return NULL;
-	}
-
-	sw->phys_connections = malloc(num_ports * sizeof(int));
-	if (!sw->phys_connections) {
-		free(sw->virtual_physical_port_table);
-		free(sw->dij_channels);
-		free(sw);
-		return NULL;
-	}
+	sw->p_sw = p_sw;
+	p_sw->priv = sw;
 
-	sw->routing_table = malloc(num_switches * sizeof(sw->routing_table[0]));
-	if (!sw->routing_table) {
-		free(sw->phys_connections);
-		free(sw->virtual_physical_port_table);
+	if (osm_mesh_node_create(p_lash, sw)) {
 		free(sw->dij_channels);
 		free(sw);
 		return NULL;
 	}
 
-	for (i = 0; i < num_switches; i++) {
-		sw->routing_table[i].out_link = NONE;
-		sw->routing_table[i].lane = NONE;
-	}
-
-	for (i = 0; i < num_ports; i++) {
-		sw->virtual_physical_port_table[i] = -1;
-		sw->phys_connections[i] = NONE;
-	}
-
-	sw->p_sw = p_sw;
-	if (p_sw)
-		p_sw->priv = sw;
-
 	return sw;
 }
 
-static void switch_delete(switch_t * sw)
+static void switch_delete(lash_t *p_lash, switch_t * sw)
 {
 	if (sw->dij_channels)
 		free(sw->dij_channels);
-	if (sw->virtual_physical_port_table)
-		free(sw->virtual_physical_port_table);
-	if (sw->phys_connections)
-		free(sw->phys_connections);
-	if (sw->routing_table)
-		free(sw->routing_table);
 	free(sw);
 }
 
+static void delete_mesh_switches(lash_t *p_lash)
+{
+	if (p_lash->switches) {
+		unsigned id;
+		for (id = 0; ((int)id) < p_lash->num_switches; id++)
+			if (p_lash->switches[id])
+				osm_mesh_node_delete(p_lash,
+						     p_lash->switches[id]);
+	}
+}
+
 static void free_lash_structures(lash_t * p_lash)
 {
 	unsigned int i, j, k;
@@ -730,24 +666,14 @@ static void free_lash_structures(lash_t * p_lash)
 
 	OSM_LOG_ENTER(p_log);
 
-	// free cdg_vertex_matrix
+	delete_mesh_switches(p_lash);
+
+	/* free cdg_vertex_matrix */
 	for (i = 0; i < p_lash->vl_min; i++) {
 		for (j = 0; j < num_switches; j++) {
-			for (k = 0; k < num_switches; k++) {
-				if (p_lash->cdg_vertex_matrix[i][j][k]) {
-
-					if (p_lash->cdg_vertex_matrix[i][j][k]->dependency)
-						free(p_lash->cdg_vertex_matrix[i][j][k]->
-						     dependency);
-
-					if (p_lash->cdg_vertex_matrix[i][j][k]->
-					    num_using_this_depend)
-						free(p_lash->cdg_vertex_matrix[i][j][k]->
-						     num_using_this_depend);
-
+			for (k = 0; k < num_switches; k++)
+				if (p_lash->cdg_vertex_matrix[i][j][k])
 					free(p_lash->cdg_vertex_matrix[i][j][k]);
-				}
-			}
 			if (p_lash->cdg_vertex_matrix[i][j])
 				free(p_lash->cdg_vertex_matrix[i][j]);
 		}
@@ -758,7 +684,7 @@ static void free_lash_structures(lash_t * p_lash)
 	if (p_lash->cdg_vertex_matrix)
 		free(p_lash->cdg_vertex_matrix);
 
-	// free virtual_location
+	/* free virtual_location */
 	for (i = 0; i < num_switches; i++) {
 		for (j = 0; j < num_switches; j++) {
 			if (p_lash->virtual_location[i][j])
@@ -770,9 +696,6 @@ static void free_lash_structures(lash_t * p_lash)
 	if (p_lash->virtual_location)
 		free(p_lash->virtual_location);
 
-	if (p_lash->num_mst_in_lane)
-		free(p_lash->num_mst_in_lane);
-
 	OSM_LOG_EXIT(p_log);
 }
 
@@ -786,13 +709,15 @@ static int init_lash_structures(lash_t * p_lash)
 
 	OSM_LOG_ENTER(p_log);
 
-	// initialise cdg_vertex_matrix[num_switches][num_switches][num_switches]
+	/* initialise cdg_vertex_matrix[num_switches][num_switches][num_switches] */
 	p_lash->cdg_vertex_matrix =
-	    (cdg_vertex_t ****) malloc(vl_min * sizeof(cdg_vertex_t ****));
+	    (cdg_vertex_t ****) malloc(vl_min * sizeof(cdg_vertex_t ***));
+	if (p_lash->cdg_vertex_matrix == NULL)
+		goto Exit_Mem_Error;
 	for (i = 0; i < vl_min; i++) {
 		p_lash->cdg_vertex_matrix[i] =
 		    (cdg_vertex_t ***) malloc(num_switches *
-					      sizeof(cdg_vertex_t ***));
+					      sizeof(cdg_vertex_t **));
 
 		if (p_lash->cdg_vertex_matrix[i] == NULL)
 			goto Exit_Mem_Error;
@@ -802,18 +727,19 @@ static int init_lash_structures(lash_t * p_lash)
 		for (j = 0; j < num_switches; j++) {
 			p_lash->cdg_vertex_matrix[i][j] =
 			    (cdg_vertex_t **) malloc(num_switches *
-						     sizeof(cdg_vertex_t **));
+						     sizeof(cdg_vertex_t *));
 			if (p_lash->cdg_vertex_matrix[i][j] == NULL)
 				goto Exit_Mem_Error;
 
-			for (k = 0; k < num_switches; k++) {
+			for (k = 0; k < num_switches; k++)
 				p_lash->cdg_vertex_matrix[i][j][k] = NULL;
-			}
 		}
 	}
 
-	// initialise virtual_location[num_switches][num_switches][num_layers],
-	// default value = 0
+	/*
+	 * initialise virtual_location[num_switches][num_switches][num_layers],
+	 * default value = 0
+	 */
 	p_lash->virtual_location =
 	    (int ***)malloc(num_switches * sizeof(int ***));
 	if (p_lash->virtual_location == NULL)
@@ -832,18 +758,14 @@ static int init_lash_structures(lash_t * p_lash)
 			    (int *)malloc(vl_min * sizeof(int *));
 			if (p_lash->virtual_location[i][j] == NULL)
 				goto Exit_Mem_Error;
-			for (k = 0; k < vl_min; k++) {
+			for (k = 0; k < vl_min; k++)
 				p_lash->virtual_location[i][j][k] = 0;
-			}
 		}
 	}
 
-	// initialise num_mst_in_lane[num_switches], default 0
-	p_lash->num_mst_in_lane = (int *)malloc(num_switches * sizeof(int));
-	if (p_lash->num_mst_in_lane == NULL)
-		goto Exit_Mem_Error;
+	/* initialise num_mst_in_lane[num_switches], default 0 */
 	memset(p_lash->num_mst_in_lane, 0,
-	       num_switches * sizeof(p_lash->num_mst_in_lane[0]));
+	       IB_MAX_NUM_VLS * sizeof(p_lash->num_mst_in_lane[0]));
 
 	goto Exit;
 
@@ -871,15 +793,25 @@ static int lash_core(lash_t * p_lash)
 	int stop = 0, output_link, i_next_switch;
 	int output_link2, i_next_switch2;
 	int cycle_found2 = 0;
-	int status = 0;
-	int *switch_bitmap;	/* Bitmap to check if we have processed this pair */
+	int status = -1;
+	int *switch_bitmap = NULL;	/* Bitmap to check if we have processed this pair */
+	unsigned start_vl = p_lash->p_osm->subn.opt.lash_start_vl;
 
 	OSM_LOG_ENTER(p_log);
 
+	if (p_lash->p_osm->subn.opt.do_mesh_analysis && osm_do_mesh_analysis(p_lash)) {
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4D05: Mesh analysis failed\n");
+		goto Exit;
+	}
+
 	for (i = 0; i < num_switches; i++) {
 
 		shortest_path(p_lash, i);
-		generate_routing_func_for_mst(p_lash, i, &dests);
+		if (generate_routing_func_for_mst(p_lash, i, &dests)) {
+			OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4D06: "
+				"generate_routing_func_for_mst failed\n");
+			goto Exit;
+		}
 
 		idest = dests;
 		while (idest != NULL) {
@@ -894,13 +826,12 @@ static int lash_core(lash_t * p_lash)
 		}
 	}
 
-	switch_bitmap = malloc(num_switches * num_switches * sizeof(int));
+	switch_bitmap = calloc(num_switches * num_switches, sizeof(int));
 	if (!switch_bitmap) {
 		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4D04: "
 			"Failed allocating switch_bitmap - out of memory\n");
 		goto Exit;
 	}
-	memset(switch_bitmap, 0, num_switches * num_switches * sizeof(int));
 
 	for (i = 0; i < num_switches; i++) {
 		for (dest_switch = 0; dest_switch < num_switches; dest_switch++)
@@ -908,17 +839,20 @@ static int lash_core(lash_t * p_lash)
 				v_lane = 0;
 				stop = 0;
 				while (v_lane < lanes_needed && stop == 0) {
-					generate_cdg_for_sp(p_lash, i, dest_switch, v_lane);
-					generate_cdg_for_sp(p_lash, dest_switch, i, v_lane);
+					if (generate_cdg_for_sp(p_lash, i, dest_switch, v_lane) ||
+					    generate_cdg_for_sp(p_lash, dest_switch, i, v_lane)) {
+						OSM_LOG(p_log, OSM_LOG_ERROR,
+							"ERR 4D07: generate_cdg_for_sp failed\n");
+						goto Exit;
+					}
 
 					output_link =
 					    switches[i]->routing_table[dest_switch].out_link;
 					output_link2 =
 					    switches[dest_switch]->routing_table[i].out_link;
 
-					i_next_switch = switches[i]->phys_connections[output_link];
-					i_next_switch2 =
-					    switches[dest_switch]->phys_connections[output_link2];
+					i_next_switch = get_next_switch(p_lash, i, output_link);
+					i_next_switch2 = get_next_switch(p_lash, dest_switch, output_link2);
 
 					CL_ASSERT(p_lash->
 						  cdg_vertex_matrix[v_lane][i][i_next_switch] !=
@@ -968,15 +902,19 @@ static int lash_core(lash_t * p_lash)
 					}
 				}
 
-				switches[i]->routing_table[dest_switch].lane = v_lane;
-				switches[dest_switch]->routing_table[i].lane = v_lane;
+				switches[i]->routing_table[dest_switch].lane = v_lane + start_vl;
+				switches[dest_switch]->routing_table[i].lane = v_lane + start_vl;
 
 				if (cycle_found == 1 || cycle_found2 == 1) {
 					if (++lanes_needed > p_lash->vl_min)
 						goto Error_Not_Enough_Lanes;
 
-					generate_cdg_for_sp(p_lash, i, dest_switch, v_lane);
-					generate_cdg_for_sp(p_lash, dest_switch, i, v_lane);
+					if (generate_cdg_for_sp(p_lash, i, dest_switch, v_lane) ||
+					    generate_cdg_for_sp(p_lash, dest_switch, i, v_lane)) {
+						OSM_LOG(p_log, OSM_LOG_ERROR,
+							"ERR 4D08: generate_cdg_for_sp failed\n");
+						goto Exit;
+					}
 
 					set_temp_depend_to_permanent_for_sp(p_lash, i, dest_switch,
 									    v_lane);
@@ -994,28 +932,30 @@ static int lash_core(lash_t * p_lash)
 			}
 	}
 
+	for (i = 0; i < lanes_needed; i++)
+		OSM_LOG(p_log, OSM_LOG_INFO, "Lanes in layer %d: %d\n",
+			i, p_lash->num_mst_in_lane[i]);
+
 	OSM_LOG(p_log, OSM_LOG_INFO,
 		"Lanes needed: %d, Balancing\n", lanes_needed);
 
-	for (i = 0; i < lanes_needed; i++) {
-		OSM_LOG(p_log, OSM_LOG_INFO, "Lanes in layer %d: %d\n",
-			i, p_lash->num_mst_in_lane[i]);
+	if (balance_virtual_lanes(p_lash, lanes_needed)) {
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4D09: Balancing failed\n");
+		goto Exit;
 	}
 
-	balance_virtual_lanes(p_lash, lanes_needed);
-
-	for (i = 0; i < lanes_needed; i++) {
+	for (i = 0; i < lanes_needed; i++)
 		OSM_LOG(p_log, OSM_LOG_INFO, "Lanes in layer %d: %d\n",
 			i, p_lash->num_mst_in_lane[i]);
-	}
 
+	status = 0;
 	goto Exit;
 
 Error_Not_Enough_Lanes:
-	status = -1;
 	OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4D02: "
-		"Lane requirements (%d) exceed available lanes (%d)\n",
-		p_lash->vl_min, lanes_needed);
+		"Lane requirements (%d) exceed available lanes (%d)"
+		" with starting lane (%d)\n",
+		lanes_needed, p_lash->vl_min, start_vl);
 Exit:
 	if (switch_bitmap)
 		free(switch_bitmap);
@@ -1028,11 +968,25 @@ static unsigned get_lash_id(osm_switch_t * p_sw)
 	return ((switch_t *) p_sw->priv)->id;
 }
 
+static int get_next_port(switch_t *sw, int link)
+{
+	link_t *l = sw->node->links[link];
+	int port = l->next_port++;
+
+	/*
+	 * note if not doing mesh analysis
+	 * then num_ports is always 1
+	 */
+	if (l->next_port >= l->num_ports)
+		l->next_port = 0;
+
+	return l->ports[port];
+}
+
 static void populate_fwd_tbls(lash_t * p_lash)
 {
 	osm_log_t *p_log = &p_lash->p_osm->log;
 	osm_subn_t *p_subn = &p_lash->p_osm->subn;
-	osm_opensm_t *p_osm = p_lash->p_osm;
 	osm_switch_t *p_sw, *p_next_sw, *p_dst_sw;
 	osm_port_t *port;
 	uint16_t max_lid_ho, lid;
@@ -1041,7 +995,7 @@ static void populate_fwd_tbls(lash_t * p_lash)
 
 	p_next_sw = (osm_switch_t *) cl_qmap_head(&p_subn->sw_guid_tbl);
 
-	// Go through each swtich individually
+	/* Go through each switch individually */
 	while (p_next_sw != (osm_switch_t *) cl_qmap_end(&p_subn->sw_guid_tbl)) {
 		uint64_t current_guid;
 		switch_t *sw;
@@ -1052,10 +1006,10 @@ static void populate_fwd_tbls(lash_t * p_lash)
 		current_guid = p_sw->p_node->node_info.port_guid;
 		sw = p_sw->priv;
 
-		memset(p_sw->new_lft, OSM_NO_PATH, IB_LID_UCAST_END_HO + 1);
+		memset(p_sw->new_lft, OSM_NO_PATH, p_sw->lft_size);
 
 		for (lid = 1; lid <= max_lid_ho; lid++) {
-			port = cl_ptr_vector_get(&p_subn->port_lid_tbl, lid);
+			port = osm_get_port_by_lid_ho(p_subn, lid);
 			if (!port)
 				continue;
 
@@ -1079,9 +1033,7 @@ static void populate_fwd_tbls(lash_t * p_lash)
 				    (uint8_t) sw->
 				    routing_table[dst_lash_switch_id].out_link;
 				uint8_t physical_egress_port =
-				    (uint8_t) sw->
-				    virtual_physical_port_table
-				    [lash_egress_port];
+					get_next_port(sw, lash_egress_port);
 
 				p_sw->new_lft[lid] = physical_egress_port;
 				OSM_LOG(p_log, OSM_LOG_VERBOSE,
@@ -1097,8 +1049,7 @@ static void populate_fwd_tbls(lash_t * p_lash)
 					dst_lash_switch_id,
 					physical_egress_port);
 			}
-		}		// for
-		osm_ucast_mgr_set_fwd_table(&p_osm->sm.ucast_mgr, p_sw);
+		}		/* for */
 	}
 	OSM_LOG_EXIT(p_log);
 }
@@ -1115,7 +1066,7 @@ static void osm_lash_process_switch(lash_t * p_lash, osm_switch_t * p_sw)
 	switch_a_lash_id = get_lash_id(p_sw);
 	port_count = osm_node_get_num_physp(p_sw->p_node);
 
-	// starting at port 1, ignoring management port on switch
+	/* starting at port 1, ignoring management port on switch */
 	for (i = 1; i < port_count; i++) {
 
 		p_current_physp = osm_node_get_physp_ptr(p_sw->p_node, i);
@@ -1166,7 +1117,7 @@ static void lash_cleanup(lash_t * p_lash)
 		unsigned id;
 		for (id = 0; ((int)id) < p_lash->num_switches; id++)
 			if (p_lash->switches[id])
-				switch_delete(p_lash->switches[id]);
+				switch_delete(p_lash, p_lash->switches[id]);
 		free(p_lash->switches);
 	}
 	p_lash->switches = NULL;
@@ -1181,7 +1132,7 @@ static void lash_cleanup(lash_t * p_lash)
 
 static int discover_network_properties(lash_t * p_lash)
 {
-	int i = 0, id = 0;
+	int i, id = 0;
 	uint8_t vl_min;
 	osm_subn_t *p_subn = &p_lash->p_osm->subn;
 	osm_switch_t *p_next_sw, *p_sw;
@@ -1189,12 +1140,11 @@ static int discover_network_properties(lash_t * p_lash)
 
 	p_lash->num_switches = cl_qmap_count(&p_subn->sw_guid_tbl);
 
-	p_lash->switches = malloc(p_lash->num_switches * sizeof(switch_t *));
+	p_lash->switches = calloc(p_lash->num_switches, sizeof(switch_t *));
 	if (!p_lash->switches)
 		return -1;
-	memset(p_lash->switches, 0, p_lash->num_switches * sizeof(switch_t *));
 
-	vl_min = 5;		// set to a high value
+	vl_min = 5;		/* set to a high value */
 
 	p_next_sw = (osm_switch_t *) cl_qmap_head(&p_subn->sw_guid_tbl);
 	while (p_next_sw != (osm_switch_t *) cl_qmap_end(&p_subn->sw_guid_tbl)) {
@@ -1209,7 +1159,7 @@ static int discover_network_properties(lash_t * p_lash)
 
 		port_count = osm_node_get_num_physp(p_sw->p_node);
 
-		// Note, ignoring port 0. management port
+		/* Note, ignoring port 0. management port */
 		for (i = 1; i < port_count; i++) {
 			osm_physp_t *p_current_physp =
 			    osm_node_get_physp_ptr(p_sw->p_node, i);
@@ -1224,17 +1174,25 @@ static int discover_network_properties(lash_t * p_lash)
 				if (port_vl_min && port_vl_min < vl_min)
 					vl_min = port_vl_min;
 			}
-		}		// for
-	}			// while
+		}		/* for */
+	}			/* while */
 
 	vl_min = 1 << (vl_min - 1);
 	if (vl_min > 15)
 		vl_min = 15;
 
-	p_lash->vl_min = vl_min;
+	if (p_lash->p_osm->subn.opt.lash_start_vl >= vl_min) {
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4D03: "
+			"Start VL(%d) too high for min operational vl(%d)\n",
+			p_lash->p_osm->subn.opt.lash_start_vl, vl_min);
+		return -1;
+	}
+
+	p_lash->vl_min = vl_min - p_lash->p_osm->subn.opt.lash_start_vl;
 
 	OSM_LOG(p_log, OSM_LOG_INFO,
-		"min operational vl(%d) max_switches(%d)\n", p_lash->vl_min,
+		"min operational vl(%d) start vl(%d) max_switches(%d)\n",
+		p_lash->vl_min, p_lash->p_osm->subn.opt.lash_start_vl,
 		p_lash->num_switches);
 	return 0;
 }
@@ -1244,7 +1202,7 @@ static void process_switches(lash_t * p_lash)
 	osm_switch_t *p_sw, *p_next_sw;
 	osm_subn_t *p_subn = &p_lash->p_osm->subn;
 
-	/* Go through each swithc and process it. i.e build the connection
+	/* Go through each switch and process it. i.e build the connection
 	   structure required by LASH */
 	p_next_sw = (osm_switch_t *) cl_qmap_head(&p_subn->sw_guid_tbl);
 	while (p_next_sw != (osm_switch_t *) cl_qmap_end(&p_subn->sw_guid_tbl)) {
@@ -1259,71 +1217,88 @@ static int lash_process(void *context)
 {
 	lash_t *p_lash = context;
 	osm_log_t *p_log = &p_lash->p_osm->log;
-	int return_status = IB_SUCCESS;
+	int status = 0;
 
 	OSM_LOG_ENTER(p_log);
 
 	p_lash->balance_limit = 6;
 
-	// everything starts here
+	/* everything starts here */
 	lash_cleanup(p_lash);
 
-	discover_network_properties(p_lash);
+	status = discover_network_properties(p_lash);
+	if (status)
+		goto Exit;
 
-	return_status = init_lash_structures(p_lash);
-	if (return_status != IB_SUCCESS)
+	status = init_lash_structures(p_lash);
+	if (status)
 		goto Exit;
 
 	process_switches(p_lash);
 
-	return_status = lash_core(p_lash);
-	if (return_status != IB_SUCCESS)
+	status = lash_core(p_lash);
+	if (status)
 		goto Exit;
 
 	populate_fwd_tbls(p_lash);
 
 Exit:
-	free_lash_structures(p_lash);
+	if (p_lash->vl_min)
+		free_lash_structures(p_lash);
 	OSM_LOG_EXIT(p_log);
 
-	return return_status;
+	return status;
 }
 
 static lash_t *lash_create(osm_opensm_t * p_osm)
 {
 	lash_t *p_lash;
 
-	p_lash = malloc(sizeof(lash_t));
+	p_lash = calloc(1, sizeof(lash_t));
 	if (!p_lash)
 		return NULL;
 
-	memset(p_lash, 0, sizeof(lash_t));
 	p_lash->p_osm = p_osm;
 
-	return (p_lash);
+	return p_lash;
 }
 
 static void lash_delete(void *context)
 {
 	lash_t *p_lash = context;
+
 	if (p_lash->switches) {
 		unsigned id;
 		for (id = 0; ((int)id) < p_lash->num_switches; id++)
 			if (p_lash->switches[id])
-				switch_delete(p_lash->switches[id]);
+				switch_delete(p_lash, p_lash->switches[id]);
 		free(p_lash->switches);
 	}
+
 	free(p_lash);
 }
 
-uint8_t osm_get_lash_sl(osm_opensm_t * p_osm, osm_port_t * p_src_port,
-			osm_port_t * p_dst_port)
+static uint8_t get_lash_sl(void *context, uint8_t path_sl_hint,
+			   const ib_net16_t slid, const ib_net16_t dlid)
 {
 	unsigned dst_id;
 	unsigned src_id;
+	osm_port_t *p_src_port, *p_dst_port;
 	osm_switch_t *p_sw;
+	lash_t *p_lash = context;
+	osm_opensm_t *p_osm = p_lash->p_osm;
+
+
+	if (!(p_osm->routing_engine_used &&
+	      p_osm->routing_engine_used->type == OSM_ROUTING_ENGINE_TYPE_LASH))
+		return OSM_DEFAULT_SL;
 
-	if (p_osm->routing_engine_used != OSM_ROUTING_ENGINE_TYPE_LASH)
+	p_src_port = osm_get_port_by_lid(&p_osm->subn, slid);
+	if (!p_src_port)
+		return OSM_DEFAULT_SL;
+
+	p_dst_port = osm_get_port_by_lid(&p_osm->subn, dlid);
+	if (!p_dst_port)
 		return OSM_DEFAULT_SL;
 
 	p_sw = get_osm_switch_from_port(p_dst_port);
@@ -1337,7 +1312,7 @@ uint8_t osm_get_lash_sl(osm_opensm_t * p_osm, osm_port_t * p_src_port,
 
 	src_id = get_lash_id(p_sw);
 	if (src_id == dst_id)
-		return OSM_DEFAULT_SL;
+		return p_osm->subn.opt.lash_start_vl;
 
 	return (uint8_t) ((switch_t *) p_sw->priv)->routing_table[dst_id].lane;
 }
@@ -1350,7 +1325,8 @@ int osm_ucast_lash_setup(struct osm_routing_engine *r, osm_opensm_t *p_osm)
 
 	r->context = p_lash;
 	r->ucast_build_fwd_tables = lash_process;
-	r->delete = lash_delete;
+	r->path_sl = get_lash_sl;
+	r->destroy = lash_delete;
 
 	return 0;
 }
diff --git a/opensm/osm_ucast_mgr.c b/opensm/osm_ucast_mgr.c
index 371c99a..b4cf0f2 100644
--- a/opensm/osm_ucast_mgr.c
+++ b/opensm/osm_ucast_mgr.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -46,10 +46,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_UCAST_MGR_C
 #include <opensm/osm_ucast_mgr.h>
 #include <opensm/osm_sm.h>
 #include <opensm/osm_log.h>
@@ -59,16 +62,12 @@
 #include <opensm/osm_msgdef.h>
 #include <opensm/osm_opensm.h>
 
-/**********************************************************************
- **********************************************************************/
-void osm_ucast_mgr_construct(IN osm_ucast_mgr_t * const p_mgr)
+void osm_ucast_mgr_construct(IN osm_ucast_mgr_t * p_mgr)
 {
 	memset(p_mgr, 0, sizeof(*p_mgr));
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * const p_mgr)
+void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * p_mgr)
 {
 	CL_ASSERT(p_mgr);
 
@@ -80,10 +79,7 @@ void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * const p_mgr)
 	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_ucast_mgr_init(IN osm_ucast_mgr_t * const p_mgr, IN osm_sm_t * sm)
+ib_api_status_t osm_ucast_mgr_init(IN osm_ucast_mgr_t * p_mgr, IN osm_sm_t * sm)
 {
 	ib_api_status_t status = IB_SUCCESS;
 
@@ -100,52 +96,48 @@ osm_ucast_mgr_init(IN osm_ucast_mgr_t * const p_mgr, IN osm_sm_t * sm)
 		cl_qmap_init(&p_mgr->cache_sw_tbl);
 
 	OSM_LOG_EXIT(p_mgr->p_log);
-	return (status);
+	return status;
 }
 
 /**********************************************************************
  Add each switch's own and neighbor LIDs to its LID matrix
 **********************************************************************/
-static void
-__osm_ucast_mgr_process_hop_0_1(IN cl_map_item_t * const p_map_item,
-				IN void *context)
+static void ucast_mgr_process_hop_0_1(IN cl_map_item_t * p_map_item,
+				      IN void *context)
 {
-	osm_switch_t *const p_sw = (osm_switch_t *) p_map_item;
+	osm_switch_t * p_sw = (osm_switch_t *) p_map_item;
 	osm_node_t *p_remote_node;
 	uint16_t lid, remote_lid;
-	uint8_t i, remote_port;
+	uint8_t i;
 
-	lid = osm_node_get_base_lid(p_sw->p_node, 0);
-	lid = cl_ntoh16(lid);
+	lid = cl_ntoh16(osm_node_get_base_lid(p_sw->p_node, 0));
 	osm_switch_set_hops(p_sw, lid, 0, 0);
 
 	for (i = 1; i < p_sw->num_ports; i++) {
-		p_remote_node =
-		    osm_node_get_remote_node(p_sw->p_node, i, &remote_port);
+		osm_physp_t *p = osm_node_get_physp_ptr(p_sw->p_node, i);
+		p_remote_node = (p && p->p_remote_physp) ?
+		    p->p_remote_physp->p_node : NULL;
 
 		if (p_remote_node && p_remote_node->sw &&
-		    (p_remote_node != p_sw->p_node)) {
+		    p_remote_node != p_sw->p_node) {
 			remote_lid = osm_node_get_base_lid(p_remote_node, 0);
 			remote_lid = cl_ntoh16(remote_lid);
-			osm_switch_set_hops(p_sw, remote_lid, i, 1);
-			osm_switch_set_hops(p_remote_node->sw, lid, remote_port,
-					    1);
+			osm_switch_set_hops(p_sw, remote_lid, i, p->hop_wf);
 		}
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_ucast_mgr_process_neighbor(IN osm_ucast_mgr_t * const p_mgr,
-				 IN osm_switch_t * const p_this_sw,
-				 IN osm_switch_t * const p_remote_sw,
-				 IN const uint8_t port_num,
-				 IN const uint8_t remote_port_num)
-{
-	osm_switch_t *p_sw, *p_next_sw;
+static void ucast_mgr_process_neighbor(IN osm_ucast_mgr_t * p_mgr,
+				       IN osm_switch_t * p_this_sw,
+				       IN osm_switch_t * p_remote_sw,
+				       IN uint8_t port_num,
+				       IN uint8_t remote_port_num)
+{
+	osm_switch_t *p_sw;
+	cl_map_item_t *item;
 	uint16_t lid_ho;
 	uint8_t hops;
+	osm_physp_t *p;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 
@@ -156,22 +148,22 @@ __osm_ucast_mgr_process_neighbor(IN osm_ucast_mgr_t * const p_mgr,
 		cl_ntoh64(osm_node_get_node_guid(p_remote_sw->p_node)),
 		port_num, remote_port_num);
 
-	p_next_sw = (osm_switch_t *) cl_qmap_head(&p_mgr->p_subn->sw_guid_tbl);
-	while (p_next_sw !=
-	       (osm_switch_t *) cl_qmap_end(&p_mgr->p_subn->sw_guid_tbl)) {
-		p_sw = p_next_sw;
-		p_next_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
-		lid_ho = osm_node_get_base_lid(p_sw->p_node, 0);
-		lid_ho = cl_ntoh16(lid_ho);
+	p = osm_node_get_physp_ptr(p_this_sw->p_node, port_num);
+
+	for (item = cl_qmap_head(&p_mgr->p_subn->sw_guid_tbl);
+	     item != cl_qmap_end(&p_mgr->p_subn->sw_guid_tbl);
+	     item = cl_qmap_next(item)) {
+		p_sw = (osm_switch_t *) item;
+		lid_ho = cl_ntoh16(osm_node_get_base_lid(p_sw->p_node, 0));
 		hops = osm_switch_get_least_hops(p_remote_sw, lid_ho);
 		if (hops == OSM_NO_PATH)
 			continue;
-		hops++;
+		hops += p->hop_wf;
 		if (hops <
 		    osm_switch_get_hop_count(p_this_sw, lid_ho, port_num)) {
 			if (osm_switch_set_hops
 			    (p_this_sw, lid_ho, port_num, hops) != 0)
-				OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+				OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A03: "
 					"cannot set hops for lid %u at switch 0x%"
 					PRIx64 "\n", lid_ho,
 					cl_ntoh64(osm_node_get_node_guid
@@ -183,31 +175,33 @@ __osm_ucast_mgr_process_neighbor(IN osm_ucast_mgr_t * const p_mgr,
 	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static struct osm_remote_node *
-find_and_add_remote_sys(osm_switch_t *sw, uint8_t port,
-			struct osm_remote_guids_count *r)
+static struct osm_remote_node *find_and_add_remote_sys(osm_switch_t * sw,
+						       uint8_t port,
+						       boolean_t dor, struct
+						       osm_remote_guids_count
+						       *r)
 {
 	unsigned i;
 	osm_physp_t *p = osm_node_get_physp_ptr(sw->p_node, port);
 	osm_node_t *node = p->p_remote_physp->p_node;
+	uint8_t rem_port = osm_physp_get_port_num(p->p_remote_physp);
 
 	for (i = 0; i < r->count; i++)
 		if (r->guids[i].node == node)
-			return &r->guids[i];
+			if (!dor || (r->guids[i].port == rem_port))
+				return &r->guids[i];
 
 	r->guids[i].node = node;
 	r->guids[i].forwarded_to = 0;
+	r->guids[i].port = rem_port;
 	r->count++;
 	return &r->guids[i];
 }
 
-static void
-__osm_ucast_mgr_process_port(IN osm_ucast_mgr_t * const p_mgr,
-			     IN osm_switch_t * const p_sw,
-			     IN osm_port_t * const p_port,
-			     IN unsigned lid_offset)
+static void ucast_mgr_process_port(IN osm_ucast_mgr_t * p_mgr,
+				   IN osm_switch_t * p_sw,
+				   IN osm_port_t * p_port,
+				   IN unsigned lid_offset)
 {
 	uint16_t min_lid_ho;
 	uint16_t max_lid_ho;
@@ -225,9 +219,11 @@ __osm_ucast_mgr_process_port(IN osm_ucast_mgr_t * const p_mgr,
 	 * the initialization. Don't handle this port. */
 	if (min_lid_ho == 0 || max_lid_ho == 0) {
 		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A04: "
-			"Port 0x%" PRIx64 " has LID 0. An initialization "
-			"error occurred. Ignoring port\n",
-			cl_ntoh64(osm_port_get_guid(p_port)));
+			"Port 0x%"PRIx64" (%s port %d) has LID 0. An "
+			"initialization error occurred. Ignoring port\n",
+			cl_ntoh64(osm_port_get_guid(p_port)),
+			p_port->p_node->print_desc,
+			p_port->p_physp->port_num);
 		goto Exit;
 	}
 
@@ -236,15 +232,16 @@ __osm_ucast_mgr_process_port(IN osm_ucast_mgr_t * const p_mgr,
 	if (lid_ho > max_lid_ho)
 		goto Exit;
 
-	if (lid_offset)
+	if (lid_offset && !p_mgr->is_dor)
 		/* ignore potential overflow - it is handled in osm_switch.c */
 		start_from = osm_switch_get_port_by_lid(p_sw, lid_ho - 1) + 1;
 
 	OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
-		"Processing port 0x%" PRIx64 " (\'%s\' port %u), LID %u [%u,%u]\n",
+		"Processing port 0x%" PRIx64
+		" (\'%s\' port %u), LID %u [%u,%u]\n",
 		cl_ntoh64(osm_port_get_guid(p_port)),
-		p_port->p_node->print_desc, p_port->p_physp->port_num,
-		lid_ho, min_lid_ho, max_lid_ho);
+		p_port->p_node->print_desc, p_port->p_physp->port_num, lid_ho,
+		min_lid_ho, max_lid_ho);
 
 	/* TODO - This should be runtime error, not a CL_ASSERT() */
 	CL_ASSERT(max_lid_ho <= IB_LID_UCAST_END_HO);
@@ -259,7 +256,10 @@ __osm_ucast_mgr_process_port(IN osm_ucast_mgr_t * const p_mgr,
 	 */
 	port = osm_switch_recommend_path(p_sw, p_port, lid_ho, start_from,
 					 p_mgr->p_subn->ignore_existing_lfts,
-					 p_mgr->is_dor);
+					 p_mgr->p_subn->opt.lmc,
+					 p_mgr->is_dor,
+					 p_mgr->p_subn->opt.port_shifting,
+					 p_mgr->p_subn->opt.scatter_ports);
 
 	if (port == OSM_NO_PATH) {
 		/* do not try to overwrite the ppro of non existing port ... */
@@ -272,8 +272,7 @@ __osm_ucast_mgr_process_port(IN osm_ucast_mgr_t * const p_mgr,
 		osm_physp_t *p = osm_node_get_physp_ptr(p_sw->p_node, port);
 
 		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
-			"Routing LID %u to port %u"
-			" for switch 0x%" PRIx64 "\n",
+			"Routing LID %u to port %u for switch 0x%" PRIx64 "\n",
 			lid_ho, port, cl_ntoh64(node_guid));
 
 		/*
@@ -302,6 +301,7 @@ __osm_ucast_mgr_process_port(IN osm_ucast_mgr_t * const p_mgr,
 		osm_switch_count_path(p_sw, port);
 		if (port > 0 && p_port->priv &&
 		    (rem_node_used = find_and_add_remote_sys(p_sw, port,
+							     p_mgr->is_dor,
 							     p_port->priv)))
 			rem_node_used->forwarded_to++;
 	}
@@ -310,126 +310,7 @@ Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-int osm_ucast_mgr_set_fwd_table(IN osm_ucast_mgr_t * const p_mgr,
-				IN osm_switch_t * const p_sw)
-{
-	osm_node_t *p_node;
-	osm_dr_path_t *p_path;
-	osm_madw_context_t context;
-	ib_api_status_t status;
-	ib_switch_info_t si;
-	uint16_t block_id_ho = 0;
-	uint8_t block[IB_SMP_DATA_SIZE];
-	boolean_t set_swinfo_require = FALSE;
-	uint16_t lin_top;
-	uint8_t life_state;
-
-	CL_ASSERT(p_mgr);
-
-	OSM_LOG_ENTER(p_mgr->p_log);
-
-	CL_ASSERT(p_sw);
-
-	p_node = p_sw->p_node;
-
-	CL_ASSERT(p_node);
-
-	p_path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));
-
-	/*
-	   Set the top of the unicast forwarding table.
-	 */
-	si = p_sw->switch_info;
-	lin_top = cl_hton16(p_sw->max_lid_ho);
-	if (lin_top != si.lin_top) {
-		set_swinfo_require = TRUE;
-		si.lin_top = lin_top;
-	}
-
-	/* check to see if the change state bit is on. If it is - then we
-	   need to clear it. */
-	if (ib_switch_info_get_state_change(&si))
-		life_state = ((p_mgr->p_subn->opt.packet_life_time << 3)
-			      | (si.life_state & IB_SWITCH_PSC)) & 0xfc;
-	else
-		life_state = (p_mgr->p_subn->opt.packet_life_time << 3) & 0xf8;
-
-	if ((life_state != si.life_state)
-	    || ib_switch_info_get_state_change(&si)) {
-		set_swinfo_require = TRUE;
-		si.life_state = life_state;
-	}
-
-	if (set_swinfo_require) {
-		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
-			"Setting switch FT top to LID %u\n", p_sw->max_lid_ho);
-
-		context.si_context.light_sweep = FALSE;
-		context.si_context.node_guid = osm_node_get_node_guid(p_node);
-		context.si_context.set_method = TRUE;
-
-		status = osm_req_set(p_mgr->sm, p_path, (uint8_t *) & si,
-				     sizeof(si),
-				     IB_MAD_ATTR_SWITCH_INFO,
-				     0, CL_DISP_MSGID_NONE, &context);
-
-		if (status != IB_SUCCESS)
-			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A06: "
-				"Sending SwitchInfo attribute failed (%s)\n",
-				ib_get_err_str(status));
-	}
-
-	/*
-	   Send linear forwarding table blocks to the switch
-	   as long as the switch indicates it has blocks needing
-	   configuration.
-	 */
-
-	context.lft_context.node_guid = osm_node_get_node_guid(p_node);
-	context.lft_context.set_method = TRUE;
-
-	if (!p_sw->new_lft) {
-		/* any routing should provide the new_lft */
-		CL_ASSERT(p_mgr->p_subn->opt.use_ucast_cache &&
-			  p_mgr->cache_valid && !p_sw->need_update);
-		goto Exit;
-	}
-
-	for (block_id_ho = 0;
-	     osm_switch_get_lft_block(p_sw, block_id_ho, block);
-	     block_id_ho++) {
-		if (!p_sw->need_update && !p_mgr->p_subn->need_update &&
-		    !memcmp(block,
-			    p_sw->new_lft + block_id_ho * IB_SMP_DATA_SIZE,
-			    IB_SMP_DATA_SIZE))
-			continue;
-
-		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
-			"Writing FT block %u\n", block_id_ho);
-
-		status = osm_req_set(p_mgr->sm, p_path,
-				     p_sw->new_lft + block_id_ho * IB_SMP_DATA_SIZE,
-				     sizeof(block),
-				     IB_MAD_ATTR_LIN_FWD_TBL,
-				     cl_hton32(block_id_ho),
-				     CL_DISP_MSGID_NONE, &context);
-
-		if (status != IB_SUCCESS)
-			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A05: "
-				"Sending linear fwd. tbl. block failed (%s)\n",
-				ib_get_err_str(status));
-	}
-
-Exit:
-	OSM_LOG_EXIT(p_mgr->p_log);
-	return 0;
-}
-
-/**********************************************************************
- **********************************************************************/
-static void alloc_ports_priv(osm_ucast_mgr_t *mgr)
+static void alloc_ports_priv(osm_ucast_mgr_t * mgr)
 {
 	cl_qmap_t *port_tbl = &mgr->p_subn->port_guid_tbl;
 	struct osm_remote_guids_count *r;
@@ -439,10 +320,8 @@ static void alloc_ports_priv(osm_ucast_mgr_t *mgr)
 
 	for (item = cl_qmap_head(port_tbl); item != cl_qmap_end(port_tbl);
 	     item = cl_qmap_next(item)) {
-		port = (osm_port_t *)item;
+		port = (osm_port_t *) item;
 		lmc = ib_port_info_get_lmc(&port->p_physp->port_info);
-		if (!lmc)
-			continue;
 		r = malloc(sizeof(*r) + sizeof(r->guids[0]) * (1 << lmc));
 		if (!r) {
 			OSM_LOG(mgr->p_log, OSM_LOG_ERROR, "ERR 3A09: "
@@ -456,14 +335,14 @@ static void alloc_ports_priv(osm_ucast_mgr_t *mgr)
 	}
 }
 
-static void free_ports_priv(osm_ucast_mgr_t *mgr)
+static void free_ports_priv(osm_ucast_mgr_t * mgr)
 {
 	cl_qmap_t *port_tbl = &mgr->p_subn->port_guid_tbl;
 	osm_port_t *port;
 	cl_map_item_t *item;
 	for (item = cl_qmap_head(port_tbl); item != cl_qmap_end(port_tbl);
 	     item = cl_qmap_next(item)) {
-		port = (osm_port_t *)item;
+		port = (osm_port_t *) item;
 		if (port->priv) {
 			free(port->priv);
 			port->priv = NULL;
@@ -471,12 +350,11 @@ static void free_ports_priv(osm_ucast_mgr_t *mgr)
 	}
 }
 
-static void
-__osm_ucast_mgr_process_tbl(IN cl_map_item_t * const p_map_item,
-			    IN void *context)
+static void ucast_mgr_process_tbl(IN cl_map_item_t * p_map_item,
+				  IN void *context)
 {
 	osm_ucast_mgr_t *p_mgr = context;
-	osm_switch_t *const p_sw = (osm_switch_t *) p_map_item;
+	osm_switch_t * p_sw = (osm_switch_t *) p_map_item;
 	unsigned i, lids_per_port;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
@@ -488,10 +366,9 @@ __osm_ucast_mgr_process_tbl(IN cl_map_item_t * const p_map_item,
 		cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)));
 
 	/* Initialize LIDs in buffer to invalid port number. */
-	memset(p_sw->new_lft, OSM_NO_PATH, IB_LID_UCAST_END_HO + 1);
+	memset(p_sw->new_lft, OSM_NO_PATH, p_sw->max_lid_ho + 1);
 
-	if (p_mgr->p_subn->opt.lmc)
-		alloc_ports_priv(p_mgr);
+	alloc_ports_priv(p_mgr);
 
 	/*
 	   Iterate through every port setting LID routes for each
@@ -504,26 +381,20 @@ __osm_ucast_mgr_process_tbl(IN cl_map_item_t * const p_map_item,
 		for (item = cl_qlist_head(list); item != cl_qlist_end(list);
 		     item = cl_qlist_next(item)) {
 			osm_port_t *port = cl_item_obj(item, port, list_item);
-			__osm_ucast_mgr_process_port(p_mgr, p_sw, port, i);
+			ucast_mgr_process_port(p_mgr, p_sw, port, i);
 		}
 	}
 
-	osm_ucast_mgr_set_fwd_table(p_mgr, p_sw);
-
-	if (p_mgr->p_subn->opt.lmc)
-		free_ports_priv(p_mgr);
+	free_ports_priv(p_mgr);
 
 	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-static void
-__osm_ucast_mgr_process_neighbors(IN cl_map_item_t * const p_map_item,
-				  IN void *context)
+static void ucast_mgr_process_neighbors(IN cl_map_item_t * p_map_item,
+					IN void *context)
 {
-	osm_switch_t *const p_sw = (osm_switch_t *) p_map_item;
-	osm_ucast_mgr_t *const p_mgr = (osm_ucast_mgr_t *) context;
+	osm_switch_t * p_sw = (osm_switch_t *) p_map_item;
+	osm_ucast_mgr_t * p_mgr = context;
 	osm_node_t *p_node;
 	osm_node_t *p_remote_node;
 	uint32_t port_num;
@@ -551,7 +422,6 @@ __osm_ucast_mgr_process_neighbors(IN cl_map_item_t * const p_map_item,
 		p_remote_node = osm_node_get_remote_node(p_node,
 							 (uint8_t) port_num,
 							 &remote_port_num);
-
 		if (p_remote_node && p_remote_node->sw
 		    && (p_remote_node != p_node)) {
 			/* make sure the link is healthy. If it is not - don't
@@ -560,20 +430,166 @@ __osm_ucast_mgr_process_neighbors(IN cl_map_item_t * const p_map_item,
 			if (!p_physp || !osm_link_is_healthy(p_physp))
 				continue;
 
-			__osm_ucast_mgr_process_neighbor(p_mgr, p_sw,
-							 p_remote_node->sw,
-							 (uint8_t) port_num,
-							 remote_port_num);
-
+			ucast_mgr_process_neighbor(p_mgr, p_sw,
+						   p_remote_node->sw,
+						   (uint8_t) port_num,
+						   remote_port_num);
 		}
 	}
 
 	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-int osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * const p_mgr)
+static int set_hop_wf(void *ctx, uint64_t guid, char *p)
+{
+	osm_ucast_mgr_t *m = ctx;
+	osm_node_t *node = osm_get_node_by_guid(m->p_subn, cl_hton64(guid));
+	osm_physp_t *physp;
+	unsigned port, hop_wf;
+	char *e;
+
+	if (!node || !node->sw) {
+		OSM_LOG(m->p_log, OSM_LOG_DEBUG,
+			"switch with guid 0x%016" PRIx64 " is not found\n",
+			guid);
+		return 0;
+	}
+
+	if (!p || !*p || !(port = strtoul(p, &e, 0)) || (p == e) ||
+	    port >= node->sw->num_ports) {
+		OSM_LOG(m->p_log, OSM_LOG_DEBUG,
+			"bad port specified for guid 0x%016" PRIx64 "\n", guid);
+		return 0;
+	}
+
+	p = e + 1;
+
+	if (!*p || !(hop_wf = strtoul(p, &e, 0)) || p == e || hop_wf >= 0x100) {
+		OSM_LOG(m->p_log, OSM_LOG_DEBUG,
+			"bad hop weight factor specified for guid 0x%016" PRIx64
+			"port %u\n", guid, port);
+		return 0;
+	}
+
+	physp = osm_node_get_physp_ptr(node, port);
+	if (!physp)
+		return 0;
+
+	physp->hop_wf = hop_wf;
+
+	return 0;
+}
+
+static void set_default_hop_wf(cl_map_item_t * p_map_item, void *ctx)
+{
+	osm_switch_t *sw = (osm_switch_t *) p_map_item;
+	int i;
+
+	for (i = 1; i < sw->num_ports; i++) {
+		osm_physp_t *p = osm_node_get_physp_ptr(sw->p_node, i);
+		if (p)
+			p->hop_wf = 1;
+	}
+}
+
+static int set_search_ordering_ports(void *ctx, uint64_t guid, char *p)
+{
+	osm_subn_t *p_subn = ctx;
+	osm_node_t *node = osm_get_node_by_guid(p_subn, cl_hton64(guid));
+	osm_switch_t *sw;
+	uint8_t *search_ordering_ports = NULL;
+	uint8_t port;
+	unsigned int *ports = NULL;
+	const int bpw = sizeof(*ports)*8;
+	int words;
+	int i = 1; /* port 0 maps to port 0 */
+
+	if (!node || !(sw = node->sw)) {
+		OSM_LOG(&p_subn->p_osm->log, OSM_LOG_VERBOSE,
+			"switch with guid 0x%016" PRIx64 " is not found\n",
+			guid);
+		return 0;
+	}
+
+	if (sw->search_ordering_ports) {
+		OSM_LOG(&p_subn->p_osm->log, OSM_LOG_VERBOSE,
+			"switch with guid 0x%016" PRIx64 " already listed\n",
+			guid);
+		return 0;
+	}
+
+	search_ordering_ports = malloc(sizeof(*search_ordering_ports)*sw->num_ports);
+	if (!search_ordering_ports) {
+		OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR,
+			"ERR 3A07: cannot allocate memory for search_ordering_ports\n");
+		return -1;
+	}
+	memset(search_ordering_ports, 0, sizeof(*search_ordering_ports)*sw->num_ports);
+
+	/* the ports array is for record keeping of which ports have
+	 * been seen */
+	words = (sw->num_ports + bpw - 1)/bpw;
+	ports = malloc(words*sizeof(*ports));
+	if (!ports) {
+		OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR,
+			"ERR 3A08: cannot allocate memory for ports\n");
+		free(search_ordering_ports);
+		return -1;
+	}
+	memset(ports, 0, words*sizeof(*ports));
+
+	while ((*p != '\0') && (*p != '#')) {
+		char *e;
+
+		port = strtoul(p, &e, 0);
+		if ((p == e) || (port == 0) || (port >= sw->num_ports) ||
+		    !osm_node_get_physp_ptr(node, port)) {
+			OSM_LOG(&p_subn->p_osm->log, OSM_LOG_VERBOSE,
+				"bad port %d specified for guid 0x%016" PRIx64 "\n",
+				port, guid);
+			free(search_ordering_ports);
+			free(ports);
+			return 0;
+		}
+
+		if (ports[port/bpw] & (1u << (port%bpw))) {
+			OSM_LOG(&p_subn->p_osm->log, OSM_LOG_VERBOSE,
+				"port %d already specified for guid 0x%016" PRIx64 "\n",
+				port, guid);
+			free(search_ordering_ports);
+			free(ports);
+			return 0;
+		}
+
+		ports[port/bpw] |= (1u << (port%bpw));
+		search_ordering_ports[i++] = port;
+
+		p = e;
+		while (isspace(*p)) {
+			p++;
+		}
+	}
+
+	if (i > 1) {
+		for (port = 1; port < sw->num_ports; port++) {
+			/* fill out the rest of the search_ordering_ports array
+			 * in sequence using the remaining unspecified
+			 * ports.
+			 */
+			if (!(ports[port/bpw] & (1u << (port%bpw)))) {
+				search_ordering_ports[i++] = port;
+			}
+		}
+		sw->search_ordering_ports = search_ordering_ports;
+	} else {
+		free(search_ordering_ports);
+	}
+
+	free(ports);
+	return 0;
+}
+
+int osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * p_mgr)
 {
 	uint32_t i;
 	uint32_t iteration_max;
@@ -585,11 +601,26 @@ int osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * const p_mgr)
 		"Starting switches' Min Hop Table Assignment\n");
 
 	/*
+	   Set up the weighting factors for the routing.
+	 */
+	cl_qmap_apply_func(p_sw_guid_tbl, set_default_hop_wf, NULL);
+	if (p_mgr->p_subn->opt.hop_weights_file) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+			"Fetching hop weight factor file \'%s\'\n",
+			p_mgr->p_subn->opt.hop_weights_file);
+		if (parse_node_map(p_mgr->p_subn->opt.hop_weights_file,
+				   set_hop_wf, p_mgr)) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A05: "
+				"cannot parse hop_weights_file \'%s\'\n",
+				p_mgr->p_subn->opt.hop_weights_file);
+		}
+	}
+
+	/*
 	   Set the switch matrices for each switch's own port 0 LID(s)
 	   then set the lid matrices for the each switch's leaf nodes.
 	 */
-	cl_qmap_apply_func(p_sw_guid_tbl,
-			   __osm_ucast_mgr_process_hop_0_1, p_mgr);
+	cl_qmap_apply_func(p_sw_guid_tbl, ucast_mgr_process_hop_0_1, p_mgr);
 
 	/*
 	   Get the switch matrices for each switch's neighbors.
@@ -630,8 +661,7 @@ int osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * const p_mgr)
 		     i++) {
 			p_mgr->some_hop_count_set = FALSE;
 			cl_qmap_apply_func(p_sw_guid_tbl,
-					   __osm_ucast_mgr_process_neighbors,
-					   p_mgr);
+					   ucast_mgr_process_neighbors, p_mgr);
 		}
 		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 			"Min-hop propagated in %d steps\n", i);
@@ -640,8 +670,6 @@ int osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * const p_mgr)
 	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
 static int ucast_mgr_setup_all_switches(osm_subn_t * p_subn)
 {
 	osm_switch_t *p_sw;
@@ -652,7 +680,7 @@ static int ucast_mgr_setup_all_switches(osm_subn_t * p_subn)
 
 	for (p_sw = (osm_switch_t *) cl_qmap_head(&p_subn->sw_guid_tbl);
 	     p_sw != (osm_switch_t *) cl_qmap_end(&p_subn->sw_guid_tbl);
-	     p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item))
+	     p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item)) {
 		if (osm_switch_prepare_path_rebuild(p_sw, lids)) {
 			OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR, "ERR 3A0B: "
 				"cannot setup switch 0x%016" PRIx64 "\n",
@@ -660,13 +688,27 @@ static int ucast_mgr_setup_all_switches(osm_subn_t * p_subn)
 					  (p_sw->p_node)));
 			return -1;
 		}
+		if (p_sw->search_ordering_ports) {
+			free(p_sw->search_ordering_ports);
+			p_sw->search_ordering_ports = NULL;
+		}
+	}
+
+	if (p_subn->opt.port_search_ordering_file) {
+		OSM_LOG(&p_subn->p_osm->log, OSM_LOG_DEBUG,
+			"Fetching dimension ports file \'%s\'\n",
+			p_subn->opt.port_search_ordering_file);
+		if (parse_node_map(p_subn->opt.port_search_ordering_file,
+				   set_search_ordering_ports, p_subn)) {
+			OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR, "ERR 3A05: "
+				"cannot parse port_search_ordering_file \'%s\'\n",
+				p_subn->opt.port_search_ordering_file);
+		}
+	}
 
 	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
-
 static int add_guid_to_order_list(void *ctx, uint64_t guid, char *p)
 {
 	osm_ucast_mgr_t *m = ctx;
@@ -691,9 +733,9 @@ static int add_guid_to_order_list(void *ctx, uint64_t guid, char *p)
 	return 0;
 }
 
-static void add_port_to_order_list(cl_map_item_t * const p_map_item, void *ctx)
+static void add_port_to_order_list(cl_map_item_t * p_map_item, void *ctx)
 {
-	osm_port_t *port = (osm_port_t *)p_map_item;
+	osm_port_t *port = (osm_port_t *) p_map_item;
 	osm_ucast_mgr_t *m = ctx;
 
 	if (!port->flag)
@@ -732,9 +774,9 @@ static int mark_ignored_port(void *ctx, uint64_t guid, char *p)
 	return 0;
 }
 
-static void clear_prof_ignore_flag(cl_map_item_t * const p_map_item, void *ctx)
+static void clear_prof_ignore_flag(cl_map_item_t * p_map_item, void *ctx)
 {
-	osm_switch_t *sw = (osm_switch_t *)p_map_item;
+	osm_switch_t *sw = (osm_switch_t *) p_map_item;
 	int i;
 
 	for (i = 1; i < sw->num_ports; i++) {
@@ -744,7 +786,71 @@ static void clear_prof_ignore_flag(cl_map_item_t * const p_map_item, void *ctx)
 	}
 }
 
-static int ucast_mgr_build_lfts(osm_ucast_mgr_t *p_mgr)
+static void add_sw_endports_to_order_list(osm_switch_t * sw,
+					  osm_ucast_mgr_t * m)
+{
+	osm_port_t *port;
+	osm_physp_t *p;
+	int i;
+
+	for (i = 1; i < sw->num_ports; i++) {
+		p = osm_node_get_physp_ptr(sw->p_node, i);
+		if (p && p->p_remote_physp && !p->p_remote_physp->p_node->sw) {
+			port = osm_get_port_by_guid(m->p_subn,
+						    p->p_remote_physp->
+						    port_guid);
+			if (!port)
+				continue;
+			cl_qlist_insert_tail(&m->port_order_list,
+					     &port->list_item);
+			port->flag = 1;
+		}
+	}
+}
+
+static void sw_count_endport_links(osm_switch_t * sw)
+{
+	osm_physp_t *p;
+	int i;
+
+	sw->endport_links = 0;
+	for (i = 1; i < sw->num_ports; i++) {
+		p = osm_node_get_physp_ptr(sw->p_node, i);
+		if (p && p->p_remote_physp && !p->p_remote_physp->p_node->sw)
+			sw->endport_links++;
+	}
+}
+
+static int compar_sw_load(const void *s1, const void *s2)
+{
+#define get_sw_endport_links(s) (*(osm_switch_t **)s)->endport_links
+	return get_sw_endport_links(s2) - get_sw_endport_links(s1);
+}
+
+static void sort_ports_by_switch_load(osm_ucast_mgr_t * m)
+{
+	int i, num = cl_qmap_count(&m->p_subn->sw_guid_tbl);
+	void **s = malloc(num * sizeof(*s));
+	if (!s) {
+		OSM_LOG(m->p_log, OSM_LOG_ERROR, "ERR 3A0C: "
+			"No memory, skip by switch load sorting.\n");
+		return;
+	}
+	s[0] = cl_qmap_head(&m->p_subn->sw_guid_tbl);
+	for (i = 1; i < num; i++)
+		s[i] = cl_qmap_next(s[i - 1]);
+
+	for (i = 0; i < num; i++)
+		sw_count_endport_links(s[i]);
+
+	qsort(s, num, sizeof(*s), compar_sw_load);
+
+	for (i = 0; i < num; i++)
+		add_sw_endports_to_order_list(s[i], m);
+	free(s);
+}
+
+static int ucast_mgr_build_lfts(osm_ucast_mgr_t * p_mgr)
 {
 	cl_qlist_init(&p_mgr->port_order_list);
 
@@ -755,17 +861,18 @@ static int ucast_mgr_build_lfts(osm_ucast_mgr_t *p_mgr)
 
 		if (parse_node_map(p_mgr->p_subn->opt.guid_routing_order_file,
 				   add_guid_to_order_list, p_mgr))
-			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR : "
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A0D: "
 				"cannot parse guid routing order file \'%s\'\n",
 				p_mgr->p_subn->opt.guid_routing_order_file);
-	}
+	} else
+		sort_ports_by_switch_load(p_mgr);
 
 	if (p_mgr->p_subn->opt.port_prof_ignore_file) {
 		cl_qmap_apply_func(&p_mgr->p_subn->sw_guid_tbl,
 				   clear_prof_ignore_flag, NULL);
 		if (parse_node_map(p_mgr->p_subn->opt.port_prof_ignore_file,
 				   mark_ignored_port, p_mgr)) {
-			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR : "
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A0E: "
 				"cannot parse port prof ignore file \'%s\'\n",
 				p_mgr->p_subn->opt.port_prof_ignore_file);
 		}
@@ -774,23 +881,171 @@ static int ucast_mgr_build_lfts(osm_ucast_mgr_t *p_mgr)
 	cl_qmap_apply_func(&p_mgr->p_subn->port_guid_tbl,
 			   add_port_to_order_list, p_mgr);
 
-	cl_qmap_apply_func(&p_mgr->p_subn->sw_guid_tbl,
-			   __osm_ucast_mgr_process_tbl, p_mgr);
+	cl_qmap_apply_func(&p_mgr->p_subn->sw_guid_tbl, ucast_mgr_process_tbl,
+			   p_mgr);
 
 	cl_qlist_remove_all(&p_mgr->port_order_list);
 
 	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
-static int ucast_mgr_route(struct osm_routing_engine *r, osm_opensm_t *osm)
+static void ucast_mgr_set_fwd_top(IN cl_map_item_t * p_map_item,
+				  IN void *cxt)
+{
+	osm_ucast_mgr_t *p_mgr = cxt;
+	osm_switch_t * p_sw = (osm_switch_t *) p_map_item;
+	osm_node_t *p_node;
+	osm_dr_path_t *p_path;
+	osm_madw_context_t context;
+	ib_api_status_t status;
+	ib_switch_info_t si;
+	boolean_t set_swinfo_require = FALSE;
+	uint16_t lin_top;
+	uint8_t life_state;
+
+	CL_ASSERT(p_mgr);
+
+	OSM_LOG_ENTER(p_mgr->p_log);
+
+	CL_ASSERT(p_sw && p_sw->max_lid_ho);
+
+	p_node = p_sw->p_node;
+
+	CL_ASSERT(p_node);
+
+	if (p_mgr->max_lid < p_sw->max_lid_ho)
+		p_mgr->max_lid = p_sw->max_lid_ho;
+
+	p_path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));
+
+	/*
+	   Set the top of the unicast forwarding table.
+	 */
+	si = p_sw->switch_info;
+	lin_top = cl_hton16(p_sw->max_lid_ho);
+	if (lin_top != si.lin_top) {
+		set_swinfo_require = TRUE;
+		si.lin_top = lin_top;
+	}
+
+	/* check to see if the change state bit is on. If it is - then we
+	   need to clear it. */
+	if (ib_switch_info_get_state_change(&si))
+		life_state = ((p_mgr->p_subn->opt.packet_life_time << 3)
+			      | (si.life_state & IB_SWITCH_PSC)) & 0xfc;
+	else
+		life_state = (p_mgr->p_subn->opt.packet_life_time << 3) & 0xf8;
+
+	if (life_state != si.life_state || ib_switch_info_get_state_change(&si)) {
+		set_swinfo_require = TRUE;
+		si.life_state = life_state;
+	}
+
+	if (set_swinfo_require) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+			"Setting switch FT top to LID %u\n", p_sw->max_lid_ho);
+
+		context.si_context.light_sweep = FALSE;
+		context.si_context.node_guid = osm_node_get_node_guid(p_node);
+		context.si_context.set_method = TRUE;
+
+		status = osm_req_set(p_mgr->sm, p_path, (uint8_t *) & si,
+				     sizeof(si), IB_MAD_ATTR_SWITCH_INFO,
+				     0, CL_DISP_MSGID_NONE, &context);
+
+		if (status != IB_SUCCESS)
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A06: "
+				"Sending SwitchInfo attribute failed (%s)\n",
+				ib_get_err_str(status));
+	}
+
+	OSM_LOG_EXIT(p_mgr->p_log);
+}
+
+static int set_lft_block(IN osm_switch_t *p_sw, IN osm_ucast_mgr_t *p_mgr,
+			 IN uint16_t block_id_ho)
+{
+	uint8_t block[IB_SMP_DATA_SIZE];
+	osm_madw_context_t context;
+	osm_dr_path_t *p_path;
+	ib_api_status_t status;
+
+	/*
+	   Send linear forwarding table blocks to the switch
+	   as long as the switch indicates it has blocks needing
+	   configuration.
+	 */
+	if (!p_sw->new_lft) {
+		/* any routing should provide the new_lft */
+		CL_ASSERT(p_mgr->p_subn->opt.use_ucast_cache &&
+			  p_mgr->cache_valid && !p_sw->need_update);
+		return -1;
+	}
+
+	p_path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_sw->p_node, 0));
+
+	context.lft_context.node_guid = osm_node_get_node_guid(p_sw->p_node);
+	context.lft_context.set_method = TRUE;
+
+	if (!osm_switch_get_lft_block(p_sw, block_id_ho, block) ||
+	    (!p_sw->need_update && !p_mgr->p_subn->need_update &&
+	     !memcmp(block, p_sw->new_lft + block_id_ho * IB_SMP_DATA_SIZE,
+		     IB_SMP_DATA_SIZE)))
+		return 0;
+
+	OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+		"Writing FT block %u to switch 0x%" PRIx64 "\n", block_id_ho,
+		cl_ntoh64(context.lft_context.node_guid));
+
+	status = osm_req_set(p_mgr->sm, p_path,
+			     p_sw->new_lft + block_id_ho * IB_SMP_DATA_SIZE,
+			     IB_SMP_DATA_SIZE, IB_MAD_ATTR_LIN_FWD_TBL,
+			     cl_hton32(block_id_ho),
+			     CL_DISP_MSGID_NONE, &context);
+	if (status != IB_SUCCESS) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A05: "
+			"Sending linear fwd. tbl. block failed (%s)\n",
+			ib_get_err_str(status));
+		return -1;
+	}
+
+	return 0;
+}
+
+static void ucast_mgr_pipeline_fwd_tbl(osm_ucast_mgr_t * p_mgr)
+{
+	cl_qmap_t *tbl;
+	cl_map_item_t *item;
+	unsigned i, max_block = p_mgr->max_lid / 64 + 1;
+
+	tbl = &p_mgr->p_subn->sw_guid_tbl;
+	for (i = 0; i < max_block; i++)
+		for (item = cl_qmap_head(tbl); item != cl_qmap_end(tbl);
+		     item = cl_qmap_next(item))
+			set_lft_block((osm_switch_t *)item, p_mgr, i);
+}
+
+void osm_ucast_mgr_set_fwd_tables(osm_ucast_mgr_t * p_mgr)
+{
+	p_mgr->max_lid = 0;
+
+	cl_qmap_apply_func(&p_mgr->p_subn->sw_guid_tbl, ucast_mgr_set_fwd_top,
+			   p_mgr);
+
+	ucast_mgr_pipeline_fwd_tbl(p_mgr);
+}
+
+static int ucast_mgr_route(struct osm_routing_engine *r, osm_opensm_t * osm)
 {
 	int ret;
 
 	OSM_LOG(&osm->log, OSM_LOG_VERBOSE,
 		"building routing with \'%s\' routing algorithm...\n", r->name);
 
+	/* Set the before each lft build to keep the routes in place between sweeps */
+	if(osm->subn.opt.scatter_ports)
+		srandom(osm->subn.opt.scatter_ports);
+
 	if (!r->build_lid_matrices ||
 	    (ret = r->build_lid_matrices(r->context)) > 0)
 		ret = osm_ucast_mgr_build_lid_matrices(&osm->sm.ucast_mgr);
@@ -811,16 +1066,19 @@ static int ucast_mgr_route(struct osm_routing_engine *r, osm_opensm_t *osm)
 		return ret;
 	}
 
-	osm->routing_engine_used = osm_routing_engine_type(r->name);
+	osm->routing_engine_used = r;
+
+	osm_ucast_mgr_set_fwd_tables(&osm->sm.ucast_mgr);
 
 	return 0;
 }
 
-int osm_ucast_mgr_process(IN osm_ucast_mgr_t * const p_mgr)
+int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr)
 {
 	osm_opensm_t *p_osm;
 	struct osm_routing_engine *p_routing_eng;
 	cl_qmap_t *p_sw_guid_tbl;
+	int failed = 0;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 
@@ -837,31 +1095,46 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t * const p_mgr)
 	    ucast_mgr_setup_all_switches(p_mgr->p_subn) < 0)
 		goto Exit;
 
-	p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_NONE;
+	failed = -1;
+	p_osm->routing_engine_used = NULL;
 	while (p_routing_eng) {
-		if (!ucast_mgr_route(p_routing_eng, p_osm))
+		failed = ucast_mgr_route(p_routing_eng, p_osm);
+		if (!failed)
 			break;
 		p_routing_eng = p_routing_eng->next;
 	}
 
-	if (p_osm->routing_engine_used == OSM_ROUTING_ENGINE_TYPE_NONE) {
+	if (!p_osm->routing_engine_used &&
+	    p_osm->no_fallback_routing_engine != TRUE) {
 		/* If configured routing algorithm failed, use default MinHop */
-		osm_ucast_mgr_build_lid_matrices(p_mgr);
-		ucast_mgr_build_lfts(p_mgr);
-		p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_MINHOP;
-	}
+		struct osm_routing_engine *r = p_osm->default_routing_engine;
 
-	OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-		"%s tables configured on all switches\n",
-		osm_routing_engine_type_str(p_osm->routing_engine_used));
+		r->build_lid_matrices(r->context);
+		failed = r->ucast_build_fwd_tables(r->context);
+		if (!failed) {
+			p_osm->routing_engine_used = r;
+			osm_ucast_mgr_set_fwd_tables(p_mgr);
+		}
+	}
 
-        if (p_mgr->p_subn->opt.use_ucast_cache)
-		p_mgr->cache_valid = TRUE;
+	if (p_osm->routing_engine_used) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+			"%s tables configured on all switches\n",
+			osm_routing_engine_type_str(p_osm->
+						    routing_engine_used->type));
 
+		if (p_mgr->p_subn->opt.use_ucast_cache)
+			p_mgr->cache_valid = TRUE;
+	} else {
+		p_mgr->p_subn->subnet_initialization_error = TRUE;
+		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+			"No routing engine able to successfully configure "
+			" switch tables on current fabric\n");
+	}
 Exit:
 	CL_PLOCK_RELEASE(p_mgr->p_lock);
 	OSM_LOG_EXIT(p_mgr->p_log);
-	return 0;
+	return failed;
 }
 
 static int ucast_build_lid_matrices(void *context)
@@ -874,7 +1147,7 @@ static int ucast_build_lfts(void *context)
 	return ucast_mgr_build_lfts(context);
 }
 
-int osm_ucast_minhop_setup(struct osm_routing_engine *r, osm_opensm_t *osm)
+int osm_ucast_minhop_setup(struct osm_routing_engine *r, osm_opensm_t * osm)
 {
 	r->context = &osm->sm.ucast_mgr;
 	r->build_lid_matrices = ucast_build_lid_matrices;
@@ -894,7 +1167,7 @@ static int ucast_dor_build_lfts(void *context)
 	return ret;
 }
 
-int osm_ucast_dor_setup(struct osm_routing_engine *r, osm_opensm_t *osm)
+int osm_ucast_dor_setup(struct osm_routing_engine *r, osm_opensm_t * osm)
 {
 	r->context = &osm->sm.ucast_mgr;
 	r->build_lid_matrices = ucast_build_lid_matrices;
diff --git a/opensm/osm_ucast_updn.c b/opensm/osm_ucast_updn.c
index bb9ccda..d6877fe 100644
--- a/opensm/osm_ucast_updn.c
+++ b/opensm/osm_ucast_updn.c
@@ -1,7 +1,8 @@
 /*
  * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2007,2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -47,6 +48,8 @@
 #include <ctype.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qmap.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_UCAST_UPDN_C
 #include <opensm/osm_switch.h>
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_ucast_mgr.h>
@@ -76,8 +79,6 @@ struct updn_node {
 	unsigned visited;
 };
 
-/**********************************************************************
- **********************************************************************/
 /* This function returns direction based on rank and guid info of current &
    remote ports */
 static updn_switch_dir_t updn_get_dir(unsigned cur_rank, unsigned rem_rank,
@@ -203,8 +204,6 @@ static int updn_bfs_by_node(IN osm_log_t * p_log, IN osm_subn_t * p_subn,
 	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
 /* NOTE : PLS check if we need to decide that the first */
 /*        rank is a SWITCH for BFS purpose */
 static int updn_subn_rank(IN updn_t * p_updn)
@@ -282,28 +281,22 @@ static int updn_subn_rank(IN updn_t * p_updn)
 	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
 /* hack: preserve min hops entries to any other root switches */
-static void updn_clear_root_hops(updn_t * p_updn, osm_switch_t * p_sw)
+static void updn_clear_non_root_hops(updn_t * updn, osm_switch_t * sw)
 {
-	osm_port_t *p_port;
+	osm_port_t *port;
 	unsigned i;
 
-	for (i = 0; i < p_sw->num_hops; i++)
-		if (p_sw->hops[i]) {
-			p_port =
-			    cl_ptr_vector_get(&p_updn->p_osm->subn.port_lid_tbl,
-					      i);
-			if (!p_port || !p_port->p_node->sw
-			    || ((struct updn_node *)p_port->p_node->sw->priv)->
+	for (i = 0; i < sw->num_hops; i++)
+		if (sw->hops[i]) {
+			port = osm_get_port_by_lid_ho(&updn->p_osm->subn, i);
+			if (!port || !port->p_node->sw
+			    || ((struct updn_node *)port->p_node->sw->priv)->
 			    rank != 0)
-				memset(p_sw->hops[i], 0xff, p_sw->num_ports);
+				memset(sw->hops[i], 0xff, sw->num_ports);
 		}
 }
 
-/**********************************************************************
- **********************************************************************/
 static int updn_set_min_hop_table(IN updn_t * p_updn)
 {
 	osm_subn_t *p_subn = &p_updn->p_osm->subn;
@@ -324,7 +317,7 @@ static int updn_set_min_hop_table(IN updn_t * p_updn)
 		p_sw = (osm_switch_t *)item;
 		/* Clear Min Hop Table */
 		if (p_subn->opt.connect_roots)
-			updn_clear_root_hops(p_updn, p_sw);
+			updn_clear_non_root_hops(p_updn, p_sw);
 		else
 			osm_switch_clear_hops(p_sw);
 	}
@@ -350,8 +343,6 @@ static int updn_set_min_hop_table(IN updn_t * p_updn)
 	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
 static int updn_build_lid_matrices(IN updn_t * p_updn)
 {
 	int status;
@@ -388,8 +379,6 @@ _exit:
 	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
 static struct updn_node *create_updn_node(osm_switch_t * sw)
 {
 	struct updn_node *u;
@@ -410,8 +399,6 @@ static void delete_updn_node(struct updn_node *u)
 	free(u);
 }
 
-/**********************************************************************
- **********************************************************************/
 /* Find Root nodes automatically by Min Hop Table info */
 static void updn_find_root_nodes_by_min_hop(OUT updn_t * p_updn)
 {
@@ -431,13 +418,14 @@ static void updn_find_root_nodes_by_min_hop(OUT updn_t * p_updn)
 		"Current number of ports in the subnet is %d\n",
 		cl_qmap_count(&p_osm->subn.port_guid_tbl));
 
-	cas_per_sw = malloc((IB_LID_UCAST_END_HO + 1) * sizeof(*cas_per_sw));
+	lid_ho = (uint16_t) cl_ptr_vector_get_size(&p_updn->p_osm->subn.port_lid_tbl) + 1;
+	cas_per_sw = malloc(lid_ho * sizeof(*cas_per_sw));
 	if (!cas_per_sw) {
 		OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR AA14: "
 			"cannot alloc mem for CAs per switch counter array\n");
 		goto _exit;
 	}
-	memset(cas_per_sw, 0, (IB_LID_UCAST_END_HO + 1) * sizeof(*cas_per_sw));
+	memset(cas_per_sw, 0, lid_ho * sizeof(*cas_per_sw));
 
 	/* Find the Maximum number of CAs (and routers) for histogram normalization */
 	OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,
@@ -515,8 +503,6 @@ _exit:
 	return;
 }
 
-/**********************************************************************
- **********************************************************************/
 static void dump_roots(cl_map_item_t *item, FILE *file, void *cxt)
 {
 	osm_switch_t *sw = (osm_switch_t *)item;
@@ -644,7 +630,7 @@ static int updn_lid_matrices(void *ctx)
 		ret = -1;
 	}
 
-	if (osm_log_is_active(&p_updn->p_osm->log, OSM_LOG_ROUTING))
+	if (OSM_LOG_IS_ACTIVE_V2(&p_updn->p_osm->log, OSM_LOG_ROUTING))
 		osm_dump_qmap_to_file(p_updn->p_osm, "opensm-updn-roots.dump",
 				      &p_updn->p_osm->subn.sw_guid_tbl,
 				      dump_roots, NULL);
@@ -660,8 +646,6 @@ static int updn_lid_matrices(void *ctx)
 	return ret;
 }
 
-/**********************************************************************
- **********************************************************************/
 static void updn_delete(void *context)
 {
 	free(context);
@@ -679,7 +663,7 @@ int osm_ucast_updn_setup(struct osm_routing_engine *r, osm_opensm_t *osm)
 	updn->p_osm = osm;
 
 	r->context = updn;
-	r->delete = updn_delete;
+	r->destroy = updn_delete;
 	r->build_lid_matrices = updn_lid_matrices;
 
 	return 0;
diff --git a/opensm/osm_vl15intf.c b/opensm/osm_vl15intf.c
index 0703a4f..253578b 100644
--- a/opensm/osm_vl15intf.c
+++ b/opensm/osm_vl15intf.c
@@ -1,6 +1,7 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -47,25 +48,25 @@
 #include <string.h>
 #include <iba/ib_types.h>
 #include <complib/cl_thread.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_VL15INTF_C
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_vl15intf.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_helper.h>
 
-/**********************************************************************
- **********************************************************************/
-
 static void vl15_send_mad(osm_vl15_t * p_vl, osm_madw_t * p_madw)
 {
 	ib_api_status_t status;
+	boolean_t resp_expected = p_madw->resp_expected;
 
 	/*
 	   Non-response-expected mads are not throttled on the wire
 	   since we can have no confirmation that they arrived
 	   at their destination.
 	 */
-	if (p_madw->resp_expected == TRUE)
+	if (resp_expected)
 		/*
 		   Note that other threads may not see the response MAD
 		   arrive before send() even returns.
@@ -105,16 +106,18 @@ static void vl15_send_mad(osm_vl15_t * p_vl, osm_madw_t * p_madw)
 	   qp0_mads_outstanding will be decremented by send error callback
 	   (called by osm_vendor_send() */
 	cl_atomic_dec(&p_vl->p_stats->qp0_mads_sent);
-	if (!p_madw->resp_expected)
+	if (!resp_expected)
 		cl_atomic_dec(&p_vl->p_stats->qp0_unicasts_sent);
 }
 
-static void __osm_vl15_poller(IN void *p_ptr)
+static void vl15_poller(IN void *p_ptr)
 {
 	ib_api_status_t status;
 	osm_madw_t *p_madw;
-	osm_vl15_t *const p_vl = (osm_vl15_t *) p_ptr;
+	osm_vl15_t *p_vl = p_ptr;
 	cl_qlist_t *p_fifo;
+	int32_t max_smps = p_vl->max_wire_smps;
+	int32_t max_smps2 = p_vl->max_wire_smps2;
 
 	OSM_LOG_ENTER(p_vl->p_log);
 
@@ -144,10 +147,10 @@ static void __osm_vl15_poller(IN void *p_ptr)
 		if (p_madw != (osm_madw_t *) cl_qlist_end(p_fifo)) {
 			OSM_LOG(p_vl->p_log, OSM_LOG_DEBUG,
 				"Servicing p_madw = %p\n", p_madw);
-			if (osm_log_is_active(p_vl->p_log, OSM_LOG_FRAMES))
-				osm_dump_dr_smp(p_vl->p_log,
-						osm_madw_get_smp_ptr(p_madw),
-						OSM_LOG_FRAMES);
+			if (OSM_LOG_IS_ACTIVE_V2(p_vl->p_log, OSM_LOG_FRAMES))
+				osm_dump_dr_smp_v2(p_vl->p_log,
+						   osm_madw_get_smp_ptr(p_madw),
+						   FILE_ID, OSM_LOG_FRAMES);
 
 			vl15_send_mad(p_vl, p_madw);
 		} else
@@ -157,17 +160,22 @@ static void __osm_vl15_poller(IN void *p_ptr)
 			status = cl_event_wait_on(&p_vl->signal,
 						  EVENT_NO_TIMEOUT, TRUE);
 
-		while ((p_vl->p_stats->qp0_mads_outstanding_on_wire >=
-			(int32_t) p_vl->max_wire_smps) &&
-		       (p_vl->thread_state == OSM_THREAD_STATE_RUN)) {
+		while (p_vl->p_stats->qp0_mads_outstanding_on_wire >= max_smps &&
+		       p_vl->thread_state == OSM_THREAD_STATE_RUN) {
 			status = cl_event_wait_on(&p_vl->signal,
-						  EVENT_NO_TIMEOUT, TRUE);
-			if (status != CL_SUCCESS) {
+						  p_vl->max_smps_timeout,
+						  TRUE);
+			if (status == CL_TIMEOUT) {
+				if (max_smps < max_smps2)
+					max_smps++;
+				break;
+			} else if (status != CL_SUCCESS) {
 				OSM_LOG(p_vl->p_log, OSM_LOG_ERROR, "ERR 3E02: "
 					"Event wait failed (%s)\n",
 					CL_STATUS_MSG(status));
 				break;
 			}
+			max_smps = p_vl->max_wire_smps;
 		}
 	}
 
@@ -180,9 +188,7 @@ static void __osm_vl15_poller(IN void *p_ptr)
 	OSM_LOG_EXIT(p_vl->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_vl15_construct(IN osm_vl15_t * const p_vl)
+void osm_vl15_construct(IN osm_vl15_t * p_vl)
 {
 	memset(p_vl, 0, sizeof(*p_vl));
 	p_vl->state = OSM_VL15_STATE_INIT;
@@ -194,10 +200,7 @@ void osm_vl15_construct(IN osm_vl15_t * const p_vl)
 	cl_thread_construct(&p_vl->poller);
 }
 
-/**********************************************************************
- **********************************************************************/
-void
-osm_vl15_destroy(IN osm_vl15_t * const p_vl, IN struct osm_mad_pool *p_pool)
+void osm_vl15_destroy(IN osm_vl15_t * p_vl, IN struct osm_mad_pool *p_pool)
 {
 	osm_madw_t *p_madw;
 
@@ -241,13 +244,11 @@ osm_vl15_destroy(IN osm_vl15_t * const p_vl, IN struct osm_mad_pool *p_pool)
 	OSM_LOG_EXIT(p_vl->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_vl15_init(IN osm_vl15_t * const p_vl,
-	      IN osm_vendor_t * const p_vend,
-	      IN osm_log_t * const p_log,
-	      IN osm_stats_t * const p_stats, IN const int32_t max_wire_smps)
+ib_api_status_t osm_vl15_init(IN osm_vl15_t * p_vl, IN osm_vendor_t * p_vend,
+			      IN osm_log_t * p_log, IN osm_stats_t * p_stats,
+			      IN int32_t max_wire_smps,
+			      IN int32_t max_wire_smps2,
+			      IN uint32_t max_smps_timeout)
 {
 	ib_api_status_t status = IB_SUCCESS;
 
@@ -257,6 +258,9 @@ osm_vl15_init(IN osm_vl15_t * const p_vl,
 	p_vl->p_log = p_log;
 	p_vl->p_stats = p_stats;
 	p_vl->max_wire_smps = max_wire_smps;
+	p_vl->max_wire_smps2 = max_wire_smps2;
+	p_vl->max_smps_timeout = max_wire_smps < max_wire_smps2 ?
+				 max_smps_timeout : EVENT_NO_TIMEOUT;
 
 	status = cl_event_init(&p_vl->signal, FALSE);
 	if (status != IB_SUCCESS)
@@ -272,19 +276,14 @@ osm_vl15_init(IN osm_vl15_t * const p_vl,
 	   Initialize the thread after all other dependent objects
 	   have been initialized.
 	 */
-	status = cl_thread_init(&p_vl->poller, __osm_vl15_poller, p_vl,
+	status = cl_thread_init(&p_vl->poller, vl15_poller, p_vl,
 				"opensm poller");
-	if (status != IB_SUCCESS)
-		goto Exit;
-
 Exit:
 	OSM_LOG_EXIT(p_log);
-	return (status);
+	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_vl15_poll(IN osm_vl15_t * const p_vl)
+void osm_vl15_poll(IN osm_vl15_t * p_vl)
 {
 	OSM_LOG_ENTER(p_vl->p_log);
 
@@ -309,15 +308,13 @@ void osm_vl15_poll(IN osm_vl15_t * const p_vl)
 	OSM_LOG_EXIT(p_vl->p_log);
 }
 
-/**********************************************************************
- **********************************************************************/
-void osm_vl15_post(IN osm_vl15_t * const p_vl, IN osm_madw_t * const p_madw)
+void osm_vl15_post(IN osm_vl15_t * p_vl, IN osm_madw_t * p_madw)
 {
 	OSM_LOG_ENTER(p_vl->p_log);
 
 	CL_ASSERT(p_vl->state == OSM_VL15_STATE_READY);
 
-	OSM_LOG(p_vl->p_log, OSM_LOG_DEBUG, "Posting p_madw = 0x%p\n", p_madw);
+	OSM_LOG(p_vl->p_log, OSM_LOG_DEBUG, "Posting p_madw = %p\n", p_madw);
 
 	/*
 	   Determine in which fifo to place the pending madw.
@@ -340,9 +337,7 @@ void osm_vl15_post(IN osm_vl15_t * const p_vl, IN osm_madw_t * const p_madw)
 	OSM_LOG_EXIT(p_vl->p_log);
 }
 
-void
-osm_vl15_shutdown(IN osm_vl15_t * const p_vl,
-		  IN osm_mad_pool_t * const p_mad_pool)
+void osm_vl15_shutdown(IN osm_vl15_t * p_vl, IN osm_mad_pool_t * p_mad_pool)
 {
 	osm_madw_t *p_madw;
 
diff --git a/opensm/osm_vl_arb_rcv.c b/opensm/osm_vl_arb_rcv.c
index ec04d67..3967574 100644
--- a/opensm/osm_vl_arb_rcv.c
+++ b/opensm/osm_vl_arb_rcv.c
@@ -1,7 +1,9 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2010 HNR Consulting. All rights reserved.
+ * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -48,6 +50,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_VL_ARB_RCV_C
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
@@ -55,10 +59,8 @@
 #include <opensm/osm_helper.h>
 #include <opensm/osm_sm.h>
 
-/**********************************************************************
- **********************************************************************/
 /*
- * WE MIGHT ONLY RECEIVE GET or SET responses
+ * WE ONLY RECEIVE GET or SET responses
  */
 void osm_vla_rcv_process(IN void *context, IN void *data)
 {
@@ -83,7 +85,7 @@ void osm_vla_rcv_process(IN void *context, IN void *data)
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 
 	p_context = osm_madw_get_vla_context_ptr(p_madw);
-	p_vla_tbl = (ib_vl_arb_table_t *) ib_smp_get_payload_ptr(p_smp);
+	p_vla_tbl = ib_smp_get_payload_ptr(p_smp);
 
 	port_guid = p_context->port_guid;
 	node_guid = p_context->node_guid;
@@ -93,12 +95,10 @@ void osm_vla_rcv_process(IN void *context, IN void *data)
 	cl_plock_excl_acquire(sm->p_lock);
 	p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
 	if (!p_port) {
-		cl_plock_release(sm->p_lock);
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3F06: "
 			"No port object for port with GUID 0x%" PRIx64
 			"\n\t\t\t\tfor parent node GUID 0x%" PRIx64
-			", TID 0x%" PRIx64 "\n",
-			cl_ntoh64(port_guid),
+			", TID 0x%" PRIx64 "\n", cl_ntoh64(port_guid),
 			cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));
 		goto Exit;
 	}
@@ -117,8 +117,8 @@ void osm_vla_rcv_process(IN void *context, IN void *data)
 	}
 
 	/*
-	   We do not mind if this is a result of a set or get - all we want is to update
-	   the subnet.
+	   We do not care if this is a result of a set or get -
+	   all we want is to update the subnet.
 	 */
 	OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 		"Got GetResp(VLArb) block:%u port_num %u with GUID 0x%"
@@ -136,15 +136,14 @@ void osm_vla_rcv_process(IN void *context, IN void *data)
 		goto Exit;
 	}
 
-	osm_dump_vl_arb_table(sm->p_log,
-			      port_guid, block_num,
-			      port_num, p_vla_tbl, OSM_LOG_DEBUG);
-
 	if ((block_num < 1) || (block_num > 4)) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
 			"Got invalid block number 0x%X\n", block_num);
 		goto Exit;
 	}
+
+	osm_dump_vl_arb_table_v2(sm->p_log, port_guid, block_num, port_num,
+			         p_vla_tbl, FILE_ID, OSM_LOG_DEBUG);
 	osm_physp_set_vla_tbl(p_physp, p_vla_tbl, block_num);
 
 Exit:
diff --git a/opensm/st.c b/opensm/st.c
index c5a2f53..754648c 100644
--- a/opensm/st.c
+++ b/opensm/st.c
@@ -41,12 +41,10 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <opensm/osm_file_ids.h>
+#define FILE_ID OSM_FILE_ST_C
 #include <opensm/st.h>
 
-#ifdef _WIN32
-#include <malloc.h>
-#endif
-
 typedef struct st_table_entry st_table_entry;
 
 struct st_table_entry {
@@ -198,6 +196,8 @@ size_t size;
 #endif
 
 	size = new_size(size);	/* round up to prime number */
+	if (size < 0)
+		return NULL;
 
 	tbl = alloc(st_table);
 	tbl->type = type;
@@ -355,6 +355,9 @@ register st_table *table;
 	unsigned int hash_val;
 
 	new_num_bins = new_size(old_num_bins + 1);
+	if (new_num_bins < 0)
+		return;
+
 	new_bins =
 	    (st_table_entry **) Calloc(new_num_bins, sizeof(st_table_entry *));
 
diff --git a/osmeventplugin/Makefile.in b/osmeventplugin/Makefile.in
index 4c2dd80..38381ee 100644
--- a/osmeventplugin/Makefile.in
+++ b/osmeventplugin/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -17,8 +18,9 @@
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -37,27 +39,44 @@ subdir = osmeventplugin
 DIST_COMMON = $(libosmeventplugininclude_HEADERS) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
-	$(top_srcdir)/config/ltoptions.m4 \
-	$(top_srcdir)/config/ltsugar.m4 \
-	$(top_srcdir)/config/ltversion.m4 \
-	$(top_srcdir)/config/lt~obsolete.m4 \
-	$(top_srcdir)/config/osmvsel.m4 $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/osmvsel.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/include/config.h \
 	$(top_builddir)/include/opensm/osm_config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(libdir)" \
 	"$(DESTDIR)$(libosmeventpluginincludedir)"
-libLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(lib_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 am_libosmeventplugin_la_OBJECTS =  \
@@ -70,6 +89,7 @@ libosmeventplugin_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/include -I$(top_builddir)/include/opensm
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
+am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
@@ -81,7 +101,6 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(libosmeventplugin_la_SOURCES)
 DIST_SOURCES = $(libosmeventplugin_la_SOURCES)
-libosmeventpluginincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(libosmeventplugininclude_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -102,6 +121,7 @@ CYGPATH_W = @CYGPATH_W@
 DEFAULT_EVENT_PLUGIN = @DEFAULT_EVENT_PLUGIN@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -128,6 +148,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -146,9 +167,11 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PARTITION_CONFIG_FILE = @PARTITION_CONFIG_FILE@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PER_MOD_LOGGING_FILE = @PER_MOD_LOGGING_FILE@
 PREFIX_ROUTES_FILE = @PREFIX_ROUTES_FILE@
 QOS_POLICY_FILE = @QOS_POLICY_FILE@
 RANLIB = @RANLIB@
@@ -158,6 +181,7 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
 TARBALL = @TARBALL@
+TORUS2QOS_CONF_FILE = @TORUS2QOS_CONF_FILE@
 VERSION = @VERSION@
 YACC = @YACC@
 YFLAGS = @YFLAGS@
@@ -167,6 +191,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -199,7 +224,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -249,9 +273,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  osmeventplugin/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  osmeventplugin/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign osmeventplugin/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign osmeventplugin/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -269,23 +293,28 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
 	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
-	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	list2=; for p in $$list; do \
 	  if test -f $$p; then \
-	    f=$(am__strip_dir) \
-	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
-	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	    list2="$$list2 $$p"; \
 	  else :; fi; \
-	done
+	done; \
+	test -z "$$list2" || { \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+	}
 
 uninstall-libLTLIBRARIES:
 	@$(NORMAL_UNINSTALL)
-	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
-	  p=$(am__strip_dir) \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	for p in $$list; do \
+	  $(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
 	done
 
 clean-libLTLIBRARIES:
@@ -296,7 +325,7 @@ clean-libLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libosmeventplugin.la: $(libosmeventplugin_la_OBJECTS) $(libosmeventplugin_la_DEPENDENCIES) 
+libosmeventplugin.la: $(libosmeventplugin_la_OBJECTS) $(libosmeventplugin_la_DEPENDENCIES) $(EXTRA_libosmeventplugin_la_DEPENDENCIES) 
 	$(libosmeventplugin_la_LINK) -rpath $(libdir) $(libosmeventplugin_la_OBJECTS) $(libosmeventplugin_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -309,31 +338,31 @@ distclean-compile:
 
 .c.o:
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 
 .c.lo:
 @am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
 libosmeventplugin_la-osmeventplugin.lo: src/osmeventplugin.c
- at am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmeventplugin_la_CFLAGS) $(CFLAGS) -MT libosmeventplugin_la-osmeventplugin.lo -MD -MP -MF $(DEPDIR)/libosmeventplugin_la-osmeventplugin.Tpo -c -o libosmeventplugin_la-osmeventplugin.lo `test -f 'src/osmeventplugin.c' || echo '$(srcdir)/'`src/osmeventplugin.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libosmeventplugin_la-osmeventplugin.Tpo $(DEPDIR)/libosmeventplugin_la-osmeventplugin.Plo
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmeventplugin_la_CFLAGS) $(CFLAGS) -MT libosmeventplugin_la-osmeventplugin.lo -MD -MP -MF $(DEPDIR)/libosmeventplugin_la-osmeventplugin.Tpo -c -o libosmeventplugin_la-osmeventplugin.lo `test -f 'src/osmeventplugin.c' || echo '$(srcdir)/'`src/osmeventplugin.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libosmeventplugin_la-osmeventplugin.Tpo $(DEPDIR)/libosmeventplugin_la-osmeventplugin.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/osmeventplugin.c' object='libosmeventplugin_la-osmeventplugin.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmeventplugin_la_CFLAGS) $(CFLAGS) -c -o libosmeventplugin_la-osmeventplugin.lo `test -f 'src/osmeventplugin.c' || echo '$(srcdir)/'`src/osmeventplugin.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libosmeventplugin_la_CFLAGS) $(CFLAGS) -c -o libosmeventplugin_la-osmeventplugin.lo `test -f 'src/osmeventplugin.c' || echo '$(srcdir)/'`src/osmeventplugin.c
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -343,20 +372,21 @@ clean-libtool:
 install-libosmeventpluginincludeHEADERS: $(libosmeventplugininclude_HEADERS)
 	@$(NORMAL_INSTALL)
 	test -z "$(libosmeventpluginincludedir)" || $(MKDIR_P) "$(DESTDIR)$(libosmeventpluginincludedir)"
-	@list='$(libosmeventplugininclude_HEADERS)'; for p in $$list; do \
+	@list='$(libosmeventplugininclude_HEADERS)'; test -n "$(libosmeventpluginincludedir)" || list=; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(libosmeventpluginincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libosmeventpluginincludedir)/$$f'"; \
-	  $(libosmeventpluginincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libosmeventpluginincludedir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libosmeventpluginincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(libosmeventpluginincludedir)" || exit $$?; \
 	done
 
 uninstall-libosmeventpluginincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(libosmeventplugininclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(libosmeventpluginincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(libosmeventpluginincludedir)/$$f"; \
-	done
+	@list='$(libosmeventplugininclude_HEADERS)'; test -n "$(libosmeventpluginincludedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(libosmeventpluginincludedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -370,7 +400,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -378,29 +408,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -421,13 +456,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -448,16 +487,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -479,6 +524,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -487,18 +534,28 @@ install-data-am: install-libosmeventpluginincludeHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am: install-libLTLIBRARIES
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
@@ -540,6 +597,7 @@ uninstall-am: uninstall-libLTLIBRARIES \
 	uninstall-am uninstall-libLTLIBRARIES \
 	uninstall-libosmeventpluginincludeHEADERS
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/osmeventplugin/libosmeventplugin.ver b/osmeventplugin/libosmeventplugin.ver
index f755ff6..777bf15 100644
--- a/osmeventplugin/libosmeventplugin.ver
+++ b/osmeventplugin/libosmeventplugin.ver
@@ -6,4 +6,4 @@
 # API_REV - advance on any added API
 # RUNNING_REV - advance any change to the vendor files
 # AGE - number of backward versions the API still supports
-LIBVERSION=1:0:0
+LIBVERSION=1:2:0
diff --git a/osmeventplugin/src/osmeventplugin.c b/osmeventplugin/src/osmeventplugin.c
index f0781eb..aaf7e80 100644
--- a/osmeventplugin/src/osmeventplugin.c
+++ b/osmeventplugin/src/osmeventplugin.c
@@ -137,13 +137,21 @@ static void handle_port_select(_log_events_t * log, osm_epi_ps_event_t * ps)
 
 /** =========================================================================
  */
-static void handle_trap_event(_log_events_t * log, osm_epi_trap_event_t * trap)
+static void handle_trap_event(_log_events_t *log, ib_mad_notice_attr_t *p_ntc)
 {
-	fprintf(log->log_file,
-		"Trap event %d from 0x%" PRIx64 " (%s) port %d\n",
-		trap->trap_num,
-		trap->port_id.node_guid,
-		trap->port_id.node_name, trap->port_id.port_num);
+	if (ib_notice_is_generic(p_ntc)) {
+		fprintf(log->log_file,
+			"Generic trap type %d; event %d; from LID %u\n",
+			ib_notice_get_type(p_ntc),
+			cl_ntoh16(p_ntc->g_or_v.generic.trap_num),
+			cl_ntoh16(p_ntc->issuer_lid));
+	} else {
+		fprintf(log->log_file,
+			"Vendor trap type %d; from LID %u\n",
+			ib_notice_get_type(p_ntc),
+			cl_ntoh16(p_ntc->issuer_lid));
+	}
+
 }
 
 /** =========================================================================
@@ -163,13 +171,32 @@ static void report(void *_log, osm_epi_event_id_t event_id, void *event_data)
 		handle_port_select(log, (osm_epi_ps_event_t *) event_data);
 		break;
 	case OSM_EVENT_ID_TRAP:
-		handle_trap_event(log, (osm_epi_trap_event_t *) event_data);
+		handle_trap_event(log, (ib_mad_notice_attr_t *) event_data);
+		break;
+	case OSM_EVENT_ID_SUBNET_UP:
+		fprintf(log->log_file, "Subnet up reported\n");
+		break;
+	case OSM_EVENT_ID_HEAVY_SWEEP_START:
+		fprintf(log->log_file, "Heavy sweep started\n");
+		break;
+	case OSM_EVENT_ID_HEAVY_SWEEP_DONE:
+		fprintf(log->log_file, "Heavy sweep completed\n");
+		break;
+	case OSM_EVENT_ID_UCAST_ROUTING_DONE:
+		fprintf(log->log_file, "Unicast routing completed\n");
+		break;
+	case OSM_EVENT_ID_STATE_CHANGE:
+		fprintf(log->log_file, "SM state changed\n");
+		break;
+	case OSM_EVENT_ID_SA_DB_DUMPED:
+		fprintf(log->log_file, "SA DB dump file updated\n");
 		break;
 	case OSM_EVENT_ID_MAX:
 	default:
 		osm_log(log->osmlog, OSM_LOG_ERROR,
-			"Unknown event reported to plugin\n");
+			"Unknown event (%d) reported to plugin\n", event_id);
 	}
+	fflush(log->log_file);
 }
 
 /** =========================================================================
diff --git a/osmtest/Makefile.in b/osmtest/Makefile.in
index 3644788..2eb41d2 100644
--- a/osmtest/Makefile.in
+++ b/osmtest/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,8 +17,9 @@
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -37,20 +39,16 @@ sbin_PROGRAMS = osmtest$(EXEEXT)
 subdir = osmtest
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
-	$(top_srcdir)/config/ltoptions.m4 \
-	$(top_srcdir)/config/ltsugar.m4 \
-	$(top_srcdir)/config/ltversion.m4 \
-	$(top_srcdir)/config/lt~obsolete.m4 \
-	$(top_srcdir)/config/osmvsel.m4 $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/osmvsel.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/include/config.h \
 	$(top_builddir)/include/opensm/osm_config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 am__installdirs = "$(DESTDIR)$(sbindir)"
-sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(sbin_PROGRAMS)
 am__osmtest_SOURCES_DIST = main.c osmtest.c osmt_service.c \
 	osmt_slvl_vl_arb.c osmt_multicast.c osmt_inform.c \
@@ -70,6 +68,7 @@ osmtest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/include -I$(top_builddir)/include/opensm
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
+am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
@@ -100,6 +99,7 @@ CYGPATH_W = @CYGPATH_W@
 DEFAULT_EVENT_PLUGIN = @DEFAULT_EVENT_PLUGIN@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -126,6 +126,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -144,9 +145,11 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PARTITION_CONFIG_FILE = @PARTITION_CONFIG_FILE@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PER_MOD_LOGGING_FILE = @PER_MOD_LOGGING_FILE@
 PREFIX_ROUTES_FILE = @PREFIX_ROUTES_FILE@
 QOS_POLICY_FILE = @QOS_POLICY_FILE@
 RANLIB = @RANLIB@
@@ -156,6 +159,7 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
 TARBALL = @TARBALL@
+TORUS2QOS_CONF_FILE = @TORUS2QOS_CONF_FILE@
 VERSION = @VERSION@
 YACC = @YACC@
 YFLAGS = @YFLAGS@
@@ -165,6 +169,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -197,7 +202,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -239,9 +243,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  osmtest/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  osmtest/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign osmtest/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign osmtest/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -259,35 +263,51 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 install-sbinPROGRAMS: $(sbin_PROGRAMS)
 	@$(NORMAL_INSTALL)
 	test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
-	@list='$(sbin_PROGRAMS)'; for p in $$list; do \
-	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
-	  if test -f $$p \
-	     || test -f $$p1 \
-	  ; then \
-	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
-	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
-	  else :; fi; \
-	done
+	@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+	for p in $$list; do echo "$$p $$p"; done | \
+	sed 's/$(EXEEXT)$$//' | \
+	while read p p1; do if test -f $$p || test -f $$p1; \
+	  then echo "$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+	sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
+	    else { print "f", $$3 "/" $$4, $$1; } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	    test -z "$$files" || { \
+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
+	    } \
+	; done
 
 uninstall-sbinPROGRAMS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(sbin_PROGRAMS)'; for p in $$list; do \
-	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
-	  echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(sbindir)/$$f"; \
-	done
+	@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+	      -e 's/$$/$(EXEEXT)/' `; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(sbindir)" && rm -f $$files
 
 clean-sbinPROGRAMS:
-	@list='$(sbin_PROGRAMS)'; for p in $$list; do \
-	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
-	  echo " rm -f $$p $$f"; \
-	  rm -f $$p $$f ; \
-	done
-osmtest$(EXEEXT): $(osmtest_OBJECTS) $(osmtest_DEPENDENCIES) 
+	@list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+osmtest$(EXEEXT): $(osmtest_OBJECTS) $(osmtest_DEPENDENCIES) $(EXTRA_osmtest_DEPENDENCIES) 
 	@rm -f osmtest$(EXEEXT)
 	$(osmtest_LINK) $(osmtest_OBJECTS) $(osmtest_LDADD) $(LIBS)
 
@@ -307,119 +327,119 @@ distclean-compile:
 
 .c.o:
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 
 .c.lo:
 @am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
 osmtest-main.o: main.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -MT osmtest-main.o -MD -MP -MF $(DEPDIR)/osmtest-main.Tpo -c -o osmtest-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/osmtest-main.Tpo $(DEPDIR)/osmtest-main.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/osmtest-main.Tpo $(DEPDIR)/osmtest-main.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='main.c' object='osmtest-main.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -c -o osmtest-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c
 
 osmtest-main.obj: main.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -MT osmtest-main.obj -MD -MP -MF $(DEPDIR)/osmtest-main.Tpo -c -o osmtest-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/osmtest-main.Tpo $(DEPDIR)/osmtest-main.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/osmtest-main.Tpo $(DEPDIR)/osmtest-main.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='main.c' object='osmtest-main.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -c -o osmtest-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`
 
 osmtest-osmtest.o: osmtest.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -MT osmtest-osmtest.o -MD -MP -MF $(DEPDIR)/osmtest-osmtest.Tpo -c -o osmtest-osmtest.o `test -f 'osmtest.c' || echo '$(srcdir)/'`osmtest.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/osmtest-osmtest.Tpo $(DEPDIR)/osmtest-osmtest.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/osmtest-osmtest.Tpo $(DEPDIR)/osmtest-osmtest.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osmtest.c' object='osmtest-osmtest.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -c -o osmtest-osmtest.o `test -f 'osmtest.c' || echo '$(srcdir)/'`osmtest.c
 
 osmtest-osmtest.obj: osmtest.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -MT osmtest-osmtest.obj -MD -MP -MF $(DEPDIR)/osmtest-osmtest.Tpo -c -o osmtest-osmtest.obj `if test -f 'osmtest.c'; then $(CYGPATH_W) 'osmtest.c'; else $(CYGPATH_W) '$(srcdir)/osmtest.c'; fi`
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/osmtest-osmtest.Tpo $(DEPDIR)/osmtest-osmtest.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/osmtest-osmtest.Tpo $(DEPDIR)/osmtest-osmtest.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osmtest.c' object='osmtest-osmtest.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -c -o osmtest-osmtest.obj `if test -f 'osmtest.c'; then $(CYGPATH_W) 'osmtest.c'; else $(CYGPATH_W) '$(srcdir)/osmtest.c'; fi`
 
 osmtest-osmt_service.o: osmt_service.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -MT osmtest-osmt_service.o -MD -MP -MF $(DEPDIR)/osmtest-osmt_service.Tpo -c -o osmtest-osmt_service.o `test -f 'osmt_service.c' || echo '$(srcdir)/'`osmt_service.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/osmtest-osmt_service.Tpo $(DEPDIR)/osmtest-osmt_service.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/osmtest-osmt_service.Tpo $(DEPDIR)/osmtest-osmt_service.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osmt_service.c' object='osmtest-osmt_service.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -c -o osmtest-osmt_service.o `test -f 'osmt_service.c' || echo '$(srcdir)/'`osmt_service.c
 
 osmtest-osmt_service.obj: osmt_service.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -MT osmtest-osmt_service.obj -MD -MP -MF $(DEPDIR)/osmtest-osmt_service.Tpo -c -o osmtest-osmt_service.obj `if test -f 'osmt_service.c'; then $(CYGPATH_W) 'osmt_service.c'; else $(CYGPATH_W) '$(srcdir)/osmt_service.c'; fi`
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/osmtest-osmt_service.Tpo $(DEPDIR)/osmtest-osmt_service.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/osmtest-osmt_service.Tpo $(DEPDIR)/osmtest-osmt_service.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osmt_service.c' object='osmtest-osmt_service.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -c -o osmtest-osmt_service.obj `if test -f 'osmt_service.c'; then $(CYGPATH_W) 'osmt_service.c'; else $(CYGPATH_W) '$(srcdir)/osmt_service.c'; fi`
 
 osmtest-osmt_slvl_vl_arb.o: osmt_slvl_vl_arb.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -MT osmtest-osmt_slvl_vl_arb.o -MD -MP -MF $(DEPDIR)/osmtest-osmt_slvl_vl_arb.Tpo -c -o osmtest-osmt_slvl_vl_arb.o `test -f 'osmt_slvl_vl_arb.c' || echo '$(srcdir)/'`osmt_slvl_vl_arb.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/osmtest-osmt_slvl_vl_arb.Tpo $(DEPDIR)/osmtest-osmt_slvl_vl_arb.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/osmtest-osmt_slvl_vl_arb.Tpo $(DEPDIR)/osmtest-osmt_slvl_vl_arb.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osmt_slvl_vl_arb.c' object='osmtest-osmt_slvl_vl_arb.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -c -o osmtest-osmt_slvl_vl_arb.o `test -f 'osmt_slvl_vl_arb.c' || echo '$(srcdir)/'`osmt_slvl_vl_arb.c
 
 osmtest-osmt_slvl_vl_arb.obj: osmt_slvl_vl_arb.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -MT osmtest-osmt_slvl_vl_arb.obj -MD -MP -MF $(DEPDIR)/osmtest-osmt_slvl_vl_arb.Tpo -c -o osmtest-osmt_slvl_vl_arb.obj `if test -f 'osmt_slvl_vl_arb.c'; then $(CYGPATH_W) 'osmt_slvl_vl_arb.c'; else $(CYGPATH_W) '$(srcdir)/osmt_slvl_vl_arb.c'; fi`
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/osmtest-osmt_slvl_vl_arb.Tpo $(DEPDIR)/osmtest-osmt_slvl_vl_arb.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/osmtest-osmt_slvl_vl_arb.Tpo $(DEPDIR)/osmtest-osmt_slvl_vl_arb.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osmt_slvl_vl_arb.c' object='osmtest-osmt_slvl_vl_arb.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -c -o osmtest-osmt_slvl_vl_arb.obj `if test -f 'osmt_slvl_vl_arb.c'; then $(CYGPATH_W) 'osmt_slvl_vl_arb.c'; else $(CYGPATH_W) '$(srcdir)/osmt_slvl_vl_arb.c'; fi`
 
 osmtest-osmt_multicast.o: osmt_multicast.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -MT osmtest-osmt_multicast.o -MD -MP -MF $(DEPDIR)/osmtest-osmt_multicast.Tpo -c -o osmtest-osmt_multicast.o `test -f 'osmt_multicast.c' || echo '$(srcdir)/'`osmt_multicast.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/osmtest-osmt_multicast.Tpo $(DEPDIR)/osmtest-osmt_multicast.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/osmtest-osmt_multicast.Tpo $(DEPDIR)/osmtest-osmt_multicast.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osmt_multicast.c' object='osmtest-osmt_multicast.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -c -o osmtest-osmt_multicast.o `test -f 'osmt_multicast.c' || echo '$(srcdir)/'`osmt_multicast.c
 
 osmtest-osmt_multicast.obj: osmt_multicast.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -MT osmtest-osmt_multicast.obj -MD -MP -MF $(DEPDIR)/osmtest-osmt_multicast.Tpo -c -o osmtest-osmt_multicast.obj `if test -f 'osmt_multicast.c'; then $(CYGPATH_W) 'osmt_multicast.c'; else $(CYGPATH_W) '$(srcdir)/osmt_multicast.c'; fi`
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/osmtest-osmt_multicast.Tpo $(DEPDIR)/osmtest-osmt_multicast.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/osmtest-osmt_multicast.Tpo $(DEPDIR)/osmtest-osmt_multicast.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osmt_multicast.c' object='osmtest-osmt_multicast.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -c -o osmtest-osmt_multicast.obj `if test -f 'osmt_multicast.c'; then $(CYGPATH_W) 'osmt_multicast.c'; else $(CYGPATH_W) '$(srcdir)/osmt_multicast.c'; fi`
 
 osmtest-osmt_inform.o: osmt_inform.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -MT osmtest-osmt_inform.o -MD -MP -MF $(DEPDIR)/osmtest-osmt_inform.Tpo -c -o osmtest-osmt_inform.o `test -f 'osmt_inform.c' || echo '$(srcdir)/'`osmt_inform.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/osmtest-osmt_inform.Tpo $(DEPDIR)/osmtest-osmt_inform.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/osmtest-osmt_inform.Tpo $(DEPDIR)/osmtest-osmt_inform.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osmt_inform.c' object='osmtest-osmt_inform.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -c -o osmtest-osmt_inform.o `test -f 'osmt_inform.c' || echo '$(srcdir)/'`osmt_inform.c
 
 osmtest-osmt_inform.obj: osmt_inform.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -MT osmtest-osmt_inform.obj -MD -MP -MF $(DEPDIR)/osmtest-osmt_inform.Tpo -c -o osmtest-osmt_inform.obj `if test -f 'osmt_inform.c'; then $(CYGPATH_W) 'osmt_inform.c'; else $(CYGPATH_W) '$(srcdir)/osmt_inform.c'; fi`
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/osmtest-osmt_inform.Tpo $(DEPDIR)/osmtest-osmt_inform.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/osmtest-osmt_inform.Tpo $(DEPDIR)/osmtest-osmt_inform.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osmt_inform.c' object='osmtest-osmt_inform.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -c -o osmtest-osmt_inform.obj `if test -f 'osmt_inform.c'; then $(CYGPATH_W) 'osmt_inform.c'; else $(CYGPATH_W) '$(srcdir)/osmt_inform.c'; fi`
 
 osmtest-osmt_mtl_regular_qp.o: osmt_mtl_regular_qp.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -MT osmtest-osmt_mtl_regular_qp.o -MD -MP -MF $(DEPDIR)/osmtest-osmt_mtl_regular_qp.Tpo -c -o osmtest-osmt_mtl_regular_qp.o `test -f 'osmt_mtl_regular_qp.c' || echo '$(srcdir)/'`osmt_mtl_regular_qp.c
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/osmtest-osmt_mtl_regular_qp.Tpo $(DEPDIR)/osmtest-osmt_mtl_regular_qp.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/osmtest-osmt_mtl_regular_qp.Tpo $(DEPDIR)/osmtest-osmt_mtl_regular_qp.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osmt_mtl_regular_qp.c' object='osmtest-osmt_mtl_regular_qp.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -c -o osmtest-osmt_mtl_regular_qp.o `test -f 'osmt_mtl_regular_qp.c' || echo '$(srcdir)/'`osmt_mtl_regular_qp.c
 
 osmtest-osmt_mtl_regular_qp.obj: osmt_mtl_regular_qp.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -MT osmtest-osmt_mtl_regular_qp.obj -MD -MP -MF $(DEPDIR)/osmtest-osmt_mtl_regular_qp.Tpo -c -o osmtest-osmt_mtl_regular_qp.obj `if test -f 'osmt_mtl_regular_qp.c'; then $(CYGPATH_W) 'osmt_mtl_regular_qp.c'; else $(CYGPATH_W) '$(srcdir)/osmt_mtl_regular_qp.c'; fi`
- at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/osmtest-osmt_mtl_regular_qp.Tpo $(DEPDIR)/osmtest-osmt_mtl_regular_qp.Po
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/osmtest-osmt_mtl_regular_qp.Tpo $(DEPDIR)/osmtest-osmt_mtl_regular_qp.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='osmt_mtl_regular_qp.c' object='osmtest-osmt_mtl_regular_qp.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(osmtest_CFLAGS) $(CFLAGS) -c -o osmtest-osmt_mtl_regular_qp.obj `if test -f 'osmt_mtl_regular_qp.c'; then $(CYGPATH_W) 'osmt_mtl_regular_qp.c'; else $(CYGPATH_W) '$(srcdir)/osmt_mtl_regular_qp.c'; fi`
@@ -442,7 +462,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -450,29 +470,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -493,13 +518,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -520,16 +549,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -551,6 +586,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -559,18 +596,28 @@ install-data-am:
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am: install-sbinPROGRAMS
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
@@ -609,6 +656,7 @@ uninstall-am: uninstall-sbinPROGRAMS
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-sbinPROGRAMS
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/osmtest/include/osmtest_base.h b/osmtest/include/osmtest_base.h
index 7c33da3..6c980a3 100644
--- a/osmtest/include/osmtest_base.h
+++ b/osmtest/include/osmtest_base.h
@@ -48,19 +48,16 @@
 #endif
 
 #define OSMTEST_MAX_LINE_LEN	120
-#ifdef WIN32
-#define OSMTEST_FILE_PATH_MAX	4096
-#else
 #define OSMTEST_FILE_PATH_MAX	PATH_MAX
-#endif
 
 #define STRESS_SMALL_RMPP_THR 100000
 /*
-    Take long times when quering big clusters (over 40 nodes) , an average of : 0.25 sec for query
+    Take long times when querying big clusters (over 40 nodes), an average of : 0.25 sec for query
     each query receives 1000 records
 */
 #define STRESS_LARGE_RMPP_THR 4000
 #define STRESS_LARGE_PR_RMPP_THR 20000
+#define STRESS_GET_PR 100000
 
 extern const char *const p_file;
 
diff --git a/osmtest/main.c b/osmtest/main.c
index f87e33b..7b586e9 100644
--- a/osmtest/main.c
+++ b/osmtest/main.c
@@ -1,6 +1,7 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -54,14 +55,12 @@
 	Future versions could support multiple subents by
 	instantiating more than one osmtest object.
 */
-#define GUID_ARRAY_SIZE 64
+#define MAX_LOCAL_IBPORTS 64
 #define OSMT_DEFAULT_RETRY_COUNT 3
 #define OSMT_DEFAULT_TRANS_TIMEOUT_MILLISEC 1000
 #define OSMT_DEFAULT_TRAP_WAIT_TIMEOUT_SEC 10
 #define INVALID_GUID (0xFFFFFFFFFFFFFFFFULL)
 
-/**********************************************************************
- **********************************************************************/
 boolean_t osmt_is_debug(void)
 {
 #if defined( _DEBUG_ )
@@ -71,10 +70,6 @@ boolean_t osmt_is_debug(void)
 #endif				/* defined( _DEBUG_ ) */
 }
 
-/**********************************************************************
- **********************************************************************/
-void show_usage(void);
-
 void show_usage()
 {
 	printf
@@ -144,9 +139,10 @@ void show_usage()
 	       "          Stress test options are as follows:\n"
 	       "          OPT    Description\n"
 	       "          ---    -----------------\n"
-	       "          -s1  - Single-MAD response SA queries\n"
+	       "          -s1  - Single-MAD (RMPP) response SA queries\n"
 	       "          -s2  - Multi-MAD (RMPP) response SA queries\n"
 	       "          -s3  - Multi-MAD (RMPP) Path Record SA queries\n"
+	       "          -s4  - Single-MAD (non RMPP) get Path Record SA queries\n"
 	       "          Without -s, stress testing is not performed\n\n");
 	printf("-M\n"
 	       "--Multicast_Mode\n"
@@ -207,15 +203,12 @@ void show_usage()
 	       "          the transaction timeout with the -t option\n\n");
 }
 
-/**********************************************************************
- **********************************************************************/
-static void print_all_guids(IN osmtest_t * p_osmt);
 static void print_all_guids(IN osmtest_t * p_osmt)
 {
 	ib_api_status_t status;
-	uint32_t num_ports = GUID_ARRAY_SIZE;
-	ib_port_attr_t attr_array[GUID_ARRAY_SIZE];
-	int i;
+	uint32_t num_ports = MAX_LOCAL_IBPORTS;
+	ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS] = { {0} };
+	uint32_t i;
 
 	/*
 	   Call the transport layer for a list of local port
@@ -236,14 +229,12 @@ static void print_all_guids(IN osmtest_t * p_osmt)
 		       cl_hton64(attr_array[i].port_guid));
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_net64_t get_port_guid(IN osmtest_t * p_osmt, uint64_t port_guid)
 {
 	ib_api_status_t status;
-	uint32_t num_ports = GUID_ARRAY_SIZE;
-	ib_port_attr_t attr_array[GUID_ARRAY_SIZE];
-	int i;
+	uint32_t num_ports = MAX_LOCAL_IBPORTS;
+	ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS] = { {0} };
+	uint32_t i;
 
 	/*
 	   Call the transport layer for a list of local port
@@ -274,8 +265,6 @@ ib_net64_t get_port_guid(IN osmtest_t * p_osmt, uint64_t port_guid)
 	return 0;
 }
 
-/**********************************************************************
- **********************************************************************/
 int main(int argc, char *argv[])
 {
 	static osmtest_t osm_test;
@@ -370,7 +359,7 @@ int main(int argc, char *argv[])
 
 		case 'f':
 			/*
-			 * Specifies Flow .
+			 * Specifies Flow.
 			 */
 			if (strlen(optarg) > OSMTEST_FILE_PATH_MAX)
 				printf
@@ -424,7 +413,7 @@ int main(int argc, char *argv[])
 			/*
 			 * Specifies the max LID to search for during exploration.
 			 */
-			max_lid = atoi(optarg);
+			max_lid = (uint16_t) atoi(optarg);
 			printf("\tMAX-LID %u\n", max_lid);
 			break;
 
@@ -491,6 +480,9 @@ int main(int argc, char *argv[])
 			case 3:
 				printf("Large Path Record SA queries\n");
 				break;
+			case 4:
+				printf("SA Get Path Record queries\n");
+				break;
 			default:
 				printf("Unknown value %u (ignored)\n",
 				       opt.stress);
diff --git a/osmtest/osmt_inform.c b/osmtest/osmt_inform.c
index c252a4c..f06ec3f 100644
--- a/osmtest/osmt_inform.c
+++ b/osmtest/osmt_inform.c
@@ -596,7 +596,7 @@ osmt_init_inform_info_by_trap(IN osmtest_t * const p_osmt,
  * - try to unregister inform info (should succeed)
  * - register an inform info
  * - send a trap - sleep
- * - check that a Report(Notice) arrived that match the sent one
+ * - check that a Report(Notice) arrived that matches the sent trap
  *
  */
 ib_api_status_t osmt_run_inform_info_flow(IN osmtest_t * const p_osmt)
@@ -725,7 +725,7 @@ ib_api_status_t osmt_run_trap64_65_flow(IN osmtest_t * const p_osmt)
 	}
 
   /*--------------------- PREP -------------------------*/
-	if (osmt_mtl_mad_post_recv_bufs(&qp_ctx.qp_bind_hndl, qp_ctx.p_recv_buf, 1,	/* we need to reveive the report */
+	if (osmt_mtl_mad_post_recv_bufs(&qp_ctx.qp_bind_hndl, qp_ctx.p_recv_buf, 1,	/* we need to receive the report */
 					GRH_LEN + MAD_BLOCK_SIZE, 1) != 1) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0127: "
 			"Error posting recv bufs for trap 65\n");
diff --git a/osmtest/osmt_mtl_regular_qp.c b/osmtest/osmt_mtl_regular_qp.c
index 6374dc2..72015bf 100644
--- a/osmtest/osmt_mtl_regular_qp.c
+++ b/osmtest/osmt_mtl_regular_qp.c
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -235,7 +236,7 @@ VAPI_ret_t osmt_mtl_mad_create_mr(osmt_mtl_mad_res_t * res)
 	mr_in.r_key = 0;
 	mr_in.size = res->buf_size;
 	ASSERT_VOIDP2UINTN(res->buf_ptr);
-	mr_in.start = (VAPI_virt_addr_t) (uintn_t) (res->buf_ptr);
+	mr_in.start = (VAPI_virt_addr_t) (res->buf_ptr);
 	mr_in.type = VAPI_MR;
 
 	ret = VAPI_register_mr(res->hca_hndl, &mr_in, &(res->mr_hndl), &mr_out);
@@ -370,7 +371,7 @@ VAPI_ret_t osmt_mtl_mad_send(osmt_mtl_mad_res_t * res, VAPI_wr_id_t id,
 	sr.sg_lst_len = 1;
 	sr.sg_lst_p = &sg_entry;
 	ASSERT_VOIDP2UINTN(mad);
-	sg_entry.addr = (VAPI_virt_addr_t) (uintn_t) (mad);
+	sg_entry.addr = (VAPI_virt_addr_t) (mad);
 	sg_entry.len = MAD_SIZE;
 	sg_entry.lkey = res->l_key;
 
@@ -403,7 +404,7 @@ int osmt_mtl_mad_post_recv_bufs(osmt_mtl_mad_res_t * res, void *buf_array,
 	for (i = 0; i < num_o_bufs; i++) {
 		rr.id = start_id + i;	/* WQE id used is the index to buffers ptr array */
 		ASSERT_VOIDP2UINTN(cur_buf);
-		sg_entry.addr = (VAPI_virt_addr_t) (uintn_t) cur_buf;
+		sg_entry.addr = (VAPI_virt_addr_t) cur_buf;
 		sg_entry.len = size;
 		memset(cur_buf, 0x00, size);	/* fill with 0 */
 		ret = VAPI_post_rr(res->hca_hndl, res->qp_hndl, &rr);
diff --git a/osmtest/osmt_multicast.c b/osmtest/osmt_multicast.c
index 165457c..b861ad4 100644
--- a/osmtest/osmt_multicast.c
+++ b/osmtest/osmt_multicast.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2010 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -51,9 +52,6 @@
 #include <complib/cl_list.h>
 #include "osmtest.h"
 
-/**********************************************************************
- **********************************************************************/
-
 static void __osmt_print_all_multicast_records(IN osmtest_t * const p_osmt)
 {
 	uint32_t i;
@@ -68,7 +66,6 @@ static void __osmt_print_all_multicast_records(IN osmtest_t * const p_osmt)
 	memset(&user, 0, sizeof(user));
 
 	user.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;
-	user.attr_offset = ib_get_attr_offset(sizeof(*mcast_record));
 
 	req.query_type = OSMV_QUERY_USER_DEFINED;
 	req.timeout_ms = p_osmt->opt.transaction_timeout;
@@ -126,9 +123,6 @@ static void __osmt_print_all_multicast_records(IN osmtest_t * const p_osmt)
 
 }
 
-/**********************************************************************
- **********************************************************************/
-
 static cl_status_t
 __match_mgids(IN const void *const p_object, IN void *context)
 {
@@ -143,9 +137,6 @@ __match_mgids(IN const void *const p_object, IN void *context)
 		return CL_NOT_FOUND;
 }
 
-/**********************************************************************
- **********************************************************************/
-
 ib_api_status_t osmt_query_mcast(IN osmtest_t * const p_osmt)
 {
 	ib_api_status_t status = IB_SUCCESS;
@@ -176,7 +167,6 @@ ib_api_status_t osmt_query_mcast(IN osmtest_t * const p_osmt)
 
 	context.p_osmt = p_osmt;
 	user.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;
-	user.attr_offset = ib_get_attr_offset(sizeof(ib_member_rec_t));
 
 	req.query_type = OSMV_QUERY_USER_DEFINED;
 	req.timeout_ms = p_osmt->opt.transaction_timeout;
@@ -199,13 +189,12 @@ ib_api_status_t osmt_query_mcast(IN osmtest_t * const p_osmt)
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0264: "
 			"ib_query failed (%s)\n", ib_get_err_str(status));
-		if (status == IB_REMOTE_ERROR) {
+		if (status == IB_REMOTE_ERROR)
 			OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,
 				"Remote error = %s.\n",
 				ib_get_mad_status_str(osm_madw_get_mad_ptr
 						      (context.result.
 						       p_result_madw)));
-		}
 		goto Exit;
 	}
 
@@ -217,7 +206,6 @@ ib_api_status_t osmt_query_mcast(IN osmtest_t * const p_osmt)
 		p_next_item = cl_qmap_next(p_item);
 		cl_qmap_remove_item(&p_osmt->exp_subn.mgrp_mlid_tbl, p_item);
 		free(p_item);
-
 	}
 
 	cl_list_construct(&mgids_list);
@@ -275,9 +263,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
-
 /* given a multicast request send and wait for response. */
 ib_api_status_t
 osmt_send_mcast_request(IN osmtest_t * const p_osmt,
@@ -307,24 +292,22 @@ osmt_send_mcast_request(IN osmtest_t * const p_osmt,
 	user.p_attr = p_mc_req;
 	user.comp_mask = comp_mask;
 
-	if (is_set == 1) {
+	if (is_set == 1)
 		req.query_type = OSMV_QUERY_UD_MULTICAST_SET;
-	} else if (is_set == 0) {
+	else if (is_set == 0)
 		req.query_type = OSMV_QUERY_UD_MULTICAST_DELETE;
-	} else if (is_set == 0xee) {
+	else if (is_set == 0xee) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
 			"Set USER DEFINED QUERY\n");
 		req.query_type = OSMV_QUERY_USER_DEFINED;
 		user.method = IB_MAD_METHOD_GET;
 		user.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;
-		user.attr_offset = ib_get_attr_offset(sizeof(ib_member_rec_t));
 	} else if (is_set == 0xff) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
 			"Set USER DEFINED QUERY\n");
 		req.query_type = OSMV_QUERY_USER_DEFINED;
 		user.method = IB_MAD_METHOD_SET;
 		user.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;
-		user.attr_offset = ib_get_attr_offset(sizeof(ib_member_rec_t));
 	}
 
 	/* TODO : Check the validity of all user fields in order to use
@@ -353,8 +336,7 @@ osmt_send_mcast_request(IN osmtest_t * const p_osmt,
 	}
 
 	/* ok it worked */
-	memcpy(p_res,
-	       osm_madw_get_mad_ptr(context.result.p_result_madw),
+	memcpy(p_res, osm_madw_get_mad_ptr(context.result.p_result_madw),
 	       sizeof(ib_sa_mad_t));
 
 	status = context.result.status;
@@ -362,13 +344,12 @@ osmt_send_mcast_request(IN osmtest_t * const p_osmt,
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0224: "
 			"ib_query failed (%s)\n", ib_get_err_str(status));
-		if (status == IB_REMOTE_ERROR) {
+		if (status == IB_REMOTE_ERROR)
 			OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,
 				"Remote error = %s\n",
 				ib_get_mad_status_str(osm_madw_get_mad_ptr
 						      (context.result.
 						       p_result_madw)));
-		}
 	}
 
 Exit:
@@ -385,12 +366,8 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
-
-void
-osmt_init_mc_query_rec(IN osmtest_t * const p_osmt,
-		       IN OUT ib_member_rec_t * p_mc_req)
+void osmt_init_mc_query_rec(IN osmtest_t * const p_osmt,
+			    IN OUT ib_member_rec_t * p_mc_req)
 {
 	/* use default values so we can change only what we want later */
 	memset(p_mc_req, 0, sizeof(ib_member_rec_t));
@@ -398,8 +375,7 @@ osmt_init_mc_query_rec(IN osmtest_t * const p_osmt,
 	/* we leave the MGID to the user */
 	memcpy(&p_mc_req->port_gid.unicast.interface_id,
 	       &p_osmt->local_port.port_guid,
-	       sizeof(p_osmt->local_port.port_guid)
-	    );
+	       sizeof(p_osmt->local_port.port_guid));
 
 	/*  use our own subnet prefix: */
 	p_mc_req->port_gid.unicast.prefix = CL_HTON64(0xFE80000000000000ULL);
@@ -409,7 +385,7 @@ osmt_init_mc_query_rec(IN osmtest_t * const p_osmt,
 	/*  uint8_t     mtu; - keep it zero means - anything you have please. */
 	/*  uint8_t     tclass; can leave as zero for now (between subnets) */
 	/*  ib_net16_t  pkey; leave as zero */
-	p_mc_req->rate = IB_LINK_WIDTH_ACTIVE_4X;
+	p_mc_req->rate = IB_PATH_RECORD_RATE_2_5_GBS;
 	/*  uint8_t     pkt_life; zero means greater than zero ... */
 	/*  ib_net32_t  sl_flow_hop; keep it all zeros */
 	/*  we want to use a link local scope: 0x02 */
@@ -470,8 +446,12 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	char gid_str2[INET6_ADDRSTRLEN];
 	ib_api_status_t status;
 	ib_member_rec_t mc_req_rec;
+	union {
+		ib_sa_mad_t sa_mad;
+		ib_member_rec_t mcmr;
+	} res;
+	ib_sa_mad_t *sa_mad;
 	ib_member_rec_t *p_mc_res;
-	ib_sa_mad_t res_sa_mad;
 	uint64_t comp_mask = 0;
 	ib_net64_t remote_port_guid = 0x0;
 	cl_qmap_t *p_mgrp_mlid_tbl;
@@ -479,7 +459,6 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	ib_gid_t special_mgid, tmp_mgid, proxy_mgid;
 	ib_net16_t invalid_mlid = 0x0;
 	ib_net16_t max_mlid = cl_hton16(0xFFFE), tmp_mlid;
-	boolean_t ReachedMlidLimit = FALSE;
 	int start_cnt = 0, cnt, middle_cnt = 0, end_cnt = 0;
 	int start_ipoib_cnt = 0, end_ipoib_cnt = 0;
 	int mcg_outside_test_cnt = 0, fail_to_delete_mcg = 0;
@@ -488,7 +467,6 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	uint32_t num_recs = 0, i;
 	uint8_t mtu_phys = 0, rate_phys = 0;
 	cl_map_t test_created_mlids;	/* List of all mlids created in this test */
-	ib_member_rec_t *p_recvd_rec;
 	boolean_t got_error = FALSE;
 
 	static ib_gid_t good_mgid = {
@@ -541,7 +519,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "GetTable of all current MCGs...\n");
 	status = osmt_query_mcast(p_osmt);
 	if (status != IB_SUCCESS) {
-		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 2FF "
+		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02FF "
 			"GetTable of all records has failed!\n");
 		goto Exit;
 	}
@@ -553,7 +531,8 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	p_mgrp_mlid_tbl = &p_osmt->exp_subn.mgrp_mlid_tbl;
 	osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
 
-	p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
+	sa_mad = &res.sa_mad;
+	p_mc_res = ib_sa_mad_get_payload_ptr(sa_mad);
 
 	/* Only when we are on single mode check flow - do the count comparison, otherwise skip */
 	if (p_osmt->opt.mmode == 1 || p_osmt->opt.mmode == 3) {
@@ -578,9 +557,9 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	/* scan all available multicast groups in the DB and fill in the table */
 	while (p_mgrp != (osmtest_mgrp_t *) cl_qmap_end(p_mgrp_mlid_tbl)) {
 		/* search for ipoib mgid */
-		if (IS_IPOIB_MGID(&p_mgrp->mcmember_rec.mgid)) {
+		if (IS_IPOIB_MGID(&p_mgrp->mcmember_rec.mgid))
 			start_ipoib_cnt++;
-		} else {
+		else {
 			OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
 				"Non-IPoIB MC Groups exist: mgid=%s\n",
 				inet_ntop(AF_INET6,
@@ -610,8 +589,8 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 		    IB_MCR_COMPMASK_JOIN_STATE;
 
 		status = osmt_send_mcast_request(p_osmt, 0xff,	/* User Defined query Set */
-						 &mc_req_rec,
-						 comp_mask, &res_sa_mad);
+						 &mc_req_rec, comp_mask,
+						 sa_mad);
 
 		OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
 			"Joining an existing IPoIB multicast group\n");
@@ -631,7 +610,6 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 			goto Exit;
 		}
 		/* Check MTU & Rate Value and resend with SA suggested values */
-		p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
 
 		/* Prepare the mc_req_rec for the rest of the flow */
 		osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
@@ -667,8 +645,8 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 			"Sending attributes of MCG : \n\t\tMTU=0x%02X, RATE=0x%02X\n",
 			mc_req_rec.mtu, mc_req_rec.rate);
 		status = osmt_send_mcast_request(p_osmt, 0xff,	/* User Defined query */
-						 &mc_req_rec,
-						 comp_mask, &res_sa_mad);
+						 &mc_req_rec, comp_mask,
+						 sa_mad);
 		OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
 			"Sent Join request using response values, response is : %s\n",
 			ib_get_err_str(status));
@@ -695,11 +673,11 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
 	status = osmt_send_mcast_request(p_osmt, 0xee,	/* User Defined query Get */
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+					 &mc_req_rec, comp_mask, sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if (status == IB_SUCCESS) {
-		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 2E0 "
+		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02E0 "
 			"SubnAdmGet with invalid mlid 0x%x succeeded\n",
 			cl_ntoh16(mc_req_rec.mlid));
 		status = IB_ERROR;
@@ -724,11 +702,11 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
 	status = osmt_send_mcast_request(p_osmt, 0xee,	/* User Defined query Get */
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+					 &mc_req_rec, comp_mask, sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if (status == IB_SUCCESS) {
-		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 2E4 "
+		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02E4 "
 			"SubnAdmGet with invalid port guid succeeded\n");
 		status = IB_ERROR;
 		goto Exit;
@@ -751,22 +729,24 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 
 	comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
 	    /* IB_MCR_COMPMASK_QKEY |  */
-	    /* IB_MCR_COMPMASK_PKEY | intentionaly missed to raise the error */
+	    /* IB_MCR_COMPMASK_PKEY | intentionally missed to raise the error */
 	    IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
-	if (status != IB_REMOTE_ERROR ||
-	    ((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
-	    IB_SA_MAD_STATUS_INSUF_COMPS) {
+	if (((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=
+	     IB_SA_MAD_STATUS_INSUF_COMPS)
+		OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
+			"Expected IB_SA_MAD_STATUS_INSUF_COMPS got:%s\n",
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
+	if (status != IB_REMOTE_ERROR) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02EE: "
-			"Expectedd REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
-			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			"Expected REMOTE ERROR got:%s\n",
+			ib_get_err_str(status));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -777,28 +757,30 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	/* no MGID */
 	memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
 	/* Request Join */
+	mc_req_rec.pkey = IB_DEFAULT_PKEY;
 	ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
 
 	comp_mask =
-	    IB_MCR_COMPMASK_MGID |
-	    IB_MCR_COMPMASK_PORT_GID |
+	    IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
 	    IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY |
 	    /* IB_MCR_COMPMASK_SL |  */
 	    IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
-	if (status != IB_REMOTE_ERROR ||
-	    ((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
-	    IB_SA_MAD_STATUS_INSUF_COMPS) {
+	if (((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=
+	     IB_SA_MAD_STATUS_INSUF_COMPS)
+		OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
+			"Expected IB_SA_MAD_STATUS_INSUF_COMPS got:%s\n",
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
+	if (status != IB_REMOTE_ERROR) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02ED: "
-			"Expectedd REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
-			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			"Expected REMOTE ERROR got:%s\n",
+			ib_get_err_str(status));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -809,159 +791,157 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 
 	mc_req_rec.mgid.raw[15] = 0x01;
 
-	p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
-
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
 		"Checking Join with insufficient comp mask - flow label (o15.0.1.3)...\n");
 
 	/* Request Join */
+	mc_req_rec.pkey = IB_DEFAULT_PKEY;
 	ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
 
 	comp_mask =
-	    IB_MCR_COMPMASK_MGID |
-	    IB_MCR_COMPMASK_PORT_GID |
+	    IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
 	    IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL |
-	    /* IB_MCR_COMPMASK_FLOW | intentionaly missed to raise the error */
+	    /* IB_MCR_COMPMASK_FLOW | intentionally missed to raise the error */
 	    IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
-	if (status != IB_REMOTE_ERROR ||
-	    ((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
-	    IB_SA_MAD_STATUS_INSUF_COMPS) {
+	if (((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=
+	     IB_SA_MAD_STATUS_INSUF_COMPS)
+		OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
+			"Expected IB_SA_MAD_STATUS_INSUF_COMPS got:%s\n",
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
+	if (status != IB_REMOTE_ERROR) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02EC: "
-			"Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
-			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			"Expected REMOTE ERROR got:%s\n",
+			ib_get_err_str(status));
 		status = IB_ERROR;
 		goto Exit;
 	}
 
 	osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
 
-	p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
-
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
 		"Checking Join with insufficient comp mask - tclass (o15.0.1.3)...\n");
 
 	/* Request Join */
+	mc_req_rec.pkey = IB_DEFAULT_PKEY;
 	ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
 
 	comp_mask =
-	    IB_MCR_COMPMASK_MGID |
-	    IB_MCR_COMPMASK_PORT_GID |
-	    IB_MCR_COMPMASK_QKEY |
-	    IB_MCR_COMPMASK_PKEY |
-	    IB_MCR_COMPMASK_SL |
+	    IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
+	    IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL |
 	    IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE |
 	    /* IB_MCR_COMPMASK_TCLASS |  Intentionally missed to raise an error */
 	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
-	if (status != IB_REMOTE_ERROR ||
-	    ((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
-	    IB_SA_MAD_STATUS_INSUF_COMPS) {
+	if (((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=
+	     IB_SA_MAD_STATUS_INSUF_COMPS)
+		OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
+			"Expected IB_SA_MAD_STATUS_INSUF_COMPS got:%s\n",
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
+	if (status != IB_REMOTE_ERROR) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02EA: "
-			"Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
-			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			"Expected REMOTE ERROR got:%s\n",
+			ib_get_err_str(status));
 		status = IB_ERROR;
 		goto Exit;
 	}
 
 	osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
 
-	p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
-
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
 		"Checking Join with insufficient comp mask - tclass qkey (o15.0.1.3)...\n");
 
 	/* no MGID */
 	/* memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t)); */
 	/* Request Join */
+	mc_req_rec.pkey = IB_DEFAULT_PKEY;
 	ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
 
 	comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
-	    /* IB_MCR_COMPMASK_QKEY | intentionaly missed to raise the error */
-	    IB_MCR_COMPMASK_PKEY |
-	    IB_MCR_COMPMASK_SL |
+	    /* IB_MCR_COMPMASK_QKEY | intentionally missed to raise the error */
+	    IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL |
 	    IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE |
-	    /* IB_MCR_COMPMASK_TCLASS |  intentionaly missed to raise the error */
+	    /* IB_MCR_COMPMASK_TCLASS |  intentionally missed to raise the error */
 	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
-	if (status != IB_REMOTE_ERROR ||
-	    ((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
-	    IB_SA_MAD_STATUS_INSUF_COMPS) {
+	if (((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=
+	     IB_SA_MAD_STATUS_INSUF_COMPS)
+		OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
+			"Expected IB_SA_MAD_STATUS_INSUF_COMPS got:%s\n",
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
+	if (status != IB_REMOTE_ERROR) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02E9: "
-			"Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
-			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			"Expected REMOTE ERROR got:%s\n",
+			ib_get_err_str(status));
 		status = IB_ERROR;
 		goto Exit;
 	}
 
 	/* o15.0.1.8: */
-	/* - Request join with irrelevant RATE : get a ERR_INSUFFICIENT_COMPONENTS */
+	/* - Request join with unrealistic RATE : get REQ INVALID status */
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
 		"Checking Join with unrealistic rate (o15.0.1.8)...\n");
 
 	/* impossible requested rate */
 	mc_req_rec.rate =
-	    IB_LINK_WIDTH_ACTIVE_12X | IB_PATH_SELECTOR_GREATER_THAN << 6;
+	    IB_PATH_RECORD_RATE_56_GBS | IB_PATH_SELECTOR_GREATER_THAN << 6;
 
 	comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if (status != IB_REMOTE_ERROR ||
-	    res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID) {
+	    sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0207: "
 			"Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
 
 	/* Check Valid value which is unreasonable now */
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
-		"Checking Join with unrealistic rate 120GB (o15.0.1.8)...\n");
+		"Checking Join with unrealistic rate 300GB (o15.0.1.8)...\n");
 
 	/* impossible requested rate */
 	mc_req_rec.rate =
-	    IB_PATH_RECORD_RATE_120_GBS | IB_PATH_SELECTOR_GREATER_THAN << 6;
+	    IB_PATH_RECORD_RATE_300_GBS | IB_PATH_SELECTOR_GREATER_THAN << 6;
 
 	comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if (status != IB_REMOTE_ERROR ||
-	    res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID) {
+	    sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0208: "
 			"Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -978,16 +958,16 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if (status != IB_REMOTE_ERROR ||
-	    res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID) {
+	    sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AB: "
 			"Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -1004,17 +984,16 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	    IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if (status != IB_REMOTE_ERROR ||
-	    res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID) {
+	    sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AC: "
 			"Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad))
-		    );
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -1031,16 +1010,16 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	    IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if (status != IB_REMOTE_ERROR ||
-	    res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID) {
+	    sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AD: "
 			"Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -1055,16 +1034,16 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	    IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if (status != IB_REMOTE_ERROR ||
-	    res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID) {
+	    sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AE: "
 			"Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -1081,16 +1060,16 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	    IB_MCR_COMPMASK_LIFE | IB_MCR_COMPMASK_LIFE_SEL;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if (status != IB_REMOTE_ERROR ||
-	    res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID) {
+	    sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AF: "
 			"Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -1105,45 +1084,44 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 
 	osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
 
-	p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
-
 	/* no MGID */
 	memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
 	/* Request Join */
+	mc_req_rec.pkey = IB_DEFAULT_PKEY;
 	ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
 
 	comp_mask =
-	    IB_MCR_COMPMASK_MGID |
-	    IB_MCR_COMPMASK_PORT_GID |
+	    IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
 	    IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY |
 	    /* IB_MCR_COMPMASK_SL | Intentionally missed */
 	    IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
-	if (status != IB_REMOTE_ERROR ||
-	    ((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
-	    IB_SA_MAD_STATUS_INSUF_COMPS) {
+	if (((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=
+	     IB_SA_MAD_STATUS_INSUF_COMPS)
+		OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
+			"Expected IB_SA_MAD_STATUS_INSUF_COMPS got:%s\n",
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
+	if (status != IB_REMOTE_ERROR) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02A8: "
-			"Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
-			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			"Expected REMOTE ERROR got:%s\n",
+			ib_get_err_str(status));
 		status = IB_ERROR;
 		goto Exit;
 	}
 
 	/* Check that no same MCG in the SMDB */
 	status = osmt_query_mcast(p_osmt);
-
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AA: "
 			"Could not get all MC Records in subnet, got:%s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
@@ -1153,12 +1131,11 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 		OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "(post false create): "
 			"Number of MC Records found in SA DB is %d\n",
 			middle_cnt);
-		if (middle_cnt != start_cnt) {
+		if (middle_cnt != start_cnt)
 			OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
 				"Got different number of records stored in SA DB (before any creation)\n"
 				"Instead of %d got %d\n", start_cnt,
 				middle_cnt);
-		}
 	}
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
@@ -1166,8 +1143,6 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 
 	osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
 
-	p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
-
 	/* no MGID */
 	memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
 	/* Request Join */
@@ -1180,17 +1155,19 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
-	if (status != IB_REMOTE_ERROR ||
-	    ((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
-	    IB_SA_MAD_STATUS_INSUF_COMPS) {
+	if (((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=
+	     IB_SA_MAD_STATUS_INSUF_COMPS)
+		OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
+			"Expected IB_SA_MAD_STATUS_INSUF_COMPS got:%s\n",
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
+	if (status != IB_REMOTE_ERROR) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02A7: "
-			"Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
-			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			"Expected REMOTE ERROR got:%s\n",
+			ib_get_err_str(status));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -1204,100 +1181,88 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 
 	osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
 
-	p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
-
 	/* no MGID */
 	memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
 	/* Request Join */
+	mc_req_rec.pkey = IB_DEFAULT_PKEY;
 	ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
 
 	comp_mask =
-	    IB_MCR_COMPMASK_MGID |
-	    IB_MCR_COMPMASK_PORT_GID |
-	    IB_MCR_COMPMASK_QKEY |
-	    IB_MCR_COMPMASK_PKEY |
-	    IB_MCR_COMPMASK_SL |
+	    IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
+	    IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL |
 	    IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE |
 	    /* IB_MCR_COMPMASK_TCLASS |  Intentionally missed */
 	    /* all above are required */
 	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
-	if (status != IB_REMOTE_ERROR ||
-	    ((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
-	    IB_SA_MAD_STATUS_INSUF_COMPS) {
+	if (((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=
+	     IB_SA_MAD_STATUS_INSUF_COMPS)
+		OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
+			"Expected IB_SA_MAD_STATUS_INSUF_COMPS got:%s\n",
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
+	if (status != IB_REMOTE_ERROR) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02A6: "
-			"Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
-			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			"Expected REMOTE ERROR got:%s\n",
+			ib_get_err_str(status));
 		status = IB_ERROR;
 		goto Exit;
 	}
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
 		"Checking Create given MGID=0 valid Set several options :\n\t\t"
-		"First above min RATE, Second less than max RATE\n\t\t"
-		"Third above min MTU, Second less than max MTU\n\t\t"
+		"First any RATE, Second less than max RATE\n\t\t"
+		"Third above min MTU, Fourth less than max MTU\n\t\t"
 		"Fifth exact MTU & RATE feasible, Sixth exact RATE feasible\n\t\t"
 		"Seventh exact MTU feasible (o15.0.1.4)...\n");
 
 	/* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */
 
-	mc_req_rec.rate =
-	    IB_LINK_WIDTH_ACTIVE_1X | IB_PATH_SELECTOR_GREATER_THAN << 6;
+	comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS;	/* all above are required */
 
-	comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
-	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
-
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02A5: "
 			"Failed to create MCG for MGID=0 with higher than minimum RATE - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
 	/* Save the mlid created in test_created_mlids map */
-	p_recvd_rec =
-	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "created MGID:%s MLID:0x%04X\n",
-		inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
-			  sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
-	cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
-		      p_recvd_rec);
+		inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,
+			  sizeof gid_str), cl_ntoh16(p_mc_res->mlid));
+	cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);
 
 	/* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */
 
 	mc_req_rec.rate =
-	    IB_LINK_WIDTH_ACTIVE_12X | IB_PATH_SELECTOR_LESS_THAN << 6;
+	    IB_PATH_RECORD_RATE_60_GBS | IB_PATH_SELECTOR_LESS_THAN << 6;
 
 	comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0211: "
 			"Failed to create MCG for MGID=0 with less than highest RATE - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
 	/* Save the mlid created in test_created_mlids map */
-	p_recvd_rec =
-	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
-		inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
-			  sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
-	cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
-		      p_recvd_rec);
+		inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,
+			  sizeof gid_str), cl_ntoh16(p_mc_res->mlid));
+	cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);
 
 	/* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */
 
@@ -1306,24 +1271,21 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0238: "
 			"Failed to create MCG for MGID=0 with less than highest MTU - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
 	/* Save the mlid created in test_created_mlids map */
-	p_recvd_rec =
-	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
-		inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
-			  sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
-	cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
-		      p_recvd_rec);
+		inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,
+			  sizeof gid_str), cl_ntoh16(p_mc_res->mlid));
+	cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);
 
 	/* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */
 	mc_req_rec.mtu = IB_MTU_LEN_256 | IB_PATH_SELECTOR_GREATER_THAN << 6;
@@ -1331,24 +1293,21 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0239: "
 			"Failed to create MCG for MGID=0 with higher than lowest MTU - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
 	/* Save the mlid created in test_created_mlids map */
-	p_recvd_rec =
-	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
-		inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
-			  sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
-	cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
-		      p_recvd_rec);
+		inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,
+			  sizeof gid_str), cl_ntoh16(p_mc_res->mlid));
+	cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);
 
 	/* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */
 	/* Using Exact feasible MTU & RATE */
@@ -1365,25 +1324,21 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	    IB_MCR_COMPMASK_MTU |
 	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
-
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0240: "
 			"Failed to create MCG for MGID=0 with exact MTU & RATE - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
 	/* Save the mlid created in test_created_mlids map */
-	p_recvd_rec =
-	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
-		inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
-			  sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
-	cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
-		      p_recvd_rec);
+		inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,
+			  sizeof gid_str), cl_ntoh16(p_mc_res->mlid));
+	cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);
 
 	/* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */
 	/* Using Exact feasible RATE */
@@ -1396,24 +1351,21 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0241: "
 			"Failed to create MCG for MGID=0 with exact RATE - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
 	/* Save the mlid created in test_created_mlids map */
-	p_recvd_rec =
-	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
-		inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
-			  sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
-	cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
-		      p_recvd_rec);
+		inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,
+			  sizeof gid_str), cl_ntoh16(p_mc_res->mlid));
+	cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);
 
 	/* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */
 	/* Using Exact feasible MTU */
@@ -1426,24 +1378,21 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0242: "
 			"Failed to create MCG for MGID=0 with exact MTU - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
 	/* Save the mlid created in test_created_mlids map */
-	p_recvd_rec =
-	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
-		inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
-			  sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
-	cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
-		      p_recvd_rec);
+		inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,
+			  sizeof gid_str), cl_ntoh16(p_mc_res->mlid));
+	cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);
 
 	/* o15.0.1.5: */
 	/* - Check the returned MGID is valid. (p 804) */
@@ -1473,11 +1422,10 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 
 	osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
 
-	p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
-
 	/* no MGID */
 	memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
 	/* Request Join */
+	mc_req_rec.pkey = IB_DEFAULT_PKEY;
 	ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
 
 	mc_req_rec.pkt_life = 0 | IB_PATH_SELECTOR_GREATER_THAN << 6;
@@ -1485,28 +1433,26 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_LIFE | IB_MCR_COMPMASK_LIFE_SEL;
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0210: "
 			"Failed to create MCG for MGID=0 - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
 	/* Save the mlid created in test_created_mlids map */
-	p_recvd_rec =
-	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
-		inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
-			  sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
-	cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
-		      p_recvd_rec);
+		inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,
+			  sizeof gid_str), cl_ntoh16(p_mc_res->mlid));
+	cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);
 
 	/* o15.0.1.6: */
 	/* - Create a new MCG with valid requested MGID. */
 	osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
+	mc_req_rec.pkey = IB_DEFAULT_PKEY;
 	mc_req_rec.mgid = good_mgid;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
@@ -1522,15 +1468,15 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
 	status = osmt_send_mcast_request(p_osmt, 1,	/* join */
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+					 &mc_req_rec, comp_mask, sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if ((status != IB_REMOTE_ERROR) ||
-	    (res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
+	    (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0301: "
 			"Tried joining group that shouldn't have existed - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -1543,25 +1489,22 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 		inet_ntop(AF_INET6, mc_req_rec.mgid.raw, gid_str,
 			  sizeof gid_str));
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0211: "
 			"Failed to create MCG for MGID=%s (o15.0.1.6) - got %s/%s\n",
 			inet_ntop(AF_INET6, good_mgid.raw, gid_str,
 				  sizeof gid_str), ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
 	/* Save the mlid created in test_created_mlids map */
-	p_recvd_rec =
-	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
-		inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
-			  sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
-	cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
-		      p_recvd_rec);
+		inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,
+			  sizeof gid_str), cl_ntoh16(p_mc_res->mlid));
+	cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
 		"Validating resulting MGID (o15.0.1.6)...\n");
@@ -1584,16 +1527,16 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
 
 	mc_req_rec.mgid.raw[0] = 0xFA;
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if ((status != IB_REMOTE_ERROR) ||
-	    (res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
+	    (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0213: "
 			"Failed to recognize MGID error for MGID=0xFA - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -1607,16 +1550,16 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	comp_mask = comp_mask | IB_MCR_COMPMASK_SCOPE;
 	mc_req_rec.scope_state = mc_req_rec.scope_state & 0x2F;	/* local scope */
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if ((status != IB_REMOTE_ERROR) ||
-	    (res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
+	    (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0214: "
 			"Failed to recognize MGID error for A01B with link-local bit (status %s) (rem status %s)\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -1627,20 +1570,19 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 		"Checking BAD MGID PREFIX=0xEF... (o15.0.1.6)...\n");
 
 	mc_req_rec.mgid = good_mgid;
-
 	mc_req_rec.mgid.raw[0] = 0xEF;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if ((status != IB_REMOTE_ERROR) ||
-	    (res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
+	    (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0215: "
 			"Failed to recognize MGID PREFIX error for MGID=0xEF - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -1654,28 +1596,24 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 			  sizeof gid_str));
 
 	mc_req_rec.mgid = good_mgid;
-
 	mc_req_rec.mgid.raw[1] = 0x1F;
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0216: "
 			"Failed to create MCG for MGID=%s - got %s/%s\n",
 			inet_ntop(AF_INET6, good_mgid.raw, gid_str,
 				  sizeof gid_str), ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
 	/* Save the mlid created in test_created_mlids map */
-	p_recvd_rec =
-	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
-		inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
-			  sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
-	cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
-		      p_recvd_rec);
+		inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,
+			  sizeof gid_str), cl_ntoh16(p_mc_res->mlid));
+	cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);
 
 	/* Change the flags to invalid value 0x2 - get back INVALID REQ */
 
@@ -1685,20 +1623,19 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
 
 	mc_req_rec.mgid = good_mgid;
-
 	mc_req_rec.mgid.raw[1] = 0x22;
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if ((status != IB_REMOTE_ERROR) ||
-	    (res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
+	    (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0217: "
 			"Failed to recognize create with invalid flags value 0x2 - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -1710,24 +1647,21 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 
 	mc_req_rec.mgid = osm_link_local_mgid;
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0218: "
 			"Failed to create MCG for MGID=0xFF02:0:0:0:0:0:0:1 - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
 	/* Save the mlid created in test_created_mlids map */
-	p_recvd_rec =
-	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
-		inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
-			  sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
-	cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
-		      p_recvd_rec);
+		inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,
+			  sizeof gid_str), cl_ntoh16(p_mc_res->mlid));
+	cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);
 
 	/* o15.0.1.7 - implicitlly checked during the prev steps. */
 	/* o15.0.1.8 - implicitlly checked during the prev steps. */
@@ -1744,16 +1678,16 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	mc_req_rec.mgid.raw[12] = 0xFF;
 	mc_req_rec.scope_state = 0x22;	/* link-local scope, non-member state */
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if ((status != IB_REMOTE_ERROR) ||
-	    (res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
+	    (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0219: "
 			"Failed to recognize create with JoinState != FullMember - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -1765,25 +1699,21 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	mc_req_rec.mgid = good_mgid;
 	mc_req_rec.scope_state = 0x23;	/* link-local scope, non member and full member */
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
-
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0220: "
 			"Failed to create MCG with valid join state 0x3 - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
 	/* Save the mlid created in test_created_mlids map */
-	p_recvd_rec =
-	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
-		inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
-			  sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
-	cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
-		      p_recvd_rec);
+		inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,
+			  sizeof gid_str), cl_ntoh16(p_mc_res->mlid));
+	cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);
 
 	/* Lets try another invalid join scope state */
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
@@ -1794,19 +1724,18 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	/* We have created a new MCG so now we need different mgid when cresting group otherwise it will be counted as join request . */
 	mc_req_rec.mgid = good_mgid;
 	mc_req_rec.mgid.raw[12] = 0xFC;
-
 	mc_req_rec.scope_state = 0x24;	/* link-local scope, send only member */
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if ((status != IB_REMOTE_ERROR) ||
-	    (res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
+	    (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0221: "
 			"Failed to recognize create with JoinState != FullMember - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -1820,30 +1749,25 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	memcpy(&special_mgid, &mc_req_rec.mgid, sizeof(ib_gid_t));
 	mc_req_rec.scope_state = 0x2F;	/* link-local scope, Full member with all other bits turned on */
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
-
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0222: "
 			"Failed to create MCG with valid join state 0xF - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
 	/* Save the mlid created in test_created_mlids map */
-	p_recvd_rec =
-	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
-		inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
-			  sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
-	cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
-		      p_recvd_rec);
+		inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,
+			  sizeof gid_str), cl_ntoh16(p_mc_res->mlid));
+	cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);
 
 	/* o15.0.1.10 - can't check on a single client .-- obsolete -
 	   checked by SilverStorm bug o15-0.2.4, never the less recheck */
 	/* o15-0.2.4 - Check a join request to already created MCG */
-	p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "Check o15-0.2.4 statement...\n");
 	/* Try to join */
 	memcpy(&mc_req_rec.mgid, &p_mc_res->mgid, sizeof(ib_gid_t));
@@ -1854,20 +1778,18 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	    IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_JOIN_STATE;
 
 	status = osmt_send_mcast_request(p_osmt, 0x1,	/* SubnAdmSet */
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+					 &mc_req_rec, comp_mask, sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CC: "
 			"Failed to join MCG with valid req, returned status = %s\n",
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
-	p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	if ((p_mc_res->scope_state & 0x7) != 0x7) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02D0: "
 			"Validating JoinState update failed. "
-			"Expected 0x27 got 0x%02X\n",
-			p_mc_res->scope_state);
+			"Expected 0x27 got 0x%02X\n", p_mc_res->scope_state);
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -1882,24 +1804,24 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 
 	/* first, make sure  that the group exists */
 	mc_req_rec.scope_state = 0x21;
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CD: "
 			"Failed to create/join as full member - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
 	mc_req_rec.scope_state = 0x22;	/* link-local scope, non-member */
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02D1: "
 			"Failed to update existing MGID - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
@@ -1929,33 +1851,31 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	   so we should not be able to delete) */
 	mc_req_rec.scope_state = 0x26;
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 0,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 0, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if (status != IB_REMOTE_ERROR) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CF: "
 			"Expected to fail partially update JoinState, "
-			"but got %s\n",
-			ib_get_err_str(status));
+			"but got %s\n", ib_get_err_str(status));
 		status = IB_ERROR;
 		goto Exit;
 	}
 
 	/* link-local scope, NonMember bit, the FullMember bit should stay */
 	mc_req_rec.scope_state = 0x22;
-	status = osmt_send_mcast_request(p_osmt, 0,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 0, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02D3: "
 			"Failed to partially update JoinState : %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
 
-	p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
 	if (p_mc_res->scope_state != 0x21) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02D4: "
 			"Failed to partially update JoinState : "
@@ -1969,13 +1889,13 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	mc_req_rec.mgid = good_mgid;
 	mc_req_rec.scope_state = 0x24;	/* link-local scope, send only  member */
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C0: "
 			"Failed to update existing MCG - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
@@ -1992,13 +1912,13 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	/* Now try to update value of join state */
 	mc_req_rec.scope_state = 0x21;	/* link-local scope, full member */
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C2: "
 			"Failed to update existing MGID - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
@@ -2017,13 +1937,13 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	/* Now try to update value of join state */
 	mc_req_rec.scope_state = 0x22;	/* link-local scope,non member */
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C4: "
 			"Failed to update existing MGID - got %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
@@ -2058,27 +1978,27 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 
 	mc_req_rec.mgid = good_mgid;
 	mc_req_rec.rate =
-	    IB_LINK_WIDTH_ACTIVE_1X | IB_PATH_SELECTOR_LESS_THAN << 6;
+	    IB_PATH_RECORD_RATE_2_5_GBS | IB_PATH_SELECTOR_LESS_THAN << 6;
 	comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if ((status != IB_REMOTE_ERROR) ||
-	    (res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
+	    (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C6: "
-			"Failed to catch BAD RATE joining an exiting MGID: %s/%s\n",
+			"Failed to catch BAD RATE joining an existing MGID: %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
 
 	/* Try MTU that does not exist in any MCG */
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
-		"Checking BAD MTU (higher them max) when connecting to "
+		"Checking BAD MTU (higher than max) when connecting to "
 		"existing MGID (o15.0.1.13)...\n");
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
 
@@ -2087,16 +2007,16 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if ((status != IB_REMOTE_ERROR) ||
-	    (res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
+	    (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C7: "
-			"Failed to catch BAD RATE (higher them max) joining an exiting MGID: %s/%s\n",
+			"Failed to catch BAD RATE (higher than max) joining an existing MGID: %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -2112,16 +2032,16 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if ((status != IB_REMOTE_ERROR) ||
-	    (res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
+	    (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C8: "
-			"Failed to catch BAD RATE (less them min) joining an exiting MGID: %s/%s\n",
+			"Failed to catch BAD RATE (less than min) joining an existing MGID: %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -2132,23 +2052,19 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
 		"Checking partial JoinState delete request - removing NonMember (o15.0.1.14)...\n");
 
-	mc_req_rec.rate =
-	    IB_LINK_WIDTH_ACTIVE_1X | IB_PATH_SELECTOR_GREATER_THAN << 6;
 	mc_req_rec.mgid = good_mgid;
-	comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
-	    IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
+	comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS;	/* all above are required */
 	/* link-local scope, non member (so we should not be able to delete) */
 	/* but the NonMember bit should be gone */
 	mc_req_rec.scope_state = 0x22;
 
-	status = osmt_send_mcast_request(p_osmt, 0,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
-
+	status = osmt_send_mcast_request(p_osmt, 0, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C9: "
 			"Fail to partially update JoinState during delete: %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -2166,14 +2082,13 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	/* Now use the same scope_state and delete all JoinState - leave multicast group since state is 0x0 */
 
 	mc_req_rec.scope_state = 0x25;
-	status = osmt_send_mcast_request(p_osmt, 0,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
-
+	status = osmt_send_mcast_request(p_osmt, 0, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CB: "
 			"Failed to update JoinState during delete: %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -2197,14 +2112,14 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
 	status = osmt_send_mcast_request(p_osmt, 1,	/* join */
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+					 &mc_req_rec, comp_mask, sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if (status != IB_REMOTE_ERROR) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02BC: "
 			"Succeeded Joining Deleted Group: %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -2220,15 +2135,15 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	mc_req_rec.scope_state = 0x21;	/* delete full member */
 
 	status = osmt_send_mcast_request(p_osmt, 0,	/* delete flag */
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+					 &mc_req_rec, comp_mask, sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if ((status != IB_REMOTE_ERROR) ||
-	    (res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
+	    (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02BD: "
 			"Failed to catch BAD delete from IPoIB: %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -2246,14 +2161,14 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_LIFE | IB_MCR_COMPMASK_LIFE_SEL;
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02BE: "
 			"Failed to create MCG for %s - got %s/%s\n",
 			inet_ntop(AF_INET6, good_mgid.raw, gid_str,
 				  sizeof gid_str), ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		goto Exit;
 	}
 
@@ -2261,12 +2176,10 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
 		"Checking Full Delete of a group (o15.0.1.14)...\n");
 	mc_req_rec.scope_state = 0x21;	/* the FullMember is the current JoinState */
-	status = osmt_send_mcast_request(p_osmt, 0,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
-
-	if (status != IB_SUCCESS) {
+	status = osmt_send_mcast_request(p_osmt, 0, &mc_req_rec, comp_mask,
+					 sa_mad);
+	if (status != IB_SUCCESS)
 		goto Exit;
-	}
 
 	/* o15.0.1.15: */
 	/* - Try deletion of the IPoIB MCG and get: ERR_REQ_INVALID */
@@ -2280,16 +2193,16 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	mc_req_rec.scope_state = 0x21;	/* delete full member */
 
 	status = osmt_send_mcast_request(p_osmt, 0,	/* delete flag */
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+					 &mc_req_rec, comp_mask, sa_mad);
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if ((status != IB_REMOTE_ERROR) ||
-	    (res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
+	    (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0223: "
 			"Failed to catch BAD delete from IPoIB: %s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -2303,15 +2216,15 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 		"\t\twith unrealistic MTU greater than 4096 (o15.0.1.8)...\n");
 
 	/* First create new mgrp */
+	mc_req_rec.pkey = IB_DEFAULT_PKEY;
 	ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
 	mc_req_rec.mtu = IB_MTU_LEN_1024 | IB_PATH_SELECTOR_EXACTLY << 6;
 	memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
 	comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
 
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
-	p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02EB: "
 			"Failed to create new mgrp\n");
@@ -2326,21 +2239,20 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	memcpy(&mc_req_rec.mgid, &tmp_mgid, sizeof(ib_gid_t));
 	ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
 	comp_mask =
-	    IB_MCR_COMPMASK_GID |
-	    IB_MCR_COMPMASK_PORT_GID |
+	    IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID |
 	    IB_MCR_COMPMASK_JOIN_STATE |
 	    IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
-	status = osmt_send_mcast_request(p_osmt, 1,
-					 &mc_req_rec, comp_mask, &res_sa_mad);
+	status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,
+					 sa_mad);
 	OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
 	if (status == IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02E4: "
 			"Expected REMOTE ERROR got:%s/%s\n",
 			ib_get_err_str(status),
-			ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
+			ib_get_mad_status_str((ib_mad_t *) sa_mad));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -2392,28 +2304,25 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	}
 
 	if (remote_port_guid != 0x0) {
+		mc_req_rec.pkey = IB_DEFAULT_PKEY;
 		ib_member_set_join_state(&mc_req_rec,
 					 IB_MC_REC_STATE_FULL_MEMBER);
 		memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
 		mc_req_rec.port_gid.unicast.interface_id = remote_port_guid;
 		comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS;	/* all above are required */
 
-		status = osmt_send_mcast_request(p_osmt, 1,
-						 &mc_req_rec,
-						 comp_mask, &res_sa_mad);
-
+		status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec,
+						 comp_mask, sa_mad);
 		if (status != IB_SUCCESS) {
 			OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B4: "
 				"Could not join on behalf of remote port 0x%016"
 				PRIx64 " remote status: %s\n",
 				cl_ntoh64(remote_port_guid),
-				ib_get_mad_status_str((ib_mad_t
-						       *) (&res_sa_mad)));
+				ib_get_mad_status_str((ib_mad_t *) sa_mad));
 			status = IB_ERROR;
 			goto Exit;
 		}
 
-		p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
 		memcpy(&proxy_mgid, &p_mc_res->mgid, sizeof(ib_gid_t));
 
 		/* First try a bad deletion then good one */
@@ -2432,7 +2341,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 
 		status = osmt_send_mcast_request(p_osmt, 0,	/* delete flag */
 						 &mc_req_rec,
-						 comp_mask, &res_sa_mad);
+						 comp_mask, sa_mad);
 
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
 
@@ -2441,11 +2350,10 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 				"Successful deletion of remote port guid with local one MGID : "
 				"%s, Got : %s/%s\n",
 				inet_ntop(AF_INET6,
-					p_mgrp->mcmember_rec.mgid.raw,
-					gid_str, sizeof gid_str),
+					  p_mgrp->mcmember_rec.mgid.raw,
+					  gid_str, sizeof gid_str),
 				ib_get_err_str(status),
-				ib_get_mad_status_str((ib_mad_t
-						       *) (&res_sa_mad)));
+				ib_get_mad_status_str((ib_mad_t *) sa_mad));
 			status = IB_ERROR;
 			goto Exit;
 		}
@@ -2463,23 +2371,21 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 		    IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_JOIN_STATE;
 		status = osmt_send_mcast_request(p_osmt, 0,	/* delete flag */
 						 &mc_req_rec,
-						 comp_mask, &res_sa_mad);
+						 comp_mask, sa_mad);
 		if (status != IB_SUCCESS) {
 			OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B0: "
 				"Failed to delete mgid with remote port guid MGID : "
 				"%s, Got : %s/%s\n",
 				inet_ntop(AF_INET6,
-					p_mgrp->mcmember_rec.mgid.raw,
-					gid_str, sizeof gid_str),
+					  p_mgrp->mcmember_rec.mgid.raw,
+					  gid_str, sizeof gid_str),
 				ib_get_err_str(status),
-				ib_get_mad_status_str((ib_mad_t
-						       *) (&res_sa_mad)));
+				ib_get_mad_status_str((ib_mad_t *) sa_mad));
 			goto Exit;
 		}
-	} else {
+	} else
 		OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
 			"Could not check proxy join since could not found remote port, different from local port\n");
-	}
 
 	/* prepare init for next check */
 	osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
@@ -2492,7 +2398,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 			"Checking Creation of Maximum avaliable Groups (MulticastFDBCap)...\n");
 		tmp_mlid = cl_ntoh16(max_mlid) - cnt;
 
-		while (tmp_mlid > 0 && !ReachedMlidLimit) {
+		while (tmp_mlid > 0) {
 			uint16_t cur_mlid = 0;
 
 			/* Request Set */
@@ -2508,49 +2414,32 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 			memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
 			comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 			    IB_MCR_COMPMASK_MLID;
-			status = osmt_send_mcast_request(p_osmt, 1,
-							 &mc_req_rec,
-							 comp_mask,
-							 &res_sa_mad);
-
-			p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
-			if (status != IB_SUCCESS) {
-
-				if (cur_mlid > cl_ntoh16(max_mlid)) {
-
-					OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,
-						"ERR 2E1 "
-						"Successful Join with greater mlid than switches support (MulticastFDBCap) 0x%04X\n",
-						cur_mlid);
-					status = IB_ERROR;
-					osm_dump_mc_record(&p_osmt->log,
-							   p_mc_res,
-							   OSM_LOG_VERBOSE);
-					goto Exit;
-				} else
-				    if ((res_sa_mad.
-					 status & IB_SMP_STATUS_MASK) ==
-					IB_SA_MAD_STATUS_NO_RESOURCES) {
-					/* You can quitly exit the loop since no available mlid in SA DB
-					   i.e. reached the maximum valiad avalable mlid */
-					ReachedMlidLimit = TRUE;
-				}
-			} else {
+			status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec,
+							 comp_mask, sa_mad);
+			if (status == IB_SUCCESS) {
 				cur_mlid = cl_ntoh16(p_mc_res->mlid);
 				/* Save the mlid created in test_created_mlids map */
-				p_recvd_rec =
-				    (ib_member_rec_t *)
-				    ib_sa_mad_get_payload_ptr(&res_sa_mad);
 				OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
 					"Created MGID:%s MLID:0x%04X\n",
-					inet_ntop(AF_INET6,
-						  p_recvd_rec->mgid.raw,
+					inet_ntop(AF_INET6, p_mc_res->mgid.raw,
 						  gid_str, sizeof gid_str),
-					cl_ntoh16(p_recvd_rec->mlid));
+					cl_ntoh16(p_mc_res->mlid));
 				cl_map_insert(&test_created_mlids,
-					      cl_ntoh16(p_recvd_rec->mlid),
-					      p_recvd_rec);
-			}
+					      cl_ntoh16(p_mc_res->mlid),
+					      p_mc_res);
+			} else if (cur_mlid > cl_ntoh16(max_mlid)) {
+				OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02E1 "
+					"Successful Join with greater mlid than switches support (MulticastFDBCap) 0x%04X\n",
+					cur_mlid);
+				status = IB_ERROR;
+				osm_dump_mc_record(&p_osmt->log, p_mc_res,
+						   OSM_LOG_VERBOSE);
+				goto Exit;
+			} else if ((sa_mad->status & IB_SMP_STATUS_MASK) ==
+				   IB_SA_MAD_STATUS_NO_RESOURCES)
+				/* You can quietly exit the loop since no available mlid in SA DB
+				   i.e. reached the maximum valid avalable mlid */
+				break;
 			tmp_mlid--;
 		}
 	}
@@ -2588,16 +2477,13 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 			mc_req_rec.mgid = p_mgrp->mcmember_rec.mgid;
 
 			/* o15-0.1.4 - need to specify the oppsite state for a valid delete */
-			if (!memcmp
-			    (&special_mgid, &p_mgrp->mcmember_rec.mgid,
-			     sizeof(special_mgid))) {
+			if (!memcmp(&special_mgid, &p_mgrp->mcmember_rec.mgid,
+				    sizeof(special_mgid)))
 				mc_req_rec.scope_state = 0x2F;
-			} else {
+			else
 				mc_req_rec.scope_state = 0x21;
-			}
 			comp_mask =
-			    IB_MCR_COMPMASK_MGID |
-			    IB_MCR_COMPMASK_PORT_GID |
+			    IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
 			    IB_MCR_COMPMASK_JOIN_STATE;
 
 			OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
@@ -2607,9 +2493,8 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 					  gid_str, sizeof gid_str),
 				mc_req_rec.scope_state);
 			status = osmt_send_mcast_request(p_osmt, 0,	/* delete flag */
-							 &mc_req_rec,
-							 comp_mask,
-							 &res_sa_mad);
+							 &mc_req_rec, comp_mask,
+							 sa_mad);
 			if (status != IB_SUCCESS) {
 				OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,
 					"ERR 02FF: Failed to delete MGID : %s"
@@ -2619,12 +2504,11 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 						  gid_str, sizeof gid_str),
 					ib_get_err_str(status),
 					ib_get_mad_status_str((ib_mad_t *)
-							      (&res_sa_mad)));
+							      sa_mad));
 				fail_to_delete_mcg++;
 			}
-		} else {
+		} else
 			end_ipoib_cnt++;
-		}
 		p_mgrp = (osmtest_mgrp_t *) cl_qmap_next(&p_mgrp->map_item);
 	}
 
@@ -2689,8 +2573,8 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 					 (&p_mgrp->mcmember_rec.
 					  mgid)) ? "IPoIB" : "non-IPoIB",
 					inet_ntop(AF_INET6,
-						p_mgrp->mcmember_rec.mgid.raw,
-						gid_str, sizeof gid_str));
+						  p_mgrp->mcmember_rec.mgid.raw,
+						  gid_str, sizeof gid_str));
 			}
 			p_mgrp =
 			    (osmtest_mgrp_t *) cl_qmap_next(&p_mgrp->map_item);
diff --git a/osmtest/osmt_service.c b/osmtest/osmt_service.c
index 97f1492..a37c946 100644
--- a/osmtest/osmt_service.c
+++ b/osmtest/osmt_service.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2010 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -55,8 +56,6 @@
 #include <complib/cl_debug.h>
 #include "osmtest.h"
 
-/**********************************************************************
- **********************************************************************/
 
 ib_api_status_t
 osmt_register_service(IN osmtest_t * const p_osmt,
@@ -123,7 +122,6 @@ osmt_register_service(IN osmtest_t * const p_osmt,
 		    IB_SR_COMPMASK_SLEASE |
 		    IB_SR_COMPMASK_SKEY | IB_SR_COMPMASK_SNAME;
 	}
-	user.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t));
 	user.p_attr = &svc_rec;
 
 	status = osmv_query_sa(p_osmt->h_bind, &req);
@@ -160,9 +158,6 @@ Exit:
 	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-
 ib_api_status_t
 osmt_register_service_with_full_key(IN osmtest_t * const p_osmt,
 				    IN ib_net64_t service_id,
@@ -231,7 +226,6 @@ osmt_register_service_with_full_key(IN osmtest_t * const p_osmt,
 		    IB_SR_COMPMASK_SLEASE |
 		    IB_SR_COMPMASK_SKEY | IB_SR_COMPMASK_SNAME;
 	}
-	user.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t));
 	user.p_attr = &svc_rec;
 
 	status = osmv_query_sa(p_osmt->h_bind, &req);
@@ -284,9 +278,6 @@ Exit:
 	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-
 ib_api_status_t
 osmt_register_service_with_data(IN osmtest_t * const p_osmt,
 				IN ib_net64_t service_id,
@@ -381,7 +372,6 @@ osmt_register_service_with_data(IN osmtest_t * const p_osmt,
 		    IB_SR_COMPMASK_SDATA32_1 |
 		    IB_SR_COMPMASK_SDATA64_0 | IB_SR_COMPMASK_SDATA64_1;
 	}
-	user.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t));
 	user.p_attr = &svc_rec;
 
 	/*  Dump to Service Data b4 send */
@@ -440,9 +430,6 @@ Exit:
 	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-
 ib_api_status_t
 osmt_get_service_by_id_and_name(IN osmtest_t * const p_osmt,
 				IN uint32_t rec_num,
@@ -497,7 +484,6 @@ osmt_get_service_by_id_and_name(IN osmtest_t * const p_osmt,
 	user.method = IB_MAD_METHOD_GET;
 	user.attr_id = IB_MAD_ATTR_SERVICE_RECORD;
 	user.comp_mask = IB_SR_COMPMASK_SID | IB_SR_COMPMASK_SNAME;
-	user.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t));
 	user.p_attr = &svc_rec;
 
 	status = osmv_query_sa(p_osmt->h_bind, &req);
@@ -569,9 +555,6 @@ Exit:
 	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-
 ib_api_status_t
 osmt_get_service_by_id(IN osmtest_t * const p_osmt,
 		       IN uint32_t rec_num,
@@ -621,7 +604,6 @@ osmt_get_service_by_id(IN osmtest_t * const p_osmt,
 	user.method = IB_MAD_METHOD_GET;
 	user.attr_id = IB_MAD_ATTR_SERVICE_RECORD;
 	user.comp_mask = IB_SR_COMPMASK_SID;
-	user.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t));
 	user.p_attr = &svc_rec;
 
 	status = osmv_query_sa(p_osmt->h_bind, &req);
@@ -694,9 +676,6 @@ Exit:
 	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-
 ib_api_status_t
 osmt_get_service_by_name_and_key(IN osmtest_t * const p_osmt,
 				 IN char *sr_name,
@@ -756,7 +735,6 @@ osmt_get_service_by_name_and_key(IN osmtest_t * const p_osmt,
 	user.method = IB_MAD_METHOD_GET;
 	user.attr_id = IB_MAD_ATTR_SERVICE_RECORD;
 	user.comp_mask = IB_SR_COMPMASK_SNAME | IB_SR_COMPMASK_SKEY;
-	user.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t));
 	user.p_attr = &svc_rec;
 	status = osmv_query_sa(p_osmt->h_bind, &req);
 	if (status != IB_SUCCESS) {
@@ -828,9 +806,6 @@ Exit:
 	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-
 ib_api_status_t
 osmt_get_service_by_name(IN osmtest_t * const p_osmt,
 			 IN char *sr_name,
@@ -945,9 +920,6 @@ Exit:
 	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-
 #ifdef VENDOR_RMPP_SUPPORT
 ib_api_status_t
 osmt_get_all_services_and_check_names(IN osmtest_t * const p_osmt,
@@ -1068,9 +1040,6 @@ Exit:
 }
 #endif
 
-/**********************************************************************
- **********************************************************************/
-
 ib_api_status_t
 osmt_delete_service_by_name(IN osmtest_t * const p_osmt,
 			    IN uint8_t IsServiceExist,
@@ -1118,7 +1087,6 @@ osmt_delete_service_by_name(IN osmtest_t * const p_osmt,
 	user.method = IB_MAD_METHOD_DELETE;
 	user.attr_id = IB_MAD_ATTR_SERVICE_RECORD;
 	user.comp_mask = IB_SR_COMPMASK_SNAME;
-	user.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t));
 	user.p_attr = &svc_rec;
 
 	status = osmv_query_sa(p_osmt->h_bind, &req);
@@ -1174,9 +1142,6 @@ ExitNoDel:
 	return status;
 }
 
-/**********************************************************************
- **********************************************************************/
-
 /*
  * Run a complete service records flow:
  * - register a service
@@ -1607,6 +1572,7 @@ ib_api_status_t osmt_run_service_records_flow(IN osmtest_t * const p_osmt)
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A32: "
 			"Failed to delete service name: %s\n",
 			(char *)service_name[6]);
+		status = IB_ERROR;
 		goto Exit;
 	}
 
diff --git a/osmtest/osmt_slvl_vl_arb.c b/osmtest/osmt_slvl_vl_arb.c
index 82a6f39..49123ad 100644
--- a/osmtest/osmt_slvl_vl_arb.c
+++ b/osmtest/osmt_slvl_vl_arb.c
@@ -51,25 +51,23 @@
 #include <complib/cl_debug.h>
 #include "osmtest.h"
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_write_vl_arb_table(IN osmtest_t * const p_osmt,
 			   IN FILE * fh,
 			   IN const ib_vl_arb_table_record_t * const p_rec)
 {
-	int result, i;
+	int i;
 	cl_status_t status = IB_SUCCESS;
 
 	OSM_LOG_ENTER(&p_osmt->log);
 
-	result = fprintf(fh,
-			 "VL_ARBITRATION_TABLE\n"
-			 "lid                     0x%X\n"
-			 "port_num                0x%X\n"
-			 "block                   0x%X\n",
-			 cl_ntoh16(p_rec->lid),
-			 p_rec->port_num, p_rec->block_num);
+	fprintf(fh,
+		"VL_ARBITRATION_TABLE\n"
+		"lid                     0x%X\n"
+		"port_num                0x%X\n"
+		"block                   0x%X\n",
+		cl_ntoh16(p_rec->lid),
+		p_rec->port_num, p_rec->block_num);
 
 	fprintf(fh, "       ");
 	for (i = 0; i < 32; i++)
@@ -262,18 +260,18 @@ osmtest_write_slvl_map_table(IN osmtest_t * const p_osmt,
 			     IN FILE * fh,
 			     IN const ib_slvl_table_record_t * const p_rec)
 {
-	int result, i;
+	int i;
 	cl_status_t status = IB_SUCCESS;
 
 	OSM_LOG_ENTER(&p_osmt->log);
 
-	result = fprintf(fh,
-			 "SLtoVL_MAP_TABLE\n"
-			 "lid                     0x%X\n"
-			 "in_port_num             0x%X\n"
-			 "out_port_num            0x%X\n",
-			 cl_ntoh16(p_rec->lid),
-			 p_rec->in_port_num, p_rec->out_port_num);
+	fprintf(fh,
+		"SLtoVL_MAP_TABLE\n"
+		"lid                     0x%X\n"
+		"in_port_num             0x%X\n"
+		"out_port_num            0x%X\n",
+		cl_ntoh16(p_rec->lid),
+		p_rec->in_port_num, p_rec->out_port_num);
 
 	fprintf(fh, "SL:");
 	for (i = 0; i < 16; i++)
@@ -491,6 +489,12 @@ osmt_run_slvl_and_vlarb_records_flow(IN osmtest_t * const p_osmt)
 	OSM_LOG_ENTER(&p_osmt->log);
 
 	fh = fopen("qos.txt", "w");
+	if (!fh) {
+		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0474: "
+			"Failed to open file qos.txt for writing\n");
+		status = IB_ERROR;
+		goto Exit;
+	}
 
 	/* go over all ports in the subnet */
 	status = osmt_query_all_ports_vl_arb(p_osmt, fh);
@@ -522,7 +526,8 @@ osmt_run_slvl_and_vlarb_records_flow(IN osmtest_t * const p_osmt)
 	}
 
 Exit:
-	fclose(fh);
+	if (fh)
+		fclose(fh);
 	OSM_LOG_EXIT(&p_osmt->log);
 	return status;
 }
diff --git a/osmtest/osmtest.c b/osmtest/osmtest.c
index 243d0b2..68b0e40 100644
--- a/osmtest/osmtest.c
+++ b/osmtest/osmtest.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009,2010 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -42,28 +43,15 @@
  *
  */
 
-#ifdef __WIN__
-#pragma warning(disable : 4996)
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifdef __WIN__
-#include <complib/cl_timer.h>
-#else
-#include <strings.h>
 #include <sys/time.h>
-#endif
 #include <complib/cl_debug.h>
 #include "osmtest.h"
 
-#ifndef __WIN__
-#define strnicmp strncasecmp
-#endif
-
 #define POOL_MIN_ITEMS  64
-#define GUID_ARRAY_SIZE 64
+#define MAX_LOCAL_IBPORTS 64
 
 typedef struct _osmtest_sm_info_rec {
 	ib_net64_t sm_guid;
@@ -193,7 +181,6 @@ const osmtest_token_t token_array[] = {
 	{OSMTEST_TOKEN_RATE, 4, "RATE"},
 	{OSMTEST_TOKEN_PKT_LIFE, 8, "PKT_LIFE"},
 	{OSMTEST_TOKEN_PREFERENCE, 10, "PREFERENCE"},
-	{OSMTEST_TOKEN_MKEY, 4, "M_KEY"},
 	{OSMTEST_TOKEN_SUBN_PREF, 13, "SUBNET_PREFIX"},
 	{OSMTEST_TOKEN_BASE_LID, 8, "BASE_LID"},
 	{OSMTEST_TOKEN_SM_BASE_LID, 18, "MASTER_SM_BASE_LID"},
@@ -225,6 +212,7 @@ const osmtest_token_t token_array[] = {
 	{OSMTEST_TOKEN_SUBN_TIMEOUT, 14, "subnet_timeout"},
 	{OSMTEST_TOKEN_RESP_TIME_VAL, 15, "resp_time_value"},
 	{OSMTEST_TOKEN_ERR_THRESHOLD, 15, "error_threshold"},
+	{OSMTEST_TOKEN_MKEY, 4, "M_KEY"}, /* must be after the other mkey... tokens. */
 	{OSMTEST_TOKEN_MTU, 3, "MTU"},	/*  must be after the other mtu... tokens. */
 	{OSMTEST_TOKEN_FROMLID, 8, "from_lid"},
 	{OSMTEST_TOKEN_FROMPORTNUM, 13, "from_port_num"},
@@ -233,8 +221,6 @@ const osmtest_token_t token_array[] = {
 	{OSMTEST_TOKEN_UNKNOWN, 0, ""}	/* must be last entry */
 };
 
-#define IB_MAD_STATUS_CLASS_MASK       (CL_HTON16(0xFF00))
-
 static const char ib_mad_status_str_busy[] = "IB_MAD_STATUS_BUSY";
 static const char ib_mad_status_str_redirect[] = "IB_MAD_STATUS_REDIRECT";
 static const char ib_mad_status_str_unsup_class_ver[] =
@@ -259,8 +245,6 @@ static const char ib_mad_status_str_insuf_comps[] =
     "IB_SA_MAD_STATUS_INSUF_COMPS";
 static const char generic_or_str[] = " | ";
 
-/**********************************************************************
- **********************************************************************/
 const char *ib_get_mad_status_str(IN const ib_mad_t * const p_mad)
 {
 	static char line[512];
@@ -390,8 +374,6 @@ const char *ib_get_mad_status_str(IN const ib_mad_t * const p_mad)
 	return (line);
 }
 
-/**********************************************************************
- **********************************************************************/
 void subnet_construct(IN subnet_t * const p_subn)
 {
 	cl_qmap_init(&p_subn->link_tbl);
@@ -408,8 +390,6 @@ void subnet_construct(IN subnet_t * const p_subn)
 	cl_qmap_init(&p_subn->path_tbl);
 }
 
-/**********************************************************************
- **********************************************************************/
 cl_status_t subnet_init(IN subnet_t * const p_subn)
 {
 	cl_status_t status = IB_SUCCESS;
@@ -419,8 +399,6 @@ cl_status_t subnet_init(IN subnet_t * const p_subn)
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osmtest_construct(IN osmtest_t * const p_osmt)
 {
 	memset(p_osmt, 0, sizeof(*p_osmt));
@@ -428,8 +406,6 @@ void osmtest_construct(IN osmtest_t * const p_osmt)
 	subnet_construct(&p_osmt->exp_subn);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osmtest_destroy(IN osmtest_t * const p_osmt)
 {
 	cl_map_item_t *p_item, *p_next_item;
@@ -487,8 +463,6 @@ void osmtest_destroy(IN osmtest_t * const p_osmt)
 	osm_log_destroy(&p_osmt->log);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osmtest_init(IN osmtest_t * const p_osmt,
 	     IN const osmtest_opt_t * const p_opt,
@@ -542,8 +516,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 void osmtest_query_res_cb(IN osmv_query_res_t * p_rec)
 {
 	osmtest_req_context_t *const p_ctxt =
@@ -562,8 +534,6 @@ void osmtest_query_res_cb(IN osmv_query_res_t * p_rec)
 	OSM_LOG_EXIT(&p_osmt->log);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osmtest_get_all_recs(IN osmtest_t * const p_osmt,
 		     IN ib_net16_t const attr_id,
@@ -591,7 +561,6 @@ osmtest_get_all_recs(IN osmtest_t * const p_osmt,
 
 	p_context->p_osmt = p_osmt;
 	user.attr_id = attr_id;
-	user.attr_offset = cl_ntoh16((uint16_t) (attr_size >> 3));
 
 	req.query_type = OSMV_QUERY_USER_DEFINED;
 	req.timeout_ms = p_osmt->opt.transaction_timeout;
@@ -630,8 +599,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t osmtest_validate_sa_class_port_info(IN osmtest_t * const p_osmt)
 {
 	ib_api_status_t status = IB_SUCCESS;
@@ -717,8 +684,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osmtest_get_node_rec(IN osmtest_t * const p_osmt,
 		     IN ib_net64_t const node_guid,
@@ -751,7 +716,6 @@ osmtest_get_node_rec(IN osmtest_t * const p_osmt,
 	p_context->p_osmt = p_osmt;
 	user.comp_mask = IB_NR_COMPMASK_NODEGUID;
 	user.attr_id = IB_MAD_ATTR_NODE_RECORD;
-	user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));
 	user.p_attr = &record;
 
 	req.query_type = OSMV_QUERY_USER_DEFINED;
@@ -825,7 +789,6 @@ osmtest_get_node_rec_by_lid(IN osmtest_t * const p_osmt,
 	p_context->p_osmt = p_osmt;
 	user.comp_mask = IB_NR_COMPMASK_LID;
 	user.attr_id = IB_MAD_ATTR_NODE_RECORD;
-	user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));
 	user.p_attr = &record;
 
 	req.query_type = OSMV_QUERY_USER_DEFINED;
@@ -868,8 +831,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_get_path_rec_by_guid_pair(IN osmtest_t * const p_osmt,
 				  IN ib_net64_t sguid,
@@ -902,7 +863,7 @@ osmtest_get_path_rec_by_guid_pair(IN osmtest_t * const p_osmt,
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
 		"Query for path from 0x%" PRIx64 " to 0x%" PRIx64 "\n",
-		sguid, dguid);
+		cl_ntoh64(sguid), cl_ntoh64(dguid));
 
 	status = osmv_query_sa(p_osmt->h_bind, &req);
 	if (status != IB_SUCCESS) {
@@ -933,8 +894,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_get_path_rec_by_gid_pair(IN osmtest_t * const p_osmt,
 				 IN ib_gid_t sgid,
@@ -967,9 +926,11 @@ osmtest_get_path_rec_by_gid_pair(IN osmtest_t * const p_osmt,
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
 		"Query for path from 0x%016" PRIx64 " 0x%016" PRIx64
-		" to 0x%016" PRIx64 " 0x%016" PRIx64 "\n", sgid.unicast.prefix,
-		sgid.unicast.interface_id, dgid.unicast.prefix,
-		dgid.unicast.interface_id);
+		" to 0x%016" PRIx64 " 0x%016" PRIx64 "\n",
+		cl_ntoh64(sgid.unicast.prefix),
+		cl_ntoh64(sgid.unicast.interface_id),
+		cl_ntoh64(dgid.unicast.prefix),
+		cl_ntoh64(dgid.unicast.interface_id));
 
 	status = osmv_query_sa(p_osmt->h_bind, &req);
 	if (status != IB_SUCCESS) {
@@ -1001,8 +962,6 @@ Exit:
 }
 
 #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_get_multipath_rec(IN osmtest_t * const p_osmt,
 			  IN osmv_multipath_req_t * p_request,
@@ -1063,8 +1022,6 @@ Exit:
 }
 #endif
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osmtest_get_port_rec(IN osmtest_t * const p_osmt,
 		     IN ib_net16_t const lid,
@@ -1097,7 +1054,6 @@ osmtest_get_port_rec(IN osmtest_t * const p_osmt,
 	p_context->p_osmt = p_osmt;
 	user.comp_mask = IB_PIR_COMPMASK_LID;
 	user.attr_id = IB_MAD_ATTR_PORTINFO_RECORD;
-	user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));
 	user.p_attr = &record;
 
 	req.query_type = OSMV_QUERY_USER_DEFINED;
@@ -1137,8 +1093,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osmtest_get_port_rec_by_num(IN osmtest_t * const p_osmt,
 			    IN ib_net16_t const lid,
@@ -1214,8 +1168,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osmtest_stress_port_recs_large(IN osmtest_t * const p_osmt,
 			       OUT uint32_t * const p_num_recs,
@@ -1277,8 +1229,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osmtest_stress_node_recs_large(IN osmtest_t * const p_osmt,
 			       OUT uint32_t * const p_num_recs,
@@ -1341,8 +1291,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osmtest_stress_path_recs_large(IN osmtest_t * const p_osmt,
 			       OUT uint32_t * const p_num_recs,
@@ -1404,8 +1352,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osmtest_stress_path_recs_by_guid(IN osmtest_t * const p_osmt,
 				 OUT uint32_t * const p_num_recs,
@@ -1516,8 +1462,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osmtest_stress_port_recs_small(IN osmtest_t * const p_osmt,
 			       OUT uint32_t * const p_num_recs,
@@ -1581,8 +1525,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osmtest_get_local_port_lmc(IN osmtest_t * const p_osmt,
 			   IN ib_net16_t lid, OUT uint8_t * const p_lmc)
@@ -1714,8 +1656,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_write_port_info(IN osmtest_t * const p_osmt,
 			IN FILE * fh,
@@ -1810,8 +1750,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_write_path_info(IN osmtest_t * const p_osmt,
 			IN FILE * fh, IN const ib_path_rec_t * const p_rec)
@@ -1860,8 +1798,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_write_node_info(IN osmtest_t * const p_osmt,
 			IN FILE * fh, IN const ib_node_record_t * const p_rec)
@@ -1920,8 +1856,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_write_link(IN osmtest_t * const p_osmt,
 		   IN FILE * fh, IN const ib_link_record_t * const p_rec)
@@ -1954,8 +1888,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_write_all_link_recs(IN osmtest_t * const p_osmt, IN FILE * fh)
 {
@@ -2022,8 +1954,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_get_path_rec_by_lid_pair(IN osmtest_t * const p_osmt,
 				 IN ib_net16_t slid,
@@ -2055,7 +1985,8 @@ osmtest_get_path_rec_by_lid_pair(IN osmtest_t * const p_osmt,
 	req.sm_key = 0;
 
 	OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
-		"Query for path from 0x%X to 0x%X\n", slid, dlid);
+		"Query for path from 0x%X to 0x%X\n",
+		cl_ntoh16(slid), cl_ntoh16(dlid));
 	status = osmv_query_sa(p_osmt->h_bind, &req);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0053: "
@@ -2594,8 +2525,6 @@ osmtest_write_all_path_recs(IN osmtest_t * const p_osmt, IN FILE * fh)
 
 #endif
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_create_inventory_file(IN osmtest_t * const p_osmt)
 {
@@ -2639,8 +2568,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t osmtest_stress_large_rmpp_pr(IN osmtest_t * const p_osmt)
 {
 	ib_api_status_t status = IB_SUCCESS;
@@ -2718,8 +2645,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t osmtest_stress_large_rmpp(IN osmtest_t * const p_osmt)
 {
 	ib_api_status_t status = IB_SUCCESS;
@@ -2802,8 +2727,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t osmtest_stress_small_rmpp(IN osmtest_t * const p_osmt)
 {
 	ib_api_status_t status = IB_SUCCESS;
@@ -2827,7 +2750,11 @@ static ib_api_status_t osmtest_stress_small_rmpp(IN osmtest_t * const p_osmt)
 
 		status = osmtest_stress_port_recs_small(p_osmt, &delta_recs,
 							&delta_queries);
-		if (status != IB_SUCCESS)
+		if (status == IB_TIMEOUT) {
+			num_timeouts++;
+			continue;
+		}
+		else if (status != IB_SUCCESS)
 			goto Exit;
 
 		num_recs += delta_recs;
@@ -2879,8 +2806,146 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
+ib_api_status_t
+osmtest_stress_path_recs_by_lid(IN osmtest_t * const p_osmt,
+				OUT uint32_t * const p_num_recs,
+				OUT uint32_t * const p_num_queries)
+{
+	osmtest_req_context_t context;
+	ib_path_rec_t *p_rec;
+	cl_status_t status;
+	ib_net16_t dlid, slid;
+	int num_recs, i;
+
+	OSM_LOG_ENTER(&p_osmt->log);
+
+	memset(&context, 0, sizeof(context));
+
+	slid = cl_ntoh16(p_osmt->local_port.lid);
+	dlid = cl_ntoh16(p_osmt->local_port.sm_lid);
+
+	/*
+	 * Do a blocking query for the PathRecord.
+	 */
+	status = osmtest_get_path_rec_by_lid_pair(p_osmt, slid, dlid, &context);
+	if (status != IB_SUCCESS) {
+		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 000A: "
+			"osmtest_get_path_rec_by_lid_pair failed (%s)\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+	/*
+	 * Populate the database with the received records.
+	 */
+	num_recs = context.result.result_cnt;
+	*p_num_recs += num_recs;
+	++*p_num_queries;
+
+	if (osm_log_is_active(&p_osmt->log, OSM_LOG_VERBOSE)) {
+		OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
+			"Received %u records\n", num_recs);
+
+		for (i = 0; i < num_recs; i++) {
+			p_rec = osmv_get_query_path_rec(context.result.p_result_madw, 0);
+			osm_dump_path_record(&p_osmt->log, p_rec, OSM_LOG_VERBOSE);
+		}
+	}
+
+Exit:
+	/*
+	 * Return the IB query MAD to the pool as necessary.
+	 */
+	if (context.result.p_result_madw != NULL) {
+		osm_mad_pool_put(&p_osmt->mad_pool,
+				 context.result.p_result_madw);
+		context.result.p_result_madw = NULL;
+	}
+
+	OSM_LOG_EXIT(&p_osmt->log);
+	return (status);
+}
+
+static ib_api_status_t osmtest_stress_get_pr(IN osmtest_t * const p_osmt)
+{
+	ib_api_status_t status = IB_SUCCESS;
+	uint64_t num_recs = 0;
+	uint64_t num_queries = 0;
+	uint32_t delta_recs;
+	uint32_t delta_queries;
+	uint32_t print_freq = 0;
+	int num_timeouts = 0;
+	struct timeval start_tv, end_tv;
+	long sec_diff, usec_diff;
+
+	OSM_LOG_ENTER(&p_osmt->log);
+	gettimeofday(&start_tv, NULL);
+	printf("-I- Start time is : %09ld:%06ld [sec:usec]\n",
+	       start_tv.tv_sec, (long)start_tv.tv_usec);
+
+	while ((num_queries < STRESS_GET_PR) && (num_timeouts < 100)) {
+		delta_recs = 0;
+		delta_queries = 0;
+
+		status = osmtest_stress_path_recs_by_lid(p_osmt,
+							 &delta_recs,
+							 &delta_queries);
+		if (status == IB_TIMEOUT) {
+			num_timeouts++;
+			continue;
+		}
+		else if (status != IB_SUCCESS)
+			goto Exit;
+
+		num_recs += delta_recs;
+		num_queries += delta_queries;
+
+		print_freq += delta_recs;
+		if (print_freq > 5000) {
+			gettimeofday(&end_tv, NULL);
+			printf("%" PRIu64 " records, %" PRIu64 " queries\n",
+			       num_recs, num_queries);
+			if (end_tv.tv_usec > start_tv.tv_usec) {
+				sec_diff = end_tv.tv_sec - start_tv.tv_sec;
+				usec_diff = end_tv.tv_usec - start_tv.tv_usec;
+			} else {
+				sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1;
+				usec_diff =
+				    1000000 - (start_tv.tv_usec -
+					       end_tv.tv_usec);
+			}
+			printf("-I- End time is : %09ld:%06ld [sec:usec]\n",
+			       end_tv.tv_sec, (long)end_tv.tv_usec);
+			printf("-I- Querying %" PRId64
+			       " path_rec queries took %04ld:%06ld [sec:usec]\n",
+			       num_queries, sec_diff, usec_diff);
+			print_freq = 0;
+		}
+	}
+
+Exit:
+	gettimeofday(&end_tv, NULL);
+	printf("-I- End time is : %09ld:%06ld [sec:usec]\n",
+	       end_tv.tv_sec, (long)end_tv.tv_usec);
+	if (end_tv.tv_usec > start_tv.tv_usec) {
+		sec_diff = end_tv.tv_sec - start_tv.tv_sec;
+		usec_diff = end_tv.tv_usec - start_tv.tv_usec;
+	} else {
+		sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1;
+		usec_diff = 1000000 - (start_tv.tv_usec - end_tv.tv_usec);
+	}
+
+	printf("-I- Querying %" PRId64
+	       " path_rec queries took %04ld:%06ld [sec:usec]\n",
+	       num_queries, sec_diff, usec_diff);
+	if (num_timeouts > 50) {
+		status = IB_TIMEOUT;
+	}
+	/* Exit: */
+	OSM_LOG_EXIT(&p_osmt->log);
+	return (status);
+}
+
 static void
 osmtest_prepare_db_generic(IN osmtest_t * const p_osmt,
 			   IN cl_qmap_t * const p_tbl)
@@ -2899,8 +2964,6 @@ osmtest_prepare_db_generic(IN osmtest_t * const p_osmt,
 	OSM_LOG_EXIT(&p_osmt->log);
 }
 
-/**********************************************************************
- **********************************************************************/
 static void osmtest_prepare_db(IN osmtest_t * const p_osmt)
 {
 	OSM_LOG_ENTER(&p_osmt->log);
@@ -2911,8 +2974,6 @@ static void osmtest_prepare_db(IN osmtest_t * const p_osmt)
 	OSM_LOG_EXIT(&p_osmt->log);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t osmtest_check_missing_nodes(IN osmtest_t * const p_osmt)
 {
 	const node_t *p_node;
@@ -2943,8 +3004,6 @@ static ib_api_status_t osmtest_check_missing_nodes(IN osmtest_t * const p_osmt)
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t osmtest_check_missing_ports(IN osmtest_t * const p_osmt)
 {
 	const port_t *p_port;
@@ -2976,8 +3035,6 @@ static ib_api_status_t osmtest_check_missing_ports(IN osmtest_t * const p_osmt)
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t osmtest_check_missing_paths(IN osmtest_t * const p_osmt)
 {
 	const path_t *p_path;
@@ -3011,15 +3068,11 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 inline uint32_t osmtest_path_rec_key_get(IN const ib_path_rec_t * const p_rec)
 {
 	return (p_rec->dlid << 16 | p_rec->slid);
 }
 
-/**********************************************************************
- **********************************************************************/
 static boolean_t
 osmtest_path_rec_kay_is_valid(IN osmtest_t * const p_osmt,
 			      IN const path_t * const p_path)
@@ -3033,8 +3086,6 @@ osmtest_path_rec_kay_is_valid(IN osmtest_t * const p_osmt,
 	return (TRUE);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_path_data(IN osmtest_t * const p_osmt,
 			   IN path_t * const p_path,
@@ -3144,8 +3195,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_node_data(IN osmtest_t * const p_osmt,
 			   IN node_t * const p_node,
@@ -3323,8 +3372,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_node_rec(IN osmtest_t * const p_osmt,
 			  IN const ib_node_record_t * const p_rec)
@@ -3356,8 +3403,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_port_data(IN osmtest_t * const p_osmt,
 			   IN port_t * const p_port,
@@ -3835,8 +3880,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_port_rec(IN osmtest_t * const p_osmt,
 			  IN const ib_portinfo_record_t * const p_rec)
@@ -3870,8 +3913,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_path_rec(IN osmtest_t * const p_osmt,
 			  IN const ib_path_rec_t * const p_rec)
@@ -3905,8 +3946,6 @@ Exit:
 #ifdef VENDOR_RMPP_SUPPORT
 ib_net64_t portguid = 0;
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_all_node_recs(IN osmtest_t * const p_osmt)
 {
@@ -3980,8 +4019,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_all_guidinfo_recs(IN osmtest_t * const p_osmt)
 {
@@ -4028,8 +4065,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_all_path_recs(IN osmtest_t * const p_osmt)
 {
@@ -4141,7 +4176,6 @@ osmtest_get_link_rec_by_lid(IN osmtest_t * const p_osmt,
 	if (to_lid)
 		user.comp_mask |= IB_LR_COMPMASK_TO_LID;
 	user.attr_id = IB_MAD_ATTR_LINK_RECORD;
-	user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));
 	user.p_attr = &record;
 
 	req.query_type = OSMV_QUERY_USER_DEFINED;
@@ -4219,7 +4253,6 @@ osmtest_get_guidinfo_rec_by_lid(IN osmtest_t * const p_osmt,
 	p_context->p_osmt = p_osmt;
 	user.comp_mask = IB_GIR_COMPMASK_LID;
 	user.attr_id = IB_MAD_ATTR_GUIDINFO_RECORD;
-	user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));
 	user.p_attr = &record;
 
 	req.query_type = OSMV_QUERY_USER_DEFINED;
@@ -4298,7 +4331,6 @@ osmtest_get_pkeytbl_rec_by_lid(IN osmtest_t * const p_osmt,
 	p_context->p_osmt = p_osmt;
 	user.comp_mask = IB_PKEY_COMPMASK_LID;
 	user.attr_id = IB_MAD_ATTR_PKEY_TBL_RECORD;
-	user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));
 	user.p_attr = &record;
 
 	req.query_type = OSMV_QUERY_USER_DEFINED;
@@ -4377,7 +4409,6 @@ osmtest_get_sw_info_rec_by_lid(IN osmtest_t * const p_osmt,
 	if (lid)
 		user.comp_mask = IB_SWIR_COMPMASK_LID;
 	user.attr_id = IB_MAD_ATTR_SWITCH_INFO_RECORD;
-	user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));
 	user.p_attr = &record;
 
 	req.query_type = OSMV_QUERY_USER_DEFINED;
@@ -4456,7 +4487,6 @@ osmtest_get_lft_rec_by_lid(IN osmtest_t * const p_osmt,
 	if (lid)
 		user.comp_mask = IB_LFTR_COMPMASK_LID;
 	user.attr_id = IB_MAD_ATTR_LFT_RECORD;
-	user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));
 	user.p_attr = &record;
 
 	req.query_type = OSMV_QUERY_USER_DEFINED;
@@ -4535,7 +4565,6 @@ osmtest_get_mft_rec_by_lid(IN osmtest_t * const p_osmt,
 	if (lid)
 		user.comp_mask = IB_MFTR_COMPMASK_LID;
 	user.attr_id = IB_MAD_ATTR_MFT_RECORD;
-	user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));
 	user.p_attr = &record;
 
 	req.query_type = OSMV_QUERY_USER_DEFINED;
@@ -4579,8 +4608,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_sminfo_record_request(IN osmtest_t * const p_osmt,
 			      IN uint8_t method,
@@ -4609,7 +4636,6 @@ osmtest_sminfo_record_request(IN osmtest_t * const p_osmt,
 
 	p_context->p_osmt = p_osmt;
 	user.attr_id = IB_MAD_ATTR_SMINFO_RECORD;
-	user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));
 	p_sm_info_opt = p_options;
 	if (p_sm_info_opt->sm_guid != 0) {
 		record.sm_info.guid = p_sm_info_opt->sm_guid;
@@ -4676,8 +4702,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_informinfo_request(IN osmtest_t * const p_osmt,
 			   IN ib_net16_t attr_id,
@@ -4711,7 +4735,6 @@ osmtest_informinfo_request(IN osmtest_t * const p_osmt,
 	p_context->p_osmt = p_osmt;
 	user.attr_id = attr_id;
 	if (attr_id == IB_MAD_ATTR_INFORM_INFO_RECORD) {
-		user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));
 		p_inform_info_rec_opt = p_options;
 		if (p_inform_info_rec_opt->subscriber_gid.unicast.prefix != 0 &&
 		    p_inform_info_rec_opt->subscriber_gid.unicast.
@@ -4725,7 +4748,6 @@ osmtest_informinfo_request(IN osmtest_t * const p_osmt,
 		user.comp_mask |= IB_IIR_COMPMASK_ENUM;
 		user.p_attr = &record;
 	} else {
-		user.attr_offset = cl_ntoh16((uint16_t) (sizeof(rec) >> 3));
 		/* comp mask bits below are for InformInfoRecord rather than InformInfo */
 		/* as currently no comp mask bits defined for InformInfo!!! */
 		user.comp_mask = IB_IIR_COMPMASK_SUBSCRIBE;
@@ -4790,8 +4812,6 @@ Exit:
 }
 #endif
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_single_path_rec_lid_pair(IN osmtest_t * const p_osmt,
 					  IN path_t * const p_path)
@@ -4847,8 +4867,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_single_node_rec_lid(IN osmtest_t * const p_osmt,
 				     IN ib_net16_t const lid,
@@ -4878,7 +4896,6 @@ osmtest_validate_single_node_rec_lid(IN osmtest_t * const p_osmt,
 	context.p_osmt = p_osmt;
 	user.comp_mask = IB_NR_COMPMASK_LID;
 	user.attr_id = IB_MAD_ATTR_NODE_RECORD;
-	user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));
 	user.p_attr = &record;
 
 	req.query_type = OSMV_QUERY_USER_DEFINED;
@@ -4945,8 +4962,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_single_port_rec_lid(IN osmtest_t * const p_osmt,
 				     IN port_t * const p_port)
@@ -4994,8 +5009,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_single_path_rec_guid_pair(IN osmtest_t * const p_osmt,
 					   IN const osmv_guid_pair_t *
@@ -5114,8 +5127,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_single_path_recs(IN osmtest_t * const p_osmt)
 {
@@ -5198,8 +5209,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_single_node_recs(IN osmtest_t * const p_osmt)
 {
@@ -5252,8 +5261,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_validate_single_port_recs(IN osmtest_t * const p_osmt)
 {
@@ -5304,8 +5311,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t osmtest_validate_against_db(IN osmtest_t * const p_osmt)
 {
 	ib_api_status_t status = IB_SUCCESS;
@@ -6018,8 +6023,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static const osmtest_token_t *str_get_token(IN char *const p_str)
 {
 	const osmtest_token_t *p_tok;
@@ -6028,7 +6031,7 @@ static const osmtest_token_t *str_get_token(IN char *const p_str)
 	p_tok = &token_array[index];
 
 	while (p_tok->val != OSMTEST_TOKEN_UNKNOWN) {
-		if (strnicmp(p_str, p_tok->str, p_tok->str_size) == 0)
+		if (strncasecmp(p_str, p_tok->str, p_tok->str_size) == 0)
 			return (p_tok);
 
 		p_tok = &token_array[++index];
@@ -6066,8 +6069,6 @@ static void str_skip_token(IN char line[], IN OUT uint32_t * const p_offset)
 	}
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_parse_node(IN osmtest_t * const p_osmt,
 		   IN FILE * const fh, IN OUT uint32_t * const p_line_num)
@@ -6293,8 +6294,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_parse_port(IN osmtest_t * const p_osmt,
 		   IN FILE * const fh, IN OUT uint32_t * const p_line_num)
@@ -6700,8 +6699,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_parse_path(IN osmtest_t * const p_osmt,
 		   IN FILE * const fh, IN OUT uint32_t * const p_line_num)
@@ -6861,8 +6858,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
 osmtest_parse_link(IN osmtest_t * const p_osmt,
 		   IN FILE * const fh, IN OUT uint32_t * const p_line_num)
@@ -6942,8 +6937,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t osmtest_create_db(IN osmtest_t * const p_osmt)
 {
 	FILE *fh;
@@ -7046,9 +7039,7 @@ osmtest_get_user_port(IN osmtest_t * const p_osmt,
 		      IN const ib_port_attr_t p_attr_array[],
 		      IN uint32_t const num_ports)
 {
-	uint32_t i;
-	uint32_t choice = 0;
-	boolean_t done_flag = FALSE;
+	uint32_t i, choice = 0;
 
 	OSM_LOG_ENTER(&p_osmt->log);
 
@@ -7057,7 +7048,7 @@ osmtest_get_user_port(IN osmtest_t * const p_osmt,
 	 * to bind.
 	 */
 
-	while (done_flag == FALSE) {
+	while (1) {
 		printf("\nChoose a local port number with which to bind:\n\n");
 		for (i = 0; i < num_ports; i++) {
 			/*
@@ -7074,28 +7065,28 @@ osmtest_get_user_port(IN osmtest_t * const p_osmt,
 		}
 
 		printf("\nEnter choice (1-%u): ", i);
-		scanf("%u", &choice);
-		if (choice > num_ports)
-			printf("\nError: Lame choice!\n");
-		else
-			done_flag = TRUE;
-
+		fflush(stdout);
+		if (scanf("%u", &choice) <= 0) {
+			char junk[256];
+			if (scanf("%s", junk) <= 0)
+				printf("\nError: Cannot scan!\n");
+		} else if (choice && choice <= num_ports)
+			break;
+		printf("\nError: Lame choice!\n");
 	}
 	printf("\n");
 	OSM_LOG_EXIT(&p_osmt->log);
 	return (choice - 1);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t
 osmtest_bind(IN osmtest_t * p_osmt,
 	     IN uint16_t max_lid, IN ib_net64_t guid OPTIONAL)
 {
 	uint32_t port_index;
 	ib_api_status_t status;
-	uint32_t num_ports = GUID_ARRAY_SIZE;
-	ib_port_attr_t attr_array[GUID_ARRAY_SIZE];
+	uint32_t num_ports = MAX_LOCAL_IBPORTS;
+	ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS] = { {0} };
 
 	OSM_LOG_ENTER(&p_osmt->log);
 
@@ -7167,8 +7158,6 @@ Exit:
 	return (status);
 }
 
-/**********************************************************************
- **********************************************************************/
 ib_api_status_t osmtest_run(IN osmtest_t * const p_osmt)
 {
 	ib_api_status_t status = IB_SUCCESS;
@@ -7240,6 +7229,16 @@ ib_api_status_t osmtest_run(IN osmtest_t * const p_osmt)
 					goto Exit;
 				}
 				break;
+			case 4: /* SA Get PR to SA LID */
+				status = osmtest_stress_get_pr(p_osmt);
+				if (status != IB_SUCCESS) {
+					OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,
+						"ERR 014B: "
+						"SA Get PR stress test failed (%s)\n",
+						ib_get_err_str(status));
+					goto Exit;
+				}
+				break;
 			default:
 				OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,
 					"ERR 0144: "
@@ -7369,7 +7368,7 @@ ib_api_status_t osmtest_run(IN osmtest_t * const p_osmt)
 				}
 #else
 				OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
-					"The event forwarding flow "
+					"Trap 64/65 flow "
 					"is not implemented yet!\n");
 				status = IB_SUCCESS;
 				goto Exit;
diff --git a/scripts/opensm.init.in b/scripts/opensm.init
similarity index 94%
copy from scripts/opensm.init.in
copy to scripts/opensm.init
index 52293eb..4195092 100644
--- a/scripts/opensm.init.in
+++ b/scripts/opensm.init
@@ -8,6 +8,7 @@
 ### BEGIN INIT INFO
 # Provides: opensm
 # Required-Start: $syslog
+# Required-Stop:
 # Default-Start: none
 # Default-Stop: 0 1 6
 # Description:  Manage OpenSM
@@ -39,8 +40,8 @@
 # notice, one of the license notices in the documentation
 # and/or other materials provided with the distribution.
 
-prefix=@prefix@
-exec_prefix=@exec_prefix@
+prefix=/usr/local
+exec_prefix=${prefix}
 
 # Source function library.
 if [[ -s /etc/init.d/functions ]]; then
@@ -54,14 +55,14 @@ if [[ -s /etc/rc.status ]]; then
     success() { rc_status -v; }
 fi
 
-CONFIG=@sysconfdir@/sysconfig/opensm
+CONFIG=${prefix}/etc/sysconfig/opensm
 if [[ -s $CONFIG ]]; then
     . $CONFIG
 fi
 
 start () {
     echo -n "Starting opensm: "
-    @sbindir@/opensm --daemon $OPTIONS > /dev/null
+    ${exec_prefix}/sbin/opensm --daemon $OPTIONS > /dev/null
     if [[ $RETVAL -eq 0 ]]; then
         touch /var/lock/subsys/opensm
         success
diff --git a/scripts/opensm.init.in b/scripts/opensm.init.in
index 52293eb..0c84bd3 100644
--- a/scripts/opensm.init.in
+++ b/scripts/opensm.init.in
@@ -8,6 +8,7 @@
 ### BEGIN INIT INFO
 # Provides: opensm
 # Required-Start: $syslog
+# Required-Stop:
 # Default-Start: none
 # Default-Stop: 0 1 6
 # Description:  Manage OpenSM
diff --git a/scripts/redhat-opensm.init b/scripts/redhat-opensm.init
new file mode 100644
index 0000000..24a5663
--- /dev/null
+++ b/scripts/redhat-opensm.init
@@ -0,0 +1,292 @@
+#!/bin/bash
+#
+# Bring up/down opensm
+#
+# chkconfig: - 15 85
+# description: Activates/Deactivates InfiniBand Subnet Manager
+#
+### BEGIN INIT INFO
+# Provides:       opensm
+### END INIT INFO
+#
+# Copyright (c) 2008 Voltaire, Inc. All rights reserved.
+# Copyright (c) 2006 Mellanox Technologies. All rights reserved.
+#
+# This Software is licensed under one of the following licenses:
+#
+# 1) under the terms of the "Common Public License 1.0" a copy of which is
+#    available from the Open Source Initiative, see
+#    http://www.opensource.org/licenses/cpl.php.
+#
+# 2) under the terms of the "The BSD License" a copy of which is
+#    available from the Open Source Initiative, see
+#    http://www.opensource.org/licenses/bsd-license.php.
+#
+# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
+#    copy of which is available from the Open Source Initiative, see
+#    http://www.opensource.org/licenses/gpl-license.php.
+#
+# Licensee has the right to choose one of the above licenses.
+#
+# Redistributions of source code must retain the above copyright
+# notice and one of the license notices.
+#
+# Redistributions in binary form must reproduce both the above copyright
+# notice, one of the license notices in the documentation
+# and/or other materials provided with the distribution.
+#
+#
+#  $Id: openib-1.0-opensm.init,v 1.5 2006/08/02 18:18:23 dledford Exp $
+#
+# processname: ${exec_prefix}/sbin/opensm
+# config: ${prefix}/etc/sysconfig/opensm
+# pidfile: /var/run/opensm.pid
+
+prefix=/usr/local
+exec_prefix=${prefix}
+
+. /etc/rc.d/init.d/functions
+
+CONFIG=${prefix}/etc/sysconfig/opensm
+if [ -f $CONFIG ]; then
+    . $CONFIG
+fi
+
+prog=${exec_prefix}/sbin/opensm
+bin=${prog##*/}
+
+# Handover daemon for updating guid2lid cache file
+sldd_prog=${exec_prefix}/sbin/sldd.sh
+sldd_bin=${sldd_prog##*/}
+sldd_pid_file=/var/run/sldd.pid
+
+ACTION=$1
+
+# Setting OpenSM start parameters
+PID_FILE=/var/run/${bin}.pid
+touch $PID_FILE
+
+if [[ -n "${OSM_HOSTS}" && $(echo -n ${OSM_HOSTS} | wc -w | tr -d '[:space:]') -gt 1  ]]; then
+    HONORE_GUID2LID="--honor_guid2lid"
+fi
+
+#########################################################################
+
+start_sldd()
+{
+    if [ -f $sldd_pid_file ]; then
+            local line p
+            read line < $sldd_pid_file
+            for p in $line ; do
+                    [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && sldd_pid="$sldd_pid $p"
+            done
+    fi
+
+    if [ -z "$sldd_pid" ]; then
+        sldd_pid=`pidof -x $sldd_bin`
+    fi
+
+    if [ -n "${sldd_pid:-}" ] ; then
+	kill -9 ${sldd_pid} > /dev/null 2>&1
+    fi
+
+    $sldd_prog > /dev/null 2>&1 &
+    sldd_pid=$!
+
+    echo ${sldd_pid} > $sldd_pid_file
+    # Sleep is needed in order to update local gid2lid cache file before running opensm
+    sleep 3
+}
+
+stop_sldd()
+{
+    if [ -f $sldd_pid_file ]; then
+            local line p
+            read line < $sldd_pid_file
+            for p in $line ; do
+                    [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && sldd_pid="$sldd_pid $p"
+            done
+    fi
+
+    if [ -z "$sldd_pid" ]; then
+        sldd_pid=`pidof -x $sldd_bin`
+    fi
+
+    if [ -n "${sldd_pid:-}" ] ; then
+        kill -15 ${sldd_pid} > /dev/null 2>&1
+    fi
+
+}
+
+start()
+{
+    local OSM_PID=
+
+    pid=""
+
+    if [ -f $PID_FILE ]; then
+            local line p
+            read line < $PID_FILE
+            for p in $line ; do
+                    [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p"
+            done
+    fi
+
+    if [ -z "$pid" ]; then
+        pid=`pidof -o $$ -o $PPID -o %PPID -x $bin`
+    fi
+
+    if [ -n "${pid:-}" ] ; then
+        echo $"${bin} (pid $pid) is already running..."
+    else
+
+	if [ -n "${HONORE_GUID2LID}" ]; then
+		# Run sldd daemod
+		start_sldd
+	fi
+
+        # Start opensm
+	echo -n "Starting IB Subnet Manager"
+        $prog --daemon ${HONORE_GUID2LID} ${OPTIONS} > /dev/null
+        cnt=0; alive=0
+        while [ $cnt -lt 6 -a $alive -ne 1 ]; do
+		echo -n ".";
+		sleep 1
+		alive=0
+                OSM_PID=`pidof $prog`
+                if [ "$OSM_PID" != "" ]; then
+                        alive=1
+                fi
+		let cnt++;
+	done
+
+        echo $OSM_PID > $PID_FILE
+        checkpid $OSM_PID
+        RC=$?
+        [ $RC -eq 0 ] && echo_success || echo_failure
+        [ $RC -eq 0 ] && touch /var/lock/subsys/opensm
+	echo
+
+    fi
+return $RC
+}
+
+stop()
+{
+    local pid=
+    local pid1=
+    local pid2=
+
+    # Stop sldd daemon
+    stop_sldd
+
+    if [ -f $PID_FILE ]; then
+            local line p
+            read line < $PID_FILE
+            for p in $line ; do
+                    [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid1="$pid1 $p"
+            done
+    fi
+
+    pid2=`pidof -o $$ -o $PPID -o %PPID -x $bin`
+
+    pid=`echo "$pid1 $pid2" | sed -e 's/\ /\n/g' | sort -n | uniq | sed -e 's/\n/\ /g'`
+
+    if [ -n "${pid:-}" ] ; then
+        # Kill opensm
+	echo -n "Stopping IB Subnet Manager."
+        kill -15 $pid > /dev/null 2>&1
+		cnt=0; alive=1
+        while [ $cnt -lt 6 -a $alive -ne 0 ]; do
+		echo -n ".";
+		alive=0
+		for p in $pid; do
+			if checkpid $p ; then alive=1; echo -n "-"; fi
+		done
+		let cnt++;
+		sleep $alive
+	done
+
+        for p in $pid
+        do
+            while checkpid $p ; do
+                kill -KILL $p > /dev/null 2>&1
+                echo -n "+"
+                sleep 1
+            done
+        done
+        checkpid $pid
+        RC=$?
+        [ $RC -eq 0 ] && echo_failure || echo_success
+	echo
+        RC=$((! $RC))
+    else
+	echo -n "Stopping IB Subnet Manager."
+        echo_failure
+	echo
+        RC=1
+    fi
+
+    # Remove pid file if any.
+    rm -f $PID_FILE
+    rm -f /var/lock/subsys/opensm
+    return $RC
+}
+
+status()
+{
+    local pid
+
+    # First try "pidof"
+    pid=`pidof -o $$ -o $PPID -o %PPID -x ${bin}`
+    if [ -n "$pid" ]; then
+            echo $"${bin} (pid $pid) is running..."
+            return 0
+    fi
+
+     # Next try "/var/run/opensm.pid" files
+     if [ -f $PID_FILE ] ; then
+             read pid < $PID_FILE
+             if [ -n "$pid" ]; then
+                     echo $"${bin} dead but pid file $PID_FILE exists"
+                     return 1
+             fi
+     fi
+     echo $"${bin} is stopped"
+     return 3
+}
+
+
+
+case $ACTION in
+	start)
+                start
+		;;
+	stop)
+		stop
+		;;
+	restart)
+		stop
+                start
+		;;
+	status)
+		status
+		;;
+	condrestart)
+		pid=`pidof -o $$ -o $PPID -o %PPID -x $bin`
+		if [ -n "$pid" ]; then
+			stop
+			sleep 1
+			start
+		fi
+		;;
+	*)
+		echo
+		echo "Usage: `basename $0` {start|stop|restart|status}"
+		echo
+		exit 1
+		;;
+esac
+
+RC=$?
+exit $RC
diff --git a/scripts/sldd.sh.in b/scripts/sldd.sh
old mode 100755
new mode 100644
similarity index 54%
copy from scripts/sldd.sh.in
copy to scripts/sldd.sh
index f7635fe..7943dfa
--- a/scripts/sldd.sh.in
+++ b/scripts/sldd.sh
@@ -39,19 +39,19 @@
 # the semi-static LID assignment table from the master SM to all standby SMs.
 # A standby SM, becoming a master . needs to obey the copied semi static LID assignment table.
 
-prefix=@prefix@
-exec_prefix=@exec_prefix@
+prefix=/usr/local
+exec_prefix=${prefix}
 
-CONFIG=@sysconfdir@/sysconfig/opensm
+CONFIG=${prefix}/etc/sysconfig/opensm
 if [ -f $CONFIG ]; then
 	. $CONFIG
 fi
 
 SLDD_DEBUG=${SLDD_DEBUG:-0}
 
-CACHE_FILE=${CACHE_FILE:-/var/cache/opensm/guid2lid}
-CACHE_DIR=$(dirname ${CACHE_FILE})
-tmp_cache=${CACHE_FILE}.tmp
+CACHE_FILE=${CACHE_FILE:-/var/cache/opensm/guid2lid:/var/cache/opensm/guid2mkey:/var/cache/opensm/neighbors}
+declare -a arr_CACHE_FILES
+arr_CACHE_FILES=(`echo $CACHE_FILE| sed 's/:/\n/g' | sort | uniq`)
 
 PING='ping -w 1 -c 1'
 
@@ -104,8 +104,8 @@ is_local()
 
 update_remote_cache()
 {
-	/bin/rm -f ${CACHE_FILE}.upd
-	/bin/cp -a ${CACHE_FILE} ${CACHE_FILE}.upd
+	/bin/rm -f "$1.upd"
+	/bin/cp -a "$1" "$1.upd"
 
 	[ $SLDD_DEBUG -eq 1 ] &&
 	echo "Updating remote cache file"
@@ -118,17 +118,18 @@ update_remote_cache()
 		fi
 
 		if is_alive $host; then
-			stat=$($RSH $host "/bin/mkdir -p ${CACHE_DIR} > /dev/null 2>&1; /bin/rm -f ${CACHE_FILE}.${local_host} > /dev/null 2>&1; echo \$?" | tr -d '[:space:]')
+			cache_dir=$(dirname "$1")
+			stat=$($RSH $host "/bin/mkdir -p ${cache_dir} > /dev/null 2>&1; /bin/rm -f "$1.${local_host}" > /dev/null 2>&1; echo \$?" | tr -d '[:space:]')
 			if [ "X${stat}" == "X0" ]; then
 				[ $SLDD_DEBUG -eq 1 ] &&
 				echo "Updating $host"
-				logger -i "SLDD: updating $host with ${CACHE_FILE}"
-				$RCP ${CACHE_FILE}.upd ${host}:${CACHE_FILE}.${local_host}
-				/bin/cp ${CACHE_FILE}.upd ${CACHE_FILE}.${host}
+				logger -i "SLDD: updating $host with $1"
+				$RCP "$1.upd" "${host}:$1.${local_host}"
+				/bin/cp "$1.upd" "$1.${host}"
 			else
 				[ $SLDD_DEBUG -eq 1 ] &&
 				echo "$RSH to $host failed."
-				logger -i "SLDD: Failed to update $host with ${CACHE_FILE}. $RSH without password should be enabled"
+				logger -i "SLDD: Failed to update $host with $1. $RSH without password should be enabled"
 				exit 5
 			fi
 		else
@@ -142,21 +143,21 @@ update_remote_cache()
 get_latest_remote_cache()
 {
 	# Find most updated remote cache file (the suffix should be like ip address: *.*.*.*)
-	echo -n "$(/bin/ls -1t ${CACHE_FILE}.*.* 2> /dev/null | head -1)"
+	echo -n "$(/bin/ls -1t $1.*.* 2> /dev/null | head -1)"
 }
 
 get_largest_remote_cache()
 {
 	# Find largest (size) remote cache file (the suffix should be like ip address: *.*.*.*)
-	echo -n "$(/bin/ls -1S ${CACHE_FILE}.*.* 2> /dev/null | head -1)"
+	echo -n "$(/bin/ls -1S $1.*.* 2> /dev/null | head -1)"
 }
 
 swap_cache_files()
 {
-	/bin/rm -f ${CACHE_FILE}.old
-	/bin/mv ${CACHE_FILE} ${CACHE_FILE}.old
-	/bin/cp ${largest_remote_cache} ${CACHE_FILE}
-	touch ${CACHE_FILE}.tmp
+	/bin/rm -f "$1.old"
+	/bin/mv "$1" "$1.old"
+	/bin/cp "$2" "$1"
+	touch "$1.tmp"
 }
 
 # Find local host in the osm hosts list
@@ -170,74 +171,86 @@ done
 
 # Get cache file info
 declare -i new_size=0
-declare -i last_size=0
+declare -ai arr_last_size
+for i in  ${!arr_CACHE_FILES[@]}
+do
+	arr_last_size[$i]=0
+done
 declare -i largest_remote_cache_size=0
 
-if [ -e ${CACHE_FILE} ]; then
-	last_size=$(du -b ${CACHE_FILE} | awk '{print$1}' | tr -d '[:space:]')
-else
-	touch ${CACHE_FILE} ${CACHE_FILE}.tmp
-fi
+for i in ${!arr_CACHE_FILES[@]}
+do
+	cache_file=${arr_CACHE_FILES[$i]}
+	if [ -e ${cache_file} ]; then
+		arr_last_size[$i]=$(du -b ${cache_file} | awk '{print$1}' | tr -d '[:space:]')
+	else
+		touch ${cache_file} ${cache_file}.tmp
+	fi
 
-# if [ ${last_size} -gt 0 ]; then
-# 	# First time update
-# 	update_remote_cache
-# fi
+#	if [ ${arr_last_size[$i]} -gt 0 ]; then
+#		# First time update
+#		update_remote_cache ${cache_file}
+#	fi
+done
 
 while true
 do
-	if [ -s "${CACHE_FILE}" ]; then
-		new_size=$(du -b ${CACHE_FILE} | awk '{print$1}' | tr -d '[:space:]')
-		# Check if local cache file grew from its last version or the time stamp changed
-		if [ ${new_size} -gt ${last_size} ]
-		   [ "$(/bin/ls -1t ${CACHE_FILE} ${CACHE_FILE}.tmp 2> /dev/null | head -1)"  != "${CACHE_FILE}.tmp" ]; then
-			largest_remote_cache=$(get_largest_remote_cache)
+	for i in ${!arr_CACHE_FILES[@]}
+	do
+		cache_file=${arr_CACHE_FILES[$i]}
+		if [ -s "${cache_file}" ]; then
+			new_size=$(du -b ${cache_file} | awk '{print$1}' | tr -d '[:space:]')
+			# Check if local cache file grew from its last version or the time stamp changed
+			if [ ${new_size} -gt ${arr_last_size[$i]} ]
+			   [ "$(/bin/ls -1t ${cache_file} ${cache_file}.tmp 2> /dev/null | head -1)"  != "${cache_file}.tmp" ]; then
+				largest_remote_cache=$(get_largest_remote_cache ${cache_file})
+				if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then
+					largest_remote_cache_size=$(du -b ${largest_remote_cache} 2> /dev/null | awk '{print$1}' | tr -d '[:space:]')
+				else
+					largest_remote_cache_size=0
+				fi
+
+				# Check if local cache file larger than remote chache file
+				if [ ${new_size} -gt ${largest_remote_cache_size} ]; then
+					[ $SLDD_DEBUG -eq 1 ] &&
+					echo "Local cache file larger then remote. Update remote cache files"
+					arr_last_size[$i]=${new_size}
+					update_remote_cache ${cache_file}
+					continue
+				fi
+			fi
+
+			largest_remote_cache=$(get_largest_remote_cache ${cache_file})
 			if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then
 				largest_remote_cache_size=$(du -b ${largest_remote_cache} 2> /dev/null | awk '{print$1}' | tr -d '[:space:]')
 			else
 				largest_remote_cache_size=0
 			fi
 
-			# Check if local cache file larger than remote chache file
-			if [ ${new_size} -gt ${largest_remote_cache_size} ]; then
+			# Update local cache file from remote
+			if [ ${largest_remote_cache_size} -gt ${new_size} ]; then
 				[ $SLDD_DEBUG -eq 1 ] &&
-				echo "Local cache file larger then remote. Update remote cache files"
-				last_size=${new_size}
-				update_remote_cache
-				continue
+				echo "Local cache file shorter then remote. Use ${largest_remote_cache}"
+				logger -i "SLDD: updating local cache file with ${largest_remote_cache}"
+				swap_cache_files ${cache_file} ${largest_remote_cache}
+				arr_last_size[$i]=${largest_remote_cache_size}
 			fi
-		fi
 
-		largest_remote_cache=$(get_largest_remote_cache)
-		if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then
-			largest_remote_cache_size=$(du -b ${largest_remote_cache} 2> /dev/null | awk '{print$1}' | tr -d '[:space:]')
-		else
-			largest_remote_cache_size=0
-		fi
-
-		# Update local cache file from remote
-		if [ ${largest_remote_cache_size} -gt ${new_size} ]; then
+		else # The local cache file is empty
 			[ $SLDD_DEBUG -eq 1 ] &&
-			echo "Local cache file shorter then remote. Use ${largest_remote_cache}"
-			logger -i "SLDD: updating local cache file with ${largest_remote_cache}"
-			swap_cache_files
-			last_size=${largest_remote_cache_size}
-		fi
+			echo "${cache_file} is empty"
 
-	else # The local cache file is empty
-		[ $SLDD_DEBUG -eq 1 ] &&
-		echo "${CACHE_FILE} is empty"
+			largest_remote_cache=$(get_largest_remote_cache ${cache_file})
+			if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then
+				# Copy it to the current cache
+				[ $SLDD_DEBUG -eq 1 ] &&
+				echo "Local cache file is empty. Use ${largest_remote_cache}"
+				logger -i "SLDD: updating local cache file with ${largest_remote_cache}"
+				swap_cache_files ${cache_file} ${largest_remote_cache}
+			fi
 
-		largest_remote_cache=$(get_largest_remote_cache)
-		if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then
-			# Copy it to the current cache
-			[ $SLDD_DEBUG -eq 1 ] &&
-			echo "Local cache file is empty. Use ${largest_remote_cache}"
-			logger -i "SLDD: updating local cache file with ${largest_remote_cache}"
-			swap_cache_files
 		fi
-
-	fi
+	done
 
 	[ $SLDD_DEBUG -eq 1 ] &&
 	echo "Sleeping ${RESCAN_TIME} seconds."
diff --git a/scripts/sldd.sh.in b/scripts/sldd.sh.in
index f7635fe..9b0e282 100755
--- a/scripts/sldd.sh.in
+++ b/scripts/sldd.sh.in
@@ -49,9 +49,9 @@ fi
 
 SLDD_DEBUG=${SLDD_DEBUG:-0}
 
-CACHE_FILE=${CACHE_FILE:-/var/cache/opensm/guid2lid}
-CACHE_DIR=$(dirname ${CACHE_FILE})
-tmp_cache=${CACHE_FILE}.tmp
+CACHE_FILE=${CACHE_FILE:-/var/cache/opensm/guid2lid:/var/cache/opensm/guid2mkey:/var/cache/opensm/neighbors}
+declare -a arr_CACHE_FILES
+arr_CACHE_FILES=(`echo $CACHE_FILE| sed 's/:/\n/g' | sort | uniq`)
 
 PING='ping -w 1 -c 1'
 
@@ -104,8 +104,8 @@ is_local()
 
 update_remote_cache()
 {
-	/bin/rm -f ${CACHE_FILE}.upd
-	/bin/cp -a ${CACHE_FILE} ${CACHE_FILE}.upd
+	/bin/rm -f "$1.upd"
+	/bin/cp -a "$1" "$1.upd"
 
 	[ $SLDD_DEBUG -eq 1 ] &&
 	echo "Updating remote cache file"
@@ -118,17 +118,18 @@ update_remote_cache()
 		fi
 
 		if is_alive $host; then
-			stat=$($RSH $host "/bin/mkdir -p ${CACHE_DIR} > /dev/null 2>&1; /bin/rm -f ${CACHE_FILE}.${local_host} > /dev/null 2>&1; echo \$?" | tr -d '[:space:]')
+			cache_dir=$(dirname "$1")
+			stat=$($RSH $host "/bin/mkdir -p ${cache_dir} > /dev/null 2>&1; /bin/rm -f "$1.${local_host}" > /dev/null 2>&1; echo \$?" | tr -d '[:space:]')
 			if [ "X${stat}" == "X0" ]; then
 				[ $SLDD_DEBUG -eq 1 ] &&
 				echo "Updating $host"
-				logger -i "SLDD: updating $host with ${CACHE_FILE}"
-				$RCP ${CACHE_FILE}.upd ${host}:${CACHE_FILE}.${local_host}
-				/bin/cp ${CACHE_FILE}.upd ${CACHE_FILE}.${host}
+				logger -i "SLDD: updating $host with $1"
+				$RCP "$1.upd" "${host}:$1.${local_host}"
+				/bin/cp "$1.upd" "$1.${host}"
 			else
 				[ $SLDD_DEBUG -eq 1 ] &&
 				echo "$RSH to $host failed."
-				logger -i "SLDD: Failed to update $host with ${CACHE_FILE}. $RSH without password should be enabled"
+				logger -i "SLDD: Failed to update $host with $1. $RSH without password should be enabled"
 				exit 5
 			fi
 		else
@@ -142,21 +143,21 @@ update_remote_cache()
 get_latest_remote_cache()
 {
 	# Find most updated remote cache file (the suffix should be like ip address: *.*.*.*)
-	echo -n "$(/bin/ls -1t ${CACHE_FILE}.*.* 2> /dev/null | head -1)"
+	echo -n "$(/bin/ls -1t $1.*.* 2> /dev/null | head -1)"
 }
 
 get_largest_remote_cache()
 {
 	# Find largest (size) remote cache file (the suffix should be like ip address: *.*.*.*)
-	echo -n "$(/bin/ls -1S ${CACHE_FILE}.*.* 2> /dev/null | head -1)"
+	echo -n "$(/bin/ls -1S $1.*.* 2> /dev/null | head -1)"
 }
 
 swap_cache_files()
 {
-	/bin/rm -f ${CACHE_FILE}.old
-	/bin/mv ${CACHE_FILE} ${CACHE_FILE}.old
-	/bin/cp ${largest_remote_cache} ${CACHE_FILE}
-	touch ${CACHE_FILE}.tmp
+	/bin/rm -f "$1.old"
+	/bin/mv "$1" "$1.old"
+	/bin/cp "$2" "$1"
+	touch "$1.tmp"
 }
 
 # Find local host in the osm hosts list
@@ -170,74 +171,86 @@ done
 
 # Get cache file info
 declare -i new_size=0
-declare -i last_size=0
+declare -ai arr_last_size
+for i in  ${!arr_CACHE_FILES[@]}
+do
+	arr_last_size[$i]=0
+done
 declare -i largest_remote_cache_size=0
 
-if [ -e ${CACHE_FILE} ]; then
-	last_size=$(du -b ${CACHE_FILE} | awk '{print$1}' | tr -d '[:space:]')
-else
-	touch ${CACHE_FILE} ${CACHE_FILE}.tmp
-fi
+for i in ${!arr_CACHE_FILES[@]}
+do
+	cache_file=${arr_CACHE_FILES[$i]}
+	if [ -e ${cache_file} ]; then
+		arr_last_size[$i]=$(du -b ${cache_file} | awk '{print$1}' | tr -d '[:space:]')
+	else
+		touch ${cache_file} ${cache_file}.tmp
+	fi
 
-# if [ ${last_size} -gt 0 ]; then
-# 	# First time update
-# 	update_remote_cache
-# fi
+#	if [ ${arr_last_size[$i]} -gt 0 ]; then
+#		# First time update
+#		update_remote_cache ${cache_file}
+#	fi
+done
 
 while true
 do
-	if [ -s "${CACHE_FILE}" ]; then
-		new_size=$(du -b ${CACHE_FILE} | awk '{print$1}' | tr -d '[:space:]')
-		# Check if local cache file grew from its last version or the time stamp changed
-		if [ ${new_size} -gt ${last_size} ]
-		   [ "$(/bin/ls -1t ${CACHE_FILE} ${CACHE_FILE}.tmp 2> /dev/null | head -1)"  != "${CACHE_FILE}.tmp" ]; then
-			largest_remote_cache=$(get_largest_remote_cache)
+	for i in ${!arr_CACHE_FILES[@]}
+	do
+		cache_file=${arr_CACHE_FILES[$i]}
+		if [ -s "${cache_file}" ]; then
+			new_size=$(du -b ${cache_file} | awk '{print$1}' | tr -d '[:space:]')
+			# Check if local cache file grew from its last version or the time stamp changed
+			if [ ${new_size} -gt ${arr_last_size[$i]} ]
+			   [ "$(/bin/ls -1t ${cache_file} ${cache_file}.tmp 2> /dev/null | head -1)"  != "${cache_file}.tmp" ]; then
+				largest_remote_cache=$(get_largest_remote_cache ${cache_file})
+				if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then
+					largest_remote_cache_size=$(du -b ${largest_remote_cache} 2> /dev/null | awk '{print$1}' | tr -d '[:space:]')
+				else
+					largest_remote_cache_size=0
+				fi
+
+				# Check if local cache file larger than remote chache file
+				if [ ${new_size} -gt ${largest_remote_cache_size} ]; then
+					[ $SLDD_DEBUG -eq 1 ] &&
+					echo "Local cache file larger then remote. Update remote cache files"
+					arr_last_size[$i]=${new_size}
+					update_remote_cache ${cache_file}
+					continue
+				fi
+			fi
+
+			largest_remote_cache=$(get_largest_remote_cache ${cache_file})
 			if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then
 				largest_remote_cache_size=$(du -b ${largest_remote_cache} 2> /dev/null | awk '{print$1}' | tr -d '[:space:]')
 			else
 				largest_remote_cache_size=0
 			fi
 
-			# Check if local cache file larger than remote chache file
-			if [ ${new_size} -gt ${largest_remote_cache_size} ]; then
+			# Update local cache file from remote
+			if [ ${largest_remote_cache_size} -gt ${new_size} ]; then
 				[ $SLDD_DEBUG -eq 1 ] &&
-				echo "Local cache file larger then remote. Update remote cache files"
-				last_size=${new_size}
-				update_remote_cache
-				continue
+				echo "Local cache file shorter then remote. Use ${largest_remote_cache}"
+				logger -i "SLDD: updating local cache file with ${largest_remote_cache}"
+				swap_cache_files ${cache_file} ${largest_remote_cache}
+				arr_last_size[$i]=${largest_remote_cache_size}
 			fi
-		fi
 
-		largest_remote_cache=$(get_largest_remote_cache)
-		if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then
-			largest_remote_cache_size=$(du -b ${largest_remote_cache} 2> /dev/null | awk '{print$1}' | tr -d '[:space:]')
-		else
-			largest_remote_cache_size=0
-		fi
-
-		# Update local cache file from remote
-		if [ ${largest_remote_cache_size} -gt ${new_size} ]; then
+		else # The local cache file is empty
 			[ $SLDD_DEBUG -eq 1 ] &&
-			echo "Local cache file shorter then remote. Use ${largest_remote_cache}"
-			logger -i "SLDD: updating local cache file with ${largest_remote_cache}"
-			swap_cache_files
-			last_size=${largest_remote_cache_size}
-		fi
+			echo "${cache_file} is empty"
 
-	else # The local cache file is empty
-		[ $SLDD_DEBUG -eq 1 ] &&
-		echo "${CACHE_FILE} is empty"
+			largest_remote_cache=$(get_largest_remote_cache ${cache_file})
+			if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then
+				# Copy it to the current cache
+				[ $SLDD_DEBUG -eq 1 ] &&
+				echo "Local cache file is empty. Use ${largest_remote_cache}"
+				logger -i "SLDD: updating local cache file with ${largest_remote_cache}"
+				swap_cache_files ${cache_file} ${largest_remote_cache}
+			fi
 
-		largest_remote_cache=$(get_largest_remote_cache)
-		if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then
-			# Copy it to the current cache
-			[ $SLDD_DEBUG -eq 1 ] &&
-			echo "Local cache file is empty. Use ${largest_remote_cache}"
-			logger -i "SLDD: updating local cache file with ${largest_remote_cache}"
-			swap_cache_files
 		fi
-
-	fi
+	done
 
 	[ $SLDD_DEBUG -eq 1 ] &&
 	echo "Sleeping ${RESCAN_TIME} seconds."

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ofed/opensm.git



More information about the Pkg-ofed-commits mailing list