Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sys/arch/xen/xen Pull up following revision(s) (requested...
details: https://anonhg.NetBSD.org/src/rev/c4275ffaac36
branches: netbsd-7
changeset: 800170:c4275ffaac36
user: snj <snj%NetBSD.org@localhost>
date: Sun Mar 26 16:08:12 2017 +0000
description:
Pull up following revision(s) (requested by bouyer in ticket #1379):
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.70 via patch
Try to be smarted in the rx path: if the packet is small enough copy the
data to the mbuf's data area instead of allocating a new page from the pool.
While there fix a struct xennet_rxreq leak if xennet_checksum_fill()
fails with ENOMEM.
diffstat:
sys/arch/xen/xen/if_xennet_xenbus.c | 43 ++++++++++++++++++++++--------------
1 files changed, 26 insertions(+), 17 deletions(-)
diffs (69 lines):
diff -r 7f6710e5ce0f -r c4275ffaac36 sys/arch/xen/xen/if_xennet_xenbus.c
--- a/sys/arch/xen/xen/if_xennet_xenbus.c Sun Mar 26 16:05:40 2017 +0000
+++ b/sys/arch/xen/xen/if_xennet_xenbus.c Sun Mar 26 16:08:12 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_xennet_xenbus.c,v 1.63.2.1 2016/03/06 18:52:06 martin Exp $ */
+/* $NetBSD: if_xennet_xenbus.c,v 1.63.2.2 2017/03/26 16:08:12 snj Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -85,7 +85,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.63.2.1 2016/03/06 18:52:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.63.2.2 2017/03/26 16:08:12 snj Exp $");
#include "opt_xen.h"
#include "opt_nfs_boot.h"
@@ -1073,26 +1073,35 @@
MCLAIM(m, &sc->sc_ethercom.ec_rx_mowner);
m->m_pkthdr.rcvif = ifp;
- req->rxreq_va = (vaddr_t)pool_cache_get_paddr(
- if_xennetrxbuf_cache, PR_NOWAIT, &req->rxreq_pa);
- if (__predict_false(req->rxreq_va == 0)) {
- printf("%s: rx no buf\n", ifp->if_xname);
- ifp->if_ierrors++;
- req->rxreq_va = va;
- req->rxreq_pa = pa;
- xennet_rx_free_req(req);
- m_freem(m);
- continue;
+ if (rx->status <= MHLEN) {
+ /* small packet; copy to mbuf data area */
+ m_copyback(m, 0, rx->status, pktp);
+ KASSERT(m->m_pkthdr.len == rx->status);
+ KASSERT(m->m_len == rx->status);
+ } else {
+ /* large packet; attach buffer to mbuf */
+ req->rxreq_va = (vaddr_t)pool_cache_get_paddr(
+ if_xennetrxbuf_cache, PR_NOWAIT, &req->rxreq_pa);
+ if (__predict_false(req->rxreq_va == 0)) {
+ printf("%s: rx no buf\n", ifp->if_xname);
+ ifp->if_ierrors++;
+ req->rxreq_va = va;
+ req->rxreq_pa = pa;
+ xennet_rx_free_req(req);
+ m_freem(m);
+ continue;
+ }
+ m->m_len = m->m_pkthdr.len = rx->status;
+ MEXTADD(m, pktp, rx->status,
+ M_DEVBUF, xennet_rx_mbuf_free, NULL);
+ m->m_ext.ext_paddr = pa;
+ m->m_flags |= M_EXT_RW; /* we own the buffer */
}
- m->m_len = m->m_pkthdr.len = rx->status;
- MEXTADD(m, pktp, rx->status,
- M_DEVBUF, xennet_rx_mbuf_free, NULL);
- m->m_flags |= M_EXT_RW; /* we own the buffer */
- m->m_ext.ext_paddr = pa;
if ((rx->flags & NETRXF_csum_blank) != 0) {
xennet_checksum_fill(&m);
if (m == NULL) {
ifp->if_ierrors++;
+ xennet_rx_free_req(req);
continue;
}
}
Home |
Main Index |
Thread Index |
Old Index