From patchwork Fri Oct 23 16:33:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 55585 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 n9NGW4Z4019666 for ; Fri, 23 Oct 2009 16:32:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752646AbZJWQbe (ORCPT ); Fri, 23 Oct 2009 12:31:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752535AbZJWQbe (ORCPT ); Fri, 23 Oct 2009 12:31:34 -0400 Received: from mail-bw0-f227.google.com ([209.85.218.227]:63518 "EHLO mail-bw0-f227.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752646AbZJWQbd (ORCPT ); Fri, 23 Oct 2009 12:31:33 -0400 Received: by bwz27 with SMTP id 27so1012437bwz.21 for ; Fri, 23 Oct 2009 09:31:37 -0700 (PDT) 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=K/DdfVdruwAt8jMhUUeYiqjt9xbfyf0K/7raZVnxfFI=; b=FpddDa+haZBVgdckrzEbzwQmXd7niUpCG7WIAYd7aYbWQjinlMNUpgflFFCn7UWk7n aKndA3ROqx8QwKzPaPDU4Wejiz63M/XJqhZPDlVaihlffE0bH7hxPs+e08Ofv1SetvIX zEIdA86kqOLENGlrwT4c6skSQbUXbbw9uGKyU= 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=bMvsbKB1l8N85l8QYS6JCZ8csKGXWyYreCxBikbPm8gjRqwrfGHmsUpBX2XwxzhVSc aqE1PcT9jcA6b4IGoXDySNgU8aHG1CNcW3vHW34liVUnAXoj5MDdGNBtcxb1vp2xV+2r ZgAC7kAT7wDJc2R8KMsycd83GqwKdoKhNSZNI= Received: by 10.103.81.8 with SMTP id i8mr4693163mul.80.1256315495914; Fri, 23 Oct 2009 09:31:35 -0700 (PDT) Received: from me.localdomain (85.64.35.106.dynamic.barak-online.net [85.64.35.106]) by mx.google.com with ESMTPS id j10sm3524980muh.0.2009.10.23.09.31.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 23 Oct 2009 09:31:35 -0700 (PDT) Received: by me.localdomain (Postfix, from userid 1000) id 5F68A11F05; Fri, 23 Oct 2009 18:33:37 +0200 (IST) Date: Fri, 23 Oct 2009 18:33:37 +0200 From: Sasha Khapyorsky To: Ira Weiny Cc: Hal Rosenstock , linux-rdma Subject: [PATCH] infiniband-diags/ibqueryerrors.c: use common portid in query_cap_mask() Message-ID: <20091023163337.GB718@me> References: <20090924235011.a9a16022.weiny2@llnl.gov> <20090925093358.f9f747d4.weiny2@llnl.gov> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090925093358.f9f747d4.weiny2@llnl.gov> 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/infiniband-diags/src/ibqueryerrors.c b/infiniband-diags/src/ibqueryerrors.c index 697afd1..fdd9246 100644 --- a/infiniband-diags/src/ibqueryerrors.c +++ b/infiniband-diags/src/ibqueryerrors.c @@ -261,23 +261,18 @@ static void print_results(ibnd_node_t * node, uint8_t * pc, int portnum, } } -static int query_cap_mask(ibnd_node_t * node, int portnum, uint16_t * cap_mask) +static int query_cap_mask(ib_portid_t *portid, ibnd_node_t * node, int portnum, + uint16_t * cap_mask) { uint8_t pc[1024]; uint16_t rc_cap_mask; - ib_portid_t portid = { 0 }; - - if (node->type == IB_NODE_SWITCH) - ib_portid_set(&portid, node->smalid, 0, 0); - else - ib_portid_set(&portid, node->ports[portnum]->base_lid, 0, 0); /* PerfMgt ClassPortInfo is a required attribute */ - if (!pma_query_via(pc, &portid, portnum, ibd_timeout, CLASS_PORT_INFO, + if (!pma_query_via(pc, portid, portnum, ibd_timeout, CLASS_PORT_INFO, ibmad_port)) { IBWARN("classportinfo query failed on %s, %s port %d", remap_node_name(node_name_map, node->guid, - node->nodedesc), portid2str(&portid), + node->nodedesc), portid2str(portid), portnum); return -1; } @@ -371,18 +366,18 @@ void print_node(ibnd_node_t * node, void *user_data) for (p = startport; p <= node->numports; p++) { if (node->ports[p]) { - if (query_cap_mask(node, p, &cap_mask) < 0) - continue; - - if (cap_mask & 0x100) - all_port_sup = 1; - if (node->type == IB_NODE_SWITCH) ib_portid_set(&portid, node->smalid, 0, 0); else ib_portid_set(&portid, node->ports[p]->base_lid, 0, 0); + if (query_cap_mask(&portid, node, p, &cap_mask) < 0) + continue; + + if (cap_mask & 0x100) + all_port_sup = 1; + print_port(&portid, cap_mask, node, p, &header_printed); if (!all_port_sup) clear_port(&portid, cap_mask, node, p);