Author: mav
Date: Sun Mar 15 16:09:39 2015
New Revision: 280041
URL: https://svnweb.freebsd.org/changeset/base/280041

Log:
  Fix networking problem after r280026.
  
  I've missed that network driver sometimes returns taken request back to
  available queue without processing.  Add new helper function for that case.
  
  Reported by:  flo
  MFC after:    2 weeks

Modified:
  head/usr.sbin/bhyve/pci_virtio_net.c
  head/usr.sbin/bhyve/virtio.c
  head/usr.sbin/bhyve/virtio.h

Modified: head/usr.sbin/bhyve/pci_virtio_net.c
==============================================================================
--- head/usr.sbin/bhyve/pci_virtio_net.c        Sun Mar 15 15:29:03 2015        
(r280040)
+++ head/usr.sbin/bhyve/pci_virtio_net.c        Sun Mar 15 16:09:39 2015        
(r280041)
@@ -342,6 +342,7 @@ pci_vtnet_tap_rx(struct pci_vtnet_softc 
                         * No more packets, but still some avail ring
                         * entries.  Interrupt if needed/appropriate.
                         */
+                       vq_retchain(vq);
                        vq_endchains(vq, 0);
                        return;
                }

Modified: head/usr.sbin/bhyve/virtio.c
==============================================================================
--- head/usr.sbin/bhyve/virtio.c        Sun Mar 15 15:29:03 2015        
(r280040)
+++ head/usr.sbin/bhyve/virtio.c        Sun Mar 15 16:09:39 2015        
(r280041)
@@ -372,8 +372,21 @@ loopy:
 }
 
 /*
- * Return the currently-first request chain to the guest, setting
- * its I/O length to the provided value.
+ * Return the currently-first request chain back to the available queue.
+ *
+ * (This chain is the one you handled when you called vq_getchain()
+ * and used its positive return value.)
+ */
+void
+vq_retchain(struct vqueue_info *vq)
+{
+
+       vq->vq_last_avail--;
+}
+
+/*
+ * Return specified request chain to the guest, setting its I/O length
+ * to the provided value.
  *
  * (This chain is the one you handled when you called vq_getchain()
  * and used its positive return value.)

Modified: head/usr.sbin/bhyve/virtio.h
==============================================================================
--- head/usr.sbin/bhyve/virtio.h        Sun Mar 15 15:29:03 2015        
(r280040)
+++ head/usr.sbin/bhyve/virtio.h        Sun Mar 15 16:09:39 2015        
(r280041)
@@ -453,6 +453,7 @@ void        vi_set_io_bar(struct virtio_softc *
 
 int    vq_getchain(struct vqueue_info *vq, uint16_t *pidx,
                    struct iovec *iov, int n_iov, uint16_t *flags);
+void   vq_retchain(struct vqueue_info *vq);
 void   vq_relchain(struct vqueue_info *vq, uint16_t idx, uint32_t iolen);
 void   vq_endchains(struct vqueue_info *vq, int used_all_avail);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to