From patchwork Fri Oct 30 11:40:06 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eli Dorfman (Voltaire)" X-Patchwork-Id: 56599 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9UBVLYI028669 for ; Fri, 30 Oct 2009 11:31:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755036AbZJ3LbP (ORCPT ); Fri, 30 Oct 2009 07:31:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755806AbZJ3LbP (ORCPT ); Fri, 30 Oct 2009 07:31:15 -0400 Received: from mail-ew0-f228.google.com ([209.85.219.228]:53102 "EHLO mail-ew0-f228.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755036AbZJ3LbO (ORCPT ); Fri, 30 Oct 2009 07:31:14 -0400 Received: by ewy28 with SMTP id 28so2879306ewy.18 for ; Fri, 30 Oct 2009 04:31:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=0vFGiiwB8KB5SJ1wfDeZt5fygkN4WTla5xHRV2Dhm/4=; b=fge1HfotxH33Tw6DG/3fXjHmlowNgGzsoPyXYH3EjaXcdxWX+mCNZgDSuUHEA590uo NsDsYhW6JoQ6E7DYc3RHhAYT3dAqf7ifGVEo1hXY1Ry7AT+wn4JOzjcdSZj8jhZzVIvK BxD8UK1A9igPVB32/2Z/T4bUuZJ8rJyZCgpQM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=VPZJuOIOt9aymFu/kSbjvEQxMUXAR0pOYMUhaQzNNXqqIv29lnJJgc3HEFDmWjoBiC oHyHAxx0W9fW+rnmEmms4nuie+5MKsnQW/rYLwRK5CzBgNbHzUn8syv+JrNXK7OT/x+/ R4039226ZuabLYo/I2Q83ZdQIvoGpkuT3LorE= Received: by 10.210.229.1 with SMTP id b1mr213557ebh.66.1256902278017; Fri, 30 Oct 2009 04:31:18 -0700 (PDT) Received: from localhost.localdomain (fwil.voltaire.com [193.47.165.2]) by mx.google.com with ESMTPS id 24sm8409101eyx.37.2009.10.30.04.31.15 (version=SSLv3 cipher=RC4-MD5); Fri, 30 Oct 2009 04:31:16 -0700 (PDT) From: Eli Dorfman To: sashak@voltaire.com Cc: linux-rdma@vger.kernel.org, Eli Dorfman Subject: [PATCH] Return single PathRecord for SubnAdmGet when SGID and/or DGID Date: Fri, 30 Oct 2009 13:40:06 +0200 Message-Id: <1256902806-12040-1-git-send-email-elid@voltaire.com> X-Mailer: git-send-email 1.5.5 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_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c index f36eb46..0c6621b 100644 --- a/opensm/opensm/osm_sa_path_record.c +++ b/opensm/opensm/osm_sa_path_record.c @@ -890,7 +890,7 @@ Exit: /********************************************************************** **********************************************************************/ -static void pr_rcv_get_port_pair_paths(IN osm_sa_t * sa, +static int pr_rcv_get_port_pair_paths(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, IN const osm_port_t * p_req_port, IN const osm_port_t * p_src_port, @@ -908,7 +908,7 @@ static void pr_rcv_get_port_pair_paths(IN osm_sa_t * sa, uint16_t dest_lid_max_ho; uint16_t src_lid_ho; uint16_t dest_lid_ho; - uint32_t path_num; + uint32_t path_num = 0; uint8_t preference; uintn_t iterations; uintn_t src_offset; @@ -1019,7 +1019,7 @@ static void pr_rcv_get_port_pair_paths(IN osm_sa_t * sa, Preferred paths come first in OpenSM */ preference = 0; - path_num = 0; + path_num = cl_qlist_count(p_list); /* If SubnAdmGet, assume NumbPaths 1 (1.2 erratum) */ if (p_sa_mad->method != IB_MAD_METHOD_GET) @@ -1111,6 +1111,7 @@ static void pr_rcv_get_port_pair_paths(IN osm_sa_t * sa, Exit: OSM_LOG_EXIT(sa->p_log); + return path_num; } /********************************************************************** @@ -1314,6 +1315,8 @@ static void pr_rcv_process_world(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, const cl_qmap_t *p_tbl; const osm_port_t *p_dest_port; const osm_port_t *p_src_port; + const ib_sa_mad_t *p_sa_mad; + int num_paths = 0; OSM_LOG_ENTER(sa->p_log); @@ -1326,14 +1329,17 @@ static void pr_rcv_process_world(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, any check to determine the reversability of the paths. */ p_tbl = &sa->p_subn->port_guid_tbl; + p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw); p_dest_port = (osm_port_t *) cl_qmap_head(p_tbl); while (p_dest_port != (osm_port_t *) cl_qmap_end(p_tbl)) { p_src_port = (osm_port_t *) cl_qmap_head(p_tbl); while (p_src_port != (osm_port_t *) cl_qmap_end(p_tbl)) { - pr_rcv_get_port_pair_paths(sa, p_madw, requester_port, - p_src_port, p_dest_port, - p_dgid, comp_mask, p_list); + num_paths += pr_rcv_get_port_pair_paths(sa, p_madw, requester_port, + p_src_port, p_dest_port, + p_dgid, comp_mask, p_list); + if (p_sa_mad->method == IB_MAD_METHOD_GET && num_paths > 1) + return; p_src_port = (osm_port_t *) cl_qmap_next(&p_src_port->map_item); @@ -1358,6 +1364,8 @@ static void pr_rcv_process_half(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, { const cl_qmap_t *p_tbl; const osm_port_t *p_port; + const ib_sa_mad_t *p_sa_mad; + int num_paths = 0; OSM_LOG_ENTER(sa->p_log); @@ -1367,6 +1375,7 @@ static void pr_rcv_process_half(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, need to special case that one. */ p_tbl = &sa->p_subn->port_guid_tbl; + p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw); if (p_src_port) { /* @@ -1374,9 +1383,11 @@ static void pr_rcv_process_half(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, */ p_port = (osm_port_t *) cl_qmap_head(p_tbl); while (p_port != (osm_port_t *) cl_qmap_end(p_tbl)) { - pr_rcv_get_port_pair_paths(sa, p_madw, requester_port, - p_src_port, p_port, p_dgid, - comp_mask, p_list); + num_paths += pr_rcv_get_port_pair_paths(sa, p_madw, requester_port, + p_src_port, p_port, p_dgid, + comp_mask, p_list); + if (p_sa_mad->method == IB_MAD_METHOD_GET && num_paths > 1) + goto Exit; p_port = (osm_port_t *) cl_qmap_next(&p_port->map_item); } } else { @@ -1385,13 +1396,16 @@ static void pr_rcv_process_half(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, */ p_port = (osm_port_t *) cl_qmap_head(p_tbl); while (p_port != (osm_port_t *) cl_qmap_end(p_tbl)) { - pr_rcv_get_port_pair_paths(sa, p_madw, requester_port, - p_port, p_dest_port, p_dgid, - comp_mask, p_list); + num_paths += pr_rcv_get_port_pair_paths(sa, p_madw, requester_port, + p_port, p_dest_port, p_dgid, + comp_mask, p_list); + if (p_sa_mad->method == IB_MAD_METHOD_GET && num_paths > 1) + goto Exit; p_port = (osm_port_t *) cl_qmap_next(&p_port->map_item); } } +Exit: OSM_LOG_EXIT(sa->p_log); }