From patchwork Fri Apr 9 23:56:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 91832 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o39NujBJ014206 for ; Fri, 9 Apr 2010 23:56:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755690Ab0DIX4o (ORCPT ); Fri, 9 Apr 2010 19:56:44 -0400 Received: from mail-bw0-f209.google.com ([209.85.218.209]:39360 "EHLO mail-bw0-f209.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755505Ab0DIX4n (ORCPT ); Fri, 9 Apr 2010 19:56:43 -0400 Received: by bwz1 with SMTP id 1so2881265bwz.21 for ; Fri, 09 Apr 2010 16:56:41 -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=45A6oC3olgbMY/eQH6t0OA5FCw1YmqO5pfLKe1yUJn4=; b=LwntHvnPPEKLsXfoRf8OFas712SU0OzAYQIwV1g5J7umZbIm2w3Ap7MPzaknNbFuIo UJPnARASNww1wHzDvCELM8x9ZReKSCxofb9kU4+4x9dW7wYGMloQ4/c9M5COjy1vvnxx 0lsDJdpvGOw8UuwsTPQdGkL7BZQVWUeKNDjI8= 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=JZTbNg5UQkPi1lbAG8iiu6agx6r/AHkT1nv7L0/UsgT7igX9hFeNghyesL7gyOsEsL Gy8TxpDUuOiEOQcpLzT462dy1zJqReZY77ybY4XpD2HTobbobpAGNppWN0zjekyq5DUE JWJkkJtQTWHhvjasrgokRrh5VVfF/y/nO5eJc= Received: by 10.204.126.130 with SMTP id c2mr798257bks.155.1270857401762; Fri, 09 Apr 2010 16:56:41 -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 l1sm13719512bkl.20.2010.04.09.16.56.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 09 Apr 2010 16:56:41 -0700 (PDT) Received: by me.localdomain (Postfix, from userid 1000) id 3866511F34; Sat, 10 Apr 2010 02:56:52 +0300 (IDT) Date: Sat, 10 Apr 2010 02:56:52 +0300 From: Sasha Khapyorsky To: Ira Weiny Cc: "linux-rdma@vger.kernel.org" Subject: [PATCH] tests/subnet_discover: verbose node discovery printout Message-ID: <20100409235652.GG4808@me> References: <20100218124931.4d6ef34b.weiny2@llnl.gov> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100218124931.4d6ef34b.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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 09 Apr 2010 23:56:45 +0000 (UTC) diff --git a/tests/subnet_discover.c b/tests/subnet_discover.c index 22b092a..44cd86e 100644 --- a/tests/subnet_discover.c +++ b/tests/subnet_discover.c @@ -52,7 +52,9 @@ static unsigned max_hops = 0; #define ERROR(fmt, ...) fprintf(stderr, "ERR: " fmt, ##__VA_ARGS__) #define VERBOSE(fmt, ...) if (verbose) fprintf(stderr, fmt, ##__VA_ARGS__) -#define NOISE(fmt, ...) if (verbose > 1) fprintf(stderr, fmt, ##__VA_ARGS__) +#define VERBOSE1(fmt, ...) if (verbose > 1) fprintf(stderr, fmt, ##__VA_ARGS__) +#define VERBOSE2(fmt, ...) if (verbose > 2) fprintf(stderr, fmt, ##__VA_ARGS__) +#define NOISE(fmt, ...) VERBOSE2(fmt, ##__VA_ARGS__) static const char *print_path(uint8_t path[], size_t path_cnt) { @@ -116,8 +118,8 @@ static int send_request(int fd, int agent, uint64_t trid, uint8_t * path, return -1; } - VERBOSE("send %016" PRIx64 ": attr %x, mod %x to %s\n", trid, attr_id, - attr_mod, print_path(path, path_cnt)); + VERBOSE1("send %016" PRIx64 ": attr %x, mod %x to %s\n", trid, attr_id, + attr_mod, print_path(path, path_cnt)); return ret; } @@ -239,8 +241,8 @@ static int send_query(int fd, int agent, unsigned node_id, uint8_t path[], return -1; } - VERBOSE("queue %016" PRIx64 ": attr %x, mod %x to %s\n", trid, attr_id, - attr_mod, print_path(path, path_cnt)); + VERBOSE1("queue %016" PRIx64 ": attr %x, mod %x to %s\n", trid, attr_id, + attr_mod, print_path(path, path_cnt)); run_request_queue(fd, agent); @@ -384,8 +386,8 @@ static void connect_ports(unsigned node1_id, unsigned port1_num, { struct port *port1 = &node_array[node1_id]->ports[port1_num]; struct port *port2 = &node_array[node2_id]->ports[port2_num]; - VERBOSE("connecting %u:%u <--> %u:%u\n", - node1_id, port1_num, node2_id, port2_num); + VERBOSE1("connecting %u:%u <--> %u:%u\n", + node1_id, port1_num, node2_id, port2_num); port1->remote = port2; port2->remote = port1; } @@ -410,6 +412,11 @@ static int process_node(void *umad, unsigned remote_id, int fd, int agent, node = node_array[id]; + VERBOSE("%-5s %-6s with guid 0x%" PRIx64 " discovered at %s\n", + node_is_new ? "new" : "known", + node->is_switch ? "Switch" : "Ca", node->guid, + print_path(path, path_cnt)); + node->ports[port_num].guid = mad_get_field64(node_info, 0, IB_NODE_PORT_GUID_F); @@ -472,8 +479,8 @@ static int recv_smp_resp(int fd, int agent, uint8_t * umad, uint8_t path[]) node_id = trid & 0xffff; - VERBOSE("recv %016" PRIx64 ": attr %x, mod %x from %s\n", trid, attr_id, - attr_mod, print_path(path, path_cnt)); + VERBOSE1("recv %016" PRIx64 ": attr %x, mod %x from %s\n", trid, + attr_id, attr_mod, print_path(path, path_cnt)); switch (attr_id) { case IB_ATTR_NODE_INFO: