From patchwork Wed Jun 3 14:59:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 6539071 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 53ECFC0020 for ; Wed, 3 Jun 2015 14:59:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72D0E2066C for ; Wed, 3 Jun 2015 14:59:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C77D2066B for ; Wed, 3 Jun 2015 14:59:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932476AbbFCO7w (ORCPT ); Wed, 3 Jun 2015 10:59:52 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:35179 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932454AbbFCO7w (ORCPT ); Wed, 3 Jun 2015 10:59:52 -0400 Received: by wiga1 with SMTP id a1so17542884wig.0 for ; Wed, 03 Jun 2015 07:59:50 -0700 (PDT) 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=geRNZcVcts1wDQMRNVv+8ynQNX2ZVmmCLuS4gBrNfGs=; b=JQriest/vmv+hXlP/k8n2ENvXV+gudy8D3/YSrPThT0FeHdFKwGMgdj21nwKhvnju3 cPnL6gwZkS2GSKr4Rs5GYIJIXr6FAIPkA1vr8gT1rEv6xjzo6YizVmjpa9CVznt1wVxY nTvBCZEfAnjWn9Hl9sKVjUFb0ZiWUBRzW1E7WfyE6+zM7yCrSs6Z+9H15ongiPmS3bUy SnKVcGsZ0//1ECzh1IUw55oS+gjXJBItCWmX+CnjziNtiuxkUtG0A4jLcRG6/Ya+hCgn WhbPNBJWXhG5iC8iSTUNTyiNiIEAML2hY2ZPQ6svxEj2XwCYJDo5O0Ayw9qUixYnUNTt 0SRQ== X-Gm-Message-State: ALoCoQm7iF7Z3xcBaqLxSmZ4bZYwvEWoUA6d+eH04Je5tx9qk6kBhPXvo29mV0t+E/gym3W9/ldQ X-Received: by 10.180.9.83 with SMTP id x19mr36609729wia.49.1433343590811; Wed, 03 Jun 2015 07:59:50 -0700 (PDT) Received: from [192.168.1.102] (c-71-234-225-223.hsd1.ct.comcast.net. [71.234.225.223]) by mx.google.com with ESMTPSA id b7sm1450970wjx.47.2015.06.03.07.59.48 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Jun 2015 07:59:49 -0700 (PDT) Message-ID: <556F1663.6090408@dev.mellanox.co.il> Date: Wed, 03 Jun 2015 10:59:47 -0400 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_console.c: Fix display of negative counters in console Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Date: Tue, 26 May 2015 14:38:21 +0300 OpenSM may print negative counters values in console mode due to the wrong format being used in printf. This change fixes the problem by changing the format used for counters of type uint32_t from decimal (%d) to unsigned (%u). Signed-off-by: Daniel Klein Signed-off-by: Hal Rosenstock --- opensm/osm_console.c | 46 +++++++++++++++++++++++----------------------- 1 files changed, 23 insertions(+), 23 deletions(-) diff --git a/opensm/osm_console.c b/opensm/osm_console.c index f3f79ff..0f68afe 100644 --- a/opensm/osm_console.c +++ b/opensm/osm_console.c @@ -482,32 +482,32 @@ static void print_status(osm_opensm_t * p_osm, FILE * out) #endif fprintf(out, "\n MAD stats\n" " ---------\n" - " QP0 MADs outstanding : %d\n" - " QP0 MADs outstanding (on wire) : %d\n" - " QP0 MADs rcvd : %d\n" - " QP0 MADs sent : %d\n" - " QP0 unicasts sent : %d\n" - " QP0 unknown MADs rcvd : %d\n" - " SA MADs outstanding : %d\n" - " SA MADs rcvd : %d\n" - " SA MADs sent : %d\n" - " SA unknown MADs rcvd : %d\n" - " SA MADs ignored : %d\n", - p_osm->stats.qp0_mads_outstanding, - p_osm->stats.qp0_mads_outstanding_on_wire, - p_osm->stats.qp0_mads_rcvd, - p_osm->stats.qp0_mads_sent, - p_osm->stats.qp0_unicasts_sent, - p_osm->stats.qp0_mads_rcvd_unknown, - p_osm->stats.sa_mads_outstanding, - p_osm->stats.sa_mads_rcvd, - p_osm->stats.sa_mads_sent, - p_osm->stats.sa_mads_rcvd_unknown, - p_osm->stats.sa_mads_ignored); + " QP0 MADs outstanding : %u\n" + " QP0 MADs outstanding (on wire) : %u\n" + " QP0 MADs rcvd : %u\n" + " QP0 MADs sent : %u\n" + " QP0 unicasts sent : %u\n" + " QP0 unknown MADs rcvd : %u\n" + " SA MADs outstanding : %u\n" + " SA MADs rcvd : %u\n" + " SA MADs sent : %u\n" + " SA unknown MADs rcvd : %u\n" + " SA MADs ignored : %u\n", + (uint32_t)p_osm->stats.qp0_mads_outstanding, + (uint32_t)p_osm->stats.qp0_mads_outstanding_on_wire, + (uint32_t)p_osm->stats.qp0_mads_rcvd, + (uint32_t)p_osm->stats.qp0_mads_sent, + (uint32_t)p_osm->stats.qp0_unicasts_sent, + (uint32_t)p_osm->stats.qp0_mads_rcvd_unknown, + (uint32_t)p_osm->stats.sa_mads_outstanding, + (uint32_t)p_osm->stats.sa_mads_rcvd, + (uint32_t)p_osm->stats.sa_mads_sent, + (uint32_t)p_osm->stats.sa_mads_rcvd_unknown, + (uint32_t)p_osm->stats.sa_mads_ignored); fprintf(out, "\n Subnet flags\n" " ------------\n" " Sweeping enabled : %d\n" - " Sweep interval (seconds) : %d\n" + " Sweep interval (seconds) : %u\n" " Ignore existing lfts : %d\n" " Subnet Init errors : %d\n" " In sweep hop 0 : %d\n"