Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Nov 2014 22:51:56 +0000 (UTC)
From:      eclectic 923 <eclectic923@yahoo.com>
To:        "net@freebsd.org" <net@freebsd.org>
Subject:   Re: Patches for linux virtio_net driver
Message-ID:  <30479248.2784505.1416610316088.JavaMail.yahoo@jws106129.mail.bf1.yahoo.com>

next in thread | raw e-mail | index | archive | help
Sorry, having problems sending attachments as plain text.
Here's virtio_netmap.patch:


 
# This file is a patch to the netmap virtio_net driver include file.
# There is a problem with the initialization, and during read packet with
# control of the indicies .
#
# This problem is easily seen by building a KVM netmap/virtio_net driver, and
# simply pinging it (host pings KVM guest). All goes well, until ring buffer
# reaches index 255, and no packet is actually received. This will fix that
# problem and resulted in a working driver.
#
Index: b/LINUX/virtio_netmap.h
===================================================================
--- a/LINUX/virtio_netmap.h     2014-11-21 16:26:03.951278021 -0500
+++ b/LINUX/virtio_netmap.h     2014-11-21 16:26:25.451386665 -0500
@@ -398,8 +398,8 @@
* Second part: skip past packets that userspace has released.
*/
nm_i = kring->nr_hwcur; /* netmap ring index */
-       if (nm_i != head) {
-               for (n = 0; nm_i != head; n++) {
+       if (nm_next(nm_i, lim) != head) {
+               for (n = 0; nm_next(nm_i, lim) != head; n++) {
struct netmap_slot *slot = &ring->slot[nm_i];
void *addr = NMB(slot);
int err;
@@ -421,7 +421,7 @@
virtqueue_kick(vq);
nm_i = nm_next(nm_i, lim);
}
-               kring->nr_hwcur = head;
+               kring->nr_hwcur = nm_i;
}

/* We have finished processing used RX buffers, so we have to tell
@@ -454,6 +454,7 @@
for (r = 0; r < na->num_rx_rings; r++) {
COMPAT_DECL_SG
struct netmap_ring *ring = na->rx_rings[r].ring;
+               struct netmap_kring *kring = &na->rx_rings[r];
struct virtqueue *vq = GET_RX_VQ(vi, r);
struct scatterlist *sg = GET_RX_SG(vi, r);
struct netmap_slot* slot;
@@ -485,6 +486,7 @@
if (VQ_FULL(vq, err))
break;
}
+               kring->nr_hwcur = i;
D("added %d inbufs on queue %d", i, r);
virtqueue_kick(vq);
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?30479248.2784505.1416610316088.JavaMail.yahoo>