Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/net/lib/libvirtif When sending, only load mbufs whi...



details:   https://anonhg.NetBSD.org/src/rev/c088f36d1575
branches:  trunk
changeset: 327602:c088f36d1575
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Mar 12 17:49:13 2014 +0000

description:
When sending, only load mbufs which have a length.  This is especially
useful for fragmented datagrams where the tail of the first packet is
full of nothing.

diffstat:

 sys/rump/net/lib/libvirtif/if_virt.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (38 lines):

diff -r 1163e4fc23a5 -r c088f36d1575 sys/rump/net/lib/libvirtif/if_virt.c
--- a/sys/rump/net/lib/libvirtif/if_virt.c      Wed Mar 12 16:37:01 2014 +0000
+++ b/sys/rump/net/lib/libvirtif/if_virt.c      Wed Mar 12 17:49:13 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_virt.c,v 1.39 2014/03/03 13:56:40 pooka Exp $       */
+/*     $NetBSD: if_virt.c,v 1.40 2014/03/12 17:49:13 pooka Exp $       */
 
 /*
  * Copyright (c) 2008, 2013 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.39 2014/03/03 13:56:40 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.40 2014/03/12 17:49:13 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -296,12 +296,15 @@
                }
 
                m = m0;
-               for (i = 0; i < LB_SH && m; i++) {
-                       io[i].iov_base = mtod(m, void *);
-                       io[i].iov_len = m->m_len;
+               for (i = 0; i < LB_SH && m; ) {
+                       if (m->m_len) {
+                               io[i].iov_base = mtod(m, void *);
+                               io[i].iov_len = m->m_len;
+                               i++;
+                       }
                        m = m->m_next;
                }
-               if (i == LB_SH)
+               if (i == LB_SH && m)
                        panic("lazy bum");
                bpf_mtap(ifp, m0);
 



Home | Main Index | Thread Index | Old Index