[ofa-general] [PATCH] opensm/opensm: indentation changes

Sasha Khapyorsky sashak at voltaire.com
Thu Aug 16 14:39:03 PDT 2007


Formatted with opensm/osm_indent
(indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs)

All opensm/opensm source files were formatted except:

opensm/osm_lid_mgr.c
opensm/osm_link_mgr.c
opensm/osm_port.c
opensm/osm_port_info_rcv.c
opensm/osm_sa_link_record.c
opensm/osm_sa_multipath_record.c
opensm/osm_sa_path_record.c
opensm/osm_sa_slvl_record.c
opensm/osm_sminfo_rcv.c
opensm/osm_state_mgr.c
opensm/osm_subnet.c
opensm/osm_trap_rcv.c
opensm/osm_switch.c
opensm/osm_ucast_lash.c
opensm/osm_ucast_ftree.c
opensm/osm_vl15intf.c

Here very long names and very long flows are overused, which requires
additional cleanup.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/main.c                   | 1752 +++++++-------
 opensm/opensm/osm_console.c            |  747 +++---
 opensm/opensm/osm_db_files.c           | 1107 ++++-----
 opensm/opensm/osm_db_pack.c            |  171 +-
 opensm/opensm/osm_drop_mgr.c           |  972 ++++----
 opensm/opensm/osm_dump.c               |   13 +-
 opensm/opensm/osm_event_plugin.c       |   29 +-
 opensm/opensm/osm_fwd_tbl.c            |   80 +-
 opensm/opensm/osm_helper.c             | 4270 +++++++++++++++-----------------
 opensm/opensm/osm_inform.c             | 1122 ++++-----
 opensm/opensm/osm_lin_fwd_rcv.c        |  147 +-
 opensm/opensm/osm_lin_fwd_tbl.c        |   55 +-
 opensm/opensm/osm_log.c                |  424 ++--
 opensm/opensm/osm_mad_pool.c           |  349 ++--
 opensm/opensm/osm_mcast_fwd_rcv.c      |  179 +-
 opensm/opensm/osm_mcast_mgr.c          | 2509 +++++++++----------
 opensm/opensm/osm_mcast_tbl.c          |  339 ++--
 opensm/opensm/osm_mcm_info.c           |   28 +-
 opensm/opensm/osm_mcm_port.c           |   52 +-
 opensm/opensm/osm_mtree.c              |   98 +-
 opensm/opensm/osm_multicast.c          |  509 ++--
 opensm/opensm/osm_node.c               |  338 ++--
 opensm/opensm/osm_node_desc_rcv.c      |  153 +-
 opensm/opensm/osm_node_info_rcv.c      | 1615 ++++++-------
 opensm/opensm/osm_opensm.c             |  444 ++--
 opensm/opensm/osm_perfmgr.c            |  621 +++---
 opensm/opensm/osm_perfmgr_db.c         |  516 ++--
 opensm/opensm/osm_pkey.c               |  715 +++---
 opensm/opensm/osm_pkey_mgr.c           |  909 ++++----
 opensm/opensm/osm_pkey_rcv.c           |  245 +-
 opensm/opensm/osm_prtn.c               |  128 +-
 opensm/opensm/osm_prtn_config.c        |   83 +-
 opensm/opensm/osm_qos.c                |   38 +-
 opensm/opensm/osm_remote_sm.c          |   34 +-
 opensm/opensm/osm_req.c                |  371 ++--
 opensm/opensm/osm_resp.c               |  245 +-
 opensm/opensm/osm_router.c             |   31 +-
 opensm/opensm/osm_sa.c                 |  875 +++----
 opensm/opensm/osm_sa_class_port_info.c |  331 ++--
 opensm/opensm/osm_sa_guidinfo_record.c |  948 ++++----
 opensm/opensm/osm_sa_informinfo.c      | 1429 ++++++------
 opensm/opensm/osm_sa_lft_record.c      |  766 +++---
 opensm/opensm/osm_sa_mad_ctrl.c        |  918 ++++----
 opensm/opensm/osm_sa_mcmember_record.c | 3882 ++++++++++++++---------------
 opensm/opensm/osm_sa_mft_record.c      |  823 +++----
 opensm/opensm/osm_sa_node_record.c     |  935 ++++----
 opensm/opensm/osm_sa_pkey_record.c     |  913 ++++----
 opensm/opensm/osm_sa_portinfo_record.c | 1414 +++++------
 opensm/opensm/osm_sa_response.c        |  175 +-
 opensm/opensm/osm_sa_service_record.c  | 1978 +++++++--------
 opensm/opensm/osm_sa_sminfo_record.c   |  888 ++++----
 opensm/opensm/osm_sa_sw_info_record.c  |  798 +++---
 opensm/opensm/osm_sa_vlarb_record.c    |  865 ++++----
 opensm/opensm/osm_service.c            |  155 +-
 opensm/opensm/osm_slvl_map_rcv.c       |  252 +-
 opensm/opensm/osm_sm.c                 | 1309 +++++-----
 opensm/opensm/osm_sm_mad_ctrl.c        | 1519 ++++++------
 opensm/opensm/osm_sm_state_mgr.c       | 1382 +++++------
 opensm/opensm/osm_state_mgr_ctrl.c     |   82 +-
 opensm/opensm/osm_sw_info_rcv.c        | 1052 ++++-----
 opensm/opensm/osm_sweep_fail_ctrl.c    |  103 +-
 opensm/opensm/osm_ucast_file.c         |   43 +-
 opensm/opensm/osm_ucast_mgr.c          | 1374 +++++------
 opensm/opensm/osm_ucast_updn.c         | 1343 +++++------
 opensm/opensm/osm_vl_arb_rcv.c         |  260 +--
 opensm/opensm/st.c                     |  727 +++---
 66 files changed, 23551 insertions(+), 25426 deletions(-)

diff --git a/opensm/opensm/main.c b/opensm/opensm/main.c
index f3429ff..0827f1c 100644
--- a/opensm/opensm/main.c
+++ b/opensm/opensm/main.c
@@ -44,7 +44,7 @@
  */
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -71,7 +71,7 @@ static volatile unsigned int osm_usr1_flag = 0;
 
 static void mark_exit_flag(int signum)
 {
-	if(!osm_exit_flag)
+	if (!osm_exit_flag)
 		printf("OpenSM: Got signal %d - exiting...\n", signum);
 	osm_exit_flag = 1;
 }
@@ -123,338 +123,326 @@ static void setup_signals()
 /**********************************************************************
  **********************************************************************/
 
-void
-show_usage(void)
+void show_usage(void)
 {
-  printf( "\n------- OpenSM - Usage and options ----------------------\n" );
-  printf( "Usage:   opensm [options]\n");
-  printf( "Options:\n" );
-  printf( "-c\n"
-          "--cache-options\n"
-          "          Cache the given command line options into the file\n"
-          "          /var/cache/opensm/opensm.opts for use on next invocation.\n"
-          "          The cache directory can be changed by the environment\n"
-          "          variable OSM_CACHE_DIR\n\n");
-  printf( "-g[=]<GUID in hex>\n"
-          "--guid[=]<GUID in hex>\n"
-          "          This option specifies the local port GUID value\n"
-          "          with which OpenSM should bind.  OpenSM may be\n"
-          "          bound to 1 port at a time.\n"
-          "          If GUID given is 0, OpenSM displays a list\n"
-          "          of possible port GUIDs and waits for user input.\n"
-          "          Without -g, OpenSM tries to use the default port.\n\n");
-  printf( "-l <LMC>\n"
-          "--lmc <LMC>\n"
-          "          This option specifies the subnet's LMC value.\n"
-          "          The number of LIDs assigned to each port is 2^LMC.\n"
-          "          The LMC value must be in the range 0-7.\n"
-          "          LMC values > 0 allow multiple paths between ports.\n"
-          "          LMC values > 0 should only be used if the subnet\n"
-          "          topology actually provides multiple paths between\n"
-          "          ports, i.e. multiple interconnects between switches.\n"
-          "          Without -l, OpenSM defaults to LMC = 0, which allows\n"
-          "          one path between any two ports.\n\n" );
-  printf( "-p <PRIORITY>\n"
-          "--priority <PRIORITY>\n"
-          "          This option specifies the SM's PRIORITY.\n"
-          "          This will effect the handover cases, where master\n"
-          "          is chosen by priority and GUID.  Range goes\n"
-          "          from 0 (lowest priority) to 15 (highest).\n\n" );
-  printf( "-smkey <SM_Key>\n"
-          "          This option specifies the SM's SM_Key (64 bits).\n"
-          "          This will effect SM authentication.\n\n" );
-  printf( "-r\n"
-          "--reassign_lids\n"
-          "          This option causes OpenSM to reassign LIDs to all\n"
-          "          end nodes. Specifying -r on a running subnet\n"
-          "          may disrupt subnet traffic.\n"
-          "          Without -r, OpenSM attempts to preserve existing\n"
-          "          LID assignments resolving multiple use of same LID.\n\n");
-  printf( "-R\n"
-          "--routing_engine <engine name>\n"
-          "          This option chooses routing engine instead of Min Hop\n"
-          "          algorithm (default).\n"
-          "          Supported engines: updn, file, ftree, lash\n\n");
-  printf( "-z\n"
-          "--connect_roots\n"
-          "          This option enforces a routing engine (currently\n"
-          "          up/down only) 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");
-  printf( "-M\n"
-          "--lid_matrix_file <file name>\n"
-          "          This option specifies the name of the lid matrix dump file\n"
-          "          from where switch lid matrices (min hops tables will be\n"
-          "          loaded.\n\n");
-  printf( "-U\n"
-          "--ucast_file <file name>\n"
-          "          This option specifies the name of the unicast dump file\n"
-          "          from where switch forwarding tables will be loaded.\n\n");
-  printf( "-S\n"
-          "--sadb_file <file name>\n"
-          "          This option specifies the name of the SA DB dump file\n"
-          "          from where SA database will be loaded.\n\n");
-  printf ("-a\n"
-          "--root_guid_file <path to file>\n"
-          "          Set the root nodes for the Up/Down or Fat-Tree routing\n"
-          "          algorithm to the guids provided in the given file (one\n"
-          "          to a line)\n"
-          "\n");
-  printf ("-u\n"
-          "--cn_guid_file <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( "-o\n"
-          "--once\n"
-          "          This option causes OpenSM to configure the subnet\n"
-          "          once, then exit.  Ports remain in the ACTIVE state.\n\n" );
-  printf( "-s <interval>\n"
-          "--sweep <interval>\n"
-          "          This option specifies the number of seconds between\n"
-          "          subnet sweeps.  Specifying -s 0 disables sweeping.\n"
-          "          Without -s, OpenSM defaults to a sweep interval of\n"
-          "          10 seconds.\n\n" );
-  printf( "-t <milliseconds>\n"
-          "--timeout <milliseconds>\n"
-          "          This option specifies the time in milliseconds\n"
-          "          used for transaction timeouts.\n"
-          "          Specifying -t 0 disables timeouts.\n"
-          "          Without -t, OpenSM defaults to a timeout value of\n"
-          "          200 milliseconds.\n\n" );
-  printf( "-maxsmps <number>\n"
-          "          This option specifies the number of VL15 SMP MADs\n"
-          "          allowed on the wire at any one time.\n"
-          "          Specifying -maxsmps 0 allows unlimited outstanding\n"
-          "          SMPs.\n"
-          "          Without -maxsmps, OpenSM defaults to a maximum of\n"
-          "          4 outstanding SMPs.\n\n" );
-  printf( "-console [off|local"
+	printf("\n------- OpenSM - Usage and options ----------------------\n");
+	printf("Usage:   opensm [options]\n");
+	printf("Options:\n");
+	printf("-c\n"
+	       "--cache-options\n"
+	       "          Cache the given command line options into the file\n"
+	       "          /var/cache/opensm/opensm.opts for use on next invocation.\n"
+	       "          The cache directory can be changed by the environment\n"
+	       "          variable OSM_CACHE_DIR\n\n");
+	printf("-g[=]<GUID in hex>\n"
+	       "--guid[=]<GUID in hex>\n"
+	       "          This option specifies the local port GUID value\n"
+	       "          with which OpenSM should bind.  OpenSM may be\n"
+	       "          bound to 1 port at a time.\n"
+	       "          If GUID given is 0, OpenSM displays a list\n"
+	       "          of possible port GUIDs and waits for user input.\n"
+	       "          Without -g, OpenSM tries to use the default port.\n\n");
+	printf("-l <LMC>\n"
+	       "--lmc <LMC>\n"
+	       "          This option specifies the subnet's LMC value.\n"
+	       "          The number of LIDs assigned to each port is 2^LMC.\n"
+	       "          The LMC value must be in the range 0-7.\n"
+	       "          LMC values > 0 allow multiple paths between ports.\n"
+	       "          LMC values > 0 should only be used if the subnet\n"
+	       "          topology actually provides multiple paths between\n"
+	       "          ports, i.e. multiple interconnects between switches.\n"
+	       "          Without -l, OpenSM defaults to LMC = 0, which allows\n"
+	       "          one path between any two ports.\n\n");
+	printf("-p <PRIORITY>\n"
+	       "--priority <PRIORITY>\n"
+	       "          This option specifies the SM's PRIORITY.\n"
+	       "          This will effect the handover cases, where master\n"
+	       "          is chosen by priority and GUID.  Range goes\n"
+	       "          from 0 (lowest priority) to 15 (highest).\n\n");
+	printf("-smkey <SM_Key>\n"
+	       "          This option specifies the SM's SM_Key (64 bits).\n"
+	       "          This will effect SM authentication.\n\n");
+	printf("-r\n"
+	       "--reassign_lids\n"
+	       "          This option causes OpenSM to reassign LIDs to all\n"
+	       "          end nodes. Specifying -r on a running subnet\n"
+	       "          may disrupt subnet traffic.\n"
+	       "          Without -r, OpenSM attempts to preserve existing\n"
+	       "          LID assignments resolving multiple use of same LID.\n\n");
+	printf("-R\n"
+	       "--routing_engine <engine name>\n"
+	       "          This option chooses routing engine instead of Min Hop\n"
+	       "          algorithm (default).\n"
+	       "          Supported engines: updn, file, ftree, lash\n\n");
+	printf("-z\n"
+	       "--connect_roots\n"
+	       "          This option enforces a routing engine (currently\n"
+	       "          up/down only) 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");
+	printf("-M\n"
+	       "--lid_matrix_file <file name>\n"
+	       "          This option specifies the name of the lid matrix dump file\n"
+	       "          from where switch lid matrices (min hops tables will be\n"
+	       "          loaded.\n\n");
+	printf("-U\n"
+	       "--ucast_file <file name>\n"
+	       "          This option specifies the name of the unicast dump file\n"
+	       "          from where switch forwarding tables will be loaded.\n\n");
+	printf("-S\n"
+	       "--sadb_file <file name>\n"
+	       "          This option specifies the name of the SA DB dump file\n"
+	       "          from where SA database will be loaded.\n\n");
+	printf("-a\n"
+	       "--root_guid_file <path to file>\n"
+	       "          Set the root nodes for the Up/Down or Fat-Tree routing\n"
+	       "          algorithm to the guids provided in the given file (one\n"
+	       "          to a line)\n" "\n");
+	printf("-u\n"
+	       "--cn_guid_file <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("-o\n"
+	       "--once\n"
+	       "          This option causes OpenSM to configure the subnet\n"
+	       "          once, then exit.  Ports remain in the ACTIVE state.\n\n");
+	printf("-s <interval>\n"
+	       "--sweep <interval>\n"
+	       "          This option specifies the number of seconds between\n"
+	       "          subnet sweeps.  Specifying -s 0 disables sweeping.\n"
+	       "          Without -s, OpenSM defaults to a sweep interval of\n"
+	       "          10 seconds.\n\n");
+	printf("-t <milliseconds>\n"
+	       "--timeout <milliseconds>\n"
+	       "          This option specifies the time in milliseconds\n"
+	       "          used for transaction timeouts.\n"
+	       "          Specifying -t 0 disables timeouts.\n"
+	       "          Without -t, OpenSM defaults to a timeout value of\n"
+	       "          200 milliseconds.\n\n");
+	printf("-maxsmps <number>\n"
+	       "          This option specifies the number of VL15 SMP MADs\n"
+	       "          allowed on the wire at any one time.\n"
+	       "          Specifying -maxsmps 0 allows unlimited outstanding\n"
+	       "          SMPs.\n"
+	       "          Without -maxsmps, OpenSM defaults to a maximum of\n"
+	       "          4 outstanding SMPs.\n\n");
+	printf("-console [off|local"
 #ifdef ENABLE_OSM_CONSOLE_SOCKET
-          "|socket"
+	       "|socket"
 #endif
-          "]\n          This option activates the OpenSM console (default off).\n\n");
+	       "]\n          This option activates the OpenSM console (default off).\n\n");
 #ifdef ENABLE_OSM_CONSOLE_SOCKET
-  printf( "-console-port <port>\n"
-          "          Specify an alternate telnet port for the console (default %d).\n\n",
-	  OSM_DEFAULT_CONSOLE_PORT);
+	printf("-console-port <port>\n"
+	       "          Specify an alternate telnet port for the console (default %d).\n\n",
+	       OSM_DEFAULT_CONSOLE_PORT);
 #endif
-  printf( "-i <equalize-ignore-guids-file>\n"
-          "-ignore-guids <equalize-ignore-guids-file>\n"
-          "          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( "-x\n"
-          "--honor_guid2lid\n"
-          "          This option forces OpenSM to honor the guid2lid file,\n"
-          "          when it comes out of Standby state, if such file exists\n"
-          "          under OSM_CACHE_DIR, and is valid. By default, this is FALSE.\n\n" );
-  printf( "-f\n"
-          "--log_file\n"
-          "          This option defines the log to be the given file.\n"
-          "          By default, the log goes to /var/log/opensm.log.\n"
-          "          For the log to go to standard output use -f stdout.\n\n");
-  printf( "-L <size in MB>\n"
-          "--log_limit <size in MB>\n"
-          "          This option defines maximal log file size in MB. When\n"
-          "          specified the log file will be truncated upon reaching\n"
-          "          this limit.\n\n");
-  printf( "-e\n"
-          "--erase_log_file\n"
-          "          This option will cause deletion of the log file\n"
-          "          (if it previously exists). By default, the log file\n"
-          "          is accumulative.\n\n");
-  printf( "-P\n"
-          "--Pconfig\n"
-          "          This option defines the optional partition configuration file.\n"
-	  "          The default name is \'" OSM_DEFAULT_PARTITION_CONFIG_FILE "\'.\n\n");
-  printf( "-Q\n"
-          "--qos\n"
-          "          This option enables QoS setup.\n\n");
-  printf( "-N\n"
-          "--no_part_enforce\n"
-          "          This option disables partition enforcement on switch external ports.\n\n");
-  printf( "-y\n"
-          "--stay_on_fatal\n"
-          "          This option will cause SM not to exit on fatal initialization\n"
-          "          issues: if SM discovers duplicated guids or 12x link with\n"
-          "          lane reversal badly configured.\n"
-          "          By default, the SM will exit on these errors.\n\n");
-  printf( "-B\n"
-          "--daemon\n"
-          "          Run in daemon mode - OpenSM will run in the background.\n\n");
-  printf("-I\n"
-         "--inactive\n"
-         "           Start SM in inactive rather than normal init SM state.\n\n");
-  printf( "-v\n"
-          "--verbose\n"
-          "          This option increases the log verbosity level.\n"
-          "          The -v option may be specified multiple times\n"
-          "          to further increase the verbosity level.\n"
-          "          See the -D option for more information about\n"
-          "          log verbosity.\n\n" );
-  printf( "-V\n"
-          "          This option sets the maximum verbosity level and\n"
-          "          forces log flushing.\n"
-          "          The -V is equivalent to '-D 0xFF -d 2'.\n"
-          "          See the -D option for more information about\n"
-          "          log verbosity.\n\n" );
-  printf( "-D <flags>\n"
-          "          This option sets the log verbosity level.\n"
-          "          A flags field must follow the -D option.\n"
-          "          A bit set/clear in the flags enables/disables a\n"
-          "          specific log level as follows:\n"
-          "          BIT    LOG LEVEL ENABLED\n"
-          "          ----   -----------------\n"
-          "          0x01 - ERROR (error messages)\n"
-          "          0x02 - INFO (basic messages, low volume)\n"
-          "          0x04 - VERBOSE (interesting stuff, moderate volume)\n"
-          "          0x08 - DEBUG (diagnostic, high volume)\n"
-          "          0x10 - FUNCS (function entry/exit, very high volume)\n"
-          "          0x20 - FRAMES (dumps all SMP and GMP frames)\n"
-          "          0x40 - ROUTING (dump FDB routing information)\n"
-          "          0x80 - currently unused.\n"
-          "          Without -D, OpenSM defaults to ERROR + INFO (0x3).\n"
-          "          Specifying -D 0 disables all messages.\n"
-          "          Specifying -D 0xFF enables all messages (see -V).\n"
-          "          High verbosity levels may require increasing\n"
-          "          the transaction timeout with the -t option.\n\n" );
-  printf( "-d <number>\n"
-          "--debug <number>\n"
-          "          This option specifies a debug option.\n"
-          "          These options are not normally needed.\n"
-          "          The number following -d selects the debug\n"
-          "          option to enable as follows:\n"
-          "          OPT   Description\n"
-          "          ---    -----------------\n"
-          "          -d0  - Ignore other SM nodes\n"
-          "          -d1  - Force single threaded dispatching\n"
-          "          -d2  - Force log flushing after each log message\n"
-          "          -d3  - Disable multicast support\n"
-          "          -d10 - Put OpenSM in testability mode\n"
-          "          Without -d, no debug options are enabled\n\n" );
-  printf( "-h\n"
-          "--help\n"
-          "          Display this usage info then exit.\n\n" );
-  printf( "-?\n"
-          "          Display this usage info then exit.\n\n" );
-  fflush( stdout );
-  exit(2);
+	printf("-i <equalize-ignore-guids-file>\n"
+	       "-ignore-guids <equalize-ignore-guids-file>\n"
+	       "          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("-x\n"
+	       "--honor_guid2lid\n"
+	       "          This option forces OpenSM to honor the guid2lid file,\n"
+	       "          when it comes out of Standby state, if such file exists\n"
+	       "          under OSM_CACHE_DIR, and is valid. By default, this is FALSE.\n\n");
+	printf("-f\n"
+	       "--log_file\n"
+	       "          This option defines the log to be the given file.\n"
+	       "          By default, the log goes to /var/log/opensm.log.\n"
+	       "          For the log to go to standard output use -f stdout.\n\n");
+	printf("-L <size in MB>\n"
+	       "--log_limit <size in MB>\n"
+	       "          This option defines maximal log file size in MB. When\n"
+	       "          specified the log file will be truncated upon reaching\n"
+	       "          this limit.\n\n");
+	printf("-e\n"
+	       "--erase_log_file\n"
+	       "          This option will cause deletion of the log file\n"
+	       "          (if it previously exists). By default, the log file\n"
+	       "          is accumulative.\n\n");
+	printf("-P\n"
+	       "--Pconfig\n"
+	       "          This option defines the optional partition configuration file.\n"
+	       "          The default name is \'"
+	       OSM_DEFAULT_PARTITION_CONFIG_FILE "\'.\n\n");
+	printf("-Q\n" "--qos\n" "          This option enables QoS setup.\n\n");
+	printf("-N\n"
+	       "--no_part_enforce\n"
+	       "          This option disables partition enforcement on switch external ports.\n\n");
+	printf("-y\n"
+	       "--stay_on_fatal\n"
+	       "          This option will cause SM not to exit on fatal initialization\n"
+	       "          issues: if SM discovers duplicated guids or 12x link with\n"
+	       "          lane reversal badly configured.\n"
+	       "          By default, the SM will exit on these errors.\n\n");
+	printf("-B\n"
+	       "--daemon\n"
+	       "          Run in daemon mode - OpenSM will run in the background.\n\n");
+	printf("-I\n"
+	       "--inactive\n"
+	       "           Start SM in inactive rather than normal init SM state.\n\n");
+	printf("-v\n"
+	       "--verbose\n"
+	       "          This option increases the log verbosity level.\n"
+	       "          The -v option may be specified multiple times\n"
+	       "          to further increase the verbosity level.\n"
+	       "          See the -D option for more information about\n"
+	       "          log verbosity.\n\n");
+	printf("-V\n"
+	       "          This option sets the maximum verbosity level and\n"
+	       "          forces log flushing.\n"
+	       "          The -V is equivalent to '-D 0xFF -d 2'.\n"
+	       "          See the -D option for more information about\n"
+	       "          log verbosity.\n\n");
+	printf("-D <flags>\n"
+	       "          This option sets the log verbosity level.\n"
+	       "          A flags field must follow the -D option.\n"
+	       "          A bit set/clear in the flags enables/disables a\n"
+	       "          specific log level as follows:\n"
+	       "          BIT    LOG LEVEL ENABLED\n"
+	       "          ----   -----------------\n"
+	       "          0x01 - ERROR (error messages)\n"
+	       "          0x02 - INFO (basic messages, low volume)\n"
+	       "          0x04 - VERBOSE (interesting stuff, moderate volume)\n"
+	       "          0x08 - DEBUG (diagnostic, high volume)\n"
+	       "          0x10 - FUNCS (function entry/exit, very high volume)\n"
+	       "          0x20 - FRAMES (dumps all SMP and GMP frames)\n"
+	       "          0x40 - ROUTING (dump FDB routing information)\n"
+	       "          0x80 - currently unused.\n"
+	       "          Without -D, OpenSM defaults to ERROR + INFO (0x3).\n"
+	       "          Specifying -D 0 disables all messages.\n"
+	       "          Specifying -D 0xFF enables all messages (see -V).\n"
+	       "          High verbosity levels may require increasing\n"
+	       "          the transaction timeout with the -t option.\n\n");
+	printf("-d <number>\n"
+	       "--debug <number>\n"
+	       "          This option specifies a debug option.\n"
+	       "          These options are not normally needed.\n"
+	       "          The number following -d selects the debug\n"
+	       "          option to enable as follows:\n"
+	       "          OPT   Description\n"
+	       "          ---    -----------------\n"
+	       "          -d0  - Ignore other SM nodes\n"
+	       "          -d1  - Force single threaded dispatching\n"
+	       "          -d2  - Force log flushing after each log message\n"
+	       "          -d3  - Disable multicast support\n"
+	       "          -d10 - Put OpenSM in testability mode\n"
+	       "          Without -d, no debug options are enabled\n\n");
+	printf("-h\n"
+	       "--help\n" "          Display this usage info then exit.\n\n");
+	printf("-?\n" "          Display this usage info then exit.\n\n");
+	fflush(stdout);
+	exit(2);
 }
 
 /**********************************************************************
  **********************************************************************/
-ib_net64_t
-get_port_guid(
-  IN osm_opensm_t *p_osm, uint64_t port_guid )
+ib_net64_t get_port_guid(IN osm_opensm_t * p_osm, uint64_t port_guid)
 {
-  uint32_t i;
-  uint32_t choice = 0;
-  char junk[128];
-  boolean_t done_flag = FALSE;
-  ib_api_status_t status;
-  uint32_t num_ports = GUID_ARRAY_SIZE;
-  ib_port_attr_t attr_array[GUID_ARRAY_SIZE];
-
-  /*
-    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 );
-  }
-
-  /* if num_ports is 0 - return 0 */
-  if( num_ports == 0 )
-  {
-    printf( "\nNo local ports detected!\n" );
-    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 );
-  }
+	uint32_t i;
+	uint32_t choice = 0;
+	char junk[128];
+	boolean_t done_flag = FALSE;
+	ib_api_status_t status;
+	uint32_t num_ports = GUID_ARRAY_SIZE;
+	ib_port_attr_t attr_array[GUID_ARRAY_SIZE];
+
+	/*
+	   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);
+	}
 
+	/* if num_ports is 0 - return 0 */
+	if (num_ports == 0) {
+		printf("\nNo local ports detected!\n");
+		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);
+	}
 #if defined ( OSM_VENDOR_INTF_OPENIB )
-  /* If port_guid is 0, and this is gen2 - use the default port whose info is in attr_array[0] */
-  if ( port_guid == 0 )
-  {
-    printf("Using default GUID 0x%" PRIx64 "\n", cl_hton64(attr_array[0].port_guid));
-    return( attr_array[0].port_guid );
-  }
-#endif /* OSM_VENDOR_INTF_OPENIB */
-
-  /* More than one possible port - list all ports and let the user to choose. */
-  while( done_flag == FALSE )
-  {
-    printf( "\nChoose a local port number with which to bind:\n\n" );
-    /* If this is gen2 code - then port 0 has details of the default port used.
-       no need to print it.
-       If this is not gen2 code - need to print details of all ports. */
+	/* If port_guid is 0, and this is gen2 - use the default port whose info is in attr_array[0] */
+	if (port_guid == 0) {
+		printf("Using default GUID 0x%" PRIx64 "\n",
+		       cl_hton64(attr_array[0].port_guid));
+		return (attr_array[0].port_guid);
+	}
+#endif				/* OSM_VENDOR_INTF_OPENIB */
+
+	/* More than one possible port - list all ports and let the user to choose. */
+	while (done_flag == FALSE) {
+		printf("\nChoose a local port number with which to bind:\n\n");
+		/* If this is gen2 code - then port 0 has details of the default port used.
+		   no need to print it.
+		   If this is not gen2 code - need to print details of all ports. */
 #if defined ( OSM_VENDOR_INTF_OPENIB )
-    for( i = 1; i < num_ports; i++ )
-    {
-      printf("\t%u: GUID 0x%8" PRIx64 ", lid 0x%04X, state %s\n",
-             i, 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-1 );
+		for (i = 1; i < num_ports; i++) {
+			printf("\t%u: GUID 0x%8" PRIx64
+			       ", lid 0x%04X, state %s\n", i,
+			       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 - 1);
 # else
-    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%8" PRIx64 ", lid 0x%04X, 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 );
-#endif /* OSM_VENDOR_INTF_OPENIB */
-
-    fflush( stdout );
-    if (scanf( "%u", &choice ))
-    {
-      /* If gen2 code - choice can be between 1 to num_ports-1
-         if not gen2 code - choice can be between 1 to num_ports */
+		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%8" PRIx64
+			       ", lid 0x%04X, 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);
+#endif				/* OSM_VENDOR_INTF_OPENIB */
+
+		fflush(stdout);
+		if (scanf("%u", &choice)) {
+			/* If gen2 code - choice can be between 1 to num_ports-1
+			   if not gen2 code - choice can be between 1 to num_ports */
 #if defined ( OSM_VENDOR_INTF_OPENIB )
-      if( choice >= num_ports )
+			if (choice >= num_ports)
 # else
-      if( choice > num_ports || choice < 1 )
-#endif /* OSM_VENDOR_INTF_OPENIB */
-      {
-        printf("\nError: Lame choice!\n");
-        fflush( stdin );
-      }
-      else
-      {
-        done_flag = TRUE;
-      }
-    }
-    else
-    {
-      /* get rid of the junk in the selection line */
-      scanf( "%s", junk );
-      printf("\nError: Lame choice!\n");
-      fflush( stdin );
-    }
-  }
+			if (choice > num_ports || choice < 1)
+#endif				/* OSM_VENDOR_INTF_OPENIB */
+			{
+				printf("\nError: Lame choice!\n");
+				fflush(stdin);
+			} else {
+				done_flag = TRUE;
+			}
+		} else {
+			/* get rid of the junk in the selection line */
+			scanf("%s", junk);
+			printf("\nError: Lame choice!\n");
+			fflush(stdin);
+		}
+	}
 #if defined ( OSM_VENDOR_INTF_OPENIB )
-  printf("Choice guid=0x%8" PRIx64 "\n", cl_ntoh64( attr_array[choice].port_guid ));
-  return( attr_array[choice].port_guid );
+	printf("Choice guid=0x%8" PRIx64 "\n",
+	       cl_ntoh64(attr_array[choice].port_guid));
+	return (attr_array[choice].port_guid);
 # else
-  return( attr_array[choice - 1].port_guid );
-#endif /* OSM_VENDOR_INTF_OPENIB */
+	return (attr_array[choice - 1].port_guid);
+#endif				/* OSM_VENDOR_INTF_OPENIB */
 }
 
 /**********************************************************************
@@ -462,85 +450,76 @@ get_port_guid(
 #define OSM_MAX_IGNORE_GUID_LINES_LEN 128
 
 static int
-parse_ignore_guids_file(IN char *guids_file_name,
-                        IN osm_opensm_t *p_osm)
+parse_ignore_guids_file(IN char *guids_file_name, IN osm_opensm_t * p_osm)
 {
-  FILE *fh;
-  char line[OSM_MAX_IGNORE_GUID_LINES_LEN];
-  char *p_c, *p_ec;
-  uint32_t line_num = 0;
-  uint64_t port_guid;
-  ib_api_status_t status = IB_SUCCESS;
-  unsigned int port_num;
-
-  OSM_LOG_ENTER( &p_osm->log, parse_ignore_guids_file );
-
-  fh = fopen( guids_file_name, "r" );
-  if( fh == NULL )
-  {
-    osm_log( &p_osm->log, OSM_LOG_ERROR,
-             "parse_ignore_guids_file: ERR 0601: "
-             "Unable to open ignore guids file (%s)\n",
-             guids_file_name );
-    status = IB_ERROR;
-    goto Exit;
-  }
-
-  /*
-   * Parse the file and add to the ignore guids map.
-   */
-  while( fgets( line, OSM_MAX_IGNORE_GUID_LINES_LEN, fh ) != NULL )
-  {
-    line_num++;
-    p_c = line;
-    while ( (*p_c == ' ') && (*p_c != '\0'))
-      p_c++;
-    port_guid = strtoull( p_c, &p_ec, 16 );
-    if (p_ec == p_c)
-    {
-      osm_log( &p_osm->log, OSM_LOG_ERROR,
-               "parse_ignore_guids_file: ERR 0602: "
-               "Error in line (%u): %s\n",
-               line_num, line
-               );
-      status = IB_ERROR;
-      goto Exit;
-    }
-
-    while ( (*p_ec == ' ') && (*p_ec != '\0'))
-      p_ec++;
-    if (! sscanf(p_ec, "%d", &port_num))
-    {
-      osm_log( &p_osm->log, OSM_LOG_ERROR,
-               "parse_ignore_guids_file: ERR 0603: "
-               "Error in line (%u): %s\n",
-               line_num, p_ec
-               );
-      status = IB_ERROR;
-      goto Exit;
-    }
-
-    /* ok insert it */
-    osm_port_prof_set_ignored_port(&p_osm->subn, cl_hton64( port_guid ), port_num);
-    osm_log( &p_osm->log, OSM_LOG_DEBUG,
-             "parse_ignore_guids_file: "
-             "Inserted Port: 0x%" PRIx64 " PortNum: 0x%X into ignored guids list\n" ,
-             port_guid, port_num
-             );
-
-  }
-
-  fclose( fh );
-
- Exit:
-  OSM_LOG_EXIT( &p_osm->log );
-  return ( status );
+	FILE *fh;
+	char line[OSM_MAX_IGNORE_GUID_LINES_LEN];
+	char *p_c, *p_ec;
+	uint32_t line_num = 0;
+	uint64_t port_guid;
+	ib_api_status_t status = IB_SUCCESS;
+	unsigned int port_num;
+
+	OSM_LOG_ENTER(&p_osm->log, parse_ignore_guids_file);
+
+	fh = fopen(guids_file_name, "r");
+	if (fh == NULL) {
+		osm_log(&p_osm->log, OSM_LOG_ERROR,
+			"parse_ignore_guids_file: ERR 0601: "
+			"Unable to open ignore guids file (%s)\n",
+			guids_file_name);
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	/*
+	 * Parse the file and add to the ignore guids map.
+	 */
+	while (fgets(line, OSM_MAX_IGNORE_GUID_LINES_LEN, fh) != NULL) {
+		line_num++;
+		p_c = line;
+		while ((*p_c == ' ') && (*p_c != '\0'))
+			p_c++;
+		port_guid = strtoull(p_c, &p_ec, 16);
+		if (p_ec == p_c) {
+			osm_log(&p_osm->log, OSM_LOG_ERROR,
+				"parse_ignore_guids_file: ERR 0602: "
+				"Error in line (%u): %s\n", line_num, line);
+			status = IB_ERROR;
+			goto Exit;
+		}
+
+		while ((*p_ec == ' ') && (*p_ec != '\0'))
+			p_ec++;
+		if (!sscanf(p_ec, "%d", &port_num)) {
+			osm_log(&p_osm->log, OSM_LOG_ERROR,
+				"parse_ignore_guids_file: ERR 0603: "
+				"Error in line (%u): %s\n", line_num, p_ec);
+			status = IB_ERROR;
+			goto Exit;
+		}
+
+		/* ok insert it */
+		osm_port_prof_set_ignored_port(&p_osm->subn,
+					       cl_hton64(port_guid), port_num);
+		osm_log(&p_osm->log, OSM_LOG_DEBUG,
+			"parse_ignore_guids_file: " "Inserted Port: 0x%" PRIx64
+			" PortNum: 0x%X into ignored guids list\n", port_guid,
+			port_num);
+
+	}
+
+	fclose(fh);
+
+      Exit:
+	OSM_LOG_EXIT(&p_osm->log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 
-static int daemonize(osm_opensm_t *osm)
+static int daemonize(osm_opensm_t * osm)
 {
 	pid_t pid;
 	int fd;
@@ -578,535 +557,520 @@ static int daemonize(osm_opensm_t *osm)
 
 /**********************************************************************
  **********************************************************************/
-int
-main(
-  int                   argc,
-  char*                 argv[] )
+int main(int argc, char *argv[])
 {
-  osm_opensm_t          osm;
-  osm_subn_opt_t        opt;
-  ib_net64_t            sm_key = 0;
-  ib_api_status_t       status;
-  uint32_t              temp, dbg_lvl;
-  boolean_t             run_once_flag = FALSE;
-  int32_t               vendor_debug = 0;
-  uint32_t              next_option;
+	osm_opensm_t osm;
+	osm_subn_opt_t opt;
+	ib_net64_t sm_key = 0;
+	ib_api_status_t status;
+	uint32_t temp, dbg_lvl;
+	boolean_t run_once_flag = FALSE;
+	int32_t vendor_debug = 0;
+	uint32_t next_option;
 #if 0
-  uint32_t	        exitTimeout;
+	uint32_t exitTimeout;
 #endif
-  boolean_t             cache_options = FALSE;
-  char                 *ignore_guids_file_name = NULL;
-  uint32_t              val;
-  const char * const    short_option =
-	  "i:f:ed:g:l:L:s:t:a:u:R:zM:U:S:P:NBIQvVhorcyxp:n:q:k:C:";
-
-  /*
-    In the array below, the 2nd parameter specifies the number
-    of arguments as follows:
-    0: no arguments
-    1: argument
-    2: optional
-  */
-  const struct option long_option[] =
-    {
-      {  "debug",         1, NULL, 'd'},
-      {  "guid",          1, NULL, 'g'},
-      {  "ignore_guids",  1, NULL, 'i'},
-      {  "lmc",           1, NULL, 'l'},
-      {  "sweep",         1, NULL, 's'},
-      {  "timeout",       1, NULL, 't'},
-      {  "verbose",       0, NULL, 'v'},
-      {  "D",             1, NULL, 'D'},
-      {  "log_file",      1, NULL, 'f'},
-      {  "log_limit",     1, NULL, 'L'},
-      {  "erase_log_file",0, NULL, 'e'},
-      {  "Pconfig",       1, NULL, 'P'},
-      {  "no_part_enforce",0,NULL, 'N'},
-      {  "qos",           0, NULL, 'Q'},
-      {  "maxsmps",       1, NULL, 'n'},
-      {  "console",       1, NULL, 'q'},
-      {  "V",             0, NULL, 'V'},
-      {  "help",          0, NULL, 'h'},
-      {  "once",          0, NULL, 'o'},
-      {  "reassign_lids", 0, NULL, 'r'},
-      {  "priority",      1, NULL, 'p'},
-      {  "smkey",         1, NULL, 'k'},
-      {  "routing_engine",1, NULL, 'R'},
-      {  "connect_roots", 0, NULL, 'z'},
-      {  "lid_matrix_file",1, NULL, 'M'},
-      {  "ucast_file",    1, NULL, 'U'},
-      {  "sadb_file",     1, NULL, 'S'},
-      {  "root_guid_file", 1, NULL, 'a'},
-      {  "cn_guid_file",  1, NULL, 'u'},
-      {  "cache-options", 0, NULL, 'c'},
-      {  "stay_on_fatal", 0, NULL, 'y'},
-      {  "honor_guid2lid",0, NULL, 'x'},
+	boolean_t cache_options = FALSE;
+	char *ignore_guids_file_name = NULL;
+	uint32_t val;
+	const char *const short_option =
+	    "i:f:ed:g:l:L:s:t:a:u:R:zM:U:S:P:NBIQvVhorcyxp:n:q:k:C:";
+
+	/*
+	   In the array below, the 2nd parameter specifies the number
+	   of arguments as follows:
+	   0: no arguments
+	   1: argument
+	   2: optional
+	 */
+	const struct option long_option[] = {
+		{"debug", 1, NULL, 'd'},
+		{"guid", 1, NULL, 'g'},
+		{"ignore_guids", 1, NULL, 'i'},
+		{"lmc", 1, NULL, 'l'},
+		{"sweep", 1, NULL, 's'},
+		{"timeout", 1, NULL, 't'},
+		{"verbose", 0, NULL, 'v'},
+		{"D", 1, NULL, 'D'},
+		{"log_file", 1, NULL, 'f'},
+		{"log_limit", 1, NULL, 'L'},
+		{"erase_log_file", 0, NULL, 'e'},
+		{"Pconfig", 1, NULL, 'P'},
+		{"no_part_enforce", 0, NULL, 'N'},
+		{"qos", 0, NULL, 'Q'},
+		{"maxsmps", 1, NULL, 'n'},
+		{"console", 1, NULL, 'q'},
+		{"V", 0, NULL, 'V'},
+		{"help", 0, NULL, 'h'},
+		{"once", 0, NULL, 'o'},
+		{"reassign_lids", 0, NULL, 'r'},
+		{"priority", 1, NULL, 'p'},
+		{"smkey", 1, NULL, 'k'},
+		{"routing_engine", 1, NULL, 'R'},
+		{"connect_roots", 0, NULL, 'z'},
+		{"lid_matrix_file", 1, NULL, 'M'},
+		{"ucast_file", 1, NULL, 'U'},
+		{"sadb_file", 1, NULL, 'S'},
+		{"root_guid_file", 1, NULL, 'a'},
+		{"cn_guid_file", 1, NULL, 'u'},
+		{"cache-options", 0, NULL, 'c'},
+		{"stay_on_fatal", 0, NULL, 'y'},
+		{"honor_guid2lid", 0, NULL, 'x'},
 #ifdef ENABLE_OSM_CONSOLE_SOCKET
-      {  "console-port",  1, NULL, 'C'},
+		{"console-port", 1, NULL, 'C'},
 #endif
-      {  "daemon",        0, NULL, 'B'},
-      {  "inactive",      0, NULL, 'I'},
+		{"daemon", 0, NULL, 'B'},
+		{"inactive", 0, NULL, 'I'},
 #ifdef ENABLE_OSM_PERF_MGR
-      {  "perfmgr",       0, NULL,  1 },
-      {  "perfmgr_sweep_time_s", 1, NULL, 2 },
+		{"perfmgr", 0, NULL, 1},
+		{"perfmgr_sweep_time_s", 1, NULL, 2},
 #endif
-      {  NULL,            0, NULL,  0 }  /* Required at the end of the array */
-    };
-
-  /* Make sure that the opensm and complib were compiled using
-     same modes (debug/free) */
-  if ( osm_is_debug() != cl_is_debug() )
-  {
-    fprintf(stderr, "ERROR: OpenSM and Complib were compiled using different modes\n");
-    fprintf(stderr, "ERROR: OpenSM debug:%d Complib debug:%d \n", osm_is_debug(), cl_is_debug() );
-    exit(1);
-  }
-
+		{NULL, 0, NULL, 0}	/* Required at the end of the array */
+	};
+
+	/* Make sure that the opensm and complib were compiled using
+	   same modes (debug/free) */
+	if (osm_is_debug() != cl_is_debug()) {
+		fprintf(stderr,
+			"ERROR: OpenSM and Complib were compiled using different modes\n");
+		fprintf(stderr, "ERROR: OpenSM debug:%d Complib debug:%d \n",
+			osm_is_debug(), cl_is_debug());
+		exit(1);
+	}
 #if defined (_DEBUG_) && defined (OSM_VENDOR_INTF_OPENIB)
-  enable_stack_dump(1);
+	enable_stack_dump(1);
 #endif
 
-  printf("-------------------------------------------------\n");
-  printf("%s\n", OSM_VERSION);
-
-  osm_subn_set_default_opt(&opt);
-  if (osm_subn_parse_conf_file(&opt) != IB_SUCCESS)
-    printf("\nosm_subn_parse_conf_file failed!\n");
-
-  printf("Command Line Arguments:\n");
-  do
-  {
-    next_option = getopt_long_only(argc, argv, short_option,
-                                   long_option, NULL);
-    switch(next_option)
-    {
-    case 'o':
-      /*
-        Run once option.
-      */
-      run_once_flag = TRUE;
-      printf(" Run Once\n");
-      break;
-
-    case 'r':
-      /*
-        Reassign LIDs subnet option.
-      */
-      opt.reassign_lids = TRUE;
-      printf(" Reassign LIDs\n");
-      break;
-
-    case 'i':
-      /*
-        Specifies ignore guids file.
-      */
-      ignore_guids_file_name = optarg;
-      printf(" Ignore Guids File = %s\n", ignore_guids_file_name);
-      break;
-
-    case 'g':
-      /*
-        Specifies port guid with which to bind.
-      */
-      opt.guid = cl_hton64( strtoull( optarg, NULL, 16 ));
-      if (!opt.guid)
-      {
-        /* If guid is 0 - need to display the guid list */
-        opt.guid = INVALID_GUID;
-      }
-      else
-        printf(" Guid <0x%"PRIx64">\n", cl_hton64( opt.guid ));
-      break;
-
-    case 's':
-      val = strtol(optarg, NULL, 0);
-      /* Check that the number is not too large */
-      if ( ((uint32_t)(val * 1000000)) / 1000000 != val )
-        fprintf(stderr, "ERROR: sweep interval given is too large. Ignoring it.\n");
-      else
-      {
-        opt.sweep_interval = val;
-        printf(" sweep interval = %d\n", opt.sweep_interval);
-      }
-      break;
-
-    case 't':
-      opt.transaction_timeout = strtol(optarg, NULL, 0);
-      printf(" Transaction timeout = %d\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 = 0x7FFFFFFF;
-      printf(" Max wire smp's = %d\n", opt.max_wire_smps);
-      break;
-
-    case 'q':
-      /*
-       * OpenSM interactive console
-       */
-      if (strcmp(optarg, "off") == 0) {
-      	opt.console = "off";
-      } else if (strcmp(optarg, "local") == 0) {
-      	opt.console = "local";
+	printf("-------------------------------------------------\n");
+	printf("%s\n", OSM_VERSION);
+
+	osm_subn_set_default_opt(&opt);
+	if (osm_subn_parse_conf_file(&opt) != IB_SUCCESS)
+		printf("\nosm_subn_parse_conf_file failed!\n");
+
+	printf("Command Line Arguments:\n");
+	do {
+		next_option = getopt_long_only(argc, argv, short_option,
+					       long_option, NULL);
+		switch (next_option) {
+		case 'o':
+			/*
+			   Run once option.
+			 */
+			run_once_flag = TRUE;
+			printf(" Run Once\n");
+			break;
+
+		case 'r':
+			/*
+			   Reassign LIDs subnet option.
+			 */
+			opt.reassign_lids = TRUE;
+			printf(" Reassign LIDs\n");
+			break;
+
+		case 'i':
+			/*
+			   Specifies ignore guids file.
+			 */
+			ignore_guids_file_name = optarg;
+			printf(" Ignore Guids File = %s\n",
+			       ignore_guids_file_name);
+			break;
+
+		case 'g':
+			/*
+			   Specifies port guid with which to bind.
+			 */
+			opt.guid = cl_hton64(strtoull(optarg, NULL, 16));
+			if (!opt.guid) {
+				/* If guid is 0 - need to display the guid list */
+				opt.guid = INVALID_GUID;
+			} else
+				printf(" Guid <0x%" PRIx64 ">\n",
+				       cl_hton64(opt.guid));
+			break;
+
+		case 's':
+			val = strtol(optarg, NULL, 0);
+			/* Check that the number is not too large */
+			if (((uint32_t) (val * 1000000)) / 1000000 != val)
+				fprintf(stderr,
+					"ERROR: sweep interval given is too large. Ignoring it.\n");
+			else {
+				opt.sweep_interval = val;
+				printf(" sweep interval = %d\n",
+				       opt.sweep_interval);
+			}
+			break;
+
+		case 't':
+			opt.transaction_timeout = strtol(optarg, NULL, 0);
+			printf(" Transaction timeout = %d\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 = 0x7FFFFFFF;
+			printf(" Max wire smp's = %d\n", opt.max_wire_smps);
+			break;
+
+		case 'q':
+			/*
+			 * OpenSM interactive console
+			 */
+			if (strcmp(optarg, "off") == 0) {
+				opt.console = "off";
+			} else if (strcmp(optarg, "local") == 0) {
+				opt.console = "local";
 #ifdef ENABLE_OSM_CONSOLE_SOCKET
-      } else if (strcmp(optarg, "socket") == 0) {
-      	opt.console = "socket";
+			} else if (strcmp(optarg, "socket") == 0) {
+				opt.console = "socket";
 #endif
-      } else {
-	printf("-console %s option not understood\n", optarg);
-      }
-      break;
+			} else {
+				printf("-console %s option not understood\n",
+				       optarg);
+			}
+			break;
 
 #ifdef ENABLE_OSM_CONSOLE_SOCKET
-    case 'C':
-      opt.console_port = strtol(optarg, NULL, 0);
-      break;
+		case 'C':
+			opt.console_port = strtol(optarg, NULL, 0);
+			break;
 #endif
 
-    case 'd':
-      dbg_lvl = strtol(optarg, NULL, 0);
-      printf(" d level = 0x%x\n", dbg_lvl);
-      if (dbg_lvl == 0)
-      {
-        printf(" Debug mode: Ignore Other SMs\n");
-        opt.ignore_other_sm = TRUE;
-      }
-      else if(dbg_lvl == 1)
-      {
-        printf(" Debug mode: Forcing Single Thread\n");
-        opt.single_thread = TRUE;
-      }
-      else if(dbg_lvl == 2)
-      {
-        printf(" Debug mode: Force Log Flush\n");
-        opt.force_log_flush = TRUE;
-      }
-      else if(dbg_lvl == 3)
-      {
-        printf(" Debug mode: Disable multicast support\n");
-        opt.disable_multicast = TRUE;
-      }
-      /*
-       * NOTE: Debug level 4 used to be used for memory tracking
-       * but this is now deprecated
-       */
-      else if(dbg_lvl == 5)
-      {
-        vendor_debug++;
-      }
-      else if(dbg_lvl >= 10)
-      {
-        /* Please look at osm_subnet.h for list of testability modes. */
-        opt.testability_mode = dbg_lvl - 9;
-      }
-      else
-        printf(" OpenSM: Unknown debug option %d ignored\n", dbg_lvl);
-      break;
-
-    case 'l':
-      temp = strtol(optarg, NULL, 0);
-      if( temp > 7 )
-      {
-        fprintf(stderr, "ERROR: LMC must be 7 or less.");
-        return( -1 );
-      }
-      opt.lmc = (uint8_t)temp;
-      printf(" LMC = %d\n", temp);
-      break;
-
-    case 'D':
-      opt.log_flags = strtol(optarg, NULL, 0);
-      printf(" verbose option -D = 0x%x\n", opt.log_flags);
-      break;
-
-    case 'f':
-      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);
-      break;
-
-    case 'e':
-      opt.accum_log_file = FALSE;
-      printf(" Creating new log file\n");
-      break;
-
-    case 'P':
-      opt.partition_config_file = optarg;
-      break;
-
-    case 'N':
-      opt.no_partition_enforcement = TRUE;
-      break;
-
-    case 'Q':
-      opt.no_qos = FALSE;
-      break;
-
-    case 'y':
-      opt.exit_on_fatal = FALSE;
-      printf(" Staying on fatal initialization errors\n");
-      break;
-
-    case 'v':
-      opt.log_flags = (opt.log_flags <<1 )|1;
-      printf(" Verbose option -v (log flags = 0x%X)\n", opt.log_flags );
-      break;
-
-    case 'V':
-      opt.log_flags = 0xFF;
-      opt.force_log_flush = TRUE;
-      printf(" Big V selected\n");
-      break;
-
-    case 'p':
-      temp = strtol(optarg, NULL, 0);
-      if (0 > temp || 15 < temp) {
-        fprintf(stderr, "ERROR: priority must be between 0 and 15\n");
-        return (-1);
-      }
-      opt.sm_priority = (uint8_t)temp;
-      printf(" Priority = %d\n", temp);
-      break;
-
-    case 'k':
-      sm_key = cl_hton64( strtoull( optarg, NULL, 16 ));
-      printf(" SM Key <0x%"PRIx64">\n", cl_hton64( sm_key ));
-      opt.sm_key = sm_key;
-      break;
-
-    case 'R':
-      opt.routing_engine_name = optarg;
-      printf(" Activate \'%s\' routing engine\n", optarg);
-      break;
-
-    case 'z':
-      opt.connect_roots = TRUE;
-      printf(" Connect roots option is on\n");
-      break;
-
-    case 'M':
-      opt.lid_matrix_dump_file = optarg;
-      printf(" Lid matrix dump file is \'%s\'\n", optarg);
-      break;
-
-    case 'U':
-      opt.ucast_dump_file = optarg;
-      printf(" Ucast dump file is \'%s\'\n", optarg);
-      break;
-
-    case 'S':
-      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;
-      printf (" Root Guid File: %s\n", opt.root_guid_file );
-      break;
-
-    case 'u':
-      /*
-        Specifies compute node guids file
-      */
-      opt.cn_guid_file = optarg;
-      printf (" Compute Node Guid File: %s\n", opt.cn_guid_file );
-      break;
-
-    case 'c':
-      cache_options = TRUE;
-      printf (" Caching command line options\n");
-      break;
-
-    case 'x':
-      opt.honor_guid2lid_file = TRUE;
-      printf (" Honor guid2lid file, if possible\n");
-      break;
-
-    case 'B':
-      opt.daemon = TRUE;
-      printf (" Daemon mode\n");
-      break;
-
-    case 'I':
-      opt.sm_inactive = TRUE;
-      printf(" SM started in inactive state\n");
-      break;
+		case 'd':
+			dbg_lvl = strtol(optarg, NULL, 0);
+			printf(" d level = 0x%x\n", dbg_lvl);
+			if (dbg_lvl == 0) {
+				printf(" Debug mode: Ignore Other SMs\n");
+				opt.ignore_other_sm = TRUE;
+			} else if (dbg_lvl == 1) {
+				printf(" Debug mode: Forcing Single Thread\n");
+				opt.single_thread = TRUE;
+			} else if (dbg_lvl == 2) {
+				printf(" Debug mode: Force Log Flush\n");
+				opt.force_log_flush = TRUE;
+			} else if (dbg_lvl == 3) {
+				printf
+				    (" Debug mode: Disable multicast support\n");
+				opt.disable_multicast = TRUE;
+			}
+			/*
+			 * NOTE: Debug level 4 used to be used for memory tracking
+			 * but this is now deprecated
+			 */
+			else if (dbg_lvl == 5) {
+				vendor_debug++;
+			} else if (dbg_lvl >= 10) {
+				/* Please look at osm_subnet.h for list of testability modes. */
+				opt.testability_mode = dbg_lvl - 9;
+			} else
+				printf
+				    (" OpenSM: Unknown debug option %d ignored\n",
+				     dbg_lvl);
+			break;
+
+		case 'l':
+			temp = strtol(optarg, NULL, 0);
+			if (temp > 7) {
+				fprintf(stderr,
+					"ERROR: LMC must be 7 or less.");
+				return (-1);
+			}
+			opt.lmc = (uint8_t) temp;
+			printf(" LMC = %d\n", temp);
+			break;
+
+		case 'D':
+			opt.log_flags = strtol(optarg, NULL, 0);
+			printf(" verbose option -D = 0x%x\n", opt.log_flags);
+			break;
+
+		case 'f':
+			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);
+			break;
+
+		case 'e':
+			opt.accum_log_file = FALSE;
+			printf(" Creating new log file\n");
+			break;
+
+		case 'P':
+			opt.partition_config_file = optarg;
+			break;
+
+		case 'N':
+			opt.no_partition_enforcement = TRUE;
+			break;
+
+		case 'Q':
+			opt.no_qos = FALSE;
+			break;
+
+		case 'y':
+			opt.exit_on_fatal = FALSE;
+			printf(" Staying on fatal initialization errors\n");
+			break;
+
+		case 'v':
+			opt.log_flags = (opt.log_flags << 1) | 1;
+			printf(" Verbose option -v (log flags = 0x%X)\n",
+			       opt.log_flags);
+			break;
+
+		case 'V':
+			opt.log_flags = 0xFF;
+			opt.force_log_flush = TRUE;
+			printf(" Big V selected\n");
+			break;
+
+		case 'p':
+			temp = strtol(optarg, NULL, 0);
+			if (0 > temp || 15 < temp) {
+				fprintf(stderr,
+					"ERROR: priority must be between 0 and 15\n");
+				return (-1);
+			}
+			opt.sm_priority = (uint8_t) temp;
+			printf(" Priority = %d\n", temp);
+			break;
+
+		case 'k':
+			sm_key = cl_hton64(strtoull(optarg, NULL, 16));
+			printf(" SM Key <0x%" PRIx64 ">\n", cl_hton64(sm_key));
+			opt.sm_key = sm_key;
+			break;
+
+		case 'R':
+			opt.routing_engine_name = optarg;
+			printf(" Activate \'%s\' routing engine\n", optarg);
+			break;
+
+		case 'z':
+			opt.connect_roots = TRUE;
+			printf(" Connect roots option is on\n");
+			break;
+
+		case 'M':
+			opt.lid_matrix_dump_file = optarg;
+			printf(" Lid matrix dump file is \'%s\'\n", optarg);
+			break;
+
+		case 'U':
+			opt.ucast_dump_file = optarg;
+			printf(" Ucast dump file is \'%s\'\n", optarg);
+			break;
+
+		case 'S':
+			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;
+			printf(" Root Guid File: %s\n", opt.root_guid_file);
+			break;
+
+		case 'u':
+			/*
+			   Specifies compute node guids file
+			 */
+			opt.cn_guid_file = optarg;
+			printf(" Compute Node Guid File: %s\n",
+			       opt.cn_guid_file);
+			break;
+
+		case 'c':
+			cache_options = TRUE;
+			printf(" Caching command line options\n");
+			break;
+
+		case 'x':
+			opt.honor_guid2lid_file = TRUE;
+			printf(" Honor guid2lid file, if possible\n");
+			break;
+
+		case 'B':
+			opt.daemon = TRUE;
+			printf(" Daemon mode\n");
+			break;
+
+		case 'I':
+			opt.sm_inactive = TRUE;
+			printf(" SM started in inactive state\n");
+			break;
 
 #ifdef ENABLE_OSM_PERF_MGR
-    case 1:
-      opt.perfmgr = TRUE;
-      break;
-    case 2:
-      opt.perfmgr_sweep_time_s = atoi(optarg);
-      break;
-#endif /* ENABLE_OSM_PERF_MGR */
-
-    case 'h':
-    case '?':
-    case ':':
-      show_usage();
-      break;
-
-    case -1:
-      break; /* done with option */
-    default: /* something wrong */
-      abort();
-    }
-  }
-  while(next_option != -1);
-
-  if (opt.log_file != NULL )
-    printf(" Log File: %s\n", opt.log_file );
-  /* Done with options description */
-  printf("-------------------------------------------------\n");
-
-  if (vendor_debug)
-    osm_vendor_set_debug( osm.p_vendor, vendor_debug );
-
-  block_signals();
-
-  if (opt.daemon)
-    daemonize(&osm);
-
-  complib_init();
-
-  status = osm_opensm_init( &osm, &opt );
-  if( status != IB_SUCCESS )
-  {
-    const char *err_str = ib_get_err_str( status );
-    if (err_str == NULL)
-    {
-      err_str = "Unknown Error Type";
-    }
-    printf( "\nError from osm_opensm_init: %s.\n",
-            err_str);
-    /* We will just exit, and not go to Exit, since we don't
-       want the destroy to be called. */
-    complib_exit();
-    return( status );
-  }
-
-  /*
-    If the user didn't specify a GUID on the command line,
-    then get a port GUID value with which to bind.
-  */
-  if( opt.guid == 0 || cl_hton64(opt.guid) == CL_HTON64(INVALID_GUID))
-    opt.guid = get_port_guid( &osm, opt.guid );
-
-  if ( opt.guid == 0 )
-  {
-    printf( "Error: Could not get port guid\n" );
-    status = IB_ERROR;
-    goto Exit;
-  }
-
-  if ( cache_options == TRUE )
-  {
-    if (osm_subn_write_conf_file( &opt ) != IB_SUCCESS)
-    {
-      printf( "\nosm_subn_write_conf_file failed!\n" );
-    }
-  }
-
-  status = osm_opensm_bind( &osm, opt.guid );
-  if( status != IB_SUCCESS )
-  {
-    printf( "\nError from osm_opensm_bind (0x%X)\n", status );
-    printf( "Perhaps another instance of OpenSM is already running\n" );
-    goto Exit;
-  }
-
-  /*
-   * Define some port guids to ignore during path equalization
-   */
-  if (ignore_guids_file_name != NULL)
-  {
-    status = parse_ignore_guids_file(ignore_guids_file_name, &osm);
-    if( status != IB_SUCCESS )
-    {
-      printf( "\nError from parse_ignore_guids_file (0x%X)\n", status );
-      goto Exit;
-    }
-  }
-
-  setup_signals();
-
-  osm_opensm_sweep( &osm );
-
-  if( run_once_flag == TRUE )
-  {
-     while (!osm_exit_flag)
-     {
-        status = osm_opensm_wait_for_subnet_up(
-                  &osm, osm.subn.opt.sweep_interval * 1000000, TRUE );
-        if (!status)
-           osm_exit_flag = 1;
-     }
-  }
-  else
-  {
-    osm_console_init(&opt, &osm);
-
-    /*
-      Sit here forever
-    */
-    while( !osm_exit_flag ) {
-      if (strcmp(opt.console, "local") == 0)
-      {
-        osm_console(&osm);
+		case 1:
+			opt.perfmgr = TRUE;
+			break;
+		case 2:
+			opt.perfmgr_sweep_time_s = atoi(optarg);
+			break;
+#endif				/* ENABLE_OSM_PERF_MGR */
+
+		case 'h':
+		case '?':
+		case ':':
+			show_usage();
+			break;
+
+		case -1:
+			break;	/* done with option */
+		default:	/* something wrong */
+			abort();
+		}
+	}
+	while (next_option != -1);
+
+	if (opt.log_file != NULL)
+		printf(" Log File: %s\n", opt.log_file);
+	/* Done with options description */
+	printf("-------------------------------------------------\n");
+
+	if (vendor_debug)
+		osm_vendor_set_debug(osm.p_vendor, vendor_debug);
+
+	block_signals();
+
+	if (opt.daemon)
+		daemonize(&osm);
+
+	complib_init();
+
+	status = osm_opensm_init(&osm, &opt);
+	if (status != IB_SUCCESS) {
+		const char *err_str = ib_get_err_str(status);
+		if (err_str == NULL) {
+			err_str = "Unknown Error Type";
+		}
+		printf("\nError from osm_opensm_init: %s.\n", err_str);
+		/* We will just exit, and not go to Exit, since we don't
+		   want the destroy to be called. */
+		complib_exit();
+		return (status);
+	}
+
+	/*
+	   If the user didn't specify a GUID on the command line,
+	   then get a port GUID value with which to bind.
+	 */
+	if (opt.guid == 0 || cl_hton64(opt.guid) == CL_HTON64(INVALID_GUID))
+		opt.guid = get_port_guid(&osm, opt.guid);
+
+	if (opt.guid == 0) {
+		printf("Error: Could not get port guid\n");
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	if (cache_options == TRUE) {
+		if (osm_subn_write_conf_file(&opt) != IB_SUCCESS) {
+			printf("\nosm_subn_write_conf_file failed!\n");
+		}
+	}
+
+	status = osm_opensm_bind(&osm, opt.guid);
+	if (status != IB_SUCCESS) {
+		printf("\nError from osm_opensm_bind (0x%X)\n", status);
+		printf
+		    ("Perhaps another instance of OpenSM is already running\n");
+		goto Exit;
+	}
+
+	/*
+	 * Define some port guids to ignore during path equalization
+	 */
+	if (ignore_guids_file_name != NULL) {
+		status = parse_ignore_guids_file(ignore_guids_file_name, &osm);
+		if (status != IB_SUCCESS) {
+			printf("\nError from parse_ignore_guids_file (0x%X)\n",
+			       status);
+			goto Exit;
+		}
+	}
+
+	setup_signals();
+
+	osm_opensm_sweep(&osm);
+
+	if (run_once_flag == TRUE) {
+		while (!osm_exit_flag) {
+			status =
+			    osm_opensm_wait_for_subnet_up(&osm,
+							  osm.subn.opt.
+							  sweep_interval *
+							  1000000, TRUE);
+			if (!status)
+				osm_exit_flag = 1;
+		}
+	} else {
+		osm_console_init(&opt, &osm);
+
+		/*
+		   Sit here forever
+		 */
+		while (!osm_exit_flag) {
+			if (strcmp(opt.console, "local") == 0) {
+				osm_console(&osm);
 #ifdef ENABLE_OSM_CONSOLE_SOCKET
-      }
-      else if (strcmp(opt.console, "socket") == 0)
-      {
-        osm_console(&osm);
+			} else if (strcmp(opt.console, "socket") == 0) {
+				osm_console(&osm);
 #endif
-      }
-      else
-        cl_thread_suspend( 10000 );
-
-      if (osm_usr1_flag) {
-        osm_usr1_flag = 0;
-        osm_log_reopen_file(&osm.log);
-      }
-      if (osm_hup_flag) {
-        osm_hup_flag = 0;
-        /* a HUP signal should only start a new heavy sweep */
-        osm.subn.force_immediate_heavy_sweep = TRUE;
-        osm_opensm_sweep( &osm );
-      }
-    }
-    osm_console_close_socket(&osm);
-  }
+			} else
+				cl_thread_suspend(10000);
+
+			if (osm_usr1_flag) {
+				osm_usr1_flag = 0;
+				osm_log_reopen_file(&osm.log);
+			}
+			if (osm_hup_flag) {
+				osm_hup_flag = 0;
+				/* a HUP signal should only start a new heavy sweep */
+				osm.subn.force_immediate_heavy_sweep = TRUE;
+				osm_opensm_sweep(&osm);
+			}
+		}
+		osm_console_close_socket(&osm);
+	}
 
 #if 0
-  /* wait for all transactions to end */
-  CL_ASSERT( ((opt.polling_retry_number + 1) * opt.transaction_timeout / 1000.0) < 0x100000000ULL );
-  exitTimeout =
-     (uint32_t) ((opt.polling_retry_number + 1) * opt.transaction_timeout / 1000.0);
-
-  if (exitTimeout < 3) exitTimeout = 3;
-
-  printf( "\n------- OpenSM Exiting (in %u seconds) -------\n",
-  exitTimeout);
-  sleep(exitTimeout);
+	/* wait for all transactions to end */
+	CL_ASSERT(((opt.polling_retry_number +
+		    1) * opt.transaction_timeout / 1000.0) < 0x100000000ULL);
+	exitTimeout =
+	    (uint32_t) ((opt.polling_retry_number +
+			 1) * opt.transaction_timeout / 1000.0);
+
+	if (exitTimeout < 3)
+		exitTimeout = 3;
+
+	printf("\n------- OpenSM Exiting (in %u seconds) -------\n",
+	       exitTimeout);
+	sleep(exitTimeout);
 #endif
 
-  if (osm.mad_pool.mads_out)
-    fprintf(stdout,
-            "There are still %u MADs out. Forcing the exit of the OpenSM application...\n",
-            osm.mad_pool.mads_out);
+	if (osm.mad_pool.mads_out)
+		fprintf(stdout,
+			"There are still %u MADs out. Forcing the exit of the OpenSM application...\n",
+			osm.mad_pool.mads_out);
 
- Exit:
-  osm_opensm_destroy(&osm);
-  complib_exit();
+      Exit:
+	osm_opensm_destroy(&osm);
+	complib_exit();
 
-  exit( 0 );
+	exit(0);
 }
diff --git a/opensm/opensm/osm_console.c b/opensm/opensm/osm_console.c
index 766779d..3301f45 100644
--- a/opensm/opensm/osm_console.c
+++ b/opensm/opensm/osm_console.c
@@ -33,7 +33,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #define _GNU_SOURCE		/* for getline */
 #include <stdio.h>
@@ -58,20 +58,18 @@
 
 struct command {
 	char *name;
-	void (*help_function)(FILE *out, int detail);
-	void (*parse_function)(char **p_last, osm_opensm_t *p_osm, FILE *out);
+	void (*help_function) (FILE * out, int detail);
+	void (*parse_function) (char **p_last, osm_opensm_t * p_osm,
+				FILE * out);
 };
 
 struct {
-	int    on;
-	int    delay_s;
+	int on;
+	int delay_s;
 	time_t previous;
-	void (*loop_function)(osm_opensm_t *p_osm, FILE *out);
+	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[];
 
@@ -80,7 +78,7 @@ static inline char *next_token(char **p_last)
 	return strtok_r(NULL, " \t\n\r", p_last);
 }
 
-static void help_command(FILE *out, int detail)
+static void help_command(FILE * out, int detail)
 {
 	int i;
 
@@ -91,42 +89,51 @@ static void help_command(FILE *out, int detail)
 		console_cmds[i].help_function(out, 0);
 }
 
-static void help_quit(FILE *out, int detail)
+static void help_quit(FILE * out, int detail)
 {
 	fprintf(out, "quit (not valid in local mode; use ctl-c)\n");
 }
 
-
-static void help_loglevel(FILE *out, int detail)
+static void help_loglevel(FILE * out, int detail)
 {
 	fprintf(out, "loglevel [<log-level>]\n");
 	if (detail) {
 		fprintf(out, "   log-level is OR'ed from the following\n");
-		fprintf(out, "   OSM_LOG_NONE             0x%02X\n", OSM_LOG_NONE);
-		fprintf(out, "   OSM_LOG_ERROR            0x%02X\n", OSM_LOG_ERROR);
-		fprintf(out, "   OSM_LOG_INFO             0x%02X\n", OSM_LOG_INFO);
-		fprintf(out, "   OSM_LOG_VERBOSE          0x%02X\n", OSM_LOG_VERBOSE);
-		fprintf(out, "   OSM_LOG_DEBUG            0x%02X\n", OSM_LOG_DEBUG);
-		fprintf(out, "   OSM_LOG_FUNCS            0x%02X\n", OSM_LOG_FUNCS);
-		fprintf(out, "   OSM_LOG_FRAMES           0x%02X\n", OSM_LOG_FRAMES);
-		fprintf(out, "   OSM_LOG_ROUTING          0x%02X\n", OSM_LOG_ROUTING);
-		fprintf(out, "   OSM_LOG_SYS              0x%02X\n", OSM_LOG_SYS);
+		fprintf(out, "   OSM_LOG_NONE             0x%02X\n",
+			OSM_LOG_NONE);
+		fprintf(out, "   OSM_LOG_ERROR            0x%02X\n",
+			OSM_LOG_ERROR);
+		fprintf(out, "   OSM_LOG_INFO             0x%02X\n",
+			OSM_LOG_INFO);
+		fprintf(out, "   OSM_LOG_VERBOSE          0x%02X\n",
+			OSM_LOG_VERBOSE);
+		fprintf(out, "   OSM_LOG_DEBUG            0x%02X\n",
+			OSM_LOG_DEBUG);
+		fprintf(out, "   OSM_LOG_FUNCS            0x%02X\n",
+			OSM_LOG_FUNCS);
+		fprintf(out, "   OSM_LOG_FRAMES           0x%02X\n",
+			OSM_LOG_FRAMES);
+		fprintf(out, "   OSM_LOG_ROUTING          0x%02X\n",
+			OSM_LOG_ROUTING);
+		fprintf(out, "   OSM_LOG_SYS              0x%02X\n",
+			OSM_LOG_SYS);
 		fprintf(out, "\n");
-		fprintf(out, "   OSM_LOG_DEFAULT_LEVEL    0x%02X\n", OSM_LOG_DEFAULT_LEVEL);
+		fprintf(out, "   OSM_LOG_DEFAULT_LEVEL    0x%02X\n",
+			OSM_LOG_DEFAULT_LEVEL);
 	}
 }
 
-static void help_priority(FILE *out, int detail)
+static void help_priority(FILE * out, int detail)
 {
 	fprintf(out, "priority [<sm-priority>]\n");
 }
 
-static void help_resweep(FILE *out, int detail)
+static void help_resweep(FILE * out, int detail)
 {
 	fprintf(out, "resweep [heavy|light]\n");
 }
 
-static void help_status(FILE *out, int detail)
+static void help_status(FILE * out, int detail)
 {
 	fprintf(out, "status [loop]\n");
 	if (detail) {
@@ -134,44 +141,51 @@ static void help_status(FILE *out, int detail)
 	}
 }
 
-static void help_logflush(FILE *out, int detail)
+static void help_logflush(FILE * out, int detail)
 {
 	fprintf(out, "logflush -- flush the opensm.log file\n");
 }
 
-static void help_querylid(FILE *out, int detail)
+static void help_querylid(FILE * out, int detail)
 {
 	fprintf(out,
-	"querylid lid -- print internal information about the lid specified\n");
+		"querylid lid -- print internal information about the lid specified\n");
 }
 
-static void help_portstatus(FILE *out, int detail)
+static void help_portstatus(FILE * out, int detail)
 {
 	fprintf(out, "portstatus [ca|switch|router]\n");
 	if (detail) {
 		fprintf(out, "summarize port status\n");
-		fprintf(out, "   [ca|switch|router] -- limit the results to the node type specified\n");
+		fprintf(out,
+			"   [ca|switch|router] -- limit the results to the node type specified\n");
 	}
 
 }
 
 #ifdef ENABLE_OSM_PERF_MGR
-static void help_perfmgr(FILE *out, int detail)
+static void help_perfmgr(FILE * out, int detail)
 {
-	fprintf(out, "perfmgr [enable|disable|clear_counters|dump_counters|sweep_time[seconds]]\n");
+	fprintf(out,
+		"perfmgr [enable|disable|clear_counters|dump_counters|sweep_time[seconds]]\n");
 	if (detail) {
-		fprintf(out, "perfmgr -- print the performance manager state\n");
-		fprintf(out, "   [enable|disable] -- change the perfmgr state\n");
-		fprintf(out, "   [sweep_time] -- change the perfmgr sweep time (requires [seconds] option)\n");
-		fprintf(out, "   [clear_counters] -- clear the counters stored\n");
-		fprintf(out, "   [dump_counters [mach]] -- dump the counters (optionally in [mach]ine readable format)\n");
+		fprintf(out,
+			"perfmgr -- print the performance manager state\n");
+		fprintf(out,
+			"   [enable|disable] -- change the perfmgr state\n");
+		fprintf(out,
+			"   [sweep_time] -- change the perfmgr sweep time (requires [seconds] option)\n");
+		fprintf(out,
+			"   [clear_counters] -- clear the counters stored\n");
+		fprintf(out,
+			"   [dump_counters [mach]] -- dump the counters (optionally in [mach]ine readable format)\n");
 	}
 }
-#endif /* ENABLE_OSM_PERF_MGR */
+#endif				/* ENABLE_OSM_PERF_MGR */
 
 /* more help routines go here */
 
-static void help_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
+static void help_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 {
 	char *p_cmd;
 	int i, found = 0;
@@ -194,14 +208,15 @@ static void help_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
 	}
 }
 
-static void loglevel_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
+static void loglevel_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 {
 	char *p_cmd;
 	int level;
 
 	p_cmd = next_token(p_last);
 	if (!p_cmd)
-		fprintf(out, "Current log level is 0x%x\n", osm_log_get_level(&p_osm->log));
+		fprintf(out, "Current log level is 0x%x\n",
+			osm_log_get_level(&p_osm->log));
 	else {
 		/* Handle x, 0x, and decimal specification of log level */
 		if (!strncmp(p_cmd, "x", 1)) {
@@ -222,21 +237,24 @@ static void loglevel_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
 	}
 }
 
-static void priority_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
+static void priority_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 {
 	char *p_cmd;
 	int priority;
 
 	p_cmd = next_token(p_last);
 	if (!p_cmd)
-		fprintf(out, "Current sm-priority is %d\n", p_osm->subn.opt.sm_priority);
+		fprintf(out, "Current sm-priority is %d\n",
+			p_osm->subn.opt.sm_priority);
 	else {
 		priority = strtol(p_cmd, NULL, 0);
 		if (0 > priority || 15 < priority)
-			fprintf(out, "Invalid sm-priority %d; must be between 0 and 15\n", priority);
+			fprintf(out,
+				"Invalid sm-priority %d; must be between 0 and 15\n",
+				priority);
 		else {
 			fprintf(out, "Setting sm-priority to %d\n", priority);
-			p_osm->subn.opt.sm_priority = (uint8_t)priority;
+			p_osm->subn.opt.sm_priority = (uint8_t) priority;
 			/* Does the SM state machine need a kick now ? */
 		}
 	}
@@ -244,17 +262,16 @@ static void priority_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
 
 static char *sm_state_str(int state)
 {
-	switch (state)
-	{
+	switch (state) {
 	case IB_SMINFO_STATE_INIT:
 		return ("Init");
-   	case IB_SMINFO_STATE_DISCOVERING:
+	case IB_SMINFO_STATE_DISCOVERING:
 		return ("Discovering");
-   	case IB_SMINFO_STATE_STANDBY:
+	case IB_SMINFO_STATE_STANDBY:
 		return ("Standby");
-   	case IB_SMINFO_STATE_NOTACTIVE:
+	case IB_SMINFO_STATE_NOTACTIVE:
 		return ("Not Active");
-   	case IB_SMINFO_STATE_MASTER:
+	case IB_SMINFO_STATE_MASTER:
 		return ("Master");
 	}
 	return ("UNKNOWN");
@@ -262,8 +279,7 @@ static char *sm_state_str(int state)
 
 static char *sa_state_str(osm_sa_state_t state)
 {
-	switch (state)
-	{
+	switch (state) {
 	case OSM_SA_STATE_INIT:
 		return ("Init");
 	case OSM_SA_STATE_READY:
@@ -274,91 +290,89 @@ static char *sa_state_str(osm_sa_state_t state)
 
 static char *sm_state_mgr_str(osm_sm_state_t state)
 {
-	switch (state)
-	{
-		case OSM_SM_STATE_NO_STATE:
-			return ("No State");
-		case OSM_SM_STATE_INIT:
-			return ("Init");
-		case OSM_SM_STATE_IDLE:
-			return ("Idle");
-		case OSM_SM_STATE_SWEEP_LIGHT:
-			return ("Sweep Light");
-		case OSM_SM_STATE_SWEEP_LIGHT_WAIT:
-			return ("Sweep Light Wait");
-		case OSM_SM_STATE_SWEEP_HEAVY_SELF:
-			return ("Sweep Heavy Self");
-		case OSM_SM_STATE_SWEEP_HEAVY_SUBNET:
-			return ("Sweep Heavy Subnet");
-		case OSM_SM_STATE_SET_SM_UCAST_LID:
-			return ("Set SM UCAST LID");
-		case OSM_SM_STATE_SET_SM_UCAST_LID_WAIT:
-			return ("Set SM UCAST LID Wait");
-		case OSM_SM_STATE_SET_SM_UCAST_LID_DONE:
-			return ("Set SM UCAST LID Done");
-		case OSM_SM_STATE_SET_SUBNET_UCAST_LIDS:
-			return ("Set Subnet UCAST LIDS");
-		case OSM_SM_STATE_SET_SUBNET_UCAST_LIDS_WAIT:
-			return ("Set Subnet UCAST LIDS Wait");
-		case OSM_SM_STATE_SET_SUBNET_UCAST_LIDS_DONE:
-			return ("Set Subnet UCAST LIDS Done");
-		case OSM_SM_STATE_SET_UCAST_TABLES:
-			return ("Set UCAST Tables");
-		case OSM_SM_STATE_SET_UCAST_TABLES_WAIT:
-			return ("Set UCAST Tables Wait");
-		case OSM_SM_STATE_SET_UCAST_TABLES_DONE:
-			return ("Set UCAST Tables Done");
-		case OSM_SM_STATE_SET_MCAST_TABLES:
-			return ("Set MCAST Tables");
-		case OSM_SM_STATE_SET_MCAST_TABLES_WAIT:
-			return ("Set MCAST Tables Wait");
-		case OSM_SM_STATE_SET_MCAST_TABLES_DONE:
-			return ("Set MCAST Tables Done");
-		case OSM_SM_STATE_SET_LINK_PORTS:
-			return ("Set Link Ports");
-		case OSM_SM_STATE_SET_LINK_PORTS_WAIT:
-			return ("Set Link Ports Wait");
-		case OSM_SM_STATE_SET_LINK_PORTS_DONE:
-			return ("Set Link Ports Done");
-		case OSM_SM_STATE_SET_ARMED:
-			return ("Set Armed");
-		case OSM_SM_STATE_SET_ARMED_WAIT:
-			return ("Set Armed Wait");
-		case OSM_SM_STATE_SET_ARMED_DONE:
-			return ("Set Armed Done");
-		case OSM_SM_STATE_SET_ACTIVE:
-			return ("Set Active");
-		case OSM_SM_STATE_SET_ACTIVE_WAIT:
-			return ("Set Active Wait");
-		case OSM_SM_STATE_LOST_NEGOTIATION:
-			return ("Lost Negotiation");
-		case OSM_SM_STATE_STANDBY:
-			return ("Standby");
-		case OSM_SM_STATE_SUBNET_UP:
-			return ("Subnet Up");
-		case OSM_SM_STATE_PROCESS_REQUEST:
-			return ("Process Request");
-		case OSM_SM_STATE_PROCESS_REQUEST_WAIT:
-			return ("Process Request Wait");
-		case OSM_SM_STATE_PROCESS_REQUEST_DONE:
-			return ("Process Request Done");
-		case OSM_SM_STATE_MASTER_OR_HIGHER_SM_DETECTED:
-			return ("Master or Higher SM Detected");
-		case OSM_SM_STATE_SET_PKEY:
-			return ("Set PKey");
-		case OSM_SM_STATE_SET_PKEY_WAIT:
-			return ("Set PKey Wait");
-		case OSM_SM_STATE_SET_PKEY_DONE:
-			return ("Set PKey Done");
-		default:
-			return ("Unknown State");
+	switch (state) {
+	case OSM_SM_STATE_NO_STATE:
+		return ("No State");
+	case OSM_SM_STATE_INIT:
+		return ("Init");
+	case OSM_SM_STATE_IDLE:
+		return ("Idle");
+	case OSM_SM_STATE_SWEEP_LIGHT:
+		return ("Sweep Light");
+	case OSM_SM_STATE_SWEEP_LIGHT_WAIT:
+		return ("Sweep Light Wait");
+	case OSM_SM_STATE_SWEEP_HEAVY_SELF:
+		return ("Sweep Heavy Self");
+	case OSM_SM_STATE_SWEEP_HEAVY_SUBNET:
+		return ("Sweep Heavy Subnet");
+	case OSM_SM_STATE_SET_SM_UCAST_LID:
+		return ("Set SM UCAST LID");
+	case OSM_SM_STATE_SET_SM_UCAST_LID_WAIT:
+		return ("Set SM UCAST LID Wait");
+	case OSM_SM_STATE_SET_SM_UCAST_LID_DONE:
+		return ("Set SM UCAST LID Done");
+	case OSM_SM_STATE_SET_SUBNET_UCAST_LIDS:
+		return ("Set Subnet UCAST LIDS");
+	case OSM_SM_STATE_SET_SUBNET_UCAST_LIDS_WAIT:
+		return ("Set Subnet UCAST LIDS Wait");
+	case OSM_SM_STATE_SET_SUBNET_UCAST_LIDS_DONE:
+		return ("Set Subnet UCAST LIDS Done");
+	case OSM_SM_STATE_SET_UCAST_TABLES:
+		return ("Set UCAST Tables");
+	case OSM_SM_STATE_SET_UCAST_TABLES_WAIT:
+		return ("Set UCAST Tables Wait");
+	case OSM_SM_STATE_SET_UCAST_TABLES_DONE:
+		return ("Set UCAST Tables Done");
+	case OSM_SM_STATE_SET_MCAST_TABLES:
+		return ("Set MCAST Tables");
+	case OSM_SM_STATE_SET_MCAST_TABLES_WAIT:
+		return ("Set MCAST Tables Wait");
+	case OSM_SM_STATE_SET_MCAST_TABLES_DONE:
+		return ("Set MCAST Tables Done");
+	case OSM_SM_STATE_SET_LINK_PORTS:
+		return ("Set Link Ports");
+	case OSM_SM_STATE_SET_LINK_PORTS_WAIT:
+		return ("Set Link Ports Wait");
+	case OSM_SM_STATE_SET_LINK_PORTS_DONE:
+		return ("Set Link Ports Done");
+	case OSM_SM_STATE_SET_ARMED:
+		return ("Set Armed");
+	case OSM_SM_STATE_SET_ARMED_WAIT:
+		return ("Set Armed Wait");
+	case OSM_SM_STATE_SET_ARMED_DONE:
+		return ("Set Armed Done");
+	case OSM_SM_STATE_SET_ACTIVE:
+		return ("Set Active");
+	case OSM_SM_STATE_SET_ACTIVE_WAIT:
+		return ("Set Active Wait");
+	case OSM_SM_STATE_LOST_NEGOTIATION:
+		return ("Lost Negotiation");
+	case OSM_SM_STATE_STANDBY:
+		return ("Standby");
+	case OSM_SM_STATE_SUBNET_UP:
+		return ("Subnet Up");
+	case OSM_SM_STATE_PROCESS_REQUEST:
+		return ("Process Request");
+	case OSM_SM_STATE_PROCESS_REQUEST_WAIT:
+		return ("Process Request Wait");
+	case OSM_SM_STATE_PROCESS_REQUEST_DONE:
+		return ("Process Request Done");
+	case OSM_SM_STATE_MASTER_OR_HIGHER_SM_DETECTED:
+		return ("Master or Higher SM Detected");
+	case OSM_SM_STATE_SET_PKEY:
+		return ("Set PKey");
+	case OSM_SM_STATE_SET_PKEY_WAIT:
+		return ("Set PKey Wait");
+	case OSM_SM_STATE_SET_PKEY_DONE:
+		return ("Set PKey Done");
+	default:
+		return ("Unknown State");
 	}
 }
 
-static void print_status(osm_opensm_t *p_osm, FILE *out)
+static void print_status(osm_opensm_t * p_osm, FILE * out)
 {
-	if (out)
-	{
+	if (out) {
 		fprintf(out, "   OpenSM Version     : %s\n", OSM_VERSION);
 		fprintf(out, "   SM State/Mgr State : %s/%s\n",
 			sm_state_str(p_osm->subn.sm_state),
@@ -366,48 +380,44 @@ static void print_status(osm_opensm_t *p_osm, FILE *out)
 		fprintf(out, "   SA State           : %s\n",
 			sa_state_str(p_osm->sa.state));
 		fprintf(out, "   Routing Engine     : %s\n",
-			p_osm->routing_engine.name ? p_osm->routing_engine.name : "null (min-hop)");
+			p_osm->routing_engine.name ? p_osm->routing_engine.
+			name : "null (min-hop)");
 #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)));
 #endif
 		fprintf(out, "\n   MAD stats\n"
-			     "   ---------\n"
-			     "   QP0 MADS outstanding           : %d\n"
-			     "   QP0 MADS outstanding (on wire) : %d\n"
-			     "   QP0 MADS rcvd                  : %d\n"
-			     "   QP0 MADS sent                  : %d\n"
-			     "   QP0 unicasts sent              : %d\n"
-			     "   SA MADS outstanding            : %d\n"
-			     "   SA MADS rcvd                   : %d\n"
-			     "   SA MADS sent                   : %d\n"
-			     ,
+			"   ---------\n"
+			"   QP0 MADS outstanding           : %d\n"
+			"   QP0 MADS outstanding (on wire) : %d\n"
+			"   QP0 MADS rcvd                  : %d\n"
+			"   QP0 MADS sent                  : %d\n"
+			"   QP0 unicasts sent              : %d\n"
+			"   SA MADS outstanding            : %d\n"
+			"   SA MADS rcvd                   : %d\n"
+			"   SA MADS sent                   : %d\n",
 			p_osm->stats.qp0_mads_outstanding,
 			p_osm->stats.qp0_mads_outstanding_on_wire,
 			p_osm->stats.qp0_mads_rcvd,
 			p_osm->stats.qp0_mads_sent,
 			p_osm->stats.qp0_unicasts_sent,
 			p_osm->stats.sa_mads_outstanding,
-			p_osm->stats.sa_mads_rcvd,
-			p_osm->stats.sa_mads_sent
-			);
+			p_osm->stats.sa_mads_rcvd, p_osm->stats.sa_mads_sent);
 		fprintf(out, "\n   Subnet flags\n"
-			     "   ------------\n"
-			     "   Ignore existing lfts           : %d\n"
-			     "   Subnet Init errors             : %d\n"
-			     "   In sweep hop 0                 : %d\n"
-			     "   Moved to master state          : %d\n"
-			     "   First time master sweep        : %d\n"
-			     "   Coming out of standby          : %d\n"
-			     ,
+			"   ------------\n"
+			"   Ignore existing lfts           : %d\n"
+			"   Subnet Init errors             : %d\n"
+			"   In sweep hop 0                 : %d\n"
+			"   Moved to master state          : %d\n"
+			"   First time master sweep        : %d\n"
+			"   Coming out of standby          : %d\n",
 			p_osm->subn.ignore_existing_lfts,
 			p_osm->subn.subnet_initialization_error,
 			p_osm->subn.in_sweep_hop_0,
 			p_osm->subn.moved_to_master_state,
 			p_osm->subn.first_time_master_sweep,
-			p_osm->subn.coming_out_of_standby
-			);
+			p_osm->subn.coming_out_of_standby);
 		fprintf(out, "\n");
 	}
 }
@@ -422,7 +432,7 @@ static int loop_command_check_time(void)
 	return (0);
 }
 
-static void status_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
+static void status_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 {
 	char *p_cmd;
 
@@ -442,35 +452,34 @@ static void status_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
 	print_status(p_osm, out);
 }
 
-static void resweep_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
+static void resweep_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, "heavy") != 0 &&
-	     strcmp(p_cmd, "light") != 0)) {
+	    (strcmp(p_cmd, "heavy") != 0 && strcmp(p_cmd, "light") != 0)) {
 		fprintf(out, "Invalid resweep command\n");
 		help_resweep(out, 1);
 	} else {
 		if (strcmp(p_cmd, "heavy") == 0) {
-        		p_osm->subn.force_immediate_heavy_sweep = TRUE;
+			p_osm->subn.force_immediate_heavy_sweep = TRUE;
 		}
-		osm_opensm_sweep( p_osm );
+		osm_opensm_sweep(p_osm);
 	}
 }
 
-static void logflush_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
+static void logflush_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 {
 	fflush(p_osm->log.out_port);
 }
 
-static void querylid_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;
-	uint16_t    lid = 0;
+	int p = 0;
+	uint16_t lid = 0;
 	osm_port_t *p_port = NULL;
-	char       *p_cmd = next_token(p_last);
+	char *p_cmd = next_token(p_last);
 
 	if (!p_cmd) {
 		fprintf(out, "no LID specified\n");
@@ -478,7 +487,7 @@ static void querylid_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
 		return;
 	}
 
-	lid = (uint16_t)strtoul(p_cmd, NULL, 0);
+	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;
@@ -495,25 +504,24 @@ static void querylid_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
 		cl_ntoh64(p_port->guid),
 		p_port->p_node->print_desc,
 		ib_get_node_type_str(osm_node_get_type(p_port->p_node)),
-		p_port->p_node->node_info.num_ports
-	       );
+		p_port->p_node->node_info.num_ports);
 
 	if (p_port->p_node->sw)
 		p = 0;
 	else
 		p = 1;
-	for (/* see above */; p < p_port->p_node->physp_tbl_size; p++) {
+	for ( /* see above */ ; p < p_port->p_node->physp_tbl_size; p++) {
 		fprintf(out,
 			"   Port %d health       : %s\n",
 			p,
-			p_port->p_node->physp_table[p].healthy ? "OK" : "ERROR"
-		       );
+			p_port->p_node->physp_table[p].
+			healthy ? "OK" : "ERROR");
 	}
 
 	cl_plock_release(&p_osm->lock);
 	return;
 
-invalid_lid:
+      invalid_lid:
 	cl_plock_release(&p_osm->lock);
 	fprintf(out, "Invalid lid %d\n", lid);
 	return;
@@ -524,13 +532,13 @@ invalid_lid:
  */
 typedef struct _port_report {
 	struct _port_report *next;
-	uint64_t             node_guid;
-	uint8_t              port_num;
-	char		     print_desc[IB_NODE_DESCRIPTION_SIZE+1];
+	uint64_t node_guid;
+	uint8_t port_num;
+	char print_desc[IB_NODE_DESCRIPTION_SIZE + 1];
 } port_report_t;
 
 static void
-__tag_port_report(port_report_t **head, uint64_t node_guid,
+__tag_port_report(port_report_t ** head, uint64_t node_guid,
 		  uint8_t port_num, char *print_desc)
 {
 	port_report_t *rep = malloc(sizeof(*rep));
@@ -539,7 +547,7 @@ __tag_port_report(port_report_t **head, uint64_t node_guid,
 
 	rep->node_guid = node_guid;
 	rep->port_num = port_num;
-	memcpy(rep->print_desc, print_desc, IB_NODE_DESCRIPTION_SIZE+1);
+	memcpy(rep->print_desc, print_desc, IB_NODE_DESCRIPTION_SIZE + 1);
 	rep->next = NULL;
 	if (*head) {
 		rep->next = *head;
@@ -548,12 +556,11 @@ __tag_port_report(port_report_t **head, uint64_t node_guid,
 		*head = rep;
 }
 
-static void
-__print_port_report(FILE *out, port_report_t *head)
+static void __print_port_report(FILE * out, port_report_t * head)
 {
-	port_report_t  *item = head;
+	port_report_t *item = head;
 	while (item != NULL) {
-		fprintf(out, "      0x%016"PRIx64" %d (%s)\n",
+		fprintf(out, "      0x%016" PRIx64 " %d (%s)\n",
 			item->node_guid, item->port_num, item->print_desc);
 		port_report_t *next = item->next;
 		free(item);
@@ -562,42 +569,41 @@ __print_port_report(FILE *out, port_report_t *head)
 }
 
 typedef struct {
-	uint8_t        node_type_lim; /* limit the results; 0 == ALL */
-	uint64_t       total_nodes;
-	uint64_t       total_ports;
-	uint64_t       ports_down;
-	uint64_t       ports_active;
-	uint64_t       ports_disabled;
+	uint8_t node_type_lim;	/* limit the results; 0 == ALL */
+	uint64_t total_nodes;
+	uint64_t total_ports;
+	uint64_t ports_down;
+	uint64_t ports_active;
+	uint64_t ports_disabled;
 	port_report_t *disabled_ports;
-	uint64_t       ports_1X;
-	uint64_t       ports_4X;
-	uint64_t       ports_8X;
-	uint64_t       ports_12X;
-	uint64_t       ports_unknown_width;
-	uint64_t       ports_reduced_width;
+	uint64_t ports_1X;
+	uint64_t ports_4X;
+	uint64_t ports_8X;
+	uint64_t ports_12X;
+	uint64_t ports_unknown_width;
+	uint64_t ports_reduced_width;
 	port_report_t *reduced_width_ports;
-	uint64_t       ports_sdr;
-	uint64_t       ports_ddr;
-	uint64_t       ports_qdr;
-	uint64_t       ports_unknown_speed;
-	uint64_t       ports_reduced_speed;
+	uint64_t ports_sdr;
+	uint64_t ports_ddr;
+	uint64_t ports_qdr;
+	uint64_t ports_unknown_speed;
+	uint64_t ports_reduced_speed;
 	port_report_t *reduced_speed_ports;
 } fabric_stats_t;
 
 /**
  * iterator function to get portstatus on each node
  */
-static void
-__get_stats(cl_map_item_t * const p_map_item, void *context)
+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;
-	uint8_t         num_ports = osm_node_get_num_physp(node);
-	uint8_t         port = 0;
+	fabric_stats_t *fs = (fabric_stats_t *) context;
+	osm_node_t *node = (osm_node_t *) p_map_item;
+	uint8_t num_ports = osm_node_get_num_physp(node);
+	uint8_t port = 0;
 
 	/* Skip nodes we are not interested in */
 	if (fs->node_type_lim != 0
-		&& fs->node_type_lim != node->node_info.node_type)
+	    && fs->node_type_lim != node->node_info.node_type)
 		return;
 
 	fs->total_nodes++;
@@ -618,49 +624,47 @@ __get_stats(cl_map_item_t * const p_map_item, void *context)
 		if ((enabled_width ^ active_width) > active_width) {
 			__tag_port_report(&(fs->reduced_width_ports),
 					  cl_ntoh64(node->node_info.node_guid),
-					  port,
-					  node->print_desc);
+					  port, node->print_desc);
 			fs->ports_reduced_width++;
 		}
 
 		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);
+					  port, node->print_desc);
 			fs->ports_reduced_speed++;
 		}
 
-		switch(active_speed) {
-			case IB_LINK_SPEED_ACTIVE_2_5:
-				fs->ports_sdr++;
-				break;
-			case IB_LINK_SPEED_ACTIVE_5:
-				fs->ports_ddr++;
-				break;
-			case IB_LINK_SPEED_ACTIVE_10:
-				fs->ports_qdr++;
-				break;
-			default:
-				fs->ports_unknown_speed++;
-				break;
+		switch (active_speed) {
+		case IB_LINK_SPEED_ACTIVE_2_5:
+			fs->ports_sdr++;
+			break;
+		case IB_LINK_SPEED_ACTIVE_5:
+			fs->ports_ddr++;
+			break;
+		case IB_LINK_SPEED_ACTIVE_10:
+			fs->ports_qdr++;
+			break;
+		default:
+			fs->ports_unknown_speed++;
+			break;
 		}
-		switch(active_width) {
-			case IB_LINK_WIDTH_ACTIVE_1X:
-				fs->ports_1X++;
-				break;
-			case IB_LINK_WIDTH_ACTIVE_4X:
-				fs->ports_4X++;
-				break;
-			case IB_LINK_WIDTH_ACTIVE_8X:
-				fs->ports_8X++;
-				break;
-			case IB_LINK_WIDTH_ACTIVE_12X:
-				fs->ports_12X++;
-				break;
-			default:
-				fs->ports_unknown_width++;
-				break;
+		switch (active_width) {
+		case IB_LINK_WIDTH_ACTIVE_1X:
+			fs->ports_1X++;
+			break;
+		case IB_LINK_WIDTH_ACTIVE_4X:
+			fs->ports_4X++;
+			break;
+		case IB_LINK_WIDTH_ACTIVE_8X:
+			fs->ports_8X++;
+			break;
+		case IB_LINK_WIDTH_ACTIVE_12X:
+			fs->ports_12X++;
+			break;
+		default:
+			fs->ports_unknown_width++;
+			break;
 		}
 		if (port_state == IB_LINK_DOWN)
 			fs->ports_down++;
@@ -669,8 +673,7 @@ __get_stats(cl_map_item_t * const p_map_item, void *context)
 		if (port_phys_state == IB_PORT_PHYS_STATE_DISABLED) {
 			__tag_port_report(&(fs->disabled_ports),
 					  cl_ntoh64(node->node_info.node_guid),
-					  port,
-					  node->print_desc);
+					  port, node->print_desc);
 			fs->ports_disabled++;
 		}
 
@@ -678,11 +681,11 @@ __get_stats(cl_map_item_t * const p_map_item, void *context)
 	}
 }
 
-static void portstatus_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
+static void portstatus_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 {
-	fabric_stats_t  fs;
-	struct timeval  before, after;
-	char           *p_cmd;
+	fabric_stats_t fs;
+	struct timeval before, after;
+	char *p_cmd;
 
 	memset(&fs, 0, sizeof(fs));
 
@@ -705,52 +708,56 @@ static void portstatus_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
 
 	/* for each node in the system gather the stats */
 	cl_plock_acquire(&p_osm->lock);
-	cl_qmap_apply_func(&(p_osm->subn.node_guid_tbl), __get_stats, (void *)&fs);
+	cl_qmap_apply_func(&(p_osm->subn.node_guid_tbl), __get_stats,
+			   (void *)&fs);
 	cl_plock_release(&p_osm->lock);
 
 	gettimeofday(&after, NULL);
 
 	/* report the stats */
 	fprintf(out, "\"%s\" port status:\n",
-		fs.node_type_lim ?  ib_get_node_type_str(fs.node_type_lim) : "ALL");
-	fprintf(out, "   %"PRIu64" port(s) scanned on %"PRIu64" nodes in %lu us\n",
-		fs.total_ports, fs.total_nodes, after.tv_usec - before.tv_usec);
+		fs.node_type_lim ? ib_get_node_type_str(fs.
+							node_type_lim) : "ALL");
+	fprintf(out,
+		"   %" PRIu64 " port(s) scanned on %" PRIu64
+		" nodes in %lu us\n", fs.total_ports, fs.total_nodes,
+		after.tv_usec - before.tv_usec);
 
 	if (fs.ports_down)
-		fprintf(out, "   %"PRIu64" down\n", fs.ports_down);
+		fprintf(out, "   %" PRIu64 " down\n", fs.ports_down);
 	if (fs.ports_active)
-		fprintf(out, "   %"PRIu64" active\n", fs.ports_active);
+		fprintf(out, "   %" PRIu64 " active\n", fs.ports_active);
 	if (fs.ports_1X)
-		fprintf(out, "   %"PRIu64" at 1X\n", fs.ports_1X);
+		fprintf(out, "   %" PRIu64 " at 1X\n", fs.ports_1X);
 	if (fs.ports_4X)
-		fprintf(out, "   %"PRIu64" at 4X\n", fs.ports_4X);
+		fprintf(out, "   %" PRIu64 " at 4X\n", fs.ports_4X);
 	if (fs.ports_8X)
-		fprintf(out, "   %"PRIu64" at 8X\n", fs.ports_8X);
+		fprintf(out, "   %" PRIu64 " at 8X\n", fs.ports_8X);
 	if (fs.ports_12X)
-		fprintf(out, "   %"PRIu64" at 12X\n", fs.ports_12X);
+		fprintf(out, "   %" PRIu64 " at 12X\n", fs.ports_12X);
 
 	if (fs.ports_sdr)
-		fprintf(out, "   %"PRIu64" at 2.5 Gbps\n", fs.ports_sdr);
+		fprintf(out, "   %" PRIu64 " at 2.5 Gbps\n", fs.ports_sdr);
 	if (fs.ports_ddr)
-		fprintf(out, "   %"PRIu64" at 5.0 Gbps\n", fs.ports_ddr);
+		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);
+		fprintf(out, "   %" PRIu64 " at 10.0 Gbps\n", fs.ports_qdr);
 
 	if (fs.ports_disabled + fs.ports_reduced_speed + fs.ports_reduced_width
-			> 0) {
+	    > 0) {
 		fprintf(out, "\nPossible issues:\n");
 	}
 	if (fs.ports_disabled) {
-		fprintf(out, "   %"PRIu64" disabled\n", fs.ports_disabled);
+		fprintf(out, "   %" PRIu64 " disabled\n", fs.ports_disabled);
 		__print_port_report(out, fs.disabled_ports);
 	}
 	if (fs.ports_reduced_speed) {
-		fprintf(out, "   %"PRIu64" with reduced speed\n",
+		fprintf(out, "   %" PRIu64 " with reduced speed\n",
 			fs.ports_reduced_speed);
 		__print_port_report(out, fs.reduced_speed_ports);
 	}
 	if (fs.ports_reduced_width) {
-		fprintf(out, "   %"PRIu64" with reduced width\n",
+		fprintf(out, "   %" PRIu64 " with reduced width\n",
 			fs.ports_reduced_width);
 		__print_port_report(out, fs.reduced_width_ports);
 	}
@@ -758,72 +765,59 @@ static void portstatus_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
 }
 
 #ifdef ENABLE_OSM_PERF_MGR
-static void perfmgr_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
+static void perfmgr_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 {
 	char *p_cmd;
 
 	p_cmd = next_token(p_last);
-	if (p_cmd)
-	{
-	   if (strcmp(p_cmd, "enable") == 0)
-	   {
-		   osm_perfmgr_set_state(&(p_osm->perfmgr), PERFMGR_STATE_ENABLED);
-	   }
-	   else if (strcmp(p_cmd, "disable") == 0)
-	   {
-		   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));
-	   }
-	   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),
-					PERFMGR_EVENT_DB_DUMP_MR);
+	if (p_cmd) {
+		if (strcmp(p_cmd, "enable") == 0) {
+			osm_perfmgr_set_state(&(p_osm->perfmgr),
+					      PERFMGR_STATE_ENABLED);
+		} else if (strcmp(p_cmd, "disable") == 0) {
+			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));
+		} 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),
+							  PERFMGR_EVENT_DB_DUMP_MR);
+			} else {
+				osm_perfmgr_dump_counters(&(p_osm->perfmgr),
+							  PERFMGR_EVENT_DB_DUMP_HR);
+			}
+		} 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);
+			} else {
+				fprintf(out,
+					"sweep_time requires a time period (in seconds) to be specified\n");
+			}
 		} else {
-			osm_perfmgr_dump_counters(&(p_osm->perfmgr),
-					PERFMGR_EVENT_DB_DUMP_HR);
+			fprintf(out, "\"%s\" option not found\n", p_cmd);
 		}
-	   }
-	   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);
-		}
-		else
-		{
-			fprintf(out, "sweep_time requires a time period (in seconds) to be specified\n");
-		}
-	   }
-	   else
-	   {
-		fprintf(out, "\"%s\" option not found\n", p_cmd);
-	   }
 	} else {
 		fprintf(out, "Performance Manager status:\n"
-			     "state                   : %s\n"
-			     "sweep state             : %s\n"
-		             "sweep time              : %us\n"
-		             "outstanding queries/max : %d/%u\n"
-		        ,
+			"state                   : %s\n"
+			"sweep state             : %s\n"
+			"sweep time              : %us\n"
+			"outstanding queries/max : %d/%u\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
-			);
+			p_osm->perfmgr.max_outstanding_queries);
 	}
 }
-#endif /* ENABLE_OSM_PERF_MGR */
+#endif				/* ENABLE_OSM_PERF_MGR */
 
 /* This is public to be able to close it on exit */
-void osm_console_close_socket(osm_opensm_t *p_osm)
+void osm_console_close_socket(osm_opensm_t * p_osm)
 {
 	if (p_osm->console.socket > 0) {
 		close(p_osm->console.in_fd);
@@ -834,32 +828,30 @@ void osm_console_close_socket(osm_opensm_t *p_osm)
 	}
 }
 
-static void quit_parse(char **p_last, osm_opensm_t *p_osm, FILE *out)
+static void quit_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 {
 	osm_console_close_socket(p_osm);
 }
 
-
 /* more parse routines go here */
 
-static const struct command console_cmds[] =
-{
-	{ "help",	&help_command,		&help_parse},
-	{ "quit",	&help_quit,		&quit_parse},
-	{ "loglevel",	&help_loglevel,		&loglevel_parse},
-	{ "priority",	&help_priority,		&priority_parse},
-	{ "resweep",	&help_resweep,		&resweep_parse},
-	{ "status",	&help_status,		&status_parse},
-	{ "logflush",	&help_logflush,		&logflush_parse},
-	{ "querylid",   &help_querylid,         &querylid_parse},
-	{ "portstatus", &help_portstatus,       &portstatus_parse},
+static const struct command console_cmds[] = {
+	{"help", &help_command, &help_parse},
+	{"quit", &help_quit, &quit_parse},
+	{"loglevel", &help_loglevel, &loglevel_parse},
+	{"priority", &help_priority, &priority_parse},
+	{"resweep", &help_resweep, &resweep_parse},
+	{"status", &help_status, &status_parse},
+	{"logflush", &help_logflush, &logflush_parse},
+	{"querylid", &help_querylid, &querylid_parse},
+	{"portstatus", &help_portstatus, &portstatus_parse},
 #ifdef ENABLE_OSM_PERF_MGR
-	{ "perfmgr",    &help_perfmgr,          &perfmgr_parse},
-#endif /* ENABLE_OSM_PERF_MGR */
-	{ NULL,		NULL,			NULL}	/* end of array */
+	{"perfmgr", &help_perfmgr, &perfmgr_parse},
+#endif				/* ENABLE_OSM_PERF_MGR */
+	{NULL, NULL, NULL}	/* end of array */
 };
 
-static void parse_cmd_line(char *line, osm_opensm_t *p_osm)
+static void parse_cmd_line(char *line, osm_opensm_t * p_osm)
 {
 	char *p_cmd, *p_last;
 	int i, found = 0;
@@ -874,7 +866,7 @@ static void parse_cmd_line(char *line, osm_opensm_t *p_osm)
 	p_cmd = strtok_r(line, " \t\n\r", &p_last);
 	if (p_cmd) {
 		for (i = 0; console_cmds[i].name; i++) {
-			if (loop_command.on ) {
+			if (loop_command.on) {
 				if (!strcmp(p_cmd, "q")) {
 					loop_command.on = 0;
 				}
@@ -883,7 +875,8 @@ static void parse_cmd_line(char *line, osm_opensm_t *p_osm)
 			}
 			if (!strcmp(p_cmd, console_cmds[i].name)) {
 				found = 1;
-				console_cmds[i].parse_function(&p_last, p_osm, out);
+				console_cmds[i].parse_function(&p_last, p_osm,
+							       out);
 				break;
 			}
 		}
@@ -900,7 +893,7 @@ static void parse_cmd_line(char *line, osm_opensm_t *p_osm)
 	}
 }
 
-void osm_console_prompt(FILE *out)
+void osm_console_prompt(FILE * out)
 {
 	if (out) {
 		fprintf(out, "OpenSM %s", OSM_COMMAND_PROMPT);
@@ -908,11 +901,11 @@ void osm_console_prompt(FILE *out)
 	}
 }
 
-void osm_console_init(osm_subn_opt_t *opt, osm_opensm_t *p_osm)
+void osm_console_init(osm_subn_opt_t * opt, osm_opensm_t * p_osm)
 {
 	p_osm->console.socket = -1;
 	/* set up the file descriptors for the console */
-    	if (strcmp(opt->console, "local") == 0) {
+	if (strcmp(opt->console, "local") == 0) {
 		p_osm->console.in = stdin;
 		p_osm->console.out = stdout;
 		p_osm->console.in_fd = fileno(stdin);
@@ -920,66 +913,64 @@ void osm_console_init(osm_subn_opt_t *opt, osm_opensm_t *p_osm)
 
 		osm_console_prompt(p_osm->console.out);
 #ifdef ENABLE_OSM_CONSOLE_SOCKET
-    	} else if (strcmp(opt->console, "socket") == 0) {
-		struct sockaddr_in  sin;
+	} else if (strcmp(opt->console, "socket") == 0) {
+		struct sockaddr_in sin;
 		int optval = 1;
 
-		if ((p_osm->console.socket = socket(AF_INET, SOCK_STREAM, 0)) < 0)
-		{
+		if ((p_osm->console.socket =
+		     socket(AF_INET, SOCK_STREAM, 0)) < 0) {
 			osm_log(&(p_osm->log), OSM_LOG_ERROR,
 				"osm_console_init: ERR 4B01: Failed to open console socket: %s\n",
 				strerror(errno));
 			return;
 		}
-		setsockopt(p_osm->console.socket, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval));
+		setsockopt(p_osm->console.socket, SOL_SOCKET, SO_REUSEADDR,
+			   &optval, sizeof(optval));
 		sin.sin_family = AF_INET;
 		sin.sin_port = htons(opt->console_port);
 		sin.sin_addr.s_addr = htonl(INADDR_ANY);
-		if (bind(p_osm->console.socket, &sin, sizeof(sin)) < 0)
-		{
+		if (bind(p_osm->console.socket, &sin, sizeof(sin)) < 0) {
 			osm_log(&(p_osm->log), OSM_LOG_ERROR,
 				"osm_console_init: ERR 4B02: Failed to bind console socket: %s\n",
 				strerror(errno));
 			return;
 		}
-		if (listen(p_osm->console.socket, 1) < 0)
-		{
+		if (listen(p_osm->console.socket, 1) < 0) {
 			osm_log(&(p_osm->log), OSM_LOG_ERROR,
 				"osm_console_init: ERR 4B03: Failed to listen on socket: %s\n",
 				strerror(errno));
 			return;
 		}
 
-		signal(SIGPIPE, SIG_IGN); /* protect ourselves from closed pipes */
+		signal(SIGPIPE, SIG_IGN);	/* protect ourselves from closed pipes */
 		p_osm->console.in = NULL;
 		p_osm->console.out = NULL;
 		p_osm->console.in_fd = -1;
 		p_osm->console.out_fd = -1;
 		osm_log(&(p_osm->log), OSM_LOG_INFO,
-				"osm_console_init: Console listening on port %d\n", opt->console_port);
+			"osm_console_init: Console listening on port %d\n",
+			opt->console_port);
 #endif
 	}
 }
 
 #ifdef ENABLE_OSM_CONSOLE_SOCKET
-static void handle_osm_connection(osm_opensm_t *p_osm, int new_fd,
-				char *client_ip, char *client_hn)
+static void handle_osm_connection(osm_opensm_t * p_osm, int new_fd,
+				  char *client_ip, char *client_hn)
 {
-	char          *p_line;
-	size_t         len;
-	ssize_t        n;
+	char *p_line;
+	size_t len;
+	ssize_t n;
 
-	if (p_osm->console.in_fd >= 0)
-	{
+	if (p_osm->console.in_fd >= 0) {
 		FILE *file = fdopen(new_fd, "w+");
 
 		fprintf(file, "OpenSM Console connection already in use\n"
-				"   kill other session (y/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'))
-		{
+		if (n > 0 && (p_line[0] == 'y' || p_line[0] == 'Y')) {
 			osm_console_close_socket(p_osm);
 		} else {
 			close(new_fd);
@@ -992,24 +983,25 @@ static void handle_osm_connection(osm_opensm_t *p_osm, int new_fd,
 	p_osm->console.out = p_osm->console.in;
 	osm_console_prompt(p_osm->console.out);
 	osm_log(&(p_osm->log), OSM_LOG_INFO,
-			"osm_console_init: Console connection accepted: %s (%s)\n",
-			client_hn, client_ip);
+		"osm_console_init: Console connection accepted: %s (%s)\n",
+		client_hn, client_ip);
 }
 
 static int connection_ok(char *client_ip, char *client_hn)
 {
-	return (hosts_ctl(OSM_DAEMON_NAME, client_hn, client_ip, "STRING_UNKNOWN"));
+	return (hosts_ctl
+		(OSM_DAEMON_NAME, client_hn, client_ip, "STRING_UNKNOWN"));
 }
 #endif
 
-void osm_console(osm_opensm_t *p_osm)
+void osm_console(osm_opensm_t * p_osm)
 {
-	struct pollfd  pollfd[2];
-	char          *p_line;
-	size_t         len;
-	ssize_t        n;
+	struct pollfd pollfd[2];
+	char *p_line;
+	size_t len;
+	ssize_t n;
 	struct pollfd *fds;
-	nfds_t         nfds;
+	nfds_t nfds;
 
 	pollfd[0].fd = p_osm->console.socket;
 	pollfd[0].events = POLLIN;
@@ -1023,8 +1015,7 @@ void osm_console(osm_opensm_t *p_osm)
 	nfds = p_osm->console.socket < 0 || pollfd[1].fd < 0 ? 1 : 2;
 
 	if (loop_command.on && loop_command_check_time() &&
-	    loop_command.loop_function)
-	{
+	    loop_command.loop_function) {
 		if (p_osm->console.out) {
 			loop_command.loop_function(p_osm, p_osm->console.out);
 			fflush(p_osm->console.out);
@@ -1039,7 +1030,7 @@ void osm_console(osm_opensm_t *p_osm)
 #ifdef ENABLE_OSM_CONSOLE_SOCKET
 	if (pollfd[0].revents & POLLIN) {
 		int new_fd = 0;
-		struct sockaddr_in  sin;
+		struct sockaddr_in sin;
 		socklen_t len = sizeof(sin);
 		char client_ip[64];
 		char client_hn[128];
@@ -1051,17 +1042,21 @@ void osm_console(osm_opensm_t *p_osm)
 			p_osm->console.in_fd = -1;
 			return;
 		}
-		if (inet_ntop(AF_INET, &sin.sin_addr, client_ip, sizeof(client_ip)) == NULL) {
+		if (inet_ntop
+		    (AF_INET, &sin.sin_addr, client_ip,
+		     sizeof(client_ip)) == NULL) {
 			snprintf(client_ip, 64, "STRING_UNKNOWN");
 		}
-    		if ((hent = gethostbyaddr((const char *) &sin.sin_addr,
-                              sizeof(struct in_addr), AF_INET)) == NULL) {
+		if ((hent = gethostbyaddr((const char *)&sin.sin_addr,
+					  sizeof(struct in_addr),
+					  AF_INET)) == NULL) {
 			snprintf(client_hn, 128, "STRING_UNKNOWN");
 		} else {
 			snprintf(client_hn, 128, "%s", hent->h_name);
 		}
 		if (connection_ok(client_ip, client_hn)) {
-			handle_osm_connection(p_osm, new_fd, client_ip, client_hn);
+			handle_osm_connection(p_osm, new_fd, client_ip,
+					      client_hn);
 		} else {
 			osm_log(&(p_osm->log), OSM_LOG_ERROR,
 				"osm_console: ERR 4B05: Console connection denied: %s (%s)\n",
diff --git a/opensm/opensm/osm_db_files.c b/opensm/opensm/osm_db_files.c
index 6bcbe80..535c4ba 100644
--- a/opensm/opensm/osm_db_files.c
+++ b/opensm/opensm/osm_db_files.c
@@ -42,7 +42,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -86,9 +86,9 @@
  * SYNOPSIS
  */
 typedef struct _osm_db_domain_imp {
-  char          *file_name;
-  st_table      *p_hash;
-  cl_spinlock_t lock;
+	char *file_name;
+	st_table *p_hash;
+	cl_spinlock_t lock;
 } osm_db_domain_imp_t;
 /*
  * FIELDS
@@ -107,7 +107,7 @@ typedef struct _osm_db_domain_imp {
  * SYNOPSIS
  */
 typedef struct _osm_db_imp {
-  char      *db_dir_name;
+	char *db_dir_name;
 } osm_db_imp_t;
 /*
  * FIELDS
@@ -121,688 +121,619 @@ typedef struct _osm_db_imp {
 
 /***************************************************************************
  ***************************************************************************/
-void
-osm_db_construct(
-  IN osm_db_t* const p_db )
+void osm_db_construct(IN osm_db_t * const p_db)
 {
-  memset(p_db, 0, sizeof(osm_db_t));
-  cl_list_construct( &p_db->domains );
+	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 * const 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;
+	osm_db_domain_imp_t *p_domain_imp;
+	p_domain_imp = (osm_db_domain_imp_t *) p_db_domain->p_domain_imp;
 
-  osm_db_clear( p_db_domain );
+	osm_db_clear(p_db_domain);
 
-  cl_spinlock_destroy( &p_domain_imp->lock );
+	cl_spinlock_destroy(&p_domain_imp->lock);
 
-  st_free_table( p_domain_imp->p_hash );
-  free( p_domain_imp->file_name );
-  free( p_domain_imp );
+	st_free_table(p_domain_imp->p_hash);
+	free(p_domain_imp->file_name);
+	free(p_domain_imp);
 }
 
 /***************************************************************************
  ***************************************************************************/
-void
-osm_db_destroy(
-  IN osm_db_t* const p_db )
+void osm_db_destroy(IN osm_db_t * const p_db)
 {
-  osm_db_domain_t   *p_domain;
-
-  while ((p_domain = cl_list_remove_head( &p_db->domains )) != NULL )
-  {
-    osm_db_domain_destroy( p_domain );
-    free( p_domain );
-  }
-  cl_list_destroy( &p_db->domains );
-  free( p_db->p_db_imp );
+	osm_db_domain_t *p_domain;
+
+	while ((p_domain = cl_list_remove_head(&p_db->domains)) != NULL) {
+		osm_db_domain_destroy(p_domain);
+		free(p_domain);
+	}
+	cl_list_destroy(&p_db->domains);
+	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 * const p_db, IN osm_log_t * p_log)
 {
-  osm_db_imp_t *p_db_imp;
-  struct stat  dstat;
+	osm_db_imp_t *p_db_imp;
+	struct stat dstat;
 
-  OSM_LOG_ENTER( p_log, osm_db_init );
+	OSM_LOG_ENTER(p_log, osm_db_init);
 
-  p_db_imp = (osm_db_imp_t *)malloc(sizeof(osm_db_imp_t));
-  CL_ASSERT( p_db_imp != NULL);
+	p_db_imp = (osm_db_imp_t *) malloc(sizeof(osm_db_imp_t));
+	CL_ASSERT(p_db_imp != NULL);
 
-  p_db_imp->db_dir_name = getenv("OSM_CACHE_DIR");
-  if (!p_db_imp->db_dir_name || !(*p_db_imp->db_dir_name))
-    p_db_imp->db_dir_name = OSM_DEFAULT_CACHE_DIR;
+	p_db_imp->db_dir_name = getenv("OSM_CACHE_DIR");
+	if (!p_db_imp->db_dir_name || !(*p_db_imp->db_dir_name))
+		p_db_imp->db_dir_name = OSM_DEFAULT_CACHE_DIR;
 
-  /* Create the directory if it doesn't exist */
-  /* There is a difference in creating directory between windows and linux */
+	/* 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);
-#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,
-               "osm_db_init: ERR 6101: "
-               " Failed to create the db directory:%s\n",
-               p_db_imp->db_dir_name);
-      OSM_LOG_EXIT( p_log );
-      return 1;
-    }
-  }
+	/* Check if the directory exists. If not - create it. */
+	CreateDirectory(p_db_imp->db_dir_name, NULL);
+#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,
+				"osm_db_init: ERR 6101: "
+				" Failed to create the db directory:%s\n",
+				p_db_imp->db_dir_name);
+			OSM_LOG_EXIT(p_log);
+			return 1;
+		}
+	}
 #endif
 
-  p_db->p_log = p_log;
-  p_db->p_db_imp = (void*)p_db_imp;
+	p_db->p_log = p_log;
+	p_db->p_db_imp = (void *)p_db_imp;
 
-  cl_list_init( &p_db->domains, 5 );
+	cl_list_init(&p_db->domains, 5);
 
-  OSM_LOG_EXIT( p_log );
+	OSM_LOG_EXIT(p_log);
 
-  return 0;
+	return 0;
 }
 
 /***************************************************************************
  ***************************************************************************/
-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 * const p_db,
+				    IN char *domain_name)
 {
-  osm_db_domain_t     *p_domain;
-  osm_db_domain_imp_t *p_domain_imp;
-  int                  dir_name_len;
-  osm_log_t           *p_log = p_db->p_log;
-  FILE                *p_file;
-
-  OSM_LOG_ENTER( p_log, osm_db_domain_init );
-
-  /* allocate a new domain object */
-  p_domain = (osm_db_domain_t *)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));
-  CL_ASSERT( p_domain_imp != NULL );
-
-  dir_name_len = strlen(((osm_db_imp_t*)p_db->p_db_imp)->db_dir_name);
-
-  /* set the domain file name */
-  p_domain_imp->file_name =
-    (char *)malloc(sizeof(char)*(dir_name_len) + strlen(domain_name) + 2);
-  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);
-
-  /* make sure the file exists - or exit if not writable */
-  p_file = fopen(p_domain_imp->file_name, "a+");
-  if (! p_file)
-  {
-    osm_log( p_log, OSM_LOG_ERROR,
-             "osm_db_domain_init: ERR 6102: "
-             " Failed to open the db file:%s\n",
-             p_domain_imp->file_name);
-    free(p_domain_imp);
-    free(p_domain);
-    p_domain = NULL;
-    goto Exit;
-  }
-  fclose(p_file);
-
-  /* initialize the hash table object */
-  p_domain_imp->p_hash = st_init_strtable();
-  CL_ASSERT( p_domain_imp->p_hash != NULL );
-
-  p_domain->p_db = p_db;
-  cl_list_insert_tail( &p_db->domains, p_domain );
-  p_domain->p_domain_imp = p_domain_imp;
-  cl_spinlock_construct( &p_domain_imp->lock );
-  cl_spinlock_init( &p_domain_imp->lock );
-
- Exit:
-  OSM_LOG_EXIT( p_log );
-  return p_domain;
+	osm_db_domain_t *p_domain;
+	osm_db_domain_imp_t *p_domain_imp;
+	int dir_name_len;
+	osm_log_t *p_log = p_db->p_log;
+	FILE *p_file;
+
+	OSM_LOG_ENTER(p_log, osm_db_domain_init);
+
+	/* allocate a new domain object */
+	p_domain = (osm_db_domain_t *) 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));
+	CL_ASSERT(p_domain_imp != NULL);
+
+	dir_name_len = strlen(((osm_db_imp_t *) p_db->p_db_imp)->db_dir_name);
+
+	/* set the domain file name */
+	p_domain_imp->file_name =
+	    (char *)malloc(sizeof(char) * (dir_name_len) + strlen(domain_name) +
+			   2);
+	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);
+
+	/* make sure the file exists - or exit if not writable */
+	p_file = fopen(p_domain_imp->file_name, "a+");
+	if (!p_file) {
+		osm_log(p_log, OSM_LOG_ERROR,
+			"osm_db_domain_init: ERR 6102: "
+			" Failed to open the db file:%s\n",
+			p_domain_imp->file_name);
+		free(p_domain_imp);
+		free(p_domain);
+		p_domain = NULL;
+		goto Exit;
+	}
+	fclose(p_file);
+
+	/* initialize the hash table object */
+	p_domain_imp->p_hash = st_init_strtable();
+	CL_ASSERT(p_domain_imp->p_hash != NULL);
+
+	p_domain->p_db = p_db;
+	cl_list_insert_tail(&p_db->domains, p_domain);
+	p_domain->p_domain_imp = p_domain_imp;
+	cl_spinlock_construct(&p_domain_imp->lock);
+	cl_spinlock_init(&p_domain_imp->lock);
+
+      Exit:
+	OSM_LOG_EXIT(p_log);
+	return p_domain;
 }
 
 /***************************************************************************
  ***************************************************************************/
-int
-osm_db_restore(
-  IN osm_db_domain_t *p_domain)
+int osm_db_restore(IN osm_db_domain_t * p_domain)
 {
 
-  osm_log_t           *p_log = p_domain->p_db->p_log;
-  osm_db_domain_imp_t *p_domain_imp =
-    (osm_db_domain_imp_t *)p_domain->p_domain_imp;
-  FILE                *p_file;
-  int                  status;
-  char                 sLine[OSM_DB_MAX_LINE_LEN];
-  boolean_t            before_key;
-  char                *p_first_word, *p_rest_of_line, *p_last;
-  char                *p_key = NULL;
-  char                *p_prev_val, *p_accum_val = NULL;
-  char                *endptr = NULL;
-  unsigned int         line_num;
-
-  OSM_LOG_ENTER( p_log, osm_db_restore );
-
-  /* take the lock on the domain */
-  cl_spinlock_acquire( &p_domain_imp->lock );
-
-  /* open the file - read mode */
-  p_file = fopen(p_domain_imp->file_name, "r");
-
-  if (! p_file)
-  {
-    osm_log( p_log, OSM_LOG_ERROR,
-             "osm_db_restore: ERR 6103: "
-             " Failed to open the db file:%s\n",
-             p_domain_imp->file_name);
-    status = 1;
-    goto Exit;
-  }
-
-  /* parse the file allocating new hash tables as required */
-  /*
-     states:
-     before_key (0) -> in_key (1)
-
-     before_key: if a word on the first byte - it is the key. state=in_key
-     the rest of the line is start of the value.
-     in_key: unless the line is empty - add it (with newlines) to the value.
-     if empty: state=before_key
-  */
-  status = 0;
-  before_key = TRUE;
-  line_num = 0;
-  /* if we got to EOF in the middle of a key we add a last newline */
-  while (
-    (fgets(sLine, OSM_DB_MAX_LINE_LEN, p_file) != NULL) ||
-    ((before_key == FALSE) && strcpy(sLine,"\n"))
-    )
-  {
-    line_num++;
-    if (before_key)
-    {
-      if ((sLine[0] != ' ') && (sLine[0] != '\t') && (sLine[0] != '\n'))
-      {
-        /* we got a new key */
-        before_key = FALSE;
-
-        /* handle the key */
-        p_first_word = strtok_r(sLine, " \t\n", &p_last);
-        if (! p_first_word)
-        {
-          osm_log( p_log, OSM_LOG_ERROR,
-                   "osm_db_restore: ERR 6104: "
-                   " Failed to get key from line:%u : %s (file:%s)\n",
-                   line_num, sLine, p_domain_imp->file_name);
-          status = 1;
-          goto EndParsing;
-        }
-        if (strlen(p_first_word) > OSM_DB_MAX_GUID_LEN)
-        {
-          osm_log( p_log, OSM_LOG_ERROR,
-                   "osm_db_restore: ERR 610A: "
-                   " Illegal key from line:%u : %s (file:%s)\n",
-                   line_num, sLine, p_domain_imp->file_name);
-          status = 1;
-          goto EndParsing;
-        }
-
-        p_key = (char *)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));
-          strcpy(p_accum_val, p_rest_of_line);
-        }
-        else
-        {
-          p_accum_val = (char*)malloc(2);
-          strcpy(p_accum_val, "\0");
-        }
-      }
-      else if (sLine[0] != '\n')
-      {
-        osm_log( p_log, OSM_LOG_ERROR,
-                 "osm_db_restore: ERR 6105: "
-                 " How did we get here? line:%u : %s (file:%s)\n",
-                 line_num, sLine, p_domain_imp->file_name);
-        status = 1;
-        goto EndParsing;
-      }
-    } /* before key */
-    else
-    {
-      /* we already have a key */
-
-      if (sLine[0] == '\n')
-      {
-        /* got an end of key */
-        before_key = TRUE;
-
-        /* make sure the key was not previously used */
-        if (st_lookup(p_domain_imp->p_hash,
-                      (st_data_t)p_key,
-                      (st_data_t*)&p_prev_val))
-        {
-          osm_log( p_log, OSM_LOG_ERROR,
-                   "osm_db_restore: ERR 6106: "
-                   " Key:%s already exists in:%s with value:%s."
-                   " Removing it\n",
-                   p_key,
-                   p_domain_imp->file_name,
-                   p_prev_val);
-        }
-        else
-        {
-          p_prev_val = NULL;
-        }
-
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "osm_db_restore: "
-                 "Got key:%s value:%s\n", p_key, p_accum_val);
-
-        /* check that the key is a number */
-        if (!strtouq(p_key, &endptr, 0) && *endptr != '\0')
-        {
-          osm_log( p_log, OSM_LOG_ERROR,
-                   "osm_db_restore: ERR 610B: "
-                   "Key:%s is invalid\n",
-                   p_key);
-        }
-        else
-        {
-          /* store our key and value */
-          st_insert(p_domain_imp->p_hash,
-                    (st_data_t)p_key, (st_data_t)p_accum_val);
-        }
-      }
-      else
-      {
-        /* accumulate into the value */
-        p_prev_val = p_accum_val;
-        p_accum_val =
-          (char *)malloc(strlen(p_prev_val) + strlen(sLine) + 1);
-        strcpy(p_accum_val, p_prev_val);
-        free(p_prev_val);
-        strcat(p_accum_val, sLine);
-      }
-    } /* in key */
-  } /* while lines or last line */
-
- EndParsing:
-  fclose(p_file);
-
- Exit:
-  cl_spinlock_release( &p_domain_imp->lock );
-  OSM_LOG_EXIT( p_log );
-  return status;
+	osm_log_t *p_log = p_domain->p_db->p_log;
+	osm_db_domain_imp_t *p_domain_imp =
+	    (osm_db_domain_imp_t *) p_domain->p_domain_imp;
+	FILE *p_file;
+	int status;
+	char sLine[OSM_DB_MAX_LINE_LEN];
+	boolean_t before_key;
+	char *p_first_word, *p_rest_of_line, *p_last;
+	char *p_key = NULL;
+	char *p_prev_val, *p_accum_val = NULL;
+	char *endptr = NULL;
+	unsigned int line_num;
+
+	OSM_LOG_ENTER(p_log, osm_db_restore);
+
+	/* take the lock on the domain */
+	cl_spinlock_acquire(&p_domain_imp->lock);
+
+	/* open the file - read mode */
+	p_file = fopen(p_domain_imp->file_name, "r");
+
+	if (!p_file) {
+		osm_log(p_log, OSM_LOG_ERROR,
+			"osm_db_restore: ERR 6103: "
+			" Failed to open the db file:%s\n",
+			p_domain_imp->file_name);
+		status = 1;
+		goto Exit;
+	}
+
+	/* parse the file allocating new hash tables as required */
+	/*
+	   states:
+	   before_key (0) -> in_key (1)
+
+	   before_key: if a word on the first byte - it is the key. state=in_key
+	   the rest of the line is start of the value.
+	   in_key: unless the line is empty - add it (with newlines) to the value.
+	   if empty: state=before_key
+	 */
+	status = 0;
+	before_key = TRUE;
+	line_num = 0;
+	/* if we got to EOF in the middle of a key we add a last newline */
+	while ((fgets(sLine, OSM_DB_MAX_LINE_LEN, p_file) != NULL) ||
+	       ((before_key == FALSE) && strcpy(sLine, "\n"))
+	    ) {
+		line_num++;
+		if (before_key) {
+			if ((sLine[0] != ' ') && (sLine[0] != '\t')
+			    && (sLine[0] != '\n')) {
+				/* we got a new key */
+				before_key = FALSE;
+
+				/* handle the key */
+				p_first_word =
+				    strtok_r(sLine, " \t\n", &p_last);
+				if (!p_first_word) {
+					osm_log(p_log, OSM_LOG_ERROR,
+						"osm_db_restore: ERR 6104: "
+						" Failed to get key from line:%u : %s (file:%s)\n",
+						line_num, sLine,
+						p_domain_imp->file_name);
+					status = 1;
+					goto EndParsing;
+				}
+				if (strlen(p_first_word) > OSM_DB_MAX_GUID_LEN) {
+					osm_log(p_log, OSM_LOG_ERROR,
+						"osm_db_restore: ERR 610A: "
+						" Illegal key from line:%u : %s (file:%s)\n",
+						line_num, sLine,
+						p_domain_imp->file_name);
+					status = 1;
+					goto EndParsing;
+				}
+
+				p_key =
+				    (char *)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));
+					strcpy(p_accum_val, p_rest_of_line);
+				} else {
+					p_accum_val = (char *)malloc(2);
+					strcpy(p_accum_val, "\0");
+				}
+			} else if (sLine[0] != '\n') {
+				osm_log(p_log, OSM_LOG_ERROR,
+					"osm_db_restore: ERR 6105: "
+					" How did we get here? line:%u : %s (file:%s)\n",
+					line_num, sLine,
+					p_domain_imp->file_name);
+				status = 1;
+				goto EndParsing;
+			}
+		} /* before key */
+		else {
+			/* we already have a key */
+
+			if (sLine[0] == '\n') {
+				/* got an end of key */
+				before_key = TRUE;
+
+				/* make sure the key was not previously used */
+				if (st_lookup(p_domain_imp->p_hash,
+					      (st_data_t) p_key,
+					      (st_data_t *) & p_prev_val)) {
+					osm_log(p_log, OSM_LOG_ERROR,
+						"osm_db_restore: ERR 6106: "
+						" Key:%s already exists in:%s with value:%s."
+						" Removing it\n",
+						p_key,
+						p_domain_imp->file_name,
+						p_prev_val);
+				} else {
+					p_prev_val = NULL;
+				}
+
+				osm_log(p_log, OSM_LOG_DEBUG,
+					"osm_db_restore: "
+					"Got key:%s value:%s\n", p_key,
+					p_accum_val);
+
+				/* check that the key is a number */
+				if (!strtouq(p_key, &endptr, 0)
+				    && *endptr != '\0') {
+					osm_log(p_log, OSM_LOG_ERROR,
+						"osm_db_restore: ERR 610B: "
+						"Key:%s is invalid\n", p_key);
+				} else {
+					/* store our key and value */
+					st_insert(p_domain_imp->p_hash,
+						  (st_data_t) p_key,
+						  (st_data_t) p_accum_val);
+				}
+			} else {
+				/* accumulate into the value */
+				p_prev_val = p_accum_val;
+				p_accum_val =
+				    (char *)malloc(strlen(p_prev_val) +
+						   strlen(sLine) + 1);
+				strcpy(p_accum_val, p_prev_val);
+				free(p_prev_val);
+				strcat(p_accum_val, sLine);
+			}
+		}		/* in key */
+	}			/* while lines or last line */
+
+      EndParsing:
+	fclose(p_file);
+
+      Exit:
+	cl_spinlock_release(&p_domain_imp->lock);
+	OSM_LOG_EXIT(p_log);
+	return status;
 }
 
 /***************************************************************************
  ***************************************************************************/
-int
-__osm_dump_tbl_entry(st_data_t key, st_data_t val, st_data_t arg)
+int __osm_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;
-  char *p_val = (char *)val;
+	FILE *p_file = (FILE *) arg;
+	char *p_key = (char *)key;
+	char *p_val = (char *)val;
 
-  fprintf(p_file, "%s %s\n\n", p_key, p_val);
-  return ST_CONTINUE;
+	fprintf(p_file, "%s %s\n\n", p_key, p_val);
+	return ST_CONTINUE;
 }
 
-int
-osm_db_store(
-  IN osm_db_domain_t *p_domain)
+int osm_db_store(IN osm_db_domain_t * p_domain)
 {
-  osm_log_t           *p_log = p_domain->p_db->p_log;
-  osm_db_domain_imp_t *p_domain_imp;
-  FILE                *p_file;
-  int                  status = 0;
-  char                *p_tmp_file_name;
-
-  OSM_LOG_ENTER( p_log, osm_db_store );
-
-  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));
-  strcpy(p_tmp_file_name, p_domain_imp->file_name);
-  strcat(p_tmp_file_name,".tmp");
-
-  cl_spinlock_acquire( &p_domain_imp->lock );
-
-  /* open up the output file */
-  p_file = fopen(p_tmp_file_name, "w");
-  if (! p_file)
-  {
-    osm_log( p_log, OSM_LOG_ERROR,
-             "osm_db_store: ERR 6107: "
-             " Failed to open the db file:%s for writing\n",
-             p_domain_imp->file_name);
-    status = 1;
-    goto Exit;
-  }
-
-  st_foreach(p_domain_imp->p_hash, __osm_dump_tbl_entry, (st_data_t)p_file);
-  fclose(p_file);
-
-  /* move the domain file */
-  status = remove(p_domain_imp->file_name);
-  if (status)
-  {
-    osm_log( p_log, OSM_LOG_ERROR,
-             "osm_db_store: ERR 6109: "
-             " Failed to remove file:%s (err:%u)\n",
-             p_domain_imp->file_name, status);
-  }
-
-  status = rename(p_tmp_file_name, p_domain_imp->file_name);
-  if (status)
-  {
-    osm_log( p_log, OSM_LOG_ERROR,
-             "osm_db_store: ERR 6108: "
-             " Failed to rename the db file to:%s (err:%u)\n",
-             p_domain_imp->file_name, status);
-  }
- Exit:
-  cl_spinlock_release( &p_domain_imp->lock );
-  free(p_tmp_file_name);
-  OSM_LOG_EXIT( p_log );
-  return status;
+	osm_log_t *p_log = p_domain->p_db->p_log;
+	osm_db_domain_imp_t *p_domain_imp;
+	FILE *p_file;
+	int status = 0;
+	char *p_tmp_file_name;
+
+	OSM_LOG_ENTER(p_log, osm_db_store);
+
+	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));
+	strcpy(p_tmp_file_name, p_domain_imp->file_name);
+	strcat(p_tmp_file_name, ".tmp");
+
+	cl_spinlock_acquire(&p_domain_imp->lock);
+
+	/* open up the output file */
+	p_file = fopen(p_tmp_file_name, "w");
+	if (!p_file) {
+		osm_log(p_log, OSM_LOG_ERROR,
+			"osm_db_store: ERR 6107: "
+			" Failed to open the db file:%s for writing\n",
+			p_domain_imp->file_name);
+		status = 1;
+		goto Exit;
+	}
+
+	st_foreach(p_domain_imp->p_hash, __osm_dump_tbl_entry,
+		   (st_data_t) p_file);
+	fclose(p_file);
+
+	/* move the domain file */
+	status = remove(p_domain_imp->file_name);
+	if (status) {
+		osm_log(p_log, OSM_LOG_ERROR,
+			"osm_db_store: ERR 6109: "
+			" Failed to remove file:%s (err:%u)\n",
+			p_domain_imp->file_name, status);
+	}
+
+	status = rename(p_tmp_file_name, p_domain_imp->file_name);
+	if (status) {
+		osm_log(p_log, OSM_LOG_ERROR,
+			"osm_db_store: ERR 6108: "
+			" Failed to rename the db file to:%s (err:%u)\n",
+			p_domain_imp->file_name, status);
+	}
+      Exit:
+	cl_spinlock_release(&p_domain_imp->lock);
+	free(p_tmp_file_name);
+	OSM_LOG_EXIT(p_log);
+	return status;
 }
 
 /***************************************************************************
  ***************************************************************************/
 /* simply de-allocate the key and the value and return the code
    that makes the st_foreach delete the entry */
-int
-__osm_clear_tbl_entry(st_data_t key, st_data_t val, st_data_t arg)
+int __osm_clear_tbl_entry(st_data_t key, st_data_t val, st_data_t arg)
 {
-  free((char*)key);
-  free((char*)val);
-  return ST_DELETE;
+	free((char *)key);
+	free((char *)val);
+	return ST_DELETE;
 }
 
-int
-osm_db_clear(
-  IN osm_db_domain_t *p_domain)
+int osm_db_clear(IN osm_db_domain_t * p_domain)
 {
-  osm_db_domain_imp_t *p_domain_imp =
-    (osm_db_domain_imp_t *)p_domain->p_domain_imp;
+	osm_db_domain_imp_t *p_domain_imp =
+	    (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);
-  cl_spinlock_release( &p_domain_imp->lock );
+	cl_spinlock_acquire(&p_domain_imp->lock);
+	st_foreach(p_domain_imp->p_hash, __osm_clear_tbl_entry,
+		   (st_data_t) NULL);
+	cl_spinlock_release(&p_domain_imp->lock);
 
-  return 0;
+	return 0;
 }
 
 /***************************************************************************
  ***************************************************************************/
-int
-__osm_get_key_of_tbl_entry(st_data_t key, st_data_t val, st_data_t arg)
+int __osm_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);
-  return ST_CONTINUE;
+	cl_list_t *p_list = (cl_list_t *) arg;
+	cl_list_insert_tail(p_list, (void *)key);
+	return ST_CONTINUE;
 }
 
-int
-osm_db_keys(
-  IN osm_db_domain_t *p_domain,
-  OUT cl_list_t* p_key_list)
+int osm_db_keys(IN osm_db_domain_t * p_domain, OUT cl_list_t * p_key_list)
 {
-  osm_db_domain_imp_t *p_domain_imp =
-    (osm_db_domain_imp_t *)p_domain->p_domain_imp;
+	osm_db_domain_imp_t *p_domain_imp =
+	    (osm_db_domain_imp_t *) p_domain->p_domain_imp;
 
-  cl_spinlock_acquire( &p_domain_imp->lock );
+	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,
+		   __osm_get_key_of_tbl_entry, (st_data_t) p_key_list);
 
-  cl_spinlock_release( &p_domain_imp->lock );
+	cl_spinlock_release(&p_domain_imp->lock);
 
-  return 0;
+	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 *const p_key)
 {
-  osm_db_domain_imp_t *p_domain_imp =
-    (osm_db_domain_imp_t *)p_domain->p_domain_imp;
-  char *p_val = NULL;
+	osm_db_domain_imp_t *p_domain_imp =
+	    (osm_db_domain_imp_t *) p_domain->p_domain_imp;
+	char *p_val = NULL;
 
-  cl_spinlock_acquire( &p_domain_imp->lock );
+	cl_spinlock_acquire(&p_domain_imp->lock);
 
-  if (!st_lookup(p_domain_imp->p_hash, (st_data_t)p_key, (st_data_t*)&p_val))
-    p_val = NULL;
+	if (!st_lookup
+	    (p_domain_imp->p_hash, (st_data_t) p_key, (st_data_t *) & p_val))
+		p_val = NULL;
 
-  cl_spinlock_release( &p_domain_imp->lock );
+	cl_spinlock_release(&p_domain_imp->lock);
 
-  return p_val;
+	return p_val;
 }
 
 /***************************************************************************
  ***************************************************************************/
 int
-osm_db_update(
-  IN osm_db_domain_t *p_domain,
-  IN char *const p_key,
-  IN char *const p_val)
+osm_db_update(IN osm_db_domain_t * p_domain,
+	      IN char *const p_key, IN char *const p_val)
 {
-  osm_log_t           *p_log = p_domain->p_db->p_log;
-  osm_db_domain_imp_t *p_domain_imp =
-    (osm_db_domain_imp_t *)p_domain->p_domain_imp;
-  char *p_prev_val = NULL;
-  char *p_new_key;
-  char *p_new_val;
-
-  cl_spinlock_acquire( &p_domain_imp->lock );
-
-  if (st_lookup(p_domain_imp->p_hash,
-                (st_data_t)p_key, (st_data_t*)&p_prev_val))
-  {
-    osm_log( p_log, OSM_LOG_DEBUG,
-             "osm_db_update: "
-             " Key:%s previously exists in:%s with value:%s\n",
-             p_key,
-             p_domain_imp->file_name,
-             p_prev_val);
-    p_new_key = p_key;
-  }
-  else
-  {
-    /* need to allocate the key */
-    p_new_key = malloc(sizeof(char)*(strlen(p_key) + 1));
-    strcpy(p_new_key, p_key);
-  }
-
-  /* need to arange a new copy of the  value */
-  p_new_val = malloc(sizeof(char)*(strlen(p_val) + 1));
-  strcpy(p_new_val, p_val);
-
-  st_insert(p_domain_imp->p_hash, (st_data_t)p_new_key, (st_data_t)p_new_val);
-
-  if (p_prev_val)
-    free(p_prev_val);
-
-  cl_spinlock_release( &p_domain_imp->lock );
-
-  return 0;
+	osm_log_t *p_log = p_domain->p_db->p_log;
+	osm_db_domain_imp_t *p_domain_imp =
+	    (osm_db_domain_imp_t *) p_domain->p_domain_imp;
+	char *p_prev_val = NULL;
+	char *p_new_key;
+	char *p_new_val;
+
+	cl_spinlock_acquire(&p_domain_imp->lock);
+
+	if (st_lookup(p_domain_imp->p_hash,
+		      (st_data_t) p_key, (st_data_t *) & p_prev_val)) {
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"osm_db_update: "
+			" Key:%s previously exists in:%s with value:%s\n",
+			p_key, p_domain_imp->file_name, p_prev_val);
+		p_new_key = p_key;
+	} else {
+		/* need to allocate the key */
+		p_new_key = malloc(sizeof(char) * (strlen(p_key) + 1));
+		strcpy(p_new_key, p_key);
+	}
+
+	/* need to arange a new copy of the  value */
+	p_new_val = malloc(sizeof(char) * (strlen(p_val) + 1));
+	strcpy(p_new_val, p_val);
+
+	st_insert(p_domain_imp->p_hash, (st_data_t) p_new_key,
+		  (st_data_t) p_new_val);
+
+	if (p_prev_val)
+		free(p_prev_val);
+
+	cl_spinlock_release(&p_domain_imp->lock);
+
+	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 *const p_key)
 {
-  osm_log_t           *p_log = p_domain->p_db->p_log;
-  osm_db_domain_imp_t *p_domain_imp =
-    (osm_db_domain_imp_t *)p_domain->p_domain_imp;
-  char *p_prev_val = NULL;
-  int res;
-
-  OSM_LOG_ENTER( p_log, osm_db_delete );
-
-  cl_spinlock_acquire( &p_domain_imp->lock );
-  if (st_delete(p_domain_imp->p_hash,
-                (st_data_t*)&p_key, (st_data_t*)&p_prev_val))
-  {
-    if (st_lookup(p_domain_imp->p_hash,
-                  (st_data_t)p_key, (st_data_t*)&p_prev_val))
-    {
-      osm_log( p_log, OSM_LOG_ERROR,
-               "osm_db_delete: "
-               " 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;
-    }
-  }
-  else
-  {
-    osm_log( p_log, OSM_LOG_DEBUG,
-             "osm_db_update: "
-             " fail to find key:%s. delete failed\n",
-             p_key);
-    res = 1;
-  }
-  cl_spinlock_release( &p_domain_imp->lock );
-
-  OSM_LOG_EXIT( p_log );
-  return res;
+	osm_log_t *p_log = p_domain->p_db->p_log;
+	osm_db_domain_imp_t *p_domain_imp =
+	    (osm_db_domain_imp_t *) p_domain->p_domain_imp;
+	char *p_prev_val = NULL;
+	int res;
+
+	OSM_LOG_ENTER(p_log, osm_db_delete);
+
+	cl_spinlock_acquire(&p_domain_imp->lock);
+	if (st_delete(p_domain_imp->p_hash,
+		      (st_data_t *) & p_key, (st_data_t *) & p_prev_val)) {
+		if (st_lookup(p_domain_imp->p_hash,
+			      (st_data_t) p_key, (st_data_t *) & p_prev_val)) {
+			osm_log(p_log, OSM_LOG_ERROR,
+				"osm_db_delete: "
+				" 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;
+		}
+	} else {
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"osm_db_update: "
+			" fail to find key:%s. delete failed\n", p_key);
+		res = 1;
+	}
+	cl_spinlock_release(&p_domain_imp->lock);
+
+	OSM_LOG_EXIT(p_log);
+	return res;
 }
 
 #ifdef TEST_OSMDB
 #include <stdlib.h>
 #include <math.h>
 
-int
-main(int argc, char **argv)
+int main(int argc, char **argv)
 {
-  osm_db_t db;
-  osm_log_t log;
-  osm_db_domain_t *p_dbd;
-  cl_list_t keys;
-  cl_list_iterator_t kI;
-  char *p_key;
-  char *p_val;
-  int i;
-
-  cl_list_construct( &keys );
-  cl_list_init( &keys, 10 );
-
-  osm_log_init_v2( &log, TRUE, 0xff, "/var/log/osm_db_test.log", 0, FALSE);
-
-  osm_db_construct(&db);
-  if (osm_db_init(&db, &log))
-  {
-    printf("db init failed\n");
-    exit(1);
-  }
-
-  p_dbd = osm_db_domain_init(&db, "lid_by_guid");
-
-  if (osm_db_restore(p_dbd))
-  {
-    printf("failed to restore\n");
-  }
-
-  if (osm_db_keys(p_dbd, &keys))
-  {
-    printf("failed to get keys\n");
-  }
-  else
-  {
-    kI = cl_list_head( &keys );
-    while (kI != cl_list_end( & keys ))
-    {
-      p_key = cl_list_obj(kI);
-      kI = cl_list_next( kI );
-
-      p_val = osm_db_lookup(p_dbd, p_key);
-      printf("key = %s val = %s\n", p_key, p_val);
-    }
-  }
-
-  cl_list_remove_all(&keys);
-
-  /* randomly add and remove numbers */
-  for (i =  0; i < 10; i++)
-  {
-    int k;
-    float v;
-    int is_add;
-    char val_buf[16];
-    char key_buf[16];
-
-    k = floor(1.0 * rand()/ RAND_MAX * 100);
-    v = rand();
-    sprintf(key_buf, "%u", k);
-    sprintf(val_buf, "%u", v);
-
-    is_add = (rand() < RAND_MAX/ 2);
-
-    if (is_add)
-    {
-      osm_db_update(p_dbd, key_buf, val_buf);
-    }
-    else
-    {
-      osm_db_delete(p_dbd, key_buf);
-    }
-  }
-  if (osm_db_keys(p_dbd, &keys))
-  {
-    printf("failed to get keys\n");
-  }
-  else
-  {
-    kI = cl_list_head( &keys );
-    while (kI != cl_list_end( & keys ))
-    {
-      p_key = cl_list_obj(kI);
-      kI = cl_list_next( kI );
-
-      p_val = osm_db_lookup(p_dbd, p_key);
-      printf("key = %s val = %s\n", p_key, p_val);
-    }
-  }
-  if (osm_db_store(p_dbd))
-    printf("failed to store\n");
-
-  osm_db_destroy( &db );
-  cl_list_destroy( &keys );
+	osm_db_t db;
+	osm_log_t log;
+	osm_db_domain_t *p_dbd;
+	cl_list_t keys;
+	cl_list_iterator_t kI;
+	char *p_key;
+	char *p_val;
+	int i;
+
+	cl_list_construct(&keys);
+	cl_list_init(&keys, 10);
+
+	osm_log_init_v2(&log, TRUE, 0xff, "/var/log/osm_db_test.log", 0, FALSE);
+
+	osm_db_construct(&db);
+	if (osm_db_init(&db, &log)) {
+		printf("db init failed\n");
+		exit(1);
+	}
+
+	p_dbd = osm_db_domain_init(&db, "lid_by_guid");
+
+	if (osm_db_restore(p_dbd)) {
+		printf("failed to restore\n");
+	}
+
+	if (osm_db_keys(p_dbd, &keys)) {
+		printf("failed to get keys\n");
+	} else {
+		kI = cl_list_head(&keys);
+		while (kI != cl_list_end(&keys)) {
+			p_key = cl_list_obj(kI);
+			kI = cl_list_next(kI);
+
+			p_val = osm_db_lookup(p_dbd, p_key);
+			printf("key = %s val = %s\n", p_key, p_val);
+		}
+	}
+
+	cl_list_remove_all(&keys);
+
+	/* randomly add and remove numbers */
+	for (i = 0; i < 10; i++) {
+		int k;
+		float v;
+		int is_add;
+		char val_buf[16];
+		char key_buf[16];
+
+		k = floor(1.0 * rand() / RAND_MAX * 100);
+		v = rand();
+		sprintf(key_buf, "%u", k);
+		sprintf(val_buf, "%u", v);
+
+		is_add = (rand() < RAND_MAX / 2);
+
+		if (is_add) {
+			osm_db_update(p_dbd, key_buf, val_buf);
+		} else {
+			osm_db_delete(p_dbd, key_buf);
+		}
+	}
+	if (osm_db_keys(p_dbd, &keys)) {
+		printf("failed to get keys\n");
+	} else {
+		kI = cl_list_head(&keys);
+		while (kI != cl_list_end(&keys)) {
+			p_key = cl_list_obj(kI);
+			kI = cl_list_next(kI);
+
+			p_val = osm_db_lookup(p_dbd, p_key);
+			printf("key = %s val = %s\n", p_key, p_val);
+		}
+	}
+	if (osm_db_store(p_dbd))
+		printf("failed to store\n");
+
+	osm_db_destroy(&db);
+	cl_list_destroy(&keys);
 }
 #endif
diff --git a/opensm/opensm/osm_db_pack.c b/opensm/opensm/osm_db_pack.c
index 23e56a6..de5550f 100644
--- a/opensm/opensm/osm_db_pack.c
+++ b/opensm/opensm/osm_db_pack.c
@@ -33,140 +33,129 @@
  *
  */
 
-
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <complib/cl_debug.h>
 #include <opensm/osm_db_pack.h>
 
-static inline void
-__osm_pack_guid(uint64_t guid, char *p_guid_str)
+static inline void __osm_pack_guid(uint64_t guid, char *p_guid_str)
 {
-  sprintf(p_guid_str, "0x%016" PRIx64, guid);
+	sprintf(p_guid_str, "0x%016" PRIx64, guid);
 }
 
-static inline uint64_t
-__osm_unpack_guid(char *p_guid_str)
+static inline uint64_t __osm_unpack_guid(char *p_guid_str)
 {
 #if __WORDSIZE == 64
-  return (strtoul(p_guid_str, NULL, 0));
+	return (strtoul(p_guid_str, NULL, 0));
 #else
-  return (strtoull(p_guid_str, NULL, 0));
+	return (strtoull(p_guid_str, NULL, 0));
 #endif
 }
 
 static inline void
 __osm_pack_lids(uint16_t min_lid, uint16_t max_lid, char *p_lid_str)
 {
-  sprintf(p_lid_str, "0x%04x 0x%04x", min_lid, max_lid);
+	sprintf(p_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 )
+__osm_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;
-  char *p_num;
-  char lids_str[24];
-
-  strncpy(lids_str, p_lid_str, 23);
-  lids_str[23] = '\0';
-  p_num = strtok_r(lids_str, " \t", &p_next);
-  if (! p_num) return 1;
-  tmp = strtoul(p_num, NULL, 0);
-  CL_ASSERT( tmp < 0x10000 );
-  *p_min_lid = (uint16_t)tmp;
-
-  p_num = strtok_r(NULL, " \t", &p_next);
-  if (! p_num) return 1;
-  tmp = strtoul(p_num, NULL, 0);
-  CL_ASSERT( tmp < 0x10000 );
-  *p_max_lid = (uint16_t)tmp;
-
-  return 0;
+	unsigned long tmp;
+	char *p_next;
+	char *p_num;
+	char lids_str[24];
+
+	strncpy(lids_str, p_lid_str, 23);
+	lids_str[23] = '\0';
+	p_num = strtok_r(lids_str, " \t", &p_next);
+	if (!p_num)
+		return 1;
+	tmp = strtoul(p_num, NULL, 0);
+	CL_ASSERT(tmp < 0x10000);
+	*p_min_lid = (uint16_t) tmp;
+
+	p_num = strtok_r(NULL, " \t", &p_next);
+	if (!p_num)
+		return 1;
+	tmp = strtoul(p_num, NULL, 0);
+	CL_ASSERT(tmp < 0x10000);
+	*p_max_lid = (uint16_t) tmp;
+
+	return 0;
 }
 
 int
-osm_db_guid2lid_guids(
-  IN osm_db_domain_t* const p_g2l,
-  OUT cl_qlist_t* p_guid_list )
+osm_db_guid2lid_guids(IN osm_db_domain_t * const p_g2l,
+		      OUT cl_qlist_t * p_guid_list)
 {
-  char               *p_key;
-  cl_list_t           keys;
-  osm_db_guid_elem_t *p_guid_elem;
+	char *p_key;
+	cl_list_t keys;
+	osm_db_guid_elem_t *p_guid_elem;
 
-  cl_list_construct( &keys );
-  cl_list_init( &keys, 10 );
+	cl_list_construct(&keys);
+	cl_list_init(&keys, 10);
 
-  if (osm_db_keys(p_g2l, &keys))
-    return 1;
+	if (osm_db_keys(p_g2l, &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 );
+	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 = __osm_unpack_guid(p_key);
-    cl_qlist_insert_head(p_guid_list, &p_guid_elem->item);
-  }
+		p_guid_elem->guid = __osm_unpack_guid(p_key);
+		cl_qlist_insert_head(p_guid_list, &p_guid_elem->item);
+	}
 
-  cl_list_destroy( &keys );
-  return 0;
+	cl_list_destroy(&keys);
+	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)
+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)
 {
-  char guid_str[20];
-  char *p_lid_str;
-  uint16_t min_lid, max_lid;
-
-  __osm_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))
-    return 1;
-
-  if (p_min_lid) *p_min_lid = min_lid;
-  if (p_max_lid) *p_max_lid = max_lid;
-
-  return 0;
+	char guid_str[20];
+	char *p_lid_str;
+	uint16_t min_lid, max_lid;
+
+	__osm_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))
+		return 1;
+
+	if (p_min_lid)
+		*p_min_lid = min_lid;
+	if (p_max_lid)
+		*p_max_lid = max_lid;
+
+	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)
+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)
 {
-  char guid_str[20];
-  char lid_str[16];
+	char guid_str[20];
+	char lid_str[16];
 
-  __osm_pack_guid(guid, guid_str);
-  __osm_pack_lids(min_lid, max_lid, lid_str);
+	__osm_pack_guid(guid, guid_str);
+	__osm_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 * const p_g2l, IN uint64_t guid)
 {
-  char guid_str[20];
-  __osm_pack_guid(guid, guid_str);
-  return( osm_db_delete( p_g2l, guid_str) );
+	char guid_str[20];
+	__osm_pack_guid(guid, guid_str);
+	return (osm_db_delete(p_g2l, guid_str));
 }
-
diff --git a/opensm/opensm/osm_drop_mgr.c b/opensm/opensm/osm_drop_mgr.c
index cb9568f..7ace399 100644
--- a/opensm/opensm/osm_drop_mgr.c
+++ b/opensm/opensm/osm_drop_mgr.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <string.h>
@@ -68,563 +68,533 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_drop_mgr_construct(
-  IN osm_drop_mgr_t* const p_mgr )
+void osm_drop_mgr_construct(IN osm_drop_mgr_t * const p_mgr)
 {
-  CL_ASSERT( p_mgr );
-  memset( p_mgr, 0, sizeof(*p_mgr) );
+	CL_ASSERT(p_mgr);
+	memset(p_mgr, 0, sizeof(*p_mgr));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_drop_mgr_destroy(
-  IN osm_drop_mgr_t* const p_mgr )
+void osm_drop_mgr_destroy(IN osm_drop_mgr_t * const p_mgr)
 {
-  CL_ASSERT( p_mgr );
+	CL_ASSERT(p_mgr);
 
-  OSM_LOG_ENTER( p_mgr->p_log, osm_drop_mgr_destroy );
+	OSM_LOG_ENTER(p_mgr->p_log, osm_drop_mgr_destroy);
 
-  OSM_LOG_EXIT( p_mgr->p_log );
+	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_drop_mgr_init(
-  IN osm_drop_mgr_t* const p_mgr,
-  IN osm_subn_t* const p_subn,
-  IN osm_log_t* const p_log,
-  IN osm_req_t* const p_req,
-  IN cl_plock_t* const p_lock )
+osm_drop_mgr_init(IN osm_drop_mgr_t * const p_mgr,
+		  IN osm_subn_t * const p_subn,
+		  IN osm_log_t * const p_log,
+		  IN osm_req_t * const p_req, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_drop_mgr_init );
+	OSM_LOG_ENTER(p_log, osm_drop_mgr_init);
 
-  osm_drop_mgr_construct( p_mgr );
+	osm_drop_mgr_construct(p_mgr);
 
-  p_mgr->p_log = p_log;
-  p_mgr->p_subn = p_subn;
-  p_mgr->p_lock = p_lock;
-  p_mgr->p_req = p_req;
+	p_mgr->p_log = p_log;
+	p_mgr->p_subn = p_subn;
+	p_mgr->p_lock = p_lock;
+	p_mgr->p_req = p_req;
 
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return( status );
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_drop_mgr_remove_router(
-  IN const osm_drop_mgr_t* const p_mgr,
-  IN const ib_net64_t portguid )
+__osm_drop_mgr_remove_router(IN const osm_drop_mgr_t * const p_mgr,
+			     IN const ib_net64_t portguid)
 {
-  osm_router_t *p_rtr;
-  cl_qmap_t* p_rtr_guid_tbl;
-
-  p_rtr_guid_tbl = &p_mgr->p_subn->rtr_guid_tbl;
-  p_rtr = (osm_router_t*)cl_qmap_remove( p_rtr_guid_tbl, portguid );
-  if( p_rtr != (osm_router_t*)cl_qmap_end( p_rtr_guid_tbl ) )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-             "__osm_drop_mgr_remove_router: "
-             "Cleaned router for port guid 0x%016" PRIx64 "\n",
-             cl_ntoh64( portguid ) );
-    osm_router_delete( &p_rtr );
-  }
+	osm_router_t *p_rtr;
+	cl_qmap_t *p_rtr_guid_tbl;
+
+	p_rtr_guid_tbl = &p_mgr->p_subn->rtr_guid_tbl;
+	p_rtr = (osm_router_t *) cl_qmap_remove(p_rtr_guid_tbl, portguid);
+	if (p_rtr != (osm_router_t *) cl_qmap_end(p_rtr_guid_tbl)) {
+		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+			"__osm_drop_mgr_remove_router: "
+			"Cleaned router for port guid 0x%016" PRIx64 "\n",
+			cl_ntoh64(portguid));
+		osm_router_delete(&p_rtr);
+	}
 }
 
-
 /**********************************************************************
  **********************************************************************/
 static void
-drop_mgr_clean_physp(
-  IN const osm_drop_mgr_t* const p_mgr,
-  IN osm_physp_t *p_physp)
+drop_mgr_clean_physp(IN const osm_drop_mgr_t * const p_mgr,
+		     IN osm_physp_t * p_physp)
 {
-  osm_physp_t *p_remote_physp;
-  osm_port_t* p_remote_port;
-
-  p_remote_physp = osm_physp_get_remote( p_physp );
-  if( p_remote_physp && osm_physp_is_valid( p_remote_physp ) )
-  {
-    p_remote_port = osm_get_port_by_guid( p_mgr->p_subn,
-                                          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. */
-      if (p_remote_port->discovery_count &&
-          osm_physp_get_port_state( p_remote_physp ) == IB_LINK_ACTIVE )
-      {
-        osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-                 "drop_mgr_clean_physp: "
-                 "Forcing delayed heavy sweep. Remote "
-                 "port 0x%016" PRIx64 " port num: 0x%X "
-                 "was recognized in ACTIVE state\n",
-                 cl_ntoh64( p_remote_physp->port_guid ),
-                 p_remote_physp->port_num );
-        p_mgr->p_subn->force_delayed_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 ( !p_remote_physp->p_node->sw )
-      {
-        p_remote_port->discovery_count = 0;
-        osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-                 "drop_mgr_clean_physp: Resetting discovery count of node: "
-                 "0x%016" PRIx64 " port num:0x%X\n",
-                 cl_ntoh64( osm_node_get_node_guid( p_remote_physp->p_node ) ),
-                 p_remote_physp->port_num );
-      }
-    }
-
-    osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-             "drop_mgr_clean_physp: "
-             "Unlinking local node 0x%016" PRIx64 ", port 0x%X"
-             "\n\t\t\t\tand remote node 0x%016" PRIx64 ", port 0x%X\n",
-             cl_ntoh64( osm_node_get_node_guid( p_physp->p_node ) ),
-             p_physp->port_num,
-             cl_ntoh64( osm_node_get_node_guid( p_remote_physp->p_node ) ),
-             p_remote_physp->port_num );
-
-    osm_physp_unlink( p_physp, p_remote_physp );
-
-  }
-
-  osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-           "drop_mgr_clean_physp: Clearing node 0x%016" PRIx64 " physical port number 0x%X\n",
-           cl_ntoh64( osm_node_get_node_guid( p_physp->p_node ) ),
-           p_physp->port_num );
-
-  osm_physp_destroy( p_physp );
+	osm_physp_t *p_remote_physp;
+	osm_port_t *p_remote_port;
+
+	p_remote_physp = osm_physp_get_remote(p_physp);
+	if (p_remote_physp && osm_physp_is_valid(p_remote_physp)) {
+		p_remote_port = osm_get_port_by_guid(p_mgr->p_subn,
+						     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. */
+			if (p_remote_port->discovery_count &&
+			    osm_physp_get_port_state(p_remote_physp) ==
+			    IB_LINK_ACTIVE) {
+				osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+					"drop_mgr_clean_physp: "
+					"Forcing delayed heavy sweep. Remote "
+					"port 0x%016" PRIx64 " port num: 0x%X "
+					"was recognized in ACTIVE state\n",
+					cl_ntoh64(p_remote_physp->port_guid),
+					p_remote_physp->port_num);
+				p_mgr->p_subn->force_delayed_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 (!p_remote_physp->p_node->sw) {
+				p_remote_port->discovery_count = 0;
+				osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+					"drop_mgr_clean_physp: Resetting discovery count of node: "
+					"0x%016" PRIx64 " port num:0x%X\n",
+					cl_ntoh64(osm_node_get_node_guid
+						  (p_remote_physp->p_node)),
+					p_remote_physp->port_num);
+			}
+		}
+
+		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+			"drop_mgr_clean_physp: "
+			"Unlinking local node 0x%016" PRIx64 ", port 0x%X"
+			"\n\t\t\t\tand remote node 0x%016" PRIx64
+			", port 0x%X\n",
+			cl_ntoh64(osm_node_get_node_guid(p_physp->p_node)),
+			p_physp->port_num,
+			cl_ntoh64(osm_node_get_node_guid
+				  (p_remote_physp->p_node)),
+			p_remote_physp->port_num);
+
+		osm_physp_unlink(p_physp, p_remote_physp);
+
+	}
+
+	osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+		"drop_mgr_clean_physp: Clearing node 0x%016" PRIx64
+		" physical port number 0x%X\n",
+		cl_ntoh64(osm_node_get_node_guid(p_physp->p_node)),
+		p_physp->port_num);
+
+	osm_physp_destroy(p_physp);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_drop_mgr_remove_port(
-  IN const osm_drop_mgr_t* const p_mgr,
-  IN osm_port_t* p_port )
+__osm_drop_mgr_remove_port(IN const osm_drop_mgr_t * const p_mgr,
+			   IN osm_port_t * p_port)
 {
-  ib_net64_t port_guid;
-  osm_port_t *p_port_check;
-  cl_qmap_t* p_sm_guid_tbl;
-  osm_mcm_info_t* p_mcm;
-  osm_mgrp_t*  p_mgrp;
-  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;
-  ib_gid_t port_gid;
-  ib_mad_notice_attr_t notice;
-  ib_api_status_t status;
-
-  OSM_LOG_ENTER( p_mgr->p_log, __osm_drop_mgr_remove_port );
-
-  port_guid = osm_port_get_guid( p_port );
-  osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-           "__osm_drop_mgr_remove_port: "
-           "Unreachable port 0x%016" PRIx64 "\n",
-           cl_ntoh64( port_guid ) );
-
-  p_port_check = (osm_port_t*)cl_qmap_remove( &p_mgr->p_subn->port_guid_tbl,
-                                              port_guid );
-  if( p_port_check != p_port )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "__osm_drop_mgr_remove_port: ERR 0101: "
-             "Port 0x%016" PRIx64 " not in guid table\n",
-             cl_ntoh64( port_guid ) );
-    goto Exit;
-  }
-
-  p_sm_guid_tbl = &p_mgr->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 ) )
-  {
-    /* need to remove this item */
-    osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-             "__osm_drop_mgr_remove_port: "
-             "Cleaned SM for port guid\n" );
-
-    free(p_sm);
-  }
-
-  __osm_drop_mgr_remove_router( p_mgr, port_guid );
-
-  osm_port_get_lid_range_ho( p_port, &min_lid_ho, &max_lid_ho );
-
-  osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-           "__osm_drop_mgr_remove_port: "
-           "Clearing abandoned LID range [0x%X,0x%X]\n",
-           min_lid_ho, max_lid_ho );
-
-  p_port_lid_tbl = &p_mgr->p_subn->port_lid_tbl;
-  for( lid_ho = min_lid_ho; lid_ho <= max_lid_ho; lid_ho++ )
-    cl_ptr_vector_set( p_port_lid_tbl, lid_ho, NULL );
-
-  drop_mgr_clean_physp(p_mgr, 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_mgrp_t *)cl_qmap_get( &p_mgr->p_subn->mgrp_mlid_tbl,
-                                        p_mcm->mlid );
-    if(p_mgrp != (osm_mgrp_t *)cl_qmap_end( &p_mgr->p_subn->mgrp_mlid_tbl ) )
-    {
-      osm_mgrp_remove_port(p_mgr->p_subn, p_mgr->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 = p_mgr->p_subn->sm_base_lid;
-  /* following C14-72.1.2 and table 119 p725 */
-  /* we need to provide the GID */
-  port_gid.unicast.prefix = p_mgr->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 = p_mgr->p_subn->opt.subnet_prefix;
-  notice.issuer_gid.unicast.interface_id = p_mgr->p_subn->sm_port_guid;
-
-  status = osm_report_notice(p_mgr->p_log, p_mgr->p_subn, &notice);
-  if( status != IB_SUCCESS )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "__osm_drop_mgr_remove_port: ERR 0103: "
-             "Error sending trap reports (%s)\n",
-             ib_get_err_str( status ) );
-    goto Exit;
-  }
-
-  if (osm_log_is_active( p_mgr->p_log, OSM_LOG_INFO ))
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_INFO,
-             "__osm_drop_mgr_remove_port: "
-             "Removed port with GUID:0x%016" PRIx64
-             " LID range [0x%X,0x%X] of node:%s\n",
-             cl_ntoh64( port_gid.unicast.interface_id ),
-             min_lid_ho, max_lid_ho, p_node ? p_node->print_desc : "UNKNOWN" );
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_mgr->p_log );
+	ib_net64_t port_guid;
+	osm_port_t *p_port_check;
+	cl_qmap_t *p_sm_guid_tbl;
+	osm_mcm_info_t *p_mcm;
+	osm_mgrp_t *p_mgrp;
+	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;
+	ib_gid_t port_gid;
+	ib_mad_notice_attr_t notice;
+	ib_api_status_t status;
+
+	OSM_LOG_ENTER(p_mgr->p_log, __osm_drop_mgr_remove_port);
+
+	port_guid = osm_port_get_guid(p_port);
+	osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+		"__osm_drop_mgr_remove_port: "
+		"Unreachable port 0x%016" PRIx64 "\n", cl_ntoh64(port_guid));
+
+	p_port_check =
+	    (osm_port_t *) cl_qmap_remove(&p_mgr->p_subn->port_guid_tbl,
+					  port_guid);
+	if (p_port_check != p_port) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_drop_mgr_remove_port: ERR 0101: "
+			"Port 0x%016" PRIx64 " not in guid table\n",
+			cl_ntoh64(port_guid));
+		goto Exit;
+	}
+
+	p_sm_guid_tbl = &p_mgr->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)) {
+		/* need to remove this item */
+		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+			"__osm_drop_mgr_remove_port: "
+			"Cleaned SM for port guid\n");
+
+		free(p_sm);
+	}
+
+	__osm_drop_mgr_remove_router(p_mgr, port_guid);
+
+	osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);
+
+	osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+		"__osm_drop_mgr_remove_port: "
+		"Clearing abandoned LID range [0x%X,0x%X]\n",
+		min_lid_ho, max_lid_ho);
+
+	p_port_lid_tbl = &p_mgr->p_subn->port_lid_tbl;
+	for (lid_ho = min_lid_ho; lid_ho <= max_lid_ho; lid_ho++)
+		cl_ptr_vector_set(p_port_lid_tbl, lid_ho, NULL);
+
+	drop_mgr_clean_physp(p_mgr, 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_mgrp_t *) cl_qmap_get(&p_mgr->p_subn->mgrp_mlid_tbl,
+					       p_mcm->mlid);
+		if (p_mgrp !=
+		    (osm_mgrp_t *) cl_qmap_end(&p_mgr->p_subn->mgrp_mlid_tbl)) {
+			osm_mgrp_remove_port(p_mgr->p_subn, p_mgr->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 = p_mgr->p_subn->sm_base_lid;
+	/* following C14-72.1.2 and table 119 p725 */
+	/* we need to provide the GID */
+	port_gid.unicast.prefix = p_mgr->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 = p_mgr->p_subn->opt.subnet_prefix;
+	notice.issuer_gid.unicast.interface_id = p_mgr->p_subn->sm_port_guid;
+
+	status = osm_report_notice(p_mgr->p_log, p_mgr->p_subn, &notice);
+	if (status != IB_SUCCESS) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_drop_mgr_remove_port: ERR 0103: "
+			"Error sending trap reports (%s)\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_INFO)) {
+		osm_log(p_mgr->p_log, OSM_LOG_INFO,
+			"__osm_drop_mgr_remove_port: "
+			"Removed port with GUID:0x%016" PRIx64
+			" LID range [0x%X,0x%X] of node:%s\n",
+			cl_ntoh64(port_gid.unicast.interface_id),
+			min_lid_ho, max_lid_ho,
+			p_node ? p_node->print_desc : "UNKNOWN");
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_drop_mgr_remove_switch(
-  IN const osm_drop_mgr_t* const p_mgr,
-  IN osm_node_t* p_node )
+__osm_drop_mgr_remove_switch(IN const osm_drop_mgr_t * const p_mgr,
+			     IN osm_node_t * p_node)
 {
-  osm_switch_t *p_sw;
-  cl_qmap_t* p_sw_guid_tbl;
-  ib_net64_t node_guid;
-
-  OSM_LOG_ENTER( p_mgr->p_log, __osm_drop_mgr_remove_switch );
-
-  node_guid = osm_node_get_node_guid( p_node );
-  p_sw_guid_tbl = &p_mgr->p_subn->sw_guid_tbl;
-
-  p_sw = (osm_switch_t*)cl_qmap_remove( p_sw_guid_tbl, node_guid );
-  if( p_sw == (osm_switch_t*)cl_qmap_end( p_sw_guid_tbl ) )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "__osm_drop_mgr_remove_switch: ERR 0102: "
-             "Node 0x%016" PRIx64 " not in switch table\n",
-             cl_ntoh64( osm_node_get_node_guid( p_node ) ) );
-  }
-  else
-  {
-    p_node->sw = NULL;
-    osm_switch_delete( &p_sw );
-  }
-
-  OSM_LOG_EXIT( p_mgr->p_log );
+	osm_switch_t *p_sw;
+	cl_qmap_t *p_sw_guid_tbl;
+	ib_net64_t node_guid;
+
+	OSM_LOG_ENTER(p_mgr->p_log, __osm_drop_mgr_remove_switch);
+
+	node_guid = osm_node_get_node_guid(p_node);
+	p_sw_guid_tbl = &p_mgr->p_subn->sw_guid_tbl;
+
+	p_sw = (osm_switch_t *) cl_qmap_remove(p_sw_guid_tbl, node_guid);
+	if (p_sw == (osm_switch_t *) cl_qmap_end(p_sw_guid_tbl)) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_drop_mgr_remove_switch: ERR 0102: "
+			"Node 0x%016" PRIx64 " not in switch table\n",
+			cl_ntoh64(osm_node_get_node_guid(p_node)));
+	} else {
+		p_node->sw = NULL;
+		osm_switch_delete(&p_sw);
+	}
+
+	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static boolean_t
-__osm_drop_mgr_process_node(
-  IN const osm_drop_mgr_t* const p_mgr,
-  IN osm_node_t* p_node )
+__osm_drop_mgr_process_node(IN const osm_drop_mgr_t * const p_mgr,
+			    IN osm_node_t * p_node)
 {
-  osm_physp_t *p_physp;
-  osm_port_t *p_port;
-  osm_node_t *p_node_check;
-  uint32_t port_num;
-  uint32_t max_ports;
-  ib_net64_t port_guid;
-  boolean_t return_val = FALSE;
-
-  OSM_LOG_ENTER( p_mgr->p_log, __osm_drop_mgr_process_node );
-
-  osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-           "__osm_drop_mgr_process_node: "
-           "Unreachable node 0x%016" PRIx64 "\n",
-           cl_ntoh64( osm_node_get_node_guid( p_node ) ) );
-
-  /*
-    Delete all the logical and physical port objects
-    associated with this node.
-  */
-  max_ports = osm_node_get_num_physp( p_node );
-  for( port_num = 0; port_num < max_ports; port_num++ )
-  {
-    p_physp = osm_node_get_physp_ptr( p_node, port_num );
-    if( osm_physp_is_valid( p_physp ) )
-    {
-      port_guid = osm_physp_get_port_guid( p_physp );
-
-      p_port = osm_get_port_by_guid( p_mgr->p_subn, port_guid );
-
-      if( p_port )
-        __osm_drop_mgr_remove_port( p_mgr, p_port );
-      else
-        drop_mgr_clean_physp( p_mgr, p_physp );
-    }
-  }
-
-  return_val = TRUE;
-
-  if (p_node->sw)
-    __osm_drop_mgr_remove_switch( p_mgr, p_node );
-
-  p_node_check = (osm_node_t*)cl_qmap_remove( &p_mgr->p_subn->node_guid_tbl,
-                                              osm_node_get_node_guid( p_node ) );
-  if( p_node_check != p_node )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "__osm_drop_mgr_process_node: ERR 0105: "
-             "Node 0x%016" PRIx64 " not in guid table\n",
-             cl_ntoh64( osm_node_get_node_guid( p_node ) ) );
-  }
-
-  /* free memory allocated to node */
-  osm_node_delete( &p_node );
-
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return( return_val );
+	osm_physp_t *p_physp;
+	osm_port_t *p_port;
+	osm_node_t *p_node_check;
+	uint32_t port_num;
+	uint32_t max_ports;
+	ib_net64_t port_guid;
+	boolean_t return_val = FALSE;
+
+	OSM_LOG_ENTER(p_mgr->p_log, __osm_drop_mgr_process_node);
+
+	osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+		"__osm_drop_mgr_process_node: "
+		"Unreachable node 0x%016" PRIx64 "\n",
+		cl_ntoh64(osm_node_get_node_guid(p_node)));
+
+	/*
+	   Delete all the logical and physical port objects
+	   associated with this node.
+	 */
+	max_ports = osm_node_get_num_physp(p_node);
+	for (port_num = 0; port_num < max_ports; port_num++) {
+		p_physp = osm_node_get_physp_ptr(p_node, port_num);
+		if (osm_physp_is_valid(p_physp)) {
+			port_guid = osm_physp_get_port_guid(p_physp);
+
+			p_port = osm_get_port_by_guid(p_mgr->p_subn, port_guid);
+
+			if (p_port)
+				__osm_drop_mgr_remove_port(p_mgr, p_port);
+			else
+				drop_mgr_clean_physp(p_mgr, p_physp);
+		}
+	}
+
+	return_val = TRUE;
+
+	if (p_node->sw)
+		__osm_drop_mgr_remove_switch(p_mgr, p_node);
+
+	p_node_check =
+	    (osm_node_t *) cl_qmap_remove(&p_mgr->p_subn->node_guid_tbl,
+					  osm_node_get_node_guid(p_node));
+	if (p_node_check != p_node) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_drop_mgr_process_node: ERR 0105: "
+			"Node 0x%016" PRIx64 " not in guid table\n",
+			cl_ntoh64(osm_node_get_node_guid(p_node)));
+	}
+
+	/* free memory allocated to node */
+	osm_node_delete(&p_node);
+
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return (return_val);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_drop_mgr_check_node(
-  IN const osm_drop_mgr_t* const p_mgr,
-  IN osm_node_t* p_node )
+__osm_drop_mgr_check_node(IN const osm_drop_mgr_t * const p_mgr,
+			  IN osm_node_t * p_node)
 {
-  ib_net64_t node_guid;
-  osm_physp_t *p_physp;
-  osm_port_t *p_port;
-  ib_net64_t port_guid;
-
-  OSM_LOG_ENTER( p_mgr->p_log, __osm_drop_mgr_check_node );
-
-  node_guid = osm_node_get_node_guid( p_node );
-
-  if ( osm_node_get_type( p_node ) != IB_NODE_TYPE_SWITCH )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "__osm_drop_mgr_check_node: ERR 0107: "
-             "Node 0x%016" PRIx64 " is not a switch node\n",
-             cl_ntoh64( node_guid ) );
-    goto Exit;
-  }
-
-  /* Make sure we have a switch object for this node */
-  if (!p_node->sw)
-  {
-    /* We do not have switch info for this node */
-    osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-             "__osm_drop_mgr_check_node: "
-             "Node 0x%016" PRIx64 " no switch in table\n",
-             cl_ntoh64( node_guid ) );
-
-    __osm_drop_mgr_process_node( p_mgr, p_node );
-    goto Exit;
-  }
-
-  /* Make sure we have a port object for port zero */
-  p_physp = osm_node_get_physp_ptr( p_node, 0 );
-  if ( !osm_physp_is_valid( p_physp ) )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-             "__osm_drop_mgr_check_node: "
-             "Node 0x%016" PRIx64 " no valid physical port 0\n",
-             cl_ntoh64( node_guid ) );
-
-    __osm_drop_mgr_process_node( p_mgr, p_node );
-    goto Exit;
-  }
-
-  port_guid = osm_physp_get_port_guid( p_physp );
-
-  p_port = osm_get_port_by_guid( p_mgr->p_subn, port_guid );
-
-  if( !p_port )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-             "__osm_drop_mgr_check_node: "
-             "Node 0x%016" PRIx64 " has no port object\n",
-             cl_ntoh64( node_guid ) );
-
-    __osm_drop_mgr_process_node( p_mgr, p_node );
-    goto Exit;
-  }
-
-  if ( p_port->discovery_count == 0 )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-             "__osm_drop_mgr_check_node: "
-             "Node 0x%016" PRIx64 " port has discovery count zero\n",
-             cl_ntoh64( node_guid ) );
-
-    __osm_drop_mgr_process_node( p_mgr, p_node );
-    goto Exit;
-  }
-
-  Exit:
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return;
+	ib_net64_t node_guid;
+	osm_physp_t *p_physp;
+	osm_port_t *p_port;
+	ib_net64_t port_guid;
+
+	OSM_LOG_ENTER(p_mgr->p_log, __osm_drop_mgr_check_node);
+
+	node_guid = osm_node_get_node_guid(p_node);
+
+	if (osm_node_get_type(p_node) != IB_NODE_TYPE_SWITCH) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_drop_mgr_check_node: ERR 0107: "
+			"Node 0x%016" PRIx64 " is not a switch node\n",
+			cl_ntoh64(node_guid));
+		goto Exit;
+	}
+
+	/* Make sure we have a switch object for this node */
+	if (!p_node->sw) {
+		/* We do not have switch info for this node */
+		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+			"__osm_drop_mgr_check_node: "
+			"Node 0x%016" PRIx64 " no switch in table\n",
+			cl_ntoh64(node_guid));
+
+		__osm_drop_mgr_process_node(p_mgr, p_node);
+		goto Exit;
+	}
+
+	/* Make sure we have a port object for port zero */
+	p_physp = osm_node_get_physp_ptr(p_node, 0);
+	if (!osm_physp_is_valid(p_physp)) {
+		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+			"__osm_drop_mgr_check_node: "
+			"Node 0x%016" PRIx64 " no valid physical port 0\n",
+			cl_ntoh64(node_guid));
+
+		__osm_drop_mgr_process_node(p_mgr, p_node);
+		goto Exit;
+	}
+
+	port_guid = osm_physp_get_port_guid(p_physp);
+
+	p_port = osm_get_port_by_guid(p_mgr->p_subn, port_guid);
+
+	if (!p_port) {
+		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+			"__osm_drop_mgr_check_node: "
+			"Node 0x%016" PRIx64 " has no port object\n",
+			cl_ntoh64(node_guid));
+
+		__osm_drop_mgr_process_node(p_mgr, p_node);
+		goto Exit;
+	}
+
+	if (p_port->discovery_count == 0) {
+		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+			"__osm_drop_mgr_check_node: "
+			"Node 0x%016" PRIx64 " port has discovery count zero\n",
+			cl_ntoh64(node_guid));
+
+		__osm_drop_mgr_process_node(p_mgr, p_node);
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return;
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_drop_mgr_process(
-  IN const osm_drop_mgr_t* const p_mgr )
+void osm_drop_mgr_process(IN const osm_drop_mgr_t * const p_mgr)
 {
-  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;
-  ib_net64_t   port_guid;
-  ib_net64_t   node_guid;
-
-  CL_ASSERT( p_mgr );
-
-  OSM_LOG_ENTER( p_mgr->p_log, osm_drop_mgr_process );
-
-  p_node_guid_tbl = &p_mgr->p_subn->node_guid_tbl;
-  p_port_guid_tbl = &p_mgr->p_subn->port_guid_tbl;
-
-  CL_PLOCK_EXCL_ACQUIRE( p_mgr->p_lock );
-
-  p_next_node = (osm_node_t*)cl_qmap_head( p_node_guid_tbl );
-  while( p_next_node != (osm_node_t*)cl_qmap_end( p_node_guid_tbl ) )
-  {
-    p_node = p_next_node;
-    p_next_node = (osm_node_t*)cl_qmap_next( &p_next_node->map_item );
-
-    CL_ASSERT( cl_qmap_key( &p_node->map_item ) ==
-               osm_node_get_node_guid( p_node ) );
-
-    if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-    {
-      node_guid = osm_node_get_node_guid( p_node );
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-               "osm_drop_mgr_process: "
-               "Checking node 0x%016" PRIx64 "\n",
-               cl_ntoh64( node_guid ) );
-    }
-
-    /*
-      Check if this node was discovered during the last sweep.
-      If not, it is unreachable in the current subnet, and
-      should therefore be removed from the subnet object.
-    */
-    if( p_node->discovery_count == 0 )
-      __osm_drop_mgr_process_node( p_mgr, p_node );
-  }
-
-  /*
-    Go over all the nodes. If the node is a switch - make sure
-    there is also a switch record for it, and a portInfo record for
-    port zero of of the node.
-    If not - this means that there was some error in getting the data
-    of this node. Drop the node.
-  */
-  p_next_node = (osm_node_t*)cl_qmap_head( p_node_guid_tbl );
-  while( p_next_node != (osm_node_t*)cl_qmap_end( p_node_guid_tbl ) )
-  {
-    p_node = p_next_node;
-    p_next_node = (osm_node_t*)cl_qmap_next( &p_next_node->map_item );
-
-    if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-    {
-      node_guid = osm_node_get_node_guid( p_node );
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-               "osm_drop_mgr_process: "
-               "Checking full discovery of node 0x%016" PRIx64 "\n",
-               cl_ntoh64( node_guid ) );
-    }
-
-    if ( osm_node_get_type( p_node ) != IB_NODE_TYPE_SWITCH )
-      continue;
-
-    /* We are handling a switch node */
-    __osm_drop_mgr_check_node( p_mgr, p_node );
-  }
-
-  p_next_port = (osm_port_t*)cl_qmap_head( p_port_guid_tbl );
-  while( p_next_port != (osm_port_t*)cl_qmap_end( p_port_guid_tbl ) )
-  {
-    p_port = p_next_port;
-    p_next_port = (osm_port_t*)cl_qmap_next( &p_next_port->map_item );
-
-    CL_ASSERT( cl_qmap_key( &p_port->map_item ) ==
-               osm_port_get_guid( p_port ) );
-
-    if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-    {
-      port_guid = osm_port_get_guid( p_port );
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-               "osm_drop_mgr_process: "
-               "Checking port 0x%016" PRIx64 "\n",
-               cl_ntoh64( port_guid ) );
-    }
-
-    /*
-      If the port is unreachable, remove it from the guid table.
-    */
-    if( p_port->discovery_count == 0 )
-      __osm_drop_mgr_remove_port( p_mgr, p_port );
-  }
-
-  CL_PLOCK_RELEASE( p_mgr->p_lock );
-  OSM_LOG_EXIT( p_mgr->p_log );
+	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;
+	ib_net64_t port_guid;
+	ib_net64_t node_guid;
+
+	CL_ASSERT(p_mgr);
+
+	OSM_LOG_ENTER(p_mgr->p_log, osm_drop_mgr_process);
+
+	p_node_guid_tbl = &p_mgr->p_subn->node_guid_tbl;
+	p_port_guid_tbl = &p_mgr->p_subn->port_guid_tbl;
+
+	CL_PLOCK_EXCL_ACQUIRE(p_mgr->p_lock);
+
+	p_next_node = (osm_node_t *) cl_qmap_head(p_node_guid_tbl);
+	while (p_next_node != (osm_node_t *) cl_qmap_end(p_node_guid_tbl)) {
+		p_node = p_next_node;
+		p_next_node =
+		    (osm_node_t *) cl_qmap_next(&p_next_node->map_item);
+
+		CL_ASSERT(cl_qmap_key(&p_node->map_item) ==
+			  osm_node_get_node_guid(p_node));
+
+		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+			node_guid = osm_node_get_node_guid(p_node);
+			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				"osm_drop_mgr_process: "
+				"Checking node 0x%016" PRIx64 "\n",
+				cl_ntoh64(node_guid));
+		}
+
+		/*
+		   Check if this node was discovered during the last sweep.
+		   If not, it is unreachable in the current subnet, and
+		   should therefore be removed from the subnet object.
+		 */
+		if (p_node->discovery_count == 0)
+			__osm_drop_mgr_process_node(p_mgr, p_node);
+	}
+
+	/*
+	   Go over all the nodes. If the node is a switch - make sure
+	   there is also a switch record for it, and a portInfo record for
+	   port zero of of the node.
+	   If not - this means that there was some error in getting the data
+	   of this node. Drop the node.
+	 */
+	p_next_node = (osm_node_t *) cl_qmap_head(p_node_guid_tbl);
+	while (p_next_node != (osm_node_t *) cl_qmap_end(p_node_guid_tbl)) {
+		p_node = p_next_node;
+		p_next_node =
+		    (osm_node_t *) cl_qmap_next(&p_next_node->map_item);
+
+		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+			node_guid = osm_node_get_node_guid(p_node);
+			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				"osm_drop_mgr_process: "
+				"Checking full discovery of node 0x%016" PRIx64
+				"\n", cl_ntoh64(node_guid));
+		}
+
+		if (osm_node_get_type(p_node) != IB_NODE_TYPE_SWITCH)
+			continue;
+
+		/* We are handling a switch node */
+		__osm_drop_mgr_check_node(p_mgr, p_node);
+	}
+
+	p_next_port = (osm_port_t *) cl_qmap_head(p_port_guid_tbl);
+	while (p_next_port != (osm_port_t *) cl_qmap_end(p_port_guid_tbl)) {
+		p_port = p_next_port;
+		p_next_port =
+		    (osm_port_t *) cl_qmap_next(&p_next_port->map_item);
+
+		CL_ASSERT(cl_qmap_key(&p_port->map_item) ==
+			  osm_port_get_guid(p_port));
+
+		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+			port_guid = osm_port_get_guid(p_port);
+			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				"osm_drop_mgr_process: "
+				"Checking port 0x%016" PRIx64 "\n",
+				cl_ntoh64(port_guid));
+		}
+
+		/*
+		   If the port is unreachable, remove it from the guid table.
+		 */
+		if (p_port->discovery_count == 0)
+			__osm_drop_mgr_remove_port(p_mgr, p_port);
+	}
+
+	CL_PLOCK_RELEASE(p_mgr->p_lock);
+	OSM_LOG_EXIT(p_mgr->p_log);
 }
diff --git a/opensm/opensm/osm_dump.c b/opensm/opensm/osm_dump.c
index 367d941..7935c16 100644
--- a/opensm/opensm/osm_dump.c
+++ b/opensm/opensm/osm_dump.c
@@ -202,7 +202,9 @@ static void dump_ucast_routes(cl_map_item_t * p_map_item, void *cxt)
 								  p_node, 0);
 					base_lid = cl_ntoh16(base_lid);
 					num_hops =
-					    p_physp->p_remote_physp->p_node->sw == p_sw ? 0 :
+					    p_physp->p_remote_physp->p_node->
+					    sw ==
+					    p_sw ? 0 :
 					    osm_switch_get_hop_count(p_sw,
 								     base_lid,
 								     port_num);
@@ -270,7 +272,8 @@ static void dump_mcast_routes(cl_map_item_t * p_map_item, void *cxt)
 				mlid_ho + IB_LID_MCAST_START_HO);
 			while (position <= p_tbl->max_position) {
 				mask_entry =
-				    cl_ntoh16((*p_tbl->p_mask_tbl)[mlid_ho][position]);
+				    cl_ntoh16((*p_tbl->
+					       p_mask_tbl)[mlid_ho][position]);
 				if (mask_entry == 0) {
 					position++;
 					continue;
@@ -278,11 +281,13 @@ static void dump_mcast_routes(cl_map_item_t * p_map_item, void *cxt)
 				for (j = 0; j < 16; j++) {
 					if ((1 << j) & mask_entry) {
 						if (first_mlid) {
-							fprintf(file, "%s", sw_hdr);
+							fprintf(file, "%s",
+								sw_hdr);
 							first_mlid = FALSE;
 						}
 						if (first_port) {
-							fprintf(file, "%s", mlid_hdr);
+							fprintf(file, "%s",
+								mlid_hdr);
 							first_port = FALSE;
 						}
 						fprintf(file, " 0x%03X ",
diff --git a/opensm/opensm/osm_event_plugin.c b/opensm/opensm/osm_event_plugin.c
index fb5052e..5133628 100644
--- a/opensm/opensm/osm_event_plugin.c
+++ b/opensm/opensm/osm_event_plugin.c
@@ -60,14 +60,13 @@
 /**
  * functions
  */
-osm_epi_plugin_t *
-osm_epi_construct(osm_log_t *p_log, char *plugin_name)
+osm_epi_plugin_t *osm_epi_construct(osm_log_t * p_log, char *plugin_name)
 {
-	char              lib_name[OSM_PATH_MAX];
+	char lib_name[OSM_PATH_MAX];
 	osm_epi_plugin_t *rc = NULL;
 
 	if (!plugin_name ||
-			strcmp(plugin_name, OSM_EVENT_PLUGIN_NAME_NONE) == 0)
+	    strcmp(plugin_name, OSM_EVENT_PLUGIN_NAME_NONE) == 0)
 		return (NULL);
 
 	/* find the plugin */
@@ -85,12 +84,13 @@ osm_epi_construct(osm_log_t *p_log, char *plugin_name)
 		goto DLOPENFAIL;
 	}
 
-	rc->impl = (__osm_epi_plugin_t *)dlsym(rc->handle, OSM_EVENT_PLUGIN_IMPL_NAME);
+	rc->impl =
+	    (__osm_epi_plugin_t *) dlsym(rc->handle,
+					 OSM_EVENT_PLUGIN_IMPL_NAME);
 	if (!rc->impl) {
 		osm_log(p_log, OSM_LOG_ERROR,
 			"Failed to find \"%s\" symbol in \"%s\" : \"%s\"\n",
-			OSM_EVENT_PLUGIN_IMPL_NAME,
-			lib_name, dlerror());
+			OSM_EVENT_PLUGIN_IMPL_NAME, lib_name, dlerror());
 		goto Exit;
 	}
 
@@ -119,15 +119,14 @@ osm_epi_construct(osm_log_t *p_log, char *plugin_name)
 	rc->p_log = p_log;
 	return (rc);
 
-Exit:
+      Exit:
 	dlclose(rc->handle);
-DLOPENFAIL:
+      DLOPENFAIL:
 	free(rc);
 	return (NULL);
 }
 
-void
-osm_epi_destroy(osm_epi_plugin_t *plugin)
+void osm_epi_destroy(osm_epi_plugin_t * plugin)
 {
 	if (plugin) {
 		if (plugin->impl->destroy)
@@ -138,11 +137,9 @@ osm_epi_destroy(osm_epi_plugin_t *plugin)
 }
 
 void
-osm_epi_report(osm_epi_plugin_t *plugin, osm_epi_event_id_t event_id,
-		void *event_data)
+osm_epi_report(osm_epi_plugin_t * plugin, osm_epi_event_id_t event_id,
+	       void *event_data)
 {
 	if (plugin && plugin->impl->report)
-		plugin->impl->report(plugin->plugin_data,
-				event_id, event_data);
+		plugin->impl->report(plugin->plugin_data, event_id, event_data);
 }
-
diff --git a/opensm/opensm/osm_fwd_tbl.c b/opensm/opensm/osm_fwd_tbl.c
index 4ff1e10..61a692d 100644
--- a/opensm/opensm/osm_fwd_tbl.c
+++ b/opensm/opensm/osm_fwd_tbl.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of osm_fwd_tbl_t.
@@ -48,68 +47,59 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <complib/cl_math.h>
 #include <iba/ib_types.h>
 #include <opensm/osm_fwd_tbl.h>
 
-
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_fwd_tbl_init(
-  IN osm_fwd_tbl_t* const p_tbl,
-  IN const ib_switch_info_t* const p_si )
+osm_fwd_tbl_init(IN osm_fwd_tbl_t * const p_tbl,
+		 IN const ib_switch_info_t * const p_si)
 {
-  uint16_t tbl_cap;
-  ib_api_status_t status = IB_SUCCESS;
+	uint16_t tbl_cap;
+	ib_api_status_t status = IB_SUCCESS;
 
-  /*
-    Determine the type and size of the forwarding table
-    used by this switch, then initialize accordingly.
-    The current implementation only supports switches
-    with linear forwarding tables.
-  */
-  tbl_cap = cl_ntoh16( p_si->lin_cap );
+	/*
+	   Determine the type and size of the forwarding table
+	   used by this switch, then initialize accordingly.
+	   The current implementation only supports switches
+	   with linear forwarding tables.
+	 */
+	tbl_cap = cl_ntoh16(p_si->lin_cap);
 
-  if( tbl_cap == 0 )
-  {
-    /*
-      This switch does not support linear forwarding
-      tables.  Error out for now.
-    */
-    status = IB_UNSUPPORTED;
-    goto Exit;
-  }
+	if (tbl_cap == 0) {
+		/*
+		   This switch does not support linear forwarding
+		   tables.  Error out for now.
+		 */
+		status = IB_UNSUPPORTED;
+		goto Exit;
+	}
 
-  p_tbl->p_rnd_tbl = NULL;
+	p_tbl->p_rnd_tbl = NULL;
 
-  p_tbl->p_lin_tbl = osm_lin_tbl_new( tbl_cap );
+	p_tbl->p_lin_tbl = osm_lin_tbl_new(tbl_cap);
 
-  if( p_tbl->p_lin_tbl == NULL )
-  {
-    status = IB_INSUFFICIENT_MEMORY;
-    goto Exit;
-  }
+	if (p_tbl->p_lin_tbl == NULL) {
+		status = IB_INSUFFICIENT_MEMORY;
+		goto Exit;
+	}
 
- Exit:
-  return( status );
+      Exit:
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_fwd_tbl_destroy(
-  IN osm_fwd_tbl_t* const p_tbl )
+void osm_fwd_tbl_destroy(IN osm_fwd_tbl_t * const p_tbl)
 {
-  if( p_tbl->p_lin_tbl )
-  {
-    CL_ASSERT( p_tbl->p_rnd_tbl == NULL );
-    osm_lin_tbl_delete( &p_tbl->p_lin_tbl );
-  }
-  else
-  {
-    osm_rand_tbl_delete( &p_tbl->p_rnd_tbl );
-  }
+	if (p_tbl->p_lin_tbl) {
+		CL_ASSERT(p_tbl->p_rnd_tbl == NULL);
+		osm_lin_tbl_delete(&p_tbl->p_lin_tbl);
+	} else {
+		osm_rand_tbl_delete(&p_tbl->p_rnd_tbl);
+	}
 }
diff --git a/opensm/opensm/osm_helper.c b/opensm/opensm/osm_helper.c
index 9d21194..c428823 100644
--- a/opensm/opensm/osm_helper.c
+++ b/opensm/opensm/osm_helper.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of opensm helper functions.
@@ -46,7 +45,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -59,2490 +58,2341 @@
 #define LINE_LENGTH 256
 
 /* we use two tables - one for queries and one for responses */
-const char* const __ib_sa_method_str[] =
-{
-  "RESERVED",                 /* 0 */
-  "SubnAdmGet",             /* 1 */
-  "SubnAdmSet",             /* 2 */
-  "RESERVED",                  /* 3 */
-  "RESERVED",                  /* 4 */
-  "RESERVED",                  /* 5 */
-  "SubnAdmReport",          /* 6 */
-  "RESERVED",                  /* 7 */
-  "RESERVED",                  /* 8 */
-  "RESERVED",                  /* 9 */
-  "RESERVED",                  /* A */
-  "RESERVED",                  /* B */
-  "RESERVED",                  /* C */
-  "RESERVED",                  /* D */
-  "RESERVED",                  /* E */
-  "RESERVED",                  /* F */
-  "RESERVED",                  /* 10 */
-  "RESERVED",                  /* 11 */
-  "SubnAdmGetTable",           /* 12 */
-  "SubnAdmGetTraceTable",      /* 13 */
-  "SubnAdmGetMulti",           /* 14 */
-  "SubnAdmDelete",          /* 15 */
-  "UNKNOWN"                   /* 16 */
+const char *const __ib_sa_method_str[] = {
+	"RESERVED",		/* 0 */
+	"SubnAdmGet",		/* 1 */
+	"SubnAdmSet",		/* 2 */
+	"RESERVED",		/* 3 */
+	"RESERVED",		/* 4 */
+	"RESERVED",		/* 5 */
+	"SubnAdmReport",	/* 6 */
+	"RESERVED",		/* 7 */
+	"RESERVED",		/* 8 */
+	"RESERVED",		/* 9 */
+	"RESERVED",		/* A */
+	"RESERVED",		/* B */
+	"RESERVED",		/* C */
+	"RESERVED",		/* D */
+	"RESERVED",		/* E */
+	"RESERVED",		/* F */
+	"RESERVED",		/* 10 */
+	"RESERVED",		/* 11 */
+	"SubnAdmGetTable",	/* 12 */
+	"SubnAdmGetTraceTable",	/* 13 */
+	"SubnAdmGetMulti",	/* 14 */
+	"SubnAdmDelete",	/* 15 */
+	"UNKNOWN"		/* 16 */
 };
 
-const char* const __ib_sa_resp_method_str[] =
-{
-  "RESERVED",                 /* 80 */
-  "SubnAdmGetResp",            /* 81 */
-  "RESERVED (SetResp?)",    /* 82 */
-  "RESERVED",                  /* 83 */
-  "RESERVED",                  /* 84 */
-  "RESERVED",                  /* 85 */
-  "SubnAdmReportResp",         /* 86 */
-  "RESERVED",                  /* 87 */
-  "RESERVED",                  /* 88 */
-  "RESERVED",                  /* 89 */
-  "RESERVED",                  /* 8A */
-  "RESERVED",                  /* 8B */
-  "RESERVED",                  /* 8C */
-  "RESERVED",                  /* 8D */
-  "RESERVED",                  /* 8E */
-  "RESERVED",                  /* 8F */
-  "RESERVED",                  /* 90 */
-  "RESERVED",                  /* 91 */
-  "SubnAdmGetTableResp",       /* 92 */
-  "RESERVED",                  /* 93 */
-  "SubnAdmGetMultiResp",    /* 94 */
-  "SubnAdmDeleteResp",         /* 95 */
-  "UNKNOWN"
+const char *const __ib_sa_resp_method_str[] = {
+	"RESERVED",		/* 80 */
+	"SubnAdmGetResp",	/* 81 */
+	"RESERVED (SetResp?)",	/* 82 */
+	"RESERVED",		/* 83 */
+	"RESERVED",		/* 84 */
+	"RESERVED",		/* 85 */
+	"SubnAdmReportResp",	/* 86 */
+	"RESERVED",		/* 87 */
+	"RESERVED",		/* 88 */
+	"RESERVED",		/* 89 */
+	"RESERVED",		/* 8A */
+	"RESERVED",		/* 8B */
+	"RESERVED",		/* 8C */
+	"RESERVED",		/* 8D */
+	"RESERVED",		/* 8E */
+	"RESERVED",		/* 8F */
+	"RESERVED",		/* 90 */
+	"RESERVED",		/* 91 */
+	"SubnAdmGetTableResp",	/* 92 */
+	"RESERVED",		/* 93 */
+	"SubnAdmGetMultiResp",	/* 94 */
+	"SubnAdmDeleteResp",	/* 95 */
+	"UNKNOWN"
 };
 
 #define OSM_SA_METHOD_STR_UNKNOWN_VAL 0x16
 
-const char* const __ib_sm_method_str[] =
-{
-  "RESERVED0",              /* 0 */
-  "SubnGet",              /* 1 */
-  "SubnSet",              /* 2 */
-  "RESERVED3",               /* 3 */
-  "RESERVED4",               /* 4 */
-  "SubnTrap",                /* 5 */
-  "RESERVED6",               /* 6 */
-  "SubnTrapRepress",         /* 7 */
-  "RESERVED8",               /* 8 */
-  "RESERVED9",               /* 9 */
-  "RESERVEDA",               /* A */
-  "RESERVEDB",               /* B */
-  "RESERVEDC",               /* C */
-  "RESERVEDD",               /* D */
-  "RESERVEDE",               /* E */
-  "RESERVEDF",               /* F */
-  "RESERVED10",              /* 10 */
-  "SubnGetResp",             /* 11 */
-  "RESERVED12",           /* 12 */
-  "RESERVED13",           /* 13 */
-  "RESERVED14",           /* 14 */
-  "RESERVED15",           /* 15 */
-  "RESERVED16",              /* 16 */
-  "RESERVED17",           /* 17 */
-  "RESERVED18",           /* 18 */
-  "RESERVED19",           /* 19 */
-  "RESERVED1A",           /* 1A */
-  "RESERVED1B",           /* 1B */
-  "RESERVED1C",           /* 1C */
-  "RESERVED1D",           /* 1D */
-  "RESERVED1E",             /* 1E */
-  "RESERVED1F",             /* 1F */
-  "UNKNOWN"                  /* 20 */
+const char *const __ib_sm_method_str[] = {
+	"RESERVED0",		/* 0 */
+	"SubnGet",		/* 1 */
+	"SubnSet",		/* 2 */
+	"RESERVED3",		/* 3 */
+	"RESERVED4",		/* 4 */
+	"SubnTrap",		/* 5 */
+	"RESERVED6",		/* 6 */
+	"SubnTrapRepress",	/* 7 */
+	"RESERVED8",		/* 8 */
+	"RESERVED9",		/* 9 */
+	"RESERVEDA",		/* A */
+	"RESERVEDB",		/* B */
+	"RESERVEDC",		/* C */
+	"RESERVEDD",		/* D */
+	"RESERVEDE",		/* E */
+	"RESERVEDF",		/* F */
+	"RESERVED10",		/* 10 */
+	"SubnGetResp",		/* 11 */
+	"RESERVED12",		/* 12 */
+	"RESERVED13",		/* 13 */
+	"RESERVED14",		/* 14 */
+	"RESERVED15",		/* 15 */
+	"RESERVED16",		/* 16 */
+	"RESERVED17",		/* 17 */
+	"RESERVED18",		/* 18 */
+	"RESERVED19",		/* 19 */
+	"RESERVED1A",		/* 1A */
+	"RESERVED1B",		/* 1B */
+	"RESERVED1C",		/* 1C */
+	"RESERVED1D",		/* 1D */
+	"RESERVED1E",		/* 1E */
+	"RESERVED1F",		/* 1F */
+	"UNKNOWN"		/* 20 */
 };
 
 #define OSM_SM_METHOD_STR_UNKNOWN_VAL 0x21
 
-const char* const __ib_sm_attr_str[] =
-{
-  "RESERVED",                  /* 0 */
-  "ClassPortInfo",             /* 1 */
-  "Notice",                    /* 2 */
-  "InformInfo",                /* 3 */
-  "RESERVED",                  /* 4 */
-  "RESERVED",                  /* 5 */
-  "RESERVED",                  /* 6 */
-  "RESERVED",                  /* 7 */
-  "RESERVED",                  /* 8 */
-  "RESERVED",                  /* 9 */
-  "RESERVED",                  /* A */
-  "RESERVED",                  /* B */
-  "RESERVED",                  /* C */
-  "RESERVED",                  /* D */
-  "RESERVED",                  /* E */
-  "RESERVED",                  /* F */
-  "NodeDescription",           /* 10 */
-  "NodeInfo",                  /* 11 */
-  "SwitchInfo",                /* 12 */
-  "UNKNOWN",                   /* 13 */
-  "GUIDInfo",                  /* 14 */
-  "PortInfo",                  /* 15 */
-  "P_KeyTable",                /* 16 */
-  "SLtoVLMappingTable",        /* 17 */
-  "VLArbitrationTable",        /* 18 */
-  "LinearForwardingTable",     /* 19 */
-  "RandomForwardingTable",     /* 1A */
-  "MulticastForwardingTable",  /* 1B */
-  "UNKNOWN",                   /* 1C */
-  "UNKNOWN",                   /* 1D */
-  "UNKNOWN",                   /* 1E */
-  "UNKNOWN",                   /* 1F */
-  "SMInfo",                    /* 20 */
-  "UNKNOWN"                    /* 21 - always highest value */
+const char *const __ib_sm_attr_str[] = {
+	"RESERVED",		/* 0 */
+	"ClassPortInfo",	/* 1 */
+	"Notice",		/* 2 */
+	"InformInfo",		/* 3 */
+	"RESERVED",		/* 4 */
+	"RESERVED",		/* 5 */
+	"RESERVED",		/* 6 */
+	"RESERVED",		/* 7 */
+	"RESERVED",		/* 8 */
+	"RESERVED",		/* 9 */
+	"RESERVED",		/* A */
+	"RESERVED",		/* B */
+	"RESERVED",		/* C */
+	"RESERVED",		/* D */
+	"RESERVED",		/* E */
+	"RESERVED",		/* F */
+	"NodeDescription",	/* 10 */
+	"NodeInfo",		/* 11 */
+	"SwitchInfo",		/* 12 */
+	"UNKNOWN",		/* 13 */
+	"GUIDInfo",		/* 14 */
+	"PortInfo",		/* 15 */
+	"P_KeyTable",		/* 16 */
+	"SLtoVLMappingTable",	/* 17 */
+	"VLArbitrationTable",	/* 18 */
+	"LinearForwardingTable",	/* 19 */
+	"RandomForwardingTable",	/* 1A */
+	"MulticastForwardingTable",	/* 1B */
+	"UNKNOWN",		/* 1C */
+	"UNKNOWN",		/* 1D */
+	"UNKNOWN",		/* 1E */
+	"UNKNOWN",		/* 1F */
+	"SMInfo",		/* 20 */
+	"UNKNOWN"		/* 21 - always highest value */
 };
 
 #define OSM_SM_ATTR_STR_UNKNOWN_VAL 0x21
 
-const char* const __ib_sa_attr_str[] =
-{
-  "RESERVED",                  /* 0 */
-  "ClassPortInfo",             /* 1 */
-  "Notice",                    /* 2 */
-  "InformInfo",                /* 3 */
-  "RESERVED",                  /* 4 */
-  "RESERVED",                  /* 5 */
-  "RESERVED",                  /* 6 */
-  "RESERVED",                  /* 7 */
-  "RESERVED",                  /* 8 */
-  "RESERVED",                  /* 9 */
-  "RESERVED",                  /* A */
-  "RESERVED",                  /* B */
-  "RESERVED",                  /* C */
-  "RESERVED",                  /* D */
-  "RESERVED",                  /* E */
-  "RESERVED",                  /* F */
-  "RESERVED",                  /* 10 */
-  "NodeRecord",                /* 11 */
-  "PortInfoRecord",            /* 12 */
-  "SLtoVLMappingTableRecord",  /* 13 */
-  "SwitchInfoRecord",          /* 14 */
-  "LinearForwardingTableRecord", /* 15 */
-  "RandomForwardingTableRecord", /* 16 */
-  "MulticastForwardingTableRecord",  /* 17 */
-  "SMInfoRecord",              /* 18 */
-  "RESERVED",                  /* 19 */
-  "RandomForwardingTable",     /* 1A */
-  "MulticastForwardingTable",  /* 1B */
-  "UNKNOWN",                   /* 1C */
-  "UNKNOWN",                   /* 1D */
-  "UNKNOWN",                   /* 1E */
-  "UNKNOWN",                   /* 1F */
-  "LinkRecord",                /* 20 */
-  "UNKNOWN",                   /* 21 */
-  "UNKNOWN",                   /* 22 */
-  "UNKNOWN",                   /* 23 */
-  "UNKNOWN",                   /* 24 */
-  "UNKNOWN",                   /* 25 */
-  "UNKNOWN",                   /* 26 */
-  "UNKNOWN",                   /* 27 */
-  "UNKNOWN",                   /* 28 */
-  "UNKNOWN",                   /* 29 */
-  "UNKNOWN",                   /* 2A */
-  "UNKNOWN",                   /* 2B */
-  "UNKNOWN",                   /* 2C */
-  "UNKNOWN",                   /* 2D */
-  "UNKNOWN",                   /* 2E */
-  "UNKNOWN",                   /* 2F */
-  "GuidInfoRecord",            /* 30 */
-  "ServiceRecord",             /* 31 */
-  "UNKNOWN",                   /* 32 */
-  "P_KeyTableRecord",          /* 33 */
-  "UNKNOWN",                   /* 34 */
-  "PathRecord",                /* 35 */
-  "VLArbitrationTableRecord",  /* 36 */
-  "UNKNOWN",                   /* 37 */
-  "MCMemberRecord",            /* 38 */
-  "TraceRecord",               /* 39 */
-  "MultiPathRecord",           /* 3A */
-  "ServiceAssociationRecord",  /* 3B */
-  "UNKNOWN",                   /* 3C */
-  "UNKNOWN",                   /* 3D */
-  "UNKNOWN",                   /* 3E */
-  "UNKNOWN",                   /* 3F */
-  "UNKNOWN",                   /* 40 */
-  "UNKNOWN",                   /* 41 */
-  "UNKNOWN",                   /* 42 */
-  "UNKNOWN",                   /* 43 */
-  "UNKNOWN",                   /* 44 */
-  "UNKNOWN",                   /* 45 */
-  "UNKNOWN",                   /* 46 */
-  "UNKNOWN",                   /* 47 */
-  "UNKNOWN",                   /* 48 */
-  "UNKNOWN",                   /* 49 */
-  "UNKNOWN",                   /* 4A */
-  "UNKNOWN",                   /* 4B */
-  "UNKNOWN",                   /* 4C */
-  "UNKNOWN",                   /* 4D */
-  "UNKNOWN",                   /* 4E */
-  "UNKNOWN",                   /* 4F */
-  "UNKNOWN",                   /* 50 */
-  "UNKNOWN",                   /* 51 */
-  "UNKNOWN",                   /* 52 */
-  "UNKNOWN",                   /* 53 */
-  "UNKNOWN",                   /* 54 */
-  "UNKNOWN",                   /* 55 */
-  "UNKNOWN",                   /* 56 */
-  "UNKNOWN",                   /* 57 */
-  "UNKNOWN",                   /* 58 */
-  "UNKNOWN",                   /* 59 */
-  "UNKNOWN",                   /* 5A */
-  "UNKNOWN",                   /* 5B */
-  "UNKNOWN",                   /* 5C */
-  "UNKNOWN",                   /* 5D */
-  "UNKNOWN",                   /* 5E */
-  "UNKNOWN",                   /* 5F */
-  "UNKNOWN",                   /* 60 */
-  "UNKNOWN",                   /* 61 */
-  "UNKNOWN",                   /* 62 */
-  "UNKNOWN",                   /* 63 */
-  "UNKNOWN",                   /* 64 */
-  "UNKNOWN",                   /* 65 */
-  "UNKNOWN",                   /* 66 */
-  "UNKNOWN",                   /* 67 */
-  "UNKNOWN",                   /* 68 */
-  "UNKNOWN",                   /* 69 */
-  "UNKNOWN",                   /* 6A */
-  "UNKNOWN",                   /* 6B */
-  "UNKNOWN",                   /* 6C */
-  "UNKNOWN",                   /* 6D */
-  "UNKNOWN",                   /* 6E */
-  "UNKNOWN",                   /* 6F */
-  "UNKNOWN",                   /* 70 */
-  "UNKNOWN",                   /* 71 */
-  "UNKNOWN",                   /* 72 */
-  "UNKNOWN",                   /* 73 */
-  "UNKNOWN",                   /* 74 */
-  "UNKNOWN",                   /* 75 */
-  "UNKNOWN",                   /* 76 */
-  "UNKNOWN",                   /* 77 */
-  "UNKNOWN",                   /* 78 */
-  "UNKNOWN",                   /* 79 */
-  "UNKNOWN",                   /* 7A */
-  "UNKNOWN",                   /* 7B */
-  "UNKNOWN",                   /* 7C */
-  "UNKNOWN",                   /* 7D */
-  "UNKNOWN",                   /* 7E */
-  "UNKNOWN",                   /* 7F */
-  "UNKNOWN",                   /* 80 */
-  "UNKNOWN",                   /* 81 */
-  "UNKNOWN",                   /* 82 */
-  "UNKNOWN",                   /* 83 */
-  "UNKNOWN",                   /* 84 */
-  "UNKNOWN",                   /* 85 */
-  "UNKNOWN",                   /* 86 */
-  "UNKNOWN",                   /* 87 */
-  "UNKNOWN",                   /* 88 */
-  "UNKNOWN",                   /* 89 */
-  "UNKNOWN",                   /* 8A */
-  "UNKNOWN",                   /* 8B */
-  "UNKNOWN",                   /* 8C */
-  "UNKNOWN",                   /* 8D */
-  "UNKNOWN",                   /* 8E */
-  "UNKNOWN",                   /* 8F */
-  "UNKNOWN",                   /* 90 */
-  "UNKNOWN",                   /* 91 */
-  "UNKNOWN",                   /* 92 */
-  "UNKNOWN",                   /* 93 */
-  "UNKNOWN",                   /* 94 */
-  "UNKNOWN",                   /* 95 */
-  "UNKNOWN",                   /* 96 */
-  "UNKNOWN",                   /* 97 */
-  "UNKNOWN",                   /* 98 */
-  "UNKNOWN",                   /* 99 */
-  "UNKNOWN",                   /* 9A */
-  "UNKNOWN",                   /* 9B */
-  "UNKNOWN",                   /* 9C */
-  "UNKNOWN",                   /* 9D */
-  "UNKNOWN",                   /* 9E */
-  "UNKNOWN",                   /* 9F */
-  "UNKNOWN",                   /* A0 */
-  "UNKNOWN",                   /* A1 */
-  "UNKNOWN",                   /* A2 */
-  "UNKNOWN",                   /* A3 */
-  "UNKNOWN",                   /* A4 */
-  "UNKNOWN",                   /* A5 */
-  "UNKNOWN",                   /* A6 */
-  "UNKNOWN",                   /* A7 */
-  "UNKNOWN",                   /* A8 */
-  "UNKNOWN",                   /* A9 */
-  "UNKNOWN",                   /* AA */
-  "UNKNOWN",                   /* AB */
-  "UNKNOWN",                   /* AC */
-  "UNKNOWN",                   /* AD */
-  "UNKNOWN",                   /* AE */
-  "UNKNOWN",                   /* AF */
-  "UNKNOWN",                   /* B0 */
-  "UNKNOWN",                   /* B1 */
-  "UNKNOWN",                   /* B2 */
-  "UNKNOWN",                   /* B3 */
-  "UNKNOWN",                   /* B4 */
-  "UNKNOWN",                   /* B5 */
-  "UNKNOWN",                   /* B6 */
-  "UNKNOWN",                   /* B7 */
-  "UNKNOWN",                   /* B8 */
-  "UNKNOWN",                   /* B9 */
-  "UNKNOWN",                   /* BA */
-  "UNKNOWN",                   /* BB */
-  "UNKNOWN",                   /* BC */
-  "UNKNOWN",                   /* BD */
-  "UNKNOWN",                   /* BE */
-  "UNKNOWN",                   /* BF */
-  "UNKNOWN",                   /* C0 */
-  "UNKNOWN",                   /* C1 */
-  "UNKNOWN",                   /* C2 */
-  "UNKNOWN",                   /* C3 */
-  "UNKNOWN",                   /* C4 */
-  "UNKNOWN",                   /* C5 */
-  "UNKNOWN",                   /* C6 */
-  "UNKNOWN",                   /* C7 */
-  "UNKNOWN",                   /* C8 */
-  "UNKNOWN",                   /* C9 */
-  "UNKNOWN",                   /* CA */
-  "UNKNOWN",                   /* CB */
-  "UNKNOWN",                   /* CC */
-  "UNKNOWN",                   /* CD */
-  "UNKNOWN",                   /* CE */
-  "UNKNOWN",                   /* CF */
-  "UNKNOWN",                   /* D0 */
-  "UNKNOWN",                   /* D1 */
-  "UNKNOWN",                   /* D2 */
-  "UNKNOWN",                   /* D3 */
-  "UNKNOWN",                   /* D4 */
-  "UNKNOWN",                   /* D5 */
-  "UNKNOWN",                   /* D6 */
-  "UNKNOWN",                   /* D7 */
-  "UNKNOWN",                   /* D8 */
-  "UNKNOWN",                   /* D9 */
-  "UNKNOWN",                   /* DA */
-  "UNKNOWN",                   /* DB */
-  "UNKNOWN",                   /* DC */
-  "UNKNOWN",                   /* DD */
-  "UNKNOWN",                   /* DE */
-  "UNKNOWN",                   /* DF */
-  "UNKNOWN",                   /* E0 */
-  "UNKNOWN",                   /* E1 */
-  "UNKNOWN",                   /* E2 */
-  "UNKNOWN",                   /* E3 */
-  "UNKNOWN",                   /* E4 */
-  "UNKNOWN",                   /* E5 */
-  "UNKNOWN",                   /* E6 */
-  "UNKNOWN",                   /* E7 */
-  "UNKNOWN",                   /* E8 */
-  "UNKNOWN",                   /* E9 */
-  "UNKNOWN",                   /* EA */
-  "UNKNOWN",                   /* EB */
-  "UNKNOWN",                   /* EC */
-  "UNKNOWN",                   /* ED */
-  "UNKNOWN",                   /* EE */
-  "UNKNOWN",                   /* EF */
-  "UNKNOWN",                   /* F0 */
-  "UNKNOWN",                   /* F1 */
-  "UNKNOWN",                   /* F2 */
-  "InformInfoRecord",          /* F3 */
-  "UNKNOWN"                    /* F4 - always highest value */
+const char *const __ib_sa_attr_str[] = {
+	"RESERVED",		/* 0 */
+	"ClassPortInfo",	/* 1 */
+	"Notice",		/* 2 */
+	"InformInfo",		/* 3 */
+	"RESERVED",		/* 4 */
+	"RESERVED",		/* 5 */
+	"RESERVED",		/* 6 */
+	"RESERVED",		/* 7 */
+	"RESERVED",		/* 8 */
+	"RESERVED",		/* 9 */
+	"RESERVED",		/* A */
+	"RESERVED",		/* B */
+	"RESERVED",		/* C */
+	"RESERVED",		/* D */
+	"RESERVED",		/* E */
+	"RESERVED",		/* F */
+	"RESERVED",		/* 10 */
+	"NodeRecord",		/* 11 */
+	"PortInfoRecord",	/* 12 */
+	"SLtoVLMappingTableRecord",	/* 13 */
+	"SwitchInfoRecord",	/* 14 */
+	"LinearForwardingTableRecord",	/* 15 */
+	"RandomForwardingTableRecord",	/* 16 */
+	"MulticastForwardingTableRecord",	/* 17 */
+	"SMInfoRecord",		/* 18 */
+	"RESERVED",		/* 19 */
+	"RandomForwardingTable",	/* 1A */
+	"MulticastForwardingTable",	/* 1B */
+	"UNKNOWN",		/* 1C */
+	"UNKNOWN",		/* 1D */
+	"UNKNOWN",		/* 1E */
+	"UNKNOWN",		/* 1F */
+	"LinkRecord",		/* 20 */
+	"UNKNOWN",		/* 21 */
+	"UNKNOWN",		/* 22 */
+	"UNKNOWN",		/* 23 */
+	"UNKNOWN",		/* 24 */
+	"UNKNOWN",		/* 25 */
+	"UNKNOWN",		/* 26 */
+	"UNKNOWN",		/* 27 */
+	"UNKNOWN",		/* 28 */
+	"UNKNOWN",		/* 29 */
+	"UNKNOWN",		/* 2A */
+	"UNKNOWN",		/* 2B */
+	"UNKNOWN",		/* 2C */
+	"UNKNOWN",		/* 2D */
+	"UNKNOWN",		/* 2E */
+	"UNKNOWN",		/* 2F */
+	"GuidInfoRecord",	/* 30 */
+	"ServiceRecord",	/* 31 */
+	"UNKNOWN",		/* 32 */
+	"P_KeyTableRecord",	/* 33 */
+	"UNKNOWN",		/* 34 */
+	"PathRecord",		/* 35 */
+	"VLArbitrationTableRecord",	/* 36 */
+	"UNKNOWN",		/* 37 */
+	"MCMemberRecord",	/* 38 */
+	"TraceRecord",		/* 39 */
+	"MultiPathRecord",	/* 3A */
+	"ServiceAssociationRecord",	/* 3B */
+	"UNKNOWN",		/* 3C */
+	"UNKNOWN",		/* 3D */
+	"UNKNOWN",		/* 3E */
+	"UNKNOWN",		/* 3F */
+	"UNKNOWN",		/* 40 */
+	"UNKNOWN",		/* 41 */
+	"UNKNOWN",		/* 42 */
+	"UNKNOWN",		/* 43 */
+	"UNKNOWN",		/* 44 */
+	"UNKNOWN",		/* 45 */
+	"UNKNOWN",		/* 46 */
+	"UNKNOWN",		/* 47 */
+	"UNKNOWN",		/* 48 */
+	"UNKNOWN",		/* 49 */
+	"UNKNOWN",		/* 4A */
+	"UNKNOWN",		/* 4B */
+	"UNKNOWN",		/* 4C */
+	"UNKNOWN",		/* 4D */
+	"UNKNOWN",		/* 4E */
+	"UNKNOWN",		/* 4F */
+	"UNKNOWN",		/* 50 */
+	"UNKNOWN",		/* 51 */
+	"UNKNOWN",		/* 52 */
+	"UNKNOWN",		/* 53 */
+	"UNKNOWN",		/* 54 */
+	"UNKNOWN",		/* 55 */
+	"UNKNOWN",		/* 56 */
+	"UNKNOWN",		/* 57 */
+	"UNKNOWN",		/* 58 */
+	"UNKNOWN",		/* 59 */
+	"UNKNOWN",		/* 5A */
+	"UNKNOWN",		/* 5B */
+	"UNKNOWN",		/* 5C */
+	"UNKNOWN",		/* 5D */
+	"UNKNOWN",		/* 5E */
+	"UNKNOWN",		/* 5F */
+	"UNKNOWN",		/* 60 */
+	"UNKNOWN",		/* 61 */
+	"UNKNOWN",		/* 62 */
+	"UNKNOWN",		/* 63 */
+	"UNKNOWN",		/* 64 */
+	"UNKNOWN",		/* 65 */
+	"UNKNOWN",		/* 66 */
+	"UNKNOWN",		/* 67 */
+	"UNKNOWN",		/* 68 */
+	"UNKNOWN",		/* 69 */
+	"UNKNOWN",		/* 6A */
+	"UNKNOWN",		/* 6B */
+	"UNKNOWN",		/* 6C */
+	"UNKNOWN",		/* 6D */
+	"UNKNOWN",		/* 6E */
+	"UNKNOWN",		/* 6F */
+	"UNKNOWN",		/* 70 */
+	"UNKNOWN",		/* 71 */
+	"UNKNOWN",		/* 72 */
+	"UNKNOWN",		/* 73 */
+	"UNKNOWN",		/* 74 */
+	"UNKNOWN",		/* 75 */
+	"UNKNOWN",		/* 76 */
+	"UNKNOWN",		/* 77 */
+	"UNKNOWN",		/* 78 */
+	"UNKNOWN",		/* 79 */
+	"UNKNOWN",		/* 7A */
+	"UNKNOWN",		/* 7B */
+	"UNKNOWN",		/* 7C */
+	"UNKNOWN",		/* 7D */
+	"UNKNOWN",		/* 7E */
+	"UNKNOWN",		/* 7F */
+	"UNKNOWN",		/* 80 */
+	"UNKNOWN",		/* 81 */
+	"UNKNOWN",		/* 82 */
+	"UNKNOWN",		/* 83 */
+	"UNKNOWN",		/* 84 */
+	"UNKNOWN",		/* 85 */
+	"UNKNOWN",		/* 86 */
+	"UNKNOWN",		/* 87 */
+	"UNKNOWN",		/* 88 */
+	"UNKNOWN",		/* 89 */
+	"UNKNOWN",		/* 8A */
+	"UNKNOWN",		/* 8B */
+	"UNKNOWN",		/* 8C */
+	"UNKNOWN",		/* 8D */
+	"UNKNOWN",		/* 8E */
+	"UNKNOWN",		/* 8F */
+	"UNKNOWN",		/* 90 */
+	"UNKNOWN",		/* 91 */
+	"UNKNOWN",		/* 92 */
+	"UNKNOWN",		/* 93 */
+	"UNKNOWN",		/* 94 */
+	"UNKNOWN",		/* 95 */
+	"UNKNOWN",		/* 96 */
+	"UNKNOWN",		/* 97 */
+	"UNKNOWN",		/* 98 */
+	"UNKNOWN",		/* 99 */
+	"UNKNOWN",		/* 9A */
+	"UNKNOWN",		/* 9B */
+	"UNKNOWN",		/* 9C */
+	"UNKNOWN",		/* 9D */
+	"UNKNOWN",		/* 9E */
+	"UNKNOWN",		/* 9F */
+	"UNKNOWN",		/* A0 */
+	"UNKNOWN",		/* A1 */
+	"UNKNOWN",		/* A2 */
+	"UNKNOWN",		/* A3 */
+	"UNKNOWN",		/* A4 */
+	"UNKNOWN",		/* A5 */
+	"UNKNOWN",		/* A6 */
+	"UNKNOWN",		/* A7 */
+	"UNKNOWN",		/* A8 */
+	"UNKNOWN",		/* A9 */
+	"UNKNOWN",		/* AA */
+	"UNKNOWN",		/* AB */
+	"UNKNOWN",		/* AC */
+	"UNKNOWN",		/* AD */
+	"UNKNOWN",		/* AE */
+	"UNKNOWN",		/* AF */
+	"UNKNOWN",		/* B0 */
+	"UNKNOWN",		/* B1 */
+	"UNKNOWN",		/* B2 */
+	"UNKNOWN",		/* B3 */
+	"UNKNOWN",		/* B4 */
+	"UNKNOWN",		/* B5 */
+	"UNKNOWN",		/* B6 */
+	"UNKNOWN",		/* B7 */
+	"UNKNOWN",		/* B8 */
+	"UNKNOWN",		/* B9 */
+	"UNKNOWN",		/* BA */
+	"UNKNOWN",		/* BB */
+	"UNKNOWN",		/* BC */
+	"UNKNOWN",		/* BD */
+	"UNKNOWN",		/* BE */
+	"UNKNOWN",		/* BF */
+	"UNKNOWN",		/* C0 */
+	"UNKNOWN",		/* C1 */
+	"UNKNOWN",		/* C2 */
+	"UNKNOWN",		/* C3 */
+	"UNKNOWN",		/* C4 */
+	"UNKNOWN",		/* C5 */
+	"UNKNOWN",		/* C6 */
+	"UNKNOWN",		/* C7 */
+	"UNKNOWN",		/* C8 */
+	"UNKNOWN",		/* C9 */
+	"UNKNOWN",		/* CA */
+	"UNKNOWN",		/* CB */
+	"UNKNOWN",		/* CC */
+	"UNKNOWN",		/* CD */
+	"UNKNOWN",		/* CE */
+	"UNKNOWN",		/* CF */
+	"UNKNOWN",		/* D0 */
+	"UNKNOWN",		/* D1 */
+	"UNKNOWN",		/* D2 */
+	"UNKNOWN",		/* D3 */
+	"UNKNOWN",		/* D4 */
+	"UNKNOWN",		/* D5 */
+	"UNKNOWN",		/* D6 */
+	"UNKNOWN",		/* D7 */
+	"UNKNOWN",		/* D8 */
+	"UNKNOWN",		/* D9 */
+	"UNKNOWN",		/* DA */
+	"UNKNOWN",		/* DB */
+	"UNKNOWN",		/* DC */
+	"UNKNOWN",		/* DD */
+	"UNKNOWN",		/* DE */
+	"UNKNOWN",		/* DF */
+	"UNKNOWN",		/* E0 */
+	"UNKNOWN",		/* E1 */
+	"UNKNOWN",		/* E2 */
+	"UNKNOWN",		/* E3 */
+	"UNKNOWN",		/* E4 */
+	"UNKNOWN",		/* E5 */
+	"UNKNOWN",		/* E6 */
+	"UNKNOWN",		/* E7 */
+	"UNKNOWN",		/* E8 */
+	"UNKNOWN",		/* E9 */
+	"UNKNOWN",		/* EA */
+	"UNKNOWN",		/* EB */
+	"UNKNOWN",		/* EC */
+	"UNKNOWN",		/* ED */
+	"UNKNOWN",		/* EE */
+	"UNKNOWN",		/* EF */
+	"UNKNOWN",		/* F0 */
+	"UNKNOWN",		/* F1 */
+	"UNKNOWN",		/* F2 */
+	"InformInfoRecord",	/* F3 */
+	"UNKNOWN"		/* F4 - always highest value */
 };
 
 #define OSM_SA_ATTR_STR_UNKNOWN_VAL 0xF4
 
-
 /**********************************************************************
  **********************************************************************/
-const char*
-ib_get_sa_method_str(
-  IN uint8_t method )
+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  )
-      method = OSM_SA_METHOD_STR_UNKNOWN_VAL;
-    /* it is a response - use the response table */
-    return( __ib_sa_resp_method_str[method] );
-  }
-  else
-  {
-    if( method >= OSM_SA_METHOD_STR_UNKNOWN_VAL  )
-      method = OSM_SA_METHOD_STR_UNKNOWN_VAL;
-    return( __ib_sa_method_str[method] );
-  }
+	if (method & 0x80) {
+		method = method & 0x7f;
+		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]);
+	} else {
+		if (method >= OSM_SA_METHOD_STR_UNKNOWN_VAL)
+			method = OSM_SA_METHOD_STR_UNKNOWN_VAL;
+		return (__ib_sa_method_str[method]);
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
-const char*
-ib_get_sm_method_str(
-  IN uint8_t method )
+const char *ib_get_sm_method_str(IN uint8_t method)
 {
-  if (method & 0x80) method = (method & 0x0F) | 0x10;
-  if( method >= OSM_SM_METHOD_STR_UNKNOWN_VAL  )
-    method = OSM_SM_METHOD_STR_UNKNOWN_VAL;
-  return( __ib_sm_method_str[method] );
+	if (method & 0x80)
+		method = (method & 0x0F) | 0x10;
+	if (method >= OSM_SM_METHOD_STR_UNKNOWN_VAL)
+		method = OSM_SM_METHOD_STR_UNKNOWN_VAL;
+	return (__ib_sm_method_str[method]);
 }
 
 /**********************************************************************
  **********************************************************************/
-const char*
-ib_get_sm_attr_str(
-  IN ib_net16_t attr )
+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;
+	host_attr = cl_ntoh16(attr);
 
-  if( host_attr >= OSM_SM_ATTR_STR_UNKNOWN_VAL  )
-    host_attr = OSM_SM_ATTR_STR_UNKNOWN_VAL;
+	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 )
+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;
+	host_attr = cl_ntoh16(attr);
 
-  if( host_attr >= OSM_SA_ATTR_STR_UNKNOWN_VAL  )
-    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]);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_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 )
+osm_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)
 {
-  char line[LINE_LENGTH];
-  uint32_t len;
-
-  sprintf( line, "%s%s", p_prefix_str, p_new_str );
-  len = (uint32_t) strlen( line );
-  *p_total_len += len;
-  if( *p_total_len + sizeof('\0') > buf_size )
-    return( IB_INSUFFICIENT_MEMORY );
-
-  strcpy( *pp_local, line );
-  *pp_local += len;
-  return( IB_SUCCESS );
+	char line[LINE_LENGTH];
+	uint32_t len;
+
+	sprintf(line, "%s%s", p_prefix_str, p_new_str);
+	len = (uint32_t) strlen(line);
+	*p_total_len += len;
+	if (*p_total_len + sizeof('\0') > buf_size)
+		return (IB_INSUFFICIENT_MEMORY);
+
+	strcpy(*pp_local, line);
+	*pp_local += len;
+	return (IB_SUCCESS);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-osm_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 )
+osm_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)
 {
-  uint32_t total_len = 0;
-  char *p_local = p_buf;
-
-  strcpy( p_local, "Capability Mask:\n" );
-  p_local += strlen( p_local );
-
-  if( p_pi->capability_mask & IB_PORT_CAP_RESV0 )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_RESV0\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_IS_SM )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_IS_SM\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_NOTICE )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_NOTICE\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_TRAP )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_TRAP\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_IPD )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_IPD\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_AUTO_MIG )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_AUTO_MIG\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_SL_MAP )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_SL_MAP\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_NV_MKEY )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_NV_MKEY\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_NV_PKEY )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_NV_PKEY\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_LED_INFO )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_LED_INFO\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_SM_DISAB )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_SM_DISAB\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_SYS_IMG_GUID )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_SYS_IMG_GUID\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_PKEY_SW_EXT_PORT_TRAP )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_PKEY_SW_EXT_PORT_TRAP\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_RESV13 )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_RESV13\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_RESV14 )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_RESV14\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_RESV15 )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_RESV15\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_COM_MGT )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_COM_MGT\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_SNMP )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_SNMP\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_REINIT )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_REINIT\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_DEV_MGT )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_DEV_MGT\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_VEND_CLS )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_VEND_CLS\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_DR_NTC )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_DR_NTC\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_CAP_NTC )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_CAP_NTC\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_BM )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_BM\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_LINK_RT_LATENCY )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_LINK_RT_LATENCY\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_HAS_CLIENT_REREG )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_HAS_CLIENT_REREG\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_RESV26 )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_RESV26\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_RESV27 )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_RESV27\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_RESV28)
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_RESV28\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_RESV29 )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_RESV29\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_RESV30 )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_RESV30\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
-  if( p_pi->capability_mask & IB_PORT_CAP_RESV31 )
-  {
-    if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_RESV31\n", &total_len ) != IB_SUCCESS )
-      return;
-  }
+	uint32_t total_len = 0;
+	char *p_local = p_buf;
+
+	strcpy(p_local, "Capability Mask:\n");
+	p_local += strlen(p_local);
+
+	if (p_pi->capability_mask & IB_PORT_CAP_RESV0) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_RESV0\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_IS_SM) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_IS_SM\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_NOTICE) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_NOTICE\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_TRAP) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_TRAP\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_IPD) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_IPD\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_AUTO_MIG) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_AUTO_MIG\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_SL_MAP) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_SL_MAP\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_NV_MKEY) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_NV_MKEY\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_NV_PKEY) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_NV_PKEY\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_LED_INFO) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_LED_INFO\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_SM_DISAB) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_SM_DISAB\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_SYS_IMG_GUID) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_SYS_IMG_GUID\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_PKEY_SW_EXT_PORT_TRAP) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_PKEY_SW_EXT_PORT_TRAP\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_RESV13) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_RESV13\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_RESV14) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_RESV14\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_RESV15) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_RESV15\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_COM_MGT) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_COM_MGT\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_SNMP) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_SNMP\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_REINIT) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_REINIT\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_DEV_MGT) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_DEV_MGT\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_VEND_CLS) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_VEND_CLS\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_DR_NTC) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_DR_NTC\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_CAP_NTC) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_CAP_NTC\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_BM) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_BM\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_LINK_RT_LATENCY) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_LINK_RT_LATENCY\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_HAS_CLIENT_REREG) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_HAS_CLIENT_REREG\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_RESV26) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_RESV26\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_RESV27) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_RESV27\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_RESV28) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_RESV28\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_RESV29) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_RESV29\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_RESV30) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_RESV30\n",
+				    &total_len) != IB_SUCCESS)
+			return;
+	}
+	if (p_pi->capability_mask & IB_PORT_CAP_RESV31) {
+		if (osm_dbg_do_line(&p_local, buf_size, p_prefix_str,
+				    "IB_PORT_CAP_RESV31\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 )
+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)
 {
-  char buf[BUF_SIZE];
-
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    osm_log( p_log, log_level,
-             "PortInfo dump:\n"
-             "\t\t\t\tport number.............0x%X\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................0x%X\n"
-             "\t\t\t\tmaster_sm_base_lid......0x%X\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..........0x%X\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 ),
-             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,
-             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,
-             ib_port_info_get_mpb( p_pi ),
-             ib_port_info_get_lmc( p_pi ),
-             p_pi->link_speed,
-             p_pi->mtu_smsl,
-             p_pi->vl_cap,
-             p_pi->vl_high_limit,
-             p_pi->vl_arb_high_cap,
-             p_pi->vl_arb_low_cap,
-             p_pi->mtu_cap,
-             p_pi->vl_stall_life,
-             p_pi->vl_enforce,
-             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_client_rereg( p_pi ),
-             ib_port_info_get_timeout( p_pi ),
-             p_pi->resp_time_value,
-             p_pi->error_threshold
-             );
-
-    /*  show the capabilities mask */
-    if( p_pi->capability_mask )
-    {
-      osm_dbg_get_capabilities_str( buf, BUF_SIZE, "\t\t\t\t", p_pi );
-      osm_log( p_log, log_level, "%s", buf );
-    }
-  }
+	char buf[BUF_SIZE];
+
+	if (osm_log_is_active(p_log, log_level)) {
+		osm_log(p_log, log_level,
+			"PortInfo dump:\n"
+			"\t\t\t\tport number.............0x%X\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................0x%X\n"
+			"\t\t\t\tmaster_sm_base_lid......0x%X\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..........0x%X\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),
+			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,
+			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,
+			ib_port_info_get_mpb(p_pi), ib_port_info_get_lmc(p_pi),
+			p_pi->link_speed, p_pi->mtu_smsl, p_pi->vl_cap,
+			p_pi->vl_high_limit, p_pi->vl_arb_high_cap,
+			p_pi->vl_arb_low_cap, p_pi->mtu_cap,
+			p_pi->vl_stall_life, p_pi->vl_enforce,
+			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_client_rereg(p_pi),
+			ib_port_info_get_timeout(p_pi), p_pi->resp_time_value,
+			p_pi->error_threshold);
+
+		/*  show the capabilities mask */
+		if (p_pi->capability_mask) {
+			osm_dbg_get_capabilities_str(buf, BUF_SIZE, "\t\t\t\t",
+						     p_pi);
+			osm_log(p_log, log_level, "%s", buf);
+		}
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 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 )
+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)
 {
-  char buf[BUF_SIZE];
-  const ib_port_info_t * const p_pi = &p_pir->port_info;
-
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    osm_log( p_log, log_level,
-             "PortInfo Record dump:\n"
-             "\t\t\t\tRID\n"
-             "\t\t\t\tEndPortLid..............0x%X\n"
-             "\t\t\t\tPortNum.................0x%X\n"
-             "\t\t\t\tReserved................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................0x%X\n"
-             "\t\t\t\tmaster_sm_base_lid......0x%X\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..........0x%X\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 ),
-             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,
-             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,
-             ib_port_info_get_mpb( p_pi ),
-             ib_port_info_get_lmc( p_pi ),
-             p_pi->link_speed,
-             p_pi->mtu_smsl,
-             p_pi->vl_cap,
-             p_pi->vl_high_limit,
-             p_pi->vl_arb_high_cap,
-             p_pi->vl_arb_low_cap,
-             p_pi->mtu_cap,
-             p_pi->vl_stall_life,
-             p_pi->vl_enforce,
-             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
-             );
-
-    /*  show the capabilities mask */
-    if( p_pi->capability_mask )
-    {
-      osm_dbg_get_capabilities_str( buf, BUF_SIZE, "\t\t\t\t", p_pi );
-      osm_log( p_log, log_level, "%s", buf );
-    }
-  }
+	char buf[BUF_SIZE];
+	const ib_port_info_t *const p_pi = &p_pir->port_info;
+
+	if (osm_log_is_active(p_log, log_level)) {
+		osm_log(p_log, log_level,
+			"PortInfo Record dump:\n"
+			"\t\t\t\tRID\n"
+			"\t\t\t\tEndPortLid..............0x%X\n"
+			"\t\t\t\tPortNum.................0x%X\n"
+			"\t\t\t\tReserved................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................0x%X\n"
+			"\t\t\t\tmaster_sm_base_lid......0x%X\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..........0x%X\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),
+			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,
+			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,
+			ib_port_info_get_mpb(p_pi), ib_port_info_get_lmc(p_pi),
+			p_pi->link_speed, p_pi->mtu_smsl, p_pi->vl_cap,
+			p_pi->vl_high_limit, p_pi->vl_arb_high_cap,
+			p_pi->vl_arb_low_cap, p_pi->mtu_cap,
+			p_pi->vl_stall_life, p_pi->vl_enforce,
+			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);
+
+		/*  show the capabilities mask */
+		if (p_pi->capability_mask) {
+			osm_dbg_get_capabilities_str(buf, BUF_SIZE, "\t\t\t\t",
+						     p_pi);
+			osm_log(p_log, log_level, "%s", buf);
+		}
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 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 )
+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)
 {
-  const ib_guid_info_t * const p_gi = &p_gir->guid_info;
-
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    osm_log( p_log, log_level,
-             "GUIDInfo Record dump:\n"
-             "\t\t\t\tRID\n"
-             "\t\t\t\tLid.....................0x%X\n"
-             "\t\t\t\tBlockNum................0x%X\n"
-             "\t\t\t\tReserved................0x%X\n"
-             "\t\t\t\tGUIDInfo dump:\n"
-             "\t\t\t\tReserved................0x%X\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",
-             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[6]),
-             cl_ntoh64(p_gi->guid[7])
-           );
-  }
+	const ib_guid_info_t *const p_gi = &p_gir->guid_info;
+
+	if (osm_log_is_active(p_log, log_level)) {
+		osm_log(p_log, log_level,
+			"GUIDInfo Record dump:\n"
+			"\t\t\t\tRID\n"
+			"\t\t\t\tLid.....................0x%X\n"
+			"\t\t\t\tBlockNum................0x%X\n"
+			"\t\t\t\tReserved................0x%X\n"
+			"\t\t\t\tGUIDInfo dump:\n"
+			"\t\t\t\tReserved................0x%X\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",
+			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[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 )
+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)
 {
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    osm_log( p_log, log_level,
-             "NodeInfo dump:\n"
-             "\t\t\t\tbase_version............0x%X\n"
-             "\t\t\t\tclass_version...........0x%X\n"
-             "\t\t\t\tnode_type...............%s\n"
-             "\t\t\t\tnum_ports...............0x%X\n"
-             "\t\t\t\tsys_guid................0x%016" PRIx64 "\n"
-             "\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
-             "\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
-             "\t\t\t\tpartition_cap...........0x%X\n"
-             "\t\t\t\tdevice_id...............0x%X\n"
-             "\t\t\t\trevision................0x%X\n"
-             "\t\t\t\tport_num................0x%X\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 ),
-             cl_ntoh64( p_ni->port_guid ),
-             cl_ntoh16( p_ni->partition_cap ),
-             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 ) )
-             );
-  }
+	if (osm_log_is_active(p_log, log_level)) {
+		osm_log(p_log, log_level,
+			"NodeInfo dump:\n"
+			"\t\t\t\tbase_version............0x%X\n"
+			"\t\t\t\tclass_version...........0x%X\n"
+			"\t\t\t\tnode_type...............%s\n"
+			"\t\t\t\tnum_ports...............0x%X\n"
+			"\t\t\t\tsys_guid................0x%016" PRIx64 "\n"
+			"\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
+			"\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
+			"\t\t\t\tpartition_cap...........0x%X\n"
+			"\t\t\t\tdevice_id...............0x%X\n"
+			"\t\t\t\trevision................0x%X\n"
+			"\t\t\t\tport_num................0x%X\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),
+			cl_ntoh64(p_ni->port_guid),
+			cl_ntoh16(p_ni->partition_cap),
+			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 )
+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)
 {
-  const ib_node_info_t * const p_ni = &p_nr->node_info;
-
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    char desc[sizeof(p_nr->node_desc.description) + 1];
-
-    memcpy(desc, p_nr->node_desc.description,
-           sizeof(p_nr->node_desc.description));
-    desc[sizeof(desc) - 1] = '\0';
-    osm_log( p_log, log_level,
-             "Node Record dump:\n"
-             "\t\t\t\tRID\n"
-             "\t\t\t\tLid.....................0x%X\n"
-             "\t\t\t\tReserved................0x%X\n"
-             "\t\t\t\tNodeInfo dump:\n"
-             "\t\t\t\tbase_version............0x%X\n"
-             "\t\t\t\tclass_version...........0x%X\n"
-             "\t\t\t\tnode_type...............%s\n"
-             "\t\t\t\tnum_ports...............0x%X\n"
-             "\t\t\t\tsys_guid................0x%016" PRIx64 "\n"
-             "\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
-             "\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
-             "\t\t\t\tpartition_cap...........0x%X\n"
-             "\t\t\t\tdevice_id...............0x%X\n"
-             "\t\t\t\trevision................0x%X\n"
-             "\t\t\t\tport_num................0x%X\n"
-             "\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_ntoh64( p_ni->port_guid ),
-             cl_ntoh16( p_ni->partition_cap ),
-             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
-             );
-  }
+	const ib_node_info_t *const p_ni = &p_nr->node_info;
+
+	if (osm_log_is_active(p_log, log_level)) {
+		char desc[sizeof(p_nr->node_desc.description) + 1];
+
+		memcpy(desc, p_nr->node_desc.description,
+		       sizeof(p_nr->node_desc.description));
+		desc[sizeof(desc) - 1] = '\0';
+		osm_log(p_log, log_level,
+			"Node Record dump:\n"
+			"\t\t\t\tRID\n"
+			"\t\t\t\tLid.....................0x%X\n"
+			"\t\t\t\tReserved................0x%X\n"
+			"\t\t\t\tNodeInfo dump:\n"
+			"\t\t\t\tbase_version............0x%X\n"
+			"\t\t\t\tclass_version...........0x%X\n"
+			"\t\t\t\tnode_type...............%s\n"
+			"\t\t\t\tnum_ports...............0x%X\n"
+			"\t\t\t\tsys_guid................0x%016" PRIx64 "\n"
+			"\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
+			"\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
+			"\t\t\t\tpartition_cap...........0x%X\n"
+			"\t\t\t\tdevice_id...............0x%X\n"
+			"\t\t\t\trevision................0x%X\n"
+			"\t\t\t\tport_num................0x%X\n"
+			"\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_ntoh64(p_ni->port_guid),
+			cl_ntoh16(p_ni->partition_cap),
+			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 )
+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)
 {
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    osm_log( p_log, log_level,
-             "PathRecord dump:\n"
-             "\t\t\t\tresv0...................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\tdlid....................0x%X\n"
-             "\t\t\t\tslid....................0x%X\n"
-             "\t\t\t\thop_flow_raw............0x%X\n"
-             "\t\t\t\ttclass..................0x%X\n"
-             "\t\t\t\tnum_path_revers.........0x%X\n"
-             "\t\t\t\tpkey....................0x%X\n"
-             "\t\t\t\tsl......................0x%X\n"
-             "\t\t\t\tmtu.....................0x%X\n"
-             "\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"
-             "",
-             *(uint64_t*)p_pr->resv0,
-             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 ),
-             cl_ntoh16( p_pr->sl ),
-             p_pr->mtu,
-             p_pr->rate,
-             p_pr->pkt_life,
-             p_pr->preference,
-             *(uint32_t*)&p_pr->resv2,
-             *((uint16_t*)&p_pr->resv2 + 2)
-             );
-  }
+	if (osm_log_is_active(p_log, log_level)) {
+		osm_log(p_log, log_level,
+			"PathRecord dump:\n"
+			"\t\t\t\tresv0...................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\tdlid....................0x%X\n"
+			"\t\t\t\tslid....................0x%X\n"
+			"\t\t\t\thop_flow_raw............0x%X\n"
+			"\t\t\t\ttclass..................0x%X\n"
+			"\t\t\t\tnum_path_revers.........0x%X\n"
+			"\t\t\t\tpkey....................0x%X\n"
+			"\t\t\t\tsl......................0x%X\n"
+			"\t\t\t\tmtu.....................0x%X\n"
+			"\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"
+			"",
+			*(uint64_t *) p_pr->resv0,
+			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),
+			cl_ntoh16(p_pr->sl),
+			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 )
+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)
 {
-  char buf_line[1024];
-  ib_gid_t const *p_gid;
-  int i, n;
-
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    n = 0;
-    p_gid = p_mpr->gids;
-    if ( p_mpr->sgid_count )
-    {
-      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 ) );
-        p_gid++;
-      }
-    }
-    if ( p_mpr->dgid_count )
-    {
-      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 ) );
-        p_gid++;
-      }
-    }
-    osm_log( p_log, log_level,
-             "MultiPath Record dump:\n"
-             "\t\t\t\thop_flow_raw............0x%X\n"
-             "\t\t\t\ttclass..................0x%X\n"
-             "\t\t\t\tnum_path_revers.........0x%X\n"
-             "\t\t\t\tpkey....................0x%X\n"
-             "\t\t\t\tresv0...................0x%X\n"
-             "\t\t\t\tsl......................0x%X\n"
-             "\t\t\t\tmtu.....................0x%X\n"
-             "\t\t\t\trate....................0x%X\n"
-             "\t\t\t\tpkt_life................0x%X\n"
-             "\t\t\t\tresv1...................0x%X\n"
-             "\t\t\t\tindependence............0x%X\n"
-             "\t\t\t\tsgid_count..............0x%X\n"
-             "\t\t\t\tdgid_count..............0x%X\n"
-             "%s\n"
-             "",
-             cl_ntoh32( p_mpr->hop_flow_raw ),
-             p_mpr->tclass,
-             p_mpr->num_path,
-             cl_ntoh16( p_mpr->pkey ),
-             p_mpr->resv0,
-             cl_ntoh16( p_mpr->sl ),
-             p_mpr->mtu,
-             p_mpr->rate,
-             p_mpr->pkt_life,
-             p_mpr->resv1,
-             p_mpr->independence,
-             p_mpr->sgid_count,
-             p_mpr->dgid_count,
-             buf_line
-             );
-  }
+	char buf_line[1024];
+	ib_gid_t const *p_gid;
+	int i, n;
+
+	if (osm_log_is_active(p_log, log_level)) {
+		n = 0;
+		p_gid = p_mpr->gids;
+		if (p_mpr->sgid_count) {
+			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));
+				p_gid++;
+			}
+		}
+		if (p_mpr->dgid_count) {
+			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));
+				p_gid++;
+			}
+		}
+		osm_log(p_log, log_level,
+			"MultiPath Record dump:\n"
+			"\t\t\t\thop_flow_raw............0x%X\n"
+			"\t\t\t\ttclass..................0x%X\n"
+			"\t\t\t\tnum_path_revers.........0x%X\n"
+			"\t\t\t\tpkey....................0x%X\n"
+			"\t\t\t\tresv0...................0x%X\n"
+			"\t\t\t\tsl......................0x%X\n"
+			"\t\t\t\tmtu.....................0x%X\n"
+			"\t\t\t\trate....................0x%X\n"
+			"\t\t\t\tpkt_life................0x%X\n"
+			"\t\t\t\tresv1...................0x%X\n"
+			"\t\t\t\tindependence............0x%X\n"
+			"\t\t\t\tsgid_count..............0x%X\n"
+			"\t\t\t\tdgid_count..............0x%X\n"
+			"%s\n"
+			"",
+			cl_ntoh32(p_mpr->hop_flow_raw),
+			p_mpr->tclass,
+			p_mpr->num_path,
+			cl_ntoh16(p_mpr->pkey),
+			p_mpr->resv0,
+			cl_ntoh16(p_mpr->sl),
+			p_mpr->mtu,
+			p_mpr->rate,
+			p_mpr->pkt_life,
+			p_mpr->resv1,
+			p_mpr->independence,
+			p_mpr->sgid_count, p_mpr->dgid_count, 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 )
+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)
 {
 
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    osm_log( p_log, log_level,
-             "MCMember Record dump:\n"
-             "\t\t\t\tMGID....................0x%016" PRIx64 " : "
-             "0x%016" PRIx64 "\n"
-             "\t\t\t\tPortGid.................0x%016" PRIx64 " : "
-             "0x%016" PRIx64 "\n"
-             "\t\t\t\tqkey....................0x%X\n"
-             "\t\t\t\tmlid....................0x%X\n"
-             "\t\t\t\tmtu.....................0x%X\n"
-             "\t\t\t\tTClass..................0x%X\n"
-             "\t\t\t\tpkey....................0x%X\n"
-             "\t\t\t\trate....................0x%X\n"
-             "\t\t\t\tpkt_life................0x%X\n"
-             "\t\t\t\tSLFlowLabelHopLimit.....0x%X\n"
-             "\t\t\t\tScopeState..............0x%X\n"
-             "\t\t\t\tProxyJoin...............0x%X\n"
-             "",
-             cl_ntoh64( p_mcmr->mgid.unicast.prefix ),
-             cl_ntoh64( p_mcmr->mgid.unicast.interface_id ),
-             cl_ntoh64( p_mcmr->port_gid.unicast.prefix ),
-             cl_ntoh64( p_mcmr->port_gid.unicast.interface_id ),
-             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
-             );
-  }
+	if (osm_log_is_active(p_log, log_level)) {
+		osm_log(p_log, log_level,
+			"MCMember Record dump:\n"
+			"\t\t\t\tMGID....................0x%016" PRIx64 " : "
+			"0x%016" PRIx64 "\n"
+			"\t\t\t\tPortGid.................0x%016" PRIx64 " : "
+			"0x%016" PRIx64 "\n"
+			"\t\t\t\tqkey....................0x%X\n"
+			"\t\t\t\tmlid....................0x%X\n"
+			"\t\t\t\tmtu.....................0x%X\n"
+			"\t\t\t\tTClass..................0x%X\n"
+			"\t\t\t\tpkey....................0x%X\n"
+			"\t\t\t\trate....................0x%X\n"
+			"\t\t\t\tpkt_life................0x%X\n"
+			"\t\t\t\tSLFlowLabelHopLimit.....0x%X\n"
+			"\t\t\t\tScopeState..............0x%X\n"
+			"\t\t\t\tProxyJoin...............0x%X\n"
+			"",
+			cl_ntoh64(p_mcmr->mgid.unicast.prefix),
+			cl_ntoh64(p_mcmr->mgid.unicast.interface_id),
+			cl_ntoh64(p_mcmr->port_gid.unicast.prefix),
+			cl_ntoh64(p_mcmr->port_gid.unicast.interface_id),
+			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 )
+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)
 {
-  char buf_service_key[35];
-  char buf_service_name[65];
-
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    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[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,
-             "Service Record dump:\n"
-             "\t\t\t\tServiceID...............0x%016" PRIx64 "\n"
-             "\t\t\t\tServiceGID..............0x%016" PRIx64 " : "
-             "0x%016" PRIx64 "\n"
-             "\t\t\t\tServiceP_Key............0x%X\n"
-             "\t\t\t\tServiceLease............0x%X\n"
-             "\t\t\t\tServiceKey..............%s\n"
-             "\t\t\t\tServiceName.............%s\n"
-             "\t\t\t\tServiceData8.1..........0x%X\n"
-             "\t\t\t\tServiceData8.2..........0x%X\n"
-             "\t\t\t\tServiceData8.3..........0x%X\n"
-             "\t\t\t\tServiceData8.4..........0x%X\n"
-             "\t\t\t\tServiceData8.5..........0x%X\n"
-             "\t\t\t\tServiceData8.6..........0x%X\n"
-             "\t\t\t\tServiceData8.7..........0x%X\n"
-             "\t\t\t\tServiceData8.8..........0x%X\n"
-             "\t\t\t\tServiceData8.9..........0x%X\n"
-             "\t\t\t\tServiceData8.10.........0x%X\n"
-             "\t\t\t\tServiceData8.11.........0x%X\n"
-             "\t\t\t\tServiceData8.12.........0x%X\n"
-             "\t\t\t\tServiceData8.13.........0x%X\n"
-             "\t\t\t\tServiceData8.14.........0x%X\n"
-             "\t\t\t\tServiceData8.15.........0x%X\n"
-             "\t\t\t\tServiceData8.16.........0x%X\n"
-             "\t\t\t\tServiceData16.1.........0x%X\n"
-             "\t\t\t\tServiceData16.2.........0x%X\n"
-             "\t\t\t\tServiceData16.3.........0x%X\n"
-             "\t\t\t\tServiceData16.4.........0x%X\n"
-             "\t\t\t\tServiceData16.5.........0x%X\n"
-             "\t\t\t\tServiceData16.6.........0x%X\n"
-             "\t\t\t\tServiceData16.7.........0x%X\n"
-             "\t\t\t\tServiceData16.8.........0x%X\n"
-             "\t\t\t\tServiceData32.1.........0x%X\n"
-             "\t\t\t\tServiceData32.2.........0x%X\n"
-             "\t\t\t\tServiceData32.3.........0x%X\n"
-             "\t\t\t\tServiceData32.4.........0x%X\n"
-             "\t\t\t\tServiceData64.1.........0x%016" PRIx64 "\n"
-             "\t\t\t\tServiceData64.2.........0x%016" PRIx64 "\n"
-             "",
-             cl_ntoh64( p_sr->service_id ),
-             cl_ntoh64( p_sr->service_gid.unicast.prefix ),
-             cl_ntoh64( p_sr->service_gid.unicast.interface_id ),
-             cl_ntoh16( p_sr->service_pkey ),
-             cl_ntoh32( p_sr->service_lease ),
-             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],
-             p_sr->service_data8[6], p_sr->service_data8[7],
-             p_sr->service_data8[8], p_sr->service_data8[9],
-             p_sr->service_data8[10], p_sr->service_data8[11],
-             p_sr->service_data8[12], p_sr->service_data8[13],
-             p_sr->service_data8[14], p_sr->service_data8[15],
-             cl_ntoh16(p_sr->service_data16[0]),
-             cl_ntoh16(p_sr->service_data16[1]),
-             cl_ntoh16(p_sr->service_data16[2]),
-             cl_ntoh16(p_sr->service_data16[3]),
-             cl_ntoh16(p_sr->service_data16[4]),
-             cl_ntoh16(p_sr->service_data16[5]),
-             cl_ntoh16(p_sr->service_data16[6]),
-             cl_ntoh16(p_sr->service_data16[7]),
-             cl_ntoh32(p_sr->service_data32[0]),
-             cl_ntoh32(p_sr->service_data32[1]),
-             cl_ntoh32(p_sr->service_data32[2]),
-             cl_ntoh32(p_sr->service_data32[3]),
-             cl_ntoh64(p_sr->service_data64[0]),
-             cl_ntoh64(p_sr->service_data64[1])
-             );
-  }
+	char buf_service_key[35];
+	char buf_service_name[65];
+
+	if (osm_log_is_active(p_log, log_level)) {
+		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[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,
+			"Service Record dump:\n"
+			"\t\t\t\tServiceID...............0x%016" PRIx64 "\n"
+			"\t\t\t\tServiceGID..............0x%016" PRIx64 " : "
+			"0x%016" PRIx64 "\n"
+			"\t\t\t\tServiceP_Key............0x%X\n"
+			"\t\t\t\tServiceLease............0x%X\n"
+			"\t\t\t\tServiceKey..............%s\n"
+			"\t\t\t\tServiceName.............%s\n"
+			"\t\t\t\tServiceData8.1..........0x%X\n"
+			"\t\t\t\tServiceData8.2..........0x%X\n"
+			"\t\t\t\tServiceData8.3..........0x%X\n"
+			"\t\t\t\tServiceData8.4..........0x%X\n"
+			"\t\t\t\tServiceData8.5..........0x%X\n"
+			"\t\t\t\tServiceData8.6..........0x%X\n"
+			"\t\t\t\tServiceData8.7..........0x%X\n"
+			"\t\t\t\tServiceData8.8..........0x%X\n"
+			"\t\t\t\tServiceData8.9..........0x%X\n"
+			"\t\t\t\tServiceData8.10.........0x%X\n"
+			"\t\t\t\tServiceData8.11.........0x%X\n"
+			"\t\t\t\tServiceData8.12.........0x%X\n"
+			"\t\t\t\tServiceData8.13.........0x%X\n"
+			"\t\t\t\tServiceData8.14.........0x%X\n"
+			"\t\t\t\tServiceData8.15.........0x%X\n"
+			"\t\t\t\tServiceData8.16.........0x%X\n"
+			"\t\t\t\tServiceData16.1.........0x%X\n"
+			"\t\t\t\tServiceData16.2.........0x%X\n"
+			"\t\t\t\tServiceData16.3.........0x%X\n"
+			"\t\t\t\tServiceData16.4.........0x%X\n"
+			"\t\t\t\tServiceData16.5.........0x%X\n"
+			"\t\t\t\tServiceData16.6.........0x%X\n"
+			"\t\t\t\tServiceData16.7.........0x%X\n"
+			"\t\t\t\tServiceData16.8.........0x%X\n"
+			"\t\t\t\tServiceData32.1.........0x%X\n"
+			"\t\t\t\tServiceData32.2.........0x%X\n"
+			"\t\t\t\tServiceData32.3.........0x%X\n"
+			"\t\t\t\tServiceData32.4.........0x%X\n"
+			"\t\t\t\tServiceData64.1.........0x%016" PRIx64 "\n"
+			"\t\t\t\tServiceData64.2.........0x%016" PRIx64 "\n"
+			"",
+			cl_ntoh64(p_sr->service_id),
+			cl_ntoh64(p_sr->service_gid.unicast.prefix),
+			cl_ntoh64(p_sr->service_gid.unicast.interface_id),
+			cl_ntoh16(p_sr->service_pkey),
+			cl_ntoh32(p_sr->service_lease),
+			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],
+			p_sr->service_data8[6], p_sr->service_data8[7],
+			p_sr->service_data8[8], p_sr->service_data8[9],
+			p_sr->service_data8[10], p_sr->service_data8[11],
+			p_sr->service_data8[12], p_sr->service_data8[13],
+			p_sr->service_data8[14], p_sr->service_data8[15],
+			cl_ntoh16(p_sr->service_data16[0]),
+			cl_ntoh16(p_sr->service_data16[1]),
+			cl_ntoh16(p_sr->service_data16[2]),
+			cl_ntoh16(p_sr->service_data16[3]),
+			cl_ntoh16(p_sr->service_data16[4]),
+			cl_ntoh16(p_sr->service_data16[5]),
+			cl_ntoh16(p_sr->service_data16[6]),
+			cl_ntoh16(p_sr->service_data16[7]),
+			cl_ntoh32(p_sr->service_data32[0]),
+			cl_ntoh32(p_sr->service_data32[1]),
+			cl_ntoh32(p_sr->service_data32[2]),
+			cl_ntoh32(p_sr->service_data32[3]),
+			cl_ntoh64(p_sr->service_data64[0]),
+			cl_ntoh64(p_sr->service_data64[1])
+		    );
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 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 )
+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)
 {
-  uint32_t qpn;
-  uint8_t  resp_time_val;
-
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-
-   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.........0x%X\n"
-               "\t\t\t\tlid_range_end...........0x%X\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.........0x%X\n"
-               "\t\t\t\tlid_range_end...........0x%X\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 ))
-               );
-    }
-  }
+	uint32_t qpn;
+	uint8_t resp_time_val;
+
+	if (osm_log_is_active(p_log, log_level)) {
+
+		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.........0x%X\n"
+				"\t\t\t\tlid_range_end...........0x%X\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.........0x%X\n"
+				"\t\t\t\tlid_range_end...........0x%X\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))
+			    );
+		}
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 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 )
+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)
 {
-  uint32_t qpn;
-  uint8_t  resp_time_val;
-
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-
-    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...........0x%016" PRIx64 " : "
-               "0x%016" PRIx64 "\n"
-               "\t\t\t\tSubscriberEnum..........0x%X\n"
-               "\t\t\t\tInformInfo dump:\n"
-               "\t\t\t\tgid.....................0x%016" PRIx64 " : 0x%016" PRIx64 "\n"
-               "\t\t\t\tlid_range_begin.........0x%X\n"
-               "\t\t\t\tlid_range_end...........0x%X\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_iir->subscriber_gid.unicast.prefix ),
-               cl_ntoh64( p_iir->subscriber_gid.unicast.interface_id ),
-               cl_ntoh16( p_iir->subscriber_enum ),
-               cl_ntoh64( p_iir->inform_info.gid.unicast.prefix ),
-               cl_ntoh64( p_iir->inform_info.gid.unicast.interface_id ),
-               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...........0x%016" PRIx64 " : "
-               "0x%016" PRIx64 "\n"
-               "\t\t\t\tSubscriberEnum..........0x%X\n"
-               "\t\t\t\tInformInfo dump:\n"
-               "\t\t\t\tgid.....................0x%016" PRIx64 " : 0x%016" PRIx64 "\n"
-               "\t\t\t\tlid_range_begin.........0x%X\n"
-               "\t\t\t\tlid_range_end...........0x%X\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_iir->subscriber_gid.unicast.prefix ),
-               cl_ntoh64( p_iir->subscriber_gid.unicast.interface_id ),
-               cl_ntoh16( p_iir->subscriber_enum ),
-               cl_ntoh64( p_iir->inform_info.gid.unicast.prefix ),
-               cl_ntoh64( p_iir->inform_info.gid.unicast.interface_id ),
-               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 ))
-               );
-    }
-  }
+	uint32_t qpn;
+	uint8_t resp_time_val;
+
+	if (osm_log_is_active(p_log, log_level)) {
+
+		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...........0x%016" PRIx64
+				" : " "0x%016" PRIx64 "\n"
+				"\t\t\t\tSubscriberEnum..........0x%X\n"
+				"\t\t\t\tInformInfo dump:\n"
+				"\t\t\t\tgid.....................0x%016" PRIx64
+				" : 0x%016" PRIx64 "\n"
+				"\t\t\t\tlid_range_begin.........0x%X\n"
+				"\t\t\t\tlid_range_end...........0x%X\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_iir->subscriber_gid.unicast.prefix),
+				cl_ntoh64(p_iir->subscriber_gid.unicast.
+					  interface_id),
+				cl_ntoh16(p_iir->subscriber_enum),
+				cl_ntoh64(p_iir->inform_info.gid.unicast.
+					  prefix),
+				cl_ntoh64(p_iir->inform_info.gid.unicast.
+					  interface_id),
+				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...........0x%016" PRIx64
+				" : " "0x%016" PRIx64 "\n"
+				"\t\t\t\tSubscriberEnum..........0x%X\n"
+				"\t\t\t\tInformInfo dump:\n"
+				"\t\t\t\tgid.....................0x%016" PRIx64
+				" : 0x%016" PRIx64 "\n"
+				"\t\t\t\tlid_range_begin.........0x%X\n"
+				"\t\t\t\tlid_range_end...........0x%X\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_iir->subscriber_gid.unicast.prefix),
+				cl_ntoh64(p_iir->subscriber_gid.unicast.
+					  interface_id),
+				cl_ntoh16(p_iir->subscriber_enum),
+				cl_ntoh64(p_iir->inform_info.gid.unicast.
+					  prefix),
+				cl_ntoh64(p_iir->inform_info.gid.unicast.
+					  interface_id),
+				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_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 )
+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)
 {
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    osm_log( p_log, log_level,
-             "Link Record dump:\n"
-             "\t\t\t\tfrom_lid................0x%X\n"
-             "\t\t\t\tfrom_port_num...........0x%X\n"
-             "\t\t\t\tto_port_num.............0x%X\n"
-             "\t\t\t\tto_lid..................0x%X\n"
-             "",
-             cl_ntoh16( p_lr->from_lid ),
-             p_lr->from_port_num,
-             p_lr->to_port_num,
-             cl_ntoh16( p_lr->to_lid )
-             );
-  }
+	if (osm_log_is_active(p_log, log_level)) {
+		osm_log(p_log, log_level,
+			"Link Record dump:\n"
+			"\t\t\t\tfrom_lid................0x%X\n"
+			"\t\t\t\tfrom_port_num...........0x%X\n"
+			"\t\t\t\tto_port_num.............0x%X\n"
+			"\t\t\t\tto_lid..................0x%X\n"
+			"",
+			cl_ntoh16(p_lr->from_lid),
+			p_lr->from_port_num,
+			p_lr->to_port_num, cl_ntoh16(p_lr->to_lid)
+		    );
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 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 )
+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)
 {
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    osm_log( p_log, OSM_LOG_VERBOSE,
-             "SwitchInfo dump:\n"
-             "\t\t\t\tlin_cap.................0x%X\n"
-             "\t\t\t\trand_cap................0x%X\n"
-             "\t\t\t\tmcast_cap...............0x%X\n"
-             "\t\t\t\tlin_top.................0x%X\n"
-             "\t\t\t\tdef_port................0x%X\n"
-             "\t\t\t\tdef_mcast_pri_port......0x%X\n"
-             "\t\t\t\tdef_mcast_not_port......0x%X\n"
-             "\t\t\t\tlife_state..............0x%X\n"
-             "\t\t\t\tlids_per_port...........0x%X\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,
-             cl_ntoh16( p_si->lids_per_port ),
-             cl_ntoh16( p_si->enforce_cap ),
-             p_si->flags
-             );
-  }
+	if (osm_log_is_active(p_log, log_level)) {
+		osm_log(p_log, OSM_LOG_VERBOSE,
+			"SwitchInfo dump:\n"
+			"\t\t\t\tlin_cap.................0x%X\n"
+			"\t\t\t\trand_cap................0x%X\n"
+			"\t\t\t\tmcast_cap...............0x%X\n"
+			"\t\t\t\tlin_top.................0x%X\n"
+			"\t\t\t\tdef_port................0x%X\n"
+			"\t\t\t\tdef_mcast_pri_port......0x%X\n"
+			"\t\t\t\tdef_mcast_not_port......0x%X\n"
+			"\t\t\t\tlife_state..............0x%X\n"
+			"\t\t\t\tlids_per_port...........0x%X\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,
+			cl_ntoh16(p_si->lids_per_port),
+			cl_ntoh16(p_si->enforce_cap), p_si->flags);
+	}
 }
 
-
 /**********************************************************************
  **********************************************************************/
 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 )
+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)
 {
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    osm_log( p_log, log_level,
-             "SwitchInfo Record dump:\n"
-             "\t\t\t\tRID\n"
-             "\t\t\t\tlid.....................0x%X\n"
-             "\t\t\t\tSwitchInfo dump:\n"
-             "\t\t\t\tlin_cap.................0x%X\n"
-             "\t\t\t\trand_cap................0x%X\n"
-             "\t\t\t\tmcast_cap...............0x%X\n"
-             "\t\t\t\tlin_top.................0x%X\n"
-             "\t\t\t\tdef_port................0x%X\n"
-             "\t\t\t\tdef_mcast_pri_port......0x%X\n"
-             "\t\t\t\tdef_mcast_not_port......0x%X\n"
-             "\t\t\t\tlife_state..............0x%X\n"
-             "\t\t\t\tlids_per_port...........0x%X\n"
-             "\t\t\t\tpartition_enf_cap.......0x%X\n"
-             "\t\t\t\tflags...................0x%X\n"
-             "",
-             cl_ntoh16( p_sir->lid ),
-             cl_ntoh16( p_sir->switch_info.lin_cap ),
-             cl_ntoh16( p_sir->switch_info.rand_cap ),
-             cl_ntoh16( p_sir->switch_info.mcast_cap ),
-             cl_ntoh16( p_sir->switch_info.lin_top ),
-             p_sir->switch_info.def_port,
-             p_sir->switch_info.def_mcast_pri_port,
-             p_sir->switch_info.def_mcast_not_port,
-             p_sir->switch_info.life_state,
-             cl_ntoh16( p_sir->switch_info.lids_per_port ),
-             cl_ntoh16( p_sir->switch_info.enforce_cap ),
-             p_sir->switch_info.flags
-           );
-  }
+	if (osm_log_is_active(p_log, log_level)) {
+		osm_log(p_log, log_level,
+			"SwitchInfo Record dump:\n"
+			"\t\t\t\tRID\n"
+			"\t\t\t\tlid.....................0x%X\n"
+			"\t\t\t\tSwitchInfo dump:\n"
+			"\t\t\t\tlin_cap.................0x%X\n"
+			"\t\t\t\trand_cap................0x%X\n"
+			"\t\t\t\tmcast_cap...............0x%X\n"
+			"\t\t\t\tlin_top.................0x%X\n"
+			"\t\t\t\tdef_port................0x%X\n"
+			"\t\t\t\tdef_mcast_pri_port......0x%X\n"
+			"\t\t\t\tdef_mcast_not_port......0x%X\n"
+			"\t\t\t\tlife_state..............0x%X\n"
+			"\t\t\t\tlids_per_port...........0x%X\n"
+			"\t\t\t\tpartition_enf_cap.......0x%X\n"
+			"\t\t\t\tflags...................0x%X\n"
+			"",
+			cl_ntoh16(p_sir->lid),
+			cl_ntoh16(p_sir->switch_info.lin_cap),
+			cl_ntoh16(p_sir->switch_info.rand_cap),
+			cl_ntoh16(p_sir->switch_info.mcast_cap),
+			cl_ntoh16(p_sir->switch_info.lin_top),
+			p_sir->switch_info.def_port,
+			p_sir->switch_info.def_mcast_pri_port,
+			p_sir->switch_info.def_mcast_not_port,
+			p_sir->switch_info.life_state,
+			cl_ntoh16(p_sir->switch_info.lids_per_port),
+			cl_ntoh16(p_sir->switch_info.enforce_cap),
+			p_sir->switch_info.flags);
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 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 )
+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)
 {
-  char buf_line[1024];
-  int i, n;
-
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    for (i = 0, n = 0; i < 32; i++)
-      n += sprintf( buf_line + n," 0x%04x |",
-                    cl_ntoh16(p_pkey_tbl->pkey_entry[i]));
-
-    osm_log( p_log, log_level,
-             "P_Key table dump:\n"
-             "\t\t\tport_guid...........0x%016" PRIx64 "\n"
-             "\t\t\tblock_num...........0x%X\n"
-             "\t\t\tport_num............0x%X\n\tP_Key Table: %s\n",
-             cl_ntoh64( port_guid ),
-             block_num,
-             port_num,
-             buf_line
-             );
-  }
+	char buf_line[1024];
+	int i, n;
+
+	if (osm_log_is_active(p_log, log_level)) {
+		for (i = 0, n = 0; i < 32; i++)
+			n += sprintf(buf_line + n, " 0x%04x |",
+				     cl_ntoh16(p_pkey_tbl->pkey_entry[i]));
+
+		osm_log(p_log, log_level,
+			"P_Key table dump:\n"
+			"\t\t\tport_guid...........0x%016" PRIx64 "\n"
+			"\t\t\tblock_num...........0x%X\n"
+			"\t\t\tport_num............0x%X\n\tP_Key Table: %s\n",
+			cl_ntoh64(port_guid), block_num, port_num, buf_line);
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 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 )
+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)
 {
-  char buf_line1[1024];
-  char buf_line2[1024];
-  int n;
-  uint8_t i;
-
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    for (i = 0, n = 0; i < 16; i++)
-      n += sprintf( buf_line1 + n," %-2u |", i);
-    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,
-             "SLtoVL dump:\n"
-             "\t\t\tport_guid............0x%016" PRIx64 "\n"
-             "\t\t\tin_port_num..........0x%X\n"
-             "\t\t\tout_port_num.........0x%X\n\tSL: | %s\n\tVL: | %s\n",
-             cl_ntoh64( port_guid ),
-             in_port_num,
-             out_port_num,
-             buf_line1, buf_line2
-             );
-  }
+	char buf_line1[1024];
+	char buf_line2[1024];
+	int n;
+	uint8_t i;
+
+	if (osm_log_is_active(p_log, log_level)) {
+		for (i = 0, n = 0; i < 16; i++)
+			n += sprintf(buf_line1 + n, " %-2u |", i);
+		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,
+			"SLtoVL dump:\n"
+			"\t\t\tport_guid............0x%016" PRIx64 "\n"
+			"\t\t\tin_port_num..........0x%X\n"
+			"\t\t\tout_port_num.........0x%X\n\tSL: | %s\n\tVL: | %s\n",
+			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 )
+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)
 {
-  char buf_line1[1024];
-  char buf_line2[1024];
-  int i, n;
-
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    for (i = 0, n = 0; i < 32; i++)
-      n += sprintf( buf_line1 + n," 0x%01X |", p_vla_tbl->vl_entry[i].vl);
-    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,
-             "VLArb dump:\n"
-             "\t\t\tport_guid...........0x%016" PRIx64 "\n"
-             "\t\t\tblock_num...........0x%X\n"
-             "\t\t\tport_num............0x%X\n\tVL    : | %s\n\tWEIGHT:| %s\n",
-             cl_ntoh64( port_guid ),
-             block_num,
-             port_num,
-             buf_line1, buf_line2
-             );
-  }
+	char buf_line1[1024];
+	char buf_line2[1024];
+	int i, n;
+
+	if (osm_log_is_active(p_log, log_level)) {
+		for (i = 0, n = 0; i < 32; i++)
+			n += sprintf(buf_line1 + n, " 0x%01X |",
+				     p_vla_tbl->vl_entry[i].vl);
+		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,
+			"VLArb dump:\n" "\t\t\tport_guid...........0x%016"
+			PRIx64 "\n" "\t\t\tblock_num...........0x%X\n"
+			"\t\t\tport_num............0x%X\n\tVL    : | %s\n\tWEIGHT:| %s\n",
+			cl_ntoh64(port_guid), block_num, port_num, buf_line1,
+			buf_line2);
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 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 )
+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)
 {
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    osm_log( p_log, OSM_LOG_DEBUG,
-             "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_ntoh32( p_smi->act_count ),
-             ib_sminfo_get_priority( p_smi ),
-             ib_sminfo_get_state( p_smi )
-             );
-  }
+	if (osm_log_is_active(p_log, log_level)) {
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"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_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 )
+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)
 {
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    osm_log( p_log, OSM_LOG_DEBUG,
-             "SMInfo Record dump:\n"
-             "\t\t\t\tRID\n"
-             "\t\t\t\tLid.....................0x%X\n"
-             "\t\t\t\tReserved................0x%X\n"
-             "\t\t\t\tSMInfo 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_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 ),
-             ib_sminfo_get_priority( &p_smir->sm_info ),
-             ib_sminfo_get_state( &p_smir->sm_info )
-             );
-  }
+	if (osm_log_is_active(p_log, log_level)) {
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"SMInfo Record dump:\n"
+			"\t\t\t\tRID\n"
+			"\t\t\t\tLid.....................0x%X\n"
+			"\t\t\t\tReserved................0x%X\n"
+			"\t\t\t\tSMInfo 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_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),
+			ib_sminfo_get_priority(&p_smir->sm_info),
+			ib_sminfo_get_state(&p_smir->sm_info)
+		    );
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 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 )
+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)
 {
-  char buff[1024];
-  buff[0] = '\0';
-
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    if (ib_notice_is_generic(p_ntci))
-    {
-      /* 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...................0x%04X\n",
-                cl_ntoh16(p_ntci->data_details.ntc_128.sw_lid));
-        break;
-      case 129:
-      case 130:
-      case 131:
-        sprintf(buff,
-                "\t\t\t\tlid......................0x%04X\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......................0x%04x\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......................0x%04X\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;
-      }
-
-      osm_log( p_log, log_level,
-               "Generic Notice dump:\n"
-               "\t\t\t\ttype.....................0x%02X\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.....................0x%04x\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)
-               );
-    }
-  }
+	char buff[1024];
+	buff[0] = '\0';
+
+	if (osm_log_is_active(p_log, log_level)) {
+		if (ib_notice_is_generic(p_ntci)) {
+			/* 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...................0x%04X\n",
+					cl_ntoh16(p_ntci->data_details.ntc_128.
+						  sw_lid));
+				break;
+			case 129:
+			case 130:
+			case 131:
+				sprintf(buff,
+					"\t\t\t\tlid......................0x%04X\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......................0x%04x\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......................0x%04X\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;
+			}
+
+			osm_log(p_log, log_level,
+				"Generic Notice dump:\n"
+				"\t\t\t\ttype.....................0x%02X\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.....................0x%04x\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_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 )
+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)
 {
-  uint32_t i;
-  char buf[BUF_SIZE];
-  char line[BUF_SIZE];
-
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    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 (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 );
-
-    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 );
-
-    if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR)
-    {
-      sprintf( line,
-               "\t\t\t\tdr_slid.................0x%X\n"
-               "\t\t\t\tdr_dlid.................0x%X\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 );
-      }
-
-      strcat( buf, "\n\t\t\t\tReturn path:  " );
-
-      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 );
-      }
-
-      strcat( buf, "\n\t\t\t\tReserved:     " );
-
-      for( i = 0; i < 7; i++ )
-      {
-        sprintf( line, "[%0X]", p_smp->resv1[i] );
-        strcat( buf, line );
-      }
-
-      strcat( buf, "\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 );
-      }
-    }
-    else
-    {
-      /* not a Direct Route so provide source and destination lids */
-      strcat(buf, "\t\t\t\tMAD IS LID ROUTED\n");
-    }
-
-    osm_log( p_log, log_level, "%s\n", buf );
-
-  }
+	uint32_t i;
+	char buf[BUF_SIZE];
+	char line[BUF_SIZE];
+
+	if (osm_log_is_active(p_log, log_level)) {
+		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 (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);
+
+		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);
+
+		if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {
+			sprintf(line,
+				"\t\t\t\tdr_slid.................0x%X\n"
+				"\t\t\t\tdr_dlid.................0x%X\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);
+			}
+
+			strcat(buf, "\n\t\t\t\tReturn path:  ");
+
+			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);
+			}
+
+			strcat(buf, "\n\t\t\t\tReserved:     ");
+
+			for (i = 0; i < 7; i++) {
+				sprintf(line, "[%0X]", p_smp->resv1[i]);
+				strcat(buf, line);
+			}
+
+			strcat(buf, "\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);
+			}
+		} else {
+			/* not a Direct Route so provide source and destination lids */
+			strcat(buf, "\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 )
+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)
 {
-  char buf[BUF_SIZE];
-
-  /* make sure the mad is valid */
-  if (p_mad == NULL)
-  {
-    osm_log( p_log, log_level,
-             "NULL MAD POINTER\n");
-    return;
-  }
-
-  if( osm_log_is_active( p_log, log_level ) )
-  {
-    sprintf( buf,
-             "SA MAD 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"
-             "\t\t\t\tstatus..................0x%X\n"
-             "\t\t\t\tresv....................0x%X\n"
-             "\t\t\t\ttrans_id................0x%" PRIx64 "\n"
-             "\t\t\t\tattr_id.................0x%X (%s)\n"
-             "\t\t\t\tresv1...................0x%X\n"
-             "\t\t\t\tattr_mod................0x%X\n"
-             "\t\t\t\trmpp_version............0x%X\n"
-             "\t\t\t\trmpp_type...............0x%X\n"
-             "\t\t\t\trmpp_flags..............0x%X\n"
-             "\t\t\t\trmpp_status.............0x%X\n"
-             "\t\t\t\tseg_num.................0x%X\n"
-             "\t\t\t\tpayload_len/new_win.....0x%X\n"
-             "\t\t\t\tsm_key..................0x%016" PRIx64 "\n"
-             "\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->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),
-             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_ntoh32(p_mad->seg_num),
-             cl_ntoh32(p_mad->paylen_newwin),
-             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" );
-
-    osm_log( p_log, log_level, "%s\n", buf );
-  }
+	char buf[BUF_SIZE];
+
+	/* make sure the mad is valid */
+	if (p_mad == NULL) {
+		osm_log(p_log, log_level, "NULL MAD POINTER\n");
+		return;
+	}
+
+	if (osm_log_is_active(p_log, log_level)) {
+		sprintf(buf,
+			"SA MAD 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"
+			"\t\t\t\tstatus..................0x%X\n"
+			"\t\t\t\tresv....................0x%X\n"
+			"\t\t\t\ttrans_id................0x%" PRIx64 "\n"
+			"\t\t\t\tattr_id.................0x%X (%s)\n"
+			"\t\t\t\tresv1...................0x%X\n"
+			"\t\t\t\tattr_mod................0x%X\n"
+			"\t\t\t\trmpp_version............0x%X\n"
+			"\t\t\t\trmpp_type...............0x%X\n"
+			"\t\t\t\trmpp_flags..............0x%X\n"
+			"\t\t\t\trmpp_status.............0x%X\n"
+			"\t\t\t\tseg_num.................0x%X\n"
+			"\t\t\t\tpayload_len/new_win.....0x%X\n"
+			"\t\t\t\tsm_key..................0x%016" PRIx64 "\n"
+			"\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->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),
+			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_ntoh32(p_mad->seg_num),
+			cl_ntoh32(p_mad->paylen_newwin),
+			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");
+
+		osm_log(p_log, log_level, "%s\n", 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)
+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)
 {
-  uint32_t i;
-  char buf[BUF_SIZE];
-  char line[BUF_SIZE];
-
-  if( osm_log_is_active( p_log, log_level) )
-  {
-    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 );
-  }
+	uint32_t i;
+	char buf[BUF_SIZE];
+	char line[BUF_SIZE];
+
+	if (osm_log_is_active(p_log, log_level)) {
+		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);
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 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
-  )
+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)
 {
-  uint32_t i;
-  char buf[BUF_SIZE];
-  char line[BUF_SIZE];
-
-  if( osm_log_is_active( p_log, log_level) )
-  {
-    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 );
-    }
-
-    strcat( buf, "\n\t\t\t\tReturn path  = " );
-
-    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, "%s\n", buf );
-  }
+	uint32_t i;
+	char buf[BUF_SIZE];
+	char line[BUF_SIZE];
+
+	if (osm_log_is_active(p_log, log_level)) {
+		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);
+		}
+
+		strcat(buf, "\n\t\t\t\tReturn path  = ");
+
+		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, "%s\n", buf);
+	}
 }
 
-const char* const __osm_sm_state_str[] =
-{
-  "OSM_SM_STATE_NO_STATE",                    /* 0 */
-  "OSM_SM_STATE_INIT",                        /* 1 */
-  "OSM_SM_STATE_IDLE",                        /* 2 */
-  "OSM_SM_STATE_SWEEP_LIGHT",                 /* 3 */
-  "OSM_SM_STATE_SWEEP_LIGHT_WAIT",            /* 4 */
-  "OSM_SM_STATE_SWEEP_HEAVY_SELF",            /* 5 */
-  "OSM_SM_STATE_SWEEP_HEAVY_SUBNET",          /* 6 */
-  "OSM_SM_STATE_SET_SM_UCAST_LID",            /* 7 */
-  "OSM_SM_STATE_SET_SM_UCAST_LID_WAIT",       /* 8 */
-  "OSM_SM_STATE_SET_SM_UCAST_LID_DONE",       /* 9 */
-  "OSM_SM_STATE_SET_SUBNET_UCAST_LIDS",       /* 10 */
-  "OSM_SM_STATE_SET_SUBNET_UCAST_LIDS_WAIT",  /* 11 */
-  "OSM_SM_STATE_SET_SUBNET_UCAST_LIDS_DONE",  /* 12 */
-  "OSM_SM_STATE_SET_UCAST_TABLES",            /* 13 */
-  "OSM_SM_STATE_SET_UCAST_TABLES_WAIT",       /* 14 */
-  "OSM_SM_STATE_SET_UCAST_TABLES_DONE",       /* 15 */
-  "OSM_SM_STATE_SET_MCAST_TABLES",            /* 16 */
-  "OSM_SM_STATE_SET_MCAST_TABLES_WAIT",       /* 17 */
-  "OSM_SM_STATE_SET_MCAST_TABLES_DONE",       /* 18 */
-  "OSM_SM_STATE_SET_LINK_PORTS",              /* 19 */
-  "OSM_SM_STATE_SET_LINK_PORTS_WAIT",         /* 20 */
-  "OSM_SM_STATE_SET_LINK_PORTS_DONE",         /* 21 */
-  "OSM_SM_STATE_SET_ARMED",                   /* 22 */
-  "OSM_SM_STATE_SET_ARMED_WAIT",              /* 23 */
-  "OSM_SM_STATE_SET_ARMED_DONE",              /* 24 */
-  "OSM_SM_STATE_SET_ACTIVE",                  /* 25 */
-  "OSM_SM_STATE_SET_ACTIVE_WAIT",             /* 26 */
-  "OSM_SM_STATE_LOST_NEGOTIATION",            /* 27 */
-  "OSM_SM_STATE_STANDBY",                     /* 28 */
-  "OSM_SM_STATE_SUBNET_UP",                   /* 29 */
-  "OSM_SM_STATE_PROCESS_REQUEST",             /* 30 */
-  "OSM_SM_STATE_PROCESS_REQUEST_WAIT",        /* 31 */
-  "OSM_SM_STATE_PROCESS_REQUEST_DONE",        /* 32 */
-  "OSM_SM_STATE_MASTER_OR_HIGHER_SM_DETECTED",/* 33 */
-  "OSM_SM_STATE_SET_PKEY",                    /* 34 */
-  "OSM_SM_STATE_SET_PKEY_WAIT",               /* 35 */
-  "OSM_SM_STATE_SET_PKEY_DONE",               /* 36 */
-  "UNKNOWN STATE!!"                           /* 37 */
+const char *const __osm_sm_state_str[] = {
+	"OSM_SM_STATE_NO_STATE",	/* 0 */
+	"OSM_SM_STATE_INIT",	/* 1 */
+	"OSM_SM_STATE_IDLE",	/* 2 */
+	"OSM_SM_STATE_SWEEP_LIGHT",	/* 3 */
+	"OSM_SM_STATE_SWEEP_LIGHT_WAIT",	/* 4 */
+	"OSM_SM_STATE_SWEEP_HEAVY_SELF",	/* 5 */
+	"OSM_SM_STATE_SWEEP_HEAVY_SUBNET",	/* 6 */
+	"OSM_SM_STATE_SET_SM_UCAST_LID",	/* 7 */
+	"OSM_SM_STATE_SET_SM_UCAST_LID_WAIT",	/* 8 */
+	"OSM_SM_STATE_SET_SM_UCAST_LID_DONE",	/* 9 */
+	"OSM_SM_STATE_SET_SUBNET_UCAST_LIDS",	/* 10 */
+	"OSM_SM_STATE_SET_SUBNET_UCAST_LIDS_WAIT",	/* 11 */
+	"OSM_SM_STATE_SET_SUBNET_UCAST_LIDS_DONE",	/* 12 */
+	"OSM_SM_STATE_SET_UCAST_TABLES",	/* 13 */
+	"OSM_SM_STATE_SET_UCAST_TABLES_WAIT",	/* 14 */
+	"OSM_SM_STATE_SET_UCAST_TABLES_DONE",	/* 15 */
+	"OSM_SM_STATE_SET_MCAST_TABLES",	/* 16 */
+	"OSM_SM_STATE_SET_MCAST_TABLES_WAIT",	/* 17 */
+	"OSM_SM_STATE_SET_MCAST_TABLES_DONE",	/* 18 */
+	"OSM_SM_STATE_SET_LINK_PORTS",	/* 19 */
+	"OSM_SM_STATE_SET_LINK_PORTS_WAIT",	/* 20 */
+	"OSM_SM_STATE_SET_LINK_PORTS_DONE",	/* 21 */
+	"OSM_SM_STATE_SET_ARMED",	/* 22 */
+	"OSM_SM_STATE_SET_ARMED_WAIT",	/* 23 */
+	"OSM_SM_STATE_SET_ARMED_DONE",	/* 24 */
+	"OSM_SM_STATE_SET_ACTIVE",	/* 25 */
+	"OSM_SM_STATE_SET_ACTIVE_WAIT",	/* 26 */
+	"OSM_SM_STATE_LOST_NEGOTIATION",	/* 27 */
+	"OSM_SM_STATE_STANDBY",	/* 28 */
+	"OSM_SM_STATE_SUBNET_UP",	/* 29 */
+	"OSM_SM_STATE_PROCESS_REQUEST",	/* 30 */
+	"OSM_SM_STATE_PROCESS_REQUEST_WAIT",	/* 31 */
+	"OSM_SM_STATE_PROCESS_REQUEST_DONE",	/* 32 */
+	"OSM_SM_STATE_MASTER_OR_HIGHER_SM_DETECTED",	/* 33 */
+	"OSM_SM_STATE_SET_PKEY",	/* 34 */
+	"OSM_SM_STATE_SET_PKEY_WAIT",	/* 35 */
+	"OSM_SM_STATE_SET_PKEY_DONE",	/* 36 */
+	"UNKNOWN STATE!!"	/* 37 */
 };
 
-const char* const __osm_sm_signal_str[] =
-{
-  "OSM_SIGNAL_NONE",                       /* 0 */
-  "OSM_SIGNAL_SWEEP",                      /* 1 */
-  "OSM_SIGNAL_CHANGE_DETECTED",               /* 2 */
-  "OSM_SIGNAL_NO_PENDING_TRANSACTIONS",       /* 3 */
-  "OSM_SIGNAL_DONE",                       /* 4 */
-  "OSM_SIGNAL_DONE_PENDING",                  /* 5 */
-  "OSM_SIGNAL_LOST_SM_NEGOTIATION",           /* 6 */
-  "OSM_SIGNAL_LIGHT_SWEEP_FAIL",              /* 7 */
-  "OSM_SIGNAL_IDLE_TIME_PROCESS",             /* 8 */
-  "OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST",        /* 9 */
-  "OSM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED",  /* 10 */
-  "OSM_SIGNAL_EXIT_STBY",                /* 11 */
-  "UNKNOWN SIGNAL!!"                       /* 12 */
+const char *const __osm_sm_signal_str[] = {
+	"OSM_SIGNAL_NONE",	/* 0 */
+	"OSM_SIGNAL_SWEEP",	/* 1 */
+	"OSM_SIGNAL_CHANGE_DETECTED",	/* 2 */
+	"OSM_SIGNAL_NO_PENDING_TRANSACTIONS",	/* 3 */
+	"OSM_SIGNAL_DONE",	/* 4 */
+	"OSM_SIGNAL_DONE_PENDING",	/* 5 */
+	"OSM_SIGNAL_LOST_SM_NEGOTIATION",	/* 6 */
+	"OSM_SIGNAL_LIGHT_SWEEP_FAIL",	/* 7 */
+	"OSM_SIGNAL_IDLE_TIME_PROCESS",	/* 8 */
+	"OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST",	/* 9 */
+	"OSM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED",	/* 10 */
+	"OSM_SIGNAL_EXIT_STBY",	/* 11 */
+	"UNKNOWN SIGNAL!!"	/* 12 */
 };
 
 /**********************************************************************
  **********************************************************************/
-const char*
-osm_get_sm_state_str(
-  IN osm_sm_state_t state )
+const char *osm_get_sm_state_str(IN osm_sm_state_t state)
 {
-  if( state > OSM_SM_STATE_MAX )
-    state = OSM_SM_STATE_MAX;
-  return( __osm_sm_state_str[state] );
+	if (state > OSM_SM_STATE_MAX)
+		state = OSM_SM_STATE_MAX;
+	return (__osm_sm_state_str[state]);
 }
 
 /**********************************************************************
  **********************************************************************/
-const char*
-osm_get_sm_signal_str(
-  IN osm_signal_t signal )
+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] );
+	if (signal > OSM_SIGNAL_MAX)
+		signal = OSM_SIGNAL_MAX;
+	return (__osm_sm_signal_str[signal]);
 }
 
 /**********************************************************************
  **********************************************************************/
 
-static const char* const __osm_disp_msg_str[] =
-{
-  "OSM_MSG_NONE",
-  "OSM_MSG_MAD_NODE_INFO",
-  "OSM_MSG_MAD_PORT_INFO",
-  "OSM_MSG_MAD_SWITCH_INFO",
-  "OSM_MSG_MAD_NODE_DESC",
-  "OSM_MSG_NO_SMPS_OUTSTANDING",
-  "OSM_MSG_MAD_NODE_RECORD",
-  "OSM_MSG_MAD_PORTINFO_RECORD",
-  "OSM_MSG_MAD_SERVICE_RECORD",
-  "OSM_MSG_MAD_PATH_RECORD",
-  "OSM_MSG_MAD_MCMEMBER_RECORD",
-  "OSM_MSG_MAD_LINK_RECORD",
-  "OSM_MSG_MAD_SMINFO_RECORD",
-  "OSM_MSG_MAD_CLASS_PORT_INFO",
-  "OSM_MSG_MAD_INFORM_INFO",
-  "OSM_MSG_MAD_LFT_RECORD",
-  "OSM_MSG_MAD_LFT",
-  "OSM_MSG_MAD_SM_INFO",
-  "OSM_MSG_MAD_NOTICE",
-  "OSM_MSG_LIGHT_SWEEP_FAIL",
-  "OSM_MSG_MAD_MFT",
-  "OSM_MSG_MAD_PKEY_TBL_RECORD",
-  "OSM_MSG_MAD_VL_ARB_RECORD",
-  "OSM_MSG_MAD_SLVL_TBL_RECORD",
-  "OSM_MSG_MAD_PKEY",
-  "OSM_MSG_MAD_VL_ARB",
-  "OSM_MSG_MAD_SLVL",
-  "OSM_MSG_MAD_GUIDINFO_RECORD",
-  "OSM_MSG_MAD_INFORM_INFO_RECORD",
+static const char *const __osm_disp_msg_str[] = {
+	"OSM_MSG_NONE",
+	"OSM_MSG_MAD_NODE_INFO",
+	"OSM_MSG_MAD_PORT_INFO",
+	"OSM_MSG_MAD_SWITCH_INFO",
+	"OSM_MSG_MAD_NODE_DESC",
+	"OSM_MSG_NO_SMPS_OUTSTANDING",
+	"OSM_MSG_MAD_NODE_RECORD",
+	"OSM_MSG_MAD_PORTINFO_RECORD",
+	"OSM_MSG_MAD_SERVICE_RECORD",
+	"OSM_MSG_MAD_PATH_RECORD",
+	"OSM_MSG_MAD_MCMEMBER_RECORD",
+	"OSM_MSG_MAD_LINK_RECORD",
+	"OSM_MSG_MAD_SMINFO_RECORD",
+	"OSM_MSG_MAD_CLASS_PORT_INFO",
+	"OSM_MSG_MAD_INFORM_INFO",
+	"OSM_MSG_MAD_LFT_RECORD",
+	"OSM_MSG_MAD_LFT",
+	"OSM_MSG_MAD_SM_INFO",
+	"OSM_MSG_MAD_NOTICE",
+	"OSM_MSG_LIGHT_SWEEP_FAIL",
+	"OSM_MSG_MAD_MFT",
+	"OSM_MSG_MAD_PKEY_TBL_RECORD",
+	"OSM_MSG_MAD_VL_ARB_RECORD",
+	"OSM_MSG_MAD_SLVL_TBL_RECORD",
+	"OSM_MSG_MAD_PKEY",
+	"OSM_MSG_MAD_VL_ARB",
+	"OSM_MSG_MAD_SLVL",
+	"OSM_MSG_MAD_GUIDINFO_RECORD",
+	"OSM_MSG_MAD_INFORM_INFO_RECORD",
 #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
-  "OSM_MSG_MAD_MULTIPATH_RECORD",
+	"OSM_MSG_MAD_MULTIPATH_RECORD",
 #endif
-  "UNKNOWN!!"
+	"UNKNOWN!!"
 };
 
 /**********************************************************************
  **********************************************************************/
-const char*
-osm_get_disp_msg_str(
-  IN cl_disp_msgid_t msg )
+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] );
+	if (msg > OSM_MSG_MAX)
+		msg = OSM_MSG_MAX;
+	return (__osm_disp_msg_str[msg]);
 }
 
-static const char* const __osm_port_state_str_fixed_width[] =
-{
-  "NOC",
-  "DWN",
-  "INI",
-  "ARM",
-  "ACT",
-  "???"
+static const char *const __osm_port_state_str_fixed_width[] = {
+	"NOC",
+	"DWN",
+	"INI",
+	"ARM",
+	"ACT",
+	"???"
 };
 
 /**********************************************************************
  **********************************************************************/
-const char*
-osm_get_port_state_str_fixed_width(
-  IN uint8_t port_state )
+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] );
+	if (port_state > IB_LINK_ACTIVE)
+		port_state = IB_LINK_ACTIVE + 1;
+	return (__osm_port_state_str_fixed_width[port_state]);
 }
 
-static const char* const __osm_node_type_str_fixed_width[] =
-{
-  "??",
-  "CA",
-  "SW",
-  "RT",
+static const char *const __osm_node_type_str_fixed_width[] = {
+	"??",
+	"CA",
+	"SW",
+	"RT",
 };
 
 /**********************************************************************
  **********************************************************************/
-const char*
-osm_get_node_type_str_fixed_width(
-  IN uint8_t node_type )
+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] );
+	if (node_type > IB_NODE_TYPE_ROUTER)
+		node_type = 0;
+	return (__osm_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 const guid_ho)
 {
-  /* note that the max vendor string length is 11 */
-  static const char* intel_str         = "Intel";
-  static const char* mellanox_str      = "Mellanox";
-  static const char* redswitch_str     = "Redswitch";
-  static const char* silverstorm_str   = "SilverStorm";
-  static const char* topspin_str       = "Topspin";
-  static const char* fujitsu_str       = "Fujitsu";
-  static const char* voltaire_str      = "Voltaire";
-  static const char* yotta_str         = "YottaYotta";
-  static const char* pathscale_str     = "PathScale";
-  static const char* ibm_str           = "IBM";
-  static const char* divergenet_str    = "DivergeNet";
-  static const char* flextronics_str   = "Flextronics";
-  static const char* agilent_str       = "Agilent";
-  static const char* obsidian_str      = "Obsidian";
-  static const char* baymicro_str      = "BayMicro";
-  static const char* lsilogic_str      = "LSILogic";
-  static const char* ddn_str           = "DataDirect";
-  static const char* panta_str         = "Panta";
-  static const char* hp_str            = "HP";
-  static const char* rioworks_str      = "Rioworks";
-  static const char* sun_str           = "Sun";
-  static const char* leafntwks_str     = "3LeafNtwks";
-  static const char* xsigo_str         = "Xsigo";
-  static const char* unknown_str       = "Unknown";
-
-  switch( (uint32_t)(guid_ho >> (5 * 8)) )
-  {
-  case OSM_VENDOR_ID_INTEL:
-    return( intel_str );
-  case OSM_VENDOR_ID_MELLANOX:
-    return( mellanox_str );
-  case OSM_VENDOR_ID_REDSWITCH:
-    return( redswitch_str );
-  case OSM_VENDOR_ID_SILVERSTORM:
-    return( silverstorm_str );
-  case OSM_VENDOR_ID_TOPSPIN:
-    return( topspin_str );
-  case OSM_VENDOR_ID_FUJITSU:
-  case OSM_VENDOR_ID_FUJITSU2:
-    return( fujitsu_str );
-  case OSM_VENDOR_ID_VOLTAIRE:
-    return( voltaire_str );
-  case OSM_VENDOR_ID_YOTTAYOTTA:
-    return( yotta_str );
-  case OSM_VENDOR_ID_PATHSCALE:
-    return( pathscale_str );
-  case OSM_VENDOR_ID_IBM:
-    return( ibm_str );
-  case OSM_VENDOR_ID_DIVERGENET:
-    return( divergenet_str );
-  case OSM_VENDOR_ID_FLEXTRONICS:
-    return( flextronics_str );
-  case OSM_VENDOR_ID_AGILENT:
-    return( agilent_str );
-  case OSM_VENDOR_ID_OBSIDIAN:
-    return( obsidian_str );
-  case OSM_VENDOR_ID_BAYMICRO:
-    return( baymicro_str );
-  case OSM_VENDOR_ID_LSILOGIC:
-    return( lsilogic_str );
-  case OSM_VENDOR_ID_DDN:
-    return( ddn_str );
-  case OSM_VENDOR_ID_PANTA:
-    return( panta_str );
-  case OSM_VENDOR_ID_HP:
-    return( hp_str );
-  case OSM_VENDOR_ID_RIOWORKS:
-    return( rioworks_str );
-  case OSM_VENDOR_ID_SUN:
-    return( sun_str );
-  case OSM_VENDOR_ID_3LEAFNTWKS:
-    return( leafntwks_str );
-  case OSM_VENDOR_ID_XSIGO:
-    return( xsigo_str );
-  default:
-    return( unknown_str );
-  }
+	/* note that the max vendor string length is 11 */
+	static const char *intel_str = "Intel";
+	static const char *mellanox_str = "Mellanox";
+	static const char *redswitch_str = "Redswitch";
+	static const char *silverstorm_str = "SilverStorm";
+	static const char *topspin_str = "Topspin";
+	static const char *fujitsu_str = "Fujitsu";
+	static const char *voltaire_str = "Voltaire";
+	static const char *yotta_str = "YottaYotta";
+	static const char *pathscale_str = "PathScale";
+	static const char *ibm_str = "IBM";
+	static const char *divergenet_str = "DivergeNet";
+	static const char *flextronics_str = "Flextronics";
+	static const char *agilent_str = "Agilent";
+	static const char *obsidian_str = "Obsidian";
+	static const char *baymicro_str = "BayMicro";
+	static const char *lsilogic_str = "LSILogic";
+	static const char *ddn_str = "DataDirect";
+	static const char *panta_str = "Panta";
+	static const char *hp_str = "HP";
+	static const char *rioworks_str = "Rioworks";
+	static const char *sun_str = "Sun";
+	static const char *leafntwks_str = "3LeafNtwks";
+	static const char *xsigo_str = "Xsigo";
+	static const char *unknown_str = "Unknown";
+
+	switch ((uint32_t) (guid_ho >> (5 * 8))) {
+	case OSM_VENDOR_ID_INTEL:
+		return (intel_str);
+	case OSM_VENDOR_ID_MELLANOX:
+		return (mellanox_str);
+	case OSM_VENDOR_ID_REDSWITCH:
+		return (redswitch_str);
+	case OSM_VENDOR_ID_SILVERSTORM:
+		return (silverstorm_str);
+	case OSM_VENDOR_ID_TOPSPIN:
+		return (topspin_str);
+	case OSM_VENDOR_ID_FUJITSU:
+	case OSM_VENDOR_ID_FUJITSU2:
+		return (fujitsu_str);
+	case OSM_VENDOR_ID_VOLTAIRE:
+		return (voltaire_str);
+	case OSM_VENDOR_ID_YOTTAYOTTA:
+		return (yotta_str);
+	case OSM_VENDOR_ID_PATHSCALE:
+		return (pathscale_str);
+	case OSM_VENDOR_ID_IBM:
+		return (ibm_str);
+	case OSM_VENDOR_ID_DIVERGENET:
+		return (divergenet_str);
+	case OSM_VENDOR_ID_FLEXTRONICS:
+		return (flextronics_str);
+	case OSM_VENDOR_ID_AGILENT:
+		return (agilent_str);
+	case OSM_VENDOR_ID_OBSIDIAN:
+		return (obsidian_str);
+	case OSM_VENDOR_ID_BAYMICRO:
+		return (baymicro_str);
+	case OSM_VENDOR_ID_LSILOGIC:
+		return (lsilogic_str);
+	case OSM_VENDOR_ID_DDN:
+		return (ddn_str);
+	case OSM_VENDOR_ID_PANTA:
+		return (panta_str);
+	case OSM_VENDOR_ID_HP:
+		return (hp_str);
+	case OSM_VENDOR_ID_RIOWORKS:
+		return (rioworks_str);
+	case OSM_VENDOR_ID_SUN:
+		return (sun_str);
+	case OSM_VENDOR_ID_3LEAFNTWKS:
+		return (leafntwks_str);
+	case OSM_VENDOR_ID_XSIGO:
+		return (xsigo_str);
+	default:
+		return (unknown_str);
+	}
 }
 
-static const char* const __osm_mtu_str_fixed_width[] =
-{
-  "??? ",
-  "256 ",
-  "512 ",
-  "1024",
-  "2048",
-  "4096"
+static const char *const __osm_mtu_str_fixed_width[] = {
+	"??? ",
+	"256 ",
+	"512 ",
+	"1024",
+	"2048",
+	"4096"
 };
 
 /**********************************************************************
  **********************************************************************/
-const char*
-osm_get_mtu_str(
-  IN uint8_t               const mtu )
+const char *osm_get_mtu_str(IN uint8_t const mtu)
 {
-  if( mtu > IB_MTU_LEN_4096 )
-    return( __osm_mtu_str_fixed_width[0] );
-  else
-    return( __osm_mtu_str_fixed_width[mtu] );
+	if (mtu > IB_MTU_LEN_4096)
+		return (__osm_mtu_str_fixed_width[0]);
+	else
+		return (__osm_mtu_str_fixed_width[mtu]);
 }
 
-static const char* const __osm_lwa_str_fixed_width[] =
-{
-  "???",
-  "1x ",
-  "4x ",
-  "???",
-  "8x ",
-  "???",
-  "???",
-  "???",
-  "12x"
+static const char *const __osm_lwa_str_fixed_width[] = {
+	"???",
+	"1x ",
+	"4x ",
+	"???",
+	"8x ",
+	"???",
+	"???",
+	"???",
+	"12x"
 };
 
 /**********************************************************************
  **********************************************************************/
-const char*
-osm_get_lwa_str(
-  IN uint8_t               const lwa )
+const char *osm_get_lwa_str(IN uint8_t const lwa)
 {
-  if( lwa > 8 )
-    return( __osm_lwa_str_fixed_width[0] );
-  else
-    return( __osm_lwa_str_fixed_width[lwa] );
+	if (lwa > 8)
+		return (__osm_lwa_str_fixed_width[0]);
+	else
+		return (__osm_lwa_str_fixed_width[lwa]);
 }
 
 /**********************************************************************
  **********************************************************************/
-static const char* const __osm_lsa_str_fixed_width[] =
-{
-  "???",
-  "2.5",
-  "5  ",
-  "???",
-  "10 "
+static const char *const __osm_lsa_str_fixed_width[] = {
+	"???",
+	"2.5",
+	"5  ",
+	"???",
+	"10 "
 };
 
-const char*
-osm_get_lsa_str(
-  IN uint8_t               const lsa )
+const char *osm_get_lsa_str(IN uint8_t const lsa)
 {
-  if( lsa > 4 )
-    return( __osm_lsa_str_fixed_width[0] );
-  else
-    return( __osm_lsa_str_fixed_width[lsa] );
+	if (lsa > 4)
+		return (__osm_lsa_str_fixed_width[0]);
+	else
+		return (__osm_lsa_str_fixed_width[lsa]);
 }
 
 /**********************************************************************
  **********************************************************************/
 
-const char* const __osm_sm_mgr_signal_str[] =
-{
-  "OSM_SM_SIGNAL_INIT",                 /* 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_DONE",    /* 10 */
-  "OSM_SM_SIGNAL_WAIT_FOR_HANDOVER",     /* 11 */
-  "UNKNOWN STATE!!"                      /* 12 */
-
+const char *const __osm_sm_mgr_signal_str[] = {
+	"OSM_SM_SIGNAL_INIT",	/* 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_DONE",	/* 10 */
+	"OSM_SM_SIGNAL_WAIT_FOR_HANDOVER",	/* 11 */
+	"UNKNOWN STATE!!"	/* 12 */
 };
 
 /**********************************************************************
  **********************************************************************/
-const char*
-osm_get_sm_mgr_signal_str(
-  IN osm_sm_signal_t signal )
+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] );
+	if (signal > OSM_SM_SIGNAL_MAX)
+		signal = OSM_SM_SIGNAL_MAX;
+	return (__osm_sm_mgr_signal_str[signal]);
 }
 
-const char* const __osm_sm_mgr_state_str[] =
-{
-  "IB_SMINFO_STATE_NOTACTIVE",                /* 0 */
-  "IB_SMINFO_STATE_DISCOVERING",              /* 1 */
-  "IB_SMINFO_STATE_STANDBY",                     /* 2 */
-  "IB_SMINFO_STATE_MASTER",                   /* 3 */
-  "IB_SMINFO_STATE_INIT",                     /* 4 */
-  "UNKNOWN STATE!!"                              /* 5 */
-
+const char *const __osm_sm_mgr_state_str[] = {
+	"IB_SMINFO_STATE_NOTACTIVE",	/* 0 */
+	"IB_SMINFO_STATE_DISCOVERING",	/* 1 */
+	"IB_SMINFO_STATE_STANDBY",	/* 2 */
+	"IB_SMINFO_STATE_MASTER",	/* 3 */
+	"IB_SMINFO_STATE_INIT",	/* 4 */
+	"UNKNOWN STATE!!"	/* 5 */
 };
 
-const char*
-osm_get_sm_mgr_state_str(
-  IN uint16_t state )
+const char *osm_get_sm_mgr_state_str(IN uint16_t state)
 {
-  if( state > IB_SMINFO_STATE_INIT )
-    state = IB_SMINFO_STATE_INIT + 1;
-  return( __osm_sm_mgr_state_str[state] );
+	if (state > IB_SMINFO_STATE_INIT)
+		state = IB_SMINFO_STATE_INIT + 1;
+	return (__osm_sm_mgr_state_str[state]);
 }
-
diff --git a/opensm/opensm/osm_inform.c b/opensm/opensm/osm_inform.c
index 9740620..0a6ea25 100644
--- a/opensm/opensm/osm_inform.c
+++ b/opensm/opensm/osm_inform.c
@@ -45,7 +45,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <string.h>
@@ -58,294 +58,271 @@
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_pkey.h>
 
-typedef struct _osm_infr_match_ctxt
-{
-  cl_list_t            *p_remove_infr_list;
-  ib_mad_notice_attr_t *p_ntc;
+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 * const p_infr)
 {
-  free( p_infr );
+	free(p_infr);
 }
 
 /**********************************************************************
  **********************************************************************/
-osm_infr_t*
-osm_infr_new(
-  IN const osm_infr_t *p_infr_rec )
+osm_infr_t *osm_infr_new(IN const osm_infr_t * p_infr_rec)
 {
-  osm_infr_t* p_infr;
+	osm_infr_t *p_infr;
 
-  CL_ASSERT(p_infr_rec);
+	CL_ASSERT(p_infr_rec);
 
-  p_infr = (osm_infr_t*)malloc( sizeof(osm_infr_t) );
-  if( p_infr )
-    memcpy( p_infr, p_infr_rec, sizeof(osm_infr_t) );
+	p_infr = (osm_infr_t *) malloc(sizeof(osm_infr_t));
+	if (p_infr)
+		memcpy(p_infr, p_infr_rec, sizeof(osm_infr_t));
 
-  return( p_infr );
+	return (p_infr);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-__dump_all_informs(
-    IN osm_subn_t  const *p_subn,
-    IN osm_log_t *p_log)
+void __dump_all_informs(IN osm_subn_t const *p_subn, IN osm_log_t * p_log)
 {
-   cl_list_item_t* p_list_item;
+	cl_list_item_t *p_list_item;
 
-   OSM_LOG_ENTER( p_log, __dump_all_informs );
+	OSM_LOG_ENTER(p_log, __dump_all_informs);
 
-   if( !osm_log_is_active( p_log, OSM_LOG_DEBUG ) )
-     goto Exit;
+	if (!osm_log_is_active(p_log, OSM_LOG_DEBUG))
+		goto Exit;
 
-   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 );
-     p_list_item = cl_qlist_next( p_list_item );
-   }
+	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);
+		p_list_item = cl_qlist_next(p_list_item);
+	}
 
- Exit:
-   OSM_LOG_EXIT( p_log );
+      Exit:
+	OSM_LOG_EXIT(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 )
+__match_inf_rec(IN const cl_list_item_t * const 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->p_infr_rcv->p_log;
-  cl_status_t status = CL_NOT_FOUND;
-  ib_gid_t all_zero_gid;
-
-  OSM_LOG_ENTER( p_log, __match_inf_rec);
-
-  if ( memcmp( &p_infr->report_addr,
-               &p_infr_rec->report_addr,
-               sizeof(p_infr_rec->report_addr)) )
-  {
-     osm_log( p_log, OSM_LOG_DEBUG,
-              "__match_inf_rec: "
-              "Differ by Address\n" );
-     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 ( memcmp( &p_infr->inform_record.inform_info.gid,
-                  &p_infr_rec->inform_record.inform_info.gid,
-                  sizeof(p_infr->inform_record.inform_info.gid)) )
-     {
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__match_inf_rec: "
-                 "Differ by InformInfo.gid\n" );
-        goto Exit;
-     }
-  }
-  else
-  {
-     if ( (p_infr->inform_record.inform_info.lid_range_begin !=
-           p_infr_rec->inform_record.inform_info.lid_range_begin) ||
-          (p_infr->inform_record.inform_info.lid_range_end !=
-           p_infr_rec->inform_record.inform_info.lid_range_end) )
-     {
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__match_inf_rec: "
-                 "Differ by InformInfo.LIDRange\n" );
-        goto Exit;
-     }
-  }
-
-  if ( p_infr->inform_record.inform_info.trap_type !=
-       p_infr_rec->inform_record.inform_info.trap_type )
-  {
-     osm_log( p_log, OSM_LOG_DEBUG,
-              "__match_inf_rec: "
-              "Differ by InformInfo.TrapType\n" );
-     goto Exit;
-  }
-
-  if ( p_infr->inform_record.inform_info.is_generic !=
-       p_infr_rec->inform_record.inform_info.is_generic )
-  {
-     osm_log( p_log, OSM_LOG_DEBUG,
-              "__match_inf_rec: "
-              "Differ by InformInfo.IsGeneric\n" );
-     goto Exit;
-  }
-
-  if (p_infr->inform_record.inform_info.is_generic)
-  {
-     if ( p_infr->inform_record.inform_info.g_or_v.generic.trap_num !=
-          p_infr_rec->inform_record.inform_info.g_or_v.generic.trap_num )
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__match_inf_rec: "
-                 "Differ by InformInfo.Generic.TrapNumber\n" );
-     else if ( p_infr->inform_record.inform_info.g_or_v.generic.qpn_resp_time_val !=
-               p_infr_rec->inform_record.inform_info.g_or_v.generic.qpn_resp_time_val )
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__match_inf_rec: "
-                 "Differ by InformInfo.Generic.QPNRespTimeVal\n" );
-     else if ( p_infr->inform_record.inform_info.g_or_v.generic.node_type_msb !=
-               p_infr_rec->inform_record.inform_info.g_or_v.generic.node_type_msb )
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__match_inf_rec: "
-                 "Differ by InformInfo.Generic.NodeTypeMSB\n" );
-     else if ( p_infr->inform_record.inform_info.g_or_v.generic.node_type_lsb !=
-               p_infr_rec->inform_record.inform_info.g_or_v.generic.node_type_lsb )
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__match_inf_rec: "
-                 "Differ by InformInfo.Generic.NodeTypeLSB\n" );
-     else
-           status = CL_SUCCESS;
-  }
-  else
-  {
-     if ( p_infr->inform_record.inform_info.g_or_v.vend.dev_id !=
-          p_infr_rec->inform_record.inform_info.g_or_v.vend.dev_id )
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__match_inf_rec: "
-                 "Differ by InformInfo.Vendor.DeviceID\n" );
-     else if ( p_infr->inform_record.inform_info.g_or_v.vend.qpn_resp_time_val !=
-               p_infr_rec->inform_record.inform_info.g_or_v.vend.qpn_resp_time_val )
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__match_inf_rec: "
-                 "Differ by InformInfo.Vendor.QPNRespTimeVal\n" );
-     else if ( p_infr->inform_record.inform_info.g_or_v.vend.vendor_id_msb !=
-               p_infr_rec->inform_record.inform_info.g_or_v.vend.vendor_id_msb )
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__match_inf_rec: "
-                 "Differ by InformInfo.Vendor.VendorIdMSB\n" );
-     else if ( p_infr->inform_record.inform_info.g_or_v.vend.vendor_id_lsb !=
-               p_infr_rec->inform_record.inform_info.g_or_v.vend.vendor_id_lsb )
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__match_inf_rec: "
-                 "Differ by InformInfo.Vendor.VendorIdLSB\n" );
-     else
-        status = CL_SUCCESS;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_log );
-  return status;
+	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->p_infr_rcv->p_log;
+	cl_status_t status = CL_NOT_FOUND;
+	ib_gid_t all_zero_gid;
+
+	OSM_LOG_ENTER(p_log, __match_inf_rec);
+
+	if (memcmp(&p_infr->report_addr,
+		   &p_infr_rec->report_addr, sizeof(p_infr_rec->report_addr))) {
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"__match_inf_rec: " "Differ by Address\n");
+		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 (memcmp(&p_infr->inform_record.inform_info.gid,
+			   &p_infr_rec->inform_record.inform_info.gid,
+			   sizeof(p_infr->inform_record.inform_info.gid))) {
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__match_inf_rec: "
+				"Differ by InformInfo.gid\n");
+			goto Exit;
+		}
+	} else {
+		if ((p_infr->inform_record.inform_info.lid_range_begin !=
+		     p_infr_rec->inform_record.inform_info.lid_range_begin) ||
+		    (p_infr->inform_record.inform_info.lid_range_end !=
+		     p_infr_rec->inform_record.inform_info.lid_range_end)) {
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__match_inf_rec: "
+				"Differ by InformInfo.LIDRange\n");
+			goto Exit;
+		}
+	}
+
+	if (p_infr->inform_record.inform_info.trap_type !=
+	    p_infr_rec->inform_record.inform_info.trap_type) {
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"__match_inf_rec: " "Differ by InformInfo.TrapType\n");
+		goto Exit;
+	}
+
+	if (p_infr->inform_record.inform_info.is_generic !=
+	    p_infr_rec->inform_record.inform_info.is_generic) {
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"__match_inf_rec: " "Differ by InformInfo.IsGeneric\n");
+		goto Exit;
+	}
+
+	if (p_infr->inform_record.inform_info.is_generic) {
+		if (p_infr->inform_record.inform_info.g_or_v.generic.trap_num !=
+		    p_infr_rec->inform_record.inform_info.g_or_v.generic.
+		    trap_num)
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__match_inf_rec: "
+				"Differ by InformInfo.Generic.TrapNumber\n");
+		else if (p_infr->inform_record.inform_info.g_or_v.generic.
+			 qpn_resp_time_val !=
+			 p_infr_rec->inform_record.inform_info.g_or_v.generic.
+			 qpn_resp_time_val)
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__match_inf_rec: "
+				"Differ by InformInfo.Generic.QPNRespTimeVal\n");
+		else if (p_infr->inform_record.inform_info.g_or_v.generic.
+			 node_type_msb !=
+			 p_infr_rec->inform_record.inform_info.g_or_v.generic.
+			 node_type_msb)
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__match_inf_rec: "
+				"Differ by InformInfo.Generic.NodeTypeMSB\n");
+		else if (p_infr->inform_record.inform_info.g_or_v.generic.
+			 node_type_lsb !=
+			 p_infr_rec->inform_record.inform_info.g_or_v.generic.
+			 node_type_lsb)
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__match_inf_rec: "
+				"Differ by InformInfo.Generic.NodeTypeLSB\n");
+		else
+			status = CL_SUCCESS;
+	} else {
+		if (p_infr->inform_record.inform_info.g_or_v.vend.dev_id !=
+		    p_infr_rec->inform_record.inform_info.g_or_v.vend.dev_id)
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__match_inf_rec: "
+				"Differ by InformInfo.Vendor.DeviceID\n");
+		else if (p_infr->inform_record.inform_info.g_or_v.vend.
+			 qpn_resp_time_val !=
+			 p_infr_rec->inform_record.inform_info.g_or_v.vend.
+			 qpn_resp_time_val)
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__match_inf_rec: "
+				"Differ by InformInfo.Vendor.QPNRespTimeVal\n");
+		else if (p_infr->inform_record.inform_info.g_or_v.vend.
+			 vendor_id_msb !=
+			 p_infr_rec->inform_record.inform_info.g_or_v.vend.
+			 vendor_id_msb)
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__match_inf_rec: "
+				"Differ by InformInfo.Vendor.VendorIdMSB\n");
+		else if (p_infr->inform_record.inform_info.g_or_v.vend.
+			 vendor_id_lsb !=
+			 p_infr_rec->inform_record.inform_info.g_or_v.vend.
+			 vendor_id_lsb)
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__match_inf_rec: "
+				"Differ by InformInfo.Vendor.VendorIdLSB\n");
+		else
+			status = CL_SUCCESS;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_log);
+	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 )
+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)
 {
-  cl_list_item_t* p_list_item;
+	cl_list_item_t *p_list_item;
 
-  OSM_LOG_ENTER( p_log, osm_infr_get_by_rec );
+	OSM_LOG_ENTER(p_log, osm_infr_get_by_rec);
 
-  __dump_all_informs( p_subn, p_log );
+	__dump_all_informs(p_subn, p_log);
 
-  osm_log( p_log, OSM_LOG_DEBUG,
-           "osm_infr_get_by_rec: "
-           "Looking for Inform Record\n" );
-  osm_dump_inform_info( p_log, &(p_infr_rec->inform_record.inform_info),
-                        OSM_LOG_DEBUG );
-  osm_log( p_log, OSM_LOG_DEBUG,
-           "osm_infr_get_by_rec: "
-	   "InformInfo list size %d\n",
-	   cl_qlist_count(&p_subn->sa_infr_list) );
+	osm_log(p_log, OSM_LOG_DEBUG,
+		"osm_infr_get_by_rec: " "Looking for Inform Record\n");
+	osm_dump_inform_info(p_log, &(p_infr_rec->inform_record.inform_info),
+			     OSM_LOG_DEBUG);
+	osm_log(p_log, OSM_LOG_DEBUG,
+		"osm_infr_get_by_rec: "
+		"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 );
+	p_list_item = cl_qlist_find_from_head(&p_subn->sa_infr_list,
+					      __match_inf_rec, p_infr_rec);
 
-  if( p_list_item == cl_qlist_end( &p_subn->sa_infr_list ) )
-    p_list_item = NULL;
+	if (p_list_item == cl_qlist_end(&p_subn->sa_infr_list))
+		p_list_item = NULL;
 
-  OSM_LOG_EXIT( p_log );
-  return (osm_infr_t*)p_list_item;
+	OSM_LOG_EXIT(p_log);
+	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)
+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, osm_infr_insert_to_db );
+	OSM_LOG_ENTER(p_log, osm_infr_insert_to_db);
 
-  osm_log( p_log, OSM_LOG_DEBUG,
-           "osm_infr_insert_to_db: "
-           "Inserting new InformInfo Record into Database\n" );
-  osm_log( p_log, OSM_LOG_DEBUG,
-           "osm_infr_insert_to_db: "
-	   "Dump before insertion (size %d)\n",
-	   cl_qlist_count(&p_subn->sa_infr_list) );
-  __dump_all_informs( p_subn, p_log );
+	osm_log(p_log, OSM_LOG_DEBUG,
+		"osm_infr_insert_to_db: "
+		"Inserting new InformInfo Record into Database\n");
+	osm_log(p_log, OSM_LOG_DEBUG,
+		"osm_infr_insert_to_db: "
+		"Dump before insertion (size %d)\n",
+		cl_qlist_count(&p_subn->sa_infr_list));
+	__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(p_log,
+			     &(p_infr->inform_record.inform_info),
+			     OSM_LOG_DEBUG);
 #endif
 
-  cl_qlist_insert_head( &p_subn->sa_infr_list,
-                        &p_infr->list_item );
+	cl_qlist_insert_head(&p_subn->sa_infr_list, &p_infr->list_item);
 
-  osm_log( p_log, OSM_LOG_DEBUG,
-           "osm_infr_insert_to_db: "
-	   "Dump after insertion (size %d)\n",
-	   cl_qlist_count(&p_subn->sa_infr_list) );
-  __dump_all_informs( p_subn, p_log );
-  OSM_LOG_EXIT( p_log );
+	osm_log(p_log, OSM_LOG_DEBUG,
+		"osm_infr_insert_to_db: "
+		"Dump after insertion (size %d)\n",
+		cl_qlist_count(&p_subn->sa_infr_list));
+	__dump_all_informs(p_subn, p_log);
+	OSM_LOG_EXIT(p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-osm_infr_remove_from_db(
-  IN osm_subn_t   *p_subn,
-  IN osm_log_t    *p_log,
-  IN osm_infr_t   *p_infr)
+osm_infr_remove_from_db(IN osm_subn_t * p_subn,
+			IN osm_log_t * p_log, IN osm_infr_t * p_infr)
 {
-  OSM_LOG_ENTER( p_log, osm_infr_remove_from_db );
+	OSM_LOG_ENTER(p_log, osm_infr_remove_from_db);
 
-  osm_log( p_log, OSM_LOG_DEBUG,
-           "osm_infr_remove_from_db: "
-           "Removing InformInfo Subscribing GID:0x%016" PRIx64 " : 0x%016" PRIx64
-           " Enum:0x%X from Database\n",
-           cl_ntoh64(p_infr->inform_record.subscriber_gid.unicast.prefix),
-           cl_ntoh64(p_infr->inform_record.subscriber_gid.unicast.interface_id),
-           p_infr->inform_record.subscriber_enum
-           );
+	osm_log(p_log, OSM_LOG_DEBUG,
+		"osm_infr_remove_from_db: "
+		"Removing InformInfo Subscribing GID:0x%016" PRIx64 " : 0x%016"
+		PRIx64 " Enum:0x%X from Database\n",
+		cl_ntoh64(p_infr->inform_record.subscriber_gid.unicast.prefix),
+		cl_ntoh64(p_infr->inform_record.subscriber_gid.unicast.
+			  interface_id), 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(p_log, &(p_infr->inform_record.inform_info),
+			     OSM_LOG_DEBUG);
 
-  cl_qlist_remove_item( &p_subn->sa_infr_list,
-                        &p_infr->list_item );
+	cl_qlist_remove_item(&p_subn->sa_infr_list, &p_infr->list_item);
 
-  osm_infr_delete( p_infr );
+	osm_infr_delete(p_infr);
 
-  OSM_LOG_EXIT( p_log );
+	OSM_LOG_EXIT(p_log);
 }
 
 /**********************************************************************
@@ -353,82 +330,75 @@ osm_infr_remove_from_db(
  * 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 __osm_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;
-  ib_mad_notice_attr_t*    p_report_ntc;
-  ib_mad_t*                p_mad;
-  ib_sa_mad_t*             p_sa_mad;
-  static atomic32_t        trap_fwd_trans_id = 0x02DAB000;
-  ib_api_status_t          status;
-  osm_log_t *              p_log = p_infr_rec->p_infr_rcv->p_log;
-
-  OSM_LOG_ENTER( p_log, __osm_send_report );
-
-  /* HACK: who switches or uses the src and dest GIDs in the grh_info ?? */
-
-  /* it is better to use LIDs since the GIDs might not be there for SMI traps */
-  osm_log( p_log, OSM_LOG_DEBUG,
-           "__osm_send_report: "
-           "Forwarding Notice Event from LID:0x%X"
-           " to InformInfo LID: 0x%X TID:0x%X\n",
-           cl_ntoh16(p_ntc->issuer_lid),
-           cl_ntoh16(p_infr_rec->report_addr.dest_lid),
-           trap_fwd_trans_id
-           );
-
-  /* get the MAD to send */
-  p_report_madw = osm_mad_pool_get( p_infr_rec->p_infr_rcv->p_mad_pool,
-                                    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,
-             "__osm_send_report: ERR 0203: "
-             "osm_mad_pool_get failed\n" );
-    status = IB_ERROR;
-    goto Exit;
-  }
-
-  /* advance trap trans id (cant simply ++ on some systems inside ntoh) */
-  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 );
-
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_report_madw );
-
-  p_report_ntc = (ib_mad_notice_attr_t*)&(p_sa_mad->data);
-
-  /* copy the notice */
-  *p_report_ntc = *p_ntc;
-
-  /* The TRUE is for: response is expected */
-  status = osm_vendor_send( p_report_madw->h_bind, p_report_madw, TRUE );
-  if ( status != IB_SUCCESS )
-  {
-    osm_log( p_log, OSM_LOG_ERROR,
-             "__osm_send_report: ERR 0204: "
-             "osm_vendor_send status = %s\n",
-             ib_get_err_str(status) );
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_log );
-  return(status);
+	osm_madw_t *p_report_madw;
+	ib_mad_notice_attr_t *p_report_ntc;
+	ib_mad_t *p_mad;
+	ib_sa_mad_t *p_sa_mad;
+	static atomic32_t trap_fwd_trans_id = 0x02DAB000;
+	ib_api_status_t status;
+	osm_log_t *p_log = p_infr_rec->p_infr_rcv->p_log;
+
+	OSM_LOG_ENTER(p_log, __osm_send_report);
+
+	/* HACK: who switches or uses the src and dest GIDs in the grh_info ?? */
+
+	/* it is better to use LIDs since the GIDs might not be there for SMI traps */
+	osm_log(p_log, OSM_LOG_DEBUG,
+		"__osm_send_report: "
+		"Forwarding Notice Event from LID:0x%X"
+		" to InformInfo LID: 0x%X TID:0x%X\n",
+		cl_ntoh16(p_ntc->issuer_lid),
+		cl_ntoh16(p_infr_rec->report_addr.dest_lid), trap_fwd_trans_id);
+
+	/* get the MAD to send */
+	p_report_madw = osm_mad_pool_get(p_infr_rec->p_infr_rcv->p_mad_pool,
+					 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,
+			"__osm_send_report: ERR 0203: "
+			"osm_mad_pool_get failed\n");
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	/* advance trap trans id (cant simply ++ on some systems inside ntoh) */
+	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);
+
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_report_madw);
+
+	p_report_ntc = (ib_mad_notice_attr_t *) & (p_sa_mad->data);
+
+	/* copy the notice */
+	*p_report_ntc = *p_ntc;
+
+	/* The TRUE is for: response is expected */
+	status = osm_vendor_send(p_report_madw->h_bind, p_report_madw, TRUE);
+	if (status != IB_SUCCESS) {
+		osm_log(p_log, OSM_LOG_ERROR,
+			"__osm_send_report: ERR 0204: "
+			"osm_vendor_send status = %s\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
@@ -437,210 +407,197 @@ __osm_send_report(
  * 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 )
+__match_notice_to_inf_rec(IN cl_list_item_t * const 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->p_infr_rcv->p_log;
-  osm_subn_t *p_subn = p_infr_rec->p_infr_rcv->p_subn;
-  ib_gid_t              source_gid;
-  osm_port_t*           p_src_port;
-  osm_port_t*           p_dest_port;
-
-  OSM_LOG_ENTER( p_log, __match_notice_to_inf_rec );
-
-  /* matching rules
-   * InformInfo   Notice
-   * GID          IssuerGID    if non zero must match the trap
-   * LIDRange     IssuerLID    apply only if GID=0
-   * IsGeneric    IsGeneric    is compulsory and must match the trap
-   * Type         Type         if not 0xFFFF must match
-   * TrapNumber   TrapNumber   if not 0xFFFF must match
-   * DeviceId     DeviceID     if not 0xFFFF must match
-   * QPN dont care
-   * ProducerType ProducerType match or 0xFFFFFF // EZ: actually my interpretation
-   * VendorID     VendorID     match or 0xFFFFFF
-   */
-
-  /* GID          IssuerGID    if non zero must match the trap  */
-  if ( p_ii->gid.unicast.prefix != 0 || p_ii->gid.unicast.interface_id != 0 )
-  {
-    /* match by GID */
-    if ( memcmp(&(p_ii->gid), &(p_ntc->issuer_gid), sizeof(ib_gid_t)) )
-    {
-      osm_log( p_log, OSM_LOG_DEBUG,
-               "__match_notice_to_inf_rec: "
-               "Mismatch by GID\n" );
-      goto Exit;
-    }
-  }
-  else
-  {
-    /* LIDRange     IssuerLID    apply only if GID=0 */
-    /* If lid_range_begin of the informInfo is 0xFFFF - then it should be ignored. */
-    if ( p_ii->lid_range_begin != 0xFFFF )
-    {
-      /* a real lid range is given - check it */
-      if ( (cl_hton16(p_ii->lid_range_begin) > cl_hton16(p_ntc->issuer_lid)) ||
-           (cl_hton16(p_ntc->issuer_lid) > cl_hton16(p_ii->lid_range_end)) ) {
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__match_notice_to_inf_rec: "
-                 "Mismatch by LID Range. Needed: 0x%X <= 0x%X <= 0x%X\n",
-                 cl_hton16(p_ii->lid_range_begin),
-                 cl_hton16(p_ntc->issuer_lid),
-                 cl_hton16(p_ii->lid_range_end)
-                 );
-        goto Exit;
-      }
-    }
-  }
-
-  /* IsGeneric    IsGeneric    is compulsory and must match the trap  */
-  if ( (p_ii->is_generic && ! ib_notice_is_generic(p_ntc)) ||
-       (!p_ii->is_generic && ib_notice_is_generic(p_ntc)) )
-  {
-    osm_log( p_log, OSM_LOG_DEBUG,
-             "__match_notice_to_inf_rec: "
-             "Mismatch by Generic/Vendor\n" );
-    goto Exit;
-  }
-
-  /* Type         Type         if not 0xFFFF must match */
-  if ( (p_ii->trap_type != 0xFFFF) &&
-       (cl_ntoh16(p_ii->trap_type) != ib_notice_get_type(p_ntc)) )
-  {
-    osm_log( p_log, OSM_LOG_DEBUG,
-             "__match_notice_to_inf_rec: "
-             "Mismatch by Type\n" );
-    goto Exit;
-  }
-
-  /* based on generic type */
-  if ( p_ii->is_generic )
-  {
-    /* TrapNumber   TrapNumber   if not 0xFFFF must match */
-    if ( (p_ii->g_or_v.generic.trap_num != 0xFFFF) &&
-         (p_ii->g_or_v.generic.trap_num != p_ntc->g_or_v.generic.trap_num) )
-    {
-      osm_log( p_log, OSM_LOG_DEBUG,
-               "__match_notice_to_inf_rec: "
-               "Mismatch by Trap Num\n" );
-      goto Exit;
-    }
-
-    /* ProducerType ProducerType match or 0xFFFFFF  */
-    if ( (cl_ntoh32(ib_inform_info_get_prod_type(p_ii)) != 0xFFFFFF) &&
-         (ib_inform_info_get_prod_type(p_ii) != ib_notice_get_prod_type(p_ntc)) )
-    {
-      osm_log( p_log, OSM_LOG_DEBUG,
-               "__match_notice_to_inf_rec: "
-               "Mismatch by Node Type: II=0x%06X (%s) Trap=0x%06X (%s)\n",
-               cl_ntoh32(ib_inform_info_get_prod_type(p_ii)),
-               ib_get_producer_type_str(ib_inform_info_get_prod_type(p_ii)),
-               cl_ntoh32(ib_notice_get_prod_type(p_ntc)),
-               ib_get_producer_type_str(ib_notice_get_prod_type(p_ntc))
-               );
-      goto Exit;
-    }
-  }
-  else
-  {
-    /* DeviceId     DeviceID     if not 0xFFFF must match */
-    if ( (p_ii->g_or_v.vend.dev_id != 0xFFFF) &&
-         (p_ii->g_or_v.vend.dev_id != p_ntc->g_or_v.vend.dev_id) )
-    {
-      osm_log( p_log, OSM_LOG_DEBUG,
-               "__match_notice_to_inf_rec: "
-               "Mismatch by Dev Id\n" );
-      goto Exit;
-    }
-
-    /* VendorID     VendorID     match or 0xFFFFFF  */
-    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,
-               "__match_notice_to_inf_rec: "
-               "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,
-             "__match_notice_to_inf_rec: "
-             "Cannot find source port with GUID:0x%016" PRIx64 "\n",
-             cl_ntoh64(source_gid.unicast.interface_id) );
-    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,
-             "__match_notice_to_inf_rec: "
-             "Cannot find destination port with LID:0x%04x\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,
-             "__match_notice_to_inf_rec: "
-             "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,
-               "__match_notice_to_inf_rec: "
-               "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_notice_to_inf_rec: "
-           "MATCH! Sending Report...\n" );
-  __osm_send_report( p_infr_rec, p_ntc );
-  status = CL_SUCCESS;
-
- Exit:
-  OSM_LOG_EXIT( p_log );
+	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->p_infr_rcv->p_log;
+	osm_subn_t *p_subn = p_infr_rec->p_infr_rcv->p_subn;
+	ib_gid_t source_gid;
+	osm_port_t *p_src_port;
+	osm_port_t *p_dest_port;
+
+	OSM_LOG_ENTER(p_log, __match_notice_to_inf_rec);
+
+	/* matching rules
+	 * InformInfo   Notice
+	 * GID          IssuerGID    if non zero must match the trap
+	 * LIDRange     IssuerLID    apply only if GID=0
+	 * IsGeneric    IsGeneric    is compulsory and must match the trap
+	 * Type         Type         if not 0xFFFF must match
+	 * TrapNumber   TrapNumber   if not 0xFFFF must match
+	 * DeviceId     DeviceID     if not 0xFFFF must match
+	 * QPN dont care
+	 * ProducerType ProducerType match or 0xFFFFFF // EZ: actually my interpretation
+	 * VendorID     VendorID     match or 0xFFFFFF
+	 */
+
+	/* GID          IssuerGID    if non zero must match the trap  */
+	if (p_ii->gid.unicast.prefix != 0
+	    || p_ii->gid.unicast.interface_id != 0) {
+		/* match by GID */
+		if (memcmp
+		    (&(p_ii->gid), &(p_ntc->issuer_gid), sizeof(ib_gid_t))) {
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__match_notice_to_inf_rec: "
+				"Mismatch by GID\n");
+			goto Exit;
+		}
+	} else {
+		/* LIDRange     IssuerLID    apply only if GID=0 */
+		/* If lid_range_begin of the informInfo is 0xFFFF - then it should be ignored. */
+		if (p_ii->lid_range_begin != 0xFFFF) {
+			/* a real lid range is given - check it */
+			if ((cl_hton16(p_ii->lid_range_begin) >
+			     cl_hton16(p_ntc->issuer_lid))
+			    || (cl_hton16(p_ntc->issuer_lid) >
+				cl_hton16(p_ii->lid_range_end))) {
+				osm_log(p_log, OSM_LOG_DEBUG,
+					"__match_notice_to_inf_rec: "
+					"Mismatch by LID Range. Needed: 0x%X <= 0x%X <= 0x%X\n",
+					cl_hton16(p_ii->lid_range_begin),
+					cl_hton16(p_ntc->issuer_lid),
+					cl_hton16(p_ii->lid_range_end)
+				    );
+				goto Exit;
+			}
+		}
+	}
+
+	/* IsGeneric    IsGeneric    is compulsory and must match the trap  */
+	if ((p_ii->is_generic && !ib_notice_is_generic(p_ntc)) ||
+	    (!p_ii->is_generic && ib_notice_is_generic(p_ntc))) {
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"__match_notice_to_inf_rec: "
+			"Mismatch by Generic/Vendor\n");
+		goto Exit;
+	}
+
+	/* Type         Type         if not 0xFFFF must match */
+	if ((p_ii->trap_type != 0xFFFF) &&
+	    (cl_ntoh16(p_ii->trap_type) != ib_notice_get_type(p_ntc))) {
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"__match_notice_to_inf_rec: " "Mismatch by Type\n");
+		goto Exit;
+	}
+
+	/* based on generic type */
+	if (p_ii->is_generic) {
+		/* TrapNumber   TrapNumber   if not 0xFFFF must match */
+		if ((p_ii->g_or_v.generic.trap_num != 0xFFFF) &&
+		    (p_ii->g_or_v.generic.trap_num !=
+		     p_ntc->g_or_v.generic.trap_num)) {
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__match_notice_to_inf_rec: "
+				"Mismatch by Trap Num\n");
+			goto Exit;
+		}
+
+		/* ProducerType ProducerType match or 0xFFFFFF  */
+		if ((cl_ntoh32(ib_inform_info_get_prod_type(p_ii)) != 0xFFFFFF)
+		    && (ib_inform_info_get_prod_type(p_ii) !=
+			ib_notice_get_prod_type(p_ntc))) {
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__match_notice_to_inf_rec: "
+				"Mismatch by Node Type: II=0x%06X (%s) Trap=0x%06X (%s)\n",
+				cl_ntoh32(ib_inform_info_get_prod_type(p_ii)),
+				ib_get_producer_type_str
+				(ib_inform_info_get_prod_type(p_ii)),
+				cl_ntoh32(ib_notice_get_prod_type(p_ntc)),
+				ib_get_producer_type_str(ib_notice_get_prod_type
+							 (p_ntc))
+			    );
+			goto Exit;
+		}
+	} else {
+		/* DeviceId     DeviceID     if not 0xFFFF must match */
+		if ((p_ii->g_or_v.vend.dev_id != 0xFFFF) &&
+		    (p_ii->g_or_v.vend.dev_id != p_ntc->g_or_v.vend.dev_id)) {
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__match_notice_to_inf_rec: "
+				"Mismatch by Dev Id\n");
+			goto Exit;
+		}
+
+		/* VendorID     VendorID     match or 0xFFFFFF  */
+		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,
+				"__match_notice_to_inf_rec: "
+				"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,
+			"__match_notice_to_inf_rec: "
+			"Cannot find source port with GUID:0x%016" PRIx64 "\n",
+			cl_ntoh64(source_gid.unicast.interface_id));
+		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,
+			"__match_notice_to_inf_rec: "
+			"Cannot find destination port with LID:0x%04x\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,
+			"__match_notice_to_inf_rec: " "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,
+				"__match_notice_to_inf_rec: "
+				"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_notice_to_inf_rec: " "MATCH! Sending Report...\n");
+	__osm_send_report(p_infr_rec, p_ntc);
+	status = CL_SUCCESS;
+
+      Exit:
+	OSM_LOG_EXIT(p_log);
 }
 
 /**********************************************************************
@@ -652,87 +609,80 @@ __match_notice_to_inf_rec(
  * 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 )
+osm_report_notice(IN osm_log_t * const 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;
-  osm_infr_t*           p_next_infr_rec;
-
-  OSM_LOG_ENTER( p_log, osm_report_notice );
-
-  /*
-   * we must make sure we are ready for this...
-   * note that the trap receivers might be initialized before
-   * the osm_infr_init call is performed.
-   */
-  if ( p_subn->sa_infr_list.state != CL_INITIALIZED )
-  {
-    osm_log( p_log, OSM_LOG_DEBUG,
-             "osm_report_notice: "
-             "Ignoring Notice Reports since Inform List is not initialized yet!\n" );
-    return(IB_ERROR);
-  }
-
-  /* an official Event information log */
-  if ( ib_notice_is_generic(p_ntc) )
-  {
-    osm_log( p_log, OSM_LOG_INFO,
-             "osm_report_notice: "
-             "Reporting Generic Notice type:%u num:%u"
-             " from LID:0x%04X GID:0x%016" PRIx64
-				 ",0x%016" PRIx64 "\n",
-             ib_notice_get_type(p_ntc),
-             cl_ntoh16(p_ntc->g_or_v.generic.trap_num),
-             cl_ntoh16(p_ntc->issuer_lid),
-             cl_ntoh64(p_ntc->issuer_gid.unicast.prefix),
-             cl_ntoh64(p_ntc->issuer_gid.unicast.interface_id)
-             );
-  }
-  else
-  {
-    osm_log( p_log, OSM_LOG_INFO,
-             "osm_report_notice: "
-             "Reporting Vendor Notice type:%u vend:%u dev:%u"
-             " from LID:0x%04X GID:0x%016" PRIx64
-				 ",0x%016" PRIx64 "\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),
-             cl_ntoh64(p_ntc->issuer_gid.unicast.prefix),
-             cl_ntoh64(p_ntc->issuer_gid.unicast.interface_id)
-             );
-  }
-
-  /* Create a list that will hold all the infr records that should
-     be removed due to violation. o13-17.1.2 */
-  cl_list_construct( &infr_to_remove_list );
-  cl_list_init( &infr_to_remove_list, 5 );
-  context.p_remove_infr_list = &infr_to_remove_list;
-  context.p_ntc = p_ntc;
-
-  /* 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 );
-
-  /* If we inserted items into the infr_to_remove_list - we need to
-     remove them */
-  p_infr_rec = (osm_infr_t*)cl_list_remove_head(&infr_to_remove_list);
-  while ( p_infr_rec != NULL )
-  {
-    p_next_infr_rec = (osm_infr_t*)cl_list_remove_head(&infr_to_remove_list);
-    osm_infr_remove_from_db ( p_subn, p_log, p_infr_rec );
-    p_infr_rec = p_next_infr_rec;
-  }
-  cl_list_destroy(&infr_to_remove_list);
-
-  OSM_LOG_EXIT( p_log );
-
-  return(IB_SUCCESS);
+	osm_infr_match_ctxt_t context;
+	cl_list_t infr_to_remove_list;
+	osm_infr_t *p_infr_rec;
+	osm_infr_t *p_next_infr_rec;
+
+	OSM_LOG_ENTER(p_log, osm_report_notice);
+
+	/*
+	 * we must make sure we are ready for this...
+	 * note that the trap receivers might be initialized before
+	 * the osm_infr_init call is performed.
+	 */
+	if (p_subn->sa_infr_list.state != CL_INITIALIZED) {
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"osm_report_notice: "
+			"Ignoring Notice Reports since Inform List is not initialized yet!\n");
+		return (IB_ERROR);
+	}
+
+	/* an official Event information log */
+	if (ib_notice_is_generic(p_ntc)) {
+		osm_log(p_log, OSM_LOG_INFO,
+			"osm_report_notice: "
+			"Reporting Generic Notice type:%u num:%u"
+			" from LID:0x%04X GID:0x%016" PRIx64
+			",0x%016" PRIx64 "\n",
+			ib_notice_get_type(p_ntc),
+			cl_ntoh16(p_ntc->g_or_v.generic.trap_num),
+			cl_ntoh16(p_ntc->issuer_lid),
+			cl_ntoh64(p_ntc->issuer_gid.unicast.prefix),
+			cl_ntoh64(p_ntc->issuer_gid.unicast.interface_id)
+		    );
+	} else {
+		osm_log(p_log, OSM_LOG_INFO,
+			"osm_report_notice: "
+			"Reporting Vendor Notice type:%u vend:%u dev:%u"
+			" from LID:0x%04X GID:0x%016" PRIx64
+			",0x%016" PRIx64 "\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),
+			cl_ntoh64(p_ntc->issuer_gid.unicast.prefix),
+			cl_ntoh64(p_ntc->issuer_gid.unicast.interface_id)
+		    );
+	}
+
+	/* Create a list that will hold all the infr records that should
+	   be removed due to violation. o13-17.1.2 */
+	cl_list_construct(&infr_to_remove_list);
+	cl_list_init(&infr_to_remove_list, 5);
+	context.p_remove_infr_list = &infr_to_remove_list;
+	context.p_ntc = p_ntc;
+
+	/* 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);
+
+	/* If we inserted items into the infr_to_remove_list - we need to
+	   remove them */
+	p_infr_rec = (osm_infr_t *) cl_list_remove_head(&infr_to_remove_list);
+	while (p_infr_rec != NULL) {
+		p_next_infr_rec =
+		    (osm_infr_t *) cl_list_remove_head(&infr_to_remove_list);
+		osm_infr_remove_from_db(p_subn, p_log, p_infr_rec);
+		p_infr_rec = p_next_infr_rec;
+	}
+	cl_list_destroy(&infr_to_remove_list);
+
+	OSM_LOG_EXIT(p_log);
+
+	return (IB_SUCCESS);
 }
diff --git a/opensm/opensm/osm_lin_fwd_rcv.c b/opensm/opensm/osm_lin_fwd_rcv.c
index eda10d8..efc0b1b 100644
--- a/opensm/opensm/osm_lin_fwd_rcv.c
+++ b/opensm/opensm/osm_lin_fwd_rcv.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of osm_lft_rcv_t.
@@ -48,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <complib/cl_debug.h>
@@ -57,106 +56,92 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_lft_rcv_construct(
-  IN osm_lft_rcv_t* const p_rcv )
+void osm_lft_rcv_construct(IN osm_lft_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
+	memset(p_rcv, 0, sizeof(*p_rcv));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_lft_rcv_destroy(
-  IN osm_lft_rcv_t* const p_rcv )
+void osm_lft_rcv_destroy(IN osm_lft_rcv_t * const p_rcv)
 {
-  CL_ASSERT( p_rcv );
+	CL_ASSERT(p_rcv);
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_lft_rcv_destroy );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_lft_rcv_destroy);
 
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_lft_rcv_init(
-  IN osm_lft_rcv_t* const p_rcv,
-  IN osm_subn_t* const p_subn,
-  IN osm_log_t* const p_log,
-  IN cl_plock_t* const p_lock )
+osm_lft_rcv_init(IN osm_lft_rcv_t * const p_rcv,
+		 IN osm_subn_t * const p_subn,
+		 IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_lft_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_lft_rcv_init);
 
-  osm_lft_rcv_construct( p_rcv );
+	osm_lft_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
 
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_lft_rcv_process(
-  IN void *context,
-  IN void *data )
+void osm_lft_rcv_process(IN void *context, IN void *data)
 {
-  osm_lft_rcv_t *p_rcv = context;
-  osm_madw_t *p_madw = data;
-  ib_smp_t *p_smp;
-  uint32_t block_num;
-  osm_switch_t *p_sw;
-  osm_lft_context_t *p_lft_context;
-  uint8_t *p_block;
-  ib_net64_t node_guid;
-  ib_api_status_t status;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_lft_rcv_process );
-
-  CL_ASSERT( p_madw );
-
-  p_smp = osm_madw_get_smp_ptr( p_madw );
-  p_block = (uint8_t*)ib_smp_get_payload_ptr( p_smp );
-  block_num = cl_ntoh32( p_smp->attr_mod );
-
-  /*
-    Acquire the switch object for this switch.
-  */
-  p_lft_context = osm_madw_get_lft_context_ptr( p_madw );
-  node_guid = p_lft_context->node_guid;
-
-  CL_PLOCK_EXCL_ACQUIRE( p_rcv->p_lock );
-  p_sw = osm_get_switch_by_guid( p_rcv->p_subn, node_guid );
-
-  if( !p_sw )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_lft_rcv_process: ERR 0401: "
-             "LFT received for nonexistent node "
-             "0x%" PRIx64 "\n", cl_ntoh64( node_guid ) );
-  }
-  else
-  {
-    status = osm_switch_set_ft_block( p_sw, p_block, block_num );
-    if( status != IB_SUCCESS )
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_lft_rcv_process: 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 ) );
-    }
-  }
-
-  CL_PLOCK_RELEASE( p_rcv->p_lock );
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_lft_rcv_t *p_rcv = context;
+	osm_madw_t *p_madw = data;
+	ib_smp_t *p_smp;
+	uint32_t block_num;
+	osm_switch_t *p_sw;
+	osm_lft_context_t *p_lft_context;
+	uint8_t *p_block;
+	ib_net64_t node_guid;
+	ib_api_status_t status;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_lft_rcv_process);
+
+	CL_ASSERT(p_madw);
+
+	p_smp = osm_madw_get_smp_ptr(p_madw);
+	p_block = (uint8_t *) ib_smp_get_payload_ptr(p_smp);
+	block_num = cl_ntoh32(p_smp->attr_mod);
+
+	/*
+	   Acquire the switch object for this switch.
+	 */
+	p_lft_context = osm_madw_get_lft_context_ptr(p_madw);
+	node_guid = p_lft_context->node_guid;
+
+	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
+	p_sw = osm_get_switch_by_guid(p_rcv->p_subn, node_guid);
+
+	if (!p_sw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_lft_rcv_process: ERR 0401: "
+			"LFT received for nonexistent node "
+			"0x%" PRIx64 "\n", cl_ntoh64(node_guid));
+	} else {
+		status = osm_switch_set_ft_block(p_sw, p_block, block_num);
+		if (status != IB_SUCCESS) {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_lft_rcv_process: 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));
+		}
+	}
+
+	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_lin_fwd_tbl.c b/opensm/opensm/osm_lin_fwd_tbl.c
index 2a60d81..d9f001a 100644
--- a/opensm/opensm/osm_lin_fwd_tbl.c
+++ b/opensm/opensm/osm_lin_fwd_tbl.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of osm_lin_fwd_tbl_t.
@@ -48,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <string.h>
@@ -56,47 +55,39 @@
 #include <iba/ib_types.h>
 #include <opensm/osm_lin_fwd_tbl.h>
 
-
-inline size_t
-__osm_lin_tbl_compute_obj_size(
-  IN const uint32_t num_ports )
+inline size_t __osm_lin_tbl_compute_obj_size(IN const uint32_t num_ports)
 {
-  return( sizeof(osm_lin_fwd_tbl_t) + (num_ports - 1) );
+	return (sizeof(osm_lin_fwd_tbl_t) + (num_ports - 1));
 }
 
 /**********************************************************************
  **********************************************************************/
-osm_lin_fwd_tbl_t*
-osm_lin_tbl_new(
-  IN uint16_t const size )
+osm_lin_fwd_tbl_t *osm_lin_tbl_new(IN uint16_t const size)
 {
-  osm_lin_fwd_tbl_t* p_tbl;
+	osm_lin_fwd_tbl_t *p_tbl;
 
-  /*
-    The capacity reported by the switch includes LID 0,
-    so add 1 to the end of the range here for this assert.
-  */
-  CL_ASSERT( size <= IB_LID_UCAST_END_HO + 1 );
-  p_tbl = (osm_lin_fwd_tbl_t*)malloc(
-    __osm_lin_tbl_compute_obj_size( size ) );
+	/*
+	   The capacity reported by the switch includes LID 0,
+	   so add 1 to the end of the range here for this assert.
+	 */
+	CL_ASSERT(size <= IB_LID_UCAST_END_HO + 1);
+	p_tbl =
+	    (osm_lin_fwd_tbl_t *) malloc(__osm_lin_tbl_compute_obj_size(size));
 
-  /*
-    Initialize the table to OSM_NO_PATH, which means "invalid port"
-  */
-  memset( p_tbl, OSM_NO_PATH, __osm_lin_tbl_compute_obj_size( size ) );
-  if( p_tbl != NULL )
-  {
-    p_tbl->size = (uint16_t)size;
-  }
-  return( p_tbl );
+	/*
+	   Initialize the table to OSM_NO_PATH, which means "invalid port"
+	 */
+	memset(p_tbl, OSM_NO_PATH, __osm_lin_tbl_compute_obj_size(size));
+	if (p_tbl != NULL) {
+		p_tbl->size = (uint16_t) size;
+	}
+	return (p_tbl);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_lin_tbl_delete(
-  IN osm_lin_fwd_tbl_t** const pp_tbl )
+void osm_lin_tbl_delete(IN osm_lin_fwd_tbl_t ** const pp_tbl)
 {
-  free( *pp_tbl );
-  *pp_tbl = NULL;
+	free(*pp_tbl);
+	*pp_tbl = NULL;
 }
diff --git a/opensm/opensm/osm_log.c b/opensm/opensm/osm_log.c
index 85c1725..7efe93e 100644
--- a/opensm/opensm/osm_log.c
+++ b/opensm/opensm/osm_log.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <opensm/osm_log.h>
 #include <stdlib.h>
@@ -66,28 +66,26 @@ static int log_exit_count = 0;
 #include <complib/cl_timer.h>
 
 static char *month_str[] = {
-  "Jan",
-  "Feb",
-  "Mar",
-  "Apr",
-  "May",
-  "Jun",
-  "Jul",
-  "Aug",
-  "Sep",
-  "Oct",
-  "Nov",
-  "Dec"
+	"Jan",
+	"Feb",
+	"Mar",
+	"Apr",
+	"May",
+	"Jun",
+	"Jul",
+	"Aug",
+	"Sep",
+	"Oct",
+	"Nov",
+	"Dec"
 };
 #else
-void
-OsmReportState(
-    IN const char *p_str);
-#endif /* ndef WIN32 */
+void OsmReportState(IN const char *p_str);
+#endif				/* ndef WIN32 */
 
 #ifndef WIN32
 
-static void truncate_log_file(osm_log_t* const p_log)
+static void truncate_log_file(osm_log_t * const p_log)
 {
 	int fd = fileno(p_log->out_port);
 	if (ftruncate(fd, 0) < 0)
@@ -99,255 +97,247 @@ static void truncate_log_file(osm_log_t* const p_log)
 	p_log->count = 0;
 }
 
-#else /* Windows */
+#else				/* Windows */
 
-static void truncate_log_file(osm_log_t* const p_log)
+static void truncate_log_file(osm_log_t * const p_log)
 {
-	fprintf(stderr, "truncate_log_file: cannot truncate on windows system (yet)\n");
+	fprintf(stderr,
+		"truncate_log_file: cannot truncate on windows system (yet)\n");
 }
-#endif /* ndef WIN32 */
+#endif				/* ndef WIN32 */
 
-int osm_log_printf(osm_log_t *p_log, osm_log_level_t level,
+int osm_log_printf(osm_log_t * p_log, osm_log_level_t level,
 		   const char *fmt, ...)
 {
 	va_list args;
 	int ret;
 
-	if (!(p_log->level&level))
+	if (!(p_log->level & level))
 		return 0;
 
 	va_start(args, fmt);
 	ret = vfprintf(stdout, fmt, args);
 	va_end(args);
 
-	if (p_log->flush || level&OSM_LOG_ERROR)
-		fflush( stdout );
+	if (p_log->flush || level & OSM_LOG_ERROR)
+		fflush(stdout);
 
 	return ret;
 }
 
 void
-osm_log(
-  IN osm_log_t* const p_log,
-  IN const osm_log_level_t verbosity,
-  IN const char *p_str, ... )
+osm_log(IN osm_log_t * const p_log,
+	IN const osm_log_level_t verbosity, IN const char *p_str, ...)
 {
-  char      buffer[LOG_ENTRY_SIZE_MAX];
-  va_list   args;
-  int       ret;
+	char buffer[LOG_ENTRY_SIZE_MAX];
+	va_list args;
+	int ret;
 
 #ifdef WIN32
-  SYSTEMTIME st;
-  uint32_t pid = GetCurrentThreadId();
+	SYSTEMTIME st;
+	uint32_t pid = GetCurrentThreadId();
 #else
-  pid_t pid = 0;
-  time_t tim;
-  struct tm result;
-  uint64_t time_usecs;
-  uint32_t usecs;
-
-  time_usecs = cl_get_time_stamp();
-  tim = time_usecs/1000000;
-  usecs = time_usecs % 1000000;
-  localtime_r(&tim, &result);
-#endif /* WIN32 */
-
-  /* If this is a call to syslog - always print it */
-  if ( verbosity & (OSM_LOG_SYS | p_log->level) )
-  {
-    va_start( args, p_str );
-    vsprintf( buffer, p_str, args );
-    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 );
-      }
+	pid_t pid = 0;
+	time_t tim;
+	struct tm result;
+	uint64_t time_usecs;
+	uint32_t usecs;
+
+	time_usecs = cl_get_time_stamp();
+	tim = time_usecs / 1000000;
+	usecs = time_usecs % 1000000;
+	localtime_r(&tim, &result);
+#endif				/* WIN32 */
+
+	/* If this is a call to syslog - always print it */
+	if (verbosity & (OSM_LOG_SYS | p_log->level)) {
+		va_start(args, p_str);
+		vsprintf(buffer, p_str, args);
+		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 WIN32
-      OsmReportState(buffer);
-#endif /* WIN32 */
-    }
-
-    /* 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);
-    }
-
+			OsmReportState(buffer);
+#endif				/* WIN32 */
+		}
+
+		/* 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 WIN32
-    GetLocalTime(&st);
- _retry:
-    ret = fprintf( p_log->out_port, "[%02d:%02d:%02d:%03d][%04X] -> %s",
-                   st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
-                   pid, buffer );
+		GetLocalTime(&st);
+	      _retry:
+		ret =
+		    fprintf(p_log->out_port,
+			    "[%02d:%02d:%02d:%03d][%04X] -> %s", st.wHour,
+			    st.wMinute, st.wSecond, st.wMilliseconds, pid,
+			    buffer);
 #else
-    pid = pthread_self();
- _retry:
-    ret = fprintf( p_log->out_port, "%s %02d %02d:%02d:%02d %06d [%04X] -> %s",
-                   (result.tm_mon < 12 ? month_str[result.tm_mon] : "???"),
-                   result.tm_mday, result.tm_hour,
-                   result.tm_min, result.tm_sec,
-                   usecs, pid, buffer );
+		pid = pthread_self();
+	      _retry:
+		ret =
+		    fprintf(p_log->out_port,
+			    "%s %02d %02d:%02d:%02d %06d [%04X] -> %s",
+			    (result.tm_mon <
+			     12 ? month_str[result.tm_mon] : "???"),
+			    result.tm_mday, result.tm_hour, result.tm_min,
+			    result.tm_sec, usecs, pid, 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 );
-  }
+		/*  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_raw(
-  IN osm_log_t* const p_log,
-  IN const osm_log_level_t verbosity,
-  IN const char *p_buf )
+osm_log_raw(IN osm_log_t * const p_log,
+	    IN const osm_log_level_t verbosity, IN const char *p_buf)
 {
-  if( p_log->level & verbosity )
-  {
-    cl_spinlock_acquire( &p_log->lock );
-    printf( "%s", p_buf );
-    cl_spinlock_release( &p_log->lock );
-
-    /*
-      Flush log on errors too.
-    */
-    if( p_log->flush || (verbosity & OSM_LOG_ERROR) )
-      fflush( stdout );
-  }
+	if (p_log->level & verbosity) {
+		cl_spinlock_acquire(&p_log->lock);
+		printf("%s", p_buf);
+		cl_spinlock_release(&p_log->lock);
+
+		/*
+		   Flush log on errors too.
+		 */
+		if (p_log->flush || (verbosity & OSM_LOG_ERROR))
+			fflush(stdout);
+	}
 }
 
-boolean_t
-osm_is_debug(void)
+boolean_t osm_is_debug(void)
 {
 #if defined( _DEBUG_ )
-  return TRUE;
+	return TRUE;
 #else
-  return FALSE;
-#endif /* defined( _DEBUG_ ) */
+	return FALSE;
+#endif				/* defined( _DEBUG_ ) */
 }
 
-static int
-open_out_port(IN osm_log_t *p_log)
+static int open_out_port(IN osm_log_t * p_log)
 {
-  struct stat st;
-
-  if (p_log->accum_log_file)
-    p_log->out_port = fopen(p_log->log_file_name, "a+");
-  else
-    p_log->out_port = fopen(p_log->log_file_name, "w+");
-
-  if (!p_log->out_port)
-  {
-    if (p_log->accum_log_file)
-      syslog(LOG_CRIT, "Cannot open %s for appending. Permission denied\n",
-	     p_log->log_file_name);
-    else
-      syslog(LOG_CRIT, "Cannot open %s for writing. Permission denied\n",
-	     p_log->log_file_name);
-
-    return(IB_UNKNOWN_ERROR);
-  }
-
-  if (fstat(fileno(p_log->out_port), &st) == 0)
-    p_log->count = st.st_size;
-
-  syslog(LOG_NOTICE, "%s log file opened\n", p_log->log_file_name);
-
-  if (p_log->daemon) {
-    dup2(fileno(p_log->out_port), 0);
-    dup2(fileno(p_log->out_port), 1);
-    dup2(fileno(p_log->out_port), 2);
-  }
-
-  return (0);
+	struct stat st;
+
+	if (p_log->accum_log_file)
+		p_log->out_port = fopen(p_log->log_file_name, "a+");
+	else
+		p_log->out_port = fopen(p_log->log_file_name, "w+");
+
+	if (!p_log->out_port) {
+		if (p_log->accum_log_file)
+			syslog(LOG_CRIT,
+			       "Cannot open %s for appending. Permission denied\n",
+			       p_log->log_file_name);
+		else
+			syslog(LOG_CRIT,
+			       "Cannot open %s for writing. Permission denied\n",
+			       p_log->log_file_name);
+
+		return (IB_UNKNOWN_ERROR);
+	}
+
+	if (fstat(fileno(p_log->out_port), &st) == 0)
+		p_log->count = st.st_size;
+
+	syslog(LOG_NOTICE, "%s log file opened\n", p_log->log_file_name);
+
+	if (p_log->daemon) {
+		dup2(fileno(p_log->out_port), 0);
+		dup2(fileno(p_log->out_port), 1);
+		dup2(fileno(p_log->out_port), 2);
+	}
+
+	return (0);
 }
 
-int
-osm_log_reopen_file(osm_log_t *p_log)
+int osm_log_reopen_file(osm_log_t * p_log)
 {
-  int ret;
-
-  if (p_log->out_port == stdout || p_log->out_port == stderr)
-    return 0;
-  cl_spinlock_acquire(&p_log->lock);
-  fclose(p_log->out_port);
-  ret = open_out_port(p_log);
-  cl_spinlock_release(&p_log->lock);
-  return ret;
+	int ret;
+
+	if (p_log->out_port == stdout || p_log->out_port == stderr)
+		return 0;
+	cl_spinlock_acquire(&p_log->lock);
+	fclose(p_log->out_port);
+	ret = open_out_port(p_log);
+	cl_spinlock_release(&p_log->lock);
+	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 )
+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)
 {
-  p_log->level = log_flags;
-  p_log->flush = flush;
-  p_log->count = 0;
-  p_log->max_size = max_size;
-  p_log->accum_log_file = accum_log_file;
-  p_log->log_file_name = (char *)log_file;
-
-  openlog("OpenSM", LOG_CONS | LOG_PID, LOG_USER);
-
-  if (log_file == NULL || !strcmp(log_file, "-") ||
-      !strcmp(log_file, "stdout"))
-    p_log->out_port = stdout;
-  else if (!strcmp(log_file, "stderr"))
-    p_log->out_port = stderr;
-  else if (open_out_port(p_log))
-    return (IB_UNKNOWN_ERROR);
-
-  if (cl_spinlock_init( &p_log->lock ) == CL_SUCCESS)
-    return IB_SUCCESS;
-  else
-    return IB_ERROR;
+	p_log->level = log_flags;
+	p_log->flush = flush;
+	p_log->count = 0;
+	p_log->max_size = max_size;
+	p_log->accum_log_file = accum_log_file;
+	p_log->log_file_name = (char *)log_file;
+
+	openlog("OpenSM", LOG_CONS | LOG_PID, LOG_USER);
+
+	if (log_file == NULL || !strcmp(log_file, "-") ||
+	    !strcmp(log_file, "stdout"))
+		p_log->out_port = stdout;
+	else if (!strcmp(log_file, "stderr"))
+		p_log->out_port = stderr;
+	else if (open_out_port(p_log))
+		return (IB_UNKNOWN_ERROR);
+
+	if (cl_spinlock_init(&p_log->lock) == CL_SUCCESS)
+		return IB_SUCCESS;
+	else
+		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 )
+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)
 {
-  return osm_log_init_v2( p_log, flush, log_flags, log_file, 0, accum_log_file );
+	return osm_log_init_v2(p_log, flush, log_flags, log_file, 0,
+			       accum_log_file);
 }
diff --git a/opensm/opensm/osm_mad_pool.c b/opensm/opensm/osm_mad_pool.c
index da7c879..c3f3f2a 100644
--- a/opensm/opensm/osm_mad_pool.c
+++ b/opensm/opensm/osm_mad_pool.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of osm_mad_pool_t.
@@ -48,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <string.h>
@@ -60,243 +59,219 @@
 #define OSM_MAD_POOL_MIN_SIZE 256
 #define OSM_MAD_POOL_GROW_SIZE 256
 
-
 /**********************************************************************
  **********************************************************************/
 cl_status_t
-__osm_mad_pool_ctor(
-  IN void* const p_object,
-  IN void* context,
-  OUT cl_pool_item_t** const pp_pool_item )
+__osm_mad_pool_ctor(IN void *const p_object,
+		    IN void *context, OUT cl_pool_item_t ** const pp_pool_item)
 {
-  osm_madw_t *p_madw = p_object;
+	osm_madw_t *p_madw = p_object;
 
-  UNUSED_PARAM( context );
-  osm_madw_construct( p_madw );
-  /* CHECK THIS.  DOCS DON'T DESCRIBE THIS OUT PARAM. */
-  *pp_pool_item = &p_madw->pool_item;
-  return( CL_SUCCESS );
+	UNUSED_PARAM(context);
+	osm_madw_construct(p_madw);
+	/* CHECK THIS.  DOCS DON'T DESCRIBE THIS OUT PARAM. */
+	*pp_pool_item = &p_madw->pool_item;
+	return (CL_SUCCESS);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_mad_pool_construct(
-  IN osm_mad_pool_t* const p_pool )
+void osm_mad_pool_construct(IN osm_mad_pool_t * const p_pool)
 {
-  CL_ASSERT( p_pool );
+	CL_ASSERT(p_pool);
 
-  memset( p_pool, 0, sizeof(*p_pool) );
-  cl_qlock_pool_construct( &p_pool->madw_pool );
+	memset(p_pool, 0, sizeof(*p_pool));
+	cl_qlock_pool_construct(&p_pool->madw_pool);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_mad_pool_destroy(
-  IN osm_mad_pool_t* const p_pool )
+void osm_mad_pool_destroy(IN osm_mad_pool_t * const p_pool)
 {
-  CL_ASSERT( p_pool );
+	CL_ASSERT(p_pool);
 
-  /* HACK: we still rarely see some mads leaking - so ignore this */
-  /* cl_qlock_pool_destroy( &p_pool->madw_pool ); */
+	/* HACK: we still rarely see some mads leaking - so ignore this */
+	/* cl_qlock_pool_destroy( &p_pool->madw_pool ); */
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_mad_pool_init(
-  IN osm_mad_pool_t* const p_pool,
-  IN osm_log_t* const p_log )
+osm_mad_pool_init(IN osm_mad_pool_t * const p_pool, IN osm_log_t * const p_log)
 {
-  ib_api_status_t status;
-
-  OSM_LOG_ENTER( p_log, osm_mad_pool_init );
-
-  p_pool->p_log = p_log;
-
-  status = cl_qlock_pool_init(
-    &p_pool->madw_pool,
-    OSM_MAD_POOL_MIN_SIZE,
-    0,
-    OSM_MAD_POOL_GROW_SIZE,
-    sizeof( osm_madw_t ),
-    __osm_mad_pool_ctor,
-    NULL,
-    p_pool );
-  if( status != IB_SUCCESS )
-  {
-    osm_log( p_log, OSM_LOG_ERROR,
-             "osm_mad_pool_init: ERR 0702: "
-             "Grow pool initialization failed (%s)\n",
-             ib_get_err_str(status) );
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	ib_api_status_t status;
+
+	OSM_LOG_ENTER(p_log, osm_mad_pool_init);
+
+	p_pool->p_log = p_log;
+
+	status = cl_qlock_pool_init(&p_pool->madw_pool,
+				    OSM_MAD_POOL_MIN_SIZE,
+				    0,
+				    OSM_MAD_POOL_GROW_SIZE,
+				    sizeof(osm_madw_t),
+				    __osm_mad_pool_ctor, NULL, p_pool);
+	if (status != IB_SUCCESS) {
+		osm_log(p_log, OSM_LOG_ERROR,
+			"osm_mad_pool_init: ERR 0702: "
+			"Grow pool initialization failed (%s)\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
-osm_madw_t*
-osm_mad_pool_get(
-  IN osm_mad_pool_t* const 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 )
+osm_madw_t *osm_mad_pool_get(IN osm_mad_pool_t * const 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)
 {
-  osm_madw_t *p_madw;
-  ib_mad_t *p_mad;
-
-  OSM_LOG_ENTER( p_pool->p_log, osm_mad_pool_get );
-
-  CL_ASSERT( h_bind != OSM_BIND_INVALID_HANDLE );
-  CL_ASSERT( total_size );
-
-  /*
-    First, acquire a mad wrapper from the mad wrapper pool.
-  */
-  p_madw = (osm_madw_t*)cl_qlock_pool_get( &p_pool->madw_pool );
-  if( p_madw == NULL )
-  {
-    osm_log( p_pool->p_log, OSM_LOG_ERROR,
-             "osm_mad_pool_get: ERR 0703: "
-             "Unable to acquire MAD wrapper object\n" );
-    goto Exit;
-  }
-
-  osm_madw_init( p_madw, h_bind, total_size, p_mad_addr );
-
-  /*
-    Next, acquire a wire mad of the specified size.
-  */
-  p_mad = osm_vendor_get( h_bind, total_size, &p_madw->vend_wrap );
-  if( p_mad == NULL )
-  {
-    osm_log( p_pool->p_log, OSM_LOG_ERROR,
-             "osm_mad_pool_get: ERR 0704: "
-             "Unable to acquire wire MAD\n" );
-
-    /* Don't leak wrappers! */
-    cl_qlock_pool_put( &p_pool->madw_pool, (cl_pool_item_t*)p_madw );
-    p_madw = NULL;
-    goto Exit;
-  }
-
-  cl_atomic_inc( &p_pool->mads_out );
-  /*
-    Finally, attach the wire MAD to this wrapper.
-  */
-  osm_madw_set_mad( p_madw, p_mad );
-
-  osm_log( p_pool->p_log, OSM_LOG_DEBUG,
-           "osm_mad_pool_get: Acquired p_madw = %p, p_mad = %p, "
-           "size = %u\n", p_madw, p_madw->p_mad, total_size );
-
- Exit:
-  OSM_LOG_EXIT( p_pool->p_log );
-  return( p_madw );
+	osm_madw_t *p_madw;
+	ib_mad_t *p_mad;
+
+	OSM_LOG_ENTER(p_pool->p_log, osm_mad_pool_get);
+
+	CL_ASSERT(h_bind != OSM_BIND_INVALID_HANDLE);
+	CL_ASSERT(total_size);
+
+	/*
+	   First, acquire a mad wrapper from the mad wrapper pool.
+	 */
+	p_madw = (osm_madw_t *) cl_qlock_pool_get(&p_pool->madw_pool);
+	if (p_madw == NULL) {
+		osm_log(p_pool->p_log, OSM_LOG_ERROR,
+			"osm_mad_pool_get: ERR 0703: "
+			"Unable to acquire MAD wrapper object\n");
+		goto Exit;
+	}
+
+	osm_madw_init(p_madw, h_bind, total_size, p_mad_addr);
+
+	/*
+	   Next, acquire a wire mad of the specified size.
+	 */
+	p_mad = osm_vendor_get(h_bind, total_size, &p_madw->vend_wrap);
+	if (p_mad == NULL) {
+		osm_log(p_pool->p_log, OSM_LOG_ERROR,
+			"osm_mad_pool_get: ERR 0704: "
+			"Unable to acquire wire MAD\n");
+
+		/* Don't leak wrappers! */
+		cl_qlock_pool_put(&p_pool->madw_pool,
+				  (cl_pool_item_t *) p_madw);
+		p_madw = NULL;
+		goto Exit;
+	}
+
+	cl_atomic_inc(&p_pool->mads_out);
+	/*
+	   Finally, attach the wire MAD to this wrapper.
+	 */
+	osm_madw_set_mad(p_madw, p_mad);
+
+	osm_log(p_pool->p_log, OSM_LOG_DEBUG,
+		"osm_mad_pool_get: Acquired p_madw = %p, p_mad = %p, "
+		"size = %u\n", p_madw, p_madw->p_mad, total_size);
+
+      Exit:
+	OSM_LOG_EXIT(p_pool->p_log);
+	return (p_madw);
 }
 
 /**********************************************************************
  **********************************************************************/
-osm_madw_t*
-osm_mad_pool_get_wrapper(
-  IN osm_mad_pool_t* const 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 )
+osm_madw_t *osm_mad_pool_get_wrapper(IN osm_mad_pool_t * const 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)
 {
-  osm_madw_t *p_madw;
-
-  OSM_LOG_ENTER( p_pool->p_log, osm_mad_pool_get_wrapper );
-
-  CL_ASSERT( h_bind != OSM_BIND_INVALID_HANDLE );
-  CL_ASSERT( total_size );
-  CL_ASSERT( p_mad );
-
-  /*
-    First, acquire a mad wrapper from the mad wrapper pool.
-  */
-  p_madw = (osm_madw_t*)cl_qlock_pool_get( &p_pool->madw_pool );
-  if( p_madw == NULL )
-  {
-    osm_log( p_pool->p_log, OSM_LOG_ERROR,
-             "osm_mad_pool_get_wrapper: ERR 0705: "
-             "Unable to acquire MAD wrapper object\n" );
-    goto Exit;
-  }
-
-  /*
-    Finally, initialize the wrapper object.
-  */
-  cl_atomic_inc( &p_pool->mads_out );
-  osm_madw_init( p_madw, h_bind, total_size, p_mad_addr );
-  osm_madw_set_mad( p_madw, p_mad );
-
-  osm_log( p_pool->p_log, OSM_LOG_DEBUG,
-           "osm_mad_pool_get_wrapper: Acquired p_madw = %p, p_mad = %p "
-           "size = %u\n", p_madw, p_madw->p_mad, total_size );
-
- Exit:
-  OSM_LOG_EXIT( p_pool->p_log );
-  return( p_madw );
+	osm_madw_t *p_madw;
+
+	OSM_LOG_ENTER(p_pool->p_log, osm_mad_pool_get_wrapper);
+
+	CL_ASSERT(h_bind != OSM_BIND_INVALID_HANDLE);
+	CL_ASSERT(total_size);
+	CL_ASSERT(p_mad);
+
+	/*
+	   First, acquire a mad wrapper from the mad wrapper pool.
+	 */
+	p_madw = (osm_madw_t *) cl_qlock_pool_get(&p_pool->madw_pool);
+	if (p_madw == NULL) {
+		osm_log(p_pool->p_log, OSM_LOG_ERROR,
+			"osm_mad_pool_get_wrapper: ERR 0705: "
+			"Unable to acquire MAD wrapper object\n");
+		goto Exit;
+	}
+
+	/*
+	   Finally, initialize the wrapper object.
+	 */
+	cl_atomic_inc(&p_pool->mads_out);
+	osm_madw_init(p_madw, h_bind, total_size, p_mad_addr);
+	osm_madw_set_mad(p_madw, p_mad);
+
+	osm_log(p_pool->p_log, OSM_LOG_DEBUG,
+		"osm_mad_pool_get_wrapper: Acquired p_madw = %p, p_mad = %p "
+		"size = %u\n", p_madw, p_madw->p_mad, total_size);
+
+      Exit:
+	OSM_LOG_EXIT(p_pool->p_log);
+	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 * const p_pool)
 {
-  osm_madw_t *p_madw;
+	osm_madw_t *p_madw;
 
-  OSM_LOG_ENTER( p_pool->p_log, osm_mad_pool_get_wrapper_raw );
+	OSM_LOG_ENTER(p_pool->p_log, osm_mad_pool_get_wrapper_raw);
 
-  p_madw = (osm_madw_t*)cl_qlock_pool_get( &p_pool->madw_pool );
+	p_madw = (osm_madw_t *) cl_qlock_pool_get(&p_pool->madw_pool);
 
-  osm_log( p_pool->p_log, OSM_LOG_DEBUG,
-           "osm_mad_pool_get_wrapper_raw: "
-           "Getting p_madw = %p\n", p_madw );
+	osm_log(p_pool->p_log, OSM_LOG_DEBUG,
+		"osm_mad_pool_get_wrapper_raw: "
+		"Getting p_madw = %p\n", p_madw);
 
-  osm_madw_init( p_madw, 0, 0, 0 );
-  osm_madw_set_mad( p_madw, 0 );
-  cl_atomic_inc( &p_pool->mads_out );
+	osm_madw_init(p_madw, 0, 0, 0);
+	osm_madw_set_mad(p_madw, 0);
+	cl_atomic_inc(&p_pool->mads_out);
 
-  OSM_LOG_EXIT( p_pool->p_log );
-  return( p_madw );
+	OSM_LOG_EXIT(p_pool->p_log);
+	return (p_madw);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-osm_mad_pool_put(
-  IN osm_mad_pool_t* const p_pool,
-  IN osm_madw_t* const p_madw )
+osm_mad_pool_put(IN osm_mad_pool_t * const p_pool, IN osm_madw_t * const p_madw)
 {
-  OSM_LOG_ENTER( p_pool->p_log, osm_mad_pool_put );
+	OSM_LOG_ENTER(p_pool->p_log, osm_mad_pool_put);
 
-  CL_ASSERT( p_madw );
+	CL_ASSERT(p_madw);
 
-  osm_log( p_pool->p_log, OSM_LOG_DEBUG,
-           "osm_mad_pool_put: Releasing p_madw = %p, p_mad = %p\n",
-           p_madw, p_madw->p_mad );
+	osm_log(p_pool->p_log, OSM_LOG_DEBUG,
+		"osm_mad_pool_put: Releasing p_madw = %p, p_mad = %p\n",
+		p_madw, p_madw->p_mad);
 
-  /*
-    First, return the wire mad to the pool
-  */
-  if( p_madw->p_mad )
-    osm_vendor_put( p_madw->h_bind, &p_madw->vend_wrap );
+	/*
+	   First, return the wire mad to the pool
+	 */
+	if (p_madw->p_mad)
+		osm_vendor_put(p_madw->h_bind, &p_madw->vend_wrap);
 
-  /*
-    Return the mad wrapper to the wrapper pool
-  */
-  cl_qlock_pool_put( &p_pool->madw_pool, (cl_pool_item_t*)p_madw );
-  cl_atomic_dec( &p_pool->mads_out );
+	/*
+	   Return the mad wrapper to the wrapper pool
+	 */
+	cl_qlock_pool_put(&p_pool->madw_pool, (cl_pool_item_t *) p_madw);
+	cl_atomic_dec(&p_pool->mads_out);
 
-  OSM_LOG_EXIT( p_pool->p_log );
+	OSM_LOG_EXIT(p_pool->p_log);
 }
-
diff --git a/opensm/opensm/osm_mcast_fwd_rcv.c b/opensm/opensm/osm_mcast_fwd_rcv.c
index e3e9491..aa497b5 100644
--- a/opensm/opensm/osm_mcast_fwd_rcv.c
+++ b/opensm/opensm/osm_mcast_fwd_rcv.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -62,122 +62,109 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_mft_rcv_construct(
-  IN osm_mft_rcv_t* const p_rcv )
+void osm_mft_rcv_construct(IN osm_mft_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
+	memset(p_rcv, 0, sizeof(*p_rcv));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_mft_rcv_destroy(
-  IN osm_mft_rcv_t* const p_rcv )
+void osm_mft_rcv_destroy(IN osm_mft_rcv_t * const p_rcv)
 {
-  CL_ASSERT( p_rcv );
+	CL_ASSERT(p_rcv);
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_mft_rcv_destroy );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_mft_rcv_destroy);
 
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_mft_rcv_init(
-  IN osm_mft_rcv_t* const p_rcv,
-  IN osm_subn_t* const p_subn,
-  IN osm_log_t* const p_log,
-  IN cl_plock_t* const p_lock )
+osm_mft_rcv_init(IN osm_mft_rcv_t * const p_rcv,
+		 IN osm_subn_t * const p_subn,
+		 IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_mft_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_mft_rcv_init);
 
-  osm_mft_rcv_construct( p_rcv );
+	osm_mft_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
 
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_mft_rcv_process(
-  IN void *context,
-  IN void *data )
+void osm_mft_rcv_process(IN void *context, IN void *data)
 {
-  osm_mft_rcv_t *p_rcv = context;
-  osm_madw_t *p_madw = data;
-  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( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_mft_rcv_process );
-
-  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);
-
-  /*
-    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;
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_mft_rcv_process: "
-             "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 ) );
-  }
-
-  CL_PLOCK_EXCL_ACQUIRE( p_rcv->p_lock );
-  p_sw = osm_get_switch_by_guid( p_rcv->p_subn, node_guid );
-
-  if( !p_sw )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_mft_rcv_process: 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( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_mft_rcv_process: 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 );
-    }
-  }
-
-  CL_PLOCK_RELEASE( p_rcv->p_lock );
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_mft_rcv_t *p_rcv = context;
+	osm_madw_t *p_madw = data;
+	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(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_mft_rcv_process);
+
+	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);
+
+	/*
+	   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;
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"osm_mft_rcv_process: "
+			"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));
+	}
+
+	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
+	p_sw = osm_get_switch_by_guid(p_rcv->p_subn, node_guid);
+
+	if (!p_sw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_mft_rcv_process: 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(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_mft_rcv_process: 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);
+		}
+	}
+
+	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_mcast_mgr.c b/opensm/opensm/osm_mcast_mgr.c
index 5f64b19..d1ecf61 100644
--- a/opensm/opensm/osm_mcast_mgr.c
+++ b/opensm/opensm/osm_mcast_mgr.c
@@ -46,7 +46,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <string.h>
@@ -62,143 +62,134 @@
 
 /**********************************************************************
  **********************************************************************/
-typedef struct _osm_mcast_work_obj
-{
-  cl_list_item_t     list_item;
-  osm_port_t*        p_port;
+typedef struct _osm_mcast_work_obj {
+	cl_list_item_t list_item;
+	osm_port_t *p_port;
 } 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 *__osm_mcast_work_obj_new(IN const osm_port_t *
+						      const p_port)
 {
-  /*
-    TO DO - get these objects from a lockpool.
-  */
-  osm_mcast_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 = malloc( sizeof( *p_obj ) );
-  if( p_obj )
-  {
-    memset( p_obj, 0, sizeof( *p_obj ) );
-    p_obj->p_port = (osm_port_t*)p_port;
-  }
-
-  return( p_obj );
+	/*
+	   TO DO - get these objects from a lockpool.
+	 */
+	osm_mcast_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 = malloc(sizeof(*p_obj));
+	if (p_obj) {
+		memset(p_obj, 0, sizeof(*p_obj));
+		p_obj->p_port = (osm_port_t *) p_port;
+	}
+
+	return (p_obj);
 }
 
 /**********************************************************************
  **********************************************************************/
-static void
-__osm_mcast_work_obj_delete(
-  IN osm_mcast_work_obj_t* p_wobj )
+static void __osm_mcast_work_obj_delete(IN osm_mcast_work_obj_t * p_wobj)
 {
-  free( p_wobj );
+	free(p_wobj);
 }
 
 /**********************************************************************
  Recursively remove nodes from the tree
  *********************************************************************/
-static void
-__osm_mcast_mgr_purge_tree_node(
-  IN osm_mtree_node_t*     p_mtn )
+static void __osm_mcast_mgr_purge_tree_node(IN osm_mtree_node_t * p_mtn)
 {
-  uint8_t                  i;
+	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] );
+	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]);
 
-    p_mtn->child_array[i] = NULL;
+		p_mtn->child_array[i] = NULL;
 
-  }
+	}
 
-  free( p_mtn );
+	free(p_mtn);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_mcast_mgr_purge_tree(
-  IN osm_mcast_mgr_t*      const p_mgr,
-  IN osm_mgrp_t*           const p_mgrp )
+__osm_mcast_mgr_purge_tree(IN osm_mcast_mgr_t * const p_mgr,
+			   IN osm_mgrp_t * const p_mgrp)
 {
-  OSM_LOG_ENTER( p_mgr->p_log, __osm_mcast_mgr_purge_tree );
+	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_purge_tree);
 
-  if( p_mgrp->p_root )
-    __osm_mcast_mgr_purge_tree_node( p_mgrp->p_root );
+	if (p_mgrp->p_root)
+		__osm_mcast_mgr_purge_tree_node(p_mgrp->p_root);
 
-  p_mgrp->p_root = NULL;
+	p_mgrp->p_root = NULL;
 
-  OSM_LOG_EXIT( p_mgr->p_log );
+	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static float
-osm_mcast_mgr_compute_avg_hops(
-  osm_mcast_mgr_t*         const p_mgr,
-  const osm_mgrp_t*        const p_mgrp,
-  const osm_switch_t*      const p_sw )
+osm_mcast_mgr_compute_avg_hops(osm_mcast_mgr_t * const p_mgr,
+			       const osm_mgrp_t * const p_mgrp,
+			       const osm_switch_t * const p_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;
-
-  OSM_LOG_ENTER( p_mgr->p_log, osm_mcast_mgr_compute_avg_hops );
-
-  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( p_mgr->p_subn,
-                                   ib_gid_get_guid( &p_mcm_port->port_gid ) );
-
-    if( !p_port )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-               "osm_mcast_mgr_compute_avg_hops: 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++;
-  }
-
-  /*
-    We should 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);
-
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return( avg_hops );
+	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;
+
+	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_compute_avg_hops);
+
+	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(p_mgr->p_subn,
+					      ib_gid_get_guid(&p_mcm_port->
+							      port_gid));
+
+		if (!p_port) {
+			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+				"osm_mcast_mgr_compute_avg_hops: 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++;
+	}
+
+	/*
+	   We should 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);
+
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return (avg_hops);
 }
 
 /**********************************************************************
@@ -206,60 +197,59 @@ osm_mcast_mgr_compute_avg_hops(
  of the group HCAs
  **********************************************************************/
 static float
-osm_mcast_mgr_compute_max_hops(
-  osm_mcast_mgr_t*         const p_mgr,
-  const osm_mgrp_t*        const p_mgrp,
-  const osm_switch_t*      const p_sw )
+osm_mcast_mgr_compute_max_hops(osm_mcast_mgr_t * const p_mgr,
+			       const osm_mgrp_t * const p_mgrp,
+			       const osm_switch_t * const p_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;
-
-  OSM_LOG_ENTER( p_mgr->p_log, osm_mcast_mgr_compute_max_hops );
-
-  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( p_mgr->p_subn,
-                                   ib_gid_get_guid( &p_mcm_port->port_gid ) );
-
-    if( !p_port )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-               "osm_mcast_mgr_compute_max_hops: 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 );
-    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 */
-  }
-
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return(float)(max_hops);
+	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;
+
+	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_compute_max_hops);
+
+	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(p_mgr->p_subn,
+					      ib_gid_get_guid(&p_mcm_port->
+							      port_gid));
+
+		if (!p_port) {
+			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+				"osm_mcast_mgr_compute_max_hops: 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);
+		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 */
+	}
+
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return (float)(max_hops);
 }
 
 /**********************************************************************
@@ -268,239 +258,225 @@ osm_mcast_mgr_compute_max_hops(
    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_mcast_mgr_t*         const p_mgr,
-  const osm_mgrp_t*        const p_mgrp )
+static osm_switch_t *__osm_mcast_mgr_find_optimal_switch(osm_mcast_mgr_t *
+							 const p_mgr,
+							 const osm_mgrp_t *
+							 const p_mgrp)
 {
-  cl_qmap_t*               p_sw_tbl;
-  const osm_switch_t*      p_sw;
-  const osm_switch_t*      p_best_sw = NULL;
-  float                    hops = 0;
-  float                    best_hops = 10000;   /* any big # will do */
-  uint64_t                 sw_guid_ho;
+	cl_qmap_t *p_sw_tbl;
+	const osm_switch_t *p_sw;
+	const osm_switch_t *p_best_sw = NULL;
+	float hops = 0;
+	float best_hops = 10000;	/* any big # will do */
+	uint64_t sw_guid_ho;
 #ifdef OSM_VENDOR_INTF_ANAFA
-  boolean_t                use_avg_hops = TRUE; /* anafa2 - bug hca on switch */ /* use max hops for root */
+	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 */
+	boolean_t use_avg_hops = FALSE;	/* use max hops for root */
 #endif
 
-  OSM_LOG_ENTER( p_mgr->p_log, __osm_mcast_mgr_find_optimal_switch );
-
-  p_sw_tbl = &p_mgr->p_subn->sw_guid_tbl;
-
-  CL_ASSERT( !osm_mgrp_is_empty( p_mgrp ) );
-
-  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( p_mgr, p_mgrp, p_sw );
-    else
-      hops = osm_mcast_mgr_compute_max_hops( p_mgr, p_mgrp, p_sw );
-
-    if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-    {
-      sw_guid_ho = cl_ntoh64( osm_node_get_node_guid(p_sw->p_node) );
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-               "__osm_mcast_mgr_find_optimal_switch: "
-               "Switch 0x%016" PRIx64 ", hops = %f\n",
-               sw_guid_ho, hops );
-    }
-
-    if( hops < best_hops )
-    {
-      p_best_sw = p_sw;
-      best_hops = hops;
-    }
-  }
-
-  if( osm_log_is_active( p_mgr->p_log, OSM_LOG_VERBOSE ) )
-  {
-    if( p_best_sw )
-    {
-      sw_guid_ho = cl_ntoh64( osm_node_get_node_guid(p_best_sw->p_node) );
-      osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-               "__osm_mcast_mgr_find_optimal_switch: "
-               "Best switch is 0x%" PRIx64 ", hops = %f\n",
-               sw_guid_ho, best_hops );
-    }
-    else
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-               "__osm_mcast_mgr_find_optimal_switch: "
-               "No multicast capable switches detected\n" );
-    }
-  }
-
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return( (osm_switch_t*)p_best_sw );
+	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_find_optimal_switch);
+
+	p_sw_tbl = &p_mgr->p_subn->sw_guid_tbl;
+
+	CL_ASSERT(!osm_mgrp_is_empty(p_mgrp));
+
+	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(p_mgr, p_mgrp, p_sw);
+		else
+			hops =
+			    osm_mcast_mgr_compute_max_hops(p_mgr, p_mgrp, p_sw);
+
+		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+			sw_guid_ho =
+			    cl_ntoh64(osm_node_get_node_guid(p_sw->p_node));
+			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				"__osm_mcast_mgr_find_optimal_switch: "
+				"Switch 0x%016" PRIx64 ", hops = %f\n",
+				sw_guid_ho, hops);
+		}
+
+		if (hops < best_hops) {
+			p_best_sw = p_sw;
+			best_hops = hops;
+		}
+	}
+
+	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_VERBOSE)) {
+		if (p_best_sw) {
+			sw_guid_ho =
+			    cl_ntoh64(osm_node_get_node_guid
+				      (p_best_sw->p_node));
+			osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+				"__osm_mcast_mgr_find_optimal_switch: "
+				"Best switch is 0x%" PRIx64 ", hops = %f\n",
+				sw_guid_ho, best_hops);
+		} else {
+			osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+				"__osm_mcast_mgr_find_optimal_switch: "
+				"No multicast capable switches detected\n");
+		}
+	}
+
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return ((osm_switch_t *) p_best_sw);
 }
 
 /**********************************************************************
    This function returns the existing or optimal root swtich for the tree.
 **********************************************************************/
-static osm_switch_t*
-__osm_mcast_mgr_find_root_switch(
-  osm_mcast_mgr_t* const p_mgr,
-  const osm_mgrp_t* const p_mgrp )
+static osm_switch_t *__osm_mcast_mgr_find_root_switch(osm_mcast_mgr_t *
+						      const p_mgr,
+						      const osm_mgrp_t *
+						      const p_mgrp)
 {
-  const osm_switch_t* p_sw = NULL;
+	const osm_switch_t *p_sw = NULL;
 
-  OSM_LOG_ENTER( p_mgr->p_log, __osm_mcast_mgr_find_root_switch );
+	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_find_root_switch);
 
-  /*
-    We always look for the best multicast tree root switch.
-    Otherwise since we always start with a a single join
-    the root will be always on the first switch attached to it.
-    - Very bad ...
-  */
-  p_sw = __osm_mcast_mgr_find_optimal_switch( p_mgr, p_mgrp );
+	/*
+	   We always look for the best multicast tree root switch.
+	   Otherwise since we always start with a a single join
+	   the root will be always on the first switch attached to it.
+	   - Very bad ...
+	 */
+	p_sw = __osm_mcast_mgr_find_optimal_switch(p_mgr, p_mgrp);
 
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return( (osm_switch_t*)p_sw );
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return ((osm_switch_t *) p_sw);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_mcast_mgr_construct(
-  IN osm_mcast_mgr_t* const p_mgr )
+void osm_mcast_mgr_construct(IN osm_mcast_mgr_t * const p_mgr)
 {
-  memset( p_mgr, 0, sizeof(*p_mgr) );
+	memset(p_mgr, 0, sizeof(*p_mgr));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_mcast_mgr_destroy(
-  IN osm_mcast_mgr_t* const p_mgr )
+void osm_mcast_mgr_destroy(IN osm_mcast_mgr_t * const p_mgr)
 {
-  CL_ASSERT( p_mgr );
+	CL_ASSERT(p_mgr);
 
-  OSM_LOG_ENTER( p_mgr->p_log, osm_mcast_mgr_destroy );
+	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_destroy);
 
-  OSM_LOG_EXIT( p_mgr->p_log );
+	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_mcast_mgr_init(
-  IN osm_mcast_mgr_t*         const p_mgr,
-  IN osm_req_t*            const p_req,
-  IN osm_subn_t*           const p_subn,
-  IN osm_log_t*            const p_log,
-  IN cl_plock_t*           const p_lock )
+osm_mcast_mgr_init(IN osm_mcast_mgr_t * const p_mgr,
+		   IN osm_req_t * const p_req,
+		   IN osm_subn_t * const p_subn,
+		   IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t          status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_mcast_mgr_init );
+	OSM_LOG_ENTER(p_log, osm_mcast_mgr_init);
 
-  CL_ASSERT( p_req );
-  CL_ASSERT( p_subn );
-  CL_ASSERT( p_lock );
+	CL_ASSERT(p_req);
+	CL_ASSERT(p_subn);
+	CL_ASSERT(p_lock);
 
-  osm_mcast_mgr_construct( p_mgr );
+	osm_mcast_mgr_construct(p_mgr);
 
-  p_mgr->p_log = p_log;
-  p_mgr->p_subn = p_subn;
-  p_mgr->p_lock = p_lock;
-  p_mgr->p_req = p_req;
+	p_mgr->p_log = p_log;
+	p_mgr->p_subn = p_subn;
+	p_mgr->p_lock = p_lock;
+	p_mgr->p_req = p_req;
 
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return( status );
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static osm_signal_t
-__osm_mcast_mgr_set_tbl(
-  IN osm_mcast_mgr_t*      const p_mgr,
-  IN osm_switch_t*         const p_sw )
+__osm_mcast_mgr_set_tbl(IN osm_mcast_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       mad_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;
-  osm_mcast_tbl_t*         p_tbl;
-  ib_net16_t               block[IB_MCAST_BLOCK_SIZE];
-  osm_signal_t             signal = OSM_SIGNAL_DONE;
-
-  CL_ASSERT( p_mgr );
-
-  OSM_LOG_ENTER( p_mgr->p_log, __osm_mcast_mgr_set_tbl );
-
-  CL_ASSERT( p_sw );
-
-  p_node = p_sw->p_node;
-
-  CL_ASSERT( p_node );
-
-  p_path = osm_node_get_any_dr_path_ptr( p_node );
-
-  CL_ASSERT( p_path );
-
-  /*
-    Send multicast forwarding table blocks to the switch
-    as long as the switch indicates it has blocks needing
-    configuration.
-  */
-
-  mad_context.mft_context.node_guid = osm_node_get_node_guid( p_node );
-  mad_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 ) )
-  {
-    if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-               "__osm_mcast_mgr_set_tbl: "
-               "Writing MFT block 0x%X\n", block_id_ho );
-    }
-
-    block_id_ho = block_num + (position << 28);
-
-    status = osm_req_set( p_mgr->p_req,
-                          p_path,
-                          (void*)block,
-                          sizeof(block),
-                          IB_MAD_ATTR_MCAST_FWD_TBL,
-                          cl_hton32( block_id_ho ),
-                          CL_DISP_MSGID_NONE,
-                          &mad_context );
-
-    if( status != IB_SUCCESS )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-               "__osm_mcast_mgr_set_tbl: 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++;
-    }
-  }
-
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return( signal );
+	osm_node_t *p_node;
+	osm_dr_path_t *p_path;
+	osm_madw_context_t mad_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;
+	osm_mcast_tbl_t *p_tbl;
+	ib_net16_t block[IB_MCAST_BLOCK_SIZE];
+	osm_signal_t signal = OSM_SIGNAL_DONE;
+
+	CL_ASSERT(p_mgr);
+
+	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_set_tbl);
+
+	CL_ASSERT(p_sw);
+
+	p_node = p_sw->p_node;
+
+	CL_ASSERT(p_node);
+
+	p_path = osm_node_get_any_dr_path_ptr(p_node);
+
+	CL_ASSERT(p_path);
+
+	/*
+	   Send multicast forwarding table blocks to the switch
+	   as long as the switch indicates it has blocks needing
+	   configuration.
+	 */
+
+	mad_context.mft_context.node_guid = osm_node_get_node_guid(p_node);
+	mad_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)) {
+		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				"__osm_mcast_mgr_set_tbl: "
+				"Writing MFT block 0x%X\n", block_id_ho);
+		}
+
+		block_id_ho = block_num + (position << 28);
+
+		status = osm_req_set(p_mgr->p_req,
+				     p_path,
+				     (void *)block,
+				     sizeof(block),
+				     IB_MAD_ATTR_MCAST_FWD_TBL,
+				     cl_hton32(block_id_ho),
+				     CL_DISP_MSGID_NONE, &mad_context);
+
+		if (status != IB_SUCCESS) {
+			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+				"__osm_mcast_mgr_set_tbl: 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++;
+		}
+	}
+
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return (signal);
 }
 
 /**********************************************************************
@@ -509,106 +485,106 @@ __osm_mcast_mgr_set_tbl(
   contains the group members that must be routed from this switch.
 **********************************************************************/
 static void
-__osm_mcast_mgr_subdivide(
-  osm_mcast_mgr_t*         const p_mgr,
-  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 )
+__osm_mcast_mgr_subdivide(osm_mcast_mgr_t * const p_mgr,
+			  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)
 {
-  uint8_t                  port_num;
-  uint16_t                 mlid_ho;
-  boolean_t                ignore_existing;
-  osm_mcast_work_obj_t*    p_wobj;
-
-  OSM_LOG_ENTER( p_mgr->p_log, __osm_mcast_mgr_subdivide );
-
-  mlid_ho = cl_ntoh16( osm_mgrp_get_mlid( p_mgrp ) );
-
-  /*
-     For Multicast Groups, we want not to count on previous
-     configurations - since we can easily generate a storm
-     by loops.
-  */
-  ignore_existing = TRUE;
-
-  /*
-    Subdivide the set of ports into non-overlapping subsets
-    that will be routed to other switches.
-  */
-  while( (p_wobj = (osm_mcast_work_obj_t*)cl_qlist_remove_head( p_list )) !=
-         (osm_mcast_work_obj_t*)cl_qlist_end( p_list ) )
-  {
-    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( p_mgr->p_log, OSM_LOG_ERROR,
-               "__osm_mcast_mgr_subdivide: 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 0x%X\n",
-               mlid_ho, node_guid_ho,
-               cl_ntoh16(osm_port_get_base_lid(p_wobj->p_port)) );
-
-      __osm_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( p_mgr->p_log, OSM_LOG_ERROR,
-               "__osm_mcast_mgr_subdivide: 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 0x%X\n",
-               mlid_ho, node_guid_ho,
-               cl_ntoh16(osm_port_get_base_lid(p_wobj->p_port)) );
-
-      __osm_mcast_work_obj_delete( p_wobj );
-
-      /* This is means OpenSM has a bug. */
-      CL_ASSERT( FALSE );
-      continue;
-    }
-
-    cl_qlist_insert_tail( &list_array[port_num], &p_wobj->list_item );
-  }
-
-  OSM_LOG_EXIT( p_mgr->p_log );
+	uint8_t port_num;
+	uint16_t mlid_ho;
+	boolean_t ignore_existing;
+	osm_mcast_work_obj_t *p_wobj;
+
+	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_subdivide);
+
+	mlid_ho = cl_ntoh16(osm_mgrp_get_mlid(p_mgrp));
+
+	/*
+	   For Multicast Groups, we want not to count on previous
+	   configurations - since we can easily generate a storm
+	   by loops.
+	 */
+	ignore_existing = TRUE;
+
+	/*
+	   Subdivide the set of ports into non-overlapping subsets
+	   that will be routed to other switches.
+	 */
+	while ((p_wobj =
+		(osm_mcast_work_obj_t *) cl_qlist_remove_head(p_list)) !=
+	       (osm_mcast_work_obj_t *) cl_qlist_end(p_list)) {
+		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(p_mgr->p_log, OSM_LOG_ERROR,
+				"__osm_mcast_mgr_subdivide: 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 0x%X\n", mlid_ho, node_guid_ho,
+				cl_ntoh16(osm_port_get_base_lid
+					  (p_wobj->p_port)));
+
+			__osm_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(p_mgr->p_log, OSM_LOG_ERROR,
+				"__osm_mcast_mgr_subdivide: 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 0x%X\n", mlid_ho, node_guid_ho,
+				cl_ntoh16(osm_port_get_base_lid
+					  (p_wobj->p_port)));
+
+			__osm_mcast_work_obj_delete(p_wobj);
+
+			/* This is means OpenSM has a bug. */
+			CL_ASSERT(FALSE);
+			continue;
+		}
+
+		cl_qlist_insert_tail(&list_array[port_num], &p_wobj->list_item);
+	}
+
+	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_mcast_mgr_purge_list(
-  osm_mcast_mgr_t*         const p_mgr,
-  cl_qlist_t*              const p_list )
+__osm_mcast_mgr_purge_list(osm_mcast_mgr_t * const p_mgr,
+			   cl_qlist_t * const p_list)
 {
-  osm_mcast_work_obj_t*    p_wobj;
+	osm_mcast_work_obj_t *p_wobj;
 
-  OSM_LOG_ENTER( p_mgr->p_log, __osm_mcast_mgr_purge_list );
+	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_purge_list);
 
-  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( p_mgr->p_log, OSM_LOG_ERROR,
-             "__osm_mcast_mgr_purge_list: 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 );
-  }
+	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(p_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_mcast_mgr_purge_list: 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);
+	}
 
-  OSM_LOG_EXIT( p_mgr->p_log );
+	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
 /**********************************************************************
@@ -618,362 +594,346 @@ __osm_mcast_mgr_purge_list(
 
   The function returns the newly created mtree node element.
 **********************************************************************/
-static osm_mtree_node_t*
-__osm_mcast_mgr_branch(
-  osm_mcast_mgr_t*         const p_mgr,
-  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 *__osm_mcast_mgr_branch(osm_mcast_mgr_t * const p_mgr,
+						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)
 {
-  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( p_mgr->p_log, __osm_mcast_mgr_branch );
-
-  CL_ASSERT( p_sw );
-  CL_ASSERT( p_list );
-  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 ) );
-
-  if( osm_log_is_active( p_mgr->p_log, OSM_LOG_VERBOSE ) )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-             "__osm_mcast_mgr_branch: "
-             "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 );
-  }
-
-  CL_ASSERT( cl_qlist_count( p_list ) > 0 );
-
-  depth++;
-
-  if( depth > *p_max_depth )
-  {
-    CL_ASSERT( depth == *p_max_depth + 1 );
-    *p_max_depth = depth;
-  }
-
-  if( osm_switch_supports_mcast( p_sw ) == FALSE )
-  {
-    /*
-      This switch doesn't do multicast.  Clean-up.
-    */
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "__osm_mcast_mgr_branch: ERR 0A14: "
-             "Switch 0x%" PRIx64 " does not support multicast\n",
-             node_guid_ho );
-
-    /*
-      Deallocate all the work objects on this branch of the tree.
-    */
-    __osm_mcast_mgr_purge_list( p_mgr, p_list );
-    goto Exit;
-  }
-
-  p_mtn = osm_mtree_node_new( p_sw );
-  if( p_mtn == NULL )
-  {
-    /*
-      We are unable to continue routing down this
-      leg of the tree.  Clean-up.
-    */
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "__osm_mcast_mgr_branch: ERR 0A15: "
-             "Insufficient memory to build multicast tree\n" );
-
-    /*
-      Deallocate all the work objects on this branch of the tree.
-    */
-    __osm_mcast_mgr_purge_list( p_mgr, p_list );
-    goto Exit;
-  }
-
-  max_children = osm_mtree_node_get_max_children( p_mtn );
-
-  CL_ASSERT( max_children > 1 );
-
-  /*
-    Prepare an empty list for each port in the switch.
-    TO DO - this list array could probably be moved
-    inside the switch element to save on malloc thrashing.
-  */
-  list_array = malloc( sizeof(cl_qlist_t) * max_children );
-  if( list_array == NULL )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "__osm_mcast_mgr_branch: ERR 0A16: "
-             "Unable to allocate list array\n" );
-    __osm_mcast_mgr_purge_list( p_mgr, p_list );
-    goto Exit;
-  }
-
-  memset( list_array, 0, sizeof(cl_qlist_t) * max_children );
-
-  for( i = 0; i < max_children; i++ )
-    cl_qlist_init( &list_array[i] );
-
-  __osm_mcast_mgr_subdivide( p_mgr, p_mgrp, p_sw, p_list, list_array,
-                             max_children );
-
-  p_tbl = osm_switch_get_mcast_tbl_ptr( p_sw );
-
-  /*
-    Add the upstream port to the forwarding table unless
-    we're at the root of the spanning tree.
-  */
-  if( depth > 1 )
-  {
-    if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-               "__osm_mcast_mgr_branch: "
-               "Adding upstream port 0x%X\n", upstream_port );
-    }
-
-    CL_ASSERT( upstream_port );
-    osm_mcast_tbl_set( p_tbl, mlid_ho, upstream_port );
-  }
-
-  /*
-    For each port that was allocated some routes,
-    recurse into this function to continue building the tree
-    if the node on the other end of that port is another switch.
-    Otherwise, the node is an endpoint, and we've found a leaf
-    of the tree.  Mark leaves with our special pointer value.
-  */
-
-  for( i = 0; i < max_children; i++ )
-  {
-    const osm_physp_t   *p_physp;
-    const osm_physp_t   *p_remote_physp;
-    const osm_node_t    *p_node;
-    const osm_node_t    *p_remote_node;
-
-    p_port_list = &list_array[i];
-
-    count = cl_qlist_count( p_port_list );
-
-    /*
-      There should be no children routed through the upstream port!
-    */
-    CL_ASSERT( ( upstream_port == 0 ) || ( i != upstream_port) ||
-               ( (i == upstream_port) && (count == 0)) );
-
-    if( count == 0)
-      continue;      /* No routes down this port. */
-
-    if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-               "__osm_mcast_mgr_branch: "
-               "Routing %zu destinations via switch port 0x%X\n",
-               count, i );
-    }
-
-    /*
-      This port routes frames for this mcast group.  Therefore,
-      set the appropriate bit in the multicast forwarding
-      table for this switch.
-    */
-    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 */
-      continue;
-
-    p_node = p_sw->p_node;
-    p_remote_node = osm_node_get_remote_node( p_node, i, NULL );
-
-    if( osm_node_get_type( p_remote_node ) == IB_NODE_TYPE_SWITCH )
-    {
-      /*
-        Acquire a pointer to the remote switch then recurse.
-      */
-      CL_ASSERT( p_remote_node->sw );
-
-      p_physp = osm_node_get_physp_ptr( p_node, i );
-      CL_ASSERT( osm_physp_is_valid( p_physp ) );
-
-      p_remote_physp = osm_physp_get_remote( p_physp );
-      CL_ASSERT( p_remote_physp );
-      CL_ASSERT( osm_physp_is_valid( p_remote_physp ) );
-
-      p_mtn->child_array[i] = __osm_mcast_mgr_branch(
-        p_mgr, p_mgrp, 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
-        must be a leaf.
-      */
-      CL_ASSERT( count == 1 );
-
-      p_mtn->child_array[i] = OSM_MTREE_LEAF;
-      p_wobj = (osm_mcast_work_obj_t*)cl_qlist_remove_head(
-        p_port_list );
-
-      CL_ASSERT( cl_is_qlist_empty( p_port_list ) );
-
-      if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-      {
-        osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-                 "__osm_mcast_mgr_branch: "
-                 "Found leaf for port 0x%016" PRIx64
-                 " on switch port 0x%X\n",
-                 cl_ntoh64( osm_port_get_guid( p_wobj->p_port ) ), i );
-      }
-
-      __osm_mcast_work_obj_delete( p_wobj );
-    }
-  }
-
-  free( list_array );
- Exit:
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return( p_mtn );
+	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(p_mgr->p_log, __osm_mcast_mgr_branch);
+
+	CL_ASSERT(p_sw);
+	CL_ASSERT(p_list);
+	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));
+
+	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_VERBOSE)) {
+		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+			"__osm_mcast_mgr_branch: "
+			"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);
+	}
+
+	CL_ASSERT(cl_qlist_count(p_list) > 0);
+
+	depth++;
+
+	if (depth > *p_max_depth) {
+		CL_ASSERT(depth == *p_max_depth + 1);
+		*p_max_depth = depth;
+	}
+
+	if (osm_switch_supports_mcast(p_sw) == FALSE) {
+		/*
+		   This switch doesn't do multicast.  Clean-up.
+		 */
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_mcast_mgr_branch: ERR 0A14: "
+			"Switch 0x%" PRIx64 " does not support multicast\n",
+			node_guid_ho);
+
+		/*
+		   Deallocate all the work objects on this branch of the tree.
+		 */
+		__osm_mcast_mgr_purge_list(p_mgr, p_list);
+		goto Exit;
+	}
+
+	p_mtn = osm_mtree_node_new(p_sw);
+	if (p_mtn == NULL) {
+		/*
+		   We are unable to continue routing down this
+		   leg of the tree.  Clean-up.
+		 */
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_mcast_mgr_branch: ERR 0A15: "
+			"Insufficient memory to build multicast tree\n");
+
+		/*
+		   Deallocate all the work objects on this branch of the tree.
+		 */
+		__osm_mcast_mgr_purge_list(p_mgr, p_list);
+		goto Exit;
+	}
+
+	max_children = osm_mtree_node_get_max_children(p_mtn);
+
+	CL_ASSERT(max_children > 1);
+
+	/*
+	   Prepare an empty list for each port in the switch.
+	   TO DO - this list array could probably be moved
+	   inside the switch element to save on malloc thrashing.
+	 */
+	list_array = malloc(sizeof(cl_qlist_t) * max_children);
+	if (list_array == NULL) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_mcast_mgr_branch: ERR 0A16: "
+			"Unable to allocate list array\n");
+		__osm_mcast_mgr_purge_list(p_mgr, p_list);
+		goto Exit;
+	}
+
+	memset(list_array, 0, sizeof(cl_qlist_t) * max_children);
+
+	for (i = 0; i < max_children; i++)
+		cl_qlist_init(&list_array[i]);
+
+	__osm_mcast_mgr_subdivide(p_mgr, p_mgrp, p_sw, p_list, list_array,
+				  max_children);
+
+	p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
+
+	/*
+	   Add the upstream port to the forwarding table unless
+	   we're at the root of the spanning tree.
+	 */
+	if (depth > 1) {
+		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				"__osm_mcast_mgr_branch: "
+				"Adding upstream port 0x%X\n", upstream_port);
+		}
+
+		CL_ASSERT(upstream_port);
+		osm_mcast_tbl_set(p_tbl, mlid_ho, upstream_port);
+	}
+
+	/*
+	   For each port that was allocated some routes,
+	   recurse into this function to continue building the tree
+	   if the node on the other end of that port is another switch.
+	   Otherwise, the node is an endpoint, and we've found a leaf
+	   of the tree.  Mark leaves with our special pointer value.
+	 */
+
+	for (i = 0; i < max_children; i++) {
+		const osm_physp_t *p_physp;
+		const osm_physp_t *p_remote_physp;
+		const osm_node_t *p_node;
+		const osm_node_t *p_remote_node;
+
+		p_port_list = &list_array[i];
+
+		count = cl_qlist_count(p_port_list);
+
+		/*
+		   There should be no children routed through the upstream port!
+		 */
+		CL_ASSERT((upstream_port == 0) || (i != upstream_port) ||
+			  ((i == upstream_port) && (count == 0)));
+
+		if (count == 0)
+			continue;	/* No routes down this port. */
+
+		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				"__osm_mcast_mgr_branch: "
+				"Routing %zu destinations via switch port 0x%X\n",
+				count, i);
+		}
+
+		/*
+		   This port routes frames for this mcast group.  Therefore,
+		   set the appropriate bit in the multicast forwarding
+		   table for this switch.
+		 */
+		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 */
+			continue;
+
+		p_node = p_sw->p_node;
+		p_remote_node = osm_node_get_remote_node(p_node, i, NULL);
+
+		if (osm_node_get_type(p_remote_node) == IB_NODE_TYPE_SWITCH) {
+			/*
+			   Acquire a pointer to the remote switch then recurse.
+			 */
+			CL_ASSERT(p_remote_node->sw);
+
+			p_physp = osm_node_get_physp_ptr(p_node, i);
+			CL_ASSERT(osm_physp_is_valid(p_physp));
+
+			p_remote_physp = osm_physp_get_remote(p_physp);
+			CL_ASSERT(p_remote_physp);
+			CL_ASSERT(osm_physp_is_valid(p_remote_physp));
+
+			p_mtn->child_array[i] =
+			    __osm_mcast_mgr_branch(p_mgr, p_mgrp,
+						   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
+			   must be a leaf.
+			 */
+			CL_ASSERT(count == 1);
+
+			p_mtn->child_array[i] = OSM_MTREE_LEAF;
+			p_wobj =
+			    (osm_mcast_work_obj_t *)
+			    cl_qlist_remove_head(p_port_list);
+
+			CL_ASSERT(cl_is_qlist_empty(p_port_list));
+
+			if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+				osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+					"__osm_mcast_mgr_branch: "
+					"Found leaf for port 0x%016" PRIx64
+					" on switch port 0x%X\n",
+					cl_ntoh64(osm_port_get_guid
+						  (p_wobj->p_port)), i);
+			}
+
+			__osm_mcast_work_obj_delete(p_wobj);
+		}
+	}
+
+	free(list_array);
+      Exit:
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return (p_mtn);
 }
 
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t
-__osm_mcast_mgr_build_spanning_tree(
-  osm_mcast_mgr_t*         const p_mgr,
-  osm_mgrp_t*              const p_mgrp )
+__osm_mcast_mgr_build_spanning_tree(osm_mcast_mgr_t * const p_mgr,
+				    osm_mgrp_t * const p_mgrp)
 {
-  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;
-  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( p_mgr->p_log, __osm_mcast_mgr_build_spanning_tree );
-
-  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( p_mgr, p_mgrp );
-
-  p_mcm_tbl = &p_mgrp->mcm_port_tbl;
-  num_ports = cl_qmap_count( p_mcm_tbl );
-  if( num_ports == 0 )
-  {
-    if( osm_log_is_active( p_mgr->p_log, OSM_LOG_VERBOSE ) )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-               "__osm_mcast_mgr_build_spanning_tree: "
-               "MLID 0x%X has no members - nothing to do\n",
-               cl_ntoh16( osm_mgrp_get_mlid( p_mgrp ) ) );
-    }
-    goto Exit;
-  }
-
-  /*
-    This function builds the single spanning tree recursively.
-    At each stage, the ports to be reached are divided into
-    non-overlapping subsets of member ports that can be reached through
-    a given switch port.  Construction then moves down each
-    branch, and the process starts again with each branch computing
-    for its own subset of the member ports.
-
-    The maximum recursion depth is at worst the maximum hop count in the
-    subnet, which is spec limited to 64.
-  */
-
-  /*
-    Locate the switch around which to create the spanning
-    tree for this multicast group.
-  */
-  p_sw = __osm_mcast_mgr_find_root_switch( p_mgr, p_mgrp );
-  if( p_sw == NULL )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "__osm_mcast_mgr_build_spanning_tree: ERR 0A08: "
-             "Unable to locate a suitable switch for group 0x%X\n",
-             cl_ntoh16( osm_mgrp_get_mlid( p_mgrp ) ));
-    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( p_mgr->p_subn,
-                                   ib_gid_get_guid( &p_mcm_port->port_gid ) );
-    if( !p_port )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-               "__osm_mcast_mgr_build_spanning_tree: 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( p_mgr->p_log, OSM_LOG_ERROR,
-               "__osm_mcast_mgr_build_spanning_tree: 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( p_mgr, p_mgrp, p_sw,
-                                           &port_list, 0, 0, &max_depth );
-
-  osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-           "__osm_mcast_mgr_build_spanning_tree: "
-           "Configured MLID 0x%X for %u ports, max tree depth = %u\n",
-           cl_ntoh16( osm_mgrp_get_mlid( p_mgrp ) ),
-           count, max_depth );
-
- Exit:
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return( status );
+	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;
+	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(p_mgr->p_log, __osm_mcast_mgr_build_spanning_tree);
+
+	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(p_mgr, p_mgrp);
+
+	p_mcm_tbl = &p_mgrp->mcm_port_tbl;
+	num_ports = cl_qmap_count(p_mcm_tbl);
+	if (num_ports == 0) {
+		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_VERBOSE)) {
+			osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+				"__osm_mcast_mgr_build_spanning_tree: "
+				"MLID 0x%X has no members - nothing to do\n",
+				cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)));
+		}
+		goto Exit;
+	}
+
+	/*
+	   This function builds the single spanning tree recursively.
+	   At each stage, the ports to be reached are divided into
+	   non-overlapping subsets of member ports that can be reached through
+	   a given switch port.  Construction then moves down each
+	   branch, and the process starts again with each branch computing
+	   for its own subset of the member ports.
+
+	   The maximum recursion depth is at worst the maximum hop count in the
+	   subnet, which is spec limited to 64.
+	 */
+
+	/*
+	   Locate the switch around which to create the spanning
+	   tree for this multicast group.
+	 */
+	p_sw = __osm_mcast_mgr_find_root_switch(p_mgr, p_mgrp);
+	if (p_sw == NULL) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_mcast_mgr_build_spanning_tree: ERR 0A08: "
+			"Unable to locate a suitable switch for group 0x%X\n",
+			cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)));
+		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(p_mgr->p_subn,
+					      ib_gid_get_guid(&p_mcm_port->
+							      port_gid));
+		if (!p_port) {
+			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+				"__osm_mcast_mgr_build_spanning_tree: 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(p_mgr->p_log, OSM_LOG_ERROR,
+				"__osm_mcast_mgr_build_spanning_tree: 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(p_mgr, p_mgrp, p_sw,
+						&port_list, 0, 0, &max_depth);
+
+	osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+		"__osm_mcast_mgr_build_spanning_tree: "
+		"Configured MLID 0x%X for %u ports, max tree depth = %u\n",
+		cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)), count, max_depth);
+
+      Exit:
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return (status);
 }
 
 #if 0
@@ -981,84 +941,79 @@ __osm_mcast_mgr_build_spanning_tree(
 /**********************************************************************
  **********************************************************************/
 void
-osm_mcast_mgr_set_table(
-  IN osm_mcast_mgr_t*         const p_mgr,
-  IN const osm_mgrp_t*        const p_mgrp,
-  IN const osm_mtree_node_t*  const p_mtn )
+osm_mcast_mgr_set_table(IN osm_mcast_mgr_t * const p_mgr,
+			IN const osm_mgrp_t * const p_mgrp,
+			IN const osm_mtree_node_t * const p_mtn)
 {
-  uint8_t i;
-  uint8_t max_children;
-  osm_mtree_node_t* p_child_mtn;
-  uint16_t mlid_ho;
-  osm_mcast_tbl_t* p_tbl;
-  osm_switch_t* p_sw;
+	uint8_t i;
+	uint8_t max_children;
+	osm_mtree_node_t *p_child_mtn;
+	uint16_t mlid_ho;
+	osm_mcast_tbl_t *p_tbl;
+	osm_switch_t *p_sw;
 
-  OSM_LOG_ENTER( p_mgr->p_log, osm_mcast_mgr_set_table );
+	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_set_table);
 
-  mlid_ho = cl_ntoh16( osm_mgrp_get_mlid( p_mgrp ) );
-  p_sw = osm_mtree_node_get_switch_ptr( p_mtn );
+	mlid_ho = cl_ntoh16(osm_mgrp_get_mlid(p_mgrp));
+	p_sw = osm_mtree_node_get_switch_ptr(p_mtn);
 
-  CL_ASSERT( p_sw );
+	CL_ASSERT(p_sw);
 
-  if( osm_log_is_active( p_mgr->p_log, OSM_LOG_VERBOSE ) )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-             "osm_mcast_mgr_set_table: "
-             "Configuring MLID 0x%X on switch 0x%" PRIx64 "\n",
-             mlid_ho, osm_node_get_node_guid(p_sw->p_node) );
-  }
+	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_VERBOSE)) {
+		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+			"osm_mcast_mgr_set_table: "
+			"Configuring MLID 0x%X on switch 0x%" PRIx64 "\n",
+			mlid_ho, osm_node_get_node_guid(p_sw->p_node));
+	}
 
-  /*
-    For every child of this tree node, set the corresponding
-    bit in the switch's mcast table.
-  */
-  p_tbl = osm_switch_get_mcast_tbl_ptr( p_sw );
-  max_children = osm_mtree_node_get_max_children( p_mtn );
+	/*
+	   For every child of this tree node, set the corresponding
+	   bit in the switch's mcast table.
+	 */
+	p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
+	max_children = osm_mtree_node_get_max_children(p_mtn);
 
-  CL_ASSERT( max_children <= osm_switch_get_num_ports( p_sw ) );
+	CL_ASSERT(max_children <= osm_switch_get_num_ports(p_sw));
 
-  osm_mcast_tbl_clear_mlid( p_tbl, mlid_ho );
+	osm_mcast_tbl_clear_mlid(p_tbl, mlid_ho);
 
-  for( i = 0; i < max_children; i++ )
-  {
-    p_child_mtn = osm_mtree_node_get_child( p_mtn, i );
-    if( p_child_mtn == NULL )
-      continue;
+	for (i = 0; i < max_children; i++) {
+		p_child_mtn = osm_mtree_node_get_child(p_mtn, i);
+		if (p_child_mtn == NULL)
+			continue;
 
-    osm_mcast_tbl_set( p_tbl, mlid_ho, i );
-  }
+		osm_mcast_tbl_set(p_tbl, mlid_ho, i);
+	}
 
-  OSM_LOG_EXIT( p_mgr->p_log );
+	OSM_LOG_EXIT(p_mgr->p_log);
 }
 #endif
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_mcast_mgr_clear(
-  IN osm_mcast_mgr_t*      const p_mgr,
-  IN osm_mgrp_t*           const p_mgrp )
+__osm_mcast_mgr_clear(IN osm_mcast_mgr_t * const p_mgr,
+		      IN osm_mgrp_t * const p_mgrp)
 {
-  osm_switch_t*            p_sw;
-  cl_qmap_t*               p_sw_tbl;
-  osm_mcast_tbl_t*         p_mcast_tbl;
-
-  OSM_LOG_ENTER( p_mgr->p_log, __osm_mcast_mgr_clear );
-
-  /*
-    Walk the switches and clear the routing entries for
-    this MLID.
-  */
-  p_sw_tbl = &p_mgr->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) );
-    p_sw = (osm_switch_t*)cl_qmap_next( &p_sw->map_item );
-  }
-
-  OSM_LOG_EXIT( p_mgr->p_log );
+	osm_switch_t *p_sw;
+	cl_qmap_t *p_sw_tbl;
+	osm_mcast_tbl_t *p_mcast_tbl;
+
+	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_clear);
+
+	/*
+	   Walk the switches and clear the routing entries for
+	   this MLID.
+	 */
+	p_sw_tbl = &p_mgr->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));
+		p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
+	}
+
+	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
 #if 0
@@ -1067,178 +1022,157 @@ __osm_mcast_mgr_clear(
    Lock must be held on entry.
 **********************************************************************/
 ib_api_status_t
-osm_mcast_mgr_process_single(
-  IN osm_mcast_mgr_t*      const p_mgr,
-  IN ib_net16_t            const mlid,
-  IN ib_net64_t            const port_guid,
-  IN uint8_t               const join_state )
+osm_mcast_mgr_process_single(IN osm_mcast_mgr_t * const p_mgr,
+			     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;
-  ib_net64_t               sw_guid;
-  osm_port_t*              p_port;
-  osm_physp_t*             p_physp;
-  osm_physp_t*             p_remote_physp;
-  osm_node_t*              p_remote_node;
-  osm_mcast_tbl_t*         p_mcast_tbl;
-  ib_api_status_t          status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_mgr->p_log, osm_mcast_mgr_process_single );
-
-  CL_ASSERT( mlid );
-  CL_ASSERT( port_guid );
-
-  mlid_ho = cl_ntoh16( mlid );
-
-  if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-             "osm_mcast_mgr_process_single: "
-             "Attempting to add port 0x%" PRIx64 " to MLID 0x%X, "
-             "\n\t\t\t\tjoin state = 0x%X\n",
-             cl_ntoh64( port_guid ), mlid_ho, join_state );
-  }
-
-  /*
-    Acquire the Port object.
-  */
-  p_port = osm_get_port_by_guid( p_mgr->p_subn, port_guid );
-  if( !p_port )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "osm_mcast_mgr_process_single: ERR 0A01: "
-             "Unable to acquire port object for 0x%" PRIx64 "\n",
-             cl_ntoh64( port_guid ) );
-    status = IB_ERROR;
-    goto Exit;
-  }
-
-  p_physp = p_port->p_physp;
-  if( p_physp == NULL )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "osm_mcast_mgr_process_single: ERR 0A05: "
-             "Unable to acquire phsyical port object for 0x%" PRIx64 "\n",
-             cl_ntoh64( port_guid ) );
-    status = IB_ERROR;
-    goto Exit;
-  }
-
-  if( !osm_physp_is_valid( p_physp ) )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "osm_mcast_mgr_process_single: ERR 0A07: "
-             "Unable to acquire valid physical port object "
-             "for 0x%" PRIx64 "\n",
-             cl_ntoh64( port_guid ) );
-    status = IB_ERROR;
-    goto Exit;
-  }
-
-  p_remote_physp = osm_physp_get_remote( p_physp );
-  if( p_remote_physp == NULL )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "osm_mcast_mgr_process_single: ERR 0A11: "
-             "Unable to acquire remote phsyical port object "
-             "for 0x%" PRIx64 "\n",
-             cl_ntoh64( port_guid ) );
-    status = IB_ERROR;
-    goto Exit;
-  }
-
-  if( !osm_physp_is_valid( p_remote_physp ) )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "osm_mcast_mgr_process_single: ERR 0A21: "
-             "Unable to acquire valid remote physical port object "
-             "for 0x%" PRIx64 "\n",
-             cl_ntoh64( port_guid ) );
-    status = IB_ERROR;
-    goto Exit;
-  }
-
-  p_remote_node = osm_physp_get_node_ptr( p_remote_physp );
-
-  CL_ASSERT( p_remote_node );
-
-  sw_guid = osm_node_get_node_guid( p_remote_node );
-
-  if( osm_node_get_type( p_remote_node ) != IB_NODE_TYPE_SWITCH )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "osm_mcast_mgr_process_single: ERR 0A22: "
-             "Remote node not a switch node 0x%" PRIx64 "\n",
-             cl_ntoh64( sw_guid ) );
-    status = IB_ERROR;
-    goto Exit;
-  }
-
-  if( !p_remote_node->sw )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "osm_mcast_mgr_process_single: ERR 0A12: "
-             "No switch object 0x%" PRIx64 "\n",
-             cl_ntoh64( sw_guid ) );
-    status = IB_ERROR;
-    goto Exit;
-  }
-
-  if( osm_switch_is_in_mcast_tree( p_remote_node->sw, mlid_ho ) )
-  {
-    /*
-      We're in luck. The switch attached to this port
-      is already in the multicast group, so we can just
-      add the specified port as a new leaf of the tree.
-    */
-    if( join_state & (IB_JOIN_STATE_FULL | IB_JOIN_STATE_NON ) )
-    {
-      /*
-        This node wants to receive multicast frames.
-        Get the switch port number to which the new member port
-        is attached, then configure this single mcast table.
-      */
-      port_num = osm_physp_get_port_num( p_remote_physp );
-      CL_ASSERT( port_num );
-
-      p_mcast_tbl = osm_switch_get_mcast_tbl_ptr( p_remote_node->sw );
-      osm_mcast_tbl_set( p_mcast_tbl, mlid_ho, port_num );
-    }
-    else
-    {
-      if( join_state & IB_JOIN_STATE_SEND_ONLY )
-      {
-        if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-        {
-          osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-                   "osm_mcast_mgr_process_single: "
-                   "Success.  Nothing to do for send"
-                   "only member\n" );
-        }
-      }
-      else
-      {
-        osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-                 "osm_mcast_mgr_process_single: ERR 0A13: "
-                 "Unknown join state 0x%X\n", join_state );
-        status = IB_ERROR;
-        goto Exit;
-      }
-    }
-  }
-  else
-  {
-    if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-               "osm_mcast_mgr_process_single: "
-               "Unable to add port\n" );
-    }
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return( status );
+	uint8_t port_num;
+	uint16_t mlid_ho;
+	ib_net64_t sw_guid;
+	osm_port_t *p_port;
+	osm_physp_t *p_physp;
+	osm_physp_t *p_remote_physp;
+	osm_node_t *p_remote_node;
+	osm_mcast_tbl_t *p_mcast_tbl;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_process_single);
+
+	CL_ASSERT(mlid);
+	CL_ASSERT(port_guid);
+
+	mlid_ho = cl_ntoh16(mlid);
+
+	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+			"osm_mcast_mgr_process_single: "
+			"Attempting to add port 0x%" PRIx64 " to MLID 0x%X, "
+			"\n\t\t\t\tjoin state = 0x%X\n",
+			cl_ntoh64(port_guid), mlid_ho, join_state);
+	}
+
+	/*
+	   Acquire the Port object.
+	 */
+	p_port = osm_get_port_by_guid(p_mgr->p_subn, port_guid);
+	if (!p_port) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"osm_mcast_mgr_process_single: ERR 0A01: "
+			"Unable to acquire port object for 0x%" PRIx64 "\n",
+			cl_ntoh64(port_guid));
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	p_physp = p_port->p_physp;
+	if (p_physp == NULL) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"osm_mcast_mgr_process_single: ERR 0A05: "
+			"Unable to acquire phsyical port object for 0x%" PRIx64
+			"\n", cl_ntoh64(port_guid));
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	if (!osm_physp_is_valid(p_physp)) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"osm_mcast_mgr_process_single: ERR 0A07: "
+			"Unable to acquire valid physical port object "
+			"for 0x%" PRIx64 "\n", cl_ntoh64(port_guid));
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	p_remote_physp = osm_physp_get_remote(p_physp);
+	if (p_remote_physp == NULL) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"osm_mcast_mgr_process_single: ERR 0A11: "
+			"Unable to acquire remote phsyical port object "
+			"for 0x%" PRIx64 "\n", cl_ntoh64(port_guid));
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	if (!osm_physp_is_valid(p_remote_physp)) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"osm_mcast_mgr_process_single: ERR 0A21: "
+			"Unable to acquire valid remote physical port object "
+			"for 0x%" PRIx64 "\n", cl_ntoh64(port_guid));
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	p_remote_node = osm_physp_get_node_ptr(p_remote_physp);
+
+	CL_ASSERT(p_remote_node);
+
+	sw_guid = osm_node_get_node_guid(p_remote_node);
+
+	if (osm_node_get_type(p_remote_node) != IB_NODE_TYPE_SWITCH) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"osm_mcast_mgr_process_single: ERR 0A22: "
+			"Remote node not a switch node 0x%" PRIx64 "\n",
+			cl_ntoh64(sw_guid));
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	if (!p_remote_node->sw) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"osm_mcast_mgr_process_single: ERR 0A12: "
+			"No switch object 0x%" PRIx64 "\n", cl_ntoh64(sw_guid));
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	if (osm_switch_is_in_mcast_tree(p_remote_node->sw, mlid_ho)) {
+		/*
+		   We're in luck. The switch attached to this port
+		   is already in the multicast group, so we can just
+		   add the specified port as a new leaf of the tree.
+		 */
+		if (join_state & (IB_JOIN_STATE_FULL | IB_JOIN_STATE_NON)) {
+			/*
+			   This node wants to receive multicast frames.
+			   Get the switch port number to which the new member port
+			   is attached, then configure this single mcast table.
+			 */
+			port_num = osm_physp_get_port_num(p_remote_physp);
+			CL_ASSERT(port_num);
+
+			p_mcast_tbl =
+			    osm_switch_get_mcast_tbl_ptr(p_remote_node->sw);
+			osm_mcast_tbl_set(p_mcast_tbl, mlid_ho, port_num);
+		} else {
+			if (join_state & IB_JOIN_STATE_SEND_ONLY) {
+				if (osm_log_is_active
+				    (p_mgr->p_log, OSM_LOG_DEBUG)) {
+					osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+						"osm_mcast_mgr_process_single: "
+						"Success.  Nothing to do for send"
+						"only member\n");
+				}
+			} else {
+				osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+					"osm_mcast_mgr_process_single: ERR 0A13: "
+					"Unknown join state 0x%X\n",
+					join_state);
+				status = IB_ERROR;
+				goto Exit;
+			}
+		}
+	} else {
+		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				"osm_mcast_mgr_process_single: "
+				"Unable to add port\n");
+		}
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return (status);
 }
 #endif
 
@@ -1246,90 +1180,82 @@ osm_mcast_mgr_process_single(
    lock must already be held on entry
 **********************************************************************/
 static ib_api_status_t
-osm_mcast_mgr_process_tree(
-  IN osm_mcast_mgr_t*      const p_mgr,
-  IN osm_mgrp_t*           const p_mgrp,
-  IN osm_mcast_req_type_t        req_type,
-  ib_net64_t                     port_guid )
+osm_mcast_mgr_process_tree(IN osm_mcast_mgr_t * const p_mgr,
+			   IN osm_mgrp_t * const p_mgrp,
+			   IN osm_mcast_req_type_t req_type,
+			   ib_net64_t port_guid)
 {
-  ib_api_status_t          status = IB_SUCCESS;
-  ib_net16_t               mlid;
-  boolean_t                ui_mcast_fdb_assign_func_defined;
-
-  OSM_LOG_ENTER( p_mgr->p_log, osm_mcast_mgr_process_tree );
-
-  mlid = osm_mgrp_get_mlid( p_mgrp );
-
-  if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-             "osm_mcast_mgr_process_tree: "
-             "Processing multicast group 0x%X\n", cl_ntoh16( mlid ));
-  }
-
-  /*
-    If there are no switches in the subnet, then we have nothing to do.
-  */
-  if( cl_qmap_count( &p_mgr->p_subn->sw_guid_tbl ) == 0 )
-  {
-    if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-               "osm_mcast_mgr_process_tree: "
-               "No switches in subnet. Nothing to do\n" );
-    }
-    goto Exit;
-  }
-
-  if (p_mgr->p_subn->opt.pfn_ui_mcast_fdb_assign)
-    ui_mcast_fdb_assign_func_defined = TRUE;
-  else
-    ui_mcast_fdb_assign_func_defined = FALSE;
-
-  /*
-    Clear the multicast tables to start clean, then build
-    the spanning tree which sets the mcast table bits for each
-    port in the group.
-    We will clean the multicast tables if a ui_mcast function isn't
-    defined, or if such function is defined, but we got here
-    through a MC_CREATE request - this means we are creating a new
-    multicast group - clean all old data.
-  */
-  if ( ui_mcast_fdb_assign_func_defined == FALSE ||
-       req_type == OSM_MCAST_REQ_TYPE_CREATE )
-    __osm_mcast_mgr_clear( p_mgr, p_mgrp );
-
-  /* If a UI function is defined, then we will call it here.
-     If not - the use the regular build spanning tree function */
-  if ( ui_mcast_fdb_assign_func_defined == FALSE )
-  {
-    status = __osm_mcast_mgr_build_spanning_tree( p_mgr, p_mgrp );
-    if( status != IB_SUCCESS )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-               "osm_mcast_mgr_process_tree: ERR 0A17: "
-               "Unable to create spanning tree (%s)\n",
-               ib_get_err_str( status ) );
-      goto Exit;
-    }
-  }
-  else
-  {
-    if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-               "osm_mcast_mgr_process_tree: "
-               "Invoking UI function pfn_ui_mcast_fdb_assign\n");
-    }
-
-    p_mgr->p_subn->opt.pfn_ui_mcast_fdb_assign(
-      p_mgr->p_subn->opt.ui_mcast_fdb_assign_ctx,
-      mlid, req_type, port_guid );
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return( status );
+	ib_api_status_t status = IB_SUCCESS;
+	ib_net16_t mlid;
+	boolean_t ui_mcast_fdb_assign_func_defined;
+
+	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_process_tree);
+
+	mlid = osm_mgrp_get_mlid(p_mgrp);
+
+	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+			"osm_mcast_mgr_process_tree: "
+			"Processing multicast group 0x%X\n", cl_ntoh16(mlid));
+	}
+
+	/*
+	   If there are no switches in the subnet, then we have nothing to do.
+	 */
+	if (cl_qmap_count(&p_mgr->p_subn->sw_guid_tbl) == 0) {
+		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				"osm_mcast_mgr_process_tree: "
+				"No switches in subnet. Nothing to do\n");
+		}
+		goto Exit;
+	}
+
+	if (p_mgr->p_subn->opt.pfn_ui_mcast_fdb_assign)
+		ui_mcast_fdb_assign_func_defined = TRUE;
+	else
+		ui_mcast_fdb_assign_func_defined = FALSE;
+
+	/*
+	   Clear the multicast tables to start clean, then build
+	   the spanning tree which sets the mcast table bits for each
+	   port in the group.
+	   We will clean the multicast tables if a ui_mcast function isn't
+	   defined, or if such function is defined, but we got here
+	   through a MC_CREATE request - this means we are creating a new
+	   multicast group - clean all old data.
+	 */
+	if (ui_mcast_fdb_assign_func_defined == FALSE ||
+	    req_type == OSM_MCAST_REQ_TYPE_CREATE)
+		__osm_mcast_mgr_clear(p_mgr, p_mgrp);
+
+	/* If a UI function is defined, then we will call it here.
+	   If not - the use the regular build spanning tree function */
+	if (ui_mcast_fdb_assign_func_defined == FALSE) {
+		status = __osm_mcast_mgr_build_spanning_tree(p_mgr, p_mgrp);
+		if (status != IB_SUCCESS) {
+			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+				"osm_mcast_mgr_process_tree: ERR 0A17: "
+				"Unable to create spanning tree (%s)\n",
+				ib_get_err_str(status));
+			goto Exit;
+		}
+	} else {
+		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				"osm_mcast_mgr_process_tree: "
+				"Invoking UI function pfn_ui_mcast_fdb_assign\n");
+		}
+
+		p_mgr->p_subn->opt.pfn_ui_mcast_fdb_assign(p_mgr->p_subn->opt.
+							   ui_mcast_fdb_assign_ctx,
+							   mlid, req_type,
+							   port_guid);
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return (status);
 }
 
 /**********************************************************************
@@ -1338,142 +1264,132 @@ osm_mcast_mgr_process_tree(
  NOTE : The lock should be held externally!
  **********************************************************************/
 static osm_signal_t
-osm_mcast_mgr_process_mgrp(
-  IN osm_mcast_mgr_t*      const p_mgr,
-  IN osm_mgrp_t*           const p_mgrp,
-  IN osm_mcast_req_type_t        req_type,
-  IN ib_net64_t                  port_guid )
+osm_mcast_mgr_process_mgrp(IN osm_mcast_mgr_t * const p_mgr,
+			   IN osm_mgrp_t * const p_mgrp,
+			   IN osm_mcast_req_type_t req_type,
+			   IN ib_net64_t port_guid)
 {
-  osm_signal_t          signal = OSM_SIGNAL_DONE;
-  ib_api_status_t       status;
-  osm_switch_t*         p_sw;
-  cl_qmap_t*            p_sw_tbl;
-  boolean_t             pending_transactions = FALSE;
-
-  OSM_LOG_ENTER( p_mgr->p_log, osm_mcast_mgr_process_mgrp );
-
-  p_sw_tbl = &p_mgr->p_subn->sw_guid_tbl;
-
-  status = osm_mcast_mgr_process_tree( p_mgr, p_mgrp, req_type, port_guid );
-  if( status != IB_SUCCESS )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "osm_mcast_mgr_process_mgrp: ERR 0A19: "
-             "Unable to create spanning tree (%s)\n",
-             ib_get_err_str( status ) );
-
-    goto Exit;
-  }
-
-  /*
-    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( p_mgr, p_sw );
-    if( signal == OSM_SIGNAL_DONE_PENDING )
-      pending_transactions = TRUE;
-
-    p_sw = (osm_switch_t*)cl_qmap_next( &p_sw->map_item );
-  }
-
-  osm_dump_mcast_routes( p_mgr->p_subn->p_osm );
-
- Exit:
-  OSM_LOG_EXIT( p_mgr->p_log );
-
-  if( pending_transactions == TRUE )
-    return( OSM_SIGNAL_DONE_PENDING );
-  else
-    return( OSM_SIGNAL_DONE );
+	osm_signal_t signal = OSM_SIGNAL_DONE;
+	ib_api_status_t status;
+	osm_switch_t *p_sw;
+	cl_qmap_t *p_sw_tbl;
+	boolean_t pending_transactions = FALSE;
+
+	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_process_mgrp);
+
+	p_sw_tbl = &p_mgr->p_subn->sw_guid_tbl;
+
+	status = osm_mcast_mgr_process_tree(p_mgr, p_mgrp, req_type, port_guid);
+	if (status != IB_SUCCESS) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"osm_mcast_mgr_process_mgrp: ERR 0A19: "
+			"Unable to create spanning tree (%s)\n",
+			ib_get_err_str(status));
+
+		goto Exit;
+	}
+
+	/*
+	   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(p_mgr, p_sw);
+		if (signal == OSM_SIGNAL_DONE_PENDING)
+			pending_transactions = TRUE;
+
+		p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
+	}
+
+	osm_dump_mcast_routes(p_mgr->p_subn->p_osm);
+
+      Exit:
+	OSM_LOG_EXIT(p_mgr->p_log);
+
+	if (pending_transactions == TRUE)
+		return (OSM_SIGNAL_DONE_PENDING);
+	else
+		return (OSM_SIGNAL_DONE);
 }
 
 /**********************************************************************
  **********************************************************************/
-osm_signal_t
-osm_mcast_mgr_process(
-  IN osm_mcast_mgr_t*      const p_mgr )
+osm_signal_t osm_mcast_mgr_process(IN osm_mcast_mgr_t * const p_mgr)
 {
-  osm_signal_t             signal;
-  osm_switch_t*            p_sw;
-  cl_qmap_t*               p_sw_tbl;
-  cl_qmap_t*               p_mcast_tbl;
-  osm_mgrp_t*              p_mgrp;
-  ib_api_status_t          status;
-  boolean_t                pending_transactions = FALSE;
-
-  OSM_LOG_ENTER( p_mgr->p_log, osm_mcast_mgr_process );
-
-  p_sw_tbl = &p_mgr->p_subn->sw_guid_tbl;
-
-  p_mcast_tbl = &p_mgr->p_subn->mgrp_mlid_tbl;
-  /*
-    While holding the lock, iterate over all the established
-    multicast groups, servicing each in turn.
-
-    Then, download the multicast tables to the switches.
-  */
-  CL_PLOCK_EXCL_ACQUIRE( p_mgr->p_lock );
-
-  p_mgrp = (osm_mgrp_t*)cl_qmap_head( p_mcast_tbl );
-  while( p_mgrp != (osm_mgrp_t*)cl_qmap_end( p_mcast_tbl ) )
-  {
-    /* 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. */
-    status = osm_mcast_mgr_process_tree( p_mgr, p_mgrp,
-                                         OSM_MCAST_REQ_TYPE_SUBNET_CHANGE, 0);
-    if( status != IB_SUCCESS )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-               "osm_mcast_mgr_process: ERR 0A20: "
-               "Unable to create spanning tree (%s)\n",
-               ib_get_err_str( status ) );
-    }
-
-    p_mgrp = (osm_mgrp_t*)cl_qmap_next( &p_mgrp->map_item );
-  }
-
-  /*
-    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( p_mgr, p_sw );
-    if( signal == OSM_SIGNAL_DONE_PENDING )
-      pending_transactions = TRUE;
-
-    p_sw = (osm_switch_t*)cl_qmap_next( &p_sw->map_item );
-  }
-
-  CL_PLOCK_RELEASE( p_mgr->p_lock );
-
-  OSM_LOG_EXIT( p_mgr->p_log );
-
-  if( pending_transactions == TRUE )
-    return( OSM_SIGNAL_DONE_PENDING );
-  else
-    return( OSM_SIGNAL_DONE );
+	osm_signal_t signal;
+	osm_switch_t *p_sw;
+	cl_qmap_t *p_sw_tbl;
+	cl_qmap_t *p_mcast_tbl;
+	osm_mgrp_t *p_mgrp;
+	ib_api_status_t status;
+	boolean_t pending_transactions = FALSE;
+
+	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_process);
+
+	p_sw_tbl = &p_mgr->p_subn->sw_guid_tbl;
+
+	p_mcast_tbl = &p_mgr->p_subn->mgrp_mlid_tbl;
+	/*
+	   While holding the lock, iterate over all the established
+	   multicast groups, servicing each in turn.
+
+	   Then, download the multicast tables to the switches.
+	 */
+	CL_PLOCK_EXCL_ACQUIRE(p_mgr->p_lock);
+
+	p_mgrp = (osm_mgrp_t *) cl_qmap_head(p_mcast_tbl);
+	while (p_mgrp != (osm_mgrp_t *) cl_qmap_end(p_mcast_tbl)) {
+		/* 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. */
+		status = osm_mcast_mgr_process_tree(p_mgr, p_mgrp,
+						    OSM_MCAST_REQ_TYPE_SUBNET_CHANGE,
+						    0);
+		if (status != IB_SUCCESS) {
+			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+				"osm_mcast_mgr_process: ERR 0A20: "
+				"Unable to create spanning tree (%s)\n",
+				ib_get_err_str(status));
+		}
+
+		p_mgrp = (osm_mgrp_t *) cl_qmap_next(&p_mgrp->map_item);
+	}
+
+	/*
+	   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(p_mgr, p_sw);
+		if (signal == OSM_SIGNAL_DONE_PENDING)
+			pending_transactions = TRUE;
+
+		p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
+	}
+
+	CL_PLOCK_RELEASE(p_mgr->p_lock);
+
+	OSM_LOG_EXIT(p_mgr->p_log);
+
+	if (pending_transactions == TRUE)
+		return (OSM_SIGNAL_DONE_PENDING);
+	else
+		return (OSM_SIGNAL_DONE);
 }
 
 /**********************************************************************
  **********************************************************************/
 static
-osm_mgrp_t *
-__get_mgrp_by_mlid(
-  IN osm_mcast_mgr_t* const p_mgr,
-  IN ib_net16_t const mlid )
+osm_mgrp_t *__get_mgrp_by_mlid(IN osm_mcast_mgr_t * const p_mgr,
+			       IN ib_net16_t const mlid)
 {
-  cl_map_item_t *map_item;
-
-  map_item = cl_qmap_get(&p_mgr->p_subn->mgrp_mlid_tbl, mlid);
-  if(map_item == cl_qmap_end(&p_mgr->p_subn->mgrp_mlid_tbl))
-  {
-    return NULL;
-  }
-  return (osm_mgrp_t *)map_item;
+	cl_map_item_t *map_item;
+
+	map_item = cl_qmap_get(&p_mgr->p_subn->mgrp_mlid_tbl, mlid);
+	if (map_item == cl_qmap_end(&p_mgr->p_subn->mgrp_mlid_tbl)) {
+		return NULL;
+	}
+	return (osm_mgrp_t *) map_item;
 }
 
 /**********************************************************************
@@ -1482,81 +1398,76 @@ __get_mgrp_by_mlid(
   hold the mlid, port guid and action (join/leave/delete) required.
  **********************************************************************/
 osm_signal_t
-osm_mcast_mgr_process_mgrp_cb(
-  IN void*              const Context1,
-  IN void*              const Context2 )
+osm_mcast_mgr_process_mgrp_cb(IN void *const Context1, IN void *const Context2)
 {
-  osm_mcast_mgr_t* p_mgr = (osm_mcast_mgr_t*)Context1;
-  osm_mgrp_t* p_mgrp;
-  ib_net16_t  mlid;
-  osm_signal_t signal = OSM_SIGNAL_DONE;
-  osm_mcast_mgr_ctxt_t* p_ctxt = (osm_mcast_mgr_ctxt_t*)Context2;
-  osm_mcast_req_type_t req_type = p_ctxt->req_type;
-  ib_net64_t port_guid = p_ctxt->port_guid;
-
-  OSM_LOG_ENTER( p_mgr->p_log, osm_mcast_mgr_process_mgrp_cb );
-
-  /* nice copy no warning on size diff */
-  memcpy(&mlid, &p_ctxt->mlid, sizeof(mlid));
-
-  /* we can destroy the context now */
-  free(p_ctxt);
-
-  /* we need a lock to make sure the p_mgrp is not change other ways */
-  CL_PLOCK_EXCL_ACQUIRE( p_mgr->p_lock );
-  p_mgrp = __get_mgrp_by_mlid( p_mgr, mlid);
-
-  /* since we delayed the execution we prefer to pass the
-     mlid as the mgrp identifier and then find it or abort */
-
-  if (p_mgrp)
-  {
-
-    /* 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( p_mgr->p_log, OSM_LOG_DEBUG,
-               "osm_mcast_mgr_process_mgrp_cb: "
-               "Skip processing mgrp with lid:0x%X change id:%u\n",
-               cl_ntoh16(mlid), p_mgrp->last_change_id );
-    }
-    else
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-               "osm_mcast_mgr_process_mgrp_cb: "
-               "Processing mgrp with lid:0x%X change id:%u\n",
-               cl_ntoh16(mlid), p_mgrp->last_change_id );
-
-      signal =
-        osm_mcast_mgr_process_mgrp( p_mgr, p_mgrp, req_type, port_guid );
-      p_mgrp->last_tree_id = p_mgrp->last_change_id;
-    }
-
-    /* Remove MGRP only if osm_mcm_port_t count is 0 and
-     * Not a well known group
-     */
-    if((0x0 == cl_qmap_count(&p_mgrp->mcm_port_tbl)) &&
-       (p_mgrp->well_known == FALSE))
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-               "osm_mcast_mgr_process_mgrp_cb: "
-               "Destroying mgrp with lid:0x%X\n",
-               cl_ntoh16(mlid) );
-
-     /* Send a Report to any InformInfo registered for
-         Trap 67 : MCGroup delete */
-      osm_mgrp_send_delete_notice( p_mgr->p_subn, p_mgr->p_log, p_mgrp );
-
-      cl_qmap_remove_item(&p_mgr->p_subn->mgrp_mlid_tbl,
-                          (cl_map_item_t *)p_mgrp );
-
-      osm_mgrp_delete(p_mgrp);
-    }
-  }
-
-  CL_PLOCK_RELEASE( p_mgr->p_lock );
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return signal;
+	osm_mcast_mgr_t *p_mgr = (osm_mcast_mgr_t *) Context1;
+	osm_mgrp_t *p_mgrp;
+	ib_net16_t mlid;
+	osm_signal_t signal = OSM_SIGNAL_DONE;
+	osm_mcast_mgr_ctxt_t *p_ctxt = (osm_mcast_mgr_ctxt_t *) Context2;
+	osm_mcast_req_type_t req_type = p_ctxt->req_type;
+	ib_net64_t port_guid = p_ctxt->port_guid;
+
+	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_process_mgrp_cb);
+
+	/* nice copy no warning on size diff */
+	memcpy(&mlid, &p_ctxt->mlid, sizeof(mlid));
+
+	/* we can destroy the context now */
+	free(p_ctxt);
+
+	/* we need a lock to make sure the p_mgrp is not change other ways */
+	CL_PLOCK_EXCL_ACQUIRE(p_mgr->p_lock);
+	p_mgrp = __get_mgrp_by_mlid(p_mgr, mlid);
+
+	/* since we delayed the execution we prefer to pass the
+	   mlid as the mgrp identifier and then find it or abort */
+
+	if (p_mgrp) {
+
+		/* 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(p_mgr->p_log, OSM_LOG_DEBUG,
+				"osm_mcast_mgr_process_mgrp_cb: "
+				"Skip processing mgrp with lid:0x%X change id:%u\n",
+				cl_ntoh16(mlid), p_mgrp->last_change_id);
+		} else {
+			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				"osm_mcast_mgr_process_mgrp_cb: "
+				"Processing mgrp with lid:0x%X change id:%u\n",
+				cl_ntoh16(mlid), p_mgrp->last_change_id);
+
+			signal =
+			    osm_mcast_mgr_process_mgrp(p_mgr, p_mgrp, req_type,
+						       port_guid);
+			p_mgrp->last_tree_id = p_mgrp->last_change_id;
+		}
+
+		/* Remove MGRP only if osm_mcm_port_t count is 0 and
+		 * Not a well known group
+		 */
+		if ((0x0 == cl_qmap_count(&p_mgrp->mcm_port_tbl)) &&
+		    (p_mgrp->well_known == FALSE)) {
+			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				"osm_mcast_mgr_process_mgrp_cb: "
+				"Destroying mgrp with lid:0x%X\n",
+				cl_ntoh16(mlid));
+
+			/* Send a Report to any InformInfo registered for
+			   Trap 67 : MCGroup delete */
+			osm_mgrp_send_delete_notice(p_mgr->p_subn, p_mgr->p_log,
+						    p_mgrp);
+
+			cl_qmap_remove_item(&p_mgr->p_subn->mgrp_mlid_tbl,
+					    (cl_map_item_t *) p_mgrp);
+
+			osm_mgrp_delete(p_mgrp);
+		}
+	}
+
+	CL_PLOCK_RELEASE(p_mgr->p_lock);
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return signal;
 }
diff --git a/opensm/opensm/osm_mcast_tbl.c b/opensm/opensm/osm_mcast_tbl.c
index a86f4aa..8715869 100644
--- a/opensm/opensm/osm_mcast_tbl.c
+++ b/opensm/opensm/osm_mcast_tbl.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <string.h>
@@ -55,248 +55,235 @@
 #include <iba/ib_types.h>
 #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 )
+osm_mcast_tbl_init(IN osm_mcast_tbl_t * const p_tbl,
+		   IN uint8_t const num_ports, IN uint16_t const capacity)
 {
-  CL_ASSERT( p_tbl );
-  CL_ASSERT( num_ports );
-
-  memset( p_tbl, 0, sizeof(*p_tbl) );
-
-  p_tbl->max_block_in_use = -1;
-
-  if( capacity == 0 )
-  {
-    /*
-      This switch apparently doesn't support multicast.
-      Everything is initialized to zero already, so return.
-    */
-    return( IB_SUCCESS );
-  }
-
-  p_tbl->num_entries = capacity;
-  p_tbl->num_ports = num_ports;
-  p_tbl->max_position = (uint8_t)((ROUNDUP( num_ports, IB_MCAST_MASK_SIZE) /
-                                   IB_MCAST_MASK_SIZE) - 1);
-
-  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);
-
-  /*
-    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 );
+	CL_ASSERT(p_tbl);
+	CL_ASSERT(num_ports);
+
+	memset(p_tbl, 0, sizeof(*p_tbl));
+
+	p_tbl->max_block_in_use = -1;
+
+	if (capacity == 0) {
+		/*
+		   This switch apparently doesn't support multicast.
+		   Everything is initialized to zero already, so return.
+		 */
+		return (IB_SUCCESS);
+	}
+
+	p_tbl->num_entries = capacity;
+	p_tbl->num_ports = num_ports;
+	p_tbl->max_position =
+	    (uint8_t) ((ROUNDUP(num_ports, IB_MCAST_MASK_SIZE) /
+			IB_MCAST_MASK_SIZE) - 1);
+
+	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);
+
+	/*
+	   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 * const p_tbl)
 {
-  free( p_tbl->p_mask_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 )
+osm_mcast_tbl_set(IN osm_mcast_tbl_t * const p_tbl,
+		  IN const uint16_t mlid_ho, IN const uint8_t port)
 {
-  uintn_t mlid_offset;
-  uintn_t mask_offset;
-  uintn_t bit_mask;
-  int16_t block_num;
+	uintn_t mlid_offset;
+	uintn_t mask_offset;
+	uintn_t bit_mask;
+	int16_t block_num;
 
-  CL_ASSERT( p_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 );
+	CL_ASSERT(p_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;
-  bit_mask = cl_ntoh16( (uint16_t)( 1 << (port % IB_MCAST_MASK_SIZE) ) );
-  (*p_tbl->p_mask_tbl)[mlid_offset][mask_offset] |= bit_mask;
+	mlid_offset = mlid_ho - IB_LID_MCAST_START_HO;
+	mask_offset = port / IB_MCAST_MASK_SIZE;
+	bit_mask = cl_ntoh16((uint16_t) (1 << (port % IB_MCAST_MASK_SIZE)));
+	(*p_tbl->p_mask_tbl)[mlid_offset][mask_offset] |= bit_mask;
 
-  block_num = (int16_t)(mlid_offset / IB_MCAST_BLOCK_SIZE);
+	block_num = (int16_t) (mlid_offset / IB_MCAST_BLOCK_SIZE);
 
-  if( block_num > p_tbl->max_block_in_use )
-    p_tbl->max_block_in_use = (uint16_t)block_num;
+	if (block_num > p_tbl->max_block_in_use)
+		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 )
+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)
 {
-  uintn_t mlid_offset;
-  uintn_t mask_offset;
-  uintn_t bit_mask;
-
-  CL_ASSERT( p_tbl );
-
-  if( p_tbl->p_mask_tbl )
-  {
-    CL_ASSERT( port_num <= (p_tbl->max_position + 1) * IB_MCAST_MASK_SIZE );
-    CL_ASSERT( mlid_ho >= IB_LID_MCAST_START_HO );
-    CL_ASSERT( mlid_ho <= p_tbl->max_mlid_ho );
-
-    mlid_offset = mlid_ho - IB_LID_MCAST_START_HO;
-    mask_offset = port_num / IB_MCAST_MASK_SIZE;
-    bit_mask = cl_ntoh16(
-      (uint16_t)( 1 << (port_num % IB_MCAST_MASK_SIZE) ) );
-    return( ((*p_tbl->p_mask_tbl)[mlid_offset][mask_offset] & bit_mask) ==
-            bit_mask );
-  }
-
-  return( FALSE );
+	uintn_t mlid_offset;
+	uintn_t mask_offset;
+	uintn_t bit_mask;
+
+	CL_ASSERT(p_tbl);
+
+	if (p_tbl->p_mask_tbl) {
+		CL_ASSERT(port_num <=
+			  (p_tbl->max_position + 1) * IB_MCAST_MASK_SIZE);
+		CL_ASSERT(mlid_ho >= IB_LID_MCAST_START_HO);
+		CL_ASSERT(mlid_ho <= p_tbl->max_mlid_ho);
+
+		mlid_offset = mlid_ho - IB_LID_MCAST_START_HO;
+		mask_offset = port_num / IB_MCAST_MASK_SIZE;
+		bit_mask = cl_ntoh16((uint16_t)
+				     (1 << (port_num % IB_MCAST_MASK_SIZE)));
+		return (((*p_tbl->
+			  p_mask_tbl)[mlid_offset][mask_offset] & bit_mask) ==
+			bit_mask);
+	}
+
+	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 )
+osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * const p_tbl,
+			  IN const uint16_t mlid_ho)
 {
-  uintn_t mlid_offset;
-  uint8_t position;
-  uint16_t result = 0;
+	uintn_t mlid_offset;
+	uint8_t position;
+	uint16_t result = 0;
 
-  CL_ASSERT( p_tbl );
+	CL_ASSERT(p_tbl);
 
-  if( p_tbl->p_mask_tbl )
-  {
-    CL_ASSERT( mlid_ho >= IB_LID_MCAST_START_HO );
-    CL_ASSERT( mlid_ho <= p_tbl->max_mlid_ho );
+	if (p_tbl->p_mask_tbl) {
+		CL_ASSERT(mlid_ho >= IB_LID_MCAST_START_HO);
+		CL_ASSERT(mlid_ho <= p_tbl->max_mlid_ho);
 
-    mlid_offset = mlid_ho - IB_LID_MCAST_START_HO;
+		mlid_offset = mlid_ho - IB_LID_MCAST_START_HO;
 
-    for( position = 0; position <= p_tbl->max_position; position++ )
-      result |= (*p_tbl->p_mask_tbl)[mlid_offset][position];
-  }
+		for (position = 0; position <= p_tbl->max_position; position++)
+			result |= (*p_tbl->p_mask_tbl)[mlid_offset][position];
+	}
 
-  return( result != 0 );
+	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 )
+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)
 {
-  uint32_t i;
-  uint16_t mlid_start_ho;
+	uint32_t i;
+	uint16_t mlid_start_ho;
 
-  CL_ASSERT( p_tbl );
-  CL_ASSERT( p_block );
+	CL_ASSERT(p_tbl);
+	CL_ASSERT(p_block);
 
-  if( block_num > p_tbl->max_block )
-    return( IB_INVALID_PARAMETER );
+	if (block_num > p_tbl->max_block)
+		return (IB_INVALID_PARAMETER);
 
-  if( position > p_tbl->max_position )
-    return( IB_INVALID_PARAMETER );
+	if (position > p_tbl->max_position)
+		return (IB_INVALID_PARAMETER);
 
-  mlid_start_ho = (uint16_t)(block_num * IB_MCAST_BLOCK_SIZE);
+	mlid_start_ho = (uint16_t) (block_num * IB_MCAST_BLOCK_SIZE);
 
-  if( mlid_start_ho + IB_MCAST_BLOCK_SIZE > p_tbl->max_mlid_ho )
-    return( IB_INVALID_PARAMETER );
+	if (mlid_start_ho + IB_MCAST_BLOCK_SIZE > p_tbl->max_mlid_ho)
+		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];
+	for (i = 0; i < IB_MCAST_BLOCK_SIZE; i++)
+		(*p_tbl->p_mask_tbl)[mlid_start_ho + i][position] = p_block[i];
 
-  if( block_num > p_tbl->max_block_in_use )
-    p_tbl->max_block_in_use = (uint16_t)block_num;
+	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 )
+osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * const p_tbl,
+			 IN const uint16_t mlid_ho)
 {
-  uint8_t i;
-  uintn_t 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;
-  }
+	uint8_t i;
+	uintn_t 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;
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 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 )
+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)
 {
-  uint32_t i;
-  uint16_t mlid_start_ho;
+	uint32_t i;
+	uint16_t mlid_start_ho;
 
-  CL_ASSERT( p_tbl );
-  CL_ASSERT( p_block );
+	CL_ASSERT(p_tbl);
+	CL_ASSERT(p_block);
 
-  if( block_num > p_tbl->max_block_in_use )
-    return( FALSE );
+	if (block_num > p_tbl->max_block_in_use)
+		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 );
-  }
+	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);
+	}
 
-  mlid_start_ho = (uint16_t)(block_num * IB_MCAST_BLOCK_SIZE);
+	mlid_start_ho = (uint16_t) (block_num * IB_MCAST_BLOCK_SIZE);
 
-  if( mlid_start_ho + IB_MCAST_BLOCK_SIZE > p_tbl->max_mlid_ho )
-    return( IB_INVALID_PARAMETER );
+	if (mlid_start_ho + IB_MCAST_BLOCK_SIZE > 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];
+	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/opensm/osm_mcm_info.c b/opensm/opensm/osm_mcm_info.c
index d296814..5d5d3a9 100644
--- a/opensm/opensm/osm_mcm_info.c
+++ b/opensm/opensm/osm_mcm_info.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Declaration of osm_mcm_info_t.
@@ -48,34 +47,29 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_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 *osm_mcm_info_new(IN const ib_net16_t mlid)
 {
-  osm_mcm_info_t* p_mcm;
+	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;
-  }
+	p_mcm = (osm_mcm_info_t *) malloc(sizeof(*p_mcm));
+	if (p_mcm) {
+		memset(p_mcm, 0, sizeof(*p_mcm));
+		p_mcm->mlid = mlid;
+	}
 
-  return( p_mcm );
+	return (p_mcm);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_mcm_info_delete(
-  IN osm_mcm_info_t* const p_mcm )
+void osm_mcm_info_delete(IN osm_mcm_info_t * const p_mcm)
 {
-  free( p_mcm );
+	free(p_mcm);
 }
diff --git a/opensm/opensm/osm_mcm_port.c b/opensm/opensm/osm_mcm_port.c
index b11f929..1dac7fe 100644
--- a/opensm/opensm/osm_mcm_port.c
+++ b/opensm/opensm/osm_mcm_port.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <string.h>
@@ -56,47 +56,39 @@
 /**********************************************************************
  **********************************************************************/
 static void
-osm_mcm_port_init(
-  IN osm_mcm_port_t* const p_mcm,
-  IN const ib_gid_t* const p_port_gid,
-  IN const uint8_t   scope_state,
-  IN const boolean_t proxy_join )
+osm_mcm_port_init(IN osm_mcm_port_t * const p_mcm,
+		  IN const ib_gid_t * const p_port_gid,
+		  IN const uint8_t scope_state, IN const boolean_t proxy_join)
 {
-  CL_ASSERT( p_port_gid );
-  CL_ASSERT( scope_state );
+	CL_ASSERT(p_port_gid);
+	CL_ASSERT(scope_state);
 
-  p_mcm->port_gid = *p_port_gid;
-  p_mcm->scope_state = scope_state;
-  p_mcm->proxy_join = proxy_join;
+	p_mcm->port_gid = *p_port_gid;
+	p_mcm->scope_state = scope_state;
+	p_mcm->proxy_join = proxy_join;
 }
 
 /**********************************************************************
  **********************************************************************/
-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 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;
+	osm_mcm_port_t *p_mcm;
 
-  p_mcm = malloc( sizeof(*p_mcm) );
-  if( p_mcm )
-  {
-    memset( p_mcm, 0, sizeof(*p_mcm) );
-    osm_mcm_port_init( p_mcm, p_port_gid,
-                       scope_state, proxy_join );
-  }
+	p_mcm = malloc(sizeof(*p_mcm));
+	if (p_mcm) {
+		memset(p_mcm, 0, sizeof(*p_mcm));
+		osm_mcm_port_init(p_mcm, p_port_gid, scope_state, proxy_join);
+	}
 
-  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 * const p_mcm)
 {
-  CL_ASSERT( p_mcm );
-  free( p_mcm );
+	CL_ASSERT(p_mcm);
+	free(p_mcm);
 }
diff --git a/opensm/opensm/osm_mtree.c b/opensm/opensm/osm_mtree.c
index e43bc72..9ce58d4 100644
--- a/opensm/opensm/osm_mtree.c
+++ b/opensm/opensm/osm_mtree.c
@@ -46,7 +46,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <complib/cl_debug.h>
@@ -55,82 +55,74 @@
 /**********************************************************************
  **********************************************************************/
 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_init(IN osm_mtree_node_t * const p_mtn,
+		    IN const osm_switch_t * const p_sw)
 {
-  uint32_t              i;
+	uint32_t i;
 
-  CL_ASSERT( p_mtn );
-  CL_ASSERT( p_sw );
+	CL_ASSERT(p_mtn);
+	CL_ASSERT(p_sw);
 
-  memset( p_mtn, 0, sizeof(*p_mtn) );
+	memset(p_mtn, 0, sizeof(*p_mtn));
 
-  p_mtn->p_sw = (osm_switch_t*)p_sw;
-  p_mtn->max_children = p_sw->num_ports;
+	p_mtn->p_sw = (osm_switch_t *) 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;
+	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 *osm_mtree_node_new(IN const osm_switch_t * const p_sw)
 {
-  osm_mtree_node_t *p_mtn;
+	osm_mtree_node_t *p_mtn;
 
-  p_mtn = malloc( sizeof(osm_mtree_node_t) +
-                  sizeof(void*) * (p_sw->num_ports - 1) );
+	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 );
+	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 )
+void osm_mtree_destroy(IN osm_mtree_node_t * p_mtn)
 {
-  uint32_t i;
+	uint32_t i;
 
-  if (p_mtn == NULL)
-    return;
+	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]);
+	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]);
 
-  free( p_mtn );
+	free(p_mtn);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-__osm_mtree_dump(
-  IN osm_mtree_node_t *p_mtn )
+void __osm_mtree_dump(IN osm_mtree_node_t * p_mtn)
 {
-  uint32_t i;
-
-  if (p_mtn == NULL)
-    return;
-
-  printf("GUID:0x%016" PRIx64 " max_children:%u\n",
-         cl_ntoh64(p_mtn->p_sw->p_node->node_info.node_guid),
-         p_mtn->max_children );
-  if ( p_mtn->child_array != NULL )
-  {
-    for (i = 0 ; i< p_mtn->max_children; i++ )
-    {
-      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]);
-    }
-  }
+	uint32_t i;
+
+	if (p_mtn == NULL)
+		return;
+
+	printf("GUID:0x%016" PRIx64 " max_children:%u\n",
+	       cl_ntoh64(p_mtn->p_sw->p_node->node_info.node_guid),
+	       p_mtn->max_children);
+	if (p_mtn->child_array != NULL) {
+		for (i = 0; i < p_mtn->max_children; i++) {
+			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]);
+		}
+	}
 }
diff --git a/opensm/opensm/osm_multicast.c b/opensm/opensm/osm_multicast.c
index ad4389a..2e25263 100644
--- a/opensm/opensm/osm_multicast.c
+++ b/opensm/opensm/osm_multicast.c
@@ -45,7 +45,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <string.h>
@@ -57,337 +57,308 @@
 /**********************************************************************
  **********************************************************************/
 /* osm_mcast_req_type_t values converted to test for easier printing. */
-const char* osm_mcast_req_type_str[] =
-{
-  "OSM_MCAST_REQ_TYPE_CREATE",
-  "OSM_MCAST_REQ_TYPE_JOIN",
-  "OSM_MCAST_REQ_TYPE_LEAVE",
-  "OSM_MCAST_REQ_TYPE_SUBNET_CHANGE"
+const char *osm_mcast_req_type_str[] = {
+	"OSM_MCAST_REQ_TYPE_CREATE",
+	"OSM_MCAST_REQ_TYPE_JOIN",
+	"OSM_MCAST_REQ_TYPE_LEAVE",
+	"OSM_MCAST_REQ_TYPE_SUBNET_CHANGE"
 };
 
-const char*
-osm_get_mcast_req_type_str(
-  IN osm_mcast_req_type_t  req_type )
+const char *osm_get_mcast_req_type_str(IN osm_mcast_req_type_t req_type)
 {
-  if ( req_type > OSM_MCAST_REQ_TYPE_SUBNET_CHANGE )
-    req_type = OSM_MCAST_REQ_TYPE_SUBNET_CHANGE;
-  return( osm_mcast_req_type_str[req_type] );
+	if (req_type > OSM_MCAST_REQ_TYPE_SUBNET_CHANGE)
+		req_type = OSM_MCAST_REQ_TYPE_SUBNET_CHANGE;
+	return (osm_mcast_req_type_str[req_type]);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_mgrp_delete(
-  IN osm_mgrp_t* const p_mgrp )
+void osm_mgrp_delete(IN osm_mgrp_t * const p_mgrp)
 {
-  osm_mcm_port_t *p_mcm_port;
-  osm_mcm_port_t *p_next_mcm_port;
-
-  CL_ASSERT(p_mgrp);
-
-  p_next_mcm_port = (osm_mcm_port_t*)cl_qmap_head( &p_mgrp->mcm_port_tbl );
-  while( p_next_mcm_port != (osm_mcm_port_t*)cl_qmap_end( &p_mgrp->mcm_port_tbl ) )
-  {
-    p_mcm_port = p_next_mcm_port;
-    p_next_mcm_port = (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_mcm_port_t *p_mcm_port;
+	osm_mcm_port_t *p_next_mcm_port;
+
+	CL_ASSERT(p_mgrp);
+
+	p_next_mcm_port =
+	    (osm_mcm_port_t *) cl_qmap_head(&p_mgrp->mcm_port_tbl);
+	while (p_next_mcm_port !=
+	       (osm_mcm_port_t *) cl_qmap_end(&p_mgrp->mcm_port_tbl)) {
+		p_mcm_port = p_next_mcm_port;
+		p_next_mcm_port =
+		    (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);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-osm_mgrp_init(
-  IN osm_mgrp_t* const p_mgrp,
-  IN const ib_net16_t mlid )
+osm_mgrp_init(IN osm_mgrp_t * const p_mgrp, IN const ib_net16_t mlid)
 {
-  CL_ASSERT( cl_ntoh16( mlid ) >= IB_LID_MCAST_START_HO );
-
-  memset( p_mgrp, 0, sizeof(*p_mgrp) );
-  cl_qmap_init( &p_mgrp->mcm_port_tbl );
-  p_mgrp->mlid = mlid;
-  p_mgrp->last_change_id = 0;
-  p_mgrp->last_tree_id = 0;
-  p_mgrp->to_be_deleted = FALSE;
+	CL_ASSERT(cl_ntoh16(mlid) >= IB_LID_MCAST_START_HO);
+
+	memset(p_mgrp, 0, sizeof(*p_mgrp));
+	cl_qmap_init(&p_mgrp->mcm_port_tbl);
+	p_mgrp->mlid = mlid;
+	p_mgrp->last_change_id = 0;
+	p_mgrp->last_tree_id = 0;
+	p_mgrp->to_be_deleted = FALSE;
 }
 
 /**********************************************************************
  **********************************************************************/
-osm_mgrp_t*
-osm_mgrp_new(
-  IN const ib_net16_t mlid )
+osm_mgrp_t *osm_mgrp_new(IN const ib_net16_t mlid)
 {
-  osm_mgrp_t* p_mgrp;
+	osm_mgrp_t *p_mgrp;
 
-  p_mgrp = (osm_mgrp_t*)malloc( sizeof(*p_mgrp) );
-  if( p_mgrp )
-    osm_mgrp_init( p_mgrp, mlid );
+	p_mgrp = (osm_mgrp_t *) malloc(sizeof(*p_mgrp));
+	if (p_mgrp)
+		osm_mgrp_init(p_mgrp, mlid);
 
-  return( p_mgrp );
+	return (p_mgrp);
 }
 
 /**********************************************************************
  **********************************************************************/
-osm_mcm_port_t*
-osm_mgrp_add_port(
-  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 )
+osm_mcm_port_t *osm_mgrp_add_port(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)
 {
-  ib_net64_t port_guid;
-  osm_mcm_port_t *p_mcm_port;
-  cl_map_item_t *prev_item;
-  uint8_t prev_join_state;
-  uint8_t prev_scope;
-
-  p_mcm_port = osm_mcm_port_new( p_port_gid, join_state, proxy_join );
-  if( p_mcm_port )
-  {
-    port_guid = p_port_gid->unicast.interface_id;
-
-    /*
-      prev_item = cl_qmap_insert(...)
-      Pointer to the item in the map with the specified key.  If insertion
-      was successful, this is the pointer to the item.  If an item with the
-      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);
-
-    }
-    else
-    {
-      /* track the fact we modified the group ports */
-      p_mgrp->last_change_id++;
-    }
-  }
-
-  return( p_mcm_port );
+	ib_net64_t port_guid;
+	osm_mcm_port_t *p_mcm_port;
+	cl_map_item_t *prev_item;
+	uint8_t prev_join_state;
+	uint8_t prev_scope;
+
+	p_mcm_port = osm_mcm_port_new(p_port_gid, join_state, proxy_join);
+	if (p_mcm_port) {
+		port_guid = p_port_gid->unicast.interface_id;
+
+		/*
+		   prev_item = cl_qmap_insert(...)
+		   Pointer to the item in the map with the specified key.  If insertion
+		   was successful, this is the pointer to the item.  If an item with the
+		   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);
+
+		} else {
+			/* track the fact we modified the group ports */
+			p_mgrp->last_change_id++;
+		}
+	}
+
+	return (p_mcm_port);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-osm_mgrp_remove_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_mgrp_remove_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)
 {
-  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 ) )
-  {
-    cl_qmap_remove_item( &p_mgrp->mcm_port_tbl,
-                         p_map_item );
-    osm_mcm_port_delete((osm_mcm_port_t*)p_map_item);
-
-    /* track the fact we modified the group */
-    p_mgrp->last_change_id++;
-  }
-
-  /*
-     no more ports so the group will be deleted after re-route
-     but only if it is not a well known group and not already deleted
-   */
-  if ((cl_is_qmap_empty( &p_mgrp->mcm_port_tbl )) &&
-      (p_mgrp->well_known == FALSE) &&
-      (p_mgrp->to_be_deleted  == FALSE))
-  {
-    p_mgrp->to_be_deleted = TRUE;
-
-    /* Send a Report to any InformInfo registered for
-       Trap 67 : MCGroup delete */
-    osm_mgrp_send_delete_notice( p_subn, p_log, p_mgrp );
-  }
+	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)) {
+		cl_qmap_remove_item(&p_mgrp->mcm_port_tbl, p_map_item);
+		osm_mcm_port_delete((osm_mcm_port_t *) p_map_item);
+
+		/* track the fact we modified the group */
+		p_mgrp->last_change_id++;
+	}
+
+	/*
+	   no more ports so the group will be deleted after re-route
+	   but only if it is not a well known group and not already deleted
+	 */
+	if ((cl_is_qmap_empty(&p_mgrp->mcm_port_tbl)) &&
+	    (p_mgrp->well_known == FALSE) && (p_mgrp->to_be_deleted == FALSE)) {
+		p_mgrp->to_be_deleted = TRUE;
+
+		/* Send a Report to any InformInfo registered for
+		   Trap 67 : MCGroup delete */
+		osm_mgrp_send_delete_notice(p_subn, p_log, p_mgrp);
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 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_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;
-  }
-  if (pp_mcm_port)
-    *pp_mcm_port = NULL;
-  return FALSE;
+	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;
+	}
+	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_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)
 {
-  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 );
-  }
+	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);
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-osm_mgrp_apply_func(
-  const osm_mgrp_t* const p_mgrp,
-  osm_mgrp_func_t p_func,
-  void* context )
+osm_mgrp_apply_func(const osm_mgrp_t * const p_mgrp,
+		    osm_mgrp_func_t p_func, void *context)
 {
-  osm_mtree_node_t* p_mtn;
+	osm_mtree_node_t *p_mtn;
 
-  CL_ASSERT( p_mgrp );
-  CL_ASSERT( p_func );
+	CL_ASSERT(p_mgrp);
+	CL_ASSERT(p_func);
 
-  p_mtn = p_mgrp->p_root;
+	p_mtn = p_mgrp->p_root;
 
-  if( p_mtn )
-    __osm_mgrp_apply_func_sub( p_mgrp, p_mtn, p_func, context );
+	if (p_mtn)
+		__osm_mgrp_apply_func_sub(p_mgrp, p_mtn, p_func, context);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-osm_mgrp_send_delete_notice(
-   IN osm_subn_t* const p_subn,
-   IN osm_log_t* const p_log,
-   IN osm_mgrp_t *p_mgrp )
+osm_mgrp_send_delete_notice(IN osm_subn_t * const p_subn,
+			    IN osm_log_t * const p_log, IN osm_mgrp_t * p_mgrp)
 {
-  ib_mad_notice_attr_t    notice;
-  ib_api_status_t         status;
-
-  OSM_LOG_ENTER( p_log, osm_mgrp_send_delete_notice );
-
-  /* prepare the needed info */
-
-  /* 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 */
-  notice.g_or_v.generic.trap_num = CL_HTON16(67); /* delete of mcg */
-  /* The sm_base_lid is saved in network order already. */
-  notice.issuer_lid = p_subn->sm_base_lid;
-  /* following o14-12.1.11 and table 120 p726 */
-  /* we need to provide the MGID */
-  memcpy(&(notice.data_details.ntc_64_67.gid),
-         &(p_mgrp->mcmember_rec.mgid),
-         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 = p_subn->opt.subnet_prefix;
-  notice.issuer_gid.unicast.interface_id = p_subn->sm_port_guid;
-
-  status = osm_report_notice(p_log, p_subn, &notice);
-  if( status != IB_SUCCESS )
-  {
-    osm_log( p_log, OSM_LOG_ERROR,
-             "osm_mgrp_send_delete_notice: ERR 7601: "
-             "Error sending trap reports (%s)\n",
-             ib_get_err_str( status ) );
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_log );
+	ib_mad_notice_attr_t notice;
+	ib_api_status_t status;
+
+	OSM_LOG_ENTER(p_log, osm_mgrp_send_delete_notice);
+
+	/* prepare the needed info */
+
+	/* 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 */
+	notice.g_or_v.generic.trap_num = CL_HTON16(67);	/* delete of mcg */
+	/* The sm_base_lid is saved in network order already. */
+	notice.issuer_lid = p_subn->sm_base_lid;
+	/* following o14-12.1.11 and table 120 p726 */
+	/* we need to provide the MGID */
+	memcpy(&(notice.data_details.ntc_64_67.gid),
+	       &(p_mgrp->mcmember_rec.mgid), 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 = p_subn->opt.subnet_prefix;
+	notice.issuer_gid.unicast.interface_id = p_subn->sm_port_guid;
+
+	status = osm_report_notice(p_log, p_subn, &notice);
+	if (status != IB_SUCCESS) {
+		osm_log(p_log, OSM_LOG_ERROR,
+			"osm_mgrp_send_delete_notice: ERR 7601: "
+			"Error sending trap reports (%s)\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-osm_mgrp_send_create_notice(
-   IN osm_subn_t* const p_subn,
-   IN osm_log_t* const p_log,
-   IN osm_mgrp_t *p_mgrp )
+osm_mgrp_send_create_notice(IN osm_subn_t * const p_subn,
+			    IN osm_log_t * const p_log, IN osm_mgrp_t * p_mgrp)
 {
-  ib_mad_notice_attr_t    notice;
-  ib_api_status_t         status;
-
-  OSM_LOG_ENTER( p_log, osm_mgrp_send_create_notice );
-
-  /* prepare the needed info */
-
-  /* details of the notice */
-  notice.generic_type = 0x83; /* Generic SubnMgt type */
-  ib_notice_set_prod_type_ho(&notice, 4); /* A Class Manager generator */
-  notice.g_or_v.generic.trap_num = CL_HTON16(66); /* create of mcg */
-  /* The sm_base_lid is saved in network order already. */
-  notice.issuer_lid = p_subn->sm_base_lid;
-  /* following o14-12.1.11 and table 120 p726 */
-  /* we need to provide the MGID */
-  memcpy(&(notice.data_details.ntc_64_67.gid),
-         &(p_mgrp->mcmember_rec.mgid),
-         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 = p_subn->opt.subnet_prefix;
-  notice.issuer_gid.unicast.interface_id = p_subn->sm_port_guid;
-
-  status = osm_report_notice(p_log, p_subn, &notice);
-  if( status != IB_SUCCESS )
-  {
-    osm_log( p_log, OSM_LOG_ERROR,
-             "osm_mgrp_send_create_notice: ERR 7602: "
-             "Error sending trap reports (%s)\n",
-             ib_get_err_str( status ) );
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_log );
+	ib_mad_notice_attr_t notice;
+	ib_api_status_t status;
+
+	OSM_LOG_ENTER(p_log, osm_mgrp_send_create_notice);
+
+	/* prepare the needed info */
+
+	/* details of the notice */
+	notice.generic_type = 0x83;	/* Generic SubnMgt type */
+	ib_notice_set_prod_type_ho(&notice, 4);	/* A Class Manager generator */
+	notice.g_or_v.generic.trap_num = CL_HTON16(66);	/* create of mcg */
+	/* The sm_base_lid is saved in network order already. */
+	notice.issuer_lid = p_subn->sm_base_lid;
+	/* following o14-12.1.11 and table 120 p726 */
+	/* we need to provide the MGID */
+	memcpy(&(notice.data_details.ntc_64_67.gid),
+	       &(p_mgrp->mcmember_rec.mgid), 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 = p_subn->opt.subnet_prefix;
+	notice.issuer_gid.unicast.interface_id = p_subn->sm_port_guid;
+
+	status = osm_report_notice(p_log, p_subn, &notice);
+	if (status != IB_SUCCESS) {
+		osm_log(p_log, OSM_LOG_ERROR,
+			"osm_mgrp_send_create_notice: ERR 7602: "
+			"Error sending trap reports (%s)\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_log);
 }
diff --git a/opensm/opensm/osm_node.c b/opensm/opensm/osm_node.c
index 04b1045..645daa9 100644
--- a/opensm/opensm/osm_node.c
+++ b/opensm/opensm/osm_node.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <iba/ib_types.h>
@@ -57,264 +57,246 @@
 /**********************************************************************
  **********************************************************************/
 void
-osm_node_init_physp(
-  IN osm_node_t* const p_node,
-  IN const osm_madw_t* const p_madw )
+osm_node_init_physp(IN osm_node_t * const p_node,
+		    IN const osm_madw_t * const p_madw)
 {
-  ib_net64_t         port_guid;
-  ib_smp_t           *p_smp;
-  ib_node_info_t     *p_ni;
-  uint8_t            port_num;
+	ib_net64_t port_guid;
+	ib_smp_t *p_smp;
+	ib_node_info_t *p_ni;
+	uint8_t port_num;
 
-  CL_ASSERT( p_node );
-  CL_ASSERT( p_madw );
+	CL_ASSERT(p_node);
+	CL_ASSERT(p_madw);
 
-  p_smp = osm_madw_get_smp_ptr( p_madw );
+	p_smp = osm_madw_get_smp_ptr(p_madw);
 
-  CL_ASSERT( p_smp->attr_id == IB_MAD_ATTR_NODE_INFO );
+	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_NODE_INFO);
 
-  p_ni = (ib_node_info_t*)ib_smp_get_payload_ptr( p_smp );
-  port_guid = p_ni->port_guid;
-  port_num = ib_node_info_get_local_port_num( p_ni );
+	p_ni = (ib_node_info_t *) 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 );
+	CL_ASSERT(port_num < p_node->physp_tbl_size);
 
-  osm_physp_init( &p_node->physp_table[port_num],
-                  port_guid, port_num, p_node,
-                  osm_madw_get_bind_handle( p_madw ),
-                  p_smp->hop_count, p_smp->initial_path );
+	osm_physp_init(&p_node->physp_table[port_num],
+		       port_guid, port_num, 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 * const p_madw)
 {
-  osm_node_t      *p_node;
-  ib_smp_t        *p_smp;
-  ib_node_info_t  *p_ni;
-  uint8_t         i;
-  uint32_t        size;
-
-  CL_ASSERT( p_madw );
-
-  p_smp = osm_madw_get_smp_ptr( p_madw );
-
-  CL_ASSERT( p_smp->attr_id == IB_MAD_ATTR_NODE_INFO );
-
-  p_ni = (ib_node_info_t*)ib_smp_get_payload_ptr( p_smp );
-
-  /*
-    The node object already contains one physical port object.
-    Therefore, subtract 1 from the number of physical ports
-    used by the switch.  This is not done for CA's since they
-    need to occupy 1 more physp than they physically have since
-    we still reserve room for a "port 0".
-  */
-  size = p_ni->num_ports;
-
-  p_node = malloc( sizeof(*p_node) + sizeof(osm_physp_t) * size );
-  if( p_node != NULL )
-  {
-    memset( p_node, 0, sizeof(*p_node) + sizeof(osm_physp_t) * size );
-    p_node->node_info = *p_ni;
-    p_node->physp_tbl_size = size + 1;
-
-    /*
-      Construct Physical Port objects owned by this Node.
-      Then, initialize the Physical Port through with we
-      discovered this port.
-      For switches, all ports have the same GUID.
-      For CAs and routers, each port has a different GUID, so we only
-      know the GUID for the port that responded to our
-      Get(NodeInfo).
-    */
-    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 );
-  }
-
-  return( p_node );
+	osm_node_t *p_node;
+	ib_smp_t *p_smp;
+	ib_node_info_t *p_ni;
+	uint8_t i;
+	uint32_t size;
+
+	CL_ASSERT(p_madw);
+
+	p_smp = osm_madw_get_smp_ptr(p_madw);
+
+	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_NODE_INFO);
+
+	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
+
+	/*
+	   The node object already contains one physical port object.
+	   Therefore, subtract 1 from the number of physical ports
+	   used by the switch.  This is not done for CA's since they
+	   need to occupy 1 more physp than they physically have since
+	   we still reserve room for a "port 0".
+	 */
+	size = p_ni->num_ports;
+
+	p_node = malloc(sizeof(*p_node) + sizeof(osm_physp_t) * size);
+	if (p_node != NULL) {
+		memset(p_node, 0, sizeof(*p_node) + sizeof(osm_physp_t) * size);
+		p_node->node_info = *p_ni;
+		p_node->physp_tbl_size = size + 1;
+
+		/*
+		   Construct Physical Port objects owned by this Node.
+		   Then, initialize the Physical Port through with we
+		   discovered this port.
+		   For switches, all ports have the same GUID.
+		   For CAs and routers, each port has a different GUID, so we only
+		   know the GUID for the port that responded to our
+		   Get(NodeInfo).
+		 */
+		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);
+	}
+
+	return (p_node);
 }
 
 /**********************************************************************
  **********************************************************************/
-static void
-osm_node_destroy(
-  IN osm_node_t *p_node )
+static void osm_node_destroy(IN osm_node_t * p_node)
 {
-  uint16_t i;
+	uint16_t i;
 
-  /*
-    Cleanup all physports
-  */
-  for( i = 0; i < p_node->physp_tbl_size; i++ )
-    osm_physp_destroy( &p_node->physp_table[i] );
+	/*
+	   Cleanup all physports
+	 */
+	for (i = 0; i < p_node->physp_tbl_size; i++)
+		osm_physp_destroy(&p_node->physp_table[i]);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_node_delete(
-  IN OUT osm_node_t** const p_node )
+void osm_node_delete(IN OUT osm_node_t ** const p_node)
 {
-  CL_ASSERT(p_node && *p_node);
-  osm_node_destroy( *p_node );
-  free( *p_node );
-  *p_node = NULL;
+	CL_ASSERT(p_node && *p_node);
+	osm_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 )
+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)
 {
-  osm_physp_t *p_physp;
-  osm_physp_t *p_remote_physp;
+	osm_physp_t *p_physp;
+	osm_physp_t *p_remote_physp;
 
-  CL_ASSERT( port_num < p_node->physp_tbl_size );
-  CL_ASSERT( remote_port_num < p_remote_node->physp_tbl_size );
+	CL_ASSERT(port_num < p_node->physp_tbl_size);
+	CL_ASSERT(remote_port_num < p_remote_node->physp_tbl_size);
 
-  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 );
+	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);
 
-  if (p_physp->p_remote_physp)
-    p_physp->p_remote_physp->p_remote_physp = NULL;
-  if (p_remote_physp->p_remote_physp)
-    p_remote_physp->p_remote_physp->p_remote_physp = NULL;
+	if (p_physp->p_remote_physp)
+		p_physp->p_remote_physp->p_remote_physp = NULL;
+	if (p_remote_physp->p_remote_physp)
+		p_remote_physp->p_remote_physp->p_remote_physp = NULL;
 
-  osm_physp_link( p_physp, p_remote_physp );
+	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 )
+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)
 {
-  osm_physp_t *p_physp;
-  osm_physp_t *p_remote_physp;
+	osm_physp_t *p_physp;
+	osm_physp_t *p_remote_physp;
 
-  CL_ASSERT( port_num < p_node->physp_tbl_size );
-  CL_ASSERT( remote_port_num < p_remote_node->physp_tbl_size );
+	CL_ASSERT(port_num < p_node->physp_tbl_size);
+	CL_ASSERT(remote_port_num < p_remote_node->physp_tbl_size);
 
-  if( osm_node_link_exists( p_node, port_num,
-                            p_remote_node, remote_port_num ) )
-  {
+	if (osm_node_link_exists(p_node, port_num,
+				 p_remote_node, remote_port_num)) {
 
-    p_physp = osm_node_get_physp_ptr( p_node, port_num );
-    p_remote_physp =  osm_node_get_physp_ptr( p_remote_node, remote_port_num );
+		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);
 
-    osm_physp_unlink( p_physp, p_remote_physp );
-  }
+		osm_physp_unlink(p_physp, p_remote_physp);
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 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 )
+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)
 {
-  osm_physp_t *p_physp;
-  osm_physp_t *p_remote_physp;
+	osm_physp_t *p_physp;
+	osm_physp_t *p_remote_physp;
 
-  CL_ASSERT( port_num < p_node->physp_tbl_size );
-  CL_ASSERT( remote_port_num < p_remote_node->physp_tbl_size );
+	CL_ASSERT(port_num < p_node->physp_tbl_size);
+	CL_ASSERT(remote_port_num < p_remote_node->physp_tbl_size);
 
-  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 );
+	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 )
+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)
 {
-  osm_physp_t *p_physp;
-  osm_physp_t *p_remote_physp;
+	osm_physp_t *p_physp;
+	osm_physp_t *p_remote_physp;
 
-  CL_ASSERT( port_num < p_node->physp_tbl_size );
-  CL_ASSERT( remote_port_num < p_remote_node->physp_tbl_size );
+	CL_ASSERT(port_num < p_node->physp_tbl_size);
+	CL_ASSERT(remote_port_num < p_remote_node->physp_tbl_size);
 
-  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 );
+	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_is_valid( p_physp ) &&
-          osm_physp_is_valid( p_remote_physp ) );
+	return (osm_physp_is_valid(p_physp) &&
+		osm_physp_is_valid(p_remote_physp));
 }
 
 /**********************************************************************
  **********************************************************************/
 boolean_t
-osm_node_has_any_link(
-  IN osm_node_t* const p_node,
-  IN const uint8_t port_num )
+osm_node_has_any_link(IN osm_node_t * const p_node, IN const 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 ) );
+	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));
 }
 
 /**********************************************************************
  **********************************************************************/
-osm_node_t*
-osm_node_get_remote_node(
-  IN const osm_node_t* const p_node,
-  IN const uint8_t port_num,
-  OUT uint8_t *p_remote_port_num )
+osm_node_t *osm_node_get_remote_node(IN const osm_node_t * const p_node,
+				     IN const uint8_t port_num,
+				     OUT uint8_t * p_remote_port_num)
 {
-  osm_physp_t *p_physp;
-  osm_physp_t *p_remote_physp;
+	osm_physp_t *p_physp;
+	osm_physp_t *p_remote_physp;
 
-  p_physp = osm_node_get_physp_ptr( p_node, port_num );
+	p_physp = osm_node_get_physp_ptr(p_node, port_num);
 
-  if( !osm_physp_has_any_link( p_physp ) )
-    return( NULL );
+	if (!osm_physp_has_any_link(p_physp))
+		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 );
+	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 const osm_node_t* const p_node,
-  IN const uint32_t port_num )
+osm_node_get_remote_base_lid(IN const osm_node_t * const p_node,
+			     IN const uint32_t port_num)
 {
-  osm_physp_t *p_physp;
-  osm_physp_t *p_remote_physp;
-  CL_ASSERT( port_num < p_node->physp_tbl_size );
-
-  p_physp = osm_node_get_physp_ptr( p_node, port_num );
-  if( osm_physp_is_valid( p_physp ) )
-  {
-    p_remote_physp = osm_physp_get_remote( p_physp );
-    return( osm_physp_get_base_lid( p_remote_physp ) );
-  }
-
-  return( 0 );
+	osm_physp_t *p_physp;
+	osm_physp_t *p_remote_physp;
+	CL_ASSERT(port_num < p_node->physp_tbl_size);
+
+	p_physp = osm_node_get_physp_ptr(p_node, port_num);
+	if (osm_physp_is_valid(p_physp)) {
+		p_remote_physp = osm_physp_get_remote(p_physp);
+		return (osm_physp_get_base_lid(p_remote_physp));
+	}
+
+	return (0);
 }
diff --git a/opensm/opensm/osm_node_desc_rcv.c b/opensm/opensm/osm_node_desc_rcv.c
index 9104bea..d50883c 100644
--- a/opensm/opensm/osm_node_desc_rcv.c
+++ b/opensm/opensm/osm_node_desc_rcv.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of osm_nd_rcv_t.
@@ -48,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -64,118 +63,104 @@
 /**********************************************************************
  **********************************************************************/
 void
-__osm_nd_rcv_process_nd(
-  IN const osm_nd_rcv_t* const p_rcv,
-  IN osm_node_t* const p_node,
-  IN const ib_node_desc_t* const p_nd )
+__osm_nd_rcv_process_nd(IN const osm_nd_rcv_t * const p_rcv,
+			IN osm_node_t * const p_node,
+			IN const ib_node_desc_t * const p_nd)
 {
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_nd_rcv_process_nd );
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_nd_rcv_process_nd);
 
-  memcpy( &p_node->node_desc.description, p_nd, sizeof(*p_nd) );
+	memcpy(&p_node->node_desc.description, p_nd, sizeof(*p_nd));
 
-  /* also set up a printable version */
-  memcpy( &p_node->print_desc, p_nd, sizeof(*p_nd) );
-  p_node->print_desc[IB_NODE_DESCRIPTION_SIZE] = '\0';
+	/* also set up a printable version */
+	memcpy(&p_node->print_desc, p_nd, sizeof(*p_nd));
+	p_node->print_desc[IB_NODE_DESCRIPTION_SIZE] = '\0';
 
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_VERBOSE ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "__osm_nd_rcv_process_nd: "
-             "Node 0x%" PRIx64 "\n\t\t\t\tDescription = %s\n",
-             cl_ntoh64( osm_node_get_node_guid( p_node )),
-             p_node->print_desc);
-  }
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_VERBOSE)) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"__osm_nd_rcv_process_nd: "
+			"Node 0x%" PRIx64 "\n\t\t\t\tDescription = %s\n",
+			cl_ntoh64(osm_node_get_node_guid(p_node)),
+			p_node->print_desc);
+	}
 
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_nd_rcv_construct(
-  IN osm_nd_rcv_t* const p_rcv )
+void osm_nd_rcv_construct(IN osm_nd_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
+	memset(p_rcv, 0, sizeof(*p_rcv));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_nd_rcv_destroy(
-  IN osm_nd_rcv_t* const p_rcv )
+void osm_nd_rcv_destroy(IN osm_nd_rcv_t * const p_rcv)
 {
-  CL_ASSERT( p_rcv );
+	CL_ASSERT(p_rcv);
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_nd_rcv_destroy );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_nd_rcv_destroy);
 
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_nd_rcv_init(
-  IN osm_nd_rcv_t* const p_rcv,
-  IN osm_subn_t* const p_subn,
-  IN osm_log_t* const p_log,
-  IN cl_plock_t* const p_lock )
+osm_nd_rcv_init(IN osm_nd_rcv_t * const p_rcv,
+		IN osm_subn_t * const p_subn,
+		IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_nd_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_nd_rcv_init);
 
-  osm_nd_rcv_construct( p_rcv );
+	osm_nd_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
 
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_nd_rcv_process(
-  IN void *context,
-  IN void *data )
+void osm_nd_rcv_process(IN void *context, IN void *data)
 {
-  osm_nd_rcv_t *p_rcv = context;
-  osm_madw_t *p_madw = data;
-  ib_node_desc_t *p_nd;
-  ib_smp_t *p_smp;
-  osm_node_t *p_node;
-  ib_net64_t node_guid;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_nd_rcv_process );
-
-  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.
-  */
-
-  node_guid = osm_madw_get_nd_context_ptr( p_madw )->node_guid;
-  CL_PLOCK_EXCL_ACQUIRE( p_rcv->p_lock );
-  p_node = osm_get_node_by_guid( p_rcv->p_subn, node_guid );
-  if( !p_node )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_nd_rcv_process: ERR 0B01: "
-             "NodeDescription received for nonexistent node "
-             "0x%" PRIx64 "\n", cl_ntoh64(node_guid) );
-  }
-  else
-  {
-    __osm_nd_rcv_process_nd( p_rcv, p_node, p_nd );
-  }
-
-  CL_PLOCK_RELEASE( p_rcv->p_lock );
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_nd_rcv_t *p_rcv = context;
+	osm_madw_t *p_madw = data;
+	ib_node_desc_t *p_nd;
+	ib_smp_t *p_smp;
+	osm_node_t *p_node;
+	ib_net64_t node_guid;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_nd_rcv_process);
+
+	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.
+	 */
+
+	node_guid = osm_madw_get_nd_context_ptr(p_madw)->node_guid;
+	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
+	p_node = osm_get_node_by_guid(p_rcv->p_subn, node_guid);
+	if (!p_node) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_nd_rcv_process: ERR 0B01: "
+			"NodeDescription received for nonexistent node "
+			"0x%" PRIx64 "\n", cl_ntoh64(node_guid));
+	} else {
+		__osm_nd_rcv_process_nd(p_rcv, p_node, p_nd);
+	}
+
+	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_node_info_rcv.c b/opensm/opensm/osm_node_info_rcv.c
index 72245ce..33a41fe 100644
--- a/opensm/opensm/osm_node_info_rcv.c
+++ b/opensm/opensm/osm_node_info_rcv.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <string.h>
@@ -67,942 +67,891 @@
 #include <opensm/osm_msgdef.h>
 
 static void
-report_duplicated_guid(
-  IN const osm_ni_rcv_t* const p_rcv,
-  osm_physp_t *p_physp,
-  osm_node_t* p_neighbor_node,
-  const uint8_t port_num)
+report_duplicated_guid(IN const osm_ni_rcv_t * const p_rcv,
+		       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;
-
-  p_old = p_physp->p_remote_physp;
-  p_new = osm_node_get_physp_ptr(p_neighbor_node, port_num);
-
-  osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-          "report_duplicated_guid: ERR 0D01: "
-	  "Found duplicated node.\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",
-          cl_ntoh64(p_physp->p_node->node_info.node_guid), p_physp->port_num,
-          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(p_rcv->p_log, osm_physp_get_dr_path_ptr(p_physp), OSM_LOG_ERROR);
-
-  path = *osm_physp_get_dr_path_ptr(p_new);
-  osm_dr_path_extend(&path, port_num);
-  osm_dump_dr_path(p_rcv->p_log, &path, OSM_LOG_ERROR);
-
-  osm_log( p_rcv->p_log, OSM_LOG_SYS,
-           "FATAL: duplicated guids or 12x lane reversal\n");
+	osm_physp_t *p_old, *p_new;
+	osm_dr_path_t path;
+
+	p_old = p_physp->p_remote_physp;
+	p_new = osm_node_get_physp_ptr(p_neighbor_node, port_num);
+
+	osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		"report_duplicated_guid: ERR 0D01: "
+		"Found duplicated node.\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",
+		cl_ntoh64(p_physp->p_node->node_info.node_guid),
+		p_physp->port_num,
+		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(p_rcv->p_log, osm_physp_get_dr_path_ptr(p_physp),
+			 OSM_LOG_ERROR);
+
+	path = *osm_physp_get_dr_path_ptr(p_new);
+	osm_dr_path_extend(&path, port_num);
+	osm_dump_dr_path(p_rcv->p_log, &path, OSM_LOG_ERROR);
+
+	osm_log(p_rcv->p_log, OSM_LOG_SYS,
+		"FATAL: duplicated guids or 12x lane reversal\n");
 }
 
-static void requery_dup_node_info(
-  IN const osm_ni_rcv_t* const p_rcv,
-  osm_physp_t *p_physp, unsigned count)
+static void requery_dup_node_info(IN const osm_ni_rcv_t * const p_rcv,
+				  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);
-
-    context.ni_context.node_guid = p_physp->p_remote_physp->p_node->node_info.port_guid;
-    context.ni_context.port_num = p_physp->p_remote_physp->port_num;
-    context.ni_context.dup_node_guid = p_physp->p_node->node_info.node_guid;
-    context.ni_context.dup_port_num = p_physp->port_num;
-    context.ni_context.dup_count = count;
-
-    status = osm_req_get(p_rcv->p_gen_req,
-                         &path,
-                         IB_MAD_ATTR_NODE_INFO,
-                         0,
-                         CL_DISP_MSGID_NONE,
-                         &context);
-
-    if(status != IB_SUCCESS)
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "requery_dup_node_info: ERR 0D02: "
-               "Failure initiating NodeInfo request (%s)\n",
-               ib_get_err_str(status) );
+	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);
+
+	context.ni_context.node_guid =
+	    p_physp->p_remote_physp->p_node->node_info.port_guid;
+	context.ni_context.port_num = p_physp->p_remote_physp->port_num;
+	context.ni_context.dup_node_guid = p_physp->p_node->node_info.node_guid;
+	context.ni_context.dup_port_num = p_physp->port_num;
+	context.ni_context.dup_count = count;
+
+	status = osm_req_get(p_rcv->p_gen_req,
+			     &path,
+			     IB_MAD_ATTR_NODE_INFO,
+			     0, CL_DISP_MSGID_NONE, &context);
+
+	if (status != IB_SUCCESS)
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"requery_dup_node_info: ERR 0D02: "
+			"Failure initiating NodeInfo request (%s)\n",
+			ib_get_err_str(status));
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_set_links(
-  IN const osm_ni_rcv_t* const p_rcv,
-  osm_node_t* p_node,
-  const uint8_t port_num,
-  const osm_ni_context_t* const p_ni_context )
+__osm_ni_rcv_set_links(IN const osm_ni_rcv_t * const p_rcv,
+		       osm_node_t * p_node,
+		       const uint8_t port_num,
+		       const osm_ni_context_t * const p_ni_context)
 {
-  osm_node_t *p_neighbor_node;
-  osm_physp_t *p_physp;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_ni_rcv_set_links );
-
-  /*
-    A special case exists in which the node we're trying to
-    link is our own node.  In this case, the guid value in
-    the ni_context will be zero.
-  */
-  if( p_ni_context->node_guid == 0 )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_ni_rcv_set_links: "
-             "Nothing to link for our own node 0x%" PRIx64 "\n",
-             cl_ntoh64( osm_node_get_node_guid( p_node ) ) );
-    goto _exit;
-  }
-
-  p_neighbor_node = osm_get_node_by_guid( p_rcv->p_subn,
-                                          p_ni_context->node_guid );
-  if( !p_neighbor_node )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_ni_rcv_set_links: ERR 0D10: "
-             "Unexpected removal of neighbor node "
-             "0x%" PRIx64 "\n",
-             cl_ntoh64( p_ni_context->node_guid ) );
-    goto _exit;
-  }
-
-    /*
-      We have seen this neighbor node before, but we might
-      not have seen this port on the neighbor node before.
-      We should not set links to an uninitialized port on the
-      neighbor, so check validity up front.  If it's not
-      valid, do nothing, since we'll see this link again
-      when we probe the neighbor.
-    */
-  if( !osm_node_link_has_valid_ports( p_node, port_num,
-                                     p_neighbor_node, p_ni_context->port_num ) )
-    goto _exit;
-
-  if( osm_node_link_exists( p_node, port_num,
-                            p_neighbor_node, p_ni_context->port_num ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_ni_rcv_set_links: "
-             "Link already exists\n" );
-    goto _exit;
-  }
-
-  if (osm_node_has_any_link(p_node, port_num) &&
-      p_rcv->p_subn->force_immediate_heavy_sweep == FALSE &&
-      (!p_ni_context->dup_count ||
-       (p_ni_context->dup_node_guid == osm_node_get_node_guid(p_node) &&
-        p_ni_context->dup_port_num == port_num)))
-  {
-    /*
-      Uh oh...
-      This could be reconnected ports, but also duplicated GUID
-      (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.
-    */
-    p_physp = osm_node_get_physp_ptr(p_node, port_num);
-    if (p_ni_context->dup_count > 5)
-    {
-      report_duplicated_guid(p_rcv, p_physp,
-                             p_neighbor_node, p_ni_context->port_num);
-      p_rcv->p_subn->force_immediate_heavy_sweep = TRUE;
-    }
-    else if (p_node->sw)
-      requery_dup_node_info(p_rcv, p_physp->p_remote_physp,
-                            p_ni_context->dup_count + 1);
-    else
-      requery_dup_node_info(p_rcv, p_physp,
-                            p_ni_context->dup_count + 1);
-  }
-
-  /*
-     When there are only two nodes with exact same guids (connected back
-     to back) - the previous check for duplicated guid will not catch
-     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) &&
-      port_num != 0 && cl_qmap_count(&p_rcv->p_subn->sw_guid_tbl) == 0)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE, "__osm_ni_rcv_set_links: "
-             "Duplicate GUID found by link from a port to itself:"
-             "node 0x%" PRIx64 ", port number 0x%X\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(p_rcv->p_log,
-                     osm_physp_get_dr_path_ptr(p_physp),
-                     OSM_LOG_VERBOSE);
-
-    if ( p_rcv->p_subn->opt.exit_on_fatal == TRUE )
-    {
-      osm_log( p_rcv->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");
-      exit( 1 );
-    }
-  }
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_ni_rcv_set_links: "
-             "Creating new link between: "
-             "\n\t\t\t\tnode 0x%" PRIx64 ", "
-             "port number 0x%X and"
-             "\n\t\t\t\tnode 0x%" PRIx64 ", "
-             "port number 0x%X\n",
-             cl_ntoh64( osm_node_get_node_guid( p_node ) ),
-             port_num,
-             cl_ntoh64( p_ni_context->node_guid ),
-             p_ni_context->port_num );
-
-  osm_node_link( p_node, port_num, p_neighbor_node,
-                 p_ni_context->port_num );
-
- _exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_node_t *p_neighbor_node;
+	osm_physp_t *p_physp;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_set_links);
+
+	/*
+	   A special case exists in which the node we're trying to
+	   link is our own node.  In this case, the guid value in
+	   the ni_context will be zero.
+	 */
+	if (p_ni_context->node_guid == 0) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_ni_rcv_set_links: "
+			"Nothing to link for our own node 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_node_get_node_guid(p_node)));
+		goto _exit;
+	}
+
+	p_neighbor_node = osm_get_node_by_guid(p_rcv->p_subn,
+					       p_ni_context->node_guid);
+	if (!p_neighbor_node) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_ni_rcv_set_links: ERR 0D10: "
+			"Unexpected removal of neighbor node "
+			"0x%" PRIx64 "\n", cl_ntoh64(p_ni_context->node_guid));
+		goto _exit;
+	}
+
+	/*
+	   We have seen this neighbor node before, but we might
+	   not have seen this port on the neighbor node before.
+	   We should not set links to an uninitialized port on the
+	   neighbor, so check validity up front.  If it's not
+	   valid, do nothing, since we'll see this link again
+	   when we probe the neighbor.
+	 */
+	if (!osm_node_link_has_valid_ports(p_node, port_num,
+					   p_neighbor_node,
+					   p_ni_context->port_num))
+		goto _exit;
+
+	if (osm_node_link_exists(p_node, port_num,
+				 p_neighbor_node, p_ni_context->port_num)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_ni_rcv_set_links: " "Link already exists\n");
+		goto _exit;
+	}
+
+	if (osm_node_has_any_link(p_node, port_num) &&
+	    p_rcv->p_subn->force_immediate_heavy_sweep == FALSE &&
+	    (!p_ni_context->dup_count ||
+	     (p_ni_context->dup_node_guid == osm_node_get_node_guid(p_node) &&
+	      p_ni_context->dup_port_num == port_num))) {
+		/*
+		   Uh oh...
+		   This could be reconnected ports, but also duplicated GUID
+		   (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.
+		 */
+		p_physp = osm_node_get_physp_ptr(p_node, port_num);
+		if (p_ni_context->dup_count > 5) {
+			report_duplicated_guid(p_rcv, p_physp,
+					       p_neighbor_node,
+					       p_ni_context->port_num);
+			p_rcv->p_subn->force_immediate_heavy_sweep = TRUE;
+		} else if (p_node->sw)
+			requery_dup_node_info(p_rcv, p_physp->p_remote_physp,
+					      p_ni_context->dup_count + 1);
+		else
+			requery_dup_node_info(p_rcv, p_physp,
+					      p_ni_context->dup_count + 1);
+	}
+
+	/*
+	   When there are only two nodes with exact same guids (connected back
+	   to back) - the previous check for duplicated guid will not catch
+	   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) &&
+	    port_num != 0 && cl_qmap_count(&p_rcv->p_subn->sw_guid_tbl) == 0) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"__osm_ni_rcv_set_links: "
+			"Duplicate GUID found by link from a port to itself:"
+			"node 0x%" PRIx64 ", port number 0x%X\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(p_rcv->p_log,
+				 osm_physp_get_dr_path_ptr(p_physp),
+				 OSM_LOG_VERBOSE);
+
+		if (p_rcv->p_subn->opt.exit_on_fatal == TRUE) {
+			osm_log(p_rcv->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");
+			exit(1);
+		}
+	}
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_ni_rcv_set_links: "
+			"Creating new link between: "
+			"\n\t\t\t\tnode 0x%" PRIx64 ", "
+			"port number 0x%X and"
+			"\n\t\t\t\tnode 0x%" PRIx64 ", "
+			"port number 0x%X\n",
+			cl_ntoh64(osm_node_get_node_guid(p_node)),
+			port_num,
+			cl_ntoh64(p_ni_context->node_guid),
+			p_ni_context->port_num);
+
+	osm_node_link(p_node, port_num, p_neighbor_node,
+		      p_ni_context->port_num);
+
+      _exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_process_new_node(
-  IN const osm_ni_rcv_t* const p_rcv,
-  IN osm_node_t* const p_node,
-  IN const osm_madw_t* const p_madw )
+__osm_ni_rcv_process_new_node(IN const osm_ni_rcv_t * const p_rcv,
+			      IN osm_node_t * const p_node,
+			      IN const osm_madw_t * const p_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_LOG_ENTER( p_rcv->p_log, __osm_ni_rcv_process_new_node );
-
-  CL_ASSERT( p_node );
-  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 );
-  port_num = ib_node_info_get_local_port_num( p_ni );
-
-  /*
-    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 );
-
-  CL_ASSERT( osm_physp_is_valid( p_physp ) );
-  CL_ASSERT( osm_madw_get_bind_handle( p_madw ) ==
-             osm_dr_path_get_bind_handle(
-               osm_physp_get_dr_path_ptr( p_physp ) ) );
-
-  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.update_master_sm_base_lid = FALSE;
-  context.pi_context.ignore_errors = FALSE;
-  context.pi_context.light_sweep = FALSE;
-  context.pi_context.active_transition = FALSE;
-
-  status = osm_req_get( p_rcv->p_gen_req,
-                        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( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_ni_rcv_process_new_node: ERR 0D02: "
-             "Failure initiating PortInfo request (%s)\n",
-             ib_get_err_str(status));
-
-  OSM_LOG_EXIT( p_rcv->p_log );
+	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_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_new_node);
+
+	CL_ASSERT(p_node);
+	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);
+	port_num = ib_node_info_get_local_port_num(p_ni);
+
+	/*
+	   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);
+
+	CL_ASSERT(osm_physp_is_valid(p_physp));
+	CL_ASSERT(osm_madw_get_bind_handle(p_madw) ==
+		  osm_dr_path_get_bind_handle(osm_physp_get_dr_path_ptr
+					      (p_physp)));
+
+	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.update_master_sm_base_lid = FALSE;
+	context.pi_context.ignore_errors = FALSE;
+	context.pi_context.light_sweep = FALSE;
+	context.pi_context.active_transition = FALSE;
+
+	status = osm_req_get(p_rcv->p_gen_req,
+			     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(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_ni_rcv_process_new_node: ERR 0D02: "
+			"Failure initiating PortInfo request (%s)\n",
+			ib_get_err_str(status));
+
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_get_node_desc(
-  IN const osm_ni_rcv_t* const p_rcv,
-  IN osm_node_t* const p_node,
-  IN const osm_madw_t* const p_madw )
+__osm_ni_rcv_get_node_desc(IN const osm_ni_rcv_t * const p_rcv,
+			   IN osm_node_t * const p_node,
+			   IN const osm_madw_t * const p_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_LOG_ENTER( p_rcv->p_log, __osm_ni_rcv_get_node_desc );
-
-  CL_ASSERT( p_node );
-  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 );
-  port_num = ib_node_info_get_local_port_num( p_ni );
-
-  /*
-    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 );
-
-  CL_ASSERT( osm_physp_is_valid( p_physp ) );
-  CL_ASSERT( osm_madw_get_bind_handle( p_madw ) ==
-             osm_dr_path_get_bind_handle(
-               osm_physp_get_dr_path_ptr( p_physp ) ) );
-
-  context.nd_context.node_guid = osm_node_get_node_guid( p_node );
-
-  status = osm_req_get( p_rcv->p_gen_req,
-                        osm_physp_get_dr_path_ptr( p_physp ),
-                        IB_MAD_ATTR_NODE_DESC,
-                        0,
-                        CL_DISP_MSGID_NONE,
-                        &context );
-  if( status != IB_SUCCESS )
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_ni_rcv_get_node_desc: ERR 0D03: "
-             "Failure initiating NodeDescription request (%s)\n",
-             ib_get_err_str(status));
-
-  OSM_LOG_EXIT( p_rcv->p_log );
+	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_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_get_node_desc);
+
+	CL_ASSERT(p_node);
+	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);
+	port_num = ib_node_info_get_local_port_num(p_ni);
+
+	/*
+	   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);
+
+	CL_ASSERT(osm_physp_is_valid(p_physp));
+	CL_ASSERT(osm_madw_get_bind_handle(p_madw) ==
+		  osm_dr_path_get_bind_handle(osm_physp_get_dr_path_ptr
+					      (p_physp)));
+
+	context.nd_context.node_guid = osm_node_get_node_guid(p_node);
+
+	status = osm_req_get(p_rcv->p_gen_req,
+			     osm_physp_get_dr_path_ptr(p_physp),
+			     IB_MAD_ATTR_NODE_DESC,
+			     0, CL_DISP_MSGID_NONE, &context);
+	if (status != IB_SUCCESS)
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_ni_rcv_get_node_desc: ERR 0D03: "
+			"Failure initiating NodeDescription request (%s)\n",
+			ib_get_err_str(status));
+
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_process_new_ca_or_router(
-  IN const osm_ni_rcv_t* const p_rcv,
-  IN osm_node_t* const p_node,
-  IN const osm_madw_t* const p_madw )
+__osm_ni_rcv_process_new_ca_or_router(IN const osm_ni_rcv_t * const p_rcv,
+				      IN osm_node_t * const p_node,
+				      IN const osm_madw_t * const p_madw)
 {
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_ni_rcv_process_new_ca_or_router );
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_new_ca_or_router);
 
-  __osm_ni_rcv_process_new_node( p_rcv, p_node, p_madw );
+	__osm_ni_rcv_process_new_node(p_rcv, p_node, p_madw);
 
-  /*
-    A node guid of 0 is the corner case that indicates
-    we discovered our own node.  Initialize the subnet
-    object with the SM's own port guid.
-  */
-  if( osm_madw_get_ni_context_ptr( p_madw )->node_guid == 0 )
-    p_rcv->p_subn->sm_port_guid = p_node->node_info.port_guid;
+	/*
+	   A node guid of 0 is the corner case that indicates
+	   we discovered our own node.  Initialize the subnet
+	   object with the SM's own port guid.
+	 */
+	if (osm_madw_get_ni_context_ptr(p_madw)->node_guid == 0)
+		p_rcv->p_subn->sm_port_guid = p_node->node_info.port_guid;
 
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_process_existing_ca_or_router(
-  IN const osm_ni_rcv_t* const p_rcv,
-  IN osm_node_t* const p_node,
-  IN const osm_madw_t* const p_madw )
+__osm_ni_rcv_process_existing_ca_or_router(IN const osm_ni_rcv_t * const p_rcv,
+					   IN osm_node_t * const p_node,
+					   IN const osm_madw_t * const 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_LOG_ENTER( p_rcv->p_log, __osm_ni_rcv_process_existing_ca_or_router );
-
-  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 );
-  h_bind = osm_madw_get_bind_handle( p_madw );
-
-  /*
-    Determine if we have encountered this node through a
-    previously undiscovered port.  If so, build the new
-    port object.
-  */
-  p_port = osm_get_port_by_guid( p_rcv->p_subn, p_ni->port_guid );
-  if( !p_port )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "__osm_ni_rcv_process_existing_ca_or_router: "
-             "Creating new port object with GUID 0x%" PRIx64 "\n",
-             cl_ntoh64( p_ni->port_guid ) );
-
-    osm_node_init_physp( p_node, p_madw );
-
-    p_port = osm_port_new( p_ni, p_node );
-    if( p_port == NULL )
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "__osm_ni_rcv_process_existing_ca_or_router: ERR 0D04: "
-               "Unable to create new port object\n" );
-      goto Exit;
-    }
-
-    /*
-      Add the new port object to the database.
-    */
-    p_port_check = (osm_port_t*)cl_qmap_insert( &p_rcv->p_subn->port_guid_tbl,
-                                                p_ni->port_guid, &p_port->map_item );
-    if( p_port_check != p_port )
-    {
-      /*
-        We should never be here!
-        Somehow, this port GUID already exists in the table.
-      */
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "__osm_ni_rcv_process_existing_ca_or_router: ERR 0D12: "
-               "Port 0x%" PRIx64 " already in the database!\n",
-               cl_ntoh64( p_ni->port_guid ) );
-
-      osm_port_delete( &p_port );
-      goto Exit;
-    }
-
-    /* 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
-       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.
-       If we are master, then the subnet as we know it is the updated one,
-       and any new ports we encounter should cause trap 64. C14-72.1.1 */
-    if ( p_rcv->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 );
-
-    if ( !osm_physp_is_valid( p_physp ) )
-    {
-        osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-                 "__osm_ni_rcv_process_existing_ca_or_router: ERR 0D19: "
-                 "Invalid physical port. Aborting discovery\n");
-        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,
-                      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.update_master_sm_base_lid = FALSE;
-  context.pi_context.ignore_errors = FALSE;
-  context.pi_context.light_sweep = FALSE;
-
-  status = osm_req_get( p_rcv->p_gen_req,
-                        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( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_ni_rcv_process_existing_ca_or_router: ERR 0D13: "
-             "Failure initiating PortInfo request (%s)\n",
-             ib_get_err_str(status));
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	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_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_existing_ca_or_router);
+
+	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);
+	h_bind = osm_madw_get_bind_handle(p_madw);
+
+	/*
+	   Determine if we have encountered this node through a
+	   previously undiscovered port.  If so, build the new
+	   port object.
+	 */
+	p_port = osm_get_port_by_guid(p_rcv->p_subn, p_ni->port_guid);
+	if (!p_port) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"__osm_ni_rcv_process_existing_ca_or_router: "
+			"Creating new port object with GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(p_ni->port_guid));
+
+		osm_node_init_physp(p_node, p_madw);
+
+		p_port = osm_port_new(p_ni, p_node);
+		if (p_port == NULL) {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"__osm_ni_rcv_process_existing_ca_or_router: ERR 0D04: "
+				"Unable to create new port object\n");
+			goto Exit;
+		}
+
+		/*
+		   Add the new port object to the database.
+		 */
+		p_port_check =
+		    (osm_port_t *) cl_qmap_insert(&p_rcv->p_subn->port_guid_tbl,
+						  p_ni->port_guid,
+						  &p_port->map_item);
+		if (p_port_check != p_port) {
+			/*
+			   We should never be here!
+			   Somehow, this port GUID already exists in the table.
+			 */
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"__osm_ni_rcv_process_existing_ca_or_router: ERR 0D12: "
+				"Port 0x%" PRIx64 " already in the database!\n",
+				cl_ntoh64(p_ni->port_guid));
+
+			osm_port_delete(&p_port);
+			goto Exit;
+		}
+
+		/* 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
+		   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.
+		   If we are master, then the subnet as we know it is the updated one,
+		   and any new ports we encounter should cause trap 64. C14-72.1.1 */
+		if (p_rcv->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);
+
+		if (!osm_physp_is_valid(p_physp)) {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"__osm_ni_rcv_process_existing_ca_or_router: ERR 0D19: "
+				"Invalid physical port. Aborting discovery\n");
+			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,
+				 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.update_master_sm_base_lid = FALSE;
+	context.pi_context.ignore_errors = FALSE;
+	context.pi_context.light_sweep = FALSE;
+
+	status = osm_req_get(p_rcv->p_gen_req,
+			     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(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_ni_rcv_process_existing_ca_or_router: ERR 0D13: "
+			"Failure initiating PortInfo request (%s)\n",
+			ib_get_err_str(status));
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_ni_rcv_process_switch(
-  IN const osm_ni_rcv_t* const p_rcv,
-  IN osm_node_t* const p_node,
-  IN const osm_madw_t* const p_madw )
+__osm_ni_rcv_process_switch(IN const osm_ni_rcv_t * const p_rcv,
+			    IN osm_node_t * const p_node,
+			    IN const osm_madw_t * const p_madw)
 {
-  ib_api_status_t status = IB_SUCCESS;
-  osm_madw_context_t context;
-  osm_dr_path_t dr_path;
-  ib_smp_t *p_smp;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_ni_rcv_process_switch );
-
-  CL_ASSERT( p_node );
-  CL_ASSERT( p_madw );
-
-  p_smp = osm_madw_get_smp_ptr( p_madw );
-
-  osm_dr_path_init( &dr_path,
-                    osm_madw_get_bind_handle( p_madw ),
-                    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;
-  context.si_context.light_sweep = FALSE;
-
-  /* Request a SwitchInfo attribute */
-  status = osm_req_get( p_rcv->p_gen_req,
-                        &dr_path,
-                        IB_MAD_ATTR_SWITCH_INFO,
-                        0,
-                        CL_DISP_MSGID_NONE,
-                        &context );
-  if( status != IB_SUCCESS )
-    /* continue despite error */
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_ni_rcv_process_switch: ERR 0D06: "
-             "Failure initiating SwitchInfo request (%s)\n",
-             ib_get_err_str( status ) );
-
-  OSM_LOG_EXIT( p_rcv->p_log );
+	ib_api_status_t status = IB_SUCCESS;
+	osm_madw_context_t context;
+	osm_dr_path_t dr_path;
+	ib_smp_t *p_smp;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_switch);
+
+	CL_ASSERT(p_node);
+	CL_ASSERT(p_madw);
+
+	p_smp = osm_madw_get_smp_ptr(p_madw);
+
+	osm_dr_path_init(&dr_path,
+			 osm_madw_get_bind_handle(p_madw),
+			 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;
+	context.si_context.light_sweep = FALSE;
+
+	/* Request a SwitchInfo attribute */
+	status = osm_req_get(p_rcv->p_gen_req,
+			     &dr_path,
+			     IB_MAD_ATTR_SWITCH_INFO,
+			     0, CL_DISP_MSGID_NONE, &context);
+	if (status != IB_SUCCESS)
+		/* continue despite error */
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_ni_rcv_process_switch: ERR 0D06: "
+			"Failure initiating SwitchInfo request (%s)\n",
+			ib_get_err_str(status));
+
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_process_existing_switch(
-  IN const osm_ni_rcv_t* const p_rcv,
-  IN osm_node_t* const p_node,
-  IN const osm_madw_t* const p_madw )
+__osm_ni_rcv_process_existing_switch(IN const osm_ni_rcv_t * const p_rcv,
+				     IN osm_node_t * const p_node,
+				     IN const osm_madw_t * const p_madw)
 {
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_ni_rcv_process_existing_switch );
-
-  /*
-    If this switch has already been probed during this sweep,
-    then don't bother reprobing it.
-    There is one exception - if the node has been visited, but
-    for some reason we don't have the switch object (this can happen
-    if the SwitchInfo mad didn't reach the SM) then we want
-    to retry to probe the switch.
-  */
-  if( p_node->discovery_count == 1 )
-    __osm_ni_rcv_process_switch( p_rcv, p_node, p_madw );
-  else if( !p_node->sw || p_node->sw->discovery_count == 0 )
-  {
-    /* we don't have the SwitchInfo - retry to get it */
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_ni_rcv_process_existing_switch: "
-             "Retry to get SwitchInfo on node GUID:0x%"
-             PRIx64 "\n", cl_ntoh64(osm_node_get_node_guid(p_node)) );
-    __osm_ni_rcv_process_switch( p_rcv, p_node, p_madw );
-  }
-
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_existing_switch);
+
+	/*
+	   If this switch has already been probed during this sweep,
+	   then don't bother reprobing it.
+	   There is one exception - if the node has been visited, but
+	   for some reason we don't have the switch object (this can happen
+	   if the SwitchInfo mad didn't reach the SM) then we want
+	   to retry to probe the switch.
+	 */
+	if (p_node->discovery_count == 1)
+		__osm_ni_rcv_process_switch(p_rcv, p_node, p_madw);
+	else if (!p_node->sw || p_node->sw->discovery_count == 0) {
+		/* we don't have the SwitchInfo - retry to get it */
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_ni_rcv_process_existing_switch: "
+			"Retry to get SwitchInfo on node GUID:0x%"
+			PRIx64 "\n", cl_ntoh64(osm_node_get_node_guid(p_node)));
+		__osm_ni_rcv_process_switch(p_rcv, p_node, p_madw);
+	}
+
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_process_new_switch(
-  IN const osm_ni_rcv_t* const p_rcv,
-  IN osm_node_t* const p_node,
-  IN const osm_madw_t* const p_madw )
+__osm_ni_rcv_process_new_switch(IN const osm_ni_rcv_t * const p_rcv,
+				IN osm_node_t * const p_node,
+				IN const osm_madw_t * const p_madw)
 {
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_ni_rcv_process_new_switch );
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_new_switch);
 
-  __osm_ni_rcv_process_switch( p_rcv, p_node, p_madw );
+	__osm_ni_rcv_process_switch(p_rcv, p_node, p_madw);
 
-  /*
-    A node guid of 0 is the corner case that indicates
-    we discovered our own node.  Initialize the subnet
-    object with the SM's own port guid.
-  */
-  if( osm_madw_get_ni_context_ptr( p_madw )->node_guid == 0 )
-    p_rcv->p_subn->sm_port_guid = p_node->node_info.port_guid;
+	/*
+	   A node guid of 0 is the corner case that indicates
+	   we discovered our own node.  Initialize the subnet
+	   object with the SM's own port guid.
+	 */
+	if (osm_madw_get_ni_context_ptr(p_madw)->node_guid == 0)
+		p_rcv->p_subn->sm_port_guid = p_node->node_info.port_guid;
 
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  The plock must NOT be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_process_new(
-  IN const osm_ni_rcv_t* const p_rcv,
-  IN const osm_madw_t* const p_madw )
+__osm_ni_rcv_process_new(IN const osm_ni_rcv_t * const p_rcv,
+			 IN const osm_madw_t * const p_madw)
 {
-  osm_node_t *p_node;
-  osm_node_t *p_node_check;
-  osm_port_t *p_port;
-  osm_port_t *p_port_check;
-  osm_router_t *p_rtr = NULL;
-  osm_router_t *p_rtr_check;
-  cl_qmap_t *p_rtr_guid_tbl;
-  ib_node_info_t *p_ni;
-  ib_smp_t *p_smp;
-  osm_ni_context_t *p_ni_context;
-  uint8_t port_num;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_ni_rcv_process_new );
-
-  p_smp = osm_madw_get_smp_ptr( p_madw );
-  p_ni = (ib_node_info_t*)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( p_rcv->p_log, p_smp, OSM_LOG_VERBOSE );
-
-  osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-           "__osm_ni_rcv_process_new: "
-           "Discovered new %s node,"
-           "\n\t\t\t\tGUID 0x%" PRIx64 ", TID 0x%" PRIx64 "\n",
-           ib_get_node_type_str( p_ni->node_type ),
-           cl_ntoh64( p_ni->node_guid ),
-           cl_ntoh64( p_smp->trans_id ) );
-
-  p_node = osm_node_new( p_madw );
-  if( p_node == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_ni_rcv_process_new: ERR 0D07: "
-             "Unable to create new node object\n" );
-    goto Exit;
-  }
-
-  /*
-    Create a new port object to represent this node's physical
-    ports in the port table.
-  */
-  p_port = osm_port_new( p_ni, p_node );
-  if( p_port == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_ni_rcv_process_new: ERR 0D14: "
-             "Unable to create new port object\n" );
-    osm_node_delete( &p_node );
-    goto Exit;
-  }
-
-  /*
-    Add the new port object to the database.
-  */
-  p_port_check = (osm_port_t*)cl_qmap_insert( &p_rcv->p_subn->port_guid_tbl,
-                                              p_ni->port_guid,
-                                              &p_port->map_item );
-  if( p_port_check != p_port )
-  {
-    /*
-      We should never be here!
-      Somehow, this port GUID already exists in the table.
-    */
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_ni_rcv_process_new: ERR 0D15: "
-             "Duplicate Port GUID 0x%" PRIx64 "! Found by the two directed routes:\n",
-             cl_ntoh64( p_ni->port_guid ) );
-    osm_dump_dr_path(p_rcv->p_log,
-                     osm_physp_get_dr_path_ptr(p_port->p_physp),
-                     OSM_LOG_ERROR);
-    osm_dump_dr_path(p_rcv->p_log,
-                     osm_physp_get_dr_path_ptr(p_port_check->p_physp),
-                     OSM_LOG_ERROR);
-    osm_port_delete( &p_port );
-    osm_node_delete( &p_node );
-    goto Exit;
-  }
-
-  /* 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
-     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.
-     If we are master, then the subnet as we know it is the updated one,
-     and any new ports we encounter should cause trap 64. C14-72.1.1 */
-  if ( p_rcv->p_subn->sm_state == IB_SMINFO_STATE_MASTER )
-    p_port->is_new = 1;
-
-  /* If there were RouterInfo or other router attribute,
-     this would be elsewhere */
-  if ( p_ni->node_type == IB_NODE_TYPE_ROUTER )
-  {
-    if ((p_rtr = osm_router_new(p_port)) == NULL)
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "__osm_ni_rcv_process_new: ERR 0D1A: "
-               "Unable to create new router object\n" );
-    else
-    {
-      p_rtr_guid_tbl = &p_rcv->p_subn->rtr_guid_tbl;
-      p_rtr_check = (osm_router_t*)cl_qmap_insert( p_rtr_guid_tbl,
-                                                   p_ni->port_guid,
-                                                   &p_rtr->map_item );
-      if( p_rtr_check != p_rtr )
-        osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-                 "__osm_ni_rcv_process_new: ERR 0D1B: "
-                 "Unable to add port GUID:0x%016" PRIx64 " to router table\n",
-                 cl_ntoh64( p_ni->port_guid ) );
-    }
-  }
-
-  p_node_check = (osm_node_t*)cl_qmap_insert( &p_rcv->p_subn->node_guid_tbl,
-                                              p_ni->node_guid,
-                                              &p_node->map_item );
-  if( p_node_check != p_node )
-  {
-    /*
-      This node must have been inserted by another thread.
-      This is unexpected, but is not an error.
-      We can simply clean-up, since the other thread will
-      see this processing through to completion.
-    */
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "__osm_ni_rcv_process_new: "
-             "Discovery race detected at node 0x%" PRIx64 "\n",
-             cl_ntoh64( p_ni->node_guid ) );
-    osm_node_delete( &p_node );
-    p_node = p_node_check;
-    __osm_ni_rcv_set_links( p_rcv, p_node, port_num, p_ni_context );
-    goto Exit;
-  }
-  else
-    __osm_ni_rcv_set_links( p_rcv, p_node, port_num, p_ni_context );
-
-  p_node->discovery_count++;
-  __osm_ni_rcv_get_node_desc( p_rcv, 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( p_rcv, p_node, p_madw );
-    break;
-  case IB_NODE_TYPE_SWITCH:
-    __osm_ni_rcv_process_new_switch( p_rcv, p_node, p_madw );
-    break;
-  default:
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_ni_rcv_process_new: ERR 0D16: "
-             "Unknown node type %u with GUID 0x%" PRIx64 "\n",
-             p_ni->node_type, cl_ntoh64( p_ni->node_guid ) );
-    break;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_node_t *p_node;
+	osm_node_t *p_node_check;
+	osm_port_t *p_port;
+	osm_port_t *p_port_check;
+	osm_router_t *p_rtr = NULL;
+	osm_router_t *p_rtr_check;
+	cl_qmap_t *p_rtr_guid_tbl;
+	ib_node_info_t *p_ni;
+	ib_smp_t *p_smp;
+	osm_ni_context_t *p_ni_context;
+	uint8_t port_num;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_new);
+
+	p_smp = osm_madw_get_smp_ptr(p_madw);
+	p_ni = (ib_node_info_t *) 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(p_rcv->p_log, p_smp, OSM_LOG_VERBOSE);
+
+	osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		"__osm_ni_rcv_process_new: "
+		"Discovered new %s node,"
+		"\n\t\t\t\tGUID 0x%" PRIx64 ", TID 0x%" PRIx64 "\n",
+		ib_get_node_type_str(p_ni->node_type),
+		cl_ntoh64(p_ni->node_guid), cl_ntoh64(p_smp->trans_id));
+
+	p_node = osm_node_new(p_madw);
+	if (p_node == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_ni_rcv_process_new: ERR 0D07: "
+			"Unable to create new node object\n");
+		goto Exit;
+	}
+
+	/*
+	   Create a new port object to represent this node's physical
+	   ports in the port table.
+	 */
+	p_port = osm_port_new(p_ni, p_node);
+	if (p_port == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_ni_rcv_process_new: ERR 0D14: "
+			"Unable to create new port object\n");
+		osm_node_delete(&p_node);
+		goto Exit;
+	}
+
+	/*
+	   Add the new port object to the database.
+	 */
+	p_port_check =
+	    (osm_port_t *) cl_qmap_insert(&p_rcv->p_subn->port_guid_tbl,
+					  p_ni->port_guid, &p_port->map_item);
+	if (p_port_check != p_port) {
+		/*
+		   We should never be here!
+		   Somehow, this port GUID already exists in the table.
+		 */
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_ni_rcv_process_new: ERR 0D15: "
+			"Duplicate Port GUID 0x%" PRIx64
+			"! Found by the two directed routes:\n",
+			cl_ntoh64(p_ni->port_guid));
+		osm_dump_dr_path(p_rcv->p_log,
+				 osm_physp_get_dr_path_ptr(p_port->p_physp),
+				 OSM_LOG_ERROR);
+		osm_dump_dr_path(p_rcv->p_log,
+				 osm_physp_get_dr_path_ptr(p_port_check->
+							   p_physp),
+				 OSM_LOG_ERROR);
+		osm_port_delete(&p_port);
+		osm_node_delete(&p_node);
+		goto Exit;
+	}
+
+	/* 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
+	   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.
+	   If we are master, then the subnet as we know it is the updated one,
+	   and any new ports we encounter should cause trap 64. C14-72.1.1 */
+	if (p_rcv->p_subn->sm_state == IB_SMINFO_STATE_MASTER)
+		p_port->is_new = 1;
+
+	/* If there were RouterInfo or other router attribute,
+	   this would be elsewhere */
+	if (p_ni->node_type == IB_NODE_TYPE_ROUTER) {
+		if ((p_rtr = osm_router_new(p_port)) == NULL)
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"__osm_ni_rcv_process_new: ERR 0D1A: "
+				"Unable to create new router object\n");
+		else {
+			p_rtr_guid_tbl = &p_rcv->p_subn->rtr_guid_tbl;
+			p_rtr_check =
+			    (osm_router_t *) cl_qmap_insert(p_rtr_guid_tbl,
+							    p_ni->port_guid,
+							    &p_rtr->map_item);
+			if (p_rtr_check != p_rtr)
+				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+					"__osm_ni_rcv_process_new: ERR 0D1B: "
+					"Unable to add port GUID:0x%016" PRIx64
+					" to router table\n",
+					cl_ntoh64(p_ni->port_guid));
+		}
+	}
+
+	p_node_check =
+	    (osm_node_t *) cl_qmap_insert(&p_rcv->p_subn->node_guid_tbl,
+					  p_ni->node_guid, &p_node->map_item);
+	if (p_node_check != p_node) {
+		/*
+		   This node must have been inserted by another thread.
+		   This is unexpected, but is not an error.
+		   We can simply clean-up, since the other thread will
+		   see this processing through to completion.
+		 */
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"__osm_ni_rcv_process_new: "
+			"Discovery race detected at node 0x%" PRIx64 "\n",
+			cl_ntoh64(p_ni->node_guid));
+		osm_node_delete(&p_node);
+		p_node = p_node_check;
+		__osm_ni_rcv_set_links(p_rcv, p_node, port_num, p_ni_context);
+		goto Exit;
+	} else
+		__osm_ni_rcv_set_links(p_rcv, p_node, port_num, p_ni_context);
+
+	p_node->discovery_count++;
+	__osm_ni_rcv_get_node_desc(p_rcv, 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(p_rcv, p_node, p_madw);
+		break;
+	case IB_NODE_TYPE_SWITCH:
+		__osm_ni_rcv_process_new_switch(p_rcv, p_node, p_madw);
+		break;
+	default:
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_ni_rcv_process_new: ERR 0D16: "
+			"Unknown node type %u with GUID 0x%" PRIx64 "\n",
+			p_ni->node_type, cl_ntoh64(p_ni->node_guid));
+		break;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_process_existing(
-  IN const osm_ni_rcv_t* const p_rcv,
-  IN osm_node_t* const p_node,
-  IN const osm_madw_t* const p_madw )
+__osm_ni_rcv_process_existing(IN const osm_ni_rcv_t * const p_rcv,
+			      IN osm_node_t * const p_node,
+			      IN const osm_madw_t * const p_madw)
 {
-  ib_node_info_t *p_ni;
-  ib_smp_t *p_smp;
-  osm_ni_context_t *p_ni_context;
-  uint8_t port_num;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_ni_rcv_process_existing );
-
-  p_smp = osm_madw_get_smp_ptr( p_madw );
-  p_ni = (ib_node_info_t*)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 );
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_VERBOSE ) )
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "__osm_ni_rcv_process_existing: "
-             "Rediscovered %s node 0x%" PRIx64
-             " TID 0x%" PRIx64 ", discovered %u times already\n",
-             ib_get_node_type_str(p_ni->node_type),
-             cl_ntoh64( p_ni->node_guid ),
-             cl_ntoh64( p_smp->trans_id ),
-             p_node->discovery_count );
-
-  /*
-    If we haven't already encountered this existing node
-    on this particular sweep, then process further.
-  */
-  p_node->discovery_count++;
-
-  switch( p_ni->node_type )
-  {
-  case IB_NODE_TYPE_CA:
-  case IB_NODE_TYPE_ROUTER:
-    __osm_ni_rcv_process_existing_ca_or_router( p_rcv, p_node, p_madw );
-    break;
-
-  case IB_NODE_TYPE_SWITCH:
-    __osm_ni_rcv_process_existing_switch( p_rcv, p_node, p_madw );
-    break;
-
-  default:
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_ni_rcv_process_existing: ERR 0D09: "
-             "Unknown node type %u with GUID 0x%" PRIx64 "\n",
-             p_ni->node_type, cl_ntoh64( p_ni->node_guid ) );
-    break;
-  }
-
-  __osm_ni_rcv_set_links( p_rcv, p_node, port_num, p_ni_context );
-
-  OSM_LOG_EXIT( p_rcv->p_log );
+	ib_node_info_t *p_ni;
+	ib_smp_t *p_smp;
+	osm_ni_context_t *p_ni_context;
+	uint8_t port_num;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_existing);
+
+	p_smp = osm_madw_get_smp_ptr(p_madw);
+	p_ni = (ib_node_info_t *) 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);
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_VERBOSE))
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"__osm_ni_rcv_process_existing: "
+			"Rediscovered %s node 0x%" PRIx64
+			" TID 0x%" PRIx64 ", discovered %u times already\n",
+			ib_get_node_type_str(p_ni->node_type),
+			cl_ntoh64(p_ni->node_guid),
+			cl_ntoh64(p_smp->trans_id), p_node->discovery_count);
+
+	/*
+	   If we haven't already encountered this existing node
+	   on this particular sweep, then process further.
+	 */
+	p_node->discovery_count++;
+
+	switch (p_ni->node_type) {
+	case IB_NODE_TYPE_CA:
+	case IB_NODE_TYPE_ROUTER:
+		__osm_ni_rcv_process_existing_ca_or_router(p_rcv, p_node,
+							   p_madw);
+		break;
+
+	case IB_NODE_TYPE_SWITCH:
+		__osm_ni_rcv_process_existing_switch(p_rcv, p_node, p_madw);
+		break;
+
+	default:
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_ni_rcv_process_existing: ERR 0D09: "
+			"Unknown node type %u with GUID 0x%" PRIx64 "\n",
+			p_ni->node_type, cl_ntoh64(p_ni->node_guid));
+		break;
+	}
+
+	__osm_ni_rcv_set_links(p_rcv, p_node, port_num, p_ni_context);
+
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_ni_rcv_construct(
-  IN osm_ni_rcv_t* const p_rcv )
+void osm_ni_rcv_construct(IN osm_ni_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
+	memset(p_rcv, 0, sizeof(*p_rcv));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_ni_rcv_destroy(
-  IN osm_ni_rcv_t* const p_rcv )
+void osm_ni_rcv_destroy(IN osm_ni_rcv_t * const p_rcv)
 {
-  CL_ASSERT( p_rcv );
+	CL_ASSERT(p_rcv);
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_ni_rcv_destroy );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_ni_rcv_destroy);
 
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_ni_rcv_init(
-  IN osm_ni_rcv_t* const p_rcv,
-  IN osm_req_t* const p_req,
-  IN osm_subn_t* const p_subn,
-  IN osm_log_t* const p_log,
-  IN osm_state_mgr_t* const p_state_mgr,
-  IN cl_plock_t* const p_lock )
+osm_ni_rcv_init(IN osm_ni_rcv_t * const p_rcv,
+		IN osm_req_t * const p_req,
+		IN osm_subn_t * const p_subn,
+		IN osm_log_t * const p_log,
+		IN osm_state_mgr_t * const p_state_mgr,
+		IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_ni_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_ni_rcv_init);
 
-  osm_ni_rcv_construct( p_rcv );
+	osm_ni_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_gen_req = p_req;
-  p_rcv->p_state_mgr = p_state_mgr;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_gen_req = p_req;
+	p_rcv->p_state_mgr = p_state_mgr;
 
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_ni_rcv_process(
-  IN void *context,
-  IN void *data )
+void osm_ni_rcv_process(IN void *context, IN void *data)
 {
-  osm_ni_rcv_t *p_rcv = context;
-  osm_madw_t *p_madw = data;
-  ib_node_info_t *p_ni;
-  ib_smp_t *p_smp;
-  osm_node_t *p_node;
-  boolean_t  process_new_flag = FALSE;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_ni_rcv_process );
-
-  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 );
-
-  CL_ASSERT( p_smp->attr_id == IB_MAD_ATTR_NODE_INFO );
-
-  if (p_ni->node_guid == 0)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_ni_rcv_process: ERR 0D16: "
-             "Got Zero Node GUID! Found on the directed route:\n");
-    osm_dump_smp_dr_path(p_rcv->p_log, p_smp, OSM_LOG_ERROR);
-    goto Exit;
-  }
-
-  if (p_ni->port_guid == 0)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_ni_rcv_process: ERR 0D17: "
-             "Got Zero Port GUID! Found on the directed route:\n");
-    osm_dump_smp_dr_path(p_rcv->p_log, p_smp, OSM_LOG_ERROR);
-    goto Exit;
-  }
-
-  /*
-    Determine if this node has already been discovered,
-    and process accordingly.
-    During processing of this node, hold the shared lock.
-  */
-
-  CL_PLOCK_EXCL_ACQUIRE( p_rcv->p_lock );
-  p_node = osm_get_node_by_guid( p_rcv->p_subn, p_ni->node_guid );
-
-  osm_dump_node_info( p_rcv->p_log, p_ni, OSM_LOG_DEBUG );
-
-  if( !p_node )
-  {
-    __osm_ni_rcv_process_new( p_rcv, p_madw );
-    process_new_flag = TRUE;
-  }
-  else
-    __osm_ni_rcv_process_existing( p_rcv, p_node, p_madw );
-
-  CL_PLOCK_RELEASE( p_rcv->p_lock );
-
-  /*
-   * If we processed a new node - need to signal to the state_mgr that
-   * change detected. BUT - we cannot call the osm_state_mgr_process
-   * from within the lock of p_rcv->p_lock (can cause a deadlock).
-   */
-  if ( process_new_flag )
-    osm_state_mgr_process( p_rcv->p_state_mgr, OSM_SIGNAL_CHANGE_DETECTED );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_ni_rcv_t *p_rcv = context;
+	osm_madw_t *p_madw = data;
+	ib_node_info_t *p_ni;
+	ib_smp_t *p_smp;
+	osm_node_t *p_node;
+	boolean_t process_new_flag = FALSE;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_ni_rcv_process);
+
+	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);
+
+	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_NODE_INFO);
+
+	if (p_ni->node_guid == 0) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_ni_rcv_process: ERR 0D16: "
+			"Got Zero Node GUID! Found on the directed route:\n");
+		osm_dump_smp_dr_path(p_rcv->p_log, p_smp, OSM_LOG_ERROR);
+		goto Exit;
+	}
+
+	if (p_ni->port_guid == 0) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_ni_rcv_process: ERR 0D17: "
+			"Got Zero Port GUID! Found on the directed route:\n");
+		osm_dump_smp_dr_path(p_rcv->p_log, p_smp, OSM_LOG_ERROR);
+		goto Exit;
+	}
+
+	/*
+	   Determine if this node has already been discovered,
+	   and process accordingly.
+	   During processing of this node, hold the shared lock.
+	 */
+
+	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
+	p_node = osm_get_node_by_guid(p_rcv->p_subn, p_ni->node_guid);
+
+	osm_dump_node_info(p_rcv->p_log, p_ni, OSM_LOG_DEBUG);
+
+	if (!p_node) {
+		__osm_ni_rcv_process_new(p_rcv, p_madw);
+		process_new_flag = TRUE;
+	} else
+		__osm_ni_rcv_process_existing(p_rcv, p_node, p_madw);
+
+	CL_PLOCK_RELEASE(p_rcv->p_lock);
+
+	/*
+	 * If we processed a new node - need to signal to the state_mgr that
+	 * change detected. BUT - we cannot call the osm_state_mgr_process
+	 * from within the lock of p_rcv->p_lock (can cause a deadlock).
+	 */
+	if (process_new_flag)
+		osm_state_mgr_process(p_rcv->p_state_mgr,
+				      OSM_SIGNAL_CHANGE_DETECTED);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_opensm.c b/opensm/opensm/osm_opensm.c
index 4cf57cf..9a596dd 100644
--- a/opensm/opensm/osm_opensm.c
+++ b/opensm/opensm/osm_opensm.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of osm_opensm_t.
@@ -48,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -66,31 +65,31 @@
 
 struct routing_engine_module {
 	const char *name;
-	int (*setup)(osm_opensm_t *p_osm);
+	int (*setup) (osm_opensm_t * p_osm);
 };
 
-extern int osm_ucast_updn_setup(osm_opensm_t *p_osm);
-extern int osm_ucast_file_setup(osm_opensm_t *p_osm);
-extern int osm_ucast_ftree_setup(osm_opensm_t *p_osm);
-extern int osm_ucast_lash_setup(osm_opensm_t *p_osm);
+extern int osm_ucast_updn_setup(osm_opensm_t * p_osm);
+extern int osm_ucast_file_setup(osm_opensm_t * p_osm);
+extern int osm_ucast_ftree_setup(osm_opensm_t * p_osm);
+extern int osm_ucast_lash_setup(osm_opensm_t * p_osm);
 
-static int osm_ucast_null_setup(osm_opensm_t *p_osm);
+static int osm_ucast_null_setup(osm_opensm_t * p_osm);
 
 const static struct routing_engine_module routing_modules[] = {
-	{ "null", osm_ucast_null_setup },
-	{ "updn", osm_ucast_updn_setup },
-	{ "file", osm_ucast_file_setup },
-	{ "ftree", osm_ucast_ftree_setup },
-	{ "lash", osm_ucast_lash_setup },
-	{ NULL, NULL }
+	{"null", osm_ucast_null_setup},
+	{"updn", osm_ucast_updn_setup},
+	{"file", osm_ucast_file_setup},
+	{"ftree", osm_ucast_ftree_setup},
+	{"lash", osm_ucast_lash_setup},
+	{NULL, NULL}
 };
 
-static int setup_routing_engine(osm_opensm_t *p_osm, const char *name)
+static int setup_routing_engine(osm_opensm_t * p_osm, const char *name)
 {
 	const struct routing_engine_module *r;
 
 	for (r = routing_modules; r->name && *r->name; r++) {
-		if(!strcmp(r->name, name)) {
+		if (!strcmp(r->name, name)) {
 			p_osm->routing_engine.name = r->name;
 			if (r->setup(p_osm)) {
 				osm_log(&p_osm->log, OSM_LOG_VERBOSE,
@@ -98,17 +97,17 @@ static int setup_routing_engine(osm_opensm_t *p_osm, const char *name)
 					" engine \'%s\' failed\n", name);
 				return -2;
 			}
-			osm_log (&p_osm->log, OSM_LOG_DEBUG,
-				 "setup_routing_engine: "
-				 "\'%s\' routing engine set up\n",
-				 p_osm->routing_engine.name);
+			osm_log(&p_osm->log, OSM_LOG_DEBUG,
+				"setup_routing_engine: "
+				"\'%s\' routing engine set up\n",
+				p_osm->routing_engine.name);
 			return 0;
 		}
 	}
 	return -1;
 }
 
-static int osm_ucast_null_setup(osm_opensm_t *p_osm)
+static int osm_ucast_null_setup(osm_opensm_t * p_osm)
 {
 	osm_log(&p_osm->log, OSM_LOG_VERBOSE,
 		"osm_ucast_null_setup: nothing yet - "
@@ -118,241 +117,228 @@ static int osm_ucast_null_setup(osm_opensm_t *p_osm)
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_opensm_construct(
-   IN osm_opensm_t * const p_osm )
+void osm_opensm_construct(IN osm_opensm_t * const p_osm)
 {
-   memset( p_osm, 0, sizeof( *p_osm ) );
-   osm_subn_construct( &p_osm->subn );
-   osm_sm_construct( &p_osm->sm );
-   osm_sa_construct( &p_osm->sa );
-   osm_db_construct( &p_osm->db );
-   osm_mad_pool_construct( &p_osm->mad_pool );
-   osm_vl15_construct( &p_osm->vl15 );
-   osm_log_construct( &p_osm->log );
+	memset(p_osm, 0, sizeof(*p_osm));
+	osm_subn_construct(&p_osm->subn);
+	osm_sm_construct(&p_osm->sm);
+	osm_sa_construct(&p_osm->sa);
+	osm_db_construct(&p_osm->db);
+	osm_mad_pool_construct(&p_osm->mad_pool);
+	osm_vl15_construct(&p_osm->vl15);
+	osm_log_construct(&p_osm->log);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_opensm_destroy(
-   IN osm_opensm_t * const p_osm )
+void osm_opensm_destroy(IN osm_opensm_t * const p_osm)
 {
-   /* in case of shutdown through exit proc - no ^C */
-   osm_exit_flag = TRUE;
+	/* in case of shutdown through exit proc - no ^C */
+	osm_exit_flag = TRUE;
 
-   /*
-    * First of all, clear the is_sm bit.
-    */
-   if( p_osm->sm.mad_ctrl.h_bind )
-      osm_vendor_set_sm( p_osm->sm.mad_ctrl.h_bind, FALSE );
+	/*
+	 * First of all, clear the is_sm bit.
+	 */
+	if (p_osm->sm.mad_ctrl.h_bind)
+		osm_vendor_set_sm(p_osm->sm.mad_ctrl.h_bind, FALSE);
 
 #ifdef ENABLE_OSM_PERF_MGR
-   /* Shutdown the PerfMgr */
-   osm_perfmgr_shutdown(&p_osm->perfmgr);
-#endif /* ENABLE_OSM_PERF_MGR */
-
-   /* shut down the SA
-    * - unbind from QP1 messages
-    */
-   osm_sa_shutdown( &p_osm->sa );
-
-   /* shut down the SM
-    * - make sure the SM sweeper thread exited
-    * - unbind from QP0 messages
-    */
-   osm_sm_shutdown( &p_osm->sm );
-
-   /* cleanup all messages on VL15 fifo that were not sent yet */
-   osm_vl15_shutdown( &p_osm->vl15, &p_osm->mad_pool );
-
-   /* shut down the dispatcher - so no new messages cross */
-   cl_disp_shutdown( &p_osm->disp );
-
-   /* dump SA DB */
-   osm_sa_db_file_dump(p_osm);
-
-   /* do the destruction in reverse order as init */
-   if (p_osm->routing_engine.delete)
-     p_osm->routing_engine.delete(p_osm->routing_engine.context);
-   osm_sa_destroy( &p_osm->sa );
-   osm_sm_destroy( &p_osm->sm );
+	/* Shutdown the PerfMgr */
+	osm_perfmgr_shutdown(&p_osm->perfmgr);
+#endif				/* ENABLE_OSM_PERF_MGR */
+
+	/* shut down the SA
+	 * - unbind from QP1 messages
+	 */
+	osm_sa_shutdown(&p_osm->sa);
+
+	/* shut down the SM
+	 * - make sure the SM sweeper thread exited
+	 * - unbind from QP0 messages
+	 */
+	osm_sm_shutdown(&p_osm->sm);
+
+	/* cleanup all messages on VL15 fifo that were not sent yet */
+	osm_vl15_shutdown(&p_osm->vl15, &p_osm->mad_pool);
+
+	/* shut down the dispatcher - so no new messages cross */
+	cl_disp_shutdown(&p_osm->disp);
+
+	/* dump SA DB */
+	osm_sa_db_file_dump(p_osm);
+
+	/* do the destruction in reverse order as init */
+	if (p_osm->routing_engine.delete)
+		p_osm->routing_engine.delete(p_osm->routing_engine.context);
+	osm_sa_destroy(&p_osm->sa);
+	osm_sm_destroy(&p_osm->sm);
 #ifdef ENABLE_OSM_PERF_MGR
-   osm_perfmgr_destroy( &p_osm->perfmgr );
-#endif /* ENABLE_OSM_PERF_MGR */
-   osm_db_destroy( &p_osm->db );
-   osm_vl15_destroy( &p_osm->vl15, &p_osm->mad_pool );
-   osm_mad_pool_destroy( &p_osm->mad_pool );
-   osm_vendor_delete( &p_osm->p_vendor );
-   osm_subn_destroy( &p_osm->subn );
-   cl_disp_destroy( &p_osm->disp );
-
-   cl_plock_destroy( &p_osm->lock );
-
-   osm_log_destroy( &p_osm->log );
+	osm_perfmgr_destroy(&p_osm->perfmgr);
+#endif				/* ENABLE_OSM_PERF_MGR */
+	osm_db_destroy(&p_osm->db);
+	osm_vl15_destroy(&p_osm->vl15, &p_osm->mad_pool);
+	osm_mad_pool_destroy(&p_osm->mad_pool);
+	osm_vendor_delete(&p_osm->p_vendor);
+	osm_subn_destroy(&p_osm->subn);
+	cl_disp_destroy(&p_osm->disp);
+
+	cl_plock_destroy(&p_osm->lock);
+
+	osm_log_destroy(&p_osm->log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_opensm_init(
-   IN osm_opensm_t * const p_osm,
-   IN const osm_subn_opt_t * const p_opt )
+osm_opensm_init(IN osm_opensm_t * const p_osm,
+		IN const osm_subn_opt_t * const p_opt)
 {
-   ib_api_status_t status;
-
-   /* Can't use log macros here, since we're initializing the log */
-   osm_opensm_construct( p_osm );
-
-   if (p_opt->daemon)
-      p_osm->log.daemon = 1;
-
-   status = osm_log_init_v2( &p_osm->log, p_opt->force_log_flush,
-                             p_opt->log_flags, p_opt->log_file,
-                             p_opt->log_max_size, p_opt->accum_log_file );
-   if( status != IB_SUCCESS )
-      return ( status );
-
-   /* 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",
-            OSM_VERSION );
-   /* Write the OSM_VERSION to the SYS_LOG */
-   osm_log( &p_osm->log, OSM_LOG_SYS, "%s\n", OSM_VERSION );   /* Format Waived */
-
-   osm_log( &p_osm->log, OSM_LOG_FUNCS, "osm_opensm_init: [\n" ); /* Format Waived */
-
-   status = cl_plock_init( &p_osm->lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   if( p_opt->single_thread )
-   {
-      osm_log( &p_osm->log, OSM_LOG_INFO,
-               "osm_opensm_init: Forcing single threaded dispatcher\n" );
-      status = cl_disp_init( &p_osm->disp, 1, "opensm" );
-   }
-   else
-   {
-      /*
-       * Normal behavior is to initialize the dispatcher with
-       * one thread per CPU, as specified by a thread count of '0'.
-       */
-      status = cl_disp_init( &p_osm->disp, 0, "opensm" );
-   }
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_subn_init( &p_osm->subn, p_osm, p_opt );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   p_osm->p_vendor =
-      osm_vendor_new( &p_osm->log, p_opt->transaction_timeout );
-   if( p_osm->p_vendor == NULL )
-   {
-      status = IB_INSUFFICIENT_RESOURCES;
-      goto Exit;
-   }
-
-   status = osm_mad_pool_init( &p_osm->mad_pool, &p_osm->log );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_vl15_init( &p_osm->vl15,
-                           p_osm->p_vendor,
-                           &p_osm->log, &p_osm->stats, p_opt->max_wire_smps,
-                           &p_osm->subn, &p_osm->disp, &p_osm->lock );
-   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 );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_sm_init( &p_osm->sm,
-                         &p_osm->subn,
-                         &p_osm->db,
-                         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;
-
-   p_osm->event_plugin = osm_epi_construct(&p_osm->log,
-					p_opt->event_plugin_name);
+	ib_api_status_t status;
+
+	/* Can't use log macros here, since we're initializing the log */
+	osm_opensm_construct(p_osm);
+
+	if (p_opt->daemon)
+		p_osm->log.daemon = 1;
+
+	status = osm_log_init_v2(&p_osm->log, p_opt->force_log_flush,
+				 p_opt->log_flags, p_opt->log_file,
+				 p_opt->log_max_size, p_opt->accum_log_file);
+	if (status != IB_SUCCESS)
+		return (status);
+
+	/* 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",
+		OSM_VERSION);
+	/* Write the OSM_VERSION to the SYS_LOG */
+	osm_log(&p_osm->log, OSM_LOG_SYS, "%s\n", OSM_VERSION);	/* Format Waived */
+
+	osm_log(&p_osm->log, OSM_LOG_FUNCS, "osm_opensm_init: [\n");	/* Format Waived */
+
+	status = cl_plock_init(&p_osm->lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	if (p_opt->single_thread) {
+		osm_log(&p_osm->log, OSM_LOG_INFO,
+			"osm_opensm_init: Forcing single threaded dispatcher\n");
+		status = cl_disp_init(&p_osm->disp, 1, "opensm");
+	} else {
+		/*
+		 * Normal behavior is to initialize the dispatcher with
+		 * one thread per CPU, as specified by a thread count of '0'.
+		 */
+		status = cl_disp_init(&p_osm->disp, 0, "opensm");
+	}
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_subn_init(&p_osm->subn, p_osm, p_opt);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	p_osm->p_vendor =
+	    osm_vendor_new(&p_osm->log, p_opt->transaction_timeout);
+	if (p_osm->p_vendor == NULL) {
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+	status = osm_mad_pool_init(&p_osm->mad_pool, &p_osm->log);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_vl15_init(&p_osm->vl15,
+			       p_osm->p_vendor,
+			       &p_osm->log, &p_osm->stats, p_opt->max_wire_smps,
+			       &p_osm->subn, &p_osm->disp, &p_osm->lock);
+	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);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_sm_init(&p_osm->sm,
+			     &p_osm->subn,
+			     &p_osm->db,
+			     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;
+
+	p_osm->event_plugin = osm_epi_construct(&p_osm->log,
+						p_opt->event_plugin_name);
 
 #ifdef ENABLE_OSM_PERF_MGR
-   status = osm_perfmgr_init( &p_osm->perfmgr,
-                         &p_osm->subn,
-			 &p_osm->sm,
-                         &p_osm->log,
-			 &p_osm->mad_pool,
-			 p_osm->p_vendor,
-			 &p_osm->disp,
-			 &p_osm->lock,
-			 p_opt,
-			 p_osm->event_plugin);
-
-   if( status != IB_SUCCESS )
-      goto Exit;
-#endif /* ENABLE_OSM_PERF_MGR */
-
-   if( p_opt->routing_engine_name &&
-       setup_routing_engine(p_osm, p_opt->routing_engine_name)) {
-      osm_log( &p_osm->log, OSM_LOG_VERBOSE,
-               "osm_opensm_init: cannot find or setup routing engine"
-               " \'%s\'. Default will be used instead\n",
-               p_opt->routing_engine_name);
-      goto Exit;
-   }
-
- Exit:
-   osm_log( &p_osm->log, OSM_LOG_FUNCS, "osm_opensm_init: ]\n" ); /* Format Waived */
-   return ( status );
+	status = osm_perfmgr_init(&p_osm->perfmgr,
+				  &p_osm->subn,
+				  &p_osm->sm,
+				  &p_osm->log,
+				  &p_osm->mad_pool,
+				  p_osm->p_vendor,
+				  &p_osm->disp,
+				  &p_osm->lock, p_opt, p_osm->event_plugin);
+
+	if (status != IB_SUCCESS)
+		goto Exit;
+#endif				/* ENABLE_OSM_PERF_MGR */
+
+	if (p_opt->routing_engine_name &&
+	    setup_routing_engine(p_osm, p_opt->routing_engine_name)) {
+		osm_log(&p_osm->log, OSM_LOG_VERBOSE,
+			"osm_opensm_init: cannot find or setup routing engine"
+			" \'%s\'. Default will be used instead\n",
+			p_opt->routing_engine_name);
+		goto Exit;
+	}
+
+      Exit:
+	osm_log(&p_osm->log, OSM_LOG_FUNCS, "osm_opensm_init: ]\n");	/* Format Waived */
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_opensm_bind(
-   IN osm_opensm_t * const p_osm,
-   IN const ib_net64_t guid )
+osm_opensm_bind(IN osm_opensm_t * const p_osm, IN const ib_net64_t guid)
 {
-   ib_api_status_t status;
+	ib_api_status_t status;
 
-   OSM_LOG_ENTER( &p_osm->log, osm_opensm_bind );
+	OSM_LOG_ENTER(&p_osm->log, osm_opensm_bind);
 
-   status = osm_sm_bind( &p_osm->sm, guid );
-   if( status != IB_SUCCESS )
-      goto Exit;
+	status = osm_sm_bind(&p_osm->sm, guid);
+	if (status != IB_SUCCESS)
+		goto Exit;
 
-   status = osm_sa_bind( &p_osm->sa, guid );
-   if( status != IB_SUCCESS )
-      goto Exit;
+	status = osm_sa_bind(&p_osm->sa, guid);
+	if (status != IB_SUCCESS)
+		goto Exit;
 
 #ifdef ENABLE_OSM_PERF_MGR
-   status = osm_perfmgr_bind( &p_osm->perfmgr, guid );
-   if( status != IB_SUCCESS )
-      goto Exit;
-#endif /* ENABLE_OSM_PERF_MGR */
-
- Exit:
-   OSM_LOG_EXIT( &p_osm->log );
-   return ( status );
+	status = osm_perfmgr_bind(&p_osm->perfmgr, guid);
+	if (status != IB_SUCCESS)
+		goto Exit;
+#endif				/* ENABLE_OSM_PERF_MGR */
+
+      Exit:
+	OSM_LOG_EXIT(&p_osm->log);
+	return (status);
 }
diff --git a/opensm/opensm/osm_perfmgr.c b/opensm/opensm/osm_perfmgr.c
index 43689fa..1f6fa19 100644
--- a/opensm/opensm/osm_perfmgr.c
+++ b/opensm/opensm/osm_perfmgr.c
@@ -43,7 +43,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #ifdef ENABLE_OSM_PERF_MGR
 
@@ -67,8 +67,7 @@
 /**********************************************************************
  * Internal helper functions.
  **********************************************************************/
-static inline void
-__init_monitored_nodes(osm_perfmgr_t *pm)
+static inline void __init_monitored_nodes(osm_perfmgr_t * pm)
 {
 	cl_qmap_init(&pm->monitored_map);
 	pm->remove_list = NULL;
@@ -77,7 +76,7 @@ __init_monitored_nodes(osm_perfmgr_t *pm)
 }
 
 static inline void
-__mark_for_removal(osm_perfmgr_t *pm, __monitored_node_t *node)
+__mark_for_removal(osm_perfmgr_t * pm, __monitored_node_t * node)
 {
 	if (pm->remove_list) {
 		node->next = pm->remove_list;
@@ -88,21 +87,19 @@ __mark_for_removal(osm_perfmgr_t *pm, __monitored_node_t *node)
 	}
 }
 
-static inline void
-__remove_marked_nodes(osm_perfmgr_t *pm)
+static inline void __remove_marked_nodes(osm_perfmgr_t * pm)
 {
 	while (pm->remove_list) {
 		__monitored_node_t *next = pm->remove_list->next;
 
 		cl_qmap_remove_item(&(pm->monitored_map),
-				    (cl_map_item_t *)(pm->remove_list));
+				    (cl_map_item_t *) (pm->remove_list));
 		free(pm->remove_list);
 		pm->remove_list = next;
 	}
 }
 
-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));
@@ -113,21 +110,21 @@ __decrement_outstanding_queries(osm_perfmgr_t *pm)
  * the dispatcher.
  **********************************************************************/
 static void
-osm_perfmgr_mad_recv_callback(osm_madw_t *p_madw, void* bind_context,
-			      osm_madw_t *p_req_madw)
+osm_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;
+	osm_perfmgr_t *pm = (osm_perfmgr_t *) bind_context;
 
-	OSM_LOG_ENTER( pm->log, osm_pm_mad_recv_callback );
+	OSM_LOG_ENTER(pm->log, osm_pm_mad_recv_callback);
 
-	osm_madw_copy_context( p_madw, p_req_madw );
-	osm_mad_pool_put( pm->mad_pool, p_req_madw );
+	osm_madw_copy_context(p_madw, p_req_madw);
+	osm_mad_pool_put(pm->mad_pool, p_req_madw);
 
 	__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) {
+			 (void *)p_madw, NULL, NULL) != CL_SUCCESS) {
 		osm_log(pm->log, OSM_LOG_ERROR,
 			"osm_perfmgr_mad_recv_callback: ERR 4C01: "
 			"PerfMgr Dispatcher post failed\n");
@@ -135,7 +132,7 @@ osm_perfmgr_mad_recv_callback(osm_madw_t *p_madw, void* bind_context,
 	}
 #if 0
 	do {
-		struct timeval      rcv_time;
+		struct timeval rcv_time;
 		gettimeofday(&rcv_time, NULL);
 		osm_log(pm->log, OSM_LOG_INFO,
 			"perfmgr rcv time %ld\n",
@@ -143,28 +140,27 @@ osm_perfmgr_mad_recv_callback(osm_madw_t *p_madw, void* bind_context,
 			p_madw->context.perfmgr_context.query_start.tv_usec);
 	} while (0);
 #endif
-	OSM_LOG_EXIT( pm->log );
+	OSM_LOG_EXIT(pm->log);
 }
 
 /**********************************************************************
  * Process MAD send errors.
  **********************************************************************/
 static void
-osm_perfmgr_mad_send_err_callback(void* bind_context, osm_madw_t *p_madw)
+osm_perfmgr_mad_send_err_callback(void *bind_context, osm_madw_t * p_madw)
 {
-	osm_perfmgr_t *pm = (osm_perfmgr_t *)bind_context;
+	osm_perfmgr_t *pm = (osm_perfmgr_t *) bind_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;
+	uint64_t node_guid = context->perfmgr_context.node_guid;
+	uint8_t port = context->perfmgr_context.port;
 
-	OSM_LOG_ENTER( pm->log, osm_pm_mad_send_err_callback );
+	OSM_LOG_ENTER(pm->log, osm_pm_mad_send_err_callback);
 
-	osm_log( pm->log, OSM_LOG_ERROR,
-		"osm_perfmgr_mad_send_err_callback: ERR 4C02: 0x%" PRIx64 " port %d\n",
-		node_guid, port);
+	osm_log(pm->log, OSM_LOG_ERROR,
+		"osm_perfmgr_mad_send_err_callback: ERR 4C02: 0x%" PRIx64
+		" port %d\n", node_guid, port);
 
-	if (pm->subn->opt.perfmgr_redir && p_madw->status == IB_TIMEOUT)
-	{
+	if (pm->subn->opt.perfmgr_redir && p_madw->status == IB_TIMEOUT) {
 		cl_map_item_t *p_node;
 		__monitored_node_t *p_mon_node;
 
@@ -174,19 +170,19 @@ osm_perfmgr_mad_send_err_callback(void* bind_context, osm_madw_t *p_madw)
 		    cl_qmap_end(&(pm->monitored_map))) {
 			cl_plock_release(pm->lock);
 			osm_log(pm->log, OSM_LOG_ERROR,
-				"osm_perfmgr_mad_send_err_callback: ERR 4C15: GUID 0x%016" PRIx64
-				" not found in monitored map\n",
+				"osm_perfmgr_mad_send_err_callback: ERR 4C15: 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;
 		/* Now, validate port number */
 		if (port > p_mon_node->redir_tbl_size) {
 			cl_plock_release(pm->lock);
 			osm_log(pm->log, OSM_LOG_ERROR,
-				"osm_perfmgr_mad_send_err_callback: ERR 4C16: Invalid port num %d for GUID 0x%016" PRIx64
-				" num ports %d\n",
-				port, node_guid, p_mon_node->redir_tbl_size);
+				"osm_perfmgr_mad_send_err_callback: ERR 4C16: Invalid port num %d for GUID 0x%016"
+				PRIx64 " num ports %d\n", port, node_guid,
+				p_mon_node->redir_tbl_size);
 			goto Exit;
 		}
 		/* Clear redirection info */
@@ -195,12 +191,12 @@ osm_perfmgr_mad_send_err_callback(void* bind_context, osm_madw_t *p_madw)
 		cl_plock_release(pm->lock);
 	}
 
- Exit:
-	osm_mad_pool_put( pm->mad_pool, p_madw );
+      Exit:
+	osm_mad_pool_put(pm->mad_pool, p_madw);
 
 	__decrement_outstanding_queries(pm);
 
-	OSM_LOG_EXIT( pm->log );
+	OSM_LOG_EXIT(pm->log);
 }
 
 /**********************************************************************
@@ -212,11 +208,11 @@ osm_perfmgr_bind(osm_perfmgr_t * const pm, const ib_net64_t port_guid)
 	osm_bind_info_t bind_info;
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER( pm->log, osm_pm_bind );
+	OSM_LOG_ENTER(pm->log, osm_pm_bind);
 
-	if( pm->bind_handle != OSM_BIND_INVALID_HANDLE ) {
-		osm_log( pm->log, OSM_LOG_ERROR,
-		         "osm_pm_mad_ctrl_bind: ERR 4C03: Multiple binds not allowed\n" );
+	if (pm->bind_handle != OSM_BIND_INVALID_HANDLE) {
+		osm_log(pm->log, OSM_LOG_ERROR,
+			"osm_pm_mad_ctrl_bind: ERR 4C03: Multiple binds not allowed\n");
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -230,67 +226,60 @@ osm_perfmgr_bind(osm_perfmgr_t * const pm, const ib_net64_t port_guid)
 	bind_info.recv_q_size = OSM_PM_DEFAULT_QP1_RCV_SIZE;
 	bind_info.send_q_size = OSM_PM_DEFAULT_QP1_SEND_SIZE;
 
-	osm_log( pm->log, OSM_LOG_VERBOSE,
-	         "osm_pm_mad_bind: "
-	         "Binding to port GUID 0x%" PRIx64 "\n",
-	         cl_ntoh64( port_guid ) );
+	osm_log(pm->log, OSM_LOG_VERBOSE,
+		"osm_pm_mad_bind: "
+		"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,
+					  osm_perfmgr_mad_recv_callback,
+					  osm_perfmgr_mad_send_err_callback,
+					  pm);
 
-	if( pm->bind_handle == OSM_BIND_INVALID_HANDLE ) {
+	if (pm->bind_handle == OSM_BIND_INVALID_HANDLE) {
 		status = IB_ERROR;
-		osm_log( pm->log, OSM_LOG_ERROR,
-		         "osm_pm_mad_bind: ERR 4C04: Vendor specific bind failed (%s)\n",
-		         ib_get_err_str(status) );
+		osm_log(pm->log, OSM_LOG_ERROR,
+			"osm_pm_mad_bind: ERR 4C04: Vendor specific bind failed (%s)\n",
+			ib_get_err_str(status));
 		goto Exit;
 	}
 
-Exit:
-	OSM_LOG_EXIT( pm->log );
-	return( status );
+      Exit:
+	OSM_LOG_EXIT(pm->log);
+	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 osm_perfmgr_mad_unbind(osm_perfmgr_t * const pm)
 {
-	OSM_LOG_ENTER( pm->log, osm_sa_mad_ctrl_unbind );
-	if( pm->bind_handle == OSM_BIND_INVALID_HANDLE ) {
-		osm_log( pm->log, OSM_LOG_ERROR,
-		         "osm_pm_mad_unbind: ERR 4C05: No previous bind\n" );
+	OSM_LOG_ENTER(pm->log, osm_sa_mad_ctrl_unbind);
+	if (pm->bind_handle == OSM_BIND_INVALID_HANDLE) {
+		osm_log(pm->log, OSM_LOG_ERROR,
+			"osm_pm_mad_unbind: ERR 4C05: No previous bind\n");
 		goto Exit;
 	}
-	osm_vendor_unbind( pm->bind_handle );
-Exit:
-	OSM_LOG_EXIT( pm->log );
+	osm_vendor_unbind(pm->bind_handle);
+      Exit:
+	OSM_LOG_EXIT(pm->log);
 }
 
 /**********************************************************************
  * 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);
 
-        if (mon_node)
-        {
-                if (mon_node->redir_tbl_size)
-                {
-                        if (port < mon_node->redir_tbl_size)
-                        {
-                                if (mon_node->redir_port[port].redir_lid)
-				{
-					if (mon_node->redir_port[port].redir_qp)
-					{
-						qp = mon_node->redir_port[port].redir_qp;
+	if (mon_node) {
+		if (mon_node->redir_tbl_size) {
+			if (port < mon_node->redir_tbl_size) {
+				if (mon_node->redir_port[port].redir_lid) {
+					if (mon_node->redir_port[port].redir_qp) {
+						qp = mon_node->redir_port[port].
+						    redir_qp;
 					}
 				}
 			}
@@ -305,36 +294,31 @@ get_qp(__monitored_node_t *mon_node, uint8_t port)
  * 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)
+get_lid(osm_node_t * p_node, uint8_t port, __monitored_node_t * mon_node)
 {
 	ib_net16_t lid = 0;
 
-	if (mon_node)
-	{
-		if (mon_node->redir_tbl_size)
-		{
-			if (port < mon_node->redir_tbl_size)
-			{
+	if (mon_node) {
+		if (mon_node->redir_tbl_size) {
+			if (port < mon_node->redir_tbl_size) {
 				lid = mon_node->redir_port[port].redir_lid;
-				if (lid)
-				{
+				if (lid) {
 					return lid;
 				}
 			}
 		}
 	}
 
-	switch (p_node->node_info.node_type)
-	{
-		case IB_NODE_TYPE_CA:
-		case IB_NODE_TYPE_ROUTER:
-			  lid = osm_node_get_base_lid(p_node, port);
-			  break;
-		case IB_NODE_TYPE_SWITCH:
-			  lid = osm_node_get_base_lid(p_node, 0);
-			  break;
-		default:
-			  break;
+	switch (p_node->node_info.node_type) {
+	case IB_NODE_TYPE_CA:
+	case IB_NODE_TYPE_ROUTER:
+		lid = osm_node_get_base_lid(p_node, port);
+		break;
+	case IB_NODE_TYPE_SWITCH:
+		lid = osm_node_get_base_lid(p_node, 0);
+		break;
+	default:
+		break;
 	}
 	return (lid);
 }
@@ -343,18 +327,20 @@ get_lid(osm_node_t *p_node, uint8_t port, __monitored_node_t *mon_node)
  * 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,
+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)
+			osm_madw_context_t * const p_context)
 {
-	ib_api_status_t     status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 	ib_port_counters_t *port_counter = NULL;
-	ib_perfmgt_mad_t   *pm_mad = NULL;
-	osm_madw_t         *p_madw = NULL;
+	ib_perfmgt_mad_t *pm_mad = NULL;
+	osm_madw_t *p_madw = NULL;
 
 	OSM_LOG_ENTER(perfmgr->log, osm_perfmgr_send_pc_mad);
 
-	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);
 
@@ -367,26 +353,28 @@ osm_perfmgr_send_pc_mad(osm_perfmgr_t *perfmgr, ib_net16_t dest_lid,
 	pm_mad->header.method = mad_method;
 	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)));
+	pm_mad->header.trans_id =
+	    cl_hton64((uint64_t) cl_atomic_inc(&(perfmgr->trans_id)));
 	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;
 
 	p_madw->mad_addr.dest_lid = 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);
+	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 = cl_hton16(0xFFFF);
 	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;
 
-	if( p_context )
+	if (p_context)
 		p_madw->context = *p_context;
 
 	status = osm_vendor_send(perfmgr->bind_handle, p_madw, TRUE);
@@ -395,50 +383,51 @@ osm_perfmgr_send_pc_mad(osm_perfmgr_t *perfmgr, ib_net16_t dest_lid,
 		/* pause this thread if we have too many outstanding requests */
 		cl_atomic_inc(&(perfmgr->outstanding_queries));
 		if (perfmgr->outstanding_queries >
-				perfmgr->max_outstanding_queries) {
+		    perfmgr->max_outstanding_queries) {
 			perfmgr->sweep_state = PERFMGR_SWEEP_SUSPENDED;
-			cl_event_wait_on( &perfmgr->sig_query, EVENT_NO_TIMEOUT, TRUE );
+			cl_event_wait_on(&perfmgr->sig_query, EVENT_NO_TIMEOUT,
+					 TRUE);
 			perfmgr->sweep_state = PERFMGR_SWEEP_ACTIVE;
 		}
 	}
 
 	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 * const 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;
+	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;
+	uint32_t size;
 
-	OSM_LOG_ENTER( pm->log, __collect_guids );
+	OSM_LOG_ENTER(pm->log, __collect_guids);
 
 	if (cl_qmap_get(&(pm->monitored_map), node_guid)
-			== cl_qmap_end(&(pm->monitored_map))) {
+	    == 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 (!mon_node) {
 			osm_log(pm->log, OSM_LOG_ERROR,
-				"PerfMgr: __collect_guids ERR 4C06: malloc failed so not handling node GUID 0x%" PRIx64 "\n", node_guid);
+				"PerfMgr: __collect_guids ERR 4C06: malloc failed so not handling node GUID 0x%"
+				PRIx64 "\n", node_guid);
 			goto Exit;
 		}
 		memset(mon_node, 0, sizeof(*mon_node) + sizeof(redir_t) * size);
 		mon_node->guid = node_guid;
 		mon_node->redir_tbl_size = size + 1;
 		cl_qmap_insert(&(pm->monitored_map), node_guid,
-				(cl_map_item_t *)mon_node);
+			       (cl_map_item_t *) mon_node);
 	}
 
-Exit:
-	OSM_LOG_EXIT( pm->log );
+      Exit:
+	OSM_LOG_EXIT(pm->log);
 }
 
 /**********************************************************************
@@ -447,23 +436,25 @@ Exit:
 static void
 __osm_perfmgr_query_counters(cl_map_item_t * const 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_node_t         *node = NULL;
-	__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;
-
-	OSM_LOG_ENTER( pm->log, __osm_pm_query_counters );
+	ib_api_status_t status = IB_SUCCESS;
+	uint8_t port = 0, startport = 1;
+	osm_perfmgr_t *pm = (osm_perfmgr_t *) context;
+	osm_node_t *node = NULL;
+	__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;
+
+	OSM_LOG_ENTER(pm->log, __osm_pm_query_counters);
 
 	cl_plock_acquire(pm->lock);
 	node = osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
 	if (!node) {
 		osm_log(pm->log, OSM_LOG_ERROR,
-			"__osm_pm_query_counters: ERR 4C07: Node guid 0x%" PRIx64 " no longer exists so removing from PerfMgr monitoring\n",
+			"__osm_pm_query_counters: ERR 4C07: Node guid 0x%"
+			PRIx64
+			" no longer exists so removing from PerfMgr monitoring\n",
 			mon_node->guid);
 		__mark_for_removal(pm, mon_node);
 		goto Exit;
@@ -475,39 +466,36 @@ __osm_perfmgr_query_counters(cl_map_item_t * const p_map_item, void *context)
 	/* make sure we have a database object ready to store this information */
 	if (perfmgr_db_create_entry(pm->db, node_guid, num_ports + 1,
 				    node->print_desc) !=
-		PERFMGR_EVENT_DB_SUCCESS)
-	{
+	    PERFMGR_EVENT_DB_SUCCESS) {
 		osm_log(pm->log, OSM_LOG_ERROR,
-			"__osm_pm_query_counters: ERR 4C08: DB create entry failed for 0x%" PRIx64 " (%s) : %s\n",
-			node_guid, node->print_desc, strerror(errno));
+			"__osm_pm_query_counters: ERR 4C08: 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)
-	{
-		if (node->sw)
-		{
-			if (ib_switch_info_is_enhanced_port0(&node->sw->switch_info))
-			{
+	if (osm_node_get_type(node) == IB_NODE_TYPE_SWITCH) {
+		if (node->sw) {
+			if (ib_switch_info_is_enhanced_port0
+			    (&node->sw->switch_info)) {
 				startport = 0;
 			}
 		}
 	}
 
 	/* issue the query for each port */
-	for (port = startport; port < num_ports; port++)
-	{
+	for (port = startport; port < num_ports; port++) {
 		ib_net16_t lid;
 
 		if (!osm_physp_is_valid(osm_node_get_physp_ptr(node, port)))
 			continue;
 
 		lid = get_lid(node, port, mon_node);
-		if (lid == 0)
-		{
+		if (lid == 0) {
 			osm_log(pm->log, OSM_LOG_DEBUG,
-				"__osm_pm_query_counters: WARN: node 0x%" PRIx64 " port %d (%s): port out of range, skipping\n",
+				"__osm_pm_query_counters: WARN: node 0x%" PRIx64
+				" port %d (%s): port out of range, skipping\n",
 				cl_ntoh64(node->node_info.node_guid), port,
 				node->print_desc);
 			continue;
@@ -522,46 +510,47 @@ __osm_perfmgr_query_counters(cl_map_item_t * const p_map_item, void *context)
 		gettimeofday(&(mad_context.perfmgr_context.query_start), NULL);
 #endif
 		osm_log(pm->log, OSM_LOG_VERBOSE,
-				"__osm_pm_query_counters: Getting stats for node 0x%" PRIx64 " port %d (lid %X) (%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);
-		if (status != IB_SUCCESS)
-		{
-		      osm_log(pm->log, OSM_LOG_ERROR,
-				"__osm_pm_query_counters: ERR 4C09: Failed to issue port counter query for node 0x%" PRIx64 " port %d (%s)\n",
+			"__osm_pm_query_counters: Getting stats for node 0x%"
+			PRIx64 " port %d (lid %X) (%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);
+		if (status != IB_SUCCESS) {
+			osm_log(pm->log, OSM_LOG_ERROR,
+				"__osm_pm_query_counters: ERR 4C09: Failed to issue port counter query for node 0x%"
+				PRIx64 " port %d (%s)\n",
 				node->node_info.node_guid, port,
 				node->print_desc);
 		}
 	}
-Exit:
+      Exit:
 	cl_plock_release(pm->lock);
-	OSM_LOG_EXIT( pm->log );
+	OSM_LOG_EXIT(pm->log);
 }
 
 /**********************************************************************
  * Main PerfMgr Thread.
  * Loop continuously and query the performance counters.
  **********************************************************************/
-void
-__osm_perfmgr_sweeper(void *p_ptr)
+void __osm_perfmgr_sweeper(void *p_ptr)
 {
 	ib_api_status_t status;
-	osm_perfmgr_t *const pm = ( osm_perfmgr_t * ) p_ptr;
+	osm_perfmgr_t *const pm = (osm_perfmgr_t *) p_ptr;
 
-	OSM_LOG_ENTER( pm->log, __osm_pm_sweeper );
+	OSM_LOG_ENTER(pm->log, __osm_pm_sweeper);
 
-	if( pm->thread_state == OSM_THREAD_STATE_INIT )
+	if (pm->thread_state == OSM_THREAD_STATE_INIT)
 		pm->thread_state = OSM_THREAD_STATE_RUN;
 
 	__init_monitored_nodes(pm);
 
-	while( pm->thread_state == OSM_THREAD_STATE_RUN ) {
+	while (pm->thread_state == OSM_THREAD_STATE_RUN) {
 		/*  do the sweep only if in MASTER state
 		 *  AND we have been activated.
 		 *  FIXME put something in here to try and reduce the load on the system
 		 *  when it is not IDLE.
-		if (pm->sm->state_mgr.state != OSM_SM_STATE_IDLE)
+		 if (pm->sm->state_mgr.state != OSM_SM_STATE_IDLE)
 		 */
 		if (pm->subn->sm_state == IB_SMINFO_STATE_MASTER &&
 		    pm->state == PERFMGR_STATE_ENABLED) {
@@ -574,7 +563,8 @@ __osm_perfmgr_sweeper(void *p_ptr)
 			/* 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");
+			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);
@@ -600,32 +590,30 @@ __osm_perfmgr_sweeper(void *p_ptr)
 		pm->sweep_state = PERFMGR_SWEEP_SLEEP;
 
 		/* Wait for a forced sweep or period timeout. */
-		status = cl_event_wait_on( &pm->sig_sweep,
-					    pm->sweep_time_s * 1000000, TRUE );
+		status = cl_event_wait_on(&pm->sig_sweep,
+					  pm->sweep_time_s * 1000000, TRUE);
 	}
 
-	OSM_LOG_EXIT( pm->log );
+	OSM_LOG_EXIT(pm->log);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_perfmgr_shutdown(osm_perfmgr_t * const pm)
+void osm_perfmgr_shutdown(osm_perfmgr_t * const pm)
 {
-	OSM_LOG_ENTER( pm->log, osm_perfmgr_shutdown );
+	OSM_LOG_ENTER(pm->log, osm_perfmgr_shutdown);
 	osm_perfmgr_mad_unbind(pm);
-	OSM_LOG_EXIT( pm->log );
+	OSM_LOG_EXIT(pm->log);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_perfmgr_destroy(osm_perfmgr_t * const pm)
+void osm_perfmgr_destroy(osm_perfmgr_t * const pm)
 {
-	OSM_LOG_ENTER( pm->log, osm_perfmgr_destroy );
+	OSM_LOG_ENTER(pm->log, osm_perfmgr_destroy);
 	free(pm->event_db_dump_file);
 	perfmgr_db_destroy(pm->db);
-	OSM_LOG_EXIT( pm->log );
+	OSM_LOG_EXIT(pm->log);
 }
 
 /**********************************************************************
@@ -638,19 +626,18 @@ osm_perfmgr_destroy(osm_perfmgr_t * const pm)
  * will be missed.
  **********************************************************************/
 static void
-osm_perfmgr_check_oob_clear(osm_perfmgr_t *pm, uint64_t node_guid, uint8_t port,
-			    perfmgr_db_err_reading_t *cr,
-			    perfmgr_db_data_cnt_reading_t *dc)
+osm_perfmgr_check_oob_clear(osm_perfmgr_t * pm, uint64_t node_guid,
+			    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;
+	perfmgr_db_err_reading_t prev_err;
+	perfmgr_db_data_cnt_reading_t prev_dc;
 
 	if (perfmgr_db_get_prev_err(pm->db, node_guid, port, &prev_err)
-			!= PERFMGR_EVENT_DB_SUCCESS)
-	{
+	    != PERFMGR_EVENT_DB_SUCCESS) {
 		osm_log(pm->log, OSM_LOG_VERBOSE,
-			"osm_perfmgr_check_oob_clear: Failed to find previous error reading for 0x%" PRIx64 " port %u\n",
-			node_guid, port);
+			"osm_perfmgr_check_oob_clear: Failed to find previous error reading for 0x%"
+			PRIx64 " port %u\n", node_guid, port);
 		return;
 	}
 
@@ -665,34 +652,29 @@ osm_perfmgr_check_oob_clear(osm_perfmgr_t *pm, uint64_t node_guid, uint8_t port,
 	    cr->rcv_constraint_err < prev_err.rcv_constraint_err ||
 	    cr->link_integrity < prev_err.link_integrity ||
 	    cr->buffer_overrun < prev_err.buffer_overrun ||
-	    cr->vl15_dropped < prev_err.vl15_dropped)
-	{
+	    cr->vl15_dropped < prev_err.vl15_dropped) {
 		osm_log(pm->log, OSM_LOG_ERROR,
-			"PerfMgr: ERR 4C0A: Detected an out of band error clear on node 0x%" PRIx64 " port %u\n",
-			node_guid, port
-			);
+			"PerfMgr: ERR 4C0A: Detected an out of band error clear on node 0x%"
+			PRIx64 " port %u\n", node_guid, port);
 		perfmgr_db_clear_prev_err(pm->db, node_guid, port);
 	}
 
 	/* FIXME handle extended counters */
 	if (perfmgr_db_get_prev_dc(pm->db, node_guid, port, &prev_dc)
-			!= PERFMGR_EVENT_DB_SUCCESS)
-	{
+	    != PERFMGR_EVENT_DB_SUCCESS) {
 		osm_log(pm->log, OSM_LOG_VERBOSE,
-			"osm_perfmgr_check_oob_clear: Failed to find previous data count reading for 0x%" PRIx64 " port %u\n",
-			node_guid, port);
+			"osm_perfmgr_check_oob_clear: Failed to find previous data count reading for 0x%"
+			PRIx64 " port %u\n", node_guid, port);
 		return;
 	}
 
 	if (dc->xmit_data < prev_dc.xmit_data ||
 	    dc->rcv_data < prev_dc.rcv_data ||
 	    dc->xmit_pkts < prev_dc.xmit_pkts ||
-	    dc->rcv_pkts < prev_dc.rcv_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 clear on node 0x%" PRIx64 " port %u\n",
-			node_guid, port
-			);
+			"PerfMgr: ERR 4C0B: Detected an out of band data counter clear on node 0x%"
+			PRIx64 " port %u\n", node_guid, port);
 		perfmgr_db_clear_prev_dc(pm->db, node_guid, port);
 	}
 }
@@ -704,17 +686,20 @@ int counter_overflow_4(uint8_t val)
 {
 	return (val >= 10);
 }
+
 int counter_overflow_8(uint8_t val)
 {
-	return (val >= (UINT8_MAX - (UINT8_MAX/4)));
+	return (val >= (UINT8_MAX - (UINT8_MAX / 4)));
 }
+
 int counter_overflow_16(ib_net16_t val)
 {
-	return (cl_ntoh16(val) >= (UINT16_MAX - (UINT16_MAX/4)));
+	return (cl_ntoh16(val) >= (UINT16_MAX - (UINT16_MAX / 4)));
 }
+
 int counter_overflow_32(ib_net32_t val)
 {
-	return (cl_ntoh32(val) >= (UINT32_MAX - (UINT32_MAX/4)));
+	return (cl_ntoh32(val) >= (UINT32_MAX - (UINT32_MAX / 4)));
 }
 
 /**********************************************************************
@@ -722,14 +707,14 @@ int counter_overflow_32(ib_net32_t val)
  * MAD to the port.
  **********************************************************************/
 static void
-osm_perfmgr_check_overflow(osm_perfmgr_t *pm, uint64_t node_guid,
-			   uint8_t port, ib_port_counters_t *pc)
+osm_perfmgr_check_overflow(osm_perfmgr_t * pm, uint64_t node_guid,
+			   uint8_t port, ib_port_counters_t * pc)
 {
 	osm_madw_context_t mad_context;
 	ib_api_status_t status;
 	ib_net32_t remote_qp;
 
-	OSM_LOG_ENTER( pm->log, osm_perfmgr_check_overflow );
+	OSM_LOG_ENTER(pm->log, osm_perfmgr_check_overflow);
 
 	if (counter_overflow_16(pc->symbol_err_cnt) ||
 	    counter_overflow_8(pc->link_err_recover) ||
@@ -746,14 +731,13 @@ osm_perfmgr_check_overflow(osm_perfmgr_t *pm, uint64_t node_guid,
 	    counter_overflow_32(pc->xmit_data) ||
 	    counter_overflow_32(pc->rcv_data) ||
 	    counter_overflow_32(pc->xmit_pkts) ||
-	    counter_overflow_32(pc->rcv_pkts))
-	{
+	    counter_overflow_32(pc->rcv_pkts)) {
 		osm_node_t *p_node = NULL;
-		ib_net16_t  lid = 0;
+		ib_net16_t lid = 0;
 
 		osm_log(pm->log, OSM_LOG_INFO,
-			"PerfMgr: Counter overflow: 0x%" PRIx64 " port %d; clearing counters\n",
-			node_guid, port);
+			"PerfMgr: Counter overflow: 0x%" PRIx64
+			" port %d; clearing counters\n", node_guid, port);
 
 		cl_plock_acquire(pm->lock);
 		p_node = osm_get_node_by_guid(pm->subn, cl_hton64(node_guid));
@@ -761,10 +745,10 @@ osm_perfmgr_check_overflow(osm_perfmgr_t *pm, uint64_t node_guid,
 		/* potentially redoing redirection */
 		lid = get_lid(p_node, port, NULL);
 		cl_plock_release(pm->lock);
-		if (lid == 0)
-		{
+		if (lid == 0) {
 			osm_log(pm->log, OSM_LOG_ERROR,
-				"PerfMgr: ERR 4C0C: Failed to clear counters for node 0x%" PRIx64 " port %d; failed to get lid\n",
+				"PerfMgr: ERR 4C0C: Failed to clear counters for node 0x%"
+				PRIx64 " port %d; failed to get lid\n",
 				node_guid, port);
 			goto Exit;
 		}
@@ -775,37 +759,38 @@ osm_perfmgr_check_overflow(osm_perfmgr_t *pm, uint64_t node_guid,
 		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);
-		if (status != IB_SUCCESS)
-		{
+		status =
+		    osm_perfmgr_send_pc_mad(pm, lid, remote_qp, port,
+					    IB_MAD_METHOD_SET, &mad_context);
+		if (status != IB_SUCCESS) {
 			osm_log(pm->log, OSM_LOG_ERROR,
-				"PerfMgr: ERR 4C11: Failed to send clear counters MAD for node 0x%" PRIx64 " port %d\n",
-				node_guid, port);
+				"PerfMgr: ERR 4C11: Failed to send clear counters MAD for node 0x%"
+				PRIx64 " port %d\n", node_guid, port);
 		}
 
 		perfmgr_db_clear_prev_dc(pm->db, node_guid, port);
 	}
 
-Exit:
-	OSM_LOG_EXIT( pm->log );
+      Exit:
+	OSM_LOG_EXIT(pm->log);
 }
 
 /**********************************************************************
  * Check values for logging of errors
  **********************************************************************/
 static void
-osm_perfmgr_log_events(osm_perfmgr_t *pm, uint64_t node_guid, uint8_t port,
-			perfmgr_db_err_reading_t *reading)
+osm_perfmgr_log_events(osm_perfmgr_t * pm, uint64_t node_guid, 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, node_guid, port, &prev_read);
+	perfmgr_db_err_reading_t prev_read;
+	time_t time_diff = 0;
+	perfmgr_db_err_t err =
+	    perfmgr_db_get_prev_err(pm->db, node_guid, port, &prev_read);
 
-	if (err != PERFMGR_EVENT_DB_SUCCESS)
-	{
+	if (err != PERFMGR_EVENT_DB_SUCCESS) {
 		osm_log(pm->log, OSM_LOG_VERBOSE,
-			"osm_perfmgr_log_events: Failed to find previous reading for 0x%" PRIx64 " port %u\n",
-			node_guid, port);
+			"osm_perfmgr_log_events: Failed to find previous reading for 0x%"
+			PRIx64 " port %u\n", node_guid, port);
 		return;
 	}
 	time_diff = (reading->time - prev_read.time);
@@ -815,31 +800,28 @@ osm_perfmgr_log_events(osm_perfmgr_t *pm, uint64_t node_guid, uint8_t port,
 	if (reading->symbol_err_cnt > prev_read.symbol_err_cnt) {
 		osm_log(pm->log, OSM_LOG_ERROR,
 			"osm_perfmgr_log_events: ERR 4C0D: "
-			"Found %"PRIu64" Symbol errors in %lu sec on node 0x%" PRIx64 " port %u\n",
+			"Found %" PRIu64 " Symbol errors in %lu sec on node 0x%"
+			PRIx64 " port %u\n",
 			(reading->symbol_err_cnt - prev_read.symbol_err_cnt),
-			time_diff,
-			node_guid,
-			port);
+			time_diff, node_guid, port);
 	}
 
 	if (reading->rcv_err > prev_read.rcv_err) {
 		osm_log(pm->log, OSM_LOG_ERROR,
 			"osm_perfmgr_log_events: ERR 4C0E: "
-			"Found %"PRIu64" Receive errors in %lu sec on node 0x%" PRIx64 " port %u\n",
-			(reading->rcv_err - prev_read.rcv_err),
-			time_diff,
-			node_guid,
-			port);
+			"Found %" PRIu64
+			" Receive errors in %lu sec on node 0x%" PRIx64
+			" port %u\n", (reading->rcv_err - prev_read.rcv_err),
+			time_diff, node_guid, port);
 	}
 
 	if (reading->xmit_discards > prev_read.xmit_discards) {
 		osm_log(pm->log, OSM_LOG_ERROR,
 			"osm_perfmgr_log_events: ERR 4C0F: "
-			"Found %"PRIu64" Xmit Discards in %lu sec on node 0x%" PRIx64 " port %u\n",
+			"Found %" PRIu64 " Xmit Discards in %lu sec on node 0x%"
+			PRIx64 " port %u\n",
 			(reading->xmit_discards - prev_read.xmit_discards),
-			time_diff,
-			node_guid,
-			port);
+			time_diff, node_guid, port);
 	}
 }
 
@@ -847,35 +829,38 @@ osm_perfmgr_log_events(osm_perfmgr_t *pm, uint64_t node_guid, uint8_t port,
  * 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.
  **********************************************************************/
-static void
-osm_pc_rcv_process(void *context, void *data)
+static void osm_pc_rcv_process(void *context, void *data)
 {
-	osm_perfmgr_t      *const pm = (osm_perfmgr_t *)context;
-	osm_madw_t         *p_madw = (osm_madw_t *)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);
-	ib_port_counters_t *wire_read = (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;
+	ib_port_counters_t *wire_read =
+	    (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;
 
-	OSM_LOG_ENTER( pm->log, osm_pc_rcv_process );
+	OSM_LOG_ENTER(pm->log, osm_pc_rcv_process);
 
 	osm_log(pm->log, OSM_LOG_VERBOSE,
-		"osm_pc_rcv_process: Processing received MAD status 0x%x context 0x%" PRIx64 " port %u\n",
-		p_mad->status, node_guid, port);
+		"osm_pc_rcv_process: Processing received MAD status 0x%x context 0x%"
+		PRIx64 " port %u\n", p_mad->status, node_guid, port);
 
 	/* Response could also be redirection (IBM eHCA PMA does this) */
 	if (p_mad->attr_id == IB_MAD_ATTR_CLASS_PORT_INFO) {
 
-		ib_class_port_info_t *cpi = (ib_class_port_info_t *)&(osm_madw_get_perfmgt_mad_ptr(p_madw)->data);
+		ib_class_port_info_t *cpi =
+		    (ib_class_port_info_t *) &
+		    (osm_madw_get_perfmgt_mad_ptr(p_madw)->data);
 		cl_map_item_t *p_node;
 		__monitored_node_t *p_mon_node;
 		ib_api_status_t status;
 
 		osm_log(pm->log, OSM_LOG_VERBOSE,
-		        "osm_pc_rcv_process: Redirection to LID 0x%x "
+			"osm_pc_rcv_process: Redirection to LID 0x%x "
 			"GID 0x%016" PRIx64 " : 0x%016" PRIx64
 			" QP 0x%x received\n",
 			cl_ntoh16(cpi->redir_lid),
@@ -901,38 +886,43 @@ osm_pc_rcv_process(void *context, void *data)
 		    cl_qmap_end(&(pm->monitored_map))) {
 			cl_plock_release(pm->lock);
 			osm_log(pm->log, OSM_LOG_ERROR,
-				"osm_pc_rcv_process: ERR 4C12: GUID 0x%016" PRIx64
-				" not found in monitored map\n",
+				"osm_pc_rcv_process: ERR 4C12: 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;
 		/* Now, validate port number */
 		if (port > p_mon_node->redir_tbl_size) {
 			cl_plock_release(pm->lock);
 			osm_log(pm->log, OSM_LOG_ERROR,
-				"osm_pc_rcv_process: ERR 4C13: Invalid port num %d for GUID 0x%016" PRIx64
-				" num ports %d\n",
-				port, node_guid, p_mon_node->redir_tbl_size);
+				"osm_pc_rcv_process: ERR 4C13: Invalid port num %d for GUID 0x%016"
+				PRIx64 " num ports %d\n", port, node_guid,
+				p_mon_node->redir_tbl_size);
 			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);
 
- ReIssue:
+	      ReIssue:
 		/* 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);
-		if (status != IB_SUCCESS)
-		{
+		status =
+		    osm_perfmgr_send_pc_mad(pm, cpi->redir_lid, cpi->redir_qp,
+					    port,
+					    mad_context->perfmgr_context.
+					    mad_method, mad_context);
+		if (status != IB_SUCCESS) {
 			osm_log(pm->log, OSM_LOG_ERROR,
-				"osm_pc_rcv_process: ERR 4C14: Failed to send redirected MAD with method 0x%x for node 0x%" PRIx64 " port %d\n",
-				mad_context->perfmgr_context.mad_method, node_guid, port);
+				"osm_pc_rcv_process: ERR 4C14: Failed to send redirected MAD with method 0x%x for node 0x%"
+				PRIx64 " port %d\n",
+				mad_context->perfmgr_context.mad_method,
+				node_guid, port);
 		}
 		goto Exit;
 	}
 
-	CL_ASSERT( p_mad->attr_id == IB_MAD_ATTR_PORT_CNTRS );
+	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
@@ -949,8 +939,10 @@ osm_pc_rcv_process(void *context, void *data)
 	osm_perfmgr_log_events(pm, node_guid, port, &err_reading);
 
 	if (mad_context->perfmgr_context.mad_method == IB_MAD_METHOD_GET) {
-		perfmgr_db_add_err_reading(pm->db, node_guid, port, &err_reading);
-		perfmgr_db_add_dc_reading(pm->db, node_guid, port, &data_reading);
+		perfmgr_db_add_err_reading(pm->db, node_guid, port,
+					   &err_reading);
+		perfmgr_db_add_dc_reading(pm->db, node_guid, port,
+					  &data_reading);
 	} else {
 		perfmgr_db_clear_prev_err(pm->db, node_guid, port);
 		perfmgr_db_clear_prev_dc(pm->db, node_guid, port);
@@ -960,7 +952,7 @@ osm_pc_rcv_process(void *context, void *data)
 
 #if 0
 	do {
-		struct timeval      proc_time;
+		struct timeval proc_time;
 		gettimeofday(&proc_time, NULL);
 		osm_log(pm->log, OSM_LOG_INFO,
 			"PerfMgr done: processing time %ld\n",
@@ -969,36 +961,34 @@ osm_pc_rcv_process(void *context, void *data)
 	} while (0);
 #endif
 
- Exit:
-	osm_mad_pool_put( pm->mad_pool, p_madw );
+      Exit:
+	osm_mad_pool_put(pm->mad_pool, p_madw);
 
-	OSM_LOG_EXIT( pm->log );
+	OSM_LOG_EXIT(pm->log);
 }
 
 /**********************************************************************
  * Initialize the PerfMgr object
  **********************************************************************/
 ib_api_status_t
-osm_perfmgr_init(
-	osm_perfmgr_t * const pm,
-	osm_subn_t * const subn,
-	osm_sm_t * const sm,
-	osm_log_t * const log,
-	osm_mad_pool_t * const mad_pool,
-	osm_vendor_t * const vendor,
-	cl_dispatcher_t* const disp,
-	cl_plock_t* const lock,
-	const osm_subn_opt_t * const p_opt,
-	osm_epi_plugin_t     *event_plugin
-	)
+osm_perfmgr_init(osm_perfmgr_t * const pm,
+		 osm_subn_t * const subn,
+		 osm_sm_t * const sm,
+		 osm_log_t * const log,
+		 osm_mad_pool_t * const mad_pool,
+		 osm_vendor_t * const vendor,
+		 cl_dispatcher_t * const disp,
+		 cl_plock_t * const lock,
+		 const osm_subn_opt_t * const p_opt,
+		 osm_epi_plugin_t * event_plugin)
 {
-	ib_api_status_t    status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER( log, osm_pm_init );
+	OSM_LOG_ENTER(log, osm_pm_init);
 
 	osm_log(log, OSM_LOG_VERBOSE, "Initializing PerfMgr\n");
 
-	memset( pm, 0, sizeof( *pm ) );
+	memset(pm, 0, sizeof(*pm));
 
 	cl_event_construct(&pm->sig_sweep);
 	cl_event_init(&pm->sig_sweep, FALSE);
@@ -1009,60 +999,57 @@ osm_perfmgr_init(
 	pm->vendor = vendor;
 	pm->trans_id = OSM_PERFMGR_INITIAL_TID_VALUE;
 	pm->lock = lock;
-	pm->state = p_opt->perfmgr ? PERFMGR_STATE_ENABLED : PERFMGR_STATE_DISABLE;
+	pm->state =
+	    p_opt->perfmgr ? PERFMGR_STATE_ENABLED : PERFMGR_STATE_DISABLE;
 	pm->sweep_time_s = p_opt->perfmgr_sweep_time_s;
 	pm->event_db_dump_file = strdup(p_opt->event_db_dump_file);
 	pm->max_outstanding_queries = p_opt->perfmgr_max_outstanding_queries;
 	pm->event_plugin = event_plugin;
 
 	pm->db = perfmgr_db_construct(pm->log, pm->event_plugin);
-	if (!pm->db)
-	{
-	      pm->state = PERFMGR_STATE_NO_DB;
-	      goto Exit;
+	if (!pm->db) {
+		pm->state = PERFMGR_STATE_NO_DB;
+		goto Exit;
 	}
 
 	pm->pc_disp_h = cl_disp_register(disp, OSM_MSG_MAD_PORT_COUNTERS,
-	                                 osm_pc_rcv_process, pm);
-	if( pm->pc_disp_h == CL_DISP_INVALID_HANDLE )
+					 osm_pc_rcv_process, pm);
+	if (pm->pc_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	pm->thread_state = OSM_THREAD_STATE_INIT;
-	status = cl_thread_init( &pm->sweeper, __osm_perfmgr_sweeper, pm,
-				 "PerfMgr sweeper" );
-	if( status != IB_SUCCESS )
+	status = cl_thread_init(&pm->sweeper, __osm_perfmgr_sweeper, pm,
+				"PerfMgr sweeper");
+	if (status != IB_SUCCESS)
 		goto Exit;
 
-Exit:
-	OSM_LOG_EXIT( log );
-	return ( status );
+      Exit:
+	OSM_LOG_EXIT(log);
+	return (status);
 }
 
 /**********************************************************************
  * Clear the counters from the db
  **********************************************************************/
-void
-osm_perfmgr_clear_counters(osm_perfmgr_t *pm)
+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(pm->log, OSM_LOG_INFO, "PerfMgr counters cleared\n");
 }
 
 /*******************************************************************
  * Have the DB dump its information to the file specified
  *******************************************************************/
-void
-osm_perfmgr_dump_counters(osm_perfmgr_t *pm, perfmgr_db_dump_t dump_type)
+void osm_perfmgr_dump_counters(osm_perfmgr_t * pm, perfmgr_db_dump_t dump_type)
 {
-	if (perfmgr_db_dump(pm->db, pm->event_db_dump_file, dump_type) != 0)
-	{
-		osm_log( pm->log, OSM_LOG_ERROR,
+	if (perfmgr_db_dump(pm->db, pm->event_db_dump_file, dump_type) != 0) {
+		osm_log(pm->log, OSM_LOG_ERROR,
 			"PB dump port counters: ERR 4C10: Failed to dump file %s : %s",
 			pm->event_db_dump_file, strerror(errno));
 	}
 }
 
-#endif /* ENABLE_OSM_PERF_MGR */
+#endif				/* ENABLE_OSM_PERF_MGR */
diff --git a/opensm/opensm/osm_perfmgr_db.c b/opensm/opensm/osm_perfmgr_db.c
index 4c82673..25d32ff 100644
--- a/opensm/opensm/osm_perfmgr_db.c
+++ b/opensm/opensm/osm_perfmgr_db.c
@@ -31,10 +31,9 @@
  *
  */
 
-
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <errno.h>
@@ -46,9 +45,8 @@
 
 /** =========================================================================
  */
-perfmgr_db_t *
-perfmgr_db_construct(osm_log_t *p_log,
-		     osm_epi_plugin_t *event_plugin)
+perfmgr_db_t *perfmgr_db_construct(osm_log_t * p_log,
+				   osm_epi_plugin_t * event_plugin)
 {
 	perfmgr_db_t *db = malloc(sizeof(*db));
 	if (!db)
@@ -64,11 +62,9 @@ perfmgr_db_construct(osm_log_t *p_log,
 
 /** =========================================================================
  */
-void
-perfmgr_db_destroy(perfmgr_db_t *db)
+void perfmgr_db_destroy(perfmgr_db_t * db)
 {
-	if (db)
-	{
+	if (db) {
 		cl_plock_destroy(&(db->lock));
 		free(db);
 	}
@@ -77,19 +73,17 @@ 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);
+	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 ((_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);
@@ -100,11 +94,10 @@ bad_node_port(_db_node_t *node, uint8_t port)
 
 /** =========================================================================
  */
-static _db_node_t *
-__malloc_node(uint64_t guid, uint8_t num_ports, char *name)
+static _db_node_t *__malloc_node(uint64_t guid, uint8_t num_ports, char *name)
 {
-	int         i = 0;
-	time_t      cur_time = 0;
+	int i = 0;
+	time_t cur_time = 0;
 	_db_node_t *rc = malloc(sizeof(*rc));
 	if (!rc)
 		return (NULL);
@@ -125,15 +118,14 @@ __malloc_node(uint64_t guid, uint8_t num_ports, char *name)
 
 	return (rc);
 
-free_rc:
+      free_rc:
 	free(rc);
 	return (NULL);
 }
 
 /** =========================================================================
  */
-static void
-__free_node(_db_node_t *node)
+static void __free_node(_db_node_t * node)
 {
 	if (!node)
 		return;
@@ -143,10 +135,11 @@ __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 *)node);
+	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);
@@ -156,10 +149,10 @@ __insert(perfmgr_db_t *db, _db_node_t *node)
 /**********************************************************************
  **********************************************************************/
 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,
 			uint8_t num_ports, char *name)
 {
-	perfmgr_db_err_t   rc = PERFMGR_EVENT_DB_SUCCESS;
+	perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;
 
 	cl_plock_excl_acquire(&(db->lock));
 	if (!_get(db, guid)) {
@@ -174,7 +167,7 @@ perfmgr_db_create_entry(perfmgr_db_t *db, uint64_t guid,
 			goto Exit;
 		}
 	}
-Exit:
+      Exit:
 	cl_plock_release(&(db->lock));
 	return (rc);
 }
@@ -183,64 +176,77 @@ Exit:
  * 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)
+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)
 {
 	if (!osm_log_is_active(db->osm_log, OSM_LOG_DEBUG))
-		return; /* optimize this a bit */
+		return;		/* optimize this a bit */
 
 	osm_log(db->osm_log, OSM_LOG_DEBUG,
-			"GUID 0x%" PRIx64 " Port %u:\n", guid, port_num);
+		"GUID 0x%" PRIx64 " Port %u:\n", guid, port_num);
 	osm_log(db->osm_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);
+		"sym %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		cur->symbol_err_cnt, port->err_previous.symbol_err_cnt,
+		port->err_total.symbol_err_cnt);
 	osm_log(db->osm_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);
+		"ler %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		cur->link_err_recover, port->err_previous.link_err_recover,
+		port->err_total.link_err_recover);
 	osm_log(db->osm_log, OSM_LOG_DEBUG,
-			"ld %"PRIu64" <-- %"PRIu64" (%" PRIu64 ")\n", cur->link_downed,
-		port->err_previous.link_downed, port->err_total.link_downed);
+		"ld %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		cur->link_downed, port->err_previous.link_downed,
+		port->err_total.link_downed);
 	osm_log(db->osm_log, OSM_LOG_DEBUG,
-			"re %"PRIu64" <-- %"PRIu64" (%" PRIu64 ")\n", cur->rcv_err,
+		"re %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_err,
 		port->err_previous.rcv_err, port->err_total.rcv_err);
 	osm_log(db->osm_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);
+		"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(db->osm_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);
+		"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(db->osm_log, OSM_LOG_DEBUG,
-			"xd %"PRIu64" <-- %"PRIu64" (%" PRIu64 ")\n", cur->xmit_discards,
-		port->err_previous.xmit_discards, port->err_total.xmit_discards);
+		"xd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		cur->xmit_discards, port->err_previous.xmit_discards,
+		port->err_total.xmit_discards);
 	osm_log(db->osm_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);
+		"xce %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		cur->xmit_constraint_err,
+		port->err_previous.xmit_constraint_err,
+		port->err_total.xmit_constraint_err);
 	osm_log(db->osm_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);
+		"rce %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		cur->rcv_constraint_err, port->err_previous.rcv_constraint_err,
+		port->err_total.rcv_constraint_err);
 	osm_log(db->osm_log, OSM_LOG_DEBUG,
-			"li %"PRIu64" <-- %"PRIu64" (%" PRIu64 ")\n", cur->link_integrity,
-		port->err_previous.link_integrity, port->err_total.link_integrity);
+		"li %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		cur->link_integrity, port->err_previous.link_integrity,
+		port->err_total.link_integrity);
 	osm_log(db->osm_log, OSM_LOG_DEBUG,
-			"bo %"PRIu64" <-- %"PRIu64" (%" PRIu64 ")\n", cur->buffer_overrun,
-		port->err_previous.buffer_overrun, port->err_total.buffer_overrun);
+		"bo %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		cur->buffer_overrun, port->err_previous.buffer_overrun,
+		port->err_total.buffer_overrun);
 	osm_log(db->osm_log, OSM_LOG_DEBUG,
-			"vld %"PRIu64" <-- %"PRIu64" (%" PRIu64 ")\n", cur->vl15_dropped,
-		port->err_previous.vl15_dropped, port->err_total.vl15_dropped);
+		"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;
-	perfmgr_db_err_reading_t  *previous = NULL;
-	perfmgr_db_err_t           rc = PERFMGR_EVENT_DB_SUCCESS;
-	osm_epi_pe_event_t         epi_pe_data;
+	_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);
@@ -253,50 +259,64 @@ perfmgr_db_add_err_reading(perfmgr_db_t *db, uint64_t guid,
 	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, node->node_name);
+	osm_epi_create_port_id(&(epi_pe_data.port_id), guid, port,
+			       node->node_name);
 
 	/* calculate changes from previous reading */
-	epi_pe_data.symbol_err_cnt = (reading->symbol_err_cnt - previous->symbol_err_cnt);
-	p_port->err_total.symbol_err_cnt       += epi_pe_data.symbol_err_cnt;
-	epi_pe_data.link_err_recover = (reading->link_err_recover - previous->link_err_recover);
-	p_port->err_total.link_err_recover     += epi_pe_data.link_err_recover;
-	epi_pe_data.link_downed = (reading->link_downed - previous->link_downed);
-	p_port->err_total.link_downed          += epi_pe_data.link_downed;
+	epi_pe_data.symbol_err_cnt =
+	    (reading->symbol_err_cnt - previous->symbol_err_cnt);
+	p_port->err_total.symbol_err_cnt += epi_pe_data.symbol_err_cnt;
+	epi_pe_data.link_err_recover =
+	    (reading->link_err_recover - previous->link_err_recover);
+	p_port->err_total.link_err_recover += epi_pe_data.link_err_recover;
+	epi_pe_data.link_downed =
+	    (reading->link_downed - previous->link_downed);
+	p_port->err_total.link_downed += epi_pe_data.link_downed;
 	epi_pe_data.rcv_err = (reading->rcv_err - previous->rcv_err);
-	p_port->err_total.rcv_err              += epi_pe_data.rcv_err;
-	epi_pe_data.rcv_rem_phys_err = (reading->rcv_rem_phys_err - previous->rcv_rem_phys_err);
-	p_port->err_total.rcv_rem_phys_err     += epi_pe_data.rcv_rem_phys_err;
-	epi_pe_data.rcv_switch_relay_err = (reading->rcv_switch_relay_err - previous->rcv_switch_relay_err);
-	p_port->err_total.rcv_switch_relay_err += epi_pe_data.rcv_switch_relay_err;
-	epi_pe_data.xmit_discards = (reading->xmit_discards - previous->xmit_discards);
-	p_port->err_total.xmit_discards        += epi_pe_data.xmit_discards;
-	epi_pe_data.xmit_constraint_err = (reading->xmit_constraint_err - previous->xmit_constraint_err);
-	p_port->err_total.xmit_constraint_err  += epi_pe_data.xmit_constraint_err;
-	epi_pe_data.rcv_constraint_err = (reading->rcv_constraint_err - previous->rcv_constraint_err);
-	p_port->err_total.rcv_constraint_err   += epi_pe_data.rcv_constraint_err;
-	epi_pe_data.link_integrity = (reading->link_integrity - previous->link_integrity);
-	p_port->err_total.link_integrity       += epi_pe_data.link_integrity;
-	epi_pe_data.buffer_overrun = (reading->buffer_overrun - previous->buffer_overrun);
-	p_port->err_total.buffer_overrun       += epi_pe_data.buffer_overrun;
-	epi_pe_data.vl15_dropped = (reading->vl15_dropped - previous->vl15_dropped);
-	p_port->err_total.vl15_dropped         += epi_pe_data.vl15_dropped;
+	p_port->err_total.rcv_err += epi_pe_data.rcv_err;
+	epi_pe_data.rcv_rem_phys_err =
+	    (reading->rcv_rem_phys_err - previous->rcv_rem_phys_err);
+	p_port->err_total.rcv_rem_phys_err += epi_pe_data.rcv_rem_phys_err;
+	epi_pe_data.rcv_switch_relay_err =
+	    (reading->rcv_switch_relay_err - previous->rcv_switch_relay_err);
+	p_port->err_total.rcv_switch_relay_err +=
+	    epi_pe_data.rcv_switch_relay_err;
+	epi_pe_data.xmit_discards =
+	    (reading->xmit_discards - previous->xmit_discards);
+	p_port->err_total.xmit_discards += epi_pe_data.xmit_discards;
+	epi_pe_data.xmit_constraint_err =
+	    (reading->xmit_constraint_err - previous->xmit_constraint_err);
+	p_port->err_total.xmit_constraint_err +=
+	    epi_pe_data.xmit_constraint_err;
+	epi_pe_data.rcv_constraint_err =
+	    (reading->rcv_constraint_err - previous->rcv_constraint_err);
+	p_port->err_total.rcv_constraint_err += epi_pe_data.rcv_constraint_err;
+	epi_pe_data.link_integrity =
+	    (reading->link_integrity - previous->link_integrity);
+	p_port->err_total.link_integrity += epi_pe_data.link_integrity;
+	epi_pe_data.buffer_overrun =
+	    (reading->buffer_overrun - previous->buffer_overrun);
+	p_port->err_total.buffer_overrun += epi_pe_data.buffer_overrun;
+	epi_pe_data.vl15_dropped =
+	    (reading->vl15_dropped - previous->vl15_dropped);
+	p_port->err_total.vl15_dropped += epi_pe_data.vl15_dropped;
 
 	p_port->err_previous = *reading;
 
 	osm_epi_report(db->event_plugin, OSM_EVENT_ID_PORT_ERRORS,
-			(void *)&epi_pe_data);
+		       (void *)&epi_pe_data);
 
-Exit:
+      Exit:
 	cl_plock_release(&(db->lock));
 	return (rc);
 }
 
-perfmgr_db_err_t perfmgr_db_get_prev_err(perfmgr_db_t *db, uint64_t guid,
+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)
+					 perfmgr_db_err_reading_t * reading)
 {
-	_db_node_t         *node = NULL;
-	perfmgr_db_err_t    rc = PERFMGR_EVENT_DB_SUCCESS;
+	_db_node_t *node = NULL;
+	perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;
 
 	cl_plock_acquire(&(db->lock));
 
@@ -306,17 +326,17 @@ perfmgr_db_err_t perfmgr_db_get_prev_err(perfmgr_db_t *db, uint64_t guid,
 
 	*reading = node->ports[port].err_previous;
 
-Exit:
+      Exit:
 	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)
+perfmgr_db_clear_prev_err(perfmgr_db_t * db, uint64_t guid, uint8_t port)
 {
-	_db_node_t                     *node = NULL;
-	perfmgr_db_data_cnt_reading_t  *previous = NULL;
-	perfmgr_db_err_t                rc = PERFMGR_EVENT_DB_SUCCESS;
+	_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);
@@ -328,29 +348,31 @@ perfmgr_db_clear_prev_err(perfmgr_db_t *db, uint64_t guid, uint8_t port)
 	memset(previous, 0, sizeof(*previous));
 	node->ports[port].dc_previous.time = time(NULL);
 
-Exit:
+      Exit:
 	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)
+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)
 {
 	if (!osm_log_is_active(db->osm_log, OSM_LOG_DEBUG))
-		return; /* optimize this a big */
+		return;		/* optimize this a big */
 
 	osm_log(db->osm_log, OSM_LOG_DEBUG,
-			"xd %"PRIu64" <-- %"PRIu64" (%" PRIu64 ")\n", cur->xmit_data,
-		port->dc_previous.xmit_data, port->dc_total.xmit_data);
+		"xd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		cur->xmit_data, port->dc_previous.xmit_data,
+		port->dc_total.xmit_data);
 	osm_log(db->osm_log, OSM_LOG_DEBUG,
-			"rd %"PRIu64" <-- %"PRIu64" (%" PRIu64 ")\n", cur->rcv_data,
+		"rd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_data,
 		port->dc_previous.rcv_data, port->dc_total.rcv_data);
 	osm_log(db->osm_log, OSM_LOG_DEBUG,
-			"xp %"PRIu64" <-- %"PRIu64" (%" PRIu64 ")\n", cur->xmit_pkts,
-		port->dc_previous.xmit_pkts, port->dc_total.xmit_pkts);
+		"xp %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
+		cur->xmit_pkts, port->dc_previous.xmit_pkts,
+		port->dc_total.xmit_pkts);
 	osm_log(db->osm_log, OSM_LOG_DEBUG,
-			"rp %"PRIu64" <-- %"PRIu64" (%" PRIu64 ")\n", cur->rcv_pkts,
+		"rp %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_pkts,
 		port->dc_previous.rcv_pkts, port->dc_total.rcv_pkts);
 }
 
@@ -358,14 +380,14 @@ debug_dump_dc_reading(perfmgr_db_t *db, uint64_t guid, uint8_t port_num,
  * 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;
-	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;
+	_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);
@@ -378,42 +400,47 @@ perfmgr_db_add_dc_reading(perfmgr_db_t *db, uint64_t guid,
 	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, node->node_name);
+	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);
-	p_port->dc_total.xmit_data           += epi_dc_data.xmit_data;
+	p_port->dc_total.xmit_data += epi_dc_data.xmit_data;
 	epi_dc_data.rcv_data = (reading->rcv_data - previous->rcv_data);
-	p_port->dc_total.rcv_data            += epi_dc_data.rcv_data;
+	p_port->dc_total.rcv_data += epi_dc_data.rcv_data;
 	epi_dc_data.xmit_pkts = (reading->xmit_pkts - previous->xmit_pkts);
-	p_port->dc_total.xmit_pkts           += epi_dc_data.xmit_pkts;
+	p_port->dc_total.xmit_pkts += epi_dc_data.xmit_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);
-	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);
-	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);
+	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);
+	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);
+	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);
 	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);
-	p_port->dc_total.multicast_rcv_pkts  += epi_dc_data.multicast_rcv_pkts;
+	epi_dc_data.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;
 
 	osm_epi_report(db->event_plugin, OSM_EVENT_ID_PORT_DATA_COUNTERS,
-			(void *)&epi_dc_data);
+		       (void *)&epi_dc_data);
 
-Exit:
+      Exit:
 	cl_plock_release(&(db->lock));
 	return (rc);
 }
 
-perfmgr_db_err_t perfmgr_db_get_prev_dc(perfmgr_db_t *db, uint64_t guid,
+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)
+					perfmgr_db_data_cnt_reading_t * reading)
 {
-	_db_node_t         *node = NULL;
-	perfmgr_db_err_t    rc = PERFMGR_EVENT_DB_SUCCESS;
+	_db_node_t *node = NULL;
+	perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;
 
 	cl_plock_acquire(&(db->lock));
 
@@ -423,17 +450,17 @@ perfmgr_db_err_t perfmgr_db_get_prev_dc(perfmgr_db_t *db, uint64_t guid,
 
 	*reading = node->ports[port].dc_previous;
 
-Exit:
+      Exit:
 	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)
+perfmgr_db_clear_prev_dc(perfmgr_db_t * db, uint64_t guid, uint8_t port)
 {
-	_db_node_t                     *node = NULL;
-	perfmgr_db_data_cnt_reading_t  *previous = NULL;
-	perfmgr_db_err_t                rc = PERFMGR_EVENT_DB_SUCCESS;
+	_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);
@@ -445,17 +472,16 @@ perfmgr_db_clear_prev_dc(perfmgr_db_t *db, uint64_t guid, uint8_t port)
 	memset(previous, 0, sizeof(*previous));
 	node->ports[port].dc_previous.time = time(NULL);
 
-Exit:
+      Exit:
 	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;
-	int         i = 0;
-	time_t      ts = time(NULL);
+	_db_node_t *node = (_db_node_t *) p_map_item;
+	int i = 0;
+	time_t ts = time(NULL);
 
 	for (i = 0; i < node->num_ports; i++) {
 		node->ports[i].err_total.symbol_err_cnt = 0;
@@ -489,7 +515,7 @@ __clear_counters(cl_map_item_t * const p_map_item, void *context )
 /**********************************************************************
  * Clear all the counters from the db
  **********************************************************************/
-void perfmgr_db_clear_counters(perfmgr_db_t *db)
+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);
@@ -503,54 +529,46 @@ 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"
-			"%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"
-			"%s\t%s\t%s\t%s\n"
-			,
-			"symbol_err_cnt",
-			"link_err_recover",
-			"link_downed",
-			"rcv_err",
-			"rcv_rem_phys_err",
-			"rcv_switch_relay_err",
-			"xmit_discards",
-			"xmit_constraint_err",
-			"rcv_constraint_err",
-			"link_int_err",
-			"buf_overrun_err",
-			"vl15_dropped",
-			"xmit_data",
-			"rcv_data",
-			"xmit_pkts",
-			"rcv_pkts",
-			"unicast_xmit_pkts",
-			"unicast_rcv_pkts",
-			"multicast_xmit_pkts",
-			"multicast_rcv_pkts"
-			);
-	for (i = 1; i < node->num_ports; i++)
-	{
+		"%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"
+		"%s\t%s\t%s\t%s\n",
+		"symbol_err_cnt",
+		"link_err_recover",
+		"link_downed",
+		"rcv_err",
+		"rcv_rem_phys_err",
+		"rcv_switch_relay_err",
+		"xmit_discards",
+		"xmit_constraint_err",
+		"rcv_constraint_err",
+		"link_int_err",
+		"buf_overrun_err",
+		"vl15_dropped",
+		"xmit_data",
+		"rcv_data",
+		"xmit_pkts",
+		"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));
-		since[strlen(since)-1] = '\0'; /* remove \n */
-
-		fprintf(fp, "%s\t0x%" PRIx64 "\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,
+		since[strlen(since) - 1] = '\0';	/* remove \n */
+
+		fprintf(fp,
+			"%s\t0x%" PRIx64 "\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->ports[i].err_total.symbol_err_cnt,
 			node->ports[i].err_total.link_err_recover,
 			node->ports[i].err_total.link_downed,
@@ -563,7 +581,6 @@ __dump_node_mr(_db_node_t *node, FILE *fp)
 			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,
@@ -571,47 +588,43 @@ __dump_node_mr(_db_node_t *node, FILE *fp)
 			node->ports[i].dc_total.unicast_xmit_pkts,
 			node->ports[i].dc_total.unicast_rcv_pkts,
 			node->ports[i].dc_total.multicast_xmit_pkts,
-			node->ports[i].dc_total.multicast_rcv_pkts
-			);
+			node->ports[i].dc_total.multicast_rcv_pkts);
 	}
 }
 
 /**********************************************************************
  * 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)
 {
 	int i = 0;
 
 	fprintf(fp, "\n");
-	for (i = 1; i < node->num_ports; i++)
-	{
+	for (i = 1; i < node->num_ports; i++) {
 		char *since = ctime(&(node->ports[i].last_reset));
-		since[strlen(since)-1] = '\0'; /* remove \n */
-
-		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"
-			,
+		since[strlen(since) - 1] = '\0';	/* remove \n */
+
+		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,
@@ -628,7 +641,6 @@ __dump_node_hr(_db_node_t *node, FILE *fp)
 			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,
@@ -636,35 +648,32 @@ __dump_node_hr(_db_node_t *node, FILE *fp)
 			node->ports[i].dc_total.unicast_xmit_pkts,
 			node->ports[i].dc_total.unicast_rcv_pkts,
 			node->ports[i].dc_total.multicast_xmit_pkts,
-			node->ports[i].dc_total.multicast_rcv_pkts
-			);
+			node->ports[i].dc_total.multicast_rcv_pkts);
 	}
 }
 
 /* Define a context for the __db_dump callback */
 typedef struct {
-	FILE                *fp;
-	perfmgr_db_dump_t   dump_type;
+	FILE *fp;
+	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;
-	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);
-			break;
-		case PERFMGR_EVENT_DB_DUMP_HR:
-		default:
-			__dump_node_hr(node, fp);
-			break;
+	_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);
+		break;
+	case PERFMGR_EVENT_DB_DUMP_HR:
+	default:
+		__dump_node_hr(node, fp);
+		break;
 	}
 }
 
@@ -672,9 +681,9 @@ __db_dump(cl_map_item_t * const p_map_item, void *context )
  * dump the data to the file "file"
  **********************************************************************/
 perfmgr_db_err_t
-perfmgr_db_dump(perfmgr_db_t *db, char *file, perfmgr_db_dump_t dump_type)
+perfmgr_db_dump(perfmgr_db_t * db, char *file, perfmgr_db_dump_t dump_type)
 {
-	dump_context_t  context;
+	dump_context_t context;
 
 	context.fp = fopen(file, "w+");
 	if (!context.fp)
@@ -692,27 +701,31 @@ perfmgr_db_dump(perfmgr_db_t *db, char *file, perfmgr_db_dump_t dump_type)
  * Fill in the various DB objects from their wire counter parts
  **********************************************************************/
 void
-perfmgr_db_fill_err_read(ib_port_counters_t *wire_read,
-			 perfmgr_db_err_reading_t *reading)
+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_downed = wire_read->link_downed;
 	reading->rcv_err = 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->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 =
+	    cl_ntoh16(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);
-	reading->buffer_overrun = PC_BUF_OVERRUN(wire_read->link_int_buffer_overrun);
+	reading->link_integrity =
+	    PC_LINK_INT(wire_read->link_int_buffer_overrun);
+	reading->buffer_overrun =
+	    PC_BUF_OVERRUN(wire_read->link_int_buffer_overrun);
 	reading->vl15_dropped = cl_ntoh16(wire_read->vl15_dropped);
 	reading->time = time(NULL);
 }
 
 void
-perfmgr_db_fill_data_cnt_read_pc(ib_port_counters_t *wire_read,
-				 perfmgr_db_data_cnt_reading_t *reading)
+perfmgr_db_fill_data_cnt_read_pc(ib_port_counters_t * wire_read,
+				 perfmgr_db_data_cnt_reading_t * reading)
 {
 	reading->xmit_data = cl_ntoh32(wire_read->xmit_data);
 	reading->rcv_data = cl_ntoh32(wire_read->rcv_data);
@@ -726,8 +739,8 @@ perfmgr_db_fill_data_cnt_read_pc(ib_port_counters_t *wire_read,
 }
 
 void
-perfmgr_db_fill_data_cnt_read_epc(ib_port_counters_ext_t *wire_read,
-				  perfmgr_db_data_cnt_reading_t *reading)
+perfmgr_db_fill_data_cnt_read_epc(ib_port_counters_ext_t * wire_read,
+				  perfmgr_db_data_cnt_reading_t * reading)
 {
 	reading->xmit_data = cl_ntoh64(wire_read->xmit_data);
 	reading->rcv_data = cl_ntoh64(wire_read->rcv_data);
@@ -735,7 +748,8 @@ perfmgr_db_fill_data_cnt_read_epc(ib_port_counters_ext_t *wire_read,
 	reading->rcv_pkts = cl_ntoh64(wire_read->rcv_pkts);
 	reading->unicast_xmit_pkts = cl_ntoh64(wire_read->unicast_xmit_pkts);
 	reading->unicast_rcv_pkts = cl_ntoh64(wire_read->unicast_rcv_pkts);
-	reading->multicast_xmit_pkts = cl_ntoh64(wire_read->multicast_xmit_pkts);
+	reading->multicast_xmit_pkts =
+	    cl_ntoh64(wire_read->multicast_xmit_pkts);
 	reading->multicast_rcv_pkts = cl_ntoh64(wire_read->multicast_rcv_pkts);
 	reading->time = time(NULL);
 }
diff --git a/opensm/opensm/osm_pkey.c b/opensm/opensm/osm_pkey.c
index 2397fbe..04d009b 100644
--- a/opensm/opensm/osm_pkey.c
+++ b/opensm/opensm/osm_pkey.c
@@ -45,7 +45,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -61,150 +61,142 @@
 
 /**********************************************************************
  **********************************************************************/
-void osm_pkey_tbl_construct(
-  IN osm_pkey_tbl_t *p_pkey_tbl)
+void osm_pkey_tbl_construct(IN osm_pkey_tbl_t * p_pkey_tbl)
 {
-  cl_ptr_vector_construct( &p_pkey_tbl->blocks );
-  cl_ptr_vector_construct( &p_pkey_tbl->new_blocks );
-  cl_map_construct( &p_pkey_tbl->keys );
+	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)
+void osm_pkey_tbl_destroy(IN osm_pkey_tbl_t * p_pkey_tbl)
 {
-  ib_pkey_table_t *p_block;
-  uint16_t num_blocks, i;
-
-  num_blocks = (uint16_t)(cl_ptr_vector_get_size( &p_pkey_tbl->blocks ));
-  for (i = 0; i < num_blocks; i++)
-    if ((p_block = cl_ptr_vector_get( &p_pkey_tbl->blocks, i )))
-      free(p_block);
-  cl_ptr_vector_destroy( &p_pkey_tbl->blocks );
-
-  num_blocks = (uint16_t)(cl_ptr_vector_get_size( &p_pkey_tbl->new_blocks ));
-  for (i = 0; i < num_blocks; i++)
-    if ((p_block = cl_ptr_vector_get( &p_pkey_tbl->new_blocks, i )))
-      free(p_block);
-  cl_ptr_vector_destroy( &p_pkey_tbl->new_blocks );
-
-  cl_map_remove_all( &p_pkey_tbl->keys );
-  cl_map_destroy( &p_pkey_tbl->keys );
+	ib_pkey_table_t *p_block;
+	uint16_t num_blocks, i;
+
+	num_blocks = (uint16_t) (cl_ptr_vector_get_size(&p_pkey_tbl->blocks));
+	for (i = 0; i < num_blocks; i++)
+		if ((p_block = cl_ptr_vector_get(&p_pkey_tbl->blocks, i)))
+			free(p_block);
+	cl_ptr_vector_destroy(&p_pkey_tbl->blocks);
+
+	num_blocks =
+	    (uint16_t) (cl_ptr_vector_get_size(&p_pkey_tbl->new_blocks));
+	for (i = 0; i < num_blocks; i++)
+		if ((p_block = cl_ptr_vector_get(&p_pkey_tbl->new_blocks, i)))
+			free(p_block);
+	cl_ptr_vector_destroy(&p_pkey_tbl->new_blocks);
+
+	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)
+ib_api_status_t osm_pkey_tbl_init(IN osm_pkey_tbl_t * p_pkey_tbl)
 {
-  cl_ptr_vector_init(&p_pkey_tbl->blocks, 0, 1);
-  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->used_blocks = 0;
-  p_pkey_tbl->max_blocks = 0;
-  return(IB_SUCCESS);
+	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->used_blocks = 0;
+	p_pkey_tbl->max_blocks = 0;
+	return (IB_SUCCESS);
 }
 
 /**********************************************************************
  **********************************************************************/
-void osm_pkey_tbl_init_new_blocks(
-  IN const osm_pkey_tbl_t *p_pkey_tbl)
+void osm_pkey_tbl_init_new_blocks(IN const osm_pkey_tbl_t * p_pkey_tbl)
 {
-  ib_pkey_table_t *p_block;
-  size_t b, num_blocks = cl_ptr_vector_get_size(&p_pkey_tbl->new_blocks);
+	ib_pkey_table_t *p_block;
+	size_t b, num_blocks = cl_ptr_vector_get_size(&p_pkey_tbl->new_blocks);
 
-  for (b = 0; b < num_blocks; b++)
-    if ((p_block = cl_ptr_vector_get(&p_pkey_tbl->new_blocks, b)))
-      memset(p_block, 0, sizeof(*p_block));
+	for (b = 0; b < num_blocks; b++)
+		if ((p_block = cl_ptr_vector_get(&p_pkey_tbl->new_blocks, b)))
+			memset(p_block, 0, sizeof(*p_block));
 }
 
 /**********************************************************************
  **********************************************************************/
-void osm_pkey_tbl_cleanup_pending(
-  IN osm_pkey_tbl_t *p_pkey_tbl)
+void osm_pkey_tbl_cleanup_pending(IN osm_pkey_tbl_t * p_pkey_tbl)
 {
-  cl_list_item_t    *p_item;
+	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);
-  }
+	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)
+osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl,
+		 IN uint16_t block, IN ib_pkey_table_t * p_tbl)
 {
-  uint16_t b, i;
-  ib_pkey_table_t *p_pkey_block;
-  uint16_t        *p_prev_pkey;
-  ib_net16_t       pkey;
-
-  /* make sure the block is allocated */
-  if (cl_ptr_vector_get_size( &p_pkey_tbl->blocks ) > block)
-    p_pkey_block =
-      (ib_pkey_table_t *)cl_ptr_vector_get( &p_pkey_tbl->blocks, block );
-  else
-    p_pkey_block = NULL;
-
-  if ( !p_pkey_block )
-  {
-    p_pkey_block = (ib_pkey_table_t *)malloc(sizeof(ib_pkey_table_t));
-    if (p_pkey_block)
-      memset(p_pkey_block, 0, sizeof(ib_pkey_table_t));
-    cl_ptr_vector_set( &p_pkey_tbl->blocks, block, p_pkey_block );
-  }
-
-  /* sets the block values */
-  memcpy( p_pkey_block, p_tbl, sizeof(ib_pkey_table_t) );
-
-  /*
-    NOTE: as the spec does not require uniqueness of PKeys in
-    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 !
-  */
-  cl_map_remove_all( &p_pkey_tbl->keys );
-
-  for (b = 0; b < cl_ptr_vector_get_size( &p_pkey_tbl->blocks ); b++)
-  {
-
-    p_pkey_block = cl_ptr_vector_get( &p_pkey_tbl->blocks, b );
-    if (! p_pkey_block)
-      continue;
-
-    for (i = 0; i < IB_NUM_PKEY_ELEMENTS_IN_BLOCK; i++)
-    {
-      pkey = p_pkey_block->pkey_entry[i];
-      if (ib_pkey_is_invalid(pkey))
-        continue;
-
-      /*
-         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));
-
-      /* we only insert if no previous or it is not full member */
-      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),
-                       &(p_pkey_block->pkey_entry[i])
-                       );
-    }
-  }
-  return(IB_SUCCESS);
+	uint16_t b, i;
+	ib_pkey_table_t *p_pkey_block;
+	uint16_t *p_prev_pkey;
+	ib_net16_t pkey;
+
+	/* make sure the block is allocated */
+	if (cl_ptr_vector_get_size(&p_pkey_tbl->blocks) > block)
+		p_pkey_block =
+		    (ib_pkey_table_t *) cl_ptr_vector_get(&p_pkey_tbl->blocks,
+							  block);
+	else
+		p_pkey_block = NULL;
+
+	if (!p_pkey_block) {
+		p_pkey_block =
+		    (ib_pkey_table_t *) malloc(sizeof(ib_pkey_table_t));
+		if (p_pkey_block)
+			memset(p_pkey_block, 0, sizeof(ib_pkey_table_t));
+		cl_ptr_vector_set(&p_pkey_tbl->blocks, block, p_pkey_block);
+	}
+
+	/* sets the block values */
+	memcpy(p_pkey_block, p_tbl, sizeof(ib_pkey_table_t));
+
+	/*
+	   NOTE: as the spec does not require uniqueness of PKeys in
+	   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 !
+	 */
+	cl_map_remove_all(&p_pkey_tbl->keys);
+
+	for (b = 0; b < cl_ptr_vector_get_size(&p_pkey_tbl->blocks); b++) {
+
+		p_pkey_block = cl_ptr_vector_get(&p_pkey_tbl->blocks, b);
+		if (!p_pkey_block)
+			continue;
+
+		for (i = 0; i < IB_NUM_PKEY_ELEMENTS_IN_BLOCK; i++) {
+			pkey = p_pkey_block->pkey_entry[i];
+			if (ib_pkey_is_invalid(pkey))
+				continue;
+
+			/*
+			   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));
+
+			/* we only insert if no previous or it is not full member */
+			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),
+					      &(p_pkey_block->pkey_entry[i])
+				    );
+		}
+	}
+	return (IB_SUCCESS);
 }
 
 /**********************************************************************
@@ -214,333 +206,308 @@ osm_pkey_tbl_set(
   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)
+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;
+	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);
-    memset(p_block, 0, sizeof(ib_pkey_table_t));
-    cl_ptr_vector_set(&p_pkey_tbl->new_blocks, block_idx, 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);
+		memset(p_block, 0, sizeof(ib_pkey_table_t));
+		cl_ptr_vector_set(&p_pkey_tbl->new_blocks, block_idx, p_block);
+	}
 
-  p_block->pkey_entry[pkey_idx] = pkey;
-  if (p_pkey_tbl->used_blocks <= block_idx)
-    p_pkey_tbl->used_blocks = block_idx + 1;
+	p_block->pkey_entry[pkey_idx] = pkey;
+	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)
+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;
-
-  CL_ASSERT(p_block_idx);
-  CL_ASSERT(p_pkey_idx);
-
-  while (*p_block_idx < p_pkey_tbl->max_blocks)
-  {
-    if (*p_pkey_idx > IB_NUM_PKEY_ELEMENTS_IN_BLOCK - 1)
-    {
-	*p_pkey_idx = 0;
-	(*p_block_idx)++;
-	if (*p_block_idx >= p_pkey_tbl->max_blocks)
-	  return FALSE;
-    }
-
-    p_new_block = osm_pkey_tbl_new_block_get(p_pkey_tbl, *p_block_idx);
-
-    if (!p_new_block ||
-	ib_pkey_is_invalid(p_new_block->pkey_entry[*p_pkey_idx]))
-      return TRUE;
-    else
-      (*p_pkey_idx)++;
-  }
-  return FALSE;
+	ib_pkey_table_t *p_new_block;
+
+	CL_ASSERT(p_block_idx);
+	CL_ASSERT(p_pkey_idx);
+
+	while (*p_block_idx < p_pkey_tbl->max_blocks) {
+		if (*p_pkey_idx > IB_NUM_PKEY_ELEMENTS_IN_BLOCK - 1) {
+			*p_pkey_idx = 0;
+			(*p_block_idx)++;
+			if (*p_block_idx >= p_pkey_tbl->max_blocks)
+				return FALSE;
+		}
+
+		p_new_block =
+		    osm_pkey_tbl_new_block_get(p_pkey_tbl, *p_block_idx);
+
+		if (!p_new_block ||
+		    ib_pkey_is_invalid(p_new_block->pkey_entry[*p_pkey_idx]))
+			return TRUE;
+		else
+			(*p_pkey_idx)++;
+	}
+	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)
+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;
-  ib_pkey_table_t *block;
-
-  CL_ASSERT( p_block_idx != NULL );
-  CL_ASSERT( p_pkey_idx != NULL );
-
-  num_of_blocks = (uint16_t)cl_ptr_vector_get_size( &p_pkey_tbl->blocks );
-  for (block_index = 0; block_index < num_of_blocks; block_index++)
-  {
-    block = osm_pkey_tbl_block_get(p_pkey_tbl, block_index);
-    if ((block->pkey_entry <= p_pkey) &&
-	(p_pkey < 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_NOT_FOUND);
+	uint16_t num_of_blocks;
+	uint16_t block_index;
+	ib_pkey_table_t *block;
+
+	CL_ASSERT(p_block_idx != NULL);
+	CL_ASSERT(p_pkey_idx != NULL);
+
+	num_of_blocks = (uint16_t) cl_ptr_vector_get_size(&p_pkey_tbl->blocks);
+	for (block_index = 0; block_index < num_of_blocks; block_index++) {
+		block = osm_pkey_tbl_block_get(p_pkey_tbl, block_index);
+		if ((block->pkey_entry <= p_pkey) &&
+		    (p_pkey <
+		     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_NOT_FOUND);
 }
 
 /**********************************************************************
  **********************************************************************/
 static boolean_t
-__osm_match_pkey (
-  IN const ib_net16_t *pkey1,
-  IN const ib_net16_t *pkey2 )
+__osm_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);
+	/* 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);
 
-  /* 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);
+	/* 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(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 )
+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)
 {
-  ib_net16_t *pkey1, *pkey2;
+	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));
+	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
-osm_physp_find_common_pkey(
-  IN const osm_physp_t*  const p_physp1,
-  IN const osm_physp_t*  const p_physp2 )
+osm_physp_find_common_pkey(IN const osm_physp_t * const p_physp1,
+			   IN const osm_physp_t * const p_physp2)
 {
-  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;
-
-  pkey_tbl1 = osm_physp_get_pkey_tbl(p_physp1);
-  pkey_tbl2 = osm_physp_get_pkey_tbl(p_physp2);
-
-  map_iter1 = cl_map_head(&pkey_tbl1->keys);
-  map_iter2 = cl_map_head(&pkey_tbl2->keys);
-
-  /* we rely on the fact the map are sorted by pkey */
-  while ( (map_iter1 != cl_map_end( &pkey_tbl1->keys )) &&
-          (map_iter2 != cl_map_end( &pkey_tbl2->keys )))
-  {
-    pkey1 = (ib_net16_t *)cl_map_obj( map_iter1 );
-    pkey2 = (ib_net16_t *)cl_map_obj( map_iter2 );
-
-    if (__osm_match_pkey(pkey1, pkey2))
-      return *pkey1;
-
-    /* advance the lower value if they are not equal */
-    pkey1_base = cl_map_key( map_iter1 );
-    pkey2_base = cl_map_key( map_iter2 );
-    if (pkey2_base == pkey1_base)
-    {
-      map_iter1 = cl_map_next( map_iter1 );
-      map_iter2 = cl_map_next( map_iter2 );
-    }
-    else if (pkey2_base < pkey1_base)
-      map_iter2 = cl_map_next( map_iter2 );
-    else
-      map_iter1 = cl_map_next( map_iter1 );
-  }
-
-  return 0;
+	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;
+
+	pkey_tbl1 = osm_physp_get_pkey_tbl(p_physp1);
+	pkey_tbl2 = osm_physp_get_pkey_tbl(p_physp2);
+
+	map_iter1 = cl_map_head(&pkey_tbl1->keys);
+	map_iter2 = cl_map_head(&pkey_tbl2->keys);
+
+	/* we rely on the fact the map are sorted by pkey */
+	while ((map_iter1 != cl_map_end(&pkey_tbl1->keys)) &&
+	       (map_iter2 != cl_map_end(&pkey_tbl2->keys))) {
+		pkey1 = (ib_net16_t *) cl_map_obj(map_iter1);
+		pkey2 = (ib_net16_t *) cl_map_obj(map_iter2);
+
+		if (__osm_match_pkey(pkey1, pkey2))
+			return *pkey1;
+
+		/* advance the lower value if they are not equal */
+		pkey1_base = cl_map_key(map_iter1);
+		pkey2_base = cl_map_key(map_iter2);
+		if (pkey2_base == pkey1_base) {
+			map_iter1 = cl_map_next(map_iter1);
+			map_iter2 = cl_map_next(map_iter2);
+		} else if (pkey2_base < pkey1_base)
+			map_iter2 = cl_map_next(map_iter2);
+		else
+			map_iter1 = cl_map_next(map_iter1);
+	}
+
+	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 )
+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)
 {
-  const osm_pkey_tbl_t *pkey_tbl1, *pkey_tbl2;
+	const osm_pkey_tbl_t *pkey_tbl1, *pkey_tbl2;
 
-  if (p_physp_1 == p_physp_2)
-    return TRUE;
+	if (p_physp_1 == p_physp_2)
+		return TRUE;
 
-  pkey_tbl1 = osm_physp_get_pkey_tbl(p_physp_1);
-  pkey_tbl2 = osm_physp_get_pkey_tbl(p_physp_2);
+	pkey_tbl1 = osm_physp_get_pkey_tbl(p_physp_1);
+	pkey_tbl2 = osm_physp_get_pkey_tbl(p_physp_2);
 
-  /*
-     The spec: 10.9.2 does not require each phys port to have PKey Table.
-     So actually if it does not, we need to use the default port instead.
+	/*
+	   The spec: 10.9.2 does not require each phys port to have PKey Table.
+	   So actually if it does not, we need to use the default port instead.
 
-     HACK: meanwhile we will ignore the check
-  */
-  if (cl_is_map_empty(&pkey_tbl1->keys) || cl_is_map_empty(&pkey_tbl2->keys))
-    return TRUE;
+	   HACK: meanwhile we will ignore the check
+	 */
+	if (cl_is_map_empty(&pkey_tbl1->keys)
+	    || cl_is_map_empty(&pkey_tbl2->keys))
+		return TRUE;
 
-  return !ib_pkey_is_invalid(osm_physp_find_common_pkey(p_physp_1, p_physp_2));
+	return
+	    !ib_pkey_is_invalid(osm_physp_find_common_pkey
+				(p_physp_1, p_physp_2));
 }
 
 /**********************************************************************
  **********************************************************************/
 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 ) {
+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)
+{
 
-  osm_physp_t *p_physp1, *p_physp2;
-  boolean_t ret;
+	osm_physp_t *p_physp1, *p_physp2;
+	boolean_t ret;
 
-  OSM_LOG_ENTER( p_log, osm_port_share_pkey );
+	OSM_LOG_ENTER(p_log, osm_port_share_pkey);
 
-  if (!p_port_1 || !p_port_2)
-  {
-    ret = FALSE;
-    goto Exit;
-  }
+	if (!p_port_1 || !p_port_2) {
+		ret = FALSE;
+		goto Exit;
+	}
 
-  p_physp1 = p_port_1->p_physp;
-  p_physp2 = p_port_2->p_physp;
+	p_physp1 = p_port_1->p_physp;
+	p_physp2 = p_port_2->p_physp;
 
-  if (!p_physp1 || !p_physp2)
-  {
-    ret = FALSE;
-    goto Exit;
-  }
+	if (!p_physp1 || !p_physp2) {
+		ret = FALSE;
+		goto Exit;
+	}
 
-  ret = osm_physp_share_pkey(p_log, p_physp1, p_physp2);
+	ret = osm_physp_share_pkey(p_log, p_physp1, p_physp2);
 
-Exit:
-  OSM_LOG_EXIT(p_log);
-  return ret;
+      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, osm_lid_share_pkey );
-
-  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));
+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, osm_lid_share_pkey);
+
+	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 ) {
-
-  ib_net16_t *p_pkey, pkey_base;
-  const osm_pkey_tbl_t *pkey_tbl;
-  boolean_t res = FALSE;
-
-  OSM_LOG_ENTER( p_log, osm_physp_has_pkey );
-
-  osm_log( p_log, OSM_LOG_DEBUG,
-           "osm_physp_has_pkey: "
-           "Search for PKey: 0x%4x\n",
-           cl_ntoh16(pkey) );
-
-  /* if the pkey given is an invalid pkey - return TRUE. */
-  if(ib_pkey_is_invalid(pkey))
-  {
-    osm_log( p_log, OSM_LOG_DEBUG,
-             "osm_physp_has_pkey: "
-             "Given invalid PKey - we treat it loosely and allow it\n");
-    res = TRUE;
-    goto Exit;
-  }
-
-  pkey_base = ib_pkey_get_base(pkey);
-
-  pkey_tbl = osm_physp_get_pkey_tbl(p_physp);
-
-  p_pkey = cl_map_get( &pkey_tbl->keys, pkey_base );
-  if (p_pkey)
-  {
-    res = TRUE;
-    osm_log( p_log, OSM_LOG_DEBUG,
-             "osm_physp_has_pkey: "
-             "PKey 0x%04x was found\n", cl_ntoh16(pkey));
-  }
-  else
-  {
-    osm_log( p_log, OSM_LOG_DEBUG,
-             "osm_physp_has_pkey: "
-             "PKey 0x%04x was not found\n", cl_ntoh16(pkey));
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_log );
-  return res;
+osm_physp_has_pkey(IN osm_log_t * p_log,
+		   IN const ib_net16_t pkey,
+		   IN const osm_physp_t * const p_physp)
+{
+
+	ib_net16_t *p_pkey, pkey_base;
+	const osm_pkey_tbl_t *pkey_tbl;
+	boolean_t res = FALSE;
+
+	OSM_LOG_ENTER(p_log, osm_physp_has_pkey);
+
+	osm_log(p_log, OSM_LOG_DEBUG,
+		"osm_physp_has_pkey: "
+		"Search for PKey: 0x%4x\n", cl_ntoh16(pkey));
+
+	/* if the pkey given is an invalid pkey - return TRUE. */
+	if (ib_pkey_is_invalid(pkey)) {
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"osm_physp_has_pkey: "
+			"Given invalid PKey - we treat it loosely and allow it\n");
+		res = TRUE;
+		goto Exit;
+	}
+
+	pkey_base = ib_pkey_get_base(pkey);
+
+	pkey_tbl = osm_physp_get_pkey_tbl(p_physp);
+
+	p_pkey = cl_map_get(&pkey_tbl->keys, pkey_base);
+	if (p_pkey) {
+		res = TRUE;
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"osm_physp_has_pkey: "
+			"PKey 0x%04x was found\n", cl_ntoh16(pkey));
+	} else {
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"osm_physp_has_pkey: "
+			"PKey 0x%04x was not found\n", cl_ntoh16(pkey));
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_log);
+	return res;
 }
diff --git a/opensm/opensm/osm_pkey_mgr.c b/opensm/opensm/osm_pkey_mgr.c
index 443db16..05caaf5 100644
--- a/opensm/opensm/osm_pkey_mgr.c
+++ b/opensm/opensm/osm_pkey_mgr.c
@@ -46,7 +46,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -66,19 +66,17 @@
   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_blocks(IN const osm_subn_t * p_subn,
+			      IN const osm_physp_t * p_physp)
 {
-  osm_node_t *p_node = osm_physp_get_node_ptr( p_physp );
-  uint16_t num_pkeys = 0;
-
-  if ( !p_node->sw ||
-       ( osm_physp_get_port_num( p_physp ) == 0 ) )
-    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);
+	osm_node_t *p_node = osm_physp_get_node_ptr(p_physp);
+	uint16_t num_pkeys = 0;
+
+	if (!p_node->sw || (osm_physp_get_port_num(p_physp) == 0))
+		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);
 }
 
 /**********************************************************************
@@ -88,495 +86,474 @@ pkey_mgr_get_physp_max_blocks(
  * pending pkeys. New entries are inserted at the back.
  */
 static void
-pkey_mgr_process_physical_port(
-  IN osm_log_t *p_log,
-  IN const osm_req_t *p_req,
-  IN const ib_net16_t pkey,
-  IN osm_physp_t *p_physp )
+pkey_mgr_process_physical_port(IN osm_log_t * p_log,
+			       IN const osm_req_t * p_req,
+			       IN const ib_net16_t pkey,
+			       IN osm_physp_t * p_physp)
 {
-  osm_node_t *p_node = osm_physp_get_node_ptr( p_physp );
-  osm_pkey_tbl_t *p_pkey_tbl;
-  ib_net16_t *p_orig_pkey;
-  char *stat = NULL;
-  osm_pending_pkey_t *p_pending;
-
-  p_pkey_tbl = osm_physp_get_mod_pkey_tbl( p_physp );
-  p_pending = (osm_pending_pkey_t *)malloc( sizeof( osm_pending_pkey_t ) );
-  if (!p_pending)
-  {
-    osm_log( p_log, OSM_LOG_ERROR,
-	     "pkey_mgr_process_physical_port: ERR 0502: "
-	     "Failed to allocate new pending pkey entry for node "
-	     "0x%016" PRIx64 " port %u\n",
-	     cl_ntoh64( osm_node_get_node_guid( p_node ) ),
-	     osm_physp_get_port_num( p_physp ) );
-    return;
-  }
-  p_pending->pkey = pkey;
-  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, (cl_list_item_t*)p_pending );
-    stat = "inserted";
-  }
-  else
-  {
-    CL_ASSERT( ib_pkey_get_base( *p_orig_pkey ) == ib_pkey_get_base( pkey ) );
-    p_pending->is_new = FALSE;
-    if (osm_pkey_tbl_get_block_and_idx(
-	  p_pkey_tbl, p_orig_pkey,
-	  &p_pending->block, &p_pending->index ) != IB_SUCCESS)
-    {
-      osm_log( p_log, OSM_LOG_ERROR,
-	       "pkey_mgr_process_physical_port: 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 ),
-	       cl_ntoh64( osm_node_get_node_guid( p_node ) ),
-	       osm_physp_get_port_num( p_physp ) );
-      return;
-    }
-    cl_qlist_insert_head( &p_pkey_tbl->pending, (cl_list_item_t*)p_pending );
-    stat = "updated";
-  }
-
-  osm_log( p_log, OSM_LOG_DEBUG,
-	   "pkey_mgr_process_physical_port: "
-	   "pkey 0x%04x was %s for node 0x%016" PRIx64
-	   " port %u\n",
-	   cl_ntoh16( pkey ), stat,
-	   cl_ntoh64( osm_node_get_node_guid( p_node ) ),
-	   osm_physp_get_port_num( p_physp ) );
+	osm_node_t *p_node = osm_physp_get_node_ptr(p_physp);
+	osm_pkey_tbl_t *p_pkey_tbl;
+	ib_net16_t *p_orig_pkey;
+	char *stat = NULL;
+	osm_pending_pkey_t *p_pending;
+
+	p_pkey_tbl = osm_physp_get_mod_pkey_tbl(p_physp);
+	p_pending = (osm_pending_pkey_t *) malloc(sizeof(osm_pending_pkey_t));
+	if (!p_pending) {
+		osm_log(p_log, OSM_LOG_ERROR,
+			"pkey_mgr_process_physical_port: ERR 0502: "
+			"Failed to allocate new pending pkey entry for node "
+			"0x%016" PRIx64 " port %u\n",
+			cl_ntoh64(osm_node_get_node_guid(p_node)),
+			osm_physp_get_port_num(p_physp));
+		return;
+	}
+	p_pending->pkey = pkey;
+	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,
+				     (cl_list_item_t *) p_pending);
+		stat = "inserted";
+	} else {
+		CL_ASSERT(ib_pkey_get_base(*p_orig_pkey) ==
+			  ib_pkey_get_base(pkey));
+		p_pending->is_new = FALSE;
+		if (osm_pkey_tbl_get_block_and_idx(p_pkey_tbl, p_orig_pkey,
+						   &p_pending->block,
+						   &p_pending->index) !=
+		    IB_SUCCESS) {
+			osm_log(p_log, OSM_LOG_ERROR,
+				"pkey_mgr_process_physical_port: 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),
+				cl_ntoh64(osm_node_get_node_guid(p_node)),
+				osm_physp_get_port_num(p_physp));
+			return;
+		}
+		cl_qlist_insert_head(&p_pkey_tbl->pending,
+				     (cl_list_item_t *) p_pending);
+		stat = "updated";
+	}
+
+	osm_log(p_log, OSM_LOG_DEBUG,
+		"pkey_mgr_process_physical_port: "
+		"pkey 0x%04x was %s for node 0x%016" PRIx64
+		" port %u\n",
+		cl_ntoh16(pkey), stat,
+		cl_ntoh64(osm_node_get_node_guid(p_node)),
+		osm_physp_get_port_num(p_physp));
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-pkey_mgr_process_partition_table(
-  osm_log_t *p_log,
-  const osm_req_t *p_req,
-  const osm_prtn_t *p_prtn,
-  const boolean_t full )
+pkey_mgr_process_partition_table(osm_log_t * p_log,
+				 const osm_req_t * p_req,
+				 const osm_prtn_t * p_prtn,
+				 const boolean_t full)
 {
-  const cl_map_t *p_tbl =
-    full ? &p_prtn->full_guid_tbl : &p_prtn->part_guid_tbl;
-  cl_map_iterator_t i, i_next;
-  ib_net16_t pkey = p_prtn->pkey;
-  osm_physp_t *p_physp;
-
-  if (full)
-    pkey |= cl_hton16( 0x8000 );
-
-  i_next = cl_map_head( p_tbl );
-  while ( i_next != cl_map_end( p_tbl ) )
-  {
-    i = i_next;
-    i_next = cl_map_next( i );
-    p_physp = cl_map_obj( i );
-    if ( p_physp && osm_physp_is_valid( p_physp ) )
-      pkey_mgr_process_physical_port( p_log, p_req, pkey, p_physp );
-  }
+	const cl_map_t *p_tbl =
+	    full ? &p_prtn->full_guid_tbl : &p_prtn->part_guid_tbl;
+	cl_map_iterator_t i, i_next;
+	ib_net16_t pkey = p_prtn->pkey;
+	osm_physp_t *p_physp;
+
+	if (full)
+		pkey |= cl_hton16(0x8000);
+
+	i_next = cl_map_head(p_tbl);
+	while (i_next != cl_map_end(p_tbl)) {
+		i = i_next;
+		i_next = cl_map_next(i);
+		p_physp = cl_map_obj(i);
+		if (p_physp && osm_physp_is_valid(p_physp))
+			pkey_mgr_process_physical_port(p_log, p_req, pkey,
+						       p_physp);
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t
-pkey_mgr_update_pkey_entry(
-  IN const osm_req_t *p_req,
-  IN const osm_physp_t *p_physp,
-  IN const ib_pkey_table_t *block,
-  IN const uint16_t block_index )
+pkey_mgr_update_pkey_entry(IN const osm_req_t * p_req,
+			   IN const osm_physp_t * p_physp,
+			   IN const ib_pkey_table_t * block,
+			   IN const uint16_t block_index)
 {
-  osm_madw_context_t context;
-  osm_node_t *p_node = osm_physp_get_node_ptr( p_physp );
-  uint32_t attr_mod;
-
-  context.pkey_context.node_guid = osm_node_get_node_guid( p_node );
-  context.pkey_context.port_guid = osm_physp_get_port_guid( p_physp );
-  context.pkey_context.set_method = TRUE;
-  attr_mod = block_index;
-  if ( osm_node_get_type( p_node ) == IB_NODE_TYPE_SWITCH )
-    attr_mod |= osm_physp_get_port_num( p_physp ) << 16;
-  return osm_req_set( p_req, osm_physp_get_dr_path_ptr( p_physp ),
-                      ( uint8_t * ) block, sizeof( *block ),
-                      IB_MAD_ATTR_P_KEY_TABLE,
-                      cl_hton32( attr_mod ), CL_DISP_MSGID_NONE, &context );
+	osm_madw_context_t context;
+	osm_node_t *p_node = osm_physp_get_node_ptr(p_physp);
+	uint32_t attr_mod;
+
+	context.pkey_context.node_guid = osm_node_get_node_guid(p_node);
+	context.pkey_context.port_guid = osm_physp_get_port_guid(p_physp);
+	context.pkey_context.set_method = TRUE;
+	attr_mod = block_index;
+	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH)
+		attr_mod |= osm_physp_get_port_num(p_physp) << 16;
+	return osm_req_set(p_req, osm_physp_get_dr_path_ptr(p_physp),
+			   (uint8_t *) block, sizeof(*block),
+			   IB_MAD_ATTR_P_KEY_TABLE,
+			   cl_hton32(attr_mod), CL_DISP_MSGID_NONE, &context);
 }
 
 /**********************************************************************
  **********************************************************************/
 static boolean_t
-pkey_mgr_enforce_partition(
-  IN osm_log_t *p_log,
-  IN const osm_req_t *p_req,
-  IN osm_physp_t *p_physp,
-  IN const boolean_t enforce)
+pkey_mgr_enforce_partition(IN osm_log_t * p_log,
+			   IN const osm_req_t * p_req,
+			   IN osm_physp_t * p_physp, IN const boolean_t enforce)
 {
-  osm_madw_context_t context;
-  uint8_t payload[IB_SMP_DATA_SIZE];
-  ib_port_info_t *p_pi;
-  ib_api_status_t status;
-
-  p_pi = &p_physp->port_info;
-
-  if ((p_pi->vl_enforce & 0xc) == (0xc)*(enforce == TRUE))
-  {
-    osm_log( p_log, OSM_LOG_DEBUG,
-             "pkey_mgr_enforce_partition: "
-             "No need to update PortInfo for "
-             "node 0x%016" PRIx64 " port %u\n",
-             cl_ntoh64(
-               osm_node_get_node_guid(
-                  osm_physp_get_node_ptr( p_physp ))),
-             osm_physp_get_port_num( p_physp ) );
-    return FALSE;
-  }
-
-  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->state_info2 = 0;
-  ib_port_info_set_port_state( p_pi, IB_LINK_NO_CHANGE );
-
-  context.pi_context.node_guid =
-    osm_node_get_node_guid( osm_physp_get_node_ptr( p_physp ) );
-  context.pi_context.port_guid = osm_physp_get_port_guid( p_physp );
-  context.pi_context.set_method = TRUE;
-  context.pi_context.update_master_sm_base_lid = FALSE;
-  context.pi_context.ignore_errors = FALSE;
-  context.pi_context.light_sweep = FALSE;
-  context.pi_context.active_transition = FALSE;
-
-  status = osm_req_set( p_req, 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)
-  {
-    osm_log( p_log, OSM_LOG_ERROR,
-             "pkey_mgr_enforce_partition: ERR 0511: "
-             "Failed to set PortInfo for "
-             "node 0x%016" PRIx64 " port %u\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_log( p_log, OSM_LOG_DEBUG,
-             "pkey_mgr_enforce_partition: "
-             "Set PortInfo for "
-             "node 0x%016" PRIx64 " port %u\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_madw_context_t context;
+	uint8_t payload[IB_SMP_DATA_SIZE];
+	ib_port_info_t *p_pi;
+	ib_api_status_t status;
+
+	p_pi = &p_physp->port_info;
+
+	if ((p_pi->vl_enforce & 0xc) == (0xc) * (enforce == TRUE)) {
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"pkey_mgr_enforce_partition: "
+			"No need to update PortInfo for "
+			"node 0x%016" PRIx64 " port %u\n",
+			cl_ntoh64(osm_node_get_node_guid
+				  (osm_physp_get_node_ptr(p_physp))),
+			osm_physp_get_port_num(p_physp));
+		return FALSE;
+	}
+
+	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->state_info2 = 0;
+	ib_port_info_set_port_state(p_pi, IB_LINK_NO_CHANGE);
+
+	context.pi_context.node_guid =
+	    osm_node_get_node_guid(osm_physp_get_node_ptr(p_physp));
+	context.pi_context.port_guid = osm_physp_get_port_guid(p_physp);
+	context.pi_context.set_method = TRUE;
+	context.pi_context.update_master_sm_base_lid = FALSE;
+	context.pi_context.ignore_errors = FALSE;
+	context.pi_context.light_sweep = FALSE;
+	context.pi_context.active_transition = FALSE;
+
+	status = osm_req_set(p_req, 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) {
+		osm_log(p_log, OSM_LOG_ERROR,
+			"pkey_mgr_enforce_partition: ERR 0511: "
+			"Failed to set PortInfo for "
+			"node 0x%016" PRIx64 " port %u\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_log(p_log, OSM_LOG_DEBUG,
+			"pkey_mgr_enforce_partition: "
+			"Set PortInfo for "
+			"node 0x%016" PRIx64 " port %u\n",
+			cl_ntoh64(osm_node_get_node_guid
+				  (osm_physp_get_node_ptr(p_physp))),
+			osm_physp_get_port_num(p_physp));
+		return TRUE;
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
-static boolean_t pkey_mgr_update_port(
-  osm_log_t *p_log,
-  osm_req_t *p_req,
-  const osm_port_t * const p_port )
+static boolean_t pkey_mgr_update_port(osm_log_t * p_log,
+				      osm_req_t * p_req,
+				      const osm_port_t * const p_port)
 {
-  osm_physp_t *p_physp;
-  osm_node_t *p_node;
-  ib_pkey_table_t *block, *new_block;
-  osm_pkey_tbl_t *p_pkey_tbl;
-  uint16_t block_index;
-  uint8_t  pkey_index;
-  uint16_t last_free_block_index = 0;
-  uint8_t  last_free_pkey_index = 0;
-  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));
-
-  p_physp = p_port->p_physp;
-  if ( !osm_physp_is_valid( p_physp ) )
-    return FALSE;
-
-  p_node = osm_physp_get_node_ptr( p_physp );
-  p_pkey_tbl = osm_physp_get_mod_pkey_tbl( p_physp );
-  num_of_blocks = osm_pkey_tbl_get_num_blocks( p_pkey_tbl );
-  max_num_of_blocks = pkey_mgr_get_physp_max_blocks( p_req->p_subn, p_physp );
-  if ( p_pkey_tbl->max_blocks > max_num_of_blocks )
-  {
-    osm_log( p_log, OSM_LOG_INFO,
-	     "pkey_mgr_update_port: "
-	     "Max number of blocks reduced from %u to %u "
-	     "for node 0x%016" PRIx64 " port %u\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 ) );
-  }
-  p_pkey_tbl->max_blocks = max_num_of_blocks;
-
-  osm_pkey_tbl_init_new_blocks( p_pkey_tbl );
-  p_pkey_tbl->used_blocks = 0;
-
-  /*
-    process every pending pkey in order -
-    first must be "updated" last are "new"
-   */
-  p_pending = (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 ))
-  {
-    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 (!found)
-	{
-	  osm_log( p_log, OSM_LOG_ERROR,
-		   "pkey_mgr_update_port: 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 ) );
+	osm_physp_t *p_physp;
+	osm_node_t *p_node;
+	ib_pkey_table_t *block, *new_block;
+	osm_pkey_tbl_t *p_pkey_tbl;
+	uint16_t block_index;
+	uint8_t pkey_index;
+	uint16_t last_free_block_index = 0;
+	uint8_t last_free_pkey_index = 0;
+	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));
+
+	p_physp = p_port->p_physp;
+	if (!osm_physp_is_valid(p_physp))
+		return FALSE;
+
+	p_node = osm_physp_get_node_ptr(p_physp);
+	p_pkey_tbl = osm_physp_get_mod_pkey_tbl(p_physp);
+	num_of_blocks = osm_pkey_tbl_get_num_blocks(p_pkey_tbl);
+	max_num_of_blocks =
+	    pkey_mgr_get_physp_max_blocks(p_req->p_subn, p_physp);
+	if (p_pkey_tbl->max_blocks > max_num_of_blocks) {
+		osm_log(p_log, OSM_LOG_INFO,
+			"pkey_mgr_update_port: "
+			"Max number of blocks reduced from %u to %u "
+			"for node 0x%016" PRIx64 " port %u\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));
 	}
-	else
-	{
-	  block_index = last_free_block_index;
-	  pkey_index = last_free_pkey_index++;
+	p_pkey_tbl->max_blocks = max_num_of_blocks;
+
+	osm_pkey_tbl_init_new_blocks(p_pkey_tbl);
+	p_pkey_tbl->used_blocks = 0;
+
+	/*
+	   process every pending pkey in order -
+	   first must be "updated" last are "new"
+	 */
+	p_pending =
+	    (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)) {
+		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 (!found) {
+				osm_log(p_log, OSM_LOG_ERROR,
+					"pkey_mgr_update_port: 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 (found) {
+			if (IB_SUCCESS !=
+			    osm_pkey_tbl_set_new_entry(p_pkey_tbl, block_index,
+						       pkey_index,
+						       p_pending->pkey)) {
+				osm_log(p_log, OSM_LOG_ERROR,
+					"pkey_mgr_update_port: ERR 0505: "
+					"Failed to set PKey 0x%04x in block %u idx %u "
+					"for node 0x%016" PRIx64 " port %u\n",
+					p_pending->pkey, block_index,
+					pkey_index,
+					cl_ntoh64(osm_node_get_node_guid
+						  (p_node)),
+					osm_physp_get_port_num(p_physp));
+			}
+		}
+
+		free(p_pending);
+		p_pending =
+		    (osm_pending_pkey_t *) cl_qlist_remove_head(&p_pkey_tbl->
+								pending);
 	}
-    }
-
-   if (found)
-   {
-	if (IB_SUCCESS != osm_pkey_tbl_set_new_entry( p_pkey_tbl, block_index,
-						       pkey_index, p_pending->pkey ))
-	{
-	  osm_log( p_log, OSM_LOG_ERROR,
-		   "pkey_mgr_update_port: ERR 0505: "
-		   "Failed to set PKey 0x%04x in block %u idx %u "
-		   "for node 0x%016" PRIx64 " port %u\n",
-		   p_pending->pkey, block_index, pkey_index,
-		   cl_ntoh64( osm_node_get_node_guid( p_node ) ),
-		   osm_physp_get_port_num( p_physp ) );
+
+	/* now look for changes and store */
+	for (block_index = 0; block_index < num_of_blocks; block_index++) {
+		block = osm_pkey_tbl_block_get(p_pkey_tbl, block_index);
+		new_block = osm_pkey_tbl_new_block_get(p_pkey_tbl, block_index);
+		if (!new_block)
+			new_block = &empty_block;
+		if (block && !memcmp(new_block, block, sizeof(*block)))
+			continue;
+
+		status =
+		    pkey_mgr_update_pkey_entry(p_req, p_physp, new_block,
+					       block_index);
+		if (status == IB_SUCCESS) {
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"pkey_mgr_update_port: "
+				"Updated "
+				"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(p_physp));
+			ret_val = TRUE;
+		} else {
+			osm_log(p_log, OSM_LOG_ERROR,
+				"pkey_mgr_update_port: ERR 0506: "
+				"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(p_physp));
+		}
 	}
-    }
-
-    free(p_pending);
-    p_pending = (osm_pending_pkey_t *)cl_qlist_remove_head( &p_pkey_tbl->pending );
-  }
-
-  /* now look for changes and store */
-  for (block_index = 0; block_index < num_of_blocks; block_index++)
-  {
-    block = osm_pkey_tbl_block_get( p_pkey_tbl, block_index );
-    new_block = osm_pkey_tbl_new_block_get( p_pkey_tbl, block_index );
-    if (!new_block)
-      new_block = &empty_block;
-    if (block && !memcmp( new_block, block, sizeof( *block ) ))
-      continue;
-
-    status = pkey_mgr_update_pkey_entry( p_req, p_physp, new_block, block_index );
-    if (status == IB_SUCCESS)
-    {
-      osm_log( p_log, OSM_LOG_DEBUG,
-	       "pkey_mgr_update_port: "
-	       "Updated "
-	       "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( p_physp ) );
-      ret_val = TRUE;
-    }
-    else
-    {
-      osm_log( p_log, OSM_LOG_ERROR,
-	       "pkey_mgr_update_port: ERR 0506: "
-		"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( p_physp ) );
-    }
-  }
-
-  return ret_val;
+
+	return ret_val;
 }
 
 /**********************************************************************
  **********************************************************************/
 static boolean_t
-pkey_mgr_update_peer_port(
-  osm_log_t *p_log,
-  const osm_req_t *p_req,
-  const osm_subn_t *p_subn,
-  const osm_port_t * const p_port,
-  boolean_t enforce )
+pkey_mgr_update_peer_port(osm_log_t * p_log,
+			  const osm_req_t * p_req,
+			  const osm_subn_t * p_subn,
+			  const osm_port_t * const p_port, boolean_t enforce)
 {
-  osm_physp_t *p_physp, *peer;
-  osm_node_t *p_node;
-  ib_pkey_table_t *block, *peer_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 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));
-
-  p_physp = p_port->p_physp;
-  if (!osm_physp_is_valid( p_physp ))
-    return FALSE;
-  peer = osm_physp_get_remote( p_physp );
-  if ( !peer || !osm_physp_is_valid( peer ) )
-    return FALSE;
-  p_node = osm_physp_get_node_ptr( peer );
-  if ( !p_node->sw || !p_node->sw->switch_info.enforce_cap )
-    return FALSE;
-
-  p_pkey_tbl = osm_physp_get_pkey_tbl( p_physp );
-  p_peer_pkey_tbl = osm_physp_get_mod_pkey_tbl( peer );
-  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,
-	     "pkey_mgr_update_peer_port: 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 ( pkey_mgr_enforce_partition( p_log, p_req, peer, enforce ) )
-    port_info_set = TRUE;
-
-  if (enforce == FALSE)
-    return port_info_set;
-
-  p_peer_pkey_tbl->used_blocks = p_pkey_tbl->used_blocks;
-  for (block_index = 0; block_index < p_pkey_tbl->used_blocks; block_index++)
-  {
-    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( p_req, peer, block, block_index );
-      if ( status == IB_SUCCESS )
-        ret_val = TRUE;
-      else
-        osm_log( p_log, OSM_LOG_ERROR,
-		 "pkey_mgr_update_peer_port: 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 ) );
-    }
-  }
-
-  if ( (ret_val == TRUE) && osm_log_is_active( p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_log, OSM_LOG_DEBUG,
-             "pkey_mgr_update_peer_port: "
-             "Pkey table was updated for node 0x%016" PRIx64
-             " port %u\n",
-             cl_ntoh64( osm_node_get_node_guid( p_node ) ),
-             osm_physp_get_port_num( peer ) );
-  }
-
-  if (port_info_set)
-    return TRUE;
-  return ret_val;
+	osm_physp_t *p_physp, *peer;
+	osm_node_t *p_node;
+	ib_pkey_table_t *block, *peer_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 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));
+
+	p_physp = p_port->p_physp;
+	if (!osm_physp_is_valid(p_physp))
+		return FALSE;
+	peer = osm_physp_get_remote(p_physp);
+	if (!peer || !osm_physp_is_valid(peer))
+		return FALSE;
+	p_node = osm_physp_get_node_ptr(peer);
+	if (!p_node->sw || !p_node->sw->switch_info.enforce_cap)
+		return FALSE;
+
+	p_pkey_tbl = osm_physp_get_pkey_tbl(p_physp);
+	p_peer_pkey_tbl = osm_physp_get_mod_pkey_tbl(peer);
+	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,
+			"pkey_mgr_update_peer_port: 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 (pkey_mgr_enforce_partition(p_log, p_req, peer, enforce))
+		port_info_set = TRUE;
+
+	if (enforce == FALSE)
+		return port_info_set;
+
+	p_peer_pkey_tbl->used_blocks = p_pkey_tbl->used_blocks;
+	for (block_index = 0; block_index < p_pkey_tbl->used_blocks;
+	     block_index++) {
+		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(p_req, peer, block,
+						       block_index);
+			if (status == IB_SUCCESS)
+				ret_val = TRUE;
+			else
+				osm_log(p_log, OSM_LOG_ERROR,
+					"pkey_mgr_update_peer_port: 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));
+		}
+	}
+
+	if ((ret_val == TRUE) && osm_log_is_active(p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"pkey_mgr_update_peer_port: "
+			"Pkey table was updated for node 0x%016" PRIx64
+			" port %u\n",
+			cl_ntoh64(osm_node_get_node_guid(p_node)),
+			osm_physp_get_port_num(peer));
+	}
+
+	if (port_info_set)
+		return TRUE;
+	return ret_val;
 }
 
 /**********************************************************************
  **********************************************************************/
-osm_signal_t
-osm_pkey_mgr_process(
-  IN osm_opensm_t *p_osm )
+osm_signal_t 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;
-
-  CL_ASSERT( p_osm );
-
-  OSM_LOG_ENTER( &p_osm->log, osm_pkey_mgr_process );
-
-  CL_PLOCK_EXCL_ACQUIRE( &p_osm->lock );
-
-  if ( osm_prtn_make_partitions( &p_osm->log, &p_osm->subn ) != IB_SUCCESS )
-  {
-    osm_log( &p_osm->log, OSM_LOG_ERROR,
-	     "osm_pkey_mgr_process: ERR 0510: "
-	     "osm_prtn_make_partitions() failed\n" );
-    goto _err;
-  }
-
-  /* populate the pending pkey entries by scanning all partitions */
-  p_tbl = &p_osm->subn.prtn_pkey_tbl;
-  p_next = cl_qmap_head( p_tbl );
-  while ( p_next != cl_qmap_end( p_tbl ) )
-  {
-    p_prtn = ( osm_prtn_t * ) p_next;
-    p_next = cl_qmap_next( p_next );
-    pkey_mgr_process_partition_table( &p_osm->log, &p_osm->sm.req,
-				      p_prtn, FALSE );
-    pkey_mgr_process_partition_table( &p_osm->log, &p_osm->sm.req,
-				      p_prtn, TRUE );
-  }
-
-  /* calculate and set new pkey tables */
-  p_tbl = &p_osm->subn.port_guid_tbl;
-  p_next = cl_qmap_head( p_tbl );
-  while ( p_next != cl_qmap_end( p_tbl ) )
-  {
-    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.req, p_port ) )
-      signal = OSM_SIGNAL_DONE_PENDING;
-    if ( ( osm_node_get_type( p_port->p_node ) != IB_NODE_TYPE_SWITCH ) &&
-	 pkey_mgr_update_peer_port( &p_osm->log, &p_osm->sm.req,
-				    &p_osm->subn, p_port,
-				    !p_osm->subn.opt.no_partition_enforcement ) )
-      signal = OSM_SIGNAL_DONE_PENDING;
-  }
-
- _err:
-  CL_PLOCK_RELEASE( &p_osm->lock );
-  OSM_LOG_EXIT( &p_osm->log );
-  return ( signal );
+	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;
+
+	CL_ASSERT(p_osm);
+
+	OSM_LOG_ENTER(&p_osm->log, osm_pkey_mgr_process);
+
+	CL_PLOCK_EXCL_ACQUIRE(&p_osm->lock);
+
+	if (osm_prtn_make_partitions(&p_osm->log, &p_osm->subn) != IB_SUCCESS) {
+		osm_log(&p_osm->log, OSM_LOG_ERROR,
+			"osm_pkey_mgr_process: ERR 0510: "
+			"osm_prtn_make_partitions() failed\n");
+		goto _err;
+	}
+
+	/* populate the pending pkey entries by scanning all partitions */
+	p_tbl = &p_osm->subn.prtn_pkey_tbl;
+	p_next = cl_qmap_head(p_tbl);
+	while (p_next != cl_qmap_end(p_tbl)) {
+		p_prtn = (osm_prtn_t *) p_next;
+		p_next = cl_qmap_next(p_next);
+		pkey_mgr_process_partition_table(&p_osm->log, &p_osm->sm.req,
+						 p_prtn, FALSE);
+		pkey_mgr_process_partition_table(&p_osm->log, &p_osm->sm.req,
+						 p_prtn, TRUE);
+	}
+
+	/* calculate and set new pkey tables */
+	p_tbl = &p_osm->subn.port_guid_tbl;
+	p_next = cl_qmap_head(p_tbl);
+	while (p_next != cl_qmap_end(p_tbl)) {
+		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.req, p_port))
+			signal = OSM_SIGNAL_DONE_PENDING;
+		if ((osm_node_get_type(p_port->p_node) != IB_NODE_TYPE_SWITCH)
+		    && pkey_mgr_update_peer_port(&p_osm->log, &p_osm->sm.req,
+						 &p_osm->subn, p_port,
+						 !p_osm->subn.opt.
+						 no_partition_enforcement))
+			signal = OSM_SIGNAL_DONE_PENDING;
+	}
+
+      _err:
+	CL_PLOCK_RELEASE(&p_osm->lock);
+	OSM_LOG_EXIT(&p_osm->log);
+	return (signal);
 }
diff --git a/opensm/opensm/osm_pkey_rcv.c b/opensm/opensm/osm_pkey_rcv.c
index fae6dd3..d045fa2 100644
--- a/opensm/opensm/osm_pkey_rcv.c
+++ b/opensm/opensm/osm_pkey_rcv.c
@@ -35,7 +35,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -56,49 +56,43 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_pkey_rcv_construct(
-  IN osm_pkey_rcv_t* const p_rcv )
+void osm_pkey_rcv_construct(IN osm_pkey_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
+	memset(p_rcv, 0, sizeof(*p_rcv));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_pkey_rcv_destroy(
-  IN osm_pkey_rcv_t* const p_rcv )
+void osm_pkey_rcv_destroy(IN osm_pkey_rcv_t * const p_rcv)
 {
-  CL_ASSERT( p_rcv );
+	CL_ASSERT(p_rcv);
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_pkey_rcv_destroy );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_pkey_rcv_destroy);
 
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_pkey_rcv_init(
-  IN osm_pkey_rcv_t* const p_rcv,
-  IN osm_req_t* const p_req,
-  IN osm_subn_t* const p_subn,
-  IN osm_log_t* const p_log,
-  IN cl_plock_t* const p_lock )
+osm_pkey_rcv_init(IN osm_pkey_rcv_t * const p_rcv,
+		  IN osm_req_t * const p_req,
+		  IN osm_subn_t * const p_subn,
+		  IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_pkey_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_pkey_rcv_init);
 
-  osm_pkey_rcv_construct( p_rcv );
+	osm_pkey_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_req = p_req;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_req = p_req;
 
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
@@ -106,111 +100,98 @@ osm_pkey_rcv_init(
 /*
  * WE MIGHT ONLY RECEIVE GET or SET responses
  */
-void
-osm_pkey_rcv_process(
-  IN void *context,
-  IN void *data )
+void osm_pkey_rcv_process(IN void *context, IN void *data)
 {
-  osm_pkey_rcv_t *p_rcv = context;
-  osm_madw_t *p_madw = data;
-  ib_pkey_table_t *p_pkey_tbl;
-  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( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_pkey_rcv_process );
-
-  CL_ASSERT( p_madw );
-
-  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 );
-
-  port_guid = p_context->port_guid;
-  node_guid = p_context->node_guid;
-
-  CL_ASSERT( p_smp->attr_id == IB_MAD_ATTR_P_KEY_TABLE );
-
-  cl_plock_excl_acquire( p_rcv->p_lock );
-  p_port = osm_get_port_by_guid( p_rcv->p_subn, port_guid );
-  if( !p_port )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_pkey_rcv_process: 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 ),
-             cl_ntoh64( node_guid ),
-             cl_ntoh64( p_smp->trans_id ) );
-    goto Exit;
-  }
-
-  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.
-  */
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_VERBOSE ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "osm_pkey_rcv_process: "
-             "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 ) );
-  }
-
-  /*
-    Determine if we encountered a new Physical Port.
-    If so, ignore it.
-  */
-  if( !osm_physp_is_valid( p_physp ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_pkey_rcv_process: ERR 4807: "
-             "Got invalid port number 0x%X\n",
-             port_num );
-    goto Exit;
-  }
-
-  osm_dump_pkey_block( p_rcv->p_log,
-                       port_guid, block_num,
-                       port_num, p_pkey_tbl,
-                       OSM_LOG_DEBUG );
-
-  osm_physp_set_pkey_tbl( p_rcv->p_log, p_rcv->p_subn,
-                          p_physp, p_pkey_tbl, block_num );
-
- Exit:
-  cl_plock_release( p_rcv->p_lock );
-
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_pkey_rcv_t *p_rcv = context;
+	osm_madw_t *p_madw = data;
+	ib_pkey_table_t *p_pkey_tbl;
+	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(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_pkey_rcv_process);
+
+	CL_ASSERT(p_madw);
+
+	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);
+
+	port_guid = p_context->port_guid;
+	node_guid = p_context->node_guid;
+
+	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_P_KEY_TABLE);
+
+	cl_plock_excl_acquire(p_rcv->p_lock);
+	p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+	if (!p_port) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_pkey_rcv_process: 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),
+			cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));
+		goto Exit;
+	}
+
+	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.
+	 */
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_VERBOSE)) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"osm_pkey_rcv_process: "
+			"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));
+	}
+
+	/*
+	   Determine if we encountered a new Physical Port.
+	   If so, ignore it.
+	 */
+	if (!osm_physp_is_valid(p_physp)) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_pkey_rcv_process: ERR 4807: "
+			"Got invalid port number 0x%X\n", port_num);
+		goto Exit;
+	}
+
+	osm_dump_pkey_block(p_rcv->p_log,
+			    port_guid, block_num,
+			    port_num, p_pkey_tbl, OSM_LOG_DEBUG);
+
+	osm_physp_set_pkey_tbl(p_rcv->p_log, p_rcv->p_subn,
+			       p_physp, p_pkey_tbl, block_num);
+
+      Exit:
+	cl_plock_release(p_rcv->p_lock);
+
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_prtn.c b/opensm/opensm/osm_prtn.c
index ebf5889..5dabae9 100644
--- a/opensm/opensm/osm_prtn.c
+++ b/opensm/opensm/osm_prtn.c
@@ -45,7 +45,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <string.h>
@@ -65,9 +65,7 @@ extern int osm_prtn_config_parse_file(osm_log_t * const p_log,
 
 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 const uint16_t pkey)
 {
 	osm_prtn_t *p = malloc(sizeof(*p));
 	if (!p)
@@ -89,8 +87,7 @@ osm_prtn_t* osm_prtn_new(
 	return p;
 }
 
-void osm_prtn_delete(
-	IN OUT osm_prtn_t** const pp_prtn )
+void osm_prtn_delete(IN OUT osm_prtn_t ** const pp_prtn)
 {
 	osm_prtn_t *p = *pp_prtn;
 
@@ -102,8 +99,9 @@ void osm_prtn_delete(
 	*pp_prtn = NULL;
 }
 
-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)
+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)
 {
 	ib_api_status_t status = IB_SUCCESS;
 	cl_map_t *p_tbl;
@@ -113,8 +111,7 @@ ib_api_status_t osm_prtn_add_port(osm_log_t *p_log, osm_subn_t *p_subn,
 	p_port = osm_get_port_by_guid(p_subn, guid);
 	if (!p_port) {
 		osm_log(p_log, OSM_LOG_VERBOSE, "osm_prtn_add_port: "
-			"port 0x%" PRIx64 " not found\n",
-			cl_ntoh64(guid));
+			"port 0x%" PRIx64 " not found\n", cl_ntoh64(guid));
 		return status;
 	}
 
@@ -134,7 +131,7 @@ ib_api_status_t osm_prtn_add_port(osm_log_t *p_log, osm_subn_t *p_subn,
 			cl_ntoh64(guid), p->name, cl_ntoh16(p->pkey));
 	}
 
-	p_tbl = (full == TRUE) ? &p->full_guid_tbl : &p->part_guid_tbl ;
+	p_tbl = (full == TRUE) ? &p->full_guid_tbl : &p->part_guid_tbl;
 
 	if (cl_map_insert(p_tbl, guid, p_physp) == NULL)
 		return IB_INSUFFICIENT_MEMORY;
@@ -142,8 +139,8 @@ ib_api_status_t osm_prtn_add_port(osm_log_t *p_log, osm_subn_t *p_subn,
 	return status;
 }
 
-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)
+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)
 {
 	cl_qmap_t *p_port_tbl = &p_subn->port_guid_tbl;
 	cl_map_item_t *p_item;
@@ -152,7 +149,7 @@ ib_api_status_t osm_prtn_add_all(osm_log_t *p_log, osm_subn_t *p_subn,
 
 	p_item = cl_qmap_head(p_port_tbl);
 	while (p_item != cl_qmap_end(p_port_tbl)) {
-		p_port = (osm_port_t *)p_item;
+		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);
@@ -160,19 +157,19 @@ ib_api_status_t osm_prtn_add_all(osm_log_t *p_log, osm_subn_t *p_subn,
 			goto _err;
 	}
 
-  _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 */
-  },
+	{
+	 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 */
+	 },
 };
 
 /*
@@ -180,18 +177,18 @@ static const ib_gid_t osm_ipoib_mgid = {
  * 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 */
-  },
+	{
+	 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,
+ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log,
+				     osm_subn_t * p_subn, osm_prtn_t * p,
 				     unsigned is_ipoib, uint8_t rate,
 				     uint8_t mtu, uint8_t scope)
 {
@@ -207,27 +204,30 @@ 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 */
+	mc_rec.mgid = osm_ipoib_mgid;	/* ipv4 broadcast group */
 	memcpy(&mc_rec.mgid.raw[4], &pkey, sizeof(pkey));
 
 	mc_rec.qkey = CL_HTON32(0x0b1b);
-	mc_rec.mtu = (mtu ? mtu : OSM_DEFAULT_MGRP_MTU) | (2 << 6); /* 2048 Bytes */
+	mc_rec.mtu = (mtu ? mtu : OSM_DEFAULT_MGRP_MTU) | (2 << 6);	/* 2048 Bytes */
 	mc_rec.tclass = 0;
 	mc_rec.pkey = pkey;
-	mc_rec.rate = (rate ? rate : OSM_DEFAULT_MGRP_RATE) | (2 << 6); /* 10Gb/sec */
+	mc_rec.rate = (rate ? rate : OSM_DEFAULT_MGRP_RATE) | (2 << 6);	/* 10Gb/sec */
 	mc_rec.pkt_life = OSM_DEFAULT_SUBNET_TIMEOUT;
 	mc_rec.sl_flow_hop = ib_member_set_sl_flow_hop(p->sl, 0, 0);
 	/* Scope in MCMemberRecord (if present) needs to be consistent with MGID */
-	mc_rec.scope_state = ib_member_set_scope_state(scope ? scope : OSM_DEFAULT_MGRP_SCOPE, MC_FULL_MEMBER);
+	mc_rec.scope_state =
+	    ib_member_set_scope_state(scope ? scope : OSM_DEFAULT_MGRP_SCOPE,
+				      MC_FULL_MEMBER);
 	ib_mgid_set_scope(&mc_rec.mgid, scope ? scope : OSM_DEFAULT_MGRP_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;
+	    IB_MCR_COMPMASK_RATE | IB_MCR_COMPMASK_RATE_SEL;
 	status = osm_mcmr_rcv_find_or_create_new_mgrp(&p_sa->mcmr_rcv,
-						      comp_mask, &mc_rec, &p_mgrp);
+						      comp_mask, &mc_rec,
+						      &p_mgrp);
 	if (!p_mgrp || status != IB_SUCCESS)
-		osm_log( p_log, OSM_LOG_ERROR,
+		osm_log(p_log, OSM_LOG_ERROR,
 			"osm_prtn_add_mcgroup: "
 			"Failed to create MC group with pkey 0x%04x\n",
 			cl_ntoh16(pkey));
@@ -239,17 +239,19 @@ ib_api_status_t osm_prtn_add_mcgroup(osm_log_t *p_log,
 	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 */
-	ts_scope = ib_mgid_get_scope(&osm_ts_ipoib_mgid); /* get scope from MGID */
-	mc_rec.scope_state = ib_member_set_scope_state(ts_scope, MC_FULL_MEMBER);
-	status = osm_mcmr_rcv_find_or_create_new_mgrp(&p_sa->mcmr_rcv,
-			comp_mask, &mc_rec, &p_mgrp);
+	ts_scope = ib_mgid_get_scope(&osm_ts_ipoib_mgid);	/* get scope from MGID */
+	mc_rec.scope_state =
+	    ib_member_set_scope_state(ts_scope, MC_FULL_MEMBER);
+	status =
+	    osm_mcmr_rcv_find_or_create_new_mgrp(&p_sa->mcmr_rcv, comp_mask,
+						 &mc_rec, &p_mgrp);
 	if (p_mgrp)
 		p_mgrp->well_known = TRUE;
 
 	return status;
 }
 
-static uint16_t __generate_pkey(osm_subn_t *p_subn)
+static uint16_t __generate_pkey(osm_subn_t * p_subn)
 {
 	uint16_t pkey;
 
@@ -263,14 +265,14 @@ static uint16_t __generate_pkey(osm_subn_t *p_subn)
 	return 0;
 }
 
-static osm_prtn_t *find_prtn_by_name(osm_subn_t *p_subn, const char *name)
+static osm_prtn_t *find_prtn_by_name(osm_subn_t * p_subn, const char *name)
 {
 	cl_map_item_t *p_next;
 	osm_prtn_t *p;
 
 	p_next = cl_qmap_head(&p_subn->prtn_pkey_tbl);
 	while (p_next != cl_qmap_end(&p_subn->prtn_pkey_tbl)) {
-		p = (osm_prtn_t *)p_next;
+		p = (osm_prtn_t *) p_next;
 		p_next = cl_qmap_next(&p->map_item);
 		if (!strncmp(p->name, name, sizeof(p->name)))
 			return p;
@@ -279,17 +281,17 @@ static osm_prtn_t *find_prtn_by_name(osm_subn_t *p_subn, const char *name)
 	return NULL;
 }
 
-osm_prtn_t *osm_prtn_make_new(osm_log_t *p_log, osm_subn_t *p_subn,
+osm_prtn_t *osm_prtn_make_new(osm_log_t * p_log, osm_subn_t * p_subn,
 			      const char *name, uint16_t pkey)
 {
 	osm_prtn_t *p = NULL, *p_check;
 
-	pkey &= cl_hton16((uint16_t)~0x8000);
+	pkey &= cl_hton16((uint16_t) ~ 0x8000);
 
 	if (!pkey) {
 		if (name && (p = find_prtn_by_name(p_subn, name)))
 			return p;
-		if(!(pkey = __generate_pkey(p_subn)))
+		if (!(pkey = __generate_pkey(p_subn)))
 			return NULL;
 	}
 
@@ -297,13 +299,12 @@ osm_prtn_t *osm_prtn_make_new(osm_log_t *p_log, osm_subn_t *p_subn,
 	if (!p) {
 		osm_log(p_log, OSM_LOG_ERROR,
 			"osm_prtn_make_new: Unable to create"
-			" partition \'%s\' (0x%04x)\n",
-			name, cl_ntoh16(pkey));
+			" partition \'%s\' (0x%04x)\n", name, cl_ntoh16(pkey));
 		return NULL;
 	}
 
-	p_check = (osm_prtn_t *)cl_qmap_insert(&p_subn->prtn_pkey_tbl,
-					       p->pkey, &p->map_item);
+	p_check = (osm_prtn_t *) cl_qmap_insert(&p_subn->prtn_pkey_tbl,
+						p->pkey, &p->map_item);
 	if (p != p_check) {
 		osm_log(p_log, OSM_LOG_VERBOSE,
 			"osm_prtn_make_new: Duplicated partition"
@@ -324,19 +325,21 @@ static ib_api_status_t osm_prtn_make_default(osm_log_t * const p_log,
 	ib_api_status_t status = IB_UNKNOWN_ERROR;
 	osm_prtn_t *p;
 
-	p = osm_prtn_make_new(p_log, p_subn, "Default", IB_DEFAULT_PARTIAL_PKEY);
+	p = osm_prtn_make_new(p_log, p_subn, "Default",
+			      IB_DEFAULT_PARTIAL_PKEY);
 	if (!p)
 		goto _err;
 	status = osm_prtn_add_all(p_log, p_subn, p, 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);
+	status =
+	    osm_prtn_add_port(p_log, p_subn, p, p_subn->sm_port_guid, TRUE);
 
 	if (no_config)
 		osm_prtn_add_mcgroup(p_log, p_subn, p, 1, 0, 0, 0);
 
-  _err:
+      _err:
 	return status;
 }
 
@@ -351,15 +354,14 @@ ib_api_status_t osm_prtn_make_partitions(osm_log_t * const p_log,
 	osm_prtn_t *p;
 
 	file_name = p_subn->opt.partition_config_file ?
-			p_subn->opt.partition_config_file :
-			"/etc/osm-partitions.conf";
+	    p_subn->opt.partition_config_file : "/etc/osm-partitions.conf";
 	if (stat(file_name, &statbuf))
 		is_config = FALSE;
 
 	/* clean up current port maps */
 	p_next = cl_qmap_head(&p_subn->prtn_pkey_tbl);
 	while (p_next != cl_qmap_end(&p_subn->prtn_pkey_tbl)) {
-		p = (osm_prtn_t *)p_next;
+		p = (osm_prtn_t *) p_next;
 		p_next = cl_qmap_next(&p->map_item);
 		cl_map_remove_all(&p->part_guid_tbl);
 		cl_map_remove_all(&p->full_guid_tbl);
@@ -380,16 +382,16 @@ ib_api_status_t osm_prtn_make_partitions(osm_log_t * const p_log,
 	/* and now clean up empty partitions */
 	p_next = cl_qmap_head(&p_subn->prtn_pkey_tbl);
 	while (p_next != cl_qmap_end(&p_subn->prtn_pkey_tbl)) {
-		p = (osm_prtn_t *)p_next;
+		p = (osm_prtn_t *) p_next;
 		p_next = cl_qmap_next(&p->map_item);
 		if (cl_map_count(&p->part_guid_tbl) == 0 &&
 		    cl_map_count(&p->full_guid_tbl) == 0) {
 			cl_qmap_remove_item(&p_subn->prtn_pkey_tbl,
-					    (cl_map_item_t *)p);
+					    (cl_map_item_t *) p);
 			osm_prtn_delete(&p);
 		}
 	}
 
-  _err:
+      _err:
 	return status;
 }
diff --git a/opensm/opensm/osm_prtn_config.c b/opensm/opensm/osm_prtn_config.c
index b49815b..9abf3e8 100644
--- a/opensm/opensm/osm_prtn_config.c
+++ b/opensm/opensm/osm_prtn_config.c
@@ -42,7 +42,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -65,23 +65,23 @@
 /*
  */
 struct part_conf {
-	osm_log_t  *p_log;
+	osm_log_t *p_log;
 	osm_subn_t *p_subn;
 	osm_prtn_t *p_prtn;
-	unsigned    is_ipoib, mtu, rate, sl, scope;
-	boolean_t   full;
+	unsigned is_ipoib, mtu, rate, sl, scope;
+	boolean_t full;
 };
 
-extern osm_prtn_t *osm_prtn_make_new(osm_log_t *p_log, osm_subn_t *p_subn,
+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_port(osm_log_t *p_log,
-					 osm_subn_t *p_subn, osm_prtn_t *p,
+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_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,
+extern ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log,
+					    osm_subn_t * p_subn, osm_prtn_t * p,
 					    unsigned is_ipoib, uint8_t rate,
 					    uint8_t mtu, uint8_t scope);
 
@@ -98,7 +98,7 @@ static int partition_create(unsigned lineno, struct part_conf *conf,
 	if (id) {
 		char *end;
 
-		pkey = (uint16_t)strtoul(id, &end, 0);
+		pkey = (uint16_t) strtoul(id, &end, 0);
 		if (end == id || *end)
 			return -1;
 	} else
@@ -114,15 +114,16 @@ static int partition_create(unsigned lineno, struct part_conf *conf,
 			osm_log(conf->p_log, OSM_LOG_ERROR,
 				"partition_create: Overriding SL %d to default SL %d on partition %s as QoS not enabled\n",
 				conf->sl, OSM_DEFAULT_SL, name);
-		  conf->sl = OSM_DEFAULT_SL;
+			conf->sl = OSM_DEFAULT_SL;
 		}
 	}
-	conf->p_prtn->sl = (uint8_t)conf->sl;
+	conf->p_prtn->sl = (uint8_t) conf->sl;
 
 	if (conf->is_ipoib)
 		osm_prtn_add_mcgroup(conf->p_log, conf->p_subn, conf->p_prtn,
-			     conf->is_ipoib, (uint8_t)conf->rate,
-			     (uint8_t)conf->mtu, (uint8_t)conf->scope);
+				     conf->is_ipoib, (uint8_t) conf->rate,
+				     (uint8_t) conf->mtu,
+				     (uint8_t) conf->scope);
 
 	return 0;
 }
@@ -164,7 +165,9 @@ static int partition_add_flag(unsigned lineno, struct part_conf *conf,
 		else
 			conf->sl = sl;
 	} else if (!strncmp(flag, "defmember", len)) {
-		if (!val || (strncmp(val, "limited", strlen(val)) && strncmp(val, "full", strlen(val))))
+		if (!val
+		    || (strncmp(val, "limited", 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)"
@@ -172,10 +175,10 @@ static int partition_add_flag(unsigned lineno, struct part_conf *conf,
 		else
 			conf->full = strncmp(val, "full", strlen(val)) == 0;
 	} else {
-			osm_log(conf->p_log, OSM_LOG_VERBOSE,
-					  "PARSE WARN: line %d: "
-					  "unrecognized partition flag \'%s\'"
-					  " - ignored\n", lineno, flag);
+		osm_log(conf->p_log, OSM_LOG_VERBOSE,
+			"PARSE WARN: line %d: "
+			"unrecognized partition flag \'%s\'"
+			" - ignored\n", lineno, flag);
 	}
 	return 0;
 }
@@ -251,8 +254,7 @@ static int parse_name_token(char *str, char **name, char **val)
 	str = q;
 
 	q = p + strlen(p);
-	while ( q != p &&
-		(*q == '\0' || *q == ' ' || *q == '\t' || *q == '\n'))
+	while (q != p && (*q == '\0' || *q == ' ' || *q == '\t' || *q == '\n'))
 		*q-- = '\0';
 
 	*name = p;
@@ -266,15 +268,14 @@ static int parse_name_token(char *str, char **name, char **val)
 
 	q = p + strlen(p);
 	len += (int)(q - str) + 1;
-	while ( q != p &&
-		( *q == '\0' || *q == ' ' || *q == '\t' || *q == '\n'))
+	while (q != p && (*q == '\0' || *q == ' ' || *q == '\t' || *q == '\n'))
 		*q-- = '\0';
 	*val = p;
 
 	return len;
 }
 
-static struct part_conf *new_part_conf(osm_log_t *p_log, osm_subn_t *p_subn)
+static struct part_conf *new_part_conf(osm_log_t * p_log, osm_subn_t * p_subn)
 {
 	static struct part_conf part;
 	struct part_conf *conf = ∂
@@ -343,9 +344,9 @@ static int parse_part_conf(struct part_conf *conf, char *str, int lineno)
 		if (!flag) {
 			osm_log(conf->p_log, OSM_LOG_ERROR,
 				"PARSE ERROR: line %d: "
-				"bad partition flags\n",lineno);
+				"bad partition flags\n", lineno);
 			fprintf(stderr, "\nPARSE ERROR: line %d: "
-				"bad partition flags\n",lineno);
+				"bad partition flags\n", lineno);
 			return -1;
 		}
 		p += ret;
@@ -354,7 +355,7 @@ static int parse_part_conf(struct part_conf *conf, char *str, int lineno)
 	}
 
 	if (p != str || (partition_create(lineno, conf,
-					name, id, flag, flval) < 0)) {
+					  name, id, flag, flval) < 0)) {
 		osm_log(conf->p_log, OSM_LOG_ERROR,
 			"PARSE ERROR: line %d: "
 			"bad partition definition\n", lineno);
@@ -363,7 +364,7 @@ static int parse_part_conf(struct part_conf *conf, char *str, int lineno)
 		return -1;
 	}
 
-  skip_header:
+      skip_header:
 	do {
 		name = flag = NULL;
 		q = strchr(p, ',');
@@ -385,7 +386,7 @@ static int parse_part_conf(struct part_conf *conf, char *str, int lineno)
 	return len;
 }
 
-int osm_prtn_config_parse_file(osm_log_t *p_log, osm_subn_t *p_subn,
+int osm_prtn_config_parse_file(osm_log_t * p_log, osm_subn_t * p_subn,
 			       const char *file_name)
 {
 	char line[1024];
@@ -396,9 +397,9 @@ int osm_prtn_config_parse_file(osm_log_t *p_log, osm_subn_t *p_subn,
 	file = fopen(file_name, "r");
 	if (!file) {
 		osm_log(p_log, OSM_LOG_VERBOSE,
-				"osm_prtn_config_parse_file: "
-				"Cannot open config file \'%s\': %s\n",
-				file_name, strerror(errno));
+			"osm_prtn_config_parse_file: "
+			"Cannot open config file \'%s\': %s\n",
+			file_name, strerror(errno));
 		return -1;
 	}
 
@@ -422,13 +423,15 @@ int osm_prtn_config_parse_file(osm_log_t *p_log, osm_subn_t *p_subn,
 			if (*p == '\0')
 				break;
 
-			if (!conf &&
-				!(conf = new_part_conf(p_log, p_subn))) {
+			if (!conf && !(conf = new_part_conf(p_log, p_subn))) {
 				osm_log(conf->p_log, OSM_LOG_ERROR,
 					"PARSE ERROR: line %d: "
-					"internal: cannot create config\n", lineno);
-				fprintf(stderr, "PARSE ERROR: line %d: "
-					"internal: cannot create config\n", lineno);
+					"internal: cannot create config\n",
+					lineno);
+				fprintf(stderr,
+					"PARSE ERROR: line %d: "
+					"internal: cannot create config\n",
+					lineno);
 				break;
 			}
 
diff --git a/opensm/opensm/osm_qos.c b/opensm/opensm/osm_qos.c
index c9ca9d8..dff9996 100644
--- a/opensm/opensm/osm_qos.c
+++ b/opensm/opensm/osm_qos.c
@@ -61,7 +61,7 @@ struct qos_config {
 	ib_slvl_table_t sl2vl;
 };
 
-static void qos_build_config(struct qos_config * cfg,
+static void qos_build_config(struct qos_config *cfg,
 			     osm_qos_options_t * opt, osm_qos_options_t * dflt);
 
 /*
@@ -71,7 +71,8 @@ static ib_api_status_t vlarb_update_table_block(osm_req_t * p_req,
 						osm_physp_t * p,
 						uint8_t port_num,
 						unsigned force_update,
-						const ib_vl_arb_table_t *table_block,
+						const ib_vl_arb_table_t *
+						table_block,
 						unsigned block_length,
 						unsigned block_num)
 {
@@ -83,8 +84,7 @@ static ib_api_status_t vlarb_update_table_block(osm_req_t * p_req,
 	vl_mask = (1 << (ib_port_info_get_op_vls(&p->port_info) - 1)) - 1;
 
 	memset(&block, 0, sizeof(block));
-	memcpy(&block, table_block,
-		block_length * sizeof(block.vl_entry[0]));
+	memcpy(&block, table_block, block_length * sizeof(block.vl_entry[0]));
 	for (i = 0; i < block_length; i++)
 		block.vl_entry[i].vl &= vl_mask;
 
@@ -175,7 +175,7 @@ static ib_api_status_t sl2vl_update_table(osm_req_t * p_req,
 			vl1 &= vl_mask;
 		if (vl2 != 15)
 			vl2 &= vl_mask;
-		tbl.raw_vl_by_sl[i] = (vl1 << 4 ) | vl2 ;
+		tbl.raw_vl_by_sl[i] = (vl1 << 4) | vl2;
 	}
 
 	if (!force_update && (p_tbl = osm_physp_get_slvl_tbl(p, in_port)) &&
@@ -205,7 +205,9 @@ static ib_api_status_t sl2vl_update(osm_req_t * p_req, osm_port_t * p_port,
 		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))
+			if (!
+			    (p_physp->port_info.
+			     capability_mask & IB_PORT_CAP_HAS_SL_MAP))
 				return IB_SUCCESS;
 		}
 		num_ports = osm_node_get_num_physp(osm_physp_get_node_ptr(p));
@@ -308,14 +310,15 @@ osm_signal_t osm_qos_setup(osm_opensm_t * p_osm)
 				if (!osm_physp_is_valid(p_physp))
 					continue;
 				force_update = p_physp->need_update ||
-					p_osm->subn.need_update;
+				    p_osm->subn.need_update;
 				status =
 				    qos_physp_setup(&p_osm->log, &p_osm->sm.req,
 						    p_port, p_physp, i,
 						    force_update, &swe_config);
 			}
 			/* skip base port 0 */
-			if (!ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info))
+			if (!ib_switch_info_is_enhanced_port0
+			    (&p_node->sw->switch_info))
 				continue;
 
 			cfg = &sw0_config;
@@ -330,8 +333,7 @@ osm_signal_t osm_qos_setup(osm_opensm_t * p_osm)
 
 		force_update = p_physp->need_update || p_osm->subn.need_update;
 		status = qos_physp_setup(&p_osm->log, &p_osm->sm.req,
-					 p_port, p_physp, 0,
-					 force_update, cfg);
+					 p_port, p_physp, 0, force_update, cfg);
 	}
 
 	cl_plock_release(&p_osm->lock);
@@ -359,7 +361,7 @@ static int parse_vlarb_entry(char *str, ib_vl_arb_element_t * e)
 	p += parse_one_unsigned(p, ':', &val);
 	e->vl = val % 15;
 	p += parse_one_unsigned(p, ',', &val);
-	e->weight = (uint8_t)val;
+	e->weight = (uint8_t) val;
 	return (int)(p - str);
 }
 
@@ -382,20 +384,24 @@ static void qos_build_config(struct qos_config *cfg,
 	memset(cfg, 0, sizeof(*cfg));
 
 	cfg->max_vls = opt->max_vls > 0 ? opt->max_vls : dflt->max_vls;
-	cfg->vl_high_limit = (uint8_t)opt->high_limit;
+	cfg->vl_high_limit = (uint8_t) opt->high_limit;
 
 	p = opt->vlarb_high ? opt->vlarb_high : dflt->vlarb_high;
 	for (i = 0; i < 2 * IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK; i++) {
 		p += parse_vlarb_entry(p,
-				       &cfg->vlarb_high[i/IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK].
-				       vl_entry[i%IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK]);
+				       &cfg->vlarb_high[i /
+							IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK].
+				       vl_entry[i %
+						IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK]);
 	}
 
 	p = opt->vlarb_low ? opt->vlarb_low : dflt->vlarb_low;
 	for (i = 0; i < 2 * IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK; i++) {
 		p += parse_vlarb_entry(p,
-				       &cfg->vlarb_low[i/IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK].
-				       vl_entry[i%IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK]);
+				       &cfg->vlarb_low[i /
+						       IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK].
+				       vl_entry[i %
+						IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK]);
 	}
 
 	p = opt->sl2vl ? opt->sl2vl : dflt->sl2vl;
diff --git a/opensm/opensm/osm_remote_sm.c b/opensm/opensm/osm_remote_sm.c
index 76616a5..4d44d53 100644
--- a/opensm/opensm/osm_remote_sm.c
+++ b/opensm/opensm/osm_remote_sm.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of osm_sm_t.
@@ -48,43 +47,38 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #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 * const p_sm)
 {
-  memset( p_sm, 0, sizeof(*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 * const p_sm)
 {
-  memset( p_sm, 0, sizeof(*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 )
+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)
 {
-  CL_ASSERT( p_sm );
-  CL_ASSERT( p_port );
+	CL_ASSERT(p_sm);
+	CL_ASSERT(p_port);
 
-  osm_remote_sm_construct( p_sm );
+	osm_remote_sm_construct(p_sm);
 
-  p_sm->p_port = p_port;
-  p_sm->smi = *p_smi;
-  return;
+	p_sm->p_port = p_port;
+	p_sm->smi = *p_smi;
+	return;
 }
diff --git a/opensm/opensm/osm_req.c b/opensm/opensm/osm_req.c
index 2bc6c19..ed1d19c 100644
--- a/opensm/opensm/osm_req.c
+++ b/opensm/opensm/osm_req.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of osm_req_t.
@@ -48,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -65,234 +64,204 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_req_construct(
-  IN osm_req_t* const p_req )
+void osm_req_construct(IN osm_req_t * const p_req)
 {
-  CL_ASSERT( p_req );
+	CL_ASSERT(p_req);
 
-  memset( p_req, 0, sizeof(*p_req) );
+	memset(p_req, 0, sizeof(*p_req));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_req_destroy(
-  IN osm_req_t* const p_req )
+void osm_req_destroy(IN osm_req_t * const p_req)
 {
-  CL_ASSERT( p_req );
+	CL_ASSERT(p_req);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_req_init(
-  IN osm_req_t*            const p_req,
-  IN osm_mad_pool_t*       const p_pool,
-  IN osm_vl15_t*           const p_vl15,
-  IN osm_subn_t*           const p_subn,
-  IN osm_log_t*            const p_log,
-  IN atomic32_t*           const p_sm_trans_id )
+osm_req_init(IN osm_req_t * const p_req,
+	     IN osm_mad_pool_t * const p_pool,
+	     IN osm_vl15_t * const p_vl15,
+	     IN osm_subn_t * const p_subn,
+	     IN osm_log_t * const p_log, IN atomic32_t * const p_sm_trans_id)
 {
-  ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_req_init );
+	OSM_LOG_ENTER(p_log, osm_req_init);
 
-  osm_req_construct( p_req );
-  p_req->p_log = p_log;
+	osm_req_construct(p_req);
+	p_req->p_log = p_log;
 
-  p_req->p_pool = p_pool;
-  p_req->p_vl15 = p_vl15;
-  p_req->p_subn = p_subn;
-  p_req->p_sm_trans_id = p_sm_trans_id;
+	p_req->p_pool = p_pool;
+	p_req->p_vl15 = p_vl15;
+	p_req->p_subn = p_subn;
+	p_req->p_sm_trans_id = p_sm_trans_id;
 
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
   The plock MAY or MAY NOT be held before calling this function.
 **********************************************************************/
 ib_api_status_t
-osm_req_get(
-  IN const osm_req_t* const p_req,
-  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 )
+osm_req_get(IN const osm_req_t * const p_req,
+	    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)
 {
-  osm_madw_t *p_madw;
-  ib_api_status_t status = IB_SUCCESS;
-  ib_net64_t tid;
-
-  CL_ASSERT( p_req );
-
-  OSM_LOG_ENTER( p_req->p_log, osm_req_get );
-
-  CL_ASSERT( p_path );
-  CL_ASSERT( attr_id );
-
-  /* do nothing if we are exiting ... */
-  if (osm_exit_flag)
-    goto Exit;
-
-  /* p_context may be NULL. */
-
-  p_madw = osm_mad_pool_get(
-    p_req->p_pool,
-    p_path->h_bind,
-    MAD_BLOCK_SIZE,
-    NULL );
-
-  if( p_madw == NULL )
-  {
-    osm_log( p_req->p_log, OSM_LOG_ERROR,
-             "osm_req_get: ERR 1101: "
-             "Unable to acquire MAD\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
-  tid = cl_hton64( (uint64_t)cl_atomic_inc( p_req->p_sm_trans_id ) );
-
-  if( osm_log_is_active( p_req->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_req->p_log, OSM_LOG_DEBUG,
-             "osm_req_get: "
-             "Getting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64 "\n",
-             ib_get_sm_attr_str( attr_id ),
-             cl_ntoh16( attr_id ),
-             cl_ntoh32( attr_mod ),
-             cl_ntoh64( tid ) );
-  }
-
-  ib_smp_init_new(
-    osm_madw_get_smp_ptr( p_madw ),
-    IB_MAD_METHOD_GET,
-    tid,
-    attr_id,
-    attr_mod,
-    p_path->hop_count,
-    p_req->p_subn->opt.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;
-  p_madw->resp_expected = TRUE;
-  p_madw->fail_msg = err_msg;
-
-  /*
-    Fill in the mad wrapper context for the recipient.
-    In this case, the only thing the recipient needs is the
-    guid value.
-  */
-
-  if( p_context )
-    p_madw->context = *p_context;
-
-  osm_vl15_post( p_req->p_vl15, p_madw );
-
- Exit:
-  OSM_LOG_EXIT( p_req->p_log );
-  return( status );
+	osm_madw_t *p_madw;
+	ib_api_status_t status = IB_SUCCESS;
+	ib_net64_t tid;
+
+	CL_ASSERT(p_req);
+
+	OSM_LOG_ENTER(p_req->p_log, osm_req_get);
+
+	CL_ASSERT(p_path);
+	CL_ASSERT(attr_id);
+
+	/* do nothing if we are exiting ... */
+	if (osm_exit_flag)
+		goto Exit;
+
+	/* p_context may be NULL. */
+
+	p_madw = osm_mad_pool_get(p_req->p_pool,
+				  p_path->h_bind, MAD_BLOCK_SIZE, NULL);
+
+	if (p_madw == NULL) {
+		osm_log(p_req->p_log, OSM_LOG_ERROR,
+			"osm_req_get: ERR 1101: " "Unable to acquire MAD\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+	tid = cl_hton64((uint64_t) cl_atomic_inc(p_req->p_sm_trans_id));
+
+	if (osm_log_is_active(p_req->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_req->p_log, OSM_LOG_DEBUG,
+			"osm_req_get: "
+			"Getting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64 "\n",
+			ib_get_sm_attr_str(attr_id),
+			cl_ntoh16(attr_id),
+			cl_ntoh32(attr_mod), cl_ntoh64(tid));
+	}
+
+	ib_smp_init_new(osm_madw_get_smp_ptr(p_madw),
+			IB_MAD_METHOD_GET,
+			tid,
+			attr_id,
+			attr_mod,
+			p_path->hop_count,
+			p_req->p_subn->opt.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;
+	p_madw->resp_expected = TRUE;
+	p_madw->fail_msg = err_msg;
+
+	/*
+	   Fill in the mad wrapper context for the recipient.
+	   In this case, the only thing the recipient needs is the
+	   guid value.
+	 */
+
+	if (p_context)
+		p_madw->context = *p_context;
+
+	osm_vl15_post(p_req->p_vl15, p_madw);
+
+      Exit:
+	OSM_LOG_EXIT(p_req->p_log);
+	return (status);
 }
 
 /**********************************************************************
   The plock MAY or MAY NOT be held before calling this function.
 **********************************************************************/
 ib_api_status_t
-osm_req_set(
-  IN const osm_req_t* const p_req,
-  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_req_set(IN const osm_req_t * const p_req,
+	    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 *p_madw;
-  ib_api_status_t status = IB_SUCCESS;
-  ib_net64_t tid;
-
-  CL_ASSERT( p_req );
-
-  OSM_LOG_ENTER( p_req->p_log, osm_req_set );
-
-  CL_ASSERT( p_path );
-  CL_ASSERT( attr_id );
-  CL_ASSERT( p_payload );
-
-  /* do nothing if we are exiting ... */
-  if (osm_exit_flag)
-    goto Exit;
-
-  /* p_context may be NULL. */
-
-  p_madw = osm_mad_pool_get(
-    p_req->p_pool,
-    p_path->h_bind,
-    MAD_BLOCK_SIZE,
-    NULL );
-
-  if( p_madw == NULL )
-  {
-    osm_log( p_req->p_log, OSM_LOG_ERROR,
-             "osm_req_set: ERR 1102: "
-             "Unable to acquire MAD\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
-  tid = cl_hton64( (uint64_t)cl_atomic_inc( p_req->p_sm_trans_id ) );
-
-  if( osm_log_is_active( p_req->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_req->p_log, OSM_LOG_DEBUG,
-             "osm_req_set: "
-             "Setting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64 "\n",
-             ib_get_sm_attr_str( attr_id ),
-             cl_ntoh16( attr_id ),
-             cl_ntoh32( attr_mod ),
-             cl_ntoh64( tid ) );
-  }
-
-  ib_smp_init_new(
-    osm_madw_get_smp_ptr( p_madw ),
-    IB_MAD_METHOD_SET,
-    tid,
-    attr_id,
-    attr_mod,
-    p_path->hop_count,
-    p_req->p_subn->opt.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;
-  p_madw->resp_expected = TRUE;
-  p_madw->fail_msg = err_msg;
-
-  /*
-    Fill in the mad wrapper context for the recipient.
-    In this case, the only thing the recipient needs is the
-    guid value.
-  */
-
-  if( p_context )
-    p_madw->context = *p_context;
-
-  memcpy( osm_madw_get_smp_ptr( p_madw )->data,
-          p_payload, payload_size );
-
-  osm_vl15_post( p_req->p_vl15, p_madw );
-
- Exit:
-  OSM_LOG_EXIT( p_req->p_log );
-  return( status );
+	osm_madw_t *p_madw;
+	ib_api_status_t status = IB_SUCCESS;
+	ib_net64_t tid;
+
+	CL_ASSERT(p_req);
+
+	OSM_LOG_ENTER(p_req->p_log, osm_req_set);
+
+	CL_ASSERT(p_path);
+	CL_ASSERT(attr_id);
+	CL_ASSERT(p_payload);
+
+	/* do nothing if we are exiting ... */
+	if (osm_exit_flag)
+		goto Exit;
+
+	/* p_context may be NULL. */
+
+	p_madw = osm_mad_pool_get(p_req->p_pool,
+				  p_path->h_bind, MAD_BLOCK_SIZE, NULL);
+
+	if (p_madw == NULL) {
+		osm_log(p_req->p_log, OSM_LOG_ERROR,
+			"osm_req_set: ERR 1102: " "Unable to acquire MAD\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+	tid = cl_hton64((uint64_t) cl_atomic_inc(p_req->p_sm_trans_id));
+
+	if (osm_log_is_active(p_req->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_req->p_log, OSM_LOG_DEBUG,
+			"osm_req_set: "
+			"Setting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64 "\n",
+			ib_get_sm_attr_str(attr_id),
+			cl_ntoh16(attr_id),
+			cl_ntoh32(attr_mod), cl_ntoh64(tid));
+	}
+
+	ib_smp_init_new(osm_madw_get_smp_ptr(p_madw),
+			IB_MAD_METHOD_SET,
+			tid,
+			attr_id,
+			attr_mod,
+			p_path->hop_count,
+			p_req->p_subn->opt.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;
+	p_madw->resp_expected = TRUE;
+	p_madw->fail_msg = err_msg;
+
+	/*
+	   Fill in the mad wrapper context for the recipient.
+	   In this case, the only thing the recipient needs is the
+	   guid value.
+	 */
+
+	if (p_context)
+		p_madw->context = *p_context;
+
+	memcpy(osm_madw_get_smp_ptr(p_madw)->data, p_payload, payload_size);
+
+	osm_vl15_post(p_req->p_vl15, p_madw);
+
+      Exit:
+	OSM_LOG_EXIT(p_req->p_log);
+	return (status);
 }
-
diff --git a/opensm/opensm/osm_resp.c b/opensm/opensm/osm_resp.c
index e4c7e75..e5beb45 100644
--- a/opensm/opensm/osm_resp.c
+++ b/opensm/opensm/osm_resp.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of osm_resp_t.
@@ -48,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -65,163 +64,143 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_resp_construct(
-  IN osm_resp_t* const p_resp )
+void osm_resp_construct(IN osm_resp_t * const p_resp)
 {
-  memset( p_resp, 0, sizeof(*p_resp) );
+	memset(p_resp, 0, sizeof(*p_resp));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_resp_destroy(
-  IN osm_resp_t* const p_resp )
+void osm_resp_destroy(IN osm_resp_t * const p_resp)
 {
-  CL_ASSERT( p_resp );
+	CL_ASSERT(p_resp);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_resp_init(
-  IN osm_resp_t*           const p_resp,
-  IN osm_mad_pool_t*    const p_pool,
-  IN osm_vl15_t*           const p_vl15,
-  IN osm_subn_t*           const p_subn,
-  IN osm_log_t*            const p_log )
+osm_resp_init(IN osm_resp_t * const p_resp,
+	      IN osm_mad_pool_t * const p_pool,
+	      IN osm_vl15_t * const p_vl15,
+	      IN osm_subn_t * const p_subn, IN osm_log_t * const p_log)
 {
-  ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_resp_init );
+	OSM_LOG_ENTER(p_log, osm_resp_init);
 
-  osm_resp_construct( p_resp );
+	osm_resp_construct(p_resp);
 
-  p_resp->p_log = p_log;
-  p_resp->p_pool = p_pool;
-  p_resp->p_vl15 = p_vl15;
-  p_resp->p_subn = p_subn;
+	p_resp->p_log = p_log;
+	p_resp->p_pool = p_pool;
+	p_resp->p_vl15 = p_vl15;
+	p_resp->p_subn = p_subn;
 
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-osm_resp_make_resp_smp(
-  IN const osm_resp_t* const p_resp,
-  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 )
+osm_resp_make_resp_smp(IN const osm_resp_t * const p_resp,
+		       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)
 {
-  OSM_LOG_ENTER( p_resp->p_log, osm_resp_make_resp_smp );
-
-  CL_ASSERT( p_dest_smp );
-  CL_ASSERT( p_src_smp );
-  CL_ASSERT( !ib_smp_is_response( p_src_smp ) );
-
-  *p_dest_smp = *p_src_smp;
-  if (p_src_smp->method == IB_MAD_METHOD_GET ||
-      p_src_smp->method == IB_MAD_METHOD_SET ) {
-    p_dest_smp->method = IB_MAD_METHOD_GET_RESP;
-    p_dest_smp->status = status;
-  }
-  else if (p_src_smp->method == IB_MAD_METHOD_TRAP)
-  {
-    p_dest_smp->method = IB_MAD_METHOD_TRAP_REPRESS;
-    p_dest_smp->status = 0;
-  }
-  else
-  {
-    osm_log( p_resp->p_log, OSM_LOG_ERROR,
-             "osm_resp_make_resp_smp: ERR 1302: "
-             "src smp method unsupported 0x%X\n",
-             p_src_smp->method );
-    goto Exit;
-  }
-
-  if (p_src_smp->mgmt_class == IB_MCLASS_SUBN_DIR)
-    p_dest_smp->status |= IB_SMP_DIRECTION;
-
-  p_dest_smp->dr_dlid = p_dest_smp->dr_slid;
-  p_dest_smp->dr_slid = p_dest_smp->dr_dlid;
-  memcpy( &p_dest_smp->data, p_payload, IB_SMP_DATA_SIZE );
-
- Exit:
-  OSM_LOG_EXIT( p_resp->p_log );
+	OSM_LOG_ENTER(p_resp->p_log, osm_resp_make_resp_smp);
+
+	CL_ASSERT(p_dest_smp);
+	CL_ASSERT(p_src_smp);
+	CL_ASSERT(!ib_smp_is_response(p_src_smp));
+
+	*p_dest_smp = *p_src_smp;
+	if (p_src_smp->method == IB_MAD_METHOD_GET ||
+	    p_src_smp->method == IB_MAD_METHOD_SET) {
+		p_dest_smp->method = IB_MAD_METHOD_GET_RESP;
+		p_dest_smp->status = status;
+	} else if (p_src_smp->method == IB_MAD_METHOD_TRAP) {
+		p_dest_smp->method = IB_MAD_METHOD_TRAP_REPRESS;
+		p_dest_smp->status = 0;
+	} else {
+		osm_log(p_resp->p_log, OSM_LOG_ERROR,
+			"osm_resp_make_resp_smp: ERR 1302: "
+			"src smp method unsupported 0x%X\n", p_src_smp->method);
+		goto Exit;
+	}
+
+	if (p_src_smp->mgmt_class == IB_MCLASS_SUBN_DIR)
+		p_dest_smp->status |= IB_SMP_DIRECTION;
+
+	p_dest_smp->dr_dlid = p_dest_smp->dr_slid;
+	p_dest_smp->dr_slid = p_dest_smp->dr_dlid;
+	memcpy(&p_dest_smp->data, p_payload, IB_SMP_DATA_SIZE);
+
+      Exit:
+	OSM_LOG_EXIT(p_resp->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_resp_send(
-  IN const osm_resp_t*     const p_resp,
-  IN const osm_madw_t*     const p_req_madw,
-  IN const ib_net16_t         mad_status,
-  IN const uint8_t*        const p_payload )
+osm_resp_send(IN const osm_resp_t * const p_resp,
+	      IN const osm_madw_t * const p_req_madw,
+	      IN const ib_net16_t mad_status,
+	      IN const uint8_t * const p_payload)
 {
-  const ib_smp_t*          p_req_smp;
-  ib_smp_t*                p_smp;
-  osm_madw_t*              p_madw;
-  ib_api_status_t          status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_resp->p_log, osm_resp_send );
-
-  CL_ASSERT( p_req_madw );
-  CL_ASSERT( p_payload );
-
-  /* do nothing if we are exiting ... */
-  if (osm_exit_flag)
-    goto Exit;
-
-  p_madw = osm_mad_pool_get(
-    p_resp->p_pool,
-    osm_madw_get_bind_handle( p_req_madw ),
-    MAD_BLOCK_SIZE,
-    NULL );
-
-  if( p_madw == NULL )
-  {
-    osm_log( p_resp->p_log, OSM_LOG_ERROR,
-             "osm_resp_send: ERR 1301: "
-             "Unable to acquire MAD\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
-  /*
-    Copy the request smp to the response smp, then just
-    update the necessary fields.
-  */
-  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( p_resp, 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 =
-    p_req_madw->mad_addr.dest_lid;
-
-  p_madw->resp_expected = FALSE;
-  p_madw->fail_msg = CL_DISP_MSGID_NONE;
-
-  if( osm_log_is_active( p_resp->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_resp->p_log, OSM_LOG_DEBUG,
-             "osm_resp_send: "
-             "Responding to %s (0x%X)"
-             "\n\t\t\t\tattribute modifier 0x%X, TID 0x%" PRIx64 "\n",
-             ib_get_sm_attr_str( p_smp->attr_id ),
-             cl_ntoh16( p_smp->attr_id ),
-             cl_ntoh32( p_smp->attr_mod ),
-             cl_ntoh64( p_smp->trans_id ) );
-  }
-
-  osm_vl15_post( p_resp->p_vl15, p_madw );
-
- Exit:
-  OSM_LOG_EXIT( p_resp->p_log );
-  return( status );
+	const ib_smp_t *p_req_smp;
+	ib_smp_t *p_smp;
+	osm_madw_t *p_madw;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_resp->p_log, osm_resp_send);
+
+	CL_ASSERT(p_req_madw);
+	CL_ASSERT(p_payload);
+
+	/* do nothing if we are exiting ... */
+	if (osm_exit_flag)
+		goto Exit;
+
+	p_madw = osm_mad_pool_get(p_resp->p_pool,
+				  osm_madw_get_bind_handle(p_req_madw),
+				  MAD_BLOCK_SIZE, NULL);
+
+	if (p_madw == NULL) {
+		osm_log(p_resp->p_log, OSM_LOG_ERROR,
+			"osm_resp_send: ERR 1301: " "Unable to acquire MAD\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+	/*
+	   Copy the request smp to the response smp, then just
+	   update the necessary fields.
+	 */
+	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(p_resp, 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 =
+	    p_req_madw->mad_addr.dest_lid;
+
+	p_madw->resp_expected = FALSE;
+	p_madw->fail_msg = CL_DISP_MSGID_NONE;
+
+	if (osm_log_is_active(p_resp->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_resp->p_log, OSM_LOG_DEBUG,
+			"osm_resp_send: "
+			"Responding to %s (0x%X)"
+			"\n\t\t\t\tattribute modifier 0x%X, TID 0x%" PRIx64
+			"\n", ib_get_sm_attr_str(p_smp->attr_id),
+			cl_ntoh16(p_smp->attr_id), cl_ntoh32(p_smp->attr_mod),
+			cl_ntoh64(p_smp->trans_id));
+	}
+
+	osm_vl15_post(p_resp->p_vl15, p_madw);
+
+      Exit:
+	OSM_LOG_EXIT(p_resp->p_log);
+	return (status);
 }
diff --git a/opensm/opensm/osm_router.c b/opensm/opensm/osm_router.c
index d719618..8b93fd6 100644
--- a/opensm/opensm/osm_router.c
+++ b/opensm/opensm/osm_router.c
@@ -46,7 +46,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <string.h>
@@ -55,30 +55,25 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_router_delete(
-  IN OUT osm_router_t** const pp_rtr )
+void osm_router_delete(IN OUT osm_router_t ** const pp_rtr)
 {
-  free( *pp_rtr );
-  *pp_rtr = NULL;
+	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 * const p_port)
 {
-  osm_router_t *p_rtr;
+	osm_router_t *p_rtr;
 
-  CL_ASSERT( p_port );
+	CL_ASSERT(p_port);
 
-  p_rtr = (osm_router_t*)malloc( sizeof(*p_rtr) );
-  if( p_rtr )
-  {
-    memset( p_rtr, 0, sizeof(*p_rtr) );
-    p_rtr->p_port = p_port;
-  }
+	p_rtr = (osm_router_t *) 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/opensm/osm_sa.c b/opensm/opensm/osm_sa.c
index 8528a61..e49bfba 100644
--- a/opensm/opensm/osm_sa.c
+++ b/opensm/opensm/osm_sa.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <ctype.h>
@@ -74,449 +74,376 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sa_construct(
-  IN osm_sa_t* const p_sa )
+void osm_sa_construct(IN osm_sa_t * const p_sa)
 {
-  memset( p_sa, 0, sizeof(*p_sa) );
-  p_sa->state = OSM_SA_STATE_INIT;
-  p_sa->sa_trans_id = OSM_SA_INITIAL_TID_VALUE;
-
-  osm_sa_resp_construct( &p_sa->resp );
-  osm_nr_rcv_construct( &p_sa->nr_rcv);
-  osm_pir_rcv_construct( &p_sa->pir_rcv );
-  osm_gir_rcv_construct( &p_sa->gir_rcv );
-  osm_lr_rcv_construct( &p_sa->lr_rcv );
-  osm_pr_rcv_construct( &p_sa->pr_rcv );
+	memset(p_sa, 0, sizeof(*p_sa));
+	p_sa->state = OSM_SA_STATE_INIT;
+	p_sa->sa_trans_id = OSM_SA_INITIAL_TID_VALUE;
+
+	osm_sa_resp_construct(&p_sa->resp);
+	osm_nr_rcv_construct(&p_sa->nr_rcv);
+	osm_pir_rcv_construct(&p_sa->pir_rcv);
+	osm_gir_rcv_construct(&p_sa->gir_rcv);
+	osm_lr_rcv_construct(&p_sa->lr_rcv);
+	osm_pr_rcv_construct(&p_sa->pr_rcv);
 #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
-  osm_mpr_rcv_construct( &p_sa->mpr_rcv );
+	osm_mpr_rcv_construct(&p_sa->mpr_rcv);
 #endif
-  osm_smir_rcv_construct( &p_sa->smir_rcv );
-  osm_mcmr_rcv_construct(&p_sa->mcmr_rcv );
-  osm_sr_rcv_construct( &p_sa->sr_rcv );
-  osm_infr_rcv_construct( &p_sa->infr_rcv );
-  osm_vlarb_rec_rcv_construct( &p_sa->vlarb_rec_rcv );
-  osm_slvl_rec_rcv_construct( &p_sa->slvl_rec_rcv );
-  osm_pkey_rec_rcv_construct( &p_sa->pkey_rec_rcv );
-  osm_lftr_rcv_construct( &p_sa->lftr_rcv );
-  osm_sir_rcv_construct( &p_sa->sir_rcv );
-  osm_mftr_rcv_construct( &p_sa->mftr_rcv );
+	osm_smir_rcv_construct(&p_sa->smir_rcv);
+	osm_mcmr_rcv_construct(&p_sa->mcmr_rcv);
+	osm_sr_rcv_construct(&p_sa->sr_rcv);
+	osm_infr_rcv_construct(&p_sa->infr_rcv);
+	osm_vlarb_rec_rcv_construct(&p_sa->vlarb_rec_rcv);
+	osm_slvl_rec_rcv_construct(&p_sa->slvl_rec_rcv);
+	osm_pkey_rec_rcv_construct(&p_sa->pkey_rec_rcv);
+	osm_lftr_rcv_construct(&p_sa->lftr_rcv);
+	osm_sir_rcv_construct(&p_sa->sir_rcv);
+	osm_mftr_rcv_construct(&p_sa->mftr_rcv);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sa_shutdown(
-  IN osm_sa_t* const p_sa )
+void osm_sa_shutdown(IN osm_sa_t * const p_sa)
 {
-  ib_api_status_t status;
-  OSM_LOG_ENTER( p_sa->p_log, osm_sa_shutdown );
-
-  /* unbind from the mad service */
-  status = osm_sa_mad_ctrl_unbind( &p_sa->mad_ctrl );
-
-  /* remove any registered dispatcher message */
-  cl_disp_unregister( p_sa->nr_disp_h );
-  cl_disp_unregister( p_sa->pir_disp_h );
-  cl_disp_unregister( p_sa->gir_disp_h );
-  cl_disp_unregister( p_sa->lr_disp_h );
-  cl_disp_unregister( p_sa->pr_disp_h );
+	ib_api_status_t status;
+	OSM_LOG_ENTER(p_sa->p_log, osm_sa_shutdown);
+
+	/* unbind from the mad service */
+	status = osm_sa_mad_ctrl_unbind(&p_sa->mad_ctrl);
+
+	/* remove any registered dispatcher message */
+	cl_disp_unregister(p_sa->nr_disp_h);
+	cl_disp_unregister(p_sa->pir_disp_h);
+	cl_disp_unregister(p_sa->gir_disp_h);
+	cl_disp_unregister(p_sa->lr_disp_h);
+	cl_disp_unregister(p_sa->pr_disp_h);
 #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
-  cl_disp_unregister( p_sa->mpr_disp_h );
+	cl_disp_unregister(p_sa->mpr_disp_h);
 #endif
-  cl_disp_unregister( p_sa->smir_disp_h );
-  cl_disp_unregister( p_sa->mcmr_disp_h);
-  cl_disp_unregister( p_sa->sr_disp_h );
-  cl_disp_unregister( p_sa->infr_disp_h );
-  cl_disp_unregister( p_sa->infir_disp_h );
-  cl_disp_unregister( p_sa->vlarb_disp_h );
-  cl_disp_unregister( p_sa->slvl_disp_h );
-  cl_disp_unregister( p_sa->pkey_disp_h );
-  cl_disp_unregister( p_sa->lft_disp_h );
-  cl_disp_unregister( p_sa->sir_disp_h );
-  cl_disp_unregister( p_sa->mft_disp_h );
-  osm_sa_mad_ctrl_destroy( &p_sa->mad_ctrl );
-
-  OSM_LOG_EXIT( p_sa->p_log );
+	cl_disp_unregister(p_sa->smir_disp_h);
+	cl_disp_unregister(p_sa->mcmr_disp_h);
+	cl_disp_unregister(p_sa->sr_disp_h);
+	cl_disp_unregister(p_sa->infr_disp_h);
+	cl_disp_unregister(p_sa->infir_disp_h);
+	cl_disp_unregister(p_sa->vlarb_disp_h);
+	cl_disp_unregister(p_sa->slvl_disp_h);
+	cl_disp_unregister(p_sa->pkey_disp_h);
+	cl_disp_unregister(p_sa->lft_disp_h);
+	cl_disp_unregister(p_sa->sir_disp_h);
+	cl_disp_unregister(p_sa->mft_disp_h);
+	osm_sa_mad_ctrl_destroy(&p_sa->mad_ctrl);
+
+	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 * const p_sa)
 {
-  OSM_LOG_ENTER( p_sa->p_log, osm_sa_destroy );
+	OSM_LOG_ENTER(p_sa->p_log, osm_sa_destroy);
 
-  p_sa->state = OSM_SA_STATE_INIT;
+	p_sa->state = OSM_SA_STATE_INIT;
 
-  osm_nr_rcv_destroy( &p_sa->nr_rcv );
-  osm_pir_rcv_destroy( &p_sa->pir_rcv );
-  osm_gir_rcv_destroy( &p_sa->gir_rcv );
-  osm_lr_rcv_destroy( &p_sa->lr_rcv );
-  osm_pr_rcv_destroy( &p_sa->pr_rcv );
+	osm_nr_rcv_destroy(&p_sa->nr_rcv);
+	osm_pir_rcv_destroy(&p_sa->pir_rcv);
+	osm_gir_rcv_destroy(&p_sa->gir_rcv);
+	osm_lr_rcv_destroy(&p_sa->lr_rcv);
+	osm_pr_rcv_destroy(&p_sa->pr_rcv);
 #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
-  osm_mpr_rcv_destroy( &p_sa->mpr_rcv );
+	osm_mpr_rcv_destroy(&p_sa->mpr_rcv);
 #endif
-  osm_smir_rcv_destroy( &p_sa->smir_rcv );
-  osm_mcmr_rcv_destroy(&p_sa->mcmr_rcv);
-  osm_sr_rcv_destroy( &p_sa->sr_rcv );
-  osm_infr_rcv_destroy( &p_sa->infr_rcv );
-  osm_vlarb_rec_rcv_destroy( &p_sa->vlarb_rec_rcv );
-  osm_slvl_rec_rcv_destroy( &p_sa->slvl_rec_rcv );
-  osm_pkey_rec_rcv_destroy( &p_sa->pkey_rec_rcv );
-  osm_lftr_rcv_destroy( &p_sa->lftr_rcv );
-  osm_sir_rcv_destroy( &p_sa->sir_rcv );
-  osm_mftr_rcv_destroy( &p_sa->mftr_rcv );
-  osm_sa_resp_destroy( &p_sa->resp );
-
-  OSM_LOG_EXIT( p_sa->p_log );
+	osm_smir_rcv_destroy(&p_sa->smir_rcv);
+	osm_mcmr_rcv_destroy(&p_sa->mcmr_rcv);
+	osm_sr_rcv_destroy(&p_sa->sr_rcv);
+	osm_infr_rcv_destroy(&p_sa->infr_rcv);
+	osm_vlarb_rec_rcv_destroy(&p_sa->vlarb_rec_rcv);
+	osm_slvl_rec_rcv_destroy(&p_sa->slvl_rec_rcv);
+	osm_pkey_rec_rcv_destroy(&p_sa->pkey_rec_rcv);
+	osm_lftr_rcv_destroy(&p_sa->lftr_rcv);
+	osm_sir_rcv_destroy(&p_sa->sir_rcv);
+	osm_mftr_rcv_destroy(&p_sa->mftr_rcv);
+	osm_sa_resp_destroy(&p_sa->resp);
+
+	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 )
+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 status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_log, osm_sa_init );
-
-  p_sa->p_subn = p_subn;
-  p_sa->p_vendor = p_vendor;
-  p_sa->p_mad_pool = p_mad_pool;
-  p_sa->p_log = p_log;
-  p_sa->p_disp = p_disp;
-  p_sa->p_lock = p_lock;
-
-  p_sa->state = OSM_SA_STATE_READY;
-
-  status = osm_sa_resp_init(&p_sa->resp,
-                            p_sa->p_mad_pool,
-                            p_log);
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_sa_mad_ctrl_init(
-    &p_sa->mad_ctrl,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_sa->p_vendor,
-    p_subn,
-    p_log,
-    p_stats,
-    p_disp );
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_cpi_rcv_init(
-    &p_sa->cpi_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock );
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_nr_rcv_init(
-    &p_sa->nr_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock );
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_pir_rcv_init(
-    &p_sa->pir_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock );
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_gir_rcv_init(
-    &p_sa->gir_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock );
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_lr_rcv_init(
-    &p_sa->lr_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock );
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_pr_rcv_init(
-    &p_sa->pr_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock );
-  if( status != IB_SUCCESS )
-    goto Exit;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_log, osm_sa_init);
+
+	p_sa->p_subn = p_subn;
+	p_sa->p_vendor = p_vendor;
+	p_sa->p_mad_pool = p_mad_pool;
+	p_sa->p_log = p_log;
+	p_sa->p_disp = p_disp;
+	p_sa->p_lock = p_lock;
+
+	p_sa->state = OSM_SA_STATE_READY;
+
+	status = osm_sa_resp_init(&p_sa->resp, p_sa->p_mad_pool, p_log);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_sa_mad_ctrl_init(&p_sa->mad_ctrl,
+				      &p_sa->resp,
+				      p_sa->p_mad_pool,
+				      p_sa->p_vendor,
+				      p_subn, p_log, p_stats, p_disp);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_cpi_rcv_init(&p_sa->cpi_rcv,
+				  &p_sa->resp,
+				  p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_nr_rcv_init(&p_sa->nr_rcv,
+				 &p_sa->resp,
+				 p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_pir_rcv_init(&p_sa->pir_rcv,
+				  &p_sa->resp,
+				  p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_gir_rcv_init(&p_sa->gir_rcv,
+				  &p_sa->resp,
+				  p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_lr_rcv_init(&p_sa->lr_rcv,
+				 &p_sa->resp,
+				 p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_pr_rcv_init(&p_sa->pr_rcv,
+				 &p_sa->resp,
+				 p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
 
 #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
-  status = osm_mpr_rcv_init(
-    &p_sa->mpr_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock );
-  if( status != IB_SUCCESS )
-    goto Exit;
+	status = osm_mpr_rcv_init(&p_sa->mpr_rcv,
+				  &p_sa->resp,
+				  p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
 #endif
 
-  status = osm_smir_rcv_init(
-    &p_sa->smir_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_stats,
-    p_log,
-    p_lock );
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_mcmr_rcv_init(
-    p_sm,
-    &p_sa->mcmr_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock);
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_sr_rcv_init(
-    &p_sa->sr_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock);
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_infr_rcv_init(
-    &p_sa->infr_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock);
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_vlarb_rec_rcv_init(
-    &p_sa->vlarb_rec_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock);
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_slvl_rec_rcv_init(
-    &p_sa->slvl_rec_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock);
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_pkey_rec_rcv_init(
-    &p_sa->pkey_rec_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock);
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_lftr_rcv_init(
-    &p_sa->lftr_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock);
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_sir_rcv_init(
-    &p_sa->sir_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock);
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  status = osm_mftr_rcv_init(
-    &p_sa->mftr_rcv,
-    &p_sa->resp,
-    p_sa->p_mad_pool,
-    p_subn,
-    p_log,
-    p_lock);
-  if( status != IB_SUCCESS )
-    goto Exit;
-
-  p_sa->cpi_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_CLASS_PORT_INFO,
-                                      osm_cpi_rcv_process, &p_sa->cpi_rcv);
-  if( p_sa->cpi_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
-  p_sa->nr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NODE_RECORD,
-                                     osm_nr_rcv_process, &p_sa->nr_rcv);
-  if( p_sa->nr_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
-  p_sa->pir_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PORTINFO_RECORD,
-                                      osm_pir_rcv_process, &p_sa->pir_rcv);
-  if( p_sa->pir_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
-  p_sa->gir_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_GUIDINFO_RECORD,
-                                      osm_gir_rcv_process, &p_sa->gir_rcv);
-  if( p_sa->gir_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
-  p_sa->lr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_LINK_RECORD,
-                                     osm_lr_rcv_process, &p_sa->lr_rcv);
-  if( p_sa->lr_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
-  p_sa->pr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PATH_RECORD,
-                                     osm_pr_rcv_process, &p_sa->pr_rcv);
-  if( p_sa->pr_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
+	status = osm_smir_rcv_init(&p_sa->smir_rcv,
+				   &p_sa->resp,
+				   p_sa->p_mad_pool,
+				   p_subn, p_stats, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_mcmr_rcv_init(p_sm,
+				   &p_sa->mcmr_rcv,
+				   &p_sa->resp,
+				   p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_sr_rcv_init(&p_sa->sr_rcv,
+				 &p_sa->resp,
+				 p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_infr_rcv_init(&p_sa->infr_rcv,
+				   &p_sa->resp,
+				   p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_vlarb_rec_rcv_init(&p_sa->vlarb_rec_rcv,
+					&p_sa->resp,
+					p_sa->p_mad_pool,
+					p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_slvl_rec_rcv_init(&p_sa->slvl_rec_rcv,
+				       &p_sa->resp,
+				       p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_pkey_rec_rcv_init(&p_sa->pkey_rec_rcv,
+				       &p_sa->resp,
+				       p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_lftr_rcv_init(&p_sa->lftr_rcv,
+				   &p_sa->resp,
+				   p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_sir_rcv_init(&p_sa->sir_rcv,
+				  &p_sa->resp,
+				  p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_mftr_rcv_init(&p_sa->mftr_rcv,
+				   &p_sa->resp,
+				   p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	p_sa->cpi_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_CLASS_PORT_INFO,
+					    osm_cpi_rcv_process,
+					    &p_sa->cpi_rcv);
+	if (p_sa->cpi_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sa->nr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NODE_RECORD,
+					   osm_nr_rcv_process, &p_sa->nr_rcv);
+	if (p_sa->nr_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sa->pir_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PORTINFO_RECORD,
+					    osm_pir_rcv_process,
+					    &p_sa->pir_rcv);
+	if (p_sa->pir_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sa->gir_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_GUIDINFO_RECORD,
+					    osm_gir_rcv_process,
+					    &p_sa->gir_rcv);
+	if (p_sa->gir_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sa->lr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_LINK_RECORD,
+					   osm_lr_rcv_process, &p_sa->lr_rcv);
+	if (p_sa->lr_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sa->pr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PATH_RECORD,
+					   osm_pr_rcv_process, &p_sa->pr_rcv);
+	if (p_sa->pr_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
 
 #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
-  p_sa->mpr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_MULTIPATH_RECORD,
-                                      osm_mpr_rcv_process, &p_sa->mpr_rcv);
-  if( p_sa->mpr_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
+	p_sa->mpr_disp_h =
+	    cl_disp_register(p_disp, OSM_MSG_MAD_MULTIPATH_RECORD,
+			     osm_mpr_rcv_process, &p_sa->mpr_rcv);
+	if (p_sa->mpr_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
 #endif
 
-  p_sa->smir_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SMINFO_RECORD,
-                                       osm_smir_rcv_process, &p_sa->smir_rcv);
-  if( p_sa->smir_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
-  p_sa->mcmr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_MCMEMBER_RECORD,
-                                       osm_mcmr_rcv_process, &p_sa->mcmr_rcv);
-  if( p_sa->mcmr_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
-  p_sa->sr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SERVICE_RECORD,
-                                     osm_sr_rcv_process, &p_sa->sr_rcv);
-  if( p_sa->sr_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
-  p_sa->infr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_INFORM_INFO,
-                                       osm_infr_rcv_process, &p_sa->infr_rcv);
-  if( p_sa->infr_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
-  p_sa->infir_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_INFORM_INFO_RECORD,
-                                        osm_infir_rcv_process, &p_sa->infr_rcv);
-  if( p_sa->infir_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
-  p_sa->vlarb_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_VL_ARB_RECORD,
-                                        osm_vlarb_rec_rcv_process,
-                                        &p_sa->vlarb_rec_rcv);
-  if( p_sa->vlarb_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
-  p_sa->slvl_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SLVL_TBL_RECORD,
-                                       osm_slvl_rec_rcv_process,
-                                       &p_sa->slvl_rec_rcv);
-  if( p_sa->slvl_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
-  p_sa->pkey_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PKEY_TBL_RECORD,
-                                       osm_pkey_rec_rcv_process,
-                                       &p_sa->pkey_rec_rcv);
-  if( p_sa->pkey_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
-  p_sa->lft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_LFT_RECORD,
-                                      osm_lftr_rcv_process, &p_sa->lftr_rcv);
-  if( p_sa->lft_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
-  p_sa->sir_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SWITCH_INFO_RECORD,
-                                      osm_sir_rcv_process, &p_sa->sir_rcv);
-  if( p_sa->sir_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
-  p_sa->mft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_MFT_RECORD,
-                                      osm_mftr_rcv_process, &p_sa->mftr_rcv);
-  if( p_sa->mft_disp_h == CL_DISP_INVALID_HANDLE )
-    goto Exit;
-
- Exit:
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	p_sa->smir_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SMINFO_RECORD,
+					     osm_smir_rcv_process,
+					     &p_sa->smir_rcv);
+	if (p_sa->smir_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sa->mcmr_disp_h =
+	    cl_disp_register(p_disp, OSM_MSG_MAD_MCMEMBER_RECORD,
+			     osm_mcmr_rcv_process, &p_sa->mcmr_rcv);
+	if (p_sa->mcmr_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sa->sr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SERVICE_RECORD,
+					   osm_sr_rcv_process, &p_sa->sr_rcv);
+	if (p_sa->sr_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sa->infr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_INFORM_INFO,
+					     osm_infr_rcv_process,
+					     &p_sa->infr_rcv);
+	if (p_sa->infr_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sa->infir_disp_h =
+	    cl_disp_register(p_disp, OSM_MSG_MAD_INFORM_INFO_RECORD,
+			     osm_infir_rcv_process, &p_sa->infr_rcv);
+	if (p_sa->infir_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sa->vlarb_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_VL_ARB_RECORD,
+					      osm_vlarb_rec_rcv_process,
+					      &p_sa->vlarb_rec_rcv);
+	if (p_sa->vlarb_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sa->slvl_disp_h =
+	    cl_disp_register(p_disp, OSM_MSG_MAD_SLVL_TBL_RECORD,
+			     osm_slvl_rec_rcv_process, &p_sa->slvl_rec_rcv);
+	if (p_sa->slvl_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sa->pkey_disp_h =
+	    cl_disp_register(p_disp, OSM_MSG_MAD_PKEY_TBL_RECORD,
+			     osm_pkey_rec_rcv_process, &p_sa->pkey_rec_rcv);
+	if (p_sa->pkey_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sa->lft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_LFT_RECORD,
+					    osm_lftr_rcv_process,
+					    &p_sa->lftr_rcv);
+	if (p_sa->lft_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sa->sir_disp_h =
+	    cl_disp_register(p_disp, OSM_MSG_MAD_SWITCH_INFO_RECORD,
+			     osm_sir_rcv_process, &p_sa->sir_rcv);
+	if (p_sa->sir_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sa->mft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_MFT_RECORD,
+					    osm_mftr_rcv_process,
+					    &p_sa->mftr_rcv);
+	if (p_sa->mft_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+      Exit:
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_sa_bind(
-  IN osm_sa_t* const p_sa,
-  IN const ib_net64_t port_guid )
+osm_sa_bind(IN osm_sa_t * const p_sa, IN const ib_net64_t port_guid)
 {
-  ib_api_status_t status;
+	ib_api_status_t status;
 
-  OSM_LOG_ENTER( p_sa->p_log, osm_sa_bind );
+	OSM_LOG_ENTER(p_sa->p_log, osm_sa_bind);
 
-  status = osm_sa_mad_ctrl_bind( &p_sa->mad_ctrl, port_guid );
+	status = osm_sa_mad_ctrl_bind(&p_sa->mad_ctrl, port_guid);
 
-  if( status != IB_SUCCESS )
-  {
-    osm_log( p_sa->p_log, OSM_LOG_ERROR,
-             "osm_sa_bind: ERR 4C03: "
-             "SA MAD Controller bind failed (%s)\n",
-             ib_get_err_str( status ) );
-    goto Exit;
-  }
+	if (status != IB_SUCCESS) {
+		osm_log(p_sa->p_log, OSM_LOG_ERROR,
+			"osm_sa_bind: ERR 4C03: "
+			"SA MAD Controller bind failed (%s)\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
 
- Exit:
-  OSM_LOG_EXIT( p_sa->p_log );
-  return( status );
+      Exit:
+	OSM_LOG_EXIT(p_sa->p_log);
+	return (status);
 }
 
 /**********************************************************************
@@ -532,11 +459,11 @@ struct opensm_dump_context {
 };
 
 static int
-opensm_dump_to_file(osm_opensm_t *p_osm, const char *file_name,
-		    void (*dump_func)(osm_opensm_t *p_osm, FILE *file))
+opensm_dump_to_file(osm_opensm_t * p_osm, const char *file_name,
+		    void (*dump_func) (osm_opensm_t * p_osm, FILE * file))
 {
 	char path[1024];
-	FILE  *file;
+	FILE *file;
 
 	snprintf(path, sizeof(path), "%s/%s",
 		 p_osm->subn.opt.dump_files_dir, file_name);
@@ -550,7 +477,7 @@ opensm_dump_to_file(osm_opensm_t *p_osm, const char *file_name,
 		return -1;
 	}
 
-	chmod(path, S_IRUSR|S_IWUSR);
+	chmod(path, S_IRUSR | S_IWUSR);
 
 	dump_func(p_osm, file);
 
@@ -558,28 +485,25 @@ opensm_dump_to_file(osm_opensm_t *p_osm, const char *file_name,
 	return 0;
 }
 
-static void
-mcast_mgr_dump_one_port(cl_map_item_t *p_map_item, void *cxt)
+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_port_t *p_mcm_port = (osm_mcm_port_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);
+		p_mcm_port->scope_state, p_mcm_port->proxy_join);
 }
 
-static void
-sa_dump_one_mgrp(cl_map_item_t *p_map_item, void *cxt)
+static void sa_dump_one_mgrp(cl_map_item_t * p_map_item, void *cxt)
 {
 	struct opensm_dump_context dump_context;
 	osm_opensm_t *p_osm = ((struct opensm_dump_context *)cxt)->p_osm;
 	FILE *file = ((struct opensm_dump_context *)cxt)->file;
-	osm_mgrp_t *p_mgrp = (osm_mgrp_t *)p_map_item;
+	osm_mgrp_t *p_mgrp = (osm_mgrp_t *) p_map_item;
 
 	fprintf(file, "MC Group 0x%04x %s:"
 		" mgid=0x%016" PRIx64 ":0x%016" PRIx64
@@ -602,8 +526,7 @@ sa_dump_one_mgrp(cl_map_item_t *p_map_item, void *cxt)
 		p_mgrp->mcmember_rec.pkt_life,
 		cl_ntoh32(p_mgrp->mcmember_rec.sl_flow_hop),
 		p_mgrp->mcmember_rec.scope_state,
-		p_mgrp->mcmember_rec.proxy_join
-		);
+		p_mgrp->mcmember_rec.proxy_join);
 
 	dump_context.p_osm = p_osm;
 	dump_context.file = file;
@@ -612,11 +535,10 @@ sa_dump_one_mgrp(cl_map_item_t *p_map_item, void *cxt)
 			   mcast_mgr_dump_one_port, &dump_context);
 }
 
-static void
-sa_dump_one_inform(cl_list_item_t *p_list_item, void *cxt)
+static void sa_dump_one_inform(cl_list_item_t * p_list_item, void *cxt)
 {
 	FILE *file = ((struct opensm_dump_context *)cxt)->file;
-	osm_infr_t *p_infr = (osm_infr_t *)p_list_item;
+	osm_infr_t *p_infr = (osm_infr_t *) p_list_item;
 	ib_inform_info_record_t *p_iir = &p_infr->inform_record;
 
 	fprintf(file, "InformInfo Record:"
@@ -657,11 +579,10 @@ sa_dump_one_inform(cl_list_item_t *p_list_item, void *cxt)
 		p_infr->report_addr.addr_type.gsi.service_level);
 }
 
-static void
-sa_dump_one_service(cl_list_item_t *p_list_item, void *cxt)
+static void sa_dump_one_service(cl_list_item_t * p_list_item, void *cxt)
 {
 	FILE *file = ((struct opensm_dump_context *)cxt)->file;
-	osm_svcr_t *p_svcr = (osm_svcr_t *)p_list_item;
+	osm_svcr_t *p_svcr = (osm_svcr_t *) p_list_item;
 	ib_service_record_t *p_sr = &p_svcr->service_record;
 
 	fprintf(file, "Service Record: id=0x%016" PRIx64
@@ -677,11 +598,11 @@ sa_dump_one_service(cl_list_item_t *p_list_item, void *cxt)
 		" data32=0x%08x%08x:0x%08x%08x"
 		" data64=0x%016" PRIx64 ":0x%016" PRIx64
 		" modified_time=0x%x lease_period=0x%x\n\n",
-		cl_ntoh64( p_sr->service_id ),
-		cl_ntoh64( p_sr->service_gid.unicast.prefix ),
-		cl_ntoh64( p_sr->service_gid.unicast.interface_id ),
-		cl_ntoh16( p_sr->service_pkey ),
-		cl_ntoh32( p_sr->service_lease ),
+		cl_ntoh64(p_sr->service_id),
+		cl_ntoh64(p_sr->service_gid.unicast.prefix),
+		cl_ntoh64(p_sr->service_gid.unicast.interface_id),
+		cl_ntoh16(p_sr->service_pkey),
+		cl_ntoh32(p_sr->service_lease),
 		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],
@@ -716,14 +637,14 @@ 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_all_sa(osm_opensm_t *p_osm, FILE *file)
+static void sa_dump_all_sa(osm_opensm_t * p_osm, FILE * file)
 {
 	struct opensm_dump_context dump_context;
 
 	dump_context.p_osm = p_osm;
 	dump_context.file = file;
-	osm_log(&p_osm->log, OSM_LOG_DEBUG, "sa_dump_all_sa: Dump multicast:\n");
+	osm_log(&p_osm->log, OSM_LOG_DEBUG,
+		"sa_dump_all_sa: Dump multicast:\n");
 	cl_plock_acquire(&p_osm->lock);
 	cl_qmap_apply_func(&p_osm->subn.mgrp_mlid_tbl,
 			   sa_dump_one_mgrp, &dump_context);
@@ -736,7 +657,7 @@ sa_dump_all_sa(osm_opensm_t *p_osm, FILE *file)
 	cl_plock_release(&p_osm->lock);
 }
 
-int osm_sa_db_file_dump(osm_opensm_t *p_osm)
+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);
 }
@@ -744,8 +665,8 @@ int osm_sa_db_file_dump(osm_opensm_t *p_osm)
 /*
  *  SA DB Loader
  */
-osm_mgrp_t *load_mcgroup(osm_opensm_t *p_osm, ib_net16_t mlid,
-			 ib_member_rec_t *p_mcm_rec, unsigned well_known)
+osm_mgrp_t *load_mcgroup(osm_opensm_t * p_osm, ib_net16_t mlid,
+			 ib_member_rec_t * p_mcm_rec, unsigned well_known)
 {
 	ib_net64_t comp_mask;
 	cl_map_item_t *p_next;
@@ -754,8 +675,8 @@ osm_mgrp_t *load_mcgroup(osm_opensm_t *p_osm, ib_net16_t mlid,
 	cl_plock_excl_acquire(&p_osm->lock);
 
 	if ((p_next = cl_qmap_get(&p_osm->subn.mgrp_mlid_tbl, mlid)) !=
-	     cl_qmap_end(&p_osm->subn.mgrp_mlid_tbl)) {
-		p_mgrp = (osm_mgrp_t *)p_next;
+	    cl_qmap_end(&p_osm->subn.mgrp_mlid_tbl)) {
+		p_mgrp = (osm_mgrp_t *) p_next;
 		if (!memcmp(&p_mgrp->mcmember_rec.mgid, &p_mcm_rec->mgid,
 			    sizeof(ib_gid_t))) {
 			osm_log(&p_osm->log, OSM_LOG_DEBUG,
@@ -769,10 +690,10 @@ osm_mgrp_t *load_mcgroup(osm_opensm_t *p_osm, ib_net16_t mlid,
 			cl_ntoh16(mlid));
 		p_mgrp = NULL;
 		goto _out;
-        }
+	}
 
 	comp_mask = IB_MCR_COMPMASK_MTU | IB_MCR_COMPMASK_MTU_SEL
-			| IB_MCR_COMPMASK_RATE | IB_MCR_COMPMASK_RATE_SEL;
+	    | IB_MCR_COMPMASK_RATE | IB_MCR_COMPMASK_RATE_SEL;
 	if (osm_mcmr_rcv_find_or_create_new_mgrp(&p_osm->sa.mcmr_rcv,
 						 comp_mask, p_mcm_rec,
 						 &p_mgrp) != IB_SUCCESS ||
@@ -783,18 +704,17 @@ osm_mgrp_t *load_mcgroup(osm_opensm_t *p_osm, ib_net16_t mlid,
 			cl_ntoh16(mlid),
 			cl_ntoh64(p_mcm_rec->mgid.unicast.prefix),
 			cl_ntoh64(p_mcm_rec->mgid.unicast.interface_id));
-		p_mgrp=NULL;
-	}
-	else if (well_known)
+		p_mgrp = NULL;
+	} else if (well_known)
 		p_mgrp->well_known = TRUE;
 
-  _out:
+      _out:
 	cl_plock_release(&p_osm->lock);
 
 	return p_mgrp;
 }
 
-static int load_svcr(osm_opensm_t *p_osm, ib_service_record_t *sr,
+static int load_svcr(osm_opensm_t * p_osm, ib_service_record_t * sr,
 		     uint32_t modified_time, uint32_t lease_period)
 {
 	osm_svcr_t *p_svcr;
@@ -802,7 +722,7 @@ static int load_svcr(osm_opensm_t *p_osm, ib_service_record_t *sr,
 
 	cl_plock_excl_acquire(&p_osm->lock);
 
-	if(osm_svcr_get_by_rid(&p_osm->subn, &p_osm->log, sr)) {
+	if (osm_svcr_get_by_rid(&p_osm->subn, &p_osm->log, sr)) {
 		osm_log(&p_osm->log, OSM_LOG_VERBOSE,
 			"load_svcr: ServiceRecord already exists\n");
 		goto _out;
@@ -826,14 +746,14 @@ static int load_svcr(osm_opensm_t *p_osm, ib_service_record_t *sr,
 	if (lease_period != 0xffffffff)
 		cl_timer_trim(&p_osm->sa.sr_rcv.sr_timer, 1000);
 
-  _out:
+      _out:
 	cl_plock_release(&p_osm->lock);
 
 	return ret;
 }
 
-static int load_infr(osm_opensm_t *p_osm, ib_inform_info_record_t *iir,
-		     osm_mad_addr_t *addr)
+static int load_infr(osm_opensm_t * p_osm, ib_inform_info_record_t * iir,
+		     osm_mad_addr_t * addr)
 {
 	osm_infr_t infr, *p_infr;
 	int ret = 0;
@@ -864,13 +784,12 @@ static int load_infr(osm_opensm_t *p_osm, ib_inform_info_record_t *iir,
 
 	osm_infr_insert_to_db(&p_osm->subn, &p_osm->log, p_infr);
 
-  _out:
+      _out:
 	cl_plock_release(&p_osm->lock);
 
 	return ret;
 }
 
-
 #define UNPACK_FUNC(name,x) \
 int unpack_##name##x(char *p, uint##x##_t *val_ptr) \
 { \
@@ -888,12 +807,12 @@ int unpack_##name##x(char *p, uint##x##_t *val_ptr) \
 
 #define cl_hton8(x) (x)
 
-UNPACK_FUNC(net,8);
-UNPACK_FUNC(net,16);
-UNPACK_FUNC(net,32);
-UNPACK_FUNC(net,64);
+UNPACK_FUNC(net, 8);
+UNPACK_FUNC(net, 16);
+UNPACK_FUNC(net, 32);
+UNPACK_FUNC(net, 64);
 
-static int unpack_string(char *p, uint8_t *buf, unsigned len)
+static int unpack_string(char *p, uint8_t * buf, unsigned len)
 {
 	char *q = p;
 	char delim = ' ';
@@ -908,7 +827,7 @@ static int unpack_string(char *p, uint8_t *buf, unsigned len)
 	return (int)(q - p);
 }
 
-static int unpack_string64(char *p, uint8_t *buf)
+static int unpack_string64(char *p, uint8_t * buf)
 {
 	return unpack_string(p, buf, 64);
 }
@@ -934,7 +853,7 @@ static int unpack_string64(char *p, uint8_t *buf)
 	p += _ret; \
 }
 
-int osm_sa_db_file_load(osm_opensm_t *p_osm)
+int osm_sa_db_file_load(osm_opensm_t * p_osm)
 {
 	char line[1024];
 	char *file_name;
@@ -954,7 +873,7 @@ 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,
+		osm_log(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS,
 			"osm_sa_db_file_load: ERR 4C02: "
 			"cannot open sa db file \'%s\'. "
 			"Skip restoring\n", file_name);
@@ -985,7 +904,7 @@ int osm_sa_db_file_load(osm_opensm_t *p_osm)
 			memset(&mcm_rec, 0, sizeof(mcm_rec));
 
 			PARSE_AHEAD(p, net16, " 0x", &mlid);
-			if(strstr(p, "well known"))
+			if (strstr(p, "well known"))
 				well_known = 1;
 			PARSE_AHEAD(p, net64, " mgid=0x",
 				    &mcm_rec.mgid.unicast.prefix);
@@ -1013,8 +932,7 @@ int osm_sa_db_file_load(osm_opensm_t *p_osm)
 					      well_known);
 			if (!p_mgrp)
 				rereg_clients = 1;
-		}
-		else if (p_mgrp && !strncmp(p, "mcm_port", 8)) {
+		} else if (p_mgrp && !strncmp(p, "mcm_port", 8)) {
 			ib_gid_t port_gid;
 			ib_net64_t guid;
 			uint8_t scope_state;
@@ -1031,11 +949,10 @@ int osm_sa_db_file_load(osm_opensm_t *p_osm)
 			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))
+			    cl_qmap_end(&p_mgrp->mcm_port_tbl))
 				osm_mgrp_add_port(p_mgrp, &port_gid,
 						  scope_state, proxy_join);
-		}
-		else if (!strncmp(p, "Service Record:", 15)) {
+		} else if (!strncmp(p, "Service Record:", 15)) {
 			ib_service_record_t s_rec;
 			uint32_t modified_time, lease_period;
 
@@ -1048,25 +965,27 @@ int osm_sa_db_file_load(osm_opensm_t *p_osm)
 			PARSE_AHEAD(p, net64, ":0x",
 				    &s_rec.service_gid.unicast.interface_id);
 			PARSE_AHEAD(p, net16, " pkey=0x", &s_rec.service_pkey);
-			PARSE_AHEAD(p, net32, " lease=0x", &s_rec.service_lease);
+			PARSE_AHEAD(p, net32, " lease=0x",
+				    &s_rec.service_lease);
 			PARSE_AHEAD(p, net64, " key=0x",
-				    (ib_net64_t *)(&s_rec.service_key[0]));
+				    (ib_net64_t *) (&s_rec.service_key[0]));
 			PARSE_AHEAD(p, net64, ":0x",
-				    (ib_net64_t *)(&s_rec.service_key[8]));
+				    (ib_net64_t *) (&s_rec.service_key[8]));
 			PARSE_AHEAD(p, string64, " name=", s_rec.service_name);
 			PARSE_AHEAD(p, net64, " data8=0x",
-				    (ib_net64_t *)(&s_rec.service_data8[0]));
+				    (ib_net64_t *) (&s_rec.service_data8[0]));
 			PARSE_AHEAD(p, net64, ":0x",
-				    (ib_net64_t *)(&s_rec.service_data8[8]));
+				    (ib_net64_t *) (&s_rec.service_data8[8]));
 			PARSE_AHEAD(p, net64, " data16=0x",
-				    (ib_net64_t *)(&s_rec.service_data16[0]));
+				    (ib_net64_t *) (&s_rec.service_data16[0]));
 			PARSE_AHEAD(p, net64, ":0x",
-				    (ib_net64_t *)(&s_rec.service_data16[4]));
+				    (ib_net64_t *) (&s_rec.service_data16[4]));
 			PARSE_AHEAD(p, net64, " data32=0x",
-				    (ib_net64_t *)(&s_rec.service_data32[0]));
+				    (ib_net64_t *) (&s_rec.service_data32[0]));
 			PARSE_AHEAD(p, net64, ":0x",
-				    (ib_net64_t *)(&s_rec.service_data32[2]));
-			PARSE_AHEAD(p, net64, " data64=0x", &s_rec.service_data64[0]);
+				    (ib_net64_t *) (&s_rec.service_data32[2]));
+			PARSE_AHEAD(p, net64, " data64=0x",
+				    &s_rec.service_data64[0]);
 			PARSE_AHEAD(p, net64, ":0x", &s_rec.service_data64[1]);
 			PARSE_AHEAD(p, net32, " modified_time=0x",
 				    &modified_time);
@@ -1076,8 +995,7 @@ int osm_sa_db_file_load(osm_opensm_t *p_osm)
 			if (load_svcr(p_osm, &s_rec, cl_ntoh32(modified_time),
 				      cl_ntoh32(lease_period)))
 				rereg_clients = 1;
-		}
-		else if (!strncmp(p, "InformInfo Record:", 18)) {
+		} else if (!strncmp(p, "InformInfo Record:", 18)) {
 			ib_inform_info_record_t i_rec;
 			osm_mad_addr_t rep_addr;
 
@@ -1094,7 +1012,8 @@ int osm_sa_db_file_load(osm_opensm_t *p_osm)
 			PARSE_AHEAD(p, net64, " gid=0x",
 				    &i_rec.inform_info.gid.unicast.prefix);
 			PARSE_AHEAD(p, net64, ":0x",
-				    &i_rec.inform_info.gid.unicast.interface_id);
+				    &i_rec.inform_info.gid.unicast.
+				    interface_id);
 			PARSE_AHEAD(p, net16, " lid_range_begin=0x",
 				    &i_rec.inform_info.lid_range_begin);
 			PARSE_AHEAD(p, net16, " lid_range_end=0x",
@@ -1108,9 +1027,11 @@ int osm_sa_db_file_load(osm_opensm_t *p_osm)
 			PARSE_AHEAD(p, net16, " trap_num=0x",
 				    &i_rec.inform_info.g_or_v.generic.trap_num);
 			PARSE_AHEAD(p, net32, " qpn_resp_time_val=0x",
-				    &i_rec.inform_info.g_or_v.generic.qpn_resp_time_val);
+				    &i_rec.inform_info.g_or_v.generic.
+				    qpn_resp_time_val);
 			PARSE_AHEAD(p, net32, " node_type=0x",
-				    (uint32_t *)&i_rec.inform_info.g_or_v.generic.reserved2);
+				    (uint32_t *) & i_rec.inform_info.g_or_v.
+				    generic.reserved2);
 
 			PARSE_AHEAD(p, net16, " rep_addr: lid=0x",
 				    &rep_addr.dest_lid);
@@ -1135,7 +1056,7 @@ int osm_sa_db_file_load(osm_opensm_t *p_osm)
 	if (!rereg_clients)
 		p_osm->subn.opt.no_clients_rereg = TRUE;
 
-  _error:
+      _error:
 	fclose(file);
 	return ret;
 }
diff --git a/opensm/opensm/osm_sa_class_port_info.c b/opensm/opensm/osm_sa_class_port_info.c
index a4d376d..aa227d5 100644
--- a/opensm/opensm/osm_sa_class_port_info.c
+++ b/opensm/opensm/osm_sa_class_port_info.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -63,216 +63,205 @@
 #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) */
-static uint32_t __msecs_to_rtv_table[MAX_MSECS_TO_RTV] =
-					{ 1, 2, 4, 8,
-					  16, 33, 67, 134,
-					  268, 536, 1073, 2147,
-					  4294, 8589, 17179, 34359,
-					  68719, 137438, 274877, 549755,
-					  1099511, 2199023, 4398046, 8796093 };
+static uint32_t __msecs_to_rtv_table[MAX_MSECS_TO_RTV] = { 1, 2, 4, 8,
+	16, 33, 67, 134,
+	268, 536, 1073, 2147,
+	4294, 8589, 17179, 34359,
+	68719, 137438, 274877, 549755,
+	1099511, 2199023, 4398046, 8796093
+};
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_cpi_rcv_construct(
-  IN osm_cpi_rcv_t* const p_rcv )
+void osm_cpi_rcv_construct(IN osm_cpi_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
+	memset(p_rcv, 0, sizeof(*p_rcv));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_cpi_rcv_destroy(
-  IN osm_cpi_rcv_t* const p_rcv )
+void osm_cpi_rcv_destroy(IN osm_cpi_rcv_t * const p_rcv)
 {
-  OSM_LOG_ENTER( p_rcv->p_log, osm_cpi_rcv_destroy );
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_cpi_rcv_destroy);
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_cpi_rcv_init(
-  IN osm_cpi_rcv_t*     const p_rcv,
-  IN osm_sa_resp_t*     const p_resp,
-  IN osm_mad_pool_t*    const p_mad_pool,
-  IN osm_subn_t*        const p_subn,
-  IN osm_log_t*         const p_log,
-  IN cl_plock_t*        const p_lock )
+osm_cpi_rcv_init(IN osm_cpi_rcv_t * const p_rcv,
+		 IN osm_sa_resp_t * const p_resp,
+		 IN osm_mad_pool_t * const p_mad_pool,
+		 IN osm_subn_t * const p_subn,
+		 IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_cpi_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_cpi_rcv_init);
 
-  osm_cpi_rcv_construct( p_rcv );
+	osm_cpi_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_resp = p_resp;
-  p_rcv->p_mad_pool = p_mad_pool;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_resp = p_resp;
+	p_rcv->p_mad_pool = p_mad_pool;
 
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_cpi_rcv_respond(
-  IN osm_cpi_rcv_t*        const p_rcv,
-  IN const osm_madw_t*     const p_madw )
+__osm_cpi_rcv_respond(IN osm_cpi_rcv_t * const p_rcv,
+		      IN const osm_madw_t * const 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_api_status_t          status;
-  ib_gid_t                 zero_gid;
-  uint8_t                  rtv;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_cpi_rcv_respond );
-
-  memset(&zero_gid, 0, sizeof(ib_gid_t));
-
-  /*
-    Get a MAD to reply. Address of Mad is in the received mad_wrapper
-  */
-  p_resp_madw = osm_mad_pool_get( p_rcv->p_mad_pool,
-                                  p_madw->h_bind,
-                                  MAD_BLOCK_SIZE,
-                                  &p_madw->mad_addr );
-  if( !p_resp_madw )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_cpi_rcv_respond: ERR 1408: "
-             "Unable to allocate MAD\n" );
-    goto Exit;
-  }
-
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
-
-  memcpy( p_resp_sa_mad, p_sa_mad, IB_SA_MAD_HDR_SIZE );
-  p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-  /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
-  p_resp_sa_mad->sm_key = 0;
-
-  p_resp_cpi = (ib_class_port_info_t*)ib_sa_mad_get_payload_ptr( p_resp_sa_mad );
-
-  /* finally do it (the job) man ! */
-  p_resp_cpi->base_ver = 1;
-  p_resp_cpi->class_ver = 2;
-  /* Calculate encoded response time value */
-  /* transaction timeout is in msec */
-  if (p_rcv->p_subn->opt.transaction_timeout > __msecs_to_rtv_table[MAX_MSECS_TO_RTV])
-    rtv = MAX_MSECS_TO_RTV - 1;
-  else
-  {
-    for (rtv = 0; rtv < MAX_MSECS_TO_RTV; rtv++) {
-      if (p_rcv->p_subn->opt.transaction_timeout <= __msecs_to_rtv_table[rtv])
-         break;
-    }
-  }
-  rtv += 8;
-  p_resp_cpi->resp_time_val = rtv;
-  p_resp_cpi->redir_gid = zero_gid;
-  p_resp_cpi->redir_tc_sl_fl = 0;
-  p_resp_cpi->redir_lid = 0;
-  p_resp_cpi->redir_pkey = 0;
-  p_resp_cpi->redir_qp = CL_NTOH32(1);
-  p_resp_cpi->redir_qkey = IB_QP1_WELL_KNOWN_Q_KEY;
-  p_resp_cpi->trap_gid = zero_gid;
-  p_resp_cpi->trap_tc_sl_fl = 0;
-  p_resp_cpi->trap_lid = 0;
-  p_resp_cpi->trap_pkey = 0;
-  p_resp_cpi->trap_hop_qp = 0;
-  p_resp_cpi->trap_qkey = IB_QP1_WELL_KNOWN_Q_KEY;
-
-  /* set specific capability mask bits */
-  /* we do not support the following options/optional records:
-     OSM_CAP_IS_SUBN_OPT_RECS_SUP :
-     RandomForwardingTableRecord,
-     ServiceAssociationRecord
-     other optional records supported "under the table"
-
-     OSM_CAP_IS_MULTIPATH_SUP:
-     TraceRecord
-
-     OSM_CAP_IS_REINIT_SUP:
-     For reinitialization functionality.
-
-     So not sending traps, but supporting Get(Notice) and Set(Notice).
-  */
-
-  /* Note host notation replaced later */
+	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_api_status_t status;
+	ib_gid_t zero_gid;
+	uint8_t rtv;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_cpi_rcv_respond);
+
+	memset(&zero_gid, 0, sizeof(ib_gid_t));
+
+	/*
+	   Get a MAD to reply. Address of Mad is in the received mad_wrapper
+	 */
+	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+				       p_madw->h_bind,
+				       MAD_BLOCK_SIZE, &p_madw->mad_addr);
+	if (!p_resp_madw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_cpi_rcv_respond: ERR 1408: "
+			"Unable to allocate MAD\n");
+		goto Exit;
+	}
+
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+
+	memcpy(p_resp_sa_mad, p_sa_mad, IB_SA_MAD_HDR_SIZE);
+	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
+	p_resp_sa_mad->sm_key = 0;
+
+	p_resp_cpi =
+	    (ib_class_port_info_t *) ib_sa_mad_get_payload_ptr(p_resp_sa_mad);
+
+	/* finally do it (the job) man ! */
+	p_resp_cpi->base_ver = 1;
+	p_resp_cpi->class_ver = 2;
+	/* Calculate encoded response time value */
+	/* transaction timeout is in msec */
+	if (p_rcv->p_subn->opt.transaction_timeout >
+	    __msecs_to_rtv_table[MAX_MSECS_TO_RTV])
+		rtv = MAX_MSECS_TO_RTV - 1;
+	else {
+		for (rtv = 0; rtv < MAX_MSECS_TO_RTV; rtv++) {
+			if (p_rcv->p_subn->opt.transaction_timeout <=
+			    __msecs_to_rtv_table[rtv])
+				break;
+		}
+	}
+	rtv += 8;
+	p_resp_cpi->resp_time_val = rtv;
+	p_resp_cpi->redir_gid = zero_gid;
+	p_resp_cpi->redir_tc_sl_fl = 0;
+	p_resp_cpi->redir_lid = 0;
+	p_resp_cpi->redir_pkey = 0;
+	p_resp_cpi->redir_qp = CL_NTOH32(1);
+	p_resp_cpi->redir_qkey = IB_QP1_WELL_KNOWN_Q_KEY;
+	p_resp_cpi->trap_gid = zero_gid;
+	p_resp_cpi->trap_tc_sl_fl = 0;
+	p_resp_cpi->trap_lid = 0;
+	p_resp_cpi->trap_pkey = 0;
+	p_resp_cpi->trap_hop_qp = 0;
+	p_resp_cpi->trap_qkey = IB_QP1_WELL_KNOWN_Q_KEY;
+
+	/* set specific capability mask bits */
+	/* we do not support the following options/optional records:
+	   OSM_CAP_IS_SUBN_OPT_RECS_SUP :
+	   RandomForwardingTableRecord,
+	   ServiceAssociationRecord
+	   other optional records supported "under the table"
+
+	   OSM_CAP_IS_MULTIPATH_SUP:
+	   TraceRecord
+
+	   OSM_CAP_IS_REINIT_SUP:
+	   For reinitialization functionality.
+
+	   So not sending traps, but supporting Get(Notice) and Set(Notice).
+	 */
+
+	/* Note host notation replaced later */
 #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
-  p_resp_cpi->cap_mask = OSM_CAP_IS_SUBN_GET_SET_NOTICE_SUP |
-                         OSM_CAP_IS_PORT_INFO_CAPMASK_MATCH_SUPPORTED |
-                         OSM_CAP_IS_MULTIPATH_SUP;
+	p_resp_cpi->cap_mask = OSM_CAP_IS_SUBN_GET_SET_NOTICE_SUP |
+	    OSM_CAP_IS_PORT_INFO_CAPMASK_MATCH_SUPPORTED |
+	    OSM_CAP_IS_MULTIPATH_SUP;
 #else
-  p_resp_cpi->cap_mask = OSM_CAP_IS_SUBN_GET_SET_NOTICE_SUP |
-			 OSM_CAP_IS_PORT_INFO_CAPMASK_MATCH_SUPPORTED;
+	p_resp_cpi->cap_mask = OSM_CAP_IS_SUBN_GET_SET_NOTICE_SUP |
+	    OSM_CAP_IS_PORT_INFO_CAPMASK_MATCH_SUPPORTED;
 #endif
-  if (p_rcv->p_subn->opt.no_multicast_option != TRUE)
-    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( p_rcv->p_log, OSM_LOG_FRAMES ) )
-    osm_dump_sa_mad( p_rcv->p_log, p_resp_sa_mad, OSM_LOG_FRAMES );
-
-  status = osm_vendor_send( p_resp_madw->h_bind, p_resp_madw,  FALSE );
-  if( status != IB_SUCCESS )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_cpi_rcv_respond: ERR 1409: "
-             "Unable to send MAD (%s)\n", ib_get_err_str( status ) );
-    /*  osm_mad_pool_put( p_rcv->p_mad_pool, p_resp_madw ); */
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	if (p_rcv->p_subn->opt.no_multicast_option != TRUE)
+		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(p_rcv->p_log, OSM_LOG_FRAMES))
+		osm_dump_sa_mad(p_rcv->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
+
+	status = osm_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE);
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_cpi_rcv_respond: ERR 1409: "
+			"Unable to send MAD (%s)\n", ib_get_err_str(status));
+		/*  osm_mad_pool_put( p_rcv->p_mad_pool, p_resp_madw ); */
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  * This code actually handles the call
  **********************************************************************/
-void
-osm_cpi_rcv_process(
-  IN void *context,
-  IN void *data )
+void osm_cpi_rcv_process(IN void *context, IN void *data)
 {
-  osm_cpi_rcv_t *p_rcv = context;
-  osm_madw_t *p_madw = data;
-  const ib_sa_mad_t*    p_sa_mad;
+	osm_cpi_rcv_t *p_rcv = context;
+	osm_madw_t *p_madw = data;
+	const ib_sa_mad_t *p_sa_mad;
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_cpi_rcv_process );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_cpi_rcv_process);
 
-  CL_ASSERT( p_madw );
+	CL_ASSERT(p_madw);
 
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
 
-  /* we only support GET */
-  if (p_sa_mad->method != IB_MAD_METHOD_GET)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_cpi_rcv_process: ERR 1403: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_sa_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);
-    goto Exit;
-  }
+	/* we only support GET */
+	if (p_sa_mad->method != IB_MAD_METHOD_GET) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_cpi_rcv_process: ERR 1403: "
+			"Unsupported Method (%s)\n",
+			ib_get_sa_method_str(p_sa_mad->method));
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_REQ_INVALID);
+		goto Exit;
+	}
 
-  CL_ASSERT( p_sa_mad->attr_id == IB_MAD_ATTR_CLASS_PORT_INFO );
+	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 on the SMDB - no lock required.
+	 */
 
-  __osm_cpi_rcv_respond( p_rcv, p_madw);
+	__osm_cpi_rcv_respond(p_rcv, p_madw);
 
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_sa_guidinfo_record.c b/opensm/opensm/osm_sa_guidinfo_record.c
index 9a02373..de1af88 100644
--- a/opensm/opensm/osm_sa_guidinfo_record.c
+++ b/opensm/opensm/osm_sa_guidinfo_record.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of osm_gir_rcv_t.
@@ -47,7 +46,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -65,546 +64,519 @@
 #define OSM_GIR_RCV_POOL_MIN_SIZE      32
 #define OSM_GIR_RCV_POOL_GROW_SIZE     32
 
-typedef  struct _osm_gir_item
-{
-  cl_pool_item_t           pool_item;
-  ib_guidinfo_record_t     rec;
+typedef struct _osm_gir_item {
+	cl_pool_item_t pool_item;
+	ib_guidinfo_record_t rec;
 } osm_gir_item_t;
 
-typedef  struct _osm_gir_search_ctxt
-{
-  const ib_guidinfo_record_t* p_rcvd_rec;
-  ib_net64_t               comp_mask;
-  cl_qlist_t*              p_list;
-  osm_gir_rcv_t*           p_rcv;
-  const osm_physp_t*       p_req_physp;
+typedef struct _osm_gir_search_ctxt {
+	const ib_guidinfo_record_t *p_rcvd_rec;
+	ib_net64_t comp_mask;
+	cl_qlist_t *p_list;
+	osm_gir_rcv_t *p_rcv;
+	const osm_physp_t *p_req_physp;
 } osm_gir_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_gir_rcv_construct(
-  IN osm_gir_rcv_t* const p_rcv )
+void osm_gir_rcv_construct(IN osm_gir_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
-  cl_qlock_pool_construct( &p_rcv->pool );
+	memset(p_rcv, 0, sizeof(*p_rcv));
+	cl_qlock_pool_construct(&p_rcv->pool);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_gir_rcv_destroy(
-  IN osm_gir_rcv_t* const p_rcv )
+void osm_gir_rcv_destroy(IN osm_gir_rcv_t * const p_rcv)
 {
-  OSM_LOG_ENTER( p_rcv->p_log, osm_gir_rcv_destroy );
-  cl_qlock_pool_destroy( &p_rcv->pool );
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_gir_rcv_destroy);
+	cl_qlock_pool_destroy(&p_rcv->pool);
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_gir_rcv_init(
-  IN osm_gir_rcv_t*        const p_rcv,
-  IN osm_sa_resp_t*        const p_resp,
-  IN osm_mad_pool_t*       const p_mad_pool,
-  IN const osm_subn_t*     const p_subn,
-  IN osm_log_t*            const p_log,
-  IN cl_plock_t*           const p_lock )
+osm_gir_rcv_init(IN osm_gir_rcv_t * const p_rcv,
+		 IN osm_sa_resp_t * const p_resp,
+		 IN osm_mad_pool_t * const p_mad_pool,
+		 IN const osm_subn_t * const p_subn,
+		 IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t          status;
+	ib_api_status_t status;
 
-  OSM_LOG_ENTER( p_log, osm_gir_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_gir_rcv_init);
 
-  osm_gir_rcv_construct( p_rcv );
+	osm_gir_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_resp = p_resp;
-  p_rcv->p_mad_pool = p_mad_pool;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_resp = p_resp;
+	p_rcv->p_mad_pool = p_mad_pool;
 
-  status = cl_qlock_pool_init( &p_rcv->pool,
-                               OSM_GIR_RCV_POOL_MIN_SIZE,
-                               0,
-                               OSM_GIR_RCV_POOL_GROW_SIZE,
-                               sizeof(osm_gir_item_t),
-                               NULL, NULL, NULL );
+	status = cl_qlock_pool_init(&p_rcv->pool,
+				    OSM_GIR_RCV_POOL_MIN_SIZE,
+				    0,
+				    OSM_GIR_RCV_POOL_GROW_SIZE,
+				    sizeof(osm_gir_item_t), NULL, NULL, NULL);
 
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t
-__osm_gir_rcv_new_gir(
-  IN osm_gir_rcv_t*        const p_rcv,
-  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 )
+__osm_gir_rcv_new_gir(IN osm_gir_rcv_t * const p_rcv,
+		      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)
 {
-  osm_gir_item_t*          p_rec_item;
-  ib_api_status_t          status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_gir_rcv_new_gir );
-
-  p_rec_item = (osm_gir_item_t*)cl_qlock_pool_get( &p_rcv->pool );
-  if( p_rec_item == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_gir_rcv_new_gir: ERR 5102: "
-             "cl_qlock_pool_get failed\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_gir_rcv_new_gir: "
-             "New GUIDInfoRecord: lid 0x%X, block num %d\n",
-             cl_ntoh16( match_lid ), block_num );
-  }
-
-  memset( &p_rec_item->rec, 0, sizeof( p_rec_item->rec ) );
-
-  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 );
-
-  cl_qlist_insert_tail( p_list, (cl_list_item_t*)&p_rec_item->pool_item );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	osm_gir_item_t *p_rec_item;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_gir_rcv_new_gir);
+
+	p_rec_item = (osm_gir_item_t *) cl_qlock_pool_get(&p_rcv->pool);
+	if (p_rec_item == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_gir_rcv_new_gir: ERR 5102: "
+			"cl_qlock_pool_get failed\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_gir_rcv_new_gir: "
+			"New GUIDInfoRecord: lid 0x%X, block num %d\n",
+			cl_ntoh16(match_lid), block_num);
+	}
+
+	memset(&p_rec_item->rec, 0, sizeof(p_rec_item->rec));
+
+	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);
+
+	cl_qlist_insert_tail(p_list,
+			     (cl_list_item_t *) & p_rec_item->pool_item);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-__osm_sa_gir_create_gir(
-  IN osm_gir_rcv_t*        const p_rcv,
-  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 match_block_num )
+__osm_sa_gir_create_gir(IN osm_gir_rcv_t * const p_rcv,
+			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 match_block_num)
 {
-  const osm_physp_t*       p_physp;
-  uint8_t                  port_num;
-  uint8_t                  num_ports;
-  uint16_t                 match_lid_ho;
-  ib_net16_t               base_lid_ho;
-  ib_net16_t               max_lid_ho;
-  uint8_t                  lmc;
-  ib_net64_t               port_guid;
-  uint8_t                  block_num, start_block_num, end_block_num, num_blocks;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_sa_gir_create_gir );
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_sa_gir_create_gir: "
-             "Looking for GUIDRecord with LID: 0x%X GUID:0x%016" PRIx64 "\n",
-             cl_ntoh16( match_lid ),
-             cl_ntoh64( match_port_guid )
-             );
-  }
-
-  /*
-    For switches, do not return the GUIDInfo record(s)
-    for each port on the switch, just for port 0.
-  */
-  if( osm_node_get_type( p_node ) == IB_NODE_TYPE_SWITCH )
-    num_ports = 1;
-  else
-    num_ports = osm_node_get_num_physp( p_node );
-
-  for( port_num = 0; port_num < num_ports; port_num++ )
-  {
-    p_physp = osm_node_get_physp_ptr( p_node, port_num );
-
-    if( !osm_physp_is_valid( p_physp ) )
-      continue;
-
-    /* Check to see if the found p_physp and the requester physp
-       share a pkey. If not, continue */
-    if (!osm_physp_share_pkey( p_rcv->p_log, p_physp, p_req_physp ) )
-      continue;
-
-    port_guid = osm_physp_get_port_guid( p_physp );
-
-    if( match_port_guid && ( port_guid != match_port_guid ) )
-      continue;
-
-    /*
-       Note: the following check is a temporary workaround
-       Since 1. GUIDCap should never be 0 on ports where this applies
-       and   2. GUIDCap should not be used on ports where it doesn't apply
-       So this should really be a check for whether the port is a
-       switch external port or not!
-     */
-    if ( p_physp->port_info.guid_cap == 0 )
-      continue;
-
-    num_blocks = p_physp->port_info.guid_cap / 8;
-    if ( p_physp->port_info.guid_cap % 8 )
-      num_blocks++;
-    if ( match_block_num == 255 )
-    {
-      start_block_num = 0;
-      end_block_num = num_blocks - 1;
-    }
-    else
-    {
-      if ( match_block_num >= num_blocks )
-        continue;
-      end_block_num = start_block_num = match_block_num;
-    }
-
-    base_lid_ho = cl_ntoh16( osm_physp_get_base_lid( p_physp ) );
-    match_lid_ho = cl_ntoh16( match_lid );
-    if( match_lid_ho )
-    {
-      lmc = osm_physp_get_lmc( p_physp );
-      max_lid_ho = (uint16_t)( base_lid_ho + (1 << lmc) - 1 );
-
-      /*
-        We validate that the lid belongs to this node.
-      */
-      if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-      {
-        osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-                 "__osm_sa_gir_create_gir: "
-                 "Comparing LID: 0x%X <= 0x%X <= 0x%X\n",
-                 base_lid_ho, match_lid_ho, max_lid_ho
-                 );
-      }
-
-      if ( match_lid_ho < base_lid_ho || match_lid_ho > max_lid_ho )
-        continue;
-    }
-
-    for (block_num = start_block_num; block_num <= end_block_num; block_num++)
-      __osm_gir_rcv_new_gir( p_rcv, p_node, p_list,
-                             port_guid, cl_ntoh16(base_lid_ho),
-                             p_physp, block_num );
-
-  }
-
-  OSM_LOG_EXIT( p_rcv->p_log );
+	const osm_physp_t *p_physp;
+	uint8_t port_num;
+	uint8_t num_ports;
+	uint16_t match_lid_ho;
+	ib_net16_t base_lid_ho;
+	ib_net16_t max_lid_ho;
+	uint8_t lmc;
+	ib_net64_t port_guid;
+	uint8_t block_num, start_block_num, end_block_num, num_blocks;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_gir_create_gir);
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_sa_gir_create_gir: "
+			"Looking for GUIDRecord with LID: 0x%X GUID:0x%016"
+			PRIx64 "\n", cl_ntoh16(match_lid),
+			cl_ntoh64(match_port_guid)
+		    );
+	}
+
+	/*
+	   For switches, do not return the GUIDInfo record(s)
+	   for each port on the switch, just for port 0.
+	 */
+	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH)
+		num_ports = 1;
+	else
+		num_ports = osm_node_get_num_physp(p_node);
+
+	for (port_num = 0; port_num < num_ports; port_num++) {
+		p_physp = osm_node_get_physp_ptr(p_node, port_num);
+
+		if (!osm_physp_is_valid(p_physp))
+			continue;
+
+		/* Check to see if the found p_physp and the requester physp
+		   share a pkey. If not, continue */
+		if (!osm_physp_share_pkey(p_rcv->p_log, p_physp, p_req_physp))
+			continue;
+
+		port_guid = osm_physp_get_port_guid(p_physp);
+
+		if (match_port_guid && (port_guid != match_port_guid))
+			continue;
+
+		/*
+		   Note: the following check is a temporary workaround
+		   Since 1. GUIDCap should never be 0 on ports where this applies
+		   and   2. GUIDCap should not be used on ports where it doesn't apply
+		   So this should really be a check for whether the port is a
+		   switch external port or not!
+		 */
+		if (p_physp->port_info.guid_cap == 0)
+			continue;
+
+		num_blocks = p_physp->port_info.guid_cap / 8;
+		if (p_physp->port_info.guid_cap % 8)
+			num_blocks++;
+		if (match_block_num == 255) {
+			start_block_num = 0;
+			end_block_num = num_blocks - 1;
+		} else {
+			if (match_block_num >= num_blocks)
+				continue;
+			end_block_num = start_block_num = match_block_num;
+		}
+
+		base_lid_ho = cl_ntoh16(osm_physp_get_base_lid(p_physp));
+		match_lid_ho = cl_ntoh16(match_lid);
+		if (match_lid_ho) {
+			lmc = osm_physp_get_lmc(p_physp);
+			max_lid_ho = (uint16_t) (base_lid_ho + (1 << lmc) - 1);
+
+			/*
+			   We validate that the lid belongs to this node.
+			 */
+			if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+				osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+					"__osm_sa_gir_create_gir: "
+					"Comparing LID: 0x%X <= 0x%X <= 0x%X\n",
+					base_lid_ho, match_lid_ho, max_lid_ho);
+			}
+
+			if (match_lid_ho < base_lid_ho
+			    || match_lid_ho > max_lid_ho)
+				continue;
+		}
+
+		for (block_num = start_block_num; block_num <= end_block_num;
+		     block_num++)
+			__osm_gir_rcv_new_gir(p_rcv, p_node, p_list, port_guid,
+					      cl_ntoh16(base_lid_ho), p_physp,
+					      block_num);
+
+	}
+
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-__osm_sa_gir_by_comp_mask_cb(
-  IN cl_map_item_t*            const p_map_item,
-  IN void*                     context )
+__osm_sa_gir_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
+			     IN void *context)
 {
-  const osm_gir_search_ctxt_t* const p_ctxt = (osm_gir_search_ctxt_t *)context;
-  const 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;
-  osm_gir_rcv_t*               const p_rcv = p_ctxt->p_rcv;
-  const ib_guid_info_t*        p_comp_gi;
-  ib_net64_t                   const comp_mask = p_ctxt->comp_mask;
-  ib_net64_t                   match_port_guid = 0;
-  ib_net16_t                   match_lid = 0;
-  uint8_t                      match_block_num = 255;
-
-  OSM_LOG_ENTER( p_ctxt->p_rcv->p_log, __osm_sa_gir_by_comp_mask_cb);
-
-  if( comp_mask & IB_GIR_COMPMASK_LID )
-     match_lid = p_rcvd_rec->lid;
-
-  if( comp_mask & IB_GIR_COMPMASK_BLOCKNUM )
-    match_block_num = p_rcvd_rec->block_num;
-
-  p_comp_gi = &p_rcvd_rec->guid_info;
-  /* Different rule for block 0 v. other blocks */
-  if( comp_mask & IB_GIR_COMPMASK_GID0 )
-  {
-    if ( !p_rcvd_rec->block_num )
-      match_port_guid = osm_physp_get_port_guid( p_req_physp );
-    if ( p_comp_gi->guid[0] != match_port_guid )
-      goto Exit;
-  }
-
-  if( comp_mask & IB_GIR_COMPMASK_GID1 )
-  {
-    if ( p_comp_gi->guid[1] != 0)
-      goto Exit;
-  }
-
-  if( comp_mask & IB_GIR_COMPMASK_GID2 )
-  {
-    if ( p_comp_gi->guid[2] != 0)
-      goto Exit;
-  }
-
-  if( comp_mask & IB_GIR_COMPMASK_GID3 )
-  {
-    if ( p_comp_gi->guid[3] != 0)
-      goto Exit;
-  }
-
-  if( comp_mask & IB_GIR_COMPMASK_GID4 )
-  {
-    if ( p_comp_gi->guid[4] != 0)
-      goto Exit;
-  }
-
-  if( comp_mask & IB_GIR_COMPMASK_GID5 )
-  {
-    if ( p_comp_gi->guid[5] != 0)
-      goto Exit;
-  }
-
-  if( comp_mask & IB_GIR_COMPMASK_GID6 )
-  {
-    if ( p_comp_gi->guid[6] != 0)
-      goto Exit;
-  }
-
-  if( comp_mask & IB_GIR_COMPMASK_GID7 )
-  {
-    if ( p_comp_gi->guid[7] != 0)
-      goto Exit;
-  }
-
-  __osm_sa_gir_create_gir( p_rcv, p_node, p_ctxt->p_list,
-                           match_port_guid, match_lid, p_req_physp,
-                           match_block_num );
-
- Exit:
-  OSM_LOG_EXIT( p_ctxt->p_rcv->p_log );
+	const osm_gir_search_ctxt_t *const p_ctxt =
+	    (osm_gir_search_ctxt_t *) context;
+	const 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;
+	osm_gir_rcv_t *const p_rcv = p_ctxt->p_rcv;
+	const ib_guid_info_t *p_comp_gi;
+	ib_net64_t const comp_mask = p_ctxt->comp_mask;
+	ib_net64_t match_port_guid = 0;
+	ib_net16_t match_lid = 0;
+	uint8_t match_block_num = 255;
+
+	OSM_LOG_ENTER(p_ctxt->p_rcv->p_log, __osm_sa_gir_by_comp_mask_cb);
+
+	if (comp_mask & IB_GIR_COMPMASK_LID)
+		match_lid = p_rcvd_rec->lid;
+
+	if (comp_mask & IB_GIR_COMPMASK_BLOCKNUM)
+		match_block_num = p_rcvd_rec->block_num;
+
+	p_comp_gi = &p_rcvd_rec->guid_info;
+	/* Different rule for block 0 v. other blocks */
+	if (comp_mask & IB_GIR_COMPMASK_GID0) {
+		if (!p_rcvd_rec->block_num)
+			match_port_guid = osm_physp_get_port_guid(p_req_physp);
+		if (p_comp_gi->guid[0] != match_port_guid)
+			goto Exit;
+	}
+
+	if (comp_mask & IB_GIR_COMPMASK_GID1) {
+		if (p_comp_gi->guid[1] != 0)
+			goto Exit;
+	}
+
+	if (comp_mask & IB_GIR_COMPMASK_GID2) {
+		if (p_comp_gi->guid[2] != 0)
+			goto Exit;
+	}
+
+	if (comp_mask & IB_GIR_COMPMASK_GID3) {
+		if (p_comp_gi->guid[3] != 0)
+			goto Exit;
+	}
+
+	if (comp_mask & IB_GIR_COMPMASK_GID4) {
+		if (p_comp_gi->guid[4] != 0)
+			goto Exit;
+	}
+
+	if (comp_mask & IB_GIR_COMPMASK_GID5) {
+		if (p_comp_gi->guid[5] != 0)
+			goto Exit;
+	}
+
+	if (comp_mask & IB_GIR_COMPMASK_GID6) {
+		if (p_comp_gi->guid[6] != 0)
+			goto Exit;
+	}
+
+	if (comp_mask & IB_GIR_COMPMASK_GID7) {
+		if (p_comp_gi->guid[7] != 0)
+			goto Exit;
+	}
+
+	__osm_sa_gir_create_gir(p_rcv, p_node, p_ctxt->p_list,
+				match_port_guid, match_lid, p_req_physp,
+				match_block_num);
+
+      Exit:
+	OSM_LOG_EXIT(p_ctxt->p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_gir_rcv_process(
-  IN void *ctx,
-  IN void *data )
+void osm_gir_rcv_process(IN void *ctx, IN void *data)
 {
-  osm_gir_rcv_t *p_rcv = 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_madw_t*              p_resp_madw;
-  ib_sa_mad_t*             p_resp_sa_mad;
-  ib_guidinfo_record_t*    p_resp_rec;
-  uint32_t                 num_rec, pre_trim_num_rec;
+	osm_gir_rcv_t *p_rcv = 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_madw_t *p_resp_madw;
+	ib_sa_mad_t *p_resp_sa_mad;
+	ib_guidinfo_record_t *p_resp_rec;
+	uint32_t num_rec, pre_trim_num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  uint32_t		   trim_num_rec;
+	uint32_t trim_num_rec;
 #endif
-  uint32_t                 i;
-  osm_gir_search_ctxt_t    context;
-  osm_gir_item_t*          p_rec_item;
-  ib_api_status_t          status;
-  osm_physp_t*             p_req_physp;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_gir_rcv_process );
-
-  CL_ASSERT( p_madw );
-
-  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_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_GUIDINFO_RECORD );
-
-  /* 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( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_gir_rcv_process: ERR 5105: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_rcvd_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
-
-  /* update the requester physical port. */
-  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-                                          p_rcv->p_subn,
-                                          osm_madw_get_mad_addr_ptr(p_madw) );
-  if (p_req_physp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_gir_rcv_process: ERR 5104: "
-             "Cannot find requester physical port\n" );
-    goto Exit;
-  }
-
-  if ( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    osm_dump_guidinfo_record( p_rcv->p_log, p_rcvd_rec, OSM_LOG_DEBUG );
-
-  cl_qlist_init( &rec_list );
-
-  context.p_rcvd_rec = p_rcvd_rec;
-  context.p_list = &rec_list;
-  context.comp_mask = p_rcvd_mad->comp_mask;
-  context.p_rcv = p_rcv;
-  context.p_req_physp = p_req_physp;
-
-  cl_plock_acquire( p_rcv->p_lock );
-
-  cl_qmap_apply_func( &p_rcv->p_subn->node_guid_tbl,
-                      __osm_sa_gir_by_comp_mask_cb,
-                      &context );
-
-  cl_plock_release( p_rcv->p_lock );
-
-  num_rec = cl_qlist_count( &rec_list );
-
-  /*
-   * C15-0.1.30:
-   * If we do a SubnAdmGet and got more than one record it is an error !
-   */
-  if (p_rcvd_mad->method == IB_MAD_METHOD_GET)
-  {
-    if (num_rec == 0)
-    {
-      osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-      goto Exit;
-    }
-    if (num_rec > 1)
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_gir_rcv_process: ERR 5103: "
-               "Got more than one record for SubnAdmGet (%u)\n",
-               num_rec );
-      osm_sa_send_error( p_rcv->p_resp, p_madw,
-                         IB_SA_MAD_STATUS_TOO_MANY_RECORDS );
-
-      /* need to set the mem free ... */
-      p_rec_item = (osm_gir_item_t*)cl_qlist_remove_head( &rec_list );
-      while( p_rec_item != (osm_gir_item_t*)cl_qlist_end( &rec_list ) )
-      {
-        cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-        p_rec_item = (osm_gir_item_t*)cl_qlist_remove_head( &rec_list );
-      }
-
-      goto Exit;
-    }
-  }
-
-  pre_trim_num_rec = num_rec;
+	uint32_t i;
+	osm_gir_search_ctxt_t context;
+	osm_gir_item_t *p_rec_item;
+	ib_api_status_t status;
+	osm_physp_t *p_req_physp;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_gir_rcv_process);
+
+	CL_ASSERT(p_madw);
+
+	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_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_GUIDINFO_RECORD);
+
+	/* 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(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_gir_rcv_process: ERR 5105: "
+			"Unsupported Method (%s)\n",
+			ib_get_sa_method_str(p_rcvd_mad->method));
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
+		goto Exit;
+	}
+
+	/* update the requester physical port. */
+	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+						p_rcv->p_subn,
+						osm_madw_get_mad_addr_ptr
+						(p_madw));
+	if (p_req_physp == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_gir_rcv_process: ERR 5104: "
+			"Cannot find requester physical port\n");
+		goto Exit;
+	}
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
+		osm_dump_guidinfo_record(p_rcv->p_log, p_rcvd_rec,
+					 OSM_LOG_DEBUG);
+
+	cl_qlist_init(&rec_list);
+
+	context.p_rcvd_rec = p_rcvd_rec;
+	context.p_list = &rec_list;
+	context.comp_mask = p_rcvd_mad->comp_mask;
+	context.p_rcv = p_rcv;
+	context.p_req_physp = p_req_physp;
+
+	cl_plock_acquire(p_rcv->p_lock);
+
+	cl_qmap_apply_func(&p_rcv->p_subn->node_guid_tbl,
+			   __osm_sa_gir_by_comp_mask_cb, &context);
+
+	cl_plock_release(p_rcv->p_lock);
+
+	num_rec = cl_qlist_count(&rec_list);
+
+	/*
+	 * C15-0.1.30:
+	 * If we do a SubnAdmGet and got more than one record it is an error !
+	 */
+	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
+		if (num_rec == 0) {
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_NO_RECORDS);
+			goto Exit;
+		}
+		if (num_rec > 1) {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_gir_rcv_process: ERR 5103: "
+				"Got more than one record for SubnAdmGet (%u)\n",
+				num_rec);
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
+
+			/* need to set the mem free ... */
+			p_rec_item =
+			    (osm_gir_item_t *) cl_qlist_remove_head(&rec_list);
+			while (p_rec_item !=
+			       (osm_gir_item_t *) cl_qlist_end(&rec_list)) {
+				cl_qlock_pool_put(&p_rcv->pool,
+						  &p_rec_item->pool_item);
+				p_rec_item =
+				    (osm_gir_item_t *)
+				    cl_qlist_remove_head(&rec_list);
+			}
+
+			goto Exit;
+		}
+	}
+
+	pre_trim_num_rec = num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  trim_num_rec = (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_guidinfo_record_t);
-  if (trim_num_rec < num_rec)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "osm_gir_rcv_process: "
-             "Number of records:%u trimmed to:%u to fit in one MAD\n",
-             num_rec, trim_num_rec );
-    num_rec = trim_num_rec;
-  }
+	trim_num_rec =
+	    (MAD_BLOCK_SIZE -
+	     IB_SA_MAD_HDR_SIZE) / sizeof(ib_guidinfo_record_t);
+	if (trim_num_rec < num_rec) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"osm_gir_rcv_process: "
+			"Number of records:%u trimmed to:%u to fit in one MAD\n",
+			num_rec, trim_num_rec);
+		num_rec = trim_num_rec;
+	}
 #endif
 
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "osm_gir_rcv_process: "
-           "Returning %u records\n", num_rec );
-
-  if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
-  {
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-    goto Exit;
-  }
-
-  /*
-   * Get a MAD to reply. Address of Mad is in the received mad_wrapper
-   */
-  p_resp_madw = osm_mad_pool_get( p_rcv->p_mad_pool,
-                                  p_madw->h_bind,
-                                  num_rec * sizeof(ib_guidinfo_record_t) + IB_SA_MAD_HDR_SIZE,
-                                  &p_madw->mad_addr );
-
-  if( !p_resp_madw )
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_gir_rcv_process: ERR 5106: "
-            "osm_mad_pool_get failed\n" );
-
-    for( i = 0; i < num_rec; i++ )
-    {
-      p_rec_item = (osm_gir_item_t*)cl_qlist_remove_head( &rec_list );
-      cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    }
-
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES );
-    goto Exit;
-  }
-
-  p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
-
-  /*
-    Copy the MAD header back into the response mad.
-    Set the 'R' bit and the payload length,
-    Then copy all records from the list into the response payload.
-  */
-
-  memcpy( p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE );
-  p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-  /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
-  p_resp_sa_mad->sm_key = 0;
-  /* Fill in the offset (paylen will be done by the rmpp SAR) */
-  p_resp_sa_mad->attr_offset =
-    ib_get_attr_offset( sizeof(ib_guidinfo_record_t) );
-
-  p_resp_rec = (ib_guidinfo_record_t*)
-    ib_sa_mad_get_payload_ptr( p_resp_sa_mad );
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"osm_gir_rcv_process: " "Returning %u records\n", num_rec);
+
+	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RECORDS);
+		goto Exit;
+	}
+
+	/*
+	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
+	 */
+	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+				       p_madw->h_bind,
+				       num_rec * sizeof(ib_guidinfo_record_t) +
+				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
+
+	if (!p_resp_madw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_gir_rcv_process: ERR 5106: "
+			"osm_mad_pool_get failed\n");
+
+		for (i = 0; i < num_rec; i++) {
+			p_rec_item =
+			    (osm_gir_item_t *) cl_qlist_remove_head(&rec_list);
+			cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		}
+
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RESOURCES);
+		goto Exit;
+	}
+
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+
+	/*
+	   Copy the MAD header back into the response mad.
+	   Set the 'R' bit and the payload length,
+	   Then copy all records from the list into the response payload.
+	 */
+
+	memcpy(p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE);
+	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
+	p_resp_sa_mad->sm_key = 0;
+	/* Fill in the offset (paylen will be done by the rmpp SAR) */
+	p_resp_sa_mad->attr_offset =
+	    ib_get_attr_offset(sizeof(ib_guidinfo_record_t));
+
+	p_resp_rec = (ib_guidinfo_record_t *)
+	    ib_sa_mad_get_payload_ptr(p_resp_sa_mad);
 
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we support only one packet RMPP - so we will set the first and
-     last flags for gettable */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-  {
-    p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST | IB_RMPP_FLAG_ACTIVE;
-  }
+	/* we support only one packet RMPP - so we will set the first and
+	   last flags for gettable */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+		p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
+		p_resp_sa_mad->rmpp_flags =
+		    IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST |
+		    IB_RMPP_FLAG_ACTIVE;
+	}
 #else
-  /* forcefully define the packet as RMPP one */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
+	/* forcefully define the packet as RMPP one */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
+		p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
 #endif
 
-  for( i = 0; i < pre_trim_num_rec; i++ )
-  {
-    p_rec_item = (osm_gir_item_t*)cl_qlist_remove_head( &rec_list );
-    /* copy only if not trimmed */
-    if (i < num_rec)
-    {
-      *p_resp_rec = p_rec_item->rec;
-    }
-    cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    p_resp_rec++;
-  }
-
-  CL_ASSERT( cl_is_qlist_empty( &rec_list ) );
-
-  status = osm_vendor_send( p_resp_madw->h_bind, p_resp_madw, FALSE);
-  if (status != IB_SUCCESS)
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_gir_rcv_process: ERR 5107: "
-            "osm_vendor_send status = %s\n",
-            ib_get_err_str(status));
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	for (i = 0; i < pre_trim_num_rec; i++) {
+		p_rec_item = (osm_gir_item_t *) cl_qlist_remove_head(&rec_list);
+		/* copy only if not trimmed */
+		if (i < num_rec) {
+			*p_resp_rec = p_rec_item->rec;
+		}
+		cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		p_resp_rec++;
+	}
+
+	CL_ASSERT(cl_is_qlist_empty(&rec_list));
+
+	status = osm_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE);
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_gir_rcv_process: ERR 5107: "
+			"osm_vendor_send status = %s\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_sa_informinfo.c b/opensm/opensm/osm_sa_informinfo.c
index d08b6e5..4639365 100644
--- a/opensm/opensm/osm_sa_informinfo.c
+++ b/opensm/opensm/osm_sa_informinfo.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -69,78 +69,69 @@
 #define OSM_IIR_RCV_POOL_MIN_SIZE      32
 #define OSM_IIR_RCV_POOL_GROW_SIZE     32
 
-typedef struct _osm_iir_item
-{
-  cl_pool_item_t          pool_item;
-  ib_inform_info_record_t rec;
+typedef struct _osm_iir_item {
+	cl_pool_item_t pool_item;
+	ib_inform_info_record_t rec;
 } osm_iir_item_t;
 
-typedef struct _osm_iir_search_ctxt
-{
-  const ib_inform_info_record_t*  p_rcvd_rec;
-  ib_net64_t                      comp_mask;
-  cl_qlist_t*                     p_list;
-  ib_gid_t                        subscriber_gid;
-  ib_net16_t                      subscriber_enum;
-  osm_infr_rcv_t*                 p_rcv;
-  osm_physp_t*                    p_req_physp;
+typedef struct _osm_iir_search_ctxt {
+	const ib_inform_info_record_t *p_rcvd_rec;
+	ib_net64_t comp_mask;
+	cl_qlist_t *p_list;
+	ib_gid_t subscriber_gid;
+	ib_net16_t subscriber_enum;
+	osm_infr_rcv_t *p_rcv;
+	osm_physp_t *p_req_physp;
 } osm_iir_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_infr_rcv_construct(
-  IN osm_infr_rcv_t* const p_rcv )
+void osm_infr_rcv_construct(IN osm_infr_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
-  cl_qlock_pool_construct( &p_rcv->pool );
+	memset(p_rcv, 0, sizeof(*p_rcv));
+	cl_qlock_pool_construct(&p_rcv->pool);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_infr_rcv_destroy(
-  IN osm_infr_rcv_t* const p_rcv )
+void osm_infr_rcv_destroy(IN osm_infr_rcv_t * const p_rcv)
 {
-  CL_ASSERT( p_rcv );
+	CL_ASSERT(p_rcv);
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_infr_rcv_destroy );
-  cl_qlock_pool_destroy( &p_rcv->pool );
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_infr_rcv_destroy);
+	cl_qlock_pool_destroy(&p_rcv->pool);
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_infr_rcv_init(
-  IN osm_infr_rcv_t*    const p_rcv,
-  IN osm_sa_resp_t*     const p_resp,
-  IN osm_mad_pool_t*    const p_mad_pool,
-  IN osm_subn_t*        const p_subn,
-  IN osm_log_t*         const p_log,
-  IN cl_plock_t*        const p_lock )
+osm_infr_rcv_init(IN osm_infr_rcv_t * const p_rcv,
+		  IN osm_sa_resp_t * const p_resp,
+		  IN osm_mad_pool_t * const p_mad_pool,
+		  IN osm_subn_t * const p_subn,
+		  IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t status = IB_ERROR;
+	ib_api_status_t status = IB_ERROR;
 
-  OSM_LOG_ENTER( p_log, osm_infr_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_infr_rcv_init);
 
-  osm_infr_rcv_construct( p_rcv );
+	osm_infr_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_resp = p_resp;
-  p_rcv->p_mad_pool = p_mad_pool;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_resp = p_resp;
+	p_rcv->p_mad_pool = p_mad_pool;
 
-  status = cl_qlock_pool_init( &p_rcv->pool,
-                               OSM_IIR_RCV_POOL_MIN_SIZE,
-                               0,
-                               OSM_IIR_RCV_POOL_GROW_SIZE,
-                               sizeof(osm_iir_item_t),
-                               NULL, NULL, NULL );
+	status = cl_qlock_pool_init(&p_rcv->pool,
+				    OSM_IIR_RCV_POOL_MIN_SIZE,
+				    0,
+				    OSM_IIR_RCV_POOL_GROW_SIZE,
+				    sizeof(osm_iir_item_t), NULL, NULL, NULL);
 
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
@@ -151,139 +142,132 @@ 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_infr_rcv_t*   const p_rcv,
-  IN osm_infr_t*       p_infr_rec )
+__validate_ports_access_rights(IN osm_infr_rcv_t * const p_rcv,
+			       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;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __validate_ports_access_rights );
-
-  /* get the requester physp from the request address */
-  p_requester_physp = osm_get_physp_by_mad_addr( p_rcv->p_log,
-                                                 p_rcv->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) ) )
-  {
-    /* a gid is defined */
-    portguid = p_infr_rec->inform_record.inform_info.gid.unicast.interface_id;
-
-    p_port = osm_get_port_by_guid( p_rcv->p_subn, portguid );
-
-    if ( p_port == NULL )
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "__validate_ports_access_rights: ERR 4301: "
-               "Invalid port guid: 0x%016" PRIx64 "\n",
-               cl_ntoh64(portguid) );
-      valid = FALSE;
-      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. */
-    if (! osm_physp_share_pkey( p_rcv->p_log, p_physp, p_requester_physp))
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-               "__validate_ports_access_rights: "
-               "port and requester don't share pkey\n" );
-      valid = FALSE;
-      goto Exit;
-    }
-  }
-  else
-  {
-    /* gid is zero - check if LID range is defined */
-    lid_range_begin = cl_ntoh16(p_infr_rec->inform_record.inform_info.lid_range_begin);
-    /* if lid is 0xFFFF - meaning all endports managed by the manager */
-    if ( lid_range_begin == 0xFFFF )
-      goto Exit;
-
-    lid_range_end = 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. */
-    if (lid_range_end == 0)
-      lid_range_end = lid_range_begin;
-
-    /* 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 = &p_rcv->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( p_rcv->p_log, OSM_LOG_ERROR,
-                 "__validate_ports_access_rights: ERR 4302: "
-                 "Given LID (0x%X) is out of range:0x%X\n",
-                 lid, cl_ptr_vector_get_size(p_tbl) );
-        valid = FALSE;
-        goto Exit;
-      }
-      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( p_rcv->p_log, p_physp, p_requester_physp))
-      {
-        osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-                 "__validate_ports_access_rights: "
-                 "port and requester don't share pkey\n" );
-        valid = FALSE;
-        goto Exit;
-      }
-    }
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return valid;
+	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;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __validate_ports_access_rights);
+
+	/* get the requester physp from the request address */
+	p_requester_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+						      p_rcv->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))) {
+		/* a gid is defined */
+		portguid =
+		    p_infr_rec->inform_record.inform_info.gid.unicast.
+		    interface_id;
+
+		p_port = osm_get_port_by_guid(p_rcv->p_subn, portguid);
+
+		if (p_port == NULL) {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"__validate_ports_access_rights: ERR 4301: "
+				"Invalid port guid: 0x%016" PRIx64 "\n",
+				cl_ntoh64(portguid));
+			valid = FALSE;
+			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. */
+		if (!osm_physp_share_pkey
+		    (p_rcv->p_log, p_physp, p_requester_physp)) {
+			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				"__validate_ports_access_rights: "
+				"port and requester don't share pkey\n");
+			valid = FALSE;
+			goto Exit;
+		}
+	} else {
+		/* gid is zero - check if LID range is defined */
+		lid_range_begin =
+		    cl_ntoh16(p_infr_rec->inform_record.inform_info.
+			      lid_range_begin);
+		/* if lid is 0xFFFF - meaning all endports managed by the manager */
+		if (lid_range_begin == 0xFFFF)
+			goto Exit;
+
+		lid_range_end =
+		    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. */
+		if (lid_range_end == 0)
+			lid_range_end = lid_range_begin;
+
+		/* 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 = &p_rcv->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(p_rcv->p_log, OSM_LOG_ERROR,
+					"__validate_ports_access_rights: ERR 4302: "
+					"Given LID (0x%X) is out of range:0x%X\n",
+					lid, cl_ptr_vector_get_size(p_tbl));
+				valid = FALSE;
+				goto Exit;
+			}
+			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
+			    (p_rcv->p_log, p_physp, p_requester_physp)) {
+				osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+					"__validate_ports_access_rights: "
+					"port and requester don't share pkey\n");
+				valid = FALSE;
+				goto Exit;
+			}
+		}
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return valid;
 }
 
 /**********************************************************************
  **********************************************************************/
 static boolean_t
-__validate_infr(
-  IN osm_infr_rcv_t*    const p_rcv,
-  IN osm_infr_t*        p_infr_rec )
+__validate_infr(IN osm_infr_rcv_t * const p_rcv, IN osm_infr_t * p_infr_rec)
 {
-  boolean_t valid = TRUE;
+	boolean_t valid = TRUE;
 
-  OSM_LOG_ENTER( p_rcv->p_log, __validate_infr );
+	OSM_LOG_ENTER(p_rcv->p_log, __validate_infr);
 
-  valid = __validate_ports_access_rights( p_rcv, p_infr_rec );
-  if (!valid)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__validate_infr: "
-             "Invalid Access for InformInfo\n" );
-    valid = FALSE;
-  }
+	valid = __validate_ports_access_rights(p_rcv, p_infr_rec);
+	if (!valid) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__validate_infr: " "Invalid Access for InformInfo\n");
+		valid = FALSE;
+	}
 
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return valid;
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return valid;
 }
 
 /**********************************************************************
@@ -292,633 +276,614 @@ with an InformInfo attribute that is a copy of the data in the
 Set(InformInfo) request.
 **********************************************************************/
 static void
-__osm_infr_rcv_respond(
-  IN osm_infr_rcv_t*    const p_rcv,
-  IN const osm_madw_t*  const p_madw )
+__osm_infr_rcv_respond(IN osm_infr_rcv_t * const p_rcv,
+		       IN const osm_madw_t * const 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_inform_info_t*     p_resp_infr;
-  ib_api_status_t       status;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_infr_rcv_respond );
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_infr_rcv_respond: "
-             "Generating successful InformInfo response\n");
-  }
-
-  /*
-    Get a MAD to reply. Address of Mad is in the received mad_wrapper
-  */
-  p_resp_madw = osm_mad_pool_get( p_rcv->p_mad_pool,
-                                  p_madw->h_bind,
-                                  MAD_BLOCK_SIZE,
-                                  &p_madw->mad_addr );
-  if ( !p_resp_madw )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_infr_rcv_respond: ERR 4303: "
-             "Unable to allocate MAD\n" );
-    goto Exit;
-  }
-
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
-
-  /* copy the request InformInfo */
-  memcpy( p_resp_sa_mad, p_sa_mad, MAD_BLOCK_SIZE );
-  p_resp_sa_mad->method = IB_MAD_METHOD_GET_RESP;
-  /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
-  p_resp_sa_mad->sm_key = 0;
-
-  p_resp_infr = (ib_inform_info_t*)ib_sa_mad_get_payload_ptr( p_resp_sa_mad );
-
-  status = osm_vendor_send( p_resp_madw->h_bind, p_resp_madw,  FALSE );
-
-  if ( status != IB_SUCCESS )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_infr_rcv_respond: ERR 4304: "
-             "Unable to send MAD (%s)\n", ib_get_err_str( status ) );
-    /* osm_mad_pool_put( p_rcv->p_mad_pool, p_resp_madw ); */
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_madw_t *p_resp_madw;
+	const ib_sa_mad_t *p_sa_mad;
+	ib_sa_mad_t *p_resp_sa_mad;
+	ib_inform_info_t *p_resp_infr;
+	ib_api_status_t status;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_infr_rcv_respond);
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_infr_rcv_respond: "
+			"Generating successful InformInfo response\n");
+	}
+
+	/*
+	   Get a MAD to reply. Address of Mad is in the received mad_wrapper
+	 */
+	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+				       p_madw->h_bind,
+				       MAD_BLOCK_SIZE, &p_madw->mad_addr);
+	if (!p_resp_madw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_infr_rcv_respond: ERR 4303: "
+			"Unable to allocate MAD\n");
+		goto Exit;
+	}
+
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+
+	/* copy the request InformInfo */
+	memcpy(p_resp_sa_mad, p_sa_mad, MAD_BLOCK_SIZE);
+	p_resp_sa_mad->method = IB_MAD_METHOD_GET_RESP;
+	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
+	p_resp_sa_mad->sm_key = 0;
+
+	p_resp_infr =
+	    (ib_inform_info_t *) ib_sa_mad_get_payload_ptr(p_resp_sa_mad);
+
+	status = osm_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE);
+
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_infr_rcv_respond: ERR 4304: "
+			"Unable to send MAD (%s)\n", ib_get_err_str(status));
+		/* osm_mad_pool_put( p_rcv->p_mad_pool, p_resp_madw ); */
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_inform_info_rec_by_comp_mask(
-  IN osm_infr_rcv_t*       const p_rcv,
-  IN const osm_infr_t*     const p_infr,
-  osm_iir_search_ctxt_t*   const p_ctxt )
+__osm_sa_inform_info_rec_by_comp_mask(IN osm_infr_rcv_t * const p_rcv,
+				      IN const osm_infr_t * const p_infr,
+				      osm_iir_search_ctxt_t * const 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;
-  osm_physp_t *            p_subscriber_physp;
-  const osm_physp_t*       p_req_physp;
-  osm_iir_item_t*          p_rec_item;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_sa_inform_info_rec_by_comp_mask );
-
-  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)
-  {
-    if (memcmp(&p_infr->inform_record.subscriber_gid,
-	       &p_ctxt->subscriber_gid,
-	       sizeof(p_infr->inform_record.subscriber_gid)))
-      goto Exit;
-  }
-
-  if (comp_mask & IB_IIR_COMPMASK_ENUM)
-  {
-    if (p_infr->inform_record.subscriber_enum != p_ctxt->subscriber_enum)
-      goto Exit;
-  }
-
-  /* Implement any other needed search cases */
-
-  /* Ensure pkey is shared before returning any records */
-  portguid = p_infr->inform_record.subscriber_gid.unicast.interface_id;
-  p_subscriber_port = osm_get_port_by_guid( p_rcv->p_subn, portguid );
-  if ( p_subscriber_port == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_sa_inform_info_rec_by_comp_mask: ERR 430D: "
-             "Invalid subscriber port guid: 0x%016" PRIx64 "\n",
-             cl_ntoh64(portguid) );
-    goto Exit;
-  }
-
-  /* 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( p_rcv->p_log, p_req_physp, p_subscriber_physp ))
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_sa_inform_info_rec_by_comp_mask: "
-             "requester and subscriber ports don't share pkey\n" );
-    goto Exit;
-  }
-
-  p_rec_item = (osm_iir_item_t*)cl_qlock_pool_get( &p_rcv->pool );
-  if( p_rec_item == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_sa_inform_info_rec_by_comp_mask: ERR 430E: "
-             "cl_qlock_pool_get failed\n" );
-    goto Exit;
-  }
-
-  memcpy((void *)&p_rec_item->rec, (void *)&p_infr->inform_record, sizeof(ib_inform_info_record_t));
-  cl_qlist_insert_tail( p_ctxt->p_list, (cl_list_item_t*)&p_rec_item->pool_item );
-
-Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	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;
+	osm_physp_t *p_subscriber_physp;
+	const osm_physp_t *p_req_physp;
+	osm_iir_item_t *p_rec_item;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_inform_info_rec_by_comp_mask);
+
+	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) {
+		if (memcmp(&p_infr->inform_record.subscriber_gid,
+			   &p_ctxt->subscriber_gid,
+			   sizeof(p_infr->inform_record.subscriber_gid)))
+			goto Exit;
+	}
+
+	if (comp_mask & IB_IIR_COMPMASK_ENUM) {
+		if (p_infr->inform_record.subscriber_enum !=
+		    p_ctxt->subscriber_enum)
+			goto Exit;
+	}
+
+	/* Implement any other needed search cases */
+
+	/* Ensure pkey is shared before returning any records */
+	portguid = p_infr->inform_record.subscriber_gid.unicast.interface_id;
+	p_subscriber_port = osm_get_port_by_guid(p_rcv->p_subn, portguid);
+	if (p_subscriber_port == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_sa_inform_info_rec_by_comp_mask: ERR 430D: "
+			"Invalid subscriber port guid: 0x%016" PRIx64 "\n",
+			cl_ntoh64(portguid));
+		goto Exit;
+	}
+
+	/* 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
+	    (p_rcv->p_log, p_req_physp, p_subscriber_physp)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_sa_inform_info_rec_by_comp_mask: "
+			"requester and subscriber ports don't share pkey\n");
+		goto Exit;
+	}
+
+	p_rec_item = (osm_iir_item_t *) cl_qlock_pool_get(&p_rcv->pool);
+	if (p_rec_item == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_sa_inform_info_rec_by_comp_mask: ERR 430E: "
+			"cl_qlock_pool_get failed\n");
+		goto Exit;
+	}
+
+	memcpy((void *)&p_rec_item->rec, (void *)&p_infr->inform_record,
+	       sizeof(ib_inform_info_record_t));
+	cl_qlist_insert_tail(p_ctxt->p_list,
+			     (cl_list_item_t *) & p_rec_item->pool_item);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->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 )
+__osm_sa_inform_info_rec_by_comp_mask_cb(IN cl_list_item_t * const 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 *const p_infr = (osm_infr_t *) p_list_item;
+	osm_iir_search_ctxt_t *const p_ctxt = (osm_iir_search_ctxt_t *) context;
 
-  __osm_sa_inform_info_rec_by_comp_mask( p_ctxt->p_rcv, p_infr, p_ctxt );
+	__osm_sa_inform_info_rec_by_comp_mask(p_ctxt->p_rcv, p_infr, p_ctxt);
 }
 
 /**********************************************************************
 Received a Get(InformInfoRecord) or GetTable(InformInfoRecord) MAD
 **********************************************************************/
 static void
-osm_infr_rcv_process_get_method(
-  IN osm_infr_rcv_t*      const p_rcv,
-  IN const osm_madw_t*    const p_madw )
+osm_infr_rcv_process_get_method(IN osm_infr_rcv_t * const p_rcv,
+				IN const osm_madw_t * const p_madw)
 {
-  ib_sa_mad_t*            p_rcvd_mad;
-  const ib_inform_info_record_t* p_rcvd_rec;
-  ib_inform_info_record_t* p_resp_rec;
-  cl_qlist_t              rec_list;
-  osm_madw_t*             p_resp_madw;
-  ib_sa_mad_t*            p_resp_sa_mad;
-  uint32_t                num_rec, pre_trim_num_rec;
+	ib_sa_mad_t *p_rcvd_mad;
+	const ib_inform_info_record_t *p_rcvd_rec;
+	ib_inform_info_record_t *p_resp_rec;
+	cl_qlist_t rec_list;
+	osm_madw_t *p_resp_madw;
+	ib_sa_mad_t *p_resp_sa_mad;
+	uint32_t num_rec, pre_trim_num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  uint32_t                trim_num_rec;
+	uint32_t trim_num_rec;
 #endif
-  uint32_t                i, j;
-  osm_iir_search_ctxt_t   context;
-  osm_iir_item_t*         p_rec_item;
-  ib_api_status_t         status = IB_SUCCESS;
-  osm_physp_t*            p_req_physp;
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_infr_rcv_process_get_method );
-
-  CL_ASSERT( p_madw );
-  p_rcvd_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_rcvd_rec =
-    (ib_inform_info_record_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
-
-  /* update the requester physical port. */
-  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-                                          p_rcv->p_subn,
-                                          osm_madw_get_mad_addr_ptr(p_madw) );
-  if (p_req_physp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_infr_rcv_process_get_method: ERR 4309: "
-             "Cannot find requester physical port\n" );
-    goto Exit;
-  }
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    osm_dump_inform_info_record( p_rcv->p_log, p_rcvd_rec, OSM_LOG_DEBUG );
-
-  cl_qlist_init( &rec_list );
-
-  context.p_rcvd_rec = p_rcvd_rec;
-  context.p_list = &rec_list;
-  context.comp_mask = p_rcvd_mad->comp_mask;
-  context.subscriber_gid = p_rcvd_rec->subscriber_gid;
-  context.subscriber_enum = p_rcvd_rec->subscriber_enum;
-  context.p_rcv = p_rcv;
-  context.p_req_physp = p_req_physp;
-
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "osm_infr_rcv_process_get_method: "
-           "Query Subscriber GID:0x%016" PRIx64 " : 0x%016" PRIx64 "(%02X) Enum:0x%X(%02X)\n",
-           cl_ntoh64(p_rcvd_rec->subscriber_gid.unicast.prefix),
-           cl_ntoh64(p_rcvd_rec->subscriber_gid.unicast.interface_id),
-           (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 );
-
-  cl_plock_acquire( p_rcv->p_lock );
-
-  cl_qlist_apply_func( &p_rcv->p_subn->sa_infr_list,
-                       __osm_sa_inform_info_rec_by_comp_mask_cb,
-                       &context );
-
-  cl_plock_release( p_rcv->p_lock );
-
-  num_rec = cl_qlist_count( &rec_list );
-
-  /*
-   * C15-0.1.30:
-   * If we do a SubnAdmGet and got more than one record it is an error !
-   */
-  if (p_rcvd_mad->method == IB_MAD_METHOD_GET)
-  {
-    if (num_rec == 0)
-    {
-      osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-      goto Exit;
-    }
-    if (num_rec > 1)
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_infr_rcv_process_get_method: ERR 430A: "
-               "More than one record for SubnAdmGet (%u)\n",
-               num_rec );
-      osm_sa_send_error( p_rcv->p_resp, p_madw,
-                         IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
-
-      /* need to set the mem free ... */
-      p_rec_item = (osm_iir_item_t*)cl_qlist_remove_head( &rec_list );
-      while( p_rec_item != (osm_iir_item_t*)cl_qlist_end( &rec_list ) )
-      {
-        cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-        p_rec_item = (osm_iir_item_t*)cl_qlist_remove_head( &rec_list );
-      }
-
-      goto Exit;
-    }
-  }
-
-  pre_trim_num_rec = num_rec;
+	uint32_t i, j;
+	osm_iir_search_ctxt_t context;
+	osm_iir_item_t *p_rec_item;
+	ib_api_status_t status = IB_SUCCESS;
+	osm_physp_t *p_req_physp;
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_infr_rcv_process_get_method);
+
+	CL_ASSERT(p_madw);
+	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_rcvd_rec =
+	    (ib_inform_info_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+
+	/* update the requester physical port. */
+	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+						p_rcv->p_subn,
+						osm_madw_get_mad_addr_ptr
+						(p_madw));
+	if (p_req_physp == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_infr_rcv_process_get_method: ERR 4309: "
+			"Cannot find requester physical port\n");
+		goto Exit;
+	}
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
+		osm_dump_inform_info_record(p_rcv->p_log, p_rcvd_rec,
+					    OSM_LOG_DEBUG);
+
+	cl_qlist_init(&rec_list);
+
+	context.p_rcvd_rec = p_rcvd_rec;
+	context.p_list = &rec_list;
+	context.comp_mask = p_rcvd_mad->comp_mask;
+	context.subscriber_gid = p_rcvd_rec->subscriber_gid;
+	context.subscriber_enum = p_rcvd_rec->subscriber_enum;
+	context.p_rcv = p_rcv;
+	context.p_req_physp = p_req_physp;
+
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"osm_infr_rcv_process_get_method: "
+		"Query Subscriber GID:0x%016" PRIx64 " : 0x%016" PRIx64
+		"(%02X) Enum:0x%X(%02X)\n",
+		cl_ntoh64(p_rcvd_rec->subscriber_gid.unicast.prefix),
+		cl_ntoh64(p_rcvd_rec->subscriber_gid.unicast.interface_id),
+		(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);
+
+	cl_plock_acquire(p_rcv->p_lock);
+
+	cl_qlist_apply_func(&p_rcv->p_subn->sa_infr_list,
+			    __osm_sa_inform_info_rec_by_comp_mask_cb, &context);
+
+	cl_plock_release(p_rcv->p_lock);
+
+	num_rec = cl_qlist_count(&rec_list);
+
+	/*
+	 * C15-0.1.30:
+	 * If we do a SubnAdmGet and got more than one record it is an error !
+	 */
+	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
+		if (num_rec == 0) {
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_NO_RECORDS);
+			goto Exit;
+		}
+		if (num_rec > 1) {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_infr_rcv_process_get_method: ERR 430A: "
+				"More than one record for SubnAdmGet (%u)\n",
+				num_rec);
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
+
+			/* need to set the mem free ... */
+			p_rec_item =
+			    (osm_iir_item_t *) cl_qlist_remove_head(&rec_list);
+			while (p_rec_item !=
+			       (osm_iir_item_t *) cl_qlist_end(&rec_list)) {
+				cl_qlock_pool_put(&p_rcv->pool,
+						  &p_rec_item->pool_item);
+				p_rec_item =
+				    (osm_iir_item_t *)
+				    cl_qlist_remove_head(&rec_list);
+			}
+
+			goto Exit;
+		}
+	}
+
+	pre_trim_num_rec = num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we limit the number of records to a single packet */
-  trim_num_rec = (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_inform_info_record_t);
-  if (trim_num_rec < num_rec)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "osm_infr_rcv_process_get_method: "
-             "Number of records:%u trimmed to:%u to fit in one MAD\n",
-             num_rec, trim_num_rec );
-    num_rec = trim_num_rec;
-  }
+	/* we limit the number of records to a single packet */
+	trim_num_rec =
+	    (MAD_BLOCK_SIZE -
+	     IB_SA_MAD_HDR_SIZE) / sizeof(ib_inform_info_record_t);
+	if (trim_num_rec < num_rec) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"osm_infr_rcv_process_get_method: "
+			"Number of records:%u trimmed to:%u to fit in one MAD\n",
+			num_rec, trim_num_rec);
+		num_rec = trim_num_rec;
+	}
 #endif
 
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "osm_infr_rcv_process_get_method: "
-           "Returning %u records\n", num_rec );
-
-  /*
-   * Get a MAD to reply. Address of Mad is in the received mad_wrapper
-   */
-  p_resp_madw = osm_mad_pool_get( p_rcv->p_mad_pool,
-                                  p_madw->h_bind,
-                                  num_rec * sizeof(ib_inform_info_record_t) + IB_SA_MAD_HDR_SIZE,
-                                  &p_madw->mad_addr );
-
-  if( !p_resp_madw )
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_infr_rcv_process_get_method: ERR 430B: "
-            "osm_mad_pool_get failed\n" );
-
-    for( i = 0; i < num_rec; i++ )
-    {
-      p_rec_item = (osm_iir_item_t*)cl_qlist_remove_head( &rec_list );
-      cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    }
-
-    osm_sa_send_error( p_rcv->p_resp, p_madw,
-                       IB_SA_MAD_STATUS_NO_RESOURCES );
-
-    goto Exit;
-  }
-
-  p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
-
-  /*
-    Copy the MAD header back into the response mad.
-    Set the 'R' bit and the payload length,
-    Then copy all records from the list into the response payload.
-  */
-
-  memcpy( p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE );
-  p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-  /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
-  p_resp_sa_mad->sm_key = 0;
-  /* Fill in the offset (paylen will be done by the rmpp SAR) */
-  p_resp_sa_mad->attr_offset =
-    ib_get_attr_offset( sizeof(ib_inform_info_record_t) );
-
-  p_resp_rec = (ib_inform_info_record_t*)ib_sa_mad_get_payload_ptr( p_resp_sa_mad );
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"osm_infr_rcv_process_get_method: "
+		"Returning %u records\n", num_rec);
+
+	/*
+	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
+	 */
+	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+				       p_madw->h_bind,
+				       num_rec *
+				       sizeof(ib_inform_info_record_t) +
+				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
+
+	if (!p_resp_madw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_infr_rcv_process_get_method: ERR 430B: "
+			"osm_mad_pool_get failed\n");
+
+		for (i = 0; i < num_rec; i++) {
+			p_rec_item =
+			    (osm_iir_item_t *) cl_qlist_remove_head(&rec_list);
+			cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		}
+
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RESOURCES);
+
+		goto Exit;
+	}
+
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+
+	/*
+	   Copy the MAD header back into the response mad.
+	   Set the 'R' bit and the payload length,
+	   Then copy all records from the list into the response payload.
+	 */
+
+	memcpy(p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE);
+	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
+	p_resp_sa_mad->sm_key = 0;
+	/* Fill in the offset (paylen will be done by the rmpp SAR) */
+	p_resp_sa_mad->attr_offset =
+	    ib_get_attr_offset(sizeof(ib_inform_info_record_t));
+
+	p_resp_rec =
+	    (ib_inform_info_record_t *)
+	    ib_sa_mad_get_payload_ptr(p_resp_sa_mad);
 
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we support only one packet RMPP - so we will set the first and
-     last flags for gettable */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-  {
-    p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST | IB_RMPP_FLAG_ACTIVE;
-  }
+	/* we support only one packet RMPP - so we will set the first and
+	   last flags for gettable */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+		p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
+		p_resp_sa_mad->rmpp_flags =
+		    IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST |
+		    IB_RMPP_FLAG_ACTIVE;
+	}
 #else
-  /* forcefully define the packet as RMPP one */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
+	/* forcefully define the packet as RMPP one */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
+		p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
 #endif
 
-  for( i = 0; i < pre_trim_num_rec; i++ )
-  {
-    p_rec_item = (osm_iir_item_t*)cl_qlist_remove_head( &rec_list );
-    /* copy only if not trimmed */
-    if (i < num_rec)
-    {
-      *p_resp_rec = p_rec_item->rec;
-      /* clear reserved and pad fields in InformInfoRecord */
-      for (j = 0; j < 6; j++)
-        p_resp_rec->reserved[j] = 0;
-      for (j = 0; j < 4; j++)
-        p_resp_rec->pad[j] = 0;
-    }
-    cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    p_resp_rec++;
-  }
-
-  CL_ASSERT( cl_is_qlist_empty( &rec_list ) );
-
-  status = osm_vendor_send( p_resp_madw->h_bind, p_resp_madw, FALSE );
-  if (status != IB_SUCCESS)
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_infr_rcv_process_get_method: ERR 430C: "
-            "osm_vendor_send status = %s\n",
-            ib_get_err_str(status));
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	for (i = 0; i < pre_trim_num_rec; i++) {
+		p_rec_item = (osm_iir_item_t *) cl_qlist_remove_head(&rec_list);
+		/* copy only if not trimmed */
+		if (i < num_rec) {
+			*p_resp_rec = p_rec_item->rec;
+			/* clear reserved and pad fields in InformInfoRecord */
+			for (j = 0; j < 6; j++)
+				p_resp_rec->reserved[j] = 0;
+			for (j = 0; j < 4; j++)
+				p_resp_rec->pad[j] = 0;
+		}
+		cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		p_resp_rec++;
+	}
+
+	CL_ASSERT(cl_is_qlist_empty(&rec_list));
+
+	status = osm_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE);
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_infr_rcv_process_get_method: ERR 430C: "
+			"osm_vendor_send status = %s\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /*********************************************************************
 Received a Set(InformInfo) MAD
 **********************************************************************/
 static void
-osm_infr_rcv_process_set_method(
-  IN osm_infr_rcv_t*      const p_rcv,
-  IN const osm_madw_t*    const p_madw )
+osm_infr_rcv_process_set_method(IN osm_infr_rcv_t * const p_rcv,
+				IN const osm_madw_t * const p_madw)
 {
-  ib_sa_mad_t *p_sa_mad;
-  ib_inform_info_t *p_recvd_inform_info;
-  osm_infr_t inform_info_rec; /* actual inform record to be stored for reports */
-  osm_infr_t *p_infr;
-  ib_net32_t qpn;
-  uint8_t resp_time_val;
-  ib_api_status_t res;
+	ib_sa_mad_t *p_sa_mad;
+	ib_inform_info_t *p_recvd_inform_info;
+	osm_infr_t inform_info_rec;	/* actual inform record to be stored for reports */
+	osm_infr_t *p_infr;
+	ib_net32_t qpn;
+	uint8_t resp_time_val;
+	ib_api_status_t res;
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_infr_rcv_process_set_method );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_infr_rcv_process_set_method);
 
-  CL_ASSERT( p_madw );
+	CL_ASSERT(p_madw);
 
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_recvd_inform_info =
-    (ib_inform_info_t*)ib_sa_mad_get_payload_ptr( p_sa_mad );
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_recvd_inform_info =
+	    (ib_inform_info_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
 
 #if 0
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    osm_dump_inform_info( p_rcv->p_log, p_recvd_inform_info, OSM_LOG_DEBUG );
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
+		osm_dump_inform_info(p_rcv->p_log, p_recvd_inform_info,
+				     OSM_LOG_DEBUG);
 #endif
 
-  /* Grab the lock */
-  cl_plock_excl_acquire( p_rcv->p_lock );
-
-  /* define the inform record */
-  inform_info_rec.inform_record.inform_info = *p_recvd_inform_info;
-
-  /* following C13-32.1.2 Tbl 120: we only copy the source address vector */
-  inform_info_rec.report_addr = p_madw->mad_addr;
-
-  /* we will need to know the mad srvc to send back through */
-  inform_info_rec.h_bind = p_madw->h_bind;
-  inform_info_rec.p_infr_rcv = p_rcv;
-
-  /* update the subscriber GID according to mad address */
-  res = osm_get_gid_by_mad_addr(
-    p_rcv->p_log,
-    p_rcv->p_subn,
-    &p_madw->mad_addr,
-    &inform_info_rec.inform_record.subscriber_gid );
-  if ( res != IB_SUCCESS )
-  {
-    cl_plock_release( p_rcv->p_lock );
-
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_infr_rcv_process_set_method: ERR 4308 "
-             "Subscribe Request from unknown LID: 0x%04X\n",
-             cl_ntoh16(p_madw->mad_addr.dest_lid)
-             );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_REQ_INVALID );
-    goto Exit;
-  }
-
-  /* HACK: enum is always 0 (currently) */
-  inform_info_rec.inform_record.subscriber_enum = 0;
-
-  /* Subscribe values above 1 are undefined */
-  if ( p_recvd_inform_info->subscribe > 1 )
-  {
-    cl_plock_release( p_rcv->p_lock );
-
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_infr_rcv_process_set_method: ERR 4308 "
-             "Invalid subscribe: %d\n",
-             p_recvd_inform_info->subscribe
-             );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_REQ_INVALID );
-    goto Exit;
-  }
-
-  /*
-   * MODIFICATIONS DONE ON INCOMING REQUEST:
-   *
-   * QPN:
-   * Internally we keep the QPN field of the InformInfo updated
-   * so we can simply compare it in the record - when finding such.
-   */
-  if ( p_recvd_inform_info->subscribe )
-  {
-    ib_inform_info_set_qpn(
-      &inform_info_rec.inform_record.inform_info,
-      inform_info_rec.report_addr.addr_type.gsi.remote_qp );
-
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_infr_rcv_process_set_method: "
-             "Subscribe Request with QPN: 0x%06X\n",
-             cl_ntoh32(inform_info_rec.report_addr.addr_type.gsi.remote_qp)
-             );
-  }
-  else
-  {
-    ib_inform_info_get_qpn_resp_time(
-      p_recvd_inform_info->g_or_v.generic.qpn_resp_time_val,
-      &qpn, &resp_time_val );
-
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_infr_rcv_process_set_method: "
-             "UnSubscribe Request with QPN: 0x%06X\n",
-             cl_ntoh32(qpn)
-             );
-  }
-
-  /* If record exists with matching InformInfo */
-  p_infr = osm_infr_get_by_rec( p_rcv->p_subn, p_rcv->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( p_rcv, &inform_info_rec ) != TRUE )
-    {
-      cl_plock_release( p_rcv->p_lock );
-
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_infr_rcv_process_set_method: ERR 4305: "
-               "Failed to validate a new inform object\n");
-
-      /* o13-13.1.1: we need to set the subscribe bit to 0 */
-      p_recvd_inform_info->subscribe = 0;
-      osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_REQ_INVALID );
-      goto Exit;
-    }
-
-    /* ok - we can try and create a new entry */
-    if (p_infr == NULL)
-    {
-      /* Create the instance of the osm_infr_t object */
-      p_infr = osm_infr_new( &inform_info_rec );
-      if (p_infr == NULL)
-      {
-        cl_plock_release( p_rcv->p_lock );
-
-        osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-                 "osm_infr_rcv_process_set_method: ERR 4306: "
-                 "Failed to create a new inform object\n");
-
-        /* o13-13.1.1: we need to set the subscribe bit to 0 */
-        p_recvd_inform_info->subscribe = 0;
-        osm_sa_send_error( p_rcv->p_resp, p_madw,
-                           IB_SA_MAD_STATUS_NO_RESOURCES );
-        goto Exit;
-      }
-
-      /* Add this new osm_infr_t object to subnet object */
-      osm_infr_insert_to_db( p_rcv->p_subn, p_rcv->p_log, p_infr );
-    }
-    else
-    {
-      /* Update the old instance of the osm_infr_t object */
-      p_infr->inform_record = inform_info_rec.inform_record;
-    }
-  }
-  else
-  {
-    /* We got an UnSubscribe request */
-    if (p_infr == NULL)
-    {
-      cl_plock_release( p_rcv->p_lock );
-
-      /* No Such Item - So Error */
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_infr_rcv_process_set_method: ERR 4307: "
-               "Failed to UnSubscribe to non existing inform object\n");
-
-      /* o13-13.1.1: we need to set the subscribe bit to 0 */
-      p_recvd_inform_info->subscribe = 0;
-      osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_REQ_INVALID );
-      goto Exit;
-    }
-    else
-    {
-      /* Delete this object from the subnet list of informs */
-      osm_infr_remove_from_db( p_rcv->p_subn, p_rcv->p_log, p_infr );
-    }
-  }
-
-  cl_plock_release( p_rcv->p_lock );
-
-  /* send the success response */
-  __osm_infr_rcv_respond( p_rcv, p_madw );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	/* Grab the lock */
+	cl_plock_excl_acquire(p_rcv->p_lock);
+
+	/* define the inform record */
+	inform_info_rec.inform_record.inform_info = *p_recvd_inform_info;
+
+	/* following C13-32.1.2 Tbl 120: we only copy the source address vector */
+	inform_info_rec.report_addr = p_madw->mad_addr;
+
+	/* we will need to know the mad srvc to send back through */
+	inform_info_rec.h_bind = p_madw->h_bind;
+	inform_info_rec.p_infr_rcv = p_rcv;
+
+	/* update the subscriber GID according to mad address */
+	res = osm_get_gid_by_mad_addr(p_rcv->p_log,
+				      p_rcv->p_subn,
+				      &p_madw->mad_addr,
+				      &inform_info_rec.inform_record.
+				      subscriber_gid);
+	if (res != IB_SUCCESS) {
+		cl_plock_release(p_rcv->p_lock);
+
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_infr_rcv_process_set_method: ERR 4308 "
+			"Subscribe Request from unknown LID: 0x%04X\n",
+			cl_ntoh16(p_madw->mad_addr.dest_lid)
+		    );
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_REQ_INVALID);
+		goto Exit;
+	}
+
+	/* HACK: enum is always 0 (currently) */
+	inform_info_rec.inform_record.subscriber_enum = 0;
+
+	/* Subscribe values above 1 are undefined */
+	if (p_recvd_inform_info->subscribe > 1) {
+		cl_plock_release(p_rcv->p_lock);
+
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_infr_rcv_process_set_method: ERR 4308 "
+			"Invalid subscribe: %d\n",
+			p_recvd_inform_info->subscribe);
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_REQ_INVALID);
+		goto Exit;
+	}
+
+	/*
+	 * MODIFICATIONS DONE ON INCOMING REQUEST:
+	 *
+	 * QPN:
+	 * Internally we keep the QPN field of the InformInfo updated
+	 * so we can simply compare it in the record - when finding such.
+	 */
+	if (p_recvd_inform_info->subscribe) {
+		ib_inform_info_set_qpn(&inform_info_rec.inform_record.
+				       inform_info,
+				       inform_info_rec.report_addr.addr_type.
+				       gsi.remote_qp);
+
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"osm_infr_rcv_process_set_method: "
+			"Subscribe Request with QPN: 0x%06X\n",
+			cl_ntoh32(inform_info_rec.report_addr.addr_type.gsi.
+				  remote_qp)
+		    );
+	} else {
+		ib_inform_info_get_qpn_resp_time(p_recvd_inform_info->g_or_v.
+						 generic.qpn_resp_time_val,
+						 &qpn, &resp_time_val);
+
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"osm_infr_rcv_process_set_method: "
+			"UnSubscribe Request with QPN: 0x%06X\n", cl_ntoh32(qpn)
+		    );
+	}
+
+	/* If record exists with matching InformInfo */
+	p_infr =
+	    osm_infr_get_by_rec(p_rcv->p_subn, p_rcv->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(p_rcv, &inform_info_rec) != TRUE) {
+			cl_plock_release(p_rcv->p_lock);
+
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_infr_rcv_process_set_method: ERR 4305: "
+				"Failed to validate a new inform object\n");
+
+			/* o13-13.1.1: we need to set the subscribe bit to 0 */
+			p_recvd_inform_info->subscribe = 0;
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_REQ_INVALID);
+			goto Exit;
+		}
+
+		/* ok - we can try and create a new entry */
+		if (p_infr == NULL) {
+			/* Create the instance of the osm_infr_t object */
+			p_infr = osm_infr_new(&inform_info_rec);
+			if (p_infr == NULL) {
+				cl_plock_release(p_rcv->p_lock);
+
+				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+					"osm_infr_rcv_process_set_method: ERR 4306: "
+					"Failed to create a new inform object\n");
+
+				/* o13-13.1.1: we need to set the subscribe bit to 0 */
+				p_recvd_inform_info->subscribe = 0;
+				osm_sa_send_error(p_rcv->p_resp, p_madw,
+						  IB_SA_MAD_STATUS_NO_RESOURCES);
+				goto Exit;
+			}
+
+			/* Add this new osm_infr_t object to subnet object */
+			osm_infr_insert_to_db(p_rcv->p_subn, p_rcv->p_log,
+					      p_infr);
+		} else {
+			/* Update the old instance of the osm_infr_t object */
+			p_infr->inform_record = inform_info_rec.inform_record;
+		}
+	} else {
+		/* We got an UnSubscribe request */
+		if (p_infr == NULL) {
+			cl_plock_release(p_rcv->p_lock);
+
+			/* No Such Item - So Error */
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_infr_rcv_process_set_method: ERR 4307: "
+				"Failed to UnSubscribe to non existing inform object\n");
+
+			/* o13-13.1.1: we need to set the subscribe bit to 0 */
+			p_recvd_inform_info->subscribe = 0;
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_REQ_INVALID);
+			goto Exit;
+		} else {
+			/* Delete this object from the subnet list of informs */
+			osm_infr_remove_from_db(p_rcv->p_subn, p_rcv->p_log,
+						p_infr);
+		}
+	}
+
+	cl_plock_release(p_rcv->p_lock);
+
+	/* send the success response */
+	__osm_infr_rcv_respond(p_rcv, p_madw);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /*********************************************************************
 **********************************************************************/
-void
-osm_infr_rcv_process(
-  IN void *context,
-  IN void *data )
+void osm_infr_rcv_process(IN void *context, IN void *data)
 {
-  osm_infr_rcv_t *p_rcv = context;
-  osm_madw_t *p_madw = data;
-  ib_sa_mad_t *p_sa_mad;
+	osm_infr_rcv_t *p_rcv = context;
+	osm_madw_t *p_madw = data;
+	ib_sa_mad_t *p_sa_mad;
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_infr_rcv_process );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_infr_rcv_process);
 
-  CL_ASSERT( p_madw );
+	CL_ASSERT(p_madw);
 
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
 
-  CL_ASSERT( p_sa_mad->attr_id == IB_MAD_ATTR_INFORM_INFO );
+	CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_INFORM_INFO);
 
-  if (p_sa_mad->method != IB_MAD_METHOD_SET)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_infr_rcv_process: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_sa_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
+	if (p_sa_mad->method != IB_MAD_METHOD_SET) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"osm_infr_rcv_process: "
+			"Unsupported Method (%s)\n",
+			ib_get_sa_method_str(p_sa_mad->method));
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
+		goto Exit;
+	}
 
-  osm_infr_rcv_process_set_method( p_rcv, p_madw );
+	osm_infr_rcv_process_set_method(p_rcv, p_madw);
 
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /*********************************************************************
 **********************************************************************/
-void
-osm_infir_rcv_process(
-  IN void *context,
-  IN void *data )
+void osm_infir_rcv_process(IN void *context, IN void *data)
 {
-  osm_infr_rcv_t *p_rcv = context;
-  osm_madw_t *p_madw = data;
-  ib_sa_mad_t *p_sa_mad;
+	osm_infr_rcv_t *p_rcv = context;
+	osm_madw_t *p_madw = data;
+	ib_sa_mad_t *p_sa_mad;
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_infr_rcv_process );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_infr_rcv_process);
 
-  CL_ASSERT( p_madw );
+	CL_ASSERT(p_madw);
 
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
 
-  CL_ASSERT( p_sa_mad->attr_id == IB_MAD_ATTR_INFORM_INFO_RECORD );
+	CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_INFORM_INFO_RECORD);
 
-  if ( (p_sa_mad->method != IB_MAD_METHOD_GET) &&
-       (p_sa_mad->method != IB_MAD_METHOD_GETTABLE) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_infir_rcv_process: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_sa_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
+	if ((p_sa_mad->method != IB_MAD_METHOD_GET) &&
+	    (p_sa_mad->method != IB_MAD_METHOD_GETTABLE)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"osm_infir_rcv_process: "
+			"Unsupported Method (%s)\n",
+			ib_get_sa_method_str(p_sa_mad->method));
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
+		goto Exit;
+	}
 
-  osm_infr_rcv_process_get_method( p_rcv, p_madw );
+	osm_infr_rcv_process_get_method(p_rcv, p_madw);
 
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_sa_lft_record.c b/opensm/opensm/osm_sa_lft_record.c
index c5be44b..057d29b 100644
--- a/opensm/opensm/osm_sa_lft_record.c
+++ b/opensm/opensm/osm_sa_lft_record.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -62,455 +62,427 @@
 #define OSM_LFTR_RCV_POOL_MIN_SIZE      32
 #define OSM_LFTR_RCV_POOL_GROW_SIZE     32
 
-typedef   struct _osm_lftr_item
-{
-  cl_pool_item_t          pool_item;
-  ib_lft_record_t         rec;
+typedef struct _osm_lftr_item {
+	cl_pool_item_t pool_item;
+	ib_lft_record_t rec;
 } osm_lftr_item_t;
 
-typedef   struct _osm_lftr_search_ctxt
-{
-  const ib_lft_record_t*      p_rcvd_rec;
-  ib_net64_t                  comp_mask;
-  cl_qlist_t*                 p_list;
-  osm_lftr_rcv_t*             p_rcv;
-  const osm_physp_t*          p_req_physp;
+typedef struct _osm_lftr_search_ctxt {
+	const ib_lft_record_t *p_rcvd_rec;
+	ib_net64_t comp_mask;
+	cl_qlist_t *p_list;
+	osm_lftr_rcv_t *p_rcv;
+	const osm_physp_t *p_req_physp;
 } osm_lftr_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_lftr_rcv_construct(
-  IN osm_lftr_rcv_t* const p_rcv )
+void osm_lftr_rcv_construct(IN osm_lftr_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
-  cl_qlock_pool_construct( &p_rcv->pool );
+	memset(p_rcv, 0, sizeof(*p_rcv));
+	cl_qlock_pool_construct(&p_rcv->pool);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_lftr_rcv_destroy(
-  IN osm_lftr_rcv_t* const p_rcv )
+void osm_lftr_rcv_destroy(IN osm_lftr_rcv_t * const p_rcv)
 {
-  OSM_LOG_ENTER( p_rcv->p_log, osm_lftr_rcv_destroy );
-  cl_qlock_pool_destroy( &p_rcv->pool );
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_lftr_rcv_destroy);
+	cl_qlock_pool_destroy(&p_rcv->pool);
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_lftr_rcv_init(
-  IN osm_lftr_rcv_t* const p_rcv,
-  IN osm_sa_resp_t*  const p_resp,
-  IN osm_mad_pool_t* const p_mad_pool,
-  IN osm_subn_t*     const p_subn,
-  IN osm_log_t*      const p_log,
-  IN cl_plock_t*     const p_lock )
+osm_lftr_rcv_init(IN osm_lftr_rcv_t * const p_rcv,
+		  IN osm_sa_resp_t * const p_resp,
+		  IN osm_mad_pool_t * const p_mad_pool,
+		  IN osm_subn_t * const p_subn,
+		  IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t            status;
+	ib_api_status_t status;
 
-  OSM_LOG_ENTER( p_log, osm_lftr_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_lftr_rcv_init);
 
-  osm_lftr_rcv_construct( p_rcv );
+	osm_lftr_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_resp = p_resp;
-  p_rcv->p_mad_pool = p_mad_pool;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_resp = p_resp;
+	p_rcv->p_mad_pool = p_mad_pool;
 
-  status = cl_qlock_pool_init( &p_rcv->pool,
-                               OSM_LFTR_RCV_POOL_MIN_SIZE,
-                               0,
-                               OSM_LFTR_RCV_POOL_GROW_SIZE,
-                               sizeof(osm_lftr_item_t),
-                               NULL, NULL, NULL );
+	status = cl_qlock_pool_init(&p_rcv->pool,
+				    OSM_LFTR_RCV_POOL_MIN_SIZE,
+				    0,
+				    OSM_LFTR_RCV_POOL_GROW_SIZE,
+				    sizeof(osm_lftr_item_t), NULL, NULL, NULL);
 
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t
-__osm_lftr_rcv_new_lftr(
-  IN osm_lftr_rcv_t*         const p_rcv,
-  IN const osm_switch_t*     const p_sw,
-  IN cl_qlist_t*             const p_list,
-  IN ib_net16_t              const lid,
-  IN ib_net16_t              const block )
+__osm_lftr_rcv_new_lftr(IN osm_lftr_rcv_t * const p_rcv,
+			IN const osm_switch_t * const p_sw,
+			IN cl_qlist_t * const p_list,
+			IN ib_net16_t const lid, IN ib_net16_t const block)
 {
-  osm_lftr_item_t*           p_rec_item;
-  ib_api_status_t            status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_lftr_rcv_new_lftr );
-
-  p_rec_item = (osm_lftr_item_t*)cl_qlock_pool_get( &p_rcv->pool );
-  if( p_rec_item == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_lftr_rcv_new_lftr: ERR 4402: "
-             "cl_qlock_pool_get failed\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_lftr_rcv_new_lftr: "
-             "New LinearForwardingTable: sw 0x%016" PRIx64
-             "\n\t\t\t\tblock 0x%02X lid 0x%02X\n",
-             cl_ntoh64( osm_node_get_node_guid( p_sw->p_node ) ),
-             cl_ntoh16( block ), cl_ntoh16( lid )
-             );
-  }
-
-  memset( &p_rec_item->rec, 0, sizeof(ib_lft_record_t) );
-
-  p_rec_item->rec.lid = lid;
-  p_rec_item->rec.block_num = block;
-
-  /* copy the lft block */
-  osm_switch_get_fwd_tbl_block( p_sw, cl_ntoh16(block), p_rec_item->rec.lft );
-
-  cl_qlist_insert_tail( p_list, (cl_list_item_t*)&p_rec_item->pool_item );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	osm_lftr_item_t *p_rec_item;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_lftr_rcv_new_lftr);
+
+	p_rec_item = (osm_lftr_item_t *) cl_qlock_pool_get(&p_rcv->pool);
+	if (p_rec_item == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_lftr_rcv_new_lftr: ERR 4402: "
+			"cl_qlock_pool_get failed\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_lftr_rcv_new_lftr: "
+			"New LinearForwardingTable: sw 0x%016" PRIx64
+			"\n\t\t\t\tblock 0x%02X lid 0x%02X\n",
+			cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)),
+			cl_ntoh16(block), cl_ntoh16(lid)
+		    );
+	}
+
+	memset(&p_rec_item->rec, 0, sizeof(ib_lft_record_t));
+
+	p_rec_item->rec.lid = lid;
+	p_rec_item->rec.block_num = block;
+
+	/* copy the lft block */
+	osm_switch_get_fwd_tbl_block(p_sw, cl_ntoh16(block),
+				     p_rec_item->rec.lft);
+
+	cl_qlist_insert_tail(p_list,
+			     (cl_list_item_t *) & p_rec_item->pool_item);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
-static osm_port_t*
-__osm_lftr_get_port_by_guid(
-  IN osm_lftr_rcv_t*  const p_rcv,
-  IN uint64_t         port_guid )
+static osm_port_t *__osm_lftr_get_port_by_guid(IN osm_lftr_rcv_t * const p_rcv,
+					       IN uint64_t port_guid)
 {
-  osm_port_t*         p_port;
-
-  CL_PLOCK_ACQUIRE(p_rcv->p_lock);
-
-  p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
-  if (!p_port)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_lftr_get_port_by_guid ERR 4404: "
-             "Invalid port GUID 0x%016" PRIx64 "\n",
-             port_guid );
-    p_port = NULL;
-  }
-
-  CL_PLOCK_RELEASE(p_rcv->p_lock);
-  return p_port;
+	osm_port_t *p_port;
+
+	CL_PLOCK_ACQUIRE(p_rcv->p_lock);
+
+	p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+	if (!p_port) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_lftr_get_port_by_guid ERR 4404: "
+			"Invalid port GUID 0x%016" PRIx64 "\n", port_guid);
+		p_port = NULL;
+	}
+
+	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	return p_port;
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_lftr_rcv_by_comp_mask(
-  IN cl_map_item_t*         const p_map_item,
-  IN void*                  context )
+__osm_lftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
+			    IN void *context)
 {
-  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 ib_lft_record_t*    const p_rcvd_rec = p_ctxt->p_rcvd_rec;
-  osm_lftr_rcv_t*           const p_rcv = p_ctxt->p_rcv;
-  ib_net64_t                const comp_mask = p_ctxt->comp_mask;
-  const osm_physp_t*        const p_req_physp = p_ctxt->p_req_physp;
-  osm_port_t*               p_port;
-  uint16_t                  min_lid_ho, max_lid_ho;
-  uint16_t                  min_block, max_block, block;
-  const osm_physp_t*        p_physp;
-
-  /* In switches, the port guid is the node guid. */
-  p_port =
-    __osm_lftr_get_port_by_guid( p_rcv, p_sw->p_node->node_info.port_guid );
-  if (! p_port)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_lftr_rcv_by_comp_mask: ERR 4405: "
-             "Failed to find Port by Node Guid:0x%016" PRIx64
-             "\n",
-             cl_ntoh64( p_sw->p_node->node_info.node_guid )
-             );
-    return;
-  }
-
-  /* check that the requester physp and the current physp are under
-     the same partition. */
-  p_physp = p_port->p_physp;
-  if (! p_physp)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_lftr_rcv_by_comp_mask: ERR 4406: "
-             "Failed to find default physical Port by Node Guid:0x%016" PRIx64
-             "\n",
-             cl_ntoh64( p_sw->p_node->node_info.node_guid )
-             );
-    return;
-  }
-  if (! osm_physp_share_pkey( p_rcv->p_log, p_req_physp, p_physp ))
-    return;
-
-  /* get the port 0 of the switch */
-  osm_port_get_lid_range_ho( p_port, &min_lid_ho, &max_lid_ho );
-
-  /* compare the lids - if required */
-  if( comp_mask & IB_LFTR_COMPMASK_LID )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_lftr_rcv_by_comp_mask: "
-             "Comparing lid:0x%02X to port lid range: 0x%02X .. 0x%02X\n",
-             cl_ntoh16( p_rcvd_rec->lid ), min_lid_ho, max_lid_ho
-             );
-    /* ok we are ready for range check */
-    if (min_lid_ho > cl_ntoh16(p_rcvd_rec->lid) ||
-        max_lid_ho < cl_ntoh16(p_rcvd_rec->lid))
-      return;
-  }
-
-  /* now we need to decide which blocks to output */
-  if( comp_mask & IB_LFTR_COMPMASK_BLOCK )
-  {
-    max_block = min_block = cl_ntoh16(p_rcvd_rec->block_num);
-  }
-  else
-  {
-    /* use as many blocks as "in use" */
-    min_block = 0;
-    max_block = osm_switch_get_max_block_id_in_use(p_sw);
-  }
-
-  /* so we can add these blocks one by one ... */
-  for (block = min_block; block <= max_block; block++)
-    __osm_lftr_rcv_new_lftr( p_rcv, p_sw, p_ctxt->p_list,
-                             osm_port_get_base_lid(p_port),
-                             cl_hton16(block) );
+	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 ib_lft_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;
+	osm_lftr_rcv_t *const p_rcv = p_ctxt->p_rcv;
+	ib_net64_t const comp_mask = p_ctxt->comp_mask;
+	const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;
+	osm_port_t *p_port;
+	uint16_t min_lid_ho, max_lid_ho;
+	uint16_t min_block, max_block, block;
+	const osm_physp_t *p_physp;
+
+	/* In switches, the port guid is the node guid. */
+	p_port =
+	    __osm_lftr_get_port_by_guid(p_rcv,
+					p_sw->p_node->node_info.port_guid);
+	if (!p_port) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_lftr_rcv_by_comp_mask: ERR 4405: "
+			"Failed to find Port by Node Guid:0x%016" PRIx64
+			"\n", cl_ntoh64(p_sw->p_node->node_info.node_guid)
+		    );
+		return;
+	}
+
+	/* check that the requester physp and the current physp are under
+	   the same partition. */
+	p_physp = p_port->p_physp;
+	if (!p_physp) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_lftr_rcv_by_comp_mask: ERR 4406: "
+			"Failed to find default physical Port by Node Guid:0x%016"
+			PRIx64 "\n",
+			cl_ntoh64(p_sw->p_node->node_info.node_guid)
+		    );
+		return;
+	}
+	if (!osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp))
+		return;
+
+	/* get the port 0 of the switch */
+	osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);
+
+	/* compare the lids - if required */
+	if (comp_mask & IB_LFTR_COMPMASK_LID) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_lftr_rcv_by_comp_mask: "
+			"Comparing lid:0x%02X to port lid range: 0x%02X .. 0x%02X\n",
+			cl_ntoh16(p_rcvd_rec->lid), min_lid_ho, max_lid_ho);
+		/* ok we are ready for range check */
+		if (min_lid_ho > cl_ntoh16(p_rcvd_rec->lid) ||
+		    max_lid_ho < cl_ntoh16(p_rcvd_rec->lid))
+			return;
+	}
+
+	/* now we need to decide which blocks to output */
+	if (comp_mask & IB_LFTR_COMPMASK_BLOCK) {
+		max_block = min_block = cl_ntoh16(p_rcvd_rec->block_num);
+	} else {
+		/* use as many blocks as "in use" */
+		min_block = 0;
+		max_block = osm_switch_get_max_block_id_in_use(p_sw);
+	}
+
+	/* so we can add these blocks one by one ... */
+	for (block = min_block; block <= max_block; block++)
+		__osm_lftr_rcv_new_lftr(p_rcv, p_sw, p_ctxt->p_list,
+					osm_port_get_base_lid(p_port),
+					cl_hton16(block));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_lftr_rcv_process(
-  IN void *ctx,
-  IN void *data )
+void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 {
-  osm_lftr_rcv_t *p_rcv = ctx;
-  osm_madw_t *p_madw = data;
-  const ib_sa_mad_t*        p_rcvd_mad;
-  const ib_lft_record_t*    p_rcvd_rec;
-  ib_lft_record_t*          p_resp_rec;
-  cl_qlist_t                rec_list;
-  osm_madw_t*               p_resp_madw;
-  ib_sa_mad_t*              p_resp_sa_mad;
-  uint32_t                  num_rec, pre_trim_num_rec;
+	osm_lftr_rcv_t *p_rcv = ctx;
+	osm_madw_t *p_madw = data;
+	const ib_sa_mad_t *p_rcvd_mad;
+	const ib_lft_record_t *p_rcvd_rec;
+	ib_lft_record_t *p_resp_rec;
+	cl_qlist_t rec_list;
+	osm_madw_t *p_resp_madw;
+	ib_sa_mad_t *p_resp_sa_mad;
+	uint32_t num_rec, pre_trim_num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  uint32_t                  trim_num_rec;
+	uint32_t trim_num_rec;
 #endif
-  uint32_t                  i;
-  osm_lftr_search_ctxt_t    context;
-  osm_lftr_item_t*          p_rec_item;
-  ib_api_status_t           status = IB_SUCCESS;
-  osm_physp_t*              p_req_physp;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_lftr_rcv_process );
-
-  CL_ASSERT( p_madw );
-
-  p_rcvd_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_rcvd_rec = (ib_lft_record_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
-
-  CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_LFT_RECORD );
-
-  /* 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( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_lftr_rcv_process: ERR 4408: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_rcvd_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
-
-  /* update the requester physical port. */
-  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-                                          p_rcv->p_subn,
-                                          osm_madw_get_mad_addr_ptr(p_madw) );
-  if (p_req_physp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_lftr_rcv_process: ERR 4407: "
-             "Cannot find requester physical port\n" );
-    goto Exit;
-  }
-
-  cl_qlist_init( &rec_list );
-
-  context.p_rcvd_rec     = p_rcvd_rec;
-  context.p_list         = &rec_list;
-  context.comp_mask      = p_rcvd_mad->comp_mask;
-  context.p_rcv          = p_rcv;
-  context.p_req_physp    = p_req_physp;
-
-  cl_plock_acquire( p_rcv->p_lock );
-
-  /* Go over all switches */
-  cl_qmap_apply_func( &p_rcv->p_subn->sw_guid_tbl,
-                      __osm_lftr_rcv_by_comp_mask,
-                      &context );
-
-  cl_plock_release( p_rcv->p_lock );
-
-  num_rec = cl_qlist_count( &rec_list );
-
-  /*
-   * C15-0.1.30:
-   * If we do a SubnAdmGet and got more than one record it is an error !
-   */
-  if (p_rcvd_mad->method == IB_MAD_METHOD_GET)
-  {
-    if (num_rec == 0)
-    {
-      osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-      goto Exit;
-    }
-    if (num_rec > 1)
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_lftr_rcv_process: ERR 4409: "
-               "Got more than one record for SubnAdmGet (%u)\n",
-               num_rec );
-      osm_sa_send_error( p_rcv->p_resp, p_madw,
-                         IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
-
-      /* need to set the mem free ... */
-      p_rec_item = (osm_lftr_item_t*)cl_qlist_remove_head( &rec_list );
-      while( p_rec_item != (osm_lftr_item_t*)cl_qlist_end( &rec_list ) )
-      {
-        cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-        p_rec_item = (osm_lftr_item_t*)cl_qlist_remove_head( &rec_list );
-      }
-
-      goto Exit;
-    }
-  }
-
-  pre_trim_num_rec = num_rec;
+	uint32_t i;
+	osm_lftr_search_ctxt_t context;
+	osm_lftr_item_t *p_rec_item;
+	ib_api_status_t status = IB_SUCCESS;
+	osm_physp_t *p_req_physp;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_lftr_rcv_process);
+
+	CL_ASSERT(p_madw);
+
+	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_rcvd_rec = (ib_lft_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+
+	CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_LFT_RECORD);
+
+	/* 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(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_lftr_rcv_process: ERR 4408: "
+			"Unsupported Method (%s)\n",
+			ib_get_sa_method_str(p_rcvd_mad->method));
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
+		goto Exit;
+	}
+
+	/* update the requester physical port. */
+	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+						p_rcv->p_subn,
+						osm_madw_get_mad_addr_ptr
+						(p_madw));
+	if (p_req_physp == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_lftr_rcv_process: ERR 4407: "
+			"Cannot find requester physical port\n");
+		goto Exit;
+	}
+
+	cl_qlist_init(&rec_list);
+
+	context.p_rcvd_rec = p_rcvd_rec;
+	context.p_list = &rec_list;
+	context.comp_mask = p_rcvd_mad->comp_mask;
+	context.p_rcv = p_rcv;
+	context.p_req_physp = p_req_physp;
+
+	cl_plock_acquire(p_rcv->p_lock);
+
+	/* Go over all switches */
+	cl_qmap_apply_func(&p_rcv->p_subn->sw_guid_tbl,
+			   __osm_lftr_rcv_by_comp_mask, &context);
+
+	cl_plock_release(p_rcv->p_lock);
+
+	num_rec = cl_qlist_count(&rec_list);
+
+	/*
+	 * C15-0.1.30:
+	 * If we do a SubnAdmGet and got more than one record it is an error !
+	 */
+	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
+		if (num_rec == 0) {
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_NO_RECORDS);
+			goto Exit;
+		}
+		if (num_rec > 1) {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_lftr_rcv_process: ERR 4409: "
+				"Got more than one record for SubnAdmGet (%u)\n",
+				num_rec);
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
+
+			/* need to set the mem free ... */
+			p_rec_item =
+			    (osm_lftr_item_t *) cl_qlist_remove_head(&rec_list);
+			while (p_rec_item !=
+			       (osm_lftr_item_t *) cl_qlist_end(&rec_list)) {
+				cl_qlock_pool_put(&p_rcv->pool,
+						  &p_rec_item->pool_item);
+				p_rec_item =
+				    (osm_lftr_item_t *)
+				    cl_qlist_remove_head(&rec_list);
+			}
+
+			goto Exit;
+		}
+	}
+
+	pre_trim_num_rec = num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we limit the number of records to a single packet */
-  trim_num_rec = (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_lft_record_t);
-  if (trim_num_rec < num_rec)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "osm_lftr_rcv_process: "
-             "Number of records:%u trimmed to:%u to fit in one MAD\n",
-             num_rec, trim_num_rec );
-    num_rec = trim_num_rec;
-  }
+	/* we limit the number of records to a single packet */
+	trim_num_rec =
+	    (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_lft_record_t);
+	if (trim_num_rec < num_rec) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"osm_lftr_rcv_process: "
+			"Number of records:%u trimmed to:%u to fit in one MAD\n",
+			num_rec, trim_num_rec);
+		num_rec = trim_num_rec;
+	}
 #endif
 
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "osm_lftr_rcv_process: "
-           "Returning %u records\n", num_rec );
-
-  if ((p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) &&
-      (num_rec == 0))
-  {
-    osm_sa_send_error( p_rcv->p_resp, p_madw,
-                       IB_SA_MAD_STATUS_NO_RECORDS );
-    goto Exit;
-  }
-
-  /*
-   * Get a MAD to reply. Address of Mad is in the received mad_wrapper
-   */
-  p_resp_madw = osm_mad_pool_get( p_rcv->p_mad_pool,
-                                  p_madw->h_bind,
-                                  num_rec * sizeof(ib_lft_record_t) + IB_SA_MAD_HDR_SIZE,
-                                  &p_madw->mad_addr );
-
-  if( !p_resp_madw )
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_lftr_rcv_process: ERR 4410: "
-            "osm_mad_pool_get failed\n" );
-
-    for( i = 0; i < num_rec; i++ )
-    {
-      p_rec_item = (osm_lftr_item_t*)cl_qlist_remove_head( &rec_list );
-      cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    }
-
-    osm_sa_send_error( p_rcv->p_resp, p_madw,
-                       IB_SA_MAD_STATUS_NO_RESOURCES );
-
-    goto Exit;
-  }
-
-  p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
-
-  /*
-    Copy the MAD header back into the response mad.
-    Set the 'R' bit and the payload length,
-    Then copy all records from the list into the response payload.
-  */
-
-  memcpy( p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE );
-  p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-  /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
-  p_resp_sa_mad->sm_key = 0;
-  /* Fill in the offset (paylen will be done by the rmpp SAR) */
-  p_resp_sa_mad->attr_offset =
-    ib_get_attr_offset( sizeof(ib_lft_record_t) );
-
-  p_resp_rec = (ib_lft_record_t*)ib_sa_mad_get_payload_ptr( p_resp_sa_mad );
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"osm_lftr_rcv_process: " "Returning %u records\n", num_rec);
+
+	if ((p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) && (num_rec == 0)) {
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RECORDS);
+		goto Exit;
+	}
+
+	/*
+	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
+	 */
+	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+				       p_madw->h_bind,
+				       num_rec * sizeof(ib_lft_record_t) +
+				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
+
+	if (!p_resp_madw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_lftr_rcv_process: ERR 4410: "
+			"osm_mad_pool_get failed\n");
+
+		for (i = 0; i < num_rec; i++) {
+			p_rec_item =
+			    (osm_lftr_item_t *) cl_qlist_remove_head(&rec_list);
+			cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		}
+
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RESOURCES);
+
+		goto Exit;
+	}
+
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+
+	/*
+	   Copy the MAD header back into the response mad.
+	   Set the 'R' bit and the payload length,
+	   Then copy all records from the list into the response payload.
+	 */
+
+	memcpy(p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE);
+	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
+	p_resp_sa_mad->sm_key = 0;
+	/* Fill in the offset (paylen will be done by the rmpp SAR) */
+	p_resp_sa_mad->attr_offset =
+	    ib_get_attr_offset(sizeof(ib_lft_record_t));
+
+	p_resp_rec =
+	    (ib_lft_record_t *) ib_sa_mad_get_payload_ptr(p_resp_sa_mad);
 
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we support only one packet RMPP - so we will set the first and
-     last flags for gettable */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-  {
-    p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST | IB_RMPP_FLAG_ACTIVE;
-  }
+	/* we support only one packet RMPP - so we will set the first and
+	   last flags for gettable */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+		p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
+		p_resp_sa_mad->rmpp_flags =
+		    IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST |
+		    IB_RMPP_FLAG_ACTIVE;
+	}
 #else
-  /* forcefully define the packet as RMPP one */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
+	/* forcefully define the packet as RMPP one */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
+		p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
 #endif
 
-  for( i = 0; i < pre_trim_num_rec; i++ )
-  {
-    p_rec_item = (osm_lftr_item_t*)cl_qlist_remove_head( &rec_list );
-    /* copy only if not trimmed */
-    if (i < num_rec)
-    {
-      *p_resp_rec = p_rec_item->rec;
-    }
-    cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    p_resp_rec++;
-  }
-
-  CL_ASSERT( cl_is_qlist_empty( &rec_list ) );
-
-  status = osm_vendor_send( p_resp_madw->h_bind, p_resp_madw, FALSE );
-  if (status != IB_SUCCESS)
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_lftr_rcv_process: ERR 4411: "
-            "osm_vendor_send status = %s\n",
-            ib_get_err_str(status));
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	for (i = 0; i < pre_trim_num_rec; i++) {
+		p_rec_item =
+		    (osm_lftr_item_t *) cl_qlist_remove_head(&rec_list);
+		/* copy only if not trimmed */
+		if (i < num_rec) {
+			*p_resp_rec = p_rec_item->rec;
+		}
+		cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		p_resp_rec++;
+	}
+
+	CL_ASSERT(cl_is_qlist_empty(&rec_list));
+
+	status = osm_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE);
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_lftr_rcv_process: ERR 4411: "
+			"osm_vendor_send status = %s\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_sa_mad_ctrl.c b/opensm/opensm/osm_sa_mad_ctrl.c
index 7a8bc87..58378b6 100644
--- a/opensm/opensm/osm_sa_mad_ctrl.c
+++ b/opensm/opensm/osm_sa_mad_ctrl.c
@@ -46,7 +46,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <complib/cl_debug.h>
@@ -68,22 +68,21 @@
  * SYNOPSIS
  */
 static void
-__osm_sa_mad_ctrl_disp_done_callback(
-  IN void* context,
-  IN void* p_data )
+__osm_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 *const p_ctrl = (osm_sa_mad_ctrl_t *) context;
+	osm_madw_t *const p_madw = (osm_madw_t *) p_data;
 
-  OSM_LOG_ENTER( p_ctrl->p_log, __osm_sa_mad_ctrl_disp_done_callback );
+	OSM_LOG_ENTER(p_ctrl->p_log, __osm_sa_mad_ctrl_disp_done_callback);
 
-  CL_ASSERT( p_madw );
-  /*
-    Return the MAD & wrapper to the pool.
-  */
-  osm_mad_pool_put( p_ctrl->p_mad_pool, p_madw );
-  OSM_LOG_EXIT( p_ctrl->p_log );
+	CL_ASSERT(p_madw);
+	/*
+	   Return the MAD & wrapper to the pool.
+	 */
+	osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
+	OSM_LOG_EXIT(p_ctrl->p_log);
 }
+
 /************/
 
 /****f* opensm: SA/__osm_sa_mad_ctrl_process
@@ -96,185 +95,179 @@ __osm_sa_mad_ctrl_disp_done_callback(
  * SYNOPSIS
  */
 static void
-__osm_sa_mad_ctrl_process(
-  IN osm_sa_mad_ctrl_t* const p_ctrl,
-  IN osm_madw_t *p_madw )
+__osm_sa_mad_ctrl_process(IN osm_sa_mad_ctrl_t * const p_ctrl,
+			  IN osm_madw_t * p_madw)
 {
-  ib_sa_mad_t* p_sa_mad;
-  cl_status_t status;
-  cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;
-  uint64_t last_dispatched_msg_queue_time_msec;
-  uint32_t num_messages;
-
-  OSM_LOG_ENTER( p_ctrl->p_log, __osm_sa_mad_ctrl_process );
-
-  /*
-     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
-     But how do we know?
-     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,
-			   &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))
-  {
-    osm_log( p_ctrl->p_log, OSM_LOG_INFO,
-             "__osm_sa_mad_ctrl_process: "
-             /*             "Responding BUSY status since the dispatcher is already"*/
-             "Dropping MAD since the dispatcher is already"
-	     " overloaded with %u messages and queue time of:"
-	     "%" PRIu64 "[msec]\n",
-	     num_messages, last_dispatched_msg_queue_time_msec );
-
-    /* send a busy response */
-    /*    osm_sa_send_error( p_ctrl->p_resp, p_madw, IB_RESOURCE_BUSY ); */
-
-    /* return the request to the pool */
-    osm_mad_pool_put( p_ctrl->p_mad_pool, p_madw );
-
-    goto Exit;
-  }
-
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
-
-  /*
-    Note that attr_id (like the rest of the MAD) is in
-    network byte order.
-  */
-  switch( p_sa_mad->attr_id )
-  {
-  case IB_MAD_ATTR_CLASS_PORT_INFO:
-    msg_id = OSM_MSG_MAD_CLASS_PORT_INFO;
-    break;
-
-  case IB_MAD_ATTR_NODE_RECORD:
-    msg_id = OSM_MSG_MAD_NODE_RECORD;
-    break;
-
-  case IB_MAD_ATTR_PORTINFO_RECORD:
-    msg_id = OSM_MSG_MAD_PORTINFO_RECORD;
-    break;
-
-  case IB_MAD_ATTR_LINK_RECORD:
-    msg_id = OSM_MSG_MAD_LINK_RECORD;
-    break;
-
-  case IB_MAD_ATTR_SMINFO_RECORD:
-    msg_id = OSM_MSG_MAD_SMINFO_RECORD;
-    break;
-
-  case IB_MAD_ATTR_SERVICE_RECORD:
-    msg_id = OSM_MSG_MAD_SERVICE_RECORD;
-    break;
-
-  case IB_MAD_ATTR_PATH_RECORD:
-    msg_id = OSM_MSG_MAD_PATH_RECORD;
-    break;
-
-  case IB_MAD_ATTR_MCMEMBER_RECORD:
-    msg_id = OSM_MSG_MAD_MCMEMBER_RECORD;
-    break;
-
-  case IB_MAD_ATTR_INFORM_INFO:
-    msg_id = OSM_MSG_MAD_INFORM_INFO;
-    break;
-
-  case IB_MAD_ATTR_VLARB_RECORD:
-    msg_id = OSM_MSG_MAD_VL_ARB_RECORD;
-    break;
-
-  case IB_MAD_ATTR_SLVL_RECORD:
-    msg_id = OSM_MSG_MAD_SLVL_TBL_RECORD;
-    break;
-
-  case IB_MAD_ATTR_PKEY_TBL_RECORD:
-    msg_id = OSM_MSG_MAD_PKEY_TBL_RECORD;
-    break;
-
-  case IB_MAD_ATTR_LFT_RECORD:
-    msg_id = OSM_MSG_MAD_LFT_RECORD;
-    break;
-
-  case IB_MAD_ATTR_GUIDINFO_RECORD:
-    msg_id = OSM_MSG_MAD_GUIDINFO_RECORD;
-    break;
-
-  case IB_MAD_ATTR_INFORM_INFO_RECORD:
-    msg_id = OSM_MSG_MAD_INFORM_INFO_RECORD;
-    break;
-
-  case IB_MAD_ATTR_SWITCH_INFO_RECORD:
-    msg_id = OSM_MSG_MAD_SWITCH_INFO_RECORD;
-    break;
-
-  case IB_MAD_ATTR_MFT_RECORD:
-    msg_id = OSM_MSG_MAD_MFT_RECORD;
-    break;
+	ib_sa_mad_t *p_sa_mad;
+	cl_status_t status;
+	cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;
+	uint64_t last_dispatched_msg_queue_time_msec;
+	uint32_t num_messages;
+
+	OSM_LOG_ENTER(p_ctrl->p_log, __osm_sa_mad_ctrl_process);
+
+	/*
+	   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
+	   But how do we know?
+	   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,
+				 &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)) {
+		osm_log(p_ctrl->p_log, OSM_LOG_INFO,
+			"__osm_sa_mad_ctrl_process: "
+			/*             "Responding BUSY status since the dispatcher is already" */
+			"Dropping MAD since the dispatcher is already"
+			" overloaded with %u messages and queue time of:"
+			"%" PRIu64 "[msec]\n",
+			num_messages, last_dispatched_msg_queue_time_msec);
+
+		/* send a busy response */
+		/*    osm_sa_send_error( p_ctrl->p_resp, p_madw, IB_RESOURCE_BUSY ); */
+
+		/* return the request to the pool */
+		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
+
+		goto Exit;
+	}
+
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+
+	/*
+	   Note that attr_id (like the rest of the MAD) is in
+	   network byte order.
+	 */
+	switch (p_sa_mad->attr_id) {
+	case IB_MAD_ATTR_CLASS_PORT_INFO:
+		msg_id = OSM_MSG_MAD_CLASS_PORT_INFO;
+		break;
+
+	case IB_MAD_ATTR_NODE_RECORD:
+		msg_id = OSM_MSG_MAD_NODE_RECORD;
+		break;
+
+	case IB_MAD_ATTR_PORTINFO_RECORD:
+		msg_id = OSM_MSG_MAD_PORTINFO_RECORD;
+		break;
+
+	case IB_MAD_ATTR_LINK_RECORD:
+		msg_id = OSM_MSG_MAD_LINK_RECORD;
+		break;
+
+	case IB_MAD_ATTR_SMINFO_RECORD:
+		msg_id = OSM_MSG_MAD_SMINFO_RECORD;
+		break;
+
+	case IB_MAD_ATTR_SERVICE_RECORD:
+		msg_id = OSM_MSG_MAD_SERVICE_RECORD;
+		break;
+
+	case IB_MAD_ATTR_PATH_RECORD:
+		msg_id = OSM_MSG_MAD_PATH_RECORD;
+		break;
+
+	case IB_MAD_ATTR_MCMEMBER_RECORD:
+		msg_id = OSM_MSG_MAD_MCMEMBER_RECORD;
+		break;
+
+	case IB_MAD_ATTR_INFORM_INFO:
+		msg_id = OSM_MSG_MAD_INFORM_INFO;
+		break;
+
+	case IB_MAD_ATTR_VLARB_RECORD:
+		msg_id = OSM_MSG_MAD_VL_ARB_RECORD;
+		break;
+
+	case IB_MAD_ATTR_SLVL_RECORD:
+		msg_id = OSM_MSG_MAD_SLVL_TBL_RECORD;
+		break;
+
+	case IB_MAD_ATTR_PKEY_TBL_RECORD:
+		msg_id = OSM_MSG_MAD_PKEY_TBL_RECORD;
+		break;
+
+	case IB_MAD_ATTR_LFT_RECORD:
+		msg_id = OSM_MSG_MAD_LFT_RECORD;
+		break;
+
+	case IB_MAD_ATTR_GUIDINFO_RECORD:
+		msg_id = OSM_MSG_MAD_GUIDINFO_RECORD;
+		break;
+
+	case IB_MAD_ATTR_INFORM_INFO_RECORD:
+		msg_id = OSM_MSG_MAD_INFORM_INFO_RECORD;
+		break;
+
+	case IB_MAD_ATTR_SWITCH_INFO_RECORD:
+		msg_id = OSM_MSG_MAD_SWITCH_INFO_RECORD;
+		break;
+
+	case IB_MAD_ATTR_MFT_RECORD:
+		msg_id = OSM_MSG_MAD_MFT_RECORD;
+		break;
 
 #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
-  case IB_MAD_ATTR_MULTIPATH_RECORD:
-    msg_id = OSM_MSG_MAD_MULTIPATH_RECORD;
-    break;
+	case IB_MAD_ATTR_MULTIPATH_RECORD:
+		msg_id = OSM_MSG_MAD_MULTIPATH_RECORD;
+		break;
 #endif
 
-  default:
-    osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-             "__osm_sa_mad_ctrl_process: ERR 1A01: "
-             "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 );
-  }
-
-  if( msg_id != CL_DISP_MSGID_NONE )
-  {
-    /*
-      Post this MAD to the dispatcher for asynchronous
-      processing by the appropriate controller.
-    */
-
-    osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
-             "__osm_sa_mad_ctrl_process: "
-             "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 );
-
-    if( status != CL_SUCCESS )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-               "__osm_sa_mad_ctrl_process: ERR 1A02: "
-               "Dispatcher post message failed (%s) for attribute = 0x%X\n",
-               CL_STATUS_MSG( status ),
-               cl_ntoh16( p_sa_mad->attr_id ) );
-
-      osm_mad_pool_put( p_ctrl->p_mad_pool, p_madw );
-      goto Exit;
-    }
-  }
-  else
-  {
-    /*
-      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 );
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_ctrl->p_log );
+	default:
+		osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+			"__osm_sa_mad_ctrl_process: ERR 1A01: "
+			"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);
+	}
+
+	if (msg_id != CL_DISP_MSGID_NONE) {
+		/*
+		   Post this MAD to the dispatcher for asynchronous
+		   processing by the appropriate controller.
+		 */
+
+		osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+			"__osm_sa_mad_ctrl_process: "
+			"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);
+
+		if (status != CL_SUCCESS) {
+			osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+				"__osm_sa_mad_ctrl_process: ERR 1A02: "
+				"Dispatcher post message failed (%s) for attribute = 0x%X\n",
+				CL_STATUS_MSG(status),
+				cl_ntoh16(p_sa_mad->attr_id));
+
+			osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
+			goto Exit;
+		}
+	} else {
+		/*
+		   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);
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_ctrl->p_log);
 }
+
 /*
  * PARAMETERS
  *
@@ -295,116 +288,109 @@ __osm_sa_mad_ctrl_process(
  * 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 )
+__osm_sa_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw,
+			       IN void *bind_context,
+			       IN osm_madw_t * p_req_madw)
 {
-  osm_sa_mad_ctrl_t* p_ctrl = (osm_sa_mad_ctrl_t*)bind_context;
-  ib_sa_mad_t* p_sa_mad;
-
-  OSM_LOG_ENTER( p_ctrl->p_log, __osm_sa_mad_ctrl_rcv_callback );
-
-  CL_ASSERT( p_madw );
-
-  /*
-    A MAD was received from the wire, possibly in response to a request.
-  */
-  cl_atomic_inc( &p_ctrl->p_stats->sa_mads_rcvd );
-
-  if( osm_log_is_active( p_ctrl->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
-             "__osm_sa_mad_ctrl_rcv_callback: "
-             "%u SA MADs received\n",
-             p_ctrl->p_stats->sa_mads_rcvd );
-  }
-
-  /*
-   * C15-0.1.3 requires not responding to any MAD if the SM is
-   * not in active state!
-   * We will not respond if the sm_state is not MASTER, or if the
-   * first_time_master_sweep flag (of the subnet) is TRUE - this
-   * flag indicates that the master still didn't finish its first
-   * sweep, so the subnet is not up and stable yet.
-   */
-  if ( p_ctrl->p_subn->sm_state != IB_SMINFO_STATE_MASTER )
-  {
-    osm_log( p_ctrl->p_log, OSM_LOG_VERBOSE,
-             "__osm_sa_mad_ctrl_rcv_callback: "
-             "Received SA MAD while SM not MASTER. MAD ignored\n");
-    osm_mad_pool_put( p_ctrl->p_mad_pool, p_madw );
-    goto Exit;
-  }
-  if ( p_ctrl->p_subn->first_time_master_sweep == TRUE )
-  {
-    osm_log( p_ctrl->p_log, OSM_LOG_VERBOSE,
-             "__osm_sa_mad_ctrl_rcv_callback: "
-             "Received SA MAD while SM in first sweep. MAD ignored\n");
-    osm_mad_pool_put( p_ctrl->p_mad_pool, p_madw );
-    goto Exit;
-  }
-
-  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 );
-
-  /*
-   * 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.sm_key)) {
-    osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-             "__osm_sa_mad_ctrl_rcv_callback: 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.sm_key)
-             );
-    osm_mad_pool_put( p_ctrl->p_mad_pool, p_madw );
-    goto Exit;
-  }
-
-  switch( p_sa_mad->method )
-  {
-  case IB_MAD_METHOD_REPORT_RESP:
-    /* we do not really do anything with report represses -
-       just retire the transaction */
-    osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
-             "__osm_sa_mad_ctrl_rcv_callback: "
-             "Received Report Repress. Retiring the transaction\n");
-
-    if (p_req_madw)
-      osm_mad_pool_put( p_ctrl->p_mad_pool, p_req_madw );
-    osm_mad_pool_put( p_ctrl->p_mad_pool, p_madw );
-
-    break;
-
-  case IB_MAD_METHOD_GET:
-  case IB_MAD_METHOD_GETTABLE:
+	osm_sa_mad_ctrl_t *p_ctrl = (osm_sa_mad_ctrl_t *) bind_context;
+	ib_sa_mad_t *p_sa_mad;
+
+	OSM_LOG_ENTER(p_ctrl->p_log, __osm_sa_mad_ctrl_rcv_callback);
+
+	CL_ASSERT(p_madw);
+
+	/*
+	   A MAD was received from the wire, possibly in response to a request.
+	 */
+	cl_atomic_inc(&p_ctrl->p_stats->sa_mads_rcvd);
+
+	if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+			"__osm_sa_mad_ctrl_rcv_callback: "
+			"%u SA MADs received\n", p_ctrl->p_stats->sa_mads_rcvd);
+	}
+
+	/*
+	 * C15-0.1.3 requires not responding to any MAD if the SM is
+	 * not in active state!
+	 * We will not respond if the sm_state is not MASTER, or if the
+	 * first_time_master_sweep flag (of the subnet) is TRUE - this
+	 * flag indicates that the master still didn't finish its first
+	 * sweep, so the subnet is not up and stable yet.
+	 */
+	if (p_ctrl->p_subn->sm_state != IB_SMINFO_STATE_MASTER) {
+		osm_log(p_ctrl->p_log, OSM_LOG_VERBOSE,
+			"__osm_sa_mad_ctrl_rcv_callback: "
+			"Received SA MAD while SM not MASTER. MAD ignored\n");
+		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
+		goto Exit;
+	}
+	if (p_ctrl->p_subn->first_time_master_sweep == TRUE) {
+		osm_log(p_ctrl->p_log, OSM_LOG_VERBOSE,
+			"__osm_sa_mad_ctrl_rcv_callback: "
+			"Received SA MAD while SM in first sweep. MAD ignored\n");
+		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
+		goto Exit;
+	}
+
+	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);
+
+	/*
+	 * 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.sm_key)) {
+		osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+			"__osm_sa_mad_ctrl_rcv_callback: 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.sm_key)
+		    );
+		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
+		goto Exit;
+	}
+
+	switch (p_sa_mad->method) {
+	case IB_MAD_METHOD_REPORT_RESP:
+		/* we do not really do anything with report represses -
+		   just retire the transaction */
+		osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+			"__osm_sa_mad_ctrl_rcv_callback: "
+			"Received Report Repress. Retiring the transaction\n");
+
+		if (p_req_madw)
+			osm_mad_pool_put(p_ctrl->p_mad_pool, p_req_madw);
+		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
+
+		break;
+
+	case IB_MAD_METHOD_GET:
+	case IB_MAD_METHOD_GETTABLE:
 #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
-  case IB_MAD_METHOD_GETMULTI:
+	case IB_MAD_METHOD_GETMULTI:
 #endif
-  case IB_MAD_METHOD_SET:
-  case IB_MAD_METHOD_DELETE:
-    __osm_sa_mad_ctrl_process( p_ctrl, p_madw );
-    break;
-
-  default:
-    osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-             "__osm_sa_mad_ctrl_rcv_callback: ERR 1A05: "
-             "Unsupported method = 0x%X\n",
-             p_sa_mad->method );
-    osm_mad_pool_put( p_ctrl->p_mad_pool, p_madw );
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_ctrl->p_log );
+	case IB_MAD_METHOD_SET:
+	case IB_MAD_METHOD_DELETE:
+		__osm_sa_mad_ctrl_process(p_ctrl, p_madw);
+		break;
+
+	default:
+		osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+			"__osm_sa_mad_ctrl_rcv_callback: ERR 1A05: "
+			"Unsupported method = 0x%X\n", p_sa_mad->method);
+		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_ctrl->p_log);
 }
+
 /*
  * PARAMETERS
  *
@@ -426,69 +412,65 @@ __osm_sa_mad_ctrl_rcv_callback(
  * SYNOPSIS
  */
 void
-__osm_sa_mad_ctrl_send_err_callback(
-  IN void *bind_context,
-  IN osm_madw_t *p_madw )
+__osm_sa_mad_ctrl_send_err_callback(IN void *bind_context,
+				    IN osm_madw_t * p_madw)
 {
-  osm_sa_mad_ctrl_t* p_ctrl = (osm_sa_mad_ctrl_t*)bind_context;
-  cl_status_t status;
-
-  OSM_LOG_ENTER( p_ctrl->p_log, __osm_sa_mad_ctrl_send_err_callback );
-
-  osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-           "__osm_sa_mad_ctrl_send_err_callback: 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)
-  */
-
-  CL_ASSERT( p_madw );
-
-  /*
-    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 )
-  {
-    if( osm_log_is_active( p_ctrl->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
-               "__osm_sa_mad_ctrl_send_err_callback: "
-               "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 );
-    if( status != CL_SUCCESS )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-               "__osm_sa_mad_ctrl_send_err_callback: ERR 1A07: "
-               "Dispatcher post message failed (%s)\n",
-               CL_STATUS_MSG( status ) );
-    }
-  }
-  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 );
+	osm_sa_mad_ctrl_t *p_ctrl = (osm_sa_mad_ctrl_t *) bind_context;
+	cl_status_t status;
+
+	OSM_LOG_ENTER(p_ctrl->p_log, __osm_sa_mad_ctrl_send_err_callback);
+
+	osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+		"__osm_sa_mad_ctrl_send_err_callback: 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)
+	 */
+
+	CL_ASSERT(p_madw);
+
+	/*
+	   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) {
+		if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+				"__osm_sa_mad_ctrl_send_err_callback: "
+				"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);
+		if (status != CL_SUCCESS) {
+			osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+				"__osm_sa_mad_ctrl_send_err_callback: ERR 1A07: "
+				"Dispatcher post message failed (%s)\n",
+				CL_STATUS_MSG(status));
+		}
+	} 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);
 }
+
 /*
  * PARAMETERS
  *
@@ -501,150 +483,134 @@ __osm_sa_mad_ctrl_send_err_callback(
 
 /**********************************************************************
  **********************************************************************/
-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 * const p_ctrl)
 {
-  CL_ASSERT( p_ctrl );
-  memset( p_ctrl, 0, sizeof(*p_ctrl) );
-  p_ctrl->h_disp = CL_DISP_INVALID_HANDLE;
+	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 * const p_ctrl)
 {
-  CL_ASSERT( p_ctrl );
-  cl_disp_unregister( p_ctrl->h_disp );
+	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_resp_t*  const p_resp,
-  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 )
+osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * const p_ctrl,
+		     IN osm_sa_resp_t * const p_resp,
+		     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 status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_log, osm_sa_mad_ctrl_init );
-
-  osm_sa_mad_ctrl_construct( p_ctrl );
-
-  p_ctrl->p_log = p_log;
-  p_ctrl->p_disp = p_disp;
-  p_ctrl->p_mad_pool = p_mad_pool;
-  p_ctrl->p_vendor = p_vendor;
-  p_ctrl->p_stats = p_stats;
-  p_ctrl->p_subn = p_subn;
-  p_ctrl->p_resp = p_resp;
-
-  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,
-             "osm_sa_mad_ctrl_init: ERR 1A08: "
-             "Dispatcher registration failed\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_log, osm_sa_mad_ctrl_init);
+
+	osm_sa_mad_ctrl_construct(p_ctrl);
+
+	p_ctrl->p_log = p_log;
+	p_ctrl->p_disp = p_disp;
+	p_ctrl->p_mad_pool = p_mad_pool;
+	p_ctrl->p_vendor = p_vendor;
+	p_ctrl->p_stats = p_stats;
+	p_ctrl->p_subn = p_subn;
+	p_ctrl->p_resp = p_resp;
+
+	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,
+			"osm_sa_mad_ctrl_init: ERR 1A08: "
+			"Dispatcher registration failed\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_log);
+	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 )
+osm_sa_mad_ctrl_bind(IN osm_sa_mad_ctrl_t * const p_ctrl,
+		     IN const ib_net64_t port_guid)
 {
-  osm_bind_info_t bind_info;
-  ib_api_status_t status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_ctrl->p_log, osm_sa_mad_ctrl_bind );
-
-  if( p_ctrl->h_bind != OSM_BIND_INVALID_HANDLE )
-  {
-    osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-             "osm_sa_mad_ctrl_bind: ERR 1A09: "
-             "Multiple binds not allowed\n" );
-    status = IB_ERROR;
-    goto Exit;
-  }
-
-  bind_info.class_version = 2;
-  bind_info.is_responder = TRUE;
-  bind_info.is_report_processor = FALSE;
-  bind_info.is_trap_processor = FALSE;
-  bind_info.mad_class = IB_MCLASS_SUBN_ADM;
-  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;
-
-  osm_log( p_ctrl->p_log, OSM_LOG_VERBOSE,
-           "osm_sa_mad_ctrl_bind: "
-           "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->p_mad_pool,
-                                    __osm_sa_mad_ctrl_rcv_callback,
-                                    __osm_sa_mad_ctrl_send_err_callback,
-                                    p_ctrl );
-
-  if( p_ctrl->h_bind == OSM_BIND_INVALID_HANDLE )
-  {
-    status = IB_ERROR;
-    osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-             "osm_sa_mad_ctrl_bind: ERR 1A10: "
-             "Vendor specific bind failed (%s)\n",
-             ib_get_err_str(status) );
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_ctrl->p_log );
-  return( status );
+	osm_bind_info_t bind_info;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_ctrl->p_log, osm_sa_mad_ctrl_bind);
+
+	if (p_ctrl->h_bind != OSM_BIND_INVALID_HANDLE) {
+		osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+			"osm_sa_mad_ctrl_bind: ERR 1A09: "
+			"Multiple binds not allowed\n");
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	bind_info.class_version = 2;
+	bind_info.is_responder = TRUE;
+	bind_info.is_report_processor = FALSE;
+	bind_info.is_trap_processor = FALSE;
+	bind_info.mad_class = IB_MCLASS_SUBN_ADM;
+	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;
+
+	osm_log(p_ctrl->p_log, OSM_LOG_VERBOSE,
+		"osm_sa_mad_ctrl_bind: "
+		"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->p_mad_pool,
+					 __osm_sa_mad_ctrl_rcv_callback,
+					 __osm_sa_mad_ctrl_send_err_callback,
+					 p_ctrl);
+
+	if (p_ctrl->h_bind == OSM_BIND_INVALID_HANDLE) {
+		status = IB_ERROR;
+		osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+			"osm_sa_mad_ctrl_bind: ERR 1A10: "
+			"Vendor specific bind failed (%s)\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_ctrl->p_log);
+	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 * const p_ctrl)
 {
-  ib_api_status_t status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_ctrl->p_log, osm_sa_mad_ctrl_unbind );
-
-  if( p_ctrl->h_bind == OSM_BIND_INVALID_HANDLE )
-  {
-    osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-             "osm_sa_mad_ctrl_unbind: ERR 1A11: "
-             "No previous bind\n" );
-    status = IB_ERROR;
-    goto Exit;
-  }
-
-  osm_vendor_unbind( p_ctrl->h_bind );
- Exit:
-  OSM_LOG_EXIT( p_ctrl->p_log );
-  return( status );
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_ctrl->p_log, osm_sa_mad_ctrl_unbind);
+
+	if (p_ctrl->h_bind == OSM_BIND_INVALID_HANDLE) {
+		osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+			"osm_sa_mad_ctrl_unbind: ERR 1A11: "
+			"No previous bind\n");
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	osm_vendor_unbind(p_ctrl->h_bind);
+      Exit:
+	OSM_LOG_EXIT(p_ctrl->p_log);
+	return (status);
 }
diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c
index 379a3e2..303d58b 100644
--- a/opensm/opensm/osm_sa_mcmember_record.c
+++ b/opensm/opensm/osm_sa_mcmember_record.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <string.h>
@@ -72,88 +72,78 @@
 #define OSM_MCMR_RCV_POOL_MIN_SIZE     32
 #define OSM_MCMR_RCV_POOL_GROW_SIZE    32
 
-typedef  struct _osm_mcmr_item
-{
-  cl_pool_item_t     pool_item;
-  ib_member_rec_t    rec;
+typedef struct _osm_mcmr_item {
+	cl_pool_item_t pool_item;
+	ib_member_rec_t rec;
 } osm_mcmr_item_t;
 
-typedef  struct   osm_sa_mcmr_search_ctxt {
-  const ib_member_rec_t  *p_mcmember_rec;
-  osm_mgrp_t      *p_mgrp;
-  osm_mcmr_recv_t *p_rcv;
-  cl_qlist_t      *p_list; /* hold results */
-  ib_net64_t      comp_mask;
-  const osm_physp_t*    p_req_physp;
-  boolean_t       trusted_req;
+typedef struct osm_sa_mcmr_search_ctxt {
+	const ib_member_rec_t *p_mcmember_rec;
+	osm_mgrp_t *p_mgrp;
+	osm_mcmr_recv_t *p_rcv;
+	cl_qlist_t *p_list;	/* hold results */
+	ib_net64_t comp_mask;
+	const osm_physp_t *p_req_physp;
+	boolean_t trusted_req;
 } osm_sa_mcmr_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_mcmr_rcv_construct(
-  IN osm_mcmr_recv_t* const p_rcv )
+void osm_mcmr_rcv_construct(IN osm_mcmr_recv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
-  cl_qlock_pool_construct( &p_rcv->pool );
+	memset(p_rcv, 0, sizeof(*p_rcv));
+	cl_qlock_pool_construct(&p_rcv->pool);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_mcmr_rcv_destroy(
-  IN osm_mcmr_recv_t* const p_rcv )
+void osm_mcmr_rcv_destroy(IN osm_mcmr_recv_t * const p_rcv)
 {
-  CL_ASSERT( p_rcv );
+	CL_ASSERT(p_rcv);
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_mcmr_rcv_destroy );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_mcmr_rcv_destroy);
 
-  cl_qlock_pool_destroy( &p_rcv->pool );
+	cl_qlock_pool_destroy(&p_rcv->pool);
 
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_mcmr_rcv_init(
-  IN osm_sm_t * const p_sm,
-  IN osm_mcmr_recv_t* const p_rcv,
-  IN osm_sa_resp_t* const p_resp,
-  IN osm_mad_pool_t* const p_mad_pool,
-  IN osm_subn_t* const p_subn,
-  IN osm_log_t* const p_log,
-  IN cl_plock_t* const p_lock )
+osm_mcmr_rcv_init(IN osm_sm_t * const p_sm,
+		  IN osm_mcmr_recv_t * const p_rcv,
+		  IN osm_sa_resp_t * const p_resp,
+		  IN osm_mad_pool_t * const p_mad_pool,
+		  IN osm_subn_t * const p_subn,
+		  IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_log, osm_mcmr_rcv_init );
-
-  osm_mcmr_rcv_construct( p_rcv );
-
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_sm = p_sm;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_resp = p_resp;
-  p_rcv->p_mad_pool = p_mad_pool;
-  p_rcv->mlid_ho = 0xC000;
-
-  status = cl_qlock_pool_init( &p_rcv->pool,
-                               OSM_MCMR_RCV_POOL_MIN_SIZE,
-                               0,
-                               OSM_MCMR_RCV_POOL_GROW_SIZE,
-                               sizeof(osm_mcmr_item_t),
-                               NULL, NULL, NULL );
-  if (status != CL_SUCCESS)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_mcmr_rcv_init: ERR 1B02: "
-             "qlock pool init failed (%d)\n",
-             status );
-  }
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_log, osm_mcmr_rcv_init);
+
+	osm_mcmr_rcv_construct(p_rcv);
+
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_sm = p_sm;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_resp = p_resp;
+	p_rcv->p_mad_pool = p_mad_pool;
+	p_rcv->mlid_ho = 0xC000;
+
+	status = cl_qlock_pool_init(&p_rcv->pool,
+				    OSM_MCMR_RCV_POOL_MIN_SIZE,
+				    0,
+				    OSM_MCMR_RCV_POOL_GROW_SIZE,
+				    sizeof(osm_mcmr_item_t), NULL, NULL, NULL);
+	if (status != CL_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_mcmr_rcv_init: ERR 1B02: "
+			"qlock pool init failed (%d)\n", status);
+	}
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
@@ -167,57 +157,51 @@ osm_mcmr_rcv_init(
    looked for and the result p_mgrp
 **********************************************************************/
 static void
-__search_mgrp_by_mgid(
-  IN  cl_map_item_t* const    p_map_item,
-  IN  void*                   context )
+__search_mgrp_by_mgid(IN cl_map_item_t * const p_map_item, IN void *context)
 {
-  osm_mgrp_t* p_mgrp = (osm_mgrp_t*)p_map_item;
-  osm_sa_mcmr_search_ctxt_t *p_ctxt = (osm_sa_mcmr_search_ctxt_t *) context;
-  const ib_member_rec_t *p_recvd_mcmember_rec;
-  osm_mcmr_recv_t *p_rcv;
-
-  p_recvd_mcmember_rec = p_ctxt->p_mcmember_rec;
-  p_rcv = p_ctxt->p_rcv;
-
-  /* ignore groups marked for deletion */
-  if (p_mgrp->to_be_deleted)
-    return;
-
-  /* compare entire MGID so different scope will not sneak in for
-     the same MGID */
-  if (memcmp(&p_mgrp->mcmember_rec.mgid,
-             &p_recvd_mcmember_rec->mgid,
-             sizeof(ib_gid_t)))
-    return;
-
-  if (p_ctxt->p_mgrp)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__search_mgrp_by_mgid: ERR 1B03: "
-             "Multiple MC groups for same MGID\n" );
-    return;
-  }
-
-  p_ctxt->p_mgrp = p_mgrp;
+	osm_mgrp_t *p_mgrp = (osm_mgrp_t *) p_map_item;
+	osm_sa_mcmr_search_ctxt_t *p_ctxt =
+	    (osm_sa_mcmr_search_ctxt_t *) context;
+	const ib_member_rec_t *p_recvd_mcmember_rec;
+	osm_mcmr_recv_t *p_rcv;
+
+	p_recvd_mcmember_rec = p_ctxt->p_mcmember_rec;
+	p_rcv = p_ctxt->p_rcv;
+
+	/* ignore groups marked for deletion */
+	if (p_mgrp->to_be_deleted)
+		return;
+
+	/* compare entire MGID so different scope will not sneak in for
+	   the same MGID */
+	if (memcmp(&p_mgrp->mcmember_rec.mgid,
+		   &p_recvd_mcmember_rec->mgid, sizeof(ib_gid_t)))
+		return;
+
+	if (p_ctxt->p_mgrp) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__search_mgrp_by_mgid: ERR 1B03: "
+			"Multiple MC groups for same MGID\n");
+		return;
+	}
+
+	p_ctxt->p_mgrp = p_mgrp;
 
 }
 
 /**********************************************************************
  Look for a MGRP in the mgrp_mlid_tbl by mlid
 **********************************************************************/
-static osm_mgrp_t *
-__get_mgrp_by_mlid(
-  IN osm_mcmr_recv_t* const p_rcv,
-  IN ib_net16_t const mlid)
+static osm_mgrp_t *__get_mgrp_by_mlid(IN osm_mcmr_recv_t * const p_rcv,
+				      IN ib_net16_t const mlid)
 {
-  cl_map_item_t *map_item;
+	cl_map_item_t *map_item;
 
-  map_item = cl_qmap_get(&p_rcv->p_subn->mgrp_mlid_tbl, mlid);
-  if (map_item == cl_qmap_end(&p_rcv->p_subn->mgrp_mlid_tbl))
-  {
-    return NULL;
-  }
-  return (osm_mgrp_t *)map_item;
+	map_item = cl_qmap_get(&p_rcv->p_subn->mgrp_mlid_tbl, mlid);
+	if (map_item == cl_qmap_end(&p_rcv->p_subn->mgrp_mlid_tbl)) {
+		return NULL;
+	}
+	return (osm_mgrp_t *) map_item;
 
 }
 
@@ -225,28 +209,25 @@ __get_mgrp_by_mlid(
 Look for a MGRP in the mgrp_mlid_tbl by mgid
 ***********************************************************************/
 static ib_api_status_t
-__get_mgrp_by_mgid(
-  IN osm_mcmr_recv_t* const p_rcv,
-  IN ib_member_rec_t* p_recvd_mcmember_rec,
-  OUT osm_mgrp_t **pp_mgrp)
+__get_mgrp_by_mgid(IN osm_mcmr_recv_t * const p_rcv,
+		   IN ib_member_rec_t * p_recvd_mcmember_rec,
+		   OUT osm_mgrp_t ** pp_mgrp)
 {
-  osm_sa_mcmr_search_ctxt_t mcmr_search_context;
+	osm_sa_mcmr_search_ctxt_t mcmr_search_context;
 
-  mcmr_search_context.p_mcmember_rec = p_recvd_mcmember_rec;
-  mcmr_search_context.p_rcv = p_rcv;
-  mcmr_search_context.p_mgrp = NULL;
+	mcmr_search_context.p_mcmember_rec = p_recvd_mcmember_rec;
+	mcmr_search_context.p_rcv = p_rcv;
+	mcmr_search_context.p_mgrp = NULL;
 
-  cl_qmap_apply_func( &p_rcv->p_subn->mgrp_mlid_tbl,
-                      __search_mgrp_by_mgid,
-                      &mcmr_search_context);
+	cl_qmap_apply_func(&p_rcv->p_subn->mgrp_mlid_tbl,
+			   __search_mgrp_by_mgid, &mcmr_search_context);
 
-  if (mcmr_search_context.p_mgrp == NULL)
-  {
-    return IB_NOT_FOUND;
-  }
+	if (mcmr_search_context.p_mgrp == NULL) {
+		return IB_NOT_FOUND;
+	}
 
-  *pp_mgrp = mcmr_search_context.p_mgrp;
-  return IB_SUCCESS;
+	*pp_mgrp = mcmr_search_context.p_mgrp;
+	return IB_SUCCESS;
 }
 
 /*********************************************************************
@@ -255,18 +236,17 @@ 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)
+__copy_from_create_mc_rec(IN ib_member_rec_t * const dest,
+			  IN const ib_member_rec_t * const src)
 {
-  dest->qkey = src->qkey;
-  dest->mlid = src->mlid;
-  dest->tclass = src->tclass;
-  dest->pkey = src->pkey;
-  dest->sl_flow_hop = src->sl_flow_hop;
-  dest->mtu = src->mtu;
-  dest->rate = src->rate;
-  dest->pkt_life = src->pkt_life;
+	dest->qkey = src->qkey;
+	dest->mlid = src->mlid;
+	dest->tclass = src->tclass;
+	dest->pkey = src->pkey;
+	dest->sl_flow_hop = src->sl_flow_hop;
+	dest->mtu = src->mtu;
+	dest->rate = src->rate;
+	dest->pkt_life = src->pkt_life;
 }
 
 /*********************************************************************
@@ -274,13 +254,10 @@ Return an mlid to the pool of free mlids.
 But this implementation is not a pool - it simply scans through
 the MGRP database for unused mlids...
 *********************************************************************/
-static void
-__free_mlid(
-  IN osm_mcmr_recv_t* const p_rcv,
-  IN uint16_t mlid)
+static void __free_mlid(IN osm_mcmr_recv_t * const p_rcv, IN uint16_t mlid)
 {
-  UNUSED_PARAM(p_rcv);
-  UNUSED_PARAM(mlid);
+	UNUSED_PARAM(p_rcv);
+	UNUSED_PARAM(mlid);
 }
 
 /*********************************************************************
@@ -289,109 +266,99 @@ TODO: Implement a more scalable - O(1) solution based on pool of
 available mlids.
 **********************************************************************/
 static ib_net16_t
-__get_new_mlid(
-  IN osm_mcmr_recv_t* const p_rcv,
-  IN ib_net16_t requested_mlid)
+__get_new_mlid(IN osm_mcmr_recv_t * const p_rcv, IN ib_net16_t requested_mlid)
 {
-  osm_subn_t   *p_subn = p_rcv->p_subn;
-  osm_mgrp_t   *p_mgrp;
-  uint8_t      *used_mlids_array;
-  uint16_t      idx;
-  uint16_t      mlid; /* the result */
-  uint16_t      max_num_mlids;
-
-  OSM_LOG_ENTER(p_rcv->p_log, __get_new_mlid);
-
-  if (requested_mlid && cl_ntoh16(requested_mlid) >= IB_LID_MCAST_START_HO &&
-      cl_ntoh16(requested_mlid) < p_subn->max_multicast_lid_ho &&
-      cl_qmap_get(&p_subn->mgrp_mlid_tbl, requested_mlid) ==
-      cl_qmap_end(&p_subn->mgrp_mlid_tbl) ) {
-    mlid = cl_ntoh16(requested_mlid);
-    goto Exit;
-  }
-
-  /* If MCGroups table empty, first return the min mlid */
-  p_mgrp = (osm_mgrp_t*)cl_qmap_head( &p_subn->mgrp_mlid_tbl );
-  if (p_mgrp == (osm_mgrp_t*)cl_qmap_end( &p_subn->mgrp_mlid_tbl ))
-  {
-    mlid = IB_LID_MCAST_START_HO;
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "__get_new_mlid: "
-             "No multicast groups found using minimal mlid:0x%04X\n",
-             mlid );
-    goto Exit;
-  }
-
-  max_num_mlids =
-    p_rcv->p_subn->max_multicast_lid_ho - IB_LID_MCAST_START_HO;
-
-  /* track all used mlids in the array (by mlid index) */
-  used_mlids_array =
-    (uint8_t *)malloc(sizeof(uint8_t)*max_num_mlids);
-  if (used_mlids_array)
-    memset(used_mlids_array, 0, sizeof(uint8_t)*max_num_mlids);
-  if (!used_mlids_array)
-    return 0;
-
-  /* scan all available multicast groups in the DB and fill in the table */
-  while( p_mgrp != (osm_mgrp_t*)cl_qmap_end( &p_subn->mgrp_mlid_tbl ) )
-  {
-    /* ignore mgrps marked for deletion */
-    if (p_mgrp->to_be_deleted == FALSE)
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-               "__get_new_mlid: "
-               "Found mgrp with lid:0x%X MGID: 0x%016" PRIx64 " : "
-               "0x%016" PRIx64 "\n",
-               cl_ntoh16( p_mgrp->mlid),
-               cl_ntoh64( p_mgrp->mcmember_rec.mgid.unicast.prefix ),
-               cl_ntoh64( p_mgrp->mcmember_rec.mgid.unicast.interface_id ) );
-
-      /* Map in table */
-      if (cl_ntoh16(p_mgrp->mlid) > p_rcv->p_subn->max_multicast_lid_ho)
-      {
-        osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-                 "__get_new_mlid: ERR 1B27: "
-                 "Found mgrp with mlid:0x%04X > max allowed mlid:0x%04X\n",
-                 cl_ntoh16(p_mgrp->mlid),
-                 max_num_mlids + IB_LID_MCAST_START_HO );
-      }
-      else
-      {
-        used_mlids_array[cl_ntoh16(p_mgrp->mlid) - IB_LID_MCAST_START_HO] = 1;
-      }
-    }
-    p_mgrp = (osm_mgrp_t*)cl_qmap_next( &p_mgrp->map_item );
-  }
-
-  /* Find "mlid holes" in the mgrp table */
-  for (idx = 0;
-       (idx < max_num_mlids) && (used_mlids_array[idx] == 1);
-       idx++);
-
-  /* did it go above the maximal mlid allowed */
-  if ( idx < max_num_mlids )
-  {
-    mlid = idx + IB_LID_MCAST_START_HO;
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "__get_new_mlid: "
-             "Found available mlid:0x%04X at idx:%u\n",
-             mlid, idx );
-  }
-  else
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__get_new_mlid: ERR 1B23: "
-             "All available:%u mlids are taken\n",
-             max_num_mlids );
-    mlid = 0;
-  }
-
-  free(used_mlids_array);
-
- Exit:
-  OSM_LOG_EXIT(p_rcv->p_log);
-  return cl_hton16(mlid);
+	osm_subn_t *p_subn = p_rcv->p_subn;
+	osm_mgrp_t *p_mgrp;
+	uint8_t *used_mlids_array;
+	uint16_t idx;
+	uint16_t mlid;		/* the result */
+	uint16_t max_num_mlids;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __get_new_mlid);
+
+	if (requested_mlid && cl_ntoh16(requested_mlid) >= IB_LID_MCAST_START_HO
+	    && cl_ntoh16(requested_mlid) < p_subn->max_multicast_lid_ho
+	    && cl_qmap_get(&p_subn->mgrp_mlid_tbl,
+			   requested_mlid) ==
+	    cl_qmap_end(&p_subn->mgrp_mlid_tbl)) {
+		mlid = cl_ntoh16(requested_mlid);
+		goto Exit;
+	}
+
+	/* If MCGroups table empty, first return the min mlid */
+	p_mgrp = (osm_mgrp_t *) cl_qmap_head(&p_subn->mgrp_mlid_tbl);
+	if (p_mgrp == (osm_mgrp_t *) cl_qmap_end(&p_subn->mgrp_mlid_tbl)) {
+		mlid = IB_LID_MCAST_START_HO;
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"__get_new_mlid: "
+			"No multicast groups found using minimal mlid:0x%04X\n",
+			mlid);
+		goto Exit;
+	}
+
+	max_num_mlids =
+	    p_rcv->p_subn->max_multicast_lid_ho - IB_LID_MCAST_START_HO;
+
+	/* track all used mlids in the array (by mlid index) */
+	used_mlids_array = (uint8_t *) malloc(sizeof(uint8_t) * max_num_mlids);
+	if (used_mlids_array)
+		memset(used_mlids_array, 0, sizeof(uint8_t) * max_num_mlids);
+	if (!used_mlids_array)
+		return 0;
+
+	/* scan all available multicast groups in the DB and fill in the table */
+	while (p_mgrp != (osm_mgrp_t *) cl_qmap_end(&p_subn->mgrp_mlid_tbl)) {
+		/* ignore mgrps marked for deletion */
+		if (p_mgrp->to_be_deleted == FALSE) {
+			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				"__get_new_mlid: "
+				"Found mgrp with lid:0x%X MGID: 0x%016" PRIx64
+				" : " "0x%016" PRIx64 "\n",
+				cl_ntoh16(p_mgrp->mlid),
+				cl_ntoh64(p_mgrp->mcmember_rec.mgid.unicast.
+					  prefix),
+				cl_ntoh64(p_mgrp->mcmember_rec.mgid.unicast.
+					  interface_id));
+
+			/* Map in table */
+			if (cl_ntoh16(p_mgrp->mlid) >
+			    p_rcv->p_subn->max_multicast_lid_ho) {
+				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+					"__get_new_mlid: ERR 1B27: "
+					"Found mgrp with mlid:0x%04X > max allowed mlid:0x%04X\n",
+					cl_ntoh16(p_mgrp->mlid),
+					max_num_mlids + IB_LID_MCAST_START_HO);
+			} else {
+				used_mlids_array[cl_ntoh16(p_mgrp->mlid) -
+						 IB_LID_MCAST_START_HO] = 1;
+			}
+		}
+		p_mgrp = (osm_mgrp_t *) cl_qmap_next(&p_mgrp->map_item);
+	}
+
+	/* Find "mlid holes" in the mgrp table */
+	for (idx = 0;
+	     (idx < max_num_mlids) && (used_mlids_array[idx] == 1); idx++) ;
+
+	/* did it go above the maximal mlid allowed */
+	if (idx < max_num_mlids) {
+		mlid = idx + IB_LID_MCAST_START_HO;
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"__get_new_mlid: "
+			"Found available mlid:0x%04X at idx:%u\n", mlid, idx);
+	} else {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__get_new_mlid: ERR 1B23: "
+			"All available:%u mlids are taken\n", max_num_mlids);
+		mlid = 0;
+	}
+
+	free(used_mlids_array);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return cl_hton16(mlid);
 }
 
 /*********************************************************************
@@ -402,26 +369,22 @@ silently drop it. Since it was an intermediate group no need to
 re-route it.
 **********************************************************************/
 static void
-__cleanup_mgrp(
-  IN osm_mcmr_recv_t* const p_rcv,
-  IN ib_net16_t const mlid)
+__cleanup_mgrp(IN osm_mcmr_recv_t * const p_rcv, IN ib_net16_t const mlid)
 {
-  osm_mgrp_t *p_mgrp;
-
-  p_mgrp = __get_mgrp_by_mlid(p_rcv, mlid);
-  if(p_mgrp)
-  {
-    /* Remove MGRP only if osm_mcm_port_t count is 0 and
-     * Not a well known group
-     */
-    if(cl_is_qmap_empty(&p_mgrp->mcm_port_tbl) &&
-       (p_mgrp->well_known == FALSE))
-    {
-      cl_qmap_remove_item(&p_rcv->p_subn->mgrp_mlid_tbl,
-                          (cl_map_item_t *)p_mgrp );
-      osm_mgrp_delete(p_mgrp);
-    }
-  }
+	osm_mgrp_t *p_mgrp;
+
+	p_mgrp = __get_mgrp_by_mlid(p_rcv, mlid);
+	if (p_mgrp) {
+		/* Remove MGRP only if osm_mcm_port_t count is 0 and
+		 * Not a well known group
+		 */
+		if (cl_is_qmap_empty(&p_mgrp->mcm_port_tbl) &&
+		    (p_mgrp->well_known == FALSE)) {
+			cl_qmap_remove_item(&p_rcv->p_subn->mgrp_mlid_tbl,
+					    (cl_map_item_t *) p_mgrp);
+			osm_mgrp_delete(p_mgrp);
+		}
+	}
 }
 
 /*********************************************************************
@@ -429,162 +392,149 @@ 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_mcmr_recv_t *p_rcv,
-  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)
+__add_new_mgrp_port(IN osm_mcmr_recv_t * p_rcv,
+		    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)
 {
-  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( p_rcv->p_log,
-                                 p_rcv->p_subn,
-                                 p_mad_addr, &requester_gid );
-  if ( res != IB_SUCCESS )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__add_new_mgrp_port: ERR 1B29: "
-             "Could not find GID for requester\n" );
-
-    return IB_INVALID_PARAMETER;
-  }
-
-  if (!memcmp(&p_recvd_mcmember_rec->port_gid, &requester_gid,
-              sizeof(ib_gid_t)))
-  {
-    proxy_join = FALSE;
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__add_new_mgrp_port: "
-             "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( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__add_new_mgrp_port: "
-             "Create new port with proxy_join TRUE\n" );
-  }
-
-  *pp_mcmr_port = osm_mgrp_add_port( p_mgrp,
-                                     &p_recvd_mcmember_rec->port_gid,
-                                     p_recvd_mcmember_rec->scope_state,
-                                     proxy_join );
-  if(*pp_mcmr_port == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__add_new_mgrp_port: ERR 1B06: "
-             "osm_mgrp_add_port failed\n" );
-
-    return IB_INSUFFICIENT_MEMORY;
-  }
-
-  return IB_SUCCESS;
+	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(p_rcv->p_log,
+				      p_rcv->p_subn,
+				      p_mad_addr, &requester_gid);
+	if (res != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__add_new_mgrp_port: ERR 1B29: "
+			"Could not find GID for requester\n");
+
+		return IB_INVALID_PARAMETER;
+	}
+
+	if (!memcmp(&p_recvd_mcmember_rec->port_gid, &requester_gid,
+		    sizeof(ib_gid_t))) {
+		proxy_join = FALSE;
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__add_new_mgrp_port: "
+			"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(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__add_new_mgrp_port: "
+			"Create new port with proxy_join TRUE\n");
+	}
+
+	*pp_mcmr_port = osm_mgrp_add_port(p_mgrp,
+					  &p_recvd_mcmember_rec->port_gid,
+					  p_recvd_mcmember_rec->scope_state,
+					  proxy_join);
+	if (*pp_mcmr_port == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__add_new_mgrp_port: ERR 1B06: "
+			"osm_mgrp_add_port failed\n");
+
+		return IB_INSUFFICIENT_MEMORY;
+	}
+
+	return IB_SUCCESS;
 }
 
 /**********************************************************************
  **********************************************************************/
-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 );
+	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)
+			 ib_member_rec_t * p_recvd_mcmember_rec)
 {
-  return(
-    ((comp_mask & REQUIRED_MC_CREATE_COMP_MASK) == REQUIRED_MC_CREATE_COMP_MASK)
-    );
+	return (((comp_mask & REQUIRED_MC_CREATE_COMP_MASK) ==
+		 REQUIRED_MC_CREATE_COMP_MASK)
+	    );
 }
 
 /**********************************************************************
 Generate the response MAD
 **********************************************************************/
 static void
-__osm_mcmr_rcv_respond(
-  IN const osm_mcmr_recv_t* const p_rcv,
-  IN const osm_madw_t* const p_madw,
-  IN ib_member_rec_t *p_mcmember_rec )
+__osm_mcmr_rcv_respond(IN const osm_mcmr_recv_t * const p_rcv,
+		       IN const osm_madw_t * const p_madw,
+		       IN ib_member_rec_t * p_mcmember_rec)
 {
-  osm_madw_t   *p_resp_madw;
-  ib_sa_mad_t *p_sa_mad, *p_resp_sa_mad;
-  ib_member_rec_t *p_resp_mcmember_rec;
-  ib_api_status_t status;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_mcmr_rcv_respond );
-
-  /*
-   *  Get a MAD to reply. Address of Mad is in the received mad_wrapper
-   */
-  p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
-                                 p_madw->h_bind,
-                                 sizeof(ib_member_rec_t)+IB_SA_MAD_HDR_SIZE,
-                                 osm_madw_get_mad_addr_ptr(p_madw) );
-  if ( !p_resp_madw )
-  {
-    goto Exit;
-  }
-
-  p_resp_sa_mad = (ib_sa_mad_t*)p_resp_madw->p_mad;
-  p_sa_mad = (ib_sa_mad_t*)p_madw->p_mad;
-  /*  Copy the MAD header back into the response mad */
-  memcpy(p_resp_sa_mad, p_sa_mad, IB_SA_MAD_HDR_SIZE);
-  /*  based on the current method decide about the response: */
-  if ((p_resp_sa_mad->method == IB_MAD_METHOD_GET) ||
-      (p_resp_sa_mad->method == IB_MAD_METHOD_SET)) {
-    p_resp_sa_mad->method = IB_MAD_METHOD_GET_RESP;
-  }
-  else if (p_resp_sa_mad->method == IB_MAD_METHOD_DELETE) {
-    p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-  }
-  else
-  {
-    CL_ASSERT( p_resp_sa_mad->method == 0);
-  }
-
-  /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
-  p_resp_sa_mad->sm_key = 0;
-
-  /* Fill in the offset (paylen will be done by the rmpp SAR) */
-  p_resp_sa_mad->attr_offset =
-    ib_get_attr_offset( sizeof(ib_member_rec_t) );
-  p_resp_mcmember_rec = (ib_member_rec_t*)&p_resp_sa_mad->data;
-
-  *p_resp_mcmember_rec = *p_mcmember_rec;
-
-  /* Fill in the mtu, rate, and packet lifetime selectors */
-  p_resp_mcmember_rec->mtu &= 0x3f;
-  p_resp_mcmember_rec->mtu |= 2<<6; /* exactly */
-  p_resp_mcmember_rec->rate &= 0x3f;
-  p_resp_mcmember_rec->rate |=  2<<6; /* exactly */
-  p_resp_mcmember_rec->pkt_life &= 0x3f;
-  p_resp_mcmember_rec->pkt_life |= 2<<6; /* exactly */
-
-  status = osm_vendor_send( p_resp_madw->h_bind, p_resp_madw, FALSE );
-
-  if(status != IB_SUCCESS)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_mcmr_rcv_respond: ERR 1B07: "
-             "Unable to send MAD (%s) for TID <0x%"PRIx64">\n",
-             ib_get_err_str( status ),
-             p_resp_sa_mad->trans_id );
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return;
+	osm_madw_t *p_resp_madw;
+	ib_sa_mad_t *p_sa_mad, *p_resp_sa_mad;
+	ib_member_rec_t *p_resp_mcmember_rec;
+	ib_api_status_t status;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_mcmr_rcv_respond);
+
+	/*
+	 *  Get a MAD to reply. Address of Mad is in the received mad_wrapper
+	 */
+	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+				       p_madw->h_bind,
+				       sizeof(ib_member_rec_t) +
+				       IB_SA_MAD_HDR_SIZE,
+				       osm_madw_get_mad_addr_ptr(p_madw));
+	if (!p_resp_madw) {
+		goto Exit;
+	}
+
+	p_resp_sa_mad = (ib_sa_mad_t *) p_resp_madw->p_mad;
+	p_sa_mad = (ib_sa_mad_t *) p_madw->p_mad;
+	/*  Copy the MAD header back into the response mad */
+	memcpy(p_resp_sa_mad, p_sa_mad, IB_SA_MAD_HDR_SIZE);
+	/*  based on the current method decide about the response: */
+	if ((p_resp_sa_mad->method == IB_MAD_METHOD_GET) ||
+	    (p_resp_sa_mad->method == IB_MAD_METHOD_SET)) {
+		p_resp_sa_mad->method = IB_MAD_METHOD_GET_RESP;
+	} else if (p_resp_sa_mad->method == IB_MAD_METHOD_DELETE) {
+		p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+	} else {
+		CL_ASSERT(p_resp_sa_mad->method == 0);
+	}
+
+	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
+	p_resp_sa_mad->sm_key = 0;
+
+	/* Fill in the offset (paylen will be done by the rmpp SAR) */
+	p_resp_sa_mad->attr_offset =
+	    ib_get_attr_offset(sizeof(ib_member_rec_t));
+	p_resp_mcmember_rec = (ib_member_rec_t *) & p_resp_sa_mad->data;
+
+	*p_resp_mcmember_rec = *p_mcmember_rec;
+
+	/* Fill in the mtu, rate, and packet lifetime selectors */
+	p_resp_mcmember_rec->mtu &= 0x3f;
+	p_resp_mcmember_rec->mtu |= 2 << 6;	/* exactly */
+	p_resp_mcmember_rec->rate &= 0x3f;
+	p_resp_mcmember_rec->rate |= 2 << 6;	/* exactly */
+	p_resp_mcmember_rec->pkt_life &= 0x3f;
+	p_resp_mcmember_rec->pkt_life |= 2 << 6;	/* exactly */
+
+	status = osm_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE);
+
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_mcmr_rcv_respond: ERR 1B07: "
+			"Unable to send MAD (%s) for TID <0x%" PRIx64 ">\n",
+			ib_get_err_str(status), p_resp_sa_mad->trans_id);
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return;
 }
 
 /*********************************************************************
@@ -593,107 +543,96 @@ 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)
+__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;
-  uint8_t mtu_mgrp;
-  uint8_t rate_sel;
-  uint8_t rate_required;
-  uint8_t rate_mgrp;
-
-  if ( comp_mask & IB_MCR_COMPMASK_MTU_SEL)
-  {
-    mtu_sel = (uint8_t)(p_recvd_mcmember_rec->mtu >> 6);
-    /* Clearing last 2 bits */
-    mtu_required = (uint8_t)(p_recvd_mcmember_rec->mtu & 0x3F);
-    mtu_mgrp = (uint8_t)(p_mgrp->mcmember_rec.mtu & 0x3F);
-    switch (mtu_sel)
-    {
-    case 0: /* Greater than MTU specified */
-      if(mtu_mgrp <= mtu_required)
-      {
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__validate_more_comp_fields: "
-                 "Requested mcast group has MTU %x, which is not greater than %x\n",
-                 mtu_mgrp, mtu_required );
-        return FALSE;
-      }
-      break;
-    case 1: /* Less than MTU specified */
-      if(mtu_mgrp >= mtu_required)
-      {
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__validate_more_comp_fields: "
-                 "Requested mcast group has MTU %x, which is not less than %x\n",
-                 mtu_mgrp, mtu_required );
-        return FALSE;
-      }
-      break;
-    case 2: /* Exactly MTU specified */
-      if(mtu_mgrp != mtu_required)
-      {
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__validate_more_comp_fields: "
-                 "Requested mcast group has MTU %x, which is not equal to %x\n",
-                 mtu_mgrp, mtu_required );
-        return FALSE;
-      }
-      break;
-    default:
-      break;
-    }
-  }
-
-  /* what about rate ? */
-  if ( comp_mask & IB_MCR_COMPMASK_RATE_SEL)
-  {
-    rate_sel = (uint8_t)(p_recvd_mcmember_rec->rate >> 6);
-    /* Clearing last 2 bits */
-    rate_required = (uint8_t)(p_recvd_mcmember_rec->rate & 0x3F);
-    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,
-                 "__validate_more_comp_fields: "
-                 "Requested mcast group has RATE %x, which is not greater than %x\n",
-                 rate_mgrp, rate_required );
-        return FALSE;
-      }
-      break;
-    case 1: /* Less than RATE specified */
-      if(rate_mgrp >= rate_required)
-      {
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__validate_more_comp_fields: "
-                 "Requested mcast group has RATE %x, which is not less than %x\n",
-                 rate_mgrp, rate_required );
-        return FALSE;
-      }
-      break;
-    case 2: /* Exactly RATE specified */
-      if(rate_mgrp != rate_required)
-      {
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__validate_more_comp_fields: "
-                 "Requested mcast group has RATE %x, which is not equal to %x\n",
-                 rate_mgrp, rate_required );
-        return FALSE;
-      }
-      break;
-    default:
-      break;
-    }
-  }
-
-  return TRUE;
+	uint8_t mtu_sel;
+	uint8_t mtu_required;
+	uint8_t mtu_mgrp;
+	uint8_t rate_sel;
+	uint8_t rate_required;
+	uint8_t rate_mgrp;
+
+	if (comp_mask & IB_MCR_COMPMASK_MTU_SEL) {
+		mtu_sel = (uint8_t) (p_recvd_mcmember_rec->mtu >> 6);
+		/* Clearing last 2 bits */
+		mtu_required = (uint8_t) (p_recvd_mcmember_rec->mtu & 0x3F);
+		mtu_mgrp = (uint8_t) (p_mgrp->mcmember_rec.mtu & 0x3F);
+		switch (mtu_sel) {
+		case 0:	/* Greater than MTU specified */
+			if (mtu_mgrp <= mtu_required) {
+				osm_log(p_log, OSM_LOG_DEBUG,
+					"__validate_more_comp_fields: "
+					"Requested mcast group has MTU %x, which is not greater than %x\n",
+					mtu_mgrp, mtu_required);
+				return FALSE;
+			}
+			break;
+		case 1:	/* Less than MTU specified */
+			if (mtu_mgrp >= mtu_required) {
+				osm_log(p_log, OSM_LOG_DEBUG,
+					"__validate_more_comp_fields: "
+					"Requested mcast group has MTU %x, which is not less than %x\n",
+					mtu_mgrp, mtu_required);
+				return FALSE;
+			}
+			break;
+		case 2:	/* Exactly MTU specified */
+			if (mtu_mgrp != mtu_required) {
+				osm_log(p_log, OSM_LOG_DEBUG,
+					"__validate_more_comp_fields: "
+					"Requested mcast group has MTU %x, which is not equal to %x\n",
+					mtu_mgrp, mtu_required);
+				return FALSE;
+			}
+			break;
+		default:
+			break;
+		}
+	}
+
+	/* what about rate ? */
+	if (comp_mask & IB_MCR_COMPMASK_RATE_SEL) {
+		rate_sel = (uint8_t) (p_recvd_mcmember_rec->rate >> 6);
+		/* Clearing last 2 bits */
+		rate_required = (uint8_t) (p_recvd_mcmember_rec->rate & 0x3F);
+		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,
+					"__validate_more_comp_fields: "
+					"Requested mcast group has RATE %x, which is not greater than %x\n",
+					rate_mgrp, rate_required);
+				return FALSE;
+			}
+			break;
+		case 1:	/* Less than RATE specified */
+			if (rate_mgrp >= rate_required) {
+				osm_log(p_log, OSM_LOG_DEBUG,
+					"__validate_more_comp_fields: "
+					"Requested mcast group has RATE %x, which is not less than %x\n",
+					rate_mgrp, rate_required);
+				return FALSE;
+			}
+			break;
+		case 2:	/* Exactly RATE specified */
+			if (rate_mgrp != rate_required) {
+				osm_log(p_log, OSM_LOG_DEBUG,
+					"__validate_more_comp_fields: "
+					"Requested mcast group has RATE %x, which is not equal to %x\n",
+					rate_mgrp, rate_required);
+				return FALSE;
+			}
+			break;
+		default:
+			break;
+		}
+	}
+
+	return TRUE;
 }
 
 /*********************************************************************
@@ -701,39 +640,35 @@ 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)
+__validate_port_caps(osm_log_t * const p_log,
+		     const osm_mgrp_t * p_mgrp, const osm_physp_t * p_physp)
 {
-  uint8_t mtu_required;
-  uint8_t mtu_mgrp;
-  uint8_t rate_required;
-  uint8_t rate_mgrp;
-
-  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,
-             "__validate_port_caps: "
-             "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);
-  rate_mgrp = (uint8_t)(p_mgrp->mcmember_rec.rate & 0x3F);
-  if (rate_required < rate_mgrp)
-  {
-    osm_log( p_log, OSM_LOG_DEBUG,
-             "__validate_port_caps: "
-             "Port's RATE %x is less than %x\n",
-             rate_required, rate_mgrp );
-    return FALSE;
-  }
-
-  return TRUE;
+	uint8_t mtu_required;
+	uint8_t mtu_mgrp;
+	uint8_t rate_required;
+	uint8_t rate_mgrp;
+
+	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,
+			"__validate_port_caps: "
+			"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);
+	rate_mgrp = (uint8_t) (p_mgrp->mcmember_rec.rate & 0x3F);
+	if (rate_required < rate_mgrp) {
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"__validate_port_caps: "
+			"Port's RATE %x is less than %x\n",
+			rate_required, rate_mgrp);
+		return FALSE;
+	}
+
+	return TRUE;
 }
 
 /**********************************************************************
@@ -748,87 +683,84 @@ __validate_port_caps(
  * part of the partition for that MCMemberRecord.
  **********************************************************************/
 static boolean_t
-__validate_modify(IN osm_mcmr_recv_t* const p_rcv,
-                  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)
+__validate_modify(IN osm_mcmr_recv_t * const p_rcv,
+		  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)
 {
-  ib_net64_t portguid;
-  ib_gid_t request_gid;
-  osm_physp_t* p_request_physp;
-  ib_api_status_t res;
-
-  portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;
-
-  *pp_mcm_port = NULL;
-
-  /* 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))
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__validate_modify: "
-             "This is a new port in the MC group\n" );
-    return TRUE;
-  }
-
-  /* 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 )
-  {
-    /* The proxy_join is not set. Modifying can by done only
-       if the requester GID == PortGID */
-    res = osm_get_gid_by_mad_addr(p_rcv->p_log,
-                                  p_rcv->p_subn,
-                                  p_mad_addr,
-                                  &request_gid);
-
-    if ( res != IB_SUCCESS )
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-               "__validate_modify: "
-               "Could not find port for requested address\n"
-               );
-      return FALSE;
-    }
-
-    if (memcmp(&((*pp_mcm_port)->port_gid), &request_gid, sizeof(ib_gid_t)))
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-               "__validate_modify: "
-               "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)
-               );
-      return FALSE;
-    }
-  }
-  else
-  {
-    /* The proxy_join is set. Modification allowed only if the
-       requester is part of the partition for this MCMemberRecord */
-    p_request_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-                                                p_rcv->p_subn,
-                                                p_mad_addr);
-    if (p_request_physp == NULL)
-      return FALSE;
-
-    if (!osm_physp_has_pkey(p_rcv->p_log, p_mgrp->mcmember_rec.pkey,
-                            p_request_physp))
-    {
-      /* the request port is not part of the partition for this mgrp */
-      osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-               "__validate_modify: "
-               "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)
-               );
-      return FALSE;
-    }
-  }
-  return TRUE;
+	ib_net64_t portguid;
+	ib_gid_t request_gid;
+	osm_physp_t *p_request_physp;
+	ib_api_status_t res;
+
+	portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;
+
+	*pp_mcm_port = NULL;
+
+	/* 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)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__validate_modify: "
+			"This is a new port in the MC group\n");
+		return TRUE;
+	}
+
+	/* 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) {
+		/* The proxy_join is not set. Modifying can by done only
+		   if the requester GID == PortGID */
+		res = osm_get_gid_by_mad_addr(p_rcv->p_log,
+					      p_rcv->p_subn,
+					      p_mad_addr, &request_gid);
+
+		if (res != IB_SUCCESS) {
+			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				"__validate_modify: "
+				"Could not find port for requested address\n");
+			return FALSE;
+		}
+
+		if (memcmp
+		    (&((*pp_mcm_port)->port_gid), &request_gid,
+		     sizeof(ib_gid_t))) {
+			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				"__validate_modify: "
+				"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)
+			    );
+			return FALSE;
+		}
+	} else {
+		/* The proxy_join is set. Modification allowed only if the
+		   requester is part of the partition for this MCMemberRecord */
+		p_request_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+							    p_rcv->p_subn,
+							    p_mad_addr);
+		if (p_request_physp == NULL)
+			return FALSE;
+
+		if (!osm_physp_has_pkey(p_rcv->p_log, p_mgrp->mcmember_rec.pkey,
+					p_request_physp)) {
+			/* the request port is not part of the partition for this mgrp */
+			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				"__validate_modify: "
+				"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)
+			    );
+			return FALSE;
+		}
+	}
+	return TRUE;
 }
 
 /**********************************************************************
@@ -854,62 +786,58 @@ __validate_modify(IN osm_mcmr_recv_t* const p_rcv,
  *   by the stored MCMemberRecord:P_Key.
  */
 static boolean_t
-__validate_delete(IN osm_mcmr_recv_t* const p_rcv,
-                  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)
+__validate_delete(IN osm_mcmr_recv_t * const p_rcv,
+		  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)
 {
-  ib_net64_t portguid;
-
-  portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;
-
-  *pp_mcm_port = NULL;
-
-  /* 1 */
-  if (!osm_mgrp_is_port_present(p_mgrp, portguid, pp_mcm_port))
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__validate_delete: "
-             "Failed to find the port in the MC group\n" );
-    return FALSE;
-  }
-
-  /* 2 */
-  if (!(p_recvd_mcmember_rec->scope_state & 0x0F &
-        (*pp_mcm_port)->scope_state))
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__validate_delete: "
-             "Could not find any matching bits in the stored and requested JoinStates\n" );
-    return FALSE;
-  }
-
-  /* 3 */
-  if ( ((p_recvd_mcmember_rec->scope_state & 0x0F) |
-        (0x0F & (*pp_mcm_port)->scope_state)) !=
-       (0x0F & (*pp_mcm_port)->scope_state))
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__validate_delete: "
-             "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)
-             );
-    return FALSE;
-  }
-
-  /* 4 */
-  /* Validate according the the proxy_join (o15-0.1.2) */
-  if ( __validate_modify( p_rcv, p_mgrp, p_mad_addr, p_recvd_mcmember_rec,
-                          pp_mcm_port ) == FALSE )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__validate_delete: "
-             "proxy_join validation failure\n" );
-    return FALSE;
-  }
-  return TRUE;
+	ib_net64_t portguid;
+
+	portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;
+
+	*pp_mcm_port = NULL;
+
+	/* 1 */
+	if (!osm_mgrp_is_port_present(p_mgrp, portguid, pp_mcm_port)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__validate_delete: "
+			"Failed to find the port in the MC group\n");
+		return FALSE;
+	}
+
+	/* 2 */
+	if (!(p_recvd_mcmember_rec->scope_state & 0x0F &
+	      (*pp_mcm_port)->scope_state)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__validate_delete: "
+			"Could not find any matching bits in the stored and requested JoinStates\n");
+		return FALSE;
+	}
+
+	/* 3 */
+	if (((p_recvd_mcmember_rec->scope_state & 0x0F) |
+	     (0x0F & (*pp_mcm_port)->scope_state)) !=
+	    (0x0F & (*pp_mcm_port)->scope_state)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__validate_delete: "
+			"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)
+		    );
+		return FALSE;
+	}
+
+	/* 4 */
+	/* Validate according the the proxy_join (o15-0.1.2) */
+	if (__validate_modify(p_rcv, p_mgrp, p_mad_addr, p_recvd_mcmember_rec,
+			      pp_mcm_port) == FALSE) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__validate_delete: "
+			"proxy_join validation failure\n");
+		return FALSE;
+	}
+	return TRUE;
 }
 
 /**********************************************************************
@@ -955,97 +883,92 @@ __validate_delete(IN osm_mcmr_recv_t* const p_rcv,
  *    only source for this signature with link-local scope)
  */
 ib_api_status_t
-__validate_requested_mgid(IN osm_mcmr_recv_t* const p_rcv,
-                          IN const ib_member_rec_t* p_mcm_rec)
+__validate_requested_mgid(IN osm_mcmr_recv_t * const p_rcv,
+			  IN const ib_member_rec_t * p_mcm_rec)
 {
-  uint16_t signature;
-  boolean_t valid = TRUE;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __validate_requested_mgid );
-
-  /* 14-a: mcast GID must start with 0xFF */
-  if (p_mcm_rec->mgid.multicast.header[0] != 0xFF)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__validate_requested_mgid: ERR 1B01: "
-             "Wrong MGID Prefix 0x%02X must be 0xFF\n",
-             cl_ntoh16(p_mcm_rec->mgid.multicast.header[0])
-             );
-    valid = FALSE;
-    goto Exit;
-  }
-
-  /* the MGID signature can mark IPoIB or SA assigned MGIDs */
-  memcpy(&signature, &(p_mcm_rec->mgid.multicast.raw_group_id), sizeof(signature));
-  signature = cl_ntoh16(signature);
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "__validate_requested_mgid:  "
-           "MGID Signed as 0x%04X\n",
-           signature
-           );
-
-  /*
-   * We skip any checks for MGIDs that follow IPoIB
-   * GID structure as defined by the IETF ipoib-link-multicast.
-   *
-   * For IPv4 over IB, the signature will be "0x401B".
-   *
-   * |   8    |  4 |  4 |     16 bits     | 16 bits | 48 bits  | 32 bits |
-   * +--------+----+----+-----------------+---------+----------+---------+
-   * |11111111|0001|scop|<IPoIB signature>|< P_Key >|00.......0|<all 1's>|
-   * +--------+----+----+-----------------+---------+----------+---------+
-   *
-   * For IPv6 over IB, the signature will be "0x601B".
-   *
-   * |   8    |  4 |  4 |     16 bits     | 16 bits |       80 bits      |
-   * +--------+----+----+-----------------+---------+--------------------+
-   * |11111111|0001|scop|<IPoIB signature>|< P_Key >|000.............0001|
-   * +--------+----+----+-----------------+---------+--------------------+
-   *
-   */
-  if (signature == 0x401B || signature == 0x601B)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__validate_requested_mgid:  "
-             "Skipping MGID Validation for IPoIB Signed (0x%04X) MGIDs\n",
-             signature
-             );
-    goto Exit;
-  }
-
-  /* 14-b: the 3 upper bits in the "flags" should be zero: */
-  if ( p_mcm_rec->mgid.multicast.header[1] & 0xE0 )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__validate_requested_mgid: ERR 1B28: "
-             "MGID uses Reserved Flags: flags=0x%X\n",
-             (p_mcm_rec->mgid.multicast.header[1] & 0xE0) >> 4
-             );
-    valid = FALSE;
-    goto Exit;
-  }
-
-  /* 2 - now what if the link local format 0xA01B is used -
-     the scope should not be link local */
-  if ( ( signature == 0xA01B ) &&
-       ((p_mcm_rec->mgid.multicast.header[1] & 0x0F) == MC_SCOPE_LINK_LOCAL) ) {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__validate_requested_mgid: ERR 1B24: "
-             "MGID uses 0xA01B signature but with link-local scope\n" );
-    valid = FALSE;
-    goto Exit;
-  }
-
-  /*
-   * For SA assigned MGIDs (signature 0xA01B):
-   * There is no real way to make sure the Unique MGID 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( p_rcv->p_log );
-  return (valid);
+	uint16_t signature;
+	boolean_t valid = TRUE;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __validate_requested_mgid);
+
+	/* 14-a: mcast GID must start with 0xFF */
+	if (p_mcm_rec->mgid.multicast.header[0] != 0xFF) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__validate_requested_mgid: ERR 1B01: "
+			"Wrong MGID Prefix 0x%02X must be 0xFF\n",
+			cl_ntoh16(p_mcm_rec->mgid.multicast.header[0])
+		    );
+		valid = FALSE;
+		goto Exit;
+	}
+
+	/* the MGID signature can mark IPoIB or SA assigned MGIDs */
+	memcpy(&signature, &(p_mcm_rec->mgid.multicast.raw_group_id),
+	       sizeof(signature));
+	signature = cl_ntoh16(signature);
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"__validate_requested_mgid:  "
+		"MGID Signed as 0x%04X\n", signature);
+
+	/*
+	 * We skip any checks for MGIDs that follow IPoIB
+	 * GID structure as defined by the IETF ipoib-link-multicast.
+	 *
+	 * For IPv4 over IB, the signature will be "0x401B".
+	 *
+	 * |   8    |  4 |  4 |     16 bits     | 16 bits | 48 bits  | 32 bits |
+	 * +--------+----+----+-----------------+---------+----------+---------+
+	 * |11111111|0001|scop|<IPoIB signature>|< P_Key >|00.......0|<all 1's>|
+	 * +--------+----+----+-----------------+---------+----------+---------+
+	 *
+	 * For IPv6 over IB, the signature will be "0x601B".
+	 *
+	 * |   8    |  4 |  4 |     16 bits     | 16 bits |       80 bits      |
+	 * +--------+----+----+-----------------+---------+--------------------+
+	 * |11111111|0001|scop|<IPoIB signature>|< P_Key >|000.............0001|
+	 * +--------+----+----+-----------------+---------+--------------------+
+	 *
+	 */
+	if (signature == 0x401B || signature == 0x601B) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__validate_requested_mgid:  "
+			"Skipping MGID Validation for IPoIB Signed (0x%04X) MGIDs\n",
+			signature);
+		goto Exit;
+	}
+
+	/* 14-b: the 3 upper bits in the "flags" should be zero: */
+	if (p_mcm_rec->mgid.multicast.header[1] & 0xE0) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__validate_requested_mgid: ERR 1B28: "
+			"MGID uses Reserved Flags: flags=0x%X\n",
+			(p_mcm_rec->mgid.multicast.header[1] & 0xE0) >> 4);
+		valid = FALSE;
+		goto Exit;
+	}
+
+	/* 2 - now what if the link local format 0xA01B is used -
+	   the scope should not be link local */
+	if ((signature == 0xA01B) &&
+	    ((p_mcm_rec->mgid.multicast.header[1] & 0x0F) ==
+	     MC_SCOPE_LINK_LOCAL)) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__validate_requested_mgid: ERR 1B24: "
+			"MGID uses 0xA01B signature but with link-local scope\n");
+		valid = FALSE;
+		goto Exit;
+	}
+
+	/*
+	 * For SA assigned MGIDs (signature 0xA01B):
+	 * There is no real way to make sure the Unique MGID 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(p_rcv->p_log);
+	return (valid);
 }
 
 /**********************************************************************
@@ -1053,325 +976,305 @@ __validate_requested_mgid(IN osm_mcmr_recv_t* const p_rcv,
  Also set the default MTU and Rate if not provided by the user.
 **********************************************************************/
 boolean_t
-__mgrp_request_is_realizable(
-  IN osm_mcmr_recv_t* const p_rcv,
-  IN ib_net64_t comp_mask,
-  IN ib_member_rec_t * p_mcm_rec,
-  IN const osm_physp_t* const p_physp)
+__mgrp_request_is_realizable(IN osm_mcmr_recv_t * const p_rcv,
+			     IN ib_net64_t comp_mask,
+			     IN ib_member_rec_t * p_mcm_rec,
+			     IN const osm_physp_t * const 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;
-  osm_log_t *p_log = p_rcv->p_log;
-
-  OSM_LOG_ENTER( p_rcv->p_log,  __mgrp_request_is_realizable );
-
-  /*
-   * End of o15-0.2.3 specifies:
-   * ....
-   * The entity may also supply the other components such as HopLimit, MTU,
-   * etc. during group creation time. If these components are not provided
-   * during group creation time, SA will provide them for the group. The values
-   * chosen are vendor-dependent and beyond the scope of the specification.
-   *
-   * so we might also need to assign RATE/MTU if they are not comp masked in.
-   */
-
-  port_mtu = p_physp ? ib_port_info_get_mtu_cap(&p_physp->port_info) : 0;
-  if (!(comp_mask & IB_MCR_COMPMASK_MTU) ||
-		  !(comp_mask & IB_MCR_COMPMASK_MTU_SEL) ||
-		  (mtu_sel = (p_mcm_rec->mtu >> 6)) == 3)
-    mtu = port_mtu ? port_mtu : p_rcv->p_subn->min_ca_mtu;
-  else
-  {
-    mtu_required = (uint8_t)(p_mcm_rec->mtu & 0x3F);
-    mtu = mtu_required;
-    switch (mtu_sel)
-    {
-    case 0: /* Greater than MTU specified */
-      if (port_mtu && mtu_required >= port_mtu)
-      {
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__mgrp_request_is_realizable: "
-                 "Requested MTU %x >= the port\'s mtu:%x\n",
-                 mtu_required, port_mtu );
-        return FALSE;
-      }
-      /* we provide the largest MTU possible if we can */
-      if (port_mtu)
-	mtu = port_mtu;
-      else if (mtu_required < p_rcv->p_subn->min_ca_mtu)
-        mtu = p_rcv->p_subn->min_ca_mtu;
-      else
-        mtu++;
-      break;
-    case 1: /* Less than MTU specified */
-      /* use the smaller of the two:
-         a. one lower then the required
-         b. the mtu of the requesting port (if exists) */
-      if (port_mtu && mtu_required > port_mtu)
-        mtu = port_mtu;
-      else
-        mtu--;
-      break;
-    case 2: /* Exactly MTU specified */
-    default:
-      break;
-    }
-    /* make sure it still be in the range */
-    if (mtu < IB_MIN_MTU || mtu > IB_MAX_MTU)
-    {
-      osm_log( p_log, OSM_LOG_DEBUG,
-               "__mgrp_request_is_realizable: "
-               "Calculated MTU %x is out of range\n",
-               mtu );
-      return FALSE;
-    }
-  }
-  p_mcm_rec->mtu = (mtu_sel<<6) | mtu;
-
-  port_rate = p_physp ? ib_port_info_compute_rate(&p_physp->port_info) : 0;
-  if (!(comp_mask & IB_MCR_COMPMASK_RATE) ||
-		  !(comp_mask & IB_MCR_COMPMASK_RATE_SEL) ||
-		  (rate_sel = (p_mcm_rec->rate >> 6)) == 3)
-    rate = port_rate ? port_rate : p_rcv->p_subn->min_ca_rate;
-  else
-  {
-    rate_required = (uint8_t)(p_mcm_rec->rate & 0x3F);
-    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,
-                 "__mgrp_request_is_realizable: "
-                 "Requested RATE %x >= the port\'s rate:%x\n",
-                 rate_required, port_rate );
-        return FALSE;
-      }
-      /* we provide the largest RATE possible if we can */
-      if (port_rate)
-	rate = port_rate;
-      else if (rate_required < p_rcv->p_subn->min_ca_rate)
-        rate = p_rcv->p_subn->min_ca_rate;
-      else
-        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)
-        rate = port_rate;
-      else
-        rate--;
-      break;
-    case 2: /* Exactly RATE specified */
-    default:
-      break;
-    }
-    /* make sure it still is in the range */
-    if (rate < IB_MIN_RATE || rate > IB_MAX_RATE)
-    {
-      osm_log( p_log, OSM_LOG_DEBUG,
-               "__mgrp_request_is_realizable: "
-               "Calculated RATE %x is out of range\n",
-               rate );
-      return FALSE;
-    }
-  }
-  p_mcm_rec->rate = (rate_sel<<6) | rate;
-
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return TRUE;
+	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;
+	osm_log_t *p_log = p_rcv->p_log;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __mgrp_request_is_realizable);
+
+	/*
+	 * End of o15-0.2.3 specifies:
+	 * ....
+	 * The entity may also supply the other components such as HopLimit, MTU,
+	 * etc. during group creation time. If these components are not provided
+	 * during group creation time, SA will provide them for the group. The values
+	 * chosen are vendor-dependent and beyond the scope of the specification.
+	 *
+	 * so we might also need to assign RATE/MTU if they are not comp masked in.
+	 */
+
+	port_mtu = p_physp ? ib_port_info_get_mtu_cap(&p_physp->port_info) : 0;
+	if (!(comp_mask & IB_MCR_COMPMASK_MTU) ||
+	    !(comp_mask & IB_MCR_COMPMASK_MTU_SEL) ||
+	    (mtu_sel = (p_mcm_rec->mtu >> 6)) == 3)
+		mtu = port_mtu ? port_mtu : p_rcv->p_subn->min_ca_mtu;
+	else {
+		mtu_required = (uint8_t) (p_mcm_rec->mtu & 0x3F);
+		mtu = mtu_required;
+		switch (mtu_sel) {
+		case 0:	/* Greater than MTU specified */
+			if (port_mtu && mtu_required >= port_mtu) {
+				osm_log(p_log, OSM_LOG_DEBUG,
+					"__mgrp_request_is_realizable: "
+					"Requested MTU %x >= the port\'s mtu:%x\n",
+					mtu_required, port_mtu);
+				return FALSE;
+			}
+			/* we provide the largest MTU possible if we can */
+			if (port_mtu)
+				mtu = port_mtu;
+			else if (mtu_required < p_rcv->p_subn->min_ca_mtu)
+				mtu = p_rcv->p_subn->min_ca_mtu;
+			else
+				mtu++;
+			break;
+		case 1:	/* Less than MTU specified */
+			/* use the smaller of the two:
+			   a. one lower then the required
+			   b. the mtu of the requesting port (if exists) */
+			if (port_mtu && mtu_required > port_mtu)
+				mtu = port_mtu;
+			else
+				mtu--;
+			break;
+		case 2:	/* Exactly MTU specified */
+		default:
+			break;
+		}
+		/* make sure it still be in the range */
+		if (mtu < IB_MIN_MTU || mtu > IB_MAX_MTU) {
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__mgrp_request_is_realizable: "
+				"Calculated MTU %x is out of range\n", mtu);
+			return FALSE;
+		}
+	}
+	p_mcm_rec->mtu = (mtu_sel << 6) | mtu;
+
+	port_rate =
+	    p_physp ? ib_port_info_compute_rate(&p_physp->port_info) : 0;
+	if (!(comp_mask & IB_MCR_COMPMASK_RATE)
+	    || !(comp_mask & IB_MCR_COMPMASK_RATE_SEL)
+	    || (rate_sel = (p_mcm_rec->rate >> 6)) == 3)
+		rate = port_rate ? port_rate : p_rcv->p_subn->min_ca_rate;
+	else {
+		rate_required = (uint8_t) (p_mcm_rec->rate & 0x3F);
+		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,
+					"__mgrp_request_is_realizable: "
+					"Requested RATE %x >= the port\'s rate:%x\n",
+					rate_required, port_rate);
+				return FALSE;
+			}
+			/* we provide the largest RATE possible if we can */
+			if (port_rate)
+				rate = port_rate;
+			else if (rate_required < p_rcv->p_subn->min_ca_rate)
+				rate = p_rcv->p_subn->min_ca_rate;
+			else
+				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)
+				rate = port_rate;
+			else
+				rate--;
+			break;
+		case 2:	/* Exactly RATE specified */
+		default:
+			break;
+		}
+		/* make sure it still is in the range */
+		if (rate < IB_MIN_RATE || rate > IB_MAX_RATE) {
+			osm_log(p_log, OSM_LOG_DEBUG,
+				"__mgrp_request_is_realizable: "
+				"Calculated RATE %x is out of range\n", rate);
+			return FALSE;
+		}
+	}
+	p_mcm_rec->rate = (rate_sel << 6) | rate;
+
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return TRUE;
 }
 
 /**********************************************************************
  Call this function to find or create a new mgrp.
 **********************************************************************/
 ib_api_status_t
-osm_mcmr_rcv_find_or_create_new_mgrp(
-  IN osm_mcmr_recv_t* const p_rcv,
-  IN ib_net64_t comp_mask,
-  IN ib_member_rec_t* const p_recvd_mcmember_rec,
-  OUT osm_mgrp_t **pp_mgrp)
+osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_mcmr_recv_t * const p_rcv,
+				     IN ib_net64_t comp_mask,
+				     IN ib_member_rec_t *
+				     const p_recvd_mcmember_rec,
+				     OUT osm_mgrp_t ** pp_mgrp)
 {
-  ib_api_status_t status;
-
-  status = __get_mgrp_by_mgid(p_rcv, p_recvd_mcmember_rec, pp_mgrp);
-  if (status == IB_SUCCESS)
-     return status;
-  return osm_mcmr_rcv_create_new_mgrp(p_rcv, comp_mask,
-		  p_recvd_mcmember_rec, NULL, pp_mgrp);
+	ib_api_status_t status;
+
+	status = __get_mgrp_by_mgid(p_rcv, p_recvd_mcmember_rec, pp_mgrp);
+	if (status == IB_SUCCESS)
+		return status;
+	return osm_mcmr_rcv_create_new_mgrp(p_rcv, comp_mask,
+					    p_recvd_mcmember_rec, NULL,
+					    pp_mgrp);
 }
 
 /**********************************************************************
  Call this function to create a new mgrp.
 **********************************************************************/
 ib_api_status_t
-osm_mcmr_rcv_create_new_mgrp(
-  IN osm_mcmr_recv_t* const p_rcv,
-  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)
+osm_mcmr_rcv_create_new_mgrp(IN osm_mcmr_recv_t * const p_rcv,
+			     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)
 {
-  ib_net16_t mlid;
-  uint8_t zero_mgid, valid;
-  uint8_t scope, i;
-  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( p_rcv->p_log, osm_mcmr_rcv_create_new_mgrp );
-
-  /* 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(p_rcv, mcm_rec.mlid);
-  if ( mlid == 0 )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_mcmr_rcv_create_new_mgrp: ERR 1B19: "
-             "__get_new_mlid failed\n" );
-    status = IB_SA_MAD_STATUS_NO_RESOURCES;
-    goto Exit;
-  }
-
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "osm_mcmr_rcv_create_new_mgrp: "
-           "Obtained new mlid 0x%X\n", cl_ntoh16(mlid) );
-
-  /* we need to create the new MGID if it was not defined */
-  if (zero_mgid)
-  {
-    /* create a new MGID */
-
-    /* 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 = 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]),
-           &p_rcv->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));
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_mcmr_rcv_create_new_mgrp: "
-             "Allocated new MGID:0x%016" PRIx64 " : "
-             "0x%016" PRIx64 "\n",
-             cl_ntoh64(p_mgid->unicast.prefix),
-             cl_ntoh64(p_mgid->unicast.interface_id) );
-  }
-  else
-  {
-    /* a specific MGID was requested so validate the resulting MGID */
-    valid = __validate_requested_mgid(p_rcv, &mcm_rec);
-    if (!valid)
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_mcmr_rcv_create_new_mgrp: ERR 1B22: "
-               "Invalid requested MGID\n" );
-      __free_mlid(p_rcv, mlid);
-      status = IB_SA_MAD_STATUS_REQ_INVALID;
-      goto Exit;
-    }
-  }
-
-  /* check the requested parameters are realizable */
-  if (__mgrp_request_is_realizable(p_rcv, comp_mask, &mcm_rec, p_physp) == FALSE)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_mcmr_rcv_create_new_mgrp: ERR 1B26: "
-             "Requested MGRP parameters are not realizable\n" );
-    __free_mlid(p_rcv, mlid);
-    status = IB_SA_MAD_STATUS_REQ_INVALID;
-    goto Exit;
-  }
-
-  /* create a new MC Group */
-  *pp_mgrp = osm_mgrp_new(mlid);
-  if (*pp_mgrp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_mcmr_rcv_create_new_mgrp: ERR 1B08: "
-             "osm_mgrp_new failed\n" );
-    __free_mlid(p_rcv, 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 */
-  (*pp_mgrp)->mcmember_rec.rate &= 0x3f;
-  (*pp_mgrp)->mcmember_rec.rate |= 2<<6; /* exactly */
-  (*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_mgrp_t *)cl_qmap_get(&p_rcv->p_subn->mgrp_mlid_tbl, mlid);
-  if (p_prev_mgrp != (osm_mgrp_t *)cl_qmap_end(&p_rcv->p_subn->mgrp_mlid_tbl))
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_mcmr_rcv_create_new_mgrp: "
-             "Found previous group for mlid:0x%04x - Need to destroy it\n",
-             cl_ntoh16(mlid) );
-    cl_qmap_remove_item(&p_rcv->p_subn->mgrp_mlid_tbl,
-                        (cl_map_item_t *)p_prev_mgrp );
-    osm_mgrp_delete( p_prev_mgrp );
-  }
-
-  cl_qmap_insert(&p_rcv->p_subn->mgrp_mlid_tbl,
-                 mlid,
-                 &(*pp_mgrp)->map_item);
-
-  /* Send a Report to any InformInfo registerd for
-     Trap 66: MCGroup create */
-  osm_mgrp_send_create_notice(p_rcv->p_subn, p_rcv->p_log, *pp_mgrp);
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return status;
+	ib_net16_t mlid;
+	uint8_t zero_mgid, valid;
+	uint8_t scope, i;
+	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(p_rcv->p_log, osm_mcmr_rcv_create_new_mgrp);
+
+	/* 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(p_rcv, mcm_rec.mlid);
+	if (mlid == 0) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_mcmr_rcv_create_new_mgrp: ERR 1B19: "
+			"__get_new_mlid failed\n");
+		status = IB_SA_MAD_STATUS_NO_RESOURCES;
+		goto Exit;
+	}
+
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"osm_mcmr_rcv_create_new_mgrp: "
+		"Obtained new mlid 0x%X\n", cl_ntoh16(mlid));
+
+	/* we need to create the new MGID if it was not defined */
+	if (zero_mgid) {
+		/* create a new MGID */
+
+		/* 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 = 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]),
+		       &p_rcv->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));
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"osm_mcmr_rcv_create_new_mgrp: "
+			"Allocated new MGID:0x%016" PRIx64 " : "
+			"0x%016" PRIx64 "\n",
+			cl_ntoh64(p_mgid->unicast.prefix),
+			cl_ntoh64(p_mgid->unicast.interface_id));
+	} else {
+		/* a specific MGID was requested so validate the resulting MGID */
+		valid = __validate_requested_mgid(p_rcv, &mcm_rec);
+		if (!valid) {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_mcmr_rcv_create_new_mgrp: ERR 1B22: "
+				"Invalid requested MGID\n");
+			__free_mlid(p_rcv, mlid);
+			status = IB_SA_MAD_STATUS_REQ_INVALID;
+			goto Exit;
+		}
+	}
+
+	/* check the requested parameters are realizable */
+	if (__mgrp_request_is_realizable(p_rcv, comp_mask, &mcm_rec, p_physp) ==
+	    FALSE) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_mcmr_rcv_create_new_mgrp: ERR 1B26: "
+			"Requested MGRP parameters are not realizable\n");
+		__free_mlid(p_rcv, mlid);
+		status = IB_SA_MAD_STATUS_REQ_INVALID;
+		goto Exit;
+	}
+
+	/* create a new MC Group */
+	*pp_mgrp = osm_mgrp_new(mlid);
+	if (*pp_mgrp == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_mcmr_rcv_create_new_mgrp: ERR 1B08: "
+			"osm_mgrp_new failed\n");
+		__free_mlid(p_rcv, 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 */
+	(*pp_mgrp)->mcmember_rec.rate &= 0x3f;
+	(*pp_mgrp)->mcmember_rec.rate |= 2 << 6;	/* exactly */
+	(*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_mgrp_t *) cl_qmap_get(&p_rcv->p_subn->mgrp_mlid_tbl, mlid);
+	if (p_prev_mgrp !=
+	    (osm_mgrp_t *) cl_qmap_end(&p_rcv->p_subn->mgrp_mlid_tbl)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"osm_mcmr_rcv_create_new_mgrp: "
+			"Found previous group for mlid:0x%04x - Need to destroy it\n",
+			cl_ntoh16(mlid));
+		cl_qmap_remove_item(&p_rcv->p_subn->mgrp_mlid_tbl,
+				    (cl_map_item_t *) p_prev_mgrp);
+		osm_mgrp_delete(p_prev_mgrp);
+	}
+
+	cl_qmap_insert(&p_rcv->p_subn->mgrp_mlid_tbl,
+		       mlid, &(*pp_mgrp)->map_item);
+
+	/* Send a Report to any InformInfo registerd for
+	   Trap 66: MCGroup create */
+	osm_mgrp_send_create_notice(p_rcv->p_subn, p_rcv->p_log, *pp_mgrp);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return status;
 
 }
 
@@ -1379,998 +1282,967 @@ osm_mcmr_rcv_create_new_mgrp(
 Process a request for leaving the group
 **********************************************************************/
 static void
-__osm_mcmr_rcv_leave_mgrp(
-  IN osm_mcmr_recv_t* const p_rcv,
-  IN const osm_madw_t* const p_madw )
+__osm_mcmr_rcv_leave_mgrp(IN osm_mcmr_recv_t * const p_rcv,
+			  IN const osm_madw_t * const p_madw)
 {
-  boolean_t valid;
-  osm_mgrp_t *p_mgrp;
-  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;
-  ib_net16_t sa_status;
-  ib_net64_t portguid;
-  osm_mcm_port_t *p_mcm_port;
-  uint8_t port_join_state;
-  uint8_t new_join_state;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_mcmr_rcv_leave_mgrp );
-
-  p_mgrp = NULL;
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_recvd_mcmember_rec =
-    (ib_member_rec_t*)ib_sa_mad_get_payload_ptr( p_sa_mad );
-
-  mcmember_rec = *p_recvd_mcmember_rec;
-
-  if ( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) ) {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_mcmr_rcv_leave_mgrp: Dump of record\n" );
-    osm_dump_mc_record( p_rcv->p_log, &mcmember_rec, OSM_LOG_DEBUG );
-  }
-
-  CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
-  status = __get_mgrp_by_mgid(p_rcv,p_recvd_mcmember_rec, &p_mgrp);
-  if (status == IB_SUCCESS)
-  {
-    mlid = p_mgrp->mlid;
-    portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;
-
-    /* check validity of the delete request o15-0.1.14 */
-    valid =  __validate_delete(p_rcv,
-                               p_mgrp,
-                               osm_madw_get_mad_addr_ptr(p_madw),
-                               p_recvd_mcmember_rec,
-                               &p_mcm_port);
-
-    if (valid)
-    {
-      /*
-       * 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 = p_mcm_port->scope_state & 0x0F;
-      new_join_state =
-        port_join_state & ~(p_recvd_mcmember_rec->scope_state & 0x0F);
-      if (new_join_state)
-      {
-        /* Just update the result JoinState */
-        p_mcm_port->scope_state =
-          new_join_state | (p_mcm_port->scope_state & 0xf0);
-
-        mcmember_rec.scope_state = p_mcm_port->scope_state;
-
-        CL_PLOCK_RELEASE( p_rcv->p_lock );
-
-        osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-                 "__osm_mcmr_rcv_leave_mgrp: "
-                 "After update JoinState != 0. Updating from 0x%X to 0x%X\n",
-                 port_join_state,
-                 new_join_state
-                 );
-      }
-      else
-      {
-        /* we need to return the stored scope state */
-        mcmember_rec.scope_state = p_mcm_port->scope_state;
-
-        /* OK we can leave */
-	/* note: osm_sm_mcgrp_leave() will release p_rcv->p_lock */
-
-        status = osm_sm_mcgrp_leave(p_rcv->p_sm, mlid, portguid);
-        if(status != IB_SUCCESS)
-        {
-          osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-                   "__osm_mcmr_rcv_leave_mgrp: ERR 1B09: "
-                   "osm_sm_mcgrp_leave failed\n" );
-        }
-      }
-    }
-    else
-    {
-      CL_PLOCK_RELEASE( p_rcv->p_lock );
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "__osm_mcmr_rcv_leave_mgrp: ERR 1B25: "
-               "Received an invalid delete request for "
-               "MGID: 0x%016" PRIx64 " : "
-               "0x%016" PRIx64 " for "
-               "PortGID: 0x%016" PRIx64 " : "
-               "0x%016" PRIx64 "\n",
-               cl_ntoh64( p_recvd_mcmember_rec->mgid.unicast.prefix ),
-               cl_ntoh64( p_recvd_mcmember_rec->mgid.unicast.interface_id ),
-               cl_ntoh64( p_recvd_mcmember_rec->port_gid.unicast.prefix ),
-               cl_ntoh64( p_recvd_mcmember_rec->port_gid.unicast.interface_id ) );
-      sa_status   = IB_SA_MAD_STATUS_REQ_INVALID;
-      osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
-      goto Exit;
-    }
-  }
-  else
-  {
-    CL_PLOCK_RELEASE( p_rcv->p_lock );
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_mcmr_rcv_leave_mgrp: "
-             "Failed since multicast group not present\n" );
-    sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-    osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
-    goto Exit;
-  }
-
-  /* Send an SA response */
-  __osm_mcmr_rcv_respond( p_rcv, p_madw, &mcmember_rec );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return;
+	boolean_t valid;
+	osm_mgrp_t *p_mgrp;
+	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;
+	ib_net16_t sa_status;
+	ib_net64_t portguid;
+	osm_mcm_port_t *p_mcm_port;
+	uint8_t port_join_state;
+	uint8_t new_join_state;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_mcmr_rcv_leave_mgrp);
+
+	p_mgrp = NULL;
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_recvd_mcmember_rec =
+	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
+
+	mcmember_rec = *p_recvd_mcmember_rec;
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_mcmr_rcv_leave_mgrp: Dump of record\n");
+		osm_dump_mc_record(p_rcv->p_log, &mcmember_rec, OSM_LOG_DEBUG);
+	}
+
+	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
+	status = __get_mgrp_by_mgid(p_rcv, p_recvd_mcmember_rec, &p_mgrp);
+	if (status == IB_SUCCESS) {
+		mlid = p_mgrp->mlid;
+		portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;
+
+		/* check validity of the delete request o15-0.1.14 */
+		valid = __validate_delete(p_rcv,
+					  p_mgrp,
+					  osm_madw_get_mad_addr_ptr(p_madw),
+					  p_recvd_mcmember_rec, &p_mcm_port);
+
+		if (valid) {
+			/*
+			 * 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 = p_mcm_port->scope_state & 0x0F;
+			new_join_state =
+			    port_join_state & ~(p_recvd_mcmember_rec->
+						scope_state & 0x0F);
+			if (new_join_state) {
+				/* Just update the result JoinState */
+				p_mcm_port->scope_state =
+				    new_join_state | (p_mcm_port->
+						      scope_state & 0xf0);
+
+				mcmember_rec.scope_state =
+				    p_mcm_port->scope_state;
+
+				CL_PLOCK_RELEASE(p_rcv->p_lock);
+
+				osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+					"__osm_mcmr_rcv_leave_mgrp: "
+					"After update JoinState != 0. Updating from 0x%X to 0x%X\n",
+					port_join_state, new_join_state);
+			} else {
+				/* we need to return the stored scope state */
+				mcmember_rec.scope_state =
+				    p_mcm_port->scope_state;
+
+				/* OK we can leave */
+				/* note: osm_sm_mcgrp_leave() will release p_rcv->p_lock */
+
+				status =
+				    osm_sm_mcgrp_leave(p_rcv->p_sm, mlid,
+						       portguid);
+				if (status != IB_SUCCESS) {
+					osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+						"__osm_mcmr_rcv_leave_mgrp: ERR 1B09: "
+						"osm_sm_mcgrp_leave failed\n");
+				}
+			}
+		} else {
+			CL_PLOCK_RELEASE(p_rcv->p_lock);
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"__osm_mcmr_rcv_leave_mgrp: ERR 1B25: "
+				"Received an invalid delete request for "
+				"MGID: 0x%016" PRIx64 " : "
+				"0x%016" PRIx64 " for "
+				"PortGID: 0x%016" PRIx64 " : "
+				"0x%016" PRIx64 "\n",
+				cl_ntoh64(p_recvd_mcmember_rec->mgid.unicast.
+					  prefix),
+				cl_ntoh64(p_recvd_mcmember_rec->mgid.unicast.
+					  interface_id),
+				cl_ntoh64(p_recvd_mcmember_rec->port_gid.
+					  unicast.prefix),
+				cl_ntoh64(p_recvd_mcmember_rec->port_gid.
+					  unicast.interface_id));
+			sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
+			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			goto Exit;
+		}
+	} else {
+		CL_PLOCK_RELEASE(p_rcv->p_lock);
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_mcmr_rcv_leave_mgrp: "
+			"Failed since multicast group not present\n");
+		sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
+		osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+		goto Exit;
+	}
+
+	/* Send an SA response */
+	__osm_mcmr_rcv_respond(p_rcv, p_madw, &mcmember_rec);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return;
 }
 
 /**********************************************************************
  Handle a join (or create) request
 **********************************************************************/
 static void
-__osm_mcmr_rcv_join_mgrp(
-  IN osm_mcmr_recv_t* const p_rcv,
-  IN const osm_madw_t* const p_madw )
+__osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
+			 IN const osm_madw_t * const p_madw)
 {
-  boolean_t valid;
-  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 sa_status;
-  ib_net16_t mlid;
-  osm_mcm_port_t *p_mcmr_port;
-  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;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_mcmr_rcv_join_mgrp );
-
-  p_mgrp = NULL;
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_recvd_mcmember_rec =
-    (ib_member_rec_t*)ib_sa_mad_get_payload_ptr( p_sa_mad );
-
-  portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;
-
-  mcmember_rec = *p_recvd_mcmember_rec;
-
-  if ( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_mcmr_rcv_join_mgrp: "
-             "Dump of incoming record\n" );
-    osm_dump_mc_record( p_rcv->p_log, &mcmember_rec, OSM_LOG_DEBUG );
-  }
-
-  CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
-
-  /* make sure the requested port guid is known to the SM */
-  p_port = osm_get_port_by_guid(p_rcv->p_subn, portguid);
-  if (!p_port)
-  {
-    CL_PLOCK_RELEASE( p_rcv->p_lock );
-
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_mcmr_rcv_join_mgrp: "
-             "Unknown port GUID 0x%016" PRIx64 "\n",
-             portguid );
-    sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-    osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
-    goto Exit;
-  }
-
-  p_physp = p_port->p_physp;
-  /* Check that the p_physp and the requester physp are in the same
-     partition. */
-  p_request_physp =
-    osm_get_physp_by_mad_addr(p_rcv->p_log,
-                              p_rcv->p_subn,
-                              osm_madw_get_mad_addr_ptr(p_madw) );
-  if (p_request_physp == NULL)
-  {
-    CL_PLOCK_RELEASE( p_rcv->p_lock );
-    goto Exit;
-  }
-
-  if (!osm_physp_share_pkey( p_rcv->p_log, p_physp, p_request_physp))
-  {
-    CL_PLOCK_RELEASE( p_rcv->p_lock );
-
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_mcmr_rcv_join_mgrp: "
-             "Port and requester don't share pkey\n" );
-    sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-    osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
-    goto Exit;
-  }
-
-  ib_member_get_scope_state(
-    p_recvd_mcmember_rec->scope_state, NULL, &join_state);
-
-  /* do we need to create a new group? */
-  status = __get_mgrp_by_mgid(p_rcv, p_recvd_mcmember_rec, &p_mgrp);
-  if ((status == IB_NOT_FOUND) || p_mgrp->to_be_deleted)
-  {
-    /* check for JoinState.FullMember = 1 o15.0.1.9 */
-    if ((join_state & 0x01) != 0x01)
-    {
-      CL_PLOCK_RELEASE( p_rcv->p_lock );
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "__osm_mcmr_rcv_join_mgrp: ERR 1B10: "
-               "Provided Join State != FullMember - required for create, "
-               "MGID: 0x%016" PRIx64 " : "
-               "0x%016" PRIx64 " from port 0x%016" PRIx64 " (%s)\n",
-               cl_ntoh64( p_recvd_mcmember_rec->mgid.unicast.prefix ),
-               cl_ntoh64( p_recvd_mcmember_rec->mgid.unicast.interface_id ),
-               cl_ntoh64( portguid ),
-               p_port->p_node->print_desc);
-      sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-      osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
-      goto Exit;
-    }
-
-    /* check the comp_mask */
-    valid = __check_create_comp_mask(p_sa_mad->comp_mask,
-                                     p_recvd_mcmember_rec);
-    if (valid)
-    {
-      status = osm_mcmr_rcv_create_new_mgrp(p_rcv,
-                                            p_sa_mad->comp_mask,
-                                            p_recvd_mcmember_rec,
-                                            p_physp,
-                                            &p_mgrp);
-      if (status != IB_SUCCESS)
-      {
-        CL_PLOCK_RELEASE( p_rcv->p_lock );
-        sa_status = status;
-        osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
-        goto Exit;
-      }
-      /* copy the MGID to the result */
-      mcmember_rec.mgid = p_mgrp->mcmember_rec.mgid;
-    }
-    else
-    {
-      CL_PLOCK_RELEASE( p_rcv->p_lock );
-
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "__osm_mcmr_rcv_join_mgrp: ERR 1B11: "
-               "method = %s, "
-               "scope_state = 0x%x, "
-               "component mask = 0x%016" PRIx64 ", "
-               "expected comp mask = 0x%016" PRIx64 ", "
-               "MGID: 0x%016" PRIx64 " : "
-               "0x%016" PRIx64 " from port 0x%016" PRIx64 " (%s)\n",
-               ib_get_sa_method_str(p_sa_mad->method),
-               p_recvd_mcmember_rec->scope_state,
-               cl_ntoh64(p_sa_mad->comp_mask),
-               CL_NTOH64(REQUIRED_MC_CREATE_COMP_MASK),
-               cl_ntoh64( p_recvd_mcmember_rec->mgid.unicast.prefix ),
-               cl_ntoh64( p_recvd_mcmember_rec->mgid.unicast.interface_id ),
-               cl_ntoh64( portguid ),
-               p_port->p_node->print_desc);
-
-      sa_status = IB_SA_MAD_STATUS_INSUF_COMPS;
-      osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
-      goto Exit;
-    }
-    is_new_group = 1;
-    req_type = OSM_MCAST_REQ_TYPE_CREATE;
-  }
-  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
-   * endport to join an existing multicast group if:
-   * 1. It receives a SubnAdmSet() method for a MCMemberRecord, and
-   *    - WE KNOW THAT ALREADY
-   * 2. The MGID is specified and matches an existing multicast
-   *    group, and
-   *    - WE KNOW THAT ALREADY
-   * 3. The MCMemberRecord:JoinState is not all 0s, and
-   * 4. PortGID is specified and
-   *    - WE KNOW THAT ALREADY (as it matched a real one)
-   * 5. All other components match that existing group, either by
-   *    being wildcarded or by having values identical to those specified
-   *    by the component mask and in use by the group with the exception
-   *    of components such as ProxyJoin and Reserved, which are ignored
-   *    by SA.
-   *
-   * We need to check #3 and #5 here:
-   */
-  valid = __validate_more_comp_fields(
-    p_rcv->p_log,
-    p_mgrp,
-    p_recvd_mcmember_rec,
-    p_sa_mad->comp_mask) && __validate_port_caps(
-    p_rcv->p_log,
-    p_mgrp,
-    p_physp) && (join_state != 0);
-
-  if (!valid)
-  {
-    /* since we might have created the new group we need to cleanup */
-    __cleanup_mgrp(p_rcv, mlid);
-
-    CL_PLOCK_RELEASE( p_rcv->p_lock );
-
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_mcmr_rcv_join_mgrp: ERR 1B12: "
-             "__validate_more_comp_fields, __validate_port_caps, "
-             "or JoinState = 0 failed from port 0x%016" PRIx64 " (%s), "
-             "sending IB_SA_MAD_STATUS_REQ_INVALID\n",
-             cl_ntoh64( portguid ),
-             p_port->p_node->print_desc);
-
-    sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-    osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
-    goto Exit;
-  }
-
-  /*
-   * Do some validation of the modification
-   */
-  if (!is_new_group)
-  {
-    /*
-     * o15-0.2.1 requires validation of the requesting port
-     * in the case of modification:
-     */
-    valid = __validate_modify(p_rcv,
-                              p_mgrp,
-                              osm_madw_get_mad_addr_ptr(p_madw),
-                              p_recvd_mcmember_rec,
-                              &p_mcmr_port);
-    if (!valid)
-    {
-      CL_PLOCK_RELEASE( p_rcv->p_lock );
-
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "__osm_mcmr_rcv_join_mgrp: ERR 1B13: "
-               "__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);
-
-      sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-      osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
-      goto Exit;
-    }
-  }
-
-  /* create or update existing port (join-state will be updated) */
-  status = __add_new_mgrp_port(
-    p_rcv,
-    p_mgrp,
-    p_recvd_mcmember_rec,
-    osm_madw_get_mad_addr_ptr(p_madw),
-    &p_mcmr_port);
-
-  if (status != IB_SUCCESS)
-  {
-    /* we fail to add the port so we might need to delete the group */
-    __cleanup_mgrp(p_rcv, mlid);
-
-    CL_PLOCK_RELEASE( p_rcv->p_lock );
-    if (status == IB_INVALID_PARAMETER)
-      sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-    else
-      sa_status = IB_SA_MAD_STATUS_NO_RESOURCES;
-
-    osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
-    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( p_rcv->p_lock );
-
-  /* do the actual routing (actually schedule the update) */
-  status =
-    osm_sm_mcgrp_join(p_rcv->p_sm,
-                      mlid,
-                      p_recvd_mcmember_rec->port_gid.unicast.interface_id,
-                      req_type);
-
-  if (status != IB_SUCCESS)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_mcmr_rcv_join_mgrp: 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(p_rcv->p_lock);
-
-    /* the request for routing failed so we need to remove the port */
-    p_mgrp = __get_mgrp_by_mlid(p_rcv, mlid);
-    if (p_mgrp != NULL)
-    {
-      osm_mgrp_remove_port(
-        p_rcv->p_subn,
-        p_rcv->p_log,
-        p_mgrp,
-        p_recvd_mcmember_rec->port_gid.unicast.interface_id);
-      __cleanup_mgrp(p_rcv, mlid);
-    }
-    CL_PLOCK_RELEASE( p_rcv->p_lock );
-    sa_status = IB_SA_MAD_STATUS_NO_RESOURCES;
-    osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
-    goto Exit;
-
-  } /* failed to route */
-
-  if ( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    osm_dump_mc_record( p_rcv->p_log, &mcmember_rec, OSM_LOG_DEBUG );
-
-  __osm_mcmr_rcv_respond( p_rcv, p_madw, &mcmember_rec );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return;
+	boolean_t valid;
+	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 sa_status;
+	ib_net16_t mlid;
+	osm_mcm_port_t *p_mcmr_port;
+	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;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_mcmr_rcv_join_mgrp);
+
+	p_mgrp = NULL;
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_recvd_mcmember_rec =
+	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
+
+	portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;
+
+	mcmember_rec = *p_recvd_mcmember_rec;
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_mcmr_rcv_join_mgrp: "
+			"Dump of incoming record\n");
+		osm_dump_mc_record(p_rcv->p_log, &mcmember_rec, OSM_LOG_DEBUG);
+	}
+
+	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
+
+	/* make sure the requested port guid is known to the SM */
+	p_port = osm_get_port_by_guid(p_rcv->p_subn, portguid);
+	if (!p_port) {
+		CL_PLOCK_RELEASE(p_rcv->p_lock);
+
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_mcmr_rcv_join_mgrp: "
+			"Unknown port GUID 0x%016" PRIx64 "\n", portguid);
+		sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
+		osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+		goto Exit;
+	}
+
+	p_physp = p_port->p_physp;
+	/* Check that the p_physp and the requester physp are in the same
+	   partition. */
+	p_request_physp =
+	    osm_get_physp_by_mad_addr(p_rcv->p_log,
+				      p_rcv->p_subn,
+				      osm_madw_get_mad_addr_ptr(p_madw));
+	if (p_request_physp == NULL) {
+		CL_PLOCK_RELEASE(p_rcv->p_lock);
+		goto Exit;
+	}
+
+	if (!osm_physp_share_pkey(p_rcv->p_log, p_physp, p_request_physp)) {
+		CL_PLOCK_RELEASE(p_rcv->p_lock);
+
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_mcmr_rcv_join_mgrp: "
+			"Port and requester don't share pkey\n");
+		sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
+		osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+		goto Exit;
+	}
+
+	ib_member_get_scope_state(p_recvd_mcmember_rec->scope_state, NULL,
+				  &join_state);
+
+	/* do we need to create a new group? */
+	status = __get_mgrp_by_mgid(p_rcv, p_recvd_mcmember_rec, &p_mgrp);
+	if ((status == IB_NOT_FOUND) || p_mgrp->to_be_deleted) {
+		/* check for JoinState.FullMember = 1 o15.0.1.9 */
+		if ((join_state & 0x01) != 0x01) {
+			CL_PLOCK_RELEASE(p_rcv->p_lock);
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"__osm_mcmr_rcv_join_mgrp: ERR 1B10: "
+				"Provided Join State != FullMember - required for create, "
+				"MGID: 0x%016" PRIx64 " : "
+				"0x%016" PRIx64 " from port 0x%016" PRIx64
+				" (%s)\n",
+				cl_ntoh64(p_recvd_mcmember_rec->mgid.unicast.
+					  prefix),
+				cl_ntoh64(p_recvd_mcmember_rec->mgid.unicast.
+					  interface_id), cl_ntoh64(portguid),
+				p_port->p_node->print_desc);
+			sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
+			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			goto Exit;
+		}
+
+		/* check the comp_mask */
+		valid = __check_create_comp_mask(p_sa_mad->comp_mask,
+						 p_recvd_mcmember_rec);
+		if (valid) {
+			status = osm_mcmr_rcv_create_new_mgrp(p_rcv,
+							      p_sa_mad->
+							      comp_mask,
+							      p_recvd_mcmember_rec,
+							      p_physp, &p_mgrp);
+			if (status != IB_SUCCESS) {
+				CL_PLOCK_RELEASE(p_rcv->p_lock);
+				sa_status = status;
+				osm_sa_send_error(p_rcv->p_resp, p_madw,
+						  sa_status);
+				goto Exit;
+			}
+			/* copy the MGID to the result */
+			mcmember_rec.mgid = p_mgrp->mcmember_rec.mgid;
+		} else {
+			CL_PLOCK_RELEASE(p_rcv->p_lock);
+
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"__osm_mcmr_rcv_join_mgrp: ERR 1B11: "
+				"method = %s, "
+				"scope_state = 0x%x, "
+				"component mask = 0x%016" PRIx64 ", "
+				"expected comp mask = 0x%016" PRIx64 ", "
+				"MGID: 0x%016" PRIx64 " : "
+				"0x%016" PRIx64 " from port 0x%016" PRIx64
+				" (%s)\n",
+				ib_get_sa_method_str(p_sa_mad->method),
+				p_recvd_mcmember_rec->scope_state,
+				cl_ntoh64(p_sa_mad->comp_mask),
+				CL_NTOH64(REQUIRED_MC_CREATE_COMP_MASK),
+				cl_ntoh64(p_recvd_mcmember_rec->mgid.unicast.
+					  prefix),
+				cl_ntoh64(p_recvd_mcmember_rec->mgid.unicast.
+					  interface_id), cl_ntoh64(portguid),
+				p_port->p_node->print_desc);
+
+			sa_status = IB_SA_MAD_STATUS_INSUF_COMPS;
+			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			goto Exit;
+		}
+		is_new_group = 1;
+		req_type = OSM_MCAST_REQ_TYPE_CREATE;
+	} 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
+	 * endport to join an existing multicast group if:
+	 * 1. It receives a SubnAdmSet() method for a MCMemberRecord, and
+	 *    - WE KNOW THAT ALREADY
+	 * 2. The MGID is specified and matches an existing multicast
+	 *    group, and
+	 *    - WE KNOW THAT ALREADY
+	 * 3. The MCMemberRecord:JoinState is not all 0s, and
+	 * 4. PortGID is specified and
+	 *    - WE KNOW THAT ALREADY (as it matched a real one)
+	 * 5. All other components match that existing group, either by
+	 *    being wildcarded or by having values identical to those specified
+	 *    by the component mask and in use by the group with the exception
+	 *    of components such as ProxyJoin and Reserved, which are ignored
+	 *    by SA.
+	 *
+	 * We need to check #3 and #5 here:
+	 */
+	valid = __validate_more_comp_fields(p_rcv->p_log,
+					    p_mgrp,
+					    p_recvd_mcmember_rec,
+					    p_sa_mad->comp_mask)
+	    && __validate_port_caps(p_rcv->p_log, p_mgrp, p_physp)
+	    && (join_state != 0);
+
+	if (!valid) {
+		/* since we might have created the new group we need to cleanup */
+		__cleanup_mgrp(p_rcv, mlid);
+
+		CL_PLOCK_RELEASE(p_rcv->p_lock);
+
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_mcmr_rcv_join_mgrp: ERR 1B12: "
+			"__validate_more_comp_fields, __validate_port_caps, "
+			"or JoinState = 0 failed from port 0x%016" PRIx64
+			" (%s), " "sending IB_SA_MAD_STATUS_REQ_INVALID\n",
+			cl_ntoh64(portguid), p_port->p_node->print_desc);
+
+		sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
+		osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+		goto Exit;
+	}
+
+	/*
+	 * Do some validation of the modification
+	 */
+	if (!is_new_group) {
+		/*
+		 * o15-0.2.1 requires validation of the requesting port
+		 * in the case of modification:
+		 */
+		valid = __validate_modify(p_rcv,
+					  p_mgrp,
+					  osm_madw_get_mad_addr_ptr(p_madw),
+					  p_recvd_mcmember_rec, &p_mcmr_port);
+		if (!valid) {
+			CL_PLOCK_RELEASE(p_rcv->p_lock);
+
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"__osm_mcmr_rcv_join_mgrp: ERR 1B13: "
+				"__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);
+
+			sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
+			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			goto Exit;
+		}
+	}
+
+	/* create or update existing port (join-state will be updated) */
+	status = __add_new_mgrp_port(p_rcv,
+				     p_mgrp,
+				     p_recvd_mcmember_rec,
+				     osm_madw_get_mad_addr_ptr(p_madw),
+				     &p_mcmr_port);
+
+	if (status != IB_SUCCESS) {
+		/* we fail to add the port so we might need to delete the group */
+		__cleanup_mgrp(p_rcv, mlid);
+
+		CL_PLOCK_RELEASE(p_rcv->p_lock);
+		if (status == IB_INVALID_PARAMETER)
+			sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
+		else
+			sa_status = IB_SA_MAD_STATUS_NO_RESOURCES;
+
+		osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+		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(p_rcv->p_lock);
+
+	/* do the actual routing (actually schedule the update) */
+	status =
+	    osm_sm_mcgrp_join(p_rcv->p_sm,
+			      mlid,
+			      p_recvd_mcmember_rec->port_gid.unicast.
+			      interface_id, req_type);
+
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_mcmr_rcv_join_mgrp: 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(p_rcv->p_lock);
+
+		/* the request for routing failed so we need to remove the port */
+		p_mgrp = __get_mgrp_by_mlid(p_rcv, mlid);
+		if (p_mgrp != NULL) {
+			osm_mgrp_remove_port(p_rcv->p_subn,
+					     p_rcv->p_log,
+					     p_mgrp,
+					     p_recvd_mcmember_rec->port_gid.
+					     unicast.interface_id);
+			__cleanup_mgrp(p_rcv, mlid);
+		}
+		CL_PLOCK_RELEASE(p_rcv->p_lock);
+		sa_status = IB_SA_MAD_STATUS_NO_RESOURCES;
+		osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+		goto Exit;
+
+	}
+	/* failed to route */
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
+		osm_dump_mc_record(p_rcv->p_log, &mcmember_rec, OSM_LOG_DEBUG);
+
+	__osm_mcmr_rcv_respond(p_rcv, p_madw, &mcmember_rec);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return;
 }
 
 /**********************************************************************
  Add a patched multicast group to the results list
 **********************************************************************/
 static ib_api_status_t
-__osm_mcmr_rcv_new_mcmr(
-  IN osm_mcmr_recv_t*         const p_rcv,
-  IN const ib_member_rec_t*   p_rcvd_rec,
-  IN cl_qlist_t*              const p_list )
+__osm_mcmr_rcv_new_mcmr(IN osm_mcmr_recv_t * const p_rcv,
+			IN const ib_member_rec_t * p_rcvd_rec,
+			IN cl_qlist_t * const p_list)
 {
-  osm_mcmr_item_t*            p_rec_item;
-  ib_api_status_t             status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_mcmr_rcv_new_mcmr );
-
-  p_rec_item = (osm_mcmr_item_t*)cl_qlock_pool_get( &p_rcv->pool );
-  if( p_rec_item == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_mcmr_rcv_new_mcmr: ERR 1B15: "
-             "cl_qlock_pool_get failed\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
-  memset( &p_rec_item->rec, 0, sizeof( p_rec_item->rec ) );
-
-  /* HACK: Untrusted requesters should result with 0 Join
-     State, Port Guid, and Proxy */
-  p_rec_item->rec = *p_rcvd_rec;
-  cl_qlist_insert_tail( p_list, (cl_list_item_t*)&p_rec_item->pool_item );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	osm_mcmr_item_t *p_rec_item;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_mcmr_rcv_new_mcmr);
+
+	p_rec_item = (osm_mcmr_item_t *) cl_qlock_pool_get(&p_rcv->pool);
+	if (p_rec_item == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_mcmr_rcv_new_mcmr: ERR 1B15: "
+			"cl_qlock_pool_get failed\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+	memset(&p_rec_item->rec, 0, sizeof(p_rec_item->rec));
+
+	/* HACK: Untrusted requesters should result with 0 Join
+	   State, Port Guid, and Proxy */
+	p_rec_item->rec = *p_rcvd_rec;
+	cl_qlist_insert_tail(p_list,
+			     (cl_list_item_t *) & p_rec_item->pool_item);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
  Match the given mgrp to the requested mcmr
 **********************************************************************/
 void
-__osm_sa_mcm_by_comp_mask_cb(
-  IN cl_map_item_t*           const p_map_item,
-  IN void*                    context )
+__osm_sa_mcm_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
+			     IN void *context)
 {
-  const osm_mgrp_t *          const p_mgrp = (osm_mgrp_t *)p_map_item;
-  osm_sa_mcmr_search_ctxt_t*  const p_ctxt =
-    (osm_sa_mcmr_search_ctxt_t *)context;
-  osm_mcmr_recv_t*            const p_rcv  = p_ctxt->p_rcv;
-  const ib_member_rec_t*      p_rcvd_rec   = p_ctxt->p_mcmember_rec;
-  const osm_physp_t*          p_req_physp  = p_ctxt->p_req_physp;
-
-  /* since we might change scope_state */
-  ib_member_rec_t             match_rec;
-  ib_net64_t                  comp_mask    = p_ctxt->comp_mask;
-  osm_mcm_port_t*             p_mcm_port;
-  ib_net64_t portguid = p_rcvd_rec->port_gid.unicast.interface_id;
-  /* will be used for group or port info */
-  uint8_t scope_state;
-  uint8_t scope_state_mask = 0;
-  cl_map_item_t *p_item;
-  ib_gid_t	port_gid;
-  boolean_t proxy_join;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_sa_mcm_by_comp_mask_cb );
-
-  osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
-          "__osm_sa_mcm_by_comp_mask_cb: "
-          "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(p_rcv->p_log, OSM_LOG_DEBUG,
-            "__osm_sa_mcm_by_comp_mask_cb: "
-            "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, sizeof(ib_gid_t)))
-    goto Exit;
-
-  if ((IB_MCR_COMPMASK_MLID & comp_mask) &&
-      memcmp(&p_rcvd_rec->mlid, &p_mgrp->mcmember_rec.mlid, sizeof(uint16_t)))
-    goto Exit;
-
-  /* if the requester physical port doesn't have the pkey that is defined for
-     the group - exit. */
-  if (!osm_physp_has_pkey( p_rcv->p_log, p_mgrp->mcmember_rec.pkey,
-                           p_req_physp ))
-    goto Exit;
-
-  /* now do the rest of the match */
-  if ((IB_MCR_COMPMASK_QKEY & comp_mask) &&
-      (p_rcvd_rec->qkey != p_mgrp->mcmember_rec.qkey))
-    goto Exit;
-
-  if ((IB_MCR_COMPMASK_PKEY & comp_mask) &&
-      (p_rcvd_rec->pkey != p_mgrp->mcmember_rec.pkey))
-    goto Exit;
-
-  if ((IB_MCR_COMPMASK_TCLASS & comp_mask) &&
-      (p_rcvd_rec->tclass != p_mgrp->mcmember_rec.tclass))
-    goto Exit;
-
-  /* check SL, Flow, and Hop limit */
-  {
-    uint8_t mgrp_sl, query_sl;
-    uint32_t mgrp_flow, query_flow;
-    uint8_t mgrp_hop, query_hop;
-
-    ib_member_get_sl_flow_hop(p_rcvd_rec->sl_flow_hop,
-                              &query_sl, &query_flow, &query_hop);
-
-    ib_member_get_sl_flow_hop(p_mgrp->mcmember_rec.sl_flow_hop,
-                              &mgrp_sl, &mgrp_flow, &mgrp_hop);
-
-    if (IB_MCR_COMPMASK_SL & comp_mask )
-      if (query_sl != mgrp_sl)
-        goto Exit;
-
-    if (IB_MCR_COMPMASK_FLOW & comp_mask)
-      if (query_flow != mgrp_flow)
-        goto Exit;
-
-    if (IB_MCR_COMPMASK_HOP & comp_mask)
-      if (query_hop != mgrp_hop)
-        goto Exit;
-  }
-
-  if ((IB_MCR_COMPMASK_PROXY & comp_mask) &&
-      (p_rcvd_rec->proxy_join != p_mgrp->mcmember_rec.proxy_join))
-    goto Exit;
-
-  /* need to validate mtu, rate, and pkt_lifetime fields */
-  if (__validate_more_comp_fields( p_rcv->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 */
-       goto Exit;
-     }
-  }
-  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;
-
-  if (IB_MCR_COMPMASK_JOIN_STATE & comp_mask)
-    scope_state_mask = scope_state_mask | 0x0F;
-
-  /* Many MC records returned */
-  if ( (p_ctxt->trusted_req == TRUE) && !(IB_MCR_COMPMASK_PORT_GID & comp_mask) )
-  {
-     osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_sa_mcm_by_comp_mask_cb: "
-             "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;
-
-        if ((scope_state_mask & p_rcvd_rec->scope_state) ==
-            (scope_state_mask & p_mcm_port->scope_state))
+	const osm_mgrp_t *const p_mgrp = (osm_mgrp_t *) p_map_item;
+	osm_sa_mcmr_search_ctxt_t *const p_ctxt =
+	    (osm_sa_mcmr_search_ctxt_t *) context;
+	osm_mcmr_recv_t *const p_rcv = p_ctxt->p_rcv;
+	const ib_member_rec_t *p_rcvd_rec = p_ctxt->p_mcmember_rec;
+	const osm_physp_t *p_req_physp = p_ctxt->p_req_physp;
+
+	/* since we might change scope_state */
+	ib_member_rec_t match_rec;
+	ib_net64_t comp_mask = p_ctxt->comp_mask;
+	osm_mcm_port_t *p_mcm_port;
+	ib_net64_t portguid = p_rcvd_rec->port_gid.unicast.interface_id;
+	/* will be used for group or port info */
+	uint8_t scope_state;
+	uint8_t scope_state_mask = 0;
+	cl_map_item_t *p_item;
+	ib_gid_t port_gid;
+	boolean_t proxy_join;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_mcm_by_comp_mask_cb);
+
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"__osm_sa_mcm_by_comp_mask_cb: "
+		"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(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_sa_mcm_by_comp_mask_cb: "
+			"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,
+		   sizeof(ib_gid_t)))
+		goto Exit;
+
+	if ((IB_MCR_COMPMASK_MLID & comp_mask) &&
+	    memcmp(&p_rcvd_rec->mlid, &p_mgrp->mcmember_rec.mlid,
+		   sizeof(uint16_t)))
+		goto Exit;
+
+	/* if the requester physical port doesn't have the pkey that is defined for
+	   the group - exit. */
+	if (!osm_physp_has_pkey(p_rcv->p_log, p_mgrp->mcmember_rec.pkey,
+				p_req_physp))
+		goto Exit;
+
+	/* now do the rest of the match */
+	if ((IB_MCR_COMPMASK_QKEY & comp_mask) &&
+	    (p_rcvd_rec->qkey != p_mgrp->mcmember_rec.qkey))
+		goto Exit;
+
+	if ((IB_MCR_COMPMASK_PKEY & comp_mask) &&
+	    (p_rcvd_rec->pkey != p_mgrp->mcmember_rec.pkey))
+		goto Exit;
+
+	if ((IB_MCR_COMPMASK_TCLASS & comp_mask) &&
+	    (p_rcvd_rec->tclass != p_mgrp->mcmember_rec.tclass))
+		goto Exit;
+
+	/* check SL, Flow, and Hop limit */
 	{
-           /* 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),
-                      sizeof(ib_gid_t));
-           osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
-                   "__osm_sa_mcm_by_comp_mask_cb: "
-                   "Record of port_gid: 0x%016" PRIx64 "0x%016" PRIx64
-                   " in multicast_lid: 0x%X is returned\n",
-                   cl_ntoh64(match_rec.port_gid.unicast.prefix),
-                   cl_ntoh64(match_rec.port_gid.unicast.interface_id),
-                   cl_ntoh16(p_mgrp->mlid)
-                   );
-
-           match_rec.proxy_join = (uint8_t)(p_mcm_port->proxy_join);
-
-           __osm_mcmr_rcv_new_mcmr(p_rcv, &match_rec, p_ctxt->p_list);
-         }
-         p_item = cl_qmap_next(p_item);
-      }
-  }
-  /* One MC record returned */
-  else
-  {
-    if ((scope_state_mask & p_rcvd_rec->scope_state) !=
-        (scope_state_mask & scope_state))
-      goto Exit;
-
-    /* add to the list */
-    match_rec = p_mgrp->mcmember_rec;
-    match_rec.scope_state = scope_state;
-    memcpy(&(match_rec.port_gid), &port_gid, sizeof(ib_gid_t));
-    match_rec.proxy_join = (uint8_t)proxy_join;
-
-    __osm_mcmr_rcv_new_mcmr(p_rcv, &match_rec, p_ctxt->p_list);
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+		uint8_t mgrp_sl, query_sl;
+		uint32_t mgrp_flow, query_flow;
+		uint8_t mgrp_hop, query_hop;
+
+		ib_member_get_sl_flow_hop(p_rcvd_rec->sl_flow_hop,
+					  &query_sl, &query_flow, &query_hop);
+
+		ib_member_get_sl_flow_hop(p_mgrp->mcmember_rec.sl_flow_hop,
+					  &mgrp_sl, &mgrp_flow, &mgrp_hop);
+
+		if (IB_MCR_COMPMASK_SL & comp_mask)
+			if (query_sl != mgrp_sl)
+				goto Exit;
+
+		if (IB_MCR_COMPMASK_FLOW & comp_mask)
+			if (query_flow != mgrp_flow)
+				goto Exit;
+
+		if (IB_MCR_COMPMASK_HOP & comp_mask)
+			if (query_hop != mgrp_hop)
+				goto Exit;
+	}
+
+	if ((IB_MCR_COMPMASK_PROXY & comp_mask) &&
+	    (p_rcvd_rec->proxy_join != p_mgrp->mcmember_rec.proxy_join))
+		goto Exit;
+
+	/* need to validate mtu, rate, and pkt_lifetime fields */
+	if (__validate_more_comp_fields(p_rcv->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 */
+			goto Exit;
+		}
+	} 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;
+
+	if (IB_MCR_COMPMASK_JOIN_STATE & comp_mask)
+		scope_state_mask = scope_state_mask | 0x0F;
+
+	/* Many MC records returned */
+	if ((p_ctxt->trusted_req == TRUE)
+	    && !(IB_MCR_COMPMASK_PORT_GID & comp_mask)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_sa_mcm_by_comp_mask_cb: "
+			"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;
+
+			if ((scope_state_mask & p_rcvd_rec->scope_state) ==
+			    (scope_state_mask & p_mcm_port->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),
+				       sizeof(ib_gid_t));
+				osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+					"__osm_sa_mcm_by_comp_mask_cb: "
+					"Record of port_gid: 0x%016" PRIx64
+					"0x%016" PRIx64
+					" in multicast_lid: 0x%X is returned\n",
+					cl_ntoh64(match_rec.port_gid.unicast.
+						  prefix),
+					cl_ntoh64(match_rec.port_gid.unicast.
+						  interface_id),
+					cl_ntoh16(p_mgrp->mlid)
+				    );
+
+				match_rec.proxy_join =
+				    (uint8_t) (p_mcm_port->proxy_join);
+
+				__osm_mcmr_rcv_new_mcmr(p_rcv, &match_rec,
+							p_ctxt->p_list);
+			}
+			p_item = cl_qmap_next(p_item);
+		}
+	}
+	/* One MC record returned */
+	else {
+		if ((scope_state_mask & p_rcvd_rec->scope_state) !=
+		    (scope_state_mask & scope_state))
+			goto Exit;
+
+		/* add to the list */
+		match_rec = p_mgrp->mcmember_rec;
+		match_rec.scope_state = scope_state;
+		memcpy(&(match_rec.port_gid), &port_gid, sizeof(ib_gid_t));
+		match_rec.proxy_join = (uint8_t) proxy_join;
+
+		__osm_mcmr_rcv_new_mcmr(p_rcv, &match_rec, p_ctxt->p_list);
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  Handle a query request
 **********************************************************************/
 static void
-__osm_mcmr_query_mgrp(IN osm_mcmr_recv_t*  const p_rcv,
-                      IN const osm_madw_t* const p_madw)
+__osm_mcmr_query_mgrp(IN osm_mcmr_recv_t * const p_rcv,
+		      IN const osm_madw_t * const p_madw)
 {
-  const ib_sa_mad_t*       p_rcvd_mad;
-  const ib_member_rec_t*   p_rcvd_rec;
-  cl_qlist_t               rec_list;
-  osm_madw_t*              p_resp_madw;
-  ib_sa_mad_t*             p_resp_sa_mad;
-  ib_member_rec_t*         p_resp_rec;
-  uint32_t                 num_rec, pre_trim_num_rec;
+	const ib_sa_mad_t *p_rcvd_mad;
+	const ib_member_rec_t *p_rcvd_rec;
+	cl_qlist_t rec_list;
+	osm_madw_t *p_resp_madw;
+	ib_sa_mad_t *p_resp_sa_mad;
+	ib_member_rec_t *p_resp_rec;
+	uint32_t num_rec, pre_trim_num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  uint32_t                 trim_num_rec;
+	uint32_t trim_num_rec;
 #endif
-  uint32_t                 i;
-  osm_sa_mcmr_search_ctxt_t   context;
-  osm_mcmr_item_t*         p_rec_item;
-  ib_api_status_t          status;
-  ib_net64_t               comp_mask;
-  osm_physp_t*             p_req_physp;
-  boolean_t                trusted_req;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_mcmr_query_mgrp );
-
-  p_rcvd_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_rcvd_rec = (ib_member_rec_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
-  comp_mask = p_rcvd_mad->comp_mask;
-
-  /*
-    if sm_key is not zero and does not match we never get here
-    see main SA receiver
-   */
-  trusted_req = (p_rcvd_mad->sm_key != 0);
-
-  /* update the requester physical port. */
-  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-                                          p_rcv->p_subn,
-                                          osm_madw_get_mad_addr_ptr(p_madw) );
-  if (p_req_physp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_mcmr_query_mgrp: ERR 1B04: "
-             "Cannot find requester physical port\n" );
-    goto Exit;
-  }
-
-  cl_qlist_init( &rec_list );
-
-  context.p_mcmember_rec = p_rcvd_rec;
-  context.p_list = &rec_list;
-  context.comp_mask = p_rcvd_mad->comp_mask;
-  context.p_rcv = p_rcv;
-  context.p_req_physp = p_req_physp;
-  context.trusted_req = trusted_req;
-
-  CL_PLOCK_ACQUIRE( p_rcv->p_lock );
-
-  /* simply go over all MCGs and match */
-  cl_qmap_apply_func( &p_rcv->p_subn->mgrp_mlid_tbl,
-                      __osm_sa_mcm_by_comp_mask_cb,
-                      &context);
-
-  CL_PLOCK_RELEASE( p_rcv->p_lock );
-
-  num_rec = cl_qlist_count( &rec_list );
-
-  /*
-   * C15-0.1.30:
-   * If we do a SubnAdmGet and got more than one record it is an error !
-   */
-  if ( (p_rcvd_mad->method == IB_MAD_METHOD_GET) &&
-       (num_rec > 1)) {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_mcmr_query_mgrp: ERR 1B05: "
-             "Got more than one record for SubnAdmGet (%u)\n",
-             num_rec );
-    osm_sa_send_error( p_rcv->p_resp, p_madw,
-                       IB_SA_MAD_STATUS_TOO_MANY_RECORDS );
-
-    /* need to set the mem free ... */
-    p_rec_item = (osm_mcmr_item_t*)cl_qlist_remove_head( &rec_list );
-    while( p_rec_item != (osm_mcmr_item_t*)cl_qlist_end( &rec_list ) )
-    {
-      cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-      p_rec_item = (osm_mcmr_item_t*)cl_qlist_remove_head( &rec_list );
-    }
-
-    goto Exit;
-  }
-
-  pre_trim_num_rec = num_rec;
+	uint32_t i;
+	osm_sa_mcmr_search_ctxt_t context;
+	osm_mcmr_item_t *p_rec_item;
+	ib_api_status_t status;
+	ib_net64_t comp_mask;
+	osm_physp_t *p_req_physp;
+	boolean_t trusted_req;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_mcmr_query_mgrp);
+
+	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_rcvd_rec = (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+	comp_mask = p_rcvd_mad->comp_mask;
+
+	/*
+	   if sm_key is not zero and does not match we never get here
+	   see main SA receiver
+	 */
+	trusted_req = (p_rcvd_mad->sm_key != 0);
+
+	/* update the requester physical port. */
+	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+						p_rcv->p_subn,
+						osm_madw_get_mad_addr_ptr
+						(p_madw));
+	if (p_req_physp == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_mcmr_query_mgrp: ERR 1B04: "
+			"Cannot find requester physical port\n");
+		goto Exit;
+	}
+
+	cl_qlist_init(&rec_list);
+
+	context.p_mcmember_rec = p_rcvd_rec;
+	context.p_list = &rec_list;
+	context.comp_mask = p_rcvd_mad->comp_mask;
+	context.p_rcv = p_rcv;
+	context.p_req_physp = p_req_physp;
+	context.trusted_req = trusted_req;
+
+	CL_PLOCK_ACQUIRE(p_rcv->p_lock);
+
+	/* simply go over all MCGs and match */
+	cl_qmap_apply_func(&p_rcv->p_subn->mgrp_mlid_tbl,
+			   __osm_sa_mcm_by_comp_mask_cb, &context);
+
+	CL_PLOCK_RELEASE(p_rcv->p_lock);
+
+	num_rec = cl_qlist_count(&rec_list);
+
+	/*
+	 * C15-0.1.30:
+	 * If we do a SubnAdmGet and got more than one record it is an error !
+	 */
+	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec > 1)) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_mcmr_query_mgrp: ERR 1B05: "
+			"Got more than one record for SubnAdmGet (%u)\n",
+			num_rec);
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
+
+		/* need to set the mem free ... */
+		p_rec_item =
+		    (osm_mcmr_item_t *) cl_qlist_remove_head(&rec_list);
+		while (p_rec_item !=
+		       (osm_mcmr_item_t *) cl_qlist_end(&rec_list)) {
+			cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+			p_rec_item =
+			    (osm_mcmr_item_t *) cl_qlist_remove_head(&rec_list);
+		}
+
+		goto Exit;
+	}
+
+	pre_trim_num_rec = num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  trim_num_rec = (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_member_rec_t);
-  if (trim_num_rec < num_rec)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "__osm_mcmr_query_mgrp: "
-             "Number of records:%u trimmed to:%u to fit in one MAD\n",
-             num_rec, trim_num_rec );
-    num_rec = trim_num_rec;
-  }
+	trim_num_rec =
+	    (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_member_rec_t);
+	if (trim_num_rec < num_rec) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"__osm_mcmr_query_mgrp: "
+			"Number of records:%u trimmed to:%u to fit in one MAD\n",
+			num_rec, trim_num_rec);
+		num_rec = trim_num_rec;
+	}
 #endif
 
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "__osm_mcmr_query_mgrp: "
-           "Returning %u records\n", num_rec );
-
-  if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
-  {
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-    goto Exit;
-  }
-
-  /*
-   * Get a MAD to reply. Address of Mad is in the received mad_wrapper
-   */
-  p_resp_madw = osm_mad_pool_get( p_rcv->p_mad_pool,
-                                  p_madw->h_bind,
-                                  num_rec * sizeof(ib_member_rec_t) + IB_SA_MAD_HDR_SIZE,
-                                  osm_madw_get_mad_addr_ptr(p_madw) );
-
-  if( !p_resp_madw )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_mcmr_query_mgrp: ERR 1B16: "
-             "osm_mad_pool_get failed\n" );
-
-    for( i = 0; i < num_rec; i++ )
-    {
-      p_rec_item = (osm_mcmr_item_t*)cl_qlist_remove_head( &rec_list );
-      cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    }
-
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES );
-    goto Exit;
-  }
-
-  p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
-
-  /*
-    Copy the MAD header back into the response mad.
-    Set the 'R' bit and the payload length,
-    Then copy all records from the list into the response payload.
-  */
-
-  memcpy( p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE );
-  p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-  /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
-  p_resp_sa_mad->sm_key = 0;
-
-  /* Fill in the offset (paylen will be done by the rmpp SAR) */
-  p_resp_sa_mad->attr_offset =
-    ib_get_attr_offset( sizeof(ib_member_rec_t) );
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"__osm_mcmr_query_mgrp: " "Returning %u records\n", num_rec);
+
+	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RECORDS);
+		goto Exit;
+	}
+
+	/*
+	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
+	 */
+	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+				       p_madw->h_bind,
+				       num_rec * sizeof(ib_member_rec_t) +
+				       IB_SA_MAD_HDR_SIZE,
+				       osm_madw_get_mad_addr_ptr(p_madw));
+
+	if (!p_resp_madw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_mcmr_query_mgrp: ERR 1B16: "
+			"osm_mad_pool_get failed\n");
+
+		for (i = 0; i < num_rec; i++) {
+			p_rec_item =
+			    (osm_mcmr_item_t *) cl_qlist_remove_head(&rec_list);
+			cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		}
+
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RESOURCES);
+		goto Exit;
+	}
+
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+
+	/*
+	   Copy the MAD header back into the response mad.
+	   Set the 'R' bit and the payload length,
+	   Then copy all records from the list into the response payload.
+	 */
+
+	memcpy(p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE);
+	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
+	p_resp_sa_mad->sm_key = 0;
+
+	/* Fill in the offset (paylen will be done by the rmpp SAR) */
+	p_resp_sa_mad->attr_offset =
+	    ib_get_attr_offset(sizeof(ib_member_rec_t));
 
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we support only one packet RMPP - so we will set the first and
-     last flags for gettable */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-  {
-    p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST | IB_RMPP_FLAG_ACTIVE;
-  }
+	/* we support only one packet RMPP - so we will set the first and
+	   last flags for gettable */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+		p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
+		p_resp_sa_mad->rmpp_flags =
+		    IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST |
+		    IB_RMPP_FLAG_ACTIVE;
+	}
 #else
-  /* forcefully define the packet as RMPP one */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
+	/* forcefully define the packet as RMPP one */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
+		p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
 #endif
 
-  p_resp_rec = (ib_member_rec_t*)ib_sa_mad_get_payload_ptr( p_resp_sa_mad );
-
-  /*
-    p923 - The PortGID, JoinState and ProxyJoin shall be zero,
-    except in the case of a trusted request.
-    Note: In the mad controller we check that the SM_Key received on
-    the mad is valid. Meaning - is either zero or equal to the local
-    sm_key.
-  */
-
-  for ( i = 0; i < pre_trim_num_rec; i++ )
-  {
-    p_rec_item = (osm_mcmr_item_t*)cl_qlist_remove_head( &rec_list );
-    /* copy only if not trimmed */
-    if (i < num_rec)
-    {
-      *p_resp_rec = p_rec_item->rec;
-      if (trusted_req == FALSE)
-      {
-        memset(&p_resp_rec->port_gid, 0, sizeof(ib_gid_t));
-        ib_member_set_join_state(p_resp_rec, 0);
-        p_resp_rec->proxy_join = 0;
-      }
-    }
-    cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    p_resp_rec++;
-  }
-
-  CL_ASSERT( cl_is_qlist_empty( &rec_list ) );
-
-  status = osm_vendor_send( p_resp_madw->h_bind, p_resp_madw, FALSE );
-  if(status != IB_SUCCESS)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_mcmr_query_mgrp: ERR 1B17: "
-             "osm_vendor_send status = %s\n",
-             ib_get_err_str(status) );
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	p_resp_rec =
+	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(p_resp_sa_mad);
+
+	/*
+	   p923 - The PortGID, JoinState and ProxyJoin shall be zero,
+	   except in the case of a trusted request.
+	   Note: In the mad controller we check that the SM_Key received on
+	   the mad is valid. Meaning - is either zero or equal to the local
+	   sm_key.
+	 */
+
+	for (i = 0; i < pre_trim_num_rec; i++) {
+		p_rec_item =
+		    (osm_mcmr_item_t *) cl_qlist_remove_head(&rec_list);
+		/* copy only if not trimmed */
+		if (i < num_rec) {
+			*p_resp_rec = p_rec_item->rec;
+			if (trusted_req == FALSE) {
+				memset(&p_resp_rec->port_gid, 0,
+				       sizeof(ib_gid_t));
+				ib_member_set_join_state(p_resp_rec, 0);
+				p_resp_rec->proxy_join = 0;
+			}
+		}
+		cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		p_resp_rec++;
+	}
+
+	CL_ASSERT(cl_is_qlist_empty(&rec_list));
+
+	status = osm_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE);
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_mcmr_query_mgrp: ERR 1B17: "
+			"osm_vendor_send status = %s\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_mcmr_rcv_process(
-  IN void *context,
-  IN void *data )
+void osm_mcmr_rcv_process(IN void *context, IN void *data)
 {
-  osm_mcmr_recv_t *p_rcv = context;
-  osm_madw_t *p_madw = data;
-  ib_sa_mad_t *p_sa_mad;
-  ib_net16_t sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-  ib_member_rec_t *p_recvd_mcmember_rec;
-  boolean_t valid;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_mcmr_rcv_process );
-
-  CL_ASSERT( p_madw );
-
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_recvd_mcmember_rec =
-    (ib_member_rec_t*)ib_sa_mad_get_payload_ptr( p_sa_mad );
-
-  CL_ASSERT( p_sa_mad->attr_id == IB_MAD_ATTR_MCMEMBER_RECORD );
-
-  switch (p_sa_mad->method)
-  {
-  case IB_MAD_METHOD_SET:
-    valid = __check_join_comp_mask(p_sa_mad->comp_mask);
-    if(!valid)
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_mcmr_rcv_process: ERR 1B18: "
-               "component mask = 0x%016" PRIx64 ", "
-               "expected comp mask = 0x%016" PRIx64 " ,"
-               "MGID: 0x%016" PRIx64 " : "
-               "0x%016" PRIx64 " for "
-               "PortGID: 0x%016" PRIx64 " : "
-               "0x%016" PRIx64 "\n",
-               cl_ntoh64(p_sa_mad->comp_mask),
-               CL_NTOH64(JOIN_MC_COMP_MASK),
-               cl_ntoh64( p_recvd_mcmember_rec->mgid.unicast.prefix ),
-               cl_ntoh64( p_recvd_mcmember_rec->mgid.unicast.interface_id ),
-               cl_ntoh64( p_recvd_mcmember_rec->port_gid.unicast.prefix ),
-               cl_ntoh64( p_recvd_mcmember_rec->port_gid.unicast.interface_id ) );
-
-      osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
-      goto Exit;
-    }
-
-    /*
-     * Join or Create Multicast Group
-     */
-    __osm_mcmr_rcv_join_mgrp(p_rcv, p_madw);
-    break;
-  case IB_MAD_METHOD_DELETE:
-    valid = __check_join_comp_mask(p_sa_mad->comp_mask);
-    if(!valid)
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_mcmr_rcv_process: 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( p_rcv->p_resp, p_madw, sa_status );
-      goto Exit;
-    }
-
-    /*
-     * Leave Multicast Group
-     */
-    __osm_mcmr_rcv_leave_mgrp(p_rcv, p_madw);
-    break;
-  case IB_MAD_METHOD_GET:
-  case IB_MAD_METHOD_GETTABLE:
-    /*
-     * Querying a Multicast Group
-     */
-    __osm_mcmr_query_mgrp(p_rcv, p_madw);
-    break;
-  default:
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_mcmr_rcv_process: ERR 1B21: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_sa_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    break;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return;
+	osm_mcmr_recv_t *p_rcv = context;
+	osm_madw_t *p_madw = data;
+	ib_sa_mad_t *p_sa_mad;
+	ib_net16_t sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
+	ib_member_rec_t *p_recvd_mcmember_rec;
+	boolean_t valid;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_mcmr_rcv_process);
+
+	CL_ASSERT(p_madw);
+
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_recvd_mcmember_rec =
+	    (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
+
+	CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_MCMEMBER_RECORD);
+
+	switch (p_sa_mad->method) {
+	case IB_MAD_METHOD_SET:
+		valid = __check_join_comp_mask(p_sa_mad->comp_mask);
+		if (!valid) {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_mcmr_rcv_process: ERR 1B18: "
+				"component mask = 0x%016" PRIx64 ", "
+				"expected comp mask = 0x%016" PRIx64 " ,"
+				"MGID: 0x%016" PRIx64 " : "
+				"0x%016" PRIx64 " for "
+				"PortGID: 0x%016" PRIx64 " : "
+				"0x%016" PRIx64 "\n",
+				cl_ntoh64(p_sa_mad->comp_mask),
+				CL_NTOH64(JOIN_MC_COMP_MASK),
+				cl_ntoh64(p_recvd_mcmember_rec->mgid.unicast.
+					  prefix),
+				cl_ntoh64(p_recvd_mcmember_rec->mgid.unicast.
+					  interface_id),
+				cl_ntoh64(p_recvd_mcmember_rec->port_gid.
+					  unicast.prefix),
+				cl_ntoh64(p_recvd_mcmember_rec->port_gid.
+					  unicast.interface_id));
+
+			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			goto Exit;
+		}
+
+		/*
+		 * Join or Create Multicast Group
+		 */
+		__osm_mcmr_rcv_join_mgrp(p_rcv, p_madw);
+		break;
+	case IB_MAD_METHOD_DELETE:
+		valid = __check_join_comp_mask(p_sa_mad->comp_mask);
+		if (!valid) {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_mcmr_rcv_process: 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(p_rcv->p_resp, p_madw, sa_status);
+			goto Exit;
+		}
+
+		/*
+		 * Leave Multicast Group
+		 */
+		__osm_mcmr_rcv_leave_mgrp(p_rcv, p_madw);
+		break;
+	case IB_MAD_METHOD_GET:
+	case IB_MAD_METHOD_GETTABLE:
+		/*
+		 * Querying a Multicast Group
+		 */
+		__osm_mcmr_query_mgrp(p_rcv, p_madw);
+		break;
+	default:
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_mcmr_rcv_process: ERR 1B21: "
+			"Unsupported Method (%s)\n",
+			ib_get_sa_method_str(p_sa_mad->method));
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
+		break;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return;
 }
diff --git a/opensm/opensm/osm_sa_mft_record.c b/opensm/opensm/osm_sa_mft_record.c
index 37d9c7b..3d20f0a 100644
--- a/opensm/opensm/osm_sa_mft_record.c
+++ b/opensm/opensm/osm_sa_mft_record.c
@@ -46,7 +46,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -61,487 +61,458 @@
 #define OSM_MFTR_RCV_POOL_MIN_SIZE      32
 #define OSM_MFTR_RCV_POOL_GROW_SIZE     32
 
-typedef   struct _osm_mftr_item
-{
-  cl_pool_item_t          pool_item;
-  ib_mft_record_t         rec;
+typedef struct _osm_mftr_item {
+	cl_pool_item_t pool_item;
+	ib_mft_record_t rec;
 } osm_mftr_item_t;
 
-typedef   struct _osm_mftr_search_ctxt
-{
-  const ib_mft_record_t*      p_rcvd_rec;
-  ib_net64_t                  comp_mask;
-  cl_qlist_t*                 p_list;
-  osm_mftr_rcv_t*             p_rcv;
-  const osm_physp_t*          p_req_physp;
+typedef struct _osm_mftr_search_ctxt {
+	const ib_mft_record_t *p_rcvd_rec;
+	ib_net64_t comp_mask;
+	cl_qlist_t *p_list;
+	osm_mftr_rcv_t *p_rcv;
+	const osm_physp_t *p_req_physp;
 } osm_mftr_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_mftr_rcv_construct(
-  IN osm_mftr_rcv_t* const p_rcv )
+void osm_mftr_rcv_construct(IN osm_mftr_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
-  cl_qlock_pool_construct( &p_rcv->pool );
+	memset(p_rcv, 0, sizeof(*p_rcv));
+	cl_qlock_pool_construct(&p_rcv->pool);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_mftr_rcv_destroy(
-  IN osm_mftr_rcv_t* const p_rcv )
+void osm_mftr_rcv_destroy(IN osm_mftr_rcv_t * const p_rcv)
 {
-  OSM_LOG_ENTER( p_rcv->p_log, osm_mftr_rcv_destroy );
-  cl_qlock_pool_destroy( &p_rcv->pool );
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_mftr_rcv_destroy);
+	cl_qlock_pool_destroy(&p_rcv->pool);
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_mftr_rcv_init(
-  IN osm_mftr_rcv_t* const p_rcv,
-  IN osm_sa_resp_t*  const p_resp,
-  IN osm_mad_pool_t* const p_mad_pool,
-  IN osm_subn_t*     const p_subn,
-  IN osm_log_t*      const p_log,
-  IN cl_plock_t*     const p_lock )
+osm_mftr_rcv_init(IN osm_mftr_rcv_t * const p_rcv,
+		  IN osm_sa_resp_t * const p_resp,
+		  IN osm_mad_pool_t * const p_mad_pool,
+		  IN osm_subn_t * const p_subn,
+		  IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t            status;
+	ib_api_status_t status;
 
-  OSM_LOG_ENTER( p_log, osm_mftr_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_mftr_rcv_init);
 
-  osm_mftr_rcv_construct( p_rcv );
+	osm_mftr_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_resp = p_resp;
-  p_rcv->p_mad_pool = p_mad_pool;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_resp = p_resp;
+	p_rcv->p_mad_pool = p_mad_pool;
 
-  status = cl_qlock_pool_init( &p_rcv->pool,
-                               OSM_MFTR_RCV_POOL_MIN_SIZE,
-                               0,
-                               OSM_MFTR_RCV_POOL_GROW_SIZE,
-                               sizeof(osm_mftr_item_t),
-                               NULL, NULL, NULL );
+	status = cl_qlock_pool_init(&p_rcv->pool,
+				    OSM_MFTR_RCV_POOL_MIN_SIZE,
+				    0,
+				    OSM_MFTR_RCV_POOL_GROW_SIZE,
+				    sizeof(osm_mftr_item_t), NULL, NULL, NULL);
 
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t
-__osm_mftr_rcv_new_mftr(
-  IN osm_mftr_rcv_t*         const p_rcv,
-  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 )
+__osm_mftr_rcv_new_mftr(IN osm_mftr_rcv_t * const p_rcv,
+			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)
 {
-  osm_mftr_item_t*           p_rec_item;
-  ib_api_status_t            status = IB_SUCCESS;
-  uint16_t                   position_block_num;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_mftr_rcv_new_mftr );
-
-  p_rec_item = (osm_mftr_item_t*)cl_qlock_pool_get( &p_rcv->pool );
-  if( p_rec_item == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_mftr_rcv_new_mftr: ERR 4A02: "
-             "cl_qlock_pool_get failed\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_mftr_rcv_new_mftr: "
-             "New MulticastForwardingTable: sw 0x%016" PRIx64
-             "\n\t\t\t\tblock %u position %u lid 0x%02X\n",
-             cl_ntoh64( osm_node_get_node_guid( p_sw->p_node ) ),
-             block, position, cl_ntoh16( lid )
-             );
-  }
-
-  position_block_num = ((uint16_t)position << 12) |
-			(block & IB_MCAST_BLOCK_ID_MASK_HO);
-
-  memset( &p_rec_item->rec, 0, sizeof(ib_mft_record_t) );
-
-  p_rec_item->rec.lid = lid;
-  p_rec_item->rec.position_block_num = cl_hton16( position_block_num );
-
-  /* copy the mft block */
-  osm_switch_get_mft_block( p_sw, block, position, p_rec_item->rec.mft );
-
-  cl_qlist_insert_tail( p_list, (cl_list_item_t*)&p_rec_item->pool_item );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	osm_mftr_item_t *p_rec_item;
+	ib_api_status_t status = IB_SUCCESS;
+	uint16_t position_block_num;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_mftr_rcv_new_mftr);
+
+	p_rec_item = (osm_mftr_item_t *) cl_qlock_pool_get(&p_rcv->pool);
+	if (p_rec_item == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_mftr_rcv_new_mftr: ERR 4A02: "
+			"cl_qlock_pool_get failed\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_mftr_rcv_new_mftr: "
+			"New MulticastForwardingTable: sw 0x%016" PRIx64
+			"\n\t\t\t\tblock %u position %u lid 0x%02X\n",
+			cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)),
+			block, position, cl_ntoh16(lid)
+		    );
+	}
+
+	position_block_num = ((uint16_t) position << 12) |
+	    (block & IB_MCAST_BLOCK_ID_MASK_HO);
+
+	memset(&p_rec_item->rec, 0, sizeof(ib_mft_record_t));
+
+	p_rec_item->rec.lid = lid;
+	p_rec_item->rec.position_block_num = cl_hton16(position_block_num);
+
+	/* copy the mft block */
+	osm_switch_get_mft_block(p_sw, block, position, p_rec_item->rec.mft);
+
+	cl_qlist_insert_tail(p_list,
+			     (cl_list_item_t *) & p_rec_item->pool_item);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
-static osm_port_t*
-__osm_mftr_get_port_by_guid(
-  IN osm_mftr_rcv_t*  const p_rcv,
-  IN uint64_t         port_guid )
+static osm_port_t *__osm_mftr_get_port_by_guid(IN osm_mftr_rcv_t * const p_rcv,
+					       IN uint64_t port_guid)
 {
-  osm_port_t*         p_port;
+	osm_port_t *p_port;
 
-  CL_PLOCK_ACQUIRE(p_rcv->p_lock);
+	CL_PLOCK_ACQUIRE(p_rcv->p_lock);
 
-  p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
-  if (!p_port)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_mftr_get_port_by_guid ERR 4A04: "
-             "Invalid port GUID 0x%016" PRIx64 "\n",
-             port_guid );
-  }
+	p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+	if (!p_port) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_mftr_get_port_by_guid ERR 4A04: "
+			"Invalid port GUID 0x%016" PRIx64 "\n", port_guid);
+	}
 
-  CL_PLOCK_RELEASE(p_rcv->p_lock);
-  return p_port;
+	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	return p_port;
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_mftr_rcv_by_comp_mask(
-  IN cl_map_item_t*         const p_map_item,
-  IN void*                  context )
+__osm_mftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
+			    IN void *context)
 {
-  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 ib_mft_record_t*    const p_rcvd_rec = p_ctxt->p_rcvd_rec;
-  osm_mftr_rcv_t*           const p_rcv = p_ctxt->p_rcv;
-  ib_net64_t                const comp_mask = p_ctxt->comp_mask;
-  const osm_physp_t*        const p_req_physp = p_ctxt->p_req_physp;
-  osm_port_t*               p_port;
-  uint16_t                  min_lid_ho, max_lid_ho;
-  uint16_t                  position_block_num_ho;
-  uint16_t                  min_block, max_block, block;
-  const osm_physp_t*        p_physp;
-  uint8_t                   min_position, max_position, position;
-
-  /* In switches, the port guid is the node guid. */
-  p_port =
-    __osm_mftr_get_port_by_guid( p_rcv, p_sw->p_node->node_info.port_guid );
-  if (! p_port)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_mftr_rcv_by_comp_mask: ERR 4A05: "
-             "Failed to find Port by Node Guid:0x%016" PRIx64
-             "\n",
-             cl_ntoh64( p_sw->p_node->node_info.node_guid )
-             );
-    return;
-  }
-
-  /* check that the requester physp and the current physp are under
-     the same partition. */
-  p_physp = p_port->p_physp;
-  if (! p_physp)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_mftr_rcv_by_comp_mask: ERR 4A06: "
-             "Failed to find default physical Port by Node Guid:0x%016" PRIx64
-             "\n",
-             cl_ntoh64( p_sw->p_node->node_info.node_guid )
-             );
-    return;
-  }
-  if (! osm_physp_share_pkey( p_rcv->p_log, p_req_physp, p_physp ))
-    return;
-
-  /* get the port 0 of the switch */
-  osm_port_get_lid_range_ho( p_port, &min_lid_ho, &max_lid_ho );
-
-  /* compare the lids - if required */
-  if( comp_mask & IB_MFTR_COMPMASK_LID )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_mftr_rcv_by_comp_mask: "
-             "Comparing lid:0x%02X to port lid range: 0x%02X .. 0x%02X\n",
-             cl_ntoh16( p_rcvd_rec->lid ), min_lid_ho, max_lid_ho
-             );
-    /* ok we are ready for range check */
-    if (min_lid_ho > cl_ntoh16(p_rcvd_rec->lid) ||
-        max_lid_ho < cl_ntoh16(p_rcvd_rec->lid))
-      return;
-  }
-
-  if ( !osm_switch_supports_mcast ( p_sw ) )
-    return;
-
-  /* Are there any blocks in use ? */
-  if ( osm_switch_get_mft_max_block_in_use( p_sw ) == -1 )
-    return;
-
-  position_block_num_ho = cl_ntoh16( p_rcvd_rec->position_block_num );
-
-  /* now we need to decide which blocks to output */
-  if( comp_mask & IB_MFTR_COMPMASK_BLOCK )
-  {
-    max_block = min_block = position_block_num_ho & IB_MCAST_BLOCK_ID_MASK_HO;
-    if ( max_block > osm_switch_get_mft_max_block_in_use( p_sw ) )
-      return;
-  }
-  else
-  {
-    /* use as many blocks as needed */
-    min_block = 0;
-    max_block = osm_switch_get_mft_max_block_in_use( p_sw );
-  }
-
-  /* need to decide which positions to output */
-  if ( comp_mask & IB_MFTR_COMPMASK_POSITION )
-  {
-    min_position = max_position = (position_block_num_ho & 0xF000) >> 12;
-    if (max_position > osm_switch_get_mft_max_position( p_sw ) )
-      return;
-  }
-  else
-  {
-    /* use as many positions as needed */
-    min_position = 0;
-    max_position = osm_switch_get_mft_max_position( p_sw );
-  }
-
-  /* so we can add these one by one ... */
-  for (block = min_block; block <= max_block; block++)
-    for (position = min_position; position <= max_position; position++)
-      __osm_mftr_rcv_new_mftr( p_rcv, p_sw, p_ctxt->p_list,
-                               osm_port_get_base_lid(p_port),
-                               block, position );
+	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 ib_mft_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;
+	osm_mftr_rcv_t *const p_rcv = p_ctxt->p_rcv;
+	ib_net64_t const comp_mask = p_ctxt->comp_mask;
+	const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;
+	osm_port_t *p_port;
+	uint16_t min_lid_ho, max_lid_ho;
+	uint16_t position_block_num_ho;
+	uint16_t min_block, max_block, block;
+	const osm_physp_t *p_physp;
+	uint8_t min_position, max_position, position;
+
+	/* In switches, the port guid is the node guid. */
+	p_port =
+	    __osm_mftr_get_port_by_guid(p_rcv,
+					p_sw->p_node->node_info.port_guid);
+	if (!p_port) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_mftr_rcv_by_comp_mask: ERR 4A05: "
+			"Failed to find Port by Node Guid:0x%016" PRIx64
+			"\n", cl_ntoh64(p_sw->p_node->node_info.node_guid)
+		    );
+		return;
+	}
+
+	/* check that the requester physp and the current physp are under
+	   the same partition. */
+	p_physp = p_port->p_physp;
+	if (!p_physp) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_mftr_rcv_by_comp_mask: ERR 4A06: "
+			"Failed to find default physical Port by Node Guid:0x%016"
+			PRIx64 "\n",
+			cl_ntoh64(p_sw->p_node->node_info.node_guid)
+		    );
+		return;
+	}
+	if (!osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp))
+		return;
+
+	/* get the port 0 of the switch */
+	osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);
+
+	/* compare the lids - if required */
+	if (comp_mask & IB_MFTR_COMPMASK_LID) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_mftr_rcv_by_comp_mask: "
+			"Comparing lid:0x%02X to port lid range: 0x%02X .. 0x%02X\n",
+			cl_ntoh16(p_rcvd_rec->lid), min_lid_ho, max_lid_ho);
+		/* ok we are ready for range check */
+		if (min_lid_ho > cl_ntoh16(p_rcvd_rec->lid) ||
+		    max_lid_ho < cl_ntoh16(p_rcvd_rec->lid))
+			return;
+	}
+
+	if (!osm_switch_supports_mcast(p_sw))
+		return;
+
+	/* Are there any blocks in use ? */
+	if (osm_switch_get_mft_max_block_in_use(p_sw) == -1)
+		return;
+
+	position_block_num_ho = cl_ntoh16(p_rcvd_rec->position_block_num);
+
+	/* now we need to decide which blocks to output */
+	if (comp_mask & IB_MFTR_COMPMASK_BLOCK) {
+		max_block = min_block =
+		    position_block_num_ho & IB_MCAST_BLOCK_ID_MASK_HO;
+		if (max_block > osm_switch_get_mft_max_block_in_use(p_sw))
+			return;
+	} else {
+		/* use as many blocks as needed */
+		min_block = 0;
+		max_block = osm_switch_get_mft_max_block_in_use(p_sw);
+	}
+
+	/* need to decide which positions to output */
+	if (comp_mask & IB_MFTR_COMPMASK_POSITION) {
+		min_position = max_position =
+		    (position_block_num_ho & 0xF000) >> 12;
+		if (max_position > osm_switch_get_mft_max_position(p_sw))
+			return;
+	} else {
+		/* use as many positions as needed */
+		min_position = 0;
+		max_position = osm_switch_get_mft_max_position(p_sw);
+	}
+
+	/* so we can add these one by one ... */
+	for (block = min_block; block <= max_block; block++)
+		for (position = min_position; position <= max_position;
+		     position++)
+			__osm_mftr_rcv_new_mftr(p_rcv, 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 )
+void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 {
-  osm_mftr_rcv_t *p_rcv = ctx;
-  osm_madw_t *p_madw = data;
-  const ib_sa_mad_t*        p_rcvd_mad;
-  const ib_mft_record_t*    p_rcvd_rec;
-  ib_mft_record_t*          p_resp_rec;
-  cl_qlist_t                rec_list;
-  osm_madw_t*               p_resp_madw;
-  ib_sa_mad_t*              p_resp_sa_mad;
-  uint32_t                  num_rec, pre_trim_num_rec;
+	osm_mftr_rcv_t *p_rcv = ctx;
+	osm_madw_t *p_madw = data;
+	const ib_sa_mad_t *p_rcvd_mad;
+	const ib_mft_record_t *p_rcvd_rec;
+	ib_mft_record_t *p_resp_rec;
+	cl_qlist_t rec_list;
+	osm_madw_t *p_resp_madw;
+	ib_sa_mad_t *p_resp_sa_mad;
+	uint32_t num_rec, pre_trim_num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  uint32_t                  trim_num_rec;
+	uint32_t trim_num_rec;
 #endif
-  uint32_t                  i;
-  osm_mftr_search_ctxt_t    context;
-  osm_mftr_item_t*          p_rec_item;
-  ib_api_status_t           status = IB_SUCCESS;
-  osm_physp_t*              p_req_physp;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_mftr_rcv_process );
-
-  CL_ASSERT( p_madw );
-
-  p_rcvd_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_rcvd_rec = (ib_mft_record_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
-
-  CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_MFT_RECORD );
-
-  /* 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( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_mftr_rcv_process: ERR 4A08: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_rcvd_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
-
-  /* update the requester physical port. */
-  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-                                          p_rcv->p_subn,
-                                          osm_madw_get_mad_addr_ptr(p_madw) );
-  if (p_req_physp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_mftr_rcv_process: ERR 4A07: "
-             "Cannot find requester physical port\n" );
-    goto Exit;
-  }
-
-  cl_qlist_init( &rec_list );
-
-  context.p_rcvd_rec     = p_rcvd_rec;
-  context.p_list         = &rec_list;
-  context.comp_mask      = p_rcvd_mad->comp_mask;
-  context.p_rcv          = p_rcv;
-  context.p_req_physp    = p_req_physp;
-
-  cl_plock_acquire( p_rcv->p_lock );
-
-  /* Go over all switches */
-  cl_qmap_apply_func( &p_rcv->p_subn->sw_guid_tbl,
-                      __osm_mftr_rcv_by_comp_mask,
-                      &context );
-
-  cl_plock_release( p_rcv->p_lock );
-
-  num_rec = cl_qlist_count( &rec_list );
-
-  /*
-   * C15-0.1.30:
-   * If we do a SubnAdmGet and got more than one record it is an error !
-   */
-  if (p_rcvd_mad->method == IB_MAD_METHOD_GET)
-  {
-    if (num_rec == 0)
-    {
-      osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-      goto Exit;
-    }
-    if (num_rec > 1)
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_mftr_rcv_process: ERR 4A09: "
-               "Got more than one record for SubnAdmGet (%u)\n",
-               num_rec );
-      osm_sa_send_error( p_rcv->p_resp, p_madw,
-                         IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
-
-      /* need to set the mem free ... */
-      p_rec_item = (osm_mftr_item_t*)cl_qlist_remove_head( &rec_list );
-      while( p_rec_item != (osm_mftr_item_t*)cl_qlist_end( &rec_list ) )
-      {
-        cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-        p_rec_item = (osm_mftr_item_t*)cl_qlist_remove_head( &rec_list );
-      }
-
-      goto Exit;
-    }
-  }
-
-  pre_trim_num_rec = num_rec;
+	uint32_t i;
+	osm_mftr_search_ctxt_t context;
+	osm_mftr_item_t *p_rec_item;
+	ib_api_status_t status = IB_SUCCESS;
+	osm_physp_t *p_req_physp;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_mftr_rcv_process);
+
+	CL_ASSERT(p_madw);
+
+	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_rcvd_rec = (ib_mft_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+
+	CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_MFT_RECORD);
+
+	/* 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(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_mftr_rcv_process: ERR 4A08: "
+			"Unsupported Method (%s)\n",
+			ib_get_sa_method_str(p_rcvd_mad->method));
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
+		goto Exit;
+	}
+
+	/* update the requester physical port. */
+	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+						p_rcv->p_subn,
+						osm_madw_get_mad_addr_ptr
+						(p_madw));
+	if (p_req_physp == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_mftr_rcv_process: ERR 4A07: "
+			"Cannot find requester physical port\n");
+		goto Exit;
+	}
+
+	cl_qlist_init(&rec_list);
+
+	context.p_rcvd_rec = p_rcvd_rec;
+	context.p_list = &rec_list;
+	context.comp_mask = p_rcvd_mad->comp_mask;
+	context.p_rcv = p_rcv;
+	context.p_req_physp = p_req_physp;
+
+	cl_plock_acquire(p_rcv->p_lock);
+
+	/* Go over all switches */
+	cl_qmap_apply_func(&p_rcv->p_subn->sw_guid_tbl,
+			   __osm_mftr_rcv_by_comp_mask, &context);
+
+	cl_plock_release(p_rcv->p_lock);
+
+	num_rec = cl_qlist_count(&rec_list);
+
+	/*
+	 * C15-0.1.30:
+	 * If we do a SubnAdmGet and got more than one record it is an error !
+	 */
+	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
+		if (num_rec == 0) {
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_NO_RECORDS);
+			goto Exit;
+		}
+		if (num_rec > 1) {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_mftr_rcv_process: ERR 4A09: "
+				"Got more than one record for SubnAdmGet (%u)\n",
+				num_rec);
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
+
+			/* need to set the mem free ... */
+			p_rec_item =
+			    (osm_mftr_item_t *) cl_qlist_remove_head(&rec_list);
+			while (p_rec_item !=
+			       (osm_mftr_item_t *) cl_qlist_end(&rec_list)) {
+				cl_qlock_pool_put(&p_rcv->pool,
+						  &p_rec_item->pool_item);
+				p_rec_item =
+				    (osm_mftr_item_t *)
+				    cl_qlist_remove_head(&rec_list);
+			}
+
+			goto Exit;
+		}
+	}
+
+	pre_trim_num_rec = num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we limit the number of records to a single packet */
-  trim_num_rec = (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_mft_record_t);
-  if (trim_num_rec < num_rec)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "osm_mftr_rcv_process: "
-             "Number of records:%u trimmed to:%u to fit in one MAD\n",
-             num_rec, trim_num_rec );
-    num_rec = trim_num_rec;
-  }
+	/* we limit the number of records to a single packet */
+	trim_num_rec =
+	    (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_mft_record_t);
+	if (trim_num_rec < num_rec) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"osm_mftr_rcv_process: "
+			"Number of records:%u trimmed to:%u to fit in one MAD\n",
+			num_rec, trim_num_rec);
+		num_rec = trim_num_rec;
+	}
 #endif
 
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "osm_mftr_rcv_process: "
-           "Returning %u records\n", num_rec );
-
-  if ((p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) &&
-      (num_rec == 0))
-  {
-    osm_sa_send_error( p_rcv->p_resp, p_madw,
-                       IB_SA_MAD_STATUS_NO_RECORDS );
-    goto Exit;
-  }
-
-  /*
-   * Get a MAD to reply. Address of Mad is in the received mad_wrapper
-   */
-  p_resp_madw = osm_mad_pool_get( p_rcv->p_mad_pool,
-                                  p_madw->h_bind,
-                                  num_rec * sizeof(ib_mft_record_t) + IB_SA_MAD_HDR_SIZE,
-                                  &p_madw->mad_addr );
-
-  if( !p_resp_madw )
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_mftr_rcv_process: ERR 4A10: "
-            "osm_mad_pool_get failed\n" );
-
-    for( i = 0; i < num_rec; i++ )
-    {
-      p_rec_item = (osm_mftr_item_t*)cl_qlist_remove_head( &rec_list );
-      cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    }
-
-    osm_sa_send_error( p_rcv->p_resp, p_madw,
-                       IB_SA_MAD_STATUS_NO_RESOURCES );
-
-    goto Exit;
-  }
-
-  p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
-
-  /*
-    Copy the MAD header back into the response mad.
-    Set the 'R' bit and the payload length,
-    Then copy all records from the list into the response payload.
-  */
-
-  memcpy( p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE );
-  p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-  /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
-  p_resp_sa_mad->sm_key = 0;
-  /* Fill in the offset (paylen will be done by the rmpp SAR) */
-  p_resp_sa_mad->attr_offset =
-    ib_get_attr_offset( sizeof(ib_mft_record_t) );
-
-  p_resp_rec = (ib_mft_record_t*)ib_sa_mad_get_payload_ptr( p_resp_sa_mad );
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"osm_mftr_rcv_process: " "Returning %u records\n", num_rec);
+
+	if ((p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) && (num_rec == 0)) {
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RECORDS);
+		goto Exit;
+	}
+
+	/*
+	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
+	 */
+	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+				       p_madw->h_bind,
+				       num_rec * sizeof(ib_mft_record_t) +
+				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
+
+	if (!p_resp_madw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_mftr_rcv_process: ERR 4A10: "
+			"osm_mad_pool_get failed\n");
+
+		for (i = 0; i < num_rec; i++) {
+			p_rec_item =
+			    (osm_mftr_item_t *) cl_qlist_remove_head(&rec_list);
+			cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		}
+
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RESOURCES);
+
+		goto Exit;
+	}
+
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+
+	/*
+	   Copy the MAD header back into the response mad.
+	   Set the 'R' bit and the payload length,
+	   Then copy all records from the list into the response payload.
+	 */
+
+	memcpy(p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE);
+	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
+	p_resp_sa_mad->sm_key = 0;
+	/* Fill in the offset (paylen will be done by the rmpp SAR) */
+	p_resp_sa_mad->attr_offset =
+	    ib_get_attr_offset(sizeof(ib_mft_record_t));
+
+	p_resp_rec =
+	    (ib_mft_record_t *) ib_sa_mad_get_payload_ptr(p_resp_sa_mad);
 
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we support only one packet RMPP - so we will set the first and
-     last flags for gettable */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-  {
-    p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST | IB_RMPP_FLAG_ACTIVE;
-  }
+	/* we support only one packet RMPP - so we will set the first and
+	   last flags for gettable */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+		p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
+		p_resp_sa_mad->rmpp_flags =
+		    IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST |
+		    IB_RMPP_FLAG_ACTIVE;
+	}
 #else
-  /* forcefully define the packet as RMPP one */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
+	/* forcefully define the packet as RMPP one */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
+		p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
 #endif
 
-  for( i = 0; i < pre_trim_num_rec; i++ )
-  {
-    p_rec_item = (osm_mftr_item_t*)cl_qlist_remove_head( &rec_list );
-    /* copy only if not trimmed */
-    if (i < num_rec)
-    {
-      *p_resp_rec = p_rec_item->rec;
-    }
-    cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    p_resp_rec++;
-  }
-
-  CL_ASSERT( cl_is_qlist_empty( &rec_list ) );
-
-  status = osm_vendor_send( p_resp_madw->h_bind, p_resp_madw, FALSE );
-  if (status != IB_SUCCESS)
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_mftr_rcv_process: ERR 4A11: "
-            "osm_vendor_send status = %s\n",
-            ib_get_err_str(status));
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	for (i = 0; i < pre_trim_num_rec; i++) {
+		p_rec_item =
+		    (osm_mftr_item_t *) cl_qlist_remove_head(&rec_list);
+		/* copy only if not trimmed */
+		if (i < num_rec) {
+			*p_resp_rec = p_rec_item->rec;
+		}
+		cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		p_resp_rec++;
+	}
+
+	CL_ASSERT(cl_is_qlist_empty(&rec_list));
+
+	status = osm_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE);
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_mftr_rcv_process: ERR 4A11: "
+			"osm_vendor_send status = %s\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_sa_node_record.c b/opensm/opensm/osm_sa_node_record.c
index f40d769..a7615c5 100644
--- a/opensm/opensm/osm_sa_node_record.c
+++ b/opensm/opensm/osm_sa_node_record.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -62,541 +62,512 @@
 #define OSM_NR_RCV_POOL_MIN_SIZE    32
 #define OSM_NR_RCV_POOL_GROW_SIZE   32
 
-typedef  struct _osm_nr_item
-{
-  cl_pool_item_t           pool_item;
-  ib_node_record_t         rec;
+typedef struct _osm_nr_item {
+	cl_pool_item_t pool_item;
+	ib_node_record_t rec;
 } osm_nr_item_t;
 
-typedef  struct _osm_nr_search_ctxt
-{
-  const ib_node_record_t*     p_rcvd_rec;
-  ib_net64_t               comp_mask;
-  cl_qlist_t*              p_list;
-  osm_nr_rcv_t*            p_rcv;
-  const osm_physp_t*       p_req_physp;
+typedef struct _osm_nr_search_ctxt {
+	const ib_node_record_t *p_rcvd_rec;
+	ib_net64_t comp_mask;
+	cl_qlist_t *p_list;
+	osm_nr_rcv_t *p_rcv;
+	const osm_physp_t *p_req_physp;
 } osm_nr_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_nr_rcv_construct(
-  IN osm_nr_rcv_t* const p_rcv )
+void osm_nr_rcv_construct(IN osm_nr_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
-  cl_qlock_pool_construct( &p_rcv->pool );
+	memset(p_rcv, 0, sizeof(*p_rcv));
+	cl_qlock_pool_construct(&p_rcv->pool);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_nr_rcv_destroy(
-  IN osm_nr_rcv_t* const p_rcv )
+void osm_nr_rcv_destroy(IN osm_nr_rcv_t * const p_rcv)
 {
-  OSM_LOG_ENTER( p_rcv->p_log, osm_nr_rcv_destroy );
-  cl_qlock_pool_destroy( &p_rcv->pool );
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_nr_rcv_destroy);
+	cl_qlock_pool_destroy(&p_rcv->pool);
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_nr_rcv_init(
-  IN osm_nr_rcv_t*         const p_rcv,
-  IN osm_sa_resp_t*        const p_resp,
-  IN osm_mad_pool_t*       const p_mad_pool,
-  IN const osm_subn_t*     const p_subn,
-  IN osm_log_t*            const p_log,
-  IN cl_plock_t*           const p_lock )
+osm_nr_rcv_init(IN osm_nr_rcv_t * const p_rcv,
+		IN osm_sa_resp_t * const p_resp,
+		IN osm_mad_pool_t * const p_mad_pool,
+		IN const osm_subn_t * const p_subn,
+		IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t          status;
+	ib_api_status_t status;
 
-  OSM_LOG_ENTER( p_log, osm_nr_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_nr_rcv_init);
 
-  osm_nr_rcv_construct( p_rcv );
+	osm_nr_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_resp = p_resp;
-  p_rcv->p_mad_pool = p_mad_pool;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_resp = p_resp;
+	p_rcv->p_mad_pool = p_mad_pool;
 
-  status = cl_qlock_pool_init( &p_rcv->pool,
-                               OSM_NR_RCV_POOL_MIN_SIZE,
-                               0,
-                               OSM_NR_RCV_POOL_GROW_SIZE,
-                               sizeof(osm_nr_item_t),
-                               NULL, NULL, NULL );
+	status = cl_qlock_pool_init(&p_rcv->pool,
+				    OSM_NR_RCV_POOL_MIN_SIZE,
+				    0,
+				    OSM_NR_RCV_POOL_GROW_SIZE,
+				    sizeof(osm_nr_item_t), NULL, NULL, NULL);
 
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t
-__osm_nr_rcv_new_nr(
-  IN osm_nr_rcv_t*         const p_rcv,
-  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 )
+__osm_nr_rcv_new_nr(IN osm_nr_rcv_t * const p_rcv,
+		    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)
 {
-  osm_nr_item_t*           p_rec_item;
-  ib_api_status_t          status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_nr_rcv_new_nr );
-
-  p_rec_item = (osm_nr_item_t*)cl_qlock_pool_get( &p_rcv->pool );
-  if( p_rec_item == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_nr_rcv_new_nr: ERR 1D02: "
-             "cl_qlock_pool_get failed\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_nr_rcv_new_nr: "
-             "New NodeRecord: node 0x%016" PRIx64
-             "\n\t\t\t\tport 0x%016" PRIx64 ", lid 0x%X\n",
-             cl_ntoh64( osm_node_get_node_guid( p_node ) ),
-             cl_ntoh64( port_guid ), cl_ntoh16( lid )
-             );
-  }
-
-  memset( &p_rec_item->rec, 0, sizeof(ib_node_record_t) );
-
-  p_rec_item->rec.lid = lid;
-
-  p_rec_item->rec.node_info = p_node->node_info;
-  p_rec_item->rec.node_info.port_guid = port_guid;
-  memcpy(&(p_rec_item->rec.node_desc), &(p_node->node_desc),
-         IB_NODE_DESCRIPTION_SIZE);
-  cl_qlist_insert_tail( p_list, (cl_list_item_t*)&p_rec_item->pool_item );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	osm_nr_item_t *p_rec_item;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_nr_rcv_new_nr);
+
+	p_rec_item = (osm_nr_item_t *) cl_qlock_pool_get(&p_rcv->pool);
+	if (p_rec_item == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_nr_rcv_new_nr: ERR 1D02: "
+			"cl_qlock_pool_get failed\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_nr_rcv_new_nr: "
+			"New NodeRecord: node 0x%016" PRIx64
+			"\n\t\t\t\tport 0x%016" PRIx64 ", lid 0x%X\n",
+			cl_ntoh64(osm_node_get_node_guid(p_node)),
+			cl_ntoh64(port_guid), cl_ntoh16(lid)
+		    );
+	}
+
+	memset(&p_rec_item->rec, 0, sizeof(ib_node_record_t));
+
+	p_rec_item->rec.lid = lid;
+
+	p_rec_item->rec.node_info = p_node->node_info;
+	p_rec_item->rec.node_info.port_guid = port_guid;
+	memcpy(&(p_rec_item->rec.node_desc), &(p_node->node_desc),
+	       IB_NODE_DESCRIPTION_SIZE);
+	cl_qlist_insert_tail(p_list,
+			     (cl_list_item_t *) & p_rec_item->pool_item);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_nr_rcv_create_nr(
-  IN osm_nr_rcv_t*         const p_rcv,
-  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 )
+__osm_nr_rcv_create_nr(IN osm_nr_rcv_t * const p_rcv,
+		       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)
 {
-  const osm_physp_t*       p_physp;
-  uint8_t                  port_num;
-  uint8_t                  num_ports;
-  uint16_t                 match_lid_ho;
-  ib_net16_t               base_lid;
-  ib_net16_t               base_lid_ho;
-  ib_net16_t               max_lid_ho;
-  uint8_t                  lmc;
-  ib_net64_t               port_guid;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_nr_rcv_create_nr );
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_nr_rcv_create_nr: "
-             "Looking for NodeRecord with LID: 0x%X GUID:0x%016" PRIx64 "\n",
-             cl_ntoh16( match_lid ),
-             cl_ntoh64( match_port_guid )
-             );
-  }
-
-  /*
-    For switches, do not return the NodeInfo record
-    for each port on the switch, just for port 0.
-  */
-  if( osm_node_get_type( p_node ) == IB_NODE_TYPE_SWITCH )
-    num_ports = 1;
-  else
-    num_ports = osm_node_get_num_physp( p_node );
-
-  for( port_num = 0; port_num < num_ports; port_num++ )
-  {
-    p_physp = osm_node_get_physp_ptr( p_node, port_num );
-
-    if( !osm_physp_is_valid( p_physp ) )
-      continue;
-
-    /* Check to see if the found p_physp and the requester physp
-       share a pkey. If not - continue */
-    if (!osm_physp_share_pkey( p_rcv->p_log, p_physp, p_req_physp ) )
-      continue;
-
-    port_guid = osm_physp_get_port_guid( p_physp );
-
-    if( match_port_guid && ( 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 )
-    {
-      /*
-        We validate that the lid belongs to this node.
-      */
-      if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-      {
-        osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-                 "__osm_nr_rcv_create_nr: "
-                 "Comparing LID: 0x%X <= 0x%X <= 0x%X\n",
-                 base_lid_ho, match_lid_ho, max_lid_ho
-                 );
-      }
-
-      if ( match_lid_ho < base_lid_ho || match_lid_ho > max_lid_ho )
-        continue;
-    }
-
-    __osm_nr_rcv_new_nr( p_rcv, p_node, p_list, port_guid, base_lid );
-
-  }
-
-  OSM_LOG_EXIT( p_rcv->p_log );
+	const osm_physp_t *p_physp;
+	uint8_t port_num;
+	uint8_t num_ports;
+	uint16_t match_lid_ho;
+	ib_net16_t base_lid;
+	ib_net16_t base_lid_ho;
+	ib_net16_t max_lid_ho;
+	uint8_t lmc;
+	ib_net64_t port_guid;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_nr_rcv_create_nr);
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_nr_rcv_create_nr: "
+			"Looking for NodeRecord with LID: 0x%X GUID:0x%016"
+			PRIx64 "\n", cl_ntoh16(match_lid),
+			cl_ntoh64(match_port_guid)
+		    );
+	}
+
+	/*
+	   For switches, do not return the NodeInfo record
+	   for each port on the switch, just for port 0.
+	 */
+	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH)
+		num_ports = 1;
+	else
+		num_ports = osm_node_get_num_physp(p_node);
+
+	for (port_num = 0; port_num < num_ports; port_num++) {
+		p_physp = osm_node_get_physp_ptr(p_node, port_num);
+
+		if (!osm_physp_is_valid(p_physp))
+			continue;
+
+		/* Check to see if the found p_physp and the requester physp
+		   share a pkey. If not - continue */
+		if (!osm_physp_share_pkey(p_rcv->p_log, p_physp, p_req_physp))
+			continue;
+
+		port_guid = osm_physp_get_port_guid(p_physp);
+
+		if (match_port_guid && (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) {
+			/*
+			   We validate that the lid belongs to this node.
+			 */
+			if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+				osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+					"__osm_nr_rcv_create_nr: "
+					"Comparing LID: 0x%X <= 0x%X <= 0x%X\n",
+					base_lid_ho, match_lid_ho, max_lid_ho);
+			}
+
+			if (match_lid_ho < base_lid_ho
+			    || match_lid_ho > max_lid_ho)
+				continue;
+		}
+
+		__osm_nr_rcv_new_nr(p_rcv, p_node, p_list, port_guid, base_lid);
+
+	}
+
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_nr_rcv_by_comp_mask(
-  IN cl_map_item_t*        const p_map_item,
-  IN void*                 context )
+__osm_nr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item, IN void *context)
 {
-  const osm_nr_search_ctxt_t* const p_ctxt = (osm_nr_search_ctxt_t *)context;
-  const osm_node_t*        const 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_nr_rcv_t*            const p_rcv = p_ctxt->p_rcv;
-  ib_net64_t               const comp_mask = p_ctxt->comp_mask;
-  ib_net64_t               match_port_guid = 0;
-  ib_net16_t               match_lid = 0;
-
-  OSM_LOG_ENTER( p_ctxt->p_rcv->p_log, __osm_nr_rcv_by_comp_mask );
-
-  osm_dump_node_info(
-    p_ctxt->p_rcv->p_log,
-    &p_node->node_info,
-    OSM_LOG_VERBOSE );
-
-  if( comp_mask & IB_NR_COMPMASK_LID )
-    match_lid = p_rcvd_rec->lid;
-
-  if( comp_mask & IB_NR_COMPMASK_NODEGUID)
-  {
-    /*
-      DEBUG TOP
-    */
-    if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-               "__osm_nr_rcv_by_comp_mask: "
-               "Looking for node 0x%016" PRIx64
-               ", found 0x%016" PRIx64 "\n",
-               cl_ntoh64( p_rcvd_rec->node_info.node_guid ),
-               cl_ntoh64( osm_node_get_node_guid( p_node ) )
-               );
-    }
-    /*
-      DEBUG BOTTOM
-    */
-    if( (p_node->node_info.node_guid != p_rcvd_rec->node_info.node_guid) )
-      goto Exit;
-  }
-  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) )
-      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)) )
-      goto Exit;
-  }
-
-  __osm_nr_rcv_create_nr( p_rcv, p_node, p_ctxt->p_list,
-                          match_port_guid, match_lid, p_req_physp );
-
- Exit:
-  OSM_LOG_EXIT( p_ctxt->p_rcv->p_log );
+	const osm_nr_search_ctxt_t *const p_ctxt =
+	    (osm_nr_search_ctxt_t *) context;
+	const osm_node_t *const 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_nr_rcv_t *const p_rcv = p_ctxt->p_rcv;
+	ib_net64_t const comp_mask = p_ctxt->comp_mask;
+	ib_net64_t match_port_guid = 0;
+	ib_net16_t match_lid = 0;
+
+	OSM_LOG_ENTER(p_ctxt->p_rcv->p_log, __osm_nr_rcv_by_comp_mask);
+
+	osm_dump_node_info(p_ctxt->p_rcv->p_log,
+			   &p_node->node_info, OSM_LOG_VERBOSE);
+
+	if (comp_mask & IB_NR_COMPMASK_LID)
+		match_lid = p_rcvd_rec->lid;
+
+	if (comp_mask & IB_NR_COMPMASK_NODEGUID) {
+		/*
+		   DEBUG TOP
+		 */
+		if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				"__osm_nr_rcv_by_comp_mask: "
+				"Looking for node 0x%016" PRIx64
+				", found 0x%016" PRIx64 "\n",
+				cl_ntoh64(p_rcvd_rec->node_info.node_guid),
+				cl_ntoh64(osm_node_get_node_guid(p_node))
+			    );
+		}
+		/*
+		   DEBUG BOTTOM
+		 */
+		if ((p_node->node_info.node_guid !=
+		     p_rcvd_rec->node_info.node_guid))
+			goto Exit;
+	}
+	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))
+			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)))
+			goto Exit;
+	}
+
+	__osm_nr_rcv_create_nr(p_rcv, p_node, p_ctxt->p_list,
+			       match_port_guid, match_lid, p_req_physp);
+
+      Exit:
+	OSM_LOG_EXIT(p_ctxt->p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_nr_rcv_process(
-  IN void *ctx,
-  IN void *data )
+void osm_nr_rcv_process(IN void *ctx, IN void *data)
 {
-  osm_nr_rcv_t *p_rcv = ctx;
-  osm_madw_t *p_madw = data;
-  const ib_sa_mad_t*       p_rcvd_mad;
-  const ib_node_record_t*  p_rcvd_rec;
-  ib_node_record_t*        p_resp_rec;
-  cl_qlist_t               rec_list;
-  osm_madw_t*              p_resp_madw;
-  ib_sa_mad_t*             p_resp_sa_mad;
-  uint32_t                 num_rec, pre_trim_num_rec;
+	osm_nr_rcv_t *p_rcv = ctx;
+	osm_madw_t *p_madw = data;
+	const ib_sa_mad_t *p_rcvd_mad;
+	const ib_node_record_t *p_rcvd_rec;
+	ib_node_record_t *p_resp_rec;
+	cl_qlist_t rec_list;
+	osm_madw_t *p_resp_madw;
+	ib_sa_mad_t *p_resp_sa_mad;
+	uint32_t num_rec, pre_trim_num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  uint32_t		   trim_num_rec;
+	uint32_t trim_num_rec;
 #endif
-  uint32_t                 i;
-  osm_nr_search_ctxt_t     context;
-  osm_nr_item_t*           p_rec_item;
-  ib_api_status_t          status;
-  osm_physp_t*             p_req_physp;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_nr_rcv_process );
-
-  CL_ASSERT( p_madw );
-
-  p_rcvd_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_rcvd_rec = (ib_node_record_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
-
-  CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_NODE_RECORD );
-
-  /* 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( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_nr_rcv_process: ERR 1D05: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_rcvd_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
-
-  /* update the requester physical port. */
-  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-                                          p_rcv->p_subn,
-                                          osm_madw_get_mad_addr_ptr(p_madw) );
-  if (p_req_physp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_nr_rcv_process: ERR 1D04: "
-             "Cannot find requester physical port\n" );
-    goto Exit;
-  }
-
-  if ( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    osm_dump_node_record( p_rcv->p_log, p_rcvd_rec, OSM_LOG_DEBUG );
-
-  cl_qlist_init( &rec_list );
-
-  context.p_rcvd_rec    = p_rcvd_rec;
-  context.p_list        = &rec_list;
-  context.comp_mask     = p_rcvd_mad->comp_mask;
-  context.p_rcv         = p_rcv;
-  context.p_req_physp   = p_req_physp;
-
-  cl_plock_acquire( p_rcv->p_lock );
-
-  cl_qmap_apply_func( &p_rcv->p_subn->node_guid_tbl,
-                      __osm_nr_rcv_by_comp_mask,
-                      &context );
-
-  cl_plock_release( p_rcv->p_lock );
-
-  num_rec = cl_qlist_count( &rec_list );
-
-  /*
-   * C15-0.1.30:
-   * If we do a SubnAdmGet and got more than one record it is an error !
-   */
-  if ( (p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec > 1) ) {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_nr_rcv_process: ERR 1D03: "
-             "Got more than one record for SubnAdmGet (%u)\n",
-             num_rec );
-    osm_sa_send_error( p_rcv->p_resp, p_madw,
-                       IB_SA_MAD_STATUS_TOO_MANY_RECORDS );
-
-    /* need to set the mem free ... */
-    p_rec_item = (osm_nr_item_t*)cl_qlist_remove_head( &rec_list );
-    while( p_rec_item != (osm_nr_item_t*)cl_qlist_end( &rec_list ) )
-    {
-      cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-      p_rec_item = (osm_nr_item_t*)cl_qlist_remove_head( &rec_list );
-    }
-
-    goto Exit;
-  }
-
-  pre_trim_num_rec = num_rec;
+	uint32_t i;
+	osm_nr_search_ctxt_t context;
+	osm_nr_item_t *p_rec_item;
+	ib_api_status_t status;
+	osm_physp_t *p_req_physp;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_nr_rcv_process);
+
+	CL_ASSERT(p_madw);
+
+	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_rcvd_rec = (ib_node_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+
+	CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_NODE_RECORD);
+
+	/* 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(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_nr_rcv_process: ERR 1D05: "
+			"Unsupported Method (%s)\n",
+			ib_get_sa_method_str(p_rcvd_mad->method));
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
+		goto Exit;
+	}
+
+	/* update the requester physical port. */
+	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+						p_rcv->p_subn,
+						osm_madw_get_mad_addr_ptr
+						(p_madw));
+	if (p_req_physp == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_nr_rcv_process: ERR 1D04: "
+			"Cannot find requester physical port\n");
+		goto Exit;
+	}
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
+		osm_dump_node_record(p_rcv->p_log, p_rcvd_rec, OSM_LOG_DEBUG);
+
+	cl_qlist_init(&rec_list);
+
+	context.p_rcvd_rec = p_rcvd_rec;
+	context.p_list = &rec_list;
+	context.comp_mask = p_rcvd_mad->comp_mask;
+	context.p_rcv = p_rcv;
+	context.p_req_physp = p_req_physp;
+
+	cl_plock_acquire(p_rcv->p_lock);
+
+	cl_qmap_apply_func(&p_rcv->p_subn->node_guid_tbl,
+			   __osm_nr_rcv_by_comp_mask, &context);
+
+	cl_plock_release(p_rcv->p_lock);
+
+	num_rec = cl_qlist_count(&rec_list);
+
+	/*
+	 * C15-0.1.30:
+	 * If we do a SubnAdmGet and got more than one record it is an error !
+	 */
+	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec > 1)) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_nr_rcv_process: ERR 1D03: "
+			"Got more than one record for SubnAdmGet (%u)\n",
+			num_rec);
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
+
+		/* need to set the mem free ... */
+		p_rec_item = (osm_nr_item_t *) cl_qlist_remove_head(&rec_list);
+		while (p_rec_item != (osm_nr_item_t *) cl_qlist_end(&rec_list)) {
+			cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+			p_rec_item =
+			    (osm_nr_item_t *) cl_qlist_remove_head(&rec_list);
+		}
+
+		goto Exit;
+	}
+
+	pre_trim_num_rec = num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we limit the number of records to a single packet */
-  trim_num_rec = (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_node_record_t);
-  if (trim_num_rec < num_rec)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "osm_nr_rcv_process: "
-             "Number of records:%u trimmed to:%u to fit in one MAD\n",
-             num_rec, trim_num_rec );
-    num_rec = trim_num_rec;
-  }
+	/* we limit the number of records to a single packet */
+	trim_num_rec =
+	    (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_node_record_t);
+	if (trim_num_rec < num_rec) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"osm_nr_rcv_process: "
+			"Number of records:%u trimmed to:%u to fit in one MAD\n",
+			num_rec, trim_num_rec);
+		num_rec = trim_num_rec;
+	}
 #endif
 
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "osm_nr_rcv_process: "
-           "Returning %u records\n", num_rec );
-
-  if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
-  {
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-    goto Exit;
-  }
-
-  /*
-   * Get a MAD to reply. Address of Mad is in the received mad_wrapper
-   */
-  p_resp_madw = osm_mad_pool_get( p_rcv->p_mad_pool,
-                                  p_madw->h_bind,
-                                  num_rec * sizeof(ib_node_record_t) + IB_SA_MAD_HDR_SIZE,
-                                  &p_madw->mad_addr );
-
-  if( !p_resp_madw )
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_nr_rcv_process: ERR 1D06: "
-            "osm_mad_pool_get failed\n" );
-
-    for( i = 0; i < num_rec; i++ )
-    {
-      p_rec_item = (osm_nr_item_t*)cl_qlist_remove_head( &rec_list );
-      cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    }
-
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES );
-    goto Exit;
-  }
-
-  p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
-
-  /*
-    Copy the MAD header back into the response mad.
-    Set the 'R' bit and the payload length,
-    Then copy all records from the list into the response payload.
-  */
-
-  memcpy( p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE );
-  p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-  /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
-  p_resp_sa_mad->sm_key = 0;
-  /* Fill in the offset (paylen will be done by the rmpp SAR) */
-  p_resp_sa_mad->attr_offset =
-    ib_get_attr_offset( sizeof(ib_node_record_t) );
-
-  p_resp_rec = (ib_node_record_t*)ib_sa_mad_get_payload_ptr( p_resp_sa_mad );
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"osm_nr_rcv_process: " "Returning %u records\n", num_rec);
+
+	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RECORDS);
+		goto Exit;
+	}
+
+	/*
+	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
+	 */
+	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+				       p_madw->h_bind,
+				       num_rec * sizeof(ib_node_record_t) +
+				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
+
+	if (!p_resp_madw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_nr_rcv_process: ERR 1D06: "
+			"osm_mad_pool_get failed\n");
+
+		for (i = 0; i < num_rec; i++) {
+			p_rec_item =
+			    (osm_nr_item_t *) cl_qlist_remove_head(&rec_list);
+			cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		}
+
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RESOURCES);
+		goto Exit;
+	}
+
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+
+	/*
+	   Copy the MAD header back into the response mad.
+	   Set the 'R' bit and the payload length,
+	   Then copy all records from the list into the response payload.
+	 */
+
+	memcpy(p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE);
+	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
+	p_resp_sa_mad->sm_key = 0;
+	/* Fill in the offset (paylen will be done by the rmpp SAR) */
+	p_resp_sa_mad->attr_offset =
+	    ib_get_attr_offset(sizeof(ib_node_record_t));
+
+	p_resp_rec =
+	    (ib_node_record_t *) ib_sa_mad_get_payload_ptr(p_resp_sa_mad);
 
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we support only one packet RMPP - so we will set the first and
-     last flags for gettable */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-  {
-    p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST | IB_RMPP_FLAG_ACTIVE;
-  }
+	/* we support only one packet RMPP - so we will set the first and
+	   last flags for gettable */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+		p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
+		p_resp_sa_mad->rmpp_flags =
+		    IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST |
+		    IB_RMPP_FLAG_ACTIVE;
+	}
 #else
-  /* forcefully define the packet as RMPP one */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
+	/* forcefully define the packet as RMPP one */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
+		p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
 #endif
 
-  for( i = 0; i < pre_trim_num_rec; i++ )
-  {
-    p_rec_item = (osm_nr_item_t*)cl_qlist_remove_head( &rec_list );
-    /* copy only if not trimmed */
-    if (i < num_rec)
-    {
-      *p_resp_rec = p_rec_item->rec;
-    }
-    cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    p_resp_rec++;
-  }
-
-  CL_ASSERT( cl_is_qlist_empty( &rec_list ) );
-
-  status = osm_vendor_send( p_resp_madw->h_bind, p_resp_madw, FALSE );
-  if (status != IB_SUCCESS)
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_nr_rcv_process: ERR 1D07: "
-            "osm_vendor_send status = %s\n",
-            ib_get_err_str(status));
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	for (i = 0; i < pre_trim_num_rec; i++) {
+		p_rec_item = (osm_nr_item_t *) cl_qlist_remove_head(&rec_list);
+		/* copy only if not trimmed */
+		if (i < num_rec) {
+			*p_resp_rec = p_rec_item->rec;
+		}
+		cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		p_resp_rec++;
+	}
+
+	CL_ASSERT(cl_is_qlist_empty(&rec_list));
+
+	status = osm_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE);
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_nr_rcv_process: ERR 1D07: "
+			"osm_vendor_send status = %s\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_sa_pkey_record.c b/opensm/opensm/osm_sa_pkey_record.c
index 2432b2d..0081f2b 100644
--- a/opensm/opensm/osm_sa_pkey_record.c
+++ b/opensm/opensm/osm_sa_pkey_record.c
@@ -35,7 +35,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -53,533 +53,512 @@
 #define OSM_PKEY_REC_RCV_POOL_MIN_SIZE      32
 #define OSM_PKEY_REC_RCV_POOL_GROW_SIZE     32
 
-typedef  struct _osm_pkey_item
-{
-  cl_pool_item_t           pool_item;
-  ib_pkey_table_record_t   rec;
+typedef struct _osm_pkey_item {
+	cl_pool_item_t pool_item;
+	ib_pkey_table_record_t rec;
 } osm_pkey_item_t;
 
-typedef  struct _osm_pkey_search_ctxt
-{
-  const ib_pkey_table_record_t*   p_rcvd_rec;
-  ib_net64_t                      comp_mask;
-  uint16_t                        block_num;
-  cl_qlist_t*                     p_list;
-  osm_pkey_rec_rcv_t*             p_rcv;
-  const osm_physp_t*              p_req_physp;
+typedef struct _osm_pkey_search_ctxt {
+	const ib_pkey_table_record_t *p_rcvd_rec;
+	ib_net64_t comp_mask;
+	uint16_t block_num;
+	cl_qlist_t *p_list;
+	osm_pkey_rec_rcv_t *p_rcv;
+	const osm_physp_t *p_req_physp;
 } osm_pkey_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_pkey_rec_rcv_construct(
-  IN osm_pkey_rec_rcv_t* const p_rcv )
+void osm_pkey_rec_rcv_construct(IN osm_pkey_rec_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
-  cl_qlock_pool_construct( &p_rcv->pool );
+	memset(p_rcv, 0, sizeof(*p_rcv));
+	cl_qlock_pool_construct(&p_rcv->pool);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_pkey_rec_rcv_destroy(
-  IN osm_pkey_rec_rcv_t* const p_rcv )
+void osm_pkey_rec_rcv_destroy(IN osm_pkey_rec_rcv_t * const p_rcv)
 {
-  OSM_LOG_ENTER( p_rcv->p_log, osm_pkey_rec_rcv_destroy );
-  cl_qlock_pool_destroy( &p_rcv->pool );
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_pkey_rec_rcv_destroy);
+	cl_qlock_pool_destroy(&p_rcv->pool);
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_pkey_rec_rcv_init(
-  IN osm_pkey_rec_rcv_t*     const p_rcv,
-  IN osm_sa_resp_t*        const p_resp,
-  IN osm_mad_pool_t*    const p_mad_pool,
-  IN const osm_subn_t*     const p_subn,
-  IN osm_log_t*            const p_log,
-  IN cl_plock_t*           const p_lock )
+osm_pkey_rec_rcv_init(IN osm_pkey_rec_rcv_t * const p_rcv,
+		      IN osm_sa_resp_t * const p_resp,
+		      IN osm_mad_pool_t * const p_mad_pool,
+		      IN const osm_subn_t * const p_subn,
+		      IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t          status;
+	ib_api_status_t status;
 
-  OSM_LOG_ENTER( p_log, osm_pkey_rec_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_pkey_rec_rcv_init);
 
-  osm_pkey_rec_rcv_construct( p_rcv );
+	osm_pkey_rec_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_resp = p_resp;
-  p_rcv->p_mad_pool = p_mad_pool;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_resp = p_resp;
+	p_rcv->p_mad_pool = p_mad_pool;
 
-  /* used for matching records collection */
-  status = cl_qlock_pool_init( &p_rcv->pool,
-                               OSM_PKEY_REC_RCV_POOL_MIN_SIZE,
-                               0,
-                               OSM_PKEY_REC_RCV_POOL_GROW_SIZE,
-                               sizeof(osm_pkey_item_t),
-                               NULL, NULL, NULL );
+	/* used for matching records collection */
+	status = cl_qlock_pool_init(&p_rcv->pool,
+				    OSM_PKEY_REC_RCV_POOL_MIN_SIZE,
+				    0,
+				    OSM_PKEY_REC_RCV_POOL_GROW_SIZE,
+				    sizeof(osm_pkey_item_t), NULL, NULL, NULL);
 
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-__osm_sa_pkey_create(
-  IN osm_pkey_rec_rcv_t*       const p_rcv,
-  IN osm_physp_t*              const p_physp,
-  IN osm_pkey_search_ctxt_t*   const p_ctxt,
-  IN uint16_t                  block )
+__osm_sa_pkey_create(IN osm_pkey_rec_rcv_t * const p_rcv,
+		     IN osm_physp_t * const p_physp,
+		     IN osm_pkey_search_ctxt_t * const p_ctxt,
+		     IN uint16_t block)
 {
-  osm_pkey_item_t*             p_rec_item;
-  uint16_t                     lid;
-  ib_api_status_t              status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_sa_pkey_create );
-
-  p_rec_item = (osm_pkey_item_t*)cl_qlock_pool_get( &p_rcv->pool );
-  if( p_rec_item == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_sa_pkey_create: ERR 4602: "
-             "cl_qlock_pool_get failed\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
-  if (p_physp->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH)
-    lid = p_physp->port_info.base_lid;
-  else
-    lid = osm_node_get_base_lid( p_physp->p_node, 0 );
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_sa_pkey_create: "
-             "New P_Key table for: port 0x%016" PRIx64
-             ", lid 0x%X, port 0x%X Block:%u\n",
-             cl_ntoh64( osm_physp_get_port_guid( p_physp ) ),
-             cl_ntoh16( lid ), osm_physp_get_port_num( p_physp ),
-             block
-             );
-  }
-
-  memset( &p_rec_item->rec, 0, sizeof( p_rec_item->rec ) );
-
-  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));
-
-  cl_qlist_insert_tail( p_ctxt->p_list,
-                        (cl_list_item_t*)&p_rec_item->pool_item );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_pkey_item_t *p_rec_item;
+	uint16_t lid;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_pkey_create);
+
+	p_rec_item = (osm_pkey_item_t *) cl_qlock_pool_get(&p_rcv->pool);
+	if (p_rec_item == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_sa_pkey_create: ERR 4602: "
+			"cl_qlock_pool_get failed\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+	if (p_physp->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH)
+		lid = p_physp->port_info.base_lid;
+	else
+		lid = osm_node_get_base_lid(p_physp->p_node, 0);
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_sa_pkey_create: "
+			"New P_Key table for: port 0x%016" PRIx64
+			", lid 0x%X, port 0x%X Block:%u\n",
+			cl_ntoh64(osm_physp_get_port_guid(p_physp)),
+			cl_ntoh16(lid), osm_physp_get_port_num(p_physp), block);
+	}
+
+	memset(&p_rec_item->rec, 0, sizeof(p_rec_item->rec));
+
+	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));
+
+	cl_qlist_insert_tail(p_ctxt->p_list,
+			     (cl_list_item_t *) & p_rec_item->pool_item);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-__osm_sa_pkey_check_physp(
-  IN osm_pkey_rec_rcv_t*       const p_rcv,
-  IN osm_physp_t*              const p_physp,
-  osm_pkey_search_ctxt_t*      const p_ctxt )
+__osm_sa_pkey_check_physp(IN osm_pkey_rec_rcv_t * const p_rcv,
+			  IN osm_physp_t * const p_physp,
+			  osm_pkey_search_ctxt_t * const p_ctxt)
 {
-  ib_net64_t comp_mask = p_ctxt->comp_mask;
-  uint16_t   block, num_blocks;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_sa_pkey_check_physp );
-
-  /* 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( p_rcv, 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( p_rcv, p_physp, p_ctxt, block );
-    }
-  }
-
-  OSM_LOG_EXIT( p_rcv->p_log );
+	ib_net64_t comp_mask = p_ctxt->comp_mask;
+	uint16_t block, num_blocks;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_pkey_check_physp);
+
+	/* 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(p_rcv, 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(p_rcv, p_physp, p_ctxt, block);
+		}
+	}
+
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_pkey_by_comp_mask(
-  IN osm_pkey_rec_rcv_t*   const p_rcv,
-  IN const osm_port_t*     const p_port,
-  osm_pkey_search_ctxt_t*  const p_ctxt )
+__osm_sa_pkey_by_comp_mask(IN osm_pkey_rec_rcv_t * const p_rcv,
+			   IN const osm_port_t * const p_port,
+			   osm_pkey_search_ctxt_t * const p_ctxt)
 {
-  const ib_pkey_table_record_t*   p_rcvd_rec;
-  ib_net64_t               comp_mask;
-  osm_physp_t *            p_physp;
-  uint8_t                  port_num;
-  uint8_t                  num_ports;
-  const osm_physp_t*       p_req_physp;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_sa_pkey_by_comp_mask );
-
-  p_rcvd_rec = p_ctxt->p_rcvd_rec;
-  comp_mask = p_ctxt->comp_mask;
-  port_num = p_rcvd_rec->port_num;
-  p_req_physp = p_ctxt->p_req_physp;
-
-  /* if this is a switch port we can search all ports
-     otherwise we must be looking on port 0 */
-  if ( p_port->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH )
-  {
-    /* we put it in the comp mask and port num */
-    port_num = p_port->p_physp->port_num;
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_sa_pkey_by_comp_mask:  "
-             "Using Physical Default Port Number: 0x%X (for End Node)\n",
-             port_num);
-    comp_mask |= IB_PKEY_COMPMASK_PORT;
-  }
-
-  if( comp_mask & IB_PKEY_COMPMASK_PORT )
-  {
-    if (port_num < osm_node_get_num_physp( p_port->p_node ))
-    {
-      p_physp = osm_node_get_physp_ptr( p_port->p_node, port_num );
-      /* Check that the p_physp is valid, and that is shares a pkey
-         with the p_req_physp. */
-      if( osm_physp_is_valid( p_physp ) &&
-          (osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp)) )
-        __osm_sa_pkey_check_physp( p_rcv, p_physp, p_ctxt );
-    }
-    else
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "__osm_sa_pkey_by_comp_mask: ERR 4603: "
-               "Given Physical Port Number: 0x%X is out of range should be < 0x%X\n",
-               port_num, osm_node_get_num_physp( p_port->p_node ));
-      goto Exit;
-    }
-  }
-  else
-  {
-    num_ports = osm_node_get_num_physp( p_port->p_node );
-    for( port_num = 0; port_num < num_ports; port_num++ )
-    {
-      p_physp = osm_node_get_physp_ptr( p_port->p_node, port_num );
-      if( !osm_physp_is_valid( p_physp ) )
-        continue;
-
-      /* if the requester and the p_physp don't share a pkey -
-         continue */
-      if (!osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp ) )
-        continue;
-
-      __osm_sa_pkey_check_physp( p_rcv, p_physp, p_ctxt );
-    }
-  }
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	const ib_pkey_table_record_t *p_rcvd_rec;
+	ib_net64_t comp_mask;
+	osm_physp_t *p_physp;
+	uint8_t port_num;
+	uint8_t num_ports;
+	const osm_physp_t *p_req_physp;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_pkey_by_comp_mask);
+
+	p_rcvd_rec = p_ctxt->p_rcvd_rec;
+	comp_mask = p_ctxt->comp_mask;
+	port_num = p_rcvd_rec->port_num;
+	p_req_physp = p_ctxt->p_req_physp;
+
+	/* if this is a switch port we can search all ports
+	   otherwise we must be looking on port 0 */
+	if (p_port->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH) {
+		/* we put it in the comp mask and port num */
+		port_num = p_port->p_physp->port_num;
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_sa_pkey_by_comp_mask:  "
+			"Using Physical Default Port Number: 0x%X (for End Node)\n",
+			port_num);
+		comp_mask |= IB_PKEY_COMPMASK_PORT;
+	}
+
+	if (comp_mask & IB_PKEY_COMPMASK_PORT) {
+		if (port_num < osm_node_get_num_physp(p_port->p_node)) {
+			p_physp =
+			    osm_node_get_physp_ptr(p_port->p_node, port_num);
+			/* Check that the p_physp is valid, and that is shares a pkey
+			   with the p_req_physp. */
+			if (osm_physp_is_valid(p_physp) &&
+			    (osm_physp_share_pkey
+			     (p_rcv->p_log, p_req_physp, p_physp)))
+				__osm_sa_pkey_check_physp(p_rcv, p_physp,
+							  p_ctxt);
+		} else {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"__osm_sa_pkey_by_comp_mask: ERR 4603: "
+				"Given Physical Port Number: 0x%X is out of range should be < 0x%X\n",
+				port_num,
+				osm_node_get_num_physp(p_port->p_node));
+			goto Exit;
+		}
+	} else {
+		num_ports = osm_node_get_num_physp(p_port->p_node);
+		for (port_num = 0; port_num < num_ports; port_num++) {
+			p_physp =
+			    osm_node_get_physp_ptr(p_port->p_node, port_num);
+			if (!osm_physp_is_valid(p_physp))
+				continue;
+
+			/* if the requester and the p_physp don't share a pkey -
+			   continue */
+			if (!osm_physp_share_pkey
+			    (p_rcv->p_log, p_req_physp, p_physp))
+				continue;
+
+			__osm_sa_pkey_check_physp(p_rcv, p_physp, p_ctxt);
+		}
+	}
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_pkey_by_comp_mask_cb(
-  IN cl_map_item_t*        const p_map_item,
-  IN void*                 context )
+__osm_sa_pkey_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
+			      IN void *context)
 {
-  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 *const p_port = (osm_port_t *) p_map_item;
+	osm_pkey_search_ctxt_t *const p_ctxt =
+	    (osm_pkey_search_ctxt_t *) context;
 
-  __osm_sa_pkey_by_comp_mask( p_ctxt->p_rcv, p_port, p_ctxt );
+	__osm_sa_pkey_by_comp_mask(p_ctxt->p_rcv, p_port, p_ctxt);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_pkey_rec_rcv_process(
-  IN void *ctx,
-  IN void *data )
+void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 {
-  osm_pkey_rec_rcv_t *p_rcv = 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_madw_t*              p_resp_madw;
-  ib_sa_mad_t*             p_resp_sa_mad;
-  ib_pkey_table_record_t*  p_resp_rec;
-  uint32_t                 num_rec, pre_trim_num_rec;
+	osm_pkey_rec_rcv_t *p_rcv = 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_madw_t *p_resp_madw;
+	ib_sa_mad_t *p_resp_sa_mad;
+	ib_pkey_table_record_t *p_resp_rec;
+	uint32_t num_rec, pre_trim_num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  uint32_t		   trim_num_rec;
+	uint32_t trim_num_rec;
 #endif
-  uint32_t                 i;
-  osm_pkey_search_ctxt_t   context;
-  osm_pkey_item_t*         p_rec_item;
-  ib_api_status_t          status = IB_SUCCESS;
-  ib_net64_t               comp_mask;
-  osm_physp_t*             p_req_physp;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_pkey_rec_rcv_process );
-
-  CL_ASSERT( p_madw );
-
-  p_rcvd_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_rcvd_rec = (ib_pkey_table_record_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
-  comp_mask = p_rcvd_mad->comp_mask;
-
-  CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_PKEY_TBL_RECORD );
-
-  /* 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( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_pkey_rec_rcv_process: ERR 4605: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_rcvd_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
-
-  /*
-     p922 - P_KeyTableRecords shall only be provided in response
-     to trusted requests.
-     Check that the requester is a trusted one.
-  */
-  if ( p_rcvd_mad->sm_key != p_rcv->p_subn->opt.sm_key )
-  {
-    /* This is not a trusted requester! */
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_pkey_rec_rcv_process ERR 4608: "
-             "Request from non-trusted requester: "
-             "Given SM_Key:0x%016" PRIx64 "\n",
-             cl_ntoh64(p_rcvd_mad->sm_key) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_REQ_INVALID );
-    goto Exit;
-  }
-
-  /* update the requester physical port. */
-  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-                                          p_rcv->p_subn,
-                                          osm_madw_get_mad_addr_ptr(p_madw) );
-  if (p_req_physp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_pkey_rec_rcv_process: ERR 4604: "
-             "Cannot find requester physical port\n" );
-    goto Exit;
-  }
-
-  p_pkey = (ib_pkey_table_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
-
-  cl_qlist_init( &rec_list );
-
-  context.p_rcvd_rec = p_rcvd_rec;
-  context.p_list = &rec_list;
-  context.comp_mask = p_rcvd_mad->comp_mask;
-  context.p_rcv = p_rcv;
-  context.block_num = p_rcvd_rec->block_num;
-  context.p_req_physp = p_req_physp;
-
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "osm_pkey_rec_rcv_process: "
-           "Got Query Lid:0x%04X(%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_BLOCK) != 0 );
-
-  cl_plock_acquire( p_rcv->p_lock );
-
-  /*
-    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_PKEY_COMPMASK_LID )
-  {
-
-    p_tbl = &p_rcv->p_subn->port_lid_tbl;
-
-    CL_ASSERT( cl_ptr_vector_get_size(p_tbl) < 0x10000 );
-
-    status = osm_get_port_by_base_lid( p_rcv->p_subn, p_rcvd_rec->lid, &p_port );
-    if ( ( status != IB_SUCCESS ) || ( p_port == NULL ) )
-    {
-      status = IB_NOT_FOUND;
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_pkey_rec_rcv_process: ERR 460B: "
-               "No port found with LID 0x%x\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( p_rcv, p_port, &context );
-    else
-    {
-      cl_qmap_apply_func( &p_rcv->p_subn->port_guid_tbl,
-                          __osm_sa_pkey_by_comp_mask_cb,
-                          &context );
-    }
-  }
-
-  cl_plock_release( p_rcv->p_lock );
-
-  num_rec = cl_qlist_count( &rec_list );
-
-  /*
-   * C15-0.1.30:
-   * If we do a SubnAdmGet and got more than one record it is an error !
-   */
-  if (p_rcvd_mad->method == IB_MAD_METHOD_GET)
-  {
-    if (num_rec == 0)
-    {
-      osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-      goto Exit;
-    }
-    if (num_rec > 1)
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_pkey_rec_rcv_process: ERR 460A: "
-               "Got more than one record for SubnAdmGet (%u)\n",
-               num_rec );
-      osm_sa_send_error( p_rcv->p_resp, p_madw,
-                         IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
-
-      /* need to set the mem free ... */
-      p_rec_item = (osm_pkey_item_t*)cl_qlist_remove_head( &rec_list );
-      while( p_rec_item != (osm_pkey_item_t*)cl_qlist_end( &rec_list ) )
-      {
-        cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-        p_rec_item = (osm_pkey_item_t*)cl_qlist_remove_head( &rec_list );
-      }
-
-      goto Exit;
-    }
-  }
-
-  pre_trim_num_rec = num_rec;
+	uint32_t i;
+	osm_pkey_search_ctxt_t context;
+	osm_pkey_item_t *p_rec_item;
+	ib_api_status_t status = IB_SUCCESS;
+	ib_net64_t comp_mask;
+	osm_physp_t *p_req_physp;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_pkey_rec_rcv_process);
+
+	CL_ASSERT(p_madw);
+
+	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_rcvd_rec =
+	    (ib_pkey_table_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+	comp_mask = p_rcvd_mad->comp_mask;
+
+	CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_PKEY_TBL_RECORD);
+
+	/* 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(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_pkey_rec_rcv_process: ERR 4605: "
+			"Unsupported Method (%s)\n",
+			ib_get_sa_method_str(p_rcvd_mad->method));
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
+		goto Exit;
+	}
+
+	/*
+	   p922 - P_KeyTableRecords shall only be provided in response
+	   to trusted requests.
+	   Check that the requester is a trusted one.
+	 */
+	if (p_rcvd_mad->sm_key != p_rcv->p_subn->opt.sm_key) {
+		/* This is not a trusted requester! */
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_pkey_rec_rcv_process ERR 4608: "
+			"Request from non-trusted requester: "
+			"Given SM_Key:0x%016" PRIx64 "\n",
+			cl_ntoh64(p_rcvd_mad->sm_key));
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_REQ_INVALID);
+		goto Exit;
+	}
+
+	/* update the requester physical port. */
+	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+						p_rcv->p_subn,
+						osm_madw_get_mad_addr_ptr
+						(p_madw));
+	if (p_req_physp == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_pkey_rec_rcv_process: ERR 4604: "
+			"Cannot find requester physical port\n");
+		goto Exit;
+	}
+
+	p_pkey = (ib_pkey_table_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+
+	cl_qlist_init(&rec_list);
+
+	context.p_rcvd_rec = p_rcvd_rec;
+	context.p_list = &rec_list;
+	context.comp_mask = p_rcvd_mad->comp_mask;
+	context.p_rcv = p_rcv;
+	context.block_num = p_rcvd_rec->block_num;
+	context.p_req_physp = p_req_physp;
+
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"osm_pkey_rec_rcv_process: "
+		"Got Query Lid:0x%04X(%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_BLOCK) != 0);
+
+	cl_plock_acquire(p_rcv->p_lock);
+
+	/*
+	   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_PKEY_COMPMASK_LID) {
+
+		p_tbl = &p_rcv->p_subn->port_lid_tbl;
+
+		CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000);
+
+		status =
+		    osm_get_port_by_base_lid(p_rcv->p_subn, p_rcvd_rec->lid,
+					     &p_port);
+		if ((status != IB_SUCCESS) || (p_port == NULL)) {
+			status = IB_NOT_FOUND;
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_pkey_rec_rcv_process: ERR 460B: "
+				"No port found with LID 0x%x\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(p_rcv, p_port, &context);
+		else {
+			cl_qmap_apply_func(&p_rcv->p_subn->port_guid_tbl,
+					   __osm_sa_pkey_by_comp_mask_cb,
+					   &context);
+		}
+	}
+
+	cl_plock_release(p_rcv->p_lock);
+
+	num_rec = cl_qlist_count(&rec_list);
+
+	/*
+	 * C15-0.1.30:
+	 * If we do a SubnAdmGet and got more than one record it is an error !
+	 */
+	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
+		if (num_rec == 0) {
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_NO_RECORDS);
+			goto Exit;
+		}
+		if (num_rec > 1) {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_pkey_rec_rcv_process: ERR 460A: "
+				"Got more than one record for SubnAdmGet (%u)\n",
+				num_rec);
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
+
+			/* need to set the mem free ... */
+			p_rec_item =
+			    (osm_pkey_item_t *) cl_qlist_remove_head(&rec_list);
+			while (p_rec_item !=
+			       (osm_pkey_item_t *) cl_qlist_end(&rec_list)) {
+				cl_qlock_pool_put(&p_rcv->pool,
+						  &p_rec_item->pool_item);
+				p_rec_item =
+				    (osm_pkey_item_t *)
+				    cl_qlist_remove_head(&rec_list);
+			}
+
+			goto Exit;
+		}
+	}
+
+	pre_trim_num_rec = num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  trim_num_rec = (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_pkey_table_record_t);
-  if (trim_num_rec < num_rec)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "osm_pkey_rec_rcv_process: "
-             "Number of records:%u trimmed to:%u to fit in one MAD\n",
-             num_rec, trim_num_rec );
-    num_rec = trim_num_rec;
-  }
+	trim_num_rec =
+	    (MAD_BLOCK_SIZE -
+	     IB_SA_MAD_HDR_SIZE) / sizeof(ib_pkey_table_record_t);
+	if (trim_num_rec < num_rec) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"osm_pkey_rec_rcv_process: "
+			"Number of records:%u trimmed to:%u to fit in one MAD\n",
+			num_rec, trim_num_rec);
+		num_rec = trim_num_rec;
+	}
 #endif
 
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "osm_pkey_rec_rcv_process: "
-           "Returning %u records\n", num_rec );
-
-  if((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
-  {
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-    goto Exit;
-  }
-
-  /*
-   * Get a MAD to reply. Address of Mad is in the received mad_wrapper
-   */
-  p_resp_madw = osm_mad_pool_get( p_rcv->p_mad_pool,
-                                  p_madw->h_bind,
-                                  num_rec * sizeof(ib_pkey_table_record_t) + IB_SA_MAD_HDR_SIZE,
-                                  &p_madw->mad_addr );
-
-  if( !p_resp_madw )
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_pkey_rec_rcv_process: ERR 4606: "
-            "osm_mad_pool_get failed\n" );
-
-    for( i = 0; i < num_rec; i++ )
-    {
-      p_rec_item = (osm_pkey_item_t*)cl_qlist_remove_head( &rec_list );
-      cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    }
-
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES );
-    goto Exit;
-  }
-
-  p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
-
-  /*
-    Copy the MAD header back into the response mad.
-    Set the 'R' bit and the payload length,
-    Then copy all records from the list into the response payload.
-  */
-
-  memcpy( p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE );
-  p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-  /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
-  p_resp_sa_mad->sm_key = 0;
-
-  /* Fill in the offset (paylen will be done by the rmpp SAR) */
-  p_resp_sa_mad->attr_offset =
-    ib_get_attr_offset( sizeof(ib_pkey_table_record_t) );
-
-  p_resp_rec = (ib_pkey_table_record_t*)
-    ib_sa_mad_get_payload_ptr( p_resp_sa_mad );
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"osm_pkey_rec_rcv_process: " "Returning %u records\n", num_rec);
+
+	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RECORDS);
+		goto Exit;
+	}
+
+	/*
+	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
+	 */
+	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+				       p_madw->h_bind,
+				       num_rec *
+				       sizeof(ib_pkey_table_record_t) +
+				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
+
+	if (!p_resp_madw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_pkey_rec_rcv_process: ERR 4606: "
+			"osm_mad_pool_get failed\n");
+
+		for (i = 0; i < num_rec; i++) {
+			p_rec_item =
+			    (osm_pkey_item_t *) cl_qlist_remove_head(&rec_list);
+			cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		}
+
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RESOURCES);
+		goto Exit;
+	}
+
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+
+	/*
+	   Copy the MAD header back into the response mad.
+	   Set the 'R' bit and the payload length,
+	   Then copy all records from the list into the response payload.
+	 */
+
+	memcpy(p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE);
+	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
+	p_resp_sa_mad->sm_key = 0;
+
+	/* Fill in the offset (paylen will be done by the rmpp SAR) */
+	p_resp_sa_mad->attr_offset =
+	    ib_get_attr_offset(sizeof(ib_pkey_table_record_t));
+
+	p_resp_rec = (ib_pkey_table_record_t *)
+	    ib_sa_mad_get_payload_ptr(p_resp_sa_mad);
 
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we support only one packet RMPP - so we will set the first and
-     last flags for gettable */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-  {
-    p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST | IB_RMPP_FLAG_ACTIVE;
-  }
+	/* we support only one packet RMPP - so we will set the first and
+	   last flags for gettable */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+		p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
+		p_resp_sa_mad->rmpp_flags =
+		    IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST |
+		    IB_RMPP_FLAG_ACTIVE;
+	}
 #else
-  /* forcefully define the packet as RMPP one */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
+	/* forcefully define the packet as RMPP one */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
+		p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
 #endif
 
-  for( i = 0; i < pre_trim_num_rec; i++ )
-  {
-    p_rec_item = (osm_pkey_item_t*)cl_qlist_remove_head( &rec_list );
-    /* copy only if not trimmed */
-    if (i < num_rec)
-    {
-      *p_resp_rec = p_rec_item->rec;
-    }
-    cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    p_resp_rec++;
-  }
-
-  CL_ASSERT( cl_is_qlist_empty( &rec_list ) );
-
-  status = osm_vendor_send( p_resp_madw->h_bind, p_resp_madw, FALSE);
-  if (status != IB_SUCCESS)
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_pkey_rec_rcv_process: ERR 4607: "
-            "osm_vendor_send status = %s\n",
-            ib_get_err_str(status));
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	for (i = 0; i < pre_trim_num_rec; i++) {
+		p_rec_item =
+		    (osm_pkey_item_t *) cl_qlist_remove_head(&rec_list);
+		/* copy only if not trimmed */
+		if (i < num_rec) {
+			*p_resp_rec = p_rec_item->rec;
+		}
+		cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		p_resp_rec++;
+	}
+
+	CL_ASSERT(cl_is_qlist_empty(&rec_list));
+
+	status = osm_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE);
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_pkey_rec_rcv_process: ERR 4607: "
+			"osm_vendor_send status = %s\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_sa_portinfo_record.c b/opensm/opensm/osm_sa_portinfo_record.c
index d2fe32c..1483d5f 100644
--- a/opensm/opensm/osm_sa_portinfo_record.c
+++ b/opensm/opensm/osm_sa_portinfo_record.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of osm_pir_rcv_t.
@@ -48,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -67,811 +66,746 @@
 #define OSM_PIR_RCV_POOL_MIN_SIZE      32
 #define OSM_PIR_RCV_POOL_GROW_SIZE     32
 
-typedef  struct _osm_pir_item
-{
-  cl_pool_item_t           pool_item;
-  ib_portinfo_record_t     rec;
+typedef struct _osm_pir_item {
+	cl_pool_item_t pool_item;
+	ib_portinfo_record_t rec;
 } osm_pir_item_t;
 
-typedef  struct _osm_pir_search_ctxt
-{
-  const ib_portinfo_record_t* p_rcvd_rec;
-  ib_net64_t               comp_mask;
-  cl_qlist_t*              p_list;
-  osm_pir_rcv_t*           p_rcv;
-  const osm_physp_t*       p_req_physp;
-  boolean_t                is_enhanced_comp_mask;
+typedef struct _osm_pir_search_ctxt {
+	const ib_portinfo_record_t *p_rcvd_rec;
+	ib_net64_t comp_mask;
+	cl_qlist_t *p_list;
+	osm_pir_rcv_t *p_rcv;
+	const osm_physp_t *p_req_physp;
+	boolean_t is_enhanced_comp_mask;
 } osm_pir_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_pir_rcv_construct(
-  IN osm_pir_rcv_t* const p_rcv )
+void osm_pir_rcv_construct(IN osm_pir_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
-  cl_qlock_pool_construct( &p_rcv->pool );
+	memset(p_rcv, 0, sizeof(*p_rcv));
+	cl_qlock_pool_construct(&p_rcv->pool);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_pir_rcv_destroy(
-  IN osm_pir_rcv_t* const p_rcv )
+void osm_pir_rcv_destroy(IN osm_pir_rcv_t * const p_rcv)
 {
-  OSM_LOG_ENTER( p_rcv->p_log, osm_pir_rcv_destroy );
-  cl_qlock_pool_destroy( &p_rcv->pool );
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_pir_rcv_destroy);
+	cl_qlock_pool_destroy(&p_rcv->pool);
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_pir_rcv_init(
-  IN osm_pir_rcv_t*  const p_rcv,
-  IN osm_sa_resp_t*  const p_resp,
-  IN osm_mad_pool_t* const p_mad_pool,
-  IN osm_subn_t*     const p_subn,
-  IN osm_log_t*      const p_log,
-  IN cl_plock_t*     const p_lock )
+osm_pir_rcv_init(IN osm_pir_rcv_t * const p_rcv,
+		 IN osm_sa_resp_t * const p_resp,
+		 IN osm_mad_pool_t * const p_mad_pool,
+		 IN osm_subn_t * const p_subn,
+		 IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t          status;
+	ib_api_status_t status;
 
-  OSM_LOG_ENTER( p_log, osm_pir_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_pir_rcv_init);
 
-  osm_pir_rcv_construct( p_rcv );
+	osm_pir_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_resp = p_resp;
-  p_rcv->p_mad_pool = p_mad_pool;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_resp = p_resp;
+	p_rcv->p_mad_pool = p_mad_pool;
 
-  status = cl_qlock_pool_init( &p_rcv->pool,
-                               OSM_PIR_RCV_POOL_MIN_SIZE,
-                               0,
-                               OSM_PIR_RCV_POOL_GROW_SIZE,
-                               sizeof(osm_pir_item_t),
-                               NULL, NULL, NULL );
+	status = cl_qlock_pool_init(&p_rcv->pool,
+				    OSM_PIR_RCV_POOL_MIN_SIZE,
+				    0,
+				    OSM_PIR_RCV_POOL_GROW_SIZE,
+				    sizeof(osm_pir_item_t), NULL, NULL, NULL);
 
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t
-__osm_pir_rcv_new_pir(
-  IN osm_pir_rcv_t*        const p_rcv,
-  IN const osm_physp_t*    const p_physp,
-  IN cl_qlist_t*           const p_list,
-  IN ib_net16_t            const lid )
+__osm_pir_rcv_new_pir(IN osm_pir_rcv_t * const p_rcv,
+		      IN const osm_physp_t * const p_physp,
+		      IN cl_qlist_t * const p_list, IN ib_net16_t const lid)
 {
-  osm_pir_item_t*          p_rec_item;
-  ib_api_status_t          status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_pir_rcv_new_pir );
-
-  p_rec_item = (osm_pir_item_t*)cl_qlock_pool_get( &p_rcv->pool );
-  if( p_rec_item == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_pir_rcv_new_pir: ERR 2102: "
-             "cl_qlock_pool_get failed\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_pir_rcv_new_pir: "
-             "New PortInfoRecord: port 0x%016" PRIx64
-             ", lid 0x%X, port 0x%X\n",
-             cl_ntoh64( osm_physp_get_port_guid( p_physp ) ),
-             cl_ntoh16( lid ), osm_physp_get_port_num( p_physp ) );
-  }
-
-  memset( &p_rec_item->rec, 0, sizeof( p_rec_item->rec ) );
-
-  p_rec_item->rec.lid = lid;
-  p_rec_item->rec.port_info = p_physp->port_info;
-  p_rec_item->rec.port_num = osm_physp_get_port_num( p_physp );
-
-  cl_qlist_insert_tail( p_list, (cl_list_item_t*)&p_rec_item->pool_item );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	osm_pir_item_t *p_rec_item;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_pir_rcv_new_pir);
+
+	p_rec_item = (osm_pir_item_t *) cl_qlock_pool_get(&p_rcv->pool);
+	if (p_rec_item == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_pir_rcv_new_pir: ERR 2102: "
+			"cl_qlock_pool_get failed\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_pir_rcv_new_pir: "
+			"New PortInfoRecord: port 0x%016" PRIx64
+			", lid 0x%X, port 0x%X\n",
+			cl_ntoh64(osm_physp_get_port_guid(p_physp)),
+			cl_ntoh16(lid), osm_physp_get_port_num(p_physp));
+	}
+
+	memset(&p_rec_item->rec, 0, sizeof(p_rec_item->rec));
+
+	p_rec_item->rec.lid = lid;
+	p_rec_item->rec.port_info = p_physp->port_info;
+	p_rec_item->rec.port_num = osm_physp_get_port_num(p_physp);
+
+	cl_qlist_insert_tail(p_list,
+			     (cl_list_item_t *) & p_rec_item->pool_item);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-__osm_sa_pir_create(
-  IN osm_pir_rcv_t*           const p_rcv,
-  IN const osm_physp_t*       const p_physp,
-  IN osm_pir_search_ctxt_t*   const p_ctxt )
+__osm_sa_pir_create(IN osm_pir_rcv_t * const p_rcv,
+		    IN const osm_physp_t * const p_physp,
+		    IN osm_pir_search_ctxt_t * const p_ctxt)
 {
-  uint8_t                     lmc;
-  uint16_t                    max_lid_ho;
-  uint16_t                    base_lid_ho;
-  uint16_t                    match_lid_ho;
-  osm_physp_t                *p_node_physp;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_sa_pir_create );
-
-  if (p_physp->p_node->sw)
-  {
-    p_node_physp = osm_node_get_physp_ptr( p_physp->p_node, 0 );
-    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, p_rcv->p_subn) ?
-      osm_physp_get_lmc( p_node_physp ) : 0;
-  }
-  else
-  {
-    lmc = osm_physp_get_lmc( p_physp );
-    base_lid_ho = cl_ntoh16( osm_physp_get_base_lid( p_physp ) );
-  }
-  max_lid_ho = (uint16_t)( base_lid_ho + (1 << lmc) - 1 );
-
-  if( p_ctxt->comp_mask & IB_PIR_COMPMASK_LID )
-  {
-    match_lid_ho = cl_ntoh16( p_ctxt->p_rcvd_rec->lid );
-
-    /*
-      We validate that the lid belongs to this node.
-    */
-    if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-               "__osm_sa_pir_create: "
-               "Comparing LID: 0x%X <= 0x%X <= 0x%X\n",
-               base_lid_ho, match_lid_ho, max_lid_ho
-               );
-    }
-
-    if ( match_lid_ho < base_lid_ho || match_lid_ho > max_lid_ho )
-      goto Exit;
-  }
-
-  __osm_pir_rcv_new_pir( p_rcv, p_physp, p_ctxt->p_list,
-                         cl_hton16( base_lid_ho ) );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	uint8_t lmc;
+	uint16_t max_lid_ho;
+	uint16_t base_lid_ho;
+	uint16_t match_lid_ho;
+	osm_physp_t *p_node_physp;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_pir_create);
+
+	if (p_physp->p_node->sw) {
+		p_node_physp = osm_node_get_physp_ptr(p_physp->p_node, 0);
+		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,
+						  p_rcv->
+						  p_subn) ?
+		    osm_physp_get_lmc(p_node_physp) : 0;
+	} else {
+		lmc = osm_physp_get_lmc(p_physp);
+		base_lid_ho = cl_ntoh16(osm_physp_get_base_lid(p_physp));
+	}
+	max_lid_ho = (uint16_t) (base_lid_ho + (1 << lmc) - 1);
+
+	if (p_ctxt->comp_mask & IB_PIR_COMPMASK_LID) {
+		match_lid_ho = cl_ntoh16(p_ctxt->p_rcvd_rec->lid);
+
+		/*
+		   We validate that the lid belongs to this node.
+		 */
+		if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				"__osm_sa_pir_create: "
+				"Comparing LID: 0x%X <= 0x%X <= 0x%X\n",
+				base_lid_ho, match_lid_ho, max_lid_ho);
+		}
+
+		if (match_lid_ho < base_lid_ho || match_lid_ho > max_lid_ho)
+			goto Exit;
+	}
+
+	__osm_pir_rcv_new_pir(p_rcv, p_physp, p_ctxt->p_list,
+			      cl_hton16(base_lid_ho));
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-__osm_sa_pir_check_physp(
-  IN osm_pir_rcv_t*        const p_rcv,
-  IN const osm_physp_t*    const p_physp,
-  osm_pir_search_ctxt_t*   const p_ctxt )
+__osm_sa_pir_check_physp(IN osm_pir_rcv_t * const p_rcv,
+			 IN const osm_physp_t * const p_physp,
+			 osm_pir_search_ctxt_t * const 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;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_sa_pir_check_physp );
-
-  p_rcvd_rec = p_ctxt->p_rcvd_rec;
-  comp_mask = p_ctxt->comp_mask;
-  p_comp_pi = &p_rcvd_rec->port_info;
-  p_pi = &p_physp->port_info;
-
-  osm_dump_port_info(
-    p_rcv->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 );
-
-  /* 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. */
-  if( comp_mask & IB_PIR_COMPMASK_BASELID )
-  {
-    if( p_comp_pi->base_lid != p_pi->base_lid )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_MKEY )
-  {
-    if( p_comp_pi->m_key != p_pi->m_key )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_GIDPRE )
-  {
-    if( p_comp_pi->subnet_prefix != p_pi->subnet_prefix )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_SMLID )
-  {
-    if( p_comp_pi->master_sm_base_lid != p_pi->master_sm_base_lid )
-      goto Exit;
-  }
-
-  /* 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_CAPMASK )
-  {
-    if (p_ctxt->is_enhanced_comp_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 )
-        goto Exit;
-    }
-  }
-
-  if( comp_mask & IB_PIR_COMPMASK_DIAGCODE )
-  {
-    if( p_comp_pi->diag_code != p_pi->diag_code )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_MKEYLEASEPRD )
-  {
-    if( p_comp_pi->m_key_lease_period != p_pi->m_key_lease_period )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_LOCALPORTNUM )
-  {
-    if( p_comp_pi->local_port_num != p_pi->local_port_num )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_LNKWIDTHSUPPORT )
-  {
-    if( p_comp_pi->link_width_supported != p_pi->link_width_supported )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_LNKWIDTHACTIVE )
-  {
-    if( p_comp_pi->link_width_active != p_pi->link_width_active )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_LINKWIDTHENABLED )
-  {
-    if( p_comp_pi->link_width_enabled != p_pi->link_width_enabled )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_LNKSPEEDSUPPORT )
-  {
-    if( ib_port_info_get_link_speed_sup( p_comp_pi )!=
-        ib_port_info_get_link_speed_sup( p_pi) )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_PORTSTATE )
-  {
-    if( ib_port_info_get_port_state( p_comp_pi ) !=
-        ib_port_info_get_port_state( p_pi ) )
-      goto Exit;
-  }
-  if ( comp_mask & IB_PIR_COMPMASK_PORTPHYSTATE )
-  {
-    if ( ib_port_info_get_port_phys_state( p_comp_pi ) !=
-         ib_port_info_get_port_phys_state( p_pi ) )
-      goto Exit;
-  }
-  if ( comp_mask & IB_PIR_COMPMASK_LINKDWNDFLTSTATE )
-  {
-    if ( ib_port_info_get_link_down_def_state( p_comp_pi ) !=
-         ib_port_info_get_link_down_def_state( p_pi ) )
-      goto Exit;
-  }
-  if ( comp_mask & IB_PIR_COMPMASK_MKEYPROTBITS )
-  {
-    if( ib_port_info_get_mpb( p_comp_pi ) !=
-        ib_port_info_get_mpb( p_pi ) )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_LMC )
-  {
-    if( ib_port_info_get_lmc( p_comp_pi ) !=
-        ib_port_info_get_lmc( p_pi ) )
-      goto Exit;
-  }
-  if ( comp_mask & IB_PIR_COMPMASK_LINKSPEEDACTIVE )
-  {
-    if ( ib_port_info_get_link_speed_active( p_comp_pi ) !=
-         ib_port_info_get_link_speed_active( p_pi ) )
-      goto Exit;
-  }
-  if ( comp_mask & IB_PIR_COMPMASK_LINKSPEEDENABLE )
-  {
-    if ( ib_port_info_get_link_speed_enabled( p_comp_pi ) !=
-         ib_port_info_get_link_speed_enabled( p_pi ) )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_NEIGHBORMTU )
-  {
-    if( ib_port_info_get_neighbor_mtu( p_comp_pi ) !=
-        ib_port_info_get_neighbor_mtu( p_pi ) )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_MASTERSMSL )
-  {
-    if( ib_port_info_get_master_smsl( p_comp_pi ) !=
-        ib_port_info_get_master_smsl( p_pi ) )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_VLCAP )
-  {
-    if( ib_port_info_get_vl_cap( p_comp_pi ) !=
-        ib_port_info_get_vl_cap( p_pi ) )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_INITTYPE )
-  {
-    if( ib_port_info_get_init_type( p_comp_pi ) !=
-        ib_port_info_get_init_type( p_pi ) )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_VLHIGHLIMIT )
-  {
-    if( p_comp_pi->vl_high_limit != p_pi->vl_high_limit )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_VLARBHIGHCAP )
-  {
-    if( p_comp_pi->vl_arb_high_cap != p_pi->vl_arb_high_cap )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_VLARBLOWCAP )
-  {
-    if( p_comp_pi->vl_arb_low_cap != p_pi->vl_arb_low_cap )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_MTUCAP )
-  {
-    if( ib_port_info_get_mtu_cap( p_comp_pi ) !=
-        ib_port_info_get_mtu_cap( p_pi ) )
-      goto Exit;
-  }
-  if( comp_mask & IB_PIR_COMPMASK_VLSTALLCNT )
-  {
-    if( ib_port_info_get_vl_stall_count( p_comp_pi ) !=
-        ib_port_info_get_vl_stall_count( p_pi ) )
-      goto Exit;
-  }
-  if (comp_mask & IB_PIR_COMPMASK_HOQLIFE )
-  {
-    if ((p_comp_pi->vl_stall_life & 0x1F) != (p_pi->vl_stall_life & 0x1F) )
-      goto Exit;
-  }
-  if (comp_mask & IB_PIR_COMPMASK_OPVLS )
-  {
-    if ((p_comp_pi->vl_enforce & 0xF0) != (p_pi->vl_enforce & 0xF0) )
-      goto Exit;
-  }
-  if (comp_mask & IB_PIR_COMPMASK_PARENFIN )
-  {
-    if ((p_comp_pi->vl_enforce & 0x08) != (p_pi->vl_enforce & 0x08) )
-      goto Exit;
-  }
-  if (comp_mask & IB_PIR_COMPMASK_PARENFOUT )
-  {
-    if ((p_comp_pi->vl_enforce & 0x04) != (p_pi->vl_enforce & 0x04) )
-      goto Exit;
-  }
-  if (comp_mask & IB_PIR_COMPMASK_FILTERRAWIN )
-  {
-    if ((p_comp_pi->vl_enforce & 0x02) != (p_pi->vl_enforce & 0x02) )
-      goto Exit;
-  }
-  if (comp_mask & IB_PIR_COMPMASK_FILTERRAWOUT )
-  {
-    if ((p_comp_pi->vl_enforce & 0x01) != (p_pi->vl_enforce & 0x01) )
-      goto Exit;
-  }
-  if (comp_mask & IB_PIR_COMPMASK_MKEYVIO )
-  {
-    if (p_comp_pi->m_key_violations != p_pi->m_key_violations )
-      goto Exit;
-  }
-  if (comp_mask & IB_PIR_COMPMASK_PKEYVIO )
-  {
-    if (p_comp_pi->p_key_violations != p_pi->p_key_violations )
-      goto Exit;
-  }
-  if (comp_mask & IB_PIR_COMPMASK_QKEYVIO )
-  {
-    if (p_comp_pi->q_key_violations != p_pi->q_key_violations )
-      goto Exit;
-  }
-  if (comp_mask & IB_PIR_COMPMASK_GUIDCAP )
-  {
-    if (p_comp_pi->guid_cap != p_pi->guid_cap )
-      goto Exit;
-  }
-  if (comp_mask & IB_PIR_COMPMASK_SUBNTO )
-  {
-    if (ib_port_info_get_timeout(p_comp_pi) != ib_port_info_get_timeout(p_pi))
-      goto Exit;
-  }
-  if (comp_mask & IB_PIR_COMPMASK_RESPTIME )
-  {
-    if ((p_comp_pi->resp_time_value & 0x1F) != (p_pi->resp_time_value &0x1F) )
-      goto Exit;
-  }
-  if (comp_mask & IB_PIR_COMPMASK_LOCALPHYERR )
-  {
-    if( ib_port_info_get_local_phy_err_thd( p_comp_pi ) !=
-        ib_port_info_get_local_phy_err_thd( p_pi ) )
-      goto Exit;
-  }
-  if (comp_mask & IB_PIR_COMPMASK_OVERRUNERR)
-  {
-    if( ib_port_info_get_overrun_err_thd( p_comp_pi ) !=
-        ib_port_info_get_overrun_err_thd( p_pi ) )
-      goto Exit;
-  }
-
-  __osm_sa_pir_create( p_rcv, p_physp, p_ctxt );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	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;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_pir_check_physp);
+
+	p_rcvd_rec = p_ctxt->p_rcvd_rec;
+	comp_mask = p_ctxt->comp_mask;
+	p_comp_pi = &p_rcvd_rec->port_info;
+	p_pi = &p_physp->port_info;
+
+	osm_dump_port_info(p_rcv->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);
+
+	/* 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. */
+	if (comp_mask & IB_PIR_COMPMASK_BASELID) {
+		if (p_comp_pi->base_lid != p_pi->base_lid)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_MKEY) {
+		if (p_comp_pi->m_key != p_pi->m_key)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_GIDPRE) {
+		if (p_comp_pi->subnet_prefix != p_pi->subnet_prefix)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_SMLID) {
+		if (p_comp_pi->master_sm_base_lid != p_pi->master_sm_base_lid)
+			goto Exit;
+	}
+
+	/* 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_CAPMASK) {
+		if (p_ctxt->is_enhanced_comp_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)
+				goto Exit;
+		}
+	}
+
+	if (comp_mask & IB_PIR_COMPMASK_DIAGCODE) {
+		if (p_comp_pi->diag_code != p_pi->diag_code)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_MKEYLEASEPRD) {
+		if (p_comp_pi->m_key_lease_period != p_pi->m_key_lease_period)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_LOCALPORTNUM) {
+		if (p_comp_pi->local_port_num != p_pi->local_port_num)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_LNKWIDTHSUPPORT) {
+		if (p_comp_pi->link_width_supported !=
+		    p_pi->link_width_supported)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_LNKWIDTHACTIVE) {
+		if (p_comp_pi->link_width_active != p_pi->link_width_active)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_LINKWIDTHENABLED) {
+		if (p_comp_pi->link_width_enabled != p_pi->link_width_enabled)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_LNKSPEEDSUPPORT) {
+		if (ib_port_info_get_link_speed_sup(p_comp_pi) !=
+		    ib_port_info_get_link_speed_sup(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_PORTSTATE) {
+		if (ib_port_info_get_port_state(p_comp_pi) !=
+		    ib_port_info_get_port_state(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_PORTPHYSTATE) {
+		if (ib_port_info_get_port_phys_state(p_comp_pi) !=
+		    ib_port_info_get_port_phys_state(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_LINKDWNDFLTSTATE) {
+		if (ib_port_info_get_link_down_def_state(p_comp_pi) !=
+		    ib_port_info_get_link_down_def_state(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_MKEYPROTBITS) {
+		if (ib_port_info_get_mpb(p_comp_pi) !=
+		    ib_port_info_get_mpb(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_LMC) {
+		if (ib_port_info_get_lmc(p_comp_pi) !=
+		    ib_port_info_get_lmc(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_LINKSPEEDACTIVE) {
+		if (ib_port_info_get_link_speed_active(p_comp_pi) !=
+		    ib_port_info_get_link_speed_active(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_LINKSPEEDENABLE) {
+		if (ib_port_info_get_link_speed_enabled(p_comp_pi) !=
+		    ib_port_info_get_link_speed_enabled(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_NEIGHBORMTU) {
+		if (ib_port_info_get_neighbor_mtu(p_comp_pi) !=
+		    ib_port_info_get_neighbor_mtu(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_MASTERSMSL) {
+		if (ib_port_info_get_master_smsl(p_comp_pi) !=
+		    ib_port_info_get_master_smsl(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_VLCAP) {
+		if (ib_port_info_get_vl_cap(p_comp_pi) !=
+		    ib_port_info_get_vl_cap(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_INITTYPE) {
+		if (ib_port_info_get_init_type(p_comp_pi) !=
+		    ib_port_info_get_init_type(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_VLHIGHLIMIT) {
+		if (p_comp_pi->vl_high_limit != p_pi->vl_high_limit)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_VLARBHIGHCAP) {
+		if (p_comp_pi->vl_arb_high_cap != p_pi->vl_arb_high_cap)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_VLARBLOWCAP) {
+		if (p_comp_pi->vl_arb_low_cap != p_pi->vl_arb_low_cap)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_MTUCAP) {
+		if (ib_port_info_get_mtu_cap(p_comp_pi) !=
+		    ib_port_info_get_mtu_cap(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_VLSTALLCNT) {
+		if (ib_port_info_get_vl_stall_count(p_comp_pi) !=
+		    ib_port_info_get_vl_stall_count(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_HOQLIFE) {
+		if ((p_comp_pi->vl_stall_life & 0x1F) !=
+		    (p_pi->vl_stall_life & 0x1F))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_OPVLS) {
+		if ((p_comp_pi->vl_enforce & 0xF0) != (p_pi->vl_enforce & 0xF0))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_PARENFIN) {
+		if ((p_comp_pi->vl_enforce & 0x08) != (p_pi->vl_enforce & 0x08))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_PARENFOUT) {
+		if ((p_comp_pi->vl_enforce & 0x04) != (p_pi->vl_enforce & 0x04))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_FILTERRAWIN) {
+		if ((p_comp_pi->vl_enforce & 0x02) != (p_pi->vl_enforce & 0x02))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_FILTERRAWOUT) {
+		if ((p_comp_pi->vl_enforce & 0x01) != (p_pi->vl_enforce & 0x01))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_MKEYVIO) {
+		if (p_comp_pi->m_key_violations != p_pi->m_key_violations)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_PKEYVIO) {
+		if (p_comp_pi->p_key_violations != p_pi->p_key_violations)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_QKEYVIO) {
+		if (p_comp_pi->q_key_violations != p_pi->q_key_violations)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_GUIDCAP) {
+		if (p_comp_pi->guid_cap != p_pi->guid_cap)
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_SUBNTO) {
+		if (ib_port_info_get_timeout(p_comp_pi) !=
+		    ib_port_info_get_timeout(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_RESPTIME) {
+		if ((p_comp_pi->resp_time_value & 0x1F) !=
+		    (p_pi->resp_time_value & 0x1F))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_LOCALPHYERR) {
+		if (ib_port_info_get_local_phy_err_thd(p_comp_pi) !=
+		    ib_port_info_get_local_phy_err_thd(p_pi))
+			goto Exit;
+	}
+	if (comp_mask & IB_PIR_COMPMASK_OVERRUNERR) {
+		if (ib_port_info_get_overrun_err_thd(p_comp_pi) !=
+		    ib_port_info_get_overrun_err_thd(p_pi))
+			goto Exit;
+	}
+
+	__osm_sa_pir_create(p_rcv, p_physp, p_ctxt);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_pir_by_comp_mask(
-  IN osm_pir_rcv_t*        const p_rcv,
-  IN const osm_port_t*     const p_port,
-  osm_pir_search_ctxt_t*   const p_ctxt )
+__osm_sa_pir_by_comp_mask(IN osm_pir_rcv_t * const p_rcv,
+			  IN const osm_port_t * const p_port,
+			  osm_pir_search_ctxt_t * const p_ctxt)
 {
-  const ib_portinfo_record_t* p_rcvd_rec;
-  ib_net64_t               comp_mask;
-  const osm_physp_t*       p_physp;
-  uint8_t                  port_num;
-  uint8_t                  num_ports;
-  const osm_physp_t*       p_req_physp;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_sa_pir_by_comp_mask );
-
-  p_rcvd_rec = p_ctxt->p_rcvd_rec;
-  comp_mask = p_ctxt->comp_mask;
-  p_req_physp = p_ctxt->p_req_physp;
-
-  num_ports = osm_node_get_num_physp( p_port->p_node );
-
-  if( comp_mask & IB_PIR_COMPMASK_PORTNUM )
-  {
-    if (p_rcvd_rec->port_num < num_ports)
-    {
-      p_physp = osm_node_get_physp_ptr( p_port->p_node, p_rcvd_rec->port_num );
-      /* Check that the p_physp is valid, and that the p_physp and the
-         p_req_physp share a pkey. */
-      if( osm_physp_is_valid( p_physp ) &&
-          osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp))
-        __osm_sa_pir_check_physp( p_rcv, p_physp, p_ctxt );
-    }
-  }
-  else
-  {
-    for( port_num = 0; port_num < num_ports; port_num++ )
-    {
-      p_physp = osm_node_get_physp_ptr( p_port->p_node, port_num );
-      if( !osm_physp_is_valid( p_physp ) )
-        continue;
-
-      /* if the requester and the p_physp don't share a pkey -
-         continue */
-      if (!osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp ) )
-        continue;
-
-      __osm_sa_pir_check_physp( p_rcv, p_physp, p_ctxt );
-    }
-  }
-
-  OSM_LOG_EXIT( p_rcv->p_log );
+	const ib_portinfo_record_t *p_rcvd_rec;
+	ib_net64_t comp_mask;
+	const osm_physp_t *p_physp;
+	uint8_t port_num;
+	uint8_t num_ports;
+	const osm_physp_t *p_req_physp;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_pir_by_comp_mask);
+
+	p_rcvd_rec = p_ctxt->p_rcvd_rec;
+	comp_mask = p_ctxt->comp_mask;
+	p_req_physp = p_ctxt->p_req_physp;
+
+	num_ports = osm_node_get_num_physp(p_port->p_node);
+
+	if (comp_mask & IB_PIR_COMPMASK_PORTNUM) {
+		if (p_rcvd_rec->port_num < num_ports) {
+			p_physp =
+			    osm_node_get_physp_ptr(p_port->p_node,
+						   p_rcvd_rec->port_num);
+			/* Check that the p_physp is valid, and that the p_physp and the
+			   p_req_physp share a pkey. */
+			if (osm_physp_is_valid(p_physp) &&
+			    osm_physp_share_pkey(p_rcv->p_log, p_req_physp,
+						 p_physp))
+				__osm_sa_pir_check_physp(p_rcv, p_physp,
+							 p_ctxt);
+		}
+	} else {
+		for (port_num = 0; port_num < num_ports; port_num++) {
+			p_physp =
+			    osm_node_get_physp_ptr(p_port->p_node, port_num);
+			if (!osm_physp_is_valid(p_physp))
+				continue;
+
+			/* if the requester and the p_physp don't share a pkey -
+			   continue */
+			if (!osm_physp_share_pkey
+			    (p_rcv->p_log, p_req_physp, p_physp))
+				continue;
+
+			__osm_sa_pir_check_physp(p_rcv, p_physp, p_ctxt);
+		}
+	}
+
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_pir_by_comp_mask_cb(
-  IN cl_map_item_t*        const p_map_item,
-  IN void*                 context )
+__osm_sa_pir_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
+			     IN void *context)
 {
-  const osm_port_t*        const p_port = (osm_port_t*)p_map_item;
-  osm_pir_search_ctxt_t*   const p_ctxt = (osm_pir_search_ctxt_t *)context;
+	const osm_port_t *const p_port = (osm_port_t *) p_map_item;
+	osm_pir_search_ctxt_t *const p_ctxt = (osm_pir_search_ctxt_t *) context;
 
-  __osm_sa_pir_by_comp_mask( p_ctxt->p_rcv, p_port, p_ctxt );
+	__osm_sa_pir_by_comp_mask(p_ctxt->p_rcv, p_port, p_ctxt);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_pir_rcv_process(
-  IN void *ctx,
-  IN void *data )
+void osm_pir_rcv_process(IN void *ctx, IN void *data)
 {
-  osm_pir_rcv_t *p_rcv = 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_madw_t*              p_resp_madw;
-  ib_sa_mad_t*             p_resp_sa_mad;
-  ib_portinfo_record_t*    p_resp_rec;
-  uint32_t                 num_rec, pre_trim_num_rec;
+	osm_pir_rcv_t *p_rcv = 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_madw_t *p_resp_madw;
+	ib_sa_mad_t *p_resp_sa_mad;
+	ib_portinfo_record_t *p_resp_rec;
+	uint32_t num_rec, pre_trim_num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  uint32_t		   trim_num_rec;
+	uint32_t trim_num_rec;
 #endif
-  uint32_t                 i;
-  osm_pir_search_ctxt_t    context;
-  osm_pir_item_t*          p_rec_item;
-  ib_api_status_t          status = IB_SUCCESS;
-  ib_net64_t               comp_mask;
-  osm_physp_t*             p_req_physp;
-  boolean_t                trusted_req = TRUE;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_pir_rcv_process );
-
-  CL_ASSERT( p_madw );
-
-  p_rcvd_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_rcvd_rec = (ib_portinfo_record_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
-  comp_mask = p_rcvd_mad->comp_mask;
-
-  CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_PORTINFO_RECORD );
-
-  /* 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( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_pir_rcv_process: ERR 2105: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_rcvd_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
-
-  /* update the requester physical port. */
-  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-                                          p_rcv->p_subn,
-                                          osm_madw_get_mad_addr_ptr(p_madw) );
-  if (p_req_physp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_pir_rcv_process: ERR 2104: "
-             "Cannot find requester physical port\n" );
-    goto Exit;
-  }
-
-  if ( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    osm_dump_portinfo_record( p_rcv->p_log, p_rcvd_rec, OSM_LOG_DEBUG );
-
-  p_tbl = &p_rcv->p_subn->port_lid_tbl;
-  p_pi = &p_rcvd_rec->port_info;
-
-  cl_qlist_init( &rec_list );
-
-  context.p_rcvd_rec = p_rcvd_rec;
-  context.p_list = &rec_list;
-  context.comp_mask = p_rcvd_mad->comp_mask;
-  context.p_rcv = p_rcv;
-  context.p_req_physp = p_req_physp;
-  context.is_enhanced_comp_mask = cl_ntoh32(p_rcvd_mad->attr_mod) & (1 << 31);
-
-  cl_plock_acquire( p_rcv->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( p_rcv->p_subn, p_rcvd_rec->lid, &p_port );
-    if ( ( status != IB_SUCCESS ) || ( p_port == NULL ) )
-    {
-      status = IB_NOT_FOUND;
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_pir_rcv_process: ERR 2109: "
-               "No port found with LID 0x%x\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( p_rcv->p_log, OSM_LOG_ERROR,
-                 "osm_pir_rcv_process: ERR 2103: "
-                 "Given LID (0x%X) is out of range:0x%X\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( p_rcv, p_port, &context );
-    else
-    {
-      cl_qmap_apply_func( &p_rcv->p_subn->port_guid_tbl,
-                          __osm_sa_pir_by_comp_mask_cb,
-                          &context );
-    }
-  }
-
-  cl_plock_release( p_rcv->p_lock );
-
-  num_rec = cl_qlist_count( &rec_list );
-
-  /*
-   * C15-0.1.30:
-   * If we do a SubnAdmGet and got more than one record it is an error !
-   */
-  if (p_rcvd_mad->method == IB_MAD_METHOD_GET)
-  {
-    if (num_rec == 0)
-    {
-      osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-      goto Exit;
-    }
-    if (num_rec > 1)
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_pir_rcv_process: ERR 2108: "
-               "Got more than one record for SubnAdmGet (%u)\n",
-               num_rec );
-      osm_sa_send_error( p_rcv->p_resp, p_madw,
-                         IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
-
-      /* need to set the mem free ... */
-      p_rec_item = (osm_pir_item_t*)cl_qlist_remove_head( &rec_list );
-      while( p_rec_item != (osm_pir_item_t*)cl_qlist_end( &rec_list ) )
-      {
-        cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-        p_rec_item = (osm_pir_item_t*)cl_qlist_remove_head( &rec_list );
-      }
-
-      goto Exit;
-    }
-  }
-
-  pre_trim_num_rec = num_rec;
+	uint32_t i;
+	osm_pir_search_ctxt_t context;
+	osm_pir_item_t *p_rec_item;
+	ib_api_status_t status = IB_SUCCESS;
+	ib_net64_t comp_mask;
+	osm_physp_t *p_req_physp;
+	boolean_t trusted_req = TRUE;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_pir_rcv_process);
+
+	CL_ASSERT(p_madw);
+
+	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_rcvd_rec =
+	    (ib_portinfo_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+	comp_mask = p_rcvd_mad->comp_mask;
+
+	CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_PORTINFO_RECORD);
+
+	/* 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(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_pir_rcv_process: ERR 2105: "
+			"Unsupported Method (%s)\n",
+			ib_get_sa_method_str(p_rcvd_mad->method));
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
+		goto Exit;
+	}
+
+	/* update the requester physical port. */
+	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+						p_rcv->p_subn,
+						osm_madw_get_mad_addr_ptr
+						(p_madw));
+	if (p_req_physp == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_pir_rcv_process: ERR 2104: "
+			"Cannot find requester physical port\n");
+		goto Exit;
+	}
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
+		osm_dump_portinfo_record(p_rcv->p_log, p_rcvd_rec,
+					 OSM_LOG_DEBUG);
+
+	p_tbl = &p_rcv->p_subn->port_lid_tbl;
+	p_pi = &p_rcvd_rec->port_info;
+
+	cl_qlist_init(&rec_list);
+
+	context.p_rcvd_rec = p_rcvd_rec;
+	context.p_list = &rec_list;
+	context.comp_mask = p_rcvd_mad->comp_mask;
+	context.p_rcv = p_rcv;
+	context.p_req_physp = p_req_physp;
+	context.is_enhanced_comp_mask =
+	    cl_ntoh32(p_rcvd_mad->attr_mod) & (1 << 31);
+
+	cl_plock_acquire(p_rcv->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(p_rcv->p_subn, p_rcvd_rec->lid,
+					     &p_port);
+		if ((status != IB_SUCCESS) || (p_port == NULL)) {
+			status = IB_NOT_FOUND;
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_pir_rcv_process: ERR 2109: "
+				"No port found with LID 0x%x\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(p_rcv->p_log, OSM_LOG_ERROR,
+					"osm_pir_rcv_process: ERR 2103: "
+					"Given LID (0x%X) is out of range:0x%X\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(p_rcv, p_port, &context);
+		else {
+			cl_qmap_apply_func(&p_rcv->p_subn->port_guid_tbl,
+					   __osm_sa_pir_by_comp_mask_cb,
+					   &context);
+		}
+	}
+
+	cl_plock_release(p_rcv->p_lock);
+
+	num_rec = cl_qlist_count(&rec_list);
+
+	/*
+	 * C15-0.1.30:
+	 * If we do a SubnAdmGet and got more than one record it is an error !
+	 */
+	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
+		if (num_rec == 0) {
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_NO_RECORDS);
+			goto Exit;
+		}
+		if (num_rec > 1) {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_pir_rcv_process: ERR 2108: "
+				"Got more than one record for SubnAdmGet (%u)\n",
+				num_rec);
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
+
+			/* need to set the mem free ... */
+			p_rec_item =
+			    (osm_pir_item_t *) cl_qlist_remove_head(&rec_list);
+			while (p_rec_item !=
+			       (osm_pir_item_t *) cl_qlist_end(&rec_list)) {
+				cl_qlock_pool_put(&p_rcv->pool,
+						  &p_rec_item->pool_item);
+				p_rec_item =
+				    (osm_pir_item_t *)
+				    cl_qlist_remove_head(&rec_list);
+			}
+
+			goto Exit;
+		}
+	}
+
+	pre_trim_num_rec = num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  trim_num_rec = (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_portinfo_record_t);
-  if (trim_num_rec < num_rec)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "osm_pir_rcv_process: "
-             "Number of records:%u trimmed to:%u to fit in one MAD\n",
-             num_rec, trim_num_rec );
-    num_rec = trim_num_rec;
-  }
+	trim_num_rec =
+	    (MAD_BLOCK_SIZE -
+	     IB_SA_MAD_HDR_SIZE) / sizeof(ib_portinfo_record_t);
+	if (trim_num_rec < num_rec) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"osm_pir_rcv_process: "
+			"Number of records:%u trimmed to:%u to fit in one MAD\n",
+			num_rec, trim_num_rec);
+		num_rec = trim_num_rec;
+	}
 #endif
 
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "osm_pir_rcv_process: "
-           "Returning %u records\n", num_rec );
-
-  if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
-  {
-    osm_sa_send_error( p_rcv->p_resp, p_madw,
-                       IB_SA_MAD_STATUS_NO_RECORDS );
-    goto Exit;
-  }
-
-  /*
-   * Get a MAD to reply. Address of Mad is in the received mad_wrapper
-   */
-  p_resp_madw = osm_mad_pool_get( p_rcv->p_mad_pool,
-                                  p_madw->h_bind,
-                                  num_rec * sizeof(ib_portinfo_record_t) + IB_SA_MAD_HDR_SIZE,
-                                  &p_madw->mad_addr );
-
-  if( !p_resp_madw )
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_pir_rcv_process: ERR 2106: "
-            "osm_mad_pool_get failed\n" );
-
-    for( i = 0; i < num_rec; i++ )
-    {
-      p_rec_item = (osm_pir_item_t*)cl_qlist_remove_head( &rec_list );
-      cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    }
-
-    osm_sa_send_error( p_rcv->p_resp, p_madw,
-                       IB_SA_MAD_STATUS_NO_RESOURCES );
-
-    goto Exit;
-  }
-
-  p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
-
-  /*
-    Copy the MAD header back into the response mad.
-    Set the 'R' bit and the payload length,
-    Then copy all records from the list into the response payload.
-  */
-
-  memcpy( p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE );
-  p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-  /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
-  p_resp_sa_mad->sm_key = 0;
-  /* Fill in the offset (paylen will be done by the rmpp SAR) */
-  p_resp_sa_mad->attr_offset =
-    ib_get_attr_offset( sizeof(ib_portinfo_record_t) );
-
-  p_resp_rec = (ib_portinfo_record_t*)
-    ib_sa_mad_get_payload_ptr( p_resp_sa_mad );
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"osm_pir_rcv_process: " "Returning %u records\n", num_rec);
+
+	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RECORDS);
+		goto Exit;
+	}
+
+	/*
+	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
+	 */
+	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+				       p_madw->h_bind,
+				       num_rec * sizeof(ib_portinfo_record_t) +
+				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
+
+	if (!p_resp_madw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_pir_rcv_process: ERR 2106: "
+			"osm_mad_pool_get failed\n");
+
+		for (i = 0; i < num_rec; i++) {
+			p_rec_item =
+			    (osm_pir_item_t *) cl_qlist_remove_head(&rec_list);
+			cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		}
+
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RESOURCES);
+
+		goto Exit;
+	}
+
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+
+	/*
+	   Copy the MAD header back into the response mad.
+	   Set the 'R' bit and the payload length,
+	   Then copy all records from the list into the response payload.
+	 */
+
+	memcpy(p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE);
+	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
+	p_resp_sa_mad->sm_key = 0;
+	/* Fill in the offset (paylen will be done by the rmpp SAR) */
+	p_resp_sa_mad->attr_offset =
+	    ib_get_attr_offset(sizeof(ib_portinfo_record_t));
+
+	p_resp_rec = (ib_portinfo_record_t *)
+	    ib_sa_mad_get_payload_ptr(p_resp_sa_mad);
 
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we support only one packet RMPP - so we will set the first and
-     last flags for gettable */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-  {
-    p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST | IB_RMPP_FLAG_ACTIVE;
-  }
+	/* we support only one packet RMPP - so we will set the first and
+	   last flags for gettable */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+		p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
+		p_resp_sa_mad->rmpp_flags =
+		    IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST |
+		    IB_RMPP_FLAG_ACTIVE;
+	}
 #else
-  /* forcefully define the packet as RMPP one */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
+	/* forcefully define the packet as RMPP one */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
+		p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
 #endif
 
-  /*
-    p922 - The M_Key returned shall be zero, except in the case of a
-    trusted request.
-    Note: In the mad controller we check that the SM_Key received on
-    the mad is valid. Meaning - is either zero or equal to the local
-    sm_key.
-  */
-  if (p_rcvd_mad->sm_key == 0)
-    trusted_req = FALSE;
-
-  for( i = 0; i < pre_trim_num_rec; i++ )
-  {
-    p_rec_item = (osm_pir_item_t*)cl_qlist_remove_head( &rec_list );
-    /* copy only if not trimmed */
-    if (i < num_rec)
-    {
-      *p_resp_rec = p_rec_item->rec;
-      if (trusted_req == FALSE)
-        p_resp_rec->port_info.m_key = 0;
-    }
-    cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    p_resp_rec++;
-  }
-
-  CL_ASSERT( cl_is_qlist_empty( &rec_list ) );
-
-  status = osm_vendor_send( p_resp_madw->h_bind, p_resp_madw, FALSE);
-  if (status != IB_SUCCESS)
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_pir_rcv_process: ERR 2107: "
-            "osm_vendor_send status = %s\n",
-            ib_get_err_str(status));
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	/*
+	   p922 - The M_Key returned shall be zero, except in the case of a
+	   trusted request.
+	   Note: In the mad controller we check that the SM_Key received on
+	   the mad is valid. Meaning - is either zero or equal to the local
+	   sm_key.
+	 */
+	if (p_rcvd_mad->sm_key == 0)
+		trusted_req = FALSE;
+
+	for (i = 0; i < pre_trim_num_rec; i++) {
+		p_rec_item = (osm_pir_item_t *) cl_qlist_remove_head(&rec_list);
+		/* copy only if not trimmed */
+		if (i < num_rec) {
+			*p_resp_rec = p_rec_item->rec;
+			if (trusted_req == FALSE)
+				p_resp_rec->port_info.m_key = 0;
+		}
+		cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		p_resp_rec++;
+	}
+
+	CL_ASSERT(cl_is_qlist_empty(&rec_list));
+
+	status = osm_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE);
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_pir_rcv_process: ERR 2107: "
+			"osm_vendor_send status = %s\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_sa_response.c b/opensm/opensm/osm_sa_response.c
index dc614c9..d84b969 100644
--- a/opensm/opensm/osm_sa_response.c
+++ b/opensm/opensm/osm_sa_response.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -59,117 +59,108 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sa_resp_construct(
-  IN osm_sa_resp_t* const p_resp )
+void osm_sa_resp_construct(IN osm_sa_resp_t * const p_resp)
 {
-  memset( p_resp, 0, sizeof(*p_resp) );
+	memset(p_resp, 0, sizeof(*p_resp));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sa_resp_destroy(
-  IN osm_sa_resp_t* const p_resp )
+void osm_sa_resp_destroy(IN osm_sa_resp_t * const p_resp)
 {
-  CL_ASSERT( p_resp );
+	CL_ASSERT(p_resp);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_sa_resp_init(
-  IN osm_sa_resp_t*     const p_resp,
-  IN osm_mad_pool_t*    const p_pool,
-  IN osm_log_t*         const p_log )
+osm_sa_resp_init(IN osm_sa_resp_t * const p_resp,
+		 IN osm_mad_pool_t * const p_pool, IN osm_log_t * const p_log)
 {
-  ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_sa_resp_init );
+	OSM_LOG_ENTER(p_log, osm_sa_resp_init);
 
-  osm_sa_resp_construct( p_resp );
+	osm_sa_resp_construct(p_resp);
 
-  p_resp->p_log = p_log;
-  p_resp->p_pool = p_pool;
+	p_resp->p_log = p_log;
+	p_resp->p_pool = p_pool;
 
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-osm_sa_send_error(
-  IN osm_sa_resp_t*        const p_resp,
-  IN const osm_madw_t*     const p_madw,
-  IN const ib_net16_t      sa_status )
+osm_sa_send_error(IN osm_sa_resp_t * const p_resp,
+		  IN const osm_madw_t * const p_madw,
+		  IN const ib_net16_t sa_status)
 {
-  osm_madw_t*              p_resp_madw;
-  ib_sa_mad_t*             p_resp_sa_mad;
-  ib_sa_mad_t*             p_sa_mad;
-  ib_api_status_t          status;
-
-  OSM_LOG_ENTER( p_resp->p_log, osm_sa_send_error );
-
-  /* avoid races - if we are exiting - exit */
-  if (osm_exit_flag)
-  {
-    osm_log( p_resp->p_log, OSM_LOG_DEBUG,
-             "osm_sa_send_error: "
-             "Ignoring requested send after exit\n" );
-    goto Exit;
-  }
-
-  p_resp_madw = osm_mad_pool_get( p_resp->p_pool,
-                                  p_madw->h_bind, MAD_BLOCK_SIZE, &p_madw->mad_addr );
-
-  if( p_resp_madw == NULL )
-  {
-    osm_log( p_resp->p_log, OSM_LOG_ERROR,
-             "osm_sa_send_error: ERR 2301: "
-             "Unable to acquire response MAD\n" );
-    goto Exit;
-  }
-
-  p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
-
-  /*  Copy the MAD header back into the response mad */
-  *p_resp_sa_mad = *p_sa_mad;
-  p_resp_sa_mad->status = sa_status;
-
-  if( p_resp_sa_mad->method == IB_MAD_METHOD_SET )
-    p_resp_sa_mad->method = IB_MAD_METHOD_GET;
-
-  p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-
-  /*
-   * C15-0.1.5 - always return SM_Key = 0 (table 185 p 884)
-   */
-  p_resp_sa_mad->sm_key = 0;
-
-  /*
-   * o15-0.2.7 - The PathRecord Attribute ID shall be used in
-   * the response (to a SubnAdmGetMulti(MultiPathRecord)
-   */
-  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( p_resp->p_log, OSM_LOG_FRAMES ) )
-    osm_dump_sa_mad( p_resp->p_log, p_resp_sa_mad, OSM_LOG_FRAMES );
-
-  status = osm_vendor_send( osm_madw_get_bind_handle( p_resp_madw ),
-                            p_resp_madw, FALSE );
-
-  if( status != IB_SUCCESS )
-  {
-    osm_log( p_resp->p_log, OSM_LOG_ERROR,
-             "osm_sa_send_error: ERR 2302: "
-             "Error sending MAD (%s)\n", ib_get_err_str( status ) );
-    /*  osm_mad_pool_put( p_resp->p_pool, p_resp_madw ); */
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_resp->p_log );
+	osm_madw_t *p_resp_madw;
+	ib_sa_mad_t *p_resp_sa_mad;
+	ib_sa_mad_t *p_sa_mad;
+	ib_api_status_t status;
+
+	OSM_LOG_ENTER(p_resp->p_log, osm_sa_send_error);
+
+	/* avoid races - if we are exiting - exit */
+	if (osm_exit_flag) {
+		osm_log(p_resp->p_log, OSM_LOG_DEBUG,
+			"osm_sa_send_error: "
+			"Ignoring requested send after exit\n");
+		goto Exit;
+	}
+
+	p_resp_madw = osm_mad_pool_get(p_resp->p_pool,
+				       p_madw->h_bind, MAD_BLOCK_SIZE,
+				       &p_madw->mad_addr);
+
+	if (p_resp_madw == NULL) {
+		osm_log(p_resp->p_log, OSM_LOG_ERROR,
+			"osm_sa_send_error: ERR 2301: "
+			"Unable to acquire response MAD\n");
+		goto Exit;
+	}
+
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+
+	/*  Copy the MAD header back into the response mad */
+	*p_resp_sa_mad = *p_sa_mad;
+	p_resp_sa_mad->status = sa_status;
+
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_SET)
+		p_resp_sa_mad->method = IB_MAD_METHOD_GET;
+
+	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+
+	/*
+	 * C15-0.1.5 - always return SM_Key = 0 (table 185 p 884)
+	 */
+	p_resp_sa_mad->sm_key = 0;
+
+	/*
+	 * o15-0.2.7 - The PathRecord Attribute ID shall be used in
+	 * the response (to a SubnAdmGetMulti(MultiPathRecord)
+	 */
+	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(p_resp->p_log, OSM_LOG_FRAMES))
+		osm_dump_sa_mad(p_resp->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
+
+	status = osm_vendor_send(osm_madw_get_bind_handle(p_resp_madw),
+				 p_resp_madw, FALSE);
+
+	if (status != IB_SUCCESS) {
+		osm_log(p_resp->p_log, OSM_LOG_ERROR,
+			"osm_sa_send_error: ERR 2302: "
+			"Error sending MAD (%s)\n", ib_get_err_str(status));
+		/*  osm_mad_pool_put( p_resp->p_pool, p_resp_madw ); */
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_resp->p_log);
 }
diff --git a/opensm/opensm/osm_sa_service_record.c b/opensm/opensm/osm_sa_service_record.c
index 016909b..89d454a 100644
--- a/opensm/opensm/osm_sa_service_record.c
+++ b/opensm/opensm/osm_sa_service_record.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -69,1138 +69,1028 @@
 #define OSM_SR_RCV_POOL_MIN_SIZE    64
 #define OSM_SR_RCV_POOL_GROW_SIZE   64
 
-typedef  struct   _osm_sr_item
-{
-  cl_pool_item_t        pool_item;
-  ib_service_record_t   service_rec;
+typedef struct _osm_sr_item {
+	cl_pool_item_t pool_item;
+	ib_service_record_t service_rec;
 } osm_sr_item_t;
 
-typedef  struct   osm_sr_match_item {
-  cl_qlist_t            sr_list;
-  ib_service_record_t*  p_service_rec;
-  ib_net64_t            comp_mask;
-  osm_sr_rcv_t*         p_rcv;
+typedef struct osm_sr_match_item {
+	cl_qlist_t sr_list;
+	ib_service_record_t *p_service_rec;
+	ib_net64_t comp_mask;
+	osm_sr_rcv_t *p_rcv;
 
 } osm_sr_match_item_t;
 
-typedef struct _osm_sr_search_ctxt
-{
-  osm_sr_match_item_t *  p_sr_item;
-  const osm_physp_t*     p_req_physp;
+typedef struct _osm_sr_search_ctxt {
+	osm_sr_match_item_t *p_sr_item;
+	const osm_physp_t *p_req_physp;
 } osm_sr_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sr_rcv_construct(
-  IN osm_sr_rcv_t* const p_rcv )
+void osm_sr_rcv_construct(IN osm_sr_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
-  cl_qlock_pool_construct( &p_rcv->sr_pool );
-  cl_timer_construct(&p_rcv->sr_timer );
+	memset(p_rcv, 0, sizeof(*p_rcv));
+	cl_qlock_pool_construct(&p_rcv->sr_pool);
+	cl_timer_construct(&p_rcv->sr_timer);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sr_rcv_destroy(
-  IN osm_sr_rcv_t* const p_rcv )
+void osm_sr_rcv_destroy(IN osm_sr_rcv_t * const p_rcv)
 {
-  OSM_LOG_ENTER( p_rcv->p_log, osm_sr_rcv_destroy );
-  cl_qlock_pool_destroy( &p_rcv->sr_pool );
-  cl_timer_trim(&p_rcv->sr_timer, 1);
-  cl_timer_destroy(&p_rcv->sr_timer );
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_sr_rcv_destroy);
+	cl_qlock_pool_destroy(&p_rcv->sr_pool);
+	cl_timer_trim(&p_rcv->sr_timer, 1);
+	cl_timer_destroy(&p_rcv->sr_timer);
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_sr_rcv_init(
-  IN osm_sr_rcv_t*      const p_rcv,
-  IN osm_sa_resp_t*     const p_resp,
-  IN osm_mad_pool_t*    const p_mad_pool,
-  IN osm_subn_t*        const p_subn,
-  IN osm_log_t*         const p_log,
-  IN cl_plock_t*        const p_lock )
+osm_sr_rcv_init(IN osm_sr_rcv_t * const p_rcv,
+		IN osm_sa_resp_t * const p_resp,
+		IN osm_mad_pool_t * const p_mad_pool,
+		IN osm_subn_t * const p_subn,
+		IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t       status = IB_ERROR;
-  cl_status_t           cl_status;
-
-  OSM_LOG_ENTER( p_log, osm_sr_rcv_init );
-
-  osm_sr_rcv_construct( p_rcv );
-
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_resp = p_resp;
-  p_rcv->p_mad_pool = p_mad_pool;
-
-  cl_status = cl_qlock_pool_init( &p_rcv->sr_pool,
-                                  OSM_SR_RCV_POOL_MIN_SIZE,
-                                  0,
-                                  OSM_SR_RCV_POOL_GROW_SIZE,
-                                  sizeof(osm_sr_item_t),
-                                  NULL, NULL, NULL );
-  if(cl_status != CL_SUCCESS)
-    goto Exit;
-
-  status = cl_timer_init(&p_rcv->sr_timer,
-                         osm_sr_rcv_lease_cb,
-                         p_rcv );
-  if(cl_status != CL_SUCCESS)
-    goto Exit;
-
-  status = IB_SUCCESS;
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	ib_api_status_t status = IB_ERROR;
+	cl_status_t cl_status;
+
+	OSM_LOG_ENTER(p_log, osm_sr_rcv_init);
+
+	osm_sr_rcv_construct(p_rcv);
+
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_resp = p_resp;
+	p_rcv->p_mad_pool = p_mad_pool;
+
+	cl_status = cl_qlock_pool_init(&p_rcv->sr_pool,
+				       OSM_SR_RCV_POOL_MIN_SIZE,
+				       0,
+				       OSM_SR_RCV_POOL_GROW_SIZE,
+				       sizeof(osm_sr_item_t), NULL, NULL, NULL);
+	if (cl_status != CL_SUCCESS)
+		goto Exit;
+
+	status = cl_timer_init(&p_rcv->sr_timer, osm_sr_rcv_lease_cb, p_rcv);
+	if (cl_status != CL_SUCCESS)
+		goto Exit;
+
+	status = IB_SUCCESS;
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static boolean_t
-__match_service_pkey_with_ports_pkey(
-  IN osm_sr_rcv_t*         const p_rcv,
-  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_sr_rcv_t * const p_rcv,
+				     IN const osm_madw_t * const p_madw,
+				     ib_service_record_t * const 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(p_rcv->p_log,
-                                          p_rcv->p_subn,
-                                          osm_madw_get_mad_addr_ptr(p_madw));
-  if (p_req_physp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__match_service_pkey_with_ports_pkey: ERR 2404: "
-             "Cannot find requester physical port\n" );
-    valid = FALSE;
-    goto Exit;
-  }
-
-  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) */
-    /* Make sure it matches the p_req_physp */
-    if (!osm_physp_has_pkey(p_rcv->p_log, p_service_rec->service_pkey, p_req_physp))
-    {
-      valid = FALSE;
-      goto Exit;
-    }
-
-    /* Make sure it matches the port of the ServiceGid */
-    if((comp_mask & IB_SR_COMPMASK_SGID) == IB_SR_COMPMASK_SGID)
-    {
-      service_guid = p_service_rec->service_gid.unicast.interface_id;
-      service_port = osm_get_port_by_guid(p_rcv->p_subn, service_guid);
-      if (!service_port)
-      {
-        osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-                 "__match_service_pkey_with_ports_pkey: ERR 2405: "
-                 "No port object for port 0x%016" PRIx64 "\n",
-                 cl_ntoh64( service_guid ) );
-        valid = FALSE;
-        goto Exit;
-      }
-      /* check on the table of the default physical port of the service port */
-      if ( !osm_physp_has_pkey( p_rcv->p_log,
-                                p_service_rec->service_pkey,
-                                service_port->p_physp ) )
-      {
-        valid = FALSE;
-        goto Exit;
-      }
-    }
-  }
-
- Exit:
-  return valid;
+	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(p_rcv->p_log,
+						p_rcv->p_subn,
+						osm_madw_get_mad_addr_ptr
+						(p_madw));
+	if (p_req_physp == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__match_service_pkey_with_ports_pkey: ERR 2404: "
+			"Cannot find requester physical port\n");
+		valid = FALSE;
+		goto Exit;
+	}
+
+	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) */
+		/* Make sure it matches the p_req_physp */
+		if (!osm_physp_has_pkey
+		    (p_rcv->p_log, p_service_rec->service_pkey, p_req_physp)) {
+			valid = FALSE;
+			goto Exit;
+		}
+
+		/* Make sure it matches the port of the ServiceGid */
+		if ((comp_mask & IB_SR_COMPMASK_SGID) == IB_SR_COMPMASK_SGID) {
+			service_guid =
+			    p_service_rec->service_gid.unicast.interface_id;
+			service_port =
+			    osm_get_port_by_guid(p_rcv->p_subn, service_guid);
+			if (!service_port) {
+				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+					"__match_service_pkey_with_ports_pkey: ERR 2405: "
+					"No port object for port 0x%016" PRIx64
+					"\n", cl_ntoh64(service_guid));
+				valid = FALSE;
+				goto Exit;
+			}
+			/* check on the table of the default physical port of the service port */
+			if (!osm_physp_has_pkey(p_rcv->p_log,
+						p_service_rec->service_pkey,
+						service_port->p_physp)) {
+				valid = FALSE;
+				goto Exit;
+			}
+		}
+	}
+
+      Exit:
+	return valid;
 }
 
 /**********************************************************************
  **********************************************************************/
 boolean_t
-__match_name_to_key_association(
-  IN osm_sr_rcv_t*      const p_rcv,
-  ib_service_record_t*  p_service_rec,
-  ib_net64_t            comp_mask )
+__match_name_to_key_association(IN osm_sr_rcv_t * const p_rcv,
+				ib_service_record_t * p_service_rec,
+				ib_net64_t comp_mask)
 {
-  UNUSED_PARAM( p_service_rec );
-  UNUSED_PARAM( p_rcv );
-
-  if( (comp_mask & (IB_SR_COMPMASK_SKEY | IB_SR_COMPMASK_SNAME)) ==
-      (IB_SR_COMPMASK_SKEY | IB_SR_COMPMASK_SNAME) )
-  {
-    /* For now, we are not maintaining the ServiceAssociation record
-     * so just return TRUE
-     */
-    return TRUE;
-  }
-
-  return TRUE;
+	UNUSED_PARAM(p_service_rec);
+	UNUSED_PARAM(p_rcv);
+
+	if ((comp_mask & (IB_SR_COMPMASK_SKEY | IB_SR_COMPMASK_SNAME)) ==
+	    (IB_SR_COMPMASK_SKEY | IB_SR_COMPMASK_SNAME)) {
+		/* For now, we are not maintaining the ServiceAssociation record
+		 * so just return TRUE
+		 */
+		return TRUE;
+	}
+
+	return TRUE;
 }
 
 /**********************************************************************
  **********************************************************************/
 static boolean_t
-__validate_sr(
-  IN osm_sr_rcv_t*         const p_rcv,
-  IN const osm_madw_t*     const p_madw )
+__validate_sr(IN osm_sr_rcv_t * const p_rcv, IN const osm_madw_t * const p_madw)
 {
-  boolean_t                valid = TRUE;
-  ib_sa_mad_t *            p_sa_mad;
-  ib_service_record_t*     p_recvd_service_rec;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __validate_sr );
-
-  p_sa_mad = osm_madw_get_sa_mad_ptr( 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(
-    p_rcv,
-    p_madw,
-    p_recvd_service_rec,
-    p_sa_mad->comp_mask );
-
-  if(!valid)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__validate_sr: "
-             "No Match for Service Pkey\n" );
-    valid = FALSE;
-    goto Exit;
-  }
-
-  valid = __match_name_to_key_association(
-    p_rcv,
-    p_recvd_service_rec,
-    p_sa_mad->comp_mask );
-
-  if(!valid)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__validate_sr: "
-             "Service Record Name to key matching failed\n" );
-    valid = FALSE;
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return valid;
+	boolean_t valid = TRUE;
+	ib_sa_mad_t *p_sa_mad;
+	ib_service_record_t *p_recvd_service_rec;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __validate_sr);
+
+	p_sa_mad = osm_madw_get_sa_mad_ptr(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(p_rcv,
+						     p_madw,
+						     p_recvd_service_rec,
+						     p_sa_mad->comp_mask);
+
+	if (!valid) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__validate_sr: " "No Match for Service Pkey\n");
+		valid = FALSE;
+		goto Exit;
+	}
+
+	valid = __match_name_to_key_association(p_rcv,
+						p_recvd_service_rec,
+						p_sa_mad->comp_mask);
+
+	if (!valid) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__validate_sr: "
+			"Service Record Name to key matching failed\n");
+		valid = FALSE;
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return valid;
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sr_rcv_respond(
-  IN osm_sr_rcv_t*         const p_rcv,
-  IN const osm_madw_t*     const p_madw,
-  IN cl_qlist_t*           const p_list )
+__osm_sr_rcv_respond(IN osm_sr_rcv_t * const p_rcv,
+		     IN const osm_madw_t * const p_madw,
+		     IN cl_qlist_t * const p_list)
 {
-  osm_madw_t*              p_resp_madw;
-  const ib_sa_mad_t*       p_sa_mad;
-  ib_sa_mad_t*             p_resp_sa_mad;
-  uint32_t                 num_rec, num_copied;
+	osm_madw_t *p_resp_madw;
+	const ib_sa_mad_t *p_sa_mad;
+	ib_sa_mad_t *p_resp_sa_mad;
+	uint32_t num_rec, num_copied;
 #ifndef VENDOR_RMPP_SUPPORT
-  uint32_t		   trim_num_rec;
+	uint32_t trim_num_rec;
 #endif
-  ib_service_record_t*     p_resp_sr;
-  ib_api_status_t          status;
-  osm_sr_item_t*           p_sr_item;
-  const ib_sa_mad_t*       p_rcvd_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  boolean_t                trusted_req = TRUE;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_sr_rcv_respond );
-
-  num_rec = cl_qlist_count( p_list );
-
-  /*
-   * C15-0.1.30:
-   * If we do a SubnAdmGet and got more than one record it is an error !
-   */
-  if ( (p_rcvd_mad->method == IB_MAD_METHOD_GET) &&
-       (num_rec > 1)) {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_sr_rcv_respond: ERR 2406: "
-             "Got more than one record for SubnAdmGet (%u).\n",
-             num_rec );
-    osm_sa_send_error( p_rcv->p_resp, p_madw,
-                       IB_SA_MAD_STATUS_TOO_MANY_RECORDS );
-
-    /* need to set the mem free ... */
-    p_sr_item = (osm_sr_item_t*)cl_qlist_remove_head( p_list );
-    while( p_sr_item != (osm_sr_item_t*)cl_qlist_end( p_list ) )
-    {
-      cl_qlock_pool_put( &p_rcv->sr_pool, &p_sr_item->pool_item );
-      p_sr_item = (osm_sr_item_t*)cl_qlist_remove_head( p_list );
-    }
-
-    goto Exit;
-  }
-
+	ib_service_record_t *p_resp_sr;
+	ib_api_status_t status;
+	osm_sr_item_t *p_sr_item;
+	const ib_sa_mad_t *p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	boolean_t trusted_req = TRUE;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_sr_rcv_respond);
+
+	num_rec = cl_qlist_count(p_list);
+
+	/*
+	 * C15-0.1.30:
+	 * If we do a SubnAdmGet and got more than one record it is an error !
+	 */
+	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec > 1)) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_sr_rcv_respond: ERR 2406: "
+			"Got more than one record for SubnAdmGet (%u).\n",
+			num_rec);
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
+
+		/* need to set the mem free ... */
+		p_sr_item = (osm_sr_item_t *) cl_qlist_remove_head(p_list);
+		while (p_sr_item != (osm_sr_item_t *) cl_qlist_end(p_list)) {
+			cl_qlock_pool_put(&p_rcv->sr_pool,
+					  &p_sr_item->pool_item);
+			p_sr_item =
+			    (osm_sr_item_t *) cl_qlist_remove_head(p_list);
+		}
+
+		goto Exit;
+	}
 #ifndef VENDOR_RMPP_SUPPORT
-  trim_num_rec = (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_service_record_t);
-  if (trim_num_rec < num_rec)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "__osm_sr_rcv_respond: "
-             "Number of records:%u trimmed to:%u to fit in one MAD\n",
-             num_rec, trim_num_rec );
-    num_rec = trim_num_rec;
-  }
+	trim_num_rec =
+	    (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_service_record_t);
+	if (trim_num_rec < num_rec) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"__osm_sr_rcv_respond: "
+			"Number of records:%u trimmed to:%u to fit in one MAD\n",
+			num_rec, trim_num_rec);
+		num_rec = trim_num_rec;
+	}
 #endif
 
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_sr_rcv_respond: "
-             "Generating response with %u records\n", num_rec );
-  }
-
-  /*
-    Get a MAD to reply. Address of Mad is in the received mad_wrapper
-  */
-  p_resp_madw = osm_mad_pool_get( p_rcv->p_mad_pool,
-                                  p_madw->h_bind,
-                                  num_rec * sizeof(ib_service_record_t) + IB_SA_MAD_HDR_SIZE,
-                                  &p_madw->mad_addr );
-  if( !p_resp_madw )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_sr_rcv_respond: ERR 2402: "
-             "Unable to allocate MAD\n" );
-    /* Release the quick pool items */
-    p_sr_item = (osm_sr_item_t*)cl_qlist_remove_head( p_list );
-    while( p_sr_item != (osm_sr_item_t*)cl_qlist_end( p_list ) )
-    {
-      cl_qlock_pool_put( &p_rcv->sr_pool, &p_sr_item->pool_item );
-      p_sr_item = (osm_sr_item_t*)cl_qlist_remove_head( p_list );
-    }
-
-    goto Exit;
-  }
-
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
-
-  memcpy( p_resp_sa_mad, p_sa_mad, IB_SA_MAD_HDR_SIZE );
-
-  /* but what if it was a SET ? setting the response bit is not enough */
-  if (p_rcvd_mad->method == IB_MAD_METHOD_SET)
-  {
-    p_resp_sa_mad->method = IB_MAD_METHOD_GET;
-  }
-  p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-  /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
-  p_resp_sa_mad->sm_key = 0;
-
-  /* Fill in the offset (paylen will be done by the rmpp SAR) */
-  p_resp_sa_mad->attr_offset =
-    ib_get_attr_offset( sizeof(ib_service_record_t) );
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_sr_rcv_respond: "
+			"Generating response with %u records\n", num_rec);
+	}
+
+	/*
+	   Get a MAD to reply. Address of Mad is in the received mad_wrapper
+	 */
+	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+				       p_madw->h_bind,
+				       num_rec * sizeof(ib_service_record_t) +
+				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
+	if (!p_resp_madw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_sr_rcv_respond: ERR 2402: "
+			"Unable to allocate MAD\n");
+		/* Release the quick pool items */
+		p_sr_item = (osm_sr_item_t *) cl_qlist_remove_head(p_list);
+		while (p_sr_item != (osm_sr_item_t *) cl_qlist_end(p_list)) {
+			cl_qlock_pool_put(&p_rcv->sr_pool,
+					  &p_sr_item->pool_item);
+			p_sr_item =
+			    (osm_sr_item_t *) cl_qlist_remove_head(p_list);
+		}
+
+		goto Exit;
+	}
+
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+
+	memcpy(p_resp_sa_mad, p_sa_mad, IB_SA_MAD_HDR_SIZE);
+
+	/* but what if it was a SET ? setting the response bit is not enough */
+	if (p_rcvd_mad->method == IB_MAD_METHOD_SET) {
+		p_resp_sa_mad->method = IB_MAD_METHOD_GET;
+	}
+	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
+	p_resp_sa_mad->sm_key = 0;
+
+	/* Fill in the offset (paylen will be done by the rmpp SAR) */
+	p_resp_sa_mad->attr_offset =
+	    ib_get_attr_offset(sizeof(ib_service_record_t));
 
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we support only one packet RMPP - so we will set the first and
-     last flags for gettable */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-  {
-    p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST | IB_RMPP_FLAG_ACTIVE;
-  }
+	/* we support only one packet RMPP - so we will set the first and
+	   last flags for gettable */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+		p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
+		p_resp_sa_mad->rmpp_flags =
+		    IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST |
+		    IB_RMPP_FLAG_ACTIVE;
+	}
 #else
-  /* forcefully define the packet as RMPP one */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
+	/* forcefully define the packet as RMPP one */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
+		p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
 #endif
 
-  p_resp_sr = (ib_service_record_t*)ib_sa_mad_get_payload_ptr( p_resp_sa_mad );
-
-  if( (p_resp_sa_mad->method != IB_MAD_METHOD_GETTABLE_RESP) &&
-      (num_rec == 0))
-  {
-    p_resp_sa_mad->status = IB_SA_MAD_STATUS_NO_RECORDS;
-    memset( p_resp_sr, 0, sizeof(*p_resp_sr) );
-  }
-  else
-  {
-    /*
-      p923 - The ServiceKey shall be set to 0, except in the case of a trusted
-      request.
-      Note: In the mad controller we check that the SM_Key received on
-      the mad is valid. Meaning - is either zero or equal to the local
-      sm_key.
-    */
-    if (p_sa_mad->sm_key == 0)
-      trusted_req = FALSE;
-
-    p_sr_item = (osm_sr_item_t*)cl_qlist_remove_head( p_list );
-
-    /* we need to track the number of copied items so we can
-     * stop the copy - but clear them all
-     */
-    num_copied = 0;
-    while( p_sr_item != (osm_sr_item_t*)cl_qlist_end( p_list ) )
-    {
-      /*  Copy the Link Records from the list into the MAD */
-      if (num_copied < num_rec)
-      {
-        *p_resp_sr = p_sr_item->service_rec;
-        if (trusted_req == FALSE)
-          memset(p_resp_sr->service_key, 0, sizeof(p_resp_sr->service_key));
-
-        num_copied++;
-      }
-      cl_qlock_pool_put( &p_rcv->sr_pool, &p_sr_item->pool_item );
-      p_resp_sr++;
-      p_sr_item = (osm_sr_item_t*)cl_qlist_remove_head( p_list );
-    }
-  }
-
-  status = osm_vendor_send( p_resp_madw->h_bind, p_resp_madw,  FALSE );
-
-  if( status != IB_SUCCESS )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_sr_rcv_respond: ERR 2407: "
-             "Unable to send MAD (%s)\n", ib_get_err_str( status ) );
-    /*  osm_mad_pool_put( p_rcv->p_mad_pool, p_resp_madw ); */
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	p_resp_sr =
+	    (ib_service_record_t *) ib_sa_mad_get_payload_ptr(p_resp_sa_mad);
+
+	if ((p_resp_sa_mad->method != IB_MAD_METHOD_GETTABLE_RESP) &&
+	    (num_rec == 0)) {
+		p_resp_sa_mad->status = IB_SA_MAD_STATUS_NO_RECORDS;
+		memset(p_resp_sr, 0, sizeof(*p_resp_sr));
+	} else {
+		/*
+		   p923 - The ServiceKey shall be set to 0, except in the case of a trusted
+		   request.
+		   Note: In the mad controller we check that the SM_Key received on
+		   the mad is valid. Meaning - is either zero or equal to the local
+		   sm_key.
+		 */
+		if (p_sa_mad->sm_key == 0)
+			trusted_req = FALSE;
+
+		p_sr_item = (osm_sr_item_t *) cl_qlist_remove_head(p_list);
+
+		/* we need to track the number of copied items so we can
+		 * stop the copy - but clear them all
+		 */
+		num_copied = 0;
+		while (p_sr_item != (osm_sr_item_t *) cl_qlist_end(p_list)) {
+			/*  Copy the Link Records from the list into the MAD */
+			if (num_copied < num_rec) {
+				*p_resp_sr = p_sr_item->service_rec;
+				if (trusted_req == FALSE)
+					memset(p_resp_sr->service_key, 0,
+					       sizeof(p_resp_sr->service_key));
+
+				num_copied++;
+			}
+			cl_qlock_pool_put(&p_rcv->sr_pool,
+					  &p_sr_item->pool_item);
+			p_resp_sr++;
+			p_sr_item =
+			    (osm_sr_item_t *) cl_qlist_remove_head(p_list);
+		}
+	}
+
+	status = osm_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE);
+
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_sr_rcv_respond: ERR 2407: "
+			"Unable to send MAD (%s)\n", ib_get_err_str(status));
+		/*  osm_mad_pool_put( p_rcv->p_mad_pool, p_resp_madw ); */
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__get_matching_sr(
-  IN  cl_list_item_t* const   p_list_item,
-  IN  void*                   context )
+__get_matching_sr(IN cl_list_item_t * const p_list_item, IN void *context)
 {
-  osm_sr_search_ctxt_t* const p_ctxt = (osm_sr_search_ctxt_t*)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(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(
-      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(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(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(
-      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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(p_sr_item->p_service_rec->service_data64[1]!=
-       p_svcr->service_record.service_data64[1])
-      return;
-  }
-
-  /* Check that the requester port has the pkey which is the service_pkey.
-     If not - then it cannot receive this ServiceRecord. */
-  /* The check is relevant only if the service_pkey is valid */
-  if (!ib_pkey_is_invalid(p_svcr->service_record.service_pkey))
-  {
-    if (!osm_physp_has_pkey( p_sr_item->p_rcv->p_log,
-                             p_svcr->service_record.service_pkey,
-                             p_req_physp ) )
-    {
-      osm_log( p_sr_item->p_rcv->p_log, OSM_LOG_VERBOSE,
-               "__get_matching_sr: "
-               "requester port doesn't have the service_pkey: 0x%X\n",
-               cl_ntoh16(p_svcr->service_record.service_pkey) );
-      return;
-    }
-  }
-
-  p_sr_pool_item = (osm_sr_item_t*)cl_qlock_pool_get( &p_sr_item->p_rcv->sr_pool );
-
-  if( p_sr_pool_item == NULL )
-  {
-    osm_log( p_sr_item->p_rcv->p_log, OSM_LOG_ERROR,
-             "__get_matching_sr: ERR 2408: "
-             "Unable to acquire Service Record from pool\n" );
-    goto Exit;
-  }
-
-  p_sr_pool_item->service_rec = p_svcr->service_record;
-
-  cl_qlist_insert_tail( &p_sr_item->sr_list,
-                        (cl_list_item_t*)&p_sr_pool_item->pool_item );
-
- Exit:
-  return;
+	osm_sr_search_ctxt_t *const p_ctxt = (osm_sr_search_ctxt_t *) 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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (p_sr_item->p_service_rec->service_data64[1] !=
+		    p_svcr->service_record.service_data64[1])
+			return;
+	}
+
+	/* Check that the requester port has the pkey which is the service_pkey.
+	   If not - then it cannot receive this ServiceRecord. */
+	/* The check is relevant only if the service_pkey is valid */
+	if (!ib_pkey_is_invalid(p_svcr->service_record.service_pkey)) {
+		if (!osm_physp_has_pkey(p_sr_item->p_rcv->p_log,
+					p_svcr->service_record.service_pkey,
+					p_req_physp)) {
+			osm_log(p_sr_item->p_rcv->p_log, OSM_LOG_VERBOSE,
+				"__get_matching_sr: "
+				"requester port doesn't have the service_pkey: 0x%X\n",
+				cl_ntoh16(p_svcr->service_record.service_pkey));
+			return;
+		}
+	}
+
+	p_sr_pool_item =
+	    (osm_sr_item_t *) cl_qlock_pool_get(&p_sr_item->p_rcv->sr_pool);
+
+	if (p_sr_pool_item == NULL) {
+		osm_log(p_sr_item->p_rcv->p_log, OSM_LOG_ERROR,
+			"__get_matching_sr: ERR 2408: "
+			"Unable to acquire Service Record from pool\n");
+		goto Exit;
+	}
+
+	p_sr_pool_item->service_rec = p_svcr->service_record;
+
+	cl_qlist_insert_tail(&p_sr_item->sr_list,
+			     (cl_list_item_t *) & p_sr_pool_item->pool_item);
+
+      Exit:
+	return;
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-osm_sr_rcv_process_get_method(
-  IN osm_sr_rcv_t*         const p_rcv,
-  IN const osm_madw_t*     const p_madw )
+osm_sr_rcv_process_get_method(IN osm_sr_rcv_t * const p_rcv,
+			      IN const osm_madw_t * const p_madw)
 {
-  ib_sa_mad_t *            p_sa_mad;
-  ib_service_record_t*     p_recvd_service_rec;
-  osm_sr_match_item_t      sr_match_item;
-  osm_sr_search_ctxt_t     context;
-  osm_physp_t*             p_req_physp;
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_sr_rcv_process_get_method );
-
-  CL_ASSERT( p_madw );
-
-  /* update the requester physical port. */
-  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-                                          p_rcv->p_subn,
-                                          osm_madw_get_mad_addr_ptr(p_madw) );
-  if (p_req_physp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_sr_rcv_process_get_method: ERR 2409: "
-             "Cannot find requester physical port\n" );
-    goto Exit;
-  }
-
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_recvd_service_rec =
-    (ib_service_record_t*)ib_sa_mad_get_payload_ptr( p_sa_mad );
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_dump_service_record( p_rcv->p_log,
-                             p_recvd_service_rec,
-                             OSM_LOG_DEBUG );
-  }
-
-  cl_qlist_init(&sr_match_item.sr_list);
-  sr_match_item.p_service_rec = p_recvd_service_rec;
-  sr_match_item.comp_mask = p_sa_mad->comp_mask;
-  sr_match_item.p_rcv = p_rcv;
-
-  context.p_sr_item = &sr_match_item;
-  context.p_req_physp = p_req_physp;
-
-  /* Grab the lock */
-  cl_plock_excl_acquire(p_rcv->p_lock);
-
-  cl_qlist_apply_func(&p_rcv->p_subn->sa_sr_list,
-                      __get_matching_sr,
-                      &context);
-
-  cl_plock_release(p_rcv->p_lock);
-
-  if ((p_sa_mad->method == IB_MAD_METHOD_GET) &&
-     (cl_qlist_count( &sr_match_item.sr_list ) == 0))
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_sr_rcv_process_get_method: "
-             "No records matched the Service Record query\n");
-
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-    goto Exit;
-  }
-
-  __osm_sr_rcv_respond( p_rcv, p_madw, &sr_match_item.sr_list );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return;
+	ib_sa_mad_t *p_sa_mad;
+	ib_service_record_t *p_recvd_service_rec;
+	osm_sr_match_item_t sr_match_item;
+	osm_sr_search_ctxt_t context;
+	osm_physp_t *p_req_physp;
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_sr_rcv_process_get_method);
+
+	CL_ASSERT(p_madw);
+
+	/* update the requester physical port. */
+	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+						p_rcv->p_subn,
+						osm_madw_get_mad_addr_ptr
+						(p_madw));
+	if (p_req_physp == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_sr_rcv_process_get_method: ERR 2409: "
+			"Cannot find requester physical port\n");
+		goto Exit;
+	}
+
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_recvd_service_rec =
+	    (ib_service_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_dump_service_record(p_rcv->p_log,
+					p_recvd_service_rec, OSM_LOG_DEBUG);
+	}
+
+	cl_qlist_init(&sr_match_item.sr_list);
+	sr_match_item.p_service_rec = p_recvd_service_rec;
+	sr_match_item.comp_mask = p_sa_mad->comp_mask;
+	sr_match_item.p_rcv = p_rcv;
+
+	context.p_sr_item = &sr_match_item;
+	context.p_req_physp = p_req_physp;
+
+	/* Grab the lock */
+	cl_plock_excl_acquire(p_rcv->p_lock);
+
+	cl_qlist_apply_func(&p_rcv->p_subn->sa_sr_list,
+			    __get_matching_sr, &context);
+
+	cl_plock_release(p_rcv->p_lock);
+
+	if ((p_sa_mad->method == IB_MAD_METHOD_GET) &&
+	    (cl_qlist_count(&sr_match_item.sr_list) == 0)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"osm_sr_rcv_process_get_method: "
+			"No records matched the Service Record query\n");
+
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RECORDS);
+		goto Exit;
+	}
+
+	__osm_sr_rcv_respond(p_rcv, p_madw, &sr_match_item.sr_list);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return;
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-osm_sr_rcv_process_set_method(
-  IN osm_sr_rcv_t*         const p_rcv,
-  IN const osm_madw_t*     const p_madw )
+osm_sr_rcv_process_set_method(IN osm_sr_rcv_t * const p_rcv,
+			      IN const osm_madw_t * const p_madw)
 {
-  ib_sa_mad_t *            p_sa_mad;
-  ib_net16_t               sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-  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;
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_sr_rcv_process_set_method );
-
-  CL_ASSERT( p_madw );
-
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  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( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_dump_service_record( p_rcv->p_log,
-                             p_recvd_service_rec,
-                             OSM_LOG_DEBUG );
-  }
-
-  if( (comp_mask & ( IB_SR_COMPMASK_SID | IB_SR_COMPMASK_SGID )) !=
-      (IB_SR_COMPMASK_SID | IB_SR_COMPMASK_SGID ))
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "osm_sr_rcv_process_set_method: "
-             "Component Mask RID check failed for METHOD_SET\n");
-    osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
-    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)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_sr_rcv_process_set_method: "
-             "ServiceLease Component Mask not set - using infinite lease\n");
-    p_recvd_service_rec->service_lease = 0xFFFFFFFF;
-  }
-
-  /* Grab the lock */
-  cl_plock_excl_acquire(p_rcv->p_lock);
-
-  /* If Record exists with matching RID */
-  p_svcr = osm_svcr_get_by_rid(
-    p_rcv->p_subn,
-    p_rcv->p_log,
-    p_recvd_service_rec );
-
-  if(p_svcr == NULL)
-  {
-    /* Create the instance of the osm_svcr_t object */
-    p_svcr = osm_svcr_new(p_recvd_service_rec);
-    if(p_svcr == NULL)
-    {
-      cl_plock_release(p_rcv->p_lock);
-
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_sr_rcv_process_set_method: ERR 2411: "
-               "osm_svcr_get_by_rid failed\n" );
-
-      osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES );
-      goto Exit;
-    }
-
-    /* Add this new osm_svcr_t object to subnet object */
-    osm_svcr_insert_to_db(
-      p_rcv->p_subn,
-      p_rcv->p_log,
-      p_svcr );
-
-  }
-  else
-  {
-    /* Update the old instance of the osm_svcr_t object */
-    osm_svcr_init(p_svcr, p_recvd_service_rec);
-  }
-
-  cl_plock_release(p_rcv->p_lock);
-
-  if( p_recvd_service_rec->service_lease != 0xFFFFFFFF )
-  {
+	ib_sa_mad_t *p_sa_mad;
+	ib_net16_t sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
+	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;
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_sr_rcv_process_set_method);
+
+	CL_ASSERT(p_madw);
+
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	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(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_dump_service_record(p_rcv->p_log,
+					p_recvd_service_rec, OSM_LOG_DEBUG);
+	}
+
+	if ((comp_mask & (IB_SR_COMPMASK_SID | IB_SR_COMPMASK_SGID)) !=
+	    (IB_SR_COMPMASK_SID | IB_SR_COMPMASK_SGID)) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"osm_sr_rcv_process_set_method: "
+			"Component Mask RID check failed for METHOD_SET\n");
+		osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+		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) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"osm_sr_rcv_process_set_method: "
+			"ServiceLease Component Mask not set - using infinite lease\n");
+		p_recvd_service_rec->service_lease = 0xFFFFFFFF;
+	}
+
+	/* Grab the lock */
+	cl_plock_excl_acquire(p_rcv->p_lock);
+
+	/* If Record exists with matching RID */
+	p_svcr = osm_svcr_get_by_rid(p_rcv->p_subn,
+				     p_rcv->p_log, p_recvd_service_rec);
+
+	if (p_svcr == NULL) {
+		/* Create the instance of the osm_svcr_t object */
+		p_svcr = osm_svcr_new(p_recvd_service_rec);
+		if (p_svcr == NULL) {
+			cl_plock_release(p_rcv->p_lock);
+
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_sr_rcv_process_set_method: ERR 2411: "
+				"osm_svcr_get_by_rid failed\n");
+
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_NO_RESOURCES);
+			goto Exit;
+		}
+
+		/* Add this new osm_svcr_t object to subnet object */
+		osm_svcr_insert_to_db(p_rcv->p_subn, p_rcv->p_log, p_svcr);
+
+	} else {
+		/* Update the old instance of the osm_svcr_t object */
+		osm_svcr_init(p_svcr, p_recvd_service_rec);
+	}
+
+	cl_plock_release(p_rcv->p_lock);
+
+	if (p_recvd_service_rec->service_lease != 0xFFFFFFFF) {
 #if 0
-    cl_timer_trim(&p_rcv->sr_timer,
-                  p_recvd_service_rec->service_lease * 1000);
+		cl_timer_trim(&p_rcv->sr_timer,
+			      p_recvd_service_rec->service_lease * 1000);
 #endif
-    /*  This was a bug since no check was made to see if too long */
-    /*  just make sure the timer works - get a call back within a second */
-    cl_timer_trim(&p_rcv->sr_timer, 1000);
-    p_svcr->modified_time = cl_get_time_stamp_sec();
-  }
-
-  p_sr_item = (osm_sr_item_t*)cl_qlock_pool_get( &p_rcv->sr_pool );
-  if( p_sr_item == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_sr_rcv_process_set_method: ERR 2412: "
-             "Unable to acquire Service record\n" );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES );
-    goto Exit;
-  }
-
-  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, (cl_list_item_t*)&p_sr_item->pool_item );
-
-  __osm_sr_rcv_respond( p_rcv, p_madw, &sr_list );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return;
+		/*  This was a bug since no check was made to see if too long */
+		/*  just make sure the timer works - get a call back within a second */
+		cl_timer_trim(&p_rcv->sr_timer, 1000);
+		p_svcr->modified_time = cl_get_time_stamp_sec();
+	}
+
+	p_sr_item = (osm_sr_item_t *) cl_qlock_pool_get(&p_rcv->sr_pool);
+	if (p_sr_item == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_sr_rcv_process_set_method: ERR 2412: "
+			"Unable to acquire Service record\n");
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RESOURCES);
+		goto Exit;
+	}
+
+	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,
+			     (cl_list_item_t *) & p_sr_item->pool_item);
+
+	__osm_sr_rcv_respond(p_rcv, p_madw, &sr_list);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return;
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-osm_sr_rcv_process_delete_method(
-  IN osm_sr_rcv_t*         const p_rcv,
-  IN const osm_madw_t*     const p_madw )
+osm_sr_rcv_process_delete_method(IN osm_sr_rcv_t * const p_rcv,
+				 IN const osm_madw_t * const 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;
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_sr_rcv_process_delete_method );
-
-  CL_ASSERT( p_madw );
-
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  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( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_dump_service_record( p_rcv->p_log,
-                             p_recvd_service_rec,
-                             OSM_LOG_DEBUG );
-  }
-
-  /* Grab the lock */
-  cl_plock_excl_acquire(p_rcv->p_lock);
-
-  /* If Record exists with matching RID */
-  p_svcr = osm_svcr_get_by_rid(
-    p_rcv->p_subn,
-    p_rcv->p_log,
-    p_recvd_service_rec );
-
-  if(p_svcr == NULL)
-  {
-    cl_plock_release(p_rcv->p_lock);
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_sr_rcv_process_delete_method: "
-             "No records matched the RID\n");
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-    goto Exit;
-  }
-  else
-  {
-    osm_svcr_remove_from_db(p_rcv->p_subn,
-                            p_rcv->p_log,
-                            p_svcr );
-  }
-
-  cl_plock_release(p_rcv->p_lock);
-
-  p_sr_item = (osm_sr_item_t*)cl_qlock_pool_get( &p_rcv->sr_pool );
-  if( p_sr_item == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_sr_rcv_process_delete_method: ERR 2413: "
-             "Unable to acquire Service record\n");
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES );
-    goto Exit;
-  }
-
-  /* provide back the copy of the record */
-  p_sr_item->service_rec = p_svcr->service_record;
-  cl_qlist_init(&sr_list);
-
-  cl_qlist_insert_tail( &sr_list, (cl_list_item_t*)&p_sr_item->pool_item );
-
-  if(p_svcr)
-    osm_svcr_delete(p_svcr);
-
-  __osm_sr_rcv_respond( p_rcv, p_madw, &sr_list );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return;
+	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;
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_sr_rcv_process_delete_method);
+
+	CL_ASSERT(p_madw);
+
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	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(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_dump_service_record(p_rcv->p_log,
+					p_recvd_service_rec, OSM_LOG_DEBUG);
+	}
+
+	/* Grab the lock */
+	cl_plock_excl_acquire(p_rcv->p_lock);
+
+	/* If Record exists with matching RID */
+	p_svcr = osm_svcr_get_by_rid(p_rcv->p_subn,
+				     p_rcv->p_log, p_recvd_service_rec);
+
+	if (p_svcr == NULL) {
+		cl_plock_release(p_rcv->p_lock);
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"osm_sr_rcv_process_delete_method: "
+			"No records matched the RID\n");
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RECORDS);
+		goto Exit;
+	} else {
+		osm_svcr_remove_from_db(p_rcv->p_subn, p_rcv->p_log, p_svcr);
+	}
+
+	cl_plock_release(p_rcv->p_lock);
+
+	p_sr_item = (osm_sr_item_t *) cl_qlock_pool_get(&p_rcv->sr_pool);
+	if (p_sr_item == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_sr_rcv_process_delete_method: ERR 2413: "
+			"Unable to acquire Service record\n");
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RESOURCES);
+		goto Exit;
+	}
+
+	/* provide back the copy of the record */
+	p_sr_item->service_rec = p_svcr->service_record;
+	cl_qlist_init(&sr_list);
+
+	cl_qlist_insert_tail(&sr_list,
+			     (cl_list_item_t *) & p_sr_item->pool_item);
+
+	if (p_svcr)
+		osm_svcr_delete(p_svcr);
+
+	__osm_sr_rcv_respond(p_rcv, p_madw, &sr_list);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return;
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sr_rcv_process(
-  IN void *context,
-  IN void *data )
+void osm_sr_rcv_process(IN void *context, IN void *data)
 {
-  osm_sr_rcv_t *p_rcv = context;
-  osm_madw_t *p_madw = data;
-  ib_sa_mad_t *            p_sa_mad;
-  ib_net16_t               sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-  boolean_t                valid;
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_sr_rcv_process );
-
-  CL_ASSERT( p_madw );
-
-  p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
-
-  CL_ASSERT( p_sa_mad->attr_id == IB_MAD_ATTR_SERVICE_RECORD );
-
-  switch (p_sa_mad->method)
-  {
-  case IB_MAD_METHOD_SET:
-    valid = __validate_sr(p_rcv, p_madw);
-    if(!valid)
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-               "osm_sr_rcv_process: "
-               "Component Mask check failed for set request\n" );
-      osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
-      goto Exit;
-    }
-    osm_sr_rcv_process_set_method(p_rcv, p_madw);
-    break;
-  case IB_MAD_METHOD_DELETE:
-    valid = __validate_sr(p_rcv, p_madw);
-    if(!valid)
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-               "osm_sr_rcv_process: "
-               "Component Mask check failed for delete request\n" );
-      osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status );
-      goto Exit;
-    }
-    osm_sr_rcv_process_delete_method(p_rcv, p_madw);
-    break;
-  case IB_MAD_METHOD_GET:
-  case IB_MAD_METHOD_GETTABLE:
-    osm_sr_rcv_process_get_method(p_rcv, p_madw);
-    break;
-  default:
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_sr_rcv_process: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_sa_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    break;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return;
+	osm_sr_rcv_t *p_rcv = context;
+	osm_madw_t *p_madw = data;
+	ib_sa_mad_t *p_sa_mad;
+	ib_net16_t sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
+	boolean_t valid;
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_sr_rcv_process);
+
+	CL_ASSERT(p_madw);
+
+	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
+
+	CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_SERVICE_RECORD);
+
+	switch (p_sa_mad->method) {
+	case IB_MAD_METHOD_SET:
+		valid = __validate_sr(p_rcv, p_madw);
+		if (!valid) {
+			osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+				"osm_sr_rcv_process: "
+				"Component Mask check failed for set request\n");
+			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			goto Exit;
+		}
+		osm_sr_rcv_process_set_method(p_rcv, p_madw);
+		break;
+	case IB_MAD_METHOD_DELETE:
+		valid = __validate_sr(p_rcv, p_madw);
+		if (!valid) {
+			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				"osm_sr_rcv_process: "
+				"Component Mask check failed for delete request\n");
+			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			goto Exit;
+		}
+		osm_sr_rcv_process_delete_method(p_rcv, p_madw);
+		break;
+	case IB_MAD_METHOD_GET:
+	case IB_MAD_METHOD_GETTABLE:
+		osm_sr_rcv_process_get_method(p_rcv, p_madw);
+		break;
+	default:
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"osm_sr_rcv_process: "
+			"Unsupported Method (%s)\n",
+			ib_get_sa_method_str(p_sa_mad->method));
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
+		break;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return;
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sr_rcv_lease_cb(
-  IN void*        context )
+void osm_sr_rcv_lease_cb(IN void *context)
 {
-  osm_sr_rcv_t*   p_rcv = (osm_sr_rcv_t*)context;
-  cl_list_item_t* p_list_item;
-  cl_list_item_t* p_next_list_item;
-  osm_svcr_t*     p_svcr;
-  uint32_t        curr_time;
-  uint32_t        elapsed_time;
-  uint32_t        trim_time = 20; /*  maxiaml timer refresh is 20 seconds */
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_sr_rcv_lease_cb );
-
-  cl_plock_excl_acquire(p_rcv->p_lock);
-
-  p_list_item = cl_qlist_head(&p_rcv->p_subn->sa_sr_list);
-
-  while( p_list_item != cl_qlist_end(&p_rcv->p_subn->sa_sr_list) )
-  {
-    p_svcr = (osm_svcr_t*)p_list_item;
-
-    if(p_svcr->service_record.service_lease == 0xFFFFFFFF)
-    {
-      p_list_item = cl_qlist_next(p_list_item);
-      continue;
-    }
-
-    /* current time in seconds */
-    curr_time = cl_get_time_stamp_sec();
-    /* elapsed time from last modify */
-    elapsed_time = curr_time - p_svcr->modified_time;
-    /* but it can not be less then 1 */
-    if (elapsed_time < 1) elapsed_time = 1;
-
-    if(elapsed_time < p_svcr->lease_period)
-    {
-      /*
-         Just update the service lease period
-         note: for simplicity we work with a uint32_t field
-         external to the network order lease_period of the MAD
-      */
-      p_svcr->lease_period -= elapsed_time;
-
-      osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-               "osm_sr_rcv_lease_cb: "
-               "Remaining time for Service Name:%s is:0x%X\n",
-               p_svcr->service_record.service_name,
-               p_svcr->lease_period );
-
-      p_svcr->modified_time = curr_time;
-
-      /* Update the trim timer */
-      if(trim_time > p_svcr->lease_period)
-      {
-        trim_time = p_svcr->lease_period;
-        if (trim_time < 1) trim_time = 1;
-      }
-
-      p_list_item = cl_qlist_next(p_list_item);
-      continue;
-
-    }
-    else
-    {
-      p_next_list_item = cl_qlist_next(p_list_item);
-
-      /* Remove the service Record */
-      osm_svcr_remove_from_db(p_rcv->p_subn,
-                              p_rcv->p_log,
-                              p_svcr);
-
-      osm_svcr_delete(p_svcr);
-
-      p_list_item = p_next_list_item;
-      continue;
-    }
-  }
-
-  /* Release the Lock */
-  cl_plock_release(p_rcv->p_lock);
-
-  if(trim_time != 0xFFFFFFFF)
-  {
-    cl_timer_trim(&p_rcv->sr_timer,
-                  trim_time * 1000); /* Convert to milli seconds */
-  }
-
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_sr_rcv_t *p_rcv = (osm_sr_rcv_t *) context;
+	cl_list_item_t *p_list_item;
+	cl_list_item_t *p_next_list_item;
+	osm_svcr_t *p_svcr;
+	uint32_t curr_time;
+	uint32_t elapsed_time;
+	uint32_t trim_time = 20;	/*  maxiaml timer refresh is 20 seconds */
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_sr_rcv_lease_cb);
+
+	cl_plock_excl_acquire(p_rcv->p_lock);
+
+	p_list_item = cl_qlist_head(&p_rcv->p_subn->sa_sr_list);
+
+	while (p_list_item != cl_qlist_end(&p_rcv->p_subn->sa_sr_list)) {
+		p_svcr = (osm_svcr_t *) p_list_item;
+
+		if (p_svcr->service_record.service_lease == 0xFFFFFFFF) {
+			p_list_item = cl_qlist_next(p_list_item);
+			continue;
+		}
+
+		/* current time in seconds */
+		curr_time = cl_get_time_stamp_sec();
+		/* elapsed time from last modify */
+		elapsed_time = curr_time - p_svcr->modified_time;
+		/* but it can not be less then 1 */
+		if (elapsed_time < 1)
+			elapsed_time = 1;
+
+		if (elapsed_time < p_svcr->lease_period) {
+			/*
+			   Just update the service lease period
+			   note: for simplicity we work with a uint32_t field
+			   external to the network order lease_period of the MAD
+			 */
+			p_svcr->lease_period -= elapsed_time;
+
+			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				"osm_sr_rcv_lease_cb: "
+				"Remaining time for Service Name:%s is:0x%X\n",
+				p_svcr->service_record.service_name,
+				p_svcr->lease_period);
+
+			p_svcr->modified_time = curr_time;
+
+			/* Update the trim timer */
+			if (trim_time > p_svcr->lease_period) {
+				trim_time = p_svcr->lease_period;
+				if (trim_time < 1)
+					trim_time = 1;
+			}
+
+			p_list_item = cl_qlist_next(p_list_item);
+			continue;
+
+		} else {
+			p_next_list_item = cl_qlist_next(p_list_item);
+
+			/* Remove the service Record */
+			osm_svcr_remove_from_db(p_rcv->p_subn,
+						p_rcv->p_log, p_svcr);
+
+			osm_svcr_delete(p_svcr);
+
+			p_list_item = p_next_list_item;
+			continue;
+		}
+	}
+
+	/* Release the Lock */
+	cl_plock_release(p_rcv->p_lock);
+
+	if (trim_time != 0xFFFFFFFF) {
+		cl_timer_trim(&p_rcv->sr_timer, trim_time * 1000);	/* Convert to milli seconds */
+	}
+
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_sa_sminfo_record.c b/opensm/opensm/osm_sa_sminfo_record.c
index f1769a8..8778dc5 100644
--- a/opensm/opensm/osm_sa_sminfo_record.c
+++ b/opensm/opensm/osm_sa_sminfo_record.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -72,514 +72,492 @@
 #define OSM_SMIR_RCV_POOL_MIN_SIZE     32
 #define OSM_SMIR_RCV_POOL_GROW_SIZE    32
 
-typedef  struct _osm_smir_item
-{
-  cl_pool_item_t           pool_item;
-  ib_sminfo_record_t       rec;
+typedef struct _osm_smir_item {
+	cl_pool_item_t pool_item;
+	ib_sminfo_record_t rec;
 } osm_smir_item_t;
 
-typedef  struct _osm_smir_search_ctxt
-{
-  const ib_sminfo_record_t* p_rcvd_rec;
-  ib_net64_t               comp_mask;
-  cl_qlist_t*              p_list;
-  osm_smir_rcv_t*          p_rcv;
-  const osm_physp_t*       p_req_physp;
+typedef struct _osm_smir_search_ctxt {
+	const ib_sminfo_record_t *p_rcvd_rec;
+	ib_net64_t comp_mask;
+	cl_qlist_t *p_list;
+	osm_smir_rcv_t *p_rcv;
+	const osm_physp_t *p_req_physp;
 } osm_smir_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_smir_rcv_construct(
-  IN osm_smir_rcv_t* const p_rcv )
+void osm_smir_rcv_construct(IN osm_smir_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
-  cl_qlock_pool_construct( &p_rcv->pool );
+	memset(p_rcv, 0, sizeof(*p_rcv));
+	cl_qlock_pool_construct(&p_rcv->pool);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_smir_rcv_destroy(
-  IN osm_smir_rcv_t* const p_rcv )
+void osm_smir_rcv_destroy(IN osm_smir_rcv_t * const p_rcv)
 {
-  CL_ASSERT( p_rcv );
+	CL_ASSERT(p_rcv);
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_smir_rcv_destroy );
-  cl_qlock_pool_destroy( &p_rcv->pool );
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_smir_rcv_destroy);
+	cl_qlock_pool_destroy(&p_rcv->pool);
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_smir_rcv_init(
-  IN osm_smir_rcv_t* const p_rcv,
-  IN osm_sa_resp_t*  const p_resp,
-  IN osm_mad_pool_t* const p_mad_pool,
-  IN osm_subn_t*     const p_subn,
-  IN osm_stats_t*    const p_stats,
-  IN osm_log_t*      const p_log,
-  IN cl_plock_t*     const p_lock )
+osm_smir_rcv_init(IN osm_smir_rcv_t * const p_rcv,
+		  IN osm_sa_resp_t * const p_resp,
+		  IN osm_mad_pool_t * const p_mad_pool,
+		  IN osm_subn_t * const p_subn,
+		  IN osm_stats_t * const p_stats,
+		  IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_smir_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_smir_rcv_init);
 
-  osm_smir_rcv_construct( p_rcv );
+	osm_smir_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_resp = p_resp;
-  p_rcv->p_stats = p_stats;
-  p_rcv->p_mad_pool = p_mad_pool;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_resp = p_resp;
+	p_rcv->p_stats = p_stats;
+	p_rcv->p_mad_pool = p_mad_pool;
 
-  status = cl_qlock_pool_init( &p_rcv->pool,
-                               OSM_SMIR_RCV_POOL_MIN_SIZE,
-                               0,
-                               OSM_SMIR_RCV_POOL_GROW_SIZE,
-                               sizeof(osm_smir_item_t),
-                               NULL, NULL, NULL );
+	status = cl_qlock_pool_init(&p_rcv->pool,
+				    OSM_SMIR_RCV_POOL_MIN_SIZE,
+				    0,
+				    OSM_SMIR_RCV_POOL_GROW_SIZE,
+				    sizeof(osm_smir_item_t), NULL, NULL, NULL);
 
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 static ib_api_status_t
-__osm_smir_rcv_new_smir(
-  IN osm_smir_rcv_t*         const p_rcv,
-  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 )
+__osm_smir_rcv_new_smir(IN osm_smir_rcv_t * const p_rcv,
+			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)
 {
-  osm_smir_item_t*           p_rec_item;
-  ib_api_status_t            status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_smir_rcv_new_smir );
-
-  p_rec_item = (osm_smir_item_t*)cl_qlock_pool_get( &p_rcv->pool );
-  if( p_rec_item == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_smir_rcv_new_smir: ERR 2801: "
-             "cl_qlock_pool_get failed\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_smir_rcv_new_smir: "
-             "New SMInfo: GUID 0x%016" PRIx64 "\n",
-             cl_ntoh64( guid )
-             );
-  }
-
-  memset( &p_rec_item->rec, 0, sizeof(ib_sminfo_record_t) );
-
-  p_rec_item->rec.lid = osm_port_get_base_lid( p_port );
-  p_rec_item->rec.sm_info.guid = guid;
-  p_rec_item->rec.sm_info.act_count = act_count;
-  p_rec_item->rec.sm_info.pri_state = pri_state;
-
-  cl_qlist_insert_tail( p_list, (cl_list_item_t*)&p_rec_item->pool_item );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	osm_smir_item_t *p_rec_item;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_smir_rcv_new_smir);
+
+	p_rec_item = (osm_smir_item_t *) cl_qlock_pool_get(&p_rcv->pool);
+	if (p_rec_item == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_smir_rcv_new_smir: ERR 2801: "
+			"cl_qlock_pool_get failed\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_smir_rcv_new_smir: "
+			"New SMInfo: GUID 0x%016" PRIx64 "\n", cl_ntoh64(guid)
+		    );
+	}
+
+	memset(&p_rec_item->rec, 0, sizeof(ib_sminfo_record_t));
+
+	p_rec_item->rec.lid = osm_port_get_base_lid(p_port);
+	p_rec_item->rec.sm_info.guid = guid;
+	p_rec_item->rec.sm_info.act_count = act_count;
+	p_rec_item->rec.sm_info.pri_state = pri_state;
+
+	cl_qlist_insert_tail(p_list,
+			     (cl_list_item_t *) & p_rec_item->pool_item);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_smir_by_comp_mask(
-  IN osm_smir_rcv_t*        const p_rcv,
-  IN const osm_remote_sm_t* const p_rem_sm,
-  osm_smir_search_ctxt_t*   const p_ctxt )
+__osm_sa_smir_by_comp_mask(IN osm_smir_rcv_t * const p_rcv,
+			   IN const osm_remote_sm_t * const p_rem_sm,
+			   osm_smir_search_ctxt_t * const 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_LOG_ENTER( p_rcv->p_log, __osm_sa_smir_by_comp_mask );
-
-  if ( comp_mask & IB_SMIR_COMPMASK_GUID )
-  {
-    if ( p_rem_sm->smi.guid != p_rcvd_rec->sm_info.guid )
-      goto Exit;
-  }
-
-  if ( comp_mask & IB_SMIR_COMPMASK_PRIORITY )
-  {
-    if ( ib_sminfo_get_priority( &p_rem_sm->smi ) !=
-         ib_sminfo_get_priority( &p_rcvd_rec->sm_info ) )
-      goto Exit;
-  }
-
-  if ( comp_mask & IB_SMIR_COMPMASK_SMSTATE )
-  {
-    if ( ib_sminfo_get_state( &p_rem_sm->smi ) !=
-         ib_sminfo_get_state( &p_rcvd_rec->sm_info ) )
-      goto Exit;
-  }
-
-  /* Implement any other needed search cases */
-
- __osm_smir_rcv_new_smir( p_rcv, 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 );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	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_LOG_ENTER(p_rcv->p_log, __osm_sa_smir_by_comp_mask);
+
+	if (comp_mask & IB_SMIR_COMPMASK_GUID) {
+		if (p_rem_sm->smi.guid != p_rcvd_rec->sm_info.guid)
+			goto Exit;
+	}
+
+	if (comp_mask & IB_SMIR_COMPMASK_PRIORITY) {
+		if (ib_sminfo_get_priority(&p_rem_sm->smi) !=
+		    ib_sminfo_get_priority(&p_rcvd_rec->sm_info))
+			goto Exit;
+	}
+
+	if (comp_mask & IB_SMIR_COMPMASK_SMSTATE) {
+		if (ib_sminfo_get_state(&p_rem_sm->smi) !=
+		    ib_sminfo_get_state(&p_rcvd_rec->sm_info))
+			goto Exit;
+	}
+
+	/* Implement any other needed search cases */
+
+	__osm_smir_rcv_new_smir(p_rcv, 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);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_smir_by_comp_mask_cb(
-  IN cl_map_item_t*        const p_map_item,
-  IN void*                 context )
+__osm_sa_smir_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
+			      IN void *context)
 {
-  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 *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;
 
-  __osm_sa_smir_by_comp_mask( p_ctxt->p_rcv, p_rem_sm, p_ctxt );
+	__osm_sa_smir_by_comp_mask(p_ctxt->p_rcv, p_rem_sm, p_ctxt);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_smir_rcv_process(
-  IN void *ctx,
-  IN void *data )
+void osm_smir_rcv_process(IN void *ctx, IN void *data)
 {
-  osm_smir_rcv_t *p_rcv = ctx;
-  osm_madw_t *p_madw = data;
-  const ib_sa_mad_t*        p_rcvd_mad;
-  const ib_sminfo_record_t* p_rcvd_rec;
-  const cl_qmap_t*          p_tbl;
-  const osm_port_t*         p_port = NULL;
-  const ib_sm_info_t*       p_smi;
-  cl_qlist_t                rec_list;
-  osm_madw_t*               p_resp_madw;
-  ib_sa_mad_t*              p_resp_sa_mad;
-  ib_sminfo_record_t*       p_resp_rec;
-  uint32_t                  num_rec, pre_trim_num_rec;
+	osm_smir_rcv_t *p_rcv = ctx;
+	osm_madw_t *p_madw = data;
+	const ib_sa_mad_t *p_rcvd_mad;
+	const ib_sminfo_record_t *p_rcvd_rec;
+	const cl_qmap_t *p_tbl;
+	const osm_port_t *p_port = NULL;
+	const ib_sm_info_t *p_smi;
+	cl_qlist_t rec_list;
+	osm_madw_t *p_resp_madw;
+	ib_sa_mad_t *p_resp_sa_mad;
+	ib_sminfo_record_t *p_resp_rec;
+	uint32_t num_rec, pre_trim_num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  uint32_t                  trim_num_rec;
+	uint32_t trim_num_rec;
 #endif
-  uint32_t                  i;
-  osm_smir_search_ctxt_t    context;
-  osm_smir_item_t*          p_rec_item;
-  ib_api_status_t           status = IB_SUCCESS;
-  ib_net64_t                comp_mask;
-  ib_net64_t                port_guid;
-  osm_physp_t*              p_req_physp;
-  osm_port_t*               local_port;
-  osm_remote_sm_t*          p_rem_sm;
-  cl_qmap_t*                p_sm_guid_tbl;
-  uint8_t                   pri_state;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_smir_rcv_process );
-
-  CL_ASSERT( p_madw );
-
-  p_rcvd_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_rcvd_rec = (ib_sminfo_record_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
-  comp_mask = p_rcvd_mad->comp_mask;
-
-  CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_SMINFO_RECORD );
-
-  /* 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( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_smir_rcv_process: ERR 2804: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_rcvd_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
-
-  /* update the requester physical port. */
-  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-                                          p_rcv->p_subn,
-                                          osm_madw_get_mad_addr_ptr(p_madw) );
-  if (p_req_physp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_smir_rcv_process: ERR 2803: "
-             "Cannot find requester physical port\n" );
-    goto Exit;
-  }
-
-  if ( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    osm_dump_sm_info_record( p_rcv->p_log, p_rcvd_rec, OSM_LOG_DEBUG );
-
-  p_tbl = &p_rcv->p_subn->sm_guid_tbl;
-  p_smi = &p_rcvd_rec->sm_info;
-
-  cl_qlist_init( &rec_list );
-
-  context.p_rcvd_rec = p_rcvd_rec;
-  context.p_list = &rec_list;
-  context.comp_mask = p_rcvd_mad->comp_mask;
-  context.p_rcv = p_rcv;
-  context.p_req_physp = p_req_physp;
-
-  cl_plock_acquire( p_rcv->p_lock );
-
-  /*
-    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_SMIR_COMPMASK_LID )
-  {
-    status = osm_get_port_by_base_lid( p_rcv->p_subn, p_rcvd_rec->lid, &p_port );
-    if ( ( status != IB_SUCCESS ) || ( p_port == NULL ) )
-    {
-      status = IB_NOT_FOUND;
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_smir_rcv_process: ERR 2806: "
-               "No port found with LID 0x%x\n",
-               cl_ntoh16(p_rcvd_rec->lid) );
-    }
-  }
-
-  if ( status == IB_SUCCESS )
-  {
-    /* Handle our own SM first */
-    local_port = osm_get_port_by_guid( p_rcv->p_subn, p_rcv->p_subn->sm_port_guid );
-    if ( !local_port )
-    {
-      cl_plock_release( p_rcv->p_lock );
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_smir_rcv_process: ERR 2809: "
-               "No port found with GUID 0x%016" PRIx64 "\n",
-               cl_ntoh64(p_rcv->p_subn->sm_port_guid ) );
-      goto Exit;
-    }
-
-    if ( !p_port || local_port == p_port )
-    {
-      if (FALSE ==
-          osm_physp_share_pkey( p_rcv->p_log, p_req_physp,
-                                local_port->p_physp ) )
-      {
-        cl_plock_release( p_rcv->p_lock );
-        osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-                 "osm_smir_rcv_process: ERR 2805: "
-                 "Cannot get SMInfo record due to pkey violation\n" );
-        goto Exit;
-      }
-
-      /* Check that other search components specified match */
-      if ( comp_mask & IB_SMIR_COMPMASK_GUID )
-      {
-        if ( p_rcv->p_subn->sm_port_guid != p_smi->guid )
-          goto Remotes;
-      }
-      if ( comp_mask & IB_SMIR_COMPMASK_PRIORITY )
-      {
-        if ( p_rcv->p_subn->opt.sm_priority != ib_sminfo_get_priority( p_smi ) )
-          goto Remotes;
-      }
-      if ( comp_mask & IB_SMIR_COMPMASK_SMSTATE )
-      {
-        if ( p_rcv->p_subn->sm_state != ib_sminfo_get_state( p_smi ) )
-          goto Remotes;
-      }
-
-      /* Now, add local SMInfo to list */
-      pri_state = p_rcv->p_subn->sm_state & 0x0F;
-      pri_state |= (p_rcv->p_subn->opt.sm_priority & 0x0F) << 4;
-      __osm_smir_rcv_new_smir( p_rcv, local_port, context.p_list,
-                               p_rcv->p_subn->sm_port_guid,
-                               cl_ntoh32( p_rcv->p_stats->qp0_mads_sent ),
-                               pri_state,
-                               p_req_physp );
-    }
-
- Remotes:
-    if( p_port && p_port != local_port )
-    {
-      /* Find remote SM corresponding to p_port */
-      port_guid = osm_port_get_guid( p_port );
-      p_sm_guid_tbl = &p_rcv->p_subn->sm_guid_tbl;
-      p_rem_sm = (osm_remote_sm_t*)cl_qmap_get( p_sm_guid_tbl, port_guid );
-      if (p_rem_sm != (osm_remote_sm_t*)cl_qmap_end( p_sm_guid_tbl ) )
-        __osm_sa_smir_by_comp_mask( p_rcv, p_rem_sm, &context );
-      else
-      {
-        osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-                 "osm_smir_rcv_process: ERR 280A: "
-                 "No remote SM for GUID 0x%016" PRIx64 "\n",
-                 cl_ntoh64( port_guid ) );
-      }
-    }
-    else
-    {
-      /* Go over all other known (remote) SMs */
-      cl_qmap_apply_func( &p_rcv->p_subn->sm_guid_tbl,
-                          __osm_sa_smir_by_comp_mask_cb,
-                          &context );
-    }
-  }
-
-  cl_plock_release( p_rcv->p_lock );
-
-  num_rec = cl_qlist_count( &rec_list );
-
-  /*
-   * C15-0.1.30:
-   * If we do a SubnAdmGet and got more than one record it is an error !
-   */
-  if (p_rcvd_mad->method == IB_MAD_METHOD_GET)
-  {
-    if (num_rec == 0)
-    {
-      osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-      goto Exit;
-    }
-    if (num_rec > 1)
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_smir_rcv_process: ERR 2808: "
-               "Got more than one record for SubnAdmGet (%u)\n",
-               num_rec );
-      osm_sa_send_error( p_rcv->p_resp, p_madw,
-                         IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
-
-      /* need to set the mem free ... */
-      p_rec_item = (osm_smir_item_t*)cl_qlist_remove_head( &rec_list );
-      while( p_rec_item != (osm_smir_item_t*)cl_qlist_end( &rec_list ) )
-      {
-        cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-        p_rec_item = (osm_smir_item_t*)cl_qlist_remove_head( &rec_list );
-      }
-
-      goto Exit;
-    }
-  }
-
-  pre_trim_num_rec = num_rec;
+	uint32_t i;
+	osm_smir_search_ctxt_t context;
+	osm_smir_item_t *p_rec_item;
+	ib_api_status_t status = IB_SUCCESS;
+	ib_net64_t comp_mask;
+	ib_net64_t port_guid;
+	osm_physp_t *p_req_physp;
+	osm_port_t *local_port;
+	osm_remote_sm_t *p_rem_sm;
+	cl_qmap_t *p_sm_guid_tbl;
+	uint8_t pri_state;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_smir_rcv_process);
+
+	CL_ASSERT(p_madw);
+
+	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_rcvd_rec =
+	    (ib_sminfo_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+	comp_mask = p_rcvd_mad->comp_mask;
+
+	CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_SMINFO_RECORD);
+
+	/* 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(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_smir_rcv_process: ERR 2804: "
+			"Unsupported Method (%s)\n",
+			ib_get_sa_method_str(p_rcvd_mad->method));
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
+		goto Exit;
+	}
+
+	/* update the requester physical port. */
+	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+						p_rcv->p_subn,
+						osm_madw_get_mad_addr_ptr
+						(p_madw));
+	if (p_req_physp == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_smir_rcv_process: ERR 2803: "
+			"Cannot find requester physical port\n");
+		goto Exit;
+	}
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
+		osm_dump_sm_info_record(p_rcv->p_log, p_rcvd_rec,
+					OSM_LOG_DEBUG);
+
+	p_tbl = &p_rcv->p_subn->sm_guid_tbl;
+	p_smi = &p_rcvd_rec->sm_info;
+
+	cl_qlist_init(&rec_list);
+
+	context.p_rcvd_rec = p_rcvd_rec;
+	context.p_list = &rec_list;
+	context.comp_mask = p_rcvd_mad->comp_mask;
+	context.p_rcv = p_rcv;
+	context.p_req_physp = p_req_physp;
+
+	cl_plock_acquire(p_rcv->p_lock);
+
+	/*
+	   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_SMIR_COMPMASK_LID) {
+		status =
+		    osm_get_port_by_base_lid(p_rcv->p_subn, p_rcvd_rec->lid,
+					     &p_port);
+		if ((status != IB_SUCCESS) || (p_port == NULL)) {
+			status = IB_NOT_FOUND;
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_smir_rcv_process: ERR 2806: "
+				"No port found with LID 0x%x\n",
+				cl_ntoh16(p_rcvd_rec->lid));
+		}
+	}
+
+	if (status == IB_SUCCESS) {
+		/* Handle our own SM first */
+		local_port =
+		    osm_get_port_by_guid(p_rcv->p_subn,
+					 p_rcv->p_subn->sm_port_guid);
+		if (!local_port) {
+			cl_plock_release(p_rcv->p_lock);
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_smir_rcv_process: ERR 2809: "
+				"No port found with GUID 0x%016" PRIx64 "\n",
+				cl_ntoh64(p_rcv->p_subn->sm_port_guid));
+			goto Exit;
+		}
+
+		if (!p_port || local_port == p_port) {
+			if (FALSE ==
+			    osm_physp_share_pkey(p_rcv->p_log, p_req_physp,
+						 local_port->p_physp)) {
+				cl_plock_release(p_rcv->p_lock);
+				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+					"osm_smir_rcv_process: ERR 2805: "
+					"Cannot get SMInfo record due to pkey violation\n");
+				goto Exit;
+			}
+
+			/* Check that other search components specified match */
+			if (comp_mask & IB_SMIR_COMPMASK_GUID) {
+				if (p_rcv->p_subn->sm_port_guid != p_smi->guid)
+					goto Remotes;
+			}
+			if (comp_mask & IB_SMIR_COMPMASK_PRIORITY) {
+				if (p_rcv->p_subn->opt.sm_priority !=
+				    ib_sminfo_get_priority(p_smi))
+					goto Remotes;
+			}
+			if (comp_mask & IB_SMIR_COMPMASK_SMSTATE) {
+				if (p_rcv->p_subn->sm_state !=
+				    ib_sminfo_get_state(p_smi))
+					goto Remotes;
+			}
+
+			/* Now, add local SMInfo to list */
+			pri_state = p_rcv->p_subn->sm_state & 0x0F;
+			pri_state |=
+			    (p_rcv->p_subn->opt.sm_priority & 0x0F) << 4;
+			__osm_smir_rcv_new_smir(p_rcv, local_port,
+						context.p_list,
+						p_rcv->p_subn->sm_port_guid,
+						cl_ntoh32(p_rcv->p_stats->
+							  qp0_mads_sent),
+						pri_state, p_req_physp);
+		}
+
+	      Remotes:
+		if (p_port && p_port != local_port) {
+			/* Find remote SM corresponding to p_port */
+			port_guid = osm_port_get_guid(p_port);
+			p_sm_guid_tbl = &p_rcv->p_subn->sm_guid_tbl;
+			p_rem_sm =
+			    (osm_remote_sm_t *) cl_qmap_get(p_sm_guid_tbl,
+							    port_guid);
+			if (p_rem_sm !=
+			    (osm_remote_sm_t *) cl_qmap_end(p_sm_guid_tbl))
+				__osm_sa_smir_by_comp_mask(p_rcv, p_rem_sm,
+							   &context);
+			else {
+				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+					"osm_smir_rcv_process: ERR 280A: "
+					"No remote SM for GUID 0x%016" PRIx64
+					"\n", cl_ntoh64(port_guid));
+			}
+		} else {
+			/* Go over all other known (remote) SMs */
+			cl_qmap_apply_func(&p_rcv->p_subn->sm_guid_tbl,
+					   __osm_sa_smir_by_comp_mask_cb,
+					   &context);
+		}
+	}
+
+	cl_plock_release(p_rcv->p_lock);
+
+	num_rec = cl_qlist_count(&rec_list);
+
+	/*
+	 * C15-0.1.30:
+	 * If we do a SubnAdmGet and got more than one record it is an error !
+	 */
+	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
+		if (num_rec == 0) {
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_NO_RECORDS);
+			goto Exit;
+		}
+		if (num_rec > 1) {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_smir_rcv_process: ERR 2808: "
+				"Got more than one record for SubnAdmGet (%u)\n",
+				num_rec);
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
+
+			/* need to set the mem free ... */
+			p_rec_item =
+			    (osm_smir_item_t *) cl_qlist_remove_head(&rec_list);
+			while (p_rec_item !=
+			       (osm_smir_item_t *) cl_qlist_end(&rec_list)) {
+				cl_qlock_pool_put(&p_rcv->pool,
+						  &p_rec_item->pool_item);
+				p_rec_item =
+				    (osm_smir_item_t *)
+				    cl_qlist_remove_head(&rec_list);
+			}
+
+			goto Exit;
+		}
+	}
+
+	pre_trim_num_rec = num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  trim_num_rec = (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_sminfo_record_t);
-  if (trim_num_rec < num_rec)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "osm_smir_rcv_process: "
-             "Number of records:%u trimmed to:%u to fit in one MAD\n",
-             num_rec, trim_num_rec );
-    num_rec = trim_num_rec;
-  }
+	trim_num_rec =
+	    (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_sminfo_record_t);
+	if (trim_num_rec < num_rec) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"osm_smir_rcv_process: "
+			"Number of records:%u trimmed to:%u to fit in one MAD\n",
+			num_rec, trim_num_rec);
+		num_rec = trim_num_rec;
+	}
 #endif
 
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "osm_smir_rcv_process: "
-           "Returning %u records\n", num_rec );
-
-  if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
-  {
-    osm_sa_send_error( p_rcv->p_resp, p_madw,
-                       IB_SA_MAD_STATUS_NO_RECORDS );
-    goto Exit;
-  }
-
-  /*
-   * Get a MAD to reply. Address of Mad is in the received mad_wrapper
-   */
-  p_resp_madw = osm_mad_pool_get( p_rcv->p_mad_pool,
-                                  p_madw->h_bind,
-                                  num_rec * sizeof(ib_sminfo_record_t) + IB_SA_MAD_HDR_SIZE,
-                                  &p_madw->mad_addr );
-
-  if( !p_resp_madw )
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_smir_rcv_process: ERR 2807: "
-            "osm_mad_pool_get failed\n" );
-
-    for( i = 0; i < num_rec; i++ )
-    {
-      p_rec_item = (osm_smir_item_t*)cl_qlist_remove_head( &rec_list );
-      cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    }
-
-    osm_sa_send_error( p_rcv->p_resp, p_madw,
-                       IB_SA_MAD_STATUS_NO_RESOURCES );
-
-    goto Exit;
-  }
-
-  p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
-
-  /*
-    Copy the MAD header back into the response mad.
-    Set the 'R' bit and the payload length,
-    Then copy all records from the list into the response payload.
-  */
-
-  memcpy( p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE );
-  p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-  /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
-  p_resp_sa_mad->sm_key = 0;
-  /* Fill in the offset (paylen will be done by the rmpp SAR) */
-  p_resp_sa_mad->attr_offset =
-    ib_get_attr_offset( sizeof(ib_sminfo_record_t) );
-
-  p_resp_rec = (ib_sminfo_record_t*)
-    ib_sa_mad_get_payload_ptr( p_resp_sa_mad );
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"osm_smir_rcv_process: " "Returning %u records\n", num_rec);
+
+	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RECORDS);
+		goto Exit;
+	}
+
+	/*
+	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
+	 */
+	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+				       p_madw->h_bind,
+				       num_rec * sizeof(ib_sminfo_record_t) +
+				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
+
+	if (!p_resp_madw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_smir_rcv_process: ERR 2807: "
+			"osm_mad_pool_get failed\n");
+
+		for (i = 0; i < num_rec; i++) {
+			p_rec_item =
+			    (osm_smir_item_t *) cl_qlist_remove_head(&rec_list);
+			cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		}
+
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RESOURCES);
+
+		goto Exit;
+	}
+
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+
+	/*
+	   Copy the MAD header back into the response mad.
+	   Set the 'R' bit and the payload length,
+	   Then copy all records from the list into the response payload.
+	 */
+
+	memcpy(p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE);
+	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
+	p_resp_sa_mad->sm_key = 0;
+	/* Fill in the offset (paylen will be done by the rmpp SAR) */
+	p_resp_sa_mad->attr_offset =
+	    ib_get_attr_offset(sizeof(ib_sminfo_record_t));
+
+	p_resp_rec = (ib_sminfo_record_t *)
+	    ib_sa_mad_get_payload_ptr(p_resp_sa_mad);
 
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we support only one packet RMPP - so we will set the first and
-     last flags for gettable */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-  {
-    p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST | IB_RMPP_FLAG_ACTIVE;
-  }
+	/* we support only one packet RMPP - so we will set the first and
+	   last flags for gettable */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+		p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
+		p_resp_sa_mad->rmpp_flags =
+		    IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST |
+		    IB_RMPP_FLAG_ACTIVE;
+	}
 #else
-  /* forcefully define the packet as RMPP one */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
+	/* forcefully define the packet as RMPP one */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
+		p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
 #endif
 
-  for( i = 0; i < pre_trim_num_rec; i++ )
-  {
-    p_rec_item = (osm_smir_item_t*)cl_qlist_remove_head( &rec_list );
-    /* copy only if not trimmed */
-    if (i < num_rec)
-    {
-      *p_resp_rec = p_rec_item->rec;
-      p_resp_rec->sm_info.sm_key = 0;
-    }
-    cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    p_resp_rec++;
-  }
-
-  CL_ASSERT( cl_is_qlist_empty( &rec_list ) );
-
-  status = osm_vendor_send( p_resp_madw->h_bind, p_resp_madw, FALSE );
-  if( status != IB_SUCCESS )
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_smir_rcv_process: ERR 2802: "
-            "Error sending MAD (%s)\n",
-            ib_get_err_str( status ) );
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	for (i = 0; i < pre_trim_num_rec; i++) {
+		p_rec_item =
+		    (osm_smir_item_t *) cl_qlist_remove_head(&rec_list);
+		/* copy only if not trimmed */
+		if (i < num_rec) {
+			*p_resp_rec = p_rec_item->rec;
+			p_resp_rec->sm_info.sm_key = 0;
+		}
+		cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		p_resp_rec++;
+	}
+
+	CL_ASSERT(cl_is_qlist_empty(&rec_list));
+
+	status = osm_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE);
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_smir_rcv_process: ERR 2802: "
+			"Error sending MAD (%s)\n", ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_sa_sw_info_record.c b/opensm/opensm/osm_sa_sw_info_record.c
index 3463e83..adddd28 100644
--- a/opensm/opensm/osm_sa_sw_info_record.c
+++ b/opensm/opensm/osm_sa_sw_info_record.c
@@ -46,7 +46,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -61,476 +61,450 @@
 #define OSM_SIR_RCV_POOL_MIN_SIZE    32
 #define OSM_SIR_RCV_POOL_GROW_SIZE   32
 
-typedef  struct _osm_sir_item
-{
-  cl_pool_item_t           pool_item;
-  ib_switch_info_record_t  rec;
+typedef struct _osm_sir_item {
+	cl_pool_item_t pool_item;
+	ib_switch_info_record_t rec;
 } osm_sir_item_t;
 
-typedef  struct _osm_sir_search_ctxt
-{
-  const ib_switch_info_record_t* p_rcvd_rec;
-  ib_net64_t               comp_mask;
-  cl_qlist_t*              p_list;
-  osm_sir_rcv_t*           p_rcv;
-  const osm_physp_t*       p_req_physp;
+typedef struct _osm_sir_search_ctxt {
+	const ib_switch_info_record_t *p_rcvd_rec;
+	ib_net64_t comp_mask;
+	cl_qlist_t *p_list;
+	osm_sir_rcv_t *p_rcv;
+	const osm_physp_t *p_req_physp;
 } osm_sir_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sir_rcv_construct(
-  IN osm_sir_rcv_t* const p_rcv )
+void osm_sir_rcv_construct(IN osm_sir_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
-  cl_qlock_pool_construct( &p_rcv->pool );
+	memset(p_rcv, 0, sizeof(*p_rcv));
+	cl_qlock_pool_construct(&p_rcv->pool);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sir_rcv_destroy(
-  IN osm_sir_rcv_t* const p_rcv )
+void osm_sir_rcv_destroy(IN osm_sir_rcv_t * const p_rcv)
 {
-  OSM_LOG_ENTER( p_rcv->p_log, osm_sir_rcv_destroy );
-  cl_qlock_pool_destroy( &p_rcv->pool );
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_sir_rcv_destroy);
+	cl_qlock_pool_destroy(&p_rcv->pool);
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_sir_rcv_init(
-  IN osm_sir_rcv_t*        const p_rcv,
-  IN osm_sa_resp_t*        const p_resp,
-  IN osm_mad_pool_t*       const p_mad_pool,
-  IN osm_subn_t*           const p_subn,
-  IN osm_log_t*            const p_log,
-  IN cl_plock_t*           const p_lock )
+osm_sir_rcv_init(IN osm_sir_rcv_t * const p_rcv,
+		 IN osm_sa_resp_t * const p_resp,
+		 IN osm_mad_pool_t * const p_mad_pool,
+		 IN osm_subn_t * const p_subn,
+		 IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t          status;
+	ib_api_status_t status;
 
-  OSM_LOG_ENTER( p_log, osm_sir_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_sir_rcv_init);
 
-  osm_sir_rcv_construct( p_rcv );
+	osm_sir_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_resp = p_resp;
-  p_rcv->p_mad_pool = p_mad_pool;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_resp = p_resp;
+	p_rcv->p_mad_pool = p_mad_pool;
 
-  status = cl_qlock_pool_init( &p_rcv->pool,
-                               OSM_SIR_RCV_POOL_MIN_SIZE,
-                               0,
-                               OSM_SIR_RCV_POOL_GROW_SIZE,
-                               sizeof(osm_sir_item_t),
-                               NULL, NULL, NULL );
+	status = cl_qlock_pool_init(&p_rcv->pool,
+				    OSM_SIR_RCV_POOL_MIN_SIZE,
+				    0,
+				    OSM_SIR_RCV_POOL_GROW_SIZE,
+				    sizeof(osm_sir_item_t), NULL, NULL, NULL);
 
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t
-__osm_sir_rcv_new_sir(
-  IN osm_sir_rcv_t*        const p_rcv,
-  IN const osm_switch_t*   const p_sw,
-  IN cl_qlist_t*           const p_list,
-  IN ib_net16_t            const lid )
+__osm_sir_rcv_new_sir(IN osm_sir_rcv_t * const p_rcv,
+		      IN const osm_switch_t * const p_sw,
+		      IN cl_qlist_t * const p_list, IN ib_net16_t const lid)
 {
-  osm_sir_item_t*          p_rec_item;
-  ib_api_status_t          status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_sir_rcv_new_sir );
-
-  p_rec_item = (osm_sir_item_t*)cl_qlock_pool_get( &p_rcv->pool );
-  if( p_rec_item == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_sir_rcv_new_sir: ERR 5308: "
-             "cl_qlock_pool_get failed\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_sir_rcv_new_sir: "
-             "New SwitchInfoRecord: lid 0x%X\n",
-             cl_ntoh16( lid )
-             );
-  }
-
-  memset( &p_rec_item->rec, 0, sizeof(ib_switch_info_record_t) );
-
-  p_rec_item->rec.lid = lid;
-  p_rec_item->rec.switch_info = p_sw->switch_info;
-
-  cl_qlist_insert_tail( p_list, (cl_list_item_t*)&p_rec_item->pool_item );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	osm_sir_item_t *p_rec_item;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_sir_rcv_new_sir);
+
+	p_rec_item = (osm_sir_item_t *) cl_qlock_pool_get(&p_rcv->pool);
+	if (p_rec_item == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_sir_rcv_new_sir: ERR 5308: "
+			"cl_qlock_pool_get failed\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_sir_rcv_new_sir: "
+			"New SwitchInfoRecord: lid 0x%X\n", cl_ntoh16(lid)
+		    );
+	}
+
+	memset(&p_rec_item->rec, 0, sizeof(ib_switch_info_record_t));
+
+	p_rec_item->rec.lid = lid;
+	p_rec_item->rec.switch_info = p_sw->switch_info;
+
+	cl_qlist_insert_tail(p_list,
+			     (cl_list_item_t *) & p_rec_item->pool_item);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
-static osm_port_t*
-__osm_sir_get_port_by_guid(
-  IN osm_sir_rcv_t*   const p_rcv,
-  IN uint64_t         port_guid )
+static osm_port_t *__osm_sir_get_port_by_guid(IN osm_sir_rcv_t * const p_rcv,
+					      IN uint64_t port_guid)
 {
-  osm_port_t*         p_port;
-
-  CL_PLOCK_ACQUIRE(p_rcv->p_lock);
-
-  p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
-  if (!p_port)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_sir_get_port_by_guid ERR 5309: "
-             "Invalid port GUID 0x%016" PRIx64 "\n",
-             port_guid );
-    p_port = NULL;
-  }
-
-  CL_PLOCK_RELEASE(p_rcv->p_lock);
-  return p_port;
+	osm_port_t *p_port;
+
+	CL_PLOCK_ACQUIRE(p_rcv->p_lock);
+
+	p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+	if (!p_port) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_sir_get_port_by_guid ERR 5309: "
+			"Invalid port GUID 0x%016" PRIx64 "\n", port_guid);
+		p_port = NULL;
+	}
+
+	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	return p_port;
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sir_rcv_create_sir(
-  IN osm_sir_rcv_t*        const p_rcv,
-  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 )
+__osm_sir_rcv_create_sir(IN osm_sir_rcv_t * const p_rcv,
+			 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)
 {
-  osm_port_t*              p_port;
-  const osm_physp_t*       p_physp;
-  uint16_t                 match_lid_ho;
-  ib_net16_t               min_lid_ho;
-  ib_net16_t               max_lid_ho;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_sir_rcv_create_sir );
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_sir_rcv_create_sir: "
-             "Looking for SwitchInfoRecord with LID: 0x%X\n",
-             cl_ntoh16( match_lid )
-             );
-  }
-
-  /* In switches, the port guid is the node guid. */
-  p_port =
-    __osm_sir_get_port_by_guid( p_rcv, p_sw->p_node->node_info.port_guid );
-  if (! p_port)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_sir_rcv_create_sir: ERR 530A: "
-             "Failed to find Port by Node Guid:0x%016" PRIx64
-             "\n",
-             cl_ntoh64( p_sw->p_node->node_info.node_guid )
-             );
-    goto Exit;
-  }
-
-  /* check that the requester physp and the current physp are under
-     the same partition. */
-  p_physp = p_port->p_physp;
-  if (! p_physp)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_sir_rcv_create_sir: ERR 530B: "
-             "Failed to find default physical Port by Node Guid:0x%016" PRIx64
-             "\n",
-             cl_ntoh64( p_sw->p_node->node_info.node_guid )
-             );
-    goto Exit;
-  }
-  if (! osm_physp_share_pkey( p_rcv->p_log, p_req_physp, p_physp ))
-    goto Exit;
-
-  /* get the port 0 of the switch */
-  osm_port_get_lid_range_ho( p_port, &min_lid_ho, &max_lid_ho );
-
-  match_lid_ho = cl_ntoh16( match_lid );
-  if( match_lid_ho )
-  {
-    /*
-      We validate that the lid belongs to this switch.
-    */
-    if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-               "__osm_sir_rcv_create_sir: "
-               "Comparing LID: 0x%X <= 0x%X <= 0x%X\n",
-               min_lid_ho, match_lid_ho, max_lid_ho
-               );
-    }
-
-    if ( match_lid_ho < min_lid_ho || match_lid_ho > max_lid_ho )
-      goto Exit;
-
-  }
-
-  __osm_sir_rcv_new_sir( p_rcv, p_sw, p_list, osm_port_get_base_lid(p_port) );
-
-Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_port_t *p_port;
+	const osm_physp_t *p_physp;
+	uint16_t match_lid_ho;
+	ib_net16_t min_lid_ho;
+	ib_net16_t max_lid_ho;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_sir_rcv_create_sir);
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_sir_rcv_create_sir: "
+			"Looking for SwitchInfoRecord with LID: 0x%X\n",
+			cl_ntoh16(match_lid)
+		    );
+	}
+
+	/* In switches, the port guid is the node guid. */
+	p_port =
+	    __osm_sir_get_port_by_guid(p_rcv,
+				       p_sw->p_node->node_info.port_guid);
+	if (!p_port) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_sir_rcv_create_sir: ERR 530A: "
+			"Failed to find Port by Node Guid:0x%016" PRIx64
+			"\n", cl_ntoh64(p_sw->p_node->node_info.node_guid)
+		    );
+		goto Exit;
+	}
+
+	/* check that the requester physp and the current physp are under
+	   the same partition. */
+	p_physp = p_port->p_physp;
+	if (!p_physp) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_sir_rcv_create_sir: ERR 530B: "
+			"Failed to find default physical Port by Node Guid:0x%016"
+			PRIx64 "\n",
+			cl_ntoh64(p_sw->p_node->node_info.node_guid)
+		    );
+		goto Exit;
+	}
+	if (!osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp))
+		goto Exit;
+
+	/* get the port 0 of the switch */
+	osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);
+
+	match_lid_ho = cl_ntoh16(match_lid);
+	if (match_lid_ho) {
+		/*
+		   We validate that the lid belongs to this switch.
+		 */
+		if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				"__osm_sir_rcv_create_sir: "
+				"Comparing LID: 0x%X <= 0x%X <= 0x%X\n",
+				min_lid_ho, match_lid_ho, max_lid_ho);
+		}
+
+		if (match_lid_ho < min_lid_ho || match_lid_ho > max_lid_ho)
+			goto Exit;
+
+	}
+
+	__osm_sir_rcv_new_sir(p_rcv, p_sw, p_list,
+			      osm_port_get_base_lid(p_port));
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sir_rcv_by_comp_mask(
-  IN cl_map_item_t*        const p_map_item,
-  IN void*                 context )
+__osm_sir_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
+			   IN void *context)
 {
-  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 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_sir_rcv_t*           const p_rcv = p_ctxt->p_rcv;
-  ib_net64_t               const comp_mask = p_ctxt->comp_mask;
-  ib_net16_t               match_lid = 0;
-
-  OSM_LOG_ENTER( p_ctxt->p_rcv->p_log, __osm_sir_rcv_by_comp_mask );
-
-  osm_dump_switch_info(
-    p_ctxt->p_rcv->p_log,
-    &p_sw->switch_info,
-    OSM_LOG_VERBOSE );
-
-  if( comp_mask & IB_SWIR_COMPMASK_LID )
-  {
-    match_lid = p_rcvd_rec->lid;
-    if (!match_lid)
-      goto Exit;
-  }
-
-  __osm_sir_rcv_create_sir( p_rcv, p_sw, p_ctxt->p_list,
-                            match_lid, p_req_physp );
-
-Exit:
-  OSM_LOG_EXIT( p_ctxt->p_rcv->p_log );
+	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 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_sir_rcv_t *const p_rcv = p_ctxt->p_rcv;
+	ib_net64_t const comp_mask = p_ctxt->comp_mask;
+	ib_net16_t match_lid = 0;
+
+	OSM_LOG_ENTER(p_ctxt->p_rcv->p_log, __osm_sir_rcv_by_comp_mask);
+
+	osm_dump_switch_info(p_ctxt->p_rcv->p_log,
+			     &p_sw->switch_info, OSM_LOG_VERBOSE);
+
+	if (comp_mask & IB_SWIR_COMPMASK_LID) {
+		match_lid = p_rcvd_rec->lid;
+		if (!match_lid)
+			goto Exit;
+	}
+
+	__osm_sir_rcv_create_sir(p_rcv, p_sw, p_ctxt->p_list,
+				 match_lid, p_req_physp);
+
+      Exit:
+	OSM_LOG_EXIT(p_ctxt->p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sir_rcv_process(
-  IN void *ctx,
-  IN void *data )
+void osm_sir_rcv_process(IN void *ctx, IN void *data)
 {
-  osm_sir_rcv_t *p_rcv = ctx;
-  osm_madw_t *p_madw = data;
-  const ib_sa_mad_t*       p_rcvd_mad;
-  const ib_switch_info_record_t*  p_rcvd_rec;
-  ib_switch_info_record_t*        p_resp_rec;
-  cl_qlist_t               rec_list;
-  osm_madw_t*              p_resp_madw;
-  ib_sa_mad_t*             p_resp_sa_mad;
-  uint32_t                 num_rec, pre_trim_num_rec;
+	osm_sir_rcv_t *p_rcv = ctx;
+	osm_madw_t *p_madw = data;
+	const ib_sa_mad_t *p_rcvd_mad;
+	const ib_switch_info_record_t *p_rcvd_rec;
+	ib_switch_info_record_t *p_resp_rec;
+	cl_qlist_t rec_list;
+	osm_madw_t *p_resp_madw;
+	ib_sa_mad_t *p_resp_sa_mad;
+	uint32_t num_rec, pre_trim_num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  uint32_t		   trim_num_rec;
+	uint32_t trim_num_rec;
 #endif
-  uint32_t                 i;
-  osm_sir_search_ctxt_t    context;
-  osm_sir_item_t*          p_rec_item;
-  ib_api_status_t          status;
-  osm_physp_t*             p_req_physp;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_sir_rcv_process );
-
-  CL_ASSERT( p_madw );
-
-  p_rcvd_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_rcvd_rec = (ib_switch_info_record_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
-
-  CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_SWITCH_INFO_RECORD );
-
-  /* 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( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_sir_rcv_process: ERR 5305: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_rcvd_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
-
-  /* update the requester physical port. */
-  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-                                          p_rcv->p_subn,
-                                          osm_madw_get_mad_addr_ptr(p_madw) );
-  if (p_req_physp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_sir_rcv_process: ERR 5304: "
-             "Cannot find requester physical port\n" );
-    goto Exit;
-  }
-
-  if ( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    osm_dump_switch_info_record( p_rcv->p_log, p_rcvd_rec, OSM_LOG_DEBUG );
-
-  cl_qlist_init( &rec_list );
-
-  context.p_rcvd_rec    = p_rcvd_rec;
-  context.p_list        = &rec_list;
-  context.comp_mask     = p_rcvd_mad->comp_mask;
-  context.p_rcv         = p_rcv;
-  context.p_req_physp   = p_req_physp;
-
-  cl_plock_acquire( p_rcv->p_lock );
-
-  /* Go over all switches */
-  cl_qmap_apply_func( &p_rcv->p_subn->sw_guid_tbl,
-                      __osm_sir_rcv_by_comp_mask,
-                      &context );
-
-  cl_plock_release( p_rcv->p_lock );
-
-  num_rec = cl_qlist_count( &rec_list );
-
-  /*
-   * C15-0.1.30:
-   * If we do a SubnAdmGet and got more than one record it is an error !
-   */
-  if ( (p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec > 1) ) {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_sir_rcv_process: ERR 5303: "
-             "Got more than one record for SubnAdmGet (%u)\n",
-             num_rec );
-    osm_sa_send_error( p_rcv->p_resp, p_madw,
-                       IB_SA_MAD_STATUS_TOO_MANY_RECORDS );
-
-    /* need to set the mem free ... */
-    p_rec_item = (osm_sir_item_t*)cl_qlist_remove_head( &rec_list );
-    while( p_rec_item != (osm_sir_item_t*)cl_qlist_end( &rec_list ) )
-    {
-      cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-      p_rec_item = (osm_sir_item_t*)cl_qlist_remove_head( &rec_list );
-    }
-
-    goto Exit;
-  }
-
-  pre_trim_num_rec = num_rec;
+	uint32_t i;
+	osm_sir_search_ctxt_t context;
+	osm_sir_item_t *p_rec_item;
+	ib_api_status_t status;
+	osm_physp_t *p_req_physp;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_sir_rcv_process);
+
+	CL_ASSERT(p_madw);
+
+	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_rcvd_rec =
+	    (ib_switch_info_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+
+	CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_SWITCH_INFO_RECORD);
+
+	/* 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(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_sir_rcv_process: ERR 5305: "
+			"Unsupported Method (%s)\n",
+			ib_get_sa_method_str(p_rcvd_mad->method));
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
+		goto Exit;
+	}
+
+	/* update the requester physical port. */
+	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+						p_rcv->p_subn,
+						osm_madw_get_mad_addr_ptr
+						(p_madw));
+	if (p_req_physp == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_sir_rcv_process: ERR 5304: "
+			"Cannot find requester physical port\n");
+		goto Exit;
+	}
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
+		osm_dump_switch_info_record(p_rcv->p_log, p_rcvd_rec,
+					    OSM_LOG_DEBUG);
+
+	cl_qlist_init(&rec_list);
+
+	context.p_rcvd_rec = p_rcvd_rec;
+	context.p_list = &rec_list;
+	context.comp_mask = p_rcvd_mad->comp_mask;
+	context.p_rcv = p_rcv;
+	context.p_req_physp = p_req_physp;
+
+	cl_plock_acquire(p_rcv->p_lock);
+
+	/* Go over all switches */
+	cl_qmap_apply_func(&p_rcv->p_subn->sw_guid_tbl,
+			   __osm_sir_rcv_by_comp_mask, &context);
+
+	cl_plock_release(p_rcv->p_lock);
+
+	num_rec = cl_qlist_count(&rec_list);
+
+	/*
+	 * C15-0.1.30:
+	 * If we do a SubnAdmGet and got more than one record it is an error !
+	 */
+	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec > 1)) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_sir_rcv_process: ERR 5303: "
+			"Got more than one record for SubnAdmGet (%u)\n",
+			num_rec);
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
+
+		/* need to set the mem free ... */
+		p_rec_item = (osm_sir_item_t *) cl_qlist_remove_head(&rec_list);
+		while (p_rec_item != (osm_sir_item_t *) cl_qlist_end(&rec_list)) {
+			cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+			p_rec_item =
+			    (osm_sir_item_t *) cl_qlist_remove_head(&rec_list);
+		}
+
+		goto Exit;
+	}
+
+	pre_trim_num_rec = num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we limit the number of records to a single packet */
-  trim_num_rec = (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_switch_info_record_t);
-  if (trim_num_rec < num_rec)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "osm_sir_rcv_process: "
-             "Number of records:%u trimmed to:%u to fit in one MAD\n",
-             num_rec, trim_num_rec );
-    num_rec = trim_num_rec;
-  }
+	/* we limit the number of records to a single packet */
+	trim_num_rec =
+	    (MAD_BLOCK_SIZE -
+	     IB_SA_MAD_HDR_SIZE) / sizeof(ib_switch_info_record_t);
+	if (trim_num_rec < num_rec) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"osm_sir_rcv_process: "
+			"Number of records:%u trimmed to:%u to fit in one MAD\n",
+			num_rec, trim_num_rec);
+		num_rec = trim_num_rec;
+	}
 #endif
 
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "osm_sir_rcv_process: "
-           "Returning %u records\n", num_rec );
-
-  if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
-  {
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-    goto Exit;
-  }
-
-  /*
-   * Get a MAD to reply. Address of Mad is in the received mad_wrapper
-   */
-  p_resp_madw = osm_mad_pool_get( p_rcv->p_mad_pool,
-                                  p_madw->h_bind,
-                                  num_rec * sizeof(ib_switch_info_record_t) + IB_SA_MAD_HDR_SIZE,
-                                  &p_madw->mad_addr );
-
-  if( !p_resp_madw )
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_sir_rcv_process: ERR 5306: "
-            "osm_mad_pool_get failed\n" );
-
-    for( i = 0; i < num_rec; i++ )
-    {
-      p_rec_item = (osm_sir_item_t*)cl_qlist_remove_head( &rec_list );
-      cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    }
-
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES );
-    goto Exit;
-  }
-
-  p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
-
-  /*
-    Copy the MAD header back into the response mad.
-    Set the 'R' bit and the payload length,
-    Then copy all records from the list into the response payload.
-  */
-
-  memcpy( p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE );
-  p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-  /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
-  p_resp_sa_mad->sm_key = 0;
-  /* Fill in the offset (paylen will be done by the rmpp SAR) */
-  p_resp_sa_mad->attr_offset =
-    ib_get_attr_offset( sizeof(ib_switch_info_record_t) );
-
-  p_resp_rec = (ib_switch_info_record_t*)ib_sa_mad_get_payload_ptr( p_resp_sa_mad );
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"osm_sir_rcv_process: " "Returning %u records\n", num_rec);
+
+	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RECORDS);
+		goto Exit;
+	}
+
+	/*
+	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
+	 */
+	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+				       p_madw->h_bind,
+				       num_rec *
+				       sizeof(ib_switch_info_record_t) +
+				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
+
+	if (!p_resp_madw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_sir_rcv_process: ERR 5306: "
+			"osm_mad_pool_get failed\n");
+
+		for (i = 0; i < num_rec; i++) {
+			p_rec_item =
+			    (osm_sir_item_t *) cl_qlist_remove_head(&rec_list);
+			cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		}
+
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RESOURCES);
+		goto Exit;
+	}
+
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+
+	/*
+	   Copy the MAD header back into the response mad.
+	   Set the 'R' bit and the payload length,
+	   Then copy all records from the list into the response payload.
+	 */
+
+	memcpy(p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE);
+	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
+	p_resp_sa_mad->sm_key = 0;
+	/* Fill in the offset (paylen will be done by the rmpp SAR) */
+	p_resp_sa_mad->attr_offset =
+	    ib_get_attr_offset(sizeof(ib_switch_info_record_t));
+
+	p_resp_rec =
+	    (ib_switch_info_record_t *)
+	    ib_sa_mad_get_payload_ptr(p_resp_sa_mad);
 
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we support only one packet RMPP - so we will set the first and
-     last flags for gettable */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-  {
-    p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST | IB_RMPP_FLAG_ACTIVE;
-  }
+	/* we support only one packet RMPP - so we will set the first and
+	   last flags for gettable */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+		p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
+		p_resp_sa_mad->rmpp_flags =
+		    IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST |
+		    IB_RMPP_FLAG_ACTIVE;
+	}
 #else
-  /* forcefully define the packet as RMPP one */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
+	/* forcefully define the packet as RMPP one */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
+		p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
 #endif
 
-  for( i = 0; i < pre_trim_num_rec; i++ )
-  {
-    p_rec_item = (osm_sir_item_t*)cl_qlist_remove_head( &rec_list );
-    /* copy only if not trimmed */
-    if (i < num_rec)
-    {
-      *p_resp_rec = p_rec_item->rec;
-    }
-    cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    p_resp_rec++;
-  }
-
-  CL_ASSERT( cl_is_qlist_empty( &rec_list ) );
-
-  status = osm_vendor_send( p_resp_madw->h_bind, p_resp_madw, FALSE );
-  if (status != IB_SUCCESS)
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_sir_rcv_process: ERR 5307: "
-            "osm_vendor_send status = %s\n",
-            ib_get_err_str(status));
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	for (i = 0; i < pre_trim_num_rec; i++) {
+		p_rec_item = (osm_sir_item_t *) cl_qlist_remove_head(&rec_list);
+		/* copy only if not trimmed */
+		if (i < num_rec) {
+			*p_resp_rec = p_rec_item->rec;
+		}
+		cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		p_resp_rec++;
+	}
+
+	CL_ASSERT(cl_is_qlist_empty(&rec_list));
+
+	status = osm_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE);
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_sir_rcv_process: ERR 5307: "
+			"osm_vendor_send status = %s\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_sa_vlarb_record.c b/opensm/opensm/osm_sa_vlarb_record.c
index f88da8d..3350af0 100644
--- a/opensm/opensm/osm_sa_vlarb_record.c
+++ b/opensm/opensm/osm_sa_vlarb_record.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -65,508 +65,495 @@
 #define OSM_VLARB_REC_RCV_POOL_MIN_SIZE      32
 #define OSM_VLARB_REC_RCV_POOL_GROW_SIZE     32
 
-typedef  struct _osm_vl_arb_item
-{
-  cl_pool_item_t           pool_item;
-  ib_vl_arb_table_record_t rec;
+typedef struct _osm_vl_arb_item {
+	cl_pool_item_t pool_item;
+	ib_vl_arb_table_record_t rec;
 } osm_vl_arb_item_t;
 
-typedef  struct _osm_vl_arb_search_ctxt
-{
-  const ib_vl_arb_table_record_t* p_rcvd_rec;
-  ib_net64_t                    comp_mask;
-  uint8_t                       block_num;
-  cl_qlist_t*                   p_list;
-  osm_vlarb_rec_rcv_t*          p_rcv;
-  const osm_physp_t*            p_req_physp;
+typedef struct _osm_vl_arb_search_ctxt {
+	const ib_vl_arb_table_record_t *p_rcvd_rec;
+	ib_net64_t comp_mask;
+	uint8_t block_num;
+	cl_qlist_t *p_list;
+	osm_vlarb_rec_rcv_t *p_rcv;
+	const osm_physp_t *p_req_physp;
 } osm_vl_arb_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_vlarb_rec_rcv_construct(
-  IN osm_vlarb_rec_rcv_t* const p_rcv )
+void osm_vlarb_rec_rcv_construct(IN osm_vlarb_rec_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
-  cl_qlock_pool_construct( &p_rcv->pool );
+	memset(p_rcv, 0, sizeof(*p_rcv));
+	cl_qlock_pool_construct(&p_rcv->pool);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_vlarb_rec_rcv_destroy(
-  IN osm_vlarb_rec_rcv_t* const p_rcv )
+void osm_vlarb_rec_rcv_destroy(IN osm_vlarb_rec_rcv_t * const p_rcv)
 {
-  OSM_LOG_ENTER( p_rcv->p_log, osm_vlarb_rec_rcv_destroy );
-  cl_qlock_pool_destroy( &p_rcv->pool );
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_vlarb_rec_rcv_destroy);
+	cl_qlock_pool_destroy(&p_rcv->pool);
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_vlarb_rec_rcv_init(
-  IN osm_vlarb_rec_rcv_t*  const p_rcv,
-  IN osm_sa_resp_t*        const p_resp,
-  IN osm_mad_pool_t*       const p_mad_pool,
-  IN const osm_subn_t*     const p_subn,
-  IN osm_log_t*            const p_log,
-  IN cl_plock_t*           const p_lock )
+osm_vlarb_rec_rcv_init(IN osm_vlarb_rec_rcv_t * const p_rcv,
+		       IN osm_sa_resp_t * const p_resp,
+		       IN osm_mad_pool_t * const p_mad_pool,
+		       IN const osm_subn_t * const p_subn,
+		       IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t          status;
+	ib_api_status_t status;
 
-  OSM_LOG_ENTER( p_log, osm_vlarb_rec_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_vlarb_rec_rcv_init);
 
-  osm_vlarb_rec_rcv_construct( p_rcv );
+	osm_vlarb_rec_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_resp = p_resp;
-  p_rcv->p_mad_pool = p_mad_pool;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_resp = p_resp;
+	p_rcv->p_mad_pool = p_mad_pool;
 
-  /* used for matching records collection */
-  status = cl_qlock_pool_init( &p_rcv->pool,
-                               OSM_VLARB_REC_RCV_POOL_MIN_SIZE,
-                               0,
-                               OSM_VLARB_REC_RCV_POOL_GROW_SIZE,
-                               sizeof(osm_vl_arb_item_t),
-                               NULL, NULL, NULL );
+	/* used for matching records collection */
+	status = cl_qlock_pool_init(&p_rcv->pool,
+				    OSM_VLARB_REC_RCV_POOL_MIN_SIZE,
+				    0,
+				    OSM_VLARB_REC_RCV_POOL_GROW_SIZE,
+				    sizeof(osm_vl_arb_item_t),
+				    NULL, NULL, NULL);
 
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-__osm_sa_vl_arb_create(
-  IN osm_vlarb_rec_rcv_t*        const p_rcv,
-  IN osm_physp_t*                const p_physp,
-  IN osm_vl_arb_search_ctxt_t*   const p_ctxt,
-  IN uint8_t                     block )
+__osm_sa_vl_arb_create(IN osm_vlarb_rec_rcv_t * const p_rcv,
+		       IN osm_physp_t * const p_physp,
+		       IN osm_vl_arb_search_ctxt_t * const 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( p_rcv->p_log, __osm_sa_vl_arb_create );
-
-  p_rec_item = (osm_vl_arb_item_t*)cl_qlock_pool_get( &p_rcv->pool );
-  if( p_rec_item == NULL )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_sa_vl_arb_create: ERR 2A02: "
-             "cl_qlock_pool_get failed\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
-  if (p_physp->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH)
-    lid = p_physp->port_info.base_lid;
-  else
-    lid = osm_node_get_base_lid( p_physp->p_node, 0 );
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_sa_vl_arb_create: "
-             "New VLArbitration for: port 0x%016" PRIx64
-             ", lid 0x%X, port 0x%X Block:%u\n",
-             cl_ntoh64( osm_physp_get_port_guid( p_physp ) ),
-             cl_ntoh16( lid ), osm_physp_get_port_num( p_physp ),
-             block
-             );
-  }
-
-  memset( &p_rec_item->rec, 0, sizeof( p_rec_item->rec ) );
-
-  p_rec_item->rec.lid = lid;
-  p_rec_item->rec.port_num = osm_physp_get_port_num( p_physp );
-  p_rec_item->rec.block_num = block;
-  p_rec_item->rec.vl_arb_tbl = *(osm_physp_get_vla_tbl(p_physp, block));
-
-  cl_qlist_insert_tail( p_ctxt->p_list, (cl_list_item_t*)&p_rec_item->pool_item );
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_vl_arb_item_t *p_rec_item;
+	uint16_t lid;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_vl_arb_create);
+
+	p_rec_item = (osm_vl_arb_item_t *) cl_qlock_pool_get(&p_rcv->pool);
+	if (p_rec_item == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_sa_vl_arb_create: ERR 2A02: "
+			"cl_qlock_pool_get failed\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+	if (p_physp->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH)
+		lid = p_physp->port_info.base_lid;
+	else
+		lid = osm_node_get_base_lid(p_physp->p_node, 0);
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_sa_vl_arb_create: "
+			"New VLArbitration for: port 0x%016" PRIx64
+			", lid 0x%X, port 0x%X Block:%u\n",
+			cl_ntoh64(osm_physp_get_port_guid(p_physp)),
+			cl_ntoh16(lid), osm_physp_get_port_num(p_physp), block);
+	}
+
+	memset(&p_rec_item->rec, 0, sizeof(p_rec_item->rec));
+
+	p_rec_item->rec.lid = lid;
+	p_rec_item->rec.port_num = osm_physp_get_port_num(p_physp);
+	p_rec_item->rec.block_num = block;
+	p_rec_item->rec.vl_arb_tbl = *(osm_physp_get_vla_tbl(p_physp, block));
+
+	cl_qlist_insert_tail(p_ctxt->p_list,
+			     (cl_list_item_t *) & p_rec_item->pool_item);
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-__osm_sa_vl_arb_check_physp(
-  IN osm_vlarb_rec_rcv_t*   const p_rcv,
-  IN osm_physp_t*           const p_physp,
-  osm_vl_arb_search_ctxt_t* const p_ctxt )
+__osm_sa_vl_arb_check_physp(IN osm_vlarb_rec_rcv_t * const p_rcv,
+			    IN osm_physp_t * const p_physp,
+			    osm_vl_arb_search_ctxt_t * const p_ctxt)
 {
-  ib_net64_t                comp_mask = p_ctxt->comp_mask;
-  uint8_t                   block;
+	ib_net64_t comp_mask = p_ctxt->comp_mask;
+	uint8_t block;
 
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_sa_vl_arb_check_physp );
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_vl_arb_check_physp);
 
-  /* 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( p_rcv, p_physp, p_ctxt, block );
-    }
-  }
+	/* 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(p_rcv, p_physp, p_ctxt, block);
+		}
+	}
 
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-__osm_sa_vl_arb_by_comp_mask(
-  IN osm_vlarb_rec_rcv_t*     const p_rcv,
-  IN const osm_port_t*        const p_port,
-  osm_vl_arb_search_ctxt_t*   const p_ctxt )
+__osm_sa_vl_arb_by_comp_mask(IN osm_vlarb_rec_rcv_t * const p_rcv,
+			     IN const osm_port_t * const p_port,
+			     osm_vl_arb_search_ctxt_t * const p_ctxt)
 {
-  const ib_vl_arb_table_record_t*   p_rcvd_rec;
-  ib_net64_t                  comp_mask;
-  osm_physp_t *               p_physp;
-  uint8_t                     port_num;
-  uint8_t                     num_ports;
-  const osm_physp_t*          p_req_physp;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_sa_vl_arb_by_comp_mask );
-
-  p_rcvd_rec = p_ctxt->p_rcvd_rec;
-  comp_mask = p_ctxt->comp_mask;
-  port_num = p_rcvd_rec->port_num;
-  p_req_physp = p_ctxt->p_req_physp;
-
-  /* if this is a switch port we can search all ports
-     otherwise we must be looking on port 0 */
-  if ( p_port->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH)
-  {
-    /* we put it in the comp mask and port num */
-    port_num = p_port->p_physp->port_num;
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_sa_vl_arb_by_comp_mask:  "
-             "Using Physical Default Port Number: 0x%X (for End Node)\n",
-             port_num );
-    comp_mask |= IB_VLA_COMPMASK_OUT_PORT;
-  }
-
-  if( comp_mask & IB_VLA_COMPMASK_OUT_PORT )
-  {
-    if (port_num < osm_node_get_num_physp( p_port->p_node ))
-    {
-      p_physp = osm_node_get_physp_ptr( p_port->p_node, port_num );
-      /* check that the p_physp is valid, and that the requester
-         and the p_physp share a pkey. */
-      if( osm_physp_is_valid( p_physp ) &&
-          osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp) )
-        __osm_sa_vl_arb_check_physp( p_rcv, p_physp, p_ctxt );
-    }
-    else
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "__osm_sa_vl_arb_by_comp_mask: ERR 2A03: "
-               "Given Physical Port Number: 0x%X is out of range should be < 0x%X\n",
-               port_num, osm_node_get_num_physp( p_port->p_node ) );
-      goto Exit;
-    }
-  }
-  else
-  {
-    num_ports = osm_node_get_num_physp( p_port->p_node );
-    for( port_num = 0; port_num < num_ports; port_num++ )
-    {
-      p_physp = osm_node_get_physp_ptr( p_port->p_node, port_num );
-      if( !osm_physp_is_valid( p_physp ) )
-        continue;
-
-      /* if the requester and the p_physp don't share a pkey -
-         continue */
-      if (!osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp))
-        continue;
-
-      __osm_sa_vl_arb_check_physp( p_rcv, p_physp, p_ctxt );
-    }
-  }
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	const ib_vl_arb_table_record_t *p_rcvd_rec;
+	ib_net64_t comp_mask;
+	osm_physp_t *p_physp;
+	uint8_t port_num;
+	uint8_t num_ports;
+	const osm_physp_t *p_req_physp;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_vl_arb_by_comp_mask);
+
+	p_rcvd_rec = p_ctxt->p_rcvd_rec;
+	comp_mask = p_ctxt->comp_mask;
+	port_num = p_rcvd_rec->port_num;
+	p_req_physp = p_ctxt->p_req_physp;
+
+	/* if this is a switch port we can search all ports
+	   otherwise we must be looking on port 0 */
+	if (p_port->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH) {
+		/* we put it in the comp mask and port num */
+		port_num = p_port->p_physp->port_num;
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_sa_vl_arb_by_comp_mask:  "
+			"Using Physical Default Port Number: 0x%X (for End Node)\n",
+			port_num);
+		comp_mask |= IB_VLA_COMPMASK_OUT_PORT;
+	}
+
+	if (comp_mask & IB_VLA_COMPMASK_OUT_PORT) {
+		if (port_num < osm_node_get_num_physp(p_port->p_node)) {
+			p_physp =
+			    osm_node_get_physp_ptr(p_port->p_node, port_num);
+			/* check that the p_physp is valid, and that the requester
+			   and the p_physp share a pkey. */
+			if (osm_physp_is_valid(p_physp) &&
+			    osm_physp_share_pkey(p_rcv->p_log, p_req_physp,
+						 p_physp))
+				__osm_sa_vl_arb_check_physp(p_rcv, p_physp,
+							    p_ctxt);
+		} else {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"__osm_sa_vl_arb_by_comp_mask: ERR 2A03: "
+				"Given Physical Port Number: 0x%X is out of range should be < 0x%X\n",
+				port_num,
+				osm_node_get_num_physp(p_port->p_node));
+			goto Exit;
+		}
+	} else {
+		num_ports = osm_node_get_num_physp(p_port->p_node);
+		for (port_num = 0; port_num < num_ports; port_num++) {
+			p_physp =
+			    osm_node_get_physp_ptr(p_port->p_node, port_num);
+			if (!osm_physp_is_valid(p_physp))
+				continue;
+
+			/* if the requester and the p_physp don't share a pkey -
+			   continue */
+			if (!osm_physp_share_pkey
+			    (p_rcv->p_log, p_req_physp, p_physp))
+				continue;
+
+			__osm_sa_vl_arb_check_physp(p_rcv, p_physp, p_ctxt);
+		}
+	}
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-__osm_sa_vl_arb_by_comp_mask_cb(
-  IN cl_map_item_t*         const p_map_item,
-  IN void*                  context )
+__osm_sa_vl_arb_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
+				IN void *context)
 {
-  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 *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;
 
-  __osm_sa_vl_arb_by_comp_mask( p_ctxt->p_rcv, p_port, p_ctxt );
+	__osm_sa_vl_arb_by_comp_mask(p_ctxt->p_rcv, p_port, p_ctxt);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_vlarb_rec_rcv_process(
-  IN void *ctx,
-  IN void *data )
+void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 {
-  osm_vlarb_rec_rcv_t *p_rcv = ctx;
-  osm_madw_t *p_madw = data;
-  const ib_sa_mad_t*       p_rcvd_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_madw_t*              p_resp_madw;
-  ib_sa_mad_t*             p_resp_sa_mad;
-  ib_vl_arb_table_record_t*    p_resp_rec;
-  uint32_t                 num_rec, pre_trim_num_rec;
+	osm_vlarb_rec_rcv_t *p_rcv = ctx;
+	osm_madw_t *p_madw = data;
+	const ib_sa_mad_t *p_rcvd_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_madw_t *p_resp_madw;
+	ib_sa_mad_t *p_resp_sa_mad;
+	ib_vl_arb_table_record_t *p_resp_rec;
+	uint32_t num_rec, pre_trim_num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  uint32_t		   trim_num_rec;
+	uint32_t trim_num_rec;
 #endif
-  uint32_t                 i;
-  osm_vl_arb_search_ctxt_t context;
-  osm_vl_arb_item_t*       p_rec_item;
-  ib_api_status_t          status = IB_SUCCESS;
-  ib_net64_t               comp_mask;
-  osm_physp_t*             p_req_physp;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_vlarb_rec_rcv_process );
-
-  CL_ASSERT( p_madw );
-
-  p_rcvd_mad = osm_madw_get_sa_mad_ptr( p_madw );
-  p_rcvd_rec = (ib_vl_arb_table_record_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
-  comp_mask = p_rcvd_mad->comp_mask;
-
-  CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_VLARB_RECORD );
-
-  /* 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( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_vlarb_rec_rcv_process: ERR 2A05: "
-             "Unsupported Method (%s)\n",
-             ib_get_sa_method_str( p_rcvd_mad->method ) );
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR );
-    goto Exit;
-  }
-
-  /* update the requester physical port. */
-  p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-                                          p_rcv->p_subn,
-                                          osm_madw_get_mad_addr_ptr(p_madw) );
-  if (p_req_physp == NULL)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_vlarb_rec_rcv_process: ERR 2A04: "
-             "Cannot find requester physical port\n" );
-    goto Exit;
-  }
-
-  p_vl_arb = (ib_vl_arb_table_t*)ib_sa_mad_get_payload_ptr( p_rcvd_mad );
-
-  cl_qlist_init( &rec_list );
-
-  context.p_rcvd_rec = p_rcvd_rec;
-  context.p_list = &rec_list;
-  context.comp_mask = p_rcvd_mad->comp_mask;
-  context.p_rcv = p_rcv;
-  context.block_num = p_rcvd_rec->block_num;
-  context.p_req_physp = p_req_physp;
-
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "osm_vlarb_rec_rcv_process: "
-           "Got Query Lid:0x%04X(%02X), Port:0x%02X(%02X), Block:0x%02X(%02X)\n",
-           cl_ntoh16(p_rcvd_rec->lid),  (comp_mask & IB_VLA_COMPMASK_LID) != 0,
-           p_rcvd_rec->port_num, (comp_mask & IB_VLA_COMPMASK_OUT_PORT) != 0,
-           p_rcvd_rec->block_num, (comp_mask & IB_VLA_COMPMASK_BLOCK) != 0 );
-
-  cl_plock_acquire( p_rcv->p_lock );
-
-  /*
-    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_VLA_COMPMASK_LID )
-  {
-
-    p_tbl = &p_rcv->p_subn->port_lid_tbl;
-
-    CL_ASSERT( cl_ptr_vector_get_size(p_tbl) < 0x10000 );
-
-    status = osm_get_port_by_base_lid( p_rcv->p_subn, p_rcvd_rec->lid, &p_port );
-    if ( ( status != IB_SUCCESS ) || ( p_port == NULL ) )
-    {
-      status = IB_NOT_FOUND;
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_vlarb_rec_rcv_process: ERR 2A09: "
-               "No port found with LID 0x%x\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_vl_arb_by_comp_mask( p_rcv, p_port, &context );
-    else
-    {
-      cl_qmap_apply_func( &p_rcv->p_subn->port_guid_tbl,
-                          __osm_sa_vl_arb_by_comp_mask_cb,
-                          &context );
-    }
-  }
-
-  cl_plock_release( p_rcv->p_lock );
-
-  num_rec = cl_qlist_count( &rec_list );
-
-  /*
-   * C15-0.1.30:
-   * If we do a SubnAdmGet and got more than one record it is an error !
-   */
-  if (p_rcvd_mad->method == IB_MAD_METHOD_GET)
-  {
-    if (num_rec == 0)
-    {
-      osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-      goto Exit;
-    }
-    if (num_rec > 1)
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_vlarb_rec_rcv_process:  ERR 2A08: "
-               "Got more than one record for SubnAdmGet (%u)\n",
-               num_rec );
-      osm_sa_send_error( p_rcv->p_resp, p_madw,
-                         IB_SA_MAD_STATUS_TOO_MANY_RECORDS );
-
-      /* need to set the mem free ... */
-      p_rec_item = (osm_vl_arb_item_t*)cl_qlist_remove_head( &rec_list );
-      while( p_rec_item != (osm_vl_arb_item_t*)cl_qlist_end( &rec_list ) )
-      {
-        cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-        p_rec_item = (osm_vl_arb_item_t*)cl_qlist_remove_head( &rec_list );
-      }
-
-      goto Exit;
-    }
-  }
-
-  pre_trim_num_rec = num_rec;
+	uint32_t i;
+	osm_vl_arb_search_ctxt_t context;
+	osm_vl_arb_item_t *p_rec_item;
+	ib_api_status_t status = IB_SUCCESS;
+	ib_net64_t comp_mask;
+	osm_physp_t *p_req_physp;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_vlarb_rec_rcv_process);
+
+	CL_ASSERT(p_madw);
+
+	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	p_rcvd_rec =
+	    (ib_vl_arb_table_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+	comp_mask = p_rcvd_mad->comp_mask;
+
+	CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_VLARB_RECORD);
+
+	/* 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(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_vlarb_rec_rcv_process: ERR 2A05: "
+			"Unsupported Method (%s)\n",
+			ib_get_sa_method_str(p_rcvd_mad->method));
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
+		goto Exit;
+	}
+
+	/* update the requester physical port. */
+	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+						p_rcv->p_subn,
+						osm_madw_get_mad_addr_ptr
+						(p_madw));
+	if (p_req_physp == NULL) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_vlarb_rec_rcv_process: ERR 2A04: "
+			"Cannot find requester physical port\n");
+		goto Exit;
+	}
+
+	p_vl_arb = (ib_vl_arb_table_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+
+	cl_qlist_init(&rec_list);
+
+	context.p_rcvd_rec = p_rcvd_rec;
+	context.p_list = &rec_list;
+	context.comp_mask = p_rcvd_mad->comp_mask;
+	context.p_rcv = p_rcv;
+	context.block_num = p_rcvd_rec->block_num;
+	context.p_req_physp = p_req_physp;
+
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"osm_vlarb_rec_rcv_process: "
+		"Got Query Lid:0x%04X(%02X), Port:0x%02X(%02X), Block:0x%02X(%02X)\n",
+		cl_ntoh16(p_rcvd_rec->lid),
+		(comp_mask & IB_VLA_COMPMASK_LID) != 0, p_rcvd_rec->port_num,
+		(comp_mask & IB_VLA_COMPMASK_OUT_PORT) != 0,
+		p_rcvd_rec->block_num,
+		(comp_mask & IB_VLA_COMPMASK_BLOCK) != 0);
+
+	cl_plock_acquire(p_rcv->p_lock);
+
+	/*
+	   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_VLA_COMPMASK_LID) {
+
+		p_tbl = &p_rcv->p_subn->port_lid_tbl;
+
+		CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000);
+
+		status =
+		    osm_get_port_by_base_lid(p_rcv->p_subn, p_rcvd_rec->lid,
+					     &p_port);
+		if ((status != IB_SUCCESS) || (p_port == NULL)) {
+			status = IB_NOT_FOUND;
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_vlarb_rec_rcv_process: ERR 2A09: "
+				"No port found with LID 0x%x\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_vl_arb_by_comp_mask(p_rcv, p_port, &context);
+		else {
+			cl_qmap_apply_func(&p_rcv->p_subn->port_guid_tbl,
+					   __osm_sa_vl_arb_by_comp_mask_cb,
+					   &context);
+		}
+	}
+
+	cl_plock_release(p_rcv->p_lock);
+
+	num_rec = cl_qlist_count(&rec_list);
+
+	/*
+	 * C15-0.1.30:
+	 * If we do a SubnAdmGet and got more than one record it is an error !
+	 */
+	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
+		if (num_rec == 0) {
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_NO_RECORDS);
+			goto Exit;
+		}
+		if (num_rec > 1) {
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_vlarb_rec_rcv_process:  ERR 2A08: "
+				"Got more than one record for SubnAdmGet (%u)\n",
+				num_rec);
+			osm_sa_send_error(p_rcv->p_resp, p_madw,
+					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
+
+			/* need to set the mem free ... */
+			p_rec_item =
+			    (osm_vl_arb_item_t *)
+			    cl_qlist_remove_head(&rec_list);
+			while (p_rec_item !=
+			       (osm_vl_arb_item_t *) cl_qlist_end(&rec_list)) {
+				cl_qlock_pool_put(&p_rcv->pool,
+						  &p_rec_item->pool_item);
+				p_rec_item =
+				    (osm_vl_arb_item_t *)
+				    cl_qlist_remove_head(&rec_list);
+			}
+
+			goto Exit;
+		}
+	}
+
+	pre_trim_num_rec = num_rec;
 #ifndef VENDOR_RMPP_SUPPORT
-  trim_num_rec = (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_vl_arb_table_record_t);
-  if (trim_num_rec < num_rec)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "osm_vlarb_rec_rcv_process: "
-             "Number of records:%u trimmed to:%u to fit in one MAD\n",
-             num_rec, trim_num_rec );
-    num_rec = trim_num_rec;
-  }
+	trim_num_rec =
+	    (MAD_BLOCK_SIZE -
+	     IB_SA_MAD_HDR_SIZE) / sizeof(ib_vl_arb_table_record_t);
+	if (trim_num_rec < num_rec) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"osm_vlarb_rec_rcv_process: "
+			"Number of records:%u trimmed to:%u to fit in one MAD\n",
+			num_rec, trim_num_rec);
+		num_rec = trim_num_rec;
+	}
 #endif
 
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "osm_vlarb_rec_rcv_process: "
-           "Returning %u records\n", num_rec );
-
-  if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
-  {
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RECORDS );
-    goto Exit;
-  }
-
-  /*
-   * Get a MAD to reply. Address of Mad is in the received mad_wrapper
-   */
-  p_resp_madw = osm_mad_pool_get( p_rcv->p_mad_pool,
-                                  p_madw->h_bind,
-                                  num_rec * sizeof(ib_vl_arb_table_record_t) + IB_SA_MAD_HDR_SIZE,
-                                  &p_madw->mad_addr );
-
-  if( !p_resp_madw )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_vlarb_rec_rcv_process: ERR 2A06: "
-             "osm_mad_pool_get failed\n" );
-
-    for( i = 0; i < num_rec; i++ )
-    {
-      p_rec_item = (osm_vl_arb_item_t*)cl_qlist_remove_head( &rec_list );
-      cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    }
-
-    osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES );
-    goto Exit;
-  }
-
-  p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
-
-  /*
-    Copy the MAD header back into the response mad.
-    Set the 'R' bit and the payload length,
-    Then copy all records from the list into the response payload.
-  */
-
-  memcpy( p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE );
-  p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
-  /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
-  p_resp_sa_mad->sm_key = 0;
-
-  /* Fill in the offset (paylen will be done by the rmpp SAR) */
-  p_resp_sa_mad->attr_offset =
-    ib_get_attr_offset( sizeof(ib_vl_arb_table_record_t) );
-
-  p_resp_rec = (ib_vl_arb_table_record_t*)
-    ib_sa_mad_get_payload_ptr( p_resp_sa_mad );
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"osm_vlarb_rec_rcv_process: "
+		"Returning %u records\n", num_rec);
+
+	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RECORDS);
+		goto Exit;
+	}
+
+	/*
+	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
+	 */
+	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+				       p_madw->h_bind,
+				       num_rec *
+				       sizeof(ib_vl_arb_table_record_t) +
+				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
+
+	if (!p_resp_madw) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_vlarb_rec_rcv_process: ERR 2A06: "
+			"osm_mad_pool_get failed\n");
+
+		for (i = 0; i < num_rec; i++) {
+			p_rec_item =
+			    (osm_vl_arb_item_t *)
+			    cl_qlist_remove_head(&rec_list);
+			cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		}
+
+		osm_sa_send_error(p_rcv->p_resp, p_madw,
+				  IB_SA_MAD_STATUS_NO_RESOURCES);
+		goto Exit;
+	}
+
+	p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);
+
+	/*
+	   Copy the MAD header back into the response mad.
+	   Set the 'R' bit and the payload length,
+	   Then copy all records from the list into the response payload.
+	 */
+
+	memcpy(p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE);
+	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
+	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
+	p_resp_sa_mad->sm_key = 0;
+
+	/* Fill in the offset (paylen will be done by the rmpp SAR) */
+	p_resp_sa_mad->attr_offset =
+	    ib_get_attr_offset(sizeof(ib_vl_arb_table_record_t));
+
+	p_resp_rec = (ib_vl_arb_table_record_t *)
+	    ib_sa_mad_get_payload_ptr(p_resp_sa_mad);
 
 #ifndef VENDOR_RMPP_SUPPORT
-  /* we support only one packet RMPP - so we will set the first and
-     last flags for gettable */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-  {
-    p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST | IB_RMPP_FLAG_ACTIVE;
-  }
+	/* we support only one packet RMPP - so we will set the first and
+	   last flags for gettable */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {
+		p_resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;
+		p_resp_sa_mad->rmpp_flags =
+		    IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST |
+		    IB_RMPP_FLAG_ACTIVE;
+	}
 #else
-  /* forcefully define the packet as RMPP one */
-  if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
-    p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
+	/* forcefully define the packet as RMPP one */
+	if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)
+		p_resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
 #endif
 
-  for( i = 0; i < pre_trim_num_rec; i++ )
-  {
-    p_rec_item = (osm_vl_arb_item_t*)cl_qlist_remove_head( &rec_list );
-    /* copy only if not trimmed */
-    if (i < num_rec)
-    {
-      *p_resp_rec = p_rec_item->rec;
-    }
-    cl_qlock_pool_put( &p_rcv->pool, &p_rec_item->pool_item );
-    p_resp_rec++;
-  }
-
-  CL_ASSERT( cl_is_qlist_empty( &rec_list ) );
-
-  status = osm_vendor_send( p_resp_madw->h_bind, p_resp_madw, FALSE );
-  if(status != IB_SUCCESS)
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_vlarb_rec_rcv_process: ERR 2A07: "
-             "osm_vendor_send status = %s\n",
-             ib_get_err_str(status) );
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	for (i = 0; i < pre_trim_num_rec; i++) {
+		p_rec_item =
+		    (osm_vl_arb_item_t *) cl_qlist_remove_head(&rec_list);
+		/* copy only if not trimmed */
+		if (i < num_rec) {
+			*p_resp_rec = p_rec_item->rec;
+		}
+		cl_qlock_pool_put(&p_rcv->pool, &p_rec_item->pool_item);
+		p_resp_rec++;
+	}
+
+	CL_ASSERT(cl_is_qlist_empty(&rec_list));
+
+	status = osm_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE);
+	if (status != IB_SUCCESS) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_vlarb_rec_rcv_process: ERR 2A07: "
+			"osm_vendor_send status = %s\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_service.c b/opensm/opensm/osm_service.c
index 2f7d545..fcbdee3 100644
--- a/opensm/opensm/osm_service.c
+++ b/opensm/opensm/osm_service.c
@@ -45,7 +45,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <complib/cl_debug.h>
@@ -54,139 +54,120 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_svcr_delete(
-  IN osm_svcr_t* const p_svcr )
+void osm_svcr_delete(IN osm_svcr_t * const p_svcr)
 {
-  free( 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  )
+osm_svcr_init(IN osm_svcr_t * const p_svcr,
+	      IN const ib_service_record_t * p_svc_rec)
 {
-  CL_ASSERT( p_svcr );
+	CL_ASSERT(p_svcr);
 
-  p_svcr->modified_time = cl_get_time_stamp_sec();
+	p_svcr->modified_time = cl_get_time_stamp_sec();
 
-  /* We track the time left for this service in
-     an external field to avoid extra cl_ntoh/hton
-     required for working with the MAD field */
-  p_svcr->lease_period = cl_ntoh32(p_svc_rec->service_lease);
-  p_svcr->service_record = *p_svc_rec;
+	/* We track the time left for this service in
+	   an external field to avoid extra cl_ntoh/hton
+	   required for working with the MAD field */
+	p_svcr->lease_period = cl_ntoh32(p_svc_rec->service_lease);
+	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 *osm_svcr_new(IN const ib_service_record_t * p_svc_rec)
 {
-  osm_svcr_t* p_svcr;
+	osm_svcr_t *p_svcr;
 
-  CL_ASSERT(p_svc_rec);
+	CL_ASSERT(p_svc_rec);
 
-  p_svcr = (osm_svcr_t*)malloc( sizeof(*p_svcr) );
-  if( p_svcr )
-  {
-    memset( p_svcr, 0, sizeof(*p_svcr) );
-    osm_svcr_init( p_svcr, p_svc_rec );
-  }
+	p_svcr = (osm_svcr_t *) malloc(sizeof(*p_svcr));
+	if (p_svcr) {
+		memset(p_svcr, 0, sizeof(*p_svcr));
+		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 )
+    cl_status_t
+__match_rid_of_svc_rec(IN const cl_list_item_t * const 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
-    return CL_NOT_FOUND;
+	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
+		return CL_NOT_FOUND;
 
 }
 
 /**********************************************************************
  **********************************************************************/
-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 )
+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)
 {
-  cl_list_item_t* p_list_item;
+	cl_list_item_t *p_list_item;
 
-  OSM_LOG_ENTER( p_log, osm_svcr_get_by_rid );
+	OSM_LOG_ENTER(p_log, osm_svcr_get_by_rid);
 
-  p_list_item = cl_qlist_find_from_head(
-    &p_subn->sa_sr_list,
-    __match_rid_of_svc_rec,
-    p_svc_rec);
+	p_list_item = cl_qlist_find_from_head(&p_subn->sa_sr_list,
+					      __match_rid_of_svc_rec,
+					      p_svc_rec);
 
-  if( p_list_item == cl_qlist_end( &p_subn->sa_sr_list ) )
-    p_list_item = NULL;
+	if (p_list_item == cl_qlist_end(&p_subn->sa_sr_list))
+		p_list_item = NULL;
 
-  OSM_LOG_EXIT( p_log );
-  return (osm_svcr_t*)p_list_item;
+	OSM_LOG_EXIT(p_log);
+	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)
+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, osm_svcr_insert_to_db );
+	OSM_LOG_ENTER(p_log, osm_svcr_insert_to_db);
 
-  osm_log( p_log, OSM_LOG_DEBUG,
-           "osm_svcr_insert_to_db: "
-           "Inserting new Service Record into Database\n");
+	osm_log(p_log, OSM_LOG_DEBUG,
+		"osm_svcr_insert_to_db: "
+		"Inserting new Service Record into Database\n");
 
-  cl_qlist_insert_head(&p_subn->sa_sr_list,
-                       &p_svcr->list_item);
+	cl_qlist_insert_head(&p_subn->sa_sr_list, &p_svcr->list_item);
 
-  OSM_LOG_EXIT( p_log );
+	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)
+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, osm_svcr_remove_from_db );
+	OSM_LOG_ENTER(p_log, osm_svcr_remove_from_db);
 
-  osm_log( p_log, OSM_LOG_DEBUG,
-           "osm_svcr_remove_from_db: "
-           "Removing Service Record Name:%s ID:0x%016" PRIx64" from Database\n",
-           p_svcr->service_record.service_name, p_svcr->service_record.service_id
-           );
+	osm_log(p_log, OSM_LOG_DEBUG,
+		"osm_svcr_remove_from_db: "
+		"Removing Service Record Name:%s ID:0x%016" PRIx64
+		" from Database\n", p_svcr->service_record.service_name,
+		p_svcr->service_record.service_id);
 
-  cl_qlist_remove_item(&p_subn->sa_sr_list,
-                       &p_svcr->list_item);
+	cl_qlist_remove_item(&p_subn->sa_sr_list, &p_svcr->list_item);
 
-  OSM_LOG_EXIT( p_log );
+	OSM_LOG_EXIT(p_log);
 }
-
diff --git a/opensm/opensm/osm_slvl_map_rcv.c b/opensm/opensm/osm_slvl_map_rcv.c
index 0b44f58..e3942fb 100644
--- a/opensm/opensm/osm_slvl_map_rcv.c
+++ b/opensm/opensm/osm_slvl_map_rcv.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of osm_slvl_rcv_t.
@@ -48,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -69,49 +68,43 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_slvl_rcv_construct(
-  IN osm_slvl_rcv_t* const p_rcv )
+void osm_slvl_rcv_construct(IN osm_slvl_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
+	memset(p_rcv, 0, sizeof(*p_rcv));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_slvl_rcv_destroy(
-  IN osm_slvl_rcv_t* const p_rcv )
+void osm_slvl_rcv_destroy(IN osm_slvl_rcv_t * const p_rcv)
 {
-  CL_ASSERT( p_rcv );
+	CL_ASSERT(p_rcv);
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_slvl_rcv_destroy );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_slvl_rcv_destroy);
 
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_slvl_rcv_init(
-  IN osm_slvl_rcv_t* const p_rcv,
-  IN osm_req_t* const p_req,
-  IN osm_subn_t* const p_subn,
-  IN osm_log_t* const p_log,
-  IN cl_plock_t* const p_lock )
+osm_slvl_rcv_init(IN osm_slvl_rcv_t * const p_rcv,
+		  IN osm_req_t * const p_req,
+		  IN osm_subn_t * const p_subn,
+		  IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_slvl_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_slvl_rcv_init);
 
-  osm_slvl_rcv_construct( p_rcv );
+	osm_slvl_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_req = p_req;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_req = p_req;
 
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
@@ -119,114 +112,101 @@ osm_slvl_rcv_init(
 /*
  * WE MIGHT ONLY RECEIVE A GET or SET responses
  */
-void
-osm_slvl_rcv_process(
-  IN void *context,
-  IN void *p_data )
+void osm_slvl_rcv_process(IN void *context, IN void *p_data)
 {
-  osm_slvl_rcv_t *p_rcv = context;
-  osm_madw_t *p_madw = p_data;
-  ib_slvl_table_t *p_slvl_tbl;
-  ib_smp_t *p_smp;
-  osm_port_t *p_port;
-  osm_physp_t *p_physp;
-  osm_node_t *p_node;
-  osm_slvl_context_t *p_context;
-  ib_net64_t port_guid;
-  ib_net64_t node_guid;
-  uint8_t out_port_num, in_port_num;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_slvl_rcv_process );
-
-  CL_ASSERT( p_madw );
-
-  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 );
-
-  port_guid = p_context->port_guid;
-  node_guid = p_context->node_guid;
-
-  CL_ASSERT( p_smp->attr_id == IB_MAD_ATTR_SLVL_TABLE );
-
-  cl_plock_excl_acquire( p_rcv->p_lock );
-  p_port = osm_get_port_by_guid( p_rcv->p_subn, port_guid );
-
-  if( !p_port )
-  {
-    cl_plock_release( p_rcv->p_lock );
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_slvl_rcv_process: 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 ),
-             cl_ntoh64( node_guid ),
-             cl_ntoh64( p_smp->trans_id ) );
-    goto Exit;
-  }
-
-  p_node = p_port->p_node;
-  CL_ASSERT( p_node );
-
-  /* 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 );
-  }
-  else
-  {
-    p_physp = p_port->p_physp;
-    out_port_num = p_physp->port_num;
-    in_port_num  = 0;
-  }
-
-  CL_ASSERT( p_physp );
-
-  /*
-    We do not mind if this is a result of a set or get - all we want is to update
-    the subnet.
-  */
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_VERBOSE ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "osm_slvl_rcv_process: "
-             "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( !osm_physp_is_valid( p_physp ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_slvl_rcv_process: "
-             "Got invalid port number 0x%X\n",
-             out_port_num );
-    goto Exit;
-  }
-
-  osm_dump_slvl_map_table( p_rcv->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( p_rcv->p_lock );
-
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_slvl_rcv_t *p_rcv = context;
+	osm_madw_t *p_madw = p_data;
+	ib_slvl_table_t *p_slvl_tbl;
+	ib_smp_t *p_smp;
+	osm_port_t *p_port;
+	osm_physp_t *p_physp;
+	osm_node_t *p_node;
+	osm_slvl_context_t *p_context;
+	ib_net64_t port_guid;
+	ib_net64_t node_guid;
+	uint8_t out_port_num, in_port_num;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_slvl_rcv_process);
+
+	CL_ASSERT(p_madw);
+
+	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);
+
+	port_guid = p_context->port_guid;
+	node_guid = p_context->node_guid;
+
+	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_SLVL_TABLE);
+
+	cl_plock_excl_acquire(p_rcv->p_lock);
+	p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+
+	if (!p_port) {
+		cl_plock_release(p_rcv->p_lock);
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_slvl_rcv_process: 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),
+			cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));
+		goto Exit;
+	}
+
+	p_node = p_port->p_node;
+	CL_ASSERT(p_node);
+
+	/* 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);
+	} else {
+		p_physp = p_port->p_physp;
+		out_port_num = p_physp->port_num;
+		in_port_num = 0;
+	}
+
+	CL_ASSERT(p_physp);
+
+	/*
+	   We do not mind if this is a result of a set or get - all we want is to update
+	   the subnet.
+	 */
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_VERBOSE)) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"osm_slvl_rcv_process: "
+			"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 (!osm_physp_is_valid(p_physp)) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_slvl_rcv_process: "
+			"Got invalid port number 0x%X\n", out_port_num);
+		goto Exit;
+	}
+
+	osm_dump_slvl_map_table(p_rcv->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(p_rcv->p_lock);
+
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
-
diff --git a/opensm/opensm/osm_sm.c b/opensm/opensm/osm_sm.c
index 403f6b1..6fc9496 100644
--- a/opensm/opensm/osm_sm.c
+++ b/opensm/opensm/osm_sm.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <string.h>
@@ -69,735 +69,702 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-__osm_sm_sweeper(
-   IN void *p_ptr )
+void __osm_sm_sweeper(IN void *p_ptr)
 {
-   ib_api_status_t status;
-   osm_sm_t *const p_sm = ( osm_sm_t * ) p_ptr;
-
-   OSM_LOG_ENTER( p_sm->p_log, __osm_sm_sweeper );
-
-   if( p_sm->thread_state == OSM_THREAD_STATE_INIT )
-   {
-      p_sm->thread_state = OSM_THREAD_STATE_RUN;
-   }
-
-   /* If the sweep interval was updated before - then run only if
-    * it is not zero. */
-   while( p_sm->thread_state == OSM_THREAD_STATE_RUN &&
-          p_sm->p_subn->opt.sweep_interval != 0 )
-   {
-      /*  do the sweep only if we are in MASTER state */
-      if( p_sm->p_subn->sm_state == IB_SMINFO_STATE_MASTER ||
-          p_sm->p_subn->sm_state == IB_SMINFO_STATE_DISCOVERING )
-         osm_state_mgr_process( &p_sm->state_mgr, OSM_SIGNAL_SWEEP );
-
-      /*
-       * Wait on the event with a timeout.
-       * Sweeps may be initiated "off schedule" by simply
-       * signaling the event.
-       */
-      status = cl_event_wait_on( &p_sm->signal,
-                                 p_sm->p_subn->opt.sweep_interval * 1000000,
-                                 TRUE );
-
-      if( status == CL_SUCCESS )
-      {
-         if( osm_log_is_active( p_sm->p_log, OSM_LOG_DEBUG ) )
-         {
-            osm_log( p_sm->p_log, OSM_LOG_DEBUG,
-                     "__osm_sm_sweeper: " "Off schedule sweep signalled\n" );
-         }
-      }
-      else
-      {
-         if( status != CL_TIMEOUT )
-         {
-            osm_log( p_sm->p_log, OSM_LOG_ERROR,
-                     "__osm_sm_sweeper: ERR 2E01: "
-                     "Event wait failed (%s)\n", CL_STATUS_MSG( status ) );
-         }
-      }
-   }
-
-   OSM_LOG_EXIT( p_sm->p_log );
+	ib_api_status_t status;
+	osm_sm_t *const p_sm = (osm_sm_t *) p_ptr;
+
+	OSM_LOG_ENTER(p_sm->p_log, __osm_sm_sweeper);
+
+	if (p_sm->thread_state == OSM_THREAD_STATE_INIT) {
+		p_sm->thread_state = OSM_THREAD_STATE_RUN;
+	}
+
+	/* If the sweep interval was updated before - then run only if
+	 * it is not zero. */
+	while (p_sm->thread_state == OSM_THREAD_STATE_RUN &&
+	       p_sm->p_subn->opt.sweep_interval != 0) {
+		/*  do the sweep only if we are in MASTER state */
+		if (p_sm->p_subn->sm_state == IB_SMINFO_STATE_MASTER ||
+		    p_sm->p_subn->sm_state == IB_SMINFO_STATE_DISCOVERING)
+			osm_state_mgr_process(&p_sm->state_mgr,
+					      OSM_SIGNAL_SWEEP);
+
+		/*
+		 * Wait on the event with a timeout.
+		 * Sweeps may be initiated "off schedule" by simply
+		 * signaling the event.
+		 */
+		status = cl_event_wait_on(&p_sm->signal,
+					  p_sm->p_subn->opt.sweep_interval *
+					  1000000, TRUE);
+
+		if (status == CL_SUCCESS) {
+			if (osm_log_is_active(p_sm->p_log, OSM_LOG_DEBUG)) {
+				osm_log(p_sm->p_log, OSM_LOG_DEBUG,
+					"__osm_sm_sweeper: "
+					"Off schedule sweep signalled\n");
+			}
+		} else {
+			if (status != CL_TIMEOUT) {
+				osm_log(p_sm->p_log, OSM_LOG_ERROR,
+					"__osm_sm_sweeper: ERR 2E01: "
+					"Event wait failed (%s)\n",
+					CL_STATUS_MSG(status));
+			}
+		}
+	}
+
+	OSM_LOG_EXIT(p_sm->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sm_construct(
-   IN osm_sm_t * const p_sm )
+void osm_sm_construct(IN osm_sm_t * const p_sm)
 {
-   memset( p_sm, 0, sizeof( *p_sm ) );
-   p_sm->thread_state = OSM_THREAD_STATE_NONE;
-   p_sm->sm_trans_id = OSM_SM_INITIAL_TID_VALUE;
-   cl_event_construct( &p_sm->signal );
-   cl_event_construct( &p_sm->subnet_up_event );
-   cl_thread_construct( &p_sm->sweeper );
-   osm_req_construct( &p_sm->req );
-   osm_resp_construct( &p_sm->resp );
-   osm_ni_rcv_construct( &p_sm->ni_rcv );
-   osm_pi_rcv_construct( &p_sm->pi_rcv );
-   osm_nd_rcv_construct( &p_sm->nd_rcv );
-   osm_sm_mad_ctrl_construct( &p_sm->mad_ctrl );
-   osm_si_rcv_construct( &p_sm->si_rcv );
-   osm_lid_mgr_construct( &p_sm->lid_mgr );
-   osm_ucast_mgr_construct( &p_sm->ucast_mgr );
-   osm_link_mgr_construct( &p_sm->link_mgr );
-   osm_state_mgr_construct( &p_sm->state_mgr );
-   osm_state_mgr_ctrl_construct( &p_sm->state_mgr_ctrl );
-   osm_drop_mgr_construct( &p_sm->drop_mgr );
-   osm_lft_rcv_construct( &p_sm->lft_rcv );
-   osm_mft_rcv_construct( &p_sm->mft_rcv );
-   osm_sweep_fail_ctrl_construct( &p_sm->sweep_fail_ctrl );
-   osm_sminfo_rcv_construct( &p_sm->sm_info_rcv );
-   osm_trap_rcv_construct( &p_sm->trap_rcv );
-   osm_sm_state_mgr_construct( &p_sm->sm_state_mgr );
-   osm_slvl_rcv_construct( &p_sm->slvl_rcv );
-   osm_vla_rcv_construct( &p_sm->vla_rcv );
-   osm_pkey_rcv_construct( &p_sm->pkey_rcv );
-   osm_mcast_mgr_construct( &p_sm->mcast_mgr );
+	memset(p_sm, 0, sizeof(*p_sm));
+	p_sm->thread_state = OSM_THREAD_STATE_NONE;
+	p_sm->sm_trans_id = OSM_SM_INITIAL_TID_VALUE;
+	cl_event_construct(&p_sm->signal);
+	cl_event_construct(&p_sm->subnet_up_event);
+	cl_thread_construct(&p_sm->sweeper);
+	osm_req_construct(&p_sm->req);
+	osm_resp_construct(&p_sm->resp);
+	osm_ni_rcv_construct(&p_sm->ni_rcv);
+	osm_pi_rcv_construct(&p_sm->pi_rcv);
+	osm_nd_rcv_construct(&p_sm->nd_rcv);
+	osm_sm_mad_ctrl_construct(&p_sm->mad_ctrl);
+	osm_si_rcv_construct(&p_sm->si_rcv);
+	osm_lid_mgr_construct(&p_sm->lid_mgr);
+	osm_ucast_mgr_construct(&p_sm->ucast_mgr);
+	osm_link_mgr_construct(&p_sm->link_mgr);
+	osm_state_mgr_construct(&p_sm->state_mgr);
+	osm_state_mgr_ctrl_construct(&p_sm->state_mgr_ctrl);
+	osm_drop_mgr_construct(&p_sm->drop_mgr);
+	osm_lft_rcv_construct(&p_sm->lft_rcv);
+	osm_mft_rcv_construct(&p_sm->mft_rcv);
+	osm_sweep_fail_ctrl_construct(&p_sm->sweep_fail_ctrl);
+	osm_sminfo_rcv_construct(&p_sm->sm_info_rcv);
+	osm_trap_rcv_construct(&p_sm->trap_rcv);
+	osm_sm_state_mgr_construct(&p_sm->sm_state_mgr);
+	osm_slvl_rcv_construct(&p_sm->slvl_rcv);
+	osm_vla_rcv_construct(&p_sm->vla_rcv);
+	osm_pkey_rcv_construct(&p_sm->pkey_rcv);
+	osm_mcast_mgr_construct(&p_sm->mcast_mgr);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sm_shutdown(
-   IN osm_sm_t * const p_sm )
+void osm_sm_shutdown(IN osm_sm_t * const p_sm)
 {
-   boolean_t signal_event = FALSE;
-
-   OSM_LOG_ENTER( p_sm->p_log, osm_sm_shutdown );
-
-   /*
-    * Signal our threads that we're leaving.
-    */
-   if( p_sm->thread_state != OSM_THREAD_STATE_NONE )
-      signal_event = TRUE;
-
-   p_sm->thread_state = OSM_THREAD_STATE_EXIT;
-
-   /*
-    * Don't trigger unless event has been initialized.
-    * Destroy the thread before we tear down the other objects.
-    */
-   if( signal_event )
-      cl_event_signal( &p_sm->signal );
-
-   cl_thread_destroy( &p_sm->sweeper );
-
-   /*
-    * Always destroy controllers before the corresponding
-    * receiver to guarantee that all callbacks from the
-    * dispatcher are complete.
-    */
-   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->si_disp_h);
-   cl_disp_unregister(p_sm->nd_disp_h);
-   cl_disp_unregister(p_sm->lft_disp_h);
-   cl_disp_unregister(p_sm->mft_disp_h);
-   cl_disp_unregister(p_sm->sm_info_disp_h);
-   cl_disp_unregister(p_sm->trap_disp_h);
-   cl_disp_unregister(p_sm->slvl_disp_h);
-   cl_disp_unregister(p_sm->vla_disp_h);
-   cl_disp_unregister(p_sm->pkey_disp_h);
-   osm_sweep_fail_ctrl_destroy( &p_sm->sweep_fail_ctrl );
-   osm_state_mgr_ctrl_destroy( &p_sm->state_mgr_ctrl );
-
-   OSM_LOG_EXIT( p_sm->p_log );
+	boolean_t signal_event = FALSE;
+
+	OSM_LOG_ENTER(p_sm->p_log, osm_sm_shutdown);
+
+	/*
+	 * Signal our threads that we're leaving.
+	 */
+	if (p_sm->thread_state != OSM_THREAD_STATE_NONE)
+		signal_event = TRUE;
+
+	p_sm->thread_state = OSM_THREAD_STATE_EXIT;
+
+	/*
+	 * Don't trigger unless event has been initialized.
+	 * Destroy the thread before we tear down the other objects.
+	 */
+	if (signal_event)
+		cl_event_signal(&p_sm->signal);
+
+	cl_thread_destroy(&p_sm->sweeper);
+
+	/*
+	 * Always destroy controllers before the corresponding
+	 * receiver to guarantee that all callbacks from the
+	 * dispatcher are complete.
+	 */
+	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->si_disp_h);
+	cl_disp_unregister(p_sm->nd_disp_h);
+	cl_disp_unregister(p_sm->lft_disp_h);
+	cl_disp_unregister(p_sm->mft_disp_h);
+	cl_disp_unregister(p_sm->sm_info_disp_h);
+	cl_disp_unregister(p_sm->trap_disp_h);
+	cl_disp_unregister(p_sm->slvl_disp_h);
+	cl_disp_unregister(p_sm->vla_disp_h);
+	cl_disp_unregister(p_sm->pkey_disp_h);
+	osm_sweep_fail_ctrl_destroy(&p_sm->sweep_fail_ctrl);
+	osm_state_mgr_ctrl_destroy(&p_sm->state_mgr_ctrl);
+
+	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 * const p_sm)
 {
-   OSM_LOG_ENTER( p_sm->p_log, osm_sm_destroy );
-   osm_trap_rcv_destroy( &p_sm->trap_rcv );
-   osm_sminfo_rcv_destroy( &p_sm->sm_info_rcv );
-   osm_req_destroy( &p_sm->req );
-   osm_resp_destroy( &p_sm->resp );
-   osm_ni_rcv_destroy( &p_sm->ni_rcv );
-   osm_pi_rcv_destroy( &p_sm->pi_rcv );
-   osm_si_rcv_destroy( &p_sm->si_rcv );
-   osm_nd_rcv_destroy( &p_sm->nd_rcv );
-   osm_lid_mgr_destroy( &p_sm->lid_mgr );
-   osm_ucast_mgr_destroy( &p_sm->ucast_mgr );
-   osm_link_mgr_destroy( &p_sm->link_mgr );
-   osm_drop_mgr_destroy( &p_sm->drop_mgr );
-   osm_lft_rcv_destroy( &p_sm->lft_rcv );
-   osm_mft_rcv_destroy( &p_sm->mft_rcv );
-   osm_slvl_rcv_destroy( &p_sm->slvl_rcv );
-   osm_vla_rcv_destroy( &p_sm->vla_rcv );
-   osm_pkey_rcv_destroy( &p_sm->pkey_rcv );
-   osm_state_mgr_destroy( &p_sm->state_mgr );
-   osm_sm_state_mgr_destroy( &p_sm->sm_state_mgr );
-   osm_mcast_mgr_destroy( &p_sm->mcast_mgr );
-   cl_event_destroy( &p_sm->signal );
-   cl_event_destroy( &p_sm->subnet_up_event );
-
-   osm_log( p_sm->p_log, OSM_LOG_SYS, "Exiting SM\n" ); /* Format Waived */
-   OSM_LOG_EXIT( p_sm->p_log );
+	OSM_LOG_ENTER(p_sm->p_log, osm_sm_destroy);
+	osm_trap_rcv_destroy(&p_sm->trap_rcv);
+	osm_sminfo_rcv_destroy(&p_sm->sm_info_rcv);
+	osm_req_destroy(&p_sm->req);
+	osm_resp_destroy(&p_sm->resp);
+	osm_ni_rcv_destroy(&p_sm->ni_rcv);
+	osm_pi_rcv_destroy(&p_sm->pi_rcv);
+	osm_si_rcv_destroy(&p_sm->si_rcv);
+	osm_nd_rcv_destroy(&p_sm->nd_rcv);
+	osm_lid_mgr_destroy(&p_sm->lid_mgr);
+	osm_ucast_mgr_destroy(&p_sm->ucast_mgr);
+	osm_link_mgr_destroy(&p_sm->link_mgr);
+	osm_drop_mgr_destroy(&p_sm->drop_mgr);
+	osm_lft_rcv_destroy(&p_sm->lft_rcv);
+	osm_mft_rcv_destroy(&p_sm->mft_rcv);
+	osm_slvl_rcv_destroy(&p_sm->slvl_rcv);
+	osm_vla_rcv_destroy(&p_sm->vla_rcv);
+	osm_pkey_rcv_destroy(&p_sm->pkey_rcv);
+	osm_state_mgr_destroy(&p_sm->state_mgr);
+	osm_sm_state_mgr_destroy(&p_sm->sm_state_mgr);
+	osm_mcast_mgr_destroy(&p_sm->mcast_mgr);
+	cl_event_destroy(&p_sm->signal);
+	cl_event_destroy(&p_sm->subnet_up_event);
+
+	osm_log(p_sm->p_log, OSM_LOG_SYS, "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 )
+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 status = IB_SUCCESS;
-
-   OSM_LOG_ENTER( p_log, osm_sm_init );
-
-   p_sm->p_subn = p_subn;
-   p_sm->p_db = p_db;
-   p_sm->p_vendor = p_vendor;
-   p_sm->p_mad_pool = p_mad_pool;
-   p_sm->p_vl15 = p_vl15;
-   p_sm->p_log = p_log;
-   p_sm->p_disp = p_disp;
-   p_sm->p_lock = p_lock;
-
-   status = cl_event_init( &p_sm->signal, FALSE );
-   if( status != CL_SUCCESS )
-      goto Exit;
-
-   status = cl_event_init( &p_sm->subnet_up_event, FALSE );
-   if( status != CL_SUCCESS )
-      goto Exit;
-
-   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 )
-      goto Exit;
-
-   status = osm_req_init( &p_sm->req,
-                          p_mad_pool,
-                          p_vl15, p_subn, p_log, &p_sm->sm_trans_id );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_resp_init( &p_sm->resp, p_mad_pool, p_vl15, p_subn, p_log );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_ni_rcv_init( &p_sm->ni_rcv,
-                             &p_sm->req,
-                             p_subn, p_log, &p_sm->state_mgr, p_lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_pi_rcv_init( &p_sm->pi_rcv,
-                             &p_sm->req,
-                             p_subn, p_log, &p_sm->state_mgr, p_lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_si_rcv_init( &p_sm->si_rcv,
-                             p_sm->p_subn,
-                             p_sm->p_log,
-                             &p_sm->req, &p_sm->state_mgr, p_sm->p_lock );
-
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_nd_rcv_init( &p_sm->nd_rcv, p_subn, p_log, p_lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_lid_mgr_init( &p_sm->lid_mgr,
-                              &p_sm->req,
-                              p_sm->p_subn,
-                              p_sm->p_db, p_sm->p_log, p_sm->p_lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_ucast_mgr_init( &p_sm->ucast_mgr,
-                                &p_sm->req,
-                                p_sm->p_subn,
-                                p_sm->p_log, p_sm->p_lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_link_mgr_init( &p_sm->link_mgr,
-                               &p_sm->req,
-                               p_sm->p_subn, p_sm->p_log, p_sm->p_lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_state_mgr_init( &p_sm->state_mgr,
-                                p_sm->p_subn,
-                                &p_sm->lid_mgr,
-                                &p_sm->ucast_mgr,
-                                &p_sm->mcast_mgr,
-                                &p_sm->link_mgr,
-                                &p_sm->drop_mgr,
-                                &p_sm->req,
-                                p_stats,
-                                &p_sm->sm_state_mgr,
-                                &p_sm->mad_ctrl,
-                                p_sm->p_lock,
-                                &p_sm->subnet_up_event,
-                                p_sm->p_log );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_state_mgr_ctrl_init( &p_sm->state_mgr_ctrl,
-                                     &p_sm->state_mgr,
-                                     p_sm->p_log, p_sm->p_disp );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_drop_mgr_init( &p_sm->drop_mgr,
-                               p_sm->p_subn,
-                               p_sm->p_log, &p_sm->req, p_sm->p_lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_lft_rcv_init( &p_sm->lft_rcv, p_subn, p_log, p_lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_mft_rcv_init( &p_sm->mft_rcv, p_subn, p_log, p_lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_sweep_fail_ctrl_init( &p_sm->sweep_fail_ctrl,
-                                      p_log, &p_sm->state_mgr, p_disp );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_sminfo_rcv_init( &p_sm->sm_info_rcv,
-                                 p_subn,
-                                 p_stats,
-                                 &p_sm->resp,
-                                 p_log,
-                                 &p_sm->state_mgr,
-                                 &p_sm->sm_state_mgr, p_lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_trap_rcv_init( &p_sm->trap_rcv,
-                               p_subn,
-                               p_stats,
-                               &p_sm->resp, p_log, &p_sm->state_mgr, p_lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_sm_state_mgr_init( &p_sm->sm_state_mgr,
-                                   &p_sm->state_mgr,
-                                   p_sm->p_subn, &p_sm->req, p_sm->p_log );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_mcast_mgr_init( &p_sm->mcast_mgr,
-                                &p_sm->req, p_subn, p_log, p_lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_slvl_rcv_init( &p_sm->slvl_rcv,
-                               &p_sm->req, p_subn, p_log, p_lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_vla_rcv_init( &p_sm->vla_rcv,
-                              &p_sm->req, p_subn, p_log, p_lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   status = osm_pkey_rcv_init( &p_sm->pkey_rcv,
-                               &p_sm->req, p_subn, p_log, p_lock );
-   if( status != IB_SUCCESS )
-      goto Exit;
-
-   p_sm->ni_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NODE_INFO,
-                                      osm_ni_rcv_process, &p_sm->ni_rcv);
-   if( p_sm->ni_disp_h == CL_DISP_INVALID_HANDLE )
-      goto Exit;
-
-   p_sm->pi_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PORT_INFO,
-                                      osm_pi_rcv_process, &p_sm->pi_rcv);
-   if( p_sm->pi_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->si_rcv);
-   if( p_sm->si_disp_h == CL_DISP_INVALID_HANDLE )
-      goto Exit;
-
-   p_sm->nd_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NODE_DESC,
-                                      osm_nd_rcv_process, &p_sm->nd_rcv);
-   if( p_sm->nd_disp_h == CL_DISP_INVALID_HANDLE )
-      goto Exit;
-
-   p_sm->lft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_LFT,
-                                       osm_lft_rcv_process, &p_sm->lft_rcv);
-   if( p_sm->lft_disp_h == CL_DISP_INVALID_HANDLE )
-      goto Exit;
-
-   p_sm->mft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_MFT,
-                                       osm_mft_rcv_process, &p_sm->mft_rcv);
-   if( p_sm->mft_disp_h == CL_DISP_INVALID_HANDLE )
-      goto Exit;
-
-   p_sm->sm_info_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SM_INFO,
-                                           osm_sminfo_rcv_process,
-                                           &p_sm->sm_info_rcv);
-   if( p_sm->sm_info_disp_h == CL_DISP_INVALID_HANDLE )
-      goto Exit;
-
-   p_sm->trap_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NOTICE,
-                                        osm_trap_rcv_process, &p_sm->trap_rcv);
-   if( p_sm->trap_disp_h == CL_DISP_INVALID_HANDLE )
-      goto Exit;
-
-   p_sm->slvl_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SLVL,
-                                        osm_slvl_rcv_process, &p_sm->slvl_rcv);
-   if( p_sm->slvl_disp_h == CL_DISP_INVALID_HANDLE )
-      goto Exit;
-
-   p_sm->vla_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_VL_ARB,
-                                       osm_vla_rcv_process, &p_sm->vla_rcv);
-   if( p_sm->vla_disp_h == CL_DISP_INVALID_HANDLE )
-      goto Exit;
-
-   p_sm->pkey_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PKEY,
-                                        osm_pkey_rcv_process, &p_sm->pkey_rcv);
-   if( p_sm->pkey_disp_h == CL_DISP_INVALID_HANDLE )
-      goto Exit;
-
-   /*
-    * Now that the component objects are initialized, start
-    * the sweeper thread if the user wants sweeping.
-    */
-   if( p_sm->p_subn->opt.sweep_interval )
-   {
-      p_sm->thread_state = OSM_THREAD_STATE_INIT;
-      status = cl_thread_init( &p_sm->sweeper, __osm_sm_sweeper, p_sm,
-                               "opensm sweeper" );
-      if( status != IB_SUCCESS )
-         goto Exit;
-   }
-
- Exit:
-   OSM_LOG_EXIT( p_log );
-   return ( status );
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_log, osm_sm_init);
+
+	p_sm->p_subn = p_subn;
+	p_sm->p_db = p_db;
+	p_sm->p_vendor = p_vendor;
+	p_sm->p_mad_pool = p_mad_pool;
+	p_sm->p_vl15 = p_vl15;
+	p_sm->p_log = p_log;
+	p_sm->p_disp = p_disp;
+	p_sm->p_lock = p_lock;
+
+	status = cl_event_init(&p_sm->signal, FALSE);
+	if (status != CL_SUCCESS)
+		goto Exit;
+
+	status = cl_event_init(&p_sm->subnet_up_event, FALSE);
+	if (status != CL_SUCCESS)
+		goto Exit;
+
+	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)
+		goto Exit;
+
+	status = osm_req_init(&p_sm->req,
+			      p_mad_pool,
+			      p_vl15, p_subn, p_log, &p_sm->sm_trans_id);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_resp_init(&p_sm->resp, p_mad_pool, p_vl15, p_subn, p_log);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_ni_rcv_init(&p_sm->ni_rcv,
+				 &p_sm->req,
+				 p_subn, p_log, &p_sm->state_mgr, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_pi_rcv_init(&p_sm->pi_rcv,
+				 &p_sm->req,
+				 p_subn, p_log, &p_sm->state_mgr, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_si_rcv_init(&p_sm->si_rcv,
+				 p_sm->p_subn,
+				 p_sm->p_log,
+				 &p_sm->req, &p_sm->state_mgr, p_sm->p_lock);
+
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_nd_rcv_init(&p_sm->nd_rcv, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_lid_mgr_init(&p_sm->lid_mgr,
+				  &p_sm->req,
+				  p_sm->p_subn,
+				  p_sm->p_db, p_sm->p_log, p_sm->p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_ucast_mgr_init(&p_sm->ucast_mgr,
+				    &p_sm->req,
+				    p_sm->p_subn, p_sm->p_log, p_sm->p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_link_mgr_init(&p_sm->link_mgr,
+				   &p_sm->req,
+				   p_sm->p_subn, p_sm->p_log, p_sm->p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_state_mgr_init(&p_sm->state_mgr,
+				    p_sm->p_subn,
+				    &p_sm->lid_mgr,
+				    &p_sm->ucast_mgr,
+				    &p_sm->mcast_mgr,
+				    &p_sm->link_mgr,
+				    &p_sm->drop_mgr,
+				    &p_sm->req,
+				    p_stats,
+				    &p_sm->sm_state_mgr,
+				    &p_sm->mad_ctrl,
+				    p_sm->p_lock,
+				    &p_sm->subnet_up_event, p_sm->p_log);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_state_mgr_ctrl_init(&p_sm->state_mgr_ctrl,
+					 &p_sm->state_mgr,
+					 p_sm->p_log, p_sm->p_disp);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_drop_mgr_init(&p_sm->drop_mgr,
+				   p_sm->p_subn,
+				   p_sm->p_log, &p_sm->req, p_sm->p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_lft_rcv_init(&p_sm->lft_rcv, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_mft_rcv_init(&p_sm->mft_rcv, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_sweep_fail_ctrl_init(&p_sm->sweep_fail_ctrl,
+					  p_log, &p_sm->state_mgr, p_disp);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_sminfo_rcv_init(&p_sm->sm_info_rcv,
+				     p_subn,
+				     p_stats,
+				     &p_sm->resp,
+				     p_log,
+				     &p_sm->state_mgr,
+				     &p_sm->sm_state_mgr, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_trap_rcv_init(&p_sm->trap_rcv,
+				   p_subn,
+				   p_stats,
+				   &p_sm->resp, p_log, &p_sm->state_mgr,
+				   p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_sm_state_mgr_init(&p_sm->sm_state_mgr,
+				       &p_sm->state_mgr,
+				       p_sm->p_subn, &p_sm->req, p_sm->p_log);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_mcast_mgr_init(&p_sm->mcast_mgr,
+				    &p_sm->req, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_slvl_rcv_init(&p_sm->slvl_rcv,
+				   &p_sm->req, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_vla_rcv_init(&p_sm->vla_rcv,
+				  &p_sm->req, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	status = osm_pkey_rcv_init(&p_sm->pkey_rcv,
+				   &p_sm->req, p_subn, p_log, p_lock);
+	if (status != IB_SUCCESS)
+		goto Exit;
+
+	p_sm->ni_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NODE_INFO,
+					   osm_ni_rcv_process, &p_sm->ni_rcv);
+	if (p_sm->ni_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sm->pi_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PORT_INFO,
+					   osm_pi_rcv_process, &p_sm->pi_rcv);
+	if (p_sm->pi_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->si_rcv);
+	if (p_sm->si_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sm->nd_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NODE_DESC,
+					   osm_nd_rcv_process, &p_sm->nd_rcv);
+	if (p_sm->nd_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sm->lft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_LFT,
+					    osm_lft_rcv_process,
+					    &p_sm->lft_rcv);
+	if (p_sm->lft_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sm->mft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_MFT,
+					    osm_mft_rcv_process,
+					    &p_sm->mft_rcv);
+	if (p_sm->mft_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sm->sm_info_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SM_INFO,
+						osm_sminfo_rcv_process,
+						&p_sm->sm_info_rcv);
+	if (p_sm->sm_info_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sm->trap_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NOTICE,
+					     osm_trap_rcv_process,
+					     &p_sm->trap_rcv);
+	if (p_sm->trap_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sm->slvl_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SLVL,
+					     osm_slvl_rcv_process,
+					     &p_sm->slvl_rcv);
+	if (p_sm->slvl_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sm->vla_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_VL_ARB,
+					    osm_vla_rcv_process,
+					    &p_sm->vla_rcv);
+	if (p_sm->vla_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	p_sm->pkey_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PKEY,
+					     osm_pkey_rcv_process,
+					     &p_sm->pkey_rcv);
+	if (p_sm->pkey_disp_h == CL_DISP_INVALID_HANDLE)
+		goto Exit;
+
+	/*
+	 * Now that the component objects are initialized, start
+	 * the sweeper thread if the user wants sweeping.
+	 */
+	if (p_sm->p_subn->opt.sweep_interval) {
+		p_sm->thread_state = OSM_THREAD_STATE_INIT;
+		status = cl_thread_init(&p_sm->sweeper, __osm_sm_sweeper, p_sm,
+					"opensm sweeper");
+		if (status != IB_SUCCESS)
+			goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sm_sweep(
-   IN osm_sm_t * const p_sm )
+void osm_sm_sweep(IN osm_sm_t * const p_sm)
 {
-   OSM_LOG_ENTER( p_sm->p_log, osm_sm_sweep );
-   osm_state_mgr_process( &p_sm->state_mgr, OSM_SIGNAL_SWEEP );
-   OSM_LOG_EXIT( p_sm->p_log );
+	OSM_LOG_ENTER(p_sm->p_log, osm_sm_sweep);
+	osm_state_mgr_process(&p_sm->state_mgr, 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 )
+osm_sm_bind(IN osm_sm_t * const p_sm, IN const ib_net64_t port_guid)
 {
-   ib_api_status_t status;
+	ib_api_status_t status;
 
-   OSM_LOG_ENTER( p_sm->p_log, osm_sm_bind );
+	OSM_LOG_ENTER(p_sm->p_log, osm_sm_bind);
 
-   status = osm_sm_mad_ctrl_bind( &p_sm->mad_ctrl, port_guid );
+	status = osm_sm_mad_ctrl_bind(&p_sm->mad_ctrl, port_guid);
 
-   if( status != IB_SUCCESS )
-   {
-      osm_log( p_sm->p_log, OSM_LOG_ERROR,
-               "osm_sm_bind: ERR 2E10: "
-               "SM MAD Controller bind failed (%s)\n",
-               ib_get_err_str( status ) );
-      goto Exit;
-   }
+	if (status != IB_SUCCESS) {
+		osm_log(p_sm->p_log, OSM_LOG_ERROR,
+			"osm_sm_bind: ERR 2E10: "
+			"SM MAD Controller bind failed (%s)\n",
+			ib_get_err_str(status));
+		goto Exit;
+	}
 
- Exit:
-   OSM_LOG_EXIT( p_sm->p_log );
-   return ( status );
+      Exit:
+	OSM_LOG_EXIT(p_sm->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 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 )
+__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)
 {
-   ib_api_status_t status;
-   osm_mcast_mgr_ctxt_t *ctx2;
-
-   OSM_LOG_ENTER( p_sm->p_log, __osm_sm_mgrp_connect );
-
-   /*
-    * 'Schedule' all the QP0 traffic for when the state manager
-    * isn't busy trying to do something else.
-    */
-   ctx2 =
-      ( osm_mcast_mgr_ctxt_t * ) malloc( sizeof( osm_mcast_mgr_ctxt_t ) );
-   memcpy( &ctx2->mlid, &p_mgrp->mlid, sizeof( p_mgrp->mlid ) );
-   ctx2->req_type = req_type;
-   ctx2->port_guid = port_guid;
-
-   status = osm_state_mgr_process_idle( &p_sm->state_mgr,
-                                        osm_mcast_mgr_process_mgrp_cb,
-                                        NULL, &p_sm->mcast_mgr,
-                                        ( void * )ctx2 );
-
-   OSM_LOG_EXIT( p_sm->p_log );
-   return ( status );
+	ib_api_status_t status;
+	osm_mcast_mgr_ctxt_t *ctx2;
+
+	OSM_LOG_ENTER(p_sm->p_log, __osm_sm_mgrp_connect);
+
+	/*
+	 * 'Schedule' all the QP0 traffic for when the state manager
+	 * isn't busy trying to do something else.
+	 */
+	ctx2 = (osm_mcast_mgr_ctxt_t *) malloc(sizeof(osm_mcast_mgr_ctxt_t));
+	memcpy(&ctx2->mlid, &p_mgrp->mlid, sizeof(p_mgrp->mlid));
+	ctx2->req_type = req_type;
+	ctx2->port_guid = port_guid;
+
+	status = osm_state_mgr_process_idle(&p_sm->state_mgr,
+					    osm_mcast_mgr_process_mgrp_cb,
+					    NULL, &p_sm->mcast_mgr,
+					    (void *)ctx2);
+
+	OSM_LOG_EXIT(p_sm->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 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_disconnect(IN osm_sm_t * const p_sm,
+			 IN osm_mgrp_t * const p_mgrp,
+			 IN const ib_net64_t port_guid)
 {
-   ib_api_status_t status;
-   osm_mcast_mgr_ctxt_t *ctx2;
-
-   OSM_LOG_ENTER( p_sm->p_log, __osm_sm_mgrp_disconnect );
-
-   /*
-    * 'Schedule' all the QP0 traffic for when the state manager
-    * isn't busy trying to do something else.
-    */
-   ctx2 =
-      ( osm_mcast_mgr_ctxt_t * ) malloc( sizeof( osm_mcast_mgr_ctxt_t ) );
-   memcpy( &ctx2->mlid, &p_mgrp->mlid, sizeof( p_mgrp->mlid ) );
-   ctx2->req_type = OSM_MCAST_REQ_TYPE_LEAVE;
-   ctx2->port_guid = port_guid;
-
-   status = osm_state_mgr_process_idle( &p_sm->state_mgr,
-                                        osm_mcast_mgr_process_mgrp_cb,
-                                        NULL, &p_sm->mcast_mgr, ctx2 );
-   if( status != IB_SUCCESS )
-   {
-      osm_log( p_sm->p_log, OSM_LOG_ERROR,
-               "__osm_sm_mgrp_disconnect: ERR 2E11: "
-               "Failure processing multicast group (%s)\n",
-               ib_get_err_str( status ) );
-   }
-
-   OSM_LOG_EXIT( p_sm->p_log );
+	ib_api_status_t status;
+	osm_mcast_mgr_ctxt_t *ctx2;
+
+	OSM_LOG_ENTER(p_sm->p_log, __osm_sm_mgrp_disconnect);
+
+	/*
+	 * 'Schedule' all the QP0 traffic for when the state manager
+	 * isn't busy trying to do something else.
+	 */
+	ctx2 = (osm_mcast_mgr_ctxt_t *) malloc(sizeof(osm_mcast_mgr_ctxt_t));
+	memcpy(&ctx2->mlid, &p_mgrp->mlid, sizeof(p_mgrp->mlid));
+	ctx2->req_type = OSM_MCAST_REQ_TYPE_LEAVE;
+	ctx2->port_guid = port_guid;
+
+	status = osm_state_mgr_process_idle(&p_sm->state_mgr,
+					    osm_mcast_mgr_process_mgrp_cb,
+					    NULL, &p_sm->mcast_mgr, ctx2);
+	if (status != IB_SUCCESS) {
+		osm_log(p_sm->p_log, OSM_LOG_ERROR,
+			"__osm_sm_mgrp_disconnect: ERR 2E11: "
+			"Failure processing multicast group (%s)\n",
+			ib_get_err_str(status));
+	}
+
+	OSM_LOG_EXIT(p_sm->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 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_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;
-   cl_qmap_t *p_tbl;
-   ib_api_status_t status = IB_SUCCESS;
-   osm_mcm_info_t *p_mcm;
-
-   OSM_LOG_ENTER( p_sm->p_log, osm_sm_mcgrp_join );
-
-   osm_log( p_sm->p_log, OSM_LOG_VERBOSE,
-            "osm_sm_mcgrp_join: "
-            "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,
-               "osm_sm_mcgrp_join: 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_tbl = &p_sm->p_subn->mgrp_mlid_tbl;
-   p_mgrp = ( osm_mgrp_t * ) cl_qmap_get( p_tbl, mlid );
-   if( p_mgrp == ( osm_mgrp_t * ) cl_qmap_end( p_tbl ) )
-   {
-      osm_log( p_sm->p_log, OSM_LOG_VERBOSE,
-               "osm_sm_mcgrp_join: "
-               "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,
-                  "osm_sm_mcgrp_join: ERR 2E06: "
-                  "Unable to allocate multicast group object\n" );
-         status = IB_INSUFFICIENT_MEMORY;
-         goto Exit;
-      }
-
-      cl_qmap_insert( p_tbl, mlid, &p_mgrp->map_item );
-   }
-   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,
-                  "osm_sm_mcgrp_join: 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,
-                  "osm_sm_mcgrp_join: "
-                  "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,
-               "osm_sm_mcgrp_join: 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;
-   }
-
-   CL_PLOCK_RELEASE( p_sm->p_lock );
-   status = __osm_sm_mgrp_connect( p_sm, p_mgrp, port_guid, req_type );
-
- Exit:
-   OSM_LOG_EXIT( p_sm->p_log );
-   return ( status );
+	osm_mgrp_t *p_mgrp;
+	osm_port_t *p_port;
+	cl_qmap_t *p_tbl;
+	ib_api_status_t status = IB_SUCCESS;
+	osm_mcm_info_t *p_mcm;
+
+	OSM_LOG_ENTER(p_sm->p_log, osm_sm_mcgrp_join);
+
+	osm_log(p_sm->p_log, OSM_LOG_VERBOSE,
+		"osm_sm_mcgrp_join: "
+		"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,
+			"osm_sm_mcgrp_join: 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_tbl = &p_sm->p_subn->mgrp_mlid_tbl;
+	p_mgrp = (osm_mgrp_t *) cl_qmap_get(p_tbl, mlid);
+	if (p_mgrp == (osm_mgrp_t *) cl_qmap_end(p_tbl)) {
+		osm_log(p_sm->p_log, OSM_LOG_VERBOSE,
+			"osm_sm_mcgrp_join: "
+			"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,
+				"osm_sm_mcgrp_join: ERR 2E06: "
+				"Unable to allocate multicast group object\n");
+			status = IB_INSUFFICIENT_MEMORY;
+			goto Exit;
+		}
+
+		cl_qmap_insert(p_tbl, mlid, &p_mgrp->map_item);
+	} 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,
+				"osm_sm_mcgrp_join: 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,
+				"osm_sm_mcgrp_join: "
+				"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,
+			"osm_sm_mcgrp_join: 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;
+	}
+
+	CL_PLOCK_RELEASE(p_sm->p_lock);
+	status = __osm_sm_mgrp_connect(p_sm, p_mgrp, port_guid, req_type);
+
+      Exit:
+	OSM_LOG_EXIT(p_sm->p_log);
+	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 )
+osm_sm_mcgrp_leave(IN osm_sm_t * const p_sm,
+		   IN const ib_net16_t mlid, IN const ib_net64_t port_guid)
 {
-   osm_mgrp_t *p_mgrp;
-   osm_port_t *p_port;
-   cl_qmap_t *p_tbl;
-   ib_api_status_t status = IB_SUCCESS;
-
-   OSM_LOG_ENTER( p_sm->p_log, osm_sm_mcgrp_leave );
-
-   osm_log( p_sm->p_log, OSM_LOG_VERBOSE,
-            "osm_sm_mcgrp_leave: "
-            "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.
-    */
-   /* note: p_sm->p_lock is locked by caller, but will be released later
-      this function */
-   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,
-               "osm_sm_mcgrp_leave: 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_tbl = &p_sm->p_subn->mgrp_mlid_tbl;
-   p_mgrp = ( osm_mgrp_t * ) cl_qmap_get( p_tbl, mlid );
-   if( p_mgrp == ( osm_mgrp_t * ) cl_qmap_end( p_tbl ) )
-   {
-      CL_PLOCK_RELEASE( p_sm->p_lock );
-      osm_log( p_sm->p_log, OSM_LOG_ERROR,
-               "osm_sm_mcgrp_leave: 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_mgrp_remove_port( p_sm->p_subn, p_sm->p_log, p_mgrp, port_guid );
-
-   osm_port_remove_mgrp( p_port, mlid );
-
-   CL_PLOCK_RELEASE( p_sm->p_lock );
-
-   __osm_sm_mgrp_disconnect( p_sm, p_mgrp, port_guid );
-
- Exit:
-   OSM_LOG_EXIT( p_sm->p_log );
-   return ( status );
+	osm_mgrp_t *p_mgrp;
+	osm_port_t *p_port;
+	cl_qmap_t *p_tbl;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_sm->p_log, osm_sm_mcgrp_leave);
+
+	osm_log(p_sm->p_log, OSM_LOG_VERBOSE,
+		"osm_sm_mcgrp_leave: "
+		"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.
+	 */
+	/* note: p_sm->p_lock is locked by caller, but will be released later
+	   this function */
+	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,
+			"osm_sm_mcgrp_leave: 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_tbl = &p_sm->p_subn->mgrp_mlid_tbl;
+	p_mgrp = (osm_mgrp_t *) cl_qmap_get(p_tbl, mlid);
+	if (p_mgrp == (osm_mgrp_t *) cl_qmap_end(p_tbl)) {
+		CL_PLOCK_RELEASE(p_sm->p_lock);
+		osm_log(p_sm->p_log, OSM_LOG_ERROR,
+			"osm_sm_mcgrp_leave: 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_mgrp_remove_port(p_sm->p_subn, p_sm->p_log, p_mgrp, port_guid);
+
+	osm_port_remove_mgrp(p_port, mlid);
+
+	CL_PLOCK_RELEASE(p_sm->p_lock);
+
+	__osm_sm_mgrp_disconnect(p_sm, p_mgrp, port_guid);
+
+      Exit:
+	OSM_LOG_EXIT(p_sm->p_log);
+	return (status);
 }
diff --git a/opensm/opensm/osm_sm_mad_ctrl.c b/opensm/opensm/osm_sm_mad_ctrl.c
index fbf96c1..758262b 100644
--- a/opensm/opensm/osm_sm_mad_ctrl.c
+++ b/opensm/opensm/osm_sm_mad_ctrl.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <complib/cl_debug.h>
@@ -70,72 +70,68 @@
  * 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 )
+__osm_sm_mad_ctrl_retire_trans_mad(IN osm_sm_mad_ctrl_t * const p_ctrl,
+				   IN osm_madw_t * const p_madw)
 {
-  uint32_t outstanding;
-  cl_status_t status;
-
-  OSM_LOG_ENTER( p_ctrl->p_log, __osm_sm_mad_ctrl_retire_trans_mad );
-
-  CL_ASSERT( p_madw );
-  /*
-    Return the MAD & wrapper to the pool.
-  */
-  if( osm_log_is_active( p_ctrl->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
-             "__osm_sm_mad_ctrl_retire_trans_mad: "
-             "Retiring MAD with TID 0x%" PRIx64 "\n",
-             cl_ntoh64( osm_madw_get_smp_ptr( p_madw )->trans_id ) );
-  }
-
-  osm_mad_pool_put( p_ctrl->p_mad_pool, p_madw );
-
-  outstanding = cl_atomic_dec( &p_ctrl->p_stats->qp0_mads_outstanding );
-
-  if( osm_log_is_active( p_ctrl->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
-             "__osm_sm_mad_ctrl_retire_trans_mad: "
-             "%u QP0 MADs outstanding\n",
-             p_ctrl->p_stats->qp0_mads_outstanding );
-  }
-
-  if( outstanding == 0 )
-  {
-    /*
-      The wire is clean.
-      Signal the state manager.
-    */
-    if( osm_log_is_active( p_ctrl->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
-               "__osm_sm_mad_ctrl_retire_trans_mad: "
-               "Posting Dispatcher message %s\n",
-               osm_get_disp_msg_str( OSM_MSG_NO_SMPS_OUTSTANDING ) );
-    }
-
-    status = cl_disp_post( p_ctrl->h_disp,
-                           OSM_MSG_NO_SMPS_OUTSTANDING,
-                           (void *)OSM_SIGNAL_NO_PENDING_TRANSACTIONS,
-                           NULL,
-                           NULL );
-
-    if( status != CL_SUCCESS )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-               "__osm_sm_mad_ctrl_retire_trans_mad: ERR 3101: "
-               "Dispatcher post message failed (%s)\n",
-               CL_STATUS_MSG( status ) );
-      goto Exit;
-    }
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_ctrl->p_log );
+	uint32_t outstanding;
+	cl_status_t status;
+
+	OSM_LOG_ENTER(p_ctrl->p_log, __osm_sm_mad_ctrl_retire_trans_mad);
+
+	CL_ASSERT(p_madw);
+	/*
+	   Return the MAD & wrapper to the pool.
+	 */
+	if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+			"__osm_sm_mad_ctrl_retire_trans_mad: "
+			"Retiring MAD with TID 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_madw_get_smp_ptr(p_madw)->trans_id));
+	}
+
+	osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
+
+	outstanding = cl_atomic_dec(&p_ctrl->p_stats->qp0_mads_outstanding);
+
+	if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+			"__osm_sm_mad_ctrl_retire_trans_mad: "
+			"%u QP0 MADs outstanding\n",
+			p_ctrl->p_stats->qp0_mads_outstanding);
+	}
+
+	if (outstanding == 0) {
+		/*
+		   The wire is clean.
+		   Signal the state manager.
+		 */
+		if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+				"__osm_sm_mad_ctrl_retire_trans_mad: "
+				"Posting Dispatcher message %s\n",
+				osm_get_disp_msg_str
+				(OSM_MSG_NO_SMPS_OUTSTANDING));
+		}
+
+		status = cl_disp_post(p_ctrl->h_disp,
+				      OSM_MSG_NO_SMPS_OUTSTANDING,
+				      (void *)
+				      OSM_SIGNAL_NO_PENDING_TRANSACTIONS, NULL,
+				      NULL);
+
+		if (status != CL_SUCCESS) {
+			osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+				"__osm_sm_mad_ctrl_retire_trans_mad: ERR 3101: "
+				"Dispatcher post message failed (%s)\n",
+				CL_STATUS_MSG(status));
+			goto Exit;
+		}
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_ctrl->p_log);
 }
+
 /************/
 
 /****f* opensm: SM/__osm_sm_mad_ctrl_disp_done_callback
@@ -149,42 +145,38 @@ __osm_sm_mad_ctrl_retire_trans_mad(
  * SYNOPSIS
  */
 static void
-__osm_sm_mad_ctrl_disp_done_callback(
-  IN void*              context,
-  IN void*              p_data )
+__osm_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;
-  ib_smp_t              *p_smp;
-
-  OSM_LOG_ENTER( p_ctrl->p_log, __osm_sm_mad_ctrl_disp_done_callback );
-
-  /*
-    If the MAD that just finished processing was a response,
-    then retire the transaction, since we must have generated
-    the request.
-
-    Otherwise, retire the transaction if a response was expected,
-    as in the case of a send failure. If a response was not expected,
-    just put the MAD back in the pool, because the MAD was a query
-    from some outside agent, e.g. Get(SMInfo) from another SM.
-  */
-  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 );
-  }
-  else
-  {
-    if( p_madw->resp_expected == TRUE )
-      __osm_sm_mad_ctrl_retire_trans_mad( p_ctrl, p_madw );
-    else
-      osm_mad_pool_put( p_ctrl->p_mad_pool, p_madw );
-  }
-
-  OSM_LOG_EXIT( p_ctrl->p_log );
+	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;
+	ib_smp_t *p_smp;
+
+	OSM_LOG_ENTER(p_ctrl->p_log, __osm_sm_mad_ctrl_disp_done_callback);
+
+	/*
+	   If the MAD that just finished processing was a response,
+	   then retire the transaction, since we must have generated
+	   the request.
+
+	   Otherwise, retire the transaction if a response was expected,
+	   as in the case of a send failure. If a response was not expected,
+	   just put the MAD back in the pool, because the MAD was a query
+	   from some outside agent, e.g. Get(SMInfo) from another SM.
+	 */
+	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);
+	} else {
+		if (p_madw->resp_expected == TRUE)
+			__osm_sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);
+		else
+			osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
+	}
+
+	OSM_LOG_EXIT(p_ctrl->p_log);
 }
+
 /************/
 
 /****f* opensm: SM/__osm_sm_mad_ctrl_update_wire_stats
@@ -197,30 +189,28 @@ __osm_sm_mad_ctrl_disp_done_callback(
  * SYNOPSIS
  */
 static void
-__osm_sm_mad_ctrl_update_wire_stats(
-  IN osm_sm_mad_ctrl_t* const p_ctrl )
+__osm_sm_mad_ctrl_update_wire_stats(IN osm_sm_mad_ctrl_t * const p_ctrl)
 {
-  uint32_t mads_on_wire;
-
-  OSM_LOG_ENTER( p_ctrl->p_log, __osm_sm_mad_ctrl_update_wire_stats );
-
-  mads_on_wire = cl_atomic_dec(
-    &p_ctrl->p_stats->qp0_mads_outstanding_on_wire );
-
-  if( osm_log_is_active( p_ctrl->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
-             "__osm_sm_mad_ctrl_update_wire_stats: "
-             "%u SMPs on the wire, %u outstanding\n", mads_on_wire,
-             p_ctrl->p_stats->qp0_mads_outstanding );
-  }
-
-  /*
-    We can signal the VL15 controller to send another MAD
-    if any are waiting for transmission.
-  */
-  osm_vl15_poll( p_ctrl->p_vl15 );
-  OSM_LOG_EXIT( p_ctrl->p_log );
+	uint32_t mads_on_wire;
+
+	OSM_LOG_ENTER(p_ctrl->p_log, __osm_sm_mad_ctrl_update_wire_stats);
+
+	mads_on_wire =
+	    cl_atomic_dec(&p_ctrl->p_stats->qp0_mads_outstanding_on_wire);
+
+	if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+			"__osm_sm_mad_ctrl_update_wire_stats: "
+			"%u SMPs on the wire, %u outstanding\n", mads_on_wire,
+			p_ctrl->p_stats->qp0_mads_outstanding);
+	}
+
+	/*
+	   We can signal the VL15 controller to send another MAD
+	   if any are waiting for transmission.
+	 */
+	osm_vl15_poll(p_ctrl->p_vl15);
+	OSM_LOG_EXIT(p_ctrl->p_log);
 }
 
 /****f* opensm: SM/__osm_sm_mad_ctrl_process_get_resp
@@ -234,132 +224,125 @@ __osm_sm_mad_ctrl_update_wire_stats(
  * 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 )
+__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)
 {
-  ib_smp_t* p_smp;
-  cl_status_t status;
-  osm_madw_t* p_old_madw;
-  cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;
-
-  OSM_LOG_ENTER( p_ctrl->p_log, __osm_sm_mad_ctrl_process_get_resp );
-
-  CL_ASSERT( p_madw );
-  CL_ASSERT( transaction_context );
-
-  p_smp = osm_madw_get_smp_ptr( p_madw );
-
-  if( p_smp->mgmt_class == IB_MCLASS_SUBN_DIR )
-  {
-    if( !ib_smp_is_d( p_smp ) )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-               "__osm_sm_mad_ctrl_process_get_resp: ERR 3102: "
-               "'D' bit not set in returned SMP\n" );
-      osm_dump_dr_smp( p_ctrl->p_log, p_smp, OSM_LOG_ERROR );
-    }
-  }
-
-  p_old_madw = (osm_madw_t*)transaction_context;
-
-  __osm_sm_mad_ctrl_update_wire_stats( p_ctrl );
-
-  /*
-    Copy the MAD Wrapper context from the requesting MAD
-    to the new MAD.  This mechanism allows the recipient
-    controller to recover its own context regarding this
-    MAD transaction.  Once we've copied the context, we
-    can return the original MAD to the pool.
-  */
-  osm_madw_copy_context( p_madw, p_old_madw );
-  osm_mad_pool_put( p_ctrl->p_mad_pool, p_old_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_NODE_DESC:
-    msg_id = OSM_MSG_MAD_NODE_DESC;
-    break;
-  case IB_MAD_ATTR_NODE_INFO:
-    msg_id = OSM_MSG_MAD_NODE_INFO;
-    break;
-  case IB_MAD_ATTR_SWITCH_INFO:
-    msg_id = OSM_MSG_MAD_SWITCH_INFO;
-    break;
-  case IB_MAD_ATTR_PORT_INFO:
-    msg_id = OSM_MSG_MAD_PORT_INFO;
-    break;
-  case IB_MAD_ATTR_LIN_FWD_TBL:
-    msg_id = OSM_MSG_MAD_LFT;
-    break;
-  case IB_MAD_ATTR_MCAST_FWD_TBL:
-    msg_id = OSM_MSG_MAD_MFT;
-    break;
-  case IB_MAD_ATTR_SM_INFO:
-    msg_id = OSM_MSG_MAD_SM_INFO;
-    break;
-  case IB_MAD_ATTR_SLVL_TABLE:
-    msg_id = OSM_MSG_MAD_SLVL;
-    break;
-  case IB_MAD_ATTR_VL_ARBITRATION:
-    msg_id = OSM_MSG_MAD_VL_ARB;
-    break;
-  case IB_MAD_ATTR_P_KEY_TABLE:
-    msg_id = OSM_MSG_MAD_PKEY;
-    break;
-
-  case IB_MAD_ATTR_GUID_INFO:
-  case IB_MAD_ATTR_CLASS_PORT_INFO:
-  case IB_MAD_ATTR_NOTICE:
-  case IB_MAD_ATTR_INFORM_INFO:
-  default:
-    osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-             "__osm_sm_mad_ctrl_process_get_resp: ERR 3103: "
-             "Unsupported attribute = 0x%X\n",
-             cl_ntoh16( p_smp->attr_id ) );
-    osm_dump_dr_smp( p_ctrl->p_log, p_smp, OSM_LOG_ERROR );
-    goto Exit;
-  }
-
-  if( msg_id != CL_DISP_MSGID_NONE )
-  {
-    /*
-      Post this MAD to the dispatcher for asynchronous
-      processing by the appropriate controller.
-    */
-
-    if( osm_log_is_active( p_ctrl->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
-               "__osm_sm_mad_ctrl_process_get_resp: "
-               "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_sm_mad_ctrl_disp_done_callback,
-                           p_ctrl );
-
-    if( status != CL_SUCCESS )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-               "__osm_sm_mad_ctrl_process_get_resp: ERR 3104: "
-               "Dispatcher post message failed (%s) for attribute = 0x%X\n",
-               CL_STATUS_MSG( status ),
-               cl_ntoh16( p_smp->attr_id ) );
-      goto Exit;
-    }
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_ctrl->p_log );
+	ib_smp_t *p_smp;
+	cl_status_t status;
+	osm_madw_t *p_old_madw;
+	cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;
+
+	OSM_LOG_ENTER(p_ctrl->p_log, __osm_sm_mad_ctrl_process_get_resp);
+
+	CL_ASSERT(p_madw);
+	CL_ASSERT(transaction_context);
+
+	p_smp = osm_madw_get_smp_ptr(p_madw);
+
+	if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {
+		if (!ib_smp_is_d(p_smp)) {
+			osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+				"__osm_sm_mad_ctrl_process_get_resp: ERR 3102: "
+				"'D' bit not set in returned SMP\n");
+			osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);
+		}
+	}
+
+	p_old_madw = (osm_madw_t *) transaction_context;
+
+	__osm_sm_mad_ctrl_update_wire_stats(p_ctrl);
+
+	/*
+	   Copy the MAD Wrapper context from the requesting MAD
+	   to the new MAD.  This mechanism allows the recipient
+	   controller to recover its own context regarding this
+	   MAD transaction.  Once we've copied the context, we
+	   can return the original MAD to the pool.
+	 */
+	osm_madw_copy_context(p_madw, p_old_madw);
+	osm_mad_pool_put(p_ctrl->p_mad_pool, p_old_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_NODE_DESC:
+		msg_id = OSM_MSG_MAD_NODE_DESC;
+		break;
+	case IB_MAD_ATTR_NODE_INFO:
+		msg_id = OSM_MSG_MAD_NODE_INFO;
+		break;
+	case IB_MAD_ATTR_SWITCH_INFO:
+		msg_id = OSM_MSG_MAD_SWITCH_INFO;
+		break;
+	case IB_MAD_ATTR_PORT_INFO:
+		msg_id = OSM_MSG_MAD_PORT_INFO;
+		break;
+	case IB_MAD_ATTR_LIN_FWD_TBL:
+		msg_id = OSM_MSG_MAD_LFT;
+		break;
+	case IB_MAD_ATTR_MCAST_FWD_TBL:
+		msg_id = OSM_MSG_MAD_MFT;
+		break;
+	case IB_MAD_ATTR_SM_INFO:
+		msg_id = OSM_MSG_MAD_SM_INFO;
+		break;
+	case IB_MAD_ATTR_SLVL_TABLE:
+		msg_id = OSM_MSG_MAD_SLVL;
+		break;
+	case IB_MAD_ATTR_VL_ARBITRATION:
+		msg_id = OSM_MSG_MAD_VL_ARB;
+		break;
+	case IB_MAD_ATTR_P_KEY_TABLE:
+		msg_id = OSM_MSG_MAD_PKEY;
+		break;
+
+	case IB_MAD_ATTR_GUID_INFO:
+	case IB_MAD_ATTR_CLASS_PORT_INFO:
+	case IB_MAD_ATTR_NOTICE:
+	case IB_MAD_ATTR_INFORM_INFO:
+	default:
+		osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+			"__osm_sm_mad_ctrl_process_get_resp: ERR 3103: "
+			"Unsupported attribute = 0x%X\n",
+			cl_ntoh16(p_smp->attr_id));
+		osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);
+		goto Exit;
+	}
+
+	if (msg_id != CL_DISP_MSGID_NONE) {
+		/*
+		   Post this MAD to the dispatcher for asynchronous
+		   processing by the appropriate controller.
+		 */
+
+		if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+				"__osm_sm_mad_ctrl_process_get_resp: "
+				"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_sm_mad_ctrl_disp_done_callback,
+				      p_ctrl);
+
+		if (status != CL_SUCCESS) {
+			osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+				"__osm_sm_mad_ctrl_process_get_resp: ERR 3104: "
+				"Dispatcher post message failed (%s) for attribute = 0x%X\n",
+				CL_STATUS_MSG(status),
+				cl_ntoh16(p_smp->attr_id));
+			goto Exit;
+		}
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_ctrl->p_log);
 }
 
 /****f* opensm: SM/__osm_sm_mad_ctrl_process_get
@@ -372,78 +355,72 @@ __osm_sm_mad_ctrl_process_get_resp(
  * SYNOPSIS
  */
 static void
-__osm_sm_mad_ctrl_process_get(
-  IN osm_sm_mad_ctrl_t* const p_ctrl,
-  IN osm_madw_t *p_madw )
+__osm_sm_mad_ctrl_process_get(IN osm_sm_mad_ctrl_t * const p_ctrl,
+			      IN osm_madw_t * p_madw)
 {
-  ib_smp_t* p_smp;
-  cl_status_t status;
-  cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;
-
-  OSM_LOG_ENTER( p_ctrl->p_log, __osm_sm_mad_ctrl_process_get );
-
-  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_SM_INFO:
-    msg_id = OSM_MSG_MAD_SM_INFO;
-    break;
-
-  default:
-    osm_log( p_ctrl->p_log, OSM_LOG_VERBOSE,
-             "__osm_sm_mad_ctrl_process_get: "
-             "Ignoring SubnGet MAD - unsupported attribute = 0x%X\n",
-             cl_ntoh16( p_smp->attr_id ) );
-    break;
-  }
-
-  if( msg_id != CL_DISP_MSGID_NONE )
-  {
-    /*
-      Post this MAD to the dispatcher for asynchronous
-      processing by the appropriate controller.
-    */
-
-    if( osm_log_is_active( p_ctrl->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
-               "__osm_sm_mad_ctrl_process_get: "
-               "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_sm_mad_ctrl_disp_done_callback,
-                           p_ctrl );
-
-    if( status != CL_SUCCESS )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-               "__osm_sm_mad_ctrl_process_get: ERR 3106: "
-               "Dispatcher post message failed (%s)\n",
-               CL_STATUS_MSG( status ) );
-      goto Exit;
-    }
-  }
-  else
-  {
-    /*
-      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 );
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_ctrl->p_log );
+	ib_smp_t *p_smp;
+	cl_status_t status;
+	cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;
+
+	OSM_LOG_ENTER(p_ctrl->p_log, __osm_sm_mad_ctrl_process_get);
+
+	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_SM_INFO:
+		msg_id = OSM_MSG_MAD_SM_INFO;
+		break;
+
+	default:
+		osm_log(p_ctrl->p_log, OSM_LOG_VERBOSE,
+			"__osm_sm_mad_ctrl_process_get: "
+			"Ignoring SubnGet MAD - unsupported attribute = 0x%X\n",
+			cl_ntoh16(p_smp->attr_id));
+		break;
+	}
+
+	if (msg_id != CL_DISP_MSGID_NONE) {
+		/*
+		   Post this MAD to the dispatcher for asynchronous
+		   processing by the appropriate controller.
+		 */
+
+		if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+				"__osm_sm_mad_ctrl_process_get: "
+				"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_sm_mad_ctrl_disp_done_callback,
+				      p_ctrl);
+
+		if (status != CL_SUCCESS) {
+			osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+				"__osm_sm_mad_ctrl_process_get: ERR 3106: "
+				"Dispatcher post message failed (%s)\n",
+				CL_STATUS_MSG(status));
+			goto Exit;
+		}
+	} else {
+		/*
+		   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);
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_ctrl->p_log);
 }
+
 /*
  * PARAMETERS
  *
@@ -464,79 +441,73 @@ __osm_sm_mad_ctrl_process_get(
  * SYNOPSIS
  */
 static void
-__osm_sm_mad_ctrl_process_set(
-  IN osm_sm_mad_ctrl_t* const p_ctrl,
-  IN osm_madw_t *p_madw )
+__osm_sm_mad_ctrl_process_set(IN osm_sm_mad_ctrl_t * const p_ctrl,
+			      IN osm_madw_t * p_madw)
 {
-  ib_smp_t* p_smp;
-  cl_status_t status;
-  cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;
-
-  OSM_LOG_ENTER( p_ctrl->p_log, __osm_sm_mad_ctrl_process_set );
-
-  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_SM_INFO:
-    msg_id = OSM_MSG_MAD_SM_INFO;
-    break;
-
-  default:
-    osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-             "__osm_sm_mad_ctrl_process_set: ERR 3107: "
-             "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 )
-  {
-    /*
-      Post this MAD to the dispatcher for asynchronous
-      processing by the appropriate controller.
-    */
-
-    if( osm_log_is_active( p_ctrl->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
-               "__osm_sm_mad_ctrl_process_set: "
-               "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_sm_mad_ctrl_disp_done_callback,
-                           p_ctrl );
-
-    if( status != CL_SUCCESS )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-               "__osm_sm_mad_ctrl_process_set: ERR 3108: "
-               "Dispatcher post message failed (%s)\n",
-               CL_STATUS_MSG( status ) );
-      goto Exit;
-    }
-  }
-  else
-  {
-    /*
-      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 );
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_ctrl->p_log );
+	ib_smp_t *p_smp;
+	cl_status_t status;
+	cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;
+
+	OSM_LOG_ENTER(p_ctrl->p_log, __osm_sm_mad_ctrl_process_set);
+
+	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_SM_INFO:
+		msg_id = OSM_MSG_MAD_SM_INFO;
+		break;
+
+	default:
+		osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+			"__osm_sm_mad_ctrl_process_set: ERR 3107: "
+			"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) {
+		/*
+		   Post this MAD to the dispatcher for asynchronous
+		   processing by the appropriate controller.
+		 */
+
+		if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+				"__osm_sm_mad_ctrl_process_set: "
+				"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_sm_mad_ctrl_disp_done_callback,
+				      p_ctrl);
+
+		if (status != CL_SUCCESS) {
+			osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+				"__osm_sm_mad_ctrl_process_set: ERR 3108: "
+				"Dispatcher post message failed (%s)\n",
+				CL_STATUS_MSG(status));
+			goto Exit;
+		}
+	} else {
+		/*
+		   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);
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_ctrl->p_log);
 }
+
 /*
  * PARAMETERS
  *
@@ -557,90 +528,83 @@ __osm_sm_mad_ctrl_process_set(
  * SYNOPSIS
  */
 static void
-__osm_sm_mad_ctrl_process_trap(
-  IN osm_sm_mad_ctrl_t* const p_ctrl,
-  IN osm_madw_t *p_madw )
+__osm_sm_mad_ctrl_process_trap(IN osm_sm_mad_ctrl_t * const p_ctrl,
+			       IN osm_madw_t * p_madw)
 {
-  ib_smp_t* p_smp;
-  cl_status_t status;
-  cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;
-
-  OSM_LOG_ENTER( p_ctrl->p_log, __osm_sm_mad_ctrl_process_trap );
-
-  p_smp = osm_madw_get_smp_ptr( p_madw );
-
-  /* Make sure OpenSM is master. If not - then we should not process the trap */
-  if (p_ctrl->p_subn->sm_state != IB_SMINFO_STATE_MASTER)
-  {
-    osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
-             "__osm_sm_mad_ctrl_process_trap: "
-             "Received trap but OpenSM is not in MASTER state. "
-             "Dropping mad\n");
-    osm_mad_pool_put( p_ctrl->p_mad_pool, p_madw );
-    goto Exit;
-  }
-
-  /*
-    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:
-    msg_id = OSM_MSG_MAD_NOTICE;
-    break;
-
-  default:
-    osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-             "__osm_sm_mad_ctrl_process_trap: ERR 3109: "
-             "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 )
-  {
-    /*
-      Post this MAD to the dispatcher for asynchronous
-      processing by the appropriate controller.
-    */
-
-    if( osm_log_is_active( p_ctrl->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
-               "__osm_sm_mad_ctrl_process_trap: "
-               "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_sm_mad_ctrl_disp_done_callback,
-                           p_ctrl );
-
-    if( status != CL_SUCCESS )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-               "__osm_sm_mad_ctrl_process_trap: ERR 3110: "
-               "Dispatcher post message failed (%s)\n",
-               CL_STATUS_MSG( status ) );
-      goto Exit;
-    }
-  }
-  else
-  {
-    /*
-      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 );
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_ctrl->p_log );
+	ib_smp_t *p_smp;
+	cl_status_t status;
+	cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;
+
+	OSM_LOG_ENTER(p_ctrl->p_log, __osm_sm_mad_ctrl_process_trap);
+
+	p_smp = osm_madw_get_smp_ptr(p_madw);
+
+	/* Make sure OpenSM is master. If not - then we should not process the trap */
+	if (p_ctrl->p_subn->sm_state != IB_SMINFO_STATE_MASTER) {
+		osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+			"__osm_sm_mad_ctrl_process_trap: "
+			"Received trap but OpenSM is not in MASTER state. "
+			"Dropping mad\n");
+		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
+		goto Exit;
+	}
+
+	/*
+	   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:
+		msg_id = OSM_MSG_MAD_NOTICE;
+		break;
+
+	default:
+		osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+			"__osm_sm_mad_ctrl_process_trap: ERR 3109: "
+			"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) {
+		/*
+		   Post this MAD to the dispatcher for asynchronous
+		   processing by the appropriate controller.
+		 */
+
+		if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+				"__osm_sm_mad_ctrl_process_trap: "
+				"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_sm_mad_ctrl_disp_done_callback,
+				      p_ctrl);
+
+		if (status != CL_SUCCESS) {
+			osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+				"__osm_sm_mad_ctrl_process_trap: ERR 3110: "
+				"Dispatcher post message failed (%s)\n",
+				CL_STATUS_MSG(status));
+			goto Exit;
+		}
+	} else {
+		/*
+		   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);
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_ctrl->p_log);
 }
+
 /*
  * PARAMETERS
  *
@@ -661,119 +625,110 @@ __osm_sm_mad_ctrl_process_trap(
  * SYNOPSIS
  */
 void
-__osm_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_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;
-  ib_smp_t* p_smp;
-  ib_net16_t status;
-
-  OSM_LOG_ENTER( p_ctrl->p_log, __osm_sm_mad_ctrl_rcv_callback );
-
-  CL_ASSERT( p_madw );
-
-  /*
-    A MAD was received from the wire, possibly in response to a request.
-  */
-  cl_atomic_inc( &p_ctrl->p_stats->qp0_mads_rcvd );
-
-  if( osm_log_is_active( p_ctrl->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
-             "__osm_sm_mad_ctrl_rcv_callback: "
-             "%u QP0 MADs received\n",
-             p_ctrl->p_stats->qp0_mads_rcvd );
-  }
-
-  p_smp = osm_madw_get_smp_ptr( p_madw );
-
-  /* if we are closing down simply do nothing */
-  if (osm_exit_flag)
-  {
-    osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-             "__osm_sm_mad_ctrl_rcv_callback: "
-             "Ignoring received mad - since we are exiting\n");
-
-    osm_dump_dr_smp( p_ctrl->p_log, p_smp, 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))
-    {
-      CL_ASSERT( p_madw->resp_expected == FALSE );
-      __osm_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 );
-      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( 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,
-             "__osm_sm_mad_ctrl_rcv_callback: ERR 3111: "
-             "Error status = 0x%X\n", status );
-    osm_dump_dr_smp( p_ctrl->p_log, p_smp, OSM_LOG_ERROR );
-  }
-
-  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 );
-    break;
-
-  case IB_MAD_METHOD_GET:
-    CL_ASSERT( p_req_madw == NULL );
-    __osm_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 );
-    break;
-
-  case IB_MAD_METHOD_SET:
-    CL_ASSERT( p_req_madw == NULL );
-    __osm_sm_mad_ctrl_process_set( 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:
-    osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-             "__osm_sm_mad_ctrl_rcv_callback: ERR 3112: "
-             "Unsupported method = 0x%X\n", p_smp->method );
-    osm_dump_dr_smp( p_ctrl->p_log, p_smp, OSM_LOG_ERROR );
-    osm_mad_pool_put( p_ctrl->p_mad_pool, p_madw );
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_ctrl->p_log );
+	osm_sm_mad_ctrl_t *p_ctrl = (osm_sm_mad_ctrl_t *) bind_context;
+	ib_smp_t *p_smp;
+	ib_net16_t status;
+
+	OSM_LOG_ENTER(p_ctrl->p_log, __osm_sm_mad_ctrl_rcv_callback);
+
+	CL_ASSERT(p_madw);
+
+	/*
+	   A MAD was received from the wire, possibly in response to a request.
+	 */
+	cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd);
+
+	if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+			"__osm_sm_mad_ctrl_rcv_callback: "
+			"%u QP0 MADs received\n",
+			p_ctrl->p_stats->qp0_mads_rcvd);
+	}
+
+	p_smp = osm_madw_get_smp_ptr(p_madw);
+
+	/* if we are closing down simply do nothing */
+	if (osm_exit_flag) {
+		osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+			"__osm_sm_mad_ctrl_rcv_callback: "
+			"Ignoring received mad - since we are exiting\n");
+
+		osm_dump_dr_smp(p_ctrl->p_log, p_smp, 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)) {
+			CL_ASSERT(p_madw->resp_expected == FALSE);
+			__osm_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);
+			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 (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,
+			"__osm_sm_mad_ctrl_rcv_callback: ERR 3111: "
+			"Error status = 0x%X\n", status);
+		osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);
+	}
+
+	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);
+		break;
+
+	case IB_MAD_METHOD_GET:
+		CL_ASSERT(p_req_madw == NULL);
+		__osm_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);
+		break;
+
+	case IB_MAD_METHOD_SET:
+		CL_ASSERT(p_req_madw == NULL);
+		__osm_sm_mad_ctrl_process_set(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:
+		osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+			"__osm_sm_mad_ctrl_rcv_callback: ERR 3112: "
+			"Unsupported method = 0x%X\n", p_smp->method);
+		osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);
+		osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_ctrl->p_log);
 }
+
 /*
  * PARAMETERS
  *
@@ -795,118 +750,109 @@ __osm_sm_mad_ctrl_rcv_callback(
  * SYNOPSIS
  */
 void
-__osm_sm_mad_ctrl_send_err_cb(
-  IN void *bind_context,
-  IN osm_madw_t *p_madw )
+__osm_sm_mad_ctrl_send_err_cb(IN void *bind_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 = (osm_sm_mad_ctrl_t *) bind_context;
 #if 0
-  osm_physp_t* p_physp;
+	osm_physp_t *p_physp;
 #endif
-  ib_api_status_t status;
-  ib_smp_t* p_smp;
-
-  OSM_LOG_ENTER( p_ctrl->p_log, __osm_sm_mad_ctrl_send_err_cb );
-
-  CL_ASSERT( p_madw );
-
-  osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-           "__osm_sm_mad_ctrl_send_err_cb: ERR 3113: "
-           "MAD completed in error (%s)\n",
-           ib_get_err_str( p_madw->status ) );
-
-  /*
-     If this was a SubnSet MAD, then this error might indicate a problem
-     in configuring the subnet. In this case - need to mark that there was
-     such a problem. The subnet will not be up, and the next sweep should
-     be a heavy sweep as well.
-  */
-  p_smp = osm_madw_get_smp_ptr( p_madw );
-  if (p_smp->method == IB_MAD_METHOD_SET &&
-      ( p_smp->attr_id == IB_MAD_ATTR_PORT_INFO ||
-        p_smp->attr_id == IB_MAD_ATTR_MCAST_FWD_TBL ||
-        p_smp->attr_id == IB_MAD_ATTR_SWITCH_INFO ||
-        p_smp->attr_id == IB_MAD_ATTR_LIN_FWD_TBL ) )
-  {
-    osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-             "__osm_sm_mad_ctrl_send_err_cb: ERR 3119: "
-             "Set method failed\n" );
-    p_ctrl->p_subn->subnet_initialization_error = TRUE;
-  }
-
-  /*
-     Since we did not get any response we suspect the DR path
-     used for the target port.
-     Find it and replace it with an alternate path.
-     This is true only if the destination lid is not 0xFFFF, since
-     then we are aiming for a specific path and not specific destination
-     lid.
-  */
-  /* For now - do not add the alternate dr path to the release */
+	ib_api_status_t status;
+	ib_smp_t *p_smp;
+
+	OSM_LOG_ENTER(p_ctrl->p_log, __osm_sm_mad_ctrl_send_err_cb);
+
+	CL_ASSERT(p_madw);
+
+	osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+		"__osm_sm_mad_ctrl_send_err_cb: ERR 3113: "
+		"MAD completed in error (%s)\n",
+		ib_get_err_str(p_madw->status));
+
+	/*
+	   If this was a SubnSet MAD, then this error might indicate a problem
+	   in configuring the subnet. In this case - need to mark that there was
+	   such a problem. The subnet will not be up, and the next sweep should
+	   be a heavy sweep as well.
+	 */
+	p_smp = osm_madw_get_smp_ptr(p_madw);
+	if (p_smp->method == IB_MAD_METHOD_SET &&
+	    (p_smp->attr_id == IB_MAD_ATTR_PORT_INFO ||
+	     p_smp->attr_id == IB_MAD_ATTR_MCAST_FWD_TBL ||
+	     p_smp->attr_id == IB_MAD_ATTR_SWITCH_INFO ||
+	     p_smp->attr_id == IB_MAD_ATTR_LIN_FWD_TBL)) {
+		osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+			"__osm_sm_mad_ctrl_send_err_cb: ERR 3119: "
+			"Set method failed\n");
+		p_ctrl->p_subn->subnet_initialization_error = TRUE;
+	}
+
+	/*
+	   Since we did not get any response we suspect the DR path
+	   used for the target port.
+	   Find it and replace it with an alternate path.
+	   This is true only if the destination lid is not 0xFFFF, since
+	   then we are aiming for a specific path and not specific destination
+	   lid.
+	 */
+	/* For now - do not add the alternate dr path to the release */
 #if 0
-  if ( p_madw->mad_addr.dest_lid != 0xFFFF )
-  {
-    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,
-               "__osm_sm_mad_ctrl_send_err_cb: ERR 3114: "
-               "Failed to find the corresponding phys port\n");
-    }
-    else
-    {
-      osm_physp_replace_dr_path_with_alternate_dr_path(
-      p_ctrl->p_log, p_ctrl->p_subn, p_physp, p_madw->h_bind );
-    }
-  }
+	if (p_madw->mad_addr.dest_lid != 0xFFFF) {
+		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,
+				"__osm_sm_mad_ctrl_send_err_cb: ERR 3114: "
+				"Failed to find the corresponding phys port\n");
+		} else {
+			osm_physp_replace_dr_path_with_alternate_dr_path
+			    (p_ctrl->p_log, p_ctrl->p_subn, p_physp,
+			     p_madw->h_bind);
+		}
+	}
 #endif
 
-  /*
-    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 );
-
-  if( osm_madw_get_err_msg( p_madw ) != CL_DISP_MSGID_NONE )
-  {
-    if( osm_log_is_active( p_ctrl->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
-               "__osm_sm_mad_ctrl_send_err_cb: "
-               "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_sm_mad_ctrl_disp_done_callback,
-                           p_ctrl );
-    if( status != CL_SUCCESS )
-    {
-      osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-               "__osm_sm_mad_ctrl_send_err_cb: ERR 3115: "
-               "Dispatcher post message failed (%s)\n",
-               CL_STATUS_MSG( status ) );
-    }
-  }
-  else
-  {
-    /*
-      No error message was provided, just retire the MAD.
-    */
-    __osm_sm_mad_ctrl_retire_trans_mad( p_ctrl, p_madw );
-  }
-
-  OSM_LOG_EXIT( p_ctrl->p_log );
+	/*
+	   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);
+
+	if (osm_madw_get_err_msg(p_madw) != CL_DISP_MSGID_NONE) {
+		if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+				"__osm_sm_mad_ctrl_send_err_cb: "
+				"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_sm_mad_ctrl_disp_done_callback,
+				      p_ctrl);
+		if (status != CL_SUCCESS) {
+			osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+				"__osm_sm_mad_ctrl_send_err_cb: ERR 3115: "
+				"Dispatcher post message failed (%s)\n",
+				CL_STATUS_MSG(status));
+		}
+	} else {
+		/*
+		   No error message was provided, just retire the MAD.
+		 */
+		__osm_sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);
+	}
+
+	OSM_LOG_EXIT(p_ctrl->p_log);
 }
+
 /*
  * PARAMETERS
  *
@@ -919,131 +865,116 @@ __osm_sm_mad_ctrl_send_err_cb(
 
 /**********************************************************************
  **********************************************************************/
-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 * const p_ctrl)
 {
-  CL_ASSERT( p_ctrl );
-  memset( p_ctrl, 0, sizeof(*p_ctrl) );
-  p_ctrl->h_disp = CL_DISP_INVALID_HANDLE;
+	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 * const p_ctrl)
 {
-  CL_ASSERT( p_ctrl );
+	CL_ASSERT(p_ctrl);
 
-  if (p_ctrl->h_bind != CL_DISP_INVALID_HANDLE)
-  {
-    osm_vendor_unbind( p_ctrl->h_bind );
-  }
-  cl_disp_unregister( p_ctrl->h_disp );
+	if (p_ctrl->h_bind != CL_DISP_INVALID_HANDLE) {
+		osm_vendor_unbind(p_ctrl->h_bind);
+	}
+	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 )
+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 status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_log, osm_sm_mad_ctrl_init );
-
-  osm_sm_mad_ctrl_construct( p_ctrl );
-
-  p_ctrl->p_subn = p_subn;
-  p_ctrl->p_log = p_log;
-  p_ctrl->p_disp = p_disp;
-  p_ctrl->p_mad_pool = p_mad_pool;
-  p_ctrl->p_vendor = p_vendor;
-  p_ctrl->p_stats = p_stats;
-  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 );
-
-  if( p_ctrl->h_disp == CL_DISP_INVALID_HANDLE )
-  {
-    osm_log( p_log, OSM_LOG_ERROR,
-             "osm_sm_mad_ctrl_init: ERR 3116: "
-             "Dispatcher registration failed\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_log, osm_sm_mad_ctrl_init);
+
+	osm_sm_mad_ctrl_construct(p_ctrl);
+
+	p_ctrl->p_subn = p_subn;
+	p_ctrl->p_log = p_log;
+	p_ctrl->p_disp = p_disp;
+	p_ctrl->p_mad_pool = p_mad_pool;
+	p_ctrl->p_vendor = p_vendor;
+	p_ctrl->p_stats = p_stats;
+	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);
+
+	if (p_ctrl->h_disp == CL_DISP_INVALID_HANDLE) {
+		osm_log(p_log, OSM_LOG_ERROR,
+			"osm_sm_mad_ctrl_init: ERR 3116: "
+			"Dispatcher registration failed\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_log);
+	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 )
+osm_sm_mad_ctrl_bind(IN osm_sm_mad_ctrl_t * const p_ctrl,
+		     IN const ib_net64_t port_guid)
 {
-  osm_bind_info_t bind_info;
-  ib_api_status_t status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_ctrl->p_log, osm_sm_mad_ctrl_bind );
-
-  if( p_ctrl->h_bind != OSM_BIND_INVALID_HANDLE )
-  {
-    osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-             "osm_sm_mad_ctrl_bind: ERR 3117: "
-             "Multiple binds not allowed\n" );
-    status = IB_ERROR;
-    goto Exit;
-  }
-
-  bind_info.class_version = 1;
-  bind_info.is_report_processor = FALSE;
-  bind_info.is_responder = TRUE;
-  bind_info.is_trap_processor = TRUE;
-  bind_info.mad_class = IB_MCLASS_SUBN_DIR;
-  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;
-
-  osm_log( p_ctrl->p_log, OSM_LOG_VERBOSE,
-           "osm_sm_mad_ctrl_bind: "
-           "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->p_mad_pool,
-                                    __osm_sm_mad_ctrl_rcv_callback,
-                                    __osm_sm_mad_ctrl_send_err_cb,
-                                    p_ctrl );
-
-  if( p_ctrl->h_bind == OSM_BIND_INVALID_HANDLE )
-  {
-    status = IB_ERROR;
-    osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
-             "osm_sm_mad_ctrl_bind: ERR 3118: "
-             "Vendor specific bind failed\n" );
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_ctrl->p_log );
-  return( status );
+	osm_bind_info_t bind_info;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_ctrl->p_log, osm_sm_mad_ctrl_bind);
+
+	if (p_ctrl->h_bind != OSM_BIND_INVALID_HANDLE) {
+		osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+			"osm_sm_mad_ctrl_bind: ERR 3117: "
+			"Multiple binds not allowed\n");
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	bind_info.class_version = 1;
+	bind_info.is_report_processor = FALSE;
+	bind_info.is_responder = TRUE;
+	bind_info.is_trap_processor = TRUE;
+	bind_info.mad_class = IB_MCLASS_SUBN_DIR;
+	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;
+
+	osm_log(p_ctrl->p_log, OSM_LOG_VERBOSE,
+		"osm_sm_mad_ctrl_bind: "
+		"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->p_mad_pool,
+					 __osm_sm_mad_ctrl_rcv_callback,
+					 __osm_sm_mad_ctrl_send_err_cb, p_ctrl);
+
+	if (p_ctrl->h_bind == OSM_BIND_INVALID_HANDLE) {
+		status = IB_ERROR;
+		osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
+			"osm_sm_mad_ctrl_bind: ERR 3118: "
+			"Vendor specific bind failed\n");
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_ctrl->p_log);
+	return (status);
 }
diff --git a/opensm/opensm/osm_sm_state_mgr.c b/opensm/opensm/osm_sm_state_mgr.c
index b37c959..2ff9639 100644
--- a/opensm/opensm/osm_sm_state_mgr.c
+++ b/opensm/opensm/osm_sm_state_mgr.c
@@ -46,7 +46,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -70,800 +70,760 @@
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sm_state_mgr_standby_msg(
-   IN const osm_sm_state_mgr_t * p_sm_mgr )
+__osm_sm_state_mgr_standby_msg(IN const osm_sm_state_mgr_t * p_sm_mgr)
 {
-   osm_log( p_sm_mgr->p_log, OSM_LOG_SYS, "Entering STANDBY state\n" );   /* Format Waived */
-
-   if( osm_log_is_active( p_sm_mgr->p_log, OSM_LOG_VERBOSE ) )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_VERBOSE,
-               "__osm_sm_state_mgr_standby_msg: "
-               "\n\n\n********************************"
-               "**********************************\n"
-               "******************** ENTERING SM STANDBY"
-               " STATE *******************\n"
-               "**************************************"
-               "****************************\n\n\n" );
-   }
+	osm_log(p_sm_mgr->p_log, OSM_LOG_SYS, "Entering STANDBY state\n");	/* Format Waived */
+
+	if (osm_log_is_active(p_sm_mgr->p_log, OSM_LOG_VERBOSE)) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_VERBOSE,
+			"__osm_sm_state_mgr_standby_msg: "
+			"\n\n\n********************************"
+			"**********************************\n"
+			"******************** ENTERING SM STANDBY"
+			" STATE *******************\n"
+			"**************************************"
+			"****************************\n\n\n");
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sm_state_mgr_master_msg(
-   IN const osm_sm_state_mgr_t * p_sm_mgr )
+__osm_sm_state_mgr_master_msg(IN const osm_sm_state_mgr_t * p_sm_mgr)
 {
-   osm_log( p_sm_mgr->p_log, OSM_LOG_SYS, "Entering MASTER state\n" );   /* Format Waived */
-
-   if( osm_log_is_active( p_sm_mgr->p_log, OSM_LOG_VERBOSE ) )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_VERBOSE,
-               "__osm_sm_state_mgr_master_msg: "
-               "\n\n\n********************************"
-               "**********************************\n"
-               "******************** ENTERING SM MASTER"
-               " STATE ********************\n"
-               "**************************************"
-               "****************************\n\n\n" );
-   }
+	osm_log(p_sm_mgr->p_log, OSM_LOG_SYS, "Entering MASTER state\n");	/* Format Waived */
+
+	if (osm_log_is_active(p_sm_mgr->p_log, OSM_LOG_VERBOSE)) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_VERBOSE,
+			"__osm_sm_state_mgr_master_msg: "
+			"\n\n\n********************************"
+			"**********************************\n"
+			"******************** ENTERING SM MASTER"
+			" STATE ********************\n"
+			"**************************************"
+			"****************************\n\n\n");
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sm_state_mgr_discovering_msg(
-   IN const osm_sm_state_mgr_t * p_sm_mgr )
+__osm_sm_state_mgr_discovering_msg(IN const osm_sm_state_mgr_t * p_sm_mgr)
 {
-   if( osm_log_is_active( p_sm_mgr->p_log, OSM_LOG_VERBOSE ) )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_VERBOSE,
-               "__osm_sm_state_mgr_discovering_msg: "
-               "\n\n\n********************************"
-               "**********************************\n"
-               "******************** ENTERING SM DISCOVERING"
-               " STATE ***************\n"
-               "**************************************"
-               "****************************\n\n\n" );
-   }
+	if (osm_log_is_active(p_sm_mgr->p_log, OSM_LOG_VERBOSE)) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_VERBOSE,
+			"__osm_sm_state_mgr_discovering_msg: "
+			"\n\n\n********************************"
+			"**********************************\n"
+			"******************** ENTERING SM DISCOVERING"
+			" STATE ***************\n"
+			"**************************************"
+			"****************************\n\n\n");
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sm_state_mgr_notactive_msg(
-   IN const osm_sm_state_mgr_t * p_sm_mgr )
+__osm_sm_state_mgr_notactive_msg(IN const osm_sm_state_mgr_t * p_sm_mgr)
 {
-   osm_log( p_sm_mgr->p_log, OSM_LOG_SYS, "Entering NOT-ACTIVE state\n" );   /* Format Waived */
-
-   if( osm_log_is_active( p_sm_mgr->p_log, OSM_LOG_VERBOSE ) )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_VERBOSE,
-               "__osm_sm_state_mgr_notactive_msg: "
-               "\n\n\n********************************"
-               "**********************************\n"
-               "***************** ENTERING SM NOT-ACTIVE"
-               " STATE *******************\n"
-               "**************************************"
-               "****************************\n\n\n" );
-   }
+	osm_log(p_sm_mgr->p_log, OSM_LOG_SYS, "Entering NOT-ACTIVE state\n");	/* Format Waived */
+
+	if (osm_log_is_active(p_sm_mgr->p_log, OSM_LOG_VERBOSE)) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_VERBOSE,
+			"__osm_sm_state_mgr_notactive_msg: "
+			"\n\n\n********************************"
+			"**********************************\n"
+			"***************** ENTERING SM NOT-ACTIVE"
+			" STATE *******************\n"
+			"**************************************"
+			"****************************\n\n\n");
+	}
 }
 
 #if 0
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sm_state_mgr_send_local_port_info_req(
-   IN osm_sm_state_mgr_t * p_sm_mgr )
+__osm_sm_state_mgr_send_local_port_info_req(IN osm_sm_state_mgr_t * p_sm_mgr)
 {
-   osm_madw_context_t context;
-   osm_port_t *p_port;
-   ib_net64_t port_guid = p_sm_mgr->p_subn->sm_port_guid;
-   ib_api_status_t status;
-
-   OSM_LOG_ENTER( p_sm_mgr->p_log,
-                  __osm_sm_state_mgr_send_local_port_info_req );
-   /*
-    * Send a query of SubnGet(PortInfo) to our own port, in order to
-    * update the master_sm_base_lid of the subnet.
-    */
-   memset( &context, 0, sizeof( context ) );
-   p_port = osm_get_port_by_guid( p_sm_mgr->p_subn, port_guid );
-   if( !p_port )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_ERROR,
-               "__osm_sm_state_mgr_send_local_port_info_req: ERR 3205: "
-               "No port object for port 0x%016" PRIx64 "\n",
-               cl_ntoh64( port_guid ) );
-      goto Exit;
-   }
-
-   context.pi_context.port_guid = port_guid;
-   context.pi_context.node_guid = p_port->p_node->node_info.node_guid;
-   context.pi_context.set_method = FALSE;
-   context.pi_context.ignore_errors = FALSE;
-   /* mark the update_master_sm_base_lid with TRUE - we want to update it */
-   /* with the new master lid value. */
-   context.pi_context.update_master_sm_base_lid = TRUE;
-   context.pi_context.light_sweep = FALSE;
-   context.pi_context.active_transition = FALSE;
-
-   status = osm_req_get( p_sm_mgr->p_req,
-                         osm_physp_get_dr_path_ptr
-                         ( p_port->p_physp ),
-                         IB_MAD_ATTR_PORT_INFO,
-                         cl_hton32( p_port->p_physp->port_num ),
-                         CL_DISP_MSGID_NONE, &context );
-
-   if( status != IB_SUCCESS )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_ERROR,
-               "__osm_sm_state_mgr_send_local_port_info_req: ERR 3202: "
-               "Failure requesting PortInfo (%s)\n",
-               ib_get_err_str( status ) );
-   }
-
- Exit:
-   OSM_LOG_EXIT( p_sm_mgr->p_log );
+	osm_madw_context_t context;
+	osm_port_t *p_port;
+	ib_net64_t port_guid = p_sm_mgr->p_subn->sm_port_guid;
+	ib_api_status_t status;
+
+	OSM_LOG_ENTER(p_sm_mgr->p_log,
+		      __osm_sm_state_mgr_send_local_port_info_req);
+	/*
+	 * Send a query of SubnGet(PortInfo) to our own port, in order to
+	 * update the master_sm_base_lid of the subnet.
+	 */
+	memset(&context, 0, sizeof(context));
+	p_port = osm_get_port_by_guid(p_sm_mgr->p_subn, port_guid);
+	if (!p_port) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_sm_state_mgr_send_local_port_info_req: ERR 3205: "
+			"No port object for port 0x%016" PRIx64 "\n",
+			cl_ntoh64(port_guid));
+		goto Exit;
+	}
+
+	context.pi_context.port_guid = port_guid;
+	context.pi_context.node_guid = p_port->p_node->node_info.node_guid;
+	context.pi_context.set_method = FALSE;
+	context.pi_context.ignore_errors = FALSE;
+	/* mark the update_master_sm_base_lid with TRUE - we want to update it */
+	/* with the new master lid value. */
+	context.pi_context.update_master_sm_base_lid = TRUE;
+	context.pi_context.light_sweep = FALSE;
+	context.pi_context.active_transition = FALSE;
+
+	status = osm_req_get(p_sm_mgr->p_req,
+			     osm_physp_get_dr_path_ptr
+			     (p_port->p_physp),
+			     IB_MAD_ATTR_PORT_INFO,
+			     cl_hton32(p_port->p_physp->port_num),
+			     CL_DISP_MSGID_NONE, &context);
+
+	if (status != IB_SUCCESS) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_sm_state_mgr_send_local_port_info_req: ERR 3202: "
+			"Failure requesting PortInfo (%s)\n",
+			ib_get_err_str(status));
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_sm_mgr->p_log);
 }
 #endif
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sm_state_mgr_send_master_sm_info_req(
-   IN osm_sm_state_mgr_t * p_sm_mgr )
+__osm_sm_state_mgr_send_master_sm_info_req(IN osm_sm_state_mgr_t * p_sm_mgr)
 {
-   osm_madw_context_t context;
-   const osm_port_t *p_port;
-   ib_api_status_t status;
-
-   OSM_LOG_ENTER( p_sm_mgr->p_log,
-                  __osm_sm_state_mgr_send_master_sm_info_req );
-
-   memset( &context, 0, sizeof( context ) );
-   if( p_sm_mgr->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.
-       */
-      p_port = osm_get_port_by_guid( p_sm_mgr->p_subn, p_sm_mgr->master_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 p_sm_mgr.
-       * Send a query of SubnGet(SMInfo) to that SM.
-       */
-      p_port = p_sm_mgr->p_polling_sm->p_port;
-   }
-   if( p_port == NULL )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_ERROR,
-               "__osm_sm_state_mgr_send_master_sm_info_req: ERR 3203: "
-               "No port object for GUID 0x%016" PRIx64 "\n",
-               cl_ntoh64(p_sm_mgr->master_guid) );
-      goto Exit;
-   }
-
-   context.smi_context.port_guid = p_port->guid;
-   context.smi_context.set_method = FALSE;
-
-   status = osm_req_get( p_sm_mgr->p_req,
-                         osm_physp_get_dr_path_ptr(p_port->p_physp),
-                         IB_MAD_ATTR_SM_INFO, 0, CL_DISP_MSGID_NONE,
-                         &context );
-
-   if( status != IB_SUCCESS )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_ERROR,
-               "__osm_sm_state_mgr_send_master_sm_info_req: ERR 3204: "
-               "Failure requesting SMInfo (%s)\n", ib_get_err_str( status ) );
-   }
-
- Exit:
-   OSM_LOG_EXIT( p_sm_mgr->p_log );
+	osm_madw_context_t context;
+	const osm_port_t *p_port;
+	ib_api_status_t status;
+
+	OSM_LOG_ENTER(p_sm_mgr->p_log,
+		      __osm_sm_state_mgr_send_master_sm_info_req);
+
+	memset(&context, 0, sizeof(context));
+	if (p_sm_mgr->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.
+		 */
+		p_port =
+		    osm_get_port_by_guid(p_sm_mgr->p_subn,
+					 p_sm_mgr->master_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 p_sm_mgr.
+		 * Send a query of SubnGet(SMInfo) to that SM.
+		 */
+		p_port = p_sm_mgr->p_polling_sm->p_port;
+	}
+	if (p_port == NULL) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_sm_state_mgr_send_master_sm_info_req: ERR 3203: "
+			"No port object for GUID 0x%016" PRIx64 "\n",
+			cl_ntoh64(p_sm_mgr->master_guid));
+		goto Exit;
+	}
+
+	context.smi_context.port_guid = p_port->guid;
+	context.smi_context.set_method = FALSE;
+
+	status = osm_req_get(p_sm_mgr->p_req,
+			     osm_physp_get_dr_path_ptr(p_port->p_physp),
+			     IB_MAD_ATTR_SM_INFO, 0, CL_DISP_MSGID_NONE,
+			     &context);
+
+	if (status != IB_SUCCESS) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_sm_state_mgr_send_master_sm_info_req: ERR 3204: "
+			"Failure requesting SMInfo (%s)\n",
+			ib_get_err_str(status));
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_sm_mgr->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
-static void
-__osm_sm_state_mgr_start_polling(
-   IN osm_sm_state_mgr_t * p_sm_mgr )
+static void __osm_sm_state_mgr_start_polling(IN osm_sm_state_mgr_t * p_sm_mgr)
 {
-   uint32_t sminfo_polling_timeout =
-      p_sm_mgr->p_subn->opt.sminfo_polling_timeout;
-   cl_status_t cl_status;
-
-   OSM_LOG_ENTER( p_sm_mgr->p_log, __osm_sm_state_mgr_start_polling );
-
-   /*
-    * Init the retry_nubmer back to zero - need to restart counting
-    */
-   p_sm_mgr->retry_number = 0;
-
-   /*
-    * Send a SubnGet(SMInfo) query to the current (or new) master found.
-    */
-   __osm_sm_state_mgr_send_master_sm_info_req( p_sm_mgr );
-
-   /*
-    * Start a timer that will wake up every sminfo_polling_timeout milliseconds.
-    * The callback of the timer will send a SubnGet(SMInfo) to the Master SM
-    * and restart the timer
-    */
-   cl_status = cl_timer_start( &p_sm_mgr->polling_timer,
-                               sminfo_polling_timeout );
-   if( cl_status != CL_SUCCESS )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_ERROR,
-               "__osm_sm_state_mgr_start_polling: ERR 3210: "
-               "Failed to start timer\n" );
-   }
-
-   OSM_LOG_EXIT( p_sm_mgr->p_log );
+	uint32_t sminfo_polling_timeout =
+	    p_sm_mgr->p_subn->opt.sminfo_polling_timeout;
+	cl_status_t cl_status;
+
+	OSM_LOG_ENTER(p_sm_mgr->p_log, __osm_sm_state_mgr_start_polling);
+
+	/*
+	 * Init the retry_nubmer back to zero - need to restart counting
+	 */
+	p_sm_mgr->retry_number = 0;
+
+	/*
+	 * Send a SubnGet(SMInfo) query to the current (or new) master found.
+	 */
+	__osm_sm_state_mgr_send_master_sm_info_req(p_sm_mgr);
+
+	/*
+	 * Start a timer that will wake up every sminfo_polling_timeout milliseconds.
+	 * The callback of the timer will send a SubnGet(SMInfo) to the Master SM
+	 * and restart the timer
+	 */
+	cl_status = cl_timer_start(&p_sm_mgr->polling_timer,
+				   sminfo_polling_timeout);
+	if (cl_status != CL_SUCCESS) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_sm_state_mgr_start_polling: ERR 3210: "
+			"Failed to start timer\n");
+	}
+
+	OSM_LOG_EXIT(p_sm_mgr->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
-static void
-__osm_sm_state_mgr_polling_callback(
-   IN void *context )
+static void __osm_sm_state_mgr_polling_callback(IN void *context)
 {
-   osm_sm_state_mgr_t *p_sm_mgr = ( osm_sm_state_mgr_t * ) context;
-   uint32_t sminfo_polling_timeout =
-      p_sm_mgr->p_subn->opt.sminfo_polling_timeout;
-   cl_status_t cl_status;
-
-   OSM_LOG_ENTER( p_sm_mgr->p_log, __osm_sm_state_mgr_polling_callback );
-
-   /*
-    * We can be here in one of two cases:
-    * 1. We are a STANDBY sm polling on the master SM.
-    * 2. We are a MASTER sm, waiting for a handover from a remote master sm.
-    * If we are not in one of these cases - don't need to restart the poller.
-    */
-   if( !( ( p_sm_mgr->p_subn->sm_state == IB_SMINFO_STATE_MASTER &&
-            p_sm_mgr->p_polling_sm != NULL ) ||
-          ( p_sm_mgr->p_subn->sm_state == IB_SMINFO_STATE_STANDBY ) ) )
-   {
-      goto Exit;
-   }
-
-   /*
-    * If we are a STANDBY sm and the osm_exit_flag is 1, then let's signal
-    * the subnet_up. This is relevant for the case of running only once. In that
-    * case - the program is stuck until this signal is received. In other
-    * cases - it is not relevant whether or not the signal is on - since we are
-    * currently in exit flow
-    */
-   if( p_sm_mgr->p_subn->sm_state == IB_SMINFO_STATE_STANDBY &&
-       osm_exit_flag == 1 )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_VERBOSE,
-               "__osm_sm_state_mgr_polling_callback: "
-               "Signalling subnet_up_event\n" );
-      cl_event_signal( p_sm_mgr->p_state_mgr->p_subnet_up_event );
-      goto Exit;
-   }
-
-   /*
-    * Incr the retry number.
-    * If it reached the max_retry_number in the subnet opt - call
-    * osm_sm_state_mgr_process with signal OSM_SM_SIGNAL_POLLING_TIMEOUT
-    */
-   p_sm_mgr->retry_number++;
-   osm_log( p_sm_mgr->p_log, OSM_LOG_VERBOSE,
-            "__osm_sm_state_mgr_polling_callback: "
-            "Retry number:%d\n", p_sm_mgr->retry_number );
-
-   if( p_sm_mgr->retry_number >= p_sm_mgr->p_subn->opt.polling_retry_number )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_DEBUG,
-               "__osm_sm_state_mgr_polling_callback: "
-               "Reached polling_retry_number value in retry_number. "
-               "Go to DISCOVERY state\n" );
-      osm_sm_state_mgr_process( p_sm_mgr, OSM_SM_SIGNAL_POLLING_TIMEOUT );
-      goto Exit;
-   }
-
-   /* Send a SubnGet(SMInfo) request to the remote sm (depends on our state) */
-   __osm_sm_state_mgr_send_master_sm_info_req( p_sm_mgr );
-
-   /* restart the timer */
-   cl_status = cl_timer_start( &p_sm_mgr->polling_timer,
-                               sminfo_polling_timeout );
-   if( cl_status != CL_SUCCESS )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_ERROR,
-               "__osm_sm_state_mgr_polling_callback: ERR 3211: "
-               "Failed to restart timer\n" );
-   }
-
- Exit:
-   OSM_LOG_EXIT( p_sm_mgr->p_log );
-   return;
+	osm_sm_state_mgr_t *p_sm_mgr = (osm_sm_state_mgr_t *) context;
+	uint32_t sminfo_polling_timeout =
+	    p_sm_mgr->p_subn->opt.sminfo_polling_timeout;
+	cl_status_t cl_status;
+
+	OSM_LOG_ENTER(p_sm_mgr->p_log, __osm_sm_state_mgr_polling_callback);
+
+	/*
+	 * We can be here in one of two cases:
+	 * 1. We are a STANDBY sm polling on the master SM.
+	 * 2. We are a MASTER sm, waiting for a handover from a remote master sm.
+	 * If we are not in one of these cases - don't need to restart the poller.
+	 */
+	if (!((p_sm_mgr->p_subn->sm_state == IB_SMINFO_STATE_MASTER &&
+	       p_sm_mgr->p_polling_sm != NULL) ||
+	      (p_sm_mgr->p_subn->sm_state == IB_SMINFO_STATE_STANDBY))) {
+		goto Exit;
+	}
+
+	/*
+	 * If we are a STANDBY sm and the osm_exit_flag is 1, then let's signal
+	 * the subnet_up. This is relevant for the case of running only once. In that
+	 * case - the program is stuck until this signal is received. In other
+	 * cases - it is not relevant whether or not the signal is on - since we are
+	 * currently in exit flow
+	 */
+	if (p_sm_mgr->p_subn->sm_state == IB_SMINFO_STATE_STANDBY &&
+	    osm_exit_flag == 1) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_VERBOSE,
+			"__osm_sm_state_mgr_polling_callback: "
+			"Signalling subnet_up_event\n");
+		cl_event_signal(p_sm_mgr->p_state_mgr->p_subnet_up_event);
+		goto Exit;
+	}
+
+	/*
+	 * Incr the retry number.
+	 * If it reached the max_retry_number in the subnet opt - call
+	 * osm_sm_state_mgr_process with signal OSM_SM_SIGNAL_POLLING_TIMEOUT
+	 */
+	p_sm_mgr->retry_number++;
+	osm_log(p_sm_mgr->p_log, OSM_LOG_VERBOSE,
+		"__osm_sm_state_mgr_polling_callback: "
+		"Retry number:%d\n", p_sm_mgr->retry_number);
+
+	if (p_sm_mgr->retry_number >=
+	    p_sm_mgr->p_subn->opt.polling_retry_number) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_DEBUG,
+			"__osm_sm_state_mgr_polling_callback: "
+			"Reached polling_retry_number value in retry_number. "
+			"Go to DISCOVERY state\n");
+		osm_sm_state_mgr_process(p_sm_mgr,
+					 OSM_SM_SIGNAL_POLLING_TIMEOUT);
+		goto Exit;
+	}
+
+	/* Send a SubnGet(SMInfo) request to the remote sm (depends on our state) */
+	__osm_sm_state_mgr_send_master_sm_info_req(p_sm_mgr);
+
+	/* restart the timer */
+	cl_status = cl_timer_start(&p_sm_mgr->polling_timer,
+				   sminfo_polling_timeout);
+	if (cl_status != CL_SUCCESS) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_ERROR,
+			"__osm_sm_state_mgr_polling_callback: ERR 3211: "
+			"Failed to restart timer\n");
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_sm_mgr->p_log);
+	return;
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sm_state_mgr_construct(
-   IN osm_sm_state_mgr_t * const p_sm_mgr )
+void osm_sm_state_mgr_construct(IN osm_sm_state_mgr_t * const p_sm_mgr)
 {
-   memset( p_sm_mgr, 0, sizeof( *p_sm_mgr ) );
-   cl_spinlock_construct( &p_sm_mgr->state_lock );
-   cl_timer_construct( &p_sm_mgr->polling_timer );
+	memset(p_sm_mgr, 0, sizeof(*p_sm_mgr));
+	cl_spinlock_construct(&p_sm_mgr->state_lock);
+	cl_timer_construct(&p_sm_mgr->polling_timer);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sm_state_mgr_destroy(
-   IN osm_sm_state_mgr_t * const p_sm_mgr )
+void osm_sm_state_mgr_destroy(IN osm_sm_state_mgr_t * const p_sm_mgr)
 {
-   CL_ASSERT( p_sm_mgr );
+	CL_ASSERT(p_sm_mgr);
 
-   OSM_LOG_ENTER( p_sm_mgr->p_log, osm_sm_state_mgr_destroy );
+	OSM_LOG_ENTER(p_sm_mgr->p_log, osm_sm_state_mgr_destroy);
 
-   cl_spinlock_destroy( &p_sm_mgr->state_lock );
-   cl_timer_destroy( &p_sm_mgr->polling_timer );
+	cl_spinlock_destroy(&p_sm_mgr->state_lock);
+	cl_timer_destroy(&p_sm_mgr->polling_timer);
 
-   OSM_LOG_EXIT( p_sm_mgr->p_log );
+	OSM_LOG_EXIT(p_sm_mgr->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_sm_state_mgr_init(
-   IN osm_sm_state_mgr_t * const p_sm_mgr,
-   IN osm_state_mgr_t * const p_state_mgr,
-   IN osm_subn_t * const p_subn,
-   IN osm_req_t * const p_req,
-   IN osm_log_t * const p_log )
+osm_sm_state_mgr_init(IN osm_sm_state_mgr_t * const p_sm_mgr,
+		      IN osm_state_mgr_t * const p_state_mgr,
+		      IN osm_subn_t * const p_subn,
+		      IN osm_req_t * const p_req, IN osm_log_t * const p_log)
 {
-   cl_status_t status;
-
-   OSM_LOG_ENTER( p_log, osm_sm_state_mgr_init );
-
-   CL_ASSERT( p_subn );
-   CL_ASSERT( p_state_mgr );
-   CL_ASSERT( p_req );
-
-   osm_sm_state_mgr_construct( p_sm_mgr );
-
-   p_sm_mgr->p_log = p_log;
-   p_sm_mgr->p_req = p_req;
-   p_sm_mgr->p_subn = p_subn;
-   p_sm_mgr->p_state_mgr = p_state_mgr;
-
-   if (p_subn->opt.sm_inactive)
-   {
-     /* init the state of the SM to not active */
-     p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_NOTACTIVE;
-     __osm_sm_state_mgr_notactive_msg( p_sm_mgr );
-   }
-   else
-   {
-     /* init the state of the SM to init */
-     p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_INIT;
-   }
-
-   status = cl_spinlock_init( &p_sm_mgr->state_lock );
-   if( status != CL_SUCCESS )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_ERROR,
-               "osm_sm_state_mgr_init: ERR 3201: "
-               "Spinlock init failed (%s)\n", CL_STATUS_MSG( status ) );
-   }
-
-   status = cl_timer_init( &p_sm_mgr->polling_timer,
-                           __osm_sm_state_mgr_polling_callback, p_sm_mgr );
-
-   if( status != CL_SUCCESS )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_ERROR,
-               "osm_sm_state_mgr_init: ERR 3206: "
-               "Timer init failed (%s)\n", CL_STATUS_MSG( status ) );
-   }
-
-   OSM_LOG_EXIT( p_sm_mgr->p_log );
-   return ( status );
+	cl_status_t status;
+
+	OSM_LOG_ENTER(p_log, osm_sm_state_mgr_init);
+
+	CL_ASSERT(p_subn);
+	CL_ASSERT(p_state_mgr);
+	CL_ASSERT(p_req);
+
+	osm_sm_state_mgr_construct(p_sm_mgr);
+
+	p_sm_mgr->p_log = p_log;
+	p_sm_mgr->p_req = p_req;
+	p_sm_mgr->p_subn = p_subn;
+	p_sm_mgr->p_state_mgr = p_state_mgr;
+
+	if (p_subn->opt.sm_inactive) {
+		/* init the state of the SM to not active */
+		p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_NOTACTIVE;
+		__osm_sm_state_mgr_notactive_msg(p_sm_mgr);
+	} else {
+		/* init the state of the SM to init */
+		p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_INIT;
+	}
+
+	status = cl_spinlock_init(&p_sm_mgr->state_lock);
+	if (status != CL_SUCCESS) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_ERROR,
+			"osm_sm_state_mgr_init: ERR 3201: "
+			"Spinlock init failed (%s)\n", CL_STATUS_MSG(status));
+	}
+
+	status = cl_timer_init(&p_sm_mgr->polling_timer,
+			       __osm_sm_state_mgr_polling_callback, p_sm_mgr);
+
+	if (status != CL_SUCCESS) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_ERROR,
+			"osm_sm_state_mgr_init: ERR 3206: "
+			"Timer init failed (%s)\n", CL_STATUS_MSG(status));
+	}
+
+	OSM_LOG_EXIT(p_sm_mgr->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-__osm_sm_state_mgr_signal_error(
-   IN const osm_sm_state_mgr_t * const p_sm_mgr,
-   IN const osm_sm_signal_t signal )
+__osm_sm_state_mgr_signal_error(IN const osm_sm_state_mgr_t * const p_sm_mgr,
+				IN const osm_sm_signal_t signal)
 {
-   osm_log( p_sm_mgr->p_log, OSM_LOG_ERROR,
-            "__osm_sm_state_mgr_signal_error: ERR 3207: "
-            "Invalid signal %s in state %s\n",
-            osm_get_sm_mgr_signal_str( signal ),
-            osm_get_sm_mgr_state_str( p_sm_mgr->p_subn->sm_state ) );
+	osm_log(p_sm_mgr->p_log, OSM_LOG_ERROR,
+		"__osm_sm_state_mgr_signal_error: ERR 3207: "
+		"Invalid signal %s in state %s\n",
+		osm_get_sm_mgr_signal_str(signal),
+		osm_get_sm_mgr_state_str(p_sm_mgr->p_subn->sm_state));
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-osm_sm_state_mgr_signal_master_is_alive(
-   IN osm_sm_state_mgr_t * const p_sm_mgr )
+osm_sm_state_mgr_signal_master_is_alive(IN osm_sm_state_mgr_t * const p_sm_mgr)
 {
-   OSM_LOG_ENTER( p_sm_mgr->p_log, osm_sm_state_mgr_signal_master_is_alive );
-   p_sm_mgr->retry_number = 0;
-   OSM_LOG_EXIT( p_sm_mgr->p_log );
+	OSM_LOG_ENTER(p_sm_mgr->p_log, osm_sm_state_mgr_signal_master_is_alive);
+	p_sm_mgr->retry_number = 0;
+	OSM_LOG_EXIT(p_sm_mgr->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_sm_state_mgr_process(
-   IN osm_sm_state_mgr_t * const p_sm_mgr,
-   IN osm_sm_signal_t signal )
+osm_sm_state_mgr_process(IN osm_sm_state_mgr_t * const p_sm_mgr,
+			 IN osm_sm_signal_t signal)
 {
-   ib_api_status_t status = IB_SUCCESS;
-
-   CL_ASSERT( p_sm_mgr );
-
-   OSM_LOG_ENTER( p_sm_mgr->p_log, osm_sm_state_mgr_process );
-
-   /*
-    * The state lock prevents many race conditions from screwing
-    * up the state transition process.
-    */
-   cl_spinlock_acquire( &p_sm_mgr->state_lock );
-
-   if( osm_log_is_active( p_sm_mgr->p_log, OSM_LOG_DEBUG ) )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_DEBUG,
-               "osm_sm_state_mgr_process: "
-               "Received signal %s in state %s\n",
-               osm_get_sm_mgr_signal_str( signal ),
-               osm_get_sm_mgr_state_str( p_sm_mgr->p_subn->sm_state ) );
-   }
-
-   switch ( p_sm_mgr->p_subn->sm_state )
-   {
-   case IB_SMINFO_STATE_INIT:
-      switch ( signal )
-      {
-      case OSM_SM_SIGNAL_INIT:
-         /*
-          * Update the state of the SM to DISCOVERING
-          */
-         __osm_sm_state_mgr_discovering_msg( p_sm_mgr );
-         p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_DISCOVERING;
-         break;
-
-      default:
-         __osm_sm_state_mgr_signal_error( p_sm_mgr, signal );
-         status = IB_INVALID_PARAMETER;
-         break;
-      }
-      break;
-
-   case IB_SMINFO_STATE_DISCOVERING:
-      switch ( signal )
-      {
-      case OSM_SM_SIGNAL_DISCOVERY_COMPLETED:
-         /*
-          * Update the state of the SM to MASTER
-          */
-         __osm_sm_state_mgr_master_msg( p_sm_mgr );
-         /* Turn on the moved_to_master_state flag */
-         p_sm_mgr->p_subn->moved_to_master_state = TRUE;
-         /* Turn on the first_time_master_sweep flag */
-         if( p_sm_mgr->p_subn->first_time_master_sweep == FALSE )
-            p_sm_mgr->p_subn->first_time_master_sweep = TRUE;
-         p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_MASTER;
-         /*
-          * Make sure to set the subnet master_sm_base_lid
-          * to the sm_base_lid value
-          */
-         p_sm_mgr->p_subn->master_sm_base_lid = p_sm_mgr->p_subn->sm_base_lid;
-         break;
-      case OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED_DONE:
-         /*
-          * Finished all discovery actions - move to STANDBY
-          * start the polling
-          */
-         __osm_sm_state_mgr_standby_msg( p_sm_mgr );
-         p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_STANDBY;
-         /*
-          * Since another SM is doing the LFT config - we should not
-          * ignore the results of it
-          */
-         p_sm_mgr->p_subn->ignore_existing_lfts = FALSE;
-
-         __osm_sm_state_mgr_start_polling( p_sm_mgr );
-         break;
-      case OSM_SM_SIGNAL_HANDOVER:
-        /*
-         * Do nothing. We will discover it later on. If we already discovered
-         * this SM, and got the HANDOVER - this means the remote SM is of
-         * lower priority. In this case we will stop polling it (since it is
-         * a lower priority SM in STANDBY state).
-         */
-         break;
-      default:
-         __osm_sm_state_mgr_signal_error( p_sm_mgr, signal );
-         status = IB_INVALID_PARAMETER;
-         break;
-      }
-      break;
-
-   case IB_SMINFO_STATE_STANDBY:
-      switch ( signal )
-      {
-      case OSM_SM_SIGNAL_POLLING_TIMEOUT:
-      case OSM_SM_SIGNAL_DISCOVER:
-         /*
-          * case 1: Polling timeout occured - this means that the Master SM
-          * is no longer alive.
-          * case 2: Got a signal to move to DISCOVERING
-          * Move to DISCOVERING state and start sweeping
-          */
-         __osm_sm_state_mgr_discovering_msg( p_sm_mgr );
-         p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_DISCOVERING;
-         p_sm_mgr->p_subn->coming_out_of_standby = TRUE;
-         osm_state_mgr_process( p_sm_mgr->p_state_mgr, OSM_SIGNAL_EXIT_STBY );
-         break;
-      case OSM_SM_SIGNAL_DISABLE:
-         /*
-          * Update the state to NOT_ACTIVE
-          */
-         __osm_sm_state_mgr_notactive_msg( p_sm_mgr );
-         p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_NOTACTIVE;
-         break;
-      case OSM_SM_SIGNAL_HANDOVER:
-         /*
-          * Update the state to MASTER, and start sweeping
-          * OPTIONAL: send ACKNOWLEDGE
-          */
-         __osm_sm_state_mgr_master_msg( p_sm_mgr );
-         /* Turn on the moved_to_master_state flag */
-         p_sm_mgr->p_subn->moved_to_master_state = TRUE;
-         /* Turn on the first_time_master_sweep flag */
-         if( p_sm_mgr->p_subn->first_time_master_sweep == FALSE )
-            p_sm_mgr->p_subn->first_time_master_sweep = TRUE;
-         /* Turn on the force_immediate_heavy_sweep - we want a
-          * heavy sweep to occur on the first sweep of this SM. */
-         p_sm_mgr->p_subn->force_immediate_heavy_sweep = TRUE;
-
-         p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_MASTER;
-         /*
-          * Make sure to set the subnet master_sm_base_lid
-          * to the sm_base_lid value
-          */
-         p_sm_mgr->p_subn->master_sm_base_lid = p_sm_mgr->p_subn->sm_base_lid;
-         p_sm_mgr->p_subn->coming_out_of_standby = TRUE;
-         osm_state_mgr_process( p_sm_mgr->p_state_mgr, OSM_SIGNAL_EXIT_STBY );
-         break;
-      case OSM_SM_SIGNAL_ACKNOWLEDGE:
-         /*
-          * Do nothing - already moved to STANDBY
-          */
-         break;
-      default:
-         __osm_sm_state_mgr_signal_error( p_sm_mgr, signal );
-         status = IB_INVALID_PARAMETER;
-         break;
-      }
-      break;
-
-   case IB_SMINFO_STATE_NOTACTIVE:
-      switch ( signal )
-      {
-      case OSM_SM_SIGNAL_STANDBY:
-         /*
-          * Update the state to STANDBY
-          * start the polling
-          */
-         __osm_sm_state_mgr_standby_msg( p_sm_mgr );
-         p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_STANDBY;
-         __osm_sm_state_mgr_start_polling( p_sm_mgr );
-         break;
-      default:
-         __osm_sm_state_mgr_signal_error( p_sm_mgr, signal );
-         status = IB_INVALID_PARAMETER;
-         break;
-      }
-      break;
-
-   case IB_SMINFO_STATE_MASTER:
-      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.
-          */
-      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
-          * 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.
-          */
-         osm_log( p_sm_mgr->p_log, OSM_LOG_VERBOSE,
-                  "osm_sm_state_mgr_process: "
-                  "Forcing immediate heavy sweep. "
-                  "Received OSM_SM_SIGNAL_HANDOVER or OSM_SM_SIGNAL_POLLING_TIMEOUT\n" );
-         p_sm_mgr->p_polling_sm = NULL;
-         p_sm_mgr->p_subn->force_immediate_heavy_sweep = TRUE;
-         osm_state_mgr_process( p_sm_mgr->p_state_mgr, OSM_SIGNAL_SWEEP );
-         break;
-      case OSM_SM_SIGNAL_HANDOVER_SENT:
-         /*
-          * Just sent a HANDOVER signal - move to STANDBY
-          * start the polling
-          */
-         __osm_sm_state_mgr_standby_msg( p_sm_mgr );
-         p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_STANDBY;
-         __osm_sm_state_mgr_start_polling( p_sm_mgr );
-         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.
-          */
-         __osm_sm_state_mgr_start_polling( p_sm_mgr );
-         break;
-      case OSM_SM_SIGNAL_DISCOVER:
-         __osm_sm_state_mgr_discovering_msg( p_sm_mgr );
-         p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_DISCOVERING;
-         break;
-      default:
-         __osm_sm_state_mgr_signal_error( p_sm_mgr, signal );
-         status = IB_INVALID_PARAMETER;
-         break;
-      }
-      break;
-
-   default:
-      osm_log( p_sm_mgr->p_log, OSM_LOG_ERROR,
-               "osm_sm_state_mgr_process: ERR 3208: "
-               "Invalid state %s\n",
-               osm_get_sm_mgr_state_str( p_sm_mgr->p_subn->sm_state ) );
-
-   }
-
-   cl_spinlock_release( &p_sm_mgr->state_lock );
-
-   OSM_LOG_EXIT( p_sm_mgr->p_log );
-   return ( status );
+	ib_api_status_t status = IB_SUCCESS;
+
+	CL_ASSERT(p_sm_mgr);
+
+	OSM_LOG_ENTER(p_sm_mgr->p_log, osm_sm_state_mgr_process);
+
+	/*
+	 * The state lock prevents many race conditions from screwing
+	 * up the state transition process.
+	 */
+	cl_spinlock_acquire(&p_sm_mgr->state_lock);
+
+	if (osm_log_is_active(p_sm_mgr->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_DEBUG,
+			"osm_sm_state_mgr_process: "
+			"Received signal %s in state %s\n",
+			osm_get_sm_mgr_signal_str(signal),
+			osm_get_sm_mgr_state_str(p_sm_mgr->p_subn->sm_state));
+	}
+
+	switch (p_sm_mgr->p_subn->sm_state) {
+	case IB_SMINFO_STATE_INIT:
+		switch (signal) {
+		case OSM_SM_SIGNAL_INIT:
+			/*
+			 * Update the state of the SM to DISCOVERING
+			 */
+			__osm_sm_state_mgr_discovering_msg(p_sm_mgr);
+			p_sm_mgr->p_subn->sm_state =
+			    IB_SMINFO_STATE_DISCOVERING;
+			break;
+
+		default:
+			__osm_sm_state_mgr_signal_error(p_sm_mgr, signal);
+			status = IB_INVALID_PARAMETER;
+			break;
+		}
+		break;
+
+	case IB_SMINFO_STATE_DISCOVERING:
+		switch (signal) {
+		case OSM_SM_SIGNAL_DISCOVERY_COMPLETED:
+			/*
+			 * Update the state of the SM to MASTER
+			 */
+			__osm_sm_state_mgr_master_msg(p_sm_mgr);
+			/* Turn on the moved_to_master_state flag */
+			p_sm_mgr->p_subn->moved_to_master_state = TRUE;
+			/* Turn on the first_time_master_sweep flag */
+			if (p_sm_mgr->p_subn->first_time_master_sweep == FALSE)
+				p_sm_mgr->p_subn->first_time_master_sweep =
+				    TRUE;
+			p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_MASTER;
+			/*
+			 * Make sure to set the subnet master_sm_base_lid
+			 * to the sm_base_lid value
+			 */
+			p_sm_mgr->p_subn->master_sm_base_lid =
+			    p_sm_mgr->p_subn->sm_base_lid;
+			break;
+		case OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED_DONE:
+			/*
+			 * Finished all discovery actions - move to STANDBY
+			 * start the polling
+			 */
+			__osm_sm_state_mgr_standby_msg(p_sm_mgr);
+			p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_STANDBY;
+			/*
+			 * Since another SM is doing the LFT config - we should not
+			 * ignore the results of it
+			 */
+			p_sm_mgr->p_subn->ignore_existing_lfts = FALSE;
+
+			__osm_sm_state_mgr_start_polling(p_sm_mgr);
+			break;
+		case OSM_SM_SIGNAL_HANDOVER:
+			/*
+			 * Do nothing. We will discover it later on. If we already discovered
+			 * this SM, and got the HANDOVER - this means the remote SM is of
+			 * lower priority. In this case we will stop polling it (since it is
+			 * a lower priority SM in STANDBY state).
+			 */
+			break;
+		default:
+			__osm_sm_state_mgr_signal_error(p_sm_mgr, signal);
+			status = IB_INVALID_PARAMETER;
+			break;
+		}
+		break;
+
+	case IB_SMINFO_STATE_STANDBY:
+		switch (signal) {
+		case OSM_SM_SIGNAL_POLLING_TIMEOUT:
+		case OSM_SM_SIGNAL_DISCOVER:
+			/*
+			 * case 1: Polling timeout occured - this means that the Master SM
+			 * is no longer alive.
+			 * case 2: Got a signal to move to DISCOVERING
+			 * Move to DISCOVERING state and start sweeping
+			 */
+			__osm_sm_state_mgr_discovering_msg(p_sm_mgr);
+			p_sm_mgr->p_subn->sm_state =
+			    IB_SMINFO_STATE_DISCOVERING;
+			p_sm_mgr->p_subn->coming_out_of_standby = TRUE;
+			osm_state_mgr_process(p_sm_mgr->p_state_mgr,
+					      OSM_SIGNAL_EXIT_STBY);
+			break;
+		case OSM_SM_SIGNAL_DISABLE:
+			/*
+			 * Update the state to NOT_ACTIVE
+			 */
+			__osm_sm_state_mgr_notactive_msg(p_sm_mgr);
+			p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_NOTACTIVE;
+			break;
+		case OSM_SM_SIGNAL_HANDOVER:
+			/*
+			 * Update the state to MASTER, and start sweeping
+			 * OPTIONAL: send ACKNOWLEDGE
+			 */
+			__osm_sm_state_mgr_master_msg(p_sm_mgr);
+			/* Turn on the moved_to_master_state flag */
+			p_sm_mgr->p_subn->moved_to_master_state = TRUE;
+			/* Turn on the first_time_master_sweep flag */
+			if (p_sm_mgr->p_subn->first_time_master_sweep == FALSE)
+				p_sm_mgr->p_subn->first_time_master_sweep =
+				    TRUE;
+			/* Turn on the force_immediate_heavy_sweep - we want a
+			 * heavy sweep to occur on the first sweep of this SM. */
+			p_sm_mgr->p_subn->force_immediate_heavy_sweep = TRUE;
+
+			p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_MASTER;
+			/*
+			 * Make sure to set the subnet master_sm_base_lid
+			 * to the sm_base_lid value
+			 */
+			p_sm_mgr->p_subn->master_sm_base_lid =
+			    p_sm_mgr->p_subn->sm_base_lid;
+			p_sm_mgr->p_subn->coming_out_of_standby = TRUE;
+			osm_state_mgr_process(p_sm_mgr->p_state_mgr,
+					      OSM_SIGNAL_EXIT_STBY);
+			break;
+		case OSM_SM_SIGNAL_ACKNOWLEDGE:
+			/*
+			 * Do nothing - already moved to STANDBY
+			 */
+			break;
+		default:
+			__osm_sm_state_mgr_signal_error(p_sm_mgr, signal);
+			status = IB_INVALID_PARAMETER;
+			break;
+		}
+		break;
+
+	case IB_SMINFO_STATE_NOTACTIVE:
+		switch (signal) {
+		case OSM_SM_SIGNAL_STANDBY:
+			/*
+			 * Update the state to STANDBY
+			 * start the polling
+			 */
+			__osm_sm_state_mgr_standby_msg(p_sm_mgr);
+			p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_STANDBY;
+			__osm_sm_state_mgr_start_polling(p_sm_mgr);
+			break;
+		default:
+			__osm_sm_state_mgr_signal_error(p_sm_mgr, signal);
+			status = IB_INVALID_PARAMETER;
+			break;
+		}
+		break;
+
+	case IB_SMINFO_STATE_MASTER:
+		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.
+			 */
+		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
+			 * 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.
+			 */
+			osm_log(p_sm_mgr->p_log, OSM_LOG_VERBOSE,
+				"osm_sm_state_mgr_process: "
+				"Forcing immediate heavy sweep. "
+				"Received OSM_SM_SIGNAL_HANDOVER or OSM_SM_SIGNAL_POLLING_TIMEOUT\n");
+			p_sm_mgr->p_polling_sm = NULL;
+			p_sm_mgr->p_subn->force_immediate_heavy_sweep = TRUE;
+			osm_state_mgr_process(p_sm_mgr->p_state_mgr,
+					      OSM_SIGNAL_SWEEP);
+			break;
+		case OSM_SM_SIGNAL_HANDOVER_SENT:
+			/*
+			 * Just sent a HANDOVER signal - move to STANDBY
+			 * start the polling
+			 */
+			__osm_sm_state_mgr_standby_msg(p_sm_mgr);
+			p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_STANDBY;
+			__osm_sm_state_mgr_start_polling(p_sm_mgr);
+			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.
+			 */
+			__osm_sm_state_mgr_start_polling(p_sm_mgr);
+			break;
+		case OSM_SM_SIGNAL_DISCOVER:
+			__osm_sm_state_mgr_discovering_msg(p_sm_mgr);
+			p_sm_mgr->p_subn->sm_state =
+			    IB_SMINFO_STATE_DISCOVERING;
+			break;
+		default:
+			__osm_sm_state_mgr_signal_error(p_sm_mgr, signal);
+			status = IB_INVALID_PARAMETER;
+			break;
+		}
+		break;
+
+	default:
+		osm_log(p_sm_mgr->p_log, OSM_LOG_ERROR,
+			"osm_sm_state_mgr_process: ERR 3208: "
+			"Invalid state %s\n",
+			osm_get_sm_mgr_state_str(p_sm_mgr->p_subn->sm_state));
+
+	}
+
+	cl_spinlock_release(&p_sm_mgr->state_lock);
+
+	OSM_LOG_EXIT(p_sm_mgr->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_sm_state_mgr_check_legality(
-   IN osm_sm_state_mgr_t * const p_sm_mgr,
-   IN osm_sm_signal_t signal )
+osm_sm_state_mgr_check_legality(IN osm_sm_state_mgr_t * const p_sm_mgr,
+				IN osm_sm_signal_t signal)
 {
-   ib_api_status_t status = IB_SUCCESS;
-
-   CL_ASSERT( p_sm_mgr );
-
-   OSM_LOG_ENTER( p_sm_mgr->p_log, osm_sm_state_mgr_check_legality );
-
-   /*
-    * The state lock prevents many race conditions from screwing
-    * up the state transition process.
-    */
-   cl_spinlock_acquire( &p_sm_mgr->state_lock );
-
-   if( osm_log_is_active( p_sm_mgr->p_log, OSM_LOG_DEBUG ) )
-   {
-      osm_log( p_sm_mgr->p_log, OSM_LOG_DEBUG,
-               "osm_sm_state_mgr_check_legality: "
-               "Received signal %s in state %s\n",
-               osm_get_sm_mgr_signal_str( signal ),
-               osm_get_sm_mgr_state_str( p_sm_mgr->p_subn->sm_state ) );
-   }
-
-   switch ( p_sm_mgr->p_subn->sm_state )
-   {
-   case IB_SMINFO_STATE_INIT:
-      switch ( signal )
-      {
-      case OSM_SM_SIGNAL_INIT:
-         status = IB_SUCCESS;
-         break;
-      default:
-         __osm_sm_state_mgr_signal_error( p_sm_mgr, signal );
-         status = IB_INVALID_PARAMETER;
-         break;
-      }
-      break;
-
-   case IB_SMINFO_STATE_DISCOVERING:
-      switch ( signal )
-      {
-      case OSM_SM_SIGNAL_DISCOVERY_COMPLETED:
-      case OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED_DONE:
-      case OSM_SM_SIGNAL_HANDOVER:
-         status = IB_SUCCESS;
-         break;
-      default:
-         __osm_sm_state_mgr_signal_error( p_sm_mgr, signal );
-         status = IB_INVALID_PARAMETER;
-         break;
-      }
-      break;
-
-   case IB_SMINFO_STATE_STANDBY:
-      switch ( signal )
-      {
-      case OSM_SM_SIGNAL_POLLING_TIMEOUT:
-      case OSM_SM_SIGNAL_DISCOVER:
-      case OSM_SM_SIGNAL_DISABLE:
-      case OSM_SM_SIGNAL_HANDOVER:
-      case OSM_SM_SIGNAL_ACKNOWLEDGE:
-         status = IB_SUCCESS;
-         break;
-      default:
-         __osm_sm_state_mgr_signal_error( p_sm_mgr, signal );
-         status = IB_INVALID_PARAMETER;
-         break;
-      }
-      break;
-
-   case IB_SMINFO_STATE_NOTACTIVE:
-      switch ( signal )
-      {
-      case OSM_SM_SIGNAL_STANDBY:
-         status = IB_SUCCESS;
-         break;
-      default:
-         __osm_sm_state_mgr_signal_error( p_sm_mgr, signal );
-         status = IB_INVALID_PARAMETER;
-         break;
-      }
-      break;
-
-   case IB_SMINFO_STATE_MASTER:
-      switch ( signal )
-      {
-      case OSM_SM_SIGNAL_HANDOVER:
-      case OSM_SM_SIGNAL_HANDOVER_SENT:
-         status = IB_SUCCESS;
-         break;
-      default:
-         __osm_sm_state_mgr_signal_error( p_sm_mgr, signal );
-         status = IB_INVALID_PARAMETER;
-         break;
-      }
-      break;
-
-   default:
-      osm_log( p_sm_mgr->p_log, OSM_LOG_ERROR,
-               "osm_sm_state_mgr_check_legality: ERR 3209: "
-               "Invalid state %s\n",
-               osm_get_sm_mgr_state_str( p_sm_mgr->p_subn->sm_state ) );
-      status = IB_INVALID_PARAMETER;
-
-   }
-
-   cl_spinlock_release( &p_sm_mgr->state_lock );
-
-   OSM_LOG_EXIT( p_sm_mgr->p_log );
-   return ( status );
+	ib_api_status_t status = IB_SUCCESS;
+
+	CL_ASSERT(p_sm_mgr);
+
+	OSM_LOG_ENTER(p_sm_mgr->p_log, osm_sm_state_mgr_check_legality);
+
+	/*
+	 * The state lock prevents many race conditions from screwing
+	 * up the state transition process.
+	 */
+	cl_spinlock_acquire(&p_sm_mgr->state_lock);
+
+	if (osm_log_is_active(p_sm_mgr->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_sm_mgr->p_log, OSM_LOG_DEBUG,
+			"osm_sm_state_mgr_check_legality: "
+			"Received signal %s in state %s\n",
+			osm_get_sm_mgr_signal_str(signal),
+			osm_get_sm_mgr_state_str(p_sm_mgr->p_subn->sm_state));
+	}
+
+	switch (p_sm_mgr->p_subn->sm_state) {
+	case IB_SMINFO_STATE_INIT:
+		switch (signal) {
+		case OSM_SM_SIGNAL_INIT:
+			status = IB_SUCCESS;
+			break;
+		default:
+			__osm_sm_state_mgr_signal_error(p_sm_mgr, signal);
+			status = IB_INVALID_PARAMETER;
+			break;
+		}
+		break;
+
+	case IB_SMINFO_STATE_DISCOVERING:
+		switch (signal) {
+		case OSM_SM_SIGNAL_DISCOVERY_COMPLETED:
+		case OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED_DONE:
+		case OSM_SM_SIGNAL_HANDOVER:
+			status = IB_SUCCESS;
+			break;
+		default:
+			__osm_sm_state_mgr_signal_error(p_sm_mgr, signal);
+			status = IB_INVALID_PARAMETER;
+			break;
+		}
+		break;
+
+	case IB_SMINFO_STATE_STANDBY:
+		switch (signal) {
+		case OSM_SM_SIGNAL_POLLING_TIMEOUT:
+		case OSM_SM_SIGNAL_DISCOVER:
+		case OSM_SM_SIGNAL_DISABLE:
+		case OSM_SM_SIGNAL_HANDOVER:
+		case OSM_SM_SIGNAL_ACKNOWLEDGE:
+			status = IB_SUCCESS;
+			break;
+		default:
+			__osm_sm_state_mgr_signal_error(p_sm_mgr, signal);
+			status = IB_INVALID_PARAMETER;
+			break;
+		}
+		break;
+
+	case IB_SMINFO_STATE_NOTACTIVE:
+		switch (signal) {
+		case OSM_SM_SIGNAL_STANDBY:
+			status = IB_SUCCESS;
+			break;
+		default:
+			__osm_sm_state_mgr_signal_error(p_sm_mgr, signal);
+			status = IB_INVALID_PARAMETER;
+			break;
+		}
+		break;
+
+	case IB_SMINFO_STATE_MASTER:
+		switch (signal) {
+		case OSM_SM_SIGNAL_HANDOVER:
+		case OSM_SM_SIGNAL_HANDOVER_SENT:
+			status = IB_SUCCESS;
+			break;
+		default:
+			__osm_sm_state_mgr_signal_error(p_sm_mgr, signal);
+			status = IB_INVALID_PARAMETER;
+			break;
+		}
+		break;
+
+	default:
+		osm_log(p_sm_mgr->p_log, OSM_LOG_ERROR,
+			"osm_sm_state_mgr_check_legality: ERR 3209: "
+			"Invalid state %s\n",
+			osm_get_sm_mgr_state_str(p_sm_mgr->p_subn->sm_state));
+		status = IB_INVALID_PARAMETER;
+
+	}
+
+	cl_spinlock_release(&p_sm_mgr->state_lock);
+
+	OSM_LOG_EXIT(p_sm_mgr->p_log);
+	return (status);
 }
diff --git a/opensm/opensm/osm_state_mgr_ctrl.c b/opensm/opensm/osm_state_mgr_ctrl.c
index 54cfc5b..53868cf 100644
--- a/opensm/opensm/osm_state_mgr_ctrl.c
+++ b/opensm/opensm/osm_state_mgr_ctrl.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of osm_state_mgr_ctrl_t.
@@ -48,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <opensm/osm_state_mgr_ctrl.h>
@@ -56,72 +55,61 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-__osm_state_mgr_ctrl_disp_callback(
-  IN  void *context,
-  IN  void *p_data )
+void __osm_state_mgr_ctrl_disp_callback(IN void *context, IN void *p_data)
 {
-  /* ignore return status when invoked via the dispatcher */
-    osm_state_mgr_process( ((osm_state_mgr_ctrl_t*)context)->p_mgr,
-		(osm_signal_t)(p_data) );
+	/* ignore return status when invoked via the dispatcher */
+	osm_state_mgr_process(((osm_state_mgr_ctrl_t *) context)->p_mgr,
+			      (osm_signal_t) (p_data));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_state_mgr_ctrl_construct(
-  IN osm_state_mgr_ctrl_t* const p_ctrl )
+void osm_state_mgr_ctrl_construct(IN osm_state_mgr_ctrl_t * const p_ctrl)
 {
-  memset( p_ctrl, 0, sizeof(*p_ctrl) );
-  p_ctrl->h_disp = CL_DISP_INVALID_HANDLE;
+	memset(p_ctrl, 0, sizeof(*p_ctrl));
+	p_ctrl->h_disp = CL_DISP_INVALID_HANDLE;
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_state_mgr_ctrl_destroy(
-  IN osm_state_mgr_ctrl_t* const p_ctrl )
+void osm_state_mgr_ctrl_destroy(IN osm_state_mgr_ctrl_t * const p_ctrl)
 {
-  CL_ASSERT( p_ctrl );
-  cl_disp_unregister( p_ctrl->h_disp );
+	CL_ASSERT(p_ctrl);
+	cl_disp_unregister(p_ctrl->h_disp);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_state_mgr_ctrl_init(
-  IN osm_state_mgr_ctrl_t* const p_ctrl,
-  IN osm_state_mgr_t* const p_mgr,
-  IN osm_log_t* const p_log,
-  IN cl_dispatcher_t* const p_disp )
+osm_state_mgr_ctrl_init(IN osm_state_mgr_ctrl_t * const p_ctrl,
+			IN osm_state_mgr_t * const p_mgr,
+			IN osm_log_t * const p_log,
+			IN cl_dispatcher_t * const p_disp)
 {
-  ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_state_mgr_ctrl_init );
+	OSM_LOG_ENTER(p_log, osm_state_mgr_ctrl_init);
 
-  osm_state_mgr_ctrl_construct( p_ctrl );
-  p_ctrl->p_log = p_log;
+	osm_state_mgr_ctrl_construct(p_ctrl);
+	p_ctrl->p_log = p_log;
 
-  p_ctrl->p_mgr = p_mgr;
-  p_ctrl->p_disp = p_disp;
+	p_ctrl->p_mgr = p_mgr;
+	p_ctrl->p_disp = p_disp;
 
-  p_ctrl->h_disp = cl_disp_register(
-    p_disp,
-    OSM_MSG_NO_SMPS_OUTSTANDING,
-    __osm_state_mgr_ctrl_disp_callback,
-    p_ctrl );
+	p_ctrl->h_disp = cl_disp_register(p_disp,
+					  OSM_MSG_NO_SMPS_OUTSTANDING,
+					  __osm_state_mgr_ctrl_disp_callback,
+					  p_ctrl);
 
-  if( p_ctrl->h_disp == CL_DISP_INVALID_HANDLE )
-  {
-    osm_log( p_log, OSM_LOG_ERROR,
-             "osm_state_mgr_ctrl_init: ERR 3401: "
-             "Dispatcher registration failed\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
+	if (p_ctrl->h_disp == CL_DISP_INVALID_HANDLE) {
+		osm_log(p_log, OSM_LOG_ERROR,
+			"osm_state_mgr_ctrl_init: ERR 3401: "
+			"Dispatcher registration failed\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
 
- Exit:
-  OSM_LOG_EXIT( p_log );
-  return( status );
+      Exit:
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
-
diff --git a/opensm/opensm/osm_sw_info_rcv.c b/opensm/opensm/osm_sw_info_rcv.c
index 8eb8cd5..a2feadf 100644
--- a/opensm/opensm/osm_sw_info_rcv.c
+++ b/opensm/opensm/osm_sw_info_rcv.c
@@ -47,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -64,74 +64,69 @@
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_si_rcv_get_port_info(
-  IN const osm_si_rcv_t* const p_rcv,
-  IN osm_switch_t* const p_sw,
-  IN const osm_madw_t* const p_madw )
+__osm_si_rcv_get_port_info(IN const osm_si_rcv_t * const p_rcv,
+			   IN osm_switch_t * const p_sw,
+			   IN const osm_madw_t * const p_madw)
 {
-  osm_madw_context_t context;
-  uint8_t port_num;
-  osm_physp_t *p_physp;
-  osm_node_t *p_node;
-  uint8_t num_ports;
-  osm_dr_path_t dr_path;
-  const ib_smp_t* p_smp;
-  ib_api_status_t status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_si_rcv_get_port_info );
-
-  CL_ASSERT( p_sw );
-
-  p_node = p_sw->p_node;
-  p_smp = osm_madw_get_smp_ptr( p_madw );
-
-  CL_ASSERT( osm_node_get_type( p_node ) == IB_NODE_TYPE_SWITCH );
-
-  /*
-    Request PortInfo attribute for each port on the switch.
-    Don't trust the port's own DR Path, since it may no longer
-    be a legitimate path through the subnet.
-    Build a path from the mad instead, since we know that path works.
-    The port's DR Path info gets updated when the PortInfo
-    attribute is received.
-  */
-  p_physp = osm_node_get_any_physp_ptr( p_node );
-
-  CL_ASSERT( osm_physp_is_valid( p_physp ) );
-
-  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.update_master_sm_base_lid = FALSE;
-  context.pi_context.ignore_errors = FALSE;
-  context.pi_context.light_sweep = FALSE;
-  context.pi_context.active_transition = FALSE;
-
-  num_ports = osm_node_get_num_physp( p_node );
-  osm_dr_path_init( &dr_path,
-                    osm_madw_get_bind_handle( p_madw ),
-                    p_smp->hop_count, p_smp->initial_path );
-
-  for( port_num = 0; port_num < num_ports; port_num++)
-  {
-    status = osm_req_get(
-      p_rcv->p_req,
-      &dr_path,
-      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( p_rcv->p_log, OSM_LOG_ERROR,
-               "__osm_si_rcv_get_port_info: ERR 3602: "
-               "Failure initiating PortInfo request (%s)\n",
-               ib_get_err_str(status));
-    }
-  }
-
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_madw_context_t context;
+	uint8_t port_num;
+	osm_physp_t *p_physp;
+	osm_node_t *p_node;
+	uint8_t num_ports;
+	osm_dr_path_t dr_path;
+	const ib_smp_t *p_smp;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_si_rcv_get_port_info);
+
+	CL_ASSERT(p_sw);
+
+	p_node = p_sw->p_node;
+	p_smp = osm_madw_get_smp_ptr(p_madw);
+
+	CL_ASSERT(osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH);
+
+	/*
+	   Request PortInfo attribute for each port on the switch.
+	   Don't trust the port's own DR Path, since it may no longer
+	   be a legitimate path through the subnet.
+	   Build a path from the mad instead, since we know that path works.
+	   The port's DR Path info gets updated when the PortInfo
+	   attribute is received.
+	 */
+	p_physp = osm_node_get_any_physp_ptr(p_node);
+
+	CL_ASSERT(osm_physp_is_valid(p_physp));
+
+	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.update_master_sm_base_lid = FALSE;
+	context.pi_context.ignore_errors = FALSE;
+	context.pi_context.light_sweep = FALSE;
+	context.pi_context.active_transition = FALSE;
+
+	num_ports = osm_node_get_num_physp(p_node);
+	osm_dr_path_init(&dr_path,
+			 osm_madw_get_bind_handle(p_madw),
+			 p_smp->hop_count, p_smp->initial_path);
+
+	for (port_num = 0; port_num < num_ports; port_num++) {
+		status = osm_req_get(p_rcv->p_req,
+				     &dr_path,
+				     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(p_rcv->p_log, OSM_LOG_ERROR,
+				"__osm_si_rcv_get_port_info: ERR 3602: "
+				"Failure initiating PortInfo request (%s)\n",
+				ib_get_err_str(status));
+		}
+	}
+
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 #if 0
@@ -139,173 +134,159 @@ __osm_si_rcv_get_port_info(
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_si_rcv_get_fwd_tbl(
-  IN const osm_si_rcv_t* const p_rcv,
-  IN osm_switch_t* const p_sw )
+__osm_si_rcv_get_fwd_tbl(IN const osm_si_rcv_t * const p_rcv,
+			 IN osm_switch_t * const p_sw)
 {
-  osm_madw_context_t context;
-  osm_dr_path_t *p_dr_path;
-  osm_physp_t *p_physp;
-  osm_node_t *p_node;
-  uint32_t block_id_ho;
-  uint32_t max_block_id_ho;
-  ib_api_status_t status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_si_rcv_get_fwd_tbl );
-
-  CL_ASSERT( p_sw );
-
-  p_node = p_sw->p_node;
-
-  CL_ASSERT( osm_node_get_type( p_node ) == IB_NODE_TYPE_SWITCH );
-
-  p_physp = osm_node_get_any_physp_ptr( p_node );
-
-  CL_ASSERT( osm_physp_is_valid( p_physp ) );
-
-  context.lft_context.node_guid = osm_node_get_node_guid( p_node );
-  context.lft_context.set_method = FALSE;
-
-  max_block_id_ho = osm_switch_get_max_block_id_in_use( p_sw );
-
-  p_dr_path = osm_physp_get_dr_path_ptr( p_physp );
-
-  for( block_id_ho = 0; block_id_ho <= max_block_id_ho; block_id_ho++)
-  {
-    if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-               "__osm_si_rcv_get_fwd_tbl: "
-               "Retrieving FT block %u\n", block_id_ho );
-    }
-
-    status = osm_req_get(
-      p_rcv->p_req,
-      p_dr_path,
-      IB_MAD_ATTR_LIN_FWD_TBL,
-      cl_hton32( block_id_ho ),
-      CL_DISP_MSGID_NONE,
-      &context );
-    if( status != IB_SUCCESS )
-    {
-      /* continue the loop despite the error */
-      osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-               "__osm_si_rcv_get_fwd_tbl: ERR 3603: "
-               "Failure initiating PortInfo request (%s)\n",
-               ib_get_err_str(status));
-    }
-  }
-
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_madw_context_t context;
+	osm_dr_path_t *p_dr_path;
+	osm_physp_t *p_physp;
+	osm_node_t *p_node;
+	uint32_t block_id_ho;
+	uint32_t max_block_id_ho;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_si_rcv_get_fwd_tbl);
+
+	CL_ASSERT(p_sw);
+
+	p_node = p_sw->p_node;
+
+	CL_ASSERT(osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH);
+
+	p_physp = osm_node_get_any_physp_ptr(p_node);
+
+	CL_ASSERT(osm_physp_is_valid(p_physp));
+
+	context.lft_context.node_guid = osm_node_get_node_guid(p_node);
+	context.lft_context.set_method = FALSE;
+
+	max_block_id_ho = osm_switch_get_max_block_id_in_use(p_sw);
+
+	p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
+
+	for (block_id_ho = 0; block_id_ho <= max_block_id_ho; block_id_ho++) {
+		if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				"__osm_si_rcv_get_fwd_tbl: "
+				"Retrieving FT block %u\n", block_id_ho);
+		}
+
+		status = osm_req_get(p_rcv->p_req,
+				     p_dr_path,
+				     IB_MAD_ATTR_LIN_FWD_TBL,
+				     cl_hton32(block_id_ho),
+				     CL_DISP_MSGID_NONE, &context);
+		if (status != IB_SUCCESS) {
+			/* continue the loop despite the error */
+			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				"__osm_si_rcv_get_fwd_tbl: ERR 3603: "
+				"Failure initiating PortInfo request (%s)\n",
+				ib_get_err_str(status));
+		}
+	}
+
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_si_rcv_get_mcast_fwd_tbl(
-  IN const osm_si_rcv_t* const p_rcv,
-  IN osm_switch_t* const p_sw )
+__osm_si_rcv_get_mcast_fwd_tbl(IN const osm_si_rcv_t * const p_rcv,
+			       IN osm_switch_t * const p_sw)
 {
-  osm_madw_context_t context;
-  osm_dr_path_t *p_dr_path;
-  osm_physp_t *p_physp;
-  osm_node_t *p_node;
-  osm_mcast_tbl_t* p_tbl;
-  uint32_t block_id_ho;
-  uint32_t max_block_id_ho;
-  uint32_t position;
-  uint32_t max_position;
-  uint32_t attr_mod_ho;
-  ib_api_status_t status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_si_rcv_get_mcast_fwd_tbl );
-
-  CL_ASSERT( p_sw );
-
-  p_node = p_sw->p_node;
-
-  CL_ASSERT( osm_node_get_type( p_node ) == IB_NODE_TYPE_SWITCH );
-
-  if( osm_switch_get_mcast_fwd_tbl_size( p_sw ) == 0 )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "__osm_si_rcv_get_mcast_fwd_tbl: "
-             "Multicast not supported by switch 0x%016" PRIx64 "\n",
-             cl_ntoh64( osm_node_get_node_guid( p_node ) ) );
-    goto Exit;
-  }
-
-  p_physp = osm_node_get_any_physp_ptr( p_node );
-  p_tbl = osm_switch_get_mcast_tbl_ptr( p_sw );
-
-  CL_ASSERT( osm_physp_is_valid( p_physp ) );
-
-  context.mft_context.node_guid = osm_node_get_node_guid( p_node );
-  context.mft_context.set_method = FALSE;
-
-  max_block_id_ho = osm_mcast_tbl_get_max_block( p_tbl );
-
-  if( max_block_id_ho > IB_MCAST_MAX_BLOCK_ID )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_si_rcv_get_mcast_fwd_tbl: ERR 3609: "
-             "Out-of-range mcast block size = %u on switch 0x%016" PRIx64
-             "\n", max_block_id_ho,
-             cl_ntoh64( osm_node_get_node_guid( p_node ) ) );
-    goto Exit;
-  }
-
-  max_position = osm_mcast_tbl_get_max_position( p_tbl );
-
-  CL_ASSERT( max_position <= IB_MCAST_POSITION_MAX );
-
-  osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-           "__osm_si_rcv_get_mcast_fwd_tbl: "
-           "Max MFT block = %u, Max position = %u\n", max_block_id_ho,
-           max_position );
-
-  p_dr_path = osm_physp_get_dr_path_ptr( p_physp );
-
-  for( block_id_ho = 0; block_id_ho <= max_block_id_ho; block_id_ho++)
-  {
-    if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-               "__osm_si_rcv_get_mcast_fwd_tbl: "
-               "Retrieving MFT block %u\n", block_id_ho );
-    }
-
-    for( position = 0; position <= max_position; position++ )
-    {
-      if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-      {
-        osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-                 "__osm_si_rcv_get_mcast_fwd_tbl: "
-                 "Retrieving MFT position %u\n", position );
-      }
-
-      attr_mod_ho = block_id_ho | position << IB_MCAST_POSITION_SHIFT;
-      status = osm_req_get(
-        p_rcv->p_req,
-        p_dr_path,
-        IB_MAD_ATTR_MCAST_FWD_TBL,
-        cl_hton32( attr_mod_ho ),
-        CL_DISP_MSGID_NONE,
-        &context );
-      if( status != IB_SUCCESS )
-      {
-        /* continue the loop despite the error */
-        osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-                 "__osm_si_rcv_get_mcast_fwd_tbl: ERR 3607: "
-                 "Failure initiating PortInfo request (%s)\n",
-                 ib_get_err_str(status));
-      }
-    }
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_madw_context_t context;
+	osm_dr_path_t *p_dr_path;
+	osm_physp_t *p_physp;
+	osm_node_t *p_node;
+	osm_mcast_tbl_t *p_tbl;
+	uint32_t block_id_ho;
+	uint32_t max_block_id_ho;
+	uint32_t position;
+	uint32_t max_position;
+	uint32_t attr_mod_ho;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_si_rcv_get_mcast_fwd_tbl);
+
+	CL_ASSERT(p_sw);
+
+	p_node = p_sw->p_node;
+
+	CL_ASSERT(osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH);
+
+	if (osm_switch_get_mcast_fwd_tbl_size(p_sw) == 0) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"__osm_si_rcv_get_mcast_fwd_tbl: "
+			"Multicast not supported by switch 0x%016" PRIx64 "\n",
+			cl_ntoh64(osm_node_get_node_guid(p_node)));
+		goto Exit;
+	}
+
+	p_physp = osm_node_get_any_physp_ptr(p_node);
+	p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
+
+	CL_ASSERT(osm_physp_is_valid(p_physp));
+
+	context.mft_context.node_guid = osm_node_get_node_guid(p_node);
+	context.mft_context.set_method = FALSE;
+
+	max_block_id_ho = osm_mcast_tbl_get_max_block(p_tbl);
+
+	if (max_block_id_ho > IB_MCAST_MAX_BLOCK_ID) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_si_rcv_get_mcast_fwd_tbl: ERR 3609: "
+			"Out-of-range mcast block size = %u on switch 0x%016"
+			PRIx64 "\n", max_block_id_ho,
+			cl_ntoh64(osm_node_get_node_guid(p_node)));
+		goto Exit;
+	}
+
+	max_position = osm_mcast_tbl_get_max_position(p_tbl);
+
+	CL_ASSERT(max_position <= IB_MCAST_POSITION_MAX);
+
+	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		"__osm_si_rcv_get_mcast_fwd_tbl: "
+		"Max MFT block = %u, Max position = %u\n", max_block_id_ho,
+		max_position);
+
+	p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
+
+	for (block_id_ho = 0; block_id_ho <= max_block_id_ho; block_id_ho++) {
+		if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				"__osm_si_rcv_get_mcast_fwd_tbl: "
+				"Retrieving MFT block %u\n", block_id_ho);
+		}
+
+		for (position = 0; position <= max_position; position++) {
+			if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+				osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+					"__osm_si_rcv_get_mcast_fwd_tbl: "
+					"Retrieving MFT position %u\n",
+					position);
+			}
+
+			attr_mod_ho =
+			    block_id_ho | position << IB_MCAST_POSITION_SHIFT;
+			status =
+			    osm_req_get(p_rcv->p_req, p_dr_path,
+					IB_MAD_ATTR_MCAST_FWD_TBL,
+					cl_hton32(attr_mod_ho),
+					CL_DISP_MSGID_NONE, &context);
+			if (status != IB_SUCCESS) {
+				/* continue the loop despite the error */
+				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+					"__osm_si_rcv_get_mcast_fwd_tbl: ERR 3607: "
+					"Failure initiating PortInfo request (%s)\n",
+					ib_get_err_str(status));
+			}
+		}
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 #endif
 
@@ -313,112 +294,109 @@ __osm_si_rcv_get_mcast_fwd_tbl(
    Lock must be held on entry to this function.
 **********************************************************************/
 static void
-__osm_si_rcv_process_new(
-  IN const osm_si_rcv_t* const p_rcv,
-  IN osm_node_t* const p_node,
-  IN const osm_madw_t* const p_madw )
+__osm_si_rcv_process_new(IN const osm_si_rcv_t * const p_rcv,
+			 IN osm_node_t * const p_node,
+			 IN const osm_madw_t * const p_madw)
 {
-  osm_switch_t *p_sw;
-  osm_switch_t *p_check;
-  ib_switch_info_t *p_si;
-  ib_smp_t *p_smp;
-  cl_qmap_t *p_sw_guid_tbl;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_si_rcv_process_new );
-
-  CL_ASSERT( p_madw );
-
-  p_sw_guid_tbl = &p_rcv->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 );
-
-  osm_dump_switch_info( p_rcv->p_log, p_si, 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( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_si_rcv_process_new: ERR 3608: "
-             "Unable to allocate new switch object\n" );
-    goto Exit;
-  }
-
-  /* set subnet max mlid to the minimum MulticastFDBCap of all switches */
-  if ( p_sw->mcast_tbl.max_mlid_ho < p_rcv->p_subn->max_multicast_lid_ho )
-  {
-    p_rcv->p_subn->max_multicast_lid_ho = p_sw->mcast_tbl.max_mlid_ho;
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "__osm_si_rcv_process_new: "
-             "Subnet max multicast lid is 0x%X\n",
-             p_rcv->p_subn->max_multicast_lid_ho );
-  }
-
-  /* set subnet max unicast lid to the minimum LinearFDBCap of all switches */
-  if ( p_sw->fwd_tbl.p_lin_tbl->size < p_rcv->p_subn->max_unicast_lid_ho )
-  {
-    p_rcv->p_subn->max_unicast_lid_ho = p_sw->fwd_tbl.p_lin_tbl->size;
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "__osm_si_rcv_process_new: "
-             "Subnet max unicast lid is 0x%X\n",
-             p_rcv->p_subn->max_unicast_lid_ho );
-  }
-
-  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!
-    */
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "__osm_si_rcv_process_new: ERR 3605: "
-             "Unable to add new switch object to database\n" );
-    osm_switch_delete( &p_sw );
-    goto Exit;
-  }
-
-  p_node->sw = p_sw;
-
-  /*
-    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( p_rcv, p_sw, p_madw );
-
-  /*
-    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.
-
-    Gathering the multicast tables can also generate large amounts
-    of extra subnet-init traffic.
-
-    The code to retrieve the tables was fully debugged.
-  */
+	osm_switch_t *p_sw;
+	osm_switch_t *p_check;
+	ib_switch_info_t *p_si;
+	ib_smp_t *p_smp;
+	cl_qmap_t *p_sw_guid_tbl;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_si_rcv_process_new);
+
+	CL_ASSERT(p_madw);
+
+	p_sw_guid_tbl = &p_rcv->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);
+
+	osm_dump_switch_info(p_rcv->p_log, p_si, 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(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_si_rcv_process_new: ERR 3608: "
+			"Unable to allocate new switch object\n");
+		goto Exit;
+	}
+
+	/* set subnet max mlid to the minimum MulticastFDBCap of all switches */
+	if (p_sw->mcast_tbl.max_mlid_ho < p_rcv->p_subn->max_multicast_lid_ho) {
+		p_rcv->p_subn->max_multicast_lid_ho =
+		    p_sw->mcast_tbl.max_mlid_ho;
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"__osm_si_rcv_process_new: "
+			"Subnet max multicast lid is 0x%X\n",
+			p_rcv->p_subn->max_multicast_lid_ho);
+	}
+
+	/* set subnet max unicast lid to the minimum LinearFDBCap of all switches */
+	if (p_sw->fwd_tbl.p_lin_tbl->size < p_rcv->p_subn->max_unicast_lid_ho) {
+		p_rcv->p_subn->max_unicast_lid_ho =
+		    p_sw->fwd_tbl.p_lin_tbl->size;
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"__osm_si_rcv_process_new: "
+			"Subnet max unicast lid is 0x%X\n",
+			p_rcv->p_subn->max_unicast_lid_ho);
+	}
+
+	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!
+		 */
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"__osm_si_rcv_process_new: ERR 3605: "
+			"Unable to add new switch object to database\n");
+		osm_switch_delete(&p_sw);
+		goto Exit;
+	}
+
+	p_node->sw = p_sw;
+
+	/*
+	   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(p_rcv, p_sw, p_madw);
+
+	/*
+	   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.
+
+	   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( p_rcv, p_sw );
-  if( !p_rcv->p_subn->opt.disable_multicast )
-    __osm_si_rcv_get_mcast_fwd_tbl( p_rcv, p_sw );
+	__osm_si_rcv_get_fwd_tbl(p_rcv, p_sw);
+	if (!p_rcv->p_subn->opt.disable_multicast)
+		__osm_si_rcv_get_mcast_fwd_tbl(p_rcv, p_sw);
 #endif
 
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
@@ -427,255 +405,223 @@ __osm_si_rcv_process_new(
    this can not be done internally as the event needs the lock...
 **********************************************************************/
 static boolean_t
-__osm_si_rcv_process_existing(
-  IN const osm_si_rcv_t* const p_rcv,
-  IN osm_node_t* const p_node,
-  IN const osm_madw_t* const p_madw )
+__osm_si_rcv_process_existing(IN const osm_si_rcv_t * const p_rcv,
+			      IN osm_node_t * const p_node,
+			      IN const osm_madw_t * const p_madw)
 {
-  osm_switch_t *p_sw = p_node->sw;
-  ib_switch_info_t *p_si;
-  osm_si_context_t *p_si_context;
-  ib_smp_t         *p_smp;
-  boolean_t         is_change_detected = FALSE;
-
-  OSM_LOG_ENTER( p_rcv->p_log, __osm_si_rcv_process_existing );
-
-  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_context = osm_madw_get_si_context_ptr( p_madw );
-
-  if( p_si_context->set_method )
-  {
-    if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-               "__osm_si_rcv_process_existing: "
-               "Received logical SetResp()\n" );
-    }
-
-    osm_switch_set_switch_info( p_sw, p_si );
-  }
-  else
-  {
-    if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-               "__osm_si_rcv_process_existing: "
-               "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( p_rcv->p_log, OSM_LOG_VERBOSE,
-                 "__osm_si_rcv_process_existing: "
-                 "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( p_rcv->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_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-               "__osm_si_rcv_process_existing: "
-               "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( p_rcv, p_sw, p_madw );
-      else
-      {
-        osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-                 "__osm_si_rcv_process_existing: "
-                 "Not discovering again through switch:0x%"
-                 PRIx64 "\n",
-                 osm_node_get_node_guid( p_sw->p_node) );
-      }
-    }
-  }
-
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return is_change_detected;
+	osm_switch_t *p_sw = p_node->sw;
+	ib_switch_info_t *p_si;
+	osm_si_context_t *p_si_context;
+	ib_smp_t *p_smp;
+	boolean_t is_change_detected = FALSE;
+
+	OSM_LOG_ENTER(p_rcv->p_log, __osm_si_rcv_process_existing);
+
+	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_context = osm_madw_get_si_context_ptr(p_madw);
+
+	if (p_si_context->set_method) {
+		if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				"__osm_si_rcv_process_existing: "
+				"Received logical SetResp()\n");
+		}
+
+		osm_switch_set_switch_info(p_sw, p_si);
+	} else {
+		if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				"__osm_si_rcv_process_existing: "
+				"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(p_rcv->p_log, OSM_LOG_VERBOSE,
+					"__osm_si_rcv_process_existing: "
+					"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(p_rcv->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_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+				"__osm_si_rcv_process_existing: "
+				"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(p_rcv, p_sw, p_madw);
+			else {
+				osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+					"__osm_si_rcv_process_existing: "
+					"Not discovering again through switch:0x%"
+					PRIx64 "\n",
+					osm_node_get_node_guid(p_sw->p_node));
+			}
+		}
+	}
+
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return is_change_detected;
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_si_rcv_construct(
-  IN osm_si_rcv_t* const p_rcv )
+void osm_si_rcv_construct(IN osm_si_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
+	memset(p_rcv, 0, sizeof(*p_rcv));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_si_rcv_destroy(
-  IN osm_si_rcv_t* const p_rcv )
+void osm_si_rcv_destroy(IN osm_si_rcv_t * const p_rcv)
 {
-  CL_ASSERT( p_rcv );
+	CL_ASSERT(p_rcv);
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_si_rcv_destroy );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_si_rcv_destroy);
 
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_si_rcv_init(
-  IN osm_si_rcv_t* const p_rcv,
-  IN osm_subn_t* const p_subn,
-  IN osm_log_t* const p_log,
-  IN osm_req_t* const p_req,
-  IN osm_state_mgr_t* const p_state_mgr,
-  IN cl_plock_t* const p_lock )
+osm_si_rcv_init(IN osm_si_rcv_t * const p_rcv,
+		IN osm_subn_t * const p_subn,
+		IN osm_log_t * const p_log,
+		IN osm_req_t * const p_req,
+		IN osm_state_mgr_t * const p_state_mgr,
+		IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t status = IB_SUCCESS;
-  OSM_LOG_ENTER( p_log, osm_si_rcv_init );
+	ib_api_status_t status = IB_SUCCESS;
+	OSM_LOG_ENTER(p_log, osm_si_rcv_init);
 
-  osm_si_rcv_construct( p_rcv );
+	osm_si_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_req = p_req;
-  p_rcv->p_state_mgr = p_state_mgr;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_req = p_req;
+	p_rcv->p_state_mgr = p_state_mgr;
 
-  OSM_LOG_EXIT( p_rcv->p_log );
-  return( status );
+	OSM_LOG_EXIT(p_rcv->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_si_rcv_process(
-  IN void *context,
-  IN void *data )
+void osm_si_rcv_process(IN void *context, IN void *data)
 {
-  osm_si_rcv_t *p_rcv = context;
-  osm_madw_t *p_madw = data;
-  ib_switch_info_t *p_si;
-  ib_smp_t *p_smp;
-  osm_node_t *p_node;
-  ib_net64_t node_guid;
-  osm_si_context_t *p_context;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_si_rcv_process );
-
-  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_context = osm_madw_get_si_context_ptr( p_madw );
-
-  node_guid = p_context->node_guid;
-
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
-             "osm_si_rcv_process: "
-             "Switch GUID 0x%016" PRIx64
-             ", TID 0x%" PRIx64 "\n",
-             cl_ntoh64( node_guid ),
-             cl_ntoh64( p_smp->trans_id ) );
-  }
-
-  CL_PLOCK_EXCL_ACQUIRE( p_rcv->p_lock );
-
-  p_node = osm_get_node_by_guid( p_rcv->p_subn, node_guid );
-  if( !p_node )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_si_rcv_process: 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( p_rcv->p_log, OSM_LOG_ERROR,
-               "osm_si_rcv_process: ERR 3610: "
-               "\n\t\t\t\tBad LinearFDBTop value = 0x%X "
-               "on switch 0x%" PRIx64
-               "\n\t\t\t\tForcing 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 )
-    {
-      __osm_si_rcv_process_new( p_rcv, p_node, p_madw );
-      /*
-         A new switch was found during the sweep so we need
-         to ignore the current LFT settings.
-      */
-      p_rcv->p_subn->ignore_existing_lfts = TRUE;
-    }
-    else
-    {
-      /* we might get back a request for signaling change was detected */
-      if (__osm_si_rcv_process_existing( p_rcv, p_node, p_madw ))
-      {
-        CL_PLOCK_RELEASE( p_rcv->p_lock );
-        osm_state_mgr_process( p_rcv->p_state_mgr,
-                               OSM_SIGNAL_CHANGE_DETECTED );
-        goto Exit;
-      }
-    }
-  }
-
-  CL_PLOCK_RELEASE( p_rcv->p_lock );
- Exit:
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_si_rcv_t *p_rcv = context;
+	osm_madw_t *p_madw = data;
+	ib_switch_info_t *p_si;
+	ib_smp_t *p_smp;
+	osm_node_t *p_node;
+	ib_net64_t node_guid;
+	osm_si_context_t *p_context;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_si_rcv_process);
+
+	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_context = osm_madw_get_si_context_ptr(p_madw);
+
+	node_guid = p_context->node_guid;
+
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			"osm_si_rcv_process: "
+			"Switch GUID 0x%016" PRIx64
+			", TID 0x%" PRIx64 "\n",
+			cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));
+	}
+
+	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
+
+	p_node = osm_get_node_by_guid(p_rcv->p_subn, node_guid);
+	if (!p_node) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_si_rcv_process: 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(p_rcv->p_log, OSM_LOG_ERROR,
+				"osm_si_rcv_process: ERR 3610: "
+				"\n\t\t\t\tBad LinearFDBTop value = 0x%X "
+				"on switch 0x%" PRIx64
+				"\n\t\t\t\tForcing 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) {
+			__osm_si_rcv_process_new(p_rcv, p_node, p_madw);
+			/*
+			   A new switch was found during the sweep so we need
+			   to ignore the current LFT settings.
+			 */
+			p_rcv->p_subn->ignore_existing_lfts = TRUE;
+		} else {
+			/* we might get back a request for signaling change was detected */
+			if (__osm_si_rcv_process_existing
+			    (p_rcv, p_node, p_madw)) {
+				CL_PLOCK_RELEASE(p_rcv->p_lock);
+				osm_state_mgr_process(p_rcv->p_state_mgr,
+						      OSM_SIGNAL_CHANGE_DETECTED);
+				goto Exit;
+			}
+		}
+	}
+
+	CL_PLOCK_RELEASE(p_rcv->p_lock);
+      Exit:
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/osm_sweep_fail_ctrl.c b/opensm/opensm/osm_sweep_fail_ctrl.c
index 41e2fbf..1ddb4f2 100644
--- a/opensm/opensm/osm_sweep_fail_ctrl.c
+++ b/opensm/opensm/osm_sweep_fail_ctrl.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of osm_sweep_fail_ctrl_t.
@@ -46,7 +45,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <opensm/osm_sweep_fail_ctrl.h>
@@ -54,80 +53,68 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-__osm_sweep_fail_ctrl_disp_callback(
-  IN  void *context,
-  IN  void *p_data )
+void __osm_sweep_fail_ctrl_disp_callback(IN void *context, IN void *p_data)
 {
-  osm_sweep_fail_ctrl_t* const p_ctrl = (osm_sweep_fail_ctrl_t*)context;
+	osm_sweep_fail_ctrl_t *const p_ctrl = (osm_sweep_fail_ctrl_t *) context;
 
-  OSM_LOG_ENTER( p_ctrl->p_log, __osm_sweep_fail_ctrl_disp_callback );
+	OSM_LOG_ENTER(p_ctrl->p_log, __osm_sweep_fail_ctrl_disp_callback);
 
-  UNUSED_PARAM( p_data );
-  /*
-    Notify the state manager that we had a light sweep failure.
-  */
-  osm_state_mgr_process( p_ctrl->p_state_mgr,
-                         OSM_SIGNAL_LIGHT_SWEEP_FAIL );
+	UNUSED_PARAM(p_data);
+	/*
+	   Notify the state manager that we had a light sweep failure.
+	 */
+	osm_state_mgr_process(p_ctrl->p_state_mgr, OSM_SIGNAL_LIGHT_SWEEP_FAIL);
 
-  OSM_LOG_EXIT( p_ctrl->p_log );
+	OSM_LOG_EXIT(p_ctrl->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sweep_fail_ctrl_construct(
-  IN osm_sweep_fail_ctrl_t* const p_ctrl )
+void osm_sweep_fail_ctrl_construct(IN osm_sweep_fail_ctrl_t * const p_ctrl)
 {
-  memset( p_ctrl, 0, sizeof(*p_ctrl) );
-  p_ctrl->h_disp = CL_DISP_INVALID_HANDLE;
+	memset(p_ctrl, 0, sizeof(*p_ctrl));
+	p_ctrl->h_disp = CL_DISP_INVALID_HANDLE;
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_sweep_fail_ctrl_destroy(
-  IN osm_sweep_fail_ctrl_t* const p_ctrl )
+void osm_sweep_fail_ctrl_destroy(IN osm_sweep_fail_ctrl_t * const p_ctrl)
 {
-  CL_ASSERT( p_ctrl );
-  cl_disp_unregister( p_ctrl->h_disp );
+	CL_ASSERT(p_ctrl);
+	cl_disp_unregister(p_ctrl->h_disp);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_sweep_fail_ctrl_init(
-  IN osm_sweep_fail_ctrl_t* const p_ctrl,
-  IN osm_log_t* const p_log,
-  IN osm_state_mgr_t* const p_state_mgr,
-  IN cl_dispatcher_t* const p_disp )
+osm_sweep_fail_ctrl_init(IN osm_sweep_fail_ctrl_t * const p_ctrl,
+			 IN osm_log_t * const p_log,
+			 IN osm_state_mgr_t * const p_state_mgr,
+			 IN cl_dispatcher_t * const p_disp)
 {
-  ib_api_status_t status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( p_log, osm_sweep_fail_ctrl_init );
-
-  osm_sweep_fail_ctrl_construct( p_ctrl );
-  p_ctrl->p_log = p_log;
-  p_ctrl->p_disp = p_disp;
-  p_ctrl->p_state_mgr = p_state_mgr;
-
-  p_ctrl->h_disp = cl_disp_register(
-    p_disp,
-    OSM_MSG_LIGHT_SWEEP_FAIL,
-    __osm_sweep_fail_ctrl_disp_callback,
-    p_ctrl );
-
-  if( p_ctrl->h_disp == CL_DISP_INVALID_HANDLE )
-  {
-    osm_log( p_log, OSM_LOG_ERROR,
-             "osm_sweep_fail_ctrl_init: ERR 3501: "
-             "Dispatcher registration failed\n" );
-    status = IB_INSUFFICIENT_RESOURCES;
-    goto Exit;
-  }
-
- Exit:
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(p_log, osm_sweep_fail_ctrl_init);
+
+	osm_sweep_fail_ctrl_construct(p_ctrl);
+	p_ctrl->p_log = p_log;
+	p_ctrl->p_disp = p_disp;
+	p_ctrl->p_state_mgr = p_state_mgr;
+
+	p_ctrl->h_disp = cl_disp_register(p_disp,
+					  OSM_MSG_LIGHT_SWEEP_FAIL,
+					  __osm_sweep_fail_ctrl_disp_callback,
+					  p_ctrl);
+
+	if (p_ctrl->h_disp == CL_DISP_INVALID_HANDLE) {
+		osm_log(p_log, OSM_LOG_ERROR,
+			"osm_sweep_fail_ctrl_init: ERR 3501: "
+			"Dispatcher registration failed\n");
+		status = IB_INSUFFICIENT_RESOURCES;
+		goto Exit;
+	}
+
+      Exit:
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
-
diff --git a/opensm/opensm/osm_ucast_file.c b/opensm/opensm/osm_ucast_file.c
index 97be7ea..9928831 100644
--- a/opensm/opensm/osm_ucast_file.c
+++ b/opensm/opensm/osm_ucast_file.c
@@ -56,8 +56,7 @@
 #include <opensm/osm_switch.h>
 #include <opensm/osm_log.h>
 
-
-static uint16_t remap_lid(osm_opensm_t *p_osm, uint16_t lid, ib_net64_t guid)
+static uint16_t remap_lid(osm_opensm_t * p_osm, uint16_t lid, ib_net64_t guid)
 {
 	osm_port_t *p_port;
 	uint16_t min_lid, max_lid;
@@ -108,7 +107,7 @@ static void add_path(osm_opensm_t * p_osm,
 		cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)));
 }
 
-static void add_lid_hops(osm_opensm_t *p_osm, osm_switch_t *p_sw,
+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)
 {
@@ -119,7 +118,7 @@ static void add_lid_hops(osm_opensm_t *p_osm, osm_switch_t *p_sw,
 	if (len > p_sw->num_ports)
 		len = p_sw->num_ports;
 
-	for (i = 0 ; i < len ; i++)
+	for (i = 0; i < len; i++)
 		osm_switch_set_hops(p_sw, lid, i, hops[i]);
 }
 
@@ -137,7 +136,7 @@ static int do_ucast_file_load(void *context)
 
 	file_name = p_osm->subn.opt.ucast_dump_file;
 	if (!file_name) {
-		osm_log(&p_osm->log, OSM_LOG_ERROR|OSM_LOG_SYS,
+		osm_log(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS,
 			"do_ucast_file_load: ERR 6301: "
 			"ucast dump file name is not defined; "
 			"using default routing algorithm\n");
@@ -146,7 +145,7 @@ 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,
+		osm_log(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS,
 			"do_ucast_file_load: ERR 6302: "
 			"cannot open ucast dump file \'%s\'; "
 			"using default routing algorithm\n", file_name);
@@ -168,14 +167,15 @@ static int do_ucast_file_load(void *context)
 			continue;
 
 		if (!strncmp(p, "Multicast mlids", 15)) {
-			osm_log(&p_osm->log, OSM_LOG_ERROR|OSM_LOG_SYS,
+			osm_log(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS,
 				"do_ucast_file_load: ERR 6303: "
 				"Multicast dump file detected; "
 				"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);
+				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,
@@ -203,10 +203,11 @@ static int do_ucast_file_load(void *context)
 					cl_ntoh64(sw_guid));
 				continue;
 			}
-			memset(p_osm->sm.ucast_mgr.lft_buf, 0xff, IB_LID_UCAST_END_HO + 1);
+			memset(p_osm->sm.ucast_mgr.lft_buf, 0xff,
+			       IB_LID_UCAST_END_HO + 1);
 		} else if (p_sw && !strncmp(p, "0x", 2)) {
 			p += 2;
-			lid = (uint16_t)strtoul(p, &q, 16);
+			lid = (uint16_t) strtoul(p, &q, 16);
 			if (q == p || !isspace(*q)) {
 				osm_log(&p_osm->log, OSM_LOG_ERROR,
 					"PARSE ERROR: %s:%u: "
@@ -217,7 +218,7 @@ static int do_ucast_file_load(void *context)
 			p = q;
 			while (isspace(*p))
 				p++;
-			port_num = (uint8_t)strtoul(p, &q, 10);
+			port_num = (uint8_t) strtoul(p, &q, 10);
 			if (q == p || !isspace(*q)) {
 				osm_log(&p_osm->log, OSM_LOG_ERROR,
 					"PARSE ERROR: %s:%u: "
@@ -235,8 +236,7 @@ static int do_ucast_file_load(void *context)
 					"(maybe broken dump): \'%s\'\n",
 					file_name, lineno, p);
 				port_guid = 0;
-			}
-			else {
+			} else {
 				p = q + 12;
 				port_guid = strtoull(p, &q, 16);
 				if (q == p || (!isspace(*q) && *q != ':')) {
@@ -274,7 +274,7 @@ static int do_lid_matrix_file_load(void *context)
 
 	file_name = p_osm->subn.opt.lid_matrix_dump_file;
 	if (!file_name) {
-		osm_log(&p_osm->log, OSM_LOG_ERROR|OSM_LOG_SYS,
+		osm_log(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS,
 			"do_lid_matrix_file_load: ERR 6304: "
 			"lid matrix file name is not defined; "
 			"using default lid matrix generation algorithm\n");
@@ -283,7 +283,7 @@ 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,
+		osm_log(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS,
 			"do_lid_matrix_file_load: ERR 6305: "
 			"cannot open lid matrix file \'%s\'; "
 			"using default lid matrix generation algorithm\n",
@@ -350,7 +350,7 @@ static int do_lid_matrix_file_load(void *context)
 				return -1;
 			}
 			/* Just checked the range, so casting is safe */
-			lid = (uint16_t)num;
+			lid = (uint16_t) num;
 			p = q;
 			while (isspace(*p) || *p == ':')
 				p++;
@@ -358,13 +358,13 @@ static int do_lid_matrix_file_load(void *context)
 				num = strtoul(p, &q, 16);
 				if (num > 0xff || q == p) {
 					osm_log(&p_osm->log, OSM_LOG_ERROR,
-					"PARSE ERROR: %s:%u: "
-					"cannot parse hops number: \'%s\'\n",
-					file_name, lineno, p);
+						"PARSE ERROR: %s:%u: "
+						"cannot parse hops number: \'%s\'\n",
+						file_name, lineno, p);
 					return -1;
 				}
 				/* Just checked the range, so casting is safe */
-				hops[len++] = (uint8_t)num;
+				hops[len++] = (uint8_t) num;
 				p = q;
 				while (isspace(*p))
 					p++;
@@ -378,8 +378,7 @@ static int do_lid_matrix_file_load(void *context)
 					"(maybe broken dump): \'%s\'\n",
 					file_name, lineno, p);
 				guid = 0;
-			}
-			else {
+			} else {
 				p = q + 12;
 				guid = strtoull(p, &q, 16);
 				if (q == p || !isspace(*q)) {
diff --git a/opensm/opensm/osm_ucast_mgr.c b/opensm/opensm/osm_ucast_mgr.c
index b90509a..2a5fe88 100644
--- a/opensm/opensm/osm_ucast_mgr.c
+++ b/opensm/opensm/osm_ucast_mgr.c
@@ -46,7 +46,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -64,799 +64,761 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_ucast_mgr_construct(
-  IN osm_ucast_mgr_t* const p_mgr )
+void osm_ucast_mgr_construct(IN osm_ucast_mgr_t * const p_mgr)
 {
-  memset( p_mgr, 0, sizeof(*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 * const p_mgr)
 {
-  CL_ASSERT( p_mgr );
+	CL_ASSERT(p_mgr);
 
-  OSM_LOG_ENTER( p_mgr->p_log, osm_ucast_mgr_destroy );
+	OSM_LOG_ENTER(p_mgr->p_log, osm_ucast_mgr_destroy);
 
-  if (p_mgr->lft_buf)
-    free(p_mgr->lft_buf);
+	if (p_mgr->lft_buf)
+		free(p_mgr->lft_buf);
 
-  OSM_LOG_EXIT( p_mgr->p_log );
+	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_req_t* const p_req,
-  IN osm_subn_t* const p_subn,
-  IN osm_log_t* const p_log,
-  IN cl_plock_t* const p_lock )
+osm_ucast_mgr_init(IN osm_ucast_mgr_t * const p_mgr,
+		   IN osm_req_t * const p_req,
+		   IN osm_subn_t * const p_subn,
+		   IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_ucast_mgr_init );
+	OSM_LOG_ENTER(p_log, osm_ucast_mgr_init);
 
-  CL_ASSERT( p_req );
-  CL_ASSERT( p_subn );
-  CL_ASSERT( p_lock );
+	CL_ASSERT(p_req);
+	CL_ASSERT(p_subn);
+	CL_ASSERT(p_lock);
 
-  osm_ucast_mgr_construct( p_mgr );
+	osm_ucast_mgr_construct(p_mgr);
 
-  p_mgr->p_log = p_log;
-  p_mgr->p_subn = p_subn;
-  p_mgr->p_lock = p_lock;
-  p_mgr->p_req = p_req;
+	p_mgr->p_log = p_log;
+	p_mgr->p_subn = p_subn;
+	p_mgr->p_lock = p_lock;
+	p_mgr->p_req = p_req;
 
-  p_mgr->lft_buf = malloc(IB_LID_UCAST_END_HO + 1);
-  if (!p_mgr->lft_buf)
-    return IB_INSUFFICIENT_MEMORY;
+	p_mgr->lft_buf = malloc(IB_LID_UCAST_END_HO + 1);
+	if (!p_mgr->lft_buf)
+		return IB_INSUFFICIENT_MEMORY;
 
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return( status );
+	OSM_LOG_EXIT(p_mgr->p_log);
+	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 )
+__osm_ucast_mgr_process_hop_0_1(IN cl_map_item_t * const p_map_item,
+				IN void *context)
 {
-  osm_switch_t* const p_sw = (osm_switch_t*)p_map_item;
-  osm_node_t *p_remote_node;
-  uint16_t lid, remote_lid;
-  uint8_t i, remote_port;
-
-  lid = osm_node_get_base_lid(p_sw->p_node, 0);
-  lid = cl_ntoh16(lid);
-  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 );
-
-    if( p_remote_node && p_remote_node->sw &&
-        (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_t *const p_sw = (osm_switch_t *) p_map_item;
+	osm_node_t *p_remote_node;
+	uint16_t lid, remote_lid;
+	uint8_t i, remote_port;
+
+	lid = osm_node_get_base_lid(p_sw->p_node, 0);
+	lid = cl_ntoh16(lid);
+	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);
+
+		if (p_remote_node && p_remote_node->sw &&
+		    (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);
+		}
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
 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_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;
-  uint16_t lid_ho;
-  uint8_t hops;
-
-  OSM_LOG_ENTER( p_mgr->p_log, __osm_ucast_mgr_process_neighbor );
-
-  if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-             "__osm_ucast_mgr_process_neighbor: "
-             "Node 0x%" PRIx64 ", remote node 0x%" PRIx64
-             ", port 0x%X, remote port 0x%X\n",
-             cl_ntoh64( osm_node_get_node_guid( p_this_sw->p_node ) ),
-             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);
-    hops = osm_switch_get_least_hops(p_remote_sw, lid_ho);
-    if (hops == OSM_NO_PATH)
-      continue;
-    hops++;
-    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_ucast_mgr_process_neighbor: "
-                 "cannot set hops for lid %u at switch 0x%" PRIx64 "\n",
-                 lid_ho,
-                 cl_ntoh64(osm_node_get_node_guid(p_this_sw->p_node)));
-      p_mgr->some_hop_count_set = TRUE;
-    }
-  }
-
-  OSM_LOG_EXIT( p_mgr->p_log );
+	osm_switch_t *p_sw, *p_next_sw;
+	uint16_t lid_ho;
+	uint8_t hops;
+
+	OSM_LOG_ENTER(p_mgr->p_log, __osm_ucast_mgr_process_neighbor);
+
+	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+			"__osm_ucast_mgr_process_neighbor: "
+			"Node 0x%" PRIx64 ", remote node 0x%" PRIx64
+			", port 0x%X, remote port 0x%X\n",
+			cl_ntoh64(osm_node_get_node_guid(p_this_sw->p_node)),
+			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);
+		hops = osm_switch_get_least_hops(p_remote_sw, lid_ho);
+		if (hops == OSM_NO_PATH)
+			continue;
+		hops++;
+		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_ucast_mgr_process_neighbor: "
+					"cannot set hops for lid %u at switch 0x%"
+					PRIx64 "\n", lid_ho,
+					cl_ntoh64(osm_node_get_node_guid
+						  (p_this_sw->p_node)));
+			p_mgr->some_hop_count_set = TRUE;
+		}
+	}
+
+	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 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 )
+__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)
 {
-  uint16_t min_lid_ho;
-  uint16_t max_lid_ho;
-  uint16_t lid_ho;
-  uint8_t port;
-  boolean_t is_ignored_by_port_prof;
-  ib_net64_t node_guid;
-  /*
-    The following are temporary structures that will aid
-    in providing better routing in LMC > 0 situations
-  */
-  uint16_t lids_per_port = 1 << p_mgr->p_subn->opt.lmc;
-  uint64_t *remote_sys_guids = NULL;
-  uint64_t *remote_node_guids = NULL;
-  uint16_t num_used_sys = 0;
-  uint16_t num_used_nodes = 0;
-
-  OSM_LOG_ENTER( p_mgr->p_log, __osm_ucast_mgr_process_port );
-
-  if (lids_per_port > 1)
-  {
-    remote_sys_guids = malloc( sizeof(uint64_t) * lids_per_port );
-    if( remote_sys_guids == NULL )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-               "__osm_ucast_mgr_process_port: ERR 3A09: "
-               "Cannot allocate array. Insufficient memory\n");
-      goto Exit;
-    }
-
-    memset( remote_sys_guids, 0, sizeof(uint64_t) * lids_per_port );
-
-    remote_node_guids = malloc( sizeof(uint64_t) * lids_per_port );
-    if( remote_node_guids == NULL )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-               "__osm_ucast_mgr_process_port: ERR 3A0A: "
-               "Cannot allocate array. Insufficient memory\n");
-      goto Exit;
-    }
-
-    memset( remote_node_guids, 0, sizeof(uint64_t) * lids_per_port );
-  }
-
-  osm_port_get_lid_range_ho( p_port, &min_lid_ho, &max_lid_ho );
-
-  /* If the lids are zero - then there was some problem with 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,
-             "__osm_ucast_mgr_process_port: ERR 3A04: "
-             "Port 0x%" PRIx64 " has LID 0. An initialization "
-             "error occurred. Ignoring port\n",
-             cl_ntoh64( osm_port_get_guid( p_port ) ) );
-    goto Exit;
-  }
-
-  if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-             "__osm_ucast_mgr_process_port: "
-             "Processing port 0x%" PRIx64
-             ", LIDs [0x%X,0x%X]\n",
-             cl_ntoh64( osm_port_get_guid( p_port ) ),
-             min_lid_ho, max_lid_ho );
-  }
-
-  /*
-    TO DO - This should be runtime error, not a CL_ASSERT()
-  */
-  CL_ASSERT( max_lid_ho < osm_switch_get_fwd_tbl_size( p_sw ) );
-
-  node_guid = osm_node_get_node_guid( p_sw->p_node );
-
-  /*
-    The lid matrix contains the number of hops to each
-    lid from each port.  From this information we determine
-    how best to distribute the LID range across the ports
-    that can reach those LIDs.
-  */
-  for( lid_ho = min_lid_ho; lid_ho <= max_lid_ho; lid_ho++ )
-  {
-    /* Use the enhanced algorithm only for LMC > 0 */
-    if (lids_per_port > 1)
-      port = osm_switch_recommend_path( p_sw, p_port, lid_ho,
-                                        p_mgr->p_subn->ignore_existing_lfts,
-                                        remote_sys_guids, &num_used_sys,
-                                        remote_node_guids, &num_used_nodes );
-    else
-      port = osm_switch_recommend_path( p_sw, p_port, lid_ho,
-                                        p_mgr->p_subn->ignore_existing_lfts,
-                                        NULL, NULL, NULL, NULL );
-
-    /*
-      There might be no path to the target
-    */
-    if (port == OSM_NO_PATH)
-    {
-      /* do not try to overwrite the ppro of non existing port ... */
-      is_ignored_by_port_prof = TRUE;
-
-      /* Up/Down routing can cause unreachable routes between some
-         switches so we do not report that as an error in that case */
-      if (!p_mgr->p_subn->p_osm->routing_engine.build_lid_matrices)
-      {
-        osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-                 "__osm_ucast_mgr_process_port: ERR 3A08: "
-                 "No path to get to LID 0x%X from switch 0x%" PRIx64 "\n",
-                 lid_ho, cl_ntoh64( node_guid ) );
-        /* trigger a new sweep - try again ... */
-        p_mgr->p_subn->subnet_initialization_error = TRUE;
-      }
-      else
-        osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-                 "__osm_ucast_mgr_process_port: "
-                 "No path to get to LID 0x%X from switch 0x%" PRIx64 "\n",
-                 lid_ho, cl_ntoh64( node_guid ) );
-    }
-    else
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-	       "__osm_ucast_mgr_process_port: "
-	       "Routing LID 0x%X to port 0x%X"
-	       " for switch 0x%" PRIx64 "\n",
-	       lid_ho, port, cl_ntoh64( node_guid ) );
-
-      /*
-	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 =
-	osm_port_prof_is_ignored_port(p_mgr->p_subn, node_guid, port);
-
-      /*
-	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);
-      }
-    }
-
-    /*
-      We have selected the port for this LID.
-      Write it to the forwarding tables.
-    */
-    p_mgr->lft_buf[lid_ho] = port;
-    if (!is_ignored_by_port_prof)
-      osm_switch_count_path(p_sw, port);
-  }
-
- Exit:
-  if (remote_sys_guids)
-    free(remote_sys_guids);
-  if (remote_node_guids)
-    free(remote_node_guids);
-  OSM_LOG_EXIT( p_mgr->p_log );
+	uint16_t min_lid_ho;
+	uint16_t max_lid_ho;
+	uint16_t lid_ho;
+	uint8_t port;
+	boolean_t is_ignored_by_port_prof;
+	ib_net64_t node_guid;
+	/*
+	   The following are temporary structures that will aid
+	   in providing better routing in LMC > 0 situations
+	 */
+	uint16_t lids_per_port = 1 << p_mgr->p_subn->opt.lmc;
+	uint64_t *remote_sys_guids = NULL;
+	uint64_t *remote_node_guids = NULL;
+	uint16_t num_used_sys = 0;
+	uint16_t num_used_nodes = 0;
+
+	OSM_LOG_ENTER(p_mgr->p_log, __osm_ucast_mgr_process_port);
+
+	if (lids_per_port > 1) {
+		remote_sys_guids = malloc(sizeof(uint64_t) * lids_per_port);
+		if (remote_sys_guids == NULL) {
+			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+				"__osm_ucast_mgr_process_port: ERR 3A09: "
+				"Cannot allocate array. Insufficient memory\n");
+			goto Exit;
+		}
+
+		memset(remote_sys_guids, 0, sizeof(uint64_t) * lids_per_port);
+
+		remote_node_guids = malloc(sizeof(uint64_t) * lids_per_port);
+		if (remote_node_guids == NULL) {
+			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+				"__osm_ucast_mgr_process_port: ERR 3A0A: "
+				"Cannot allocate array. Insufficient memory\n");
+			goto Exit;
+		}
+
+		memset(remote_node_guids, 0, sizeof(uint64_t) * lids_per_port);
+	}
+
+	osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);
+
+	/* If the lids are zero - then there was some problem with 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,
+			"__osm_ucast_mgr_process_port: ERR 3A04: "
+			"Port 0x%" PRIx64 " has LID 0. An initialization "
+			"error occurred. Ignoring port\n",
+			cl_ntoh64(osm_port_get_guid(p_port)));
+		goto Exit;
+	}
+
+	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+			"__osm_ucast_mgr_process_port: "
+			"Processing port 0x%" PRIx64
+			", LIDs [0x%X,0x%X]\n",
+			cl_ntoh64(osm_port_get_guid(p_port)),
+			min_lid_ho, max_lid_ho);
+	}
+
+	/*
+	   TO DO - This should be runtime error, not a CL_ASSERT()
+	 */
+	CL_ASSERT(max_lid_ho < osm_switch_get_fwd_tbl_size(p_sw));
+
+	node_guid = osm_node_get_node_guid(p_sw->p_node);
+
+	/*
+	   The lid matrix contains the number of hops to each
+	   lid from each port.  From this information we determine
+	   how best to distribute the LID range across the ports
+	   that can reach those LIDs.
+	 */
+	for (lid_ho = min_lid_ho; lid_ho <= max_lid_ho; lid_ho++) {
+		/* Use the enhanced algorithm only for LMC > 0 */
+		if (lids_per_port > 1)
+			port = osm_switch_recommend_path(p_sw, p_port, lid_ho,
+							 p_mgr->p_subn->
+							 ignore_existing_lfts,
+							 remote_sys_guids,
+							 &num_used_sys,
+							 remote_node_guids,
+							 &num_used_nodes);
+		else
+			port = osm_switch_recommend_path(p_sw, p_port, lid_ho,
+							 p_mgr->p_subn->
+							 ignore_existing_lfts,
+							 NULL, NULL, NULL,
+							 NULL);
+
+		/*
+		   There might be no path to the target
+		 */
+		if (port == OSM_NO_PATH) {
+			/* do not try to overwrite the ppro of non existing port ... */
+			is_ignored_by_port_prof = TRUE;
+
+			/* Up/Down routing can cause unreachable routes between some
+			   switches so we do not report that as an error in that case */
+			if (!p_mgr->p_subn->p_osm->routing_engine.
+			    build_lid_matrices) {
+				osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+					"__osm_ucast_mgr_process_port: ERR 3A08: "
+					"No path to get to LID 0x%X from switch 0x%"
+					PRIx64 "\n", lid_ho,
+					cl_ntoh64(node_guid));
+				/* trigger a new sweep - try again ... */
+				p_mgr->p_subn->subnet_initialization_error =
+				    TRUE;
+			} else
+				osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+					"__osm_ucast_mgr_process_port: "
+					"No path to get to LID 0x%X from switch 0x%"
+					PRIx64 "\n", lid_ho,
+					cl_ntoh64(node_guid));
+		} else {
+			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				"__osm_ucast_mgr_process_port: "
+				"Routing LID 0x%X to port 0x%X"
+				" for switch 0x%" PRIx64 "\n",
+				lid_ho, port, cl_ntoh64(node_guid));
+
+			/*
+			   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 =
+			    osm_port_prof_is_ignored_port(p_mgr->p_subn,
+							  node_guid, port);
+
+			/*
+			   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);
+			}
+		}
+
+		/*
+		   We have selected the port for this LID.
+		   Write it to the forwarding tables.
+		 */
+		p_mgr->lft_buf[lid_ho] = port;
+		if (!is_ignored_by_port_prof)
+			osm_switch_count_path(p_sw, port);
+	}
+
+      Exit:
+	if (remote_sys_guids)
+		free(remote_sys_guids);
+	if (remote_node_guids)
+		free(remote_node_guids);
+	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void
-osm_ucast_mgr_set_fwd_table(
-  IN osm_ucast_mgr_t* const p_mgr,
-  IN osm_switch_t* const p_sw )
+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;
-  uint32_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, osm_ucast_mgr_set_fwd_table );
-
-  CL_ASSERT( p_sw );
-
-  p_node = p_sw->p_node;
-
-  CL_ASSERT( p_node );
-
-  p_path = osm_node_get_any_dr_path_ptr( p_node );
-
-  CL_ASSERT( p_path );
-
-  /*
-    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 )
-  {
-    if ( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-               "osm_ucast_mgr_set_fwd_table: "
-               "Setting switch FT top to LID 0x%X\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->p_req,
-                          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,
-               "osm_ucast_mgr_set_fwd_table: ERR 3A06: "
-               "Sending SwitchInfo attribute failed (%s)\n",
-               ib_get_err_str( status ) );
-    }
-    else
-      p_mgr->any_change = TRUE;
-  }
-
-  /*
-    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;
-
-  for (block_id_ho = 0;
-       osm_switch_get_fwd_tbl_block( p_sw, block_id_ho, block ) ;
-       block_id_ho++ )
-  {
-    if (!p_sw->need_update &&
-        !memcmp(block, p_mgr->lft_buf + block_id_ho * 64, 64))
-      continue;
-
-    if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-               "osm_ucast_mgr_set_fwd_table: "
-               "Writing FT block %u\n", block_id_ho );
-    }
-
-    status = osm_req_set( p_mgr->p_req,
-                          p_path,
-                          p_mgr->lft_buf + block_id_ho * 64,
-                          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,
-               "osm_ucast_mgr_set_fwd_table: ERR 3A05: "
-               "Sending linear fwd. tbl. block failed (%s)\n",
-               ib_get_err_str( status ) );
-    }
-    else
-    {
-      p_mgr->any_change = TRUE;
-    }
-  }
-
-  OSM_LOG_EXIT( p_mgr->p_log );
+	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;
+	uint32_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, osm_ucast_mgr_set_fwd_table);
+
+	CL_ASSERT(p_sw);
+
+	p_node = p_sw->p_node;
+
+	CL_ASSERT(p_node);
+
+	p_path = osm_node_get_any_dr_path_ptr(p_node);
+
+	CL_ASSERT(p_path);
+
+	/*
+	   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) {
+		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				"osm_ucast_mgr_set_fwd_table: "
+				"Setting switch FT top to LID 0x%X\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->p_req,
+				     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,
+				"osm_ucast_mgr_set_fwd_table: ERR 3A06: "
+				"Sending SwitchInfo attribute failed (%s)\n",
+				ib_get_err_str(status));
+		} else
+			p_mgr->any_change = TRUE;
+	}
+
+	/*
+	   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;
+
+	for (block_id_ho = 0;
+	     osm_switch_get_fwd_tbl_block(p_sw, block_id_ho, block);
+	     block_id_ho++) {
+		if (!p_sw->need_update &&
+		    !memcmp(block, p_mgr->lft_buf + block_id_ho * 64, 64))
+			continue;
+
+		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				"osm_ucast_mgr_set_fwd_table: "
+				"Writing FT block %u\n", block_id_ho);
+		}
+
+		status = osm_req_set(p_mgr->p_req,
+				     p_path,
+				     p_mgr->lft_buf + block_id_ho * 64,
+				     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,
+				"osm_ucast_mgr_set_fwd_table: ERR 3A05: "
+				"Sending linear fwd. tbl. block failed (%s)\n",
+				ib_get_err_str(status));
+		} else {
+			p_mgr->any_change = TRUE;
+		}
+	}
+
+	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_ucast_mgr_process_tbl(
-  IN cl_map_item_t* const  p_map_item,
-  IN void* context )
+__osm_ucast_mgr_process_tbl(IN cl_map_item_t * const 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_node_t *p_node;
-  osm_port_t *p_port;
-  const cl_qmap_t* p_port_tbl;
+	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_node_t *p_node;
+	osm_port_t *p_port;
+	const cl_qmap_t *p_port_tbl;
 
-  OSM_LOG_ENTER( p_mgr->p_log, __osm_ucast_mgr_process_tbl );
+	OSM_LOG_ENTER(p_mgr->p_log, __osm_ucast_mgr_process_tbl);
 
-  p_node = p_sw->p_node;
+	p_node = p_sw->p_node;
 
-  CL_ASSERT( p_node );
-  CL_ASSERT( osm_node_get_type( p_node ) == IB_NODE_TYPE_SWITCH );
+	CL_ASSERT(p_node);
+	CL_ASSERT(osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH);
 
-  if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-             "__osm_ucast_mgr_process_tbl: "
-             "Processing switch 0x%" PRIx64 "\n",
-             cl_ntoh64( osm_node_get_node_guid( p_node ) ));
-  }
+	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+			"__osm_ucast_mgr_process_tbl: "
+			"Processing switch 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_node_get_node_guid(p_node)));
+	}
 
-  /* Initialize LIDs in buffer to invalid port number. */
-  memset(p_mgr->lft_buf, 0xff, IB_LID_UCAST_END_HO + 1);
+	/* Initialize LIDs in buffer to invalid port number. */
+	memset(p_mgr->lft_buf, 0xff, IB_LID_UCAST_END_HO + 1);
 
-  p_port_tbl = &p_mgr->p_subn->port_guid_tbl;
+	p_port_tbl = &p_mgr->p_subn->port_guid_tbl;
 
-  /*
-    Iterate through every port setting LID routes for each
-    port based on base LID and LMC value.
-  */
+	/*
+	   Iterate through every port setting LID routes for each
+	   port based on base LID and LMC value.
+	 */
 
-  for( p_port = (osm_port_t*)cl_qmap_head( p_port_tbl );
-       p_port != (osm_port_t*)cl_qmap_end( p_port_tbl );
-       p_port = (osm_port_t*)cl_qmap_next( &p_port->map_item ) )
-  {
-    __osm_ucast_mgr_process_port( p_mgr, p_sw, p_port );
-  }
+	for (p_port = (osm_port_t *) cl_qmap_head(p_port_tbl);
+	     p_port != (osm_port_t *) cl_qmap_end(p_port_tbl);
+	     p_port = (osm_port_t *) cl_qmap_next(&p_port->map_item)) {
+		__osm_ucast_mgr_process_port(p_mgr, p_sw, p_port);
+	}
 
-  osm_ucast_mgr_set_fwd_table( p_mgr, p_sw );
+	osm_ucast_mgr_set_fwd_table(p_mgr, p_sw);
 
-  OSM_LOG_EXIT( p_mgr->p_log );
+	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 )
+__osm_ucast_mgr_process_neighbors(IN cl_map_item_t * const 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_node_t *p_node;
-  osm_node_t *p_remote_node;
-  uint32_t port_num;
-  uint8_t remote_port_num;
-  uint32_t num_ports;
-  osm_physp_t* p_physp;
-
-  OSM_LOG_ENTER( p_mgr->p_log, __osm_ucast_mgr_process_neighbors );
-
-  p_node = p_sw->p_node;
-
-  CL_ASSERT( p_node );
-  CL_ASSERT( osm_node_get_type( p_node ) == IB_NODE_TYPE_SWITCH );
-
-  if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-             "__osm_ucast_mgr_process_neighbors: "
-             "Processing switch with GUID 0x%" PRIx64 "\n",
-             cl_ntoh64( osm_node_get_node_guid( p_node ) ) );
-  }
-
-  num_ports = osm_node_get_num_physp( p_node );
-
-  /*
-    Start with port 1 to skip the switch's management port.
-  */
-  for( port_num = 1; port_num < num_ports; port_num++ )
-  {
-    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
-         propagate through it. */
-      p_physp = osm_node_get_physp_ptr( p_node, port_num );
-      if (!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 );
-
-    }
-  }
-
-  OSM_LOG_EXIT( p_mgr->p_log );
+	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_node_t *p_node;
+	osm_node_t *p_remote_node;
+	uint32_t port_num;
+	uint8_t remote_port_num;
+	uint32_t num_ports;
+	osm_physp_t *p_physp;
+
+	OSM_LOG_ENTER(p_mgr->p_log, __osm_ucast_mgr_process_neighbors);
+
+	p_node = p_sw->p_node;
+
+	CL_ASSERT(p_node);
+	CL_ASSERT(osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH);
+
+	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+		osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+			"__osm_ucast_mgr_process_neighbors: "
+			"Processing switch with GUID 0x%" PRIx64 "\n",
+			cl_ntoh64(osm_node_get_node_guid(p_node)));
+	}
+
+	num_ports = osm_node_get_num_physp(p_node);
+
+	/*
+	   Start with port 1 to skip the switch's management port.
+	 */
+	for (port_num = 1; port_num < num_ports; port_num++) {
+		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
+			   propagate through it. */
+			p_physp = osm_node_get_physp_ptr(p_node, port_num);
+			if (!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);
+
+		}
+	}
+
+	OSM_LOG_EXIT(p_mgr->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_ucast_mgr_build_lid_matrices(
-  IN osm_ucast_mgr_t* const p_mgr )
+void osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * const p_mgr)
 {
-  uint32_t i;
-  uint32_t iteration_max;
-  cl_qmap_t *p_sw_guid_tbl;
-
-  p_sw_guid_tbl = &p_mgr->p_subn->sw_guid_tbl;
-
-  osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-           "osm_ucast_mgr_build_lid_matrices: "
-           "Starting switches' Min Hop Table Assignment\n" );
-
-  /*
-    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 );
-
-  /*
-    Get the switch matrices for each switch's neighbors.
-    This process requires a number of iterations equal to
-    the number of switches in the subnet minus 1.
-
-    In each iteration, a switch learns the lid/port/hop
-    information (as contained by a switch's lid matrix) from
-    its immediate neighbors.  After each iteration, a switch
-    (and it's neighbors) know more routing information than
-    it did on the previous iteration.
-    Thus, by repeatedly absorbing the routing information of
-    neighbor switches, every switch eventually learns how to
-    route all LIDs on the subnet.
-
-    Note that there may not be any switches in the subnet if
-    we are in simple p2p configuration.
-  */
-  iteration_max = cl_qmap_count( p_sw_guid_tbl );
-
-  /*
-    If there are switches in the subnet, iterate until the lid
-    matrix has been constructed.  Otherwise, just immediately
-    indicate we're done if no switches exist.
-  */
-  if( iteration_max )
-  {
-    iteration_max--;
-
-    /*
-      we need to find out when the propagation of
-      hop counts has relaxed. So this global variable
-      is preset to 0 on each iteration and if
-      if non of the switches was set will exit the
-      while loop
-    */
-    p_mgr->some_hop_count_set = TRUE;
-    for( i = 0; (i < iteration_max) && p_mgr->some_hop_count_set; i++ )
-    {
-      p_mgr->some_hop_count_set = FALSE;
-      cl_qmap_apply_func( p_sw_guid_tbl,
-                          __osm_ucast_mgr_process_neighbors, p_mgr );
-    }
-    osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-             "osm_ucast_mgr_build_lid_matrices: "
-             "Min-hop propagated in %d steps\n", i );
-  }
+	uint32_t i;
+	uint32_t iteration_max;
+	cl_qmap_t *p_sw_guid_tbl;
+
+	p_sw_guid_tbl = &p_mgr->p_subn->sw_guid_tbl;
+
+	osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+		"osm_ucast_mgr_build_lid_matrices: "
+		"Starting switches' Min Hop Table Assignment\n");
+
+	/*
+	   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);
+
+	/*
+	   Get the switch matrices for each switch's neighbors.
+	   This process requires a number of iterations equal to
+	   the number of switches in the subnet minus 1.
+
+	   In each iteration, a switch learns the lid/port/hop
+	   information (as contained by a switch's lid matrix) from
+	   its immediate neighbors.  After each iteration, a switch
+	   (and it's neighbors) know more routing information than
+	   it did on the previous iteration.
+	   Thus, by repeatedly absorbing the routing information of
+	   neighbor switches, every switch eventually learns how to
+	   route all LIDs on the subnet.
+
+	   Note that there may not be any switches in the subnet if
+	   we are in simple p2p configuration.
+	 */
+	iteration_max = cl_qmap_count(p_sw_guid_tbl);
+
+	/*
+	   If there are switches in the subnet, iterate until the lid
+	   matrix has been constructed.  Otherwise, just immediately
+	   indicate we're done if no switches exist.
+	 */
+	if (iteration_max) {
+		iteration_max--;
+
+		/*
+		   we need to find out when the propagation of
+		   hop counts has relaxed. So this global variable
+		   is preset to 0 on each iteration and if
+		   if non of the switches was set will exit the
+		   while loop
+		 */
+		p_mgr->some_hop_count_set = TRUE;
+		for (i = 0; (i < iteration_max) && p_mgr->some_hop_count_set;
+		     i++) {
+			p_mgr->some_hop_count_set = FALSE;
+			cl_qmap_apply_func(p_sw_guid_tbl,
+					   __osm_ucast_mgr_process_neighbors,
+					   p_mgr);
+		}
+		osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+			"osm_ucast_mgr_build_lid_matrices: "
+			"Min-hop propagated in %d steps\n", i);
+	}
 }
 
 /**********************************************************************
  **********************************************************************/
-static int
-ucast_mgr_setup_all_switches(osm_subn_t *p_subn)
+static int ucast_mgr_setup_all_switches(osm_subn_t * p_subn)
 {
-  osm_switch_t *p_sw;
-  uint16_t lids;
-
-  lids = (uint16_t)cl_ptr_vector_get_size(&p_subn->port_lid_tbl);
-  lids = lids ? lids - 1 : 0;
-
-  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))
-  if (osm_switch_prepare_path_rebuild(p_sw, lids)) {
-    osm_log(&p_subn->p_osm->log, OSM_LOG_ERROR,
-            "ucast_mgr_setup_all_switches: ERR 3A0B: "
-            "cannot setup switch 0x%016" PRIx64 "\n",
-            cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)));
-    return -1;
-  }
-
-  return 0;
+	osm_switch_t *p_sw;
+	uint16_t lids;
+
+	lids = (uint16_t) cl_ptr_vector_get_size(&p_subn->port_lid_tbl);
+	lids = lids ? lids - 1 : 0;
+
+	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))
+		if (osm_switch_prepare_path_rebuild(p_sw, lids)) {
+			osm_log(&p_subn->p_osm->log, OSM_LOG_ERROR,
+				"ucast_mgr_setup_all_switches: ERR 3A0B: "
+				"cannot setup switch 0x%016" PRIx64 "\n",
+				cl_ntoh64(osm_node_get_node_guid
+					  (p_sw->p_node)));
+			return -1;
+		}
+
+	return 0;
 }
 
 /**********************************************************************
  **********************************************************************/
 
 cl_status_t
-osm_ucast_mgr_read_guid_file(
-  IN  osm_ucast_mgr_t * const p_mgr,
-  IN  const char      * guid_file_name,
-  IN  cl_list_t       * p_list )
+osm_ucast_mgr_read_guid_file(IN osm_ucast_mgr_t * const p_mgr,
+			     IN const char *guid_file_name,
+			     IN cl_list_t * p_list)
 {
-  cl_status_t   status = IB_SUCCESS;
-  FILE        * guid_file;
-  char          line[MAX_GUID_FILE_LINE_LENGTH];
-  char        * endptr;
-  uint64_t    * p_guid;
-
-  OSM_LOG_ENTER(p_mgr->p_log, osm_ucast_mgr_read_guid_file);
-
-  guid_file = fopen(guid_file_name, "r");
-  if (guid_file == NULL)
-  {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "osm_ucast_mgr_read_guid_file: ERR 3A13: "
-             "Failed to open guid list file (%s)\n",
-             guid_file_name );
-    status = IB_NOT_FOUND;
-    goto Exit;
-  }
-
-  while ( fgets(line, MAX_GUID_FILE_LINE_LENGTH, guid_file) )
-  {
-    if (strcspn(line, " ,;.") != strlen(line))
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-               "osm_ucast_mgr_read_guid_file: ERR 3A14: "
-               "Poorly formatted guid in file (%s): %s\n",
-               guid_file_name, line );
-      status = IB_NOT_FOUND;
-      break;
-    }
-
-    /* Skip empty lines anywhere in the file - only one
-       char means the null termination */
-    if (strlen(line) <= 1)
-      continue;
-
-    p_guid = malloc(sizeof(uint64_t));
-    if (!p_guid)
-    {
-      status = IB_ERROR;
-      goto Exit;
-    }
-
-    *p_guid = strtoull(line, &endptr, 16);
-
-    /* check that the string is a number */
-    if (!(*p_guid) && (*endptr != '\0'))
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-               "osm_ucast_mgr_read_guid_file: ERR 3A15: "
-               "Poorly formatted guid in file (%s): %s\n",
-               guid_file_name, line );
-      status = IB_NOT_FOUND;
-      break;
-    }
-
-    /* store the parsed guid */
-    cl_list_insert_tail(p_list, p_guid);
-  }
-
-Exit :
-  if (guid_file)
-    fclose(guid_file);
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return (status);
+	cl_status_t status = IB_SUCCESS;
+	FILE *guid_file;
+	char line[MAX_GUID_FILE_LINE_LENGTH];
+	char *endptr;
+	uint64_t *p_guid;
+
+	OSM_LOG_ENTER(p_mgr->p_log, osm_ucast_mgr_read_guid_file);
+
+	guid_file = fopen(guid_file_name, "r");
+	if (guid_file == NULL) {
+		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			"osm_ucast_mgr_read_guid_file: ERR 3A13: "
+			"Failed to open guid list file (%s)\n", guid_file_name);
+		status = IB_NOT_FOUND;
+		goto Exit;
+	}
+
+	while (fgets(line, MAX_GUID_FILE_LINE_LENGTH, guid_file)) {
+		if (strcspn(line, " ,;.") != strlen(line)) {
+			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+				"osm_ucast_mgr_read_guid_file: ERR 3A14: "
+				"Poorly formatted guid in file (%s): %s\n",
+				guid_file_name, line);
+			status = IB_NOT_FOUND;
+			break;
+		}
+
+		/* Skip empty lines anywhere in the file - only one
+		   char means the null termination */
+		if (strlen(line) <= 1)
+			continue;
+
+		p_guid = malloc(sizeof(uint64_t));
+		if (!p_guid) {
+			status = IB_ERROR;
+			goto Exit;
+		}
+
+		*p_guid = strtoull(line, &endptr, 16);
+
+		/* check that the string is a number */
+		if (!(*p_guid) && (*endptr != '\0')) {
+			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+				"osm_ucast_mgr_read_guid_file: ERR 3A15: "
+				"Poorly formatted guid in file (%s): %s\n",
+				guid_file_name, line);
+			status = IB_NOT_FOUND;
+			break;
+		}
+
+		/* store the parsed guid */
+		cl_list_insert_tail(p_list, p_guid);
+	}
+
+      Exit:
+	if (guid_file)
+		fclose(guid_file);
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
-osm_signal_t
-osm_ucast_mgr_process(
-  IN osm_ucast_mgr_t* const p_mgr )
+osm_signal_t osm_ucast_mgr_process(IN osm_ucast_mgr_t * const p_mgr)
 {
-  struct osm_routing_engine *p_routing_eng;
-  osm_signal_t signal = OSM_SIGNAL_DONE;
-  cl_qmap_t *p_sw_guid_tbl;
-  boolean_t default_routing = TRUE;
-
-  OSM_LOG_ENTER( p_mgr->p_log, osm_ucast_mgr_process );
-
-  p_sw_guid_tbl = &p_mgr->p_subn->sw_guid_tbl;
-  p_routing_eng = &p_mgr->p_subn->p_osm->routing_engine;
-
-  CL_PLOCK_EXCL_ACQUIRE( p_mgr->p_lock );
-
-  /*
-    If there are no switches in the subnet, we are done.
-  */
-  if (cl_qmap_count( p_sw_guid_tbl ) == 0 ||
-      ucast_mgr_setup_all_switches(p_mgr->p_subn) < 0)
-    goto Exit;
-
-  p_mgr->any_change = FALSE;
-
-  if (!p_routing_eng->build_lid_matrices ||
-      p_routing_eng->build_lid_matrices(p_routing_eng->context) != 0)
-    osm_ucast_mgr_build_lid_matrices(p_mgr);
-
-  osm_log( p_mgr->p_log, OSM_LOG_INFO,
-           "osm_ucast_mgr_process: "
-           "%s tables configured on all switches\n",
-           p_routing_eng->name ? p_routing_eng->name : "null (min-hop)");
-
-  /*
-    Now that the lid matrices have been built, we can
-    build and download the switch forwarding tables.
-  */
-  if ( p_routing_eng->ucast_build_fwd_tables &&
-       (p_routing_eng->ucast_build_fwd_tables(p_routing_eng->context) == 0) )
-     default_routing = FALSE;
-  else
-     cl_qmap_apply_func( p_sw_guid_tbl, __osm_ucast_mgr_process_tbl, p_mgr );
-
-  if (p_mgr->any_change)
-  {
-    signal = OSM_SIGNAL_DONE_PENDING;
-    osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-             "osm_ucast_mgr_process: "
-             "LFT Tables configured on all switches\n");
-  }
-  else
-  {
-    signal = OSM_SIGNAL_DONE;
-    osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-             "osm_ucast_mgr_process: "
-             "No need to set any LFT Tables on any switches\n");
-  }
-
- Exit:
-  CL_PLOCK_RELEASE( p_mgr->p_lock );
-  OSM_LOG_EXIT( p_mgr->p_log );
-  return( signal );
+	struct osm_routing_engine *p_routing_eng;
+	osm_signal_t signal = OSM_SIGNAL_DONE;
+	cl_qmap_t *p_sw_guid_tbl;
+	boolean_t default_routing = TRUE;
+
+	OSM_LOG_ENTER(p_mgr->p_log, osm_ucast_mgr_process);
+
+	p_sw_guid_tbl = &p_mgr->p_subn->sw_guid_tbl;
+	p_routing_eng = &p_mgr->p_subn->p_osm->routing_engine;
+
+	CL_PLOCK_EXCL_ACQUIRE(p_mgr->p_lock);
+
+	/*
+	   If there are no switches in the subnet, we are done.
+	 */
+	if (cl_qmap_count(p_sw_guid_tbl) == 0 ||
+	    ucast_mgr_setup_all_switches(p_mgr->p_subn) < 0)
+		goto Exit;
+
+	p_mgr->any_change = FALSE;
+
+	if (!p_routing_eng->build_lid_matrices ||
+	    p_routing_eng->build_lid_matrices(p_routing_eng->context) != 0)
+		osm_ucast_mgr_build_lid_matrices(p_mgr);
+
+	osm_log(p_mgr->p_log, OSM_LOG_INFO,
+		"osm_ucast_mgr_process: "
+		"%s tables configured on all switches\n",
+		p_routing_eng->name ? p_routing_eng->name : "null (min-hop)");
+
+	/*
+	   Now that the lid matrices have been built, we can
+	   build and download the switch forwarding tables.
+	 */
+	if (p_routing_eng->ucast_build_fwd_tables &&
+	    (p_routing_eng->ucast_build_fwd_tables(p_routing_eng->context) ==
+	     0))
+		default_routing = FALSE;
+	else
+		cl_qmap_apply_func(p_sw_guid_tbl, __osm_ucast_mgr_process_tbl,
+				   p_mgr);
+
+	if (p_mgr->any_change) {
+		signal = OSM_SIGNAL_DONE_PENDING;
+		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+			"osm_ucast_mgr_process: "
+			"LFT Tables configured on all switches\n");
+	} else {
+		signal = OSM_SIGNAL_DONE;
+		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+			"osm_ucast_mgr_process: "
+			"No need to set any LFT Tables on any switches\n");
+	}
+
+      Exit:
+	CL_PLOCK_RELEASE(p_mgr->p_lock);
+	OSM_LOG_EXIT(p_mgr->p_log);
+	return (signal);
 }
diff --git a/opensm/opensm/osm_ucast_updn.c b/opensm/opensm/osm_ucast_updn.c
index df42245..0b7b1a9 100644
--- a/opensm/opensm/osm_ucast_updn.c
+++ b/opensm/opensm/osm_ucast_updn.c
@@ -46,7 +46,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <complib/cl_debug.h>
@@ -60,71 +60,64 @@
 /* //////////////////////////// */
 
 /* direction */
-typedef enum _updn_switch_dir
-{
-  UP = 0,
-  DOWN
+typedef enum _updn_switch_dir {
+	UP = 0,
+	DOWN
 } updn_switch_dir_t;
 
 /* guids list */
-typedef struct _updn_input
-{
-  uint32_t num_guids;
-  uint64_t *guid_list;
+typedef struct _updn_input {
+	uint32_t num_guids;
+	uint64_t *guid_list;
 } updn_input_t;
 
 /* updn structure */
-typedef struct _updn
-{
-  boolean_t      auto_detect_root_nodes;
-  updn_input_t   updn_ucast_reg_inputs;
-  cl_list_t     *p_root_nodes;
-  osm_opensm_t  *p_osm;
+typedef struct _updn {
+	boolean_t auto_detect_root_nodes;
+	updn_input_t updn_ucast_reg_inputs;
+	cl_list_t *p_root_nodes;
+	osm_opensm_t *p_osm;
 } updn_t;
 
 struct updn_node {
-  cl_list_item_t list;
-  osm_switch_t *sw;
-  updn_switch_dir_t dir;
-  unsigned rank;
-  unsigned visited;
+	cl_list_item_t list;
+	osm_switch_t *sw;
+	updn_switch_dir_t dir;
+	unsigned rank;
+	unsigned visited;
 };
 
 /* ///////////////////////////////// */
 /*  Statics                          */
 /* ///////////////////////////////// */
-static void __osm_updn_find_root_nodes_by_min_hop(OUT updn_t *p_updn);
+static void __osm_updn_find_root_nodes_by_min_hop(OUT updn_t * p_updn);
 
 /**********************************************************************
  **********************************************************************/
 /* This function returns direction based on rank and guid info of current &
    remote ports */
 static updn_switch_dir_t
-__updn_get_dir(
-  IN unsigned cur_rank,
-  IN unsigned rem_rank,
-  IN uint64_t cur_guid,
-  IN uint64_t rem_guid )
+__updn_get_dir(IN unsigned cur_rank,
+	       IN unsigned rem_rank, IN uint64_t cur_guid, IN uint64_t rem_guid)
 {
-  /* 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 UPDN to discover
-     the subnet correctly (and not from the point of view of the last root node).
-  */
-  if (!cur_rank && !rem_rank)
-    return UP;
-
-  if (cur_rank < rem_rank)
-    return DOWN;
-  else if (cur_rank > rem_rank)
-    return UP;
-  else
-  {
-    /* Equal rank, decide by guid number, bigger == UP direction */
-    if (cur_guid > rem_guid)
-      return UP;
-    else
-      return DOWN;
-  }
+	/* 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 UPDN to discover
+	   the subnet correctly (and not from the point of view of the last root node).
+	 */
+	if (!cur_rank && !rem_rank)
+		return UP;
+
+	if (cur_rank < rem_rank)
+		return DOWN;
+	else if (cur_rank > rem_rank)
+		return UP;
+	else {
+		/* Equal rank, decide by guid number, bigger == UP direction */
+		if (cur_guid > rem_guid)
+			return UP;
+		else
+			return DOWN;
+	}
 }
 
 /**********************************************************************
@@ -132,210 +125,202 @@ __updn_get_dir(
  * as a starting point.
  **********************************************************************/
 static int
-__updn_bfs_by_node(
-  IN osm_log_t *p_log,
-  IN osm_subn_t *p_subn,
-  IN osm_switch_t *p_sw )
+__updn_bfs_by_node(IN osm_log_t * p_log,
+		   IN osm_subn_t * p_subn, IN osm_switch_t * p_sw)
 {
-  uint8_t pn, pn_rem;
-  cl_qlist_t list;
-  uint16_t lid;
-  struct updn_node *u;
-  updn_switch_dir_t next_dir, current_dir;
-
-  OSM_LOG_ENTER( p_log, __updn_bfs_by_node );
-
-  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,
-           "__updn_bfs_by_node: "
-           "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 = UP;
-
-  /* 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))
-  {
-    ib_net64_t remote_guid, current_guid;
-
-    u = (struct updn_node *)cl_qlist_remove_head(&list);
-    u->visited = 0; /* cleanup */
-    current_dir = u->dir;
-    current_guid = osm_node_get_node_guid(u->sw->p_node);
-    /* 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 updn_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 */
-      remote_guid = osm_node_get_node_guid(p_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 = __updn_get_dir(u->rank, rem_u->rank,
-                                current_guid, remote_guid);
-
-      /* Check if this is a legal step : the only illegal step is going
-         from DOWN to UP */
-      if ((current_dir == DOWN) && (next_dir == UP))
-      {
-        osm_log( p_log, OSM_LOG_DEBUG,
-                 "__updn_bfs_by_node: "
-                 "Avoiding move from 0x%016" PRIx64 " to 0x%016" PRIx64"\n",
-                 cl_ntoh64(current_guid), cl_ntoh64(remote_guid) );
-        /* Illegal step */
-        continue;
-      }
-      /* 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);
-      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 (set_hop_return_value)
-        {
-          osm_log( p_log, OSM_LOG_ERROR,
-                   "__updn_bfs_by_node (less) ERR AA01: "
-                   "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 updn_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;
+	uint8_t pn, pn_rem;
+	cl_qlist_t list;
+	uint16_t lid;
+	struct updn_node *u;
+	updn_switch_dir_t next_dir, current_dir;
+
+	OSM_LOG_ENTER(p_log, __updn_bfs_by_node);
+
+	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,
+		"__updn_bfs_by_node: "
+		"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 = UP;
+
+	/* 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)) {
+		ib_net64_t remote_guid, current_guid;
+
+		u = (struct updn_node *)cl_qlist_remove_head(&list);
+		u->visited = 0;	/* cleanup */
+		current_dir = u->dir;
+		current_guid = osm_node_get_node_guid(u->sw->p_node);
+		/* 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 updn_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 */
+			remote_guid = osm_node_get_node_guid(p_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 = __updn_get_dir(u->rank, rem_u->rank,
+						  current_guid, remote_guid);
+
+			/* Check if this is a legal step : the only illegal step is going
+			   from DOWN to UP */
+			if ((current_dir == DOWN) && (next_dir == UP)) {
+				osm_log(p_log, OSM_LOG_DEBUG,
+					"__updn_bfs_by_node: "
+					"Avoiding move from 0x%016" PRIx64
+					" to 0x%016" PRIx64 "\n",
+					cl_ntoh64(current_guid),
+					cl_ntoh64(remote_guid));
+				/* Illegal step */
+				continue;
+			}
+			/* 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);
+			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 (set_hop_return_value) {
+					osm_log(p_log, OSM_LOG_ERROR,
+						"__updn_bfs_by_node (less) ERR AA01: "
+						"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 updn_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;
 }
 
 /**********************************************************************
  **********************************************************************/
-static void
-updn_destroy(
-  IN updn_t* const p_updn )
+static void updn_destroy(IN updn_t * const p_updn)
 {
-  uint64_t *p_guid_list_item;
+	uint64_t *p_guid_list_item;
 
-  /* free the array of guids */
-  if (p_updn->updn_ucast_reg_inputs.guid_list)
-    free(p_updn->updn_ucast_reg_inputs.guid_list);
+	/* free the array of guids */
+	if (p_updn->updn_ucast_reg_inputs.guid_list)
+		free(p_updn->updn_ucast_reg_inputs.guid_list);
 
-  /* destroy the list of root nodes */
-  while ((p_guid_list_item = cl_list_remove_head( p_updn->p_root_nodes )))
-    free( p_guid_list_item );
+	/* destroy the list of root nodes */
+	while ((p_guid_list_item = cl_list_remove_head(p_updn->p_root_nodes)))
+		free(p_guid_list_item);
 
-  cl_list_remove_all( p_updn->p_root_nodes );
-  cl_list_destroy( p_updn->p_root_nodes );
-  free ( p_updn->p_root_nodes );
-  free (p_updn);
+	cl_list_remove_all(p_updn->p_root_nodes);
+	cl_list_destroy(p_updn->p_root_nodes);
+	free(p_updn->p_root_nodes);
+	free(p_updn);
 }
 
 /**********************************************************************
  **********************************************************************/
-static updn_t*
-updn_construct(osm_log_t *p_log)
+static updn_t *updn_construct(osm_log_t * p_log)
 {
-  updn_t* p_updn;
+	updn_t *p_updn;
 
-  OSM_LOG_ENTER( p_log, updn_construct );
+	OSM_LOG_ENTER(p_log, updn_construct);
 
-  p_updn = malloc(sizeof(updn_t));
-  if (p_updn)
-    memset(p_updn, 0, sizeof(updn_t));
+	p_updn = malloc(sizeof(updn_t));
+	if (p_updn)
+		memset(p_updn, 0, sizeof(updn_t));
 
-  OSM_LOG_EXIT( p_log );
-  return(p_updn);
+	OSM_LOG_EXIT(p_log);
+	return (p_updn);
 }
 
 /**********************************************************************
  **********************************************************************/
-static cl_status_t
-updn_init(
-  IN updn_t* const p_updn,
-  IN osm_opensm_t *p_osm )
+static cl_status_t updn_init(IN updn_t * const p_updn, IN osm_opensm_t * p_osm)
 {
-  cl_list_t * p_list;
-  cl_list_iterator_t guid_iterator;
-  ib_api_status_t status = IB_SUCCESS;
-
-  OSM_LOG_ENTER( &p_osm->log, updn_init );
-
-  p_updn->p_osm = p_osm;
-  p_list = (cl_list_t*)malloc(sizeof(cl_list_t));
-  if (!p_list)
-  {
-    status = IB_ERROR;
-    goto Exit;
-  }
-
-  cl_list_construct( p_list );
-  cl_list_init( p_list, 10 );
-  p_updn->p_root_nodes = p_list;
-  p_updn->updn_ucast_reg_inputs.num_guids = 0;
-  p_updn->updn_ucast_reg_inputs.guid_list = NULL;
-  p_updn->auto_detect_root_nodes = FALSE;
-
-  /*
-     Check the source for root node list, if file parse it, otherwise
-     wait for a callback to activate auto detection
-  */
-  if (p_osm->subn.opt.root_guid_file)
-  {
-    status = osm_ucast_mgr_read_guid_file( &p_osm->sm.ucast_mgr,
-                                           p_osm->subn.opt.root_guid_file,
-                                           p_updn->p_root_nodes );
-    if (status != IB_SUCCESS)
-       goto Exit;
-
-    /* For Debug Purposes ... */
-    osm_log( &p_osm->log, OSM_LOG_DEBUG,
-             "updn_init: "
-             "UPDN - Fetching root nodes from file %s\n",
-             p_osm->subn.opt.root_guid_file );
-    guid_iterator = cl_list_head(p_updn->p_root_nodes);
-    while( guid_iterator != cl_list_end(p_updn->p_root_nodes) )
-    {
-      osm_log( &p_osm->log, OSM_LOG_DEBUG,
-               "updn_init: "
-               "Inserting GUID 0x%" PRIx64 " as root node\n",
-               *((uint64_t*)cl_list_obj(guid_iterator)) );
-      guid_iterator = cl_list_next(guid_iterator);
-    }
-  }
-  else
-  {
-    p_updn->auto_detect_root_nodes = TRUE;
-  }
-  /* If auto mode detection required - will be executed in main b4 the assignment of UI Ucast */
-
-Exit :
-  OSM_LOG_EXIT( &p_osm->log );
-  return (status);
+	cl_list_t *p_list;
+	cl_list_iterator_t guid_iterator;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(&p_osm->log, updn_init);
+
+	p_updn->p_osm = p_osm;
+	p_list = (cl_list_t *) malloc(sizeof(cl_list_t));
+	if (!p_list) {
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	cl_list_construct(p_list);
+	cl_list_init(p_list, 10);
+	p_updn->p_root_nodes = p_list;
+	p_updn->updn_ucast_reg_inputs.num_guids = 0;
+	p_updn->updn_ucast_reg_inputs.guid_list = NULL;
+	p_updn->auto_detect_root_nodes = FALSE;
+
+	/*
+	   Check the source for root node list, if file parse it, otherwise
+	   wait for a callback to activate auto detection
+	 */
+	if (p_osm->subn.opt.root_guid_file) {
+		status = osm_ucast_mgr_read_guid_file(&p_osm->sm.ucast_mgr,
+						      p_osm->subn.opt.
+						      root_guid_file,
+						      p_updn->p_root_nodes);
+		if (status != IB_SUCCESS)
+			goto Exit;
+
+		/* For Debug Purposes ... */
+		osm_log(&p_osm->log, OSM_LOG_DEBUG,
+			"updn_init: "
+			"UPDN - Fetching root nodes from file %s\n",
+			p_osm->subn.opt.root_guid_file);
+		guid_iterator = cl_list_head(p_updn->p_root_nodes);
+		while (guid_iterator != cl_list_end(p_updn->p_root_nodes)) {
+			osm_log(&p_osm->log, OSM_LOG_DEBUG,
+				"updn_init: "
+				"Inserting GUID 0x%" PRIx64 " as root node\n",
+				*((uint64_t *) cl_list_obj(guid_iterator)));
+			guid_iterator = cl_list_next(guid_iterator);
+		}
+	} else {
+		p_updn->auto_detect_root_nodes = TRUE;
+	}
+	/* If auto mode detection required - will be executed in main b4 the assignment of UI Ucast */
+
+      Exit:
+	OSM_LOG_EXIT(&p_osm->log);
+	return (status);
 }
 
 /**********************************************************************
@@ -343,526 +328,502 @@ Exit :
 /* NOTE : PLS check if we need to decide that the first */
 /*        rank is a SWITCH for BFS purpose */
 static int
-updn_subn_rank(
-  IN unsigned num_guids,
-  IN uint64_t* guid_list,
-  IN updn_t* p_updn )
+updn_subn_rank(IN unsigned num_guids,
+	       IN uint64_t * guid_list, IN updn_t * p_updn)
 {
-  osm_switch_t *p_sw;
-  osm_physp_t *p_physp, *p_remote_physp;
-  cl_qlist_t list;
-  struct updn_node *u, *remote_u;
-  uint8_t num_ports, port_num;
-  osm_log_t *p_log = &p_updn->p_osm->log;
-  unsigned idx = 0;
-  unsigned max_rank = 0;
-
-  OSM_LOG_ENTER( p_log, updn_subn_rank );
-  cl_qlist_init(&list);
-
-  /* Rank all the roots and add them to list */
-
-  for (idx = 0; idx < num_guids; idx++)
-  {
-    /* Apply the ranking for each guid given by user - bypass illegal ones */
-    p_sw = osm_get_switch_by_guid(&p_updn->p_osm->subn, cl_hton64(guid_list[idx]));
-    if(!p_sw)
-    {
-      osm_log( p_log, OSM_LOG_ERROR,
-               "updn_subn_rank: ERR AA05: "
-               "Root switch GUID 0x%" PRIx64 " not found\n", guid_list[idx] );
-      continue;
-    }
-
-    u = p_sw->priv;
-    osm_log( p_log, OSM_LOG_DEBUG,
-             "updn_subn_rank: "
-             "Ranking root port GUID 0x%" PRIx64 "\n", guid_list[idx] );
-    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 updn_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,
-             "updn_subn_rank: "
-             "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 );
-      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. The port is a valid port
-        3. It is a switch
-      */
-      if ( p_remote_physp &&
-           osm_physp_is_valid( 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,
-                 "updn_subn_rank: "
-                 "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,
-           "updn_subn_rank: "
-           "Subnet ranking completed. Max Node Rank = %d\n",
-           max_rank );
-  OSM_LOG_EXIT( p_log );
-  return 0;
+	osm_switch_t *p_sw;
+	osm_physp_t *p_physp, *p_remote_physp;
+	cl_qlist_t list;
+	struct updn_node *u, *remote_u;
+	uint8_t num_ports, port_num;
+	osm_log_t *p_log = &p_updn->p_osm->log;
+	unsigned idx = 0;
+	unsigned max_rank = 0;
+
+	OSM_LOG_ENTER(p_log, updn_subn_rank);
+	cl_qlist_init(&list);
+
+	/* Rank all the roots and add them to list */
+
+	for (idx = 0; idx < num_guids; idx++) {
+		/* Apply the ranking for each guid given by user - bypass illegal ones */
+		p_sw =
+		    osm_get_switch_by_guid(&p_updn->p_osm->subn,
+					   cl_hton64(guid_list[idx]));
+		if (!p_sw) {
+			osm_log(p_log, OSM_LOG_ERROR,
+				"updn_subn_rank: ERR AA05: "
+				"Root switch GUID 0x%" PRIx64 " not found\n",
+				guid_list[idx]);
+			continue;
+		}
+
+		u = p_sw->priv;
+		osm_log(p_log, OSM_LOG_DEBUG,
+			"updn_subn_rank: "
+			"Ranking root port GUID 0x%" PRIx64 "\n",
+			guid_list[idx]);
+		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 updn_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,
+			"updn_subn_rank: "
+			"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);
+			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. The port is a valid port
+			   3. It is a switch
+			 */
+			if (p_remote_physp &&
+			    osm_physp_is_valid(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,
+					"updn_subn_rank: "
+					"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,
+		"updn_subn_rank: "
+		"Subnet ranking completed. Max Node Rank = %d\n", max_rank);
+	OSM_LOG_EXIT(p_log);
+	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_root_hops(updn_t * p_updn, osm_switch_t * p_sw)
 {
-  osm_port_t *p_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)->rank != 0)
-        memset(p_sw->hops[i], 0xff, p_sw->num_ports);
-    }
+	osm_port_t *p_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)->
+			    rank != 0)
+				memset(p_sw->hops[i], 0xff, p_sw->num_ports);
+		}
 }
 
 /**********************************************************************
  **********************************************************************/
-static int
-__osm_subn_set_up_down_min_hop_table(
-  IN updn_t* p_updn )
+static int __osm_subn_set_up_down_min_hop_table(IN updn_t * p_updn)
 {
-  osm_subn_t *p_subn = &p_updn->p_osm->subn;
-  osm_log_t *p_log = &p_updn->p_osm->log;
-  osm_switch_t *p_next_sw,*p_sw;
-
-  OSM_LOG_ENTER( p_log, __osm_subn_set_up_down_min_hop_table );
-
-  /* Go over all the switches in the subnet - for each init their Min Hop
-     Table */
-  osm_log( p_log, OSM_LOG_VERBOSE,
-           "__osm_subn_set_up_down_min_hop_table: "
-           "Init Min Hop Table of all switches [\n" );
-
-  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 ) )
-  {
-    p_sw = p_next_sw;
-    p_next_sw = (osm_switch_t*)cl_qmap_next( &p_sw->map_item );
-    /* Clear Min Hop Table */
-    if (p_subn->opt.connect_roots && !((struct updn_node *)p_sw->priv)->rank)
-      updn_clear_root_hops(p_updn, p_sw);
-    else
-      osm_switch_clear_hops(p_sw);
-  }
-
-  osm_log( p_log, OSM_LOG_VERBOSE,
-           "__osm_subn_set_up_down_min_hop_table: "
-           "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,
-           "__osm_subn_set_up_down_min_hop_table: "
-           "BFS through all port guids in the subnet [\n" );
-
-  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 ) )
-  {
-    p_sw = p_next_sw;
-    p_next_sw = (osm_switch_t*)cl_qmap_next( &p_sw->map_item );
-    __updn_bfs_by_node(p_log, p_subn, p_sw);
-  }
-
-  osm_log( p_log, OSM_LOG_VERBOSE,
-           "__osm_subn_set_up_down_min_hop_table: "
-           "BFS through all port guids in the subnet ]\n" );
-  /* Cleanup */
-  OSM_LOG_EXIT( p_log );
-  return 0;
+	osm_subn_t *p_subn = &p_updn->p_osm->subn;
+	osm_log_t *p_log = &p_updn->p_osm->log;
+	osm_switch_t *p_next_sw, *p_sw;
+
+	OSM_LOG_ENTER(p_log, __osm_subn_set_up_down_min_hop_table);
+
+	/* Go over all the switches in the subnet - for each init their Min Hop
+	   Table */
+	osm_log(p_log, OSM_LOG_VERBOSE,
+		"__osm_subn_set_up_down_min_hop_table: "
+		"Init Min Hop Table of all switches [\n");
+
+	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)) {
+		p_sw = p_next_sw;
+		p_next_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
+		/* Clear Min Hop Table */
+		if (p_subn->opt.connect_roots
+		    && !((struct updn_node *)p_sw->priv)->rank)
+			updn_clear_root_hops(p_updn, p_sw);
+		else
+			osm_switch_clear_hops(p_sw);
+	}
+
+	osm_log(p_log, OSM_LOG_VERBOSE,
+		"__osm_subn_set_up_down_min_hop_table: "
+		"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,
+		"__osm_subn_set_up_down_min_hop_table: "
+		"BFS through all port guids in the subnet [\n");
+
+	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)) {
+		p_sw = p_next_sw;
+		p_next_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
+		__updn_bfs_by_node(p_log, p_subn, p_sw);
+	}
+
+	osm_log(p_log, OSM_LOG_VERBOSE,
+		"__osm_subn_set_up_down_min_hop_table: "
+		"BFS through all port guids in the subnet ]\n");
+	/* Cleanup */
+	OSM_LOG_EXIT(p_log);
+	return 0;
 }
 
 /**********************************************************************
  **********************************************************************/
 static int
-__osm_subn_calc_up_down_min_hop_table(
-  IN uint32_t num_guids,
-  IN uint64_t* guid_list,
-  IN updn_t* p_updn )
+__osm_subn_calc_up_down_min_hop_table(IN uint32_t num_guids,
+				      IN uint64_t * guid_list,
+				      IN updn_t * p_updn)
 {
-  int status;
-
-  OSM_LOG_ENTER( &p_updn->p_osm->log, osm_subn_calc_up_down_min_hop_table );
-
-  osm_log( &p_updn->p_osm->log, OSM_LOG_VERBOSE,
-           "__osm_subn_calc_up_down_min_hop_table: "
-           "Ranking all port guids in the list\n" );
-  if (num_guids == 0)
-  {
-    osm_log( &p_updn->p_osm->log, OSM_LOG_ERROR,
-             "__osm_subn_calc_up_down_min_hop_table: ERR AA0A: "
-             "No guids were provided or number of guids is 0\n" );
-    status = -1;
-    goto _exit;
-  }
-
-  /* Check if it's not a switched subnet */
-  if ( cl_is_qmap_empty( &p_updn->p_osm->subn.sw_guid_tbl ) )
-  {
-    osm_log( &p_updn->p_osm->log, OSM_LOG_ERROR,
-             "__osm_subn_calc_up_down_min_hop_table: ERR AAOB: "
-             "This is not a switched subnet, cannot perform UPDN algorithm\n" );
-    status = -1;
-    goto _exit;
-  }
-
-  /* Rank the subnet switches */
-  updn_subn_rank(num_guids, guid_list, p_updn);
-
-  /* After multiple ranking need to set Min Hop Table by UpDn algorithm  */
-  osm_log( &p_updn->p_osm->log, OSM_LOG_VERBOSE,
-           "__osm_subn_calc_up_down_min_hop_table: "
-           "Setting all switches' Min Hop Table\n" );
-  status = __osm_subn_set_up_down_min_hop_table(p_updn);
-
- _exit:
-  OSM_LOG_EXIT( &p_updn->p_osm->log );
-  return status;
+	int status;
+
+	OSM_LOG_ENTER(&p_updn->p_osm->log, osm_subn_calc_up_down_min_hop_table);
+
+	osm_log(&p_updn->p_osm->log, OSM_LOG_VERBOSE,
+		"__osm_subn_calc_up_down_min_hop_table: "
+		"Ranking all port guids in the list\n");
+	if (num_guids == 0) {
+		osm_log(&p_updn->p_osm->log, OSM_LOG_ERROR,
+			"__osm_subn_calc_up_down_min_hop_table: ERR AA0A: "
+			"No guids were provided or number of guids is 0\n");
+		status = -1;
+		goto _exit;
+	}
+
+	/* Check if it's not a switched subnet */
+	if (cl_is_qmap_empty(&p_updn->p_osm->subn.sw_guid_tbl)) {
+		osm_log(&p_updn->p_osm->log, OSM_LOG_ERROR,
+			"__osm_subn_calc_up_down_min_hop_table: ERR AAOB: "
+			"This is not a switched subnet, cannot perform UPDN algorithm\n");
+		status = -1;
+		goto _exit;
+	}
+
+	/* Rank the subnet switches */
+	updn_subn_rank(num_guids, guid_list, p_updn);
+
+	/* After multiple ranking need to set Min Hop Table by UpDn algorithm  */
+	osm_log(&p_updn->p_osm->log, OSM_LOG_VERBOSE,
+		"__osm_subn_calc_up_down_min_hop_table: "
+		"Setting all switches' Min Hop Table\n");
+	status = __osm_subn_set_up_down_min_hop_table(p_updn);
+
+      _exit:
+	OSM_LOG_EXIT(&p_updn->p_osm->log);
+	return status;
 }
 
 /**********************************************************************
  **********************************************************************/
-static struct updn_node *
-create_updn_node(
-  osm_switch_t *sw )
+static struct updn_node *create_updn_node(osm_switch_t * sw)
 {
-  struct updn_node *u;
-
-  u = malloc(sizeof(*u));
-  if (!u)
-    return NULL;
-  memset(u, 0, sizeof(*u));
-  u->sw = sw;
-  u->rank = 0xffffffff;
-  return u;
+	struct updn_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_updn_node(
-  struct updn_node *u )
+static void delete_updn_node(struct updn_node *u)
 {
-  u->sw->priv = NULL;
-  free(u);
+	u->sw->priv = NULL;
+	free(u);
 }
 
 /**********************************************************************
  **********************************************************************/
 /* UPDN callback function */
-static int
-__osm_updn_call(
-  void *ctx )
+static int __osm_updn_call(void *ctx)
 {
-  updn_t *p_updn = ctx;
-  cl_map_item_t *p_item;
-  osm_switch_t *p_sw;
-
-  OSM_LOG_ENTER( &p_updn->p_osm->log, __osm_updn_call );
-
-  p_item = cl_qmap_head(&p_updn->p_osm->subn.sw_guid_tbl);
-  while(p_item != cl_qmap_end(&p_updn->p_osm->subn.sw_guid_tbl))
-  {
-    p_sw = (osm_switch_t *)p_item;
-    p_item = cl_qmap_next(p_item);
-    p_sw->priv = create_updn_node(p_sw);
-    if (!p_sw->priv)
-    {
-      osm_log( &(p_updn->p_osm->log), OSM_LOG_ERROR,
-               "__osm_updn_call: ERR AA0C: "
-               " cannot create updn node\n" );
-      OSM_LOG_EXIT( &p_updn->p_osm->log );
-      return -1;
-    }
-  }
-
-  /* First auto detect root nodes - if required */
-  if ( p_updn->auto_detect_root_nodes )
-  {
-    osm_ucast_mgr_build_lid_matrices( &p_updn->p_osm->sm.ucast_mgr );
-    __osm_updn_find_root_nodes_by_min_hop( p_updn );
-  }
-  else if (p_updn->p_osm->subn.opt.connect_roots &&
-           p_updn->updn_ucast_reg_inputs.num_guids > 1)
-    osm_ucast_mgr_build_lid_matrices( &p_updn->p_osm->sm.ucast_mgr );
-
-  /* printf ("-V- after osm_updn_find_root_nodes_by_min_hop\n"); */
-  /* Only if there are assigned root nodes do the algorithm, otherwise perform do nothing */
-  if ( p_updn->updn_ucast_reg_inputs.num_guids > 0)
-  {
-    osm_log( &(p_updn->p_osm->log), OSM_LOG_DEBUG,
-             "__osm_updn_call: "
-             "activating UPDN algorithm\n" );
-    __osm_subn_calc_up_down_min_hop_table( p_updn->updn_ucast_reg_inputs.num_guids,
-                                           p_updn->updn_ucast_reg_inputs.guid_list,
-                                           p_updn );
-  }
-  else
-    osm_log( &p_updn->p_osm->log, OSM_LOG_INFO,
-             "__osm_updn_call: "
-             "disabling UPDN algorithm, no root nodes were found\n" );
-
-  p_item = cl_qmap_head(&p_updn->p_osm->subn.sw_guid_tbl);
-  while(p_item != cl_qmap_end(&p_updn->p_osm->subn.sw_guid_tbl))
-  {
-    p_sw = (osm_switch_t *)p_item;
-    p_item = cl_qmap_next(p_item);
-    delete_updn_node(p_sw->priv);
-  }
-
-  OSM_LOG_EXIT( &p_updn->p_osm->log );
-  return 0;
+	updn_t *p_updn = ctx;
+	cl_map_item_t *p_item;
+	osm_switch_t *p_sw;
+
+	OSM_LOG_ENTER(&p_updn->p_osm->log, __osm_updn_call);
+
+	p_item = cl_qmap_head(&p_updn->p_osm->subn.sw_guid_tbl);
+	while (p_item != cl_qmap_end(&p_updn->p_osm->subn.sw_guid_tbl)) {
+		p_sw = (osm_switch_t *) p_item;
+		p_item = cl_qmap_next(p_item);
+		p_sw->priv = create_updn_node(p_sw);
+		if (!p_sw->priv) {
+			osm_log(&(p_updn->p_osm->log), OSM_LOG_ERROR,
+				"__osm_updn_call: ERR AA0C: "
+				" cannot create updn node\n");
+			OSM_LOG_EXIT(&p_updn->p_osm->log);
+			return -1;
+		}
+	}
+
+	/* First auto detect root nodes - if required */
+	if (p_updn->auto_detect_root_nodes) {
+		osm_ucast_mgr_build_lid_matrices(&p_updn->p_osm->sm.ucast_mgr);
+		__osm_updn_find_root_nodes_by_min_hop(p_updn);
+	} else if (p_updn->p_osm->subn.opt.connect_roots &&
+		   p_updn->updn_ucast_reg_inputs.num_guids > 1)
+		osm_ucast_mgr_build_lid_matrices(&p_updn->p_osm->sm.ucast_mgr);
+
+	/* printf ("-V- after osm_updn_find_root_nodes_by_min_hop\n"); */
+	/* Only if there are assigned root nodes do the algorithm, otherwise perform do nothing */
+	if (p_updn->updn_ucast_reg_inputs.num_guids > 0) {
+		osm_log(&(p_updn->p_osm->log), OSM_LOG_DEBUG,
+			"__osm_updn_call: " "activating UPDN algorithm\n");
+		__osm_subn_calc_up_down_min_hop_table(p_updn->
+						      updn_ucast_reg_inputs.
+						      num_guids,
+						      p_updn->
+						      updn_ucast_reg_inputs.
+						      guid_list, p_updn);
+	} else
+		osm_log(&p_updn->p_osm->log, OSM_LOG_INFO,
+			"__osm_updn_call: "
+			"disabling UPDN algorithm, no root nodes were found\n");
+
+	p_item = cl_qmap_head(&p_updn->p_osm->subn.sw_guid_tbl);
+	while (p_item != cl_qmap_end(&p_updn->p_osm->subn.sw_guid_tbl)) {
+		p_sw = (osm_switch_t *) p_item;
+		p_item = cl_qmap_next(p_item);
+		delete_updn_node(p_sw->priv);
+	}
+
+	OSM_LOG_EXIT(&p_updn->p_osm->log);
+	return 0;
 }
 
 /**********************************************************************
  **********************************************************************/
 /* UPDN convert cl_list to guid array in updn struct */
-static void
-__osm_updn_convert_list2array(
-  IN updn_t * p_updn )
+static void __osm_updn_convert_list2array(IN updn_t * p_updn)
 {
-  uint32_t i = 0, max_num = 0;
-  uint64_t *p_guid;
-
-  OSM_LOG_ENTER( &p_updn->p_osm->log, __osm_updn_convert_list2array );
-
-  p_updn->updn_ucast_reg_inputs.num_guids = cl_list_count(
-    p_updn->p_root_nodes);
-  if (p_updn->updn_ucast_reg_inputs.guid_list)
-    free(p_updn->updn_ucast_reg_inputs.guid_list);
-  p_updn->updn_ucast_reg_inputs.guid_list = (uint64_t *)malloc(
-    p_updn->updn_ucast_reg_inputs.num_guids*sizeof(uint64_t));
-  if (p_updn->updn_ucast_reg_inputs.guid_list)
-    memset(p_updn->updn_ucast_reg_inputs.guid_list, 0,
-           p_updn->updn_ucast_reg_inputs.num_guids*sizeof(uint64_t));
-  if (!cl_is_list_empty(p_updn->p_root_nodes))
-  {
-    while( (p_guid = (uint64_t*)cl_list_remove_head(p_updn->p_root_nodes)) )
-    {
-      p_updn->updn_ucast_reg_inputs.guid_list[i] = *p_guid;
-      free(p_guid);
-      i++;
-    }
-    max_num = i;
-    for (i = 0; i < max_num; i++ )
-      osm_log( &p_updn->p_osm->log, OSM_LOG_DEBUG,
-               "__osm_updn_convert_list2array: "
-               "Map GUID 0x%" PRIx64 " into UPDN array\n",
-               p_updn->updn_ucast_reg_inputs.guid_list[i] );
-  }
-  /* Since we need the template list for other sweeps, we wont destroy & free it */
-  OSM_LOG_EXIT( &p_updn->p_osm->log );
+	uint32_t i = 0, max_num = 0;
+	uint64_t *p_guid;
+
+	OSM_LOG_ENTER(&p_updn->p_osm->log, __osm_updn_convert_list2array);
+
+	p_updn->updn_ucast_reg_inputs.num_guids =
+	    cl_list_count(p_updn->p_root_nodes);
+	if (p_updn->updn_ucast_reg_inputs.guid_list)
+		free(p_updn->updn_ucast_reg_inputs.guid_list);
+	p_updn->updn_ucast_reg_inputs.guid_list =
+	    (uint64_t *) malloc(p_updn->updn_ucast_reg_inputs.num_guids *
+				sizeof(uint64_t));
+	if (p_updn->updn_ucast_reg_inputs.guid_list)
+		memset(p_updn->updn_ucast_reg_inputs.guid_list, 0,
+		       p_updn->updn_ucast_reg_inputs.num_guids *
+		       sizeof(uint64_t));
+	if (!cl_is_list_empty(p_updn->p_root_nodes)) {
+		while ((p_guid =
+			(uint64_t *) cl_list_remove_head(p_updn->
+							 p_root_nodes))) {
+			p_updn->updn_ucast_reg_inputs.guid_list[i] = *p_guid;
+			free(p_guid);
+			i++;
+		}
+		max_num = i;
+		for (i = 0; i < max_num; i++)
+			osm_log(&p_updn->p_osm->log, OSM_LOG_DEBUG,
+				"__osm_updn_convert_list2array: "
+				"Map GUID 0x%" PRIx64 " into UPDN array\n",
+				p_updn->updn_ucast_reg_inputs.guid_list[i]);
+	}
+	/* Since we need the template list for other sweeps, we wont destroy & free it */
+	OSM_LOG_EXIT(&p_updn->p_osm->log);
 }
 
 /**********************************************************************
  **********************************************************************/
 /* Find Root nodes automatically by Min Hop Table info */
-static void
-__osm_updn_find_root_nodes_by_min_hop(
-  OUT updn_t *  p_updn )
+static void __osm_updn_find_root_nodes_by_min_hop(OUT updn_t * p_updn)
 {
-  osm_opensm_t *p_osm = p_updn->p_osm;
-  osm_switch_t *p_next_sw, *p_sw;
-  osm_port_t   *p_next_port, *p_port;
-  osm_physp_t  *p_physp;
-  uint64_t     *p_guid;
-  cl_list_t    *p_root_nodes_list = p_updn->p_root_nodes;
-  double thd1, thd2;
-  unsigned i, cas_num = 0;
-  unsigned *cas_per_sw;
-  uint16_t lid_ho;
-
-  OSM_LOG_ENTER( &p_osm->log, osm_updn_find_root_nodes_by_min_hop );
-
-  osm_log( &p_osm->log, OSM_LOG_DEBUG,
-           "__osm_updn_find_root_nodes_by_min_hop: "
-           "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));
-  if (!cas_per_sw) {
-    osm_log( &p_osm->log, OSM_LOG_ERROR,
-             "__osm_updn_find_root_nodes_by_min_hop: 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));
-
-  /* Find the Maximum number of CAs (and routers) for histogram normalization */
-  osm_log( &p_osm->log, OSM_LOG_VERBOSE,
-           "__osm_updn_find_root_nodes_by_min_hop: "
-           "Finding the number of CAs and storing them in cl_map\n" );
-  p_next_port = (osm_port_t*)cl_qmap_head( &p_osm->subn.port_guid_tbl );
-  while( p_next_port != (osm_port_t*)cl_qmap_end( &p_osm->subn.port_guid_tbl ) ) {
-    p_port = p_next_port;
-    p_next_port = (osm_port_t*)cl_qmap_next( &p_next_port->map_item );
-    if ( !p_port->p_node->sw )
-    {
-      p_physp = p_port->p_physp->p_remote_physp;
-      if (!p_physp || !p_physp->p_node->sw)
-        continue;
-      lid_ho = osm_node_get_base_lid(p_physp->p_node, 0);
-      lid_ho = cl_ntoh16(lid_ho);
-      osm_log( &p_osm->log, OSM_LOG_DEBUG,
-               "__osm_updn_find_root_nodes_by_min_hop: "
-               "Inserting GUID 0x%" PRIx64 ", sw lid: 0x%X into array\n",
-               cl_ntoh64(osm_port_get_guid(p_port)), lid_ho );
-      cas_per_sw[lid_ho]++;
-      cas_num++;
-    }
-  }
-
-  thd1 = cas_num * 0.9;
-  thd2 = cas_num * 0.05;
-  osm_log( &p_osm->log, OSM_LOG_DEBUG,
-           "__osm_updn_find_root_nodes_by_min_hop: "
-           "Found %u CAs and RTRs, %u SWs in the subnet. "
-           "Thresholds are thd1 = %f && thd2 = %f\n",
-           cas_num, cl_qmap_count(&p_osm->subn.sw_guid_tbl), thd1, thd2);
-
-  p_next_sw = (osm_switch_t*)cl_qmap_head( &p_osm->subn.sw_guid_tbl );
-  osm_log( &p_osm->log, OSM_LOG_VERBOSE,
-           "__osm_updn_find_root_nodes_by_min_hop: "
-           "Passing through all switches to collect Min Hop info\n" );
-  while( p_next_sw != (osm_switch_t*)cl_qmap_end( &p_osm->subn.sw_guid_tbl ) )
-  {
-    unsigned hop_hist[IB_SUBNET_PATH_HOPS_MAX];
-    uint16_t max_lid_ho;
-    uint8_t hop_val;
-    uint16_t numHopBarsOverThd1 = 0;
-    uint16_t numHopBarsOverThd2 = 0;
-
-    p_sw = p_next_sw;
-    /* Roll to the next switch */
-    p_next_sw = (osm_switch_t*)cl_qmap_next( &p_sw->map_item );
-
-    memset(hop_hist, 0, sizeof(hop_hist));
-
-    max_lid_ho = p_sw->max_lid_ho;
-    /* Get base lid of switch by retrieving port 0 lid of node pointer */
-    osm_log( &p_osm->log, OSM_LOG_DEBUG,
-             "__osm_updn_find_root_nodes_by_min_hop: "
-             "Passing through switch lid 0x%X\n",
-	     cl_ntoh16( osm_node_get_base_lid( p_sw->p_node, 0 ) ) );
-    for (lid_ho = 1; lid_ho <= max_lid_ho; lid_ho++)
-      if (cas_per_sw[lid_ho])
-      {
-        hop_val = osm_switch_get_least_hops( p_sw, lid_ho );
-        if (hop_val >= IB_SUBNET_PATH_HOPS_MAX)
-          continue;
-
-        hop_hist[hop_val] += cas_per_sw[lid_ho];
-      }
-
-    /* Now recognize the spines by requiring one bar to be above 90% of the
-       number of CAs and RTRs */
-    for (i = 0 ; i < IB_SUBNET_PATH_HOPS_MAX; i++) {
-      if (hop_hist[i] > thd1)
-        numHopBarsOverThd1++;
-      if (hop_hist[i] > thd2)
-        numHopBarsOverThd2++;
-    }
-
-    /* If thd conditions are valid insert the root node to the list */
-    if ( (numHopBarsOverThd1 == 1) && (numHopBarsOverThd2 == 1) )
-    {
-      p_guid = malloc(sizeof(uint64_t));
-      if (p_guid)
-      {
-        *p_guid = cl_ntoh64(osm_node_get_node_guid(p_sw->p_node));
-        osm_log( &p_osm->log, OSM_LOG_DEBUG,
-                 "__osm_updn_find_root_nodes_by_min_hop: "
-                 "Inserting GUID 0x%" PRIx64 " as root node\n",
-                 *p_guid );
-        cl_list_insert_tail(p_root_nodes_list, p_guid);
-      }
-      else
-      {
-        osm_log( &p_osm->log, OSM_LOG_ERROR,
-                 "__osm_updn_find_root_nodes_by_min_hop: ERR AA13: "
-                 "No memory for p_guid\n" );
-      }
-    }
-  }
-
-  free(cas_per_sw);
-  /* Now convert the cl_list to array */
-  __osm_updn_convert_list2array(p_updn);
-
- _exit:
-  OSM_LOG_EXIT( &p_osm->log );
-  return;
+	osm_opensm_t *p_osm = p_updn->p_osm;
+	osm_switch_t *p_next_sw, *p_sw;
+	osm_port_t *p_next_port, *p_port;
+	osm_physp_t *p_physp;
+	uint64_t *p_guid;
+	cl_list_t *p_root_nodes_list = p_updn->p_root_nodes;
+	double thd1, thd2;
+	unsigned i, cas_num = 0;
+	unsigned *cas_per_sw;
+	uint16_t lid_ho;
+
+	OSM_LOG_ENTER(&p_osm->log, osm_updn_find_root_nodes_by_min_hop);
+
+	osm_log(&p_osm->log, OSM_LOG_DEBUG,
+		"__osm_updn_find_root_nodes_by_min_hop: "
+		"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));
+	if (!cas_per_sw) {
+		osm_log(&p_osm->log, OSM_LOG_ERROR,
+			"__osm_updn_find_root_nodes_by_min_hop: 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));
+
+	/* Find the Maximum number of CAs (and routers) for histogram normalization */
+	osm_log(&p_osm->log, OSM_LOG_VERBOSE,
+		"__osm_updn_find_root_nodes_by_min_hop: "
+		"Finding the number of CAs and storing them in cl_map\n");
+	p_next_port = (osm_port_t *) cl_qmap_head(&p_osm->subn.port_guid_tbl);
+	while (p_next_port !=
+	       (osm_port_t *) cl_qmap_end(&p_osm->subn.port_guid_tbl)) {
+		p_port = p_next_port;
+		p_next_port =
+		    (osm_port_t *) cl_qmap_next(&p_next_port->map_item);
+		if (!p_port->p_node->sw) {
+			p_physp = p_port->p_physp->p_remote_physp;
+			if (!p_physp || !p_physp->p_node->sw)
+				continue;
+			lid_ho = osm_node_get_base_lid(p_physp->p_node, 0);
+			lid_ho = cl_ntoh16(lid_ho);
+			osm_log(&p_osm->log, OSM_LOG_DEBUG,
+				"__osm_updn_find_root_nodes_by_min_hop: "
+				"Inserting GUID 0x%" PRIx64
+				", sw lid: 0x%X into array\n",
+				cl_ntoh64(osm_port_get_guid(p_port)), lid_ho);
+			cas_per_sw[lid_ho]++;
+			cas_num++;
+		}
+	}
+
+	thd1 = cas_num * 0.9;
+	thd2 = cas_num * 0.05;
+	osm_log(&p_osm->log, OSM_LOG_DEBUG,
+		"__osm_updn_find_root_nodes_by_min_hop: "
+		"Found %u CAs and RTRs, %u SWs in the subnet. "
+		"Thresholds are thd1 = %f && thd2 = %f\n",
+		cas_num, cl_qmap_count(&p_osm->subn.sw_guid_tbl), thd1, thd2);
+
+	p_next_sw = (osm_switch_t *) cl_qmap_head(&p_osm->subn.sw_guid_tbl);
+	osm_log(&p_osm->log, OSM_LOG_VERBOSE,
+		"__osm_updn_find_root_nodes_by_min_hop: "
+		"Passing through all switches to collect Min Hop info\n");
+	while (p_next_sw !=
+	       (osm_switch_t *) cl_qmap_end(&p_osm->subn.sw_guid_tbl)) {
+		unsigned hop_hist[IB_SUBNET_PATH_HOPS_MAX];
+		uint16_t max_lid_ho;
+		uint8_t hop_val;
+		uint16_t numHopBarsOverThd1 = 0;
+		uint16_t numHopBarsOverThd2 = 0;
+
+		p_sw = p_next_sw;
+		/* Roll to the next switch */
+		p_next_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
+
+		memset(hop_hist, 0, sizeof(hop_hist));
+
+		max_lid_ho = p_sw->max_lid_ho;
+		/* Get base lid of switch by retrieving port 0 lid of node pointer */
+		osm_log(&p_osm->log, OSM_LOG_DEBUG,
+			"__osm_updn_find_root_nodes_by_min_hop: "
+			"Passing through switch lid 0x%X\n",
+			cl_ntoh16(osm_node_get_base_lid(p_sw->p_node, 0)));
+		for (lid_ho = 1; lid_ho <= max_lid_ho; lid_ho++)
+			if (cas_per_sw[lid_ho]) {
+				hop_val =
+				    osm_switch_get_least_hops(p_sw, lid_ho);
+				if (hop_val >= IB_SUBNET_PATH_HOPS_MAX)
+					continue;
+
+				hop_hist[hop_val] += cas_per_sw[lid_ho];
+			}
+
+		/* Now recognize the spines by requiring one bar to be above 90% of the
+		   number of CAs and RTRs */
+		for (i = 0; i < IB_SUBNET_PATH_HOPS_MAX; i++) {
+			if (hop_hist[i] > thd1)
+				numHopBarsOverThd1++;
+			if (hop_hist[i] > thd2)
+				numHopBarsOverThd2++;
+		}
+
+		/* If thd conditions are valid insert the root node to the list */
+		if ((numHopBarsOverThd1 == 1) && (numHopBarsOverThd2 == 1)) {
+			p_guid = malloc(sizeof(uint64_t));
+			if (p_guid) {
+				*p_guid =
+				    cl_ntoh64(osm_node_get_node_guid
+					      (p_sw->p_node));
+				osm_log(&p_osm->log, OSM_LOG_DEBUG,
+					"__osm_updn_find_root_nodes_by_min_hop: "
+					"Inserting GUID 0x%" PRIx64
+					" as root node\n", *p_guid);
+				cl_list_insert_tail(p_root_nodes_list, p_guid);
+			} else {
+				osm_log(&p_osm->log, OSM_LOG_ERROR,
+					"__osm_updn_find_root_nodes_by_min_hop: ERR AA13: "
+					"No memory for p_guid\n");
+			}
+		}
+	}
+
+	free(cas_per_sw);
+	/* Now convert the cl_list to array */
+	__osm_updn_convert_list2array(p_updn);
+
+      _exit:
+	OSM_LOG_EXIT(&p_osm->log);
+	return;
 }
 
 /**********************************************************************
  **********************************************************************/
-static void
-__osm_updn_delete(
-  void *context )
+static void __osm_updn_delete(void *context)
 {
-  updn_t *p_updn = context;
+	updn_t *p_updn = context;
 
-  updn_destroy(p_updn);
+	updn_destroy(p_updn);
 }
 
-int
-osm_ucast_updn_setup(
-  osm_opensm_t *p_osm )
+int osm_ucast_updn_setup(osm_opensm_t * p_osm)
 {
-  updn_t *p_updn;
+	updn_t *p_updn;
 
-  p_updn = updn_construct(&p_osm->log);
-  if (!p_updn)
-    return -1;
+	p_updn = updn_construct(&p_osm->log);
+	if (!p_updn)
+		return -1;
 
-  p_osm->routing_engine.context = p_updn;
-  p_osm->routing_engine.delete = __osm_updn_delete;
-  p_osm->routing_engine.build_lid_matrices = __osm_updn_call;
+	p_osm->routing_engine.context = p_updn;
+	p_osm->routing_engine.delete = __osm_updn_delete;
+	p_osm->routing_engine.build_lid_matrices = __osm_updn_call;
 
-  if (updn_init(p_updn, p_osm) != IB_SUCCESS)
-    return -1;
+	if (updn_init(p_updn, p_osm) != IB_SUCCESS)
+		return -1;
 
-  if (!p_updn->auto_detect_root_nodes)
-    __osm_updn_convert_list2array(p_updn);
+	if (!p_updn->auto_detect_root_nodes)
+		__osm_updn_convert_list2array(p_updn);
 
-  return 0;
+	return 0;
 }
diff --git a/opensm/opensm/osm_vl_arb_rcv.c b/opensm/opensm/osm_vl_arb_rcv.c
index f487058..78f15d6 100644
--- a/opensm/opensm/osm_vl_arb_rcv.c
+++ b/opensm/opensm/osm_vl_arb_rcv.c
@@ -33,7 +33,6 @@
  *
  */
 
-
 /*
  * Abstract:
  *    Implementation of osm_vla_rcv_t.
@@ -48,7 +47,7 @@
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <iba/ib_types.h>
@@ -69,49 +68,43 @@
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_vla_rcv_construct(
-  IN osm_vla_rcv_t* const p_rcv )
+void osm_vla_rcv_construct(IN osm_vla_rcv_t * const p_rcv)
 {
-  memset( p_rcv, 0, sizeof(*p_rcv) );
+	memset(p_rcv, 0, sizeof(*p_rcv));
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_vla_rcv_destroy(
-  IN osm_vla_rcv_t* const p_rcv )
+void osm_vla_rcv_destroy(IN osm_vla_rcv_t * const p_rcv)
 {
-  CL_ASSERT( p_rcv );
+	CL_ASSERT(p_rcv);
 
-  OSM_LOG_ENTER( p_rcv->p_log, osm_vla_rcv_destroy );
+	OSM_LOG_ENTER(p_rcv->p_log, osm_vla_rcv_destroy);
 
-  OSM_LOG_EXIT( p_rcv->p_log );
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_vla_rcv_init(
-  IN osm_vla_rcv_t* const p_rcv,
-  IN osm_req_t* const p_req,
-  IN osm_subn_t* const p_subn,
-  IN osm_log_t* const p_log,
-  IN cl_plock_t* const p_lock )
+osm_vla_rcv_init(IN osm_vla_rcv_t * const p_rcv,
+		 IN osm_req_t * const p_req,
+		 IN osm_subn_t * const p_subn,
+		 IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
 {
-  ib_api_status_t status = IB_SUCCESS;
+	ib_api_status_t status = IB_SUCCESS;
 
-  OSM_LOG_ENTER( p_log, osm_vla_rcv_init );
+	OSM_LOG_ENTER(p_log, osm_vla_rcv_init);
 
-  osm_vla_rcv_construct( p_rcv );
+	osm_vla_rcv_construct(p_rcv);
 
-  p_rcv->p_log = p_log;
-  p_rcv->p_subn = p_subn;
-  p_rcv->p_lock = p_lock;
-  p_rcv->p_req = p_req;
+	p_rcv->p_log = p_log;
+	p_rcv->p_subn = p_subn;
+	p_rcv->p_lock = p_lock;
+	p_rcv->p_req = p_req;
 
-  OSM_LOG_EXIT( p_log );
-  return( status );
+	OSM_LOG_EXIT(p_log);
+	return (status);
 }
 
 /**********************************************************************
@@ -119,120 +112,103 @@ osm_vla_rcv_init(
 /*
  * WE MIGHT ONLY RECEIVE GET or SET responses
  */
-void
-osm_vla_rcv_process(
-  IN void *context,
-  IN void *data )
+void osm_vla_rcv_process(IN void *context, IN void *data)
 {
-  osm_vla_rcv_t *p_rcv = context;
-  osm_madw_t *p_madw = data;
-  ib_vl_arb_table_t *p_vla_tbl;
-  ib_smp_t *p_smp;
-  osm_port_t *p_port;
-  osm_physp_t *p_physp;
-  osm_node_t *p_node;
-  osm_vla_context_t *p_context;
-  ib_net64_t port_guid;
-  ib_net64_t node_guid;
-  uint8_t port_num, block_num;
-
-  CL_ASSERT( p_rcv );
-
-  OSM_LOG_ENTER( p_rcv->p_log, osm_vla_rcv_process );
-
-  CL_ASSERT( p_madw );
-
-  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 );
-
-  port_guid = p_context->port_guid;
-  node_guid = p_context->node_guid;
-
-  CL_ASSERT( p_smp->attr_id == IB_MAD_ATTR_VL_ARBITRATION );
-
-  cl_plock_excl_acquire( p_rcv->p_lock );
-  p_port = osm_get_port_by_guid( p_rcv->p_subn, port_guid );
-  if( !p_port )
-  {
-    cl_plock_release( p_rcv->p_lock );
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_vla_rcv_process: 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 ),
-             cl_ntoh64( node_guid ),
-             cl_ntoh64( p_smp->trans_id ) );
-    goto Exit;
-  }
-
-  p_node = p_port->p_node;
-  CL_ASSERT( p_node );
-
-  block_num = (uint8_t)(cl_ntoh32(p_smp->attr_mod) >> 16);
-  /* 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) & 0x000000FF);
-    p_physp = osm_node_get_physp_ptr( p_node, port_num );
-  }
-  else
-  {
-    p_physp = p_port->p_physp;
-    port_num = p_physp->port_num;
-  }
-
-  CL_ASSERT( p_physp );
-
-  /*
-    We do not mind if this is a result of a set or get - all we want is to update
-    the subnet.
-  */
-  if( osm_log_is_active( p_rcv->p_log, OSM_LOG_VERBOSE ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
-             "osm_vla_rcv_process: "
-             "Got GetResp(VLArb) 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 ) );
-  }
-
-  /*
-    Determine if we encountered a new Physical Port.
-    If so, Ignore it.
-  */
-  if( !osm_physp_is_valid( p_physp ) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_vla_rcv_process: "
-             "Got invalid port number 0x%X\n",
-             port_num );
-    goto Exit;
-  }
-
-  osm_dump_vl_arb_table( p_rcv->p_log,
-                         port_guid, block_num,
-                         port_num, p_vla_tbl,
-                         OSM_LOG_DEBUG );
-
-  if ( (block_num < 1) || (block_num > 4) )
-  {
-    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-             "osm_vla_rcv_process: "
-             "Got invalid block number 0x%X\n",
-             block_num );
-    goto Exit;
-  }
-  osm_physp_set_vla_tbl( p_physp, p_vla_tbl, block_num);
-
- Exit:
-  cl_plock_release( p_rcv->p_lock );
-
-  OSM_LOG_EXIT( p_rcv->p_log );
+	osm_vla_rcv_t *p_rcv = context;
+	osm_madw_t *p_madw = data;
+	ib_vl_arb_table_t *p_vla_tbl;
+	ib_smp_t *p_smp;
+	osm_port_t *p_port;
+	osm_physp_t *p_physp;
+	osm_node_t *p_node;
+	osm_vla_context_t *p_context;
+	ib_net64_t port_guid;
+	ib_net64_t node_guid;
+	uint8_t port_num, block_num;
+
+	CL_ASSERT(p_rcv);
+
+	OSM_LOG_ENTER(p_rcv->p_log, osm_vla_rcv_process);
+
+	CL_ASSERT(p_madw);
+
+	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);
+
+	port_guid = p_context->port_guid;
+	node_guid = p_context->node_guid;
+
+	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_VL_ARBITRATION);
+
+	cl_plock_excl_acquire(p_rcv->p_lock);
+	p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+	if (!p_port) {
+		cl_plock_release(p_rcv->p_lock);
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_vla_rcv_process: 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),
+			cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));
+		goto Exit;
+	}
+
+	p_node = p_port->p_node;
+	CL_ASSERT(p_node);
+
+	block_num = (uint8_t) (cl_ntoh32(p_smp->attr_mod) >> 16);
+	/* 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) & 0x000000FF);
+		p_physp = osm_node_get_physp_ptr(p_node, port_num);
+	} else {
+		p_physp = p_port->p_physp;
+		port_num = p_physp->port_num;
+	}
+
+	CL_ASSERT(p_physp);
+
+	/*
+	   We do not mind if this is a result of a set or get - all we want is to update
+	   the subnet.
+	 */
+	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_VERBOSE)) {
+		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			"osm_vla_rcv_process: "
+			"Got GetResp(VLArb) 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));
+	}
+
+	/*
+	   Determine if we encountered a new Physical Port.
+	   If so, Ignore it.
+	 */
+	if (!osm_physp_is_valid(p_physp)) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_vla_rcv_process: "
+			"Got invalid port number 0x%X\n", port_num);
+		goto Exit;
+	}
+
+	osm_dump_vl_arb_table(p_rcv->p_log,
+			      port_guid, block_num,
+			      port_num, p_vla_tbl, OSM_LOG_DEBUG);
+
+	if ((block_num < 1) || (block_num > 4)) {
+		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			"osm_vla_rcv_process: "
+			"Got invalid block number 0x%X\n", block_num);
+		goto Exit;
+	}
+	osm_physp_set_vla_tbl(p_physp, p_vla_tbl, block_num);
+
+      Exit:
+	cl_plock_release(p_rcv->p_lock);
+
+	OSM_LOG_EXIT(p_rcv->p_log);
 }
diff --git a/opensm/opensm/st.c b/opensm/opensm/st.c
index 6916e31..c5a2f53 100644
--- a/opensm/opensm/st.c
+++ b/opensm/opensm/st.c
@@ -33,12 +33,11 @@
  *
  */
 
-
 /* static   char  sccsid[] = "@(#) st.c 5.1 89/12/14 Crucible"; */
 
 #if HAVE_CONFIG_H
 #  include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif				/* HAVE_CONFIG_H */
 
 #include <stdio.h>
 #include <string.h>
@@ -51,10 +50,10 @@
 typedef struct st_table_entry st_table_entry;
 
 struct st_table_entry {
-  unsigned int hash;
-  st_data_t key;
-  st_data_t record;
-  st_table_entry *next;
+	unsigned int hash;
+	st_data_t key;
+	st_data_t record;
+	st_table_entry *next;
 };
 
 #define ST_DEFAULT_MAX_DENSITY 5
@@ -72,30 +71,28 @@ struct st_table_entry {
 static int numcmp(void *, void *);
 static st_ptr_t numhash(void *);
 static struct st_hash_type type_numhash = {
-  numcmp,
-  numhash,
+	numcmp,
+	numhash,
 };
 
-
 /* extern int strcmp(const char *, const char *); */
 static int strhash(const char *);
 
 static inline st_ptr_t st_strhash(void *key)
 {
-  return strhash((const char *)key);
+	return strhash((const char *)key);
 }
 
 static inline int st_strcmp(void *key1, void *key2)
 {
-   return strcmp((const char *)key1, (const char *)key2);
+	return strcmp((const char *)key1, (const char *)key2);
 }
 
 static struct st_hash_type type_strhash = {
-  st_strcmp,
-  st_strhash
+	st_strcmp,
+	st_strhash
 };
 
-
 #define xmalloc  malloc
 #define xcalloc  calloc
 #define xrealloc realloc
@@ -121,58 +118,57 @@ static void rehash(st_table *);
   Table of prime numbers 2^n+a, 2<=n<=30.
 */
 static long primes[] = {
-  8 + 3,
-  16 + 3,
-  32 + 5,
-  64 + 3,
-  128 + 3,
-  256 + 27,
-  512 + 9,
-  1024 + 9,
-  2048 + 5,
-  4096 + 3,
-  8192 + 27,
-  16384 + 43,
-  32768 + 3,
-  65536 + 45,
-  131072 + 29,
-  262144 + 3,
-  524288 + 21,
-  1048576 + 7,
-  2097152 + 17,
-  4194304 + 15,
-  8388608 + 9,
-  16777216 + 43,
-  33554432 + 35,
-  67108864 + 15,
-  134217728 + 29,
-  268435456 + 3,
-  536870912 + 11,
-  1073741824 + 85,
-  0
+	8 + 3,
+	16 + 3,
+	32 + 5,
+	64 + 3,
+	128 + 3,
+	256 + 27,
+	512 + 9,
+	1024 + 9,
+	2048 + 5,
+	4096 + 3,
+	8192 + 27,
+	16384 + 43,
+	32768 + 3,
+	65536 + 45,
+	131072 + 29,
+	262144 + 3,
+	524288 + 21,
+	1048576 + 7,
+	2097152 + 17,
+	4194304 + 15,
+	8388608 + 9,
+	16777216 + 43,
+	33554432 + 35,
+	67108864 + 15,
+	134217728 + 29,
+	268435456 + 3,
+	536870912 + 11,
+	1073741824 + 85,
+	0
 };
 
-static int
-new_size(int size)
+static int new_size(int size)
 {
-  int i;
+	int i;
 
 #if 0
-  for (i=3; i<31; i++) {
-    if ((1<<i) > size) return 1<<i;
-  }
-  return -1;
+	for (i = 3; i < 31; i++) {
+		if ((1 << i) > size)
+			return 1 << i;
+	}
+	return -1;
 #else
-  int newsize;
-
-  for (i = 0, newsize = MINSIZE;
-       i < sizeof(primes)/sizeof(primes[0]);
-       i++, newsize <<= 1)
-  {
-    if (newsize > size) return primes[i];
-  }
-  /* Ran out of polynomials */
-  return -1;         /* should raise exception */
+	int newsize;
+
+	for (i = 0, newsize = MINSIZE;
+	     i < sizeof(primes) / sizeof(primes[0]); i++, newsize <<= 1) {
+		if (newsize > size)
+			return primes[i];
+	}
+	/* Ran out of polynomials */
+	return -1;		/* should raise exception */
 #endif
 }
 
@@ -180,91 +176,82 @@ new_size(int size)
 static int collision = 0;
 static int init_st = 0;
 
-static void
-stat_col()
+static void stat_col()
 {
-  FILE *f = fopen("/var/log/osm_st_col", "w");
-  fprintf(f, "collision: %d\n", collision);
-  fclose(f);
+	FILE *f = fopen("/var/log/osm_st_col", "w");
+	fprintf(f, "collision: %d\n", collision);
+	fclose(f);
 }
 #endif
 
-st_table*
-st_init_table_with_size(type, size)
-     struct st_hash_type *type;
-     size_t size;
+st_table *st_init_table_with_size(type, size)
+struct st_hash_type *type;
+size_t size;
 {
-  st_table *tbl;
+	st_table *tbl;
 
 #ifdef HASH_LOG
-  if (init_st == 0)
-  {
-    init_st = 1;
-    atexit(stat_col);
-  }
+	if (init_st == 0) {
+		init_st = 1;
+		atexit(stat_col);
+	}
 #endif
 
-  size = new_size(size);   /* round up to prime number */
+	size = new_size(size);	/* round up to prime number */
 
-  tbl = alloc(st_table);
-  tbl->type = type;
-  tbl->num_entries = 0;
-  tbl->num_bins = size;
-  tbl->bins = (st_table_entry **)Calloc(size, sizeof(st_table_entry*));
+	tbl = alloc(st_table);
+	tbl->type = type;
+	tbl->num_entries = 0;
+	tbl->num_bins = size;
+	tbl->bins = (st_table_entry **) Calloc(size, sizeof(st_table_entry *));
 
-  return tbl;
+	return tbl;
 }
 
-st_table*
-st_init_table(type)
-     struct st_hash_type *type;
+st_table *st_init_table(type)
+struct st_hash_type *type;
 {
-  return st_init_table_with_size(type, 0);
+	return st_init_table_with_size(type, 0);
 }
 
-st_table*
-st_init_numtable(void)
+st_table *st_init_numtable(void)
 {
-  return st_init_table(&type_numhash);
+	return st_init_table(&type_numhash);
 }
 
-st_table*
-st_init_numtable_with_size(size)
-     size_t size;
+st_table *st_init_numtable_with_size(size)
+size_t size;
 {
-  return st_init_table_with_size(&type_numhash, size);
+	return st_init_table_with_size(&type_numhash, size);
 }
 
-st_table*
-st_init_strtable(void)
+st_table *st_init_strtable(void)
 {
-  return st_init_table(&type_strhash);
+	return st_init_table(&type_strhash);
 }
 
-st_table*
-st_init_strtable_with_size(size)
-     size_t size;
+st_table *st_init_strtable_with_size(size)
+size_t size;
 {
-  return st_init_table_with_size(&type_strhash, size);
+	return st_init_table_with_size(&type_strhash, size);
 }
 
-void
-st_free_table(table)
-     st_table *table;
+void st_free_table(table)
+st_table *table;
 {
-  register st_table_entry *ptr, *next;
-  int i;
-
-  for (i = 0; i < table->num_bins; i++) {
-    ptr = table->bins[i];
-    while (ptr != 0) {
-      next = ptr->next;
-      free(ptr);
-      ptr = next;
-    }
-  }
-  free(table->bins);
-  free(table);
+	register st_table_entry *ptr, *next;
+	int i;
+
+	for (i = 0; i < table->num_bins; i++) {
+		ptr = table->bins[i];
+		while (ptr != 0) {
+			next = ptr->next;
+			free(ptr);
+			ptr = next;
+		}
+	}
+	free(table->bins);
+	free(table);
 }
 
 #define PTR_NOT_EQUAL(table, ptr, hash_val, key) \
@@ -289,28 +276,24 @@ st_free_table(table)
   }\
 } while (0)
 
-int
-st_lookup(table, key, value)
-     st_table *table;
-     register st_data_t key;
-     st_data_t *value;
+int st_lookup(table, key, value)
+st_table *table;
+register st_data_t key;
+st_data_t *value;
 {
-  unsigned int hash_val, bin_pos;
-  register st_table_entry *ptr;
-
-  hash_val = do_hash(key, table);
-  FIND_ENTRY(table, ptr, hash_val, bin_pos);
-
-  if (ptr == 0)
-  {
-    return 0;
-  }
-  else
-  {
-    if (value != 0)
-      *value = ptr->record;
-    return 1;
-  }
+	unsigned int hash_val, bin_pos;
+	register st_table_entry *ptr;
+
+	hash_val = do_hash(key, table);
+	FIND_ENTRY(table, ptr, hash_val, bin_pos);
+
+	if (ptr == 0) {
+		return 0;
+	} else {
+		if (value != 0)
+			*value = ptr->record;
+		return 1;
+	}
 }
 
 #define ADD_DIRECT(table, key, value, hash_val, bin_pos)\
@@ -332,294 +315,274 @@ do {\
   table->num_entries++;\
 } while (0);
 
-
-int
-st_insert(table, key, value)
-     register st_table *table;
-     register st_data_t key;
-     st_data_t value;
+int st_insert(table, key, value)
+register st_table *table;
+register st_data_t key;
+st_data_t value;
 {
-  unsigned int hash_val, bin_pos;
-  register st_table_entry *ptr;
-
-  hash_val = do_hash(key, table);
-  FIND_ENTRY(table, ptr, hash_val, bin_pos);
-
-  if (ptr == 0)
-  {
-    ADD_DIRECT(table, key, value, hash_val, bin_pos);
-    return 0;
-  }
-  else
-  {
-    ptr->record = value;
-    return 1;
-  }
+	unsigned int hash_val, bin_pos;
+	register st_table_entry *ptr;
+
+	hash_val = do_hash(key, table);
+	FIND_ENTRY(table, ptr, hash_val, bin_pos);
+
+	if (ptr == 0) {
+		ADD_DIRECT(table, key, value, hash_val, bin_pos);
+		return 0;
+	} else {
+		ptr->record = value;
+		return 1;
+	}
 }
 
-void
-st_add_direct(table, key, value)
-     st_table *table;
-     st_data_t key;
-     st_data_t value;
+void st_add_direct(table, key, value)
+st_table *table;
+st_data_t key;
+st_data_t value;
 {
-  unsigned int hash_val, bin_pos;
+	unsigned int hash_val, bin_pos;
 
-  hash_val = do_hash(key, table);
-  bin_pos = hash_val % table->num_bins;
-  ADD_DIRECT(table, key, value, hash_val, bin_pos);
+	hash_val = do_hash(key, table);
+	bin_pos = hash_val % table->num_bins;
+	ADD_DIRECT(table, key, value, hash_val, bin_pos);
 }
 
-static void
-rehash(table)
-     register st_table *table;
+static void rehash(table)
+register st_table *table;
 {
-  register st_table_entry *ptr, *next, **new_bins;
-  int i, old_num_bins = table->num_bins, new_num_bins;
-  unsigned int hash_val;
-
-  new_num_bins = new_size(old_num_bins+1);
-  new_bins = (st_table_entry**)Calloc(new_num_bins, sizeof(st_table_entry*));
-
-  for (i = 0; i < old_num_bins; i++) {
-    ptr = table->bins[i];
-    while (ptr != 0) {
-      next = ptr->next;
-      hash_val = ptr->hash % new_num_bins;
-      ptr->next = new_bins[hash_val];
-      new_bins[hash_val] = ptr;
-      ptr = next;
-    }
-  }
-  free(table->bins);
-  table->num_bins = new_num_bins;
-  table->bins = new_bins;
+	register st_table_entry *ptr, *next, **new_bins;
+	int i, old_num_bins = table->num_bins, new_num_bins;
+	unsigned int hash_val;
+
+	new_num_bins = new_size(old_num_bins + 1);
+	new_bins =
+	    (st_table_entry **) Calloc(new_num_bins, sizeof(st_table_entry *));
+
+	for (i = 0; i < old_num_bins; i++) {
+		ptr = table->bins[i];
+		while (ptr != 0) {
+			next = ptr->next;
+			hash_val = ptr->hash % new_num_bins;
+			ptr->next = new_bins[hash_val];
+			new_bins[hash_val] = ptr;
+			ptr = next;
+		}
+	}
+	free(table->bins);
+	table->num_bins = new_num_bins;
+	table->bins = new_bins;
 }
 
-st_table*
-st_copy(old_table)
-     st_table *old_table;
+st_table *st_copy(old_table)
+st_table *old_table;
 {
-  st_table *new_table;
-  st_table_entry *ptr, *entry;
-  size_t i, num_bins = old_table->num_bins;
-
-  new_table = alloc(st_table);
-  if (new_table == 0)
-  {
-    return 0;
-  }
-
-  *new_table = *old_table;
-  new_table->bins = (st_table_entry**)
-    Calloc(num_bins, sizeof(st_table_entry*));
-
-  if (new_table->bins == 0)
-  {
-    free(new_table);
-    return 0;
-  }
-
-  for (i = 0; i < num_bins; i++) {
-    new_table->bins[i] = 0;
-    ptr = old_table->bins[i];
-    while (ptr != 0) {
-      entry = alloc(st_table_entry);
-      if (entry == 0)
-      {
-        free(new_table->bins);
-        free(new_table);
-        return 0;
-      }
-      *entry = *ptr;
-      entry->next = new_table->bins[i];
-      new_table->bins[i] = entry;
-      ptr = ptr->next;
-    }
-  }
-  return new_table;
+	st_table *new_table;
+	st_table_entry *ptr, *entry;
+	size_t i, num_bins = old_table->num_bins;
+
+	new_table = alloc(st_table);
+	if (new_table == 0) {
+		return 0;
+	}
+
+	*new_table = *old_table;
+	new_table->bins = (st_table_entry **)
+	    Calloc(num_bins, sizeof(st_table_entry *));
+
+	if (new_table->bins == 0) {
+		free(new_table);
+		return 0;
+	}
+
+	for (i = 0; i < num_bins; i++) {
+		new_table->bins[i] = 0;
+		ptr = old_table->bins[i];
+		while (ptr != 0) {
+			entry = alloc(st_table_entry);
+			if (entry == 0) {
+				free(new_table->bins);
+				free(new_table);
+				return 0;
+			}
+			*entry = *ptr;
+			entry->next = new_table->bins[i];
+			new_table->bins[i] = entry;
+			ptr = ptr->next;
+		}
+	}
+	return new_table;
 }
 
-int
-st_delete(table, key, value)
-     register st_table *table;
-     register st_data_t *key;
-     st_data_t *value;
+int st_delete(table, key, value)
+register st_table *table;
+register st_data_t *key;
+st_data_t *value;
 {
-  unsigned int hash_val;
-  st_table_entry *tmp;
-  register st_table_entry *ptr;
-
-  hash_val = do_hash_bin(*key, table);
-  ptr = table->bins[hash_val];
-
-  if (ptr == 0)
-  {
-    if (value != 0) *value = 0;
-    return 0;
-  }
-
-  if (EQUAL(table, *key, ptr->key))
-  {
-    table->bins[hash_val] = ptr->next;
-    table->num_entries--;
-    if (value != 0) *value = ptr->record;
-    *key = ptr->key;
-    free(ptr);
-    return 1;
-  }
-
-  for (; ptr->next != 0; ptr = ptr->next) {
-    if (EQUAL(table, ptr->next->key, *key))
-    {
-      tmp = ptr->next;
-      ptr->next = ptr->next->next;
-      table->num_entries--;
-      if (value != 0) *value = tmp->record;
-      *key = tmp->key;
-      free(tmp);
-      return 1;
-    }
-  }
-
-  return 0;
+	unsigned int hash_val;
+	st_table_entry *tmp;
+	register st_table_entry *ptr;
+
+	hash_val = do_hash_bin(*key, table);
+	ptr = table->bins[hash_val];
+
+	if (ptr == 0) {
+		if (value != 0)
+			*value = 0;
+		return 0;
+	}
+
+	if (EQUAL(table, *key, ptr->key)) {
+		table->bins[hash_val] = ptr->next;
+		table->num_entries--;
+		if (value != 0)
+			*value = ptr->record;
+		*key = ptr->key;
+		free(ptr);
+		return 1;
+	}
+
+	for (; ptr->next != 0; ptr = ptr->next) {
+		if (EQUAL(table, ptr->next->key, *key)) {
+			tmp = ptr->next;
+			ptr->next = ptr->next->next;
+			table->num_entries--;
+			if (value != 0)
+				*value = tmp->record;
+			*key = tmp->key;
+			free(tmp);
+			return 1;
+		}
+	}
+
+	return 0;
 }
 
-int
-st_delete_safe(table, key, value, never)
-     register st_table *table;
-     register st_data_t *key;
-     st_data_t *value;
-     st_data_t never;
+int st_delete_safe(table, key, value, never)
+register st_table *table;
+register st_data_t *key;
+st_data_t *value;
+st_data_t never;
 {
-  unsigned int hash_val;
-  register st_table_entry *ptr;
-
-  hash_val = do_hash_bin(*key, table);
-  ptr = table->bins[hash_val];
-
-  if (ptr == 0)
-  {
-    if (value != 0) *value = 0;
-    return 0;
-  }
-
-  for (; ptr != 0; ptr = ptr->next) {
-    if ((ptr->key != never) && EQUAL(table, ptr->key, *key))
-    {
-      table->num_entries--;
-      *key = ptr->key;
-      if (value != 0) *value = ptr->record;
-      ptr->key = ptr->record = never;
-      return 1;
-    }
-  }
-
-  return 0;
+	unsigned int hash_val;
+	register st_table_entry *ptr;
+
+	hash_val = do_hash_bin(*key, table);
+	ptr = table->bins[hash_val];
+
+	if (ptr == 0) {
+		if (value != 0)
+			*value = 0;
+		return 0;
+	}
+
+	for (; ptr != 0; ptr = ptr->next) {
+		if ((ptr->key != never) && EQUAL(table, ptr->key, *key)) {
+			table->num_entries--;
+			*key = ptr->key;
+			if (value != 0)
+				*value = ptr->record;
+			ptr->key = ptr->record = never;
+			return 1;
+		}
+	}
+
+	return 0;
 }
 
-static int
-delete_never(st_data_t key, st_data_t value, st_data_t never)
+static int delete_never(st_data_t key, st_data_t value, st_data_t never)
 {
-  if (value == never) return ST_DELETE;
-  return ST_CONTINUE;
+	if (value == never)
+		return ST_DELETE;
+	return ST_CONTINUE;
 }
 
-void
-st_cleanup_safe(table, never)
-     st_table *table;
-     st_data_t never;
+void st_cleanup_safe(table, never)
+st_table *table;
+st_data_t never;
 {
-  int num_entries = table->num_entries;
+	int num_entries = table->num_entries;
 
-  st_foreach(table, delete_never, never);
-  table->num_entries = num_entries;
+	st_foreach(table, delete_never, never);
+	table->num_entries = num_entries;
 }
 
-void
-st_foreach(table, func, arg)
-     st_table *table;
-     int (*func)(st_data_t key, st_data_t val, st_data_t arg);
-     st_data_t arg;
+void st_foreach(table, func, arg)
+st_table *table;
+int (*func) (st_data_t key, st_data_t val, st_data_t arg);
+st_data_t arg;
 {
-  st_table_entry *ptr, *last, *tmp;
-  enum st_retval retval;
-  int i;
-
-  for (i = 0; i < table->num_bins; i++) {
-    last = 0;
-    for (ptr = table->bins[i]; ptr != 0;) {
-      retval = (*func)(ptr->key, ptr->record, arg);
-      switch (retval) {
-      case ST_CONTINUE:
-        last = ptr;
-        ptr = ptr->next;
-        break;
-      case ST_STOP:
-        return;
-      case ST_DELETE:
-        tmp = ptr;
-        if (last == 0)
-        {
-          table->bins[i] = ptr->next;
-        }
-        else
-        {
-          last->next = ptr->next;
-        }
-        ptr = ptr->next;
-        free(tmp);
-        table->num_entries--;
-      }
-    }
-  }
+	st_table_entry *ptr, *last, *tmp;
+	enum st_retval retval;
+	int i;
+
+	for (i = 0; i < table->num_bins; i++) {
+		last = 0;
+		for (ptr = table->bins[i]; ptr != 0;) {
+			retval = (*func) (ptr->key, ptr->record, arg);
+			switch (retval) {
+			case ST_CONTINUE:
+				last = ptr;
+				ptr = ptr->next;
+				break;
+			case ST_STOP:
+				return;
+			case ST_DELETE:
+				tmp = ptr;
+				if (last == 0) {
+					table->bins[i] = ptr->next;
+				} else {
+					last->next = ptr->next;
+				}
+				ptr = ptr->next;
+				free(tmp);
+				table->num_entries--;
+			}
+		}
+	}
 }
 
-static int
-strhash(string)
-     register const char *string;
+static int strhash(string)
+register const char *string;
 {
-  register int c;
+	register int c;
 
 #ifdef HASH_ELFHASH
-  register unsigned int h = 0, g;
-
-  while ((c = *string++) != '\0') {
-    h = ( h << 4 ) + c;
-    if ( g = h & 0xF0000000 )
-      h ^= g >> 24;
-    h &= ~g;
-  }
-  return h;
+	register unsigned int h = 0, g;
+
+	while ((c = *string++) != '\0') {
+		h = (h << 4) + c;
+		if (g = h & 0xF0000000)
+			h ^= g >> 24;
+		h &= ~g;
+	}
+	return h;
 #elif HASH_PERL
-  register int val = 0;
+	register int val = 0;
 
-  while ((c = *string++) != '\0') {
-    val = val*33 + c;
-  }
+	while ((c = *string++) != '\0') {
+		val = val * 33 + c;
+	}
 
-  return val + (val>>5);
+	return val + (val >> 5);
 #else
-  register int val = 0;
+	register int val = 0;
 
-  while ((c = *string++) != '\0') {
-    val = val*997 + c;
-  }
+	while ((c = *string++) != '\0') {
+		val = val * 997 + c;
+	}
 
-  return val + (val>>5);
+	return val + (val >> 5);
 #endif
 }
 
-static int
-numcmp(x, y)
-     void *x, *y;
+static int numcmp(x, y)
+void *x, *y;
 {
-  return (st_ptr_t)x != (st_ptr_t)y;
+	return (st_ptr_t) x != (st_ptr_t) y;
 }
 
-static st_ptr_t
-numhash(n)
-     void *n;
+static st_ptr_t numhash(n)
+void *n;
 {
-  return (st_ptr_t)n;
+	return (st_ptr_t) n;
 }
-- 
1.5.3.rc2.38.g11308




More information about the general mailing list