Index: head/usr.sbin/bhyve/pci_virtio_net.c =================================================================== --- head/usr.sbin/bhyve/pci_virtio_net.c +++ head/usr.sbin/bhyve/pci_virtio_net.c @@ -381,7 +381,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ * 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_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()))