From patchwork Mon Dec 30 12:24:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 3419121 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1780BC02DC for ; Mon, 30 Dec 2013 12:25:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD67C200E9 for ; Mon, 30 Dec 2013 12:25:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 730B2200E5 for ; Mon, 30 Dec 2013 12:24:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755724Ab3L3MYy (ORCPT ); Mon, 30 Dec 2013 07:24:54 -0500 Received: from mail-ee0-f49.google.com ([74.125.83.49]:40924 "EHLO mail-ee0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755641Ab3L3MYx (ORCPT ); Mon, 30 Dec 2013 07:24:53 -0500 Received: by mail-ee0-f49.google.com with SMTP id c41so5046306eek.36 for ; Mon, 30 Dec 2013 04:24:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=ev8oy/XRCBmvpFsQylynXpXnzg8CHtYd7JVtJKFwm/4=; b=aNy+FUZGAcrDl7cuGIiMllC1EBB5010HHjQk29eHcu6Q40Xyjuydtwffj2NvE7ngIV O8zF1PlXmTpp2w4eDLu7YNDgRGqH7tQKpTiH/V2couvJUNwf/rkclu4ugTb2Zdr6sGre W+QtoTkScwL+Y0sX3WgH3v4nmB2IMA2fFsLFF7Ok3HmetHy9jnwEoFh172a8I2cROLt+ t7mmhz2JWIb5srR/A7Li+pKDxE5DLVGNRyoYhRtCB+wRTIcQjsGtEG9jBuTkekZd7b3v Y037Qgoxzz3cofyR35jRGehJQwne005I38fpWqJ7oMv3HCQNlRCafsNwgjAanhb3GQw5 vRsw== X-Gm-Message-State: ALoCoQkh28igHLgZ6YlZNstft3EPkKPolDtF7bAkjOfwOp8KxV866MsufVuH1bezUBzLuARjH2qw X-Received: by 10.15.82.8 with SMTP id z8mr54809961eey.25.1388406292487; Mon, 30 Dec 2013 04:24:52 -0800 (PST) Received: from [192.168.1.102] (c-98-229-118-119.hsd1.ma.comcast.net. [98.229.118.119]) by mx.google.com with ESMTPSA id e43sm108266326eep.7.2013.12.30.04.24.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Dec 2013 04:24:52 -0800 (PST) Message-ID: <52C16610.4080402@dev.mellanox.co.il> Date: Mon, 30 Dec 2013 07:24:48 -0500 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: "linux-rdma (linux-rdma@vger.kernel.org)" CC: Daniel Klein Subject: [PATCH opensm] osm_ucast_ftree.c: replace assert with error return value Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Klein Removed assert in fabric_create_leaf_switch_array() that checks that the number of leafs is > 1. Instead the function returns -1, which fails the routing engine. Signed-off-by: Daniel Klein Signed-off-by: Hal Rosenstock --- opensm/osm_ucast_ftree.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/opensm/osm_ucast_ftree.c b/opensm/osm_ucast_ftree.c index 581c233..4cec0ae 100644 --- a/opensm/osm_ucast_ftree.c +++ b/opensm/osm_ucast_ftree.c @@ -1719,12 +1719,19 @@ static int fabric_create_leaf_switch_array(IN ftree_fabric_t * p_ftree) last_leaf_idx = i; } } - CL_ASSERT(first_leaf_idx < last_leaf_idx); OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG, "Full leaf array info: first_leaf_idx = %u, last_leaf_idx = %u\n", first_leaf_idx, last_leaf_idx); + if (first_leaf_idx >= last_leaf_idx) { + osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID, + "Faild to find leaf switches - topology is not " + "fat-tree\n"); + res = -1; + goto Exit; + } + /* Create array of REAL leaf switches, sorted by index. This array may contain switches at the same rank w/o CNs, in case this is the order of indexing. */