From patchwork Thu Jan 2 06:44:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Ben Yosef X-Patchwork-Id: 3423731 X-Patchwork-Delegate: ira.weiny@intel.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0641D9F2E9 for ; Thu, 2 Jan 2014 06:44:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1467A2012B for ; Thu, 2 Jan 2014 06:44:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 21A1F20122 for ; Thu, 2 Jan 2014 06:44:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751005AbaABGoU (ORCPT ); Thu, 2 Jan 2014 01:44:20 -0500 Received: from mailp.voltaire.com ([193.47.165.129]:36598 "EHLO mellanox.co.il" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750927AbaABGoT (ORCPT ); Thu, 2 Jan 2014 01:44:19 -0500 Received: from Internal Mail-Server by MTLPINE2 (envelope-from danby@mellanox.com) with SMTP; 2 Jan 2014 08:44:16 +0200 Received: from r-ufm96.mtr.labs.mlnx (r-ufm96.mtr.labs.mlnx [10.209.36.187]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id s026iFh1001967; Thu, 2 Jan 2014 08:44:15 +0200 Received: from r-ufm96.mtr.labs.mlnx (localhost [127.0.0.1]) by r-ufm96.mtr.labs.mlnx (8.14.4/8.14.4) with ESMTP id s026iFrc004629; Thu, 2 Jan 2014 08:44:15 +0200 Received: (from danby@localhost) by r-ufm96.mtr.labs.mlnx (8.14.4/8.14.4/Submit) id s026iFIa004627; Thu, 2 Jan 2014 08:44:15 +0200 Date: Thu, 2 Jan 2014 08:44:15 +0200 From: Dan Ben Yosef To: Ira Weiny Cc: linux-rdma@vger.kernel.org Subject: [PATCH infiniband-diags] libibnetdisc/ibnetdisc.c: improve log information to stdout Message-ID: <20140102064415.GA4568@r-ufm96.mtr.labs.mlnx> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) 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.4 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 Write to stdout the route-path when smp returns with status error. Signed-off-by: Dan Ben Yosef --- libibnetdisc/src/internal.h | 10 +++++++--- libibnetdisc/src/query_smp.c | 6 ++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libibnetdisc/src/internal.h b/libibnetdisc/src/internal.h index 1ccd29c..47b2a4c 100644 --- a/libibnetdisc/src/internal.h +++ b/libibnetdisc/src/internal.h @@ -42,12 +42,16 @@ #include #include +#define IBND_ERROR(fmt, ...) \ + fprintf(stderr, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__) + +#define IBND_INFO(fmt, ...) \ + printf("%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__); + #define IBND_DEBUG(fmt, ...) \ if (ibdebug) { \ - printf("%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__); \ + IBND_INFO(fmt,## __VA_ARGS__); \ } -#define IBND_ERROR(fmt, ...) \ - fprintf(stderr, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__) /* HASH table defines */ #define HASHGUID(guid) ((uint32_t)(((uint32_t)(guid) * 101) ^ ((uint32_t)((guid) >> 32) * 103))) diff --git a/libibnetdisc/src/query_smp.c b/libibnetdisc/src/query_smp.c index 28620b4..ac4984e 100644 --- a/libibnetdisc/src/query_smp.c +++ b/libibnetdisc/src/query_smp.c @@ -192,6 +192,9 @@ static int process_one_recv(smp_engine_t * engine) goto error; if ((status = umad_status(umad))) { + IBND_INFO("umad (%s Attr 0x%x:%u) bad status %d; %s\n", + portid2str(&smp->path), smp->rpc.attr.id, + smp->rpc.attr.mod, status, strerror(status)); IBND_ERROR("umad (%s Attr 0x%x:%u) bad status %d; %s\n", portid2str(&smp->path), smp->rpc.attr.id, smp->rpc.attr.mod, status, strerror(status)); @@ -199,6 +202,9 @@ static int process_one_recv(smp_engine_t * engine) rc = mlnx_ext_port_info_err(engine, smp, mad, smp->cb_data); } else if ((status = mad_get_field(mad, 0, IB_DRSMP_STATUS_F))) { + IBND_INFO("mad (%s Attr 0x%x:%u) bad status 0x%x\n", + portid2str(&smp->path), smp->rpc.attr.id, + smp->rpc.attr.mod, status); IBND_ERROR("mad (%s Attr 0x%x:%u) bad status 0x%x\n", portid2str(&smp->path), smp->rpc.attr.id, smp->rpc.attr.mod, status);