Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Mar 2015 16:09:40 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r280041 - head/usr.sbin/bhyve
Message-ID:  <201503151609.t2FG9eMc033841@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 



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