Port-xen archive

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

Re: NetBSD/xen network problems (need help)



Hi,
can you try the attached patch ? obviously m_copyback() doesn't work
the way I though it was, and as it's not even capable of allocating
a cluster when needeed it's probably less efficient than plain MCLGET/memcpy.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: if_xennet.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/if_xennet.c,v
retrieving revision 1.43
diff -u -r1.43 if_xennet.c
--- if_xennet.c 6 Mar 2006 22:04:18 -0000       1.43
+++ if_xennet.c 16 Mar 2006 20:18:49 -0000
@@ -787,16 +787,21 @@
                         * memory, copy data and push the receive
                         * buffer back to the hypervisor.
                         */
-                       m->m_len = MHLEN;
-                       m->m_pkthdr.len = 0;
-                       m_copyback(m, 0, rx->status, pktp);
-                       xennet_rx_push_buffer(sc, rx->id);
-                       if (m->m_pkthdr.len < rx->status) {
-                               /* out of memory, just drop packets */
-                               ifp->if_ierrors++;
-                               m_freem(m);
-                               continue;
+                       if (rx->status > MHLEN) {
+                               MCLGET(m, M_DONTWAIT);
+                               if (__predict_false(
+                                   (m->m_flags & M_EXT) == 0)) {
+                                       /* out of memory, just drop packets */
+                                       ifp->if_ierrors++;
+                                       m_freem(m);
+                                       xennet_rx_push_buffer(sc, rx->id);
+                                       continue;
+                               }
                        }
+                                       
+                       m->m_len = m->m_pkthdr.len = rx->status;
+                       memcpy(mtod(m, void *), pktp, rx->status);
+                       xennet_rx_push_buffer(sc, rx->id);
                }
 
 #ifdef XENNET_DEBUG_DUMP


Home | Main Index | Thread Index | Old Index