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
This commit is contained in:
@@ -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 @@ int main(int argc, char **argv)
|
||||
|
||||
while (!do_abort) {
|
||||
u_int polli = 0;
|
||||
iter++;
|
||||
|
||||
for (i = 0; i < npipes; ++i) {
|
||||
struct netmap_ring *ring = ports[i].ring;
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user