rte_virtio: move vtpci reset out of virtio_dev_free

This is required for future changes.
The general idea is to provide separate
virtio_dev_construct and virtio_dev_init
functions. construct would just allocate
and setup the struct data, while init
would be the one to start the device via
MMIO/vhost-user. If we want to destruct
a non-initialized device, there's no
need to do a reset.

Change-Id: Ib8ce56169e86e43fba8fcd1bf6c2a5b12ed99966
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/385421
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-11-02 17:33:18 +01:00 committed by Jim Harris
parent 191b45d056
commit da5ba48996
2 changed files with 3 additions and 1 deletions

View File

@ -576,6 +576,7 @@ scan_target_abort(struct virtio_scsi_scan_base *base, int error)
}
TAILQ_REMOVE(&g_virtio_driver.init_ctrlrs, base->vdev, tailq);
vtpci_reset(base->vdev);
virtio_dev_free(base->vdev);
@ -1100,6 +1101,7 @@ bdev_virtio_scsi_free(struct virtio_dev *vdev)
virtio_dev_release_queue(vdev, VIRTIO_SCSI_REQUESTQ);
}
vtpci_reset(vdev);
virtio_dev_free(vdev);
}
@ -1219,6 +1221,7 @@ bdev_virtio_finish(void)
vq->poller_ctx = NULL;
virtio_dev_release_queue(vdev, VIRTIO_SCSI_CONTROLQ);
}
vtpci_reset(vdev);
virtio_dev_free(vdev);
}
}

View File

@ -289,7 +289,6 @@ virtio_dev_free(struct virtio_dev *dev)
{
uint32_t vdev_id = dev->id;
vtpci_reset(dev);
virtio_free_queues(dev);
vtpci_ops(dev)->free_vdev(dev);
vtpci_deinit(vdev_id);