From owner-svn-soc-all@freebsd.org Fri Jul 8 15:43:54 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 00088B82520 for ; Fri, 8 Jul 2016 15:43:53 +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 CF88B11B1 for ; Fri, 8 Jul 2016 15:43:53 +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 u68Fhrks007631 for ; Fri, 8 Jul 2016 15:43:53 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u68Fhrke007628 for svn-soc-all@FreeBSD.org; Fri, 8 Jul 2016 15:43:53 GMT (envelope-from vincenzo@FreeBSD.org) Date: Fri, 8 Jul 2016 15:43:53 GMT Message-Id: <201607081543.u68Fhrke007628@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: r305826 - 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:54 -0000 Author: vincenzo Date: Fri Jul 8 15:43:52 2016 New Revision: 305826 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305826 Log: freebsd: ptnet_rx_slot: remove argument and cache pointers 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:44 2016 (r305825) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jul 8 15:43:52 2016 (r305826) @@ -1533,13 +1533,15 @@ } static inline int -ptnet_rx_slot(uint8_t *nmbuf, unsigned int nmbuf_len, struct mbuf **mtail, - uint8_t **mdata) +ptnet_rx_slot(uint8_t *nmbuf, unsigned int nmbuf_len, struct mbuf **mtail_p) { + struct mbuf *mtail = *mtail_p; + uint8_t *mdata = mtod(mtail, uint8_t *) + mtail->m_len; + do { unsigned int copy; - if ((*mtail)->m_len == MCLBYTES) { + if (mtail->m_len == MCLBYTES) { struct mbuf *mf; mf = m_getcl(M_NOWAIT, MT_DATA, 0); @@ -1547,23 +1549,23 @@ return ENOMEM; } - (*mtail)->m_next = mf; - (*mtail) = mf; - *mdata = mtod(*mtail, uint8_t *); - (*mtail)->m_len = 0; + mtail->m_next = mf; + mtail = *mtail_p = mf; + mdata = mtod(mtail, uint8_t *); + mtail->m_len = 0; } - copy = MCLBYTES - (*mtail)->m_len; + copy = MCLBYTES - mtail->m_len; if (nmbuf_len < copy) { copy = nmbuf_len; } - memcpy(*mdata, nmbuf, copy); + memcpy(mdata, nmbuf, copy); nmbuf += copy; nmbuf_len -= copy; - *mdata += copy; - (*mtail)->m_len += copy; + mdata += copy; + mtail->m_len += copy; } while (nmbuf_len); return 0; @@ -1590,7 +1592,6 @@ unsigned int prev_head = head; struct mbuf *mhead, *mtail; struct netmap_slot *slot; - uint8_t *mdata; if (head == ring->tail) { /* We ran out of slot, let's see if the host has @@ -1636,7 +1637,6 @@ M_HASHTYPE_SET(mhead, M_HASHTYPE_OPAQUE); /* Initialize state variables. */ - mdata = mtod(mtail, uint8_t *); mtail->m_len = 0; /* Scan all the netmap slots containing the current packet. */ @@ -1651,8 +1651,7 @@ head, ring->tail, slot->len, slot->flags)); - err = ptnet_rx_slot(NMB(na, slot), slot->len, - &mtail, &mdata); + err = ptnet_rx_slot(NMB(na, slot), slot->len, &mtail); if (unlikely(err)) { /* Ouch. We ran out of memory while processing * a packet. We have to restore the previous