From patchwork Tue Apr 9 13:11:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891255 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 C686417EF for ; Tue, 9 Apr 2019 13:11:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD01E2888C for ; Tue, 9 Apr 2019 13:11:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB49C28908; Tue, 9 Apr 2019 13:11:47 +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 3CBF62888C for ; Tue, 9 Apr 2019 13:11:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727222AbfDINLo (ORCPT ); Tue, 9 Apr 2019 09:11:44 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:40559 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727324AbfDINLo (ORCPT ); Tue, 9 Apr 2019 09:11:44 -0400 Received: by mail-qk1-f195.google.com with SMTP id w20so10156164qka.7 for ; Tue, 09 Apr 2019 06:11:42 -0700 (PDT) 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=ZIgxt1xdsUuhDNusB9e0FdWqbcxez0f3XsA4CcYo0ZQ=; b=oc1Km/r28Nl22YLvcVsVLotEgtZ0lugxtaPh2t5zvMGAlAo60wMQzl6YVnISrgp8Q1 3LYxR8foj8edkYs2OZ8m2gRynec6NIFznW6aWD6Hs3/pD7Hhq6oZt7w43LqtRpfrYsag EzoH5rUYf3K5NE0QkUrLMQ+V7G9k2fZOzz3XVvUuSKqou3GGr6cvK+d/WwENfwFtsnGF cp+YT09MgUTNoHsZpEy1dKu81qeeMTVf7iZonSK66nJHI6H9XO2REwWCVsPRU/2tde21 xVvScu9gI6MU55Qov1iFCm7AeoMHIvXu79FhE/ZtKwvuNyVemQ4nIm8MpdF3Ynhpur6m FaRQ== 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=ZIgxt1xdsUuhDNusB9e0FdWqbcxez0f3XsA4CcYo0ZQ=; b=BgjXjwMqfpBOJlujq2kg1avP/X0Kq7o1Sf+4GV/9iTtpdsyta7yjbefCLry+IHVnGl N6ePA0FLK74/tXX7ha5s2BTdHCkgMMR0LB38AB8xRA2FTTtb59m8E01THXDTB0Ou2HfQ Bi6IBvAA7kNQf+YP+tYYR7ZC1jGdMuMy/qkHELLtHMYuIJK7LyAKKpFaQAJJNstz4vSr fBK6X9Vfmwxhk4/KHgC/30jfJo6RMfj9uQUbuC7GJ0viPaEMftgLP4+kP1sSrBhyeCzg XbyKkU3TD+pQWOLrATDdfRxi2YNOk2ogm30yotpaOU/GY9FpSd3qHx5m6ydj3D2fLJ56 eQuQ== X-Gm-Message-State: APjAAAXhi2rj/tBGeGHrpU0nxZPgtI86kVaP2hwe+QkAp1YXVEWExeYr YyrN4Y+TnPal7FKyjBDfVGeNR43YK68= X-Google-Smtp-Source: APXvYqylfek8Ie2eCCDx9XHDGEp5OJXy42vTQAgJGQKXfQ9NJAlQlELVT1QOrb09PFiek3XEJi+nuQ== X-Received: by 2002:a37:9d06:: with SMTP id g6mr28064696qke.25.1554815501441; Tue, 09 Apr 2019 06:11:41 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id j93sm20735514qtd.82.2019.04.09.06.11.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:11:37 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXH-0004Du-Go; Tue, 09 Apr 2019 10:11:35 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 01/16] ibdiags: Replace cl_ntoh with betoh Date: Tue, 9 Apr 2019 10:11:18 -0300 Message-Id: <20190409131133.16140-2-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 done with a sed script. The glibc version automatically optimally handles constant values, so no need for the special constant version. Signed-off-by: Jason Gunthorpe --- libibnetdisc/src/ibnetdisc.c | 4 +- src/ibdiag_common.c | 12 +-- src/iblinkinfo.c | 2 +- src/ibnetdiscover.c | 6 +- src/ibportstate.c | 2 +- src/ibqueryerrors.c | 6 +- src/ibsendtrap.c | 14 +-- src/perfquery.c | 6 +- src/saquery.c | 204 +++++++++++++++++------------------ 9 files changed, 128 insertions(+), 128 deletions(-) diff --git a/libibnetdisc/src/ibnetdisc.c b/libibnetdisc/src/ibnetdisc.c index 7aaf4fcd181d40..bb36d39160da12 100644 --- a/libibnetdisc/src/ibnetdisc.c +++ b/libibnetdisc/src/ibnetdisc.c @@ -177,7 +177,7 @@ static void debug_port(ib_portid_t * portid, ibnd_port_t * port) else info = (uint8_t *)&port->info; cap_mask = mad_get_field(info, 0, IB_PORT_CAPMASK_F); - if (cap_mask & CL_NTOH32(IB_PORT_CAP_HAS_EXT_SPEEDS)) + if (cap_mask & be32toh(IB_PORT_CAP_HAS_EXT_SPEEDS)) espeed = mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_EXT_ACTIVE_F); else espeed = 0; @@ -391,7 +391,7 @@ static int recv_port_info(smp_engine_t * engine, ibnd_smp_t * smp, else info = (uint8_t *)&port->info; cap_mask = mad_get_field(info, 0, IB_PORT_CAPMASK_F); - if (cap_mask & CL_NTOH32(IB_PORT_CAP_HAS_EXT_SPEEDS)) + if (cap_mask & be32toh(IB_PORT_CAP_HAS_EXT_SPEEDS)) espeed = mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_EXT_ACTIVE_F); else espeed = 0; diff --git a/src/ibdiag_common.c b/src/ibdiag_common.c index 1d87bad0f4c397..962527e0c6feab 100644 --- a/src/ibdiag_common.c +++ b/src/ibdiag_common.c @@ -520,10 +520,10 @@ int is_port_info_extended_supported(ib_portid_t * dest, int port, IBEXIT("port info query failed"); mad_decode_field(data, IB_PORT_CAPMASK_F, &cap_mask); - if (cap_mask & CL_NTOH32(IB_PORT_CAP_HAS_CAP_MASK2)) { + if (cap_mask & be32toh(IB_PORT_CAP_HAS_CAP_MASK2)) { mad_decode_field(data, IB_PORT_CAPMASK2_F, &cap_mask2); if (!(cap_mask2 & - CL_NTOH16(IB_PORT_CAP2_IS_PORT_INFO_EXT_SUPPORTED))) { + be16toh(IB_PORT_CAP2_IS_PORT_INFO_EXT_SUPPORTED))) { IBWARN("port info capability mask2 = 0x%x doesn't" " indicate PortInfoExtended support", cap_mask2); return 0; @@ -622,8 +622,8 @@ int resolve_self(char *ca_name, uint8_t ca_port, ib_portid_t *portid, *portnum = port.portnum; if (gid) { memset(gid, 0, sizeof(*gid)); - prefix = cl_ntoh64(port.gid_prefix); - guid = cl_ntoh64(port.port_guid); + prefix = be64toh(port.gid_prefix); + guid = be64toh(port.port_guid); mad_encode_field(*gid, IB_GID_PREFIX_F, &prefix); mad_encode_field(*gid, IB_GID_GUID_F, &guid); } @@ -821,8 +821,8 @@ void get_max_msg(char *width_msg, char *speed_msg, int msg_size, ibnd_port_t * p rem_cap_mask = mad_get_field(info, 0, IB_PORT_CAPMASK_F); else rem_cap_mask = 0; - if (cap_mask & CL_NTOH32(IB_PORT_CAP_HAS_EXT_SPEEDS) && - rem_cap_mask & CL_NTOH32(IB_PORT_CAP_HAS_EXT_SPEEDS)) + if (cap_mask & be32toh(IB_PORT_CAP_HAS_EXT_SPEEDS) && + rem_cap_mask & be32toh(IB_PORT_CAP_HAS_EXT_SPEEDS)) goto check_ext_speed; check_fdr10_supp: fdr10 = (mad_get_field(port->ext_info, 0, diff --git a/src/iblinkinfo.c b/src/iblinkinfo.c index 4b43f62bf5739f..e5f5b9a7e2d3fa 100644 --- a/src/iblinkinfo.c +++ b/src/iblinkinfo.c @@ -138,7 +138,7 @@ static void print_port(ibnd_node_t *node, ibnd_port_t *port, if (info) { cap_mask = mad_get_field(info, 0, IB_PORT_CAPMASK_F); - if (cap_mask & CL_NTOH32(IB_PORT_CAP_HAS_EXT_SPEEDS)) + if (cap_mask & be32toh(IB_PORT_CAP_HAS_EXT_SPEEDS)) espeed = mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_EXT_ACTIVE_F); else diff --git a/src/ibnetdiscover.c b/src/ibnetdiscover.c index 053f3bd70563a7..91ce56bf011b4d 100644 --- a/src/ibnetdiscover.c +++ b/src/ibnetdiscover.c @@ -397,7 +397,7 @@ static void out_switch_port(ibnd_port_t *port, int group, } else { cap_mask = mad_get_field(port->node->ports[0]->info, 0, IB_PORT_CAPMASK_F); - if (cap_mask & CL_NTOH32(IB_PORT_CAP_HAS_EXT_SPEEDS)) + if (cap_mask & be32toh(IB_PORT_CAP_HAS_EXT_SPEEDS)) espeed = mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_EXT_ACTIVE_F); else @@ -460,7 +460,7 @@ static void out_ca_port(ibnd_port_t *port, int group, const char *out_prefix) port->remoteport->node->nodedesc); cap_mask = mad_get_field(port->info, 0, IB_PORT_CAPMASK_F); - if (cap_mask & CL_NTOH32(IB_PORT_CAP_HAS_EXT_SPEEDS)) + if (cap_mask & be32toh(IB_PORT_CAP_HAS_EXT_SPEEDS)) espeed = mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_EXT_ACTIVE_F); else @@ -714,7 +714,7 @@ static void dump_ports_report(ibnd_node_t *node, void *user_data) info = (uint8_t *)&port->info; if (info) { cap_mask = mad_get_field(info, 0, IB_PORT_CAPMASK_F); - if (cap_mask & CL_NTOH32(IB_PORT_CAP_HAS_EXT_SPEEDS)) + if (cap_mask & be32toh(IB_PORT_CAP_HAS_EXT_SPEEDS)) espeed = mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_EXT_ACTIVE_F); else diff --git a/src/ibportstate.c b/src/ibportstate.c index 29ffac274b7210..75eafc5f12970b 100644 --- a/src/ibportstate.c +++ b/src/ibportstate.c @@ -153,7 +153,7 @@ static int get_port_info(ib_portid_t * dest, uint8_t * data, int portnum, if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, portnum, 0, srcport)) IBEXIT("smp query portinfo failed"); cap_mask = mad_get_field(info, 0, IB_PORT_CAPMASK_F); - return (cap_mask & CL_NTOH32(IB_PORT_CAP_HAS_EXT_SPEEDS)); + return (cap_mask & be32toh(IB_PORT_CAP_HAS_EXT_SPEEDS)); } static void show_port_info(ib_portid_t * dest, uint8_t * data, int portnum, diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c index 68823f3deff432..b56d7c91cefdb9 100644 --- a/src/ibqueryerrors.c +++ b/src/ibqueryerrors.c @@ -200,7 +200,7 @@ static void print_port_config(ibnd_node_t * node, int portnum) else info = (uint8_t *)&port->info; cap_mask = mad_get_field(info, 0, IB_PORT_CAPMASK_F); - if (cap_mask & CL_NTOH32(IB_PORT_CAP_HAS_EXT_SPEEDS)) + if (cap_mask & be32toh(IB_PORT_CAP_HAS_EXT_SPEEDS)) espeed = mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_EXT_ACTIVE_F); else @@ -318,7 +318,7 @@ static void insert_lid2sl_table(struct sa_query_result *r) unsigned int i; for (i = 0; i < r->result_cnt; i++) { ib_path_rec_t *p_pr = (ib_path_rec_t *)sa_get_query_rec(r->p_result_madw, i); - lid2sl_table[cl_ntoh16(p_pr->dlid)] = ib_path_rec_sl(p_pr); + lid2sl_table[be16toh(p_pr->dlid)] = ib_path_rec_sl(p_pr); } } @@ -346,7 +346,7 @@ static int path_record_query(ib_gid_t sgid,uint64_t dguid) pr.num_path |= reversible << 7; struct sa_query_result result; int ret = sa_query(h, IB_MAD_METHOD_GET_TABLE, - (uint16_t)IB_SA_ATTR_PATHRECORD,0,cl_ntoh64(comp_mask),ibd_sakey, + (uint16_t)IB_SA_ATTR_PATHRECORD,0,be64toh(comp_mask),ibd_sakey, &pr, sizeof(pr), &result); if (ret) { sa_free_handle(h); diff --git a/src/ibsendtrap.c b/src/ibsendtrap.c index 1d7725ee71ad0a..4459b1658417bd 100644 --- a/src/ibsendtrap.c +++ b/src/ibsendtrap.c @@ -130,9 +130,9 @@ static void build_trap256_local(ib_mad_notice_attr_t * n, ib_portid_t * port) n->data_details.ntc_256.lid = n->issuer_lid; n->data_details.ntc_256.dr_slid = 0xffff; n->data_details.ntc_256.method = 1; - n->data_details.ntc_256.attr_id = cl_ntoh16(0x15); - n->data_details.ntc_256.attr_mod = cl_ntoh32(0x12); - n->data_details.ntc_256.mkey = cl_ntoh64(0x1234567812345678); + n->data_details.ntc_256.attr_id = be16toh(0x15); + n->data_details.ntc_256.attr_mod = be32toh(0x12); + n->data_details.ntc_256.mkey = be64toh(0x1234567812345678); } static void build_trap256_lid(ib_mad_notice_attr_t * n, ib_portid_t * port) @@ -163,10 +163,10 @@ static void build_trap257_258(ib_mad_notice_attr_t * n, ib_portid_t * port, n->data_details.ntc_257_258.key = cl_hton32(0x12345678); n->data_details.ntc_257_258.qp1 = cl_hton32(0x010101); n->data_details.ntc_257_258.qp2 = cl_hton32(0x020202); - n->data_details.ntc_257_258.gid1.unicast.prefix = cl_ntoh64(0xf8c0000000000001); - n->data_details.ntc_257_258.gid1.unicast.interface_id = cl_ntoh64(0x1111222233334444); - n->data_details.ntc_257_258.gid2.unicast.prefix = cl_ntoh64(0xf8c0000000000001); - n->data_details.ntc_257_258.gid2.unicast.interface_id = cl_ntoh64(0x5678567812341234); + n->data_details.ntc_257_258.gid1.unicast.prefix = be64toh(0xf8c0000000000001); + n->data_details.ntc_257_258.gid1.unicast.interface_id = be64toh(0x1111222233334444); + n->data_details.ntc_257_258.gid2.unicast.prefix = be64toh(0xf8c0000000000001); + n->data_details.ntc_257_258.gid2.unicast.interface_id = be64toh(0x5678567812341234); } static void build_trap257(ib_mad_notice_attr_t * n, ib_portid_t * port) diff --git a/src/perfquery.c b/src/perfquery.c index c7536dcc52ef00..91fe94e74dafbe 100644 --- a/src/perfquery.c +++ b/src/perfquery.c @@ -575,9 +575,9 @@ static uint8_t is_rsfec_mode_active(ib_portid_t * portid, int port, mad_decode_field(data, IB_PORT_EXT_FEC_MODE_ACTIVE_F, &fec_mode_active); if((pie_capmask & - CL_NTOH32(IB_PORT_EXT_CAP_IS_FEC_MODE_SUPPORTED)) && - ((CL_NTOH16(IB_PORT_EXT_RS_FEC_MODE_ACTIVE) == (fec_mode_active & 0xffff)) || - (CL_NTOH16(IB_PORT_EXT_RS_FEC2_MODE_ACTIVE) == (fec_mode_active & 0xffff)))) + be32toh(IB_PORT_EXT_CAP_IS_FEC_MODE_SUPPORTED)) && + ((be16toh(IB_PORT_EXT_RS_FEC_MODE_ACTIVE) == (fec_mode_active & 0xffff)) || + (be16toh(IB_PORT_EXT_RS_FEC2_MODE_ACTIVE) == (fec_mode_active & 0xffff)))) return 1; } diff --git a/src/saquery.c b/src/saquery.c index 1ce2f232d4d339..9ecd5f5332b263 100644 --- a/src/saquery.c +++ b/src/saquery.c @@ -135,7 +135,7 @@ static void print_node_desc(ib_node_record_t * node_record) name = remap_node_name(node_name_map, node_record->node_info.node_guid, (char *)p_nd->description); - printf("%6d \"%s\"\n", cl_ntoh16(node_record->lid), name); + printf("%6d \"%s\"\n", be16toh(node_record->lid), name); free(name); } } @@ -145,7 +145,7 @@ static void dump_node_record(void *data, struct query_params *p) ib_node_record_t *nr = data; ib_node_info_t *ni = &nr->node_info; char *name = remap_node_name(node_name_map, - cl_ntoh64(ni->node_guid), + be64toh(ni->node_guid), (char *)nr->node_desc.description); printf("NodeRecord dump:\n" @@ -164,14 +164,14 @@ static void dump_node_record(void *data, struct query_params *p) "\t\tport_num................%u\n" "\t\tvendor_id...............0x%X\n" "\t\tNodeDescription.........%s\n", - cl_ntoh16(nr->lid), cl_ntoh16(nr->resv), + be16toh(nr->lid), be16toh(nr->resv), ni->base_version, ni->class_version, ib_get_node_type_str(ni->node_type), ni->num_ports, - cl_ntoh64(ni->sys_guid), cl_ntoh64(ni->node_guid), - cl_ntoh64(ni->port_guid), cl_ntoh16(ni->partition_cap), - cl_ntoh16(ni->device_id), cl_ntoh32(ni->revision), + be64toh(ni->sys_guid), be64toh(ni->node_guid), + be64toh(ni->port_guid), be16toh(ni->partition_cap), + be16toh(ni->device_id), be32toh(ni->revision), ib_node_info_get_local_port_num(ni), - cl_ntoh32(ib_node_info_get_vendor_id(ni)), + be32toh(ib_node_info_get_vendor_id(ni)), name); free(name); @@ -186,15 +186,15 @@ static void print_node_record(ib_node_record_t * node_record) switch (node_print_desc) { case LID_ONLY: case UNIQUE_LID_ONLY: - printf("%u\n", cl_ntoh16(node_record->lid)); + printf("%u\n", be16toh(node_record->lid)); return; case GUID_ONLY: - printf("0x%016" PRIx64 "\n", cl_ntoh64(p_ni->port_guid)); + printf("0x%016" PRIx64 "\n", be64toh(p_ni->port_guid)); return; case NAME_OF_LID: case NAME_OF_GUID: name = remap_node_name(node_name_map, - cl_ntoh64(p_ni->node_guid), + be64toh(p_ni->node_guid), (char *)p_nd->description); printf("%s\n", name); free(name); @@ -229,12 +229,12 @@ static void dump_path_record(void *data, struct query_params *p) "\t\tpkt_life................0x%X\n" "\t\tpreference..............0x%X\n" "\t\tresv2...................0x%02X%02X%02X%02X%02X%02X\n", - cl_ntoh64(p_pr->service_id), + be64toh(p_pr->service_id), inet_ntop(AF_INET6, p_pr->dgid.raw, gid_str, sizeof gid_str), inet_ntop(AF_INET6, p_pr->sgid.raw, gid_str2, sizeof gid_str2), - cl_ntoh16(p_pr->dlid), cl_ntoh16(p_pr->slid), - cl_ntoh32(p_pr->hop_flow_raw), p_pr->tclass, p_pr->num_path, - cl_ntoh16(p_pr->pkey), ib_path_rec_qos_class(p_pr), + be16toh(p_pr->dlid), be16toh(p_pr->slid), + be32toh(p_pr->hop_flow_raw), p_pr->tclass, p_pr->num_path, + be16toh(p_pr->pkey), ib_path_rec_qos_class(p_pr), ib_path_rec_sl(p_pr), p_pr->mtu, p_pr->rate, p_pr->pkt_life, p_pr->preference, p_pr->resv2[0], p_pr->resv2[1], p_pr->resv2[2], @@ -264,16 +264,16 @@ static void dump_class_port_info(ib_class_port_info_t *cpi) "\t\tTrap PKey................0x%04X\n" "\t\tTrap HL/QP...............0x%08X\n" "\t\tTrap QKey................0x%08X\n", - cpi->base_ver, cpi->class_ver, cl_ntoh16(cpi->cap_mask), + cpi->base_ver, cpi->class_ver, be16toh(cpi->cap_mask), ib_class_cap_mask2(cpi), ib_class_resp_time_val(cpi), inet_ntop(AF_INET6, &(cpi->redir_gid), gid_str, sizeof gid_str), - cl_ntoh32(cpi->redir_tc_sl_fl), cl_ntoh16(cpi->redir_lid), - cl_ntoh16(cpi->redir_pkey), cl_ntoh32(cpi->redir_qp), - cl_ntoh32(cpi->redir_qkey), + be32toh(cpi->redir_tc_sl_fl), be16toh(cpi->redir_lid), + be16toh(cpi->redir_pkey), be32toh(cpi->redir_qp), + be32toh(cpi->redir_qkey), inet_ntop(AF_INET6, &(cpi->trap_gid), gid_str2, sizeof gid_str2), - cl_ntoh32(cpi->trap_tc_sl_fl), cl_ntoh16(cpi->trap_lid), - cl_ntoh16(cpi->trap_pkey), cl_ntoh32(cpi->trap_hop_qp), - cl_ntoh32(cpi->trap_qkey)); + be32toh(cpi->trap_tc_sl_fl), be16toh(cpi->trap_lid), + be16toh(cpi->trap_pkey), be32toh(cpi->trap_hop_qp), + be32toh(cpi->trap_qkey)); } static void dump_portinfo_record(void *data, struct query_params *p) @@ -287,9 +287,9 @@ static void dump_portinfo_record(void *data, struct query_params *p) "\t\tbase_lid................%u\n" "\t\tmaster_sm_base_lid......%u\n" "\t\tcapability_mask.........0x%X\n", - cl_ntoh16(p_pir->lid), p_pir->port_num, - cl_ntoh16(p_pi->base_lid), cl_ntoh16(p_pi->master_sm_base_lid), - cl_ntoh32(p_pi->capability_mask)); + be16toh(p_pir->lid), p_pir->port_num, + be16toh(p_pi->base_lid), be16toh(p_pi->master_sm_base_lid), + be32toh(p_pi->capability_mask)); } static void dump_one_portinfo_record(void *data, struct query_params *p) @@ -303,7 +303,7 @@ static void dump_one_portinfo_record(void *data, struct query_params *p) "\t\tPortNum.................%u\n" "\t\tOptions.................0x%x\n" "\tPortInfo dump:\n", - cl_ntoh16(pir->lid), pir->port_num, pir->options); + be16toh(pir->lid), pir->port_num, pir->options); dump_portinfo(pi, 2); } @@ -333,8 +333,8 @@ static void dump_one_mcmember_record(void *data, struct query_params *p) "\t\tProxyJoin...............0x%x\n", inet_ntop(AF_INET6, mr->mgid.raw, mgid, sizeof(mgid)), inet_ntop(AF_INET6, mr->port_gid.raw, gid, sizeof(gid)), - cl_ntoh32(mr->qkey), cl_ntoh16(mr->mlid), mr->mtu, mr->tclass, - cl_ntoh16(mr->pkey), mr->rate, mr->pkt_life, sl, + be32toh(mr->qkey), be16toh(mr->mlid), mr->mtu, mr->tclass, + be16toh(mr->pkey), mr->rate, mr->pkt_life, sl, flow, hop, scope, join, mr->proxy_join); } @@ -352,8 +352,8 @@ static void dump_multicast_group_record(void *data, struct query_params *p) "\t\tRate....................0x%X\n" "\t\tSL......................0x%X\n", inet_ntop(AF_INET6, p_mcmr->mgid.raw, gid_str, sizeof gid_str), - cl_ntoh16(p_mcmr->mlid), - p_mcmr->mtu, cl_ntoh16(p_mcmr->pkey), p_mcmr->rate, sl); + be16toh(p_mcmr->mlid), + p_mcmr->mtu, be16toh(p_mcmr->pkey), p_mcmr->rate, sl); } static void dump_multicast_member_record(ib_member_rec_t *p_mcmr, @@ -362,7 +362,7 @@ static void dump_multicast_member_record(ib_member_rec_t *p_mcmr, { char gid_str[INET6_ADDRSTRLEN]; char gid_str2[INET6_ADDRSTRLEN]; - uint16_t mlid = cl_ntoh16(p_mcmr->mlid); + uint16_t mlid = be16toh(p_mcmr->mlid); unsigned i = 0; char *node_name = strdup(""); @@ -398,7 +398,7 @@ static void dump_multicast_member_record(ib_member_rec_t *p_mcmr, "\t\tNodeDescription.........%s\n", inet_ntop(AF_INET6, p_mcmr->mgid.raw, gid_str, sizeof gid_str), - cl_ntoh16(p_mcmr->mlid), + be16toh(p_mcmr->mlid), inet_ntop(AF_INET6, p_mcmr->port_gid.raw, gid_str2, sizeof gid_str2), p_mcmr->scope_state, p_mcmr->proxy_join, node_name); @@ -463,9 +463,9 @@ static void dump_service_record(void *data, struct query_params *p) "\t\tServiceData32.4.........0x%X\n" "\t\tServiceData64.1.........0x%016" PRIx64 "\n" "\t\tServiceData64.2.........0x%016" PRIx64 "\n", - cl_ntoh64(p_sr->service_id), + be64toh(p_sr->service_id), inet_ntop(AF_INET6, p_sr->service_gid.raw, gid, sizeof gid), - cl_ntoh16(p_sr->service_pkey), cl_ntoh32(p_sr->service_lease), + be16toh(p_sr->service_pkey), be32toh(p_sr->service_lease), (show_keys ? buf_service_key : NOT_DISPLAYED_STR), buf_service_name, p_sr->service_data8[0], p_sr->service_data8[1], @@ -476,20 +476,20 @@ static void dump_service_record(void *data, struct query_params *p) p_sr->service_data8[10], p_sr->service_data8[11], p_sr->service_data8[12], p_sr->service_data8[13], p_sr->service_data8[14], p_sr->service_data8[15], - cl_ntoh16(p_sr->service_data16[0]), - cl_ntoh16(p_sr->service_data16[1]), - cl_ntoh16(p_sr->service_data16[2]), - cl_ntoh16(p_sr->service_data16[3]), - cl_ntoh16(p_sr->service_data16[4]), - cl_ntoh16(p_sr->service_data16[5]), - cl_ntoh16(p_sr->service_data16[6]), - cl_ntoh16(p_sr->service_data16[7]), - cl_ntoh32(p_sr->service_data32[0]), - cl_ntoh32(p_sr->service_data32[1]), - cl_ntoh32(p_sr->service_data32[2]), - cl_ntoh32(p_sr->service_data32[3]), - cl_ntoh64(p_sr->service_data64[0]), - cl_ntoh64(p_sr->service_data64[1])); + be16toh(p_sr->service_data16[0]), + be16toh(p_sr->service_data16[1]), + be16toh(p_sr->service_data16[2]), + be16toh(p_sr->service_data16[3]), + be16toh(p_sr->service_data16[4]), + be16toh(p_sr->service_data16[5]), + be16toh(p_sr->service_data16[6]), + be16toh(p_sr->service_data16[7]), + be32toh(p_sr->service_data32[0]), + be32toh(p_sr->service_data32[1]), + be32toh(p_sr->service_data32[2]), + be32toh(p_sr->service_data32[3]), + be64toh(p_sr->service_data64[0]), + be64toh(p_sr->service_data64[1])); } static void dump_sm_info_record(void *data, struct query_params *p) @@ -509,10 +509,10 @@ static void dump_sm_info_record(void *data, struct query_params *p) "\t\tActCount..............%u\n" "\t\tPriority..............%u\n" "\t\tSMState...............%u\n", - cl_ntoh16(p_smr->lid), - cl_ntoh64(p_smr->sm_info.guid), - cl_ntoh64(p_smr->sm_info.sm_key), - cl_ntoh32(p_smr->sm_info.act_count), + be16toh(p_smr->lid), + be64toh(p_smr->sm_info.guid), + be64toh(p_smr->sm_info.sm_key), + be32toh(p_smr->sm_info.act_count), priority, state); } @@ -536,21 +536,21 @@ static void dump_switch_info_record(void *data, struct query_params *p) "\t\tLIDsPerPort.............................0x%X\n" "\t\tPartitionEnforcementCap.................0x%X\n" "\t\tflags...................................0x%X\n", - cl_ntoh16(p_sir->lid), - cl_ntoh16(p_sir->switch_info.lin_cap), - cl_ntoh16(p_sir->switch_info.rand_cap), - cl_ntoh16(p_sir->switch_info.mcast_cap), - cl_ntoh16(p_sir->switch_info.lin_top), + be16toh(p_sir->lid), + be16toh(p_sir->switch_info.lin_cap), + be16toh(p_sir->switch_info.rand_cap), + be16toh(p_sir->switch_info.mcast_cap), + be16toh(p_sir->switch_info.lin_top), p_sir->switch_info.def_port, p_sir->switch_info.def_mcast_pri_port, p_sir->switch_info.def_mcast_not_port, p_sir->switch_info.life_state, - cl_ntoh16(p_sir->switch_info.lids_per_port), - cl_ntoh16(p_sir->switch_info.enforce_cap), + be16toh(p_sir->switch_info.lids_per_port), + be16toh(p_sir->switch_info.enforce_cap), p_sir->switch_info.flags); if (sa_cap_mask2 & UMAD_SA_CAP_MASK2_IS_MCAST_TOP_SUP) printf("\t\tMulticastFDBTop.........................0x%X\n", - cl_ntoh16(p_sir->switch_info.mcast_top)); + be16toh(p_sir->switch_info.mcast_top)); } static void dump_inform_info_record(void *data, struct query_params *p) @@ -579,18 +579,18 @@ static void dump_inform_info_record(void *data, struct query_params *p) "\t\ttrap_num................%u\n", inet_ntop(AF_INET6, p_iir->subscriber_gid.raw, gid_str, sizeof gid_str), - cl_ntoh16(p_iir->subscriber_enum), + be16toh(p_iir->subscriber_enum), inet_ntop(AF_INET6, p_iir->inform_info.gid.raw, gid_str2, sizeof gid_str2), - cl_ntoh16(p_iir->inform_info.lid_range_begin), - cl_ntoh16(p_iir->inform_info.lid_range_end), + be16toh(p_iir->inform_info.lid_range_begin), + be16toh(p_iir->inform_info.lid_range_end), p_iir->inform_info.is_generic, p_iir->inform_info.subscribe, - cl_ntoh16(p_iir->inform_info.trap_type), - cl_ntoh16(p_iir->inform_info.g_or_v.generic.trap_num)); + be16toh(p_iir->inform_info.trap_type), + be16toh(p_iir->inform_info.g_or_v.generic.trap_num)); if (show_keys) { printf("\t\tqpn.....................0x%06X\n", - cl_ntoh32(qpn)); + be32toh(qpn)); } else { printf("\t\tqpn....................." NOT_DISPLAYED_STR "\n"); @@ -598,7 +598,7 @@ static void dump_inform_info_record(void *data, struct query_params *p) printf("\t\tresp_time_val...........0x%X\n" "\t\tnode_type...............0x%06X\n", resp_time_val, - cl_ntoh32(ib_inform_info_get_prod_type + be32toh(ib_inform_info_get_prod_type (&p_iir->inform_info))); } else { printf("InformInfoRecord dump:\n" @@ -615,18 +615,18 @@ static void dump_inform_info_record(void *data, struct query_params *p) "\t\tdev_id..................0x%X\n", inet_ntop(AF_INET6, p_iir->subscriber_gid.raw, gid_str, sizeof gid_str), - cl_ntoh16(p_iir->subscriber_enum), + be16toh(p_iir->subscriber_enum), inet_ntop(AF_INET6, p_iir->inform_info.gid.raw, gid_str2, sizeof gid_str2), - cl_ntoh16(p_iir->inform_info.lid_range_begin), - cl_ntoh16(p_iir->inform_info.lid_range_end), + be16toh(p_iir->inform_info.lid_range_begin), + be16toh(p_iir->inform_info.lid_range_end), p_iir->inform_info.is_generic, p_iir->inform_info.subscribe, - cl_ntoh16(p_iir->inform_info.trap_type), - cl_ntoh16(p_iir->inform_info.g_or_v.vend.dev_id)); + be16toh(p_iir->inform_info.trap_type), + be16toh(p_iir->inform_info.g_or_v.vend.dev_id)); if (show_keys) { printf("\t\tqpn.....................0x%06X\n", - cl_ntoh32(qpn)); + be32toh(qpn)); } else { printf("\t\tqpn....................." NOT_DISPLAYED_STR "\n"); @@ -634,7 +634,7 @@ static void dump_inform_info_record(void *data, struct query_params *p) printf("\t\tresp_time_val...........0x%X\n" "\t\tvendor_id...............0x%06X\n", resp_time_val, - cl_ntoh32(ib_inform_info_get_prod_type + be32toh(ib_inform_info_get_prod_type (&p_iir->inform_info))); } } @@ -647,8 +647,8 @@ static void dump_one_link_record(void *data, struct query_params *p) "\t\tFromPort...................%u\n" "\t\tToPort.....................%u\n" "\t\tToLID......................%u\n", - cl_ntoh16(lr->from_lid), lr->from_port_num, - lr->to_port_num, cl_ntoh16(lr->to_lid)); + be16toh(lr->from_lid), lr->from_port_num, + lr->to_port_num, be16toh(lr->to_lid)); } static void dump_one_slvl_record(void *data, struct query_params *p) @@ -662,7 +662,7 @@ static void dump_one_slvl_record(void *data, struct query_params *p) "\t\tSL: 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|\n" "\t\tVL:%2u|%2u|%2u|%2u|%2u|%2u|%2u|%2u|%2u|%2u|%2u|%2u|%2u" "|%2u|%2u|%2u|\n", - cl_ntoh16(slvl->lid), slvl->in_port_num, slvl->out_port_num, + be16toh(slvl->lid), slvl->in_port_num, slvl->out_port_num, ib_slvl_table_get(t, 0), ib_slvl_table_get(t, 1), ib_slvl_table_get(t, 2), ib_slvl_table_get(t, 3), ib_slvl_table_get(t, 4), ib_slvl_table_get(t, 5), @@ -682,7 +682,7 @@ static void dump_one_vlarb_record(void *data, struct query_params *p) "\t\tLID........................%u\n" "\t\tPort.......................%u\n" "\t\tBlock......................%u\n", - cl_ntoh16(vlarb->lid), vlarb->port_num, vlarb->block_num); + be16toh(vlarb->lid), vlarb->port_num, vlarb->block_num); for (i = 0; i < 32; i += 16) printf("\t\tVL :%2u|%2u|%2u|%2u|%2u|%2u|%2u|%2u|" "%2u|%2u|%2u|%2u|%2u|%2u|%2u|%2u|\n" @@ -710,26 +710,26 @@ static void dump_one_pkey_tbl_record(void *data, struct query_params *params) "\t\tPort.......................%u\n" "\t\tBlock......................%u\n" "\t\tPKey Table:\n", - cl_ntoh16(pktr->lid), pktr->port_num, pktr->block_num); + be16toh(pktr->lid), pktr->port_num, pktr->block_num); for (i = 0; i < 32; i += 8) printf("\t\t0x%04x 0x%04x 0x%04x 0x%04x" " 0x%04x 0x%04x 0x%04x 0x%04x\n", - cl_ntoh16(p[i + 0]), cl_ntoh16(p[i + 1]), - cl_ntoh16(p[i + 2]), cl_ntoh16(p[i + 3]), - cl_ntoh16(p[i + 4]), cl_ntoh16(p[i + 5]), - cl_ntoh16(p[i + 6]), cl_ntoh16(p[i + 7])); + be16toh(p[i + 0]), be16toh(p[i + 1]), + be16toh(p[i + 2]), be16toh(p[i + 3]), + be16toh(p[i + 4]), be16toh(p[i + 5]), + be16toh(p[i + 6]), be16toh(p[i + 7])); printf("\n"); } static void dump_one_lft_record(void *data, struct query_params *p) { ib_lft_record_t *lftr = data; - unsigned block = cl_ntoh16(lftr->block_num); + unsigned block = be16toh(lftr->block_num); int i; printf("LFT Record dump:\n" "\t\tLID........................%u\n" "\t\tBlock......................%u\n" - "\t\tLFT:\n\t\tLID\tPort Number\n", cl_ntoh16(lftr->lid), block); + "\t\tLFT:\n\t\tLID\tPort Number\n", be16toh(lftr->lid), block); for (i = 0; i < 64; i++) printf("\t\t%u\t%u\n", block * 64 + i, lftr->lft[i]); printf("\n"); @@ -749,22 +749,22 @@ static void dump_one_guidinfo_record(void *data, struct query_params *p) "\t\tGUID 5.....................0x%016" PRIx64 "\n" "\t\tGUID 6.....................0x%016" PRIx64 "\n" "\t\tGUID 7.....................0x%016" PRIx64 "\n", - cl_ntoh16(gir->lid), gir->block_num, - cl_ntoh64(gir->guid_info.guid[0]), - cl_ntoh64(gir->guid_info.guid[1]), - cl_ntoh64(gir->guid_info.guid[2]), - cl_ntoh64(gir->guid_info.guid[3]), - cl_ntoh64(gir->guid_info.guid[4]), - cl_ntoh64(gir->guid_info.guid[5]), - cl_ntoh64(gir->guid_info.guid[6]), - cl_ntoh64(gir->guid_info.guid[7])); + be16toh(gir->lid), gir->block_num, + be64toh(gir->guid_info.guid[0]), + be64toh(gir->guid_info.guid[1]), + be64toh(gir->guid_info.guid[2]), + be64toh(gir->guid_info.guid[3]), + be64toh(gir->guid_info.guid[4]), + be64toh(gir->guid_info.guid[5]), + be64toh(gir->guid_info.guid[6]), + be64toh(gir->guid_info.guid[7])); } static void dump_one_mft_record(void *data, struct query_params *p) { ib_mft_record_t *mftr = data; - unsigned position = cl_ntoh16(mftr->position_block_num) >> 12; - unsigned block = cl_ntoh16(mftr->position_block_num) & + unsigned position = be16toh(mftr->position_block_num) >> 12; + unsigned block = be16toh(mftr->position_block_num) & IB_MCAST_BLOCK_ID_MASK_HO; int i; unsigned offset; @@ -774,11 +774,11 @@ static void dump_one_mft_record(void *data, struct query_params *p) "\t\tPosition...................%u\n" "\t\tBlock......................%u\n" "\t\tMFT:\n\t\tMLID\tPort Mask\n", - cl_ntoh16(mftr->lid), position, block); + be16toh(mftr->lid), position, block); offset = IB_LID_MCAST_START_HO + block * 32; for (i = 0; i < IB_MCAST_BLOCK_SIZE; i++) printf("\t\t0x%04x\t0x%04x\n", - offset + i, cl_ntoh16(mftr->mft[i])); + offset + i, be16toh(mftr->mft[i])); printf("\n"); } @@ -803,7 +803,7 @@ static int get_any_records(struct sa_handle * h, struct sa_query_result *result) { int ret = sa_query(h, IB_MAD_METHOD_GET_TABLE, attr_id, attr_mod, - cl_ntoh64(comp_mask), ibd_sakey, attr, attr_size, result); + be64toh(comp_mask), ibd_sakey, attr, attr_size, result); if (ret) { fprintf(stderr, "Query SA failed: %s\n", strerror(ret)); return ret; @@ -881,7 +881,7 @@ static int get_lid_from_name(struct sa_handle * h, const char *name, uint16_t * && strncmp(name, (char *)node_record->node_desc.description, sizeof(node_record->node_desc.description)) == 0) { - *lid = cl_ntoh16(node_record->lid); + *lid = be16toh(node_record->lid); ret = 0; break; } @@ -1002,12 +1002,12 @@ static int print_node_records(struct sa_handle * h, struct query_params *p) if (node_print_desc == ALL_DESC) { print_node_desc(node_record); } else if (node_print_desc == NAME_OF_LID) { - if (requested_lid == cl_ntoh16(node_record->lid)) + if (requested_lid == be16toh(node_record->lid)) print_node_record(node_record); } else if (node_print_desc == NAME_OF_GUID) { ib_node_info_t *p_ni = &(node_record->node_info); - if (requested_guid == cl_ntoh64(p_ni->port_guid)) + if (requested_guid == be64toh(p_ni->port_guid)) print_node_record(node_record); } else { ib_node_info_t *p_ni = &(node_record->node_info); @@ -1015,7 +1015,7 @@ static int print_node_records(struct sa_handle * h, struct query_params *p) char *name; name = remap_node_name (node_name_map, - cl_ntoh64(p_ni->node_guid), + be64toh(p_ni->node_guid), (char *)p_nd->description); if (!requested_name || From patchwork Tue Apr 9 13:11:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891251 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 A94E01805 for ; Tue, 9 Apr 2019 13:11:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 939D4288F7 for ; Tue, 9 Apr 2019 13:11:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8472328923; Tue, 9 Apr 2019 13:11:46 +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 CC731288E8 for ; Tue, 9 Apr 2019 13:11:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726993AbfDINLo (ORCPT ); Tue, 9 Apr 2019 09:11:44 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:45199 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726112AbfDINLo (ORCPT ); Tue, 9 Apr 2019 09:11:44 -0400 Received: by mail-qt1-f196.google.com with SMTP id v20so19549475qtv.12 for ; Tue, 09 Apr 2019 06:11:43 -0700 (PDT) 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=7Yhq0U4aP2OVKCqs/39H77dJua9mGhqfbh9sFI4QdSE=; b=hkx7FuicC1ubYRvUHWgzEQauj85LeZ/ji9GftoFsFff3OnxuhnM6FzXH7Ok0WXRY/a 2Pu35Jf/gJ/UCBzlZjkGuGtw6YMgvpCyDUl57UggAQFll36sqBAbWj2EILR5B5WpuTtL ihtjKI1hKm8ou5ezbu9hsguEO/7PMuQiO8JfxrItoCa50hLLOBlf3N1EpfC+GYXbDEEf loTk/DFoSvHKgnN33AMVyrakITgrShLj8gqtqb//b3tdE5054wScUhKjFnxSE2cd2w7S jcmtijw0j54zBSD30b0o4IehkiAPLh+PfXmHIQOXMIXCfLSEitmkX3dMA6TzmK1rkvdq 2Ahw== 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=7Yhq0U4aP2OVKCqs/39H77dJua9mGhqfbh9sFI4QdSE=; b=irA9/jOQ4ZezKAhwrRJMzHHBXQ2rYxJUggmP3DKA7hKKW7+PCug8FSgX1I6d8IpEOQ CUEhItgU+wUK1TrAITtql9URq2FejlJ7R8VfP+YQ94v9ESsC4vBECAhbriB0lxQYglCw 7Nrj9898hzBpl8gs+0/aXMPZch6a+iJw7exhz/uLxXtFm+T5izFwS+z/I3kNNrWAP3l8 oI2H3Al4gX3ulUlwIrr+Ffat07GR8rXpwZtxgrdIK3L6LjO1GIqpUGvbcwNHuC9vP4Ev qMNRy9Q51xV7x8CLgCPKzWP2It0N8k7xFUL2R0hRWSKq/sRhS8/DcfPoMWXhmMA+9oBG BPog== X-Gm-Message-State: APjAAAU1HZZ8yvDl7IjMkpXNMHqddUcAfglJCUxCsRFGX7DG5RWUYtaQ nSW7flHw1MbsMk8SCFPNnQhweGAXuYQ= X-Google-Smtp-Source: APXvYqxEZ+v/ZZ/RjiD3mNQcsBKGixwqXk6sO68pTEBI0RrhSprGZaylBHO2DS7cbQvzC2BsYcKVMg== X-Received: by 2002:ac8:3957:: with SMTP id t23mr30117104qtb.331.1554815503046; Tue, 09 Apr 2019 06:11:43 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id a188sm11331316qkf.34.2019.04.09.06.11.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:11:37 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXH-0004E0-Hx; Tue, 09 Apr 2019 10:11:35 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 02/16] ibdiags: Replace cl_hton with htobe Date: Tue, 9 Apr 2019 10:11:19 -0300 Message-Id: <20190409131133.16140-3-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 done with a sed script. The glibc version automatically optimally handles constant values, so no need for the special constant version. Signed-off-by: Jason Gunthorpe --- include/ibdiag_sa.h | 7 +++++-- src/ibsendtrap.c | 44 ++++++++++++++++++++++---------------------- src/saquery.c | 8 ++++---- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/include/ibdiag_sa.h b/include/ibdiag_sa.h index 368a8294dc82a7..886e963cf7ef36 100644 --- a/include/ibdiag_sa.h +++ b/include/ibdiag_sa.h @@ -70,10 +70,13 @@ void *sa_get_query_rec(void *mad, unsigned i); void sa_report_err(int status); /* Macros for setting query values and ComponentMasks */ -#define cl_hton8(x) (x) +static inline uint8_t htobe8(uint8_t val) +{ + return val; +} #define CHECK_AND_SET_VAL(val, size, comp_with, target, name, mask) \ if ((int##size##_t) val != (int##size##_t) comp_with) { \ - target = cl_hton##size((uint##size##_t) val); \ + target = htobe##size((uint##size##_t) val); \ comp_mask |= IB_##name##_COMPMASK_##mask; \ } diff --git a/src/ibsendtrap.c b/src/ibsendtrap.c index 4459b1658417bd..b6751a957c9183 100644 --- a/src/ibsendtrap.c +++ b/src/ibsendtrap.c @@ -77,20 +77,20 @@ static uint32_t get_cap_mask(ib_portid_t * port) static void build_trap145(ib_mad_notice_attr_t * n, ib_portid_t * port) { n->generic_type = 0x80 | IB_NOTICE_TYPE_INFO; - n->g_or_v.generic.prod_type_lsb = cl_hton16(get_node_type(port)); - n->g_or_v.generic.trap_num = cl_hton16(145); - n->issuer_lid = cl_hton16((uint16_t) port->lid); - n->data_details.ntc_145.new_sys_guid = cl_hton64(0x1234567812345678); + n->g_or_v.generic.prod_type_lsb = htobe16(get_node_type(port)); + n->g_or_v.generic.trap_num = htobe16(145); + n->issuer_lid = htobe16((uint16_t) port->lid); + n->data_details.ntc_145.new_sys_guid = htobe64(0x1234567812345678); } static void build_trap144_local(ib_mad_notice_attr_t * n, ib_portid_t * port) { n->generic_type = 0x80 | IB_NOTICE_TYPE_INFO; - n->g_or_v.generic.prod_type_lsb = cl_hton16(get_node_type(port)); - n->g_or_v.generic.trap_num = cl_hton16(144); - n->issuer_lid = cl_hton16((uint16_t) port->lid); + n->g_or_v.generic.prod_type_lsb = htobe16(get_node_type(port)); + n->g_or_v.generic.trap_num = htobe16(144); + n->issuer_lid = htobe16((uint16_t) port->lid); n->data_details.ntc_144.lid = n->issuer_lid; - n->data_details.ntc_144.new_cap_mask = cl_hton32(get_cap_mask(port)); + n->data_details.ntc_144.new_cap_mask = htobe32(get_cap_mask(port)); n->data_details.ntc_144.local_changes = TRAP_144_MASK_OTHER_LOCAL_CHANGES; } @@ -113,9 +113,9 @@ static void build_trap144_linkspeed(ib_mad_notice_attr_t * n, static void build_trap129(ib_mad_notice_attr_t * n, ib_portid_t * port) { n->generic_type = 0x80 | IB_NOTICE_TYPE_URGENT; - n->g_or_v.generic.prod_type_lsb = cl_hton16(get_node_type(port)); - n->g_or_v.generic.trap_num = cl_hton16(129); - n->issuer_lid = cl_hton16((uint16_t) port->lid); + n->g_or_v.generic.prod_type_lsb = htobe16(get_node_type(port)); + n->g_or_v.generic.trap_num = htobe16(129); + n->issuer_lid = htobe16((uint16_t) port->lid); n->data_details.ntc_129_131.lid = n->issuer_lid; n->data_details.ntc_129_131.pad = 0; n->data_details.ntc_129_131.port_num = (uint8_t) error_port; @@ -124,9 +124,9 @@ static void build_trap129(ib_mad_notice_attr_t * n, ib_portid_t * port) static void build_trap256_local(ib_mad_notice_attr_t * n, ib_portid_t * port) { n->generic_type = 0x80 | IB_NOTICE_TYPE_SECURITY; - n->g_or_v.generic.prod_type_lsb = cl_hton16(get_node_type(port)); - n->g_or_v.generic.trap_num = cl_hton16(256); - n->issuer_lid = cl_hton16((uint16_t) port->lid); + n->g_or_v.generic.prod_type_lsb = htobe16(get_node_type(port)); + n->g_or_v.generic.trap_num = htobe16(256); + n->issuer_lid = htobe16((uint16_t) port->lid); n->data_details.ntc_256.lid = n->issuer_lid; n->data_details.ntc_256.dr_slid = 0xffff; n->data_details.ntc_256.method = 1; @@ -155,14 +155,14 @@ static void build_trap257_258(ib_mad_notice_attr_t * n, ib_portid_t * port, uint16_t trap_num) { n->generic_type = 0x80 | IB_NOTICE_TYPE_SECURITY; - n->g_or_v.generic.prod_type_lsb = cl_hton16(get_node_type(port)); - n->g_or_v.generic.trap_num = cl_hton16(trap_num); - n->issuer_lid = cl_hton16((uint16_t) port->lid); - n->data_details.ntc_257_258.lid1 = cl_hton16(1); - n->data_details.ntc_257_258.lid2 = cl_hton16(2); - n->data_details.ntc_257_258.key = cl_hton32(0x12345678); - n->data_details.ntc_257_258.qp1 = cl_hton32(0x010101); - n->data_details.ntc_257_258.qp2 = cl_hton32(0x020202); + n->g_or_v.generic.prod_type_lsb = htobe16(get_node_type(port)); + n->g_or_v.generic.trap_num = htobe16(trap_num); + n->issuer_lid = htobe16((uint16_t) port->lid); + n->data_details.ntc_257_258.lid1 = htobe16(1); + n->data_details.ntc_257_258.lid2 = htobe16(2); + n->data_details.ntc_257_258.key = htobe32(0x12345678); + n->data_details.ntc_257_258.qp1 = htobe32(0x010101); + n->data_details.ntc_257_258.qp2 = htobe32(0x020202); n->data_details.ntc_257_258.gid1.unicast.prefix = be64toh(0xf8c0000000000001); n->data_details.ntc_257_258.gid1.unicast.interface_id = be64toh(0x1111222233334444); n->data_details.ntc_257_258.gid2.unicast.prefix = be64toh(0xf8c0000000000001); diff --git a/src/saquery.c b/src/saquery.c index 9ecd5f5332b263..40492a619c73f4 100644 --- a/src/saquery.c +++ b/src/saquery.c @@ -1058,7 +1058,7 @@ static int query_path_records(const struct query_cmd *q, struct sa_handle * h, CHECK_AND_SET_VAL(p->dlid, 16, 0, pr.dlid, PR, DLID); CHECK_AND_SET_VAL(p->hop_limit, 32, -1, pr.hop_flow_raw, PR, HOPLIMIT); CHECK_AND_SET_VAL(p->flow_label, 8, 0, flow, PR, FLOWLABEL); - pr.hop_flow_raw |= cl_hton32(flow << 8); + pr.hop_flow_raw |= htobe32(flow << 8); CHECK_AND_SET_VAL(p->tclass, 8, 0, pr.tclass, PR, TCLASS); CHECK_AND_SET_VAL(p->reversible, 8, -1, reversible, PR, REVERSIBLE); CHECK_AND_SET_VAL(p->numb_path, 8, -1, pr.num_path, PR, NUMBPATH); @@ -1066,7 +1066,7 @@ static int query_path_records(const struct query_cmd *q, struct sa_handle * h, CHECK_AND_SET_VAL(p->pkey, 16, 0, pr.pkey, PR, PKEY); CHECK_AND_SET_VAL(p->sl, 16, -1, pr.qos_class_sl, PR, SL); CHECK_AND_SET_VAL((p->qos_class << 4), 16, -1, qos_class, PR, QOS_CLASS); - pr.qos_class_sl = (pr.qos_class_sl & CL_HTON16(IB_PATH_REC_SL_MASK)) | + pr.qos_class_sl = (pr.qos_class_sl & htobe16(IB_PATH_REC_SL_MASK)) | qos_class; CHECK_AND_SET_VAL_AND_SEL(p->mtu, pr.mtu, PR, MTU, SELEC); CHECK_AND_SET_VAL_AND_SEL(p->rate, pr.rate, PR, RATE, SELEC); @@ -1418,9 +1418,9 @@ static int query_mft_records(const struct query_cmd *q, struct sa_handle * h, memset(&mftr, 0, sizeof(mftr)); CHECK_AND_SET_VAL(lid, 16, 0, mftr.lid, MFTR, LID); CHECK_AND_SET_VAL(block, 16, -1, mftr.position_block_num, MFTR, BLOCK); - mftr.position_block_num &= cl_hton16(IB_MCAST_BLOCK_ID_MASK_HO); + mftr.position_block_num &= htobe16(IB_MCAST_BLOCK_ID_MASK_HO); CHECK_AND_SET_VAL(position, 8, -1, pos, MFTR, POSITION); - mftr.position_block_num |= cl_hton16(pos << 12); + mftr.position_block_num |= htobe16(pos << 12); return get_and_dump_any_records(h, IB_SA_ATTR_MFTRECORD, 0, comp_mask, &mftr, sizeof(mftr), dump_one_mft_record, p); From patchwork Tue Apr 9 13:11:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891235 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 89E1F17EF for ; Tue, 9 Apr 2019 13:11:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7255028900 for ; Tue, 9 Apr 2019 13:11:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70A31288EF; Tue, 9 Apr 2019 13:11: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 12CA628900 for ; Tue, 9 Apr 2019 13:11:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727169AbfDINLj (ORCPT ); Tue, 9 Apr 2019 09:11:39 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:44567 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727156AbfDINLj (ORCPT ); Tue, 9 Apr 2019 09:11:39 -0400 Received: by mail-qt1-f196.google.com with SMTP id w5so19563545qtb.11 for ; Tue, 09 Apr 2019 06:11:38 -0700 (PDT) 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=kwcpL0MhCq1jybPtNXVxNeHxbIPU3Ngc2q5bWO0Ro94=; b=YZJ6rXDYk6Lut9u3qKtAndzfjXzxTJrB5ulGv5RDjUh0cu6Bsu7Ui5mmWs9NVB7Q1V Fp36g03UTYhjOl8/jInpHv83ABZrG9je2hB8QfqQPCoXBthevOS0uO5SHmFG5CzdpyoE syElEuYIjFt/pdAmIu2At5v6igGmx8Gq7Beo1KydqdAK1Vz6GBLfvULOo2tLsEGzF5zi jL39niOyFqGfRXQthpzMnUegmsj0fBrUtnhWlp6sL6Ap796qDia7uoJ/TgLoFW+HGA5/ YjTsl+95UWARGQ2yB5/WzUGQ1SP78i47IQ1LLNggFFyPNP/MWLtGRITZSAmD4OTgD887 Ja2Q== 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=kwcpL0MhCq1jybPtNXVxNeHxbIPU3Ngc2q5bWO0Ro94=; b=Cc7IIw6VpAa1a0I5dQCMA7nckaPA5/k9juxYg70MGao/3Bt1nvxStLyJMIkB2RQXpc oB3+LfSp3gSnZimX3k6FR989Uy0ouIPEZx6jk7qbXiuHvc22i/XoUHtek1ykotpw3gCj NSQlyAXrBDfWmLeBCp6HVv4PLi8xxu8tKi/G02T1m96NH2uNeIhG0Psk53O7FkGUD7GJ yx37C9iGVLubMDm+uNKcNms5udyHnyFn7oYYLX+YAjhz9UtZskCLh8JT7Q3qRX0utA+b OeL9S9nD6LLfXzArbXahHT9999KzUcge1JYFr5FxaBfo/dTRipJG32bjRFwks4Uaqe1R qymA== X-Gm-Message-State: APjAAAWhN6cUdySopWVSROWzzyNxn7cHH7REAwq0BU/3/S1ABrLZR7gZ 28Va0G1A7cr1KHVzdWbt1PurENPazlk= X-Google-Smtp-Source: APXvYqweBQtkM/Inw4YdIjE8VSxO6GhVLGx5ITuXDAOM6t6L5Nu+Ns0c3zpkFIC8j7vf27zIjJ2Xlw== X-Received: by 2002:ac8:7491:: with SMTP id v17mr28614492qtq.2.1554815498113; Tue, 09 Apr 2019 06:11:38 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id n10sm24905196qta.86.2019.04.09.06.11.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:11:37 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXH-0004E6-K4; Tue, 09 Apr 2019 10:11:35 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 03/16] ibdiags/ibping: Use clock_gettime instead of complib Date: Tue, 9 Apr 2019 10:11:20 -0300 Message-Id: <20190409131133.16140-4-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 No reason to use a library for such a simple calculation. Signed-off-by: Jason Gunthorpe --- src/ibping.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/ibping.c b/src/ibping.c index ebcb581550f4f1..b463043ae73eb6 100644 --- a/src/ibping.c +++ b/src/ibping.c @@ -41,15 +41,23 @@ #include #include #include +#include #include #include -#include #include "ibdiag_common.h" struct ibmad_port *srcport; +static uint64_t time_stamp(void) +{ + struct timespec ts; + + clock_gettime(CLOCK_MONOTONIC, &ts); + return ((uint64_t)ts.tv_sec * 1000000ULL) + ts.tv_nsec / 10000ULL; +} + static char host_and_domain[IB_VENDOR_RANGE2_DATA_SIZE]; static char last_host[IB_VENDOR_RANGE2_DATA_SIZE]; @@ -113,7 +121,7 @@ static uint64_t ibping(ib_portid_t * portid, int quiet) DEBUG("Ping.."); - start = cl_get_time_stamp(); + start = time_stamp(); call.method = IB_MAD_METHOD_GET; call.mgmt_class = IB_VENDOR_OPENIB_PING_CLASS; @@ -126,7 +134,7 @@ static uint64_t ibping(ib_portid_t * portid, int quiet) if (!ib_vendor_call_via(data, portid, &call, srcport)) return ~0ull; - rtt = cl_get_time_stamp() - start; + rtt = time_stamp() - start; if (!last_host[0]) memcpy(last_host, data, sizeof last_host); @@ -144,7 +152,7 @@ static ib_portid_t portid = { 0 }; static void report(int sig) { - total_time = cl_get_time_stamp() - start; + total_time = time_stamp() - start; DEBUG("out due signal %d", sig); @@ -240,7 +248,7 @@ int main(int argc, char **argv) signal(SIGINT, report); signal(SIGTERM, report); - start = cl_get_time_stamp(); + start = time_stamp(); while (count-- > 0) { ntrans++; From patchwork Tue Apr 9 13:11:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891239 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 88BF61669 for ; Tue, 9 Apr 2019 13:11:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7356B288B6 for ; Tue, 9 Apr 2019 13:11:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7158828922; Tue, 9 Apr 2019 13:11:42 +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 C80C8288B6 for ; Tue, 9 Apr 2019 13:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727156AbfDINLk (ORCPT ); Tue, 9 Apr 2019 09:11:40 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:44568 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727067AbfDINLk (ORCPT ); Tue, 9 Apr 2019 09:11:40 -0400 Received: by mail-qt1-f196.google.com with SMTP id w5so19563580qtb.11 for ; Tue, 09 Apr 2019 06:11:39 -0700 (PDT) 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=ykMQ6cgGYNeF7B0OK7UbIwPPl5fb0qcM8AjL7TJbE2k=; b=hrnrgLwoQQIFZ+BNRJyOtxVXqRW5xoqS51rYKa4S8HC2EdWkLgG1TT256gE0f7yUrR wMq2nkvVR9YY4qXGexhkC5ER/rZgS6urcCD5WBh1Mqk/dgWPyJr+yQtDERgpDU58Mjn3 hRegNmWckHHRPF+7MnCDBVBpfg9ZLrteudKuyshl01ydIW7WmTT2NFRqOEcbPkgywkFZ 01Vr1SYENqdsQWh2CrMAA6YtI9I6f7k1R5N2PIX4/SGfWs1MdFIucMUt90bNJX2EvYeP 7DXngXtLnZXYvijoZFAFSgNSMSxqimftm5jpCF+E09PMOYgeRQjs8v7PzhE5DdipnJrw 8fkw== 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=ykMQ6cgGYNeF7B0OK7UbIwPPl5fb0qcM8AjL7TJbE2k=; b=WcWL3HB46x73RHXLu9OhH6qlpWgixDrXzIOEKRD9dmXsA9L0Cztv/t8TsVUA0TkhVz 6dfX0n12NXfr/S1Sb5O+qPOy939Yzf9kwQmuDPhMQQFbi1vL+L+YK61/7jboCr3aIsMq CNo0+WfmEvfuXu+30X2e29nEqw6VPnDbBqEr6I1jc1lvxnLBWJD6UcfGoQFyrx15cj95 EQdS0ZAIHSc2zVOQ+MS3N0uXNezPj6W5bRgZdrLvkZ4pYfwymuBUXkfNbJCaKRGsBhiF 3gUWoTMA/EclX/VMcS77g7mk6hvAgq+mAq5Pxch6E/USqx1j41aLVT6LPwqypvNejwn7 43HQ== X-Gm-Message-State: APjAAAUwCe8S+XA7nqzQDJvp+r+cMRu8cp0mE4YIhbWhNKv97bk/vuhf eUZClL4D9QInp3bA0P8FWajn+hPzkgk= X-Google-Smtp-Source: APXvYqwpkAwst2fTaUmppWJ1s+jfH3b1bOJz85NkBF4pLZGV9P/P/NsblkyNbkFMiS8FSvXqOWTCuA== X-Received: by 2002:ac8:348d:: with SMTP id w13mr31125074qtb.329.1554815498537; Tue, 09 Apr 2019 06:11:38 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id l20sm5555032qtk.59.2019.04.09.06.11.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:11:37 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXH-0004EC-Lz; Tue, 09 Apr 2019 10:11:35 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 04/16] ibdiags: Replace ib_netXX_t with __beXX Date: Tue, 9 Apr 2019 10:11:21 -0300 Message-Id: <20190409131133.16140-5-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 Use the usual Linux constants for BE. Signed-off-by: Jason Gunthorpe --- include/ibdiag_common.h | 1 + src/ibqueryerrors.c | 2 +- src/saquery.c | 36 ++++++++++++++++++------------------ 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/include/ibdiag_common.h b/include/ibdiag_common.h index a20408e582eb2c..34f8eb7cdf3674 100644 --- a/include/ibdiag_common.h +++ b/include/ibdiag_common.h @@ -45,6 +45,7 @@ #include #include #include +#include extern int ibverbose; extern char *ibd_ca; diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c index b56d7c91cefdb9..fa3321c5c6c853 100644 --- a/src/ibqueryerrors.c +++ b/src/ibqueryerrors.c @@ -325,7 +325,7 @@ static void insert_lid2sl_table(struct sa_query_result *r) static int path_record_query(ib_gid_t sgid,uint64_t dguid) { ib_path_rec_t pr; - ib_net64_t comp_mask = 0; + __be64 comp_mask = 0; uint8_t reversible = 0; struct sa_handle * h; diff --git a/src/saquery.c b/src/saquery.c index 40492a619c73f4..d9c5d387046807 100644 --- a/src/saquery.c +++ b/src/saquery.c @@ -703,7 +703,7 @@ static void dump_one_vlarb_record(void *data, struct query_params *p) static void dump_one_pkey_tbl_record(void *data, struct query_params *params) { ib_pkey_table_record_t *pktr = data; - ib_net16_t *p = pktr->pkey_tbl.pkey_entry; + __be16 *p = pktr->pkey_tbl.pkey_entry; int i; printf("PKeyTableRecord dump:\n" "\t\tLID........................%u\n" @@ -798,7 +798,7 @@ static void dump_results(struct sa_query_result *r, */ static int get_any_records(struct sa_handle * h, uint16_t attr_id, uint32_t attr_mod, - ib_net64_t comp_mask, void *attr, + __be64 comp_mask, void *attr, size_t attr_size, struct sa_query_result *result) { @@ -818,7 +818,7 @@ static int get_any_records(struct sa_handle * h, } static int get_and_dump_any_records(struct sa_handle * h, uint16_t attr_id, - uint32_t attr_mod, ib_net64_t comp_mask, + uint32_t attr_mod, __be64 comp_mask, void *attr, size_t attr_size, void (*dump_func) (void *, @@ -970,7 +970,7 @@ static int parse_lid_and_ports(struct sa_handle * h, /* * Get the portinfo records available with IsSM or IsSMdisabled CapabilityMask bit on. */ -static int get_issm_records(struct sa_handle * h, ib_net32_t capability_mask, +static int get_issm_records(struct sa_handle * h, __be32 capability_mask, struct sa_query_result *result) { ib_portinfo_record_t attr; @@ -1045,7 +1045,7 @@ static int query_path_records(const struct query_cmd *q, struct sa_handle * h, struct query_params *p, int argc, char *argv[]) { ib_path_rec_t pr; - ib_net64_t comp_mask = 0; + __be64 comp_mask = 0; uint32_t flow = 0; uint16_t qos_class = 0; uint8_t reversible = 0; @@ -1152,7 +1152,7 @@ static int query_node_records(const struct query_cmd *q, struct sa_handle * h, struct query_params *p, int argc, char *argv[]) { ib_node_record_t nr; - ib_net64_t comp_mask = 0; + __be64 comp_mask = 0; int lid = 0; if (argc > 0) @@ -1170,7 +1170,7 @@ static int query_portinfo_records(const struct query_cmd *q, int argc, char *argv[]) { ib_portinfo_record_t pir; - ib_net64_t comp_mask = 0; + __be64 comp_mask = 0; int lid = 0, port = -1, options = -1; if (argc > 0) @@ -1191,7 +1191,7 @@ static int query_mcmember_records(const struct query_cmd *q, int argc, char *argv[]) { ib_member_rec_t mr; - ib_net64_t comp_mask = 0; + __be64 comp_mask = 0; uint32_t flow = 0; uint8_t sl = 0, hop = 0, scope = 0; @@ -1230,7 +1230,7 @@ static int query_sm_info_records(const struct query_cmd *q, int argc, char *argv[]) { ib_sminfo_record_t smir; - ib_net64_t comp_mask = 0; + __be64 comp_mask = 0; int lid = 0; if (argc > 0) @@ -1249,7 +1249,7 @@ static int query_switchinfo_records(const struct query_cmd *q, int argc, char *argv[]) { ib_switch_info_record_t swir; - ib_net64_t comp_mask = 0; + __be64 comp_mask = 0; int lid = 0; if (argc > 0) @@ -1269,7 +1269,7 @@ static int query_inform_info_records(const struct query_cmd *q, { int rc = 0; ib_inform_info_record_t ir; - ib_net64_t comp_mask = 0; + __be64 comp_mask = 0; memset(&ir, 0, sizeof(ir)); if (argc > 0) { @@ -1287,7 +1287,7 @@ static int query_link_records(const struct query_cmd *q, struct sa_handle * h, struct query_params *p, int argc, char *argv[]) { ib_link_record_t lr; - ib_net64_t comp_mask = 0; + __be64 comp_mask = 0; int from_lid = 0, to_lid = 0, from_port = -1, to_port = -1; if (argc > 0) @@ -1310,7 +1310,7 @@ static int query_sl2vl_records(const struct query_cmd *q, struct sa_handle * h, struct query_params *p, int argc, char *argv[]) { ib_slvl_table_record_t slvl; - ib_net64_t comp_mask = 0; + __be64 comp_mask = 0; int lid = 0, in_port = -1, out_port = -1; if (argc > 0) @@ -1330,7 +1330,7 @@ static int query_vlarb_records(const struct query_cmd *q, struct sa_handle * h, struct query_params *p, int argc, char *argv[]) { ib_vl_arb_table_record_t vlarb; - ib_net64_t comp_mask = 0; + __be64 comp_mask = 0; int lid = 0, port = -1, block = -1; if (argc > 0) @@ -1351,7 +1351,7 @@ static int query_pkey_tbl_records(const struct query_cmd *q, int argc, char *argv[]) { ib_pkey_table_record_t pktr; - ib_net64_t comp_mask = 0; + __be64 comp_mask = 0; int lid = 0, port = -1, block = -1; if (argc > 0) @@ -1371,7 +1371,7 @@ static int query_lft_records(const struct query_cmd *q, struct sa_handle * h, struct query_params *p, int argc, char *argv[]) { ib_lft_record_t lftr; - ib_net64_t comp_mask = 0; + __be64 comp_mask = 0; int lid = 0, block = -1; if (argc > 0) @@ -1389,7 +1389,7 @@ static int query_guidinfo_records(const struct query_cmd *q, struct sa_handle * struct query_params *p, int argc, char *argv[]) { ib_guidinfo_record_t gir; - ib_net64_t comp_mask = 0; + __be64 comp_mask = 0; int lid = 0, block = -1; if (argc > 0) @@ -1408,7 +1408,7 @@ static int query_mft_records(const struct query_cmd *q, struct sa_handle * h, struct query_params *p, int argc, char *argv[]) { ib_mft_record_t mftr; - ib_net64_t comp_mask = 0; + __be64 comp_mask = 0; int lid = 0, block = -1, position = -1; uint16_t pos = 0; From patchwork Tue Apr 9 13:11:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891233 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 0EB2B1669 for ; Tue, 9 Apr 2019 13:11:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFD00288C9 for ; Tue, 9 Apr 2019 13:11:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE02E2890B; Tue, 9 Apr 2019 13:11:38 +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 8E09C288DD for ; Tue, 9 Apr 2019 13:11:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727116AbfDINLi (ORCPT ); Tue, 9 Apr 2019 09:11:38 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:35098 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726112AbfDINLh (ORCPT ); Tue, 9 Apr 2019 09:11:37 -0400 Received: by mail-qt1-f193.google.com with SMTP id h39so1477016qte.2 for ; Tue, 09 Apr 2019 06:11:37 -0700 (PDT) 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=Bp36tgdiJy909BC9qJn7f5bA8bzqOjHlQPqswHdiAlU=; b=GlcFbvVJj14zPLHMgmFY18Cen3rTPhNCrj0okhuN6+FhJCFvG1fXEcbkvrxkWV43aJ q2bIdlv74rJhu9wcUJcq84ASGx/clgq8GC7V0+sTW6JfzaB7AxjJyk3BfEsw29jKiPL/ aObrUIFbw14x3qBHsMSfBjZ3CYs0Vl47fA0rk8MjivjKc1NW0gyET3fV3GfgPo4F6hVl a63TyLfoQXvQsNgizgPXz/+Uynet0N/ihmPSTA5I2Tp9Ffi2RLI7zI4AfVfuGAt0WhBi XEuQYVdTM/e4cMK5KZ/SCi6cu7N0Zq03zKh848rTJ2XLzhDdB75+cni05WcKm+I8gus5 4bhA== 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=Bp36tgdiJy909BC9qJn7f5bA8bzqOjHlQPqswHdiAlU=; b=rByF9hVLv1mUzu3PhCOqN4M96cRopKzungu9wq8zBW2rhiPYtztRcQ64lVumMVYtA6 dxFLBX2tHXxRtSGMLZn4GkFtcLwZyxeaCBun48hskN9KKIj1b3CAHIoX60Od1MlF8/Zt F/3Z5jowgsYigwQ8kXmSuHIjPXg5jTmNJ5Msg1Ba8PNcd4q89V9/8U7WE1Jh4NhX4ItB hBegrY4oUjUn/3Ln5KgvJr38U6P2RBG6zPYN93XyBL1NY4GEemTVo5bdP6ItbaVNXJOj DRNhAVToEYT83INbGUxH16zDKHc3nciE6601EYmW86x3FPSndSODCQBbQlVRCrkbGKdd UwSQ== X-Gm-Message-State: APjAAAXRpp1SNZBoQzXrv4HDTd6H7IWYSu6sFIlOw+np3yU48WRMOtYq aA8GBcrszoQSKez5703+hx6lZk+935Q= X-Google-Smtp-Source: APXvYqx25n+GUlB17jIVigpqnU9YK/3NAqEOxFK27oz8go9pS6k3nl4S3VcPnT+JdQxJGzLNwUej0w== X-Received: by 2002:ac8:51cd:: with SMTP id d13mr30695298qtn.45.1554815496943; Tue, 09 Apr 2019 06:11:36 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id p6sm22100193qtk.70.2019.04.09.06.11.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:11:36 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXH-0004EI-O2; Tue, 09 Apr 2019 10:11:35 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 05/16] ibdiags: Remove IN/OUT notations Date: Tue, 9 Apr 2019 10:11:22 -0300 Message-Id: <20190409131133.16140-6-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 not part of the ibdiags coding style. Signed-off-by: Jason Gunthorpe --- src/ibdiag_sa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ibdiag_sa.c b/src/ibdiag_sa.c index bbb71391431626..a5b99ad8b9a56e 100644 --- a/src/ibdiag_sa.c +++ b/src/ibdiag_sa.c @@ -199,7 +199,7 @@ static const char *ib_sa_error_str[] = { #define ARR_SIZE(a) (sizeof(a)/sizeof((a)[0])) #define SA_ERR_UNKNOWN (ARR_SIZE(ib_sa_error_str) - 1) -static inline const char *ib_sa_err_str(IN uint8_t status) +static inline const char *ib_sa_err_str(uint8_t status) { if (status > SA_ERR_UNKNOWN) status = SA_ERR_UNKNOWN; @@ -219,7 +219,7 @@ static const char *ib_mad_inv_field_str[] = { }; #define MAD_ERR_UNKNOWN (ARR_SIZE(ib_mad_inv_field_str) - 1) -static inline const char *ib_mad_inv_field_err_str(IN uint8_t f) +static inline const char *ib_mad_inv_field_err_str(uint8_t f) { if (f > MAD_ERR_UNKNOWN) f = MAD_ERR_UNKNOWN; From patchwork Tue Apr 9 13:11:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891257 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 601841805 for ; Tue, 9 Apr 2019 13:11:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43026288B3 for ; Tue, 9 Apr 2019 13:11:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41827288EF; Tue, 9 Apr 2019 13:11:48 +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 063DA288B3 for ; Tue, 9 Apr 2019 13:11:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726531AbfDINLq (ORCPT ); Tue, 9 Apr 2019 09:11:46 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:35116 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727324AbfDINLp (ORCPT ); Tue, 9 Apr 2019 09:11:45 -0400 Received: by mail-qt1-f194.google.com with SMTP id h39so1477576qte.2 for ; Tue, 09 Apr 2019 06:11:44 -0700 (PDT) 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=xzTxoEi2yCbQU5dHrmnCjWW7dr8Rnebt8yp+BxTATYs=; b=LIcCdQIKmPK3LESn2jLCzznXZSKkrHDasMjCmglSBzDgL4wjuzhH4BX5j2zLWVyaVR w6vwHUDKynsbcMb9gTg2vy+xnv4wcmnpv7lyn3pzgkcj528nixLTmWou0v9KR/qkXORQ sXfpATzSq7SZnFftms/NITJmyso4KqMt6pci9QZajJUBqmMV7tI4V0HvqMRgqXgduZWu Vb/vAMjgvvLRs9OWEBf9cLKFFY8S40z8uPstPfgMtIy+dQ0iXq6WsN6Teq63XV8DELL4 GhEPsPJ3ZbXpzb2DiO8bj6zdYpI0EkCu/QLLIMMLoxU5jhwLgumZzQydnVwbjKg9FHBg L/OQ== 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=xzTxoEi2yCbQU5dHrmnCjWW7dr8Rnebt8yp+BxTATYs=; b=EgPG/J4b3fS8fCCsiK+raQSHHWfkKus8JKhtrqvKg3sIfkhrIrzUxS93rOqiouVtwf 98zeyyX0f7bEECwWC95X/zvzIAFKU5hnKJ+4tNWBgah6mvx1XrUNwHslmJCA+GZoFnHt +qZJNAQzwMNTKyeiNsXCuvlDooVczUzBnRMez3OPjkOvEqnyzdejiLELz1Xh79DUiW+4 OszmPvGOUcN6cohRfTYXzSU63xd2qp9Usr5Uibn/dNiducUXhsukcTKwXMURVIOjWNEv 2jm1+8W8R33Vxl4mQi6bqz2qWrZj5pM/qPK/OOvMFaSh3WRpdEX5T46VEOMLsYNy9Am3 TDew== X-Gm-Message-State: APjAAAXrfxaR6DEYLOjfX9Ph85utDSBSUR575+FCANAUy9Jn1mxecSjH cqOvJ/2jgmIsj4AaiWvDlWFV8E6udIM= X-Google-Smtp-Source: APXvYqyQ1Knd1LCyCOTEhOHhIrmwEe/FJI0bI3PCzl8Fx5ySjhU0+WVLIebwUzobrsqQ4TGx4sn7fw== X-Received: by 2002:ac8:3216:: with SMTP id x22mr30236660qta.114.1554815503992; Tue, 09 Apr 2019 06:11:43 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id n201sm17855465qka.10.2019.04.09.06.11.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:11:37 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXH-0004EO-Pl; Tue, 09 Apr 2019 10:11:35 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 06/16] ibdiags: Do not use optarg for process_opt Date: Tue, 9 Apr 2019 10:11:23 -0300 Message-Id: <20190409131133.16140-7-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 Avoid a -Wshadow warning from gcc, access the global directly instead. Signed-off-by: Jason Gunthorpe --- include/ibdiag_common.h | 3 +-- src/dump_fts.c | 3 +-- src/ibaddr.c | 3 +-- src/ibcacheedit.c | 3 +-- src/ibccconfig.c | 3 +-- src/ibccquery.c | 3 +-- src/ibdiag_common.c | 11 +++++------ src/iblinkinfo.c | 3 +-- src/ibnetdiscover.c | 3 +-- src/ibping.c | 3 +-- src/ibportstate.c | 1 - src/ibqueryerrors.c | 3 +-- src/ibroute.c | 3 +-- src/ibsendtrap.c | 1 - src/ibstat.c | 3 +-- src/ibsysstat.c | 3 +-- src/ibtracert.c | 3 +-- src/perfquery.c | 3 +-- src/saquery.c | 3 +-- src/sminfo.c | 3 +-- src/smpdump.c | 3 +-- src/smpquery.c | 3 +-- src/vendstat.c | 3 +-- 23 files changed, 25 insertions(+), 48 deletions(-) diff --git a/include/ibdiag_common.h b/include/ibdiag_common.h index 34f8eb7cdf3674..6e7ec3851bb190 100644 --- a/include/ibdiag_common.h +++ b/include/ibdiag_common.h @@ -135,8 +135,7 @@ struct ibdiag_opt { extern int ibdiag_process_opts(int argc, char *const argv[], void *context, const char *exclude_common_str, const struct ibdiag_opt custom_opts[], - int (*custom_handler) (void *cxt, int val, - char *optarg), + int (*custom_handler) (void *cxt, int val), const char *usage_args, const char *usage_examples[]); extern void ibdiag_show_usage(void); diff --git a/src/dump_fts.c b/src/dump_fts.c index 3a9299d174e441..b22282b4935bfe 100644 --- a/src/dump_fts.c +++ b/src/dump_fts.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include @@ -394,7 +393,7 @@ static void process_switch(ibnd_node_t *node, void *fabric) dump_node(node, srcport, (ibnd_fabric_t *)fabric); } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'a': diff --git a/src/ibaddr.c b/src/ibaddr.c index 1a721d0a003f23..c13f3bfc5c7976 100644 --- a/src/ibaddr.c +++ b/src/ibaddr.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -91,7 +90,7 @@ static int ib_resolve_addr(ib_portid_t * portid, int portnum, int show_lid, static int show_lid, show_gid; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'g': diff --git a/src/ibcacheedit.c b/src/ibcacheedit.c index 904089b3b2e8e8..e8dc244e051f77 100644 --- a/src/ibcacheedit.c +++ b/src/ibcacheedit.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -126,7 +125,7 @@ static int parse_guidbeforeafter(char *arg, return 0; } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 1: diff --git a/src/ibccconfig.c b/src/ibccconfig.c index 19a075aa9dd435..54a501ee6cc910 100644 --- a/src/ibccconfig.c +++ b/src/ibccconfig.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -545,7 +544,7 @@ static const char *congestion_control_table(ib_portid_t *dest, char **argv, return NULL; } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'c': diff --git a/src/ibccquery.c b/src/ibccquery.c index 9bcbf8645b7bd6..0882983c2ddeac 100644 --- a/src/ibccquery.c +++ b/src/ibccquery.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #define __STDC_FORMAT_MACROS @@ -340,7 +339,7 @@ static const char *timestamp_dump(ib_portid_t *dest, char **argv, int argc) return NULL; } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'c': diff --git a/src/ibdiag_common.c b/src/ibdiag_common.c index 962527e0c6feab..cdb099dd3771a3 100644 --- a/src/ibdiag_common.c +++ b/src/ibdiag_common.c @@ -212,7 +212,7 @@ void ibdiag_show_usage(void) exit(2); } -static int process_opt(int ch, char *optarg) +static int process_opt(int ch) { char *endp; long val; @@ -373,8 +373,7 @@ static void make_str_opts(const struct option *o, char *p, unsigned size) int ibdiag_process_opts(int argc, char *const argv[], void *cxt, const char *exclude_common_str, const struct ibdiag_opt custom_opts[], - int (*custom_handler) (void *cxt, int val, - char *optarg), + int (*custom_handler) (void *cxt, int val), const char *usage_args, const char *usage_examples[]) { char str_opts[1024]; @@ -403,10 +402,10 @@ int ibdiag_process_opts(int argc, char *const argv[], void *cxt, if (!o) ibdiag_show_usage(); if (custom_handler) { - if (custom_handler(cxt, ch, optarg) && - process_opt(ch, optarg)) + if (custom_handler(cxt, ch) && + process_opt(ch)) ibdiag_show_usage(); - } else if (process_opt(ch, optarg)) + } else if (process_opt(ch)) ibdiag_show_usage(); } diff --git a/src/iblinkinfo.c b/src/iblinkinfo.c index e5f5b9a7e2d3fa..c838afebdaef3b 100644 --- a/src/iblinkinfo.c +++ b/src/iblinkinfo.c @@ -45,7 +45,6 @@ #include #include #include -#include #include #include @@ -513,7 +512,7 @@ static int diff_node(ibnd_node_t *node, ibnd_fabric_t *orig_fabric, return 0; } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { struct ibnd_config *cfg = context; char *p; diff --git a/src/ibnetdiscover.c b/src/ibnetdiscover.c index 91ce56bf011b4d..9a5b3d515c32c3 100644 --- a/src/ibnetdiscover.c +++ b/src/ibnetdiscover.c @@ -44,7 +44,6 @@ #include #include #include -#include #include #include @@ -991,7 +990,7 @@ static int diff(ibnd_fabric_t *orig_fabric, ibnd_fabric_t *new_fabric) static int list, group, ports_report; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { struct ibnd_config *cfg = context; char *p; diff --git a/src/ibping.c b/src/ibping.c index b463043ae73eb6..591619a0b6709b 100644 --- a/src/ibping.c +++ b/src/ibping.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -175,7 +174,7 @@ static void report(int sig) static int server = 0, flood = 0; static unsigned count = ~0; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'c': diff --git a/src/ibportstate.c b/src/ibportstate.c index 75eafc5f12970b..f733cf8eab2a92 100644 --- a/src/ibportstate.c +++ b/src/ibportstate.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c index fa3321c5c6c853..f86daaab9a8374 100644 --- a/src/ibqueryerrors.c +++ b/src/ibqueryerrors.c @@ -46,7 +46,6 @@ #include #include #include -#include #include #include @@ -899,7 +898,7 @@ static void calculate_suppressed_fields(char *str) free(tmp); } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { struct ibnd_config *cfg = context; switch (ch) { diff --git a/src/ibroute.c b/src/ibroute.c index 76dab8940c49d4..15d726035bff19 100644 --- a/src/ibroute.c +++ b/src/ibroute.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include @@ -396,7 +395,7 @@ static const char *dump_unicast_tables(ib_portid_t *portid, int startlid, return 0; } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'a': diff --git a/src/ibsendtrap.c b/src/ibsendtrap.c index b6751a957c9183..dd1a92722824e0 100644 --- a/src/ibsendtrap.c +++ b/src/ibsendtrap.c @@ -43,7 +43,6 @@ #include #define _GNU_SOURCE -#include #include #include diff --git a/src/ibstat.c b/src/ibstat.c index a6deccf5a91770..308e29118df654 100644 --- a/src/ibstat.c +++ b/src/ibstat.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -260,7 +259,7 @@ static int ports_list(char names[][UMAD_CA_NAME_LEN], int n) static int list_only, short_format, list_ports; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'l': diff --git a/src/ibsysstat.c b/src/ibsysstat.c index d49eafc63e4b23..9c2da8e7fd4884 100644 --- a/src/ibsysstat.c +++ b/src/ibsysstat.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -296,7 +295,7 @@ static int build_cpuinfo(void) return ncpu; } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'o': diff --git a/src/ibtracert.c b/src/ibtracert.c index 98911db1442236..91461217bf705f 100644 --- a/src/ibtracert.c +++ b/src/ibtracert.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include @@ -756,7 +755,7 @@ static int resolve_lid(ib_portid_t *portid) static int dumplevel = 2, multicast, mlid; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 1: diff --git a/src/perfquery.c b/src/perfquery.c index 91fe94e74dafbe..b0baa3bec7d3bf 100644 --- a/src/perfquery.c +++ b/src/perfquery.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include @@ -716,7 +715,7 @@ static void dump_portsamples_control(ib_portid_t *portid, int port) port, buf); } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'x': diff --git a/src/saquery.c b/src/saquery.c index d9c5d387046807..b882b2bdaf08ba 100644 --- a/src/saquery.c +++ b/src/saquery.c @@ -50,7 +50,6 @@ #include #define _GNU_SOURCE -#include #include #include @@ -1521,7 +1520,7 @@ static enum saquery_command command = SAQUERY_CMD_QUERY; static uint16_t query_type; static char *src_lid, *dst_lid; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { struct query_params *p = context; diff --git a/src/sminfo.c b/src/sminfo.c index caec7cf00d5f3d..7e6a18a41e12fc 100644 --- a/src/sminfo.c +++ b/src/sminfo.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -74,7 +73,7 @@ const char *const statestr[] = { static unsigned act; static int prio, state = SMINFO_STANDBY; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'a': diff --git a/src/smpdump.c b/src/smpdump.c index 3f80ef56ca5868..beb7168bd9aab9 100644 --- a/src/smpdump.c +++ b/src/smpdump.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include @@ -152,7 +151,7 @@ static int str2DRPath(char *str, DRPath * path) static int dump_char, mgmt_class = IB_SMI_CLASS; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 's': diff --git a/src/smpquery.c b/src/smpquery.c index 4a104174fdcb34..5254d131de2b29 100644 --- a/src/smpquery.c +++ b/src/smpquery.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #define __STDC_FORMAT_MACROS @@ -411,7 +410,7 @@ static const char *guid_info(ib_portid_t *dest, char **argv, int argc) return 0; } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 1: diff --git a/src/vendstat.c b/src/vendstat.c index e9916da1a9f456..f7c17578be837c 100644 --- a/src/vendstat.c +++ b/src/vendstat.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -291,7 +290,7 @@ static is3_config_space_t write_cs, read_cs; static unsigned write_cs_records, read_cs_records; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { int ret; switch (ch) { From patchwork Tue Apr 9 13:11:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891237 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 BCEB617EF for ; Tue, 9 Apr 2019 13:11:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6487288EE for ; Tue, 9 Apr 2019 13:11:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B00828918; Tue, 9 Apr 2019 13:11:41 +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 40F60288EE for ; Tue, 9 Apr 2019 13:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727256AbfDINLk (ORCPT ); Tue, 9 Apr 2019 09:11:40 -0400 Received: from mail-qt1-f181.google.com ([209.85.160.181]:39968 "EHLO mail-qt1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727156AbfDINLk (ORCPT ); Tue, 9 Apr 2019 09:11:40 -0400 Received: by mail-qt1-f181.google.com with SMTP id x12so19590616qts.7 for ; Tue, 09 Apr 2019 06:11:39 -0700 (PDT) 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=PYd0ZBcmsJKxMxYD3eeUvJ3JzZvbfRg+SF/nnQLK4wQ=; b=S4PmvPlGKD54brs2aJLe7VtVBkFzGCcho7cS5RgFd1mWRMJZl4uLrjC9EmZ//ee2Nj JFGKFCbaJ3q5d+j8V0wzXvX2y6MFNcEHhBTtNIVSpJXGGlAUjJgZhVargz/HPppLX2Aq CFSSHOfqsudA3nJAklAq17OgPKvRSGWFbvdKQ+vu4f83/i6KKbokZ79dMIWgM22rw/yo X862dW4gVggCqpSnDkglMCQaA4QoQqMV8yhN6Qj1LM0QWf/oY2MledbLYjUXZ+wcvYNZ B5UOH6Fgf4T/yc33FiVu7FK2DXTVw7B+7vj1B7LuSt1PuDKhyEuwrFHTJrrN25o5h2gF QqKA== 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=PYd0ZBcmsJKxMxYD3eeUvJ3JzZvbfRg+SF/nnQLK4wQ=; b=UrBLfnC8yomug+cy2K2AICx9LZwPWspHUbO5eBEc/XlFPJnofX6Sd/PFTmJM5gvBMy 9/3fS+mQRj9Rn7aRiXxjbpeCzFooffr8vmN1zaMLQ3I18fB6eM3bd2YbC/Z6Q+slYeT+ EKYki4dR0i8pJvjQEQlsBw9kBnFXhjGRXW5ReGnrve3b2/zc5hp9oY1wUTY5I/ok9QRE RZzby0+A2Gi9u20vvrJANT70s8EHNfoznfp52DhtI8Mgd8GzqEWjxw8M51bXym2ic29C gsAJ8ghRb9VQazCagwMl8d67LZOnhIHK/e2oaWtILgA9YnmB/ALNR3hF6J7rlVZfoiaj kQ5A== X-Gm-Message-State: APjAAAUgoHire9krAXICWP5TtTS6+DZ5OLM3Xf1PH7z8Ujbo1gs/7Cr0 fw6evZIuVHRC5stuK+4GJnLiQJkCf8k= X-Google-Smtp-Source: APXvYqyEhKZLPVtjDaMyFQh2bqkUkYmUWYg/3FuN6iu1XUc+Pr+Ru/ZXbWjt+NO4n7cwCBh7At3MOg== X-Received: by 2002:aed:3f51:: with SMTP id q17mr28694874qtf.346.1554815499053; Tue, 09 Apr 2019 06:11:39 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id r15sm21997343qtb.22.2019.04.09.06.11.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:11:37 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXH-0004EU-Qy; Tue, 09 Apr 2019 10:11:35 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 07/16] ibdiags: Mark functions taking format strings with attribute format Date: Tue, 9 Apr 2019 10:11:24 -0300 Message-Id: <20190409131133.16140-8-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 And fix the resulting format string errors. Resolves clang warning -Wformat-nonliteral Signed-off-by: Jason Gunthorpe --- include/ibdiag_common.h | 9 ++++++--- src/ibportstate.c | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/ibdiag_common.h b/include/ibdiag_common.h index 6e7ec3851bb190..6808ecb5c28763 100644 --- a/include/ibdiag_common.h +++ b/include/ibdiag_common.h @@ -139,7 +139,8 @@ 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(void); -extern void ibexit(const char *fn, const char *msg, ...); +extern void ibexit(const char *fn, const char *msg, ...) + __attribute__((format(printf, 2, 3))); /* convert counter values to a float with a unit specifier returned (using * binary prefix) @@ -162,9 +163,11 @@ int resolve_portid_str(char *ca_name, uint8_t ca_port, ib_portid_t * portid, char *addr_str, enum MAD_DEST dest_type, ib_portid_t *sm_id, const struct ibmad_port *srcport); int vsnprint_field(char *buf, size_t n, enum MAD_FIELDS f, int spacing, - const char *format, va_list va_args); + const char *format, va_list va_args) + __attribute__((format(printf, 5, 0))); int snprint_field(char *buf, size_t n, enum MAD_FIELDS f, int spacing, - const char *format, ...); + const char *format, ...) + __attribute__((format(printf, 5, 6))); void dump_portinfo(void *pi, int tabs); /** diff --git a/src/ibportstate.c b/src/ibportstate.c index f733cf8eab2a92..39118d6d3992f7 100644 --- a/src/ibportstate.c +++ b/src/ibportstate.c @@ -444,7 +444,7 @@ int main(int argc, char **argv) port_args[j].set = 1; if (!port_args[j].val) { if (port_op >= 0) - IBEXIT("%s only one of: ", + IBEXIT("%s only one of: " "query, enable, disable, " "reset, down, arm, active, " "can be specified", From patchwork Tue Apr 9 13:11:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891241 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 794E01669 for ; Tue, 9 Apr 2019 13:11:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64402288FA for ; Tue, 9 Apr 2019 13:11:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 624CD2890B; Tue, 9 Apr 2019 13:11:43 +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 D07BC2890E for ; Tue, 9 Apr 2019 13:11:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727297AbfDINLl (ORCPT ); Tue, 9 Apr 2019 09:11:41 -0400 Received: from mail-qk1-f174.google.com ([209.85.222.174]:46552 "EHLO mail-qk1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727273AbfDINLl (ORCPT ); Tue, 9 Apr 2019 09:11:41 -0400 Received: by mail-qk1-f174.google.com with SMTP id s81so10116870qke.13 for ; Tue, 09 Apr 2019 06:11:40 -0700 (PDT) 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=OA5lgmXIgDdaEEfz9QWC1+cv9sIzB27paTVrACY6Pnk=; b=WXPtcMSNzAjkLyM0hsjLXq4slrGAlxJ8m9zqE2zlXuiuZUrB7KO1GXi5dhyKVdTurP m+pudiBuHgyaLgkcvvmanAicGOJRaECv3QImqHFMZrvx1HiryuTMhgkoJzB6XLB8YrtS 4u8WjeU2hz5pj3I52Ribsk+Jhg/w+O7/++y8BeZ72rrFYS6xP9dV7gLZBu3ZG7wKxKBJ mAAu8HdZN2xI51qPwry/jKx1W97TVoIcLrfpQcvw0jebRwQK3gAcKeKOVp+87sGfikGT 0933wgeMu88hnWeBRasb1xJyHJFIr+iANoy8cSyRKzRj2m6e4dVj/OTRn0zoAu3Ea8d+ y7+w== 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=OA5lgmXIgDdaEEfz9QWC1+cv9sIzB27paTVrACY6Pnk=; b=CjCfMwkpJ1Img61edXXlH5zj68AMP4wWQnbKLyp7PfBdlCdbdbr56petGjGNQlHT/u QI0hrGD+QUv0FVWmweU6AeDyNj7uAejlz7/aDnJqPiaF62PZF6+ArnBaCPexGJ/OFJMF ROfTDvZtJ8QAPVjZvAqQBSktR3BoK0mNrYxJylanqRFlmg/XAfDFNy557wbbQXP4TjD/ dp+5pmvTCLmjVSlIdhwS2byDk3Z+UblCUTXjBaysYk4o7zIQEQ9/KVbN9LFGc3HNFpxd Nh4tk07qPUyfetk+oxsOgjWdu+uUu2OlAMsnVmZb8J1zdOdQe04NJI53nyfCFw18IuSN n4XQ== X-Gm-Message-State: APjAAAVKmm9utVHm/hXwQkd6CFOWc6x/e0BXC3G2SFi3S2GumHrA/5N/ 3ujcheMgoayUHfZ1iMqj628rjRUcsis= X-Google-Smtp-Source: APXvYqxBj0VRLdsytM0crtV/a820xkQRQXuf3sxZu4RDsrs7kQX3OKxfCNN3DQPQj/ZajvHvHxTxhQ== X-Received: by 2002:a37:6546:: with SMTP id z67mr28571508qkb.254.1554815500270; Tue, 09 Apr 2019 06:11:40 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id d75sm19667074qkb.74.2019.04.09.06.11.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:11:37 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXH-0004Ea-S8; Tue, 09 Apr 2019 10:11:35 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 08/16] ibdiags: Remove always true test Date: Tue, 9 Apr 2019 10:11:25 -0300 Message-Id: <20190409131133.16140-9-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 clang 7.0 says: ../ibdiags/src/iblinkinfo.c:287:19: warning: address of array 'node->info' will always evaluate to 'true' [-Wpointer-bool-conversion] else if (node->info) So drop the test. Signed-off-by: Jason Gunthorpe --- src/iblinkinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iblinkinfo.c b/src/iblinkinfo.c index c838afebdaef3b..b7c67e6a5d83ad 100644 --- a/src/iblinkinfo.c +++ b/src/iblinkinfo.c @@ -288,7 +288,7 @@ static void print_node_header(ibnd_node_t *node, int *out_header_flag, if (node->type == IB_NODE_SWITCH) { if (node->ports[0]) guid = node->ports[0]->guid; - else if (node->info) + else guid = mad_get_field64(node->info, 0, IB_NODE_PORT_GUID_F); printf("%s%s: 0x%016" PRIx64 " %s:\n", From patchwork Tue Apr 9 13:11:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891259 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 152BA1669 for ; Tue, 9 Apr 2019 13:11:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE66C288FA for ; Tue, 9 Apr 2019 13:11:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC6E32890B; Tue, 9 Apr 2019 13:11:48 +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 76EC42891B for ; Tue, 9 Apr 2019 13:11:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727261AbfDINLq (ORCPT ); Tue, 9 Apr 2019 09:11:46 -0400 Received: from mail-qt1-f177.google.com ([209.85.160.177]:39468 "EHLO mail-qt1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727342AbfDINLp (ORCPT ); Tue, 9 Apr 2019 09:11:45 -0400 Received: by mail-qt1-f177.google.com with SMTP id t28so19593939qte.6 for ; Tue, 09 Apr 2019 06:11:45 -0700 (PDT) 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=EzXZywWVy5mb/qjHpe4RLUNKbumsBX02skd+X7PfBfg=; b=hMsY/oOTXjWNVbqxVahbFPlJcDF2Waa2qI/PK7/5wEDoCdsS3cMpyOgl7kQd6xNYQg v8O9SbUJkY7YjRw5EFGqTS0RMvVv8JvNK5V9RMgbLn0vfDVyvLsHx6ldd+aHWa7guNQA t2jSToip8HTF50tnnSGg2rYHTosogF/X9BdMAgp/xQZRsEMhpfW/gfmvqlbINRAzhqtd +4uwY/y3CoRhI1f7sJie3VQ14P2m80V5VKtP29WP4aAmzmPofxh8f9F6BTUZuWMLN89T uCHAXYAKosTJKfUDmbLm0twsCOlLr33j0DtrMOGFMPhpW5xryYLkbFgzwqddkWyeR2QB Q0hg== 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=EzXZywWVy5mb/qjHpe4RLUNKbumsBX02skd+X7PfBfg=; b=T0MdxX9RnwQ2MOJNdrgoqrB4mpp+32mDFAbloxAukAQ1c14VJPEXHzLuFk6uLGojH1 VMaRgkkavIEyU5Wqr1M2UlI44sfBiyjpYPiS/v75oeECIWjUqN86jEMX3Ui+3cxwquch vrW2jd/F+g/ELT1S6mMzqsebMjzUtyQcq4lewOX2tTUdvPX0Znh31rYRLKWqHTv92z58 6PSh68RmAKxL9JCjKclWXyuMHbkNRB870WqUv747Zf+gMA1rNFsxjKjzuM52nHVdeWpb LNxN/d+WMXsZH7p0mTRF6NPreApkM22R6ZkfKDEnXbvFesCD1E5+ubzJLwWxswnjEO9P lkDg== X-Gm-Message-State: APjAAAXse2Hh1a8YcJa2ZocACY6kkLZ6UD01xadRlM/Bp9RWht/Togi1 Vm5XkpXpNNbRVUcN2fkoddWKBEGtfBU= X-Google-Smtp-Source: APXvYqzWJn6pv+rnM+CZzFn0ES/tL4W5AOqkF6lD3PtNrX0mC5CzIfQNmOmpfwml4xV/LP8Rfx9Ypw== X-Received: by 2002:aed:3e13:: with SMTP id l19mr30686755qtf.125.1554815503481; Tue, 09 Apr 2019 06:11:43 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id l6sm17934373qke.65.2019.04.09.06.11.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:11:37 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXH-0004Eg-UH; Tue, 09 Apr 2019 10:11:35 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 09/16] ibdiags: Add missing static to variables Date: Tue, 9 Apr 2019 10:11:26 -0300 Message-Id: <20190409131133.16140-10-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 Found by sparse. Also drop redundant = 0's for global values. Signed-off-by: Jason Gunthorpe --- libibnetdisc/src/chassis.c | 50 +++++++++++++++++------------------ libibnetdisc/test/testleaks.c | 2 +- src/dump_fts.c | 6 ++--- src/ibaddr.c | 2 +- src/ibcacheedit.c | 32 +++++++++++----------- src/ibccconfig.c | 4 +-- src/ibccquery.c | 4 +-- src/ibping.c | 2 +- src/ibportstate.c | 30 ++++++++++----------- src/ibqueryerrors.c | 30 ++++++++++----------- src/ibroute.c | 4 +-- src/ibsendtrap.c | 4 +-- src/ibsysstat.c | 2 +- src/ibtracert.c | 6 ++--- src/mcm_rereg_test.c | 2 +- src/perfquery.c | 6 ++--- src/saquery.c | 12 ++++----- src/sminfo.c | 6 ++--- src/smpquery.c | 2 +- src/vendstat.c | 2 +- 20 files changed, 103 insertions(+), 105 deletions(-) diff --git a/libibnetdisc/src/chassis.c b/libibnetdisc/src/chassis.c index 5e0d0550c539fc..63eacf434a663d 100644 --- a/libibnetdisc/src/chassis.c +++ b/libibnetdisc/src/chassis.c @@ -355,120 +355,120 @@ static int is_line(ibnd_node_t * n) } /* these structs help find Line (Anafa) slot number while using spine portnum */ -char line_slot_2_sfb4[37] = { +static const char line_slot_2_sfb4[37] = { 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -char anafa_line_slot_2_sfb4[37] = { +static const char anafa_line_slot_2_sfb4[37] = { 0, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -char line_slot_2_sfb12[37] = { +static const char line_slot_2_sfb12[37] = { 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -char anafa_line_slot_2_sfb12[37] = { +static const char anafa_line_slot_2_sfb12[37] = { 0, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* LB slot = table[spine port] */ -char line_slot_2_sfb18[37] = { +static const char line_slot_2_sfb18[37] = { 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18}; /* LB asic num = table[spine port] */ -char anafa_line_slot_2_sfb18[37] = { +static const char anafa_line_slot_2_sfb18[37] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; /* LB slot = table[spine port] */ -char line_slot_2_sfb18x2[37] = { +static const char line_slot_2_sfb18x2[37] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* LB asic num = table[spine port] */ -char anafa_line_slot_2_sfb18x2[37] = { +static const char anafa_line_slot_2_sfb18x2[37] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* LB slot = table[spine port] */ -char line_slot_2_sfb4200[37] = { +static const char line_slot_2_sfb4200[37] = { 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9}; /* LB asic num = table[spine port] */ -char anafa_line_slot_2_sfb4200[37] = { +static const char anafa_line_slot_2_sfb4200[37] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; /* IPR FCR modules connectivity while using sFB4 port as reference */ -char ipr_slot_2_sfb4_port[37] = { +static const char ipr_slot_2_sfb4_port[37] = { 0, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* these structs help find Spine (Anafa) slot number while using spine portnum */ -char spine12_slot_2_slb[37] = { +static const char spine12_slot_2_slb[37] = { 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -char anafa_spine12_slot_2_slb[37] = { +static const char anafa_spine12_slot_2_slb[37] = { 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -char spine4_slot_2_slb[37] = { +static const char spine4_slot_2_slb[37] = { 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -char anafa_spine4_slot_2_slb[37] = { +static const char anafa_spine4_slot_2_slb[37] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* FB slot = table[line port] */ -char spine18_slot_2_slb[37] = { +static const char spine18_slot_2_slb[37] = { 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* FB asic = table[line port] */ -char anafa_spine18_slot_2_slb[37] = { +static const char anafa_spine18_slot_2_slb[37] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -char anafa_spine18x2_slot_2_slb[37] = { +static const char anafa_spine18x2_slot_2_slb[37] = { 0, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* FB slot = table[line port] */ -char sfb4200_slot_2_slb[37] = { +static const char sfb4200_slot_2_slb[37] = { 0, 1, 1, 1, 1, 0, 0, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* FB asic = table[line port] */ -char anafa_sfb4200_slot_2_slb[37] = { +static const char anafa_sfb4200_slot_2_slb[37] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 @@ -1111,34 +1111,34 @@ A2 int port | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 */ -int int2ext_map_slb24[2][25] = { +static int int2ext_map_slb24[2][25] = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 5, 4, 18, 17, 16, 1, 2, 3, 13, 14, 15}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 11, 10, 24, 23, 22, 7, 8, 9, 19, 20, 21} }; -int int2ext_map_slb8[2][25] = { +static int int2ext_map_slb8[2][25] = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 6, 6, 6, 1, 1, 1, 5, 5, 5}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 8, 8, 8, 3, 3, 3, 7, 7, 7} }; -int int2ext_map_slb2024[2][25] = { +static int int2ext_map_slb2024[2][25] = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} }; -int int2ext_map_slb4018[37] = { +static int int2ext_map_slb4018[37] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }; -int int2ext_map_sfb4700x2[2][37] = { +static int int2ext_map_sfb4700x2[2][37] = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12}, diff --git a/libibnetdisc/test/testleaks.c b/libibnetdisc/test/testleaks.c index 84c2b76558c328..35157e0ba6d420 100644 --- a/libibnetdisc/test/testleaks.c +++ b/libibnetdisc/test/testleaks.c @@ -51,7 +51,7 @@ #include #include -const char *argv0 = "iblinkinfotest"; +static const char *argv0 = "iblinkinfotest"; static FILE *f; static void usage(void) diff --git a/src/dump_fts.c b/src/dump_fts.c index b22282b4935bfe..199403ab392f64 100644 --- a/src/dump_fts.c +++ b/src/dump_fts.c @@ -53,9 +53,9 @@ #include "ibdiag_common.h" -struct ibmad_port *srcport; +static struct ibmad_port *srcport; -unsigned startlid = 0, endlid = 0; +static unsigned startlid, endlid; static int brief, dump_all, multicast; @@ -107,7 +107,7 @@ static int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports, return i * 2; } -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 uint16_t mft[16][IB_MLIDS_IN_BLOCK]; static void dump_multicast_tables(ibnd_node_t *node, unsigned startl, unsigned endl, struct ibmad_port *mad_port) diff --git a/src/ibaddr.c b/src/ibaddr.c index c13f3bfc5c7976..509f0feab6981d 100644 --- a/src/ibaddr.c +++ b/src/ibaddr.c @@ -46,7 +46,7 @@ #include "ibdiag_common.h" -struct ibmad_port *srcport; +static struct ibmad_port *srcport; static int ib_resolve_addr(ib_portid_t * portid, int portnum, int show_lid, int show_gid) diff --git a/src/ibcacheedit.c b/src/ibcacheedit.c index e8dc244e051f77..6e04efc7575d68 100644 --- a/src/ibcacheedit.c +++ b/src/ibcacheedit.c @@ -46,22 +46,22 @@ #include "ibdiag_common.h" -uint64_t switchguid_before = 0; -uint64_t switchguid_after = 0; -int switchguid_flag = 0; - -uint64_t caguid_before = 0; -uint64_t caguid_after = 0; -int caguid_flag = 0; - -uint64_t sysimgguid_before = 0; -uint64_t sysimgguid_after = 0; -int sysimgguid_flag = 0; - -uint64_t portguid_nodeguid = 0; -uint64_t portguid_before = 0; -uint64_t portguid_after = 0; -int portguid_flag = 0; +static uint64_t switchguid_before; +static uint64_t switchguid_after; +static int switchguid_flag; + +static uint64_t caguid_before; +static uint64_t caguid_after; +static int caguid_flag; + +static uint64_t sysimgguid_before; +static uint64_t sysimgguid_after; +static int sysimgguid_flag; + +static uint64_t portguid_nodeguid; +static uint64_t portguid_before; +static uint64_t portguid_after; +static int portguid_flag; struct guids { uint64_t searchguid; diff --git a/src/ibccconfig.c b/src/ibccconfig.c index 54a501ee6cc910..a256ceaa6f3949 100644 --- a/src/ibccconfig.c +++ b/src/ibccconfig.c @@ -53,7 +53,7 @@ #include "ibdiag_common.h" -struct ibmad_port *srcport; +static struct ibmad_port *srcport; static op_fn_t congestion_key_info; static op_fn_t switch_congestion_setting; @@ -77,7 +77,7 @@ static const match_rec_t match_tbl[] = { {0} }; -uint64_t cckey = 0; +static uint64_t cckey; /*******************************************/ static const char *parselonglongint(char *arg, uint64_t *val) diff --git a/src/ibccquery.c b/src/ibccquery.c index 0882983c2ddeac..a80cd01bdea5f5 100644 --- a/src/ibccquery.c +++ b/src/ibccquery.c @@ -50,7 +50,7 @@ #include "ibdiag_common.h" -struct ibmad_port *srcport; +static struct ibmad_port *srcport; static op_fn_t class_port_info; static op_fn_t congestion_info; @@ -75,7 +75,7 @@ static const match_rec_t match_tbl[] = { {0} }; -uint64_t cckey = 0; +static uint64_t cckey = 0; /*******************************************/ static const char *class_port_info(ib_portid_t *dest, char **argv, int argc) diff --git a/src/ibping.c b/src/ibping.c index 591619a0b6709b..2ba17313c00842 100644 --- a/src/ibping.c +++ b/src/ibping.c @@ -47,7 +47,7 @@ #include "ibdiag_common.h" -struct ibmad_port *srcport; +static struct ibmad_port *srcport; static uint64_t time_stamp(void) { diff --git a/src/ibportstate.c b/src/ibportstate.c index 39118d6d3992f7..23f1ed5b7df07f 100644 --- a/src/ibportstate.c +++ b/src/ibportstate.c @@ -72,21 +72,21 @@ enum port_ops { OFF }; -struct ibmad_port *srcport; -uint64_t speed = 0; /* no state change */ -uint64_t espeed = 0; /* no state change */ -uint64_t fdr10 = 0; /* no state change */ -uint64_t width = 0; /* no state change */ -uint64_t lid; -uint64_t smlid; -uint64_t lmc; -uint64_t mtu; -uint64_t vls = 0; /* no state change */ -uint64_t mkey; -uint64_t mkeylease; -uint64_t mkeyprot; - -struct { +static struct ibmad_port *srcport; +static uint64_t speed; /* no state change */ +static uint64_t espeed; /* no state change */ +static uint64_t fdr10; /* no state change */ +static uint64_t width; /* no state change */ +static uint64_t lid; +static uint64_t smlid; +static uint64_t lmc; +static uint64_t mtu; +static uint64_t vls; /* no state change */ +static uint64_t mkey; +static uint64_t mkeylease; +static uint64_t mkeyprot; + +static struct { const char *name; uint64_t *val; int set; diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c index f86daaab9a8374..a9f738dbb30c62 100644 --- a/src/ibqueryerrors.c +++ b/src/ibqueryerrors.c @@ -56,24 +56,24 @@ #include "ibdiag_common.h" #include "ibdiag_sa.h" -struct ibmad_port *ibmad_port; +static struct ibmad_port *ibmad_port; static char *node_name_map_file = NULL; static nn_map_t *node_name_map = NULL; static char *load_cache_file = NULL; static uint16_t lid2sl_table[sizeof(uint8_t) * 1024 * 48] = { 0 }; static int obtain_sl = 1; -int data_counters = 0; -int data_counters_only = 0; -int port_config = 0; -uint64_t port_guid = 0; -char *port_guid_str = NULL; +static int data_counters; +static int data_counters_only; +static int port_config; +static uint64_t port_guid; +static char *port_guid_str; #define SUP_MAX 64 -int sup_total = 0; -enum MAD_FIELDS suppressed_fields[SUP_MAX]; -char *dr_path = NULL; -uint8_t node_type_to_print = 0; -unsigned clear_errors = 0, clear_counts = 0, details = 0; +static int sup_total; +static enum MAD_FIELDS suppressed_fields[SUP_MAX]; +static char *dr_path; +static uint8_t node_type_to_print; +static unsigned clear_errors, clear_counts, details; #define PRINT_SWITCH 0x1 #define PRINT_CA 0x2 @@ -82,20 +82,20 @@ unsigned clear_errors = 0, clear_counts = 0, details = 0; #define DEFAULT_HALF_WORLD_PR_TIMEOUT (3000) -struct { +static struct { int nodes_checked; int bad_nodes; int ports_checked; int bad_ports; int pma_query_failures; -} summary = { 0 }; +} summary; #define DEF_THRES_FILE IBDIAG_CONFIG_PATH"/error_thresholds" static const char *threshold_file = DEF_THRES_FILE; /* define a "packet" with threshold values in it */ -uint8_t thresholds[1204] = { 0 }; -char *threshold_str = NULL; +static uint8_t thresholds[1204]; +static char *threshold_str; static unsigned valid_gid(ib_gid_t * gid) { diff --git a/src/ibroute.c b/src/ibroute.c index 15d726035bff19..e433faffc7a1eb 100644 --- a/src/ibroute.c +++ b/src/ibroute.c @@ -49,7 +49,7 @@ #include "ibdiag_common.h" -struct ibmad_port *srcport; +static struct ibmad_port *srcport; static int brief, dump_all, multicast; @@ -132,7 +132,7 @@ static int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports, return i * 2; } -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 uint16_t mft[16][IB_MLIDS_IN_BLOCK]; static const char *dump_multicast_tables(ib_portid_t *portid, unsigned startlid, unsigned endlid) diff --git a/src/ibsendtrap.c b/src/ibsendtrap.c index dd1a92722824e0..14db04a0e9130a 100644 --- a/src/ibsendtrap.c +++ b/src/ibsendtrap.c @@ -49,9 +49,9 @@ #include "ibdiag_common.h" -struct ibmad_port *srcport; +static struct ibmad_port *srcport; /* for local link integrity */ -int error_port = 1; +static int error_port = 1; static uint16_t get_node_type(ib_portid_t * port) { diff --git a/src/ibsysstat.c b/src/ibsysstat.c index 9c2da8e7fd4884..501a629c0a154f 100644 --- a/src/ibsysstat.c +++ b/src/ibsysstat.c @@ -47,7 +47,7 @@ #define MAX_CPUS 8 -struct ibmad_port *srcport; +static struct ibmad_port *srcport; enum ib_sysstat_attr_t { IB_PING_ATTR = 0x10, diff --git a/src/ibtracert.c b/src/ibtracert.c index 91461217bf705f..d8d45408cd716c 100644 --- a/src/ibtracert.c +++ b/src/ibtracert.c @@ -51,7 +51,7 @@ #include "ibdiag_common.h" -struct ibmad_port *srcport; +static struct ibmad_port *srcport; #define MAXHOPS 63 @@ -113,8 +113,8 @@ struct Node { char nodeinfo[64]; }; -Node *nodesdist[MAXHOPS]; -uint64_t target_portguid; +static Node *nodesdist[MAXHOPS]; +static uint64_t target_portguid; /* * is_port_inactive diff --git a/src/mcm_rereg_test.c b/src/mcm_rereg_test.c index 95aded688aabde..b9e85f8d2d04cb 100644 --- a/src/mcm_rereg_test.c +++ b/src/mcm_rereg_test.c @@ -64,7 +64,7 @@ static ibmad_gid_t mgid_ipoib = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff }; -struct ibmad_port *srcport; +static struct ibmad_port *srcport; static uint64_t build_mcm_rec(uint8_t *data, ibmad_gid_t mgid, ibmad_gid_t port_gid) diff --git a/src/perfquery.c b/src/perfquery.c index b0baa3bec7d3bf..7ce6a3f4d311d9 100644 --- a/src/perfquery.c +++ b/src/perfquery.c @@ -49,7 +49,7 @@ #include "ibdiag_common.h" -struct ibmad_port *srcport; +static struct ibmad_port *srcport; struct perf_count { uint32_t portselect; @@ -105,8 +105,8 @@ struct perf_count_ext { static uint8_t pc[1024]; -struct perf_count perf_count = {0}; -struct perf_count_ext perf_count_ext = {0}; +static struct perf_count perf_count = {}; +static struct perf_count_ext perf_count_ext = {}; #define ALL_PORTS 0xFF #define MAX_PORTS 255 diff --git a/src/saquery.c b/src/saquery.c index b882b2bdaf08ba..8eae9ddd20083f 100644 --- a/src/saquery.c +++ b/src/saquery.c @@ -101,7 +101,7 @@ static nn_map_t *node_name_map = NULL; #define MAX_PORTS (8) #define DEFAULT_SA_TIMEOUT_MS (1000) -enum { +static enum { ALL, LID_ONLY, UNIQUE_LID_ONLY, @@ -111,11 +111,11 @@ enum { NAME_OF_GUID, } node_print_desc = ALL; -char *requested_name = NULL; -uint16_t requested_lid = 0; -int requested_lid_flag = 0; -uint64_t requested_guid = 0; -int requested_guid_flag = 0; +static char *requested_name; +static uint16_t requested_lid; +static int requested_lid_flag; +static uint64_t requested_guid; +static int requested_guid_flag; static unsigned valid_gid(ibmad_gid_t * gid) { diff --git a/src/sminfo.c b/src/sminfo.c index 7e6a18a41e12fc..24c4950085879f 100644 --- a/src/sminfo.c +++ b/src/sminfo.c @@ -48,9 +48,7 @@ static uint8_t sminfo[1024] = { 0 }; -struct ibmad_port *srcport; - -int strdata, xdata = 1, bindata; +static struct ibmad_port *srcport; enum { SMINFO_NOTACT, @@ -61,7 +59,7 @@ enum { SMINFO_STATE_LAST, }; -const char *const statestr[] = { +static const char *const statestr[] = { "SMINFO_NOTACT", "SMINFO_DISCOVER", "SMINFO_STANDBY", diff --git a/src/smpquery.c b/src/smpquery.c index 5254d131de2b29..ded1b391566955 100644 --- a/src/smpquery.c +++ b/src/smpquery.c @@ -51,7 +51,7 @@ #include "ibdiag_common.h" -struct ibmad_port *srcport; +static struct ibmad_port *srcport; static op_fn_t node_desc, node_info, port_info, switch_info, pkey_table, sl2vl_table, vlarb_table, guid_info, mlnx_ext_port_info, port_info_extended; diff --git a/src/vendstat.c b/src/vendstat.c index f7c17578be837c..0030c7caf20928 100644 --- a/src/vendstat.c +++ b/src/vendstat.c @@ -58,7 +58,7 @@ #define IB_MLX_IS3_PORT_XMIT_WAIT 0x10013C -struct ibmad_port *srcport; +static struct ibmad_port *srcport; typedef struct { uint16_t hw_revision; From patchwork Tue Apr 9 13:11:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891249 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 8366B17EF for ; Tue, 9 Apr 2019 13:11:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D836288B3 for ; Tue, 9 Apr 2019 13:11:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B4B028917; Tue, 9 Apr 2019 13:11:46 +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 8CF29288B6 for ; Tue, 9 Apr 2019 13:11:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727209AbfDINLn (ORCPT ); Tue, 9 Apr 2019 09:11:43 -0400 Received: from mail-qt1-f182.google.com ([209.85.160.182]:41796 "EHLO mail-qt1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727222AbfDINLn (ORCPT ); Tue, 9 Apr 2019 09:11:43 -0400 Received: by mail-qt1-f182.google.com with SMTP id w30so19598698qta.8 for ; Tue, 09 Apr 2019 06:11:42 -0700 (PDT) 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=uONrivQLq/7hQ7AEdmX/muQ+zzza739dkoNTFreh9IY=; b=MrKcD262BJAMCSytgjN5fkg3IrlUEH+vEYdVFHWowtK1yB1gmj6dDzdZtudyQq2s2A 1wEqqyBmFXxxTQRZBgEPm9ohcORDQftJK3aLSUMqnUYJjiwgcg7hLHjH+LIovBFevjqC PTBXcxvDpQtV05oxRzRx5Gq8StfMAnmi82erf6lgmgAfNgtJzP36Vzky+1jtjUbmvERN bKyqiJuOJQSlUnqoo6A+eqtAzBqAVJE0mubGXCdBduyhJrvZnvdWXkDHu/XWplCln/d0 93oja81B482ENh8V7Z1nCpB9nzPKBSY7odMObyxv4aqFwZ6filH2PpjXrhRC33KcDpAE 6fxg== 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=uONrivQLq/7hQ7AEdmX/muQ+zzza739dkoNTFreh9IY=; b=AyVnfVQCiZMWcVCIg0DHLA+6225QXzAJ/sfdp7S/dxGweO3usNjKJX9qVFrsvLk0n/ 5bmKfF+sdTYr15PFD5MD4K9D6hz5LgHIcIaiIc9lqfm2D/Sm89f1o4Cz44PqvI6Qj8BB l+tyR7qdXq5HOAJVT6yxlEvj4Effp5qRQCoqTjrHSKTfYZCDn7cAUOULjDSfy4i9uBAO Vb2wHr1rhfOrU4aXQNTy+Ub/ZDTQMpCUWaqhrhpJA7NJ6jwgPFVqg2IkzvgfTWX2adBO WrPy470Dbl78WoPTikNIK3AclUpKOcegruQ3Xk3w6kkSJZkuRnq0Sj4s7Dc4XtA8euQG JzxA== X-Gm-Message-State: APjAAAViUG8LtUDkcRKqBl8ms/O9+gm7hHN7PWbpbybqSZCsnkmbYtj/ sLvDk1Rnmd1P2RIMTe+Tzhlh+vZaATk= X-Google-Smtp-Source: APXvYqzSJLZpbj58jOD0xXzMFrNHspjN40BPM2VRtB6856wA2nrs9cdGmf1nQMShkWpQwo1uxjBXZg== X-Received: by 2002:ac8:13c5:: with SMTP id i5mr30385769qtj.42.1554815501881; Tue, 09 Apr 2019 06:11:41 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id x5sm16178990qki.26.2019.04.09.06.11.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:11:37 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXH-0004Em-VW; Tue, 09 Apr 2019 10:11:35 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 10/16] ibdiags: Use PRIx64 when printing uint64_t Date: Tue, 9 Apr 2019 10:11:27 -0300 Message-Id: <20190409131133.16140-11-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 compiler warnings on 32 bit builds: ibportstate.c:514:13: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'uint64_t' {aka 'long long unsigned int'} [-Werror=format=] Signed-off-by: Jason Gunthorpe --- src/ibportstate.c | 34 ++++++++++++++++++++++------------ src/ibqueryerrors.c | 7 ++++--- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/ibportstate.c b/src/ibportstate.c index 23f1ed5b7df07f..680c7e78f95a7a 100644 --- a/src/ibportstate.c +++ b/src/ibportstate.c @@ -459,40 +459,48 @@ int main(int argc, char **argv) switch (j) { case SPEED: if (val > 15) - IBEXIT("invalid speed value %ld", val); + IBEXIT("invalid speed value %" PRIu64, + val); break; case ESPEED: if (val > 31) - IBEXIT("invalid extended speed value %ld", val); + IBEXIT("invalid extended speed value %" PRIu64, + val); break; case FDR10SPEED: if (val > 1) - IBEXIT("invalid fdr10 speed value %ld", val); + IBEXIT("invalid fdr10 speed value %" PRIu64, + val); break; case WIDTH: if ((val > 31 && val != 255)) - IBEXIT("invalid width value %ld", val); + IBEXIT("invalid width value %" PRIu64, + val); break; case VLS: if (val == 0 || val > 5) - IBEXIT("invalid vls value %ld", val); + IBEXIT("invalid vls value %" PRIu64, + val); break; case MTU: if (val == 0 || val > 5) - IBEXIT("invalid mtu value %ld", val); + IBEXIT("invalid mtu value %" PRIu64, + val); break; case LID: if (val == 0 || val >= 0xC000) - IBEXIT("invalid lid value 0x%lx", val); + IBEXIT("invalid lid value 0x%" PRIx64, + val); break; case SMLID: if (val == 0 || val >= 0xC000) - IBEXIT("invalid smlid value 0x%lx", - val); + IBEXIT("invalid smlid value 0x%" PRIx64, + val); break; case LMC: if (val > 7) - IBEXIT("invalid lmc value %ld", val); + IBEXIT("invalid lmc value %" PRIu64, + val); break; case MKEY: errno = 0; @@ -509,11 +517,13 @@ int main(int argc, char **argv) break; case MKEYLEASE: if (val > 0xFFFF) - IBEXIT("invalid mkey lease time %ld", val); + IBEXIT("invalid mkey lease time %" PRIu64, + val); break; case MKEYPROT: if (val > 3) - IBEXIT("invalid mkey protection bit setting %ld", val); + IBEXIT("invalid mkey protection bit setting %" PRIu64, + val); } *port_args[j].val = val; changed = 1; diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c index a9f738dbb30c62..6cd652670977b4 100644 --- a/src/ibqueryerrors.c +++ b/src/ibqueryerrors.c @@ -112,7 +112,7 @@ static void set_thres(char *name, uint64_t val) for (f = IB_PC_EXT_ERR_SYM_F; f <= IB_PC_EXT_XMT_WAIT_F; f++) { if (strcmp(name, mad_field_name(f)) == 0) { mad_encode_field(thresholds, f, &val); - snprintf(tmp, 255, "[%s = %lu]", name, val); + snprintf(tmp, 255, "[%s = %" PRIu64 "]", name, val); threshold_str = realloc(threshold_str, strlen(threshold_str)+strlen(tmp)+1); if (!threshold_str) { @@ -407,8 +407,9 @@ static int check_threshold(uint8_t *pc, uint8_t *pce, uint32_t cap_mask2, mad_decode_field(pce, ext_i, (void *)&val64); if (exceeds_threshold(ext_i, val64)) { unit = conv_cnt_human_readable(val64, &val, 0); - *n += snprintf(str + *n, size - *n, " [%s == %lu (%5.3f%s)]", - mad_field_name(ext_i), val64, val, unit); + *n += snprintf(str + *n, size - *n, + " [%s == %" PRIu64 " (%5.3f%s)]", + mad_field_name(ext_i), val64, val, unit); is_exceeds = 1; } From patchwork Tue Apr 9 13:11:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891247 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 DA2F61805 for ; Tue, 9 Apr 2019 13:11:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B46DF288B3 for ; Tue, 9 Apr 2019 13:11:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B29B7288FA; Tue, 9 Apr 2019 13:11:44 +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 0041928910 for ; Tue, 9 Apr 2019 13:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727067AbfDINLl (ORCPT ); Tue, 9 Apr 2019 09:11:41 -0400 Received: from mail-qk1-f181.google.com ([209.85.222.181]:34997 "EHLO mail-qk1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726112AbfDINLk (ORCPT ); Tue, 9 Apr 2019 09:11:40 -0400 Received: by mail-qk1-f181.google.com with SMTP id a71so10170015qkg.2 for ; Tue, 09 Apr 2019 06:11:38 -0700 (PDT) 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=MRKwWr2By+k38fFUT8+fkpOPljO7na6KlytjV7dTJao=; b=ELgZ9u6pRbKo6/YEFzDRDHbh2fcF0zWQm6eFcUT1MF8xJGFCsttg37e33oPeJCHACc /phXYqmcVYE0C0y0/sD6cSgE2I8P27pYAR6aqpX/D/c+VVcmWHxErsIM9TBHAr3iAiSK hx+YVUXtpKzEjrBaXsym7AZKaUp8dqC822BYIYTJejyaIXb1kw/DvAXkBh5AHLBqDGGZ 9mNsF6TeHdqC+adfvpp/tg83tJEdpijowMLxkAqJ3xomaT6zdk5d/7kklrZUE+s2i8KN eUPeeBUA/McezpwDEUCB53/EjRq4OcV7Bkd5o0OxxYQkAyAMTaOcpzZ6QUP9HAIdc3DI UNeg== 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=MRKwWr2By+k38fFUT8+fkpOPljO7na6KlytjV7dTJao=; b=H61SQFF7g90JcSh5RckIJxl72y7uqoRtoYH6cT5ZKtYYww9aojdtn2kr7V4cswv1q8 RxKLul7ukFSjmq8XmVwtdUEfFXwS93wgS2BoPRMEszuKZ8TgvwS7iprlrSIG2jmfl/gG XQN/8fULuzpa7+S6M6GhFlSO6pz2BaZSBB9QaegeK8Ui8ADqlQpfP23o41m0by/vbu6A IoFTvKy2SkR81kLddNZqK2CeCXCOTSN9mJ2873qsKjuxMcV79feWYABs2iprMyklyuK0 hNfgBQk6euwau0NKaUjKGHlLyhN3BOueHmJbnUxLsNTwH2qk/I6eY78fDzzHsgRnIAzg 0xgw== X-Gm-Message-State: APjAAAUIVY7AGyD+pGrVPR5MenT1P1DVTCpmdMXab0Kbif/krt1oMDnJ vUCMpicG+G7gtljC+BvUFRjvfOBYvuU= X-Google-Smtp-Source: APXvYqw6DmEznc7dw5Ap8XcYcFvjvIUwauf3NQN9R2O6Z/t7HXQDhZp43lG6seBJvS6c8yxlUewsOQ== X-Received: by 2002:ae9:e515:: with SMTP id w21mr28266684qkf.200.1554815497535; Tue, 09 Apr 2019 06:11:37 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id n70sm22093191qkn.5.2019.04.09.06.11.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:11:37 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXI-0004Es-12; Tue, 09 Apr 2019 10:11:36 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 11/16] ibdiags: Use NULL instead of 0 in all places where it used as a pointer Date: Tue, 9 Apr 2019 10:11:28 -0300 Message-Id: <20190409131133.16140-12-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 Standard coding style. Found by sparse. Signed-off-by: Jason Gunthorpe --- libibmad/src/bm.c | 2 +- libibmad/src/fields.c | 2 +- libibmad/src/mad.c | 6 +++--- libibmad/src/register.c | 2 +- libibmad/src/resolve.c | 6 +++--- libibmad/src/rpc.c | 4 ++-- libibmad/src/sa.c | 2 +- libibmad/src/serv.c | 4 ++-- libibmad/src/vendor.c | 4 ++-- libibnetdisc/src/chassis.c | 6 +++--- libibnetdisc/src/query_smp.c | 4 ++-- libibnetdisc/test/testleaks.c | 30 +++++++++++++------------- src/dump_fts.c | 6 +++--- src/ibaddr.c | 4 ++-- src/ibcacheedit.c | 12 +++++------ src/ibccconfig.c | 6 +++--- src/ibccquery.c | 8 +++---- src/ibdiag_common.c | 14 ++++++------ src/iblinkinfo.c | 4 ++-- src/ibnetdiscover.c | 4 ++-- src/ibping.c | 14 ++++++------ src/ibportstate.c | 6 +++--- src/ibqueryerrors.c | 4 ++-- src/ibroute.c | 12 +++++------ src/ibstat.c | 4 ++-- src/ibsysstat.c | 12 +++++------ src/ibtracert.c | 18 ++++++++-------- src/perfquery.c | 14 ++++++------ src/saquery.c | 6 +++--- src/sminfo.c | 10 ++++----- src/smpdump.c | 12 +++++------ src/smpquery.c | 40 +++++++++++++++++------------------ src/vendstat.c | 6 +++--- 33 files changed, 144 insertions(+), 144 deletions(-) diff --git a/libibmad/src/bm.c b/libibmad/src/bm.c index 318145120efc61..8b3d342284ce00 100644 --- a/libibmad/src/bm.c +++ b/libibmad/src/bm.c @@ -98,7 +98,7 @@ uint8_t *bm_call_via(void *data, ib_portid_t * portid, ib_bm_call_t * call, return NULL; } - if (mad_send_via(&rpc, portid, 0, &bm_data, srcport) < 0) + if (mad_send_via(&rpc, portid, NULL, &bm_data, srcport) < 0) return NULL; return_ok: diff --git a/libibmad/src/fields.c b/libibmad/src/fields.c index 1af7a6cfa17880..45eafd94921060 100644 --- a/libibmad/src/fields.c +++ b/libibmad/src/fields.c @@ -1256,7 +1256,7 @@ char *mad_dump_field(enum MAD_FIELDS field, char *buf, int bufsz, void *val) { if (field <= IB_NO_FIELD || field >= IB_FIELD_LAST_) return NULL; - return _mad_dump_field(ib_mad_f + field, 0, buf, bufsz, val); + return _mad_dump_field(ib_mad_f + field, NULL, buf, bufsz, val); } char *mad_dump_val(enum MAD_FIELDS field, char *buf, int bufsz, void *val) diff --git a/libibmad/src/mad.c b/libibmad/src/mad.c index 5deefa242527b7..2ca317efc9296d 100644 --- a/libibmad/src/mad.c +++ b/libibmad/src/mad.c @@ -64,7 +64,7 @@ uint64_t mad_trid(void) uint64_t next; if (!trid) { - srandom((int)time(0) * getpid()); + srandom((int)time(NULL) * getpid()); trid = random(); } next = ++trid; @@ -189,11 +189,11 @@ int mad_build_pkt(void *umad, ib_rpc_t * rpc, ib_portid_t * dport, addr.flow_label = 0; umad_set_grh(umad, &addr); } else - umad_set_grh(umad, 0); + umad_set_grh(umad, NULL); umad_set_pkey(umad, is_smi ? 0 : dport->pkey_idx); mad = umad_get_mad(umad); - p = mad_encode(mad, rpc, lid_routed ? 0 : &dport->drpath, data); + p = mad_encode(mad, rpc, lid_routed ? NULL : &dport->drpath, data); if (!p) return -1; diff --git a/libibmad/src/register.c b/libibmad/src/register.c index 1fdb64a7bd9ef9..d046264bdc69a9 100644 --- a/libibmad/src/register.c +++ b/libibmad/src/register.c @@ -91,7 +91,7 @@ int mad_register_port_client(int port_id, int mgmt, uint8_t rmpp_version) return -1; } - agent = umad_register(port_id, mgmt, vers, rmpp_version, 0); + agent = umad_register(port_id, mgmt, vers, rmpp_version, NULL); if (agent < 0) DEBUG("Can't register agent for class %d", mgmt); diff --git a/libibmad/src/resolve.c b/libibmad/src/resolve.c index bccd938acc5f24..542aa16167c872 100644 --- a/libibmad/src/resolve.c +++ b/libibmad/src/resolve.c @@ -153,7 +153,7 @@ int ib_resolve_portid_str_via(ib_portid_t * portid, char *addr_str, switch (dest_type) { case IB_DEST_LID: - lid = strtol(addr_str, 0, 0); + lid = strtol(addr_str, NULL, 0); if (!IB_LID_VALID(lid)) { errno = EINVAL; return -1; @@ -168,7 +168,7 @@ int ib_resolve_portid_str_via(ib_portid_t * portid, char *addr_str, return 0; case IB_DEST_GUID: - if (!(guid = strtoull(addr_str, 0, 0))) { + if (!(guid = strtoull(addr_str, NULL, 0))) { errno = EINVAL; return -1; } @@ -186,7 +186,7 @@ int ib_resolve_portid_str_via(ib_portid_t * portid, char *addr_str, ib_portid_set(portid, lid, 0, 0); /* handle DR parsing and set DrSLID to local lid */ - if (ib_resolve_self_via(&selfportid, &selfport, 0, srcport) < 0) + if (ib_resolve_self_via(&selfportid, &selfport, NULL, srcport) < 0) return -1; if (str2drpath(&portid->drpath, routepath, selfportid.lid, 0) < 0) { diff --git a/libibmad/src/rpc.c b/libibmad/src/rpc.c index 0dd4c92ac4d59f..a05d71ffe12d5b 100644 --- a/libibmad/src/rpc.c +++ b/libibmad/src/rpc.c @@ -136,7 +136,7 @@ _do_madrpc(int port_id, void *sndbuf, void *rcvbuf, int agentid, int len, if (save_mad) { memcpy(save_mad, umad_get_mad(sndbuf), save_mad_len < len ? save_mad_len : len); - save_mad = 0; + save_mad = NULL; } if (max_retries <= 0) { @@ -227,7 +227,7 @@ void *mad_rpc(const struct ibmad_port *port, ib_rpc_t * rpc, len = 0; memset(sndbuf, 0, umad_size() + IB_MAD_SIZE); - if ((len = mad_build_pkt(sndbuf, rpc, dport, 0, payload)) < 0) + if ((len = mad_build_pkt(sndbuf, rpc, dport, NULL, payload)) < 0) return NULL; if ((len = _do_madrpc(port->port_id, sndbuf, rcvbuf, diff --git a/libibmad/src/sa.c b/libibmad/src/sa.c index 352ed9fea86ec1..09bf58824ae530 100644 --- a/libibmad/src/sa.c +++ b/libibmad/src/sa.c @@ -73,7 +73,7 @@ uint8_t *sa_rpc_call(const struct ibmad_port *ibmad_port, void *rcvbuf, if (!portid->qkey) portid->qkey = IB_DEFAULT_QP1_QKEY; - p = mad_rpc_rmpp(ibmad_port, &rpc, portid, 0 /*&sa->rmpp */ , rcvbuf); /* TODO: RMPP */ + p = mad_rpc_rmpp(ibmad_port, &rpc, portid, NULL /*&sa->rmpp */ , rcvbuf); /* TODO: RMPP */ sa->recsz = rpc.recsz; diff --git a/libibmad/src/serv.c b/libibmad/src/serv.c index 6da8163b6944cb..74dbc8b519b385 100644 --- a/libibmad/src/serv.c +++ b/libibmad/src/serv.c @@ -151,7 +151,7 @@ int mad_respond_via(void *umad, ib_portid_t * portid, uint32_t rstatus, portid->qp, rpc.mgtclass, rpc.method, rpc.attr.id, rpc.attr.mod, rpc.datasz, rpc.dataoffs, portid->qkey); - if (mad_build_pkt(umad, &rpc, portid, 0, 0) < 0) + if (mad_build_pkt(umad, &rpc, portid, NULL, NULL) < 0) return -1; if (ibdebug > 1) @@ -183,7 +183,7 @@ void *mad_receive_via(void *umad, int timeout, struct ibmad_port *srcport) if (!umad) umad_free(mad); DEBUG("recv failed: %s", strerror(errno)); - return 0; + return NULL; } return mad; diff --git a/libibmad/src/vendor.c b/libibmad/src/vendor.c index 22d6843e23e8d3..939cc2a7b3b125 100644 --- a/libibmad/src/vendor.c +++ b/libibmad/src/vendor.c @@ -102,10 +102,10 @@ uint8_t *ib_vendor_call_via(void *data, ib_portid_t * portid, portid->qkey = IB_DEFAULT_QP1_QKEY; if (resp_expected) { - p_ret = mad_rpc_rmpp(srcport, rpcold, portid, 0, data); /* FIXME: no RMPP for now */ + p_ret = mad_rpc_rmpp(srcport, rpcold, portid, NULL, data); /* FIXME: no RMPP for now */ errno = rpc.error; return p_ret; } - return mad_send_via(rpcold, portid, 0, data, srcport) < 0 ? 0 : data; /* FIXME: no RMPP for now */ + return mad_send_via(rpcold, portid, NULL, data, srcport) < 0 ? NULL : data; /* FIXME: no RMPP for now */ } diff --git a/libibnetdisc/src/chassis.c b/libibnetdisc/src/chassis.c index 63eacf434a663d..c1eef73664a377 100644 --- a/libibnetdisc/src/chassis.c +++ b/libibnetdisc/src/chassis.c @@ -763,7 +763,7 @@ static int fill_voltaire_chassis_record(ibnd_node_t * node) { int p = 0; ibnd_port_t *port; - ibnd_node_t *remnode = 0; + ibnd_node_t *remnode = NULL; if (node->ch_found) /* somehow this node has already been passed */ return 0; @@ -1005,8 +1005,8 @@ static void pass_on_spines_interpolate_chguid(ibnd_chassis_t * chassis) static int build_chassis(ibnd_node_t * node, ibnd_chassis_t * chassis) { int p = 0; - ibnd_node_t *remnode = 0; - ibnd_port_t *port = 0; + ibnd_node_t *remnode = NULL; + ibnd_port_t *port = NULL; /* we get here with node = chassis_spine */ if (insert_spine(node, chassis)) diff --git a/libibnetdisc/src/query_smp.c b/libibnetdisc/src/query_smp.c index f6b632905084dc..26a5909524f777 100644 --- a/libibnetdisc/src/query_smp.c +++ b/libibnetdisc/src/query_smp.c @@ -225,14 +225,14 @@ int smp_engine_init(smp_engine_t * engine, char * ca_name, int ca_port, } if ((engine->smi_agent = umad_register(engine->umad_fd, - IB_SMI_CLASS, 1, 0, 0)) < 0) { + IB_SMI_CLASS, 1, 0, NULL)) < 0) { IBND_ERROR("Failed to register SMI agent on (%s:%d)\n", ca_name, ca_port); goto eio_close; } if ((engine->smi_dir_agent = umad_register(engine->umad_fd, - IB_SMI_DIRECT_CLASS, 1, 0, 0)) < 0) { + IB_SMI_DIRECT_CLASS, 1, 0, NULL)) < 0) { IBND_ERROR("Failed to register SMI_DIRECT agent on (%s:%d)\n", ca_name, ca_port); goto eio_close; diff --git a/libibnetdisc/test/testleaks.c b/libibnetdisc/test/testleaks.c index 35157e0ba6d420..508c5ae2e84112 100644 --- a/libibnetdisc/test/testleaks.c +++ b/libibnetdisc/test/testleaks.c @@ -75,7 +75,7 @@ int main(int argc, char **argv) { struct ibnd_config config = { 0 }; int rc = 0; - char *ca = 0; + char *ca = NULL; int ca_port = 0; ibnd_fabric_t *fabric = NULL; char *from = NULL; @@ -84,18 +84,18 @@ int main(int argc, char **argv) static char const str_opts[] = "S:D:n:C:P:t:shuf:i:"; static const struct option long_opts[] = { - {"S", 1, 0, 'S'}, - {"D", 1, 0, 'D'}, - {"num-hops", 1, 0, 'n'}, - {"ca-name", 1, 0, 'C'}, - {"ca-port", 1, 0, 'P'}, - {"timeout", 1, 0, 't'}, - {"show", 0, 0, 's'}, - {"help", 0, 0, 'h'}, - {"usage", 0, 0, 'u'}, - {"debug", 0, 0, 2}, - {"from", 1, 0, 'f'}, - {"iters", 1, 0, 'i'}, + {"S", 1, NULL, 'S'}, + {"D", 1, NULL, 'D'}, + {"num-hops", 1, NULL, 'n'}, + {"ca-name", 1, NULL, 'C'}, + {"ca-port", 1, NULL, 'P'}, + {"timeout", 1, NULL, 't'}, + {"show", 0, NULL, 's'}, + {"help", 0, NULL, 'h'}, + {"usage", 0, NULL, 'u'}, + {"debug", 0, NULL, 2}, + {"from", 1, NULL, 'f'}, + {"iters", 1, NULL, 'i'}, {} }; @@ -118,7 +118,7 @@ int main(int argc, char **argv) ca = strdup(optarg); break; case 'P': - ca_port = strtoul(optarg, 0, 0); + ca_port = strtoul(optarg, NULL, 0); break; case 'n': config.max_hops = strtoul(optarg, NULL, 0); @@ -127,7 +127,7 @@ int main(int argc, char **argv) iters = (int)strtol(optarg, NULL, 0); break; case 't': - config.timeout_ms = strtoul(optarg, 0, 0); + config.timeout_ms = strtoul(optarg, NULL, 0); break; default: usage(); diff --git a/src/dump_fts.c b/src/dump_fts.c index 199403ab392f64..88f186f7d8921e 100644 --- a/src/dump_fts.c +++ b/src/dump_fts.c @@ -431,7 +431,7 @@ int main(int argc, char **argv) "do not try to resolve destinations"}, {"Multicast", 'M', 0, NULL, "show multicast forwarding tables"}, {"node-name-map", 1, 1, "", "node name map file"}, - {0} + {} }; char usage_args[] = "[ [ []]]"; const char *usage_examples[] = { @@ -454,9 +454,9 @@ int main(int argc, char **argv) argv += optind; if (argc > 0) - startlid = strtoul(argv[0], 0, 0); + startlid = strtoul(argv[0], NULL, 0); if (argc > 1) - endlid = strtoul(argv[1], 0, 0); + endlid = strtoul(argv[1], NULL, 0); node_name_map = open_node_name_map(node_name_map_file); diff --git a/src/ibaddr.c b/src/ibaddr.c index 509f0feab6981d..4c2b67c7428d6f 100644 --- a/src/ibaddr.c +++ b/src/ibaddr.c @@ -119,7 +119,7 @@ int main(int argc, char **argv) {"gid_show", 'g', 0, NULL, "show gid address only"}, {"lid_show", 'l', 0, NULL, "show lid range only"}, {"Lid_show", 'L', 0, NULL, "show lid range (in decimal) only"}, - {0} + {} }; char usage_args[] = "[]"; const char *usage_examples[] = { @@ -139,7 +139,7 @@ int main(int argc, char **argv) argv += optind; if (argc > 1) - port = strtoul(argv[1], 0, 0); + port = strtoul(argv[1], NULL, 0); if (!show_lid && !show_gid) show_lid = show_gid = 1; diff --git a/src/ibcacheedit.c b/src/ibcacheedit.c index 6e04efc7575d68..03e4a7efeaeae5 100644 --- a/src/ibcacheedit.c +++ b/src/ibcacheedit.c @@ -86,8 +86,8 @@ static int parse_beforeafter(char *arg, uint64_t *before, uint64_t *after) before_str = arg; after_str = ptr + 1; - (*before) = strtoull(before_str, 0, 0); - (*after) = strtoull(after_str, 0, 0); + (*before) = strtoull(before_str, NULL, 0); + (*after) = strtoull(after_str, NULL, 0); return 0; } @@ -119,9 +119,9 @@ static int parse_guidbeforeafter(char *arg, (*ptr2) = '\0'; after_str = ptr2 + 1; - (*guid) = strtoull(guid_str, 0, 0); - (*before) = strtoull(before_str, 0, 0); - (*after) = strtoull(after_str, 0, 0); + (*guid) = strtoull(guid_str, NULL, 0); + (*before) = strtoull(before_str, NULL, 0); + (*after) = strtoull(after_str, NULL, 0); return 0; } @@ -264,7 +264,7 @@ int main(int argc, char **argv) "Specify before and after sysimgguid to edit"}, {"portguid", 4, 1, "NODEGUID:BEFOREGUID:AFTERGUID", "Specify before and after port guid to edit"}, - {0} + {} }; const char *usage_args = " "; diff --git a/src/ibccconfig.c b/src/ibccconfig.c index a256ceaa6f3949..296d3f791419d7 100644 --- a/src/ibccconfig.c +++ b/src/ibccconfig.c @@ -74,7 +74,7 @@ static const match_rec_t match_tbl[] = { " "}, {"CongestionControlTable", "CT", congestion_control_table, 0, " ..."}, - {0} + {} }; static uint64_t cckey; @@ -548,7 +548,7 @@ static int process_opt(void *context, int ch) { switch (ch) { case 'c': - cckey = (uint64_t) strtoull(optarg, 0, 0); + cckey = (uint64_t) strtoull(optarg, NULL, 0); break; default: return -1; @@ -568,7 +568,7 @@ int main(int argc, char **argv) const struct ibdiag_opt opts[] = { {"cckey", 'c', 1, "", "CC key"}, - {0} + {} }; const char *usage_examples[] = { "SwitchCongestionSetting 2 0x1F 0x1FFFFFFFFF 0x0 0xF 8 0 0:0 1\t# Configure Switch Congestion Settings", diff --git a/src/ibccquery.c b/src/ibccquery.c index a80cd01bdea5f5..390ea71d55b0df 100644 --- a/src/ibccquery.c +++ b/src/ibccquery.c @@ -72,7 +72,7 @@ static const match_rec_t match_tbl[] = { {"CACongestionSetting", "CS", ca_congestion_setting, 0, ""}, {"CongestionControlTable", "CT", congestion_control_table, 0, ""}, {"Timestamp", "TI", timestamp_dump, 0, ""}, - {0} + {} }; static uint64_t cckey = 0; @@ -205,7 +205,7 @@ static const char *switch_port_congestion_setting(ib_portid_t *dest, int outputcount = 0; if (argc > 0) - portnum = strtol(argv[0], 0, 0); + portnum = strtol(argv[0], NULL, 0); /* Figure out number of ports first */ if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport)) @@ -343,7 +343,7 @@ static int process_opt(void *context, int ch) { switch (ch) { case 'c': - cckey = (uint64_t) strtoull(optarg, 0, 0); + cckey = (uint64_t) strtoull(optarg, NULL, 0); break; default: return -1; @@ -363,7 +363,7 @@ int main(int argc, char **argv) const struct ibdiag_opt opts[] = { {"cckey", 'c', 1, "", "CC key"}, - {0} + {} }; const char *usage_examples[] = { "CongestionInfo 3\t\t\t# Congestion Info by lid", diff --git a/src/ibdiag_common.c b/src/ibdiag_common.c index cdb099dd3771a3..293b9afce0a021 100644 --- a/src/ibdiag_common.c +++ b/src/ibdiag_common.c @@ -160,10 +160,10 @@ static void read_ibdiag_config(const char *file) ibd_ibnetdisc_flags &= ~IBND_CONFIG_MLX_EPI; } } else if (strncmp(name, "m_key", strlen("m_key")) == 0) { - ibd_mkey = strtoull(val_str, 0, 0); + ibd_mkey = strtoull(val_str, NULL, 0); } else if (strncmp(name, "sa_key", strlen("sa_key")) == 0) { - ibd_sakey = strtoull(val_str, 0, 0); + ibd_sakey = strtoull(val_str, NULL, 0); } else if (strncmp(name, "nd_format", strlen("nd_format")) == 0) { ibd_nd_format = strdup(val_str); @@ -242,7 +242,7 @@ static int process_opt(int ch) ibd_ca = optarg; break; case 'P': - ibd_ca_port = strtoul(optarg, 0, 0); + ibd_ca_port = strtoul(optarg, NULL, 0); break; case 'D': ibd_dest_type = IB_DEST_DRPATH; @@ -268,7 +268,7 @@ static int process_opt(int ch) case 's': /* srcport is not required when resolving via IB_DEST_LID */ if (resolve_portid_str(ibd_ca, ibd_ca_port, &sm_portid, optarg, - IB_DEST_LID, 0, NULL) < 0) + IB_DEST_LID, NULL, NULL) < 0) IBEXIT("cannot resolve SM destination port %s", optarg); ibd_sm_id = &sm_portid; @@ -310,7 +310,7 @@ static const struct ibdiag_opt common_opts[] = { {"debug", 'd', 0, NULL, "raise debug level"}, {"help", 'h', 0, NULL, "help message"}, {"version", 'V', 0, NULL, "show version"}, - {0} + {} }; static void make_opt(struct option *l, const struct ibdiag_opt *o, @@ -704,7 +704,7 @@ int resolve_portid_str(char *ca_name, uint8_t ca_port, ib_portid_t * portid, switch (dest_type) { case IB_DEST_LID: - lid = strtol(addr_str, 0, 0); + lid = strtol(addr_str, NULL, 0); if (!IB_LID_VALID(lid)) return -1; return ib_portid_set(portid, lid, 0, 0); @@ -715,7 +715,7 @@ int resolve_portid_str(char *ca_name, uint8_t ca_port, ib_portid_t * portid, return 0; case IB_DEST_GUID: - if (!(guid = strtoull(addr_str, 0, 0))) + if (!(guid = strtoull(addr_str, NULL, 0))) return -1; /* keep guid in portid? */ diff --git a/src/iblinkinfo.c b/src/iblinkinfo.c index b7c67e6a5d83ad..7060959993b0e9 100644 --- a/src/iblinkinfo.c +++ b/src/iblinkinfo.c @@ -563,7 +563,7 @@ static int process_opt(void *context, int ch) case 'S': case 'G': node_label.guid_str = optarg; - node_label.guid = (uint64_t)strtoull(node_label.guid_str, 0, 0); + node_label.guid = (uint64_t)strtoull(node_label.guid_str, NULL, 0); break; case 'D': dr_path = strdup(optarg); @@ -640,7 +640,7 @@ int main(int argc, char **argv) "Output only switches"}, {"cas-only", 7, 0, NULL, "Output only CAs"}, - {0} + {} }; char usage_args[] = ""; diff --git a/src/ibnetdiscover.c b/src/ibnetdiscover.c index 9a5b3d515c32c3..ba2e04a15783c8 100644 --- a/src/ibnetdiscover.c +++ b/src/ibnetdiscover.c @@ -550,7 +550,7 @@ static int dump_topology(int group, ibnd_fabric_t *fabric) ibnd_node_t *node; ibnd_port_t *port; int i = 0, p = 0; - time_t t = time(0); + time_t t = time(NULL); uint64_t chguid; char *chname = NULL; struct iter_user_data iter_user_data; @@ -1100,7 +1100,7 @@ int main(int argc, char **argv) {"outstanding_smps", 'o', 1, NULL, "specify the number of outstanding SMP's which should be " "issued during the scan"}, - {0} + {} }; char usage_args[] = "[topology-file]"; diff --git a/src/ibping.c b/src/ibping.c index 2ba17313c00842..9a236fe8233f85 100644 --- a/src/ibping.c +++ b/src/ibping.c @@ -89,7 +89,7 @@ static char *ibping_serv(void) DEBUG("starting to serve..."); - while ((umad = mad_receive_via(0, -1, srcport))) { + while ((umad = mad_receive_via(NULL, -1, srcport))) { if (umad_status(umad) == 0) { mad = umad_get_mad(umad); @@ -99,7 +99,7 @@ static char *ibping_serv(void) DEBUG("Pong: %s", data); - if (mad_respond_via(umad, 0, 0, srcport) < 0) + if (mad_respond_via(umad, NULL, 0, srcport) < 0) DEBUG("respond failed"); } @@ -107,7 +107,7 @@ static char *ibping_serv(void) } DEBUG("server out"); - return 0; + return NULL; } static int oui = IB_OPENIB_OUI; @@ -178,13 +178,13 @@ static int process_opt(void *context, int ch) { switch (ch) { case 'c': - count = strtoul(optarg, 0, 0); + count = strtoul(optarg, NULL, 0); break; case 'f': flood++; break; case 'o': - oui = strtoul(optarg, 0, 0); + oui = strtoul(optarg, NULL, 0); break; case 'S': server++; @@ -207,7 +207,7 @@ int main(int argc, char **argv) {"flood", 'f', 0, NULL, "flood destination"}, {"oui", 'o', 1, NULL, "use specified OUI number"}, {"Server", 'S', 0, NULL, "start in server mode"}, - {0} + {} }; char usage_args[] = ""; @@ -225,7 +225,7 @@ int main(int argc, char **argv) IBEXIT("Failed to open '%s' port '%d'", ibd_ca, ibd_ca_port); if (server) { - if (mad_register_server_via(ping_class, 0, 0, oui, srcport) < 0) + if (mad_register_server_via(ping_class, 0, NULL, oui, srcport) < 0) IBEXIT("can't serve class %d on this port", ping_class); diff --git a/src/ibportstate.c b/src/ibportstate.c index 680c7e78f95a7a..cfe30655e67fd5 100644 --- a/src/ibportstate.c +++ b/src/ibportstate.c @@ -433,7 +433,7 @@ int main(int argc, char **argv) IBEXIT("can't resolve destination port %s", argv[0]); if (argc > 1) - portnum = strtol(argv[1], 0, 0); + portnum = strtol(argv[1], NULL, 0); for (i = 2; i < argc; i++) { int j; @@ -455,7 +455,7 @@ int main(int argc, char **argv) if (++i >= argc) IBEXIT("%s requires an additional parameter", port_args[j].name); - val = strtoull(argv[i], 0, 0); + val = strtoull(argv[i], NULL, 0); switch (j) { case SPEED: if (val > 15) @@ -687,7 +687,7 @@ int main(int argc, char **argv) /* Set DrSLID to local lid */ if (resolve_self(ibd_ca, ibd_ca_port, &selfportid, - &selfport, 0) < 0) + &selfport, NULL) < 0) IBEXIT("could not resolve self"); peerportid.drpath.drslid = (uint16_t) selfportid.lid; peerportid.drpath.drdlid = 0xffff; diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c index 6cd652670977b4..bbae886b9f69d8 100644 --- a/src/ibqueryerrors.c +++ b/src/ibqueryerrors.c @@ -945,7 +945,7 @@ static int process_opt(void *context, int ch) case 'G': case 'S': port_guid_str = optarg; - port_guid = strtoull(optarg, 0, 0); + port_guid = strtoull(optarg, NULL, 0); break; case 'D': dr_path = strdup(optarg); @@ -1020,7 +1020,7 @@ int main(int argc, char **argv) {"outstanding_smps", 'o', 1, NULL, "specify the number of outstanding SMP's which should be " "issued during the scan"}, - {0} + {} }; char usage_args[] = ""; diff --git a/src/ibroute.c b/src/ibroute.c index e433faffc7a1eb..798abd80923a24 100644 --- a/src/ibroute.c +++ b/src/ibroute.c @@ -84,7 +84,7 @@ static const char *check_switch(ib_portid_t *portid, unsigned int *nports, if (!smp_query_via(sw, portid, IB_ATTR_SWITCH_INFO, 0, 0, srcport)) return "switch info failed: is a switch node?"; - return 0; + return NULL; } #define IB_MLIDS_IN_BLOCK (IB_SMP_DATA_SIZE/2) @@ -243,7 +243,7 @@ static const char *dump_multicast_tables(ib_portid_t *portid, unsigned startlid, printf("%d %smlids dumped \n", n, dump_all ? "" : "valid "); free(mapnd); - return 0; + return NULL; } static int dump_lid(char *str, int strlen, int lid, int valid) @@ -392,7 +392,7 @@ static const char *dump_unicast_tables(ib_portid_t *portid, int startlid, printf("%d %slids dumped \n", n, dump_all ? "" : "valid "); free(mapnd); - return 0; + return NULL; } static int process_opt(void *context, int ch) @@ -432,7 +432,7 @@ int main(int argc, char **argv) "do not try to resolve destinations"}, {"Multicast", 'M', 0, NULL, "show multicast forwarding tables"}, {"node-name-map", 1, 1, "", "node name map file"}, - {0} + {} }; char usage_args[] = "[ [ []]]"; const char *usage_examples[] = { @@ -461,9 +461,9 @@ int main(int argc, char **argv) ibdiag_show_usage(); if (argc > 1) - startlid = strtoul(argv[1], 0, 0); + startlid = strtoul(argv[1], NULL, 0); if (argc > 2) - endlid = strtoul(argv[2], 0, 0); + endlid = strtoul(argv[2], NULL, 0); node_name_map = open_node_name_map(node_name_map_file); diff --git a/src/ibstat.c b/src/ibstat.c index 308e29118df654..0e79f21c544c52 100644 --- a/src/ibstat.c +++ b/src/ibstat.c @@ -287,7 +287,7 @@ int main(int argc, char *argv[]) {"list_of_cas", 'l', 0, NULL, "list all IB devices"}, {"short", 's', 0, NULL, "short output"}, {"port_list", 'p', 0, NULL, "show port list"}, - {0} + {} }; char usage_args[] = " [portnum]"; const char *usage_examples[] = { @@ -303,7 +303,7 @@ int main(int argc, char *argv[]) argv += optind; if (argc > 1) - dev_port = strtol(argv[1], 0, 0); + dev_port = strtol(argv[1], NULL, 0); if (umad_init() < 0) IBPANIC("can't init UMAD library"); diff --git a/src/ibsysstat.c b/src/ibsysstat.c index 501a629c0a154f..4d8267e2eba4ed 100644 --- a/src/ibsysstat.c +++ b/src/ibsysstat.c @@ -97,7 +97,7 @@ static int server_respond(void *umad, int size) DEBUG("responding %d bytes to %s, attr 0x%x mod 0x%x qkey %x", size, portid2str(&rport), rpc.attr.id, rpc.attr.mod, rport.qkey); - if (mad_build_pkt(umad, &rpc, &rport, &rmpp, 0) < 0) + if (mad_build_pkt(umad, &rpc, &rport, &rmpp, NULL) < 0) return -1; if (ibdebug > 1) @@ -196,7 +196,7 @@ static char *ibsystat_serv(void) } DEBUG("server out"); - return 0; + return NULL; } static int match_attr(char *str) @@ -253,7 +253,7 @@ static char *ibsystat(ib_portid_t * portid, int attr) puts(data); else printf("sysstat ping succeeded\n"); - return 0; + return NULL; } static int build_cpuinfo(void) @@ -299,7 +299,7 @@ static int process_opt(void *context, int ch) { switch (ch) { case 'o': - oui = strtoul(optarg, 0, 0); + oui = strtoul(optarg, NULL, 0); break; case 'S': server++; @@ -322,7 +322,7 @@ int main(int argc, char **argv) const struct ibdiag_opt opts[] = { {"oui", 'o', 1, NULL, "use specified OUI number"}, {"Server", 'S', 0, NULL, "start in server mode"}, - {0} + {} }; char usage_args[] = " []"; @@ -343,7 +343,7 @@ int main(int argc, char **argv) IBEXIT("Failed to open '%s' port '%d'", ibd_ca, ibd_ca_port); if (server) { - if (mad_register_server_via(sysstat_class, 1, 0, oui, srcport) < + if (mad_register_server_via(sysstat_class, 1, NULL, oui, srcport) < 0) IBEXIT("can't serve class %d", sysstat_class); diff --git a/src/ibtracert.c b/src/ibtracert.c index d8d45408cd716c..a21ee8e7724865 100644 --- a/src/ibtracert.c +++ b/src/ibtracert.c @@ -554,18 +554,18 @@ static Node *find_mcpath(ib_portid_t * from, int mlid) if (get_node(node, port, from) < 0) { IBWARN("can't reach node %s", portid2str(from)); - return 0; + return NULL; } - node->upnode = 0; /* root */ + node->upnode = NULL; /* root */ if ((r = new_node(node, port, from, 0)) > 0) { if (node->type != IB_NODE_SWITCH) { IBWARN("ibtracert from CA to CA is unsupported"); - return 0; /* ibtracert from host to itself is unsupported */ + return NULL; /* ibtracert from host to itself is unsupported */ } if (switch_mclookup(node, from, mlid, map) < 0 || !map[0]) - return 0; + return NULL; return node; } @@ -620,7 +620,7 @@ static Node *find_mcpath(ib_portid_t * from, int mlid) ("can't reach node %s port %d", portid2str(path), i); free(port); - return 0; + return NULL; } if (port->physstate != 5) { /* LinkUP */ @@ -633,7 +633,7 @@ static Node *find_mcpath(ib_portid_t * from, int mlid) if (extend_dpath(&path->drpath, i) < 0) { free(port); - return 0; + return NULL; } } @@ -674,7 +674,7 @@ static Node *find_mcpath(ib_portid_t * from, int mlid) } } - return 0; /* not found */ + return NULL; /* not found */ } static uint64_t find_target_portguid(ib_portid_t * to) @@ -770,7 +770,7 @@ static int process_opt(void *context, int ch) break; case 'm': multicast++; - mlid = strtoul(optarg, 0, 0); + mlid = strtoul(optarg, NULL, 0); break; case 'f': force++; @@ -875,7 +875,7 @@ int main(int argc, char **argv) {"mlid", 'm', 1, "", "multicast trace of the mlid"}, {"node-name-map", 1, 1, "", "node name map file"}, {"ports-file", 2, 1, "", "port pairs file"}, - {0} + {} }; char usage_args[] = " "; const char *usage_examples[] = { diff --git a/src/perfquery.c b/src/perfquery.c index 7ce6a3f4d311d9..7f7ca951b01094 100644 --- a/src/perfquery.c +++ b/src/perfquery.c @@ -834,7 +834,7 @@ int main(int argc, char **argv) {"loop_ports", 'l', 0, NULL, "iterate through each port"}, {"reset_after_read", 'r', 0, NULL, "reset counters after read"}, {"Reset_only", 'R', 0, NULL, "only reset counters"}, - {0} + {} }; char usage_args[] = " [ [[port(s)] [reset_mask]]]"; const char *usage_examples[] = { @@ -867,7 +867,7 @@ int main(int argc, char **argv) tmpstr = strtok(argv[1], ","); while (tmpstr) { info.ports[info.ports_count++] = - strtoul(tmpstr, 0, 0); + strtoul(tmpstr, NULL, 0); tmpstr = strtok(NULL, ","); } info.port = info.ports[0]; @@ -878,8 +878,8 @@ int main(int argc, char **argv) *tmpstr = '\0'; tmpstr++; - pmin = strtoul(argv[1], 0, 0); - pmax = strtoul(tmpstr, 0, 0); + pmin = strtoul(argv[1], NULL, 0); + pmax = strtoul(tmpstr, NULL, 0); if (pmin >= pmax) IBEXIT("max port must be greater than min port in range"); @@ -890,10 +890,10 @@ int main(int argc, char **argv) info.port = info.ports[0]; } else - info.port = strtoul(argv[1], 0, 0); + info.port = strtoul(argv[1], NULL, 0); } if (argc > 2) { - ext_mask = strtoull(argv[2], 0, 0); + ext_mask = strtoull(argv[2], NULL, 0); mask = ext_mask; } @@ -908,7 +908,7 @@ 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, &info.port, 0) < + if (resolve_self(ibd_ca, ibd_ca_port, &portid, &info.port, NULL) < 0) IBEXIT("can't resolve self port %s", argv[0]); } diff --git a/src/saquery.c b/src/saquery.c index 8eae9ddd20083f..ae6c2c872e8d90 100644 --- a/src/saquery.c +++ b/src/saquery.c @@ -203,7 +203,7 @@ static void print_node_record(ib_node_record_t * node_record) break; } - dump_node_record(node_record, 0); + dump_node_record(node_record, NULL); } static void dump_path_record(void *data, struct query_params *p) @@ -1481,7 +1481,7 @@ static const struct query_cmd query_cmds[] = { "[lid]", query_switchinfo_records}, {"SMInfoRecord", "SMIR", IB_SA_ATTR_SMINFORECORD, "[lid]", query_sm_info_records}, - {0} + {} }; static const struct query_cmd *find_query(const char *name) @@ -1780,7 +1780,7 @@ int main(int argc, char **argv) {"join_state", 'J', 1, NULL, "Join state (MCMemberRecord)"}, {"proxy_join", 'X', 1, NULL, "Proxy join (MCMemberRecord)"}, {"service_id", 22, 1, NULL, "ServiceID (PathRecord)"}, - {0} + {} }; memset(¶ms, 0, sizeof params); diff --git a/src/sminfo.c b/src/sminfo.c index 24c4950085879f..494c95be239e91 100644 --- a/src/sminfo.c +++ b/src/sminfo.c @@ -75,13 +75,13 @@ static int process_opt(void *context, int ch) { switch (ch) { case 'a': - act = strtoul(optarg, 0, 0); + act = strtoul(optarg, NULL, 0); break; case 's': - state = strtoul(optarg, 0, 0); + state = strtoul(optarg, NULL, 0); break; case 'p': - prio = strtoul(optarg, 0, 0); + prio = strtoul(optarg, NULL, 0); break; default: return -1; @@ -102,7 +102,7 @@ int main(int argc, char **argv) {"state", 's', 1, "<0-3>", "set SM state"}, {"priority", 'p', 1, "<0-15>", "set SM priority"}, {"activity", 'a', 1, NULL, "set activity count"}, - {0} + {} }; char usage_args[] = " [modifier]"; @@ -123,7 +123,7 @@ int main(int argc, char **argv) if (argc) { if (resolve_portid_str(ibd_ca, ibd_ca_port, &portid, argv[0], - ibd_dest_type, 0, srcport) < 0) + ibd_dest_type, NULL, srcport) < 0) IBEXIT("can't resolve destination port %s", argv[0]); } else { if (resolve_sm_portid(ibd_ca, ibd_ca_port, &portid) < 0) diff --git a/src/smpdump.c b/src/smpdump.c index beb7168bd9aab9..7c5d6ffb3d69d3 100644 --- a/src/smpdump.c +++ b/src/smpdump.c @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) const struct ibdiag_opt opts[] = { {"string", 's', 0, NULL, ""}, - {0} + {} }; char usage_args[] = " [mod]"; const char *usage_examples[] = { @@ -210,11 +210,11 @@ int main(int argc, char *argv[]) IBPANIC("bad path str '%s'", argv[0]); if (mgmt_class == IB_SMI_CLASS) - dlid = strtoul(argv[0], 0, 0); + dlid = strtoul(argv[0], NULL, 0); - attr = strtoul(argv[1], 0, 0); + attr = strtoul(argv[1], NULL, 0); if (argc > 2) - mod = strtoul(argv[2], 0, 0); + mod = strtoul(argv[2], NULL, 0); if (umad_init() < 0) IBPANIC("can't init UMAD library"); @@ -222,7 +222,7 @@ int main(int argc, char *argv[]) if ((portid = umad_open_port(ibd_ca, ibd_ca_port)) < 0) IBPANIC("can't open UMAD port (%s:%d)", ibd_ca, ibd_ca_port); - if ((mad_agent = umad_register(portid, mgmt_class, 1, 0, 0)) < 0) + if ((mad_agent = umad_register(portid, mgmt_class, 1, 0, NULL)) < 0) IBPANIC("Couldn't register agent for SMPs"); if (!(umad = umad_alloc(1, umad_size() + IB_MAD_SIZE))) @@ -249,7 +249,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "%d bytes received\n", length); if (!dump_char) { - xdump(stdout, 0, smp->data, 64); + xdump(stdout, NULL, smp->data, 64); if (smp->status) fprintf(stdout, "SMP status: 0x%x\n", ntohs(smp->status)); diff --git a/src/smpquery.c b/src/smpquery.c index ded1b391566955..3a3c1ca3fb5a65 100644 --- a/src/smpquery.c +++ b/src/smpquery.c @@ -67,7 +67,7 @@ static const match_rec_t match_tbl[] = { {"VLArbitration", "VLArb", vlarb_table, 1, ""}, {"GUIDInfo", "GI", guid_info, 0, ""}, {"MlnxExtPortInfo", "MEPI", mlnx_ext_port_info, 1, ""}, - {0} + {} }; static char *node_name_map_file = NULL; @@ -106,7 +106,7 @@ static const char *node_desc(ib_portid_t *dest, char **argv, int argc) printf("Node Description:%s%s\n", dots, nodename); free(nodename); - return 0; + return NULL; } static const char *node_info(ib_portid_t * dest, char **argv, int argc) @@ -120,7 +120,7 @@ static const char *node_info(ib_portid_t * dest, char **argv, int argc) mad_dump_nodeinfo(buf, sizeof buf, data, sizeof data); printf("# Node info: %s\n%s", portid2str(dest), buf); - return 0; + return NULL; } static const char *port_info_extended(ib_portid_t *dest, char **argv, int argc) @@ -130,7 +130,7 @@ static const char *port_info_extended(ib_portid_t *dest, char **argv, int argc) int portnum = 0; if (argc > 0) - portnum = strtol(argv[0], 0, 0); + portnum = strtol(argv[0], NULL, 0); if (!is_port_info_extended_supported(dest, portnum, srcport)) return "port info extended not supported"; @@ -142,7 +142,7 @@ static const char *port_info_extended(ib_portid_t *dest, char **argv, int argc) mad_dump_portinfo_ext(buf, sizeof buf, data, sizeof data); printf("# Port info Extended: %s port %d\n%s", portid2str(dest), portnum, buf); - return 0; + return NULL; } static const char *port_info(ib_portid_t *dest, char **argv, int argc) @@ -151,7 +151,7 @@ static const char *port_info(ib_portid_t *dest, char **argv, int argc) int portnum = 0, orig_portnum; if (argc > 0) - portnum = strtol(argv[0], 0, 0); + portnum = strtol(argv[0], NULL, 0); orig_portnum = portnum; if (extended_speeds) portnum |= 1 << 31; @@ -161,7 +161,7 @@ static const char *port_info(ib_portid_t *dest, char **argv, int argc) printf("# Port info: %s port %d\n", portid2str(dest), orig_portnum); dump_portinfo(data, 0); - return 0; + return NULL; } static const char *mlnx_ext_port_info(ib_portid_t *dest, char **argv, int argc) @@ -171,7 +171,7 @@ static const char *mlnx_ext_port_info(ib_portid_t *dest, char **argv, int argc) int portnum = 0; if (argc > 0) - portnum = strtol(argv[0], 0, 0); + portnum = strtol(argv[0], NULL, 0); if (!smp_query_via(data, dest, IB_ATTR_MLNX_EXT_PORT_INFO, portnum, 0, srcport)) return "Mellanox ext port info query failed"; @@ -179,7 +179,7 @@ static const char *mlnx_ext_port_info(ib_portid_t *dest, char **argv, int argc) mad_dump_mlnx_ext_port_info(buf, sizeof buf, data, sizeof data); printf("# MLNX ext Port info: %s port %d\n%s", portid2str(dest), portnum, buf); - return 0; + return NULL; } static const char *switch_info(ib_portid_t *dest, char **argv, int argc) @@ -193,7 +193,7 @@ static const char *switch_info(ib_portid_t *dest, char **argv, int argc) mad_dump_switchinfo(buf, sizeof buf, data, sizeof data); printf("# Switch info: %s\n%s", portid2str(dest), buf); - return 0; + return NULL; } static const char *pkey_table(ib_portid_t *dest, char **argv, int argc) @@ -206,7 +206,7 @@ static const char *pkey_table(ib_portid_t *dest, char **argv, int argc) int portnum = 0; if (argc > 0) - portnum = strtol(argv[0], 0, 0); + portnum = strtol(argv[0], NULL, 0); /* Get the partition capacity */ if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport)) @@ -245,7 +245,7 @@ static const char *pkey_table(ib_portid_t *dest, char **argv, int argc) } printf("%d pkeys capacity for this port\n", n); - return 0; + return NULL; } static const char *sl2vl_dump_table_entry(ib_portid_t *dest, int in, int out) @@ -260,7 +260,7 @@ static const char *sl2vl_dump_table_entry(ib_portid_t *dest, int in, int out) mad_dump_sltovl(buf, sizeof buf, data, sizeof data); printf("ports: in %2d, out %2d: ", in, out); printf("%s", buf); - return 0; + return NULL; } static const char *sl2vl_table(ib_portid_t *dest, char **argv, int argc) @@ -271,7 +271,7 @@ static const char *sl2vl_table(ib_portid_t *dest, char **argv, int argc) const char *ret; if (argc > 0) - portnum = strtol(argv[0], 0, 0); + portnum = strtol(argv[0], NULL, 0); if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport)) return "node info query failed"; @@ -295,7 +295,7 @@ static const char *sl2vl_table(ib_portid_t *dest, char **argv, int argc) if (ret) return ret; } - return 0; + return NULL; } static const char *vlarb_dump_table_entry(ib_portid_t *dest, int portnum, @@ -309,7 +309,7 @@ static const char *vlarb_dump_table_entry(ib_portid_t *dest, int portnum, return "vl arb query failed"; mad_dump_vlarbitration(buf, sizeof(buf), data, cap * 2); printf("%s", buf); - return 0; + return NULL; } static const char *vlarb_dump_table(ib_portid_t *dest, int portnum, @@ -334,7 +334,7 @@ static const char *vlarb_table(ib_portid_t *dest, char **argv, int argc) const char *ret = NULL; if (argc > 0) - portnum = strtol(argv[0], 0, 0); + portnum = strtol(argv[0], NULL, 0); /* port number of 0 could mean SP0 or port MAD arrives on */ if (portnum == 0) { @@ -353,7 +353,7 @@ static const char *vlarb_table(ib_portid_t *dest, char **argv, int argc) printf ("# No VLArbitration tables (BSP0): %s port %d\n", portid2str(dest), 0); - return 0; + return NULL; } memset(data, 0, sizeof(data)); } @@ -407,7 +407,7 @@ static const char *guid_info(ib_portid_t *dest, char **argv, int argc) } printf("%d guids capacity for this port\n", n); - return 0; + return NULL; } static int process_opt(void *context, int ch) @@ -446,7 +446,7 @@ int main(int argc, char **argv) "use Combined route address argument"}, {"node-name-map", 1, 1, "", "node name map file"}, {"extended", 'x', 0, NULL, "use extended speeds"}, - {0} + {} }; const char *usage_examples[] = { "portinfo 3 1\t\t\t\t# portinfo by lid, with port modifier", diff --git a/src/vendstat.c b/src/vendstat.c index 0030c7caf20928..316220451055cd 100644 --- a/src/vendstat.c +++ b/src/vendstat.c @@ -359,7 +359,7 @@ int main(int argc, char **argv) {"c", 'c', 1, "", "configure IS4 counter groups"}, {"Read", 'R', 1, "", "Read configuration space record at addr"}, {"Write", 'W', 1, "", "Write configuration space record at addr"}, - {0} + {} }; char usage_args[] = " [port]"; @@ -379,7 +379,7 @@ int main(int argc, char **argv) argv += optind; if (argc > 1) - port = strtoul(argv[1], 0, 0); + port = strtoul(argv[1], NULL, 0); srcport = mad_rpc_open_port(ibd_ca, ibd_ca_port, mgmt_classes, 2); if (!srcport) @@ -392,7 +392,7 @@ int main(int argc, char **argv) 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, &port, NULL) < 0) { mad_rpc_close_port(srcport); IBEXIT("can't resolve self port %s", argv[0]); } From patchwork Tue Apr 9 13:11:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891267 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 BC19E17EF for ; Tue, 9 Apr 2019 13:37:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A810F28893 for ; Tue, 9 Apr 2019 13:37:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C2E82889B; Tue, 9 Apr 2019 13:37:04 +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 43A5428893 for ; Tue, 9 Apr 2019 13:37:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726461AbfDINhD (ORCPT ); Tue, 9 Apr 2019 09:37:03 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:37973 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbfDINhD (ORCPT ); Tue, 9 Apr 2019 09:37:03 -0400 Received: by mail-qt1-f196.google.com with SMTP id d13so19742270qth.5 for ; Tue, 09 Apr 2019 06:37:02 -0700 (PDT) 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=kYZcf8Eg9MsFMrpid6RxiKOTLqQksn7dSM/GxioXWe4=; b=n+5DNPEoMidXQzrbA7gk2/yotzR/topLSmU26Ym+iO6NwMH3DyUZPnHelimqWEUzGR 9ick7O6S/OJM+QCSbDhuSi8igYv0MC+aYeKZ5/kBS9IPGUYg71tGLMzdBLziYUmlUzEz CaQZqUG6Qw6sPAFP3FG9Fr+1Iiil+cawcNNQhDw9DVs9GN7vweIBuRDT1rx/sEWCawp6 gVXh8JxTvvS5wq79KqtgNFaN+hTNhIZkV37NSfSJAi5DBWOwMFE3AQ50QjXIsnCuPBGU zIOWeSnrHNSkxb2JS7ysv5T25FPsx+1RGIJdjQo6B65JSi6vys4IryGwBk3/UerXvq+b wlzQ== 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=kYZcf8Eg9MsFMrpid6RxiKOTLqQksn7dSM/GxioXWe4=; b=Yoll1MBzdVC5e0g2EKB+4rBbe/7UNZ1mspVqjhY2Iz/UNsjK0gXI1eTDRQt/iasBoY Rw2IhiV9BnCVUFmSZGTgJu/+Q6mFL/Vr5NzPaOnM/Q5rPWYEekVS/Dj0NWmKjGmivCvf IrMo07s/E3RTtHESG/ck49Twuvo0fUYi7jci1GMhj9BXKgbcTJ9yRb8gj7oA/GR5zkM+ KWq1p6EUEOAAcuWkHcRzLy2X/6Px+UuIof9KY8L7tMEXKXYPDWv95EY9hRqQ1d+8cteF cxHqKkHP/A/MM/cqwJhdL/q05jtrjxn/OMMwP9gzdfuCM3W+XrWv5IjgYDbkRftNJxr7 5l8Q== X-Gm-Message-State: APjAAAWTSLswiEHg91EVrM7aApffaDzXYofo1rLz6r9VYlXE8SMo48kt ZDdb86dzJ4TKW3FMIU0WOLn1TI0C4Wg= X-Google-Smtp-Source: APXvYqxDkq47kg8kXaoIbcsLG47Gr8Jibd1SFlia9b3Jk7UDUkEEAton6mSpgxTUQeYM7RFp27ln8w== X-Received: by 2002:ac8:91b:: with SMTP id t27mr29414057qth.107.1554817021988; Tue, 09 Apr 2019 06:37:01 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id q50sm22430664qtq.34.2019.04.09.06.37.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:37:01 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXI-0004Ez-2H; Tue, 09 Apr 2019 10:11:36 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 12/16] ibdiags: Fix reversed endian swap direction Date: Tue, 9 Apr 2019 10:11:29 -0300 Message-Id: <20190409131133.16140-13-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 Found by sparse Signed-off-by: Jason Gunthorpe --- src/ibsendtrap.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ibsendtrap.c b/src/ibsendtrap.c index 14db04a0e9130a..8a3a3e6fd0449d 100644 --- a/src/ibsendtrap.c +++ b/src/ibsendtrap.c @@ -129,9 +129,9 @@ static void build_trap256_local(ib_mad_notice_attr_t * n, ib_portid_t * port) n->data_details.ntc_256.lid = n->issuer_lid; n->data_details.ntc_256.dr_slid = 0xffff; n->data_details.ntc_256.method = 1; - n->data_details.ntc_256.attr_id = be16toh(0x15); - n->data_details.ntc_256.attr_mod = be32toh(0x12); - n->data_details.ntc_256.mkey = be64toh(0x1234567812345678); + n->data_details.ntc_256.attr_id = htobe16(0x15); + n->data_details.ntc_256.attr_mod = htobe32(0x12); + n->data_details.ntc_256.mkey = htobe64(0x1234567812345678); } static void build_trap256_lid(ib_mad_notice_attr_t * n, ib_portid_t * port) @@ -162,10 +162,10 @@ static void build_trap257_258(ib_mad_notice_attr_t * n, ib_portid_t * port, n->data_details.ntc_257_258.key = htobe32(0x12345678); n->data_details.ntc_257_258.qp1 = htobe32(0x010101); n->data_details.ntc_257_258.qp2 = htobe32(0x020202); - n->data_details.ntc_257_258.gid1.unicast.prefix = be64toh(0xf8c0000000000001); - n->data_details.ntc_257_258.gid1.unicast.interface_id = be64toh(0x1111222233334444); - n->data_details.ntc_257_258.gid2.unicast.prefix = be64toh(0xf8c0000000000001); - n->data_details.ntc_257_258.gid2.unicast.interface_id = be64toh(0x5678567812341234); + n->data_details.ntc_257_258.gid1.unicast.prefix = htobe64(0xf8c0000000000001); + n->data_details.ntc_257_258.gid1.unicast.interface_id = htobe64(0x1111222233334444); + n->data_details.ntc_257_258.gid2.unicast.prefix = htobe64(0xf8c0000000000001); + n->data_details.ntc_257_258.gid2.unicast.interface_id = htobe64(0x5678567812341234); } static void build_trap257(ib_mad_notice_attr_t * n, ib_portid_t * port) From patchwork Tue Apr 9 13:11:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891245 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 5032C1669 for ; Tue, 9 Apr 2019 13:11:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B656288B3 for ; Tue, 9 Apr 2019 13:11:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2524C2890B; Tue, 9 Apr 2019 13:11:44 +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 C198C288B6 for ; Tue, 9 Apr 2019 13:11:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727315AbfDINLm (ORCPT ); Tue, 9 Apr 2019 09:11:42 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:39038 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726112AbfDINLl (ORCPT ); Tue, 9 Apr 2019 09:11:41 -0400 Received: by mail-qt1-f195.google.com with SMTP id t28so19593685qte.6 for ; Tue, 09 Apr 2019 06:11:41 -0700 (PDT) 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=l+SLfx6MT4ZuGnaeobFvDgxv4vVOIAssGcTdpJ5q2Q0=; b=CO+6skIXtvRL1ZH+4uB3yexBnVvA8qpynXZs+AkCVyvzZlPBHisQ7eHeG31HU/Wxed cpqCf6XIWfu2F77V3Qp3T+QJBQnbydqKPmZyh0I/3+E+126/ND5QF3kHnac7jwSulcdD vhk1MmWvkjgtXyWBEwvrLwtZX/Pb+lyYAURP6/4xiV0UHSHgaDauPQ1Cooq8rDOjE6Tt hHNR7EW++7s006d4JpenBoGZTgTQ+C+9ZZzl4it8Azh93/yqAkqegFPJfi8BQ6gAcThr qh+6gbWctHb6eSDRnFI1UQHLe7Rai4BwZftw447t6fjdiJLEXPYbYC29p6iB78HYc+wx BZ0w== 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=l+SLfx6MT4ZuGnaeobFvDgxv4vVOIAssGcTdpJ5q2Q0=; b=YdsFWfJg9ctWOhMgrOAL4UMEdRvEsnzHN3m9tSR/ANUoU1DnOmPLbw4YhqSSVJ4dcu 21W7awDiPknFZpNMH2Hdide9/I2UOhymgyYBDh58RF3dGpYnCsp7sfdBeUMJ8IPEEskS J/Fx8PryCQygJavSoq0630RxCuwpyWtX3pGm8A9azFRqFDgaaPWPIgVDzA6JM1QqAyld mXcpmaicPfdjAtNKOt17x7NdJ9xSAhSzwFt+tMFJFWZoKqGNfZ8kEhsnNddf3AqSZdSQ V/IYjKb2pN8jfZjqDXTXUODyzEO3XCBbMzYmxCbCvEAXWAeBIOdV8Fbu4vviBzODvZkA Wdow== X-Gm-Message-State: APjAAAUhPJKqycp4LLGSnRWXWHg7+4dvJkqZ+VfhFH/ieo+GGsQaU2uK edh44ughZNV7hehJtnGoO7yQAtFkg9o= X-Google-Smtp-Source: APXvYqwPX3KWYEpPGn+ybujZBvTuiEyIaswjnglGlb8+x0pS2ARwNYqXxKE5Ac0E5pGnNxNLVOdhOw== X-Received: by 2002:a0c:871a:: with SMTP id 26mr29561184qvh.203.1554815500686; Tue, 09 Apr 2019 06:11:40 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id q30sm21883976qtk.85.2019.04.09.06.11.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:11:37 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXI-0004F5-4K; Tue, 09 Apr 2019 10:11:36 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 13/16] ibdiags: Removing unneeded casting around endian conversions Date: Tue, 9 Apr 2019 10:11:30 -0300 Message-Id: <20190409131133.16140-14-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 Signed-off-by: Jason Gunthorpe --- src/smpdump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/smpdump.c b/src/smpdump.c index 7c5d6ffb3d69d3..cdd783600b602b 100644 --- a/src/smpdump.c +++ b/src/smpdump.c @@ -90,7 +90,7 @@ static void drsmp_get_init(void *umad, DRPath * path, int attr, int mod) smp->class_version = 1; smp->method = 1; - smp->attr_id = (uint16_t) htons((uint16_t) attr); + smp->attr_id = htons(attr); smp->attr_mod = htonl(mod); smp->tid = htobe64(drmad_tid++); smp->dr_slid = 0xffff; @@ -115,7 +115,7 @@ static void smp_get_init(void *umad, int lid, int attr, int mod) smp->class_version = 1; smp->method = 1; - smp->attr_id = (uint16_t) htons((uint16_t) attr); + smp->attr_id = htons(attr); smp->attr_mod = htonl(mod); smp->tid = htobe64(drmad_tid++); From patchwork Tue Apr 9 13:11:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891253 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 EBF6F1669 for ; Tue, 9 Apr 2019 13:11:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8DB7288EF for ; Tue, 9 Apr 2019 13:11:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6FF8288B3; Tue, 9 Apr 2019 13:11:46 +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 861C328924 for ; Tue, 9 Apr 2019 13:11:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726112AbfDINLp (ORCPT ); Tue, 9 Apr 2019 09:11:45 -0400 Received: from mail-qt1-f180.google.com ([209.85.160.180]:36453 "EHLO mail-qt1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726531AbfDINLo (ORCPT ); Tue, 9 Apr 2019 09:11:44 -0400 Received: by mail-qt1-f180.google.com with SMTP id s15so11263069qtn.3 for ; Tue, 09 Apr 2019 06:11:43 -0700 (PDT) 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=cx7hO1viKgnplMRopBHjKibSLsTfRgNI1P1dXSTHwZU=; b=FOBD1gScREvWqlNwSieDKobSGid43BvFsmDwYp3XtaZncF/Knwa1WG+pyOhG9psjzu N7T0gT7GipPgdjy0LVU5bW2yr7dGwU6yArT+cDAu1QgbRK9cy6ejJmcdEn/mzuFPJAeW NpRX5EeOvummqMCrRlnKXdgnIPhmUoOigxD13n8mEkKNvRBw2nHr5hqjjjqFf98Y4qwr 1LsSJh6Qo0dWdb1fCmucNv/ZauKMwS2VnOdA6XMFVNAYsZU0yzOFlYj342z8M7FSF0UE MI1rDpbW1j3jlugUNBIu4HYlSg8uU7V02A4iwhwynv9GPHpi38eFFJZv5FymVyaJ4Hdu Nq+A== 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=cx7hO1viKgnplMRopBHjKibSLsTfRgNI1P1dXSTHwZU=; b=FT/NjPzIN+DiM/+8D3+2NDzHWNCP0/ARQnmDNw+bSrYgZkN1kPxQSWV9fzKE4ahubW NqM8zxaiX14SFP+g0HXG7/vMW+K6LZ7bPeLrUdVaLwT7Szj4pFXIcLS+NA5S71LoDY5P Ey+jXKaB3NvL7d6319cvtwchDfmlZI/mHbxkM9OZVJ0jL5pBFtOuskQ7vdzQR2dfXXR/ W8uCZO6zFHgZMHoOTVT2pzYoQiCI0isEYUBiO1QszFyLip71mKZEycidyHtvTAtA6fXj n3Lp7s+VbsQ7L7wADDjvqSzm7AiNA+KsJ6HRJr8JnCUcPAe+2FCH1v/cxaGuOURUBQL7 q6jQ== X-Gm-Message-State: APjAAAU0NokmJlcLvJO4QZ/CAUg8ixJaZJLo7FuBTtUFpEPHZaVfigG2 YHwNumM++E+5gQVA6Nhoe9cmBBJWMBk= X-Google-Smtp-Source: APXvYqzKar0U6wouQXtRH1QDleAg7Rv5JmV5bNrCRBXCYdd7Wmnhqc4wtsy8k/xbJTiiKdr1iyw3vQ== X-Received: by 2002:a0c:8b4a:: with SMTP id d10mr28746380qvc.29.1554815502322; Tue, 09 Apr 2019 06:11:42 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id g15sm22265056qta.31.2019.04.09.06.11.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:11:37 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXI-0004FB-62; Tue, 09 Apr 2019 10:11:36 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 14/16] ibdiags: Add missing endian conversions on constants Date: Tue, 9 Apr 2019 10:11:31 -0300 Message-Id: <20190409131133.16140-15-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 constants are all the same in both endians so this is no functional change. Found by sparse. Signed-off-by: Jason Gunthorpe --- src/ibsendtrap.c | 2 +- src/smpdump.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ibsendtrap.c b/src/ibsendtrap.c index 8a3a3e6fd0449d..98d2b8b6c880dc 100644 --- a/src/ibsendtrap.c +++ b/src/ibsendtrap.c @@ -127,7 +127,7 @@ static void build_trap256_local(ib_mad_notice_attr_t * n, ib_portid_t * port) n->g_or_v.generic.trap_num = htobe16(256); n->issuer_lid = htobe16((uint16_t) port->lid); n->data_details.ntc_256.lid = n->issuer_lid; - n->data_details.ntc_256.dr_slid = 0xffff; + n->data_details.ntc_256.dr_slid = htobe16(0xffff); n->data_details.ntc_256.method = 1; n->data_details.ntc_256.attr_id = htobe16(0x15); n->data_details.ntc_256.attr_mod = htobe32(0x12); diff --git a/src/smpdump.c b/src/smpdump.c index cdd783600b602b..039eca03418016 100644 --- a/src/smpdump.c +++ b/src/smpdump.c @@ -93,8 +93,8 @@ static void drsmp_get_init(void *umad, DRPath * path, int attr, int mod) smp->attr_id = htons(attr); smp->attr_mod = htonl(mod); smp->tid = htobe64(drmad_tid++); - smp->dr_slid = 0xffff; - smp->dr_dlid = 0xffff; + smp->dr_slid = htobe16(0xffff); + smp->dr_dlid = htobe16(0xffff); umad_set_addr(umad, 0xffff, 0, 0, 0); From patchwork Tue Apr 9 13:11:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891271 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 171EE1515 for ; Tue, 9 Apr 2019 13:37:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0054F2841F for ; Tue, 9 Apr 2019 13:37:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8F98288A9; Tue, 9 Apr 2019 13:37:06 +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 8DE3428893 for ; Tue, 9 Apr 2019 13:37:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726001AbfDINhF (ORCPT ); Tue, 9 Apr 2019 09:37:05 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:37431 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726711AbfDINhF (ORCPT ); Tue, 9 Apr 2019 09:37:05 -0400 Received: by mail-qt1-f195.google.com with SMTP id z16so19749446qtn.4 for ; Tue, 09 Apr 2019 06:37:05 -0700 (PDT) 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=sb/c5jgX/xPIavuKHbQ2wY9+mdZqIR7Pwq+I6fO9uJo=; b=MwyvLuiI+6+MEneyo0IR19xubWkMs21Kj9NPcesQZjNyi7+HC0DLCayjTWDMV+hx32 InaE4Gp1JXCc/ZaEcrAJg6jxfS6YlbJAe/nk9NVADvIeEptXvzXFqGsdT2tOSDaEStMJ lgPAUrUi1OUd1tndORdRr+lFEvY9x/Ir6tWedetZMrO+BcOMJ4/IyR4395bBeFvLeV+r ssEqP9TDKuJDa5FLW/UXenFnhoQx5byWzuoeZjo7/dPZfzAwzO+gVxWR2XOz0gl7WLgH i4Se/z2TAsGm7SqveGLVcITK//JS4TS/WWx6e/9EXa1p7ZNyTm8eaaDktqP6IfKm6i7f /Y9A== 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=sb/c5jgX/xPIavuKHbQ2wY9+mdZqIR7Pwq+I6fO9uJo=; b=m4AMBp715Q/i22JuyOvNEQTqfz+G+jK12IVXYXZx/7A2PmxRKD9HLIJqt7fdknrsWy 1ZQQL5xsysvsCUj8NngpqTblX4ise51xCTCTn/eT1B7ZL40pivsQKt1HBpj2Q3sG6f56 6YBayFAyLV22EF/RhiSJOsmt9w3VlqHbkp+vkXw4/IWmQ6dYUQN24bv8qHlTzZwTxust JW91IdHsVUzQ7ieEwZlWXRfBPPVhF+KAv7K2nO0arpHOpTU7jFbaxT9Ggli7aA4zjQkB a1k3uSMwrt/1lkg0by/c8egql2DINVcwiTBKtrnkc9AqldN2aMwJl3JyON/yuFnu33c8 PZzA== X-Gm-Message-State: APjAAAUkEooL6Npm6CkjPDElzQb2cuiHvhzLfuk8WwDxRmc2vL5kCScZ GxDtVrPjfzIupeBjQNx4Rl6raqpV4JI= X-Google-Smtp-Source: APXvYqzmIDxFRvGgPNAv0RjxFVThTwnmw/d1/Di7NHUDjAEUxL9MjxrFyQmfeOJ97Ao88tk7EONb3A== X-Received: by 2002:ac8:2ca3:: with SMTP id 32mr29303286qtw.60.1554817024419; Tue, 09 Apr 2019 06:37:04 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id j5sm20108422qtb.30.2019.04.09.06.37.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:37:03 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXI-0004FH-79; Tue, 09 Apr 2019 10:11:36 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 15/16] ibdiags: Add missing ULL on large constants Date: Tue, 9 Apr 2019 10:11:32 -0300 Message-Id: <20190409131133.16140-16-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 sparse warnings of the form: ibsendtrap.c:164:59: warning: constant 0xf8c0000000000001 is so big it is unsigned long Signed-off-by: Jason Gunthorpe --- src/ibsendtrap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ibsendtrap.c b/src/ibsendtrap.c index 98d2b8b6c880dc..69ec73112c841e 100644 --- a/src/ibsendtrap.c +++ b/src/ibsendtrap.c @@ -79,7 +79,7 @@ static void build_trap145(ib_mad_notice_attr_t * n, ib_portid_t * port) n->g_or_v.generic.prod_type_lsb = htobe16(get_node_type(port)); n->g_or_v.generic.trap_num = htobe16(145); n->issuer_lid = htobe16((uint16_t) port->lid); - n->data_details.ntc_145.new_sys_guid = htobe64(0x1234567812345678); + n->data_details.ntc_145.new_sys_guid = htobe64(0x1234567812345678ULL); } static void build_trap144_local(ib_mad_notice_attr_t * n, ib_portid_t * port) @@ -131,7 +131,7 @@ static void build_trap256_local(ib_mad_notice_attr_t * n, ib_portid_t * port) n->data_details.ntc_256.method = 1; n->data_details.ntc_256.attr_id = htobe16(0x15); n->data_details.ntc_256.attr_mod = htobe32(0x12); - n->data_details.ntc_256.mkey = htobe64(0x1234567812345678); + n->data_details.ntc_256.mkey = htobe64(0x1234567812345678ULL); } static void build_trap256_lid(ib_mad_notice_attr_t * n, ib_portid_t * port) @@ -162,10 +162,10 @@ static void build_trap257_258(ib_mad_notice_attr_t * n, ib_portid_t * port, n->data_details.ntc_257_258.key = htobe32(0x12345678); n->data_details.ntc_257_258.qp1 = htobe32(0x010101); n->data_details.ntc_257_258.qp2 = htobe32(0x020202); - n->data_details.ntc_257_258.gid1.unicast.prefix = htobe64(0xf8c0000000000001); - n->data_details.ntc_257_258.gid1.unicast.interface_id = htobe64(0x1111222233334444); - n->data_details.ntc_257_258.gid2.unicast.prefix = htobe64(0xf8c0000000000001); - n->data_details.ntc_257_258.gid2.unicast.interface_id = htobe64(0x5678567812341234); + n->data_details.ntc_257_258.gid1.unicast.prefix = htobe64(0xf8c0000000000001ULL); + n->data_details.ntc_257_258.gid1.unicast.interface_id = htobe64(0x1111222233334444ULL); + n->data_details.ntc_257_258.gid2.unicast.prefix = htobe64(0xf8c0000000000001ULL); + n->data_details.ntc_257_258.gid2.unicast.interface_id = htobe64(0x5678567812341234ULL); } static void build_trap257(ib_mad_notice_attr_t * n, ib_portid_t * port) From patchwork Tue Apr 9 13:11:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891269 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 AADAA17EF for ; Tue, 9 Apr 2019 13:37:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9248E2889B for ; Tue, 9 Apr 2019 13:37:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85CFF288A9; Tue, 9 Apr 2019 13:37:06 +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 A9E7428893 for ; Tue, 9 Apr 2019 13:37:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726668AbfDINhF (ORCPT ); Tue, 9 Apr 2019 09:37:05 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:46081 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbfDINhE (ORCPT ); Tue, 9 Apr 2019 09:37:04 -0400 Received: by mail-qt1-f194.google.com with SMTP id z17so19660107qts.13 for ; Tue, 09 Apr 2019 06:37:04 -0700 (PDT) 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=eqUdi1xNiC/SnRUmGkaRhDFwcC755AaqMox2bhy6b3A=; b=HqR6Ge232f+ofcUhdhgqvIQ4RgNSX4e2gpyUnxDPC6YoIRfsBOra+2HsssHrlpGZD/ RRWviVOcUOt4+/8ztaaaleyK18IGwQzC2wkUOOZ9deZPgrcORNj/0IXjshsNzykoYxMT M16bCht66vpKjBYmBvkEMu97CO/Z7Epgs7n2kDDLX8WvATx65HAY5J7UMon215dskMGp kiEiIt/DZS46rN9AMp6oGfHBpIl//0iqXPTewglmwwKKy5e3rOmn0nda4pjAI5CILE3E cPZbPdGpQ11czDY7X+Ku87F/draxr8s1d9iTVHqC8n1w5vlnVVSOwHU4Y0HVkI4OdGm3 ceAg== 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=eqUdi1xNiC/SnRUmGkaRhDFwcC755AaqMox2bhy6b3A=; b=tcjcFh7qcgFVRcfSo+yGDwg6Jps4Igs9mbC0ec8WSBLfoALJ1plWY1QcfxDpmqMX0o XsJ9paw04Xe/Zsw40KPWEcD/ntN4OAiE4Lt0069cd/QCPQMUPWEQijtC9X1nn/T7fn7f atLLJzPtlCrcPzYL3Vwx9AIJ66kUsh8G/A2a/RskHMUAXqvnhIpZArdJZBqO/q+aUKKr YLwVwKg+rtdmTYs/s/oE31+qB5DX+qyvR6GBH0QyIRb0yjQYPSvsP7XlG5ApTXQegAJ4 Y/R7UCP/Kim+2QF8nOSX7aj+Xb9Rj26LfGe62TZQYqls35zdGAGv7V4O7Nmtu0KPJ//M N9Gg== X-Gm-Message-State: APjAAAVD4g4SNVvyEfrfQITqGQI0OHdDlf0mOw3WlIsmTF7fAQxa+RDC 3SbicjoWW4gRl6uiGE9UUvRjWMI0CJo= X-Google-Smtp-Source: APXvYqw0q9kLOvjmG8gxENDSFuUToOkYRKY3YlBL0TX6Gs8nqqGtCCiRs8t4hfRqIp8rzqtNYap+Yw== X-Received: by 2002:aed:3948:: with SMTP id l66mr29767761qte.309.1554817023209; Tue, 09 Apr 2019 06:37:03 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id f47sm23893765qta.80.2019.04.09.06.37.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:37:02 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXI-0004FO-9A; Tue, 09 Apr 2019 10:11:36 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 16/16] ibdiags: Add __be* annotations to types Date: Tue, 9 Apr 2019 10:11:33 -0300 Message-Id: <20190409131133.16140-17-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-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 From sparse. Signed-off-by: Jason Gunthorpe --- src/dump_fts.c | 4 ++-- src/ibqueryerrors.c | 16 ++++++++-------- src/ibroute.c | 4 ++-- src/ibtracert.c | 2 +- src/mcm_rereg_test.c | 6 +++--- src/perfquery.c | 14 +++++++------- src/saquery.c | 4 ++-- src/smpdump.c | 14 +++++++------- src/smpquery.c | 8 ++++---- src/vendstat.c | 26 +++++++++++++------------- 10 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/dump_fts.c b/src/dump_fts.c index 88f186f7d8921e..8a5b3e20da6b45 100644 --- a/src/dump_fts.c +++ b/src/dump_fts.c @@ -65,7 +65,7 @@ static nn_map_t *node_name_map = NULL; #define IB_MLIDS_IN_BLOCK (IB_SMP_DATA_SIZE/2) static int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports, - uint16_t mft[16][IB_MLIDS_IN_BLOCK]) + __be16 mft[16][IB_MLIDS_IN_BLOCK]) { uint16_t mask; unsigned i, chunk, bit, nonzero = 0; @@ -107,7 +107,7 @@ static int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports, return i * 2; } -static uint16_t mft[16][IB_MLIDS_IN_BLOCK]; +static __be16 mft[16][IB_MLIDS_IN_BLOCK]; static void dump_multicast_tables(ibnd_node_t *node, unsigned startl, unsigned endl, struct ibmad_port *mad_port) diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c index bbae886b9f69d8..715ebc969672e2 100644 --- a/src/ibqueryerrors.c +++ b/src/ibqueryerrors.c @@ -427,7 +427,7 @@ static int check_threshold(uint8_t *pc, uint8_t *pce, uint32_t cap_mask2, static int print_results(ib_portid_t * portid, char *node_name, ibnd_node_t * node, uint8_t * pc, int portnum, - int *header_printed, uint8_t *pce, uint16_t cap_mask, + int *header_printed, uint8_t *pce, __be16 cap_mask, uint32_t cap_mask2) { char buf[2048]; @@ -537,11 +537,11 @@ static int print_results(ib_portid_t * portid, char *node_name, } static int query_cap_mask(ib_portid_t * portid, char *node_name, int portnum, - uint16_t * cap_mask, uint32_t * cap_mask2) + __be16 * cap_mask, uint32_t * cap_mask2) { uint8_t pc[1024] = { 0 }; - uint16_t rc_cap_mask; - uint32_t rc_cap_mask2; + __be16 rc_cap_mask; + __be32 rc_cap_mask2; portid->sl = lid2sl_table[portid->lid]; @@ -564,7 +564,7 @@ static int query_cap_mask(ib_portid_t * portid, char *node_name, int portnum, return 0; } -static int print_data_cnts(ib_portid_t * portid, uint16_t cap_mask, +static int print_data_cnts(ib_portid_t * portid, __be16 cap_mask, char *node_name, ibnd_node_t * node, int portnum, int *header_printed) { @@ -635,7 +635,7 @@ static int print_data_cnts(ib_portid_t * portid, uint16_t cap_mask, return (0); } -static int print_errors(ib_portid_t * portid, uint16_t cap_mask, uint32_t cap_mask2, +static int print_errors(ib_portid_t * portid, __be16 cap_mask, uint32_t cap_mask2, char *node_name, ibnd_node_t * node, int portnum, int *header_printed) { @@ -716,7 +716,7 @@ static uint8_t *reset_pc_ext(void *rcvbuf, ib_portid_t *dest, int port, return mad_rpc(srcport, &rpc, dest, rcvbuf, rcvbuf); } -static void clear_port(ib_portid_t * portid, uint16_t cap_mask, uint32_t cap_mask2, +static void clear_port(ib_portid_t * portid, __be16 cap_mask, uint32_t cap_mask2, char *node_name, int port) { uint8_t pc[1024] = { 0 }; @@ -781,7 +781,7 @@ static void print_node(ibnd_node_t *node, void *user_data) int type = 0; int all_port_sup = 0; ib_portid_t portid = { 0 }; - uint16_t cap_mask = 0; + __be16 cap_mask = 0; uint32_t cap_mask2 = 0; char *node_name = NULL; diff --git a/src/ibroute.c b/src/ibroute.c index 798abd80923a24..8108362e3a45cd 100644 --- a/src/ibroute.c +++ b/src/ibroute.c @@ -90,7 +90,7 @@ static const char *check_switch(ib_portid_t *portid, unsigned int *nports, #define IB_MLIDS_IN_BLOCK (IB_SMP_DATA_SIZE/2) static int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports, - uint16_t mft[16][IB_MLIDS_IN_BLOCK]) + __be16 mft[16][IB_MLIDS_IN_BLOCK]) { uint16_t mask; unsigned i, chunk, bit, nonzero = 0; @@ -132,7 +132,7 @@ static int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports, return i * 2; } -static uint16_t mft[16][IB_MLIDS_IN_BLOCK]; +static __be16 mft[16][IB_MLIDS_IN_BLOCK]; static const char *dump_multicast_tables(ib_portid_t *portid, unsigned startlid, unsigned endlid) diff --git a/src/ibtracert.c b/src/ibtracert.c index a21ee8e7724865..7bdb1e0034e8ea 100644 --- a/src/ibtracert.c +++ b/src/ibtracert.c @@ -491,7 +491,7 @@ static int switch_mclookup(Node * node, ib_portid_t * portid, int mlid, Switch sw; char mdb[64]; void *si = sw.switchinfo; - uint16_t *msets = (uint16_t *) mdb; + __be16 *msets = (__be16 *) mdb; int maxsets, block, i, set; memset(map, 0, 256); diff --git a/src/mcm_rereg_test.c b/src/mcm_rereg_test.c index b9e85f8d2d04cb..056682407eb359 100644 --- a/src/mcm_rereg_test.c +++ b/src/mcm_rereg_test.c @@ -145,7 +145,7 @@ static int rereg_port_gid(int port, int agent, ib_portid_t * dport, struct guid_trid { ibmad_gid_t gid; - uint64_t guid; + __be64 guid; uint64_t trid; }; @@ -319,8 +319,8 @@ static int rereg_and_test_port(const char *guid_file, int port, int agent, char line[256]; FILE *f; ibmad_gid_t port_gid; - uint64_t prefix = htobe64(0xfe80000000000000ull); - uint64_t guid = htobe64(0x0002c90200223825ull); + __be64 prefix = htobe64(0xfe80000000000000ull); + __be64 guid = htobe64(0x0002c90200223825ull); struct guid_trid *list; int i = 0; diff --git a/src/perfquery.c b/src/perfquery.c index 7f7ca951b01094..f6ca1b2fb36c2f 100644 --- a/src/perfquery.c +++ b/src/perfquery.c @@ -207,7 +207,7 @@ static void aggregate_perfcounters(void) } static void output_aggregate_perfcounters(ib_portid_t * portid, - uint16_t cap_mask) + __be16 cap_mask) { char buf[1024]; uint32_t val = ALL_PORTS; @@ -246,7 +246,7 @@ static void output_aggregate_perfcounters(ib_portid_t * portid, portid2str(portid), ALL_PORTS, ntohs(cap_mask), buf); } -static void aggregate_perfcounters_ext(uint16_t cap_mask, uint32_t cap_mask2) +static void aggregate_perfcounters_ext(__be16 cap_mask, uint32_t cap_mask2) { uint32_t val; uint64_t val64; @@ -310,7 +310,7 @@ static void aggregate_perfcounters_ext(uint16_t cap_mask, uint32_t cap_mask2) } static void output_aggregate_perfcounters_ext(ib_portid_t * portid, - uint16_t cap_mask, uint32_t cap_mask2) + __be16 cap_mask, uint32_t cap_mask2) { char buf[1536]; uint32_t val = ALL_PORTS; @@ -379,7 +379,7 @@ static void output_aggregate_perfcounters_ext(ib_portid_t * portid, portid2str(portid), ALL_PORTS, ntohs(cap_mask), cap_mask2, buf); } -static void dump_perfcounters(int extended, int timeout, uint16_t cap_mask, +static void dump_perfcounters(int extended, int timeout, __be16 cap_mask, uint32_t cap_mask2, ib_portid_t * portid, int port, int aggregate) { @@ -555,7 +555,7 @@ static uint8_t *ext_speeds_reset_via(void *rcvbuf, ib_portid_t * dest, } static uint8_t is_rsfec_mode_active(ib_portid_t * portid, int port, - uint16_t cap_mask) + __be16 cap_mask) { uint8_t data[IB_SMP_DATA_SIZE] = { 0 }; uint32_t fec_mode_active = 0; @@ -584,7 +584,7 @@ static uint8_t is_rsfec_mode_active(ib_portid_t * portid, int port, } static void extended_speeds_query(ib_portid_t * portid, int port, - uint64_t ext_mask, uint16_t cap_mask) + uint64_t ext_mask, __be16 cap_mask) { int mask = ext_mask; @@ -801,7 +801,7 @@ int main(int argc, char **argv) int mask = 0xffff; uint64_t ext_mask = 0xffffffffffffffffULL; uint32_t cap_mask2; - uint16_t cap_mask; + __be16 cap_mask; int all_ports_loop = 0; int node_type, num_ports = 0; uint8_t data[IB_SMP_DATA_SIZE] = { 0 }; diff --git a/src/saquery.c b/src/saquery.c index ae6c2c872e8d90..273e03c98bfef1 100644 --- a/src/saquery.c +++ b/src/saquery.c @@ -557,7 +557,7 @@ static void dump_inform_info_record(void *data, struct query_params *p) char gid_str[INET6_ADDRSTRLEN]; char gid_str2[INET6_ADDRSTRLEN]; ib_inform_info_record_t *p_iir = data; - uint32_t qpn; + __be32 qpn; uint8_t resp_time_val; ib_inform_info_get_qpn_resp_time(p_iir->inform_info.g_or_v. @@ -1046,7 +1046,7 @@ static int query_path_records(const struct query_cmd *q, struct sa_handle * h, ib_path_rec_t pr; __be64 comp_mask = 0; uint32_t flow = 0; - uint16_t qos_class = 0; + __be16 qos_class = 0; uint8_t reversible = 0; memset(&pr, 0, sizeof(pr)); diff --git a/src/smpdump.c b/src/smpdump.c index 039eca03418016..ece87bf2bb49e6 100644 --- a/src/smpdump.c +++ b/src/smpdump.c @@ -63,16 +63,16 @@ struct drsmp { uint8_t mgmt_class; uint8_t class_version; uint8_t method; - uint16_t status; + __be16 status; uint8_t hop_ptr; uint8_t hop_cnt; - uint64_t tid; - uint16_t attr_id; + __be64 tid; + __be16 attr_id; uint16_t resv; - uint32_t attr_mod; - uint64_t mkey; - uint16_t dr_slid; - uint16_t dr_dlid; + __be32 attr_mod; + __be64 mkey; + __be16 dr_slid; + __be16 dr_dlid; uint8_t reserved[28]; uint8_t data[64]; uint8_t initial_path[64]; diff --git a/src/smpquery.c b/src/smpquery.c index 3a3c1ca3fb5a65..6d54e65fd49181 100644 --- a/src/smpquery.c +++ b/src/smpquery.c @@ -200,7 +200,7 @@ 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; - uint16_t *p; + __be16 *p; unsigned mod; int n, t, phy_ports; int portnum = 0; @@ -234,7 +234,7 @@ static const char *pkey_table(ib_portid_t *dest, char **argv, int argc) k = ((n + 7 - i * 32) / 8) * 8; else k = 32; - p = (uint16_t *) data; + p = (__be16 *) data; for (j = 0; j < k; j += 8, p += 8) { printf ("%4u: 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", @@ -381,7 +381,7 @@ 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; - uint64_t *p; + __be64 *p; unsigned mod; int n; @@ -399,7 +399,7 @@ static const char *guid_info(ib_portid_t *dest, char **argv, int argc) k = ((n + 1 - i * 8) / 2) * 2; else k = 8; - p = (uint64_t *) data; + p = (__be64 *) data; for (j = 0; j < k; j += 2, p += 2) { printf("%4u: 0x%016" PRIx64 " 0x%016" PRIx64 "\n", (i * 8) + j, be64toh(p[0]), be64toh(p[1])); diff --git a/src/vendstat.c b/src/vendstat.c index 316220451055cd..3191e49c927298 100644 --- a/src/vendstat.c +++ b/src/vendstat.c @@ -61,10 +61,10 @@ static struct ibmad_port *srcport; typedef struct { - uint16_t hw_revision; - uint16_t device_id; + __be16 hw_revision; + __be16 device_id; uint8_t reserved[24]; - uint32_t uptime; + __be32 uptime; } is3_hw_info_t; typedef struct { @@ -72,21 +72,21 @@ typedef struct { uint8_t major; uint8_t minor; uint8_t sub_minor; - uint32_t build_id; + __be32 build_id; uint8_t month; uint8_t day; - uint16_t year; - uint16_t resv2; - uint16_t hour; + __be16 year; + __be16 resv2; + __be16 hour; uint8_t psid[16]; - uint32_t ini_file_version; + __be32 ini_file_version; } is3_fw_info_t; typedef struct { - uint32_t ext_major; - uint32_t ext_minor; - uint32_t ext_sub_minor; - uint32_t reserved[4]; + __be32 ext_major; + __be32 ext_minor; + __be32 ext_sub_minor; + __be32 reserved[4]; } is4_fw_ext_info_t; typedef struct { @@ -127,7 +127,7 @@ typedef struct { uint8_t reserved1[8]; uint8_t reserved[3]; uint8_t num_of_counter_groups; - uint32_t group_masks[COUNTER_GROUPS_NUM]; + __be32 group_masks[COUNTER_GROUPS_NUM]; } is4_counter_group_info_t; typedef struct {