socsvn commit: r305827 - soc2016/vincenzo/head/sys/dev/netmap

vincenzo at FreeBSD.org vincenzo at FreeBSD.org
Fri Jul 8 15:44:04 UTC 2016


Author: vincenzo
Date: Fri Jul  8 15:44:03 2016
New Revision: 305827
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305827

Log:
   freebsd: ptnet_rx_slot: remove mtail_p argument, use return value

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:52 2016	(r305826)
+++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c	Fri Jul  8 15:44:03 2016	(r305827)
@@ -1532,10 +1532,9 @@
 	return ptnet_drain_transmit_queue(pq);
 }
 
-static inline int
-ptnet_rx_slot(uint8_t *nmbuf, unsigned int nmbuf_len, struct mbuf **mtail_p)
+static inline struct mbuf *
+ptnet_rx_slot(struct mbuf *mtail, uint8_t *nmbuf, unsigned int nmbuf_len)
 {
-	struct mbuf *mtail = *mtail_p;
 	uint8_t *mdata = mtod(mtail, uint8_t *) + mtail->m_len;
 
 	do {
@@ -1546,11 +1545,11 @@
 
 			mf = m_getcl(M_NOWAIT, MT_DATA, 0);
 			if (unlikely(!mf)) {
-				return ENOMEM;
+				return NULL;
 			}
 
 			mtail->m_next = mf;
-			mtail = *mtail_p = mf;
+			mtail = mf;
 			mdata = mtod(mtail, uint8_t *);
 			mtail->m_len = 0;
 		}
@@ -1568,7 +1567,7 @@
 		mtail->m_len += copy;
 	} while (nmbuf_len);
 
-	return 0;
+	return mtail;
 }
 
 static int
@@ -1641,8 +1640,6 @@
 
 		/* Scan all the netmap slots containing the current packet. */
 		for (;;) {
-			int err;
-
 			slot = ring->slot + head;
 			mhead->m_pkthdr.len += slot->len;
 
@@ -1651,8 +1648,8 @@
 					  head, ring->tail, slot->len,
 					  slot->flags));
 
-			err = ptnet_rx_slot(NMB(na, slot), slot->len, &mtail);
-			if (unlikely(err)) {
+			mtail = ptnet_rx_slot(mtail, NMB(na, slot), slot->len);
+			if (unlikely(!mtail)) {
 				/* Ouch. We ran out of memory while processing
 				 * a packet. We have to restore the previous
 				 * head position, free the mbuf chain, and


More information about the svn-soc-all mailing list