From patchwork Tue Dec 29 16:29:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 70110 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBTGQHqN008074 for ; Tue, 29 Dec 2009 16:26:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752539AbZL2Q0Q (ORCPT ); Tue, 29 Dec 2009 11:26:16 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752594AbZL2Q0Q (ORCPT ); Tue, 29 Dec 2009 11:26:16 -0500 Received: from mail-ew0-f219.google.com ([209.85.219.219]:37198 "EHLO mail-ew0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752539AbZL2Q0N (ORCPT ); Tue, 29 Dec 2009 11:26:13 -0500 Received: by ewy19 with SMTP id 19so2858876ewy.21 for ; Tue, 29 Dec 2009 08:26:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received:date:from:to :cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=7qLR4AaIXtvrO+As3SOnPsy5Dj76P0kPOTic92NyLwI=; b=AeianuouBxqpv0/TYz57chrq5aMz/I4lDMJ57W/jbF6r70x/C+SoFKhWp4rqaRCCAE YPXTerNb6ssYliEn38tybqMmSLhSoscKEvJ3/9rh6mlR3COFE/xvYOYdgTCq1xVwNsSO 8kFFrylxsSiK1zpIbfoC1izy9GHHGVK55EnRM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=uCsmigu/Z0hGjmxBtk3KEN9oFxCO++Q/W7S0fYzXyNCSnZ2ddVRdc/zNjag9+OQN3L W9C/jC3IXCCvKnNsHKAfQ9ZGR0nKMRIGFino4QEa8n0MLi2vNy08c2SPgbu22+VnED+4 7vfjYYoVK1S/wxbNccx2Gf4rIgileoVdBm14c= Received: by 10.213.2.67 with SMTP id 3mr17191192ebi.77.1262103971443; Tue, 29 Dec 2009 08:26:11 -0800 (PST) Received: from me.localdomain (85.64.35.106.dynamic.barak-online.net [85.64.35.106]) by mx.google.com with ESMTPS id 5sm26315045eyh.24.2009.12.29.08.26.08 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 29 Dec 2009 08:26:09 -0800 (PST) Received: by me.localdomain (Postfix, from userid 1000) id 3593211DF8; Tue, 29 Dec 2009 18:29:12 +0200 (IST) Date: Tue, 29 Dec 2009 18:29:12 +0200 From: Sasha Khapyorsky To: Hal Rosenstock Cc: linux-rdma@vger.kernel.org Subject: Re: [PATCHv3] opensm: Add support for optimized SLtoVLMappingTable programming Message-ID: <20091229162912.GY26940@me> References: <20091201194110.GA26753@comcast.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091201194110.GA26753@comcast.net> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/opensm/opensm/osm_slvl_map_rcv.c b/opensm/opensm/osm_slvl_map_rcv.c index 7ca0b8f..73c6253 100644 --- a/opensm/opensm/osm_slvl_map_rcv.c +++ b/opensm/opensm/osm_slvl_map_rcv.c @@ -72,8 +72,8 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data) ib_net64_t port_guid; ib_net64_t node_guid; uint32_t attr_mod; - uint8_t out_port_num, in_port_num, startinport, startoutport, - endinport, endoutport; + uint8_t startinport, endinport, startoutport, endoutport; + uint8_t in_port, out_port; CL_ASSERT(sm); @@ -109,80 +109,51 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data) if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH) { unsigned num_ports = osm_node_get_num_physp(p_node) - 1; attr_mod = cl_ntoh32(p_smp->attr_mod); - out_port_num = attr_mod & 0xff; - in_port_num = (attr_mod >> 8) & 0xff; - if (in_port_num > num_ports || out_port_num > num_ports) { + + if (attr_mod & 0x10000) { + startoutport = ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) ? 0 : 1; + endoutport = osm_node_get_num_physp(p_node) - 1; + } else + startoutport = endoutport = attr_mod & 0xff; + + if (attr_mod & 0x20000) { + startinport = ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) ? 0 : 1; + endinport = osm_node_get_num_physp(p_node) - 1; + } else + startinport = endinport = (attr_mod >> 8) & 0xff; + + if (startinport > num_ports || startoutport > num_ports) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2C07" "Invalid attribute modifier 0x%x reveived in" " response from switch 0x%" PRIx64 "\n", - cl_ntoh32(p_smp->attr_mod), - cl_ntoh64(node_guid)); + cl_ntoh32(attr_mod), cl_ntoh64(node_guid)); goto Exit; } - if (attr_mod & 0x30000) - goto opt_sl2vl; - 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; - } - /* - We do not care if this is a result of a set or get - - all we want is to update the subnet. - */ - OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, - "Received SLtoVL GetResp in_port_num %u out_port_num %u with " - "GUID 0x%" PRIx64 " for parent node GUID 0x%" PRIx64 ", TID 0x%" - PRIx64 "\n", in_port_num, out_port_num, cl_ntoh64(port_guid), - cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id)); - - /* - Determine if we encountered a new Physical Port. - If so, Ignore it. - */ - if (!p_physp) { - OSM_LOG(sm->p_log, OSM_LOG_ERROR, - "Got invalid port number %u\n", out_port_num); - goto Exit; + } else { + startoutport = endoutport = p_port->p_physp->port_num; + startinport = endinport = 0; } - osm_dump_slvl_map_table(sm->p_log, port_guid, in_port_num, - out_port_num, p_slvl_tbl, OSM_LOG_DEBUG); - - osm_physp_set_slvl_tbl(p_physp, p_slvl_tbl, in_port_num); - goto Exit; - -opt_sl2vl: - if (osm_log_is_active(sm->p_log, OSM_LOG_VERBOSE)) - osm_log(sm->p_log, OSM_LOG_VERBOSE, - "Received optimized 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)); - - osm_dump_slvl_map_table(sm->p_log, port_guid, in_port_num, - out_port_num, p_slvl_tbl, OSM_LOG_DEBUG); - - if (attr_mod & 0x10000) { - startoutport = ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) ? 0 : 1; - endoutport = osm_node_get_num_physp(p_node); - } else - endoutport = startoutport = out_port_num; - if (attr_mod & 0x20000) { - startinport = ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) ? 0 : 1; - endinport = osm_node_get_num_physp(p_node); - } else - endinport = startinport = in_port_num; - - for (out_port_num = startoutport; out_port_num < endoutport; - out_port_num++) { - p_physp = osm_node_get_physp_ptr(p_node, out_port_num); - for (in_port_num = startinport; in_port_num < endinport; - in_port_num++) - osm_physp_set_slvl_tbl(p_physp, p_slvl_tbl, in_port_num); + OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Received SLtoVL GetResp" + " in_port_num %u out_port_num %u with GUID 0x%" PRIx64 + " for parent node GUID 0x%" PRIx64 ", TID 0x%" PRIx64 "\n", + startinport == endinport ? startinport : 0xff, + startoutport == endoutport ? startoutport : 0xff, + cl_ntoh64(port_guid), cl_ntoh64(node_guid), + cl_ntoh64(p_smp->trans_id)); + + osm_dump_slvl_map_table(sm->p_log, port_guid, + startinport == endinport ? startinport : 0xff, + startoutport == endoutport ? startoutport : 0xff, + p_slvl_tbl, OSM_LOG_DEBUG); + + for (out_port = startoutport; out_port <= endoutport; out_port++) { + p_physp = osm_node_get_physp_ptr(p_node, out_port); + for (in_port = startinport; in_port <= endinport; in_port++) + osm_physp_set_slvl_tbl(p_physp, p_slvl_tbl, in_port); } Exit: