Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/xen Remplace MEXTMALLOC/memcpy with m_copyback.



details:   https://anonhg.NetBSD.org/src/rev/db58c9112ad1
branches:  trunk
changeset: 584209:db58c9112ad1
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun Sep 11 11:44:52 2005 +0000

description:
Remplace MEXTMALLOC/memcpy with m_copyback.

diffstat:

 sys/arch/xen/xen/if_xennet.c |  23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)

diffs (54 lines):

diff -r c612b8fd1d9b -r db58c9112ad1 sys/arch/xen/xen/if_xennet.c
--- a/sys/arch/xen/xen/if_xennet.c      Sun Sep 11 08:39:08 2005 +0000
+++ b/sys/arch/xen/xen/if_xennet.c      Sun Sep 11 11:44:52 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_xennet.c,v 1.31 2005/08/21 22:20:28 bouyer Exp $    */
+/*     $NetBSD: if_xennet.c,v 1.32 2005/09/11 11:44:52 bouyer Exp $    */
 
 /*
  *
@@ -33,7 +33,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xennet.c,v 1.31 2005/08/21 22:20:28 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet.c,v 1.32 2005/09/11 11:44:52 bouyer Exp $");
 
 #include "opt_inet.h"
 #include "opt_nfs_boot.h"
@@ -733,12 +733,12 @@
                    (void *)(PTE_BASE[x86_btop
                        (sc->sc_rx_bufa[rx->id].xb_rx.xbrx_va)] & PG_FRAME)));
 
-               m->m_len = m->m_pkthdr.len = rx->status;
                m->m_pkthdr.rcvif = ifp;
                if (sc->sc_rx->req_prod != sc->sc_rx->resp_prod) {
+                       m->m_len = m->m_pkthdr.len = rx->status;
                        MEXTADD(m, (void *)(sc->sc_rx_bufa[rx->id].xb_rx.
-                           xbrx_va + (rx->addr & PAGE_MASK)), rx->status, M_DEVBUF,
-                           xennet_rx_mbuf_free,
+                           xbrx_va + (rx->addr & PAGE_MASK)), rx->status,
+                           M_DEVBUF, xennet_rx_mbuf_free,
                            &sc->sc_rx_bufa[rx->id]);
                } else {
                        /*
@@ -746,14 +746,11 @@
                         * memory, copy data and push the receive
                         * buffer back to the hypervisor.
                         */
-                       MEXTMALLOC(m, rx->status, M_DONTWAIT);
-                       if ((m->m_flags & M_EXT) == 0) {
-                               printf("xennet: rx no mbuf 2\n");
-                               m_free(m);
-                               break;
-                       }
-                       memcpy(m->m_data, (void *)(sc->sc_rx_bufa[rx->id].
-                           xb_rx.xbrx_va + (rx->addr & PAGE_MASK)), rx->status);
+                       m->m_len = MHLEN;
+                       m->m_pkthdr.len = 0;
+                       m_copyback(m, 0, rx->status, 
+                           (caddr_t)(sc->sc_rx_bufa[rx->id].xb_rx.xbrx_va +
+                           (rx->addr & PAGE_MASK)));
                        xennet_rx_push_buffer(sc, rx->id);
                }
 



Home | Main Index | Thread Index | Old Index