From patchwork Wed Mar 2 00:29:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 601541 X-Patchwork-Delegate: alexne@voltaire.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p220TlKL009094 for ; Wed, 2 Mar 2011 00:29:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755847Ab1CBA3p (ORCPT ); Tue, 1 Mar 2011 19:29:45 -0500 Received: from quartz.orcorp.ca ([139.142.54.143]:54438 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755799Ab1CBA3o (ORCPT ); Tue, 1 Mar 2011 19:29:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=obsidianresearch.com; s=rsa1; h=Content-Type:MIME-Version:Message-ID:Subject:To:From:Date; bh=v1EhHIC6lsrNFqAEoOE47AqjnwCra+ySOi7lcULZBjE=; b=N4S+OZhkUwJuZzi5ZdoS+m9zdvjZHlFhV9oBX9mLLsHMOgx9S5ZijpRfwxzfPRAlX/ZhlStk1RyBfqOcN3+dFzL1A4dZUp9aFXZ0i5Oj5MN0iitfo7jQi2EeeSs2X03iF/NbNaZoOnY3OALC+t4Nl4PDCXzcv3qm3kGkfc9UsoY=; Received: from [10.0.0.11] (helo=jggl.edm.orcorp.ca) by quartz.orcorp.ca with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1PuZwk-0002vQ-3B; Tue, 01 Mar 2011 17:29:42 -0700 Received: from jgg by jggl.edm.orcorp.ca with local (Exim 4.72) (envelope-from ) id 1PuZwj-0000gg-Ky; Tue, 01 Mar 2011 17:29:41 -0700 Date: Tue, 1 Mar 2011 17:29:41 -0700 From: Jason Gunthorpe To: Alex Netes , linux-rdma Subject: [PATCH/opensm] Fix SANodeRecord.nodeInfo.localPortNum Message-ID: <20110302002941.GA22729@obsidianresearch.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.11 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 02 Mar 2011 00:29:53 +0000 (UTC) diff --git a/opensm/opensm/osm_sa_node_record.c b/opensm/opensm/osm_sa_node_record.c index 87f00fd..ff08219 100644 --- a/opensm/opensm/osm_sa_node_record.c +++ b/opensm/opensm/osm_sa_node_record.c @@ -70,7 +70,8 @@ typedef struct osm_nr_search_ctxt { static ib_api_status_t nr_rcv_new_nr(osm_sa_t * sa, IN const osm_node_t * p_node, IN cl_qlist_t * p_list, - IN ib_net64_t port_guid, IN ib_net16_t lid) + IN ib_net64_t port_guid, IN ib_net16_t lid, + IN unsigned int port_num) { osm_nr_item_t *p_rec_item; ib_api_status_t status = IB_SUCCESS; @@ -97,6 +98,9 @@ static ib_api_status_t nr_rcv_new_nr(osm_sa_t * sa, p_rec_item->rec.node_info = p_node->node_info; p_rec_item->rec.node_info.port_guid = port_guid; + p_rec_item->rec.node_info.port_num_vendor_id = + (p_rec_item->rec.node_info.port_num_vendor_id & IB_NODE_INFO_VEND_ID_MASK) | + ((port_num << IB_NODE_INFO_PORT_NUM_SHIFT) & IB_NODE_INFO_PORT_NUM_MASK); memcpy(&(p_rec_item->rec.node_desc), &(p_node->node_desc), IB_NODE_DESCRIPTION_SIZE); cl_qlist_insert_tail(p_list, &p_rec_item->list_item); @@ -110,6 +114,7 @@ static void nr_rcv_create_nr(IN osm_sa_t * sa, IN osm_node_t * p_node, IN cl_qlist_t * p_list, IN ib_net64_t const match_port_guid, IN ib_net16_t const match_lid, + IN unsigned int const match_port_num, IN const osm_physp_t * p_req_physp, IN const ib_net64_t comp_mask) { @@ -173,7 +178,11 @@ static void nr_rcv_create_nr(IN osm_sa_t * sa, IN osm_node_t * p_node, continue; } - nr_rcv_new_nr(sa, p_node, p_list, port_guid, base_lid); + if ((comp_mask & IB_NR_COMPMASK_PORTNUM) && + (port_num != match_port_num)) + continue; + + nr_rcv_new_nr(sa, p_node, p_list, port_guid, base_lid, port_num); } OSM_LOG_EXIT(sa->p_log); @@ -189,6 +198,7 @@ static void nr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *context) ib_net64_t comp_mask = p_ctxt->comp_mask; ib_net64_t match_port_guid = 0; ib_net16_t match_lid = 0; + unsigned int match_port_num = 0; OSM_LOG_ENTER(p_ctxt->sa->p_log); @@ -249,10 +259,8 @@ static void nr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *context) p_rcvd_rec->node_info.revision) goto Exit; - if ((comp_mask & IB_NR_COMPMASK_PORTNUM) && - 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_PORTNUM) + match_port_num = ib_node_info_get_local_port_num(&p_rcvd_rec->node_info); if ((comp_mask & IB_NR_COMPMASK_VENDID) && ib_node_info_get_vendor_id(&p_node->node_info) != @@ -265,7 +273,7 @@ static void nr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *context) goto Exit; nr_rcv_create_nr(sa, p_node, p_ctxt->p_list, match_port_guid, - match_lid, p_req_physp, comp_mask); + match_lid, match_port_num, p_req_physp, comp_mask); Exit: OSM_LOG_EXIT(p_ctxt->sa->p_log);