Commit 417dff6c authored by Bryant G. Ly's avatar Bryant G. Ly Committed by Martin K. Petersen

scsi: ibmvscsis: add DRC indices to debug statements

Where applicable, changes pr_debug, pr_info, pr_err, etc. calls to the
dev_* versions.  This adds the DRC index of the device to the
corresponding trace statement.
Signed-off-by: default avatarBryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: default avatarBrad Warrum <bwarrum@us.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b82378e6
...@@ -122,7 +122,7 @@ static bool connection_broken(struct scsi_info *vscsi) ...@@ -122,7 +122,7 @@ static bool connection_broken(struct scsi_info *vscsi)
cpu_to_be64(buffer[MSG_HI]), cpu_to_be64(buffer[MSG_HI]),
cpu_to_be64(buffer[MSG_LOW])); cpu_to_be64(buffer[MSG_LOW]));
pr_debug("connection_broken: rc %ld\n", h_return_code); dev_dbg(&vscsi->dev, "Connection_broken: rc %ld\n", h_return_code);
if (h_return_code == H_CLOSED) if (h_return_code == H_CLOSED)
rc = true; rc = true;
...@@ -210,7 +210,7 @@ static long ibmvscsis_unregister_command_q(struct scsi_info *vscsi) ...@@ -210,7 +210,7 @@ static long ibmvscsis_unregister_command_q(struct scsi_info *vscsi)
} }
} while (qrc != H_SUCCESS && rc == ADAPT_SUCCESS); } while (qrc != H_SUCCESS && rc == ADAPT_SUCCESS);
pr_debug("Freeing CRQ: phyp rc %ld, rc %ld\n", qrc, rc); dev_dbg(&vscsi->dev, "Freeing CRQ: phyp rc %ld, rc %ld\n", qrc, rc);
return rc; return rc;
} }
...@@ -291,9 +291,9 @@ static long ibmvscsis_free_command_q(struct scsi_info *vscsi) ...@@ -291,9 +291,9 @@ static long ibmvscsis_free_command_q(struct scsi_info *vscsi)
ibmvscsis_delete_client_info(vscsi, false); ibmvscsis_delete_client_info(vscsi, false);
} }
pr_debug("free_command_q: flags 0x%x, state 0x%hx, acr_flags 0x%x, acr_state 0x%hx\n", dev_dbg(&vscsi->dev, "free_command_q: flags 0x%x, state 0x%hx, acr_flags 0x%x, acr_state 0x%hx\n",
vscsi->flags, vscsi->state, vscsi->phyp_acr_flags, vscsi->flags, vscsi->state, vscsi->phyp_acr_flags,
vscsi->phyp_acr_state); vscsi->phyp_acr_state);
} }
return rc; return rc;
} }
...@@ -428,8 +428,8 @@ static void ibmvscsis_disconnect(struct work_struct *work) ...@@ -428,8 +428,8 @@ static void ibmvscsis_disconnect(struct work_struct *work)
vscsi->flags |= DISCONNECT_SCHEDULED; vscsi->flags |= DISCONNECT_SCHEDULED;
vscsi->flags &= ~SCHEDULE_DISCONNECT; vscsi->flags &= ~SCHEDULE_DISCONNECT;
pr_debug("disconnect: flags 0x%x, state 0x%hx\n", vscsi->flags, dev_dbg(&vscsi->dev, "disconnect: flags 0x%x, state 0x%hx\n",
vscsi->state); vscsi->flags, vscsi->state);
/* /*
* check which state we are in and see if we * check which state we are in and see if we
...@@ -540,13 +540,14 @@ static void ibmvscsis_disconnect(struct work_struct *work) ...@@ -540,13 +540,14 @@ static void ibmvscsis_disconnect(struct work_struct *work)
} }
if (wait_idle) { if (wait_idle) {
pr_debug("disconnect start wait, active %d, sched %d\n", dev_dbg(&vscsi->dev, "disconnect start wait, active %d, sched %d\n",
(int)list_empty(&vscsi->active_q), (int)list_empty(&vscsi->active_q),
(int)list_empty(&vscsi->schedule_q)); (int)list_empty(&vscsi->schedule_q));
if (!list_empty(&vscsi->active_q) || if (!list_empty(&vscsi->active_q) ||
!list_empty(&vscsi->schedule_q)) { !list_empty(&vscsi->schedule_q)) {
vscsi->flags |= WAIT_FOR_IDLE; vscsi->flags |= WAIT_FOR_IDLE;
pr_debug("disconnect flags 0x%x\n", vscsi->flags); dev_dbg(&vscsi->dev, "disconnect flags 0x%x\n",
vscsi->flags);
/* /*
* This routine is can not be called with the interrupt * This routine is can not be called with the interrupt
* lock held. * lock held.
...@@ -555,7 +556,7 @@ static void ibmvscsis_disconnect(struct work_struct *work) ...@@ -555,7 +556,7 @@ static void ibmvscsis_disconnect(struct work_struct *work)
wait_for_completion(&vscsi->wait_idle); wait_for_completion(&vscsi->wait_idle);
spin_lock_bh(&vscsi->intr_lock); spin_lock_bh(&vscsi->intr_lock);
} }
pr_debug("disconnect stop wait\n"); dev_dbg(&vscsi->dev, "disconnect stop wait\n");
ibmvscsis_adapter_idle(vscsi); ibmvscsis_adapter_idle(vscsi);
} }
...@@ -597,8 +598,8 @@ static void ibmvscsis_post_disconnect(struct scsi_info *vscsi, uint new_state, ...@@ -597,8 +598,8 @@ static void ibmvscsis_post_disconnect(struct scsi_info *vscsi, uint new_state,
vscsi->flags |= flag_bits; vscsi->flags |= flag_bits;
pr_debug("post_disconnect: new_state 0x%x, flag_bits 0x%x, vscsi->flags 0x%x, state %hx\n", dev_dbg(&vscsi->dev, "post_disconnect: new_state 0x%x, flag_bits 0x%x, vscsi->flags 0x%x, state %hx\n",
new_state, flag_bits, vscsi->flags, vscsi->state); new_state, flag_bits, vscsi->flags, vscsi->state);
if (!(vscsi->flags & (DISCONNECT_SCHEDULED | SCHEDULE_DISCONNECT))) { if (!(vscsi->flags & (DISCONNECT_SCHEDULED | SCHEDULE_DISCONNECT))) {
vscsi->flags |= SCHEDULE_DISCONNECT; vscsi->flags |= SCHEDULE_DISCONNECT;
...@@ -648,8 +649,8 @@ static void ibmvscsis_post_disconnect(struct scsi_info *vscsi, uint new_state, ...@@ -648,8 +649,8 @@ static void ibmvscsis_post_disconnect(struct scsi_info *vscsi, uint new_state,
} }
} }
pr_debug("Leaving post_disconnect: flags 0x%x, new_state 0x%x\n", dev_dbg(&vscsi->dev, "Leaving post_disconnect: flags 0x%x, new_state 0x%x\n",
vscsi->flags, vscsi->new_state); vscsi->flags, vscsi->new_state);
} }
/** /**
...@@ -724,7 +725,8 @@ static long ibmvscsis_handle_init_msg(struct scsi_info *vscsi) ...@@ -724,7 +725,8 @@ static long ibmvscsis_handle_init_msg(struct scsi_info *vscsi)
break; break;
case H_CLOSED: case H_CLOSED:
pr_warn("init_msg: failed to send, rc %ld\n", rc); dev_warn(&vscsi->dev, "init_msg: failed to send, rc %ld\n",
rc);
rc = 0; rc = 0;
break; break;
} }
...@@ -768,7 +770,7 @@ static long ibmvscsis_init_msg(struct scsi_info *vscsi, struct viosrp_crq *crq) ...@@ -768,7 +770,7 @@ static long ibmvscsis_init_msg(struct scsi_info *vscsi, struct viosrp_crq *crq)
{ {
long rc = ADAPT_SUCCESS; long rc = ADAPT_SUCCESS;
pr_debug("init_msg: state 0x%hx\n", vscsi->state); dev_dbg(&vscsi->dev, "init_msg: state 0x%hx\n", vscsi->state);
rc = h_vioctl(vscsi->dds.unit_id, H_GET_PARTNER_INFO, rc = h_vioctl(vscsi->dds.unit_id, H_GET_PARTNER_INFO,
(u64)vscsi->map_ioba | ((u64)PAGE_SIZE << 32), 0, 0, 0, (u64)vscsi->map_ioba | ((u64)PAGE_SIZE << 32), 0, 0, 0,
...@@ -776,10 +778,10 @@ static long ibmvscsis_init_msg(struct scsi_info *vscsi, struct viosrp_crq *crq) ...@@ -776,10 +778,10 @@ static long ibmvscsis_init_msg(struct scsi_info *vscsi, struct viosrp_crq *crq)
if (rc == H_SUCCESS) { if (rc == H_SUCCESS) {
vscsi->client_data.partition_number = vscsi->client_data.partition_number =
be64_to_cpu(*(u64 *)vscsi->map_buf); be64_to_cpu(*(u64 *)vscsi->map_buf);
pr_debug("init_msg, part num %d\n", dev_dbg(&vscsi->dev, "init_msg, part num %d\n",
vscsi->client_data.partition_number); vscsi->client_data.partition_number);
} else { } else {
pr_debug("init_msg h_vioctl rc %ld\n", rc); dev_dbg(&vscsi->dev, "init_msg h_vioctl rc %ld\n", rc);
rc = ADAPT_SUCCESS; rc = ADAPT_SUCCESS;
} }
...@@ -813,7 +815,8 @@ static long ibmvscsis_establish_new_q(struct scsi_info *vscsi) ...@@ -813,7 +815,8 @@ static long ibmvscsis_establish_new_q(struct scsi_info *vscsi)
if (rc == H_SUCCESS) if (rc == H_SUCCESS)
vscsi->flags |= PREP_FOR_SUSPEND_ENABLED; vscsi->flags |= PREP_FOR_SUSPEND_ENABLED;
else if (rc != H_NOT_FOUND) else if (rc != H_NOT_FOUND)
pr_err("Error from Enable Prepare for Suspend: %ld\n", rc); dev_err(&vscsi->dev, "Error from Enable Prepare for Suspend: %ld\n",
rc);
vscsi->flags &= PRESERVE_FLAG_FIELDS; vscsi->flags &= PRESERVE_FLAG_FIELDS;
vscsi->rsp_q_timer.timer_pops = 0; vscsi->rsp_q_timer.timer_pops = 0;
...@@ -822,8 +825,8 @@ static long ibmvscsis_establish_new_q(struct scsi_info *vscsi) ...@@ -822,8 +825,8 @@ static long ibmvscsis_establish_new_q(struct scsi_info *vscsi)
rc = vio_enable_interrupts(vscsi->dma_dev); rc = vio_enable_interrupts(vscsi->dma_dev);
if (rc) { if (rc) {
pr_warn("establish_new_q: failed to enable interrupts, rc %ld\n", dev_warn(&vscsi->dev, "establish_new_q: failed to enable interrupts, rc %ld\n",
rc); rc);
return rc; return rc;
} }
...@@ -883,7 +886,7 @@ static void ibmvscsis_reset_queue(struct scsi_info *vscsi) ...@@ -883,7 +886,7 @@ static void ibmvscsis_reset_queue(struct scsi_info *vscsi)
int bytes; int bytes;
long rc = ADAPT_SUCCESS; long rc = ADAPT_SUCCESS;
pr_debug("reset_queue: flags 0x%x\n", vscsi->flags); dev_dbg(&vscsi->dev, "reset_queue: flags 0x%x\n", vscsi->flags);
/* don't reset, the client did it for us */ /* don't reset, the client did it for us */
if (vscsi->flags & (CLIENT_FAILED | TRANS_EVENT)) { if (vscsi->flags & (CLIENT_FAILED | TRANS_EVENT)) {
...@@ -906,7 +909,8 @@ static void ibmvscsis_reset_queue(struct scsi_info *vscsi) ...@@ -906,7 +909,8 @@ static void ibmvscsis_reset_queue(struct scsi_info *vscsi)
} }
if (rc != ADAPT_SUCCESS) { if (rc != ADAPT_SUCCESS) {
pr_debug("reset_queue: reg_crq rc %ld\n", rc); dev_dbg(&vscsi->dev, "reset_queue: reg_crq rc %ld\n",
rc);
vscsi->state = ERR_DISCONNECTED; vscsi->state = ERR_DISCONNECTED;
vscsi->flags |= RESPONSE_Q_DOWN; vscsi->flags |= RESPONSE_Q_DOWN;
...@@ -985,14 +989,15 @@ static long ibmvscsis_ready_for_suspend(struct scsi_info *vscsi, bool idle) ...@@ -985,14 +989,15 @@ static long ibmvscsis_ready_for_suspend(struct scsi_info *vscsi, bool idle)
/* See if there is a Resume event in the queue */ /* See if there is a Resume event in the queue */
crq = vscsi->cmd_q.base_addr + vscsi->cmd_q.index; crq = vscsi->cmd_q.base_addr + vscsi->cmd_q.index;
pr_debug("ready_suspend: flags 0x%x, state 0x%hx crq_valid:%x\n", dev_dbg(&vscsi->dev, "ready_suspend: flags 0x%x, state 0x%hx crq_valid:%x\n",
vscsi->flags, vscsi->state, (int)crq->valid); vscsi->flags, vscsi->state, (int)crq->valid);
if (!(vscsi->flags & PREP_FOR_SUSPEND_ABORTED) && !(crq->valid)) { if (!(vscsi->flags & PREP_FOR_SUSPEND_ABORTED) && !(crq->valid)) {
rc = h_vioctl(vscsi->dds.unit_id, H_READY_FOR_SUSPEND, 0, 0, 0, rc = h_vioctl(vscsi->dds.unit_id, H_READY_FOR_SUSPEND, 0, 0, 0,
0, 0); 0, 0);
if (rc) { if (rc) {
pr_err("Ready for Suspend Vioctl failed: %ld\n", rc); dev_err(&vscsi->dev, "Ready for Suspend Vioctl failed: %ld\n",
rc);
rc = 0; rc = 0;
} }
} else if (((vscsi->flags & PREP_FOR_SUSPEND_OVERWRITE) && } else if (((vscsi->flags & PREP_FOR_SUSPEND_OVERWRITE) &&
...@@ -1012,7 +1017,7 @@ static long ibmvscsis_ready_for_suspend(struct scsi_info *vscsi, bool idle) ...@@ -1012,7 +1017,7 @@ static long ibmvscsis_ready_for_suspend(struct scsi_info *vscsi, bool idle)
if ((crq->valid) && ((crq->valid != VALID_TRANS_EVENT) || if ((crq->valid) && ((crq->valid != VALID_TRANS_EVENT) ||
(crq->format != RESUME_FROM_SUSP))) (crq->format != RESUME_FROM_SUSP)))
pr_err("Invalid element in CRQ after Prepare for Suspend"); dev_err(&vscsi->dev, "Invalid element in CRQ after Prepare for Suspend");
} }
vscsi->flags &= ~(PREP_FOR_SUSPEND_PENDING | PREP_FOR_SUSPEND_ABORTED); vscsi->flags &= ~(PREP_FOR_SUSPEND_PENDING | PREP_FOR_SUSPEND_ABORTED);
...@@ -1036,8 +1041,8 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi, ...@@ -1036,8 +1041,8 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi,
{ {
long rc = ADAPT_SUCCESS; long rc = ADAPT_SUCCESS;
pr_debug("trans_event: format %d, flags 0x%x, state 0x%hx\n", dev_dbg(&vscsi->dev, "trans_event: format %d, flags 0x%x, state 0x%hx\n",
(int)crq->format, vscsi->flags, vscsi->state); (int)crq->format, vscsi->flags, vscsi->state);
switch (crq->format) { switch (crq->format) {
case MIGRATED: case MIGRATED:
...@@ -1073,14 +1078,14 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi, ...@@ -1073,14 +1078,14 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi,
!list_empty(&vscsi->schedule_q) || !list_empty(&vscsi->schedule_q) ||
!list_empty(&vscsi->waiting_rsp) || !list_empty(&vscsi->waiting_rsp) ||
!list_empty(&vscsi->active_q)) { !list_empty(&vscsi->active_q)) {
pr_debug("debit %d, sched %d, wait %d, active %d\n", dev_dbg(&vscsi->dev, "debit %d, sched %d, wait %d, active %d\n",
vscsi->debit, vscsi->debit,
(int)list_empty(&vscsi->schedule_q), (int)list_empty(&vscsi->schedule_q),
(int)list_empty(&vscsi->waiting_rsp), (int)list_empty(&vscsi->waiting_rsp),
(int)list_empty(&vscsi->active_q)); (int)list_empty(&vscsi->active_q));
pr_warn("connection lost with outstanding work\n"); dev_warn(&vscsi->dev, "connection lost with outstanding work\n");
} else { } else {
pr_debug("trans_event: SRP Processing, but no outstanding work\n"); dev_dbg(&vscsi->dev, "trans_event: SRP Processing, but no outstanding work\n");
} }
ibmvscsis_post_disconnect(vscsi, WAIT_IDLE, ibmvscsis_post_disconnect(vscsi, WAIT_IDLE,
...@@ -1097,8 +1102,8 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi, ...@@ -1097,8 +1102,8 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi,
break; break;
case PREPARE_FOR_SUSPEND: case PREPARE_FOR_SUSPEND:
pr_debug("Prep for Suspend, crq status = 0x%x\n", dev_dbg(&vscsi->dev, "Prep for Suspend, crq status = 0x%x\n",
(int)crq->status); (int)crq->status);
switch (vscsi->state) { switch (vscsi->state) {
case ERR_DISCONNECTED: case ERR_DISCONNECTED:
case WAIT_CONNECTION: case WAIT_CONNECTION:
...@@ -1119,15 +1124,15 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi, ...@@ -1119,15 +1124,15 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi,
case ERR_DISCONNECT: case ERR_DISCONNECT:
case ERR_DISCONNECT_RECONNECT: case ERR_DISCONNECT_RECONNECT:
case WAIT_IDLE: case WAIT_IDLE:
pr_err("Invalid state for Prepare for Suspend Trans Event: 0x%x\n", dev_err(&vscsi->dev, "Invalid state for Prepare for Suspend Trans Event: 0x%x\n",
vscsi->state); vscsi->state);
break; break;
} }
break; break;
case RESUME_FROM_SUSP: case RESUME_FROM_SUSP:
pr_debug("Resume from Suspend, crq status = 0x%x\n", dev_dbg(&vscsi->dev, "Resume from Suspend, crq status = 0x%x\n",
(int)crq->status); (int)crq->status);
if (vscsi->flags & PREP_FOR_SUSPEND_PENDING) { if (vscsi->flags & PREP_FOR_SUSPEND_PENDING) {
vscsi->flags |= PREP_FOR_SUSPEND_ABORTED; vscsi->flags |= PREP_FOR_SUSPEND_ABORTED;
} else { } else {
...@@ -1152,8 +1157,8 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi, ...@@ -1152,8 +1157,8 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi,
rc = vscsi->flags & SCHEDULE_DISCONNECT; rc = vscsi->flags & SCHEDULE_DISCONNECT;
pr_debug("Leaving trans_event: flags 0x%x, state 0x%hx, rc %ld\n", dev_dbg(&vscsi->dev, "Leaving trans_event: flags 0x%x, state 0x%hx, rc %ld\n",
vscsi->flags, vscsi->state, rc); vscsi->flags, vscsi->state, rc);
return rc; return rc;
} }
...@@ -1175,8 +1180,8 @@ static void ibmvscsis_poll_cmd_q(struct scsi_info *vscsi) ...@@ -1175,8 +1180,8 @@ static void ibmvscsis_poll_cmd_q(struct scsi_info *vscsi)
bool ack = true; bool ack = true;
volatile u8 valid; volatile u8 valid;
pr_debug("poll_cmd_q: flags 0x%x, state 0x%hx, q index %ud\n", dev_dbg(&vscsi->dev, "poll_cmd_q: flags 0x%x, state 0x%hx, q index %ud\n",
vscsi->flags, vscsi->state, vscsi->cmd_q.index); vscsi->flags, vscsi->state, vscsi->cmd_q.index);
rc = vscsi->flags & SCHEDULE_DISCONNECT; rc = vscsi->flags & SCHEDULE_DISCONNECT;
crq = vscsi->cmd_q.base_addr + vscsi->cmd_q.index; crq = vscsi->cmd_q.base_addr + vscsi->cmd_q.index;
...@@ -1204,7 +1209,7 @@ static void ibmvscsis_poll_cmd_q(struct scsi_info *vscsi) ...@@ -1204,7 +1209,7 @@ static void ibmvscsis_poll_cmd_q(struct scsi_info *vscsi)
* if a tranport event has occurred leave * if a tranport event has occurred leave
* everything but transport events on the queue * everything but transport events on the queue
*/ */
pr_debug("poll_cmd_q, ignoring\n"); dev_dbg(&vscsi->dev, "poll_cmd_q, ignoring\n");
/* /*
* need to decrement the queue index so we can * need to decrement the queue index so we can
...@@ -1233,7 +1238,7 @@ static void ibmvscsis_poll_cmd_q(struct scsi_info *vscsi) ...@@ -1233,7 +1238,7 @@ static void ibmvscsis_poll_cmd_q(struct scsi_info *vscsi)
if (ack) { if (ack) {
vio_enable_interrupts(vscsi->dma_dev); vio_enable_interrupts(vscsi->dma_dev);
ack = false; ack = false;
pr_debug("poll_cmd_q, reenabling interrupts\n"); dev_dbg(&vscsi->dev, "poll_cmd_q, reenabling interrupts\n");
} }
valid = crq->valid; valid = crq->valid;
dma_rmb(); dma_rmb();
...@@ -1241,7 +1246,7 @@ static void ibmvscsis_poll_cmd_q(struct scsi_info *vscsi) ...@@ -1241,7 +1246,7 @@ static void ibmvscsis_poll_cmd_q(struct scsi_info *vscsi)
goto poll_work; goto poll_work;
} }
pr_debug("Leaving poll_cmd_q: rc %ld\n", rc); dev_dbg(&vscsi->dev, "Leaving poll_cmd_q: rc %ld\n", rc);
} }
/** /**
...@@ -1258,9 +1263,9 @@ static void ibmvscsis_free_cmd_qs(struct scsi_info *vscsi) ...@@ -1258,9 +1263,9 @@ static void ibmvscsis_free_cmd_qs(struct scsi_info *vscsi)
{ {
struct ibmvscsis_cmd *cmd, *nxt; struct ibmvscsis_cmd *cmd, *nxt;
pr_debug("free_cmd_qs: waiting_rsp empty %d, timer starter %d\n", dev_dbg(&vscsi->dev, "free_cmd_qs: waiting_rsp empty %d, timer starter %d\n",
(int)list_empty(&vscsi->waiting_rsp), (int)list_empty(&vscsi->waiting_rsp),
vscsi->rsp_q_timer.started); vscsi->rsp_q_timer.started);
list_for_each_entry_safe(cmd, nxt, &vscsi->waiting_rsp, list) { list_for_each_entry_safe(cmd, nxt, &vscsi->waiting_rsp, list) {
list_del(&cmd->list); list_del(&cmd->list);
...@@ -1317,8 +1322,8 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi) ...@@ -1317,8 +1322,8 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi)
int free_qs = false; int free_qs = false;
long rc = 0; long rc = 0;
pr_debug("adapter_idle: flags 0x%x, state 0x%hx\n", vscsi->flags, dev_dbg(&vscsi->dev, "adapter_idle: flags 0x%x, state 0x%hx\n",
vscsi->state); vscsi->flags, vscsi->state);
/* Only need to free qs if we're disconnecting from client */ /* Only need to free qs if we're disconnecting from client */
if (vscsi->state != WAIT_CONNECTION || vscsi->flags & TRANS_EVENT) if (vscsi->state != WAIT_CONNECTION || vscsi->flags & TRANS_EVENT)
...@@ -1336,7 +1341,8 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi) ...@@ -1336,7 +1341,8 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi)
break; break;
case ERR_DISCONNECT_RECONNECT: case ERR_DISCONNECT_RECONNECT:
ibmvscsis_reset_queue(vscsi); ibmvscsis_reset_queue(vscsi);
pr_debug("adapter_idle, disc_rec: flags 0x%x\n", vscsi->flags); dev_dbg(&vscsi->dev, "adapter_idle, disc_rec: flags 0x%x\n",
vscsi->flags);
break; break;
case ERR_DISCONNECT: case ERR_DISCONNECT:
...@@ -1347,8 +1353,8 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi) ...@@ -1347,8 +1353,8 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi)
vscsi->state = ERR_DISCONNECTED; vscsi->state = ERR_DISCONNECTED;
else else
vscsi->state = WAIT_ENABLED; vscsi->state = WAIT_ENABLED;
pr_debug("adapter_idle, disc: flags 0x%x, state 0x%hx\n", dev_dbg(&vscsi->dev, "adapter_idle, disc: flags 0x%x, state 0x%hx\n",
vscsi->flags, vscsi->state); vscsi->flags, vscsi->state);
break; break;
case WAIT_IDLE: case WAIT_IDLE:
...@@ -1370,15 +1376,15 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi) ...@@ -1370,15 +1376,15 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi)
vscsi->flags &= ~DISCONNECT_SCHEDULED; vscsi->flags &= ~DISCONNECT_SCHEDULED;
} }
pr_debug("adapter_idle, wait: flags 0x%x, state 0x%hx\n", dev_dbg(&vscsi->dev, "adapter_idle, wait: flags 0x%x, state 0x%hx\n",
vscsi->flags, vscsi->state); vscsi->flags, vscsi->state);
ibmvscsis_poll_cmd_q(vscsi); ibmvscsis_poll_cmd_q(vscsi);
break; break;
case ERR_DISCONNECTED: case ERR_DISCONNECTED:
vscsi->flags &= ~DISCONNECT_SCHEDULED; vscsi->flags &= ~DISCONNECT_SCHEDULED;
pr_debug("adapter_idle, disconnected: flags 0x%x, state 0x%hx\n", dev_dbg(&vscsi->dev, "adapter_idle, disconnected: flags 0x%x, state 0x%hx\n",
vscsi->flags, vscsi->state); vscsi->flags, vscsi->state);
break; break;
default: default:
...@@ -1419,13 +1425,13 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi) ...@@ -1419,13 +1425,13 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi)
vscsi->phyp_acr_state = 0; vscsi->phyp_acr_state = 0;
vscsi->phyp_acr_flags = 0; vscsi->phyp_acr_flags = 0;
pr_debug("adapter_idle: flags 0x%x, state 0x%hx, acr_flags 0x%x, acr_state 0x%hx\n", dev_dbg(&vscsi->dev, "adapter_idle: flags 0x%x, state 0x%hx, acr_flags 0x%x, acr_state 0x%hx\n",
vscsi->flags, vscsi->state, vscsi->phyp_acr_flags, vscsi->flags, vscsi->state, vscsi->phyp_acr_flags,
vscsi->phyp_acr_state); vscsi->phyp_acr_state);
} }
pr_debug("Leaving adapter_idle: flags 0x%x, state 0x%hx, new_state 0x%x\n", dev_dbg(&vscsi->dev, "Leaving adapter_idle: flags 0x%x, state 0x%hx, new_state 0x%x\n",
vscsi->flags, vscsi->state, vscsi->new_state); vscsi->flags, vscsi->state, vscsi->new_state);
} }
/** /**
...@@ -1464,8 +1470,8 @@ static long ibmvscsis_copy_crq_packet(struct scsi_info *vscsi, ...@@ -1464,8 +1470,8 @@ static long ibmvscsis_copy_crq_packet(struct scsi_info *vscsi,
cmd->init_time = mftb(); cmd->init_time = mftb();
iue->remote_token = crq->IU_data_ptr; iue->remote_token = crq->IU_data_ptr;
iue->iu_len = len; iue->iu_len = len;
pr_debug("copy_crq: ioba 0x%llx, init_time 0x%llx\n", dev_dbg(&vscsi->dev, "copy_crq: ioba 0x%llx, init_time 0x%llx\n",
be64_to_cpu(crq->IU_data_ptr), cmd->init_time); be64_to_cpu(crq->IU_data_ptr), cmd->init_time);
break; break;
case H_PERMISSION: case H_PERMISSION:
if (connection_broken(vscsi)) if (connection_broken(vscsi))
...@@ -1536,10 +1542,10 @@ static long ibmvscsis_adapter_info(struct scsi_info *vscsi, ...@@ -1536,10 +1542,10 @@ static long ibmvscsis_adapter_info(struct scsi_info *vscsi,
if (connection_broken(vscsi)) if (connection_broken(vscsi))
flag_bits = (RESPONSE_Q_DOWN | CLIENT_FAILED); flag_bits = (RESPONSE_Q_DOWN | CLIENT_FAILED);
} }
pr_warn("adapter_info: h_copy_rdma from client failed, rc %ld\n", dev_warn(&vscsi->dev, "adapter_info: h_copy_rdma from client failed, rc %ld\n",
rc); rc);
pr_debug("adapter_info: ioba 0x%llx, flags 0x%x, flag_bits 0x%x\n", dev_dbg(&vscsi->dev, "adapter_info: ioba 0x%llx, flags 0x%x, flag_bits 0x%x\n",
be64_to_cpu(mad->buffer), vscsi->flags, flag_bits); be64_to_cpu(mad->buffer), vscsi->flags, flag_bits);
ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT, ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT,
flag_bits); flag_bits);
goto free_dma; goto free_dma;
...@@ -1595,7 +1601,7 @@ static long ibmvscsis_adapter_info(struct scsi_info *vscsi, ...@@ -1595,7 +1601,7 @@ static long ibmvscsis_adapter_info(struct scsi_info *vscsi,
free_dma: free_dma:
dma_free_coherent(&vscsi->dma_dev->dev, sizeof(*info), info, token); dma_free_coherent(&vscsi->dma_dev->dev, sizeof(*info), info, token);
pr_debug("Leaving adapter_info, rc %ld\n", rc); dev_dbg(&vscsi->dev, "Leaving adapter_info, rc %ld\n", rc);
return rc; return rc;
} }
...@@ -1629,7 +1635,7 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue) ...@@ -1629,7 +1635,7 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue)
*/ */
min_len = offsetof(struct capabilities, migration); min_len = offsetof(struct capabilities, migration);
if ((olen < min_len) || (olen > PAGE_SIZE)) { if ((olen < min_len) || (olen > PAGE_SIZE)) {
pr_warn("cap_mad: invalid len %d\n", olen); dev_warn(&vscsi->dev, "cap_mad: invalid len %d\n", olen);
mad->common.status = cpu_to_be16(VIOSRP_MAD_FAILED); mad->common.status = cpu_to_be16(VIOSRP_MAD_FAILED);
return 0; return 0;
} }
...@@ -1654,9 +1660,9 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue) ...@@ -1654,9 +1660,9 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue)
common = (struct mad_capability_common *)&cap->migration; common = (struct mad_capability_common *)&cap->migration;
while ((len > 0) && (status == VIOSRP_MAD_SUCCESS) && !rc) { while ((len > 0) && (status == VIOSRP_MAD_SUCCESS) && !rc) {
pr_debug("cap_mad: len left %hd, cap type %d, cap len %hd\n", dev_dbg(&vscsi->dev, "cap_mad: len left %hd, cap type %d, cap len %hd\n",
len, be32_to_cpu(common->cap_type), len, be32_to_cpu(common->cap_type),
be16_to_cpu(common->length)); be16_to_cpu(common->length));
cap_len = be16_to_cpu(common->length); cap_len = be16_to_cpu(common->length);
if (cap_len > len) { if (cap_len > len) {
...@@ -1673,7 +1679,7 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue) ...@@ -1673,7 +1679,7 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue)
switch (common->cap_type) { switch (common->cap_type) {
default: default:
pr_debug("cap_mad: unsupported capability\n"); dev_dbg(&vscsi->dev, "cap_mad: unsupported capability\n");
common->server_support = 0; common->server_support = 0;
flag = cpu_to_be32((u32)CAP_LIST_SUPPORTED); flag = cpu_to_be32((u32)CAP_LIST_SUPPORTED);
cap->flags &= ~flag; cap->flags &= ~flag;
...@@ -1693,8 +1699,8 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue) ...@@ -1693,8 +1699,8 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue)
be64_to_cpu(mad->buffer)); be64_to_cpu(mad->buffer));
if (rc != H_SUCCESS) { if (rc != H_SUCCESS) {
pr_debug("cap_mad: failed to copy to client, rc %ld\n", dev_dbg(&vscsi->dev, "cap_mad: failed to copy to client, rc %ld\n",
rc); rc);
if (rc == H_PERMISSION) { if (rc == H_PERMISSION) {
if (connection_broken(vscsi)) if (connection_broken(vscsi))
...@@ -1702,8 +1708,8 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue) ...@@ -1702,8 +1708,8 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue)
CLIENT_FAILED); CLIENT_FAILED);
} }
pr_warn("cap_mad: error copying data to client, rc %ld\n", dev_warn(&vscsi->dev, "cap_mad: error copying data to client, rc %ld\n",
rc); rc);
ibmvscsis_post_disconnect(vscsi, ibmvscsis_post_disconnect(vscsi,
ERR_DISCONNECT_RECONNECT, ERR_DISCONNECT_RECONNECT,
flag_bits); flag_bits);
...@@ -1712,8 +1718,8 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue) ...@@ -1712,8 +1718,8 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue)
dma_free_coherent(&vscsi->dma_dev->dev, olen, cap, token); dma_free_coherent(&vscsi->dma_dev->dev, olen, cap, token);
pr_debug("Leaving cap_mad, rc %ld, client_cap 0x%x\n", dev_dbg(&vscsi->dev, "Leaving cap_mad, rc %ld, client_cap 0x%x\n",
rc, vscsi->client_cap); rc, vscsi->client_cap);
return rc; return rc;
} }
...@@ -1749,7 +1755,7 @@ static long ibmvscsis_process_mad(struct scsi_info *vscsi, struct iu_entry *iue) ...@@ -1749,7 +1755,7 @@ static long ibmvscsis_process_mad(struct scsi_info *vscsi, struct iu_entry *iue)
vscsi->fast_fail = true; vscsi->fast_fail = true;
mad->status = cpu_to_be16(VIOSRP_MAD_SUCCESS); mad->status = cpu_to_be16(VIOSRP_MAD_SUCCESS);
} else { } else {
pr_warn("fast fail mad sent after login\n"); dev_warn(&vscsi->dev, "fast fail mad sent after login\n");
mad->status = cpu_to_be16(VIOSRP_MAD_FAILED); mad->status = cpu_to_be16(VIOSRP_MAD_FAILED);
} }
break; break;
...@@ -1809,9 +1815,9 @@ static void srp_snd_msg_failed(struct scsi_info *vscsi, long rc) ...@@ -1809,9 +1815,9 @@ static void srp_snd_msg_failed(struct scsi_info *vscsi, long rc)
*/ */
if ((vscsi->rsp_q_timer.timer_pops < MAX_TIMER_POPS) || if ((vscsi->rsp_q_timer.timer_pops < MAX_TIMER_POPS) ||
(vscsi->state == SRP_PROCESSING)) { (vscsi->state == SRP_PROCESSING)) {
pr_debug("snd_msg_failed: response queue full, flags 0x%x, timer started %d, pops %d\n", dev_dbg(&vscsi->dev, "snd_msg_failed: response queue full, flags 0x%x, timer started %d, pops %d\n",
vscsi->flags, (int)vscsi->rsp_q_timer.started, vscsi->flags, (int)vscsi->rsp_q_timer.started,
vscsi->rsp_q_timer.timer_pops); vscsi->rsp_q_timer.timer_pops);
/* /*
* Check if the timer is running; if it * Check if the timer is running; if it
...@@ -1947,8 +1953,9 @@ static void ibmvscsis_send_messages(struct scsi_info *vscsi) ...@@ -1947,8 +1953,9 @@ static void ibmvscsis_send_messages(struct scsi_info *vscsi)
be64_to_cpu(msg_hi), be64_to_cpu(msg_hi),
be64_to_cpu(cmd->rsp.tag)); be64_to_cpu(cmd->rsp.tag));
pr_debug("send_messages: cmd %p, tag 0x%llx, rc %ld\n", dev_dbg(&vscsi->dev, "send_messages: cmd %p, tag 0x%llx, rc %ld\n",
cmd, be64_to_cpu(cmd->rsp.tag), rc); cmd, be64_to_cpu(cmd->rsp.tag),
rc);
/* if all ok free up the command /* if all ok free up the command
* element resources * element resources
...@@ -2003,7 +2010,8 @@ static void ibmvscsis_send_mad_resp(struct scsi_info *vscsi, ...@@ -2003,7 +2010,8 @@ static void ibmvscsis_send_mad_resp(struct scsi_info *vscsi,
list_add_tail(&cmd->list, &vscsi->waiting_rsp); list_add_tail(&cmd->list, &vscsi->waiting_rsp);
ibmvscsis_send_messages(vscsi); ibmvscsis_send_messages(vscsi);
} else { } else {
pr_debug("Error sending mad response, rc %ld\n", rc); dev_dbg(&vscsi->dev, "Error sending mad response, rc %ld\n",
rc);
if (rc == H_PERMISSION) { if (rc == H_PERMISSION) {
if (connection_broken(vscsi)) if (connection_broken(vscsi))
flag_bits = (RESPONSE_Q_DOWN | CLIENT_FAILED); flag_bits = (RESPONSE_Q_DOWN | CLIENT_FAILED);
...@@ -2039,8 +2047,8 @@ static long ibmvscsis_mad(struct scsi_info *vscsi, struct viosrp_crq *crq) ...@@ -2039,8 +2047,8 @@ static long ibmvscsis_mad(struct scsi_info *vscsi, struct viosrp_crq *crq)
* expecting a response. * expecting a response.
*/ */
case WAIT_CONNECTION: case WAIT_CONNECTION:
pr_debug("mad: in Wait Connection state, ignoring MAD, flags %d\n", dev_dbg(&vscsi->dev, "mad: in Wait Connection state, ignoring MAD, flags %d\n",
vscsi->flags); vscsi->flags);
return ADAPT_SUCCESS; return ADAPT_SUCCESS;
case SRP_PROCESSING: case SRP_PROCESSING:
...@@ -2075,12 +2083,12 @@ static long ibmvscsis_mad(struct scsi_info *vscsi, struct viosrp_crq *crq) ...@@ -2075,12 +2083,12 @@ static long ibmvscsis_mad(struct scsi_info *vscsi, struct viosrp_crq *crq)
if (!rc) { if (!rc) {
mad = (struct mad_common *)&vio_iu(iue)->mad; mad = (struct mad_common *)&vio_iu(iue)->mad;
pr_debug("mad: type %d\n", be32_to_cpu(mad->type)); dev_dbg(&vscsi->dev, "mad: type %d\n", be32_to_cpu(mad->type));
rc = ibmvscsis_process_mad(vscsi, iue); rc = ibmvscsis_process_mad(vscsi, iue);
pr_debug("mad: status %hd, rc %ld\n", be16_to_cpu(mad->status), dev_dbg(&vscsi->dev, "mad: status %hd, rc %ld\n",
rc); be16_to_cpu(mad->status), rc);
if (!rc) if (!rc)
ibmvscsis_send_mad_resp(vscsi, cmd, crq); ibmvscsis_send_mad_resp(vscsi, cmd, crq);
...@@ -2088,7 +2096,7 @@ static long ibmvscsis_mad(struct scsi_info *vscsi, struct viosrp_crq *crq) ...@@ -2088,7 +2096,7 @@ static long ibmvscsis_mad(struct scsi_info *vscsi, struct viosrp_crq *crq)
ibmvscsis_free_cmd_resources(vscsi, cmd); ibmvscsis_free_cmd_resources(vscsi, cmd);
} }
pr_debug("Leaving mad, rc %ld\n", rc); dev_dbg(&vscsi->dev, "Leaving mad, rc %ld\n", rc);
return rc; return rc;
} }
...@@ -2211,16 +2219,17 @@ static int ibmvscsis_make_nexus(struct ibmvscsis_tport *tport) ...@@ -2211,16 +2219,17 @@ static int ibmvscsis_make_nexus(struct ibmvscsis_tport *tport)
{ {
char *name = tport->tport_name; char *name = tport->tport_name;
struct ibmvscsis_nexus *nexus; struct ibmvscsis_nexus *nexus;
struct scsi_info *vscsi = container_of(tport, struct scsi_info, tport);
int rc; int rc;
if (tport->ibmv_nexus) { if (tport->ibmv_nexus) {
pr_debug("tport->ibmv_nexus already exists\n"); dev_dbg(&vscsi->dev, "tport->ibmv_nexus already exists\n");
return 0; return 0;
} }
nexus = kzalloc(sizeof(*nexus), GFP_KERNEL); nexus = kzalloc(sizeof(*nexus), GFP_KERNEL);
if (!nexus) { if (!nexus) {
pr_err("Unable to allocate struct ibmvscsis_nexus\n"); dev_err(&vscsi->dev, "Unable to allocate struct ibmvscsis_nexus\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -2316,7 +2325,7 @@ static long ibmvscsis_srp_login(struct scsi_info *vscsi, ...@@ -2316,7 +2325,7 @@ static long ibmvscsis_srp_login(struct scsi_info *vscsi,
cmd->rsp.format = VIOSRP_SRP_FORMAT; cmd->rsp.format = VIOSRP_SRP_FORMAT;
cmd->rsp.tag = req->tag; cmd->rsp.tag = req->tag;
pr_debug("srp_login: reason 0x%x\n", reason); dev_dbg(&vscsi->dev, "srp_login: reason 0x%x\n", reason);
if (reason) if (reason)
rc = ibmvscsis_srp_login_rej(vscsi, cmd, reason); rc = ibmvscsis_srp_login_rej(vscsi, cmd, reason);
...@@ -2333,7 +2342,7 @@ static long ibmvscsis_srp_login(struct scsi_info *vscsi, ...@@ -2333,7 +2342,7 @@ static long ibmvscsis_srp_login(struct scsi_info *vscsi,
ibmvscsis_free_cmd_resources(vscsi, cmd); ibmvscsis_free_cmd_resources(vscsi, cmd);
} }
pr_debug("Leaving srp_login, rc %ld\n", rc); dev_dbg(&vscsi->dev, "Leaving srp_login, rc %ld\n", rc);
return rc; return rc;
} }
...@@ -2415,8 +2424,8 @@ static void ibmvscsis_srp_cmd(struct scsi_info *vscsi, struct viosrp_crq *crq) ...@@ -2415,8 +2424,8 @@ static void ibmvscsis_srp_cmd(struct scsi_info *vscsi, struct viosrp_crq *crq)
case SRP_TSK_MGMT: case SRP_TSK_MGMT:
tsk = &vio_iu(iue)->srp.tsk_mgmt; tsk = &vio_iu(iue)->srp.tsk_mgmt;
pr_debug("tsk_mgmt tag: %llu (0x%llx)\n", tsk->tag, dev_dbg(&vscsi->dev, "tsk_mgmt tag: %llu (0x%llx)\n",
tsk->tag); tsk->tag, tsk->tag);
cmd->rsp.tag = tsk->tag; cmd->rsp.tag = tsk->tag;
vscsi->debit += 1; vscsi->debit += 1;
cmd->type = TASK_MANAGEMENT; cmd->type = TASK_MANAGEMENT;
...@@ -2425,8 +2434,8 @@ static void ibmvscsis_srp_cmd(struct scsi_info *vscsi, struct viosrp_crq *crq) ...@@ -2425,8 +2434,8 @@ static void ibmvscsis_srp_cmd(struct scsi_info *vscsi, struct viosrp_crq *crq)
break; break;
case SRP_CMD: case SRP_CMD:
pr_debug("srp_cmd tag: %llu (0x%llx)\n", srp->tag, dev_dbg(&vscsi->dev, "srp_cmd tag: %llu (0x%llx)\n",
srp->tag); srp->tag, srp->tag);
cmd->rsp.tag = srp->tag; cmd->rsp.tag = srp->tag;
vscsi->debit += 1; vscsi->debit += 1;
cmd->type = SCSI_CDB; cmd->type = SCSI_CDB;
...@@ -2603,7 +2612,7 @@ static int read_dma_window(struct scsi_info *vscsi) ...@@ -2603,7 +2612,7 @@ static int read_dma_window(struct scsi_info *vscsi)
"ibm,my-dma-window", "ibm,my-dma-window",
NULL); NULL);
if (!dma_window) { if (!dma_window) {
pr_err("Couldn't find ibm,my-dma-window property\n"); dev_err(&vscsi->dev, "Couldn't find ibm,my-dma-window property\n");
return -1; return -1;
} }
...@@ -2613,7 +2622,7 @@ static int read_dma_window(struct scsi_info *vscsi) ...@@ -2613,7 +2622,7 @@ static int read_dma_window(struct scsi_info *vscsi)
prop = (const __be32 *)vio_get_attribute(vdev, "ibm,#dma-address-cells", prop = (const __be32 *)vio_get_attribute(vdev, "ibm,#dma-address-cells",
NULL); NULL);
if (!prop) { if (!prop) {
pr_warn("Couldn't find ibm,#dma-address-cells property\n"); dev_warn(&vscsi->dev, "Couldn't find ibm,#dma-address-cells property\n");
dma_window++; dma_window++;
} else { } else {
dma_window += be32_to_cpu(*prop); dma_window += be32_to_cpu(*prop);
...@@ -2622,7 +2631,7 @@ static int read_dma_window(struct scsi_info *vscsi) ...@@ -2622,7 +2631,7 @@ static int read_dma_window(struct scsi_info *vscsi)
prop = (const __be32 *)vio_get_attribute(vdev, "ibm,#dma-size-cells", prop = (const __be32 *)vio_get_attribute(vdev, "ibm,#dma-size-cells",
NULL); NULL);
if (!prop) { if (!prop) {
pr_warn("Couldn't find ibm,#dma-size-cells property\n"); dev_warn(&vscsi->dev, "Couldn't find ibm,#dma-size-cells property\n");
dma_window++; dma_window++;
} else { } else {
dma_window += be32_to_cpu(*prop); dma_window += be32_to_cpu(*prop);
...@@ -2808,8 +2817,8 @@ static void ibmvscsis_parse_task(struct scsi_info *vscsi, ...@@ -2808,8 +2817,8 @@ static void ibmvscsis_parse_task(struct scsi_info *vscsi,
srp_tsk->lun.scsi_lun[0] &= 0x3f; srp_tsk->lun.scsi_lun[0] &= 0x3f;
pr_debug("calling submit_tmr, func %d\n", dev_dbg(&vscsi->dev, "calling submit_tmr, func %d\n",
srp_tsk->tsk_mgmt_func); srp_tsk->tsk_mgmt_func);
rc = target_submit_tmr(&cmd->se_cmd, nexus->se_sess, NULL, rc = target_submit_tmr(&cmd->se_cmd, nexus->se_sess, NULL,
scsilun_to_int(&srp_tsk->lun), srp_tsk, scsilun_to_int(&srp_tsk->lun), srp_tsk,
tcm_type, GFP_KERNEL, tag_to_abort, 0); tcm_type, GFP_KERNEL, tag_to_abort, 0);
...@@ -3113,8 +3122,8 @@ static long srp_build_response(struct scsi_info *vscsi, ...@@ -3113,8 +3122,8 @@ static long srp_build_response(struct scsi_info *vscsi,
if (cmd->type == SCSI_CDB) { if (cmd->type == SCSI_CDB) {
rsp->status = ibmvscsis_fast_fail(vscsi, cmd); rsp->status = ibmvscsis_fast_fail(vscsi, cmd);
if (rsp->status) { if (rsp->status) {
pr_debug("build_resp: cmd %p, scsi status %d\n", cmd, dev_dbg(&vscsi->dev, "build_resp: cmd %p, scsi status %d\n",
(int)rsp->status); cmd, (int)rsp->status);
ibmvscsis_determine_resid(se_cmd, rsp); ibmvscsis_determine_resid(se_cmd, rsp);
if (se_cmd->scsi_sense_length && se_cmd->sense_buffer) { if (se_cmd->scsi_sense_length && se_cmd->sense_buffer) {
rsp->sense_data_len = rsp->sense_data_len =
...@@ -3127,7 +3136,8 @@ static long srp_build_response(struct scsi_info *vscsi, ...@@ -3127,7 +3136,8 @@ static long srp_build_response(struct scsi_info *vscsi,
rsp->sol_not = (cmd->rsp.sol_not & UCSOLNT) >> rsp->sol_not = (cmd->rsp.sol_not & UCSOLNT) >>
UCSOLNT_RESP_SHIFT; UCSOLNT_RESP_SHIFT;
} else if (cmd->flags & CMD_FAST_FAIL) { } else if (cmd->flags & CMD_FAST_FAIL) {
pr_debug("build_resp: cmd %p, fast fail\n", cmd); dev_dbg(&vscsi->dev, "build_resp: cmd %p, fast fail\n",
cmd);
rsp->sol_not = (cmd->rsp.sol_not & UCSOLNT) >> rsp->sol_not = (cmd->rsp.sol_not & UCSOLNT) >>
UCSOLNT_RESP_SHIFT; UCSOLNT_RESP_SHIFT;
} else { } else {
...@@ -3340,7 +3350,7 @@ static void ibmvscsis_handle_crq(unsigned long data) ...@@ -3340,7 +3350,7 @@ static void ibmvscsis_handle_crq(unsigned long data)
spin_lock_bh(&vscsi->intr_lock); spin_lock_bh(&vscsi->intr_lock);
pr_debug("got interrupt\n"); dev_dbg(&vscsi->dev, "got interrupt\n");
/* /*
* if we are in a path where we are waiting for all pending commands * if we are in a path where we are waiting for all pending commands
...@@ -3350,8 +3360,8 @@ static void ibmvscsis_handle_crq(unsigned long data) ...@@ -3350,8 +3360,8 @@ static void ibmvscsis_handle_crq(unsigned long data)
if (TARGET_STOP(vscsi)) { if (TARGET_STOP(vscsi)) {
vio_enable_interrupts(vscsi->dma_dev); vio_enable_interrupts(vscsi->dma_dev);
pr_debug("handle_crq, don't process: flags 0x%x, state 0x%hx\n", dev_dbg(&vscsi->dev, "handle_crq, don't process: flags 0x%x, state 0x%hx\n",
vscsi->flags, vscsi->state); vscsi->flags, vscsi->state);
spin_unlock_bh(&vscsi->intr_lock); spin_unlock_bh(&vscsi->intr_lock);
return; return;
} }
...@@ -3414,20 +3424,20 @@ static void ibmvscsis_handle_crq(unsigned long data) ...@@ -3414,20 +3424,20 @@ static void ibmvscsis_handle_crq(unsigned long data)
if (ack) { if (ack) {
vio_enable_interrupts(vscsi->dma_dev); vio_enable_interrupts(vscsi->dma_dev);
ack = false; ack = false;
pr_debug("handle_crq, reenabling interrupts\n"); dev_dbg(&vscsi->dev, "handle_crq, reenabling interrupts\n");
} }
valid = crq->valid; valid = crq->valid;
dma_rmb(); dma_rmb();
if (valid) if (valid)
goto cmd_work; goto cmd_work;
} else { } else {
pr_debug("handle_crq, error: flags 0x%x, state 0x%hx, crq index 0x%x\n", dev_dbg(&vscsi->dev, "handle_crq, error: flags 0x%x, state 0x%hx, crq index 0x%x\n",
vscsi->flags, vscsi->state, vscsi->cmd_q.index); vscsi->flags, vscsi->state, vscsi->cmd_q.index);
} }
pr_debug("Leaving handle_crq: schedule_q empty %d, flags 0x%x, state 0x%hx\n", dev_dbg(&vscsi->dev, "Leaving handle_crq: schedule_q empty %d, flags 0x%x, state 0x%hx\n",
(int)list_empty(&vscsi->schedule_q), vscsi->flags, (int)list_empty(&vscsi->schedule_q), vscsi->flags,
vscsi->state); vscsi->state);
spin_unlock_bh(&vscsi->intr_lock); spin_unlock_bh(&vscsi->intr_lock);
} }
...@@ -3443,7 +3453,7 @@ static int ibmvscsis_probe(struct vio_dev *vdev, ...@@ -3443,7 +3453,7 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
vscsi = kzalloc(sizeof(*vscsi), GFP_KERNEL); vscsi = kzalloc(sizeof(*vscsi), GFP_KERNEL);
if (!vscsi) { if (!vscsi) {
rc = -ENOMEM; rc = -ENOMEM;
pr_err("probe: allocation of adapter failed\n"); dev_err(&vdev->dev, "probe: allocation of adapter failed\n");
return rc; return rc;
} }
...@@ -3456,14 +3466,14 @@ static int ibmvscsis_probe(struct vio_dev *vdev, ...@@ -3456,14 +3466,14 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
snprintf(vscsi->tport.tport_name, IBMVSCSIS_NAMELEN, "%s", snprintf(vscsi->tport.tport_name, IBMVSCSIS_NAMELEN, "%s",
dev_name(&vdev->dev)); dev_name(&vdev->dev));
pr_debug("probe tport_name: %s\n", vscsi->tport.tport_name); dev_dbg(&vscsi->dev, "probe tport_name: %s\n", vscsi->tport.tport_name);
rc = read_dma_window(vscsi); rc = read_dma_window(vscsi);
if (rc) if (rc)
goto free_adapter; goto free_adapter;
pr_debug("Probe: liobn 0x%x, riobn 0x%x\n", dev_dbg(&vscsi->dev, "Probe: liobn 0x%x, riobn 0x%x\n",
vscsi->dds.window[LOCAL].liobn, vscsi->dds.window[LOCAL].liobn,
vscsi->dds.window[REMOTE].liobn); vscsi->dds.window[REMOTE].liobn);
strcpy(vscsi->eye, "VSCSI "); strcpy(vscsi->eye, "VSCSI ");
strncat(vscsi->eye, vdev->name, MAX_EYE); strncat(vscsi->eye, vdev->name, MAX_EYE);
...@@ -3541,8 +3551,8 @@ static int ibmvscsis_probe(struct vio_dev *vdev, ...@@ -3541,8 +3551,8 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
* client can connect" and the client isn't activated yet. * client can connect" and the client isn't activated yet.
* We'll make the call again when he sends an init msg. * We'll make the call again when he sends an init msg.
*/ */
pr_debug("probe hrc %ld, client partition num %d\n", dev_dbg(&vscsi->dev, "probe hrc %ld, client partition num %d\n",
hrc, vscsi->client_data.partition_number); hrc, vscsi->client_data.partition_number);
tasklet_init(&vscsi->work_task, ibmvscsis_handle_crq, tasklet_init(&vscsi->work_task, ibmvscsis_handle_crq,
(unsigned long)vscsi); (unsigned long)vscsi);
...@@ -3602,7 +3612,7 @@ static int ibmvscsis_remove(struct vio_dev *vdev) ...@@ -3602,7 +3612,7 @@ static int ibmvscsis_remove(struct vio_dev *vdev)
{ {
struct scsi_info *vscsi = dev_get_drvdata(&vdev->dev); struct scsi_info *vscsi = dev_get_drvdata(&vdev->dev);
pr_debug("remove (%s)\n", dev_name(&vscsi->dma_dev->dev)); dev_dbg(&vscsi->dev, "remove (%s)\n", dev_name(&vscsi->dma_dev->dev));
spin_lock_bh(&vscsi->intr_lock); spin_lock_bh(&vscsi->intr_lock);
ibmvscsis_post_disconnect(vscsi, UNCONFIGURING, 0); ibmvscsis_post_disconnect(vscsi, UNCONFIGURING, 0);
...@@ -3766,14 +3776,16 @@ static int ibmvscsis_write_pending(struct se_cmd *se_cmd) ...@@ -3766,14 +3776,16 @@ static int ibmvscsis_write_pending(struct se_cmd *se_cmd)
* attempt an srp_transfer_data. * attempt an srp_transfer_data.
*/ */
if ((vscsi->flags & (CLIENT_FAILED | RESPONSE_Q_DOWN))) { if ((vscsi->flags & (CLIENT_FAILED | RESPONSE_Q_DOWN))) {
pr_err("write_pending failed since: %d\n", vscsi->flags); dev_err(&vscsi->dev, "write_pending failed since: %d\n",
vscsi->flags);
return -EIO; return -EIO;
} }
rc = srp_transfer_data(cmd, &vio_iu(iue)->srp.cmd, ibmvscsis_rdma, rc = srp_transfer_data(cmd, &vio_iu(iue)->srp.cmd, ibmvscsis_rdma,
1, 1); 1, 1);
if (rc) { if (rc) {
pr_err("srp_transfer_data() failed: %d\n", rc); dev_err(&vscsi->dev, "srp_transfer_data() failed: %d\n", rc);
return -EIO; return -EIO;
} }
/* /*
...@@ -3811,7 +3823,7 @@ static int ibmvscsis_queue_data_in(struct se_cmd *se_cmd) ...@@ -3811,7 +3823,7 @@ static int ibmvscsis_queue_data_in(struct se_cmd *se_cmd)
rc = srp_transfer_data(cmd, &vio_iu(iue)->srp.cmd, ibmvscsis_rdma, 1, rc = srp_transfer_data(cmd, &vio_iu(iue)->srp.cmd, ibmvscsis_rdma, 1,
1); 1);
if (rc) { if (rc) {
pr_err("srp_transfer_data failed: %d\n", rc); dev_err(&vscsi->dev, "srp_transfer_data failed: %d\n", rc);
sd = se_cmd->sense_buffer; sd = se_cmd->sense_buffer;
se_cmd->scsi_sense_length = 18; se_cmd->scsi_sense_length = 18;
memset(se_cmd->sense_buffer, 0, se_cmd->scsi_sense_length); memset(se_cmd->sense_buffer, 0, se_cmd->scsi_sense_length);
...@@ -3834,7 +3846,7 @@ static int ibmvscsis_queue_status(struct se_cmd *se_cmd) ...@@ -3834,7 +3846,7 @@ static int ibmvscsis_queue_status(struct se_cmd *se_cmd)
struct scsi_info *vscsi = cmd->adapter; struct scsi_info *vscsi = cmd->adapter;
uint len; uint len;
pr_debug("queue_status %p\n", se_cmd); dev_dbg(&vscsi->dev, "queue_status %p\n", se_cmd);
srp_build_response(vscsi, cmd, &len); srp_build_response(vscsi, cmd, &len);
cmd->rsp.format = SRP_FORMAT; cmd->rsp.format = SRP_FORMAT;
...@@ -3854,8 +3866,8 @@ static void ibmvscsis_queue_tm_rsp(struct se_cmd *se_cmd) ...@@ -3854,8 +3866,8 @@ static void ibmvscsis_queue_tm_rsp(struct se_cmd *se_cmd)
u64 tag_to_abort = be64_to_cpu(srp_tsk->task_tag); u64 tag_to_abort = be64_to_cpu(srp_tsk->task_tag);
uint len; uint len;
pr_debug("queue_tm_rsp %p, status %d\n", dev_dbg(&vscsi->dev, "queue_tm_rsp %p, status %d\n",
se_cmd, (int)se_cmd->se_tmr_req->response); se_cmd, (int)se_cmd->se_tmr_req->response);
if (srp_tsk->tsk_mgmt_func == SRP_TSK_ABORT_TASK && if (srp_tsk->tsk_mgmt_func == SRP_TSK_ABORT_TASK &&
cmd->se_cmd.se_tmr_req->response == TMR_TASK_DOES_NOT_EXIST) { cmd->se_cmd.se_tmr_req->response == TMR_TASK_DOES_NOT_EXIST) {
...@@ -3877,8 +3889,12 @@ static void ibmvscsis_queue_tm_rsp(struct se_cmd *se_cmd) ...@@ -3877,8 +3889,12 @@ static void ibmvscsis_queue_tm_rsp(struct se_cmd *se_cmd)
static void ibmvscsis_aborted_task(struct se_cmd *se_cmd) static void ibmvscsis_aborted_task(struct se_cmd *se_cmd)
{ {
pr_debug("ibmvscsis_aborted_task %p task_tag: %llu\n", struct ibmvscsis_cmd *cmd = container_of(se_cmd, struct ibmvscsis_cmd,
se_cmd, se_cmd->tag); se_cmd);
struct scsi_info *vscsi = cmd->adapter;
dev_dbg(&vscsi->dev, "ibmvscsis_aborted_task %p task_tag: %llu\n",
se_cmd, se_cmd->tag);
} }
static struct se_wwn *ibmvscsis_make_tport(struct target_fabric_configfs *tf, static struct se_wwn *ibmvscsis_make_tport(struct target_fabric_configfs *tf,
...@@ -3886,12 +3902,14 @@ static struct se_wwn *ibmvscsis_make_tport(struct target_fabric_configfs *tf, ...@@ -3886,12 +3902,14 @@ static struct se_wwn *ibmvscsis_make_tport(struct target_fabric_configfs *tf,
const char *name) const char *name)
{ {
struct ibmvscsis_tport *tport; struct ibmvscsis_tport *tport;
struct scsi_info *vscsi;
tport = ibmvscsis_lookup_port(name); tport = ibmvscsis_lookup_port(name);
if (tport) { if (tport) {
vscsi = container_of(tport, struct scsi_info, tport);
tport->tport_proto_id = SCSI_PROTOCOL_SRP; tport->tport_proto_id = SCSI_PROTOCOL_SRP;
pr_debug("make_tport(%s), pointer:%p, tport_id:%x\n", dev_dbg(&vscsi->dev, "make_tport(%s), pointer:%p, tport_id:%x\n",
name, tport, tport->tport_proto_id); name, tport, tport->tport_proto_id);
return &tport->tport_wwn; return &tport->tport_wwn;
} }
...@@ -3903,9 +3921,10 @@ static void ibmvscsis_drop_tport(struct se_wwn *wwn) ...@@ -3903,9 +3921,10 @@ static void ibmvscsis_drop_tport(struct se_wwn *wwn)
struct ibmvscsis_tport *tport = container_of(wwn, struct ibmvscsis_tport *tport = container_of(wwn,
struct ibmvscsis_tport, struct ibmvscsis_tport,
tport_wwn); tport_wwn);
struct scsi_info *vscsi = container_of(tport, struct scsi_info, tport);
pr_debug("drop_tport(%s)\n", dev_dbg(&vscsi->dev, "drop_tport(%s)\n",
config_item_name(&tport->tport_wwn.wwn_group.cg_item)); config_item_name(&tport->tport_wwn.wwn_group.cg_item));
} }
static struct se_portal_group *ibmvscsis_make_tpg(struct se_wwn *wwn, static struct se_portal_group *ibmvscsis_make_tpg(struct se_wwn *wwn,
...@@ -3990,12 +4009,12 @@ static ssize_t ibmvscsis_tpg_enable_store(struct config_item *item, ...@@ -3990,12 +4009,12 @@ static ssize_t ibmvscsis_tpg_enable_store(struct config_item *item,
rc = kstrtoul(page, 0, &tmp); rc = kstrtoul(page, 0, &tmp);
if (rc < 0) { if (rc < 0) {
pr_err("Unable to extract srpt_tpg_store_enable\n"); dev_err(&vscsi->dev, "Unable to extract srpt_tpg_store_enable\n");
return -EINVAL; return -EINVAL;
} }
if ((tmp != 0) && (tmp != 1)) { if ((tmp != 0) && (tmp != 1)) {
pr_err("Illegal value for srpt_tpg_store_enable\n"); dev_err(&vscsi->dev, "Illegal value for srpt_tpg_store_enable\n");
return -EINVAL; return -EINVAL;
} }
...@@ -4004,8 +4023,8 @@ static ssize_t ibmvscsis_tpg_enable_store(struct config_item *item, ...@@ -4004,8 +4023,8 @@ static ssize_t ibmvscsis_tpg_enable_store(struct config_item *item,
tport->enabled = true; tport->enabled = true;
lrc = ibmvscsis_enable_change_state(vscsi); lrc = ibmvscsis_enable_change_state(vscsi);
if (lrc) if (lrc)
pr_err("enable_change_state failed, rc %ld state %d\n", dev_err(&vscsi->dev, "enable_change_state failed, rc %ld state %d\n",
lrc, vscsi->state); lrc, vscsi->state);
spin_unlock_bh(&vscsi->intr_lock); spin_unlock_bh(&vscsi->intr_lock);
} else { } else {
spin_lock_bh(&vscsi->intr_lock); spin_lock_bh(&vscsi->intr_lock);
...@@ -4015,7 +4034,8 @@ static ssize_t ibmvscsis_tpg_enable_store(struct config_item *item, ...@@ -4015,7 +4034,8 @@ static ssize_t ibmvscsis_tpg_enable_store(struct config_item *item,
spin_unlock_bh(&vscsi->intr_lock); spin_unlock_bh(&vscsi->intr_lock);
} }
pr_debug("tpg_enable_store, tmp %ld, state %d\n", tmp, vscsi->state); dev_dbg(&vscsi->dev, "tpg_enable_store, tmp %ld, state %d\n", tmp,
vscsi->state);
return count; return count;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment