Index: tools/tools/netmap/pkt-gen.c =================================================================== --- tools/tools/netmap/pkt-gen.c +++ tools/tools/netmap/pkt-gen.c @@ -169,7 +169,7 @@ int pkt_size; int burst; int forever; - int npackets; /* total packets to send */ + uint64_t npackets; /* total packets to send */ int frags; /* fragments per packet */ int nthreads; int cpus; @@ -810,10 +810,10 @@ struct targ *targ = (struct targ *) data; struct pollfd pfd = { .fd = targ->fd, .events = POLLIN }; struct netmap_if *nifp = targ->nmd->nifp; - int i, rx = 0, n = targ->g->npackets; + int i, rx = 0; void *frame; int size; - uint32_t sent = 0; + uint64_t sent = 0, n = targ->g->npackets; struct timespec ts, now, last_print; uint32_t count = 0, min = 1000000000, av = 0; @@ -828,7 +828,7 @@ clock_gettime(CLOCK_REALTIME_PRECISE, &last_print); now = last_print; - while (n == 0 || (int)sent < n) { + while (n == 0 || sent < n) { struct netmap_ring *ring = NETMAP_TXRING(nifp, 0); struct netmap_slot *slot; char *p; @@ -878,7 +878,7 @@ ts.tv_nsec += 1000000000; ts.tv_sec--; } - if (1) D("seq %d/%d delta %d.%09d", seq, sent, + if (1) D("seq %d/%lu delta %d.%09d", seq, sent, (int)ts.tv_sec, (int)ts.tv_nsec); if (ts.tv_nsec < (int)min) min = ts.tv_nsec; @@ -919,13 +919,14 @@ struct pollfd pfd = { .fd = targ->fd, .events = POLLIN }; struct netmap_if *nifp = targ->nmd->nifp; struct netmap_ring *txring, *rxring; - int i, rx = 0, sent = 0, n = targ->g->npackets; + int i, rx = 0; + uint64_t sent = 0, n = targ->g->npackets; if (targ->g->nthreads > 1) { D("can only reply ping with 1 thread"); return NULL; } - D("understood ponger %d but don't know how to do it", n); + D("understood ponger %lu but don't know how to do it", n); while (n == 0 || sent < n) { uint32_t txcur, txavail; //#define BUSYWAIT @@ -1066,8 +1067,9 @@ struct pollfd pfd = { .fd = targ->fd, .events = POLLOUT }; struct netmap_if *nifp; struct netmap_ring *txring; - int i, n = targ->g->npackets / targ->g->nthreads; - int64_t sent = 0; + int i; + uint64_t n = targ->g->npackets / targ->g->nthreads; + uint64_t sent = 0; int options = targ->g->options | OPT_COPY; struct timespec nexttime = { 0, 0}; // XXX silence compiler int rate_limit = targ->g->tx_rate; @@ -1157,7 +1159,8 @@ options &= ~OPT_COPY; } for (i = targ->nmd->first_tx_ring; i <= targ->nmd->last_tx_ring; i++) { - int m, limit = rate_limit ? tosend : targ->g->burst; + int m; + uint64_t limit = rate_limit ? tosend : targ->g->burst; if (n > 0 && n - sent < limit) limit = n - sent; txring = NETMAP_TXRING(nifp, i); @@ -1693,7 +1696,7 @@ break; case 'n': - g.npackets = atoi(optarg); + g.npackets = strtoull(optarg, NULL, 10); break; case 'F':