From nobody Mon Mar 13 15:53:28 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pb1Qw3X1Yz3xscF; Mon, 13 Mar 2023 15:53:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pb1Qw30JRz484X; Mon, 13 Mar 2023 15:53:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678722808; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wPTJjMiDtyaH7wBzcziudKgX8vELppY68E2JefbG9pc=; b=tdsw15BkZXeLpOtdKF9GAdHWN6lATru6CdjB43Or5wBTR0nSb3wnVDnCedYEnKmdQMMswB hOdA7bjAcRfUaeZN/mUECjJY1qJbyqBAatfMgMAg+e3dK9T9oRlq9tSWkEL7yvBCodeLVB zkQouqFCSMZaODTcEXffaHgwHImaV9p1Qrkt5JUsN3xyGPVsRGxrdZ2JuXiUjrPtVzVILe I0L2RBVUoDY6JAXvItpt+32mtNaWpduhAqG6WH5xaneS1toM0RI/qWNYq1Auz1FAglyiNL x617j92c2UFNp1tLevI9cWBbSHLFPq8BeXBncYKrEz66Ly2zJS4xbAB8U6Yd3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678722808; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wPTJjMiDtyaH7wBzcziudKgX8vELppY68E2JefbG9pc=; b=bnedotS/Bl4LFAPVtcvl97nx8YVLaA5ngvZuGU2zBPmRLqZKON+qhpoNgszKAY1acvRZk5 CeD6hOZ/Rv3wEAEQx7nXexKz2YzdXhdg/ypOb2c0qxqQOYAxn4XeIZeEe1nj3E5yhWg2A6 lIKjPIgjdzIKVppvNCaqCcihsYypdmg/MCLRJblUCUNQSaUk/HpNNAijhlBTaSnJeTW4VL grj5MDm2szs38Bay+O1pqamRk30UMaGQQrMKBtQqB2vGCoAXE/1GmxCBX2ltwGUxICyESP ypjzEuu1bcuaLRl5N/i9VDypIoFxW66fnX2AdNrIXO9saCueGXbS7mawhkOyGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678722808; a=rsa-sha256; cv=none; b=Oqd99kg5zZc7nSnBjSXywDNm3nhqC0iK1ZnDECrwOcWTtBJLNBLB3naGCFSpxHUA7khIaw FaTaSEQSN8NsNyVGO8ep1PKPwGjDo7EdEo+YqN8/WSDUg2wo3sD9Py7phFmAg8dDADxFoI /2gAUu5myVvPdtucVaYiUBd74Pazzlmm+Bm6mc9bsq8EUQ8ooEpkgRXYU/yWZHh1U7PFcL nv6yen9T4cZiL+j+pIjYYfk0OqzUUHFOHNT7Bu17xyiHjS8/e4DCjJWSoAdObf+gg4is1Z 1htfGsf7VDN+1Z+kMDxIO/WG36SFcjjI3EJEtBo/oyY1QY8Ay1JyK+Tt0BjYfQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pb1Qw23thzytT; Mon, 13 Mar 2023 15:53:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32DFrSxs039868; Mon, 13 Mar 2023 15:53:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32DFrSlT039867; Mon, 13 Mar 2023 15:53:28 GMT (envelope-from git) Date: Mon, 13 Mar 2023 15:53:28 GMT Message-Id: <202303131553.32DFrSlT039867@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 25e0844eda66 - stable/13 - netmap: Fix compiler warnings in tools List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 25e0844eda663f82f270b959df9e0935982044d3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=25e0844eda663f82f270b959df9e0935982044d3 commit 25e0844eda663f82f270b959df9e0935982044d3 Author: Mark Johnston AuthorDate: 2023-02-27 18:41:58 +0000 Commit: Mark Johnston CommitDate: 2023-03-13 15:53:16 +0000 netmap: Fix compiler warnings in tools - Remove write-only variables, or hide them in cases where their use is conditional or commented out. - Check for errors from cmd_apply() in nmreplay. - Use ANSI C definitions. Reviewed by: vmaffione MFC after: 2 weeks Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D38752 (cherry picked from commit 538c66eabda55afccebc25fb66548115e5ed8151) --- tools/tools/netmap/lb.c | 5 ++--- tools/tools/netmap/nmreplay.c | 2 ++ tools/tools/netmap/pkt-gen.c | 12 +++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tools/tools/netmap/lb.c b/tools/tools/netmap/lb.c index 778360d9ed6a..66d7aab8f6e1 100644 --- a/tools/tools/netmap/lb.c +++ b/tools/tools/netmap/lb.c @@ -388,7 +388,8 @@ static void sigint_h(int sig) signal(SIGINT, SIG_DFL); } -static void usage() +static void +usage(void) { printf("usage: lb [options]\n"); printf("where options are:\n"); @@ -617,7 +618,6 @@ int main(int argc, char **argv) int ch; uint32_t i; int rv; - unsigned int iter = 0; int poll_timeout = 10; /* default */ glob_arg.ifname[0] = '\0'; @@ -897,7 +897,6 @@ run: while (!do_abort) { u_int polli = 0; - iter++; for (i = 0; i < npipes; ++i) { struct netmap_ring *ring = ports[i].ring; diff --git a/tools/tools/netmap/nmreplay.c b/tools/tools/netmap/nmreplay.c index e0a9e2146119..390877677403 100644 --- a/tools/tools/netmap/nmreplay.c +++ b/tools/tools/netmap/nmreplay.c @@ -1249,6 +1249,8 @@ main(int argc, char **argv) err += cmd_apply(delay_cfg, d[i], qs, &qs->c_delay); err += cmd_apply(bw_cfg, b[i], qs, &qs->c_bw); err += cmd_apply(loss_cfg, l[i], qs, &qs->c_loss); + if (err != 0) + exit(1); } pthread_create(&bp[0].cons_tid, NULL, nmreplay_main, (void*)&bp[0]); diff --git a/tools/tools/netmap/pkt-gen.c b/tools/tools/netmap/pkt-gen.c index c6cf78ad85ee..b06fef05579d 100644 --- a/tools/tools/netmap/pkt-gen.c +++ b/tools/tools/netmap/pkt-gen.c @@ -1306,7 +1306,7 @@ ping_body(void *data) struct targ *targ = (struct targ *) data; struct pollfd pfd = { .fd = targ->fd, .events = POLLIN }; struct netmap_if *nifp = targ->nmd->nifp; - int i, m, rx = 0; + int i, m; void *frame; int size; struct timespec ts, now, last_print; @@ -1399,7 +1399,9 @@ ping_body(void *data) } #endif /* BUSYWAIT */ /* see what we got back */ - rx = 0; +#ifdef BUSYWAIT + int rx = 0; +#endif for (i = targ->nmd->first_rx_ring; i <= targ->nmd->last_rx_ring; i++) { ring = NETMAP_RXRING(nifp, i); @@ -1434,7 +1436,9 @@ ping_body(void *data) buckets[pos]++; /* now store it in a bucket */ ring->head = ring->cur = nm_ring_next(ring, ring->head); +#ifdef BUSYWAIT rx++; +#endif } } //D("tx %d rx %d", sent, rx); @@ -1502,7 +1506,7 @@ pong_body(void *data) struct pollfd pfd = { .fd = targ->fd, .events = POLLIN }; struct netmap_if *nifp = targ->nmd->nifp; struct netmap_ring *txring, *rxring; - int i, rx = 0; + int i; uint64_t sent = 0, n = targ->g->npackets; if (targ->g->nthreads > 1) { @@ -1544,7 +1548,6 @@ pong_body(void *data) src = NETMAP_BUF(rxring, slot->buf_idx); //D("got pkt %p of size %d", src, slot->len); rxring->head = rxring->cur = nm_ring_next(rxring, head); - rx++; if (txavail == 0) continue; dst = NETMAP_BUF(txring, @@ -1579,7 +1582,6 @@ pong_body(void *data) #ifdef BUSYWAIT ioctl(pfd.fd, NIOCTXSYNC, NULL); #endif - //D("tx %d rx %d", sent, rx); } targ->completed = 1;