The branch stable/13 has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=25e0844eda663f82f270b959df9e0935982044d3

commit 25e0844eda663f82f270b959df9e0935982044d3
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2023-02-27 18:41:58 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
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;

Reply via email to