summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bhyve/pci_virtio_net.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bhyve/pci_virtio_net.c')
-rw-r--r--usr.sbin/bhyve/pci_virtio_net.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/bhyve/pci_virtio_net.c b/usr.sbin/bhyve/pci_virtio_net.c
index 6f264a7..9f220d1 100644
--- a/usr.sbin/bhyve/pci_virtio_net.c
+++ b/usr.sbin/bhyve/pci_virtio_net.c
@@ -381,7 +381,7 @@ pci_vtnet_tap_rx(struct pci_vtnet_softc *sc)
vq_endchains(vq, 1);
}
-static int
+static __inline int
pci_vtnet_netmap_writev(struct nm_desc *nmd, struct iovec *iov, int iovcnt)
{
int r, i;
@@ -396,7 +396,7 @@ pci_vtnet_netmap_writev(struct nm_desc *nmd, struct iovec *iov, int iovcnt)
r++;
if (r > nmd->last_tx_ring)
r = nmd->first_tx_ring;
- if (r == nmd->cur_rx_ring)
+ if (r == nmd->cur_tx_ring)
break;
continue;
}
@@ -405,6 +405,8 @@ pci_vtnet_netmap_writev(struct nm_desc *nmd, struct iovec *iov, int iovcnt)
buf = NETMAP_BUF(ring, idx);
for (i = 0; i < iovcnt; i++) {
+ if (len + iov[i].iov_len > 2048)
+ break;
memcpy(&buf[len], iov[i].iov_base, iov[i].iov_len);
len += iov[i].iov_len;
}
@@ -418,7 +420,7 @@ pci_vtnet_netmap_writev(struct nm_desc *nmd, struct iovec *iov, int iovcnt)
return (len);
}
-static inline int
+static __inline int
pci_vtnet_netmap_readv(struct nm_desc *nmd, struct iovec *iov, int iovcnt)
{
int len = 0;
@@ -548,6 +550,7 @@ pci_vtnet_netmap_rx(struct pci_vtnet_softc *sc)
* No more packets, but still some avail ring
* entries. Interrupt if needed/appropriate.
*/
+ vq_retchain(vq);
vq_endchains(vq, 0);
return;
}
@@ -884,8 +887,9 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts)
pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_NET);
pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR);
- /* Link is up if we managed to open tap device. */
- sc->vsc_config.status = (opts == NULL || sc->vsc_tapfd >= 0);
+ /* Link is up if we managed to open tap device or vale port. */
+ sc->vsc_config.status = (opts == NULL || sc->vsc_tapfd >= 0 ||
+ sc->vsc_nmd != NULL);
/* use BAR 1 to map MSI-X table and PBA, if we're using MSI-X */
if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix()))
OpenPOWER on IntegriCloud