From patchwork Fri Mar 8 19:55:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10845361 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C78EF922 for ; Fri, 8 Mar 2019 19:55:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B004B2FE8A for ; Fri, 8 Mar 2019 19:55:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0FB02FF7A; Fri, 8 Mar 2019 19:55:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34D252DE17 for ; Fri, 8 Mar 2019 19:55:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726633AbfCHTz0 (ORCPT ); Fri, 8 Mar 2019 14:55:26 -0500 Received: from mail-qk1-f169.google.com ([209.85.222.169]:42384 "EHLO mail-qk1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726414AbfCHTz0 (ORCPT ); Fri, 8 Mar 2019 14:55:26 -0500 Received: by mail-qk1-f169.google.com with SMTP id y140so11887503qkb.9 for ; Fri, 08 Mar 2019 11:55:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QmxFCI15hvQ8Ev8NPqInaa2htgdyQIUBbDoSzgwQfZs=; b=KpXZ/U40I0OkwPhsqlbLwq19ciEAbd4WPWHISiup+Dz7jq74gbJGsFQKCyIe4zmxIq jUCxG1oC/uvr5fN8roIxgqc9I1eXzu00FbN5Pd0XxMJ4tac0NeaADZiysCaleFf3aYRK CwHVcaqizN/Z2L0gI35JrTfp5bf3WeGTtdMg2u4JjY57qRAupn2an0+GkiE/gdEcmehB LBuM30p/FCwjG1rapFiJjTASv9lRu2t9X3Srv7HS0edpPH0bGlgVn2HiBlfPOFv3ueZZ xCfCrNReZ3W0Bef7OUJWaGawHoCzyvx2G71Ml7X0exNBGl2quror1JDNuSNLZF6tF/9k 0YLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QmxFCI15hvQ8Ev8NPqInaa2htgdyQIUBbDoSzgwQfZs=; b=Pcfri2HuSmMSIpWve+CiwtWf9nP839QUOB2upVf2RM8ZfPa9nUW0xRXtJORMDQmIJg n5/6TgFdpxJ/WkO8Tse3Dfvy8hbGQ43qbNFHy8EKWRMG07qB4Dbslzy1KtwxKEJ8ETcB UnETwki6DP69305EnwnK/0Qlrk5l8wRqSfJGtyI4sAxHbHV9qulsLCm0eAjadmFtnW2C l0/xNFqmQZ7nR+qGbOG4Q9hpozk1bG8g0bdIXWbXoXgGgSLmDcNYqkzKsKjcNJ7sYfGO 0qiE/VNpmVXDB/Z5wRHX6UnKhB2PnLbo+wkHbsMLscXkvpEB7hEDCfynC1xb/35qy+e5 OByw== X-Gm-Message-State: APjAAAU0+dMY/Tw8U2G7tvT0b/tPVhF7luU4SYmgQEhcbvORaAlR4iMe uUPrw4d+0H1gnHBSwbAo3Ktmgqdh7anA6w== X-Google-Smtp-Source: APXvYqzAqrHTPJDHRPgZtuZwC0Eu19ODEeyrdgpYbjeNVd4+6ZXTLjqJkpw3ewpxX6pswP7+4gYqCw== X-Received: by 2002:a05:620a:10b1:: with SMTP id h17mr758767qkk.69.1552074924809; Fri, 08 Mar 2019 11:55:24 -0800 (PST) Received: from ziepe.ca ([24.137.65.181]) by smtp.gmail.com with ESMTPSA id t9sm1386617qkm.58.2019.03.08.11.55.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Mar 2019 11:55:23 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1h2LaU-0000up-2m; Fri, 08 Mar 2019 15:55:22 -0400 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 01/14] libibmad: Remove madrpc_def_timeout Date: Fri, 8 Mar 2019 15:55:02 -0400 Message-Id: <20190308195515.3408-2-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308195515.3408-1-jgg@ziepe.ca> References: <20190308195515.3408-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe This was never exposed in a header file, so nothing can be using it. Fixes the compiler warning: warning: no previous prototype for ‘madrpc_def_timeout’ [-Wmissing-prototypes] Signed-off-by: Jason Gunthorpe --- libibmad/src/libibmad.map | 1 - libibmad/src/rpc.c | 5 ----- 2 files changed, 6 deletions(-) diff --git a/libibmad/src/libibmad.map b/libibmad/src/libibmad.map index 454e37c33e28ff..e08adf0ea1d4a9 100644 --- a/libibmad/src/libibmad.map +++ b/libibmad/src/libibmad.map @@ -111,7 +111,6 @@ IBMAD_1.3 { mad_get_timeout; mad_get_retries; madrpc; - madrpc_def_timeout; madrpc_init; madrpc_portid; madrpc_rmpp; diff --git a/libibmad/src/rpc.c b/libibmad/src/rpc.c index f286af71f7b3e9..0dd4c92ac4d59f 100644 --- a/libibmad/src/rpc.c +++ b/libibmad/src/rpc.c @@ -103,11 +103,6 @@ void mad_rpc_set_timeout(struct ibmad_port *port, int timeout) port->timeout = timeout; } -int madrpc_def_timeout(void) -{ - return madrpc_timeout; -} - int madrpc_portid(void) { return ibmp->port_id; From patchwork Fri Mar 8 19:55:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10845373 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5455B4A0A for ; Fri, 8 Mar 2019 19:55:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40B752FE8A for ; Fri, 8 Mar 2019 19:55:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 358D42FE96; Fri, 8 Mar 2019 19:55:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B44BE2DE17 for ; Fri, 8 Mar 2019 19:55:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726820AbfCHTz3 (ORCPT ); Fri, 8 Mar 2019 14:55:29 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:42624 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726718AbfCHTz3 (ORCPT ); Fri, 8 Mar 2019 14:55:29 -0500 Received: by mail-qt1-f193.google.com with SMTP id u7so22597512qtg.9 for ; Fri, 08 Mar 2019 11:55:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=piO5zMO9y7wO8jtsIkTBHvFguSSwtbQfbQlmMkZFAgs=; b=VIPrTO7zckl1Hbgk3Hh/nxwMxHAXASd8W68DkN5U3AD/fXyamaUkG9NLE1TpPdT7og dWlhmRVaElT/s+i6fl9/JVpZe5Mz/YoLRad5TOLXgvgtegmNsr+j0//KsrI4Ua2G7QyR ib63w2iUzIVDL0hfk3FQmk8n7/Aun3VUckZziGJ7tESX1ZVVGU5TPpvyiwzVDqvCofZV 37yKrZt1KpIabWZ1qMRbNB/qsEyapSST+f/ODlUshAkd8gc1mpcbvpFIkwUwHpQ6l0KS 6LVDp/iQbj4j+SnsmHxMxOnlFpIXbGKVSsXA+jEWZfzqGg1gO5wDSPImYdede4uVLLSD a5hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=piO5zMO9y7wO8jtsIkTBHvFguSSwtbQfbQlmMkZFAgs=; b=eGfLo7222bOZeZhTi+QvTHy8MVUCCpCLPW77qwtGtri4NMRjlLj3WUa2cGLCo4mPPL jToBUhopHq99rmG4FConsrAQ/h8g3IjfAngXlpk1oIpO8+g61z14DpbTU/YyTEBQ+PIG y7a7wRyPaIozFFDMjeZgKSpW4mXEZwUSbwOLVgsski7dQNrUrVIH19a95mMlaHbOspJh ikJ99+n8vqqY9CHt4MRUEympUkoeR+49N1EaOPdioDld0+EbkZoYBqtQE88YXsK5vwjU fIfyx771NTpaxysfVf0/XuYuIfAXbG7YmZLPVo/VJt04VmWTXJo/7l1kONwiUr5Tvvyq PQEQ== X-Gm-Message-State: APjAAAVP7uoFDYqOQSOdqWapSOI6pNOSa7GmKm2Z6LCmmQZ0cLLO4iml otyekAXtd89ne2gD7FQEyVJkwlm1CXYsjg== X-Google-Smtp-Source: APXvYqzGtlJpxLUr6q4CMLVUQnJPYsQAgzDabxcWNBlwdVYLPO47nU6MFii3Up8of2i+9K64IWWWCw== X-Received: by 2002:ac8:35eb:: with SMTP id l40mr15987105qtb.207.1552074927888; Fri, 08 Mar 2019 11:55:27 -0800 (PST) Received: from ziepe.ca ([24.137.65.181]) by smtp.gmail.com with ESMTPSA id t55sm5703439qtt.57.2019.03.08.11.55.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Mar 2019 11:55:23 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1h2LaU-0000uv-4s; Fri, 08 Mar 2019 15:55:22 -0400 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 02/14] ibdiags: Remove unused functions Date: Fri, 8 Mar 2019 15:55:03 -0400 Message-Id: <20190308195515.3408-3-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308195515.3408-1-jgg@ziepe.ca> References: <20190308195515.3408-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe These functions are never called. Signed-off-by: Jason Gunthorpe --- libibnetdisc/src/chassis.c | 5 ----- src/smpdump.c | 35 ----------------------------------- 2 files changed, 40 deletions(-) diff --git a/libibnetdisc/src/chassis.c b/libibnetdisc/src/chassis.c index 5726f8e32b4625..b0d272de9c5a29 100644 --- a/libibnetdisc/src/chassis.c +++ b/libibnetdisc/src/chassis.c @@ -354,11 +354,6 @@ static int is_line(ibnd_node_t * n) is_line_2024(n) || is_line_4700(n)); } -int is_chassis_switch(ibnd_node_t * n) -{ - return (is_spine(n) || is_line(n)); -} - /* these structs help find Line (Anafa) slot number while using spine portnum */ char line_slot_2_sfb4[37] = { 0, diff --git a/src/smpdump.c b/src/smpdump.c index 8b1a1eeb4996e5..e3f541085be31b 100644 --- a/src/smpdump.c +++ b/src/smpdump.c @@ -123,41 +123,6 @@ void smp_get_init(void *umad, int lid, int attr, int mod) umad_set_addr(umad, lid, 0, 0, 0); } -void drsmp_set_init(void *umad, DRPath * path, int attr, int mod, void *data) -{ - struct drsmp *smp = (struct drsmp *)(umad_get_mad(umad)); - - memset(smp, 0, sizeof(*smp)); - - smp->method = 2; /* SET */ - smp->attr_id = (uint16_t) htons((uint16_t) attr); - smp->attr_mod = htonl(mod); - smp->tid = htobe64(drmad_tid++); - smp->dr_slid = 0xffff; - smp->dr_dlid = 0xffff; - - umad_set_addr(umad, 0xffff, 0, 0, 0); - - if (path) - memcpy(smp->initial_path, path->path, path->hop_cnt + 1); - - if (data) - memcpy(smp->data, data, sizeof smp->data); - - smp->hop_cnt = (uint8_t) path->hop_cnt; -} - -char *drmad_status_str(struct drsmp *drsmp) -{ - switch (drsmp->status) { - case 0: - return "success"; - case ETIMEDOUT: - return "timeout"; - } - return "unknown error"; -} - int str2DRPath(char *str, DRPath * path) { char *s; From patchwork Fri Mar 8 19:55:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10845383 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1DFBA4A0A for ; Fri, 8 Mar 2019 19:55:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03B202DE17 for ; Fri, 8 Mar 2019 19:55:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBF2C2FE8A; Fri, 8 Mar 2019 19:55:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D385B2DE17 for ; Fri, 8 Mar 2019 19:55:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726859AbfCHTzd (ORCPT ); Fri, 8 Mar 2019 14:55:33 -0500 Received: from mail-qt1-f177.google.com ([209.85.160.177]:40299 "EHLO mail-qt1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726831AbfCHTzc (ORCPT ); Fri, 8 Mar 2019 14:55:32 -0500 Received: by mail-qt1-f177.google.com with SMTP id f11so5333430qti.7 for ; Fri, 08 Mar 2019 11:55:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RtLTZ/8yAiHb7dgPyFgJRjrmhogiQDhVXhv55p21bm8=; b=Y9o6T93QlPeMQZXP+MgucM1IIouH/I8dtS9GAPQM5eiqW/wv4t5kKwPFnp9XMY6HHE aekBJ/iQyQz0rv8zZrSTm4n/AnHzAt8ctVA5CgXWxHX5yu3+SLB+R/MJdNZ/Vr7wBaGu oU4XON5p3tMB/vg1o+VKiOy3/r4Rur3XJX01a66ji6s0g1FheI4cJLmpwLf1oqUao5iZ MWwijrV/cMyawW36wqAyTHKodCIFY3mDH+8XAd3B+MTVPxDZrqGD/oaraDbyo/sUXPTy KVS9d9Fc9Uht8UTIgOHITwvVxtIwZVYv7YjTwD0rWdiCK/CYB5NdawwLIZ/nfbJL1Q+w OpPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RtLTZ/8yAiHb7dgPyFgJRjrmhogiQDhVXhv55p21bm8=; b=Es+bquBcyim7s+NxujRiO5Kv5fS+84IUm6oFFTbirUl3VVlFJuQx4gmtxhVOVhaJuv 6SLoeTtK4/8EptUwJntcrFTrUepEpUcCDen8ZHJbppvpBGktsEfK8XUCkfX/kuOdtM8L a5GIRFG5s8fJ/FaSG65Ezd6K0BP9UMFmmOiuj7qR5o4MjfRxZrtSy4urg2NQ35iDTzz3 Jk7RIjv7PQXGzlLPWBQg400PiaXZ+DGQzz6fEOgC2Qf7DJ9utxYBmRhwwj4Gu2p+My6E 7280dJV6oa2cwm51qW4KS7rO9EB4c8fRLJJqxfH2K7pkKar1kdVgO5B6uI1o8BBdI0Cl USzw== X-Gm-Message-State: APjAAAV+CflJ3gCxkpmcuwyUjBJHdjj9dpHLUqLSEDyhSHzXlACMA11O HQi7eR9bM7IbFI+h1KDa8q6rpAmDagrAEg== X-Google-Smtp-Source: APXvYqzcnkHz7KDYKZN36HcjO/2/+2exk8jr7F4g61INxvHFt6kEi7uRTIyBx5A7Y/dEOYFMGL24pQ== X-Received: by 2002:ac8:2cd6:: with SMTP id 22mr4222400qtx.112.1552074930250; Fri, 08 Mar 2019 11:55:30 -0800 (PST) Received: from ziepe.ca ([24.137.65.181]) by smtp.gmail.com with ESMTPSA id l56sm1728898qta.46.2019.03.08.11.55.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Mar 2019 11:55:23 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1h2LaU-0000vB-6w; Fri, 08 Mar 2019 15:55:22 -0400 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 03/14] ibdiags: Use const char when appropriate Date: Fri, 8 Mar 2019 15:55:04 -0400 Message-Id: <20190308195515.3408-4-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308195515.3408-1-jgg@ziepe.ca> References: <20190308195515.3408-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe rdma-core compiles with options that make C strings read only. Propagate const through all places that touch C strings. Fixes compiler warnings of the form: warning: passing argument 2 of ‘xdump’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] Signed-off-by: Jason Gunthorpe --- include/ibdiag_common.h | 8 ++-- libibmad/include/infiniband/mad.h | 2 +- libibmad/src/dump.c | 2 +- libibnetdisc/include/infiniband/ibnetdisc.h | 2 +- libibnetdisc/src/chassis.c | 6 +-- libibnetdisc/src/ibnetdisc.c | 4 +- libibnetdisc/test/testleaks.c | 2 +- src/ibcacheedit.c | 2 +- src/ibccconfig.c | 38 ++++++++------- src/ibccquery.c | 24 ++++++---- src/ibdiag_common.c | 5 +- src/iblinkinfo.c | 10 ++-- src/ibnetdiscover.c | 53 +++++++++++---------- src/ibqueryerrors.c | 12 ++--- src/ibroute.c | 23 ++++----- src/ibsendtrap.c | 6 +-- src/ibstat.c | 14 +++--- src/ibtracert.c | 4 +- src/mcm_rereg_test.c | 8 ++-- src/sminfo.c | 2 +- src/smpquery.c | 38 +++++++-------- 21 files changed, 138 insertions(+), 127 deletions(-) diff --git a/include/ibdiag_common.h b/include/ibdiag_common.h index ae93ba38c61891..20449cf8a3d0fd 100644 --- a/include/ibdiag_common.h +++ b/include/ibdiag_common.h @@ -139,14 +139,14 @@ extern int ibdiag_process_opts(int argc, char *const argv[], void *context, const char *usage_args, const char *usage_examples[]); extern void ibdiag_show_usage(); -extern void ibexit(const char *fn, char *msg, ...); +extern void ibexit(const char *fn, const char *msg, ...); /* convert counter values to a float with a unit specifier returned (using * binary prefix) * "data" is a flag indicating this counter is a byte counter multiplied by 4 * as per PortCounters[Extended] */ -extern char *conv_cnt_human_readable(uint64_t val64, float *val, int data); +const char *conv_cnt_human_readable(uint64_t val64, float *val, int data); int is_mlnx_ext_port_info_supported(uint32_t vendorid, uint16_t devid); @@ -170,13 +170,13 @@ void dump_portinfo(void *pi, int tabs); /** * Some common command line parsing */ -typedef char *(op_fn_t) (ib_portid_t * dest, char **argv, int argc); +typedef const char *(op_fn_t)(ib_portid_t *dest, char **argv, int argc); typedef struct match_rec { const char *name, *alias; op_fn_t *fn; unsigned opt_portnum; - char *ops_extra; + const char *ops_extra; } match_rec_t; op_fn_t *match_op(const match_rec_t match_tbl[], char *name); diff --git a/libibmad/include/infiniband/mad.h b/libibmad/include/infiniband/mad.h index da8263665e33e6..c95f1b10d08610 100644 --- a/libibmad/include/infiniband/mad.h +++ b/libibmad/include/infiniband/mad.h @@ -1728,7 +1728,7 @@ extern MAD_EXPORT int ibdebug; exit(-1); \ } while(0) -MAD_EXPORT void xdump(FILE * file, char *msg, void *p, int size); +MAD_EXPORT void xdump(FILE * file, const char *msg, void *p, int size); END_C_DECLS #endif /* _MAD_H_ */ diff --git a/libibmad/src/dump.c b/libibmad/src/dump.c index d71c5291e94381..d1a69115f06313 100644 --- a/libibmad/src/dump.c +++ b/libibmad/src/dump.c @@ -1195,7 +1195,7 @@ void mad_dump_portinfo_ext(char *buf, int bufsz, void *val, int valsz) IB_PORT_EXT_HDR_FEC_MODE_LAST_F); } -void xdump(FILE * file, char *msg, void *p, int size) +void xdump(FILE * file, const char *msg, void *p, int size) { #define HEX(x) ((x) < 10 ? '0' + (x) : 'a' + ((x) -10)) uint8_t *cp = p; diff --git a/libibnetdisc/include/infiniband/ibnetdisc.h b/libibnetdisc/include/infiniband/ibnetdisc.h index acde1dc20caf4f..8bdc048459c3d2 100644 --- a/libibnetdisc/include/infiniband/ibnetdisc.h +++ b/libibnetdisc/include/infiniband/ibnetdisc.h @@ -243,7 +243,7 @@ IBND_EXPORT void ibnd_iter_ports(ibnd_fabric_t * fabric, */ IBND_EXPORT uint64_t ibnd_get_chassis_guid(ibnd_fabric_t * fabric, unsigned char chassisnum); -IBND_EXPORT char *ibnd_get_chassis_type(ibnd_node_t * node); +IBND_EXPORT const char *ibnd_get_chassis_type(ibnd_node_t *node); IBND_EXPORT char *ibnd_get_chassis_slot_str(ibnd_node_t * node, char *str, size_t size); diff --git a/libibnetdisc/src/chassis.c b/libibnetdisc/src/chassis.c index b0d272de9c5a29..5e0d0550c539fc 100644 --- a/libibnetdisc/src/chassis.c +++ b/libibnetdisc/src/chassis.c @@ -50,9 +50,9 @@ #include "internal.h" #include "chassis.h" -static char *ChassisTypeStr[] = +static const char * const ChassisTypeStr[] = { "", "ISR9288", "ISR9096", "ISR2012", "ISR2004", "ISR4700", "ISR4200" }; -static char *ChassisSlotTypeStr[] = { "", "Line", "Spine", "SRBD" }; +static const char * const ChassisSlotTypeStr[] = { "", "Line", "Spine", "SRBD" }; typedef struct chassis_scan { ibnd_chassis_t *first_chassis; @@ -60,7 +60,7 @@ typedef struct chassis_scan { ibnd_chassis_t *last_chassis; } chassis_scan_t; -char *ibnd_get_chassis_type(ibnd_node_t * node) +const char *ibnd_get_chassis_type(ibnd_node_t * node) { int chassis_type; diff --git a/libibnetdisc/src/ibnetdisc.c b/libibnetdisc/src/ibnetdisc.c index 8455d7f7229743..c89c0d4f10334b 100644 --- a/libibnetdisc/src/ibnetdisc.c +++ b/libibnetdisc/src/ibnetdisc.c @@ -515,8 +515,8 @@ static void link_ports(ibnd_node_t * node, ibnd_port_t * port, remoteport->remoteport = port; } -static void dump_endnode(ib_portid_t * path, char *prompt, - ibnd_node_t * node, ibnd_port_t * port) +static void dump_endnode(ib_portid_t *path, const char *prompt, + ibnd_node_t *node, ibnd_port_t *port) { char type[64]; mad_dump_node_type(type, sizeof(type), &node->type, sizeof(int)); diff --git a/libibnetdisc/test/testleaks.c b/libibnetdisc/test/testleaks.c index dc920c71fa6515..dd216b134d6f41 100644 --- a/libibnetdisc/test/testleaks.c +++ b/libibnetdisc/test/testleaks.c @@ -51,7 +51,7 @@ #include #include -char *argv0 = "iblinkinfotest"; +const char *argv0 = "iblinkinfotest"; static FILE *f; void usage(void) diff --git a/src/ibcacheedit.c b/src/ibcacheedit.c index b5208390b5ae90..904089b3b2e8e8 100644 --- a/src/ibcacheedit.c +++ b/src/ibcacheedit.c @@ -267,7 +267,7 @@ int main(int argc, char **argv) "Specify before and after port guid to edit"}, {0} }; - char *usage_args = " "; + const char *usage_args = " "; ibdiag_process_opts(argc, argv, NULL, "CDdeGKLPstvy", opts, process_opt, usage_args, diff --git a/src/ibccconfig.c b/src/ibccconfig.c index 64aa804c198182..19a075aa9dd435 100644 --- a/src/ibccconfig.c +++ b/src/ibccconfig.c @@ -81,7 +81,7 @@ static const match_rec_t match_tbl[] = { uint64_t cckey = 0; /*******************************************/ -static char *parselonglongint(char *arg, uint64_t *val) +static const char *parselonglongint(char *arg, uint64_t *val) { char *endptr = NULL; @@ -97,7 +97,7 @@ static char *parselonglongint(char *arg, uint64_t *val) return NULL; } -static char *parseint(char *arg, uint32_t *val, int hexonly) +static const char *parseint(char *arg, uint32_t *val, int hexonly) { char *endptr = NULL; @@ -113,7 +113,7 @@ static char *parseint(char *arg, uint32_t *val, int hexonly) return NULL; } -static char *congestion_key_info(ib_portid_t * dest, char **argv, int argc) +static const char *congestion_key_info(ib_portid_t *dest, char **argv, int argc) { uint8_t rcv[IB_CC_DATA_SZ] = { 0 }; uint8_t payload[IB_CC_DATA_SZ] = { 0 }; @@ -121,7 +121,7 @@ static char *congestion_key_info(ib_portid_t * dest, char **argv, int argc) uint32_t cc_keyprotectbit; uint32_t cc_keyleaseperiod; uint32_t cc_keyviolations; - char *errstr; + const char *errstr; if (argc != 4) return "invalid number of parameters for CongestionKeyInfo"; @@ -174,7 +174,7 @@ static char *congestion_key_info(ib_portid_t * dest, char **argv, int argc) /* parse like it's a hypothetical 256 bit hex code */ -static char *parse256(char *arg, uint8_t *buf) +static const char *parse256(char *arg, uint8_t *buf) { int numdigits = 0; int startindex; @@ -202,7 +202,7 @@ static char *parse256(char *arg, uint8_t *buf) for (i = startindex; i <= 31; i++) { char tmp[3] = { 0 }; uint32_t tmpint; - char *errstr; + const char *errstr; /* I can't help but think there is a strtoX that * will do this for me, but I can't find it. @@ -224,10 +224,10 @@ static char *parse256(char *arg, uint8_t *buf) return NULL; } -static char *parsecct(char *arg, uint32_t *shift, uint32_t *multiplier) +static const char *parsecct(char *arg, uint32_t *shift, uint32_t *multiplier) { char buf[1024] = { 0 }; - char *errstr; + const char *errstr; char *ptr; strcpy(buf, arg); @@ -247,7 +247,8 @@ static char *parsecct(char *arg, uint32_t *shift, uint32_t *multiplier) return NULL; } -static char *switch_congestion_setting(ib_portid_t * dest, char **argv, int argc) +static const char *switch_congestion_setting(ib_portid_t *dest, char **argv, + int argc) { uint8_t rcv[IB_CC_DATA_SZ] = { 0 }; uint8_t payload[IB_CC_DATA_SZ] = { 0 }; @@ -261,7 +262,7 @@ static char *switch_congestion_setting(ib_portid_t * dest, char **argv, int argc uint32_t cs_returndelay_m; uint32_t cs_returndelay; uint32_t marking_rate; - char *errstr; + const char *errstr; if (argc != 8) return "invalid number of parameters for SwitchCongestionSetting"; @@ -334,7 +335,8 @@ static char *switch_congestion_setting(ib_portid_t * dest, char **argv, int argc return NULL; } -static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int argc) +static const char *switch_port_congestion_setting(ib_portid_t *dest, + char **argv, int argc) { uint8_t rcv[IB_CC_DATA_SZ] = { 0 }; uint8_t payload[IB_CC_DATA_SZ] = { 0 }; @@ -348,7 +350,7 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int uint32_t type; uint32_t numports; uint8_t *ptr; - char *errstr; + const char *errstr; if (argc != 6) return "invalid number of parameters for SwitchPortCongestion"; @@ -418,7 +420,8 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int return NULL; } -static char *ca_congestion_setting(ib_portid_t * dest, char **argv, int argc) +static const char *ca_congestion_setting(ib_portid_t *dest, char **argv, + int argc) { uint8_t rcv[IB_CC_DATA_SZ] = { 0 }; uint8_t payload[IB_CC_DATA_SZ] = { 0 }; @@ -428,7 +431,7 @@ static char *ca_congestion_setting(ib_portid_t * dest, char **argv, int argc) uint32_t ccti_increase; uint32_t trigger_threshold; uint32_t ccti_min; - char *errstr; + const char *errstr; int i; if (argc != 6) @@ -492,7 +495,8 @@ static char *ca_congestion_setting(ib_portid_t * dest, char **argv, int argc) return NULL; } -static char *congestion_control_table(ib_portid_t * dest, char **argv, int argc) +static const char *congestion_control_table(ib_portid_t *dest, char **argv, + int argc) { uint8_t rcv[IB_CC_DATA_SZ] = { 0 }; uint8_t payload[IB_CC_DATA_SZ] = { 0 }; @@ -500,7 +504,7 @@ static char *congestion_control_table(ib_portid_t * dest, char **argv, int argc) uint32_t index; uint32_t cctshifts[64]; uint32_t cctmults[64]; - char *errstr; + const char *errstr; int i; if (argc < 2 || argc > 66) @@ -558,7 +562,7 @@ int main(int argc, char **argv) char usage_args[1024]; int mgmt_classes[3] = { IB_SMI_CLASS, IB_SA_CLASS, IB_CC_CLASS }; ib_portid_t portid = { 0 }; - char *err; + const char *err; op_fn_t *fn; const match_rec_t *r; int n; diff --git a/src/ibccquery.c b/src/ibccquery.c index 95e553d2dce426..9bcbf8645b7bd6 100644 --- a/src/ibccquery.c +++ b/src/ibccquery.c @@ -79,7 +79,7 @@ static const match_rec_t match_tbl[] = { uint64_t cckey = 0; /*******************************************/ -static char *class_port_info(ib_portid_t * dest, char **argv, int argc) +static const char *class_port_info(ib_portid_t *dest, char **argv, int argc) { char buf[2048]; char data[IB_CC_DATA_SZ] = { 0 }; @@ -94,7 +94,7 @@ static char *class_port_info(ib_portid_t * dest, char **argv, int argc) return NULL; } -static char *congestion_info(ib_portid_t * dest, char **argv, int argc) +static const char *congestion_info(ib_portid_t *dest, char **argv, int argc) { char buf[2048]; char data[IB_CC_DATA_SZ] = { 0 }; @@ -109,7 +109,7 @@ static char *congestion_info(ib_portid_t * dest, char **argv, int argc) return NULL; } -static char *congestion_key_info(ib_portid_t * dest, char **argv, int argc) +static const char *congestion_key_info(ib_portid_t *dest, char **argv, int argc) { char buf[2048]; char data[IB_CC_DATA_SZ] = { 0 }; @@ -124,7 +124,7 @@ static char *congestion_key_info(ib_portid_t * dest, char **argv, int argc) return NULL; } -static char *congestion_log(ib_portid_t * dest, char **argv, int argc) +static const char *congestion_log(ib_portid_t *dest, char **argv, int argc) { char buf[2048]; char data[IB_CC_LOG_DATA_SZ] = { 0 }; @@ -180,7 +180,8 @@ static char *congestion_log(ib_portid_t * dest, char **argv, int argc) return NULL; } -static char *switch_congestion_setting(ib_portid_t * dest, char **argv, int argc) +static const char *switch_congestion_setting(ib_portid_t *dest, char **argv, + int argc) { char buf[2048]; char data[IB_CC_DATA_SZ] = { 0 }; @@ -195,7 +196,8 @@ static char *switch_congestion_setting(ib_portid_t * dest, char **argv, int argc return NULL; } -static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int argc) +static const char *switch_port_congestion_setting(ib_portid_t *dest, + char **argv, int argc) { char buf[2048]; char data[IB_CC_DATA_SZ] = { 0 }; @@ -257,7 +259,8 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int return NULL; } -static char *ca_congestion_setting(ib_portid_t * dest, char **argv, int argc) +static const char *ca_congestion_setting(ib_portid_t *dest, char **argv, + int argc) { char buf[2048]; char data[IB_CC_DATA_SZ] = { 0 }; @@ -281,7 +284,8 @@ static char *ca_congestion_setting(ib_portid_t * dest, char **argv, int argc) return NULL; } -static char *congestion_control_table(ib_portid_t * dest, char **argv, int argc) +static const char *congestion_control_table(ib_portid_t *dest, char **argv, + int argc) { char buf[2048]; char data[IB_CC_DATA_SZ] = { 0 }; @@ -321,7 +325,7 @@ static char *congestion_control_table(ib_portid_t * dest, char **argv, int argc) return NULL; } -static char *timestamp_dump(ib_portid_t * dest, char **argv, int argc) +static const char *timestamp_dump(ib_portid_t *dest, char **argv, int argc) { char buf[2048]; char data[IB_CC_DATA_SZ] = { 0 }; @@ -353,7 +357,7 @@ int main(int argc, char **argv) char usage_args[1024]; int mgmt_classes[3] = { IB_SMI_CLASS, IB_SA_CLASS, IB_CC_CLASS }; ib_portid_t portid = { 0 }; - char *err; + const char *err; op_fn_t *fn; const match_rec_t *r; int n; diff --git a/src/ibdiag_common.c b/src/ibdiag_common.c index bc1d897c422bbb..cfc7b926b61d94 100644 --- a/src/ibdiag_common.c +++ b/src/ibdiag_common.c @@ -413,7 +413,7 @@ int ibdiag_process_opts(int argc, char *const argv[], void *cxt, return 0; } -void ibexit(const char *fn, char *msg, ...) +void ibexit(const char *fn, const char *msg, ...) { char buf[512]; va_list va; @@ -434,8 +434,7 @@ void ibexit(const char *fn, char *msg, ...) exit(-1); } -char * -conv_cnt_human_readable(uint64_t val64, float *val, int data) +const char *conv_cnt_human_readable(uint64_t val64, float *val, int data) { uint64_t tmp = val64; int ui = 0; diff --git a/src/iblinkinfo.c b/src/iblinkinfo.c index deccb090c8e31f..0252d5bbd0d9e9 100644 --- a/src/iblinkinfo.c +++ b/src/iblinkinfo.c @@ -104,7 +104,7 @@ int filterdownport_check(ibnd_node_t * node, ibnd_port_t * port) return (fistate == IB_LINK_DOWN) ? 1 : 0; } -void print_port(ibnd_node_t * node, ibnd_port_t * port, char *out_prefix) +void print_port(ibnd_node_t *node, ibnd_port_t *port, const char *out_prefix) { char width[64], speed[64], state[64], physstate[64]; char remote_guid_str[256]; @@ -272,7 +272,7 @@ static inline const char *nodetype_str(ibnd_node_t * node) } void print_node_header(ibnd_node_t *node, int *out_header_flag, - char *out_prefix) + const char *out_prefix) { uint64_t guid = 0; if ((!out_header_flag || !(*out_header_flag)) && !line_mode) { @@ -321,8 +321,8 @@ struct iter_diff_data { uint32_t diff_flags; ibnd_fabric_t *fabric1; ibnd_fabric_t *fabric2; - char *fabric1_prefix; - char *fabric2_prefix; + const char *fabric1_prefix; + const char *fabric2_prefix; }; void diff_node_ports(ibnd_node_t * fabric1_node, ibnd_node_t * fabric2_node, @@ -417,7 +417,7 @@ void diff_node_iter(ibnd_node_t * fabric1_node, void *iter_user_data) fabric2_node = ibnd_find_node_guid(data->fabric2, fabric1_node->guid); if (!fabric2_node) - print_node(fabric1_node, data->fabric1_prefix); + print_node(fabric1_node, (void *)data->fabric1_prefix); else if (data->diff_flags & (DIFF_FLAG_PORT_CONNECTION | DIFF_FLAG_PORT_STATE | DIFF_FLAG_LID | DIFF_FLAG_NODE_DESCRIPTION)) { diff --git a/src/ibnetdiscover.c b/src/ibnetdiscover.c index 0eef703b5e5f6d..f3bfa5d353858c 100644 --- a/src/ibnetdiscover.c +++ b/src/ibnetdiscover.c @@ -84,7 +84,7 @@ static int full_info; * Define our own conversion functions to maintain compatibility with the old * ibnetdiscover which did not use the ibmad conversion functions. */ -char *dump_linkspeed_compat(uint32_t speed) +const char *dump_linkspeed_compat(uint32_t speed) { switch (speed) { case 1: @@ -100,7 +100,8 @@ char *dump_linkspeed_compat(uint32_t speed) return ("???"); } -char *dump_linkspeedext_compat(uint32_t espeed, uint32_t speed, uint32_t fdr10) +const char *dump_linkspeedext_compat(uint32_t espeed, uint32_t speed, + uint32_t fdr10) { switch (espeed) { case 0: @@ -122,7 +123,7 @@ char *dump_linkspeedext_compat(uint32_t espeed, uint32_t speed, uint32_t fdr10) return ("???"); } -char *dump_linkwidth_compat(uint32_t width) +const char *dump_linkwidth_compat(uint32_t width) { switch (width) { case 1: @@ -220,7 +221,7 @@ void list_nodes(ibnd_fabric_t * fabric, int list) ibnd_iter_nodes_type(fabric, list_node, IB_NODE_ROUTER, NULL); } -void out_ids(ibnd_node_t * node, int group, char *chname, char *out_prefix) +void out_ids(ibnd_node_t *node, int group, char *chname, const char *out_prefix) { uint64_t sysimgguid = mad_get_field64(node->info, 0, IB_NODE_SYSTEM_GUID_F); @@ -258,7 +259,7 @@ uint64_t out_chassis(ibnd_fabric_t * fabric, unsigned char chassisnum) return guid; } -void out_switch_detail(ibnd_node_t * node, char *sw_prefix) +void out_switch_detail(ibnd_node_t * node, const char *sw_prefix) { char *nodename = NULL; @@ -272,10 +273,10 @@ void out_switch_detail(ibnd_node_t * node, char *sw_prefix) free(nodename); } -void out_switch(ibnd_node_t * node, int group, char *chname, char *id_prefix, - char *sw_prefix) +void out_switch(ibnd_node_t *node, int group, char *chname, + const char *id_prefix, const char *sw_prefix) { - char *str; + const char *str; char str2[256]; out_ids(node, group, chname, id_prefix); @@ -298,9 +299,9 @@ void out_switch(ibnd_node_t * node, int group, char *chname, char *id_prefix, fprintf(f, "\n"); } -void out_ca_detail(ibnd_node_t * node, char *ca_prefix) +void out_ca_detail(ibnd_node_t *node, const char *ca_prefix) { - char *node_type; + const char *node_type; switch (node->type) { case IB_NODE_CA: @@ -319,10 +320,10 @@ void out_ca_detail(ibnd_node_t * node, char *ca_prefix) clean_nodedesc(node->nodedesc)); } -void out_ca(ibnd_node_t * node, int group, char *chname, char *id_prefix, - char *ca_prefix) +void out_ca(ibnd_node_t *node, int group, char *chname, const char *id_prefix, + const char *ca_prefix) { - char *node_type; + const char *node_type; out_ids(node, group, chname, id_prefix); switch (node->type) { @@ -359,7 +360,8 @@ static char *out_ext_port(ibnd_port_t * port, int group) return (NULL); } -void out_switch_port(ibnd_port_t * port, int group, char *out_prefix) +static void out_switch_port(ibnd_port_t *port, int group, + const char *out_prefix) { char *ext_port_str = NULL; char *rem_nodename = NULL; @@ -427,7 +429,7 @@ void out_switch_port(ibnd_port_t * port, int group, char *out_prefix) free(rem_nodename); } -void out_ca_port(ibnd_port_t * port, int group, char *out_prefix) +void out_ca_port(ibnd_port_t *port, int group, const char *out_prefix) { char *str = NULL; char *rem_nodename = NULL; @@ -760,11 +762,12 @@ struct iter_diff_data { uint32_t diff_flags; ibnd_fabric_t *fabric1; ibnd_fabric_t *fabric2; - char *fabric1_prefix; - char *fabric2_prefix; - void (*out_header) (ibnd_node_t *, int, char *, char *, char *); - void (*out_header_detail) (ibnd_node_t *, char *); - void (*out_port) (ibnd_port_t *, int, char *); + const char *fabric1_prefix; + const char *fabric2_prefix; + void (*out_header)(ibnd_node_t *, int, char *, const char *, + const char *); + void (*out_header_detail)(ibnd_node_t *, const char *); + void (*out_port)(ibnd_port_t *, int, const char *); }; static void diff_iter_out_header(ibnd_node_t * node, @@ -921,12 +924,12 @@ static void diff_iter_func(ibnd_node_t * fabric1_node, void *iter_user_data) } } -static int diff_common(ibnd_fabric_t * orig_fabric, ibnd_fabric_t * new_fabric, +static int diff_common(ibnd_fabric_t *orig_fabric, ibnd_fabric_t *new_fabric, int node_type, uint32_t diff_flags, - void (*out_header) (ibnd_node_t *, int, char *, char *, - char *), - void (*out_header_detail) (ibnd_node_t *, char *), - void (*out_port) (ibnd_port_t *, int, char *)) + void (*out_header)(ibnd_node_t *, int, char *, + const char *, const char *), + void (*out_header_detail)(ibnd_node_t *, const char *), + void (*out_port)(ibnd_port_t *, int, const char *)) { struct iter_diff_data iter_diff_data; diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c index 43b062a14ed797..4d5bc7c21b7498 100644 --- a/src/ibqueryerrors.c +++ b/src/ibqueryerrors.c @@ -92,11 +92,11 @@ struct { } summary = { 0 }; #define DEF_THRES_FILE IBDIAG_CONFIG_PATH"/error_thresholds" -static char *threshold_file = DEF_THRES_FILE; +static const char *threshold_file = DEF_THRES_FILE; /* define a "packet" with threshold values in it */ uint8_t thresholds[1204] = { 0 }; -char * threshold_str = ""; +char *threshold_str = NULL; static unsigned valid_gid(ib_gid_t * gid) { @@ -127,7 +127,7 @@ static void set_thres(char *name, uint64_t val) } } -static void set_thresholds(char *threshold_file) +static void set_thresholds(const char *threshold_file) { char buf[1024]; uint64_t val = 0; @@ -399,7 +399,7 @@ static int check_threshold(uint8_t *pc, uint8_t *pce, uint32_t cap_mask2, uint64_t val64 = 0; int is_exceeds = 0; float val = 0; - char *unit = ""; + const char *unit = ""; if (htonl(cap_mask2) & IB_PM_IS_ADDL_PORT_CTRS_EXT_SUP) { mad_decode_field(pce, ext_i, (void *)&val64); @@ -488,7 +488,7 @@ static int print_results(ib_portid_t * portid, char *node_name, for (i = start_field; i <= end_field; i++) { uint64_t val64 = 0; float val = 0; - char *unit = ""; + const char *unit = ""; mad_decode_field(pkt, i, (void *)&val64); if (val64) { int data = 0; @@ -614,7 +614,7 @@ static int print_data_cnts(ib_portid_t * portid, uint16_t cap_mask, for (i = start_field; i <= end_field; i++) { uint64_t val64 = 0; float val = 0; - char *unit = ""; + const char *unit = ""; int data = 0; mad_decode_field(pc, i, (void *)&val64); if (i == IB_PC_EXT_XMT_BYTES_F || i == IB_PC_EXT_RCV_BYTES_F || diff --git a/src/ibroute.c b/src/ibroute.c index 2514073970b481..111524ae97299d 100644 --- a/src/ibroute.c +++ b/src/ibroute.c @@ -59,8 +59,8 @@ static nn_map_t *node_name_map = NULL; /*******************************************/ -char *check_switch(ib_portid_t * portid, unsigned int *nports, uint64_t * guid, - uint8_t * sw, char *nd) +const char *check_switch(ib_portid_t *portid, unsigned int *nports, + uint64_t *guid, uint8_t *sw, char *nd) { uint8_t ni[IB_SMP_DATA_SIZE] = { 0 }; int type; @@ -135,13 +135,13 @@ int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports, uint16_t mft[16][IB_MLIDS_IN_BLOCK] = { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0}, { 0 }, { 0 } }; -char *dump_multicast_tables(ib_portid_t * portid, unsigned startlid, - unsigned endlid) +const char *dump_multicast_tables(ib_portid_t *portid, unsigned startlid, + unsigned endlid) { char nd[IB_SMP_DATA_SIZE] = { 0 }; uint8_t sw[IB_SMP_DATA_SIZE] = { 0 }; - char str[512]; - char *s; + char str[512], *s; + const char *err; uint64_t nodeguid; uint32_t mod; unsigned block, i, j, e, nports, cap, chunks, startblock, lastblock, @@ -149,8 +149,8 @@ char *dump_multicast_tables(ib_portid_t * portid, unsigned startlid, char *mapnd = NULL; int n = 0; - if ((s = check_switch(portid, &nports, &nodeguid, sw, nd))) - return s; + if ((err = check_switch(portid, &nports, &nodeguid, sw, nd))) + return err; mad_decode_field(sw, IB_SW_MCAST_FDB_CAP_F, &cap); mad_decode_field(sw, IB_SW_MCAST_FDB_TOP_F, &top); @@ -322,12 +322,13 @@ int dump_lid(char *str, int strlen, int lid, int valid) return rc; } -char *dump_unicast_tables(ib_portid_t * portid, int startlid, int endlid) +const char *dump_unicast_tables(ib_portid_t *portid, int startlid, int endlid) { char lft[IB_SMP_DATA_SIZE] = { 0 }; char nd[IB_SMP_DATA_SIZE] = { 0 }; uint8_t sw[IB_SMP_DATA_SIZE] = { 0 }; - char str[200], *s; + char str[200]; + const char *s; uint64_t nodeguid; int block, i, e, top; unsigned nports; @@ -423,7 +424,7 @@ int main(int argc, char **argv) { IB_SMI_CLASS, IB_SMI_DIRECT_CLASS, IB_SA_CLASS }; ib_portid_t portid = { 0 }; unsigned startlid = 0, endlid = 0; - char *err; + const char *err; const struct ibdiag_opt opts[] = { {"all", 'a', 0, NULL, "show all lids, even invalid entries"}, diff --git a/src/ibsendtrap.c b/src/ibsendtrap.c index 7044deb783d8c3..d892c97fc4fc40 100644 --- a/src/ibsendtrap.c +++ b/src/ibsendtrap.c @@ -208,7 +208,7 @@ static int send_trap(void (*build) (ib_mad_notice_attr_t *, ib_portid_t *)) } typedef struct _trap_def { - char *trap_name; + const char *trap_name; void (*build_func) (ib_mad_notice_attr_t *, ib_portid_t *); } trap_def_t; @@ -224,7 +224,7 @@ static const trap_def_t traps[] = { {NULL, NULL} }; -int process_send_trap(char *trap_name) +int process_send_trap(const char *trap_name) { int i; @@ -239,7 +239,7 @@ int main(int argc, char **argv) { char usage_args[1024]; int mgmt_classes[2] = { IB_SMI_CLASS, IB_SMI_DIRECT_CLASS }; - char *trap_name = NULL; + const char *trap_name = NULL; int i, n, rc; n = sprintf(usage_args, "[] []\n" diff --git a/src/ibstat.c b/src/ibstat.c index bad4c99800e721..1e62a06735453d 100644 --- a/src/ibstat.c +++ b/src/ibstat.c @@ -54,7 +54,7 @@ #include -static char *node_type_str[] = { +static const char * const node_type_str[] = { "???", "CA", "Switch", @@ -82,7 +82,7 @@ static void ca_dump(umad_ca_t * ca) be64toh(ca->system_guid)); } -static char *port_state_str[] = { +static const char * const port_state_str[] = { "???", "Down", "Initializing", @@ -90,7 +90,7 @@ static char *port_state_str[] = { "Active" }; -static char *port_phy_state_str[] = { +static const char * const port_phy_state_str[] = { "No state change", "Sleep", "Polling", @@ -110,8 +110,8 @@ static int ret_code(void) return e; } -static int sys_read_string(char *dir_name, char *file_name, char *str, - int max_len) +static int sys_read_string(const char *dir_name, const char *file_name, + char *str, int max_len) { char path[256], *s; int fd, r; @@ -163,8 +163,8 @@ done: static int port_dump(umad_port_t * port, int alone) { - char *pre = ""; - char *hdrpre = ""; + const char *pre = ""; + const char *hdrpre = ""; if (!port) return -1; diff --git a/src/ibtracert.c b/src/ibtracert.c index 92c7f061fa155e..2fc8b9879225a8 100644 --- a/src/ibtracert.c +++ b/src/ibtracert.c @@ -56,7 +56,7 @@ struct ibmad_port *srcport; #define MAXHOPS 63 -static char *node_type_str[] = { +static const char * const node_type_str[] = { "???", "ca", "switch", @@ -214,7 +214,7 @@ static int extend_dpath(ib_dr_path_t * path, int nextport) return path->cnt; } -static void dump_endnode(int dump, char *prompt, Node * node, Port * port) +static void dump_endnode(int dump, const char *prompt, Node *node, Port *port) { char *nodename = NULL; diff --git a/src/mcm_rereg_test.c b/src/mcm_rereg_test.c index 182749e7a16e0d..197a7877d2956a 100644 --- a/src/mcm_rereg_test.c +++ b/src/mcm_rereg_test.c @@ -309,8 +309,8 @@ static int rereg_query_all(int port, int agent, ib_portid_t * dport, #define MAX_CLIENTS 50 -static int rereg_and_test_port(char *guid_file, int port, int agent, - ib_portid_t * dport, int timeout) +static int rereg_and_test_port(const char *guid_file, int port, int agent, + ib_portid_t *dport, int timeout) { char line[256]; FILE *f; @@ -356,9 +356,9 @@ static int rereg_and_test_port(char *guid_file, int port, int agent, return 0; } -int main(int argc, char **argv) +int main(int argc, const char **argv) { - char *guid_file = "port_guids.list"; + const char *guid_file = "port_guids.list"; int mgmt_classes[2] = { IB_SMI_CLASS, IB_SMI_DIRECT_CLASS }; ib_portid_t dport_id; int port, agent; diff --git a/src/sminfo.c b/src/sminfo.c index 894d9fc38262c1..caec7cf00d5f3d 100644 --- a/src/sminfo.c +++ b/src/sminfo.c @@ -62,7 +62,7 @@ enum { SMINFO_STATE_LAST, }; -char *statestr[] = { +const char *const statestr[] = { "SMINFO_NOTACT", "SMINFO_DISCOVER", "SMINFO_STANDBY", diff --git a/src/smpquery.c b/src/smpquery.c index 37461b8b2e76e3..4a104174fdcb34 100644 --- a/src/smpquery.c +++ b/src/smpquery.c @@ -76,7 +76,7 @@ static nn_map_t *node_name_map = NULL; static int extended_speeds = 0; /*******************************************/ -static char *node_desc(ib_portid_t * dest, char **argv, int argc) +static const char *node_desc(ib_portid_t *dest, char **argv, int argc) { int node_type, l; uint64_t node_guid; @@ -110,7 +110,7 @@ static char *node_desc(ib_portid_t * dest, char **argv, int argc) return 0; } -static char *node_info(ib_portid_t * dest, char **argv, int argc) +static const char *node_info(ib_portid_t * dest, char **argv, int argc) { char buf[2048]; char data[IB_SMP_DATA_SIZE] = { 0 }; @@ -124,7 +124,7 @@ static char *node_info(ib_portid_t * dest, char **argv, int argc) return 0; } -static char *port_info_extended(ib_portid_t * dest, char **argv, int argc) +static const char *port_info_extended(ib_portid_t *dest, char **argv, int argc) { char buf[2048]; uint8_t data[IB_SMP_DATA_SIZE] = { 0 }; @@ -146,7 +146,7 @@ static char *port_info_extended(ib_portid_t * dest, char **argv, int argc) return 0; } -static char *port_info(ib_portid_t * dest, char **argv, int argc) +static const char *port_info(ib_portid_t *dest, char **argv, int argc) { char data[IB_SMP_DATA_SIZE] = { 0 }; int portnum = 0, orig_portnum; @@ -165,7 +165,7 @@ static char *port_info(ib_portid_t * dest, char **argv, int argc) return 0; } -static char *mlnx_ext_port_info(ib_portid_t * dest, char **argv, int argc) +static const char *mlnx_ext_port_info(ib_portid_t *dest, char **argv, int argc) { char buf[2300]; char data[IB_SMP_DATA_SIZE]; @@ -183,7 +183,7 @@ static char *mlnx_ext_port_info(ib_portid_t * dest, char **argv, int argc) return 0; } -static char *switch_info(ib_portid_t * dest, char **argv, int argc) +static const char *switch_info(ib_portid_t *dest, char **argv, int argc) { char buf[2048]; char data[IB_SMP_DATA_SIZE] = { 0 }; @@ -197,7 +197,7 @@ static char *switch_info(ib_portid_t * dest, char **argv, int argc) return 0; } -static char *pkey_table(ib_portid_t * dest, char **argv, int argc) +static const char *pkey_table(ib_portid_t *dest, char **argv, int argc) { uint8_t data[IB_SMP_DATA_SIZE] = { 0 }; int i, j, k; @@ -249,7 +249,7 @@ static char *pkey_table(ib_portid_t * dest, char **argv, int argc) return 0; } -static char *sl2vl_dump_table_entry(ib_portid_t * dest, int in, int out) +static const char *sl2vl_dump_table_entry(ib_portid_t *dest, int in, int out) { char buf[2048]; char data[IB_SMP_DATA_SIZE] = { 0 }; @@ -264,12 +264,12 @@ static char *sl2vl_dump_table_entry(ib_portid_t * dest, int in, int out) return 0; } -static char *sl2vl_table(ib_portid_t * dest, char **argv, int argc) +static const char *sl2vl_table(ib_portid_t *dest, char **argv, int argc) { uint8_t data[IB_SMP_DATA_SIZE] = { 0 }; int type, num_ports, portnum = 0; int i; - char *ret; + const char *ret; if (argc > 0) portnum = strtol(argv[0], 0, 0); @@ -299,8 +299,8 @@ static char *sl2vl_table(ib_portid_t * dest, char **argv, int argc) return 0; } -static char *vlarb_dump_table_entry(ib_portid_t * dest, int portnum, int offset, - unsigned cap) +static const char *vlarb_dump_table_entry(ib_portid_t *dest, int portnum, + int offset, unsigned cap) { char buf[2048]; char data[IB_SMP_DATA_SIZE] = { 0 }; @@ -313,10 +313,10 @@ static char *vlarb_dump_table_entry(ib_portid_t * dest, int portnum, int offset, return 0; } -static char *vlarb_dump_table(ib_portid_t * dest, int portnum, - char *name, int offset, int cap) +static const char *vlarb_dump_table(ib_portid_t *dest, int portnum, + const char *name, int offset, int cap) { - char *ret; + const char *ret; printf("# %s priority VL Arbitration Table:", name); ret = vlarb_dump_table_entry(dest, portnum, offset, @@ -327,12 +327,12 @@ static char *vlarb_dump_table(ib_portid_t * dest, int portnum, return ret; } -static char *vlarb_table(ib_portid_t * dest, char **argv, int argc) +static const char *vlarb_table(ib_portid_t *dest, char **argv, int argc) { uint8_t data[IB_SMP_DATA_SIZE] = { 0 }; int portnum = 0; int type, enhsp0, lowcap, highcap; - char *ret = 0; + const char *ret = NULL; if (argc > 0) portnum = strtol(argv[0], 0, 0); @@ -378,7 +378,7 @@ static char *vlarb_table(ib_portid_t * dest, char **argv, int argc) return ret; } -static char *guid_info(ib_portid_t * dest, char **argv, int argc) +static const char *guid_info(ib_portid_t *dest, char **argv, int argc) { uint8_t data[IB_SMP_DATA_SIZE] = { 0 }; int i, j, k; @@ -437,7 +437,7 @@ int main(int argc, char **argv) int mgmt_classes[3] = { IB_SMI_CLASS, IB_SMI_DIRECT_CLASS, IB_SA_CLASS }; ib_portid_t portid = { 0 }; - char *err; + const char *err; op_fn_t *fn; const match_rec_t *r; int n; From patchwork Fri Mar 8 19:55:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10845369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C7084A0A for ; Fri, 8 Mar 2019 19:55:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24A1A2FE1E for ; Fri, 8 Mar 2019 19:55:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1939A2FF7A; Fri, 8 Mar 2019 19:55:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AA1A2FE1E for ; Fri, 8 Mar 2019 19:55:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726687AbfCHTz3 (ORCPT ); Fri, 8 Mar 2019 14:55:29 -0500 Received: from mail-qk1-f175.google.com ([209.85.222.175]:36481 "EHLO mail-qk1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726613AbfCHTz2 (ORCPT ); Fri, 8 Mar 2019 14:55:28 -0500 Received: by mail-qk1-f175.google.com with SMTP id c2so11890363qkb.3 for ; Fri, 08 Mar 2019 11:55:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LZnP4x6BqSIaWQ2sn/BRAwOXVBnQXHatk14RtwI6zuo=; b=mpUqBQzV0zJvUtwaxgHW2HXLpi4lNYWgWj1EllUKec8XTP6WDwNKtvXCbIj+MoP8W+ TRXXnO+9TFsFIu4HAuTFTq0KQU3RsgWDBEGRQud4YXlKmWrP3UvEWmGhGHHy4/fH3djI tlrVAhAOuWKubBI+cGpH2FZgxlA0V1pE1ZM1uze6oDz4AJh2AAFC9/m+EtPcVEh2mbVE 5aDtdYQCGiZMXdfL2I/byTmFr0lipp8jIahueSTud0SCfxd2Tg4OAJ0jCxqEozOWUAHG gfP2yD3MPBVEpiIrbAsky95oxZkj1QG9YABpTvZTu0AGEc3oX7FWTkWVU1V3gliJBQgz ncDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LZnP4x6BqSIaWQ2sn/BRAwOXVBnQXHatk14RtwI6zuo=; b=pgcCYL62b9J45UnqhHcrtTmfACOxxmNpu2nCM6zJLZAB2ZznERXTbVk2hpKd7M1lAj yUCg9dmgGO4AGrPgJrIV6LOWTyv5KZA6bs3w7H4nGoC9fTGsu3WDWJdZPFYN94I1zwXD IMWo5C+cFLAsXr6/uf2xaIEr2RnFMIjrm/vP2noT0vIML/FSxu52f90DVkwtq0Zj/qcm mdEPyUzwHZlWTpGJFrQLcgS6OQIZ5i/TBFSakJ38qhk9O7jb4MYXjN7bj3SPNkZ9o+TB AzMIZFG6shy2OAExcsDm93H42izBMf9yVzNURHyITl5k9E4MPTifo0+chshpXLhaZW6j YZlg== X-Gm-Message-State: APjAAAXiCmETvI+VenaSaEoWfElC2DEiYXPQ19y71mjRyC1szNyw+IR7 w6CDdMsHmRwU0AloYNzC0N/gAGVOm0A47g== X-Google-Smtp-Source: APXvYqz+cw2nnbQSRvbZUY7G7kpMhiKgsvn4n2R70FU1O/EoqoQWgbU/arGSXbcoz9gQUCvywmUWvg== X-Received: by 2002:a37:a5cc:: with SMTP id o195mr6316223qke.250.1552074927111; Fri, 08 Mar 2019 11:55:27 -0800 (PST) Received: from ziepe.ca ([24.137.65.181]) by smtp.gmail.com with ESMTPSA id 50sm5346383qtr.96.2019.03.08.11.55.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Mar 2019 11:55:23 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1h2LaU-0000vM-8g; Fri, 08 Mar 2019 15:55:22 -0400 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 04/14] libibmad: Use {} instead of {0} Date: Fri, 8 Mar 2019 15:55:05 -0400 Message-Id: <20190308195515.3408-5-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308195515.3408-1-jgg@ziepe.ca> References: <20190308195515.3408-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe This is the style in rdma-core. Fixes the compiler warning: warning: missing initializer for field ‘name’ of ‘ib_field_t {aka const struct ib_field}’ [-Wmissing-field-initializers] Signed-off-by: Jason Gunthorpe --- libibmad/src/fields.c | 96 +++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/libibmad/src/fields.c b/libibmad/src/fields.c index 61fd540cd29510..1af7a6cfa17880 100644 --- a/libibmad/src/fields.c +++ b/libibmad/src/fields.c @@ -55,7 +55,7 @@ #define BE_TO_BITSOFFS(o, w) (((o) & ~31) | ((32 - ((o) & 31) - (w)))) static const ib_field_t ib_mad_f[] = { - {0, 0}, /* IB_NO_FIELD - reserved as invalid */ + {}, /* IB_NO_FIELD - reserved as invalid */ {0, 64, "GidPrefix", mad_dump_rhex}, {64, 64, "GidGuid", mad_dump_rhex}, @@ -108,7 +108,7 @@ static const ib_field_t ib_mad_f[] = { {56 * 8, (256 - 56) * 8, "SaData", mad_dump_hex}, /* bytes 64 - 127 */ - {0, 0}, /* IB_SM_DATA_F - reserved as invalid */ + {}, /* IB_SM_DATA_F - reserved as invalid */ /* bytes 64 - 256 */ {64 * 8, (256 - 64) * 8, "GsData", mad_dump_hex}, @@ -169,7 +169,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(428, 4), "OverrunErr", mad_dump_uint}, {BITSOFFS(432, 16), "MaxCreditHint", mad_dump_uint}, {BITSOFFS(456, 24), "RoundTrip", mad_dump_uint}, - {0, 0}, /* IB_PORT_LAST_F */ + {}, /* IB_PORT_LAST_F */ /* * NodeInfo fields @@ -186,7 +186,7 @@ static const ib_field_t ib_mad_f[] = { {256, 32, "Revision", mad_dump_hex}, {BITSOFFS(288, 8), "LocalPort", mad_dump_uint}, {BITSOFFS(296, 24), "VendorId", mad_dump_hex}, - {0, 0}, /* IB_NODE_LAST_F */ + {}, /* IB_NODE_LAST_F */ /* * SwitchInfo fields @@ -209,7 +209,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(131, 1), "FilterRawOutbound", mad_dump_uint}, {BITSOFFS(132, 1), "EnhancedPort0", mad_dump_uint}, {BITSOFFS(144, 16), "MulticastFDBTop", mad_dump_hex}, - {0, 0}, /* IB_SW_LAST_F */ + {}, /* IB_SW_LAST_F */ /* * SwitchLinearForwardingTable fields @@ -264,7 +264,7 @@ static const ib_field_t ib_mad_f[] = { {256, 32, "PortXmitPkts", mad_dump_uint}, {288, 32, "PortRcvPkts", mad_dump_uint}, {320, 32, "PortXmitWait", mad_dump_uint}, - {0, 0}, /* IB_PC_LAST_F */ + {}, /* IB_PC_LAST_F */ /* * SMInfo @@ -374,7 +374,7 @@ static const ib_field_t ib_mad_f[] = { {384, 64, "PortUnicastRcvPkts", mad_dump_uint}, {448, 64, "PortMulticastXmitPkts", mad_dump_uint}, {512, 64, "PortMulticastRcvPkts", mad_dump_uint}, - {0, 0}, /* IB_PC_EXT_LAST_F */ + {}, /* IB_PC_EXT_LAST_F */ /* * GUIDInfo fields @@ -426,7 +426,7 @@ static const ib_field_t ib_mad_f[] = { {448, 32, "XmtDataSL13", mad_dump_uint}, {480, 32, "XmtDataSL14", mad_dump_uint}, {512, 32, "XmtDataSL15", mad_dump_uint}, - {0, 0}, /* IB_PC_XMT_DATA_SL_LAST_F */ + {}, /* IB_PC_XMT_DATA_SL_LAST_F */ /* * PortRcvDataSL fields @@ -447,7 +447,7 @@ static const ib_field_t ib_mad_f[] = { {448, 32, "RcvDataSL13", mad_dump_uint}, {480, 32, "RcvDataSL14", mad_dump_uint}, {512, 32, "RcvDataSL15", mad_dump_uint}, - {0, 0}, /* IB_PC_RCV_DATA_SL_LAST_F */ + {}, /* IB_PC_RCV_DATA_SL_LAST_F */ /* * PortXmitDiscardDetails fields @@ -456,7 +456,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(48, 16), "PortNeighborMTUDiscards", mad_dump_uint}, {BITSOFFS(64, 16), "PortSwLifetimeLimitDiscards", mad_dump_uint}, {BITSOFFS(80, 16), "PortSwHOQLifetimeLimitDiscards", mad_dump_uint}, - {0, 0}, /* IB_PC_XMT_DISC_LAST_F */ + {}, /* IB_PC_XMT_DISC_LAST_F */ /* * PortRcvErrorDetails fields @@ -467,7 +467,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(80, 16), "PortDLIDMappingErrors", mad_dump_uint}, {BITSOFFS(96, 16), "PortVLMappingErrors", mad_dump_uint}, {BITSOFFS(112, 16), "PortLoopingErrors", mad_dump_uint}, - {0, 0}, /* IB_PC_RCV_ERR_LAST_F */ + {}, /* IB_PC_RCV_ERR_LAST_F */ /* * PortSamplesControl fields @@ -502,7 +502,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(512, 16), "CounterSelect13", mad_dump_hex}, {BITSOFFS(528, 16), "CounterSelect14", mad_dump_hex}, {576, 64, "SamplesOnlyOptionMask", mad_dump_hex}, - {0, 0}, /* IB_PSC_LAST_F */ + {}, /* IB_PSC_LAST_F */ /* GUIDInfo fields */ {0, 64, "GUID0", mad_dump_hex}, @@ -533,7 +533,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(496, 4), "LinkSpeedExtActive", mad_dump_linkspeedext}, {BITSOFFS(500, 4), "LinkSpeedExtSupported", mad_dump_linkspeedextsup}, {BITSOFFS(507, 5), "LinkSpeedExtEnabled", mad_dump_linkspeedexten}, - {0, 0}, /* IB_PORT_LINK_SPEED_EXT_LAST_F */ + {}, /* IB_PORT_LINK_SPEED_EXT_LAST_F */ /* * PortExtendedSpeedsCounters fields @@ -578,21 +578,21 @@ static const ib_field_t ib_mad_f[] = { {1024, 32, "FECUncorrectableBlockCtrLane9", mad_dump_uint}, {1056, 32, "FECUncorrectableBlockCtrLane10", mad_dump_uint}, {1088, 32, "FECUncorrectableBlockCtrLane11", mad_dump_uint}, - {0, 0}, /* IB_PESC_LAST_F */ + {}, /* IB_PESC_LAST_F */ /* * PortOpRcvCounters fields */ {32, 32, "PortOpRcvPkts", mad_dump_uint}, {64, 32, "PortOpRcvData", mad_dump_uint}, - {0, 0}, /* IB_PC_PORT_OP_RCV_COUNTERS_LAST_F */ + {}, /* IB_PC_PORT_OP_RCV_COUNTERS_LAST_F */ /* * PortFlowCtlCounters fields */ {32, 32, "PortXmitFlowPkts", mad_dump_uint}, {64, 32, "PortRcvFlowPkts", mad_dump_uint}, - {0, 0}, /* IB_PC_PORT_FLOW_CTL_COUNTERS_LAST_F */ + {}, /* IB_PC_PORT_FLOW_CTL_COUNTERS_LAST_F */ /* * PortVLOpPackets fields @@ -613,7 +613,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(240, 16), "PortVLOpPackets13", mad_dump_uint}, {BITSOFFS(256, 16), "PortVLOpPackets14", mad_dump_uint}, {BITSOFFS(272, 16), "PortVLOpPackets15", mad_dump_uint}, - {0, 0}, /* IB_PC_PORT_VL_OP_PACKETS_LAST_F */ + {}, /* IB_PC_PORT_VL_OP_PACKETS_LAST_F */ /* * PortVLOpData fields @@ -634,7 +634,7 @@ static const ib_field_t ib_mad_f[] = { {448, 32, "PortVLOpData13", mad_dump_uint}, {480, 32, "PortVLOpData14", mad_dump_uint}, {512, 32, "PortVLOpData15", mad_dump_uint}, - {0, 0}, /* IB_PC_PORT_VL_OP_DATA_LAST_F */ + {}, /* IB_PC_PORT_VL_OP_DATA_LAST_F */ /* * PortVLXmitFlowCtlUpdateErrors fields @@ -655,7 +655,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(58, 2), "PortVLXmitFlowCtlUpdateErrors13", mad_dump_uint}, {BITSOFFS(60, 2), "PortVLXmitFlowCtlUpdateErrors14", mad_dump_uint}, {BITSOFFS(62, 2), "PortVLXmitFlowCtlUpdateErrors15", mad_dump_uint}, - {0, 0}, /* IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS_LAST_F */ + {}, /* IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS_LAST_F */ /* * PortVLXmitWaitCounters fields @@ -676,7 +676,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(240, 16), "PortVLXmitWait13", mad_dump_uint}, {BITSOFFS(256, 16), "PortVLXmitWait14", mad_dump_uint}, {BITSOFFS(272, 16), "PortVLXmitWait15", mad_dump_uint}, - {0, 0}, /* IB_PC_PORT_VL_XMIT_WAIT_COUNTERS_LAST_F */ + {}, /* IB_PC_PORT_VL_XMIT_WAIT_COUNTERS_LAST_F */ /* * SwPortVLCongestion fields @@ -697,14 +697,14 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(240, 16), "SWPortVLCongestion13", mad_dump_uint}, {BITSOFFS(256, 16), "SWPortVLCongestion14", mad_dump_uint}, {BITSOFFS(272, 16), "SWPortVLCongestion15", mad_dump_uint}, - {0, 0}, /* IB_PC_SW_PORT_VL_CONGESTION_LAST_F */ + {}, /* IB_PC_SW_PORT_VL_CONGESTION_LAST_F */ /* * PortRcvConCtrl fields */ {32, 32, "PortPktRcvFECN", mad_dump_uint}, {64, 32, "PortPktRcvBECN", mad_dump_uint}, - {0, 0}, /* IB_PC_RCV_CON_CTRL_LAST_F */ + {}, /* IB_PC_RCV_CON_CTRL_LAST_F */ /* * PortSLRcvFECN fields @@ -725,7 +725,7 @@ static const ib_field_t ib_mad_f[] = { {448, 32, "PortSLRcvFECN13", mad_dump_uint}, {480, 32, "PortSLRcvFECN14", mad_dump_uint}, {512, 32, "PortSLRcvFECN15", mad_dump_uint}, - {0, 0}, /* IB_PC_SL_RCV_FECN_LAST_F */ + {}, /* IB_PC_SL_RCV_FECN_LAST_F */ /* * PortSLRcvBECN fields @@ -746,13 +746,13 @@ static const ib_field_t ib_mad_f[] = { {448, 32, "PortSLRcvBECN13", mad_dump_uint}, {480, 32, "PortSLRcvBECN14", mad_dump_uint}, {512, 32, "PortSLRcvBECN15", mad_dump_uint}, - {0, 0}, /* IB_PC_SL_RCV_BECN_LAST_F */ + {}, /* IB_PC_SL_RCV_BECN_LAST_F */ /* * PortXmitConCtrl fields */ {32, 32, "PortXmitTimeCong", mad_dump_uint}, - {0, 0}, /* IB_PC_XMIT_CON_CTRL_LAST_F */ + {}, /* IB_PC_XMIT_CON_CTRL_LAST_F */ /* * PortVLXmitTimeCong fields @@ -772,7 +772,7 @@ static const ib_field_t ib_mad_f[] = { {416, 32, "PortVLXmitTimeCong12", mad_dump_uint}, {448, 32, "PortVLXmitTimeCong13", mad_dump_uint}, {480, 32, "PortVLXmitTimeCong14", mad_dump_uint}, - {0, 0}, /* IB_PC_VL_XMIT_TIME_CONG_LAST_F */ + {}, /* IB_PC_VL_XMIT_TIME_CONG_LAST_F */ /* * Mellanox ExtendedPortInfo fields @@ -781,7 +781,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(56, 8), "LinkSpeedSupported", mad_dump_hex}, {BITSOFFS(88, 8), "LinkSpeedEnabled", mad_dump_hex}, {BITSOFFS(120, 8), "LinkSpeedActive", mad_dump_hex}, - {0, 0}, /* IB_MLNX_EXT_PORT_LAST_F */ + {}, /* IB_MLNX_EXT_PORT_LAST_F */ /* * Congestion Control Mad fields @@ -794,7 +794,7 @@ static const ib_field_t ib_mad_f[] = { */ {BITSOFFS(0, 16), "CongestionInfo", mad_dump_hex}, {BITSOFFS(16, 8), "ControlTableCap", mad_dump_uint}, - {0, 0}, /* IB_CC_CONGESTION_INFO_LAST_F */ + {}, /* IB_CC_CONGESTION_INFO_LAST_F */ /* * CongestionKeyInfo fields @@ -803,14 +803,14 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(64, 1), "CC_KeyProtectBit", mad_dump_uint}, {BITSOFFS(80, 16), "CC_KeyLeasePeriod", mad_dump_uint}, {BITSOFFS(96, 16), "CC_KeyViolations", mad_dump_uint}, - {0, 0}, /* IB_CC_CONGESTION_KEY_INFO_LAST_F */ + {}, /* IB_CC_CONGESTION_KEY_INFO_LAST_F */ /* * CongestionLog (common) fields */ {BITSOFFS(0, 8), "LogType", mad_dump_uint}, {BITSOFFS(8, 8), "CongestionFlags", mad_dump_hex}, - {0, 0}, /* IB_CC_CONGESTION_LOG_LAST_F */ + {}, /* IB_CC_CONGESTION_LOG_LAST_F */ /* * CongestionLog (Switch) fields @@ -818,7 +818,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(16, 16), "LogEventsCounter", mad_dump_uint}, {32, 32, "CurrentTimeStamp", mad_dump_uint}, {64, 256, "PortMap", mad_dump_array}, - {0, 0}, /* IB_CC_CONGESTION_LOG_SWITCH_LAST_F */ + {}, /* IB_CC_CONGESTION_LOG_SWITCH_LAST_F */ /* * CongestionLogEvent (Switch) fields @@ -827,7 +827,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(16, 16), "DLID", mad_dump_uint}, {BITSOFFS(32, 4), "SL", mad_dump_uint}, {64, 32, "Timestamp", mad_dump_uint}, - {0, 0}, /* IB_CC_CONGESTION_LOG_ENTRY_SWITCH_LAST_F */ + {}, /* IB_CC_CONGESTION_LOG_ENTRY_SWITCH_LAST_F */ /* * CongestionLog (CA) fields @@ -838,7 +838,7 @@ static const ib_field_t ib_mad_f[] = { * word aligned. Assume will be aligned to offset 64 later. */ {BITSOFFS(64, 32), "CurrentTimeStamp", mad_dump_uint}, - {0, 0}, /* IB_CC_CONGESTION_LOG_CA_LAST_F */ + {}, /* IB_CC_CONGESTION_LOG_CA_LAST_F */ /* * CongestionLogEvent (CA) fields @@ -850,7 +850,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(64, 16), "Local_LID_CN", mad_dump_uint}, {BITSOFFS(80, 16), "Remote_LID_CN_Entry", mad_dump_uint}, {BITSOFFS(96, 32), "Timestamp_CN_Entry", mad_dump_uint}, - {0, 0}, /* IB_CC_CONGESTION_LOG_ENTRY_CA_LAST_F */ + {}, /* IB_CC_CONGESTION_LOG_ENTRY_CA_LAST_F */ /* * SwitchCongestionSetting fields @@ -863,7 +863,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(560, 4), "CS_Threshold", mad_dump_hex}, {BITSOFFS(576, 16), "CS_ReturnDelay", mad_dump_hex}, /* TODO: CCT dump */ {BITSOFFS(592, 16), "Marking_Rate", mad_dump_uint}, - {0, 0}, /* IB_CC_SWITCH_CONGESTION_SETTING_LAST_F */ + {}, /* IB_CC_SWITCH_CONGESTION_SETTING_LAST_F */ /* * SwitchPortCongestionSettingElement fields @@ -873,14 +873,14 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(4, 4), "Threshold", mad_dump_hex}, {BITSOFFS(8, 8), "Packet_Size", mad_dump_uint}, {BITSOFFS(16, 16), "Cong_Parm_Marking_Rate", mad_dump_uint}, - {0, 0}, /* IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_LAST_F */ + {}, /* IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_LAST_F */ /* * CACongestionSetting fields */ {BITSOFFS(0, 16), "Port_Control", mad_dump_hex}, {BITSOFFS(16, 16), "Control_Map", mad_dump_hex}, - {0, 0}, /* IB_CC_CA_CONGESTION_SETTING_LAST_F */ + {}, /* IB_CC_CA_CONGESTION_SETTING_LAST_F */ /* * CACongestionEntry fields @@ -889,26 +889,26 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(16, 8), "CCTI_Increase", mad_dump_uint}, {BITSOFFS(24, 8), "Trigger_Threshold", mad_dump_uint}, {BITSOFFS(32, 8), "CCTI_Min", mad_dump_uint}, - {0, 0}, /* IB_CC_CA_CONGESTION_SETTING_ENTRY_LAST_F */ + {}, /* IB_CC_CA_CONGESTION_SETTING_ENTRY_LAST_F */ /* * CongestionControlTable fields */ {BITSOFFS(0, 16), "CCTI_Limit", mad_dump_uint}, - {0, 0}, /* IB_CC_CONGESTION_CONTROL_TABLE_LAST_F */ + {}, /* IB_CC_CONGESTION_CONTROL_TABLE_LAST_F */ /* * CongestionControlTableEntry fields */ {BITSOFFS(0, 2), "CCT_Shift", mad_dump_uint}, {BITSOFFS(2, 14), "CCT_Multiplier", mad_dump_uint}, - {0, 0}, /* IB_CC_CONGESTION_CONTROL_TABLE_ENTRY_LAST_F */ + {}, /* IB_CC_CONGESTION_CONTROL_TABLE_ENTRY_LAST_F */ /* * Timestamp fields */ {0, 32, "Timestamp", mad_dump_uint}, - {0, 0}, /* IB_CC_TIMESTAMP_LAST_F */ + {}, /* IB_CC_TIMESTAMP_LAST_F */ /* Node Record */ {BITSOFFS(0, 16), "Lid", mad_dump_uint}, @@ -925,7 +925,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(320, 8), "LocalPort", mad_dump_uint}, {BITSOFFS(328, 24), "VendorId", mad_dump_hex}, {352, 64 * 8, "NodeDesc", mad_dump_string}, - {0, 0}, /* IB_SA_NR_LAST_F */ + {}, /* IB_SA_NR_LAST_F */ /* * PortSamplesResult fields @@ -947,7 +947,7 @@ static const ib_field_t ib_mad_f[] = { {416, 32, "Counter12", mad_dump_uint}, {448, 32, "Counter13", mad_dump_uint}, {480, 32, "Counter14", mad_dump_uint}, - {0, 0}, /* IB_PSR_LAST_F */ + {}, /* IB_PSR_LAST_F */ /* * PortInfoExtended fields @@ -958,7 +958,7 @@ static const ib_field_t ib_mad_f[] = { {BITSOFFS(64, 16), "FDRFECModeEnabled", mad_dump_hex}, {BITSOFFS(80, 16), "EDRFECModeSupported", mad_dump_hex}, {BITSOFFS(96, 16), "EDRFECModeEnabled", mad_dump_hex}, - {0, 0}, /* IB_PORT_EXT_LAST_F */ + {}, /* IB_PORT_EXT_LAST_F */ /* * PortExtendedSpeedsCounters RSFEC Active fields @@ -982,7 +982,7 @@ static const ib_field_t ib_mad_f[] = { {1120, 32, "PortFECCorrectableBlockCtr", mad_dump_uint}, {1152, 32, "PortFECUncorrectableBlockCtr", mad_dump_uint}, {1184, 32, "PortFECCorrectedSymbolCtr", mad_dump_uint}, - {0, 0}, /* IB_PESC_RSFEC_LAST_F */ + {}, /* IB_PESC_RSFEC_LAST_F */ /* * More PortCountersExtended fields @@ -1002,7 +1002,7 @@ static const ib_field_t ib_mad_f[] = { {1280, 64, "VL15Dropped", mad_dump_uint}, {1344, 64, "PortXmitWait", mad_dump_uint}, {1408, 64, "QP1Dropped", mad_dump_uint}, - {0, 0}, /* IB_PC_EXT_ERR_LAST_F */ + {}, /* IB_PC_EXT_ERR_LAST_F */ /* * Another PortCounters field @@ -1014,9 +1014,9 @@ static const ib_field_t ib_mad_f[] = { */ {112, 16, "HDRFECModeSupported", mad_dump_hex}, {128, 16, "HDRFECModeEnabled", mad_dump_hex}, - {0, 0}, /* IB_PORT_EXT_HDR_FEC_MODE_LAST_F */ + {}, /* IB_PORT_EXT_HDR_FEC_MODE_LAST_F */ - {0, 0} /* IB_FIELD_LAST_ */ + {} /* IB_FIELD_LAST_ */ }; static void _set_field64(void *buf, int base_offs, const ib_field_t * f, From patchwork Fri Mar 8 19:55:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10845379 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 960D4922 for ; Fri, 8 Mar 2019 19:55:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8224B2DE17 for ; Fri, 8 Mar 2019 19:55:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 76BBC2FE8A; Fri, 8 Mar 2019 19:55:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22C3C2FE1E for ; Fri, 8 Mar 2019 19:55:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726613AbfCHTzc (ORCPT ); Fri, 8 Mar 2019 14:55:32 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:33604 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726859AbfCHTza (ORCPT ); Fri, 8 Mar 2019 14:55:30 -0500 Received: by mail-qk1-f194.google.com with SMTP id x9so11914703qkf.0 for ; Fri, 08 Mar 2019 11:55:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XqCozWMuYJ60RIXLLjC6Cx37w7Y8U00BJxjSrLnuJuc=; b=aaaOmDAf/OiX1BcDAlc5BW2jN95klwnfe8C1lPsbSPjNmbWpv8owtscImyl07cCwCu o2jaxT39nG971PiDEdjhW0Mrr6EMKMomIX6DyOS3Zs7ePIcs/OchEhprr15iKlIyrHTJ sXEq/sDwEPlRY2OKXLj9E7XDFvtWhQezk4mo5K2sL+nWegiXAPeG+7pabsOoQKnw927i Sq0qjHg7F+lqk92sNnUnLfou5mPbOtdcS/6P0NyEjGR5Ap2fK3RVzokOhottgsOZkhV5 vqor8QSENMJjb/MVONKl4txYifcIk36Z+xSgLdhiOPPJSvU+3q08Br/iTdIL+175OsBL xJ8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XqCozWMuYJ60RIXLLjC6Cx37w7Y8U00BJxjSrLnuJuc=; b=tq+lnjk2T/yQuAc7V3hz16rlF16/3rkyS6N4Yq50LTwE94mON/eUlXysGT8Zz8JAkB HOIZIGBljymq+ZN/isWwC4POEz/qxcqLXWJhfEAfU8EPTCaeDT9+gKhAF7+tP+2cipsr iXNWwzuAmk0JVl7FXXVUhp8cIGqTEYckm6rO5IogOJfFq7E6dDs3TPsd05b7dBzxc4/d B2LmXo790SjnMkn6iLLtXCCdGB9MhsDUfcsiJqoLa6bqbaJKHe7LNfHljgRizhVb1Amv MSlfQegZIi1Ln20FXNoPI+KgHEvG2mr4bNU3ajK6ohv0ui5g8+LExXyCHpbS3jYyzb5z XSdg== X-Gm-Message-State: APjAAAWStSs0QN9JZsXy1pbT9xiBF3oVMy9xJnDOIa+0gJqkINmAIiGV t/zsqKY9p1PoN/TxboVAF22LCFc+6QlOJw== X-Google-Smtp-Source: APXvYqzxasPMRnLexa8b64lmKgUglZUwy88DGGNfQbI5CuiCyhNHHrSo1FW6oW9/eAXyzxm3Xwp/Gg== X-Received: by 2002:a37:553:: with SMTP id 80mr14631856qkf.19.1552074929463; Fri, 08 Mar 2019 11:55:29 -0800 (PST) Received: from ziepe.ca ([24.137.65.181]) by smtp.gmail.com with ESMTPSA id w33sm2428674qth.34.2019.03.08.11.55.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Mar 2019 11:55:23 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1h2LaU-0000vS-Ao; Fri, 08 Mar 2019 15:55:22 -0400 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 05/14] ibdiags: Put the prototype for mlnx_ext_port_infor_err in a header Date: Fri, 8 Mar 2019 15:55:06 -0400 Message-Id: <20190308195515.3408-6-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308195515.3408-1-jgg@ziepe.ca> References: <20190308195515.3408-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe Prototypes should be where the implementation can see them to avoid mistakes. Fixes the compiler warning: ibnetdisc.c:228:5: warning: no previous prototype for ‘mlnx_ext_port_info_err’ [-Wmissing-prototypes] Signed-off-by: Jason Gunthorpe --- libibnetdisc/src/internal.h | 3 +++ libibnetdisc/src/query_smp.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libibnetdisc/src/internal.h b/libibnetdisc/src/internal.h index 997f439da07caa..c12b03af7946fd 100644 --- a/libibnetdisc/src/internal.h +++ b/libibnetdisc/src/internal.h @@ -114,4 +114,7 @@ void add_to_type_list(ibnd_node_t * node, f_internal_t * fabric); void destroy_node(ibnd_node_t * node); +int mlnx_ext_port_info_err(smp_engine_t *engine, ibnd_smp_t *smp, uint8_t *mad, + void *cb_data); + #endif /* _INTERNAL_H_ */ diff --git a/libibnetdisc/src/query_smp.c b/libibnetdisc/src/query_smp.c index 8f179e4913fcaf..f6b632905084dc 100644 --- a/libibnetdisc/src/query_smp.c +++ b/libibnetdisc/src/query_smp.c @@ -41,9 +41,6 @@ #include #include "internal.h" -extern int mlnx_ext_port_info_err(smp_engine_t * engine, ibnd_smp_t * smp, - uint8_t * mad, void *cb_data); - static void queue_smp(smp_engine_t * engine, ibnd_smp_t * smp) { smp->qnext = NULL; From patchwork Fri Mar 8 19:55:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10845381 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C3EB0922 for ; Fri, 8 Mar 2019 19:55:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADF712FE1E for ; Fri, 8 Mar 2019 19:55:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A20352FE96; Fri, 8 Mar 2019 19:55:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D2772FE1E for ; Fri, 8 Mar 2019 19:55:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726643AbfCHTzd (ORCPT ); Fri, 8 Mar 2019 14:55:33 -0500 Received: from mail-qk1-f176.google.com ([209.85.222.176]:42398 "EHLO mail-qk1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726903AbfCHTzc (ORCPT ); Fri, 8 Mar 2019 14:55:32 -0500 Received: by mail-qk1-f176.google.com with SMTP id y140so11887667qkb.9 for ; Fri, 08 Mar 2019 11:55:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2QwpotvBDyXG7hWbUAylfx5LltkisvYi3qcS6dlXDW0=; b=UdG0gyBxp0lJYXRr5p4XHczz1LY13aTBM/kASfA34Tbpdot4wCgM/OmFPNBgKSfXzR 85iwVf4kzLb3Jv+vBBAkjqrKm46xX8KG6dcNtAJKR3Ro8qo2iJHfw1iw8alnI5OjPnmJ Dr3F88s00MKM67/0q5o4MkgrD5vb9NZll+IoOCetKuwNeKExIEFwk2IBhHYDkFi8AdGP 0bx/uaDftOEcAH/sBuKJLfNOErkWmi0AHW2mSc8ISgJO7YFaWu2DjlndQHdWS7i6d+u+ JMfiArPumxpk09YcU2kOgZk1QzSN1di5sK7UKHvdlo5UXcZiq0gojZkTmgv8cUBQx1HN 2CQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2QwpotvBDyXG7hWbUAylfx5LltkisvYi3qcS6dlXDW0=; b=FlKdf2KdZts8ua4p0PlHIXkc2HzpMT3FV/w0BVMztz6qe7XFdbDeUwUyUOE3EovZBg NGhYZLsFyItkDNwuk6izTAQRvkF8TVzebjynEB0ToT+HL8gq71HuVj3HbSRud0kwfsk4 WpymTDLEQfbbzcK6eF2sB+rvhyNzbkpE+32mpiflyTFiH++roCyMY8NjNvIKFq+E/nZm cU8jxpEF2yPernWfDHbkGRx3HCT+OYta4sMJwBydJeJ60Ln+g+SJfn5Dj6vSaDxgEHig pgjiFgD0u/WGHWT4ZxHjCtsBnhjpSFajwJZfoH3M2o/an839pUbk9XBoX6aRcOKxm0rv Vrag== X-Gm-Message-State: APjAAAXuVjILpkYfZlFR2oBUHIoflJYp4T/3D7Ovv3JEit8yvnWSY7H4 rY3vS2y6xrwoaknQJqwIwNYtzvNMLRbayA== X-Google-Smtp-Source: APXvYqxW4BUBvIBYKRYOwwlnV4dQlUVpNEp1C6m6ZL3NnqHhLAF0FLKjuOFU+zK/YLiw8x7cWnkIBQ== X-Received: by 2002:a37:5ca:: with SMTP id 193mr15747555qkf.55.1552074930642; Fri, 08 Mar 2019 11:55:30 -0800 (PST) Received: from ziepe.ca ([24.137.65.181]) by smtp.gmail.com with ESMTPSA id p64sm4614413qkc.62.2019.03.08.11.55.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Mar 2019 11:55:23 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1h2LaU-0000vY-CJ; Fri, 08 Mar 2019 15:55:22 -0400 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 06/14] ibdiags: Make functions used in only one file static Date: Fri, 8 Mar 2019 15:55:07 -0400 Message-Id: <20190308195515.3408-7-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308195515.3408-1-jgg@ziepe.ca> References: <20190308195515.3408-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe Fixes the compiler warning warning: no previous prototype for ‘dump_multicast_tables’ [-Wmissing-prototypes] Signed-off-by: Jason Gunthorpe --- libibnetdisc/test/testleaks.c | 2 +- src/dump_fts.c | 26 +++++++++++----------- src/ibdiag_common.c | 14 ++++++------ src/iblinkinfo.c | 20 +++++++++-------- src/ibnetdiscover.c | 41 ++++++++++++++++++----------------- src/ibping.c | 2 +- src/ibqueryerrors.c | 8 +++---- src/ibroute.c | 17 ++++++++------- src/ibsendtrap.c | 2 +- src/ibsysstat.c | 2 +- src/mcm_rereg_test.c | 3 ++- src/perfquery.c | 2 +- src/smpdump.c | 6 ++--- 13 files changed, 75 insertions(+), 70 deletions(-) diff --git a/libibnetdisc/test/testleaks.c b/libibnetdisc/test/testleaks.c index dd216b134d6f41..84c2b76558c328 100644 --- a/libibnetdisc/test/testleaks.c +++ b/libibnetdisc/test/testleaks.c @@ -54,7 +54,7 @@ const char *argv0 = "iblinkinfotest"; static FILE *f; -void usage(void) +static void usage(void) { fprintf(stderr, "Usage: %s [-hclp -D -C -P ]\n" diff --git a/src/dump_fts.c b/src/dump_fts.c index 20abd241cc1576..998383aa470453 100644 --- a/src/dump_fts.c +++ b/src/dump_fts.c @@ -65,8 +65,8 @@ static nn_map_t *node_name_map = NULL; #define IB_MLIDS_IN_BLOCK (IB_SMP_DATA_SIZE/2) -int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports, - uint16_t mft[16][IB_MLIDS_IN_BLOCK]) +static int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports, + uint16_t mft[16][IB_MLIDS_IN_BLOCK]) { uint16_t mask; unsigned i, chunk, bit, nonzero = 0; @@ -110,8 +110,8 @@ int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports, uint16_t mft[16][IB_MLIDS_IN_BLOCK] = { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0}, { 0 }, { 0 } }; -void dump_multicast_tables(ibnd_node_t * node, unsigned startlid, - unsigned endlid, struct ibmad_port * mad_port) +static void dump_multicast_tables(ibnd_node_t *node, unsigned startlid, + unsigned endlid, struct ibmad_port *mad_port) { ib_portid_t *portid = &node->path_portid; char nd[IB_SMP_DATA_SIZE] = { 0 }; @@ -225,10 +225,9 @@ void dump_multicast_tables(ibnd_node_t * node, unsigned startlid, free(mapnd); } -int dump_lid(char *str, int str_len, int lid, int valid, - ibnd_fabric_t *fabric, - int * last_port_lid, int * base_port_lid, - uint64_t * portguid) +static int dump_lid(char *str, int str_len, int lid, int valid, + ibnd_fabric_t *fabric, int *last_port_lid, + int *base_port_lid, uint64_t *portguid) { char nd[IB_SMP_DATA_SIZE] = { 0 }; @@ -302,8 +301,9 @@ int dump_lid(char *str, int str_len, int lid, int valid, return rc; } -void dump_unicast_tables(ibnd_node_t * node, int startlid, int endlid, - struct ibmad_port *mad_port, ibnd_fabric_t *fabric) +static void dump_unicast_tables(ibnd_node_t *node, int startlid, int endlid, + struct ibmad_port *mad_port, + ibnd_fabric_t *fabric) { ib_portid_t * portid = &node->path_portid; char lft[IB_SMP_DATA_SIZE] = { 0 }; @@ -379,8 +379,8 @@ void dump_unicast_tables(ibnd_node_t * node, int startlid, int endlid, free(mapnd); } -void dump_node(ibnd_node_t *node, struct ibmad_port *mad_port, - ibnd_fabric_t *fabric) +static void dump_node(ibnd_node_t *node, struct ibmad_port *mad_port, + ibnd_fabric_t *fabric) { if (multicast) dump_multicast_tables(node, startlid, endlid, mad_port); @@ -389,7 +389,7 @@ void dump_node(ibnd_node_t *node, struct ibmad_port *mad_port, mad_port, fabric); } -void process_switch(ibnd_node_t * node, void *fabric) +static void process_switch(ibnd_node_t *node, void *fabric) { dump_node(node, srcport, (ibnd_fabric_t *)fabric); } diff --git a/src/ibdiag_common.c b/src/ibdiag_common.c index cfc7b926b61d94..867b5d0c5693e1 100644 --- a/src/ibdiag_common.c +++ b/src/ibdiag_common.c @@ -118,7 +118,7 @@ static inline int val_str_true(const char *val_str) (strncmp(val_str, "true", strlen("true")) == 0)); } -void read_ibdiag_config(const char *file) +static void read_ibdiag_config(const char *file) { char buf[1024]; FILE *config_fd = NULL; @@ -633,9 +633,9 @@ int resolve_self(char *ca_name, uint8_t ca_port, ib_portid_t *portid, return 0; } -int resolve_gid(char *ca_name, uint8_t ca_port, ib_portid_t * portid, - ibmad_gid_t gid, ib_portid_t * sm_id, - const struct ibmad_port *srcport) +static int resolve_gid(char *ca_name, uint8_t ca_port, ib_portid_t *portid, + ibmad_gid_t gid, ib_portid_t *sm_id, + const struct ibmad_port *srcport) { ib_portid_t sm_portid; char buf[IB_SA_DATA_SIZE] = { 0 }; @@ -653,9 +653,9 @@ int resolve_gid(char *ca_name, uint8_t ca_port, ib_portid_t * portid, return 0; } -int resolve_guid(char *ca_name, uint8_t ca_port, ib_portid_t *portid, - uint64_t *guid, ib_portid_t *sm_id, - const struct ibmad_port *srcport) +static int resolve_guid(char *ca_name, uint8_t ca_port, ib_portid_t *portid, + uint64_t *guid, ib_portid_t *sm_id, + const struct ibmad_port *srcport) { ib_portid_t sm_portid; uint8_t buf[IB_SA_DATA_SIZE] = { 0 }; diff --git a/src/iblinkinfo.c b/src/iblinkinfo.c index 0252d5bbd0d9e9..9542a0ea51c3ca 100644 --- a/src/iblinkinfo.c +++ b/src/iblinkinfo.c @@ -80,7 +80,7 @@ static int add_sw_settings = 0; static int only_flag = 0; static int only_type = 0; -int filterdownport_check(ibnd_node_t * node, ibnd_port_t * port) +static int filterdownport_check(ibnd_node_t *node, ibnd_port_t *port) { ibnd_node_t *fsw; ibnd_port_t *fport; @@ -104,7 +104,8 @@ int filterdownport_check(ibnd_node_t * node, ibnd_port_t * port) return (fistate == IB_LINK_DOWN) ? 1 : 0; } -void print_port(ibnd_node_t *node, ibnd_port_t *port, const char *out_prefix) +static void print_port(ibnd_node_t *node, ibnd_port_t *port, + const char *out_prefix) { char width[64], speed[64], state[64], physstate[64]; char remote_guid_str[256]; @@ -271,7 +272,7 @@ static inline const char *nodetype_str(ibnd_node_t * node) return "??"; } -void print_node_header(ibnd_node_t *node, int *out_header_flag, +static void print_node_header(ibnd_node_t *node, int *out_header_flag, const char *out_prefix) { uint64_t guid = 0; @@ -298,7 +299,7 @@ void print_node_header(ibnd_node_t *node, int *out_header_flag, } } -void print_node(ibnd_node_t * node, void *user_data) +static void print_node(ibnd_node_t *node, void *user_data) { int i = 0; int head_print = 0; @@ -325,8 +326,9 @@ struct iter_diff_data { const char *fabric2_prefix; }; -void diff_node_ports(ibnd_node_t * fabric1_node, ibnd_node_t * fabric2_node, - int *head_print, struct iter_diff_data *data) +static void diff_node_ports(ibnd_node_t *fabric1_node, + ibnd_node_t *fabric2_node, int *head_print, + struct iter_diff_data *data) { int i = 0; @@ -407,7 +409,7 @@ void diff_node_ports(ibnd_node_t * fabric1_node, ibnd_node_t * fabric2_node, } } -void diff_node_iter(ibnd_node_t * fabric1_node, void *iter_user_data) +static void diff_node_iter(ibnd_node_t *fabric1_node, void *iter_user_data) { struct iter_diff_data *data = iter_user_data; ibnd_node_t *fabric2_node; @@ -453,8 +455,8 @@ void diff_node_iter(ibnd_node_t * fabric1_node, void *iter_user_data) } } -int diff_node(ibnd_node_t * node, ibnd_fabric_t * orig_fabric, - ibnd_fabric_t * new_fabric) +static int diff_node(ibnd_node_t *node, ibnd_fabric_t *orig_fabric, + ibnd_fabric_t *new_fabric) { struct iter_diff_data iter_diff_data; diff --git a/src/ibnetdiscover.c b/src/ibnetdiscover.c index f3bfa5d353858c..053f3bd70563a7 100644 --- a/src/ibnetdiscover.c +++ b/src/ibnetdiscover.c @@ -84,7 +84,7 @@ static int full_info; * Define our own conversion functions to maintain compatibility with the old * ibnetdiscover which did not use the ibmad conversion functions. */ -const char *dump_linkspeed_compat(uint32_t speed) +static const char *dump_linkspeed_compat(uint32_t speed) { switch (speed) { case 1: @@ -100,8 +100,8 @@ const char *dump_linkspeed_compat(uint32_t speed) return ("???"); } -const char *dump_linkspeedext_compat(uint32_t espeed, uint32_t speed, - uint32_t fdr10) +static const char *dump_linkspeedext_compat(uint32_t espeed, uint32_t speed, + uint32_t fdr10) { switch (espeed) { case 0: @@ -123,7 +123,7 @@ const char *dump_linkspeedext_compat(uint32_t espeed, uint32_t speed, return ("???"); } -const char *dump_linkwidth_compat(uint32_t width) +static const char *dump_linkwidth_compat(uint32_t width) { switch (width) { case 1: @@ -158,7 +158,7 @@ static inline const char *ports_nt_str_compat(ibnd_node_t * node) return "??"; } -char *node_name(ibnd_node_t * node) +static char *node_name(ibnd_node_t * node) { static char buf[256]; @@ -181,9 +181,9 @@ char *node_name(ibnd_node_t * node) return buf; } -void list_node(ibnd_node_t * node, void *user_data) +static void list_node(ibnd_node_t *node, void *user_data) { - char *node_type; + const char *node_type; char *nodename = remap_node_name(node_name_map, node->guid, node->nodedesc); @@ -211,7 +211,7 @@ void list_node(ibnd_node_t * node, void *user_data) free(nodename); } -void list_nodes(ibnd_fabric_t * fabric, int list) +static void list_nodes(ibnd_fabric_t *fabric, int list) { if (list & LIST_CA_NODE) ibnd_iter_nodes_type(fabric, list_node, IB_NODE_CA, NULL); @@ -221,7 +221,8 @@ void list_nodes(ibnd_fabric_t * fabric, int list) ibnd_iter_nodes_type(fabric, list_node, IB_NODE_ROUTER, NULL); } -void out_ids(ibnd_node_t *node, int group, char *chname, const char *out_prefix) +static void out_ids(ibnd_node_t *node, int group, char *chname, + const char *out_prefix) { uint64_t sysimgguid = mad_get_field64(node->info, 0, IB_NODE_SYSTEM_GUID_F); @@ -247,7 +248,7 @@ void out_ids(ibnd_node_t *node, int group, char *chname, const char *out_prefix) fprintf(f, "\n"); } -uint64_t out_chassis(ibnd_fabric_t * fabric, unsigned char chassisnum) +static uint64_t out_chassis(ibnd_fabric_t *fabric, unsigned char chassisnum) { uint64_t guid; @@ -259,7 +260,7 @@ uint64_t out_chassis(ibnd_fabric_t * fabric, unsigned char chassisnum) return guid; } -void out_switch_detail(ibnd_node_t * node, const char *sw_prefix) +static void out_switch_detail(ibnd_node_t *node, const char *sw_prefix) { char *nodename = NULL; @@ -273,8 +274,8 @@ void out_switch_detail(ibnd_node_t * node, const char *sw_prefix) free(nodename); } -void out_switch(ibnd_node_t *node, int group, char *chname, - const char *id_prefix, const char *sw_prefix) +static void out_switch(ibnd_node_t *node, int group, char *chname, + const char *id_prefix, const char *sw_prefix) { const char *str; char str2[256]; @@ -299,7 +300,7 @@ void out_switch(ibnd_node_t *node, int group, char *chname, fprintf(f, "\n"); } -void out_ca_detail(ibnd_node_t *node, const char *ca_prefix) +static void out_ca_detail(ibnd_node_t *node, const char *ca_prefix) { const char *node_type; @@ -320,8 +321,8 @@ void out_ca_detail(ibnd_node_t *node, const char *ca_prefix) clean_nodedesc(node->nodedesc)); } -void out_ca(ibnd_node_t *node, int group, char *chname, const char *id_prefix, - const char *ca_prefix) +static void out_ca(ibnd_node_t *node, int group, char *chname, + const char *id_prefix, const char *ca_prefix) { const char *node_type; @@ -429,7 +430,7 @@ static void out_switch_port(ibnd_port_t *port, int group, free(rem_nodename); } -void out_ca_port(ibnd_port_t *port, int group, const char *out_prefix) +static void out_ca_port(ibnd_port_t *port, int group, const char *out_prefix) { char *str = NULL; char *rem_nodename = NULL; @@ -545,7 +546,7 @@ static void router_iter_func(ibnd_node_t * node, void *iter_user_data) } } -int dump_topology(int group, ibnd_fabric_t * fabric) +static int dump_topology(int group, ibnd_fabric_t *fabric) { ibnd_node_t *node; ibnd_port_t *port; @@ -687,7 +688,7 @@ int dump_topology(int group, ibnd_fabric_t * fabric) return i; } -void dump_ports_report(ibnd_node_t * node, void *user_data) +static void dump_ports_report(ibnd_node_t *node, void *user_data) { int p = 0; ibnd_port_t *port = NULL; @@ -968,7 +969,7 @@ static int diff_common(ibnd_fabric_t *orig_fabric, ibnd_fabric_t *new_fabric, return 0; } -int diff(ibnd_fabric_t * orig_fabric, ibnd_fabric_t * new_fabric) +static int diff(ibnd_fabric_t *orig_fabric, ibnd_fabric_t *new_fabric) { if (diffcheck_flags & DIFF_FLAG_SWITCH) diff_common(orig_fabric, new_fabric, IB_NODE_SWITCH, diff --git a/src/ibping.c b/src/ibping.c index b87f24d8108ded..ebcb581550f4f1 100644 --- a/src/ibping.c +++ b/src/ibping.c @@ -142,7 +142,7 @@ static uint64_t minrtt = ~0ull, maxrtt, total_rtt; static uint64_t start, total_time, replied, lost, ntrans; static ib_portid_t portid = { 0 }; -void report(int sig) +static void report(int sig) { total_time = cl_get_time_stamp() - start; diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c index 4d5bc7c21b7498..397127e686db63 100644 --- a/src/ibqueryerrors.c +++ b/src/ibqueryerrors.c @@ -673,9 +673,9 @@ static int print_errors(ib_portid_t * portid, uint16_t cap_mask, uint32_t cap_ma header_printed, pc_ext, cap_mask, cap_mask2)); } -uint8_t *reset_pc_ext(void *rcvbuf, ib_portid_t * dest, - int port, unsigned mask, unsigned timeout, - const struct ibmad_port * srcport) +static uint8_t *reset_pc_ext(void *rcvbuf, ib_portid_t *dest, int port, + unsigned mask, unsigned timeout, + const struct ibmad_port *srcport) { ib_rpc_t rpc = { 0 }; int lid = dest->lid; @@ -770,7 +770,7 @@ static void clear_port(ib_portid_t * portid, uint16_t cap_mask, uint32_t cap_mas } } -void print_node(ibnd_node_t * node, void *user_data) +static void print_node(ibnd_node_t *node, void *user_data) { int header_printed = 0; int p = 0; diff --git a/src/ibroute.c b/src/ibroute.c index 111524ae97299d..76dab8940c49d4 100644 --- a/src/ibroute.c +++ b/src/ibroute.c @@ -59,8 +59,8 @@ static nn_map_t *node_name_map = NULL; /*******************************************/ -const char *check_switch(ib_portid_t *portid, unsigned int *nports, - uint64_t *guid, uint8_t *sw, char *nd) +static const char *check_switch(ib_portid_t *portid, unsigned int *nports, + uint64_t *guid, uint8_t *sw, char *nd) { uint8_t ni[IB_SMP_DATA_SIZE] = { 0 }; int type; @@ -90,8 +90,8 @@ const char *check_switch(ib_portid_t *portid, unsigned int *nports, #define IB_MLIDS_IN_BLOCK (IB_SMP_DATA_SIZE/2) -int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports, - uint16_t mft[16][IB_MLIDS_IN_BLOCK]) +static int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports, + uint16_t mft[16][IB_MLIDS_IN_BLOCK]) { uint16_t mask; unsigned i, chunk, bit, nonzero = 0; @@ -135,8 +135,8 @@ int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports, uint16_t mft[16][IB_MLIDS_IN_BLOCK] = { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0}, { 0 }, { 0 } }; -const char *dump_multicast_tables(ib_portid_t *portid, unsigned startlid, - unsigned endlid) +static const char *dump_multicast_tables(ib_portid_t *portid, unsigned startlid, + unsigned endlid) { char nd[IB_SMP_DATA_SIZE] = { 0 }; uint8_t sw[IB_SMP_DATA_SIZE] = { 0 }; @@ -247,7 +247,7 @@ const char *dump_multicast_tables(ib_portid_t *portid, unsigned startlid, return 0; } -int dump_lid(char *str, int strlen, int lid, int valid) +static int dump_lid(char *str, int strlen, int lid, int valid) { char nd[IB_SMP_DATA_SIZE] = { 0 }; uint8_t ni[IB_SMP_DATA_SIZE] = { 0 }; @@ -322,7 +322,8 @@ int dump_lid(char *str, int strlen, int lid, int valid) return rc; } -const char *dump_unicast_tables(ib_portid_t *portid, int startlid, int endlid) +static const char *dump_unicast_tables(ib_portid_t *portid, int startlid, + int endlid) { char lft[IB_SMP_DATA_SIZE] = { 0 }; char nd[IB_SMP_DATA_SIZE] = { 0 }; diff --git a/src/ibsendtrap.c b/src/ibsendtrap.c index d892c97fc4fc40..1d7725ee71ad0a 100644 --- a/src/ibsendtrap.c +++ b/src/ibsendtrap.c @@ -224,7 +224,7 @@ static const trap_def_t traps[] = { {NULL, NULL} }; -int process_send_trap(const char *trap_name) +static int process_send_trap(const char *trap_name) { int i; diff --git a/src/ibsysstat.c b/src/ibsysstat.c index ec3b86b2fefb4a..d49eafc63e4b23 100644 --- a/src/ibsysstat.c +++ b/src/ibsysstat.c @@ -257,7 +257,7 @@ static char *ibsystat(ib_portid_t * portid, int attr) return 0; } -int build_cpuinfo(void) +static int build_cpuinfo(void) { char line[1024] = { 0 }, *s, *e; FILE *f; diff --git a/src/mcm_rereg_test.c b/src/mcm_rereg_test.c index 197a7877d2956a..183ebd5bcccd0d 100644 --- a/src/mcm_rereg_test.c +++ b/src/mcm_rereg_test.c @@ -63,7 +63,8 @@ static ibmad_gid_t mgid_ipoib = { struct ibmad_port *srcport; -uint64_t build_mcm_rec(uint8_t * data, ibmad_gid_t mgid, ibmad_gid_t port_gid) +static uint64_t build_mcm_rec(uint8_t *data, ibmad_gid_t mgid, + ibmad_gid_t port_gid) { memset(data, 0, IB_SA_DATA_SIZE); mad_set_array(data, 0, IB_SA_MCM_MGID_F, mgid); diff --git a/src/perfquery.c b/src/perfquery.c index 19d427386e119c..ee3e10b4c9a991 100644 --- a/src/perfquery.c +++ b/src/perfquery.c @@ -686,7 +686,7 @@ static void vlxmittimecc_query(ib_portid_t * portid, int port, int mask) mad_dump_perfcounters_vl_xmit_time_cong); } -void dump_portsamples_control(ib_portid_t * portid, int port) +static void dump_portsamples_control(ib_portid_t *portid, int port) { char buf[1280]; diff --git a/src/smpdump.c b/src/smpdump.c index e3f541085be31b..3f80ef56ca5868 100644 --- a/src/smpdump.c +++ b/src/smpdump.c @@ -80,7 +80,7 @@ struct drsmp { uint8_t return_path[64]; }; -void drsmp_get_init(void *umad, DRPath * path, int attr, int mod) +static void drsmp_get_init(void *umad, DRPath * path, int attr, int mod) { struct drsmp *smp = (struct drsmp *)(umad_get_mad(umad)); @@ -105,7 +105,7 @@ void drsmp_get_init(void *umad, DRPath * path, int attr, int mod) smp->hop_cnt = (uint8_t) path->hop_cnt; } -void smp_get_init(void *umad, int lid, int attr, int mod) +static void smp_get_init(void *umad, int lid, int attr, int mod) { struct drsmp *smp = (struct drsmp *)(umad_get_mad(umad)); @@ -123,7 +123,7 @@ void smp_get_init(void *umad, int lid, int attr, int mod) umad_set_addr(umad, lid, 0, 0, 0); } -int str2DRPath(char *str, DRPath * path) +static int str2DRPath(char *str, DRPath * path) { char *s; From patchwork Fri Mar 8 19:55:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10845371 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B5D79922 for ; Fri, 8 Mar 2019 19:55:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A21DD2FE1E for ; Fri, 8 Mar 2019 19:55:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96AAA2FF7A; Fri, 8 Mar 2019 19:55:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BF612FE1E for ; Fri, 8 Mar 2019 19:55:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726718AbfCHTza (ORCPT ); Fri, 8 Mar 2019 14:55:30 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:33274 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726789AbfCHTz3 (ORCPT ); Fri, 8 Mar 2019 14:55:29 -0500 Received: by mail-qt1-f196.google.com with SMTP id z39so22606617qtz.0 for ; Fri, 08 Mar 2019 11:55:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qlr+EPvZGPDEANerZtrXPEcqwel7UuAg197SfTiT9To=; b=BOwoCBv8Z1WE05HMmHv7I1If2VooJW4HZ+7n1vrSb6bD/KsFFhvfNPfqD1AMsT4Lub Ed7bV7K9MIQl2g730qcNzCyTckMCLkqUteTG+tZpOFcHvDKXl38gCPYURBd9UaLNJPrt kmvAZwzJVWMp3JeAUr+iIKBDCD+CybhveYa9ZvpIDeSMLs74j1PL9MfPf6ojmDfCRQVi 0XIsa8obcUc+TKSn6j1uJvs2IYydik6aJENr86Xar2Si0BQidqtb0jkCJRBlqjyMw3s4 eyDLxwuWoXYkUhmtb81lNYubQQaQMBzPUkcuIs9UZcSSfs5fBShRsoyVwSsrOOxkLzlR V1rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qlr+EPvZGPDEANerZtrXPEcqwel7UuAg197SfTiT9To=; b=OdgAY9XLRKuUGIVM9Jc3bBZDWpRer3cTqP9ONwx2vRiAKnASyiiHa8m8d3Uu3l+u5u 0PCKvKF8dVqWNtVEhm26KKBEhqfQ9DDb9Q/+gRBOhl+xJd7FpiBUjxJQH3Of34Ty6uqT Nbc+8voP7pd4fJEVv847Dd189vWsvfgPL+Y22nDfpLl+pKAiizoTN6VxTvXgiMWdI7Yv aGgIpyrDB6GX0KPMORveM2j3c4unuV9QW35qHUoNFVHu1ttkMuW4POXGQYLEOk5SDRXQ Q8VKstpyeGZxMqflUBZMcVYk2jkHVt0C2uoi3btQGKU3cQarjgNpEFCx+qDmBT4api7+ 0/+g== X-Gm-Message-State: APjAAAVZWl/gwPOh6+V+mKqe0lx126HXj2CjE0VP/tRq9K4pQIpMM27Z JH49uo+7zyG7sdGTxXjogq51RkQcExArQA== X-Google-Smtp-Source: APXvYqwS4UiC+MmpGo+6rjSAlol7cEKllepmdnx8SjIE1K52nq9PtY3cOaAe+9l5iP1HDYaTv6DlZw== X-Received: by 2002:a0c:8924:: with SMTP id 33mr16552908qvp.83.1552074928268; Fri, 08 Mar 2019 11:55:28 -0800 (PST) Received: from ziepe.ca ([24.137.65.181]) by smtp.gmail.com with ESMTPSA id z6sm5182223qtb.67.2019.03.08.11.55.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Mar 2019 11:55:23 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1h2LaU-0000vk-FO; Fri, 08 Mar 2019 15:55:22 -0400 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 08/14] ibdiags: Use a static inline for the empty debug Date: Fri, 8 Mar 2019 15:55:09 -0400 Message-Id: <20190308195515.3408-9-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308195515.3408-1-jgg@ziepe.ca> References: <20190308195515.3408-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe So that format checking still works when not compiling for debug. Fixes the compiler warning: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] Signed-off-by: Jason Gunthorpe --- src/mcm_rereg_test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mcm_rereg_test.c b/src/mcm_rereg_test.c index 183ebd5bcccd0d..95aded688aabde 100644 --- a/src/mcm_rereg_test.c +++ b/src/mcm_rereg_test.c @@ -51,7 +51,10 @@ #ifdef NOISY_DEBUG #define dbg(fmt, ...) fprintf(stderr, "DBG: " fmt, ## __VA_ARGS__ ) #else -#define dbg(fmt, ...) +__attribute__((format(printf, 1, 2))) static inline void dbg(const char *fmt, + ...) +{ +} #endif #define TMO 100 From patchwork Fri Mar 8 19:55:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10845365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 172EE922 for ; Fri, 8 Mar 2019 19:55:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02B8F2DE17 for ; Fri, 8 Mar 2019 19:55:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB2C92FE8A; Fri, 8 Mar 2019 19:55:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 893B92DE17 for ; Fri, 8 Mar 2019 19:55:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726736AbfCHTz1 (ORCPT ); Fri, 8 Mar 2019 14:55:27 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:40563 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726613AbfCHTz1 (ORCPT ); Fri, 8 Mar 2019 14:55:27 -0500 Received: by mail-qt1-f196.google.com with SMTP id f11so5333225qti.7 for ; Fri, 08 Mar 2019 11:55:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SjHzXjBog5f3MQbGa7BJDR3PNuoVJQjvH3fAirY0xQg=; b=XRR4MdrUvHHmkh5oV65VUtIwYdOpgqDCaZBkFP+neys8Zl+mdIpSQfXIOlnDB4culM C/YPy2x+uBfgURfEK/SAJCn8aUpA/ytSpC8zhusbxvKkDO6uQN/I3SiLjNCnxA7KWYAZ wwrXqiXudxCkS4GNHh+vd+MfHEKhWrckxpOE9+YZT/HBSE8I1jkSCP3eERoYw1HdtEER XHyHgj8mZ5CiEQzyuwApRQ+H0VqGcUZHSf1ARTQsyToCEMa1bHirmZXqOW1f2u7wHCUn ylT4HRVdOnXPM3lM8T3WVaadiK1K2StcfU5upImyDVGEDOcKAO0uUarO0dlicvVglniN F/HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SjHzXjBog5f3MQbGa7BJDR3PNuoVJQjvH3fAirY0xQg=; b=Ej5Wf4eKDbz7cXQazsQzmgVVE15HSvXGH8WyjWvCsj7Q6c0lYUmJu4fqzpUjATQVCQ Szsg5lqEljmfsEch6ZosTzXSlkAuH5+0v0gmz8UTuGfHRwXqC2+BXC4dr2RbBkUZdwok YR4JbF9Z35d9iGXbT8Tg2GMp4J1TGfeU76AELlK+eIxl+6j2sxPFLdlwacAeNxr7i0Ji yQlk9KiiRSUF9cAt3w7EwoS2PWEd3MFsRxtubjFq59aB/of2D1+VCqaNJ0Y/Ojf/Ttne eBA3X/Z48AQkQ97KghzqZ0PnuKWbKd8nCNh0u8TV6vmz6jH3jNm+rFrqQZ+t0/8MK6d3 Ponw== X-Gm-Message-State: APjAAAV/xu1WPLl+hn5RrmY3t7z/7ga+dpC28RlT9aTRT06wkgHjaArP tI5ubdEJd/duCYPqK+jVNutOBRMPB1A03A== X-Google-Smtp-Source: APXvYqw59aqRshPJx9cJ2axc5e5dIABM55tIUGmTyC3MBdgHKZ7Km/+SQvpc1hMr5frw09pENAVbGA== X-Received: by 2002:ac8:354e:: with SMTP id z14mr16398532qtb.131.1552074926279; Fri, 08 Mar 2019 11:55:26 -0800 (PST) Received: from ziepe.ca ([24.137.65.181]) by smtp.gmail.com with ESMTPSA id y11sm6541608qky.2.2019.03.08.11.55.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Mar 2019 11:55:23 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1h2LaU-0000vq-Gm; Fri, 08 Mar 2019 15:55:22 -0400 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 09/14] ibdiags: Remove unneeded prototype Date: Fri, 8 Mar 2019 15:55:10 -0400 Message-Id: <20190308195515.3408-10-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308195515.3408-1-jgg@ziepe.ca> References: <20190308195515.3408-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe The prototype is already in ibnetdisc.h Fixes the compiler warning: ibnetdisc.c:68:14: warning: redundant redeclaration of ‘ibnd_find_port_dr’ [-Wredundant-decls] Signed-off-by: Jason Gunthorpe --- libibnetdisc/src/ibnetdisc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libibnetdisc/src/ibnetdisc.c b/libibnetdisc/src/ibnetdisc.c index c89c0d4f10334b..7aaf4fcd181d40 100644 --- a/libibnetdisc/src/ibnetdisc.c +++ b/libibnetdisc/src/ibnetdisc.c @@ -65,7 +65,6 @@ static int query_node_info(smp_engine_t * engine, ib_portid_t * portid, struct ni_cbdata * cbdata); static int query_port_info(smp_engine_t * engine, ib_portid_t * portid, ibnd_node_t * node, int portnum); -ibnd_port_t *ibnd_find_port_dr(ibnd_fabric_t * fabric, char *dr_str); static int recv_switch_info(smp_engine_t * engine, ibnd_smp_t * smp, uint8_t * mad, void *cb_data) From patchwork Fri Mar 8 19:55:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10845367 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 82E43922 for ; Fri, 8 Mar 2019 19:55:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6AB702DE17 for ; Fri, 8 Mar 2019 19:55:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F77A2FE96; Fri, 8 Mar 2019 19:55:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB2A42DE17 for ; Fri, 8 Mar 2019 19:55:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726783AbfCHTz2 (ORCPT ); Fri, 8 Mar 2019 14:55:28 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:35029 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726687AbfCHTz2 (ORCPT ); Fri, 8 Mar 2019 14:55:28 -0500 Received: by mail-qt1-f194.google.com with SMTP id p48so22595571qtk.2 for ; Fri, 08 Mar 2019 11:55:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=57BwBPoo0QxSKu5aDZn5ZNqvea+pENq2D+wuV9ThYdU=; b=TWieNuwr1fFNlBVHWb9La5rkApvlCUCrYR4DsFbefscZRtnJ+7xvb3ARykSepWTv37 LhbAbZaFsuaw5UBK4G+VtwUHPMxKHGYU79n4FIieN8AIWFKscpotYMxmQbkT9Sy6dKQc BQJVADlS+3NI7aswBQNwUKi4aH3/QmC8eg9DSOcNgnM6lBawDh24my6UXCf332okxbhk U6u73r1t3+lC4joHnO08fmbooeUM08ELlxVp8aqrfZupCL6xFeDKtgQ5LpiS2BNKUa2P 1ftPAMFSK3hZI98vUt8UzggpjvwZYMI/l6oPDsjYbjM5gHSiEa8oLF9AKO4v95cuX0pe od8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=57BwBPoo0QxSKu5aDZn5ZNqvea+pENq2D+wuV9ThYdU=; b=acUSYeSaZ5rmGHroq7K8X7r75UkD6Wz6NafFW/WAi0zROJWUCOd3unii3vgqb0/shO 5Xke8oeSlrArhfPBtmTArG7KGRGnt+r7NZewE2+RceLW2zfruBXk3T9aHVzKvLAq9SGN 47/Zuh3RpveW66yC4wTUuf1eKuZPjPYfL8HFIMYanEFfUspfDtk3tD2INOv3BshUuzBn nfUs+h7xGhRqJmwG0azxM43UKcny8T0uVtA1eMBsm8Y7z/Im0HT0f0z9KQLpip0q/tp0 /S6oNCPqJxmky0g8RHrLl91Xdh7jBM5X6ppz3JFLWhN6mFuDyqDMPbK57yzU6F/O9Q6f h0wQ== X-Gm-Message-State: APjAAAWrKXcU1wWzw4f4PGavEW+0ehWJPLJ5NaQbCL/jxSCPljL3hPhx k8RwpEI5huHIZLDD9brchf+CF2qNU23jqA== X-Google-Smtp-Source: APXvYqxTijE8NVJ+SeIYXtU/mnHTIEe+MBQypCD0ugbcNB9MoP2mXZlFrYduhIrYkID7xFaieVzRpg== X-Received: by 2002:ac8:2b8f:: with SMTP id m15mr16736066qtm.300.1552074926759; Fri, 08 Mar 2019 11:55:26 -0800 (PST) Received: from ziepe.ca ([24.137.65.181]) by smtp.gmail.com with ESMTPSA id g20sm2678222qtg.4.2019.03.08.11.55.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Mar 2019 11:55:23 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1h2LaU-0000vw-IA; Fri, 08 Mar 2019 15:55:22 -0400 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 10/14] ibdiags: Remove parameters that are always passed as their global values Date: Fri, 8 Mar 2019 15:55:11 -0400 Message-Id: <20190308195515.3408-11-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308195515.3408-1-jgg@ziepe.ca> References: <20190308195515.3408-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe These cases all have parameters that are passed in from their globals, just remove the parameter. Avoids a warning from -Wshadow Signed-off-by: Jason Gunthorpe --- src/ibportstate.c | 13 ++++++------- src/ibqueryerrors.c | 4 ++-- src/perfquery.c | 5 ++--- src/vendstat.c | 21 ++++++++++----------- 4 files changed, 20 insertions(+), 23 deletions(-) diff --git a/src/ibportstate.c b/src/ibportstate.c index 6b78fa755a71bc..29ffac274b7210 100644 --- a/src/ibportstate.c +++ b/src/ibportstate.c @@ -304,7 +304,7 @@ static int get_link_speed_ext(int lsee, int lses) return lsee; } -static void validate_width(int width, int peerwidth, int lwa) +static void validate_width(int peerwidth, int lwa) { if ((width & peerwidth & 0x8)) { if (lwa != 8) @@ -334,7 +334,7 @@ static void validate_width(int width, int peerwidth, int lwa) } } -static void validate_speed(int speed, int peerspeed, int lsa) +static void validate_speed(int peerspeed, int lsa) { if ((speed & peerspeed & 0x4)) { if (lsa != 4) @@ -354,7 +354,7 @@ static void validate_speed(int speed, int peerspeed, int lsa) } } -static void validate_extended_speed(int espeed, int peerespeed, int lsea) +static void validate_extended_speed(int peerespeed, int lsea) { if ((espeed & peerespeed & 0x4)) { if (lsea != 4) @@ -744,19 +744,18 @@ int main(int argc, char **argv) /* Examine Link Width */ width = get_link_width(lwe, lws); peerwidth = get_link_width(peerlwe, peerlws); - validate_width(width, peerwidth, lwa); + validate_width(peerwidth, lwa); /* Examine Link Speeds */ speed = get_link_speed(lse, lss); peerspeed = get_link_speed(peerlse, peerlss); - validate_speed(speed, peerspeed, lsa); + validate_speed(peerspeed, lsa); if (espeed_cap && peer_espeed_cap) { espeed = get_link_speed_ext(lsee, lses); peerespeed = get_link_speed_ext(peerlsee, peerlses); - validate_extended_speed(espeed, peerespeed, - lsea); + validate_extended_speed(peerespeed, lsea); } else { if (fdr10e & FDR10 && peerfdr10e & FDR10) { if (!(fdr10a & FDR10)) diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c index 397127e686db63..358eb48e493e7a 100644 --- a/src/ibqueryerrors.c +++ b/src/ibqueryerrors.c @@ -127,7 +127,7 @@ static void set_thres(char *name, uint64_t val) } } -static void set_thresholds(const char *threshold_file) +static void set_thresholds(void) { char buf[1024]; uint64_t val = 0; @@ -1104,7 +1104,7 @@ int main(int argc, char **argv) } } - set_thresholds(threshold_file); + set_thresholds(); /* reopen the global ibmad_port */ ibmad_port = mad_rpc_open_port(ibd_ca, ibd_ca_port, diff --git a/src/perfquery.c b/src/perfquery.c index ee3e10b4c9a991..2450fba2699316 100644 --- a/src/perfquery.c +++ b/src/perfquery.c @@ -514,8 +514,7 @@ static void rcv_err_query(ib_portid_t * portid, int port, int mask) } static uint8_t *ext_speeds_reset_via(void *rcvbuf, ib_portid_t * dest, - int port, uint64_t mask, unsigned timeout, - const struct ibmad_port * srcport) + int port, uint64_t mask, unsigned timeout) { ib_rpc_t rpc = { 0 }; int lid = dest->lid; @@ -598,7 +597,7 @@ static void extended_speeds_query(ib_portid_t * portid, int port, } if ((reset_only || reset) && - !ext_speeds_reset_via(pc, portid, port, ext_mask, ibd_timeout, srcport)) + !ext_speeds_reset_via(pc, portid, port, ext_mask, ibd_timeout)) IBEXIT("cannot reset PortExtendedSpeedsCounters"); } diff --git a/src/vendstat.c b/src/vendstat.c index b0ebc3a9a047e9..e9916da1a9f456 100644 --- a/src/vendstat.c +++ b/src/vendstat.c @@ -175,9 +175,8 @@ static int is_ext_fw_info_supported(uint16_t device_id) { return 0; } -static int do_vendor(ib_portid_t *portid, struct ibmad_port *srcport, - uint8_t class, uint8_t method, uint16_t attr_id, - uint32_t attr_mod, void *data) +static int do_vendor(ib_portid_t *portid, uint8_t class, uint8_t method, + uint16_t attr_id, uint32_t attr_mod, void *data) { ib_vendor_call_t call; @@ -208,7 +207,7 @@ static int do_config_space_records(ib_portid_t *portid, unsigned set, cs->record[i].mask = htonl(cs->record[i].mask); } - if (do_vendor(portid, srcport, IB_MLX_VENDOR_CLASS, + if (do_vendor(portid, IB_MLX_VENDOR_CLASS, set ? IB_MAD_METHOD_SET : IB_MAD_METHOD_GET, IB_MLX_IS3_CONFIG_SPACE_ACCESS, 2 << 22 | records << 16, cs)) { @@ -231,7 +230,7 @@ static int counter_groups_info(ib_portid_t * portid, int port) /* Counter Group Info */ memset(&buf, 0, sizeof(buf)); - if (do_vendor(portid, srcport, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, + if (do_vendor(portid, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, IB_MLX_IS4_COUNTER_GROUP_INFO, port, buf)) { fprintf(stderr,"counter group info query failure\n"); return -1; @@ -271,7 +270,7 @@ static int config_counter_groups(ib_portid_t * portid, int port) cg_config->group_selects[0].group_select = (uint8_t) cg0; cg_config->group_selects[1].group_select = (uint8_t) cg1; - if (do_vendor(portid, srcport, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_SET, + if (do_vendor(portid, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_SET, IB_MLX_IS4_CONFIG_COUNTER_GROUP, port, buf)) { fprintf(stderr, "config counter group set failure\n"); return -1; @@ -279,7 +278,7 @@ static int config_counter_groups(ib_portid_t * portid, int port) /* get config counter groups */ memset(&buf, 0, sizeof(buf)); - if (do_vendor(portid, srcport, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, + if (do_vendor(portid, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, IB_MLX_IS4_CONFIG_COUNTER_GROUP, port, buf)) { fprintf(stderr, "config counter group query failure\n"); return -1; @@ -436,14 +435,14 @@ int main(int argc, char **argv) /* vendor ClassPortInfo is required attribute if class supported */ memset(&buf, 0, sizeof(buf)); - if (do_vendor(&portid, srcport, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, + if (do_vendor(&portid, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, CLASS_PORT_INFO, 0, buf)) { mad_rpc_close_port(srcport); IBEXIT("classportinfo query"); } memset(&buf, 0, sizeof(buf)); gi_is3 = (is3_general_info_t *) &buf; - if (do_vendor(&portid, srcport, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, + if (do_vendor(&portid, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, IB_MLX_IS3_GENERAL_INFO, 0, gi_is3)) { mad_rpc_close_port(srcport); IBEXIT("generalinfo query"); @@ -499,7 +498,7 @@ int main(int argc, char **argv) for (i = 0; i < 16; i++) cs->record[i].address = htonl(IB_MLX_IS3_PORT_XMIT_WAIT + ((i + 1) << 12)); - if (do_vendor(&portid, srcport, IB_MLX_VENDOR_CLASS, + if (do_vendor(&portid, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, IB_MLX_IS3_CONFIG_SPACE_ACCESS, 2 << 22 | 16 << 16, cs)) { mad_rpc_close_port(srcport); @@ -516,7 +515,7 @@ int main(int argc, char **argv) for (i = 0; i < 8; i++) cs->record[i].address = htonl(IB_MLX_IS3_PORT_XMIT_WAIT + ((i + 17) << 12)); - if (do_vendor(&portid, srcport, IB_MLX_VENDOR_CLASS, + if (do_vendor(&portid, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, IB_MLX_IS3_CONFIG_SPACE_ACCESS, 2 << 22 | 8 << 16, cs)) { mad_rpc_close_port(srcport); From patchwork Fri Mar 8 19:55:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10845377 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 467E117E9 for ; Fri, 8 Mar 2019 19:55:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E5F42DE17 for ; Fri, 8 Mar 2019 19:55:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22FE02FE8A; Fri, 8 Mar 2019 19:55:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C3E92FE96 for ; Fri, 8 Mar 2019 19:55:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726876AbfCHTzb (ORCPT ); Fri, 8 Mar 2019 14:55:31 -0500 Received: from mail-qk1-f174.google.com ([209.85.222.174]:32940 "EHLO mail-qk1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726613AbfCHTza (ORCPT ); Fri, 8 Mar 2019 14:55:30 -0500 Received: by mail-qk1-f174.google.com with SMTP id x9so11914686qkf.0 for ; Fri, 08 Mar 2019 11:55:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m4btgDiEyPWDNRHYUoVQ5g12llgwV4mpC245mVUwUOM=; b=fcdMYvcVXlr8zUJzTTDaDmvOh3rFEacQfCKNZKqSrOdviVrP+D3b+SMHcl50Wd3IaG 42iqf/+l84hHaeAjZggqjisPS4H0mAUBD6j3FczkOZOHjy/JzJ6CGFIRNXVNlrYhvw4S H2uOHTKvfZicu47OPeByZJwtLQPwcoKJZxJUtLeQV2HbIPpOKzct4/DQZ15wLeRnWAD2 7ByqXR/kHapR6Y8nl75jZqL+HKyiT57jQ8q1o4supqvOc5PfzXv9LUYzdruISna0lSr9 znH3jPK74DygjD5SiLM+z3rRrGSkay5HCE+hVwhy1Ph/T7/PYeLo6BD0sjfJ7Ok3QVRS 8VCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m4btgDiEyPWDNRHYUoVQ5g12llgwV4mpC245mVUwUOM=; b=ger6XNJGt4L21LhK8eqWI6YbXgjFBORUxDtI7ncAkOjaVeLS/eKs46HS5K7LFe/ARg cqxc+8HQlw05AF1iMTdfc9Y84heqsiQPPuyUt2xfdTk7MIZrT2W2R9Fgdi9r3S/KjUNC j7zOKHvTeYq28oL11nqvTSYRQCTJcd3lbb77VwVeLc2FT3EskhkZwF7OenrqOpv3cNEZ oUCeSKuXigXx4A24X5aVrZY3hVIYrq8zFHct/mCvLNaeY/NsZ9ycm84JzJy4j7yKObn5 q1ARrOT6zw+I/mD3iLnyTkYB0niZlu9/dmv8bR1c9wp7yDEXj8yOa+KK4kGXFsdzNbgJ 6CqQ== X-Gm-Message-State: APjAAAUXKj2vOoxEWaus3mYBRMhKcoqi8VJaDMnoa9micwBQpkkF1DaC vu6rgHZoAe8chxKak1CEJIstVBvPxtENQw== X-Google-Smtp-Source: APXvYqzmhgahfga3+QrfYNAIn7eeg2x6FhFsZOZGIEfI9WY0ghPSd3gpecj+yHdgu/DlgHjK7mog+A== X-Received: by 2002:a37:8b06:: with SMTP id n6mr14734678qkd.340.1552074928777; Fri, 08 Mar 2019 11:55:28 -0800 (PST) Received: from ziepe.ca ([24.137.65.181]) by smtp.gmail.com with ESMTPSA id l31sm5527062qtb.20.2019.03.08.11.55.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Mar 2019 11:55:23 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1h2LaU-0000w3-JX; Fri, 08 Mar 2019 15:55:22 -0400 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 11/14] ibdiags: Rename local variables to avoid shadow Date: Fri, 8 Mar 2019 15:55:12 -0400 Message-Id: <20190308195515.3408-12-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308195515.3408-1-jgg@ziepe.ca> References: <20190308195515.3408-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe Change the names of these variables to avoid shadowing a global. Signed-off-by: Jason Gunthorpe --- src/dump_fts.c | 68 ++++++++++++++++++++++----------------------- src/ibdiag_common.c | 20 ++++++------- src/ibqueryerrors.c | 17 ++++++------ 3 files changed, 53 insertions(+), 52 deletions(-) diff --git a/src/dump_fts.c b/src/dump_fts.c index 998383aa470453..3a9299d174e441 100644 --- a/src/dump_fts.c +++ b/src/dump_fts.c @@ -110,8 +110,8 @@ static int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports, uint16_t mft[16][IB_MLIDS_IN_BLOCK] = { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0}, { 0 }, { 0 } }; -static void dump_multicast_tables(ibnd_node_t *node, unsigned startlid, - unsigned endlid, struct ibmad_port *mad_port) +static void dump_multicast_tables(ibnd_node_t *node, unsigned startl, + unsigned endl, struct ibmad_port *mad_port) { ib_portid_t *portid = &node->path_portid; char nd[IB_SMP_DATA_SIZE] = { 0 }; @@ -131,33 +131,33 @@ static void dump_multicast_tables(ibnd_node_t *node, unsigned startlid, mad_decode_field(node->switchinfo, IB_SW_MCAST_FDB_CAP_F, &cap); mad_decode_field(node->switchinfo, IB_SW_MCAST_FDB_TOP_F, &top); - if (!endlid || endlid > IB_MIN_MCAST_LID + cap - 1) - endlid = IB_MIN_MCAST_LID + cap - 1; - if (!dump_all && top && top < endlid) { + if (!endl || endl > IB_MIN_MCAST_LID + cap - 1) + endl = IB_MIN_MCAST_LID + cap - 1; + if (!dump_all && top && top < endl) { if (top < IB_MIN_MCAST_LID - 1) IBWARN("illegal top mlid %x", top); else - endlid = top; + endl = top; } - if (!startlid) - startlid = IB_MIN_MCAST_LID; - else if (startlid < IB_MIN_MCAST_LID) { - IBWARN("illegal start mlid %x, set to %x", startlid, + if (!startl) + startl = IB_MIN_MCAST_LID; + else if (startl < IB_MIN_MCAST_LID) { + IBWARN("illegal start mlid %x, set to %x", startl, IB_MIN_MCAST_LID); - startlid = IB_MIN_MCAST_LID; + startl = IB_MIN_MCAST_LID; } - if (endlid > IB_MAX_MCAST_LID) { - IBWARN("illegal end mlid %x, truncate to %x", endlid, + if (endl > IB_MAX_MCAST_LID) { + IBWARN("illegal end mlid %x, truncate to %x", endl, IB_MAX_MCAST_LID); - endlid = IB_MAX_MCAST_LID; + endl = IB_MAX_MCAST_LID; } mapnd = remap_node_name(node_name_map, nodeguid, nd); printf("Multicast mlids [0x%x-0x%x] of switch %s guid 0x%016" PRIx64 - " (%s):\n", startlid, endlid, portid2str(portid), nodeguid, + " (%s):\n", startl, endl, portid2str(portid), nodeguid, mapnd); if (brief) @@ -182,8 +182,8 @@ static void dump_multicast_tables(ibnd_node_t *node, unsigned startlid, chunks = ALIGN(nports + 1, 16) / 16; - startblock = startlid / IB_MLIDS_IN_BLOCK; - lastblock = endlid / IB_MLIDS_IN_BLOCK; + startblock = startl / IB_MLIDS_IN_BLOCK; + lastblock = endl / IB_MLIDS_IN_BLOCK; for (block = startblock; block <= lastblock; block++) { for (j = 0; j < chunks; j++) { int status; @@ -207,10 +207,10 @@ static void dump_multicast_tables(ibnd_node_t *node, unsigned startlid, i = block * IB_MLIDS_IN_BLOCK; e = i + IB_MLIDS_IN_BLOCK; - if (i < startlid) - i = startlid; - if (e > endlid + 1) - e = endlid + 1; + if (i < startl) + i = startl; + if (e > endl + 1) + e = endl + 1; for (; i < e; i++) { if (dump_mlid(str, sizeof str, i, nports, mft) == 0) @@ -301,7 +301,7 @@ static int dump_lid(char *str, int str_len, int lid, int valid, return rc; } -static void dump_unicast_tables(ibnd_node_t *node, int startlid, int endlid, +static void dump_unicast_tables(ibnd_node_t *node, int startl, int endl, struct ibmad_port *mad_port, ibnd_fabric_t *fabric) { @@ -322,27 +322,27 @@ static void dump_unicast_tables(ibnd_node_t *node, int startlid, int endlid, nports = node->numports; memcpy(nd, node->nodedesc, strlen(node->nodedesc)); - if (!endlid || endlid > top) - endlid = top; + if (!endl || endl > top) + endl = top; - if (endlid > IB_MAX_UCAST_LID) { - IBWARN("illegal lft top %d, truncate to %d", endlid, + if (endl > IB_MAX_UCAST_LID) { + IBWARN("illegal lft top %d, truncate to %d", endl, IB_MAX_UCAST_LID); - endlid = IB_MAX_UCAST_LID; + endl = IB_MAX_UCAST_LID; } mapnd = remap_node_name(node_name_map, nodeguid, nd); printf("Unicast lids [0x%x-0x%x] of switch %s guid 0x%016" PRIx64 - " (%s):\n", startlid, endlid, portid2str(portid), nodeguid, + " (%s):\n", startl, endl, portid2str(portid), nodeguid, mapnd); DEBUG("Switch top is 0x%x\n", top); printf(" Lid Out Destination\n"); printf(" Port Info \n"); - startblock = startlid / IB_SMP_DATA_SIZE; - endblock = ALIGN(endlid, IB_SMP_DATA_SIZE) / IB_SMP_DATA_SIZE; + startblock = startl / IB_SMP_DATA_SIZE; + endblock = ALIGN(endl, IB_SMP_DATA_SIZE) / IB_SMP_DATA_SIZE; for (block = startblock; block < endblock; block++) { int status; DEBUG("reading block %d", block); @@ -357,10 +357,10 @@ static void dump_unicast_tables(ibnd_node_t *node, int startlid, int endlid, } i = block * IB_SMP_DATA_SIZE; e = i + IB_SMP_DATA_SIZE; - if (i < startlid) - i = startlid; - if (e > endlid + 1) - e = endlid + 1; + if (i < startl) + i = startl; + if (e > endl + 1) + e = endl + 1; for (; i < e; i++) { unsigned outport = lft[i % IB_SMP_DATA_SIZE]; diff --git a/src/ibdiag_common.c b/src/ibdiag_common.c index 977d8e1d05d394..1d87bad0f4c397 100644 --- a/src/ibdiag_common.c +++ b/src/ibdiag_common.c @@ -328,7 +328,7 @@ static struct option *make_long_opts(const char *exclude_str, const struct ibdiag_opt *custom_opts, const struct ibdiag_opt *map[]) { - struct option *long_opts, *l; + struct option *res, *l; const struct ibdiag_opt *o; unsigned n = 0; @@ -336,12 +336,12 @@ static struct option *make_long_opts(const char *exclude_str, for (o = custom_opts; o->name; o++) n++; - long_opts = malloc((sizeof(common_opts) / sizeof(common_opts[0]) + n) * - sizeof(*long_opts)); - if (!long_opts) + res = malloc((sizeof(common_opts) / sizeof(common_opts[0]) + n) * + sizeof(*res)); + if (!res) return NULL; - l = long_opts; + l = res; if (custom_opts) for (o = custom_opts; o->name; o++) @@ -355,7 +355,7 @@ static struct option *make_long_opts(const char *exclude_str, memset(l, 0, sizeof(*l)); - return long_opts; + return res; } static void make_str_opts(const struct option *o, char *p, unsigned size) @@ -637,11 +637,11 @@ static int resolve_gid(char *ca_name, uint8_t ca_port, ib_portid_t *portid, ibmad_gid_t gid, ib_portid_t *sm_id, const struct ibmad_port *srcport) { - ib_portid_t sm_portid; + ib_portid_t tmp; char buf[IB_SA_DATA_SIZE] = { 0 }; if (!sm_id) { - sm_id = &sm_portid; + sm_id = &tmp; if (resolve_sm_portid(ca_name, ca_port, sm_id) < 0) return -1; } @@ -657,13 +657,13 @@ static int resolve_guid(char *ca_name, uint8_t ca_port, ib_portid_t *portid, uint64_t *guid, ib_portid_t *sm_id, const struct ibmad_port *srcport) { - ib_portid_t sm_portid; + ib_portid_t tmp; uint8_t buf[IB_SA_DATA_SIZE] = { 0 }; uint64_t prefix; ibmad_gid_t selfgid; if (!sm_id) { - sm_id = &sm_portid; + sm_id = &tmp; if (resolve_sm_portid(ca_name, ca_port, sm_id) < 0) return -1; } diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c index 358eb48e493e7a..54e06e183097ea 100644 --- a/src/ibqueryerrors.c +++ b/src/ibqueryerrors.c @@ -1122,14 +1122,15 @@ int main(int argc, char **argv) mad_rpc_set_timeout(ibmad_port, ibd_timeout); if (port_guid_str) { - ibnd_port_t *port = ibnd_find_port_guid(fabric, port_guid); - if (port) - print_node(port->node, NULL); + ibnd_port_t *ndport = ibnd_find_port_guid(fabric, port_guid); + if (ndport) + print_node(ndport->node, NULL); else fprintf(stderr, "Failed to find node: %s\n", port_guid_str); } else if (dr_path) { - ibnd_port_t *port; + ibnd_port_t *ndport; + uint8_t ni[IB_SMP_DATA_SIZE] = { 0 }; if (!smp_query_via(ni, &portid, IB_ATTR_NODE_INFO, 0, ibd_timeout, ibmad_port)) { @@ -1139,12 +1140,12 @@ int main(int argc, char **argv) mad_decode_field(ni, IB_NODE_PORT_GUID_F, &(port_guid)); - port = ibnd_find_port_guid(fabric, port_guid); - if (port) { + ndport = ibnd_find_port_guid(fabric, port_guid); + if (ndport) { if(obtain_sl) - if(path_record_query(self_gid,port->guid)) + if(path_record_query(self_gid,ndport->guid)) goto close_port; - print_node(port->node, NULL); + print_node(ndport->node, NULL); } else fprintf(stderr, "Failed to find node: %s\n", dr_path); } else { From patchwork Fri Mar 8 19:55:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10845387 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1AED51575 for ; Fri, 8 Mar 2019 20:20:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 032803008E for ; Fri, 8 Mar 2019 20:20:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 019DF300B2; Fri, 8 Mar 2019 20:20:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6604300A1 for ; Fri, 8 Mar 2019 20:20:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726696AbfCHUUi (ORCPT ); Fri, 8 Mar 2019 15:20:38 -0500 Received: from mail-qt1-f179.google.com ([209.85.160.179]:34218 "EHLO mail-qt1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726258AbfCHUUi (ORCPT ); Fri, 8 Mar 2019 15:20:38 -0500 Received: by mail-qt1-f179.google.com with SMTP id x20so5048581qto.1 for ; Fri, 08 Mar 2019 12:20:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SSYJiia90RkqLlqWeV9ByRwVcriJVInYAUwGLE2D5cg=; b=nKbqPQvCQbckFDYexwi1MFU4Pc8vunK5WA1BuhlDuuMgEjdByeIiFofSHDWe4AibbU UlSh3FUWEc4FBOisg7q6h7SdgAna3UHb35GeQEC2beG9uRQMFQh6EKoGbqOjx+0v73j9 gv4NqtIN4IYwC0NjtxUYNDzVnBsaeeGLCV9tqb8xp275qSSq4QI8AHbremloclaIu2Lx bMM2QtJMP2vgoS9aX9yiNVKVxSr/IZh7fQL0agnZon+tznp8hqz24JCnDY7DXEdA0ooF ZEt7ivNhVtd5F0x6EPT+HV6QMu0MZtIMU6rubYia4zh+LlWbmsgmlmdZcKn56GBJ1ISR Pq4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SSYJiia90RkqLlqWeV9ByRwVcriJVInYAUwGLE2D5cg=; b=XgwpDuTntnQEWtYWS73jUZfDfz+HITvIF9SljpCnS1Jcpq6w5zYFWSoQ94BV9Agqh+ XKMn3xdjuIPmTNSzu+EzaCWv5axBfnNM5Chqqjb2WqdPIYrI5LDd9113PbkR2mo3fDUT IoRV6rfHmnVLry28iG368E+fBrilpqcdpg23Wy+di8bget9j3o3X6N0X2SykDxASkP99 hFSSpr/3bpaSiACTJunjDXzh59L9HCFgIYgXyOB9tKelC2FOSu9cxqNbiQ2e9CEmoYkJ JBqACJlSE79t4kRJLyhb2x1nwmelWg5O6brijy63e8G8KkZAxqejE0wRFtkno8YikQhu HIqw== X-Gm-Message-State: APjAAAXt5TaifaE4To5ddJ+R7BbliudSIoVeHObQpLaEqHDgYh/sDhAt /zUAGL32FULpcsKGQBrvX3llMJHD/ejEeQ== X-Google-Smtp-Source: APXvYqyd5ohoKKC0mNsi5UBtmWhMuknKi4dQaZapFOKcQh6N15QUJwjna5+xNRtIcowfxW1x8FclWA== X-Received: by 2002:a0c:acd7:: with SMTP id n23mr16918399qvc.215.1552076435356; Fri, 08 Mar 2019 12:20:35 -0800 (PST) Received: from ziepe.ca ([24.137.65.181]) by smtp.gmail.com with ESMTPSA id d51sm5810254qta.31.2019.03.08.12.20.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Mar 2019 12:20:34 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1h2LaU-0000w9-Ke; Fri, 08 Mar 2019 15:55:22 -0400 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 12/14] ibdiags/perfquery: Move many of the globals into a struct Date: Fri, 8 Mar 2019 15:55:13 -0400 Message-Id: <20190308195515.3408-13-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308195515.3408-1-jgg@ziepe.ca> References: <20190308195515.3408-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe Having so many globals with such commonly used names creates a lot of -WShadow warnings, move them into a struct to avoid shadowing function locals. Signed-off-by: Jason Gunthorpe --- src/perfquery.c | 310 ++++++++++++++++++++++++++---------------------- 1 file changed, 166 insertions(+), 144 deletions(-) diff --git a/src/perfquery.c b/src/perfquery.c index 2450fba2699316..c7536dcc52ef00 100644 --- a/src/perfquery.c +++ b/src/perfquery.c @@ -453,12 +453,16 @@ static void reset_counters(int extended, int timeout, int mask, } } -static int reset, reset_only, all_ports, loop_ports, port, extended, xmt_sl, - rcv_sl, xmt_disc, rcv_err, extended_speeds, smpl_ctl, oprcvcounters, flowctlcounters, - vloppackets, vlopdata, vlxmitflowctlerrors, vlxmitcounters, swportvlcong, - rcvcc, slrcvfecn, slrcvbecn, xmitcc, vlxmittimecc; -static int ports[MAX_PORTS]; -static int ports_count; +static struct +{ + int reset, reset_only, all_ports, loop_ports, port, extended, xmt_sl, + rcv_sl, xmt_disc, rcv_err, extended_speeds, smpl_ctl, + oprcvcounters, flowctlcounters, vloppackets, vlopdata, + vlxmitflowctlerrors, vlxmitcounters, swportvlcong, rcvcc, + slrcvfecn, slrcvbecn, xmitcc, vlxmittimecc; + int ports[MAX_PORTS]; + int ports_count; +} info; static void common_func(ib_portid_t * portid, int port_num, int mask, unsigned query, unsigned reset, @@ -480,36 +484,38 @@ static void common_func(ib_portid_t * portid, int port_num, int mask, } memset(pc, 0, sizeof(pc)); - if (reset && !performance_reset_via(pc, portid, port, mask, ibd_timeout, - attr, srcport)) + if (reset && !performance_reset_via(pc, portid, info.port, mask, + ibd_timeout, attr, srcport)) IBEXIT("cannot reset %s", name); } static void xmt_sl_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "PortXmitDataSL", IB_GSI_PORT_XMIT_DATA_SL, - mad_dump_perfcounters_xmt_sl); + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), "PortXmitDataSL", + IB_GSI_PORT_XMIT_DATA_SL, mad_dump_perfcounters_xmt_sl); } static void rcv_sl_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "PortRcvDataSL", IB_GSI_PORT_RCV_DATA_SL, - mad_dump_perfcounters_rcv_sl); + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), "PortRcvDataSL", + IB_GSI_PORT_RCV_DATA_SL, mad_dump_perfcounters_rcv_sl); } static void xmt_disc_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "PortXmitDiscardDetails", IB_GSI_PORT_XMIT_DISCARD_DETAILS, + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), "PortXmitDiscardDetails", + IB_GSI_PORT_XMIT_DISCARD_DETAILS, mad_dump_perfcounters_xmt_disc); } static void rcv_err_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "PortRcvErrorDetails", IB_GSI_PORT_RCV_ERROR_DETAILS, + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), "PortRcvErrorDetails", + IB_GSI_PORT_RCV_ERROR_DETAILS, mad_dump_perfcounters_rcv_err); } @@ -583,7 +589,7 @@ static void extended_speeds_query(ib_portid_t * portid, int port, { int mask = ext_mask; - if (!reset_only) { + if (!info.reset_only) { if (is_rsfec_mode_active(portid, port, cap_mask)) common_func(portid, port, mask, 1, 0, "PortExtendedSpeedsCounters with RS-FEC Active", @@ -596,92 +602,103 @@ static void extended_speeds_query(ib_portid_t * portid, int port, mad_dump_port_ext_speeds_counters); } - if ((reset_only || reset) && + if ((info.reset_only || info.reset) && !ext_speeds_reset_via(pc, portid, port, ext_mask, ibd_timeout)) IBEXIT("cannot reset PortExtendedSpeedsCounters"); } static void oprcvcounters_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "PortOpRcvCounters", IB_GSI_PORT_PORT_OP_RCV_COUNTERS, + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), "PortOpRcvCounters", + IB_GSI_PORT_PORT_OP_RCV_COUNTERS, mad_dump_perfcounters_port_op_rcv_counters); } static void flowctlcounters_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "PortFlowCtlCounters", IB_GSI_PORT_PORT_FLOW_CTL_COUNTERS, + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), "PortFlowCtlCounters", + IB_GSI_PORT_PORT_FLOW_CTL_COUNTERS, mad_dump_perfcounters_port_flow_ctl_counters); } static void vloppackets_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "PortVLOpPackets", IB_GSI_PORT_PORT_VL_OP_PACKETS, + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), "PortVLOpPackets", + IB_GSI_PORT_PORT_VL_OP_PACKETS, mad_dump_perfcounters_port_vl_op_packet); } static void vlopdata_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "PortVLOpData", IB_GSI_PORT_PORT_VL_OP_DATA, + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), "PortVLOpData", + IB_GSI_PORT_PORT_VL_OP_DATA, mad_dump_perfcounters_port_vl_op_data); } static void vlxmitflowctlerrors_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "PortVLXmitFlowCtlUpdateErrors", IB_GSI_PORT_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS, + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), + "PortVLXmitFlowCtlUpdateErrors", + IB_GSI_PORT_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS, mad_dump_perfcounters_port_vl_xmit_flow_ctl_update_errors); } static void vlxmitcounters_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "PortVLXmitWaitCounters", IB_GSI_PORT_PORT_VL_XMIT_WAIT_COUNTERS, + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), "PortVLXmitWaitCounters", + IB_GSI_PORT_PORT_VL_XMIT_WAIT_COUNTERS, mad_dump_perfcounters_port_vl_xmit_wait_counters); } static void swportvlcong_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "SwPortVLCongestion", IB_GSI_SW_PORT_VL_CONGESTION, + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), "SwPortVLCongestion", + IB_GSI_SW_PORT_VL_CONGESTION, mad_dump_perfcounters_sw_port_vl_congestion); } static void rcvcc_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "PortRcvConCtrl", IB_GSI_PORT_RCV_CON_CTRL, + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), "PortRcvConCtrl", + IB_GSI_PORT_RCV_CON_CTRL, mad_dump_perfcounters_rcv_con_ctrl); } static void slrcvfecn_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "PortSLRcvFECN", IB_GSI_PORT_SL_RCV_FECN, - mad_dump_perfcounters_sl_rcv_fecn); + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), "PortSLRcvFECN", + IB_GSI_PORT_SL_RCV_FECN, mad_dump_perfcounters_sl_rcv_fecn); } static void slrcvbecn_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "PortSLRcvBECN", IB_GSI_PORT_SL_RCV_BECN, - mad_dump_perfcounters_sl_rcv_becn); + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), "PortSLRcvBECN", + IB_GSI_PORT_SL_RCV_BECN, mad_dump_perfcounters_sl_rcv_becn); } static void xmitcc_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "PortXmitConCtrl", IB_GSI_PORT_XMIT_CON_CTRL, + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), "PortXmitConCtrl", + IB_GSI_PORT_XMIT_CON_CTRL, mad_dump_perfcounters_xmit_con_ctrl); } static void vlxmittimecc_query(ib_portid_t * portid, int port, int mask) { - common_func(portid, port, mask, !reset_only, (reset_only || reset), - "PortVLXmitTimeCong", IB_GSI_PORT_VL_XMIT_TIME_CONG, + common_func(portid, port, mask, !info.reset_only, + (info.reset_only || info.reset), "PortVLXmitTimeCong", + IB_GSI_PORT_VL_XMIT_TIME_CONG, mad_dump_perfcounters_vl_xmit_time_cong); } @@ -703,74 +720,74 @@ static int process_opt(void *context, int ch, char *optarg) { switch (ch) { case 'x': - extended = 1; + info.extended = 1; break; case 'X': - xmt_sl = 1; + info.xmt_sl = 1; break; case 'S': - rcv_sl = 1; + info.rcv_sl = 1; break; case 'D': - xmt_disc = 1; + info.xmt_disc = 1; break; case 'E': - rcv_err = 1; + info.rcv_err = 1; break; case 'T': - extended_speeds = 1; + info.extended_speeds = 1; break; case 'c': - smpl_ctl = 1; + info.smpl_ctl = 1; break; case 1: - oprcvcounters = 1; + info.oprcvcounters = 1; break; case 2: - flowctlcounters = 1; + info.flowctlcounters = 1; break; case 3: - vloppackets = 1; + info.vloppackets = 1; break; case 4: - vlopdata = 1; + info.vlopdata = 1; break; case 5: - vlxmitflowctlerrors = 1; + info.vlxmitflowctlerrors = 1; break; case 6: - vlxmitcounters = 1; + info.vlxmitcounters = 1; break; case 7: - swportvlcong = 1; + info.swportvlcong = 1; break; case 8: - rcvcc = 1; + info.rcvcc = 1; break; case 9: - slrcvfecn = 1; + info.slrcvfecn = 1; break; case 10: - slrcvbecn = 1; + info.slrcvbecn = 1; break; case 11: - xmitcc = 1; + info.xmitcc = 1; break; case 12: - vlxmittimecc = 1; + info.vlxmittimecc = 1; break; case 'a': - all_ports++; - port = ALL_PORTS; + info.all_ports++; + info.port = ALL_PORTS; break; case 'l': - loop_ports++; + info.loop_ports++; break; case 'r': - reset++; + info.reset++; break; case 'R': - reset_only++; + info.reset_only++; break; default: return -1; @@ -850,10 +867,11 @@ int main(int argc, char **argv) if (strchr(argv[1], ',')) { tmpstr = strtok(argv[1], ","); while (tmpstr) { - ports[ports_count++] = strtoul(tmpstr, 0, 0); + info.ports[info.ports_count++] = + strtoul(tmpstr, 0, 0); tmpstr = strtok(NULL, ","); } - port = ports[0]; + info.port = info.ports[0]; } else if ((tmpstr = strchr(argv[1], '-'))) { int pmin, pmax; @@ -868,12 +886,12 @@ int main(int argc, char **argv) IBEXIT("max port must be greater than min port in range"); while (pmin <= pmax) - ports[ports_count++] = pmin++; + info.ports[info.ports_count++] = pmin++; - port = ports[0]; + info.port = info.ports[0]; } else - port = strtoul(argv[1], 0, 0); + info.port = strtoul(argv[1], 0, 0); } if (argc > 2) { ext_mask = strtoull(argv[2], 0, 0); @@ -891,13 +909,14 @@ int main(int argc, char **argv) ibd_dest_type, ibd_sm_id, srcport) < 0) IBEXIT("can't resolve destination port %s", argv[0]); } else { - if (resolve_self(ibd_ca, ibd_ca_port, &portid, &port, 0) < 0) + if (resolve_self(ibd_ca, ibd_ca_port, &portid, &info.port, 0) < + 0) IBEXIT("can't resolve self port %s", argv[0]); } /* PerfMgt ClassPortInfo is a required attribute */ memset(pc, 0, sizeof(pc)); - if (!pma_query_via(pc, &portid, port, ibd_timeout, CLASS_PORT_INFO, + if (!pma_query_via(pc, &portid, info.port, ibd_timeout, CLASS_PORT_INFO, srcport)) IBEXIT("classportinfo query"); /* ClassPortInfo should be supported as part of libibmad */ @@ -906,104 +925,104 @@ int main(int argc, char **argv) cap_mask2 = ntohl(cap_mask2) >> 5; if (!(cap_mask & IB_PM_ALL_PORT_SELECT)) { /* bit 8 is AllPortSelect */ - if (!all_ports && port == ALL_PORTS) + if (!info.all_ports && info.port == ALL_PORTS) IBEXIT("AllPortSelect not supported"); - if (all_ports && port == ALL_PORTS) + if (info.all_ports && info.port == ALL_PORTS) all_ports_loop = 1; } - if (xmt_sl) { - xmt_sl_query(&portid, port, mask); + if (info.xmt_sl) { + xmt_sl_query(&portid, info.port, mask); goto done; } - if (rcv_sl) { - rcv_sl_query(&portid, port, mask); + if (info.rcv_sl) { + rcv_sl_query(&portid, info.port, mask); goto done; } - if (xmt_disc) { - xmt_disc_query(&portid, port, mask); + if (info.xmt_disc) { + xmt_disc_query(&portid, info.port, mask); goto done; } - if (rcv_err) { - rcv_err_query(&portid, port, mask); + if (info.rcv_err) { + rcv_err_query(&portid, info.port, mask); goto done; } - if (extended_speeds) { - extended_speeds_query(&portid, port, ext_mask, cap_mask); + if (info.extended_speeds) { + extended_speeds_query(&portid, info.port, ext_mask, cap_mask); goto done; } - if (oprcvcounters) { - oprcvcounters_query(&portid, port, mask); + if (info.oprcvcounters) { + oprcvcounters_query(&portid, info.port, mask); goto done; } - if (flowctlcounters) { - flowctlcounters_query(&portid, port, mask); + if (info.flowctlcounters) { + flowctlcounters_query(&portid, info.port, mask); goto done; } - if (vloppackets) { - vloppackets_query(&portid, port, mask); + if (info.vloppackets) { + vloppackets_query(&portid, info.port, mask); goto done; } - if (vlopdata) { - vlopdata_query(&portid, port, mask); + if (info.vlopdata) { + vlopdata_query(&portid, info.port, mask); goto done; } - if (vlxmitflowctlerrors) { - vlxmitflowctlerrors_query(&portid, port, mask); + if (info.vlxmitflowctlerrors) { + vlxmitflowctlerrors_query(&portid, info.port, mask); goto done; } - if (vlxmitcounters) { - vlxmitcounters_query(&portid, port, mask); + if (info.vlxmitcounters) { + vlxmitcounters_query(&portid, info.port, mask); goto done; } - if (swportvlcong) { - swportvlcong_query(&portid, port, mask); + if (info.swportvlcong) { + swportvlcong_query(&portid, info.port, mask); goto done; } - if (rcvcc) { - rcvcc_query(&portid, port, mask); + if (info.rcvcc) { + rcvcc_query(&portid, info.port, mask); goto done; } - if (slrcvfecn) { - slrcvfecn_query(&portid, port, mask); + if (info.slrcvfecn) { + slrcvfecn_query(&portid, info.port, mask); goto done; } - if (slrcvbecn) { - slrcvbecn_query(&portid, port, mask); + if (info.slrcvbecn) { + slrcvbecn_query(&portid, info.port, mask); goto done; } - if (xmitcc) { - xmitcc_query(&portid, port, mask); + if (info.xmitcc) { + xmitcc_query(&portid, info.port, mask); goto done; } - if (vlxmittimecc) { - vlxmittimecc_query(&portid, port, mask); + if (info.vlxmittimecc) { + vlxmittimecc_query(&portid, info.port, mask); goto done; } - if (smpl_ctl) { - dump_portsamples_control(&portid, port); + if (info.smpl_ctl) { + dump_portsamples_control(&portid, info.port); goto done; } - - if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) { + if (all_ports_loop || + (info.loop_ports && (info.all_ports || info.port == ALL_PORTS))) { if (!smp_query_via(data, &portid, IB_ATTR_NODE_INFO, 0, 0, srcport)) IBEXIT("smp query nodeinfo failed"); @@ -1021,35 +1040,35 @@ int main(int argc, char **argv) if (enhancedport0) start_port = 0; } - if (all_ports_loop && !loop_ports) + if (all_ports_loop && !info.loop_ports) IBWARN ("Emulating AllPortSelect by iterating through all ports"); } - if (reset_only) + if (info.reset_only) goto do_reset; - if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) { + if (all_ports_loop || + (info.loop_ports && (info.all_ports || info.port == ALL_PORTS))) { for (i = start_port; i <= num_ports; i++) - dump_perfcounters(extended, ibd_timeout, - cap_mask, cap_mask2, - &portid, i, (all_ports_loop - && !loop_ports)); - if (all_ports_loop && !loop_ports) { - if (extended != 1) + dump_perfcounters(info.extended, ibd_timeout, cap_mask, + cap_mask2, &portid, i, + (all_ports_loop && !info.loop_ports)); + if (all_ports_loop && !info.loop_ports) { + if (info.extended != 1) output_aggregate_perfcounters(&portid, cap_mask); else output_aggregate_perfcounters_ext(&portid, cap_mask, cap_mask2); } - } else if (ports_count > 1) { - for (i = 0; i < ports_count; i++) - dump_perfcounters(extended, ibd_timeout, cap_mask, - cap_mask2, &portid, ports[i], - (all_ports && !loop_ports)); - if (all_ports && !loop_ports) { - if (extended != 1) + } else if (info.ports_count > 1) { + for (i = 0; i < info.ports_count; i++) + dump_perfcounters(info.extended, ibd_timeout, cap_mask, + cap_mask2, &portid, info.ports[i], + (info.all_ports && !info.loop_ports)); + if (info.all_ports && !info.loop_ports) { + if (info.extended != 1) output_aggregate_perfcounters(&portid, cap_mask); else @@ -1057,21 +1076,21 @@ int main(int argc, char **argv) cap_mask, cap_mask2); } } else - dump_perfcounters(extended, ibd_timeout, cap_mask, cap_mask2, - &portid, port, 0); + dump_perfcounters(info.extended, ibd_timeout, cap_mask, + cap_mask2, &portid, info.port, 0); - if (!reset) + if (!info.reset) goto done; do_reset: - if (argc <= 2 && !extended) { + if (argc <= 2 && !info.extended) { if (cap_mask & IB_PM_PC_XMIT_WAIT_SUP) mask |= (1 << 16); /* reset portxmitwait */ if (cap_mask & IB_PM_IS_QP1_DROP_SUP) mask |= (1 << 17); /* reset qp1dropped */ } - if (extended) { + if (info.extended) { mask |= 0xfff0000; if (cap_mask & IB_PM_PC_XMIT_WAIT_SUP) mask |= (1 << 28); @@ -1079,14 +1098,17 @@ do_reset: mask |= (1 << 29); } - if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) { + if (all_ports_loop || + (info.loop_ports && (info.all_ports || info.port == ALL_PORTS))) { for (i = start_port; i <= num_ports; i++) - reset_counters(extended, ibd_timeout, mask, &portid, i); - } else if (ports_count > 1) { - for (i = 0; i < ports_count; i++) - reset_counters(extended, ibd_timeout, mask, &portid, ports[i]); + reset_counters(info.extended, ibd_timeout, mask, + &portid, i); + } else if (info.ports_count > 1) { + for (i = 0; i < info.ports_count; i++) + reset_counters(info.extended, ibd_timeout, mask, + &portid, info.ports[i]); } else - reset_counters(extended, ibd_timeout, mask, &portid, port); + reset_counters(info.extended, ibd_timeout, mask, &portid, info.port); done: mad_rpc_close_port(srcport); From patchwork Fri Mar 8 19:55:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10845385 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 651491575 for ; Fri, 8 Mar 2019 20:20:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5072F30095 for ; Fri, 8 Mar 2019 20:20:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 42438300A3; Fri, 8 Mar 2019 20:20:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C77C93008E for ; Fri, 8 Mar 2019 20:20:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726808AbfCHUUf (ORCPT ); Fri, 8 Mar 2019 15:20:35 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:42732 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726258AbfCHUUf (ORCPT ); Fri, 8 Mar 2019 15:20:35 -0500 Received: by mail-qk1-f195.google.com with SMTP id y140so11933468qkb.9 for ; Fri, 08 Mar 2019 12:20:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uFvrmHOyV5YXeUCgVe9CRiX7KeycEMTnZgkMwWS2YqY=; b=Wm1b42Jf/IfR7CWrTet5Rxr6EwxHYRmp6ZAYxPF0xpelJKfBVMBYnt0RqrspbHoETJ E6rPko1CXMn3PyD0yPeU9sU6vhzqfI4wPmcT+Y5hWjaZrW/NJbLKUik7nPHid8L6B05x UFvhzvJZGWDgkIfA/pxkOV3hPT73ZkNEffwYgLnXTPkvkgssh7wDOPuCU2iFNI622tsv YixgnIkN5C+1w8yTQ0Hq+IlQ3dmQeqBaXR60VLAPkd2b5AACMJ/+iDWUmfmZpCWBI6yX iFnibe/RxQCNC0lCarRGk81ULqfAQr6L+0VcsrHBwdxohCdIKLUqMMJqZY8LAwCNHvvy Anbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uFvrmHOyV5YXeUCgVe9CRiX7KeycEMTnZgkMwWS2YqY=; b=aKFdh+q9Gweuip1oivKskPNOfqk0UOvY5BRNlNyvS3l/XUsiAlTVVg5st/STtT133s /JLanYNUQIL8pH9bX6xgWdFb97QpSCMujQOsKtmJxWGxT6WbNf/hyU5EYkBvdZln2UUJ 1gMx4Bp0MHgGA35kw0ckII/qYyUKaYC20QXbr+8IExBdqZeRYZSjUknrcAXTpdWPT7pY RrRfwVM0qfM6iZEJYp+Cu0pYAfOdrkYCTv7e24g5eq6FGBooB8Qkuacho8F/qpYdHa0s PJoWzOV+DUFJehOrEkGCgcdEucu8T9P2DPRZFjrrRygs0IZKIeiylncQjIaazszG4hs2 MD0A== X-Gm-Message-State: APjAAAWWsEO2PKGRDn5dUW48tMRjU/qDZbMlGuSnderCXGdaUT0wthP0 RlT6qjCA8wp2X3hpt0/04wnpZX6Lwpcy4g== X-Google-Smtp-Source: APXvYqzeqLPj3Su9nHvwDotNGbIqpv42cswt317QcNLeM+96bEdfjVL2alwQINX19oiC1kpr0SeBRg== X-Received: by 2002:a37:f507:: with SMTP id l7mr15959077qkk.302.1552076433841; Fri, 08 Mar 2019 12:20:33 -0800 (PST) Received: from ziepe.ca ([24.137.65.181]) by smtp.gmail.com with ESMTPSA id 46sm5419412qty.59.2019.03.08.12.20.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Mar 2019 12:20:33 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1h2LaU-0000wF-Li; Fri, 08 Mar 2019 15:55:22 -0400 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 13/14] ibdiags/iblinkinfo: Move guid globals to a stuct Date: Fri, 8 Mar 2019 15:55:14 -0400 Message-Id: <20190308195515.3408-14-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308195515.3408-1-jgg@ziepe.ca> References: <20190308195515.3408-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe Having so many globals with such commonly used names creates a lot of -WShadow warnings, move them into a struct to avoid shadowing function locals. Signed-off-by: Jason Gunthorpe --- src/iblinkinfo.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/iblinkinfo.c b/src/iblinkinfo.c index 9542a0ea51c3ca..1d26244f362654 100644 --- a/src/iblinkinfo.c +++ b/src/iblinkinfo.c @@ -69,8 +69,10 @@ static unsigned diffcheck_flags = DIFF_FLAG_DEFAULT; static char *filterdownports_cache_file = NULL; static ibnd_fabric_t *filterdownports_fabric = NULL; -static uint64_t guid = 0; -static char *guid_str = NULL; +static struct { + uint64_t guid; + char *guid_str; +} node_label; static char *dr_path = NULL; static int all = 0; @@ -556,8 +558,8 @@ static int process_opt(void *context, int ch, char *optarg) break; case 'S': case 'G': - guid_str = optarg; - guid = (uint64_t) strtoull(guid_str, 0, 0); + node_label.guid_str = optarg; + node_label.guid = (uint64_t)strtoull(node_label.guid_str, 0, 0); break; case 'D': dr_path = strdup(optarg); @@ -676,13 +678,12 @@ int main(int argc, char **argv) IB_DEST_DRPATH, NULL, ibmad_port)) < 0) IBWARN("Failed to resolve %s; attempting full scan", dr_path); - } else if (guid_str) { - if ((resolved = - resolve_portid_str(ibd_ca, ibd_ca_port, &port_id, - guid_str, IB_DEST_GUID, NULL, - ibmad_port)) < 0) + } else if (node_label.guid_str) { + if ((resolved = resolve_portid_str( + ibd_ca, ibd_ca_port, &port_id, node_label.guid_str, + IB_DEST_GUID, NULL, ibmad_port)) < 0) IBWARN("Failed to resolve %s; attempting full scan\n", - guid_str); + node_label.guid_str); } if (!all && dr_path) { @@ -726,8 +727,8 @@ int main(int argc, char **argv) } } - if (!all && guid_str) { - ibnd_port_t *p = ibnd_find_port_guid(fabric, guid); + if (!all && node_label.guid_str) { + ibnd_port_t *p = ibnd_find_port_guid(fabric, node_label.guid); if (p && (!only_flag || p->node->type == only_type)) { ibnd_node_t *n = p->node; if (diff_fabric) @@ -736,12 +737,12 @@ int main(int argc, char **argv) print_node(n, NULL); } else - fprintf(stderr, "Failed to find port: %s\n", guid_str); + fprintf(stderr, "Failed to find port: %s\n", node_label.guid_str); } else if (!all && dr_path) { ibnd_port_t *p = NULL; - mad_decode_field(ni, IB_NODE_PORT_GUID_F, &(guid)); + mad_decode_field(ni, IB_NODE_PORT_GUID_F, &node_label.guid); - p = ibnd_find_port_guid(fabric, guid); + p = ibnd_find_port_guid(fabric, node_label.guid); if (p && (!only_flag || p->node->type == only_type)) { ibnd_node_t *n = p->node; if (diff_fabric) From patchwork Fri Mar 8 19:55:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10845389 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2C0C139A for ; Fri, 8 Mar 2019 20:20:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EB443008F for ; Fri, 8 Mar 2019 20:20:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92EC9300B6; Fri, 8 Mar 2019 20:20:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F8B3300A1 for ; Fri, 8 Mar 2019 20:20:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727022AbfCHUUj (ORCPT ); Fri, 8 Mar 2019 15:20:39 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:41699 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726258AbfCHUUj (ORCPT ); Fri, 8 Mar 2019 15:20:39 -0500 Received: by mail-qk1-f193.google.com with SMTP id y15so11934777qki.8 for ; Fri, 08 Mar 2019 12:20:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hrhyff/5YM+X6BqgHpN7VBw1rxYg4aAZAsGa1hEtzx4=; b=bU8/XQ2hf29z81LAWvxJ571d1a5TMi5VqZCa/rOMfziExeWD1ccxMzQQw0OQY2IV2T DWNvixdIgl5/9mfuA7ZpM4CKpyCK4bCg7DleYmZ/ILI14ohY6ssbZ5XiEU0IudAlfY75 zbZFLsT70dahwVbv++aI5XP5hr3NMnc300ubfuhNbjfQZysZzMiPcsTwxF2QjnPD5LPp OppmMtAQfztgpPlWGko+HzIsIHAjSUo6WsmAuccVCn4rzytqNQwOrZEvtpbGlp/IAOUN eQYwT4JhcHWMKjwxgg0OBNVLYmjdhKKCOOHKu1W3Hn/I9NUh/Cfc00qGvMckQ90/VgFr KgTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hrhyff/5YM+X6BqgHpN7VBw1rxYg4aAZAsGa1hEtzx4=; b=tWTqbUdWNRm5UDfdzaYTntRxtgHDI/w3bHaPtwua4qUqB7p4twb+y0dsIOf5dpvKC4 AmqQ4FCjvf2z5qGi0pRAj3KjDPR0aJCmrR97LPAQ4bSR0Fq6jwUaIQJIuFO1z/AXY/+x d5ANulErYCnlIZ5YxKCeqCydkLFGl3BNR+DJDw0IzKYz4or8LQFkWHnNpW2upzVwM4WT 3guFevnE+eLibavRrlfWdjSjwwbAx7LhNYcaJB6r3WQDWh5dPvL88zolOGbA8Cg8/So6 1nPUi+jFzxrsl9+JYuBS2U4IAA3pxGAbv4QNLDnXDVUHXHd6Xk/Bb/BsIKEOZvx+aER/ TRLw== X-Gm-Message-State: APjAAAVAi91qdAPTpo+iIXqXFzxou7SJQdlz84szLKnzAGjJ8gO/Z2sU IXSaDsefMd+CaIm0FfXPHh3sfkKhmP/QhQ== X-Google-Smtp-Source: APXvYqyoaCZLDS9BLFXsr80ipdfewJCQ5NRev5E7Y6TyNtj6oAs3yO3EP+OQSLlCkJuPvW2vg+BZEw== X-Received: by 2002:ae9:c20f:: with SMTP id j15mr14300673qkg.132.1552076437743; Fri, 08 Mar 2019 12:20:37 -0800 (PST) Received: from ziepe.ca ([24.137.65.181]) by smtp.gmail.com with ESMTPSA id e6sm4842235qkb.77.2019.03.08.12.20.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Mar 2019 12:20:36 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1h2LaU-0000wL-Ml; Fri, 08 Mar 2019 15:55:22 -0400 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 14/14] ibdiags/ibtracert: Remove srcport parameter Date: Fri, 8 Mar 2019 15:55:15 -0400 Message-Id: <20190308195515.3408-15-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308195515.3408-1-jgg@ziepe.ca> References: <20190308195515.3408-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe All callers pass this as NULL, remove it and just use NULL instead. Avoids shadowing a global. Signed-off-by: Jason Gunthorpe --- src/ibtracert.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ibtracert.c b/src/ibtracert.c index 2fc8b9879225a8..98911db1442236 100644 --- a/src/ibtracert.c +++ b/src/ibtracert.c @@ -740,12 +740,12 @@ free_name: free(nodename); } -static int resolve_lid(ib_portid_t * portid, const void *srcport) +static int resolve_lid(ib_portid_t *portid) { uint8_t portinfo[64] = { 0 }; uint16_t lid; - if (!smp_query_via(portinfo, portid, IB_ATTR_PORT_INFO, 0, 0, srcport)) + if (!smp_query_via(portinfo, portid, IB_ATTR_PORT_INFO, 0, 0, NULL)) return -1; mad_decode_field(portinfo, IB_PORT_LID_F, &lid); @@ -804,12 +804,12 @@ static int get_route(char *srcid, char *dstid) { } if (ibd_dest_type == IB_DEST_DRPATH) { - if (resolve_lid(&src_portid, NULL) < 0) { + if (resolve_lid(&src_portid) < 0) { IBWARN("cannot resolve lid for port \'%s\'", portid2str(&src_portid)); return -1; } - if (resolve_lid(&dest_portid, NULL) < 0) { + if (resolve_lid(&dest_portid) < 0) { IBWARN("cannot resolve lid for port \'%s\'", portid2str(&dest_portid)); return -1;