From patchwork Mon Dec 21 09:46:45 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Kliteynik X-Patchwork-Id: 69097 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 nBL9ap44027630 for ; Mon, 21 Dec 2009 09:36:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755841AbZLUJgv (ORCPT ); Mon, 21 Dec 2009 04:36:51 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755774AbZLUJgu (ORCPT ); Mon, 21 Dec 2009 04:36:50 -0500 Received: from mail.mellanox.co.il ([194.90.237.43]:36395 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755324AbZLUJgu (ORCPT ); Mon, 21 Dec 2009 04:36:50 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from kliteyn@dev.mellanox.co.il) with SMTP; 21 Dec 2009 11:37:07 +0200 Received: from [10.4.1.29] ([10.4.1.29]) by mtlexch01.mtl.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 21 Dec 2009 11:36:44 +0200 Message-ID: <4B2F4405.9000300@dev.mellanox.co.il> Date: Mon, 21 Dec 2009 11:46:45 +0200 From: Yevgeny Kliteynik Reply-To: kliteyn@dev.mellanox.co.il User-Agent: Thunderbird 1.5.0.5 (X11/20060719) MIME-Version: 1.0 To: Sasha Khapyorsky , Linux RDMA Subject: [PATCH] opensm/osm_mcast_mgr.c: fix osm_mcast_mgr_compute_max_hops for managed switch X-OriginalArrivalTime: 21 Dec 2009 09:36:44.0155 (UTC) FILETIME=[1B91C4B0:01CA8221] X-TM-AS-Product-Ver: SMEX-8.0.0.1181-6.000.1038-17082.006 X-TM-AS-Result: No--1.138500-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No 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_mcast_mgr.c b/opensm/opensm/osm_mcast_mgr.c index 697fb58..16f578b 100644 --- a/opensm/opensm/osm_mcast_mgr.c +++ b/opensm/opensm/osm_mcast_mgr.c @@ -204,6 +204,12 @@ static float osm_mcast_mgr_compute_max_hops(osm_sm_t * sm, cl_qlist_t * l, OSM_LOG_ENTER(sm->p_log); + if (cl_qlist_count(l) == 0) { + /* We should be here if there aren't any ports in the group */ + max_hops = 10001; /* see later - we use it to realize no hops */ + goto Exit; + } + /* For each member of the multicast group, compute the number of hops to its base LID. @@ -215,12 +221,10 @@ static float osm_mcast_mgr_compute_max_hops(osm_sm_t * sm, cl_qlist_t * l, max_hops = hops; } - if (max_hops == 0) - /* - We should be here if there aren't any ports in the group. - */ - max_hops = 10001; /* see later - we use it to realize no hops */ - + /* Note that at this point we might get (max_hops == 0), + which means that there's only one member in the mcast + group, and it's the current switch */ +Exit: OSM_LOG_EXIT(sm->p_log); return (float)max_hops; }