From owner-svn-soc-all@freebsd.org Fri Jul 8 15:43:45 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DC6FB824FF for ; Fri, 8 Jul 2016 15:43:45 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 574B3119B for ; Fri, 8 Jul 2016 15:43:45 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u68Fhju2007434 for ; Fri, 8 Jul 2016 15:43:45 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u68FhiOj007409 for svn-soc-all@FreeBSD.org; Fri, 8 Jul 2016 15:43:44 GMT (envelope-from vincenzo@FreeBSD.org) Date: Fri, 8 Jul 2016 15:43:44 GMT Message-Id: <201607081543.u68FhiOj007409@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305825 - soc2016/vincenzo/head/sys/dev/netmap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2016 15:43:45 -0000 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,