socsvn commit: r305294 - soc2016/vincenzo/head/sys/dev/netmap
vincenzo at FreeBSD.org
vincenzo at FreeBSD.org
Fri Jun 17 16:23:47 UTC 2016
Author: vincenzo
Date: Fri Jun 17 16:23:46 2016
New Revision: 305294
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305294
Log:
freebsd: ptnet_rx_eof: add mbuf allocation
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 Jun 17 16:23:37 2016 (r305293)
+++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 17 16:23:46 2016 (r305294)
@@ -1167,8 +1167,18 @@
struct netmap_slot *slot = ring->slot + head;
unsigned int nmbuf_len = slot->len;
uint8_t *nmbuf = NMB(na, slot);
- struct mbuf *m = NULL;
+ struct mbuf *m;
+ if (unlikely(nmbuf_len > MCLBYTES)) {
+ RD(1, "Dropping long frame: len %u > %u",
+ nmbuf_len, MCLBYTES);
+ goto next;
+ }
+
+ /* 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. */
+ m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
if (unlikely(m == NULL)) {
device_printf(sc->dev, "%s: failed to allocate mbuf"
"(len=%d)\n", __func__, nmbuf_len);
@@ -1187,7 +1197,7 @@
PTNET_Q_UNLOCK(pq);
(*ifp->if_input)(ifp, m);
PTNET_Q_LOCK(pq);
-
+next:
head = nm_next(head, lim);
budget--;
}
More information about the svn-soc-all
mailing list