virtio: remove virtio_dev_start
Also removed vdev->started field. Used vdev->status field to determine if a device has been `started`. This is simply a cleanup. Change-Id: Ieb06b03b3bd60bd5906b41c987c418604906c913 Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/388296 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
b948246133
commit
86745294ce
@ -1133,12 +1133,6 @@ bdev_virtio_scsi_scan(struct virtio_dev *vdev, virtio_create_device_cb cb_fn, vo
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = virtio_dev_start(vdev);
|
|
||||||
if (rc != 0) {
|
|
||||||
spdk_dma_free(base);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
base->vdev = vdev;
|
base->vdev = vdev;
|
||||||
TAILQ_INIT(&base->found_disks);
|
TAILQ_INIT(&base->found_disks);
|
||||||
|
|
||||||
|
@ -363,33 +363,6 @@ virtio_dev_free(struct virtio_dev *dev)
|
|||||||
free(dev);
|
free(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
virtio_dev_start(struct virtio_dev *vdev)
|
|
||||||
{
|
|
||||||
/* Enable uio/vfio intr/eventfd mapping: althrough we already did that
|
|
||||||
* in device configure, but it could be unmapped when device is
|
|
||||||
* stopped.
|
|
||||||
*/
|
|
||||||
/** TODO: interrupt handling for virtio_scsi */
|
|
||||||
#if 0
|
|
||||||
if (dev->data->dev_conf.intr_conf.lsc ||
|
|
||||||
dev->data->dev_conf.intr_conf.rxq) {
|
|
||||||
rte_intr_disable(dev->intr_handle);
|
|
||||||
|
|
||||||
if (rte_intr_enable(dev->intr_handle) < 0) {
|
|
||||||
PMD_DRV_LOG(ERR, "interrupt enable failed");
|
|
||||||
return -EIO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SPDK_DEBUGLOG(SPDK_TRACE_VIRTIO_DEV, "Notified backend at initialization\n");
|
|
||||||
|
|
||||||
vdev->started = 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vq_ring_free_chain(struct virtqueue *vq, uint16_t desc_idx)
|
vq_ring_free_chain(struct virtqueue *vq, uint16_t desc_idx)
|
||||||
{
|
{
|
||||||
@ -536,17 +509,15 @@ virtqueue_enqueue_xmit(struct virtqueue *vq, struct virtio_req *req)
|
|||||||
uint16_t
|
uint16_t
|
||||||
virtio_recv_pkts(struct virtqueue *vq, struct virtio_req **reqs, uint16_t nb_pkts)
|
virtio_recv_pkts(struct virtqueue *vq, struct virtio_req **reqs, uint16_t nb_pkts)
|
||||||
{
|
{
|
||||||
struct virtio_dev *vdev = vq->vdev;
|
|
||||||
struct virtio_req *rxm;
|
struct virtio_req *rxm;
|
||||||
uint16_t nb_used, num, nb_rx;
|
uint16_t nb_used, num, nb_rx;
|
||||||
uint32_t len[VIRTIO_MBUF_BURST_SZ];
|
uint32_t len[VIRTIO_MBUF_BURST_SZ];
|
||||||
struct virtio_req *rcv_pkts[VIRTIO_MBUF_BURST_SZ];
|
struct virtio_req *rcv_pkts[VIRTIO_MBUF_BURST_SZ];
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
nb_rx = 0;
|
assert(virtio_dev_get_status(vq->vdev) & VIRTIO_CONFIG_S_DRIVER_OK);
|
||||||
if (spdk_unlikely(vdev->started == 0))
|
|
||||||
return nb_rx;
|
|
||||||
|
|
||||||
|
nb_rx = 0;
|
||||||
nb_used = VIRTQUEUE_NUSED(vq);
|
nb_used = VIRTQUEUE_NUSED(vq);
|
||||||
|
|
||||||
virtio_rmb();
|
virtio_rmb();
|
||||||
@ -578,9 +549,7 @@ virtio_xmit_pkt(struct virtqueue *vq, struct virtio_req *req)
|
|||||||
struct virtio_dev *vdev = vq->vdev;
|
struct virtio_dev *vdev = vq->vdev;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (spdk_unlikely(vdev->started == 0))
|
assert(virtio_dev_get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK);
|
||||||
return -EIO;
|
|
||||||
|
|
||||||
virtio_rmb();
|
virtio_rmb();
|
||||||
|
|
||||||
rc = virtqueue_enqueue_xmit(vq, req);
|
rc = virtqueue_enqueue_xmit(vq, req);
|
||||||
|
@ -67,7 +67,6 @@ struct virtio_dev {
|
|||||||
|
|
||||||
/** Name of this virtio dev set by backend */
|
/** Name of this virtio dev set by backend */
|
||||||
char *name;
|
char *name;
|
||||||
uint16_t started;
|
|
||||||
|
|
||||||
/** Max number of queues the host supports. */
|
/** Max number of queues the host supports. */
|
||||||
uint16_t max_queues;
|
uint16_t max_queues;
|
||||||
@ -205,9 +204,8 @@ uint16_t virtio_recv_pkts(struct virtqueue *vq, struct virtio_req **reqs,
|
|||||||
*
|
*
|
||||||
* \param vq virtio queue
|
* \param vq virtio queue
|
||||||
* \param req virtio request
|
* \param req virtio request
|
||||||
* \return 0 on success, negative errno on error. In case the ring is full
|
* \return 0 on success. In case the ring is full or no free descriptors
|
||||||
* or no free descriptors are available -ENOMEM is returned. If virtio
|
* are available -ENOMEM is returned.
|
||||||
* device owning the virtqueue is not started -EIO is returned.
|
|
||||||
*/
|
*/
|
||||||
int virtio_xmit_pkt(struct virtqueue *vq, struct virtio_req *req);
|
int virtio_xmit_pkt(struct virtqueue *vq, struct virtio_req *req);
|
||||||
|
|
||||||
@ -222,7 +220,6 @@ struct virtio_dev *virtio_dev_construct(const struct virtio_dev_ops *ops, void *
|
|||||||
|
|
||||||
int virtio_dev_init(struct virtio_dev *hw, uint64_t req_features);
|
int virtio_dev_init(struct virtio_dev *hw, uint64_t req_features);
|
||||||
void virtio_dev_free(struct virtio_dev *dev);
|
void virtio_dev_free(struct virtio_dev *dev);
|
||||||
int virtio_dev_start(struct virtio_dev *hw);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind a virtqueue with given index to the current thread;
|
* Bind a virtqueue with given index to the current thread;
|
||||||
|
Loading…
Reference in New Issue
Block a user