From patchwork Tue Jul 25 22:21:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 27190 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 48C9A58CB; Wed, 26 Jul 2017 00:21:36 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id CCD7037B4 for ; Wed, 26 Jul 2017 00:21:22 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 86E8A20D6B; Tue, 25 Jul 2017 18:21:22 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Tue, 25 Jul 2017 18:21:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=BRJ 7T4xTWd85Iv3D2FxFv71q0qA3P2Lyyb4X5O/u6yA=; b=qPfm2t3B0npZbHnkDVO DP0zCmuHUfwA3p9UQAqvgkuXSfu/Z6BIL0yXZjKajnGOOie2O9KQ1Sa8van82gav 959EmWFYPot0yz/rKfi/Fy8mmKRcupL2TPsTLykbTq6DVeKO5vuatD4CqcGidtjF vBUATla/YESHOpot+bU3i0Nk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=BRJ7T4xTWd85Iv3D2FxFv71q0qA3P2Lyyb4X5O/u6 yA=; b=IXuhYZwXpKdoqv2sTKThrmfUPvaPq+FccKlVHdV5lz+VFj5MgzR8AsCIu 3WIPcIi3LT6lJyaflsvA7+xQZBakcKEDiqXL8rvQlCA0uqgWMp57xIrpvC5a7lTj YDftGpMZ6ouQOCw7IQF48/NTIL+JqzGFlQodrLnC5hsqM6gBRwZxWU03hupA+aDE lqGxvwX2r0kvI5HERFUCT98hMKUm9VVCZemEMViVRzV1Qlf2L4ZG/HpTyXbir2Te 6gvyXY2r2J+0N7tW8UgkwfEU1TATPu/jxMjqnEHfTBxTx3vwIn1luVnwzoNoOTgq nBgD56cr1WoFy8/annbKyT9rV5zjQ== X-ME-Sender: X-Sasl-enc: LOrfEFCioK7rf96vGYaSeCKPsKPFBll9VtPfONhOX8tI 1501021281 Received: from xps.domain.com (bzq-164-168-31-206.red.bezeqint.net [31.168.164.206]) by mail.messagingengine.com (Postfix) with ESMTPA id 484D324130; Tue, 25 Jul 2017 18:21:21 -0400 (EDT) From: Thomas Monjalon To: keith.wiles@intel.com Cc: dev@dpdk.org Date: Wed, 26 Jul 2017 01:21:06 +0300 Message-Id: <20170725222107.23203-6-thomas@monjalon.net> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170725222107.23203-1-thomas@monjalon.net> References: <20170725222107.23203-1-thomas@monjalon.net> Subject: [dpdk-dev] [pktgen PATCH 5/6] fix 32-bit build X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Thomas Monjalon --- app/cli-functions.c | 2 +- app/pktgen-cmds.c | 18 +++++++++--------- app/pktgen-latency.c | 26 ++++++++++++++------------ app/pktgen-port-cfg.h | 2 +- app/pktgen-stats.c | 47 ++++++++++++++++++++++++++++------------------- lib/cli/cli_cmds.c | 6 +++--- lib/common/port_config.c | 2 +- 7 files changed, 57 insertions(+), 46 deletions(-) diff --git a/app/cli-functions.c b/app/cli-functions.c index 9832026..56d5ddd 100644 --- a/app/cli-functions.c +++ b/app/cli-functions.c @@ -890,7 +890,7 @@ debug_cmd(int argc, char **argv) break; case 60: case 61: - addr = (void *)strtoull(argv[2], NULL, 0); + addr = (void *)(uintptr_t)strtoull(argv[2], NULL, 0); if (argc == 3) len = 64; else diff --git a/app/pktgen-cmds.c b/app/pktgen-cmds.c index e5fdb9d..a39124d 100644 --- a/app/pktgen-cmds.c +++ b/app/pktgen-cmds.c @@ -116,7 +116,7 @@ pktgen_script_save(char *path) /* TODO: Determine DPDK arguments for rank and memory, default for now. */ fprintf(fd, "# Command line arguments: (DPDK args are defaults)\n"); - fprintf(fd, "# %s -c %lx -n 3 -m 512 --proc-type %s -- ", + fprintf(fd, "# %s -c %" PRIx64 " -n 3 -m 512 --proc-type %s -- ", pktgen.argv[0], lcore, (rte_eal_process_type() == @@ -171,7 +171,7 @@ pktgen_script_save(char *path) if (rte_atomic64_read(&info->transmit_count) == 0) strcpy(buff, "Forever"); else - snprintf(buff, sizeof(buff), "%ld", + snprintf(buff, sizeof(buff), "%" PRIu64, rte_atomic64_read(&info->transmit_count)); fprintf(fd, "#\n"); flags = rte_atomic32_read(&info->port_flags); @@ -183,7 +183,7 @@ pktgen_script_save(char *path) fprintf(fd, "Link: %s\n", buff); fprintf(fd, "#\n# Set up the primary port information:\n"); - fprintf(fd, "set %d count %ld\n", info->pid, + fprintf(fd, "set %d count %" PRIu64 "\n", info->pid, rte_atomic64_read(&info->transmit_count)); fprintf(fd, "set %d size %d\n", info->pid, pkt->pktSize + FCS_SIZE); fprintf(fd, "set %d rate %g\n", info->pid, info->tx_rate); @@ -226,7 +226,7 @@ pktgen_script_save(char *path) } fprintf(fd, "\n"); - fprintf(fd, "set %d jitter %lu\n", i, info->jitter_threshold); + fprintf(fd, "set %d jitter %" PRIu64 "\n", i, info->jitter_threshold); fprintf(fd, "%sable %d mpls\n", (flags & SEND_MPLS_LABEL) ? "en" : "dis", i); sprintf(buff, "%x", pkt->mpls_entry); @@ -454,7 +454,7 @@ pktgen_lua_save(char *path) /* TODO: Determine DPDK arguments for rank and memory, default for now. */ fprintf(fd, "-- Command line arguments: (DPDK args are defaults)\n"); - fprintf(fd, "-- %s -c %lx -n 3 -m 512 --proc-type %s -- ", + fprintf(fd, "-- %s -c %" PRIx64 " -n 3 -m 512 --proc-type %s -- ", pktgen.argv[0], lcore, (rte_eal_process_type() == @@ -497,7 +497,7 @@ pktgen_lua_save(char *path) if (rte_atomic64_read(&info->transmit_count) == 0) strcpy(buff, "Forever"); else - snprintf(buff, sizeof(buff), "%ld", + snprintf(buff, sizeof(buff), "%" PRIu64, rte_atomic64_read(&info->transmit_count)); fprintf(fd, "-- \n"); flags = rte_atomic32_read(&info->port_flags); @@ -509,7 +509,7 @@ pktgen_lua_save(char *path) fprintf(fd, "Link: %s\n", buff); fprintf(fd, "--\n-- Set up the primary port information:\n"); - fprintf(fd, "pktgen.set('%d', 'count', %ld);\n", info->pid, + fprintf(fd, "pktgen.set('%d', 'count', %" PRIu64 ");\n", info->pid, rte_atomic64_read(&info->transmit_count)); fprintf(fd, "pktgen.set('%d', 'size', %d);\n", info->pid, pkt->pktSize + FCS_SIZE); fprintf(fd, "pktgen.set('%d', 'rate', %g);\n", info->pid, info->tx_rate); @@ -551,7 +551,7 @@ pktgen_lua_save(char *path) fprintf(fd, "\n"); fflush(fd); - fprintf(fd, "pktgen.jitter('%d', %lu);\n", i, info->jitter_threshold); + fprintf(fd, "pktgen.jitter('%d', %" PRIu64 ");\n", i, info->jitter_threshold); fprintf(fd, "pktgen.mpls('%d', '%sable');\n", i, (flags & SEND_MPLS_LABEL) ? "en" : "dis"); sprintf(buff, "%x", pkt->mpls_entry); @@ -871,7 +871,7 @@ pktgen_transmit_count_rate(int port, char *buff, int len) if (rte_atomic64_read(&info->transmit_count) == 0) snprintf(buff, len, "Forever /%g%%", info->tx_rate); else - snprintf(buff, len, "%ld /%g%%", + snprintf(buff, len, "%" PRIu64 " /%g%%", rte_atomic64_read(&info->transmit_count), info->tx_rate); diff --git a/app/pktgen-latency.c b/app/pktgen-latency.c index 7c01bec..2ed718a 100644 --- a/app/pktgen-latency.c +++ b/app/pktgen-latency.c @@ -238,13 +238,15 @@ pktgen_page_latency(void) /* Rx/Tx pkts/s rate */ row = LINK_STATE_ROW + 1; - snprintf(buff, sizeof(buff), "%lu/%lu", info->max_ipackets, info->rate_stats.ipackets); + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, + info->max_ipackets, info->rate_stats.ipackets); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); - snprintf(buff, sizeof(buff), "%lu/%lu", info->max_opackets, info->rate_stats.opackets); + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, + info->max_opackets, info->rate_stats.opackets); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); - snprintf(buff, sizeof(buff), "%lu/%lu", + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, iBitsTotal(info->rate_stats) / Million, oBitsTotal(info->rate_stats) / Million); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); @@ -285,24 +287,24 @@ pktgen_page_latency(void) info->latency_nb_pkts = 0; info->avg_latency = 0; } - snprintf(buff, sizeof(buff), "%lu", avg_lat); + snprintf(buff, sizeof(buff), "%" PRIu64, avg_lat); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); - snprintf(buff, sizeof(buff), "%lu", info->jitter_threshold); + snprintf(buff, sizeof(buff), "%" PRIu64, info->jitter_threshold); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); - snprintf(buff, sizeof(buff), "%lu", info->jitter_count); + snprintf(buff, sizeof(buff), "%" PRIu64, info->jitter_count); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); - snprintf(buff, sizeof(buff), "%lu", info->prev_stats.ipackets); + snprintf(buff, sizeof(buff), "%" PRIu64, info->prev_stats.ipackets); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); avg_lat = 0; if (info->prev_stats.ipackets) - snprintf(buff, sizeof(buff), "%lu", + snprintf(buff, sizeof(buff), "%" PRIu64, (info->jitter_count * 100) / info->prev_stats.ipackets); else - snprintf(buff, sizeof(buff), "%lu", avg_lat); + snprintf(buff, sizeof(buff), "%" PRIu64, avg_lat); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); @@ -312,15 +314,15 @@ pktgen_page_latency(void) /* Display the total pkts/s for all ports */ col = (COLUMN_WIDTH_1 * display_cnt) + COLUMN_WIDTH_0; row = LINK_STATE_ROW + 1; - snprintf(buff, sizeof(buff), "%lu/%lu", + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, pktgen.max_total_ipackets, pktgen.cumm_rate_totals.ipackets); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_3, buff); scrn_eol(); - snprintf(buff, sizeof(buff), "%lu/%lu", + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, pktgen.max_total_opackets, pktgen.cumm_rate_totals.opackets); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_3, buff); scrn_eol(); - snprintf(buff, sizeof(buff), "%lu/%lu", + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, iBitsTotal(pktgen.cumm_rate_totals) / Million, oBitsTotal(pktgen.cumm_rate_totals) / Million); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_3, buff); diff --git a/app/pktgen-port-cfg.h b/app/pktgen-port-cfg.h index 8f931f4..825297f 100644 --- a/app/pktgen-port-cfg.h +++ b/app/pktgen-port-cfg.h @@ -338,7 +338,7 @@ pktgen_dump_dev_info(FILE *f, const char *msg, struct rte_eth_dev_info *di, uint di->max_vmdq_pools); fprintf( f, - " rx_offload_capa:%4d, tx_offload_capa :%4d, reta_size :%6d, flow_type_rss_offloads:%016lx\n", + " rx_offload_capa:%4d, tx_offload_capa :%4d, reta_size :%6d, flow_type_rss_offloads:%016" PRIx64 "\n", di->rx_offload_capa, di->tx_offload_capa, di->reta_size, diff --git a/app/pktgen-stats.c b/app/pktgen-stats.c index 4719085..15cffd8 100644 --- a/app/pktgen-stats.c +++ b/app/pktgen-stats.c @@ -339,13 +339,15 @@ pktgen_page_stats(void) /* Rx/Tx pkts/s rate */ row = LINK_STATE_ROW + 1; - snprintf(buff, sizeof(buff), "%lu/%lu", info->max_ipackets, rate->ipackets); + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, + info->max_ipackets, rate->ipackets); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); - snprintf(buff, sizeof(buff), "%lu/%lu", info->max_opackets, rate->opackets); + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, + info->max_opackets, rate->opackets); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); - snprintf(buff, sizeof(buff), "%lu/%lu", + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, iBitsTotal(info->rate_stats) / Million, oBitsTotal(info->rate_stats) / Million); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); @@ -360,12 +362,14 @@ pktgen_page_stats(void) scrn_printf(row++, col, "%*llu", COLUMN_WIDTH_1, info->sizes._256_511); scrn_printf(row++, col, "%*llu", COLUMN_WIDTH_1, info->sizes._512_1023); scrn_printf(row++, col, "%*llu", COLUMN_WIDTH_1, info->sizes._1024_1518); - snprintf(buff, sizeof(buff), "%lu/%lu", info->sizes.runt, info->sizes.jumbo); + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, + info->sizes.runt, info->sizes.jumbo); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); /* Rx/Tx Errors */ row = PKT_TOTALS_ROW; - snprintf(buff, sizeof(buff), "%lu/%lu", prev->ierrors, prev->oerrors); + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, + prev->ierrors, prev->oerrors); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); /* Total Rx/Tx */ @@ -376,30 +380,32 @@ pktgen_page_stats(void) scrn_printf(row++, col, "%*llu", COLUMN_WIDTH_1, iBitsTotal(info->prev_stats) / Million); scrn_printf(row++, col, "%*llu", COLUMN_WIDTH_1, oBitsTotal(info->prev_stats) / Million); - snprintf(buff, sizeof(buff), "%lu/%lu", info->stats.arp_pkts, info->stats.echo_pkts); + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, + info->stats.arp_pkts, info->stats.echo_pkts); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); if (pktgen.flags & TX_DEBUG_FLAG) { - snprintf(buff, sizeof(buff), "%lu", info->stats.tx_failed); + snprintf(buff, sizeof(buff), "%" PRIu64, info->stats.tx_failed); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); - snprintf(buff, sizeof(buff), "%lu/%lu", info->tx_pps, info->tx_cycles); + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, + info->tx_pps, info->tx_cycles); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); - snprintf(buff, sizeof(buff), "%lu", info->stats.imissed); + snprintf(buff, sizeof(buff), "%" PRIu64, info->stats.imissed); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); #if RTE_VERSION < RTE_VERSION_NUM(2, 2, 0, 0) - snprintf(buff, sizeof(buff), "%lu", info->stats.ibadcrc); + snprintf(buff, sizeof(buff), "%" PRIu64, info->stats.ibadcrc); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); - snprintf(buff, sizeof(buff), "%lu", info->stats.ibadlen); + snprintf(buff, sizeof(buff), "%" PRIu64, info->stats.ibadlen); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); #endif #if RTE_VERSION < RTE_VERSION_NUM(16, 4, 0, 0) - snprintf(buff, sizeof(buff), "%lu", info->stats.imcasts); + snprintf(buff, sizeof(buff), "%" PRIu64, info->stats.imcasts); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); #else scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, "None"); #endif - snprintf(buff, sizeof(buff), "%lu", info->stats.rx_nombuf); + snprintf(buff, sizeof(buff), "%" PRIu64, info->stats.rx_nombuf); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff); } display_cnt++; @@ -408,15 +414,15 @@ pktgen_page_stats(void) /* Display the total pkts/s for all ports */ col = (COLUMN_WIDTH_1 * display_cnt) + COLUMN_WIDTH_0; row = LINK_STATE_ROW + 1; - snprintf(buff, sizeof(buff), "%lu/%lu", + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, pktgen.max_total_ipackets, cumm->ipackets); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_3, buff); scrn_eol(); - snprintf(buff, sizeof(buff), "%lu/%lu", + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, pktgen.max_total_opackets, cumm->opackets); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_3, buff); scrn_eol(); - snprintf(buff, sizeof(buff), "%lu/%lu", + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, iBitsTotal(pktgen.cumm_rate_totals) / Million, oBitsTotal(pktgen.cumm_rate_totals) / Million); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_3, buff); @@ -553,7 +559,8 @@ pktgen_page_phys_stats(void) rte_eth_stats_get(pid, &stats); - snprintf(buff, sizeof(buff), "%lu/%lu", s->ipackets, s->opackets); + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, + s->ipackets, s->opackets); /* Total Rx/Tx */ scrn_printf(row++, col, "%*s", COLUMN_WIDTH_3, buff); @@ -568,7 +575,8 @@ pktgen_page_phys_stats(void) rte_eth_stats_get(pid, &stats); - snprintf(buff, sizeof(buff), "%lu/%lu", s->ierrors, s->imissed); + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, + s->ierrors, s->imissed); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_3, buff); } @@ -584,7 +592,8 @@ pktgen_page_phys_stats(void) rte_eth_stats_get(pid, &stats); r = &pktgen.info[pid].rate_stats; - snprintf(buff, sizeof(buff), "%lu/%lu", r->ipackets, r->opackets); + snprintf(buff, sizeof(buff), "%" PRIu64 "/%" PRIu64, + r->ipackets, r->opackets); scrn_printf(row++, col, "%*s", COLUMN_WIDTH_3, buff); } diff --git a/lib/cli/cli_cmds.c b/lib/cli/cli_cmds.c index 92ef412..4322e56 100644 --- a/lib/cli/cli_cmds.c +++ b/lib/cli/cli_cmds.c @@ -423,9 +423,9 @@ sizes_cmd(int argc, char **argv) return 0; } - cli_printf(" sizeof(struct cli) %lu\n", sizeof(struct cli)); - cli_printf(" sizeof(struct cli_node) %lu\n", sizeof(struct cli_node)); - cli_printf(" sizeof(args_t) %lu\n", sizeof(args_t)); + cli_printf(" sizeof(struct cli) %zu\n", sizeof(struct cli)); + cli_printf(" sizeof(struct cli_node) %zu\n", sizeof(struct cli_node)); + cli_printf(" sizeof(args_t) %zu\n", sizeof(args_t)); cli_printf(" Total number of Nodes %d\n", this_cli->nb_nodes); cli_printf(" Number History lines %d\n", this_cli->nb_hist); cli_printf(" CLI_DEFAULT_NB_NODES %d\n", CLI_DEFAULT_NB_NODES); diff --git a/lib/common/port_config.c b/lib/common/port_config.c index f742576..c3b427a 100644 --- a/lib/common/port_config.c +++ b/lib/common/port_config.c @@ -194,7 +194,7 @@ create_blacklist(uint64_t portmask, return 0; fprintf(stdout, - "Ports: Port Mask: %016lx blacklisted = --, not-blacklisted = ++\n", + "Ports: Port Mask: %016" PRIx64 " blacklisted = --, not-blacklisted = ++\n", portmask); idx = 0; for (i = 0; i < port_cnt; i++) {