Blame opensm/osm_sw_info_rcv.c

Packit 13e616
/*
Packit 13e616
 * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
Packit 13e616
 * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.
Packit 13e616
 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
Packit 13e616
 * Copyright (c) 2009 HNR Consulting. All rights reserved.
Packit 13e616
 *
Packit 13e616
 * This software is available to you under a choice of one of two
Packit 13e616
 * licenses.  You may choose to be licensed under the terms of the GNU
Packit 13e616
 * General Public License (GPL) Version 2, available from the file
Packit 13e616
 * COPYING in the main directory of this source tree, or the
Packit 13e616
 * OpenIB.org BSD license below:
Packit 13e616
 *
Packit 13e616
 *     Redistribution and use in source and binary forms, with or
Packit 13e616
 *     without modification, are permitted provided that the following
Packit 13e616
 *     conditions are met:
Packit 13e616
 *
Packit 13e616
 *      - Redistributions of source code must retain the above
Packit 13e616
 *        copyright notice, this list of conditions and the following
Packit 13e616
 *        disclaimer.
Packit 13e616
 *
Packit 13e616
 *      - Redistributions in binary form must reproduce the above
Packit 13e616
 *        copyright notice, this list of conditions and the following
Packit 13e616
 *        disclaimer in the documentation and/or other materials
Packit 13e616
 *        provided with the distribution.
Packit 13e616
 *
Packit 13e616
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Packit 13e616
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Packit 13e616
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Packit 13e616
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
Packit 13e616
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
Packit 13e616
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
Packit 13e616
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Packit 13e616
 * SOFTWARE.
Packit 13e616
 *
Packit 13e616
 */
Packit 13e616
Packit 13e616
/*
Packit 13e616
 * Abstract:
Packit 13e616
 *    Implementation of osm_si_rcv_t.
Packit 13e616
 * This object represents the SwitchInfo Receiver object.
Packit 13e616
 * This object is part of the opensm family of objects.
Packit 13e616
 */
Packit 13e616
Packit 13e616
#if HAVE_CONFIG_H
Packit 13e616
#  include <config.h>
Packit 13e616
#endif				/* HAVE_CONFIG_H */
Packit 13e616
Packit 13e616
#include <string.h>
Packit 13e616
#include <iba/ib_types.h>
Packit 13e616
#include <complib/cl_qmap.h>
Packit 13e616
#include <complib/cl_passivelock.h>
Packit 13e616
#include <complib/cl_debug.h>
Packit 13e616
#include <opensm/osm_file_ids.h>
Packit 13e616
#define FILE_ID OSM_FILE_SW_INFO_RCV_C
Packit 13e616
#include <opensm/osm_log.h>
Packit 13e616
#include <opensm/osm_switch.h>
Packit 13e616
#include <opensm/osm_subnet.h>
Packit 13e616
#include <opensm/osm_helper.h>
Packit 13e616
#include <opensm/osm_opensm.h>
Packit 13e616
Packit 13e616
#if 0
Packit 13e616
/**********************************************************************
Packit 13e616
 The plock must be held before calling this function.
Packit 13e616
**********************************************************************/
Packit 13e616
static void si_rcv_get_fwd_tbl(IN osm_sm_t * sm, IN osm_switch_t * p_sw)
Packit 13e616
{
Packit 13e616
	osm_madw_context_t context;
Packit 13e616
	osm_dr_path_t *p_dr_path;
Packit 13e616
	osm_physp_t *p_physp;
Packit 13e616
	osm_node_t *p_node;
Packit 13e616
	uint32_t block_id_ho;
Packit 13e616
	uint32_t max_block_id_ho;
Packit 13e616
	ib_api_status_t status = IB_SUCCESS;
Packit 13e616
Packit 13e616
	OSM_LOG_ENTER(sm->p_log);
Packit 13e616
Packit 13e616
	CL_ASSERT(p_sw);
Packit 13e616
Packit 13e616
	p_node = p_sw->p_node;
Packit 13e616
Packit 13e616
	CL_ASSERT(osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH);
Packit 13e616
Packit 13e616
	context.lft_context.node_guid = osm_node_get_node_guid(p_node);
Packit 13e616
	context.lft_context.set_method = FALSE;
Packit 13e616
Packit 13e616
	max_block_id_ho = osm_switch_get_max_block_id_in_use(p_sw);
Packit 13e616
Packit 13e616
	p_physp = osm_node_get_physp_ptr(p_node, 0);
Packit 13e616
	p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
Packit 13e616
Packit 13e616
	for (block_id_ho = 0; block_id_ho <= max_block_id_ho; block_id_ho++) {
Packit 13e616
		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
Packit 13e616
			"Retrieving FT block %u\n", block_id_ho);
Packit 13e616
Packit 13e616
		status = osm_req_get(sm, p_dr_path, IB_MAD_ATTR_LIN_FWD_TBL,
Packit 13e616
				     cl_hton32(block_id_ho), TRUE, 0,
Packit 13e616
				     0, CL_DISP_MSGID_NONE, &context);
Packit 13e616
		if (status != IB_SUCCESS)
Packit 13e616
			/* continue the loop despite the error */
Packit 13e616
			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3603: "
Packit 13e616
				"Failure initiating PortInfo request (%s)\n",
Packit 13e616
				ib_get_err_str(status));
Packit 13e616
	}
Packit 13e616
Packit 13e616
	OSM_LOG_EXIT(sm->p_log);
Packit 13e616
}
Packit 13e616
Packit 13e616
/**********************************************************************
Packit 13e616
 The plock must be held before calling this function.
Packit 13e616
**********************************************************************/
Packit 13e616
static void si_rcv_get_mcast_fwd_tbl(IN osm_sm_t * sm, IN osm_switch_t * p_sw)
Packit 13e616
{
Packit 13e616
	osm_madw_context_t context;
Packit 13e616
	osm_dr_path_t *p_dr_path;
Packit 13e616
	osm_physp_t *p_physp;
Packit 13e616
	osm_node_t *p_node;
Packit 13e616
	osm_mcast_tbl_t *p_tbl;
Packit 13e616
	uint32_t block_id_ho;
Packit 13e616
	uint32_t max_block_id_ho;
Packit 13e616
	uint32_t position;
Packit 13e616
	uint32_t max_position;
Packit 13e616
	uint32_t attr_mod_ho;
Packit 13e616
	ib_api_status_t status = IB_SUCCESS;
Packit 13e616
Packit 13e616
	OSM_LOG_ENTER(sm->p_log);
Packit 13e616
Packit 13e616
	CL_ASSERT(p_sw);
Packit 13e616
Packit 13e616
	p_node = p_sw->p_node;
Packit 13e616
Packit 13e616
	CL_ASSERT(osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH);
Packit 13e616
Packit 13e616
	if (osm_switch_get_mcast_fwd_tbl_size(p_sw) == 0) {
Packit 13e616
		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
Packit 13e616
			"Multicast not supported by switch 0x%016" PRIx64 "\n",
Packit 13e616
			cl_ntoh64(osm_node_get_node_guid(p_node)));
Packit 13e616
		goto Exit;
Packit 13e616
	}
Packit 13e616
Packit 13e616
	context.mft_context.node_guid = osm_node_get_node_guid(p_node);
Packit 13e616
	context.mft_context.set_method = FALSE;
Packit 13e616
Packit 13e616
	p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
Packit 13e616
	max_block_id_ho = osm_mcast_tbl_get_max_block(p_tbl);
Packit 13e616
Packit 13e616
	if (max_block_id_ho > IB_MCAST_MAX_BLOCK_ID) {
Packit 13e616
		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3609: "
Packit 13e616
			"Out-of-range mcast block size = %u on switch 0x%016"
Packit 13e616
			PRIx64 "\n", max_block_id_ho,
Packit 13e616
			cl_ntoh64(osm_node_get_node_guid(p_node)));
Packit 13e616
		goto Exit;
Packit 13e616
	}
Packit 13e616
Packit 13e616
	max_position = osm_mcast_tbl_get_max_position(p_tbl);
Packit 13e616
Packit 13e616
	CL_ASSERT(max_position <= IB_MCAST_POSITION_MAX);
Packit 13e616
Packit 13e616
	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
Packit 13e616
		"Max MFT block = %u, Max position = %u\n", max_block_id_ho,
Packit 13e616
		max_position);
Packit 13e616
Packit 13e616
	p_physp = osm_node_get_physp_ptr(p_node, 0);
Packit 13e616
	p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
Packit 13e616
Packit 13e616
	for (block_id_ho = 0; block_id_ho <= max_block_id_ho; block_id_ho++) {
Packit 13e616
		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
Packit 13e616
			"Retrieving MFT block %u\n", block_id_ho);
Packit 13e616
Packit 13e616
		for (position = 0; position <= max_position; position++) {
Packit 13e616
			OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
Packit 13e616
				"Retrieving MFT position %u\n", position);
Packit 13e616
Packit 13e616
			attr_mod_ho =
Packit 13e616
			    block_id_ho | position << IB_MCAST_POSITION_SHIFT;
Packit 13e616
			status =
Packit 13e616
			    osm_req_get(sm, p_dr_path,
Packit 13e616
					IB_MAD_ATTR_MCAST_FWD_TBL,
Packit 13e616
					cl_hton32(attr_mod_ho), TRUE, 0,
Packit 13e616
					0, CL_DISP_MSGID_NONE, &context);
Packit 13e616
			if (status != IB_SUCCESS)
Packit 13e616
				/* continue the loop despite the error */
Packit 13e616
				OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3607: "
Packit 13e616
					"Failure initiating PortInfo request (%s)\n",
Packit 13e616
					ib_get_err_str(status));
Packit 13e616
		}
Packit 13e616
	}
Packit 13e616
Packit 13e616
Exit:
Packit 13e616
	OSM_LOG_EXIT(sm->p_log);
Packit 13e616
}
Packit 13e616
#endif
Packit 13e616
Packit 13e616
/**********************************************************************
Packit 13e616
   Lock must be held on entry to this function.
Packit 13e616
**********************************************************************/
Packit 13e616
static void si_rcv_process_new(IN osm_sm_t * sm, IN osm_node_t * p_node,
Packit 13e616
			       IN const osm_madw_t * p_madw)
Packit 13e616
{
Packit 13e616
	osm_switch_t *p_sw;
Packit 13e616
	osm_switch_t *p_check;
Packit 13e616
	ib_switch_info_t *p_si;
Packit 13e616
	ib_smp_t *p_smp;
Packit 13e616
	cl_qmap_t *p_sw_guid_tbl;
Packit 13e616
Packit 13e616
	CL_ASSERT(sm);
Packit 13e616
Packit 13e616
	OSM_LOG_ENTER(sm->p_log);
Packit 13e616
Packit 13e616
	CL_ASSERT(p_madw);
Packit 13e616
Packit 13e616
	p_sw_guid_tbl = &sm->p_subn->sw_guid_tbl;
Packit 13e616
	p_smp = osm_madw_get_smp_ptr(p_madw);
Packit 13e616
	p_si = ib_smp_get_payload_ptr(p_smp);
Packit 13e616
Packit 13e616
	osm_dump_switch_info_v2(sm->p_log, p_si, FILE_ID, OSM_LOG_DEBUG);
Packit 13e616
Packit 13e616
	p_sw = osm_switch_new(p_node, p_madw);
Packit 13e616
	if (p_sw == NULL) {
Packit 13e616
		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3608: "
Packit 13e616
			"Unable to allocate new switch object\n");
Packit 13e616
		goto Exit;
Packit 13e616
	}
Packit 13e616
Packit 13e616
	/* set subnet max mlid to the minimum MulticastFDBCap of all switches */
Packit 13e616
	if (p_si->mcast_cap &&
Packit 13e616
	    cl_ntoh16(p_si->mcast_cap) + IB_LID_MCAST_START_HO - 1 <
Packit 13e616
	    sm->p_subn->max_mcast_lid_ho) {
Packit 13e616
		sm->p_subn->max_mcast_lid_ho = cl_ntoh16(p_si->mcast_cap) +
Packit 13e616
			IB_LID_MCAST_START_HO - 1;
Packit 13e616
		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
Packit 13e616
			"Subnet max multicast lid is 0x%X\n",
Packit 13e616
			sm->p_subn->max_mcast_lid_ho);
Packit 13e616
	}
Packit 13e616
Packit 13e616
	/* set subnet max unicast lid to the minimum LinearFDBCap of all switches */
Packit 13e616
	if (cl_ntoh16(p_si->lin_cap) < sm->p_subn->max_ucast_lid_ho) {
Packit 13e616
		sm->p_subn->max_ucast_lid_ho = cl_ntoh16(p_si->lin_cap);
Packit 13e616
		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
Packit 13e616
			"Subnet max unicast lid is 0x%X\n",
Packit 13e616
			sm->p_subn->max_ucast_lid_ho);
Packit 13e616
	}
Packit 13e616
Packit 13e616
	p_check = (osm_switch_t *) cl_qmap_insert(p_sw_guid_tbl,
Packit 13e616
						  osm_node_get_node_guid
Packit 13e616
						  (p_node), &p_sw->map_item);
Packit 13e616
	if (p_check != p_sw) {
Packit 13e616
		/* This shouldn't happen since we hold the lock! */
Packit 13e616
		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3605: "
Packit 13e616
			"Unable to add new switch object to database\n");
Packit 13e616
		osm_switch_delete(&p_sw);
Packit 13e616
		goto Exit;
Packit 13e616
	}
Packit 13e616
Packit 13e616
	p_node->sw = p_sw;
Packit 13e616
Packit 13e616
	/* Update the switch info according to the info we just received. */
Packit 13e616
	osm_switch_set_switch_info(p_sw, p_si);
Packit 13e616
Packit 13e616
#if 0
Packit 13e616
	/* Don't bother retrieving the current unicast and multicast tables
Packit 13e616
	   from the switches.  The current version of SM does
Packit 13e616
	   not support silent take-over of an existing multicast
Packit 13e616
	   configuration.
Packit 13e616
Packit 13e616
	   Gathering the multicast tables can also generate large amounts
Packit 13e616
	   of extra subnet-init traffic.
Packit 13e616
Packit 13e616
	   The code to retrieve the tables was fully debugged. */
Packit 13e616
Packit 13e616
	si_rcv_get_fwd_tbl(sm, p_sw);
Packit 13e616
	if (!sm->p_subn->opt.disable_multicast)
Packit 13e616
		si_rcv_get_mcast_fwd_tbl(sm, p_sw);
Packit 13e616
#endif
Packit 13e616
Packit 13e616
Exit:
Packit 13e616
	OSM_LOG_EXIT(sm->p_log);
Packit 13e616
}
Packit 13e616
Packit 13e616
/**********************************************************************
Packit 13e616
   Lock must be held on entry to this function.
Packit 13e616
   Return 1 if the caller is expected to send a change_detected event.
Packit 13e616
   this can not be done internally as the event needs the lock...
Packit 13e616
**********************************************************************/
Packit 13e616
static boolean_t si_rcv_process_existing(IN osm_sm_t * sm,
Packit 13e616
					 IN osm_node_t * p_node,
Packit 13e616
					 IN const osm_madw_t * p_madw)
Packit 13e616
{
Packit 13e616
	osm_switch_t *p_sw = p_node->sw;
Packit 13e616
	ib_switch_info_t *p_si;
Packit 13e616
	osm_si_context_t *p_si_context;
Packit 13e616
	ib_smp_t *p_smp;
Packit 13e616
	osm_epi_lft_change_event_t lft_change;
Packit 13e616
	boolean_t is_change_detected = FALSE;
Packit 13e616
Packit 13e616
	OSM_LOG_ENTER(sm->p_log);
Packit 13e616
Packit 13e616
	CL_ASSERT(p_madw);
Packit 13e616
Packit 13e616
	p_smp = osm_madw_get_smp_ptr(p_madw);
Packit 13e616
	p_si = ib_smp_get_payload_ptr(p_smp);
Packit 13e616
	p_si_context = osm_madw_get_si_context_ptr(p_madw);
Packit 13e616
Packit 13e616
	OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Received logical %cetResp()\n",
Packit 13e616
		p_si_context->set_method ? 'S' : 'G');
Packit 13e616
Packit 13e616
	osm_switch_set_switch_info(p_sw, p_si);
Packit 13e616
Packit 13e616
	if (p_si_context->light_sweep == TRUE && !p_si_context->set_method) {
Packit 13e616
		/* If state changed bit is on the mad was returned with an
Packit 13e616
		   error - signal a change to the state manager. */
Packit 13e616
		if (ib_smp_get_status(p_smp) != 0) {
Packit 13e616
			OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
Packit 13e616
				"GetResp() received with error in light sweep. "
Packit 13e616
				"Commencing heavy sweep\n");
Packit 13e616
			is_change_detected = TRUE;
Packit 13e616
		} else if (ib_switch_info_get_state_change(p_si)) {
Packit 13e616
			osm_dump_switch_info_v2(sm->p_log, p_si, FILE_ID, OSM_LOG_DEBUG);
Packit 13e616
			is_change_detected = TRUE;
Packit 13e616
		}
Packit 13e616
	}
Packit 13e616
Packit 13e616
	if (sm->p_subn->first_time_master_sweep == FALSE &&
Packit 13e616
	    p_si_context->set_method && p_si_context->lft_top_change) {
Packit 13e616
		lft_change.p_sw = p_sw;
Packit 13e616
		lft_change.flags = LFT_CHANGED_LFT_TOP;
Packit 13e616
		lft_change.lft_top = cl_ntoh16(p_si->lin_top);
Packit 13e616
		lft_change.block_num = 0;
Packit 13e616
		osm_opensm_report_event(sm->p_subn->p_osm,
Packit 13e616
					OSM_EVENT_ID_LFT_CHANGE,
Packit 13e616
					&lft_change);
Packit 13e616
	}
Packit 13e616
Packit 13e616
	OSM_LOG_EXIT(sm->p_log);
Packit 13e616
	return is_change_detected;
Packit 13e616
}
Packit 13e616
Packit 13e616
static void si_rcv_get_sp0_info(IN osm_sm_t * sm, IN osm_node_t * node)
Packit 13e616
{
Packit 13e616
	osm_madw_context_t context;
Packit 13e616
	osm_physp_t *physp;
Packit 13e616
	ib_api_status_t status;
Packit 13e616
	int mlnx_epi_supported = 0;
Packit 13e616
Packit 13e616
	physp = osm_node_get_physp_ptr(node, 0);
Packit 13e616
Packit 13e616
	context.pi_context.node_guid = osm_node_get_node_guid(node);
Packit 13e616
	context.pi_context.port_guid = osm_physp_get_port_guid(physp);
Packit 13e616
	context.pi_context.set_method = FALSE;
Packit 13e616
	context.pi_context.light_sweep = FALSE;
Packit 13e616
	context.pi_context.active_transition = FALSE;
Packit 13e616
	context.pi_context.client_rereg = FALSE;
Packit 13e616
Packit 13e616
	status = osm_req_get(sm, osm_physp_get_dr_path_ptr(physp),
Packit 13e616
			     IB_MAD_ATTR_PORT_INFO, 0, TRUE, 0,
Packit 13e616
			     0, CL_DISP_MSGID_NONE, &context);
Packit 13e616
	if (status != IB_SUCCESS)
Packit 13e616
		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3611: "
Packit 13e616
			"Failure initiating PortInfo request (%s)\n",
Packit 13e616
			ib_get_err_str(status));
Packit 13e616
Packit 13e616
	if (ib_switch_info_is_enhanced_port0(&node->sw->switch_info) &&
Packit 13e616
	    sm->p_subn->opt.fdr10) {
Packit 13e616
		mlnx_epi_supported = is_mlnx_ext_port_info_supported(
Packit 13e616
						ib_node_info_get_vendor_id(&node->node_info),
Packit 13e616
						node->node_info.device_id);
Packit 13e616
		if (mlnx_epi_supported) {
Packit 13e616
			status = osm_req_get(sm,
Packit 13e616
					     osm_physp_get_dr_path_ptr(physp),
Packit 13e616
					     IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO,
Packit 13e616
					     0, TRUE, 0, 0,
Packit 13e616
					     CL_DISP_MSGID_NONE, &context);
Packit 13e616
			if (status != IB_SUCCESS)
Packit 13e616
				OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3616: "
Packit 13e616
					"Failure initiating MLNX ExtPortInfo request (%s)\n",
Packit 13e616
					ib_get_err_str(status));
Packit 13e616
		}
Packit 13e616
	}
Packit 13e616
Packit 13e616
}
Packit 13e616
Packit 13e616
void osm_si_rcv_process(IN void *context, IN void *data)
Packit 13e616
{
Packit 13e616
	osm_sm_t *sm = context;
Packit 13e616
	osm_madw_t *p_madw = data;
Packit 13e616
	ib_switch_info_t *p_si;
Packit 13e616
	ib_smp_t *p_smp;
Packit 13e616
	osm_node_t *p_node;
Packit 13e616
	ib_net64_t node_guid;
Packit 13e616
	osm_si_context_t *p_context;
Packit 13e616
Packit 13e616
	CL_ASSERT(sm);
Packit 13e616
Packit 13e616
	OSM_LOG_ENTER(sm->p_log);
Packit 13e616
Packit 13e616
	CL_ASSERT(p_madw);
Packit 13e616
Packit 13e616
	p_smp = osm_madw_get_smp_ptr(p_madw);
Packit 13e616
	p_si = ib_smp_get_payload_ptr(p_smp);
Packit 13e616
	p_context = osm_madw_get_si_context_ptr(p_madw);
Packit 13e616
	node_guid = p_context->node_guid;
Packit 13e616
Packit 13e616
	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
Packit 13e616
		"Switch GUID 0x%016" PRIx64 ", TID 0x%" PRIx64 "\n",
Packit 13e616
		cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));
Packit 13e616
Packit 13e616
	if (ib_smp_get_status(p_smp)) {
Packit 13e616
		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
Packit 13e616
			"MAD status 0x%x received\n",
Packit 13e616
			cl_ntoh16(ib_smp_get_status(p_smp)));
Packit 13e616
		goto Exit2;
Packit 13e616
	}
Packit 13e616
Packit 13e616
	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
Packit 13e616
Packit 13e616
	p_node = osm_get_node_by_guid(sm->p_subn, node_guid);
Packit 13e616
	if (!p_node) {
Packit 13e616
		CL_PLOCK_RELEASE(sm->p_lock);
Packit 13e616
		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3606: "
Packit 13e616
			"SwitchInfo received for nonexistent node "
Packit 13e616
			"with GUID 0x%" PRIx64 "\n", cl_ntoh64(node_guid));
Packit 13e616
		goto Exit;
Packit 13e616
	}
Packit 13e616
Packit 13e616
	/* Hack for bad value in Mellanox switch */
Packit 13e616
	if (cl_ntoh16(p_si->lin_top) > IB_LID_UCAST_END_HO) {
Packit 13e616
		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3610: "
Packit 13e616
			"\n\t\t\t\tBad LinearFDBTop value = 0x%X "
Packit 13e616
			"on switch 0x%" PRIx64
Packit 13e616
			"\n\t\t\t\tForcing internal correction to 0x%X\n",
Packit 13e616
			cl_ntoh16(p_si->lin_top),
Packit 13e616
			cl_ntoh64(osm_node_get_node_guid(p_node)), 0);
Packit 13e616
		p_si->lin_top = 0;
Packit 13e616
	}
Packit 13e616
Packit 13e616
	/* Acquire the switch object for this switch. */
Packit 13e616
	if (!p_node->sw) {
Packit 13e616
		si_rcv_process_new(sm, p_node, p_madw);
Packit 13e616
		/* A new switch was found during the sweep so we need
Packit 13e616
		   to ignore the current LFT settings. */
Packit 13e616
		sm->p_subn->ignore_existing_lfts = TRUE;
Packit 13e616
	} else if (si_rcv_process_existing(sm, p_node, p_madw))
Packit 13e616
		/* we might get back a request for signaling change was detected */
Packit 13e616
		sm->p_subn->force_heavy_sweep = TRUE;
Packit 13e616
Packit 13e616
	if (p_context->light_sweep || p_context->set_method)
Packit 13e616
		goto Exit;
Packit 13e616
Packit 13e616
	si_rcv_get_sp0_info(sm, p_node);
Packit 13e616
Packit 13e616
Exit:
Packit 13e616
	CL_PLOCK_RELEASE(sm->p_lock);
Packit 13e616
Exit2:
Packit 13e616
	OSM_LOG_EXIT(sm->p_log);
Packit 13e616
}