From 3bfecec9941b828a5fcca3ccf5af0db973363608 Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Fri, 2 Jun 2017 20:05:49 +0200 Subject: [PATCH] vhost_scsi: added "SCSI" keyword to trace flags To differ them from upcoming VHOST_BLK trace flags Change-Id: I1e82fb3430a6533cb9980b430d144ea28d269d59 Signed-off-by: Dariusz Stojaczyk Reviewed-on: https://review.gerrithub.io/363583 Tested-by: SPDK Automated Test System Reviewed-by: Pawel Wodkowski Reviewed-by: Ben Walker Reviewed-by: Daniel Verkamp --- lib/vhost/vhost_scsi.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/lib/vhost/vhost_scsi.c b/lib/vhost/vhost_scsi.c index 5d55b1a2ea..6ed23e89eb 100644 --- a/lib/vhost/vhost_scsi.c +++ b/lib/vhost/vhost_scsi.c @@ -101,7 +101,7 @@ submit_completion(struct spdk_vhost_task *task) { spdk_vhost_vq_used_ring_enqueue(&task->svdev->vdev, task->vq, task->req_idx, task->scsi.data_transferred); - SPDK_TRACELOG(SPDK_TRACE_VHOST, "Finished task (%p) req_idx=%d\n", task, task->req_idx); + SPDK_TRACELOG(SPDK_TRACE_VHOST_SCSI, "Finished task (%p) req_idx=%d\n", task, task->req_idx); spdk_vhost_task_put(task); } @@ -164,14 +164,14 @@ invalid_request(struct spdk_vhost_task *task) spdk_vhost_vq_used_ring_enqueue(&task->svdev->vdev, task->vq, task->req_idx, 0); spdk_vhost_task_put(task); - SPDK_TRACELOG(SPDK_TRACE_VHOST, "Invalid request (status=%" PRIu8")\n", + SPDK_TRACELOG(SPDK_TRACE_VHOST_SCSI, "Invalid request (status=%" PRIu8")\n", task->resp ? task->resp->response : -1); } static struct spdk_scsi_dev * get_scsi_dev(struct spdk_vhost_scsi_dev *svdev, const __u8 *lun) { - SPDK_TRACEDUMP(SPDK_TRACE_VHOST_QUEUE, "LUN", lun, 8); + SPDK_TRACEDUMP(SPDK_TRACE_VHOST_SCSI_QUEUE, "LUN", lun, 8); /* First byte must be 1 and second is target */ if (lun[0] != 1 || lun[1] >= SPDK_VHOST_SCSI_CTRLR_MAX_DEVS) return NULL; @@ -201,11 +201,11 @@ process_ctrl_request(struct spdk_vhost_scsi_dev *svdev, struct rte_vhost_vring * desc = spdk_vhost_vq_get_desc(controlq, req_idx); ctrl_req = spdk_vhost_gpa_to_vva(&svdev->vdev, desc->addr); - SPDK_TRACELOG(SPDK_TRACE_VHOST_QUEUE, + SPDK_TRACELOG(SPDK_TRACE_VHOST_SCSI_QUEUE, "Processing controlq descriptor: desc %d/%p, desc_addr %p, len %d, flags %d, last_used_idx %d; kickfd %d; size %d\n", req_idx, desc, (void *)desc->addr, desc->len, desc->flags, controlq->last_used_idx, controlq->kickfd, controlq->size); - SPDK_TRACEDUMP(SPDK_TRACE_VHOST_QUEUE, "Request desriptor", (uint8_t *)ctrl_req, + SPDK_TRACEDUMP(SPDK_TRACE_VHOST_SCSI_QUEUE, "Request desriptor", (uint8_t *)ctrl_req, desc->len); task = spdk_vhost_task_get(svdev); @@ -231,7 +231,7 @@ process_ctrl_request(struct spdk_vhost_scsi_dev *svdev, struct rte_vhost_vring * switch (ctrl_req->subtype) { case VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET: /* Handle LUN reset */ - SPDK_TRACELOG(SPDK_TRACE_VHOST_QUEUE, "LUN reset\n"); + SPDK_TRACELOG(SPDK_TRACE_VHOST_SCSI_QUEUE, "LUN reset\n"); task->scsi.lun = get_scsi_lun(task->scsi_dev, ctrl_req->lun); mgmt_task_submit(task, SPDK_SCSI_TASK_FUNC_LUN_RESET); @@ -239,7 +239,7 @@ process_ctrl_request(struct spdk_vhost_scsi_dev *svdev, struct rte_vhost_vring * default: task->tmf_resp->response = VIRTIO_SCSI_S_ABORTED; /* Unsupported command */ - SPDK_TRACELOG(SPDK_TRACE_VHOST_QUEUE, "Unsupported TMF command %x\n", ctrl_req->subtype); + SPDK_TRACELOG(SPDK_TRACE_VHOST_SCSI_QUEUE, "Unsupported TMF command %x\n", ctrl_req->subtype); break; } break; @@ -251,7 +251,7 @@ process_ctrl_request(struct spdk_vhost_scsi_dev *svdev, struct rte_vhost_vring * break; } default: - SPDK_TRACELOG(SPDK_TRACE_VHOST_QUEUE, "Unsupported control command %x\n", ctrl_req->type); + SPDK_TRACELOG(SPDK_TRACE_VHOST_SCSI_QUEUE, "Unsupported control command %x\n", ctrl_req->type); break; } @@ -300,9 +300,9 @@ task_data_setup(struct spdk_vhost_task *task, /* * TEST UNIT READY command and some others might not contain any payload and this is not an error. */ - SPDK_TRACELOG(SPDK_TRACE_VHOST_DATA, + SPDK_TRACELOG(SPDK_TRACE_VHOST_SCSI_DATA, "No payload descriptors for FROM DEV command req_idx=%"PRIu16".\n", task->req_idx); - SPDK_TRACEDUMP(SPDK_TRACE_VHOST_DATA, "CDB=", (*req)->cdb, VIRTIO_SCSI_CDB_SIZE); + SPDK_TRACEDUMP(SPDK_TRACE_VHOST_SCSI_DATA, "CDB=", (*req)->cdb, VIRTIO_SCSI_CDB_SIZE); task->scsi.iovcnt = 1; task->scsi.iovs[0].iov_len = 0; task->scsi.length = 0; @@ -329,7 +329,7 @@ task_data_setup(struct spdk_vhost_task *task, } } } else { - SPDK_TRACELOG(SPDK_TRACE_VHOST_DATA, "TO DEV"); + SPDK_TRACELOG(SPDK_TRACE_VHOST_SCSI_DATA, "TO DEV"); /* * TO_DEV (WRITE):[RD_req][RD_buf0]...[RD_bufN][WR_resp] * No need to check descriptor WR flag as this is done while setting scsi.dxfer_dir. @@ -394,7 +394,7 @@ process_request(struct spdk_vhost_task *task) task->scsi.lun = get_scsi_lun(task->scsi_dev, req->lun); task->scsi.cdb = req->cdb; task->scsi.target_port = spdk_scsi_dev_find_port_by_id(task->scsi_dev, 0); - SPDK_TRACEDUMP(SPDK_TRACE_VHOST_DATA, "request CDB", req->cdb, VIRTIO_SCSI_CDB_SIZE); + SPDK_TRACEDUMP(SPDK_TRACE_VHOST_SCSI_DATA, "request CDB", req->cdb, VIRTIO_SCSI_CDB_SIZE); return 0; } @@ -424,7 +424,7 @@ process_requestq(struct spdk_vhost_scsi_dev *svdev, struct rte_vhost_vring *vq) for (i = 0; i < reqs_cnt; i++) { task = spdk_vhost_task_get(svdev); - SPDK_TRACELOG(SPDK_TRACE_VHOST, "====== Starting processing request idx %"PRIu16"======\n", + SPDK_TRACELOG(SPDK_TRACE_VHOST_SCSI, "====== Starting processing request idx %"PRIu16"======\n", reqs[i]); task->vq = vq; task->svdev = svdev; @@ -432,11 +432,12 @@ process_requestq(struct spdk_vhost_scsi_dev *svdev, struct rte_vhost_vring *vq) result = process_request(task); if (likely(result == 0)) { task_submit(task); - SPDK_TRACELOG(SPDK_TRACE_VHOST, "====== Task %p req_idx %d submitted ======\n", task, + SPDK_TRACELOG(SPDK_TRACE_VHOST_SCSI, "====== Task %p req_idx %d submitted ======\n", task, task->req_idx); } else { invalid_request(task); - SPDK_TRACELOG(SPDK_TRACE_VHOST, "====== Task %p req_idx %d failed ======\n", task, task->req_idx); + SPDK_TRACELOG(SPDK_TRACE_VHOST_SCSI, "====== Task %p req_idx %d failed ======\n", task, + task->req_idx); } } } @@ -782,6 +783,6 @@ destroy_device(int vid) spdk_vhost_dev_unload(vdev); } -SPDK_LOG_REGISTER_TRACE_FLAG("vhost", SPDK_TRACE_VHOST) -SPDK_LOG_REGISTER_TRACE_FLAG("vhost_queue", SPDK_TRACE_VHOST_QUEUE) -SPDK_LOG_REGISTER_TRACE_FLAG("vhost_data", SPDK_TRACE_VHOST_DATA) +SPDK_LOG_REGISTER_TRACE_FLAG("vhost_scsi", SPDK_TRACE_VHOST_SCSI) +SPDK_LOG_REGISTER_TRACE_FLAG("vhost_scsi_queue", SPDK_TRACE_VHOST_SCSI_QUEUE) +SPDK_LOG_REGISTER_TRACE_FLAG("vhost_scsi_data", SPDK_TRACE_VHOST_SCSI_DATA)