bdev_virtio: add xmit_pkt error handling for target scan
Only the initial xmit_pkt is checked against an error, the subsequent xmits are just asserted. As scan messages are sent 1-by-1 if the first request (containing 3 iovectors) has been enqueued successfully so should the next ones. Change-Id: Ie102256a42ef1c67132d606af90ab96771adba10 Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/382784 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
f35ca8f7df
commit
a922e9f302
@ -107,7 +107,7 @@ struct bdev_virtio_io_channel {
|
||||
struct virtqueue *vq;
|
||||
};
|
||||
|
||||
static void scan_target(struct virtio_scsi_scan_base *base);
|
||||
static int scan_target(struct virtio_scsi_scan_base *base);
|
||||
|
||||
static int
|
||||
bdev_virtio_get_ctx_size(void)
|
||||
@ -556,7 +556,10 @@ scan_target_finish(struct virtio_scsi_scan_base *base)
|
||||
|
||||
base->target++;
|
||||
if (base->target < BDEV_VIRTIO_MAX_TARGET) {
|
||||
scan_target(base);
|
||||
rc = scan_target(base);
|
||||
if (rc != 0) {
|
||||
assert(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -607,6 +610,7 @@ send_read_cap_10(struct virtio_scsi_scan_base *base, uint8_t target_id, struct v
|
||||
{
|
||||
struct iovec *iov = vreq->iov;
|
||||
struct virtio_scsi_cmd_req *req = vreq->iov_req.iov_base;
|
||||
int rc;
|
||||
|
||||
memset(req, 0, sizeof(*req));
|
||||
req->lun[0] = 1;
|
||||
@ -615,7 +619,10 @@ send_read_cap_10(struct virtio_scsi_scan_base *base, uint8_t target_id, struct v
|
||||
iov[0].iov_len = 8;
|
||||
req->cdb[0] = SPDK_SBC_READ_CAPACITY_10;
|
||||
|
||||
virtio_xmit_pkt(base->vq, vreq);
|
||||
rc = virtio_xmit_pkt(base->vq, vreq);
|
||||
if (rc != 0) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -623,6 +630,7 @@ send_read_cap_16(struct virtio_scsi_scan_base *base, uint8_t target_id, struct v
|
||||
{
|
||||
struct iovec *iov = vreq->iov;
|
||||
struct virtio_scsi_cmd_req *req = vreq->iov_req.iov_base;
|
||||
int rc;
|
||||
|
||||
memset(req, 0, sizeof(*req));
|
||||
req->lun[0] = 1;
|
||||
@ -633,7 +641,10 @@ send_read_cap_16(struct virtio_scsi_scan_base *base, uint8_t target_id, struct v
|
||||
req->cdb[1] = SPDK_SBC_SAI_READ_CAPACITY_16;
|
||||
to_be32(&req->cdb[10], iov[0].iov_len);
|
||||
|
||||
virtio_xmit_pkt(base->vq, vreq);
|
||||
rc = virtio_xmit_pkt(base->vq, vreq);
|
||||
if (rc != 0) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
@ -792,7 +803,7 @@ bdev_scan_poll(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
scan_target(struct virtio_scsi_scan_base *base)
|
||||
{
|
||||
struct iovec *iov;
|
||||
@ -826,7 +837,7 @@ scan_target(struct virtio_scsi_scan_base *base)
|
||||
cdb->opcode = SPDK_SPC_INQUIRY;
|
||||
cdb->alloc_len[1] = 255;
|
||||
|
||||
virtio_xmit_pkt(base->vq, vreq);
|
||||
return virtio_xmit_pkt(base->vq, vreq);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -939,7 +950,12 @@ bdev_virtio_initialize(void)
|
||||
base->vq = vq;
|
||||
vq->poller_ctx = base;
|
||||
spdk_bdev_poller_start(&vq->poller, bdev_scan_poll, base, 0);
|
||||
scan_target(base);
|
||||
|
||||
rc = scan_target(base);
|
||||
if (rc != 0) {
|
||||
SPDK_ERRLOG("Failed to start target scan.\n");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user