diff options
author | grehan <grehan@FreeBSD.org> | 2012-12-12 19:45:36 +0000 |
---|---|---|
committer | grehan <grehan@FreeBSD.org> | 2012-12-12 19:45:36 +0000 |
commit | 56990e914687fa80fb72b9d4dbbfc174ede6bc6d (patch) | |
tree | 497be5ab0db79e571442c08b549b9daf47eeeaa5 /usr.sbin | |
parent | da369593398d675703857dee838cef0fe00d4082 (diff) | |
download | FreeBSD-src-56990e914687fa80fb72b9d4dbbfc174ede6bc6d.zip FreeBSD-src-56990e914687fa80fb72b9d4dbbfc174ede6bc6d.tar.gz |
Properly reset the tx/rx rings when a guest requests a device reset.
Obtained from: NetApp
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bhyve/pci_virtio_net.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/usr.sbin/bhyve/pci_virtio_net.c b/usr.sbin/bhyve/pci_virtio_net.c index be848c6..9e7a1c7 100644 --- a/usr.sbin/bhyve/pci_virtio_net.c +++ b/usr.sbin/bhyve/pci_virtio_net.c @@ -178,10 +178,29 @@ pci_vtnet_qsize(int qnum) } static void +pci_vtnet_ring_reset(struct pci_vtnet_softc *sc, int ring) +{ + struct vring_hqueue *hq; + + assert(ring < VTNET_MAXQ); + + hq = &sc->vsc_hq[ring]; + + /* + * Reset all soft state + */ + hq->hq_cur_aidx = 0; +} + +static void pci_vtnet_update_status(struct pci_vtnet_softc *sc, uint32_t value) { + if (value == 0) { DPRINTF(("vtnet: device reset requested !\n")); + pci_vtnet_ring_reset(sc, VTNET_RXQ); + pci_vtnet_ring_reset(sc, VTNET_TXQ); + sc->vsc_rx_ready = 0; } sc->vsc_status = value; |