Date: Mon, 27 Jun 2016 09:39:19 GMT From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305585 - soc2016/vincenzo/head/sys/dev/netmap Message-ID: <201606270939.u5R9dJEO035478@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: vincenzo Date: Mon Jun 27 09:39:19 2016 New Revision: 305585 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305585 Log: freebsd: ptnet_rx_eof: use for construct to avoid goto Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Mon Jun 27 09:35:36 2016 (r305584) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Mon Jun 27 09:39:19 2016 (r305585) @@ -1323,9 +1323,8 @@ struct netmap_kring *kring = na->rx_rings + pq->kring_id; struct netmap_ring *ring = kring->ring; unsigned int const lim = kring->nkr_num_slots - 1; - unsigned int budget = PTNET_RX_BUDGET; - unsigned int head = ring->head; struct ifnet *ifp = sc->ifp; + unsigned int budget, head; PTNET_Q_LOCK(pq); @@ -1335,7 +1334,9 @@ kring->nr_kflags &= ~NKR_PENDINTR; - while (head != ring->tail && budget) { + for (head = ring->head, budget = PTNET_RX_BUDGET; + head != ring->tail && budget; + head = nm_next(head, lim), budget--) { struct netmap_slot *slot = ring->slot + head; unsigned int nmbuf_len = slot->len; uint8_t *nmbuf = NMB(na, slot); @@ -1344,7 +1345,7 @@ if (unlikely(nmbuf_len > MCLBYTES)) { RD(1, "Dropping long frame: len %u > %u", nmbuf_len, MCLBYTES); - goto next; + continue; } DBG(device_printf(sc->dev, "%s: h %u t %u rcv frame len %u\n", @@ -1371,9 +1372,6 @@ PTNET_Q_UNLOCK(pq); (*ifp->if_input)(ifp, m); PTNET_Q_LOCK(pq); -next: - head = nm_next(head, lim); - budget--; } if (budget != PTNET_RX_BUDGET) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606270939.u5R9dJEO035478>