Date: Fri, 8 Jul 2016 15:43:44 GMT From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305825 - soc2016/vincenzo/head/sys/dev/netmap Message-ID: <201607081543.u68FhiOj007409@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: vincenzo Date: Fri Jul 8 15:43:44 2016 New Revision: 305825 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305825 Log: freebsd: ptnet_rx_eof: remove redundant local variables 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 Fri Jul 8 15:43:36 2016 (r305824) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jul 8 15:43:44 2016 (r305825) @@ -1590,8 +1590,7 @@ unsigned int prev_head = head; struct mbuf *mhead, *mtail; struct netmap_slot *slot; - unsigned int nmbuf_len; - uint8_t *nmbuf, *mdata; + uint8_t *mdata; if (head == ring->tail) { /* We ran out of slot, let's see if the host has @@ -1615,14 +1614,14 @@ } } - /* Allocate the head of an mbuf chain. + /* Allocate the head of a new mbuf chain. * We use m_getcl() to allocate an mbuf with standard cluster * size (MCLBYTES). In the future we could use m_getjcl() * to choose different sizes. */ mhead = mtail = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (unlikely(mhead == NULL)) { - device_printf(sc->dev, "%s: failed to allocate mbuf\n", - __func__); + device_printf(sc->dev, "%s: failed to allocate mbuf " + "head\n", __func__); break; } @@ -1640,30 +1639,29 @@ mdata = mtod(mtail, uint8_t *); mtail->m_len = 0; + /* Scan all the netmap slots containing the current packet. */ for (;;) { int err; slot = ring->slot + head; - nmbuf_len = slot->len; - nmbuf = NMB(na, slot); - - mhead->m_pkthdr.len += nmbuf_len; + mhead->m_pkthdr.len += slot->len; DBG(device_printf(sc->dev, "%s: h %u t %u rcv frag " "len %u, flags %u\n", __func__, - head, ring->tail, nmbuf_len, + head, ring->tail, slot->len, slot->flags)); - err = ptnet_rx_slot(nmbuf, nmbuf_len, &mtail, &mdata); + err = ptnet_rx_slot(NMB(na, slot), slot->len, + &mtail, &mdata); if (unlikely(err)) { - /* Ouch. We ran out of memory - * while processing a packet. - * We have to restore the - * previous head position, - * free the mbuf chain, and - * schedule the taskqueue to - * give the packet another - * chance. */ + /* Ouch. We ran out of memory while processing + * a packet. We have to restore the previous + * head position, free the mbuf chain, and + * schedule the taskqueue to give the packet + * another chance. */ + device_printf(sc->dev, "%s: failed to allocate" + " mbuf frag, reset head %u --> %u\n", + __func__, head, prev_head); head = prev_head; m_freem(mhead); taskqueue_enqueue(pq->taskq,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607081543.u68FhiOj007409>