Bug Fix:
[mirror/winof/.git] / ulp / opensm / user / opensm / osm_port_info_rcv.c
index 5ae9b7f..a460bf2 100644 (file)
@@ -83,7 +83,7 @@ __osm_pi_rcv_set_sm(
   {
     osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
              "__osm_pi_rcv_set_sm: "
-             "Setting 'IS_SM' bit in port attributes.\n" );
+             "Setting 'IS_SM' bit in port attributes\n" );
   }
 
   p_dr_path = osm_physp_get_dr_path_ptr( p_physp );
@@ -125,7 +125,7 @@ __osm_pi_rcv_process_endport(
       osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
                "__osm_pi_rcv_process_endport: "
                "Setting endport minimal MTU to:%u defined by port:0x%" 
-               PRIx64 ".\n",
+               PRIx64 "\n",
                mtu,
                cl_ntoh64( port_guid ) );
       p_rcv->p_subn->min_ca_mtu = mtu;
@@ -137,7 +137,7 @@ __osm_pi_rcv_process_endport(
       osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
                "__osm_pi_rcv_process_endport: "
                "Setting endport minimal rate to:%u defined by port:0x%" 
-               PRIx64 ".\n",
+               PRIx64 "\n",
                rate,
                cl_ntoh64( port_guid ) );
       p_rcv->p_subn->min_ca_rate = rate;
@@ -177,7 +177,7 @@ __osm_pi_rcv_process_endport(
       {
         osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
                  "__osm_pi_rcv_process_endport: "
-                 "Ignoring SM on port 0x%" PRIx64 ".\n",
+                 "Ignoring SM on port 0x%" PRIx64 "\n",
                  cl_ntoh64( port_guid ) );
       }
       else
@@ -187,12 +187,12 @@ __osm_pi_rcv_process_endport(
           osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
                    "__osm_pi_rcv_process_endport: "
                    "Detected another SM.  Requesting SMInfo."
-                   "\n\t\t\t\tPort 0x%" PRIx64 ".\n",
+                   "\n\t\t\t\tPort 0x%" PRIx64 "\n",
                    cl_ntoh64( port_guid ) );
         }
 
         /*
-          This port indicates it's an SM, and it's not our own port.
+          This port indicates it's an SM and it's not our own port.
           Acquire the SMInfo Attribute.
         */
         cl_memclr( &context, sizeof(context) );
@@ -208,7 +208,7 @@ __osm_pi_rcv_process_endport(
         {
           osm_log( p_rcv->p_log, OSM_LOG_ERROR,
                    "__osm_pi_rcv_process_endport: ERR 0F05: "
-                   "Failure requesting SMInfo (%s).\n",
+                   "Failure requesting SMInfo (%s)\n",
                    ib_get_err_str( status ) );
         }
       }
@@ -232,6 +232,7 @@ __osm_pi_rcv_process_switch_port(
   osm_madw_context_t context;
   osm_physp_t *p_remote_physp;
   osm_node_t *p_remote_node;
+  ib_net16_t orig_lid;
   uint8_t port_num;
   uint8_t remote_port_num;
   osm_dr_path_t path;
@@ -262,7 +263,7 @@ __osm_pi_rcv_process_switch_port(
                  "__osm_pi_rcv_process_switch_port: "
                  "Unlinking local node 0x%" PRIx64 ", port 0x%X"
                  "\n\t\t\t\tand remote node 0x%" PRIx64
-                 ", port 0x%X.\n",
+                 ", port 0x%X\n",
                  cl_ntoh64( osm_node_get_node_guid( p_node ) ),
                  port_num,
                  cl_ntoh64( osm_node_get_node_guid( p_remote_node ) ),
@@ -310,8 +311,8 @@ __osm_pi_rcv_process_switch_port(
         {
           osm_log( p_rcv->p_log, OSM_LOG_ERROR,
                    "__osm_pi_rcv_process_switch_port: ERR 0F02: "
-                   "Failure initiating NodeInfo request (%s).\n",
-                   ib_get_err_str(status));
+                   "Failure initiating NodeInfo request (%s)\n",
+                   ib_get_err_str(status) );
         }
       }
       else
@@ -320,7 +321,7 @@ __osm_pi_rcv_process_switch_port(
         {
           osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
                    "__osm_pi_rcv_process_switch_port: "
-                   "Skipping SMP responder port 0x%X.\n",
+                   "Skipping SMP responder port 0x%X\n",
                    p_pi->local_port_num );
         }
       }
@@ -329,8 +330,8 @@ __osm_pi_rcv_process_switch_port(
     default:
       osm_log( p_rcv->p_log, OSM_LOG_ERROR,
                "__osm_pi_rcv_process_switch_port: ERR 0F03: "
-               "Unknown link state = %u, port = 0x%X.\n",
-               osm_physp_get_port_state( p_physp ),
+               "Unknown link state = %u, port = 0x%X\n",
+               ib_port_info_get_port_state( p_pi ),
                p_pi->local_port_num );
       break;
     }
@@ -343,8 +344,13 @@ __osm_pi_rcv_process_switch_port(
 
   if (port_num == 0)
   {
-    /* This is a management port 0 */
-               __osm_pi_rcv_process_endport(p_rcv, p_physp, p_pi);
+       /* This is switch management port 0 */
+       if ( ( orig_lid = osm_physp_trim_base_lid_to_valid_range( p_physp ) ) )
+               osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+                        "__osm_pi_rcv_process_switch_port: ERR 0F04: "
+                        "Invalid base LID 0x%x corrected\n",
+                        cl_ntoh16( orig_lid ) );
+       __osm_pi_rcv_process_endport(p_rcv, p_physp, p_pi);
   }
 
   OSM_LOG_EXIT( p_rcv->p_log );
@@ -359,11 +365,18 @@ __osm_pi_rcv_process_ca_port(
   IN osm_physp_t* const p_physp,
   IN const ib_port_info_t* const p_pi )
 {
+  ib_net16_t orig_lid;
+
   OSM_LOG_ENTER( p_rcv->p_log, __osm_pi_rcv_process_ca_port );
 
   UNUSED_PARAM( p_node );
 
   osm_physp_set_port_info( p_physp, p_pi );
+  if ( (orig_lid = osm_physp_trim_base_lid_to_valid_range( p_physp ) ) )
+    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+            "__osm_pi_rcv_process_ca_port: ERR 0F08: "
+            "Invalid base LID 0x%x corrected\n",
+            cl_ntoh16 ( orig_lid ) );
 
   __osm_pi_rcv_process_endport(p_rcv, p_physp, p_pi);
 
@@ -379,6 +392,8 @@ __osm_pi_rcv_process_router_port(
   IN osm_physp_t* const p_physp,
   IN const ib_port_info_t* const p_pi )
 {
+  ib_net16_t orig_lid;
+
   OSM_LOG_ENTER( p_rcv->p_log, __osm_pi_rcv_process_router_port );
 
   UNUSED_PARAM( p_node );
@@ -387,10 +402,18 @@ __osm_pi_rcv_process_router_port(
     Update the PortInfo attribute.
   */
   osm_physp_set_port_info( p_physp, p_pi );
+  if ( (orig_lid = osm_physp_trim_base_lid_to_valid_range( p_physp ) ) )
+    osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+            "__osm_pi_rcv_process_router_port: ERR 0F09: "
+            "Invalid base LID 0x%x corrected\n",
+            cl_ntoh16 ( orig_lid) );
+
+  __osm_pi_rcv_process_endport(p_rcv, p_physp, p_pi);
 
   OSM_LOG_EXIT( p_rcv->p_log );
 }
 
+#define IBM_VENDOR_ID  (0x5076)
 /**********************************************************************
  **********************************************************************/
 void osm_pkey_get_tables(
@@ -423,7 +446,7 @@ void osm_pkey_get_tables(
   if (osm_node_get_type( p_node ) != IB_NODE_TYPE_SWITCH ||
       port_num == 0 )
   {
-    /* The maximum blocks is defined on the node info partition cap for CA, routers and
+    /* The maximum blocks is defined by the node info partition cap for CA, routers and
        switch management ports. */
     max_blocks = (cl_ntoh16(p_node->node_info.partition_cap)+IB_NUM_PKEY_ELEMENTS_IN_BLOCK -1)
       / IB_NUM_PKEY_ELEMENTS_IN_BLOCK ;
@@ -437,11 +460,20 @@ void osm_pkey_get_tables(
     if (! p_switch)
     {
       osm_log( p_log, OSM_LOG_ERROR,
-               "osm_physp_has_pkey: ERR 4A02: "
+               "osm_physp_has_pkey: ERR 0F11: "
                "Cannot find switch by guid: %" PRIx64 "\n",
                cl_ntoh64(p_node->node_info.node_guid) );
       goto Exit;
     }
+
+    /* Check for IBM eHCA firmware defect in reporting partition enforcement cap */
+    if (cl_ntoh32(ib_node_info_get_vendor_id(&p_node->node_info)) == IBM_VENDOR_ID)
+      p_switch->switch_info.enforce_cap = 0;
+
+    /* Bail out if this is a switch with no partition enforcement capability */
+    if (cl_ntoh16(p_switch->switch_info.enforce_cap) == 0)
+      goto Exit;
+
     max_blocks = (cl_ntoh16(p_switch->switch_info.enforce_cap)+IB_NUM_PKEY_ELEMENTS_IN_BLOCK -1)
       / IB_NUM_PKEY_ELEMENTS_IN_BLOCK ;
   }
@@ -462,8 +494,8 @@ void osm_pkey_get_tables(
     if( status != IB_SUCCESS )
     {
       osm_log( p_log, OSM_LOG_ERROR,
-               "osm_physp_has_pkey: ERR 4A03: "
-               "Failure initiating PkeyTable request (%s).\n",
+               "osm_physp_has_pkey: ERR 0F12: "
+               "Failure initiating PKeyTable request (%s)\n",
                ib_get_err_str(status));
       goto Exit;
     }
@@ -572,7 +604,7 @@ osm_pi_rcv_process_set(
   {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
              "osm_pi_rcv_process_set: ERR 0F10: "
-             "Received Error Status for SetResp()\n");
+             "Received error status for SetResp()\n");
     osm_dump_port_info(
       p_rcv->p_log,
       osm_node_get_node_guid( p_node ),
@@ -589,7 +621,7 @@ osm_pi_rcv_process_set(
              "Received logical SetResp() for GUID = 0x%" PRIx64
              ", port num = %u"
              "\n\t\t\t\tfor parent node GUID = 0x%" PRIx64
-             " TID = 0x%" PRIx64 ".\n",
+             " TID = 0x%" PRIx64 "\n",
              cl_ntoh64( port_guid ),
              port_num,
              cl_ntoh64( osm_node_get_node_guid( p_node ) ),
@@ -631,6 +663,17 @@ osm_pi_rcv_process(
   p_smp = osm_madw_get_smp_ptr( p_madw );
   p_context = osm_madw_get_pi_context_ptr( p_madw );
   p_pi = (ib_port_info_t*)ib_smp_get_payload_ptr( p_smp );
+
+  /* On receive of client reregister - clear the reregister bit - so
+     reregistering won't be sent again and again*/
+  if (ib_port_info_get_client_rereg(p_pi))
+  {
+         osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
+             "osm_pi_rcv_process: "
+             "client reregister received on response\n");
+         ib_port_info_set_client_rereg(p_pi,0);
+  }
+
   port_num = (uint8_t)cl_ntoh32( p_smp->attr_mod );
 
   port_guid = p_context->port_guid;
@@ -652,7 +695,7 @@ osm_pi_rcv_process(
     osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
              "osm_pi_rcv_process: "
              "Got light sweep response from remote port of parent node GUID = 0x%" PRIx64
-             " port = %u, Commencing heavy sweep.\n",
+             " port = %u, Commencing heavy sweep\n",
              cl_ntoh64( node_guid ),
              cl_ntoh64( port_guid ) );
     osm_state_mgr_process( p_rcv->p_state_mgr,
@@ -671,7 +714,7 @@ osm_pi_rcv_process(
              "osm_pi_rcv_process: ERR 0F06: "
              "No Port object for port with GUID = 0x%" PRIx64
              "\n\t\t\t\tfor parent node GUID = 0x%" PRIx64
-             ", TID = 0x%" PRIx64 ".\n",
+             ", TID = 0x%" PRIx64 "\n",
              cl_ntoh64( port_guid ),
              cl_ntoh64( node_guid ),
              cl_ntoh64( p_smp->trans_id ) );
@@ -680,7 +723,7 @@ osm_pi_rcv_process(
 
   /*
     If we were setting the PortInfo, then receiving
-    this attribute was not part of sweeping the subent.
+    this attribute was not part of sweeping the subnet.
     In this case, just update the PortInfo attribute.
 
     In an unfortunate blunder, the IB spec defines the
@@ -707,7 +750,7 @@ osm_pi_rcv_process(
                "osm_pi_rcv_process: "
                "Discovered port num %u with GUID = 0x%" PRIx64
                " for parent node GUID = 0x%" PRIx64
-               ", TID = 0x%" PRIx64 ".\n",
+               ", TID = 0x%" PRIx64 "\n",
                port_num,
                cl_ntoh64( port_guid ),
                cl_ntoh64( node_guid ),
@@ -722,7 +765,7 @@ osm_pi_rcv_process(
 
     /*
       Determine if we encountered a new Physical Port.
-      If so, initialize the new Physical Port  then
+      If so, initialize the new Physical Port then
       continue processing as normal.
     */
     if( !osm_physp_is_valid( p_physp ) )
@@ -731,7 +774,7 @@ osm_pi_rcv_process(
       {
         osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
                  "osm_pi_rcv_process: "
-                 "Initializing port number 0x%X.\n",
+                 "Initializing port number 0x%X\n",
                  port_num );
       }
 
@@ -762,7 +805,7 @@ osm_pi_rcv_process(
                         OSM_LOG_DEBUG );
 
     /*
-      Check if the update_sm_base_lid in the context is on TRUE.
+      Check if the update_sm_base_lid in the context is TRUE.
       If it is - then update the master_sm_base_lid of the variable
       in the subnet.
     */
@@ -794,7 +837,7 @@ osm_pi_rcv_process(
     default:
       osm_log( p_rcv->p_log, OSM_LOG_ERROR,
                "osm_pi_rcv_process: ERR 0F07: "
-               "Unknown node type %u with GUID = 0x%" PRIx64 ".\n",
+               "Unknown node type %u with GUID = 0x%" PRIx64 "\n",
                osm_node_get_type( p_node ),
                cl_ntoh64( node_guid ) );
       break;