[ofa-general] [PATCH] IB/srp: add identifying information to log messages
David Dillow
dillowda at ornl.gov
Fri Dec 21 12:39:04 PST 2007
When you have multiple targets, it gets really confusing when you try to
track down who did a reset when there is no identifying information in
the log message, especially when the same extension ID is mapped through
two different local IB ports. So, add an identifier that can be used to
track back to which local IB port/remote target pair is the one having
problems.
Signed-off-by: David Dillow <dillowda at ornl.gov>
---
This is against the previous three patches to respect the credit limit
and allow scatter/gather. I may apply with offsets without those.
ib_srp.c | 79 +++++++++++++++++++++++++++++++++++++++++----------------------
1 file changed, 52 insertions(+), 27 deletions(-)
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 4f58f94..717f186 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -272,7 +272,8 @@ static void srp_path_rec_completion(int status,
target->status = status;
if (status)
- printk(KERN_ERR PFX "Got failed path rec status %d\n", status);
+ printk(KERN_ERR PFX "scsi%d: Got failed path rec status %d\n",
+ target->scsi_host->host_no, status);
else
target->path = *pathrec;
complete(&target->done);
@@ -303,7 +304,8 @@ static int srp_lookup_path(struct srp_target_port *target)
wait_for_completion(&target->done);
if (target->status < 0)
- printk(KERN_WARNING PFX "Path record query failed\n");
+ printk(KERN_WARNING PFX "scsi%d: Path record query failed\n",
+ target->scsi_host->host_no);
return target->status;
}
@@ -400,7 +402,8 @@ static void srp_disconnect_target(struct srp_target_port *target)
init_completion(&target->done);
if (ib_send_cm_dreq(target->cm_id, NULL, 0)) {
- printk(KERN_DEBUG PFX "Sending CM DREQ failed\n");
+ printk(KERN_DEBUG PFX "scsi%d: Sending CM DREQ failed\n",
+ target->scsi_host->host_no);
return;
}
wait_for_completion(&target->done);
@@ -568,7 +571,8 @@ static int srp_reconnect_target(struct srp_target_port *target)
return ret;
err:
- printk(KERN_ERR PFX "reconnect failed (%d), removing target port.\n", ret);
+ printk(KERN_ERR PFX "scsi%d: reconnect failed (%d), removing target "
+ "port.\n", target->scsi_host->host_no, ret);
/*
* We couldn't reconnect, so kill our target port off.
@@ -683,8 +687,8 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target,
if (scmnd->sc_data_direction != DMA_FROM_DEVICE &&
scmnd->sc_data_direction != DMA_TO_DEVICE) {
- printk(KERN_WARNING PFX "Unhandled data direction %d\n",
- scmnd->sc_data_direction);
+ printk(KERN_WARNING PFX "scsi%d: Unhandled data direction %d\n",
+ target->scsi_host->host_no, scmnd->sc_data_direction);
return -EINVAL;
}
@@ -786,7 +790,8 @@ static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp)
} else {
scmnd = req->scmnd;
if (!scmnd)
- printk(KERN_ERR "Null scmnd for RSP w/tag %016llx\n",
+ printk(KERN_ERR "scsi%d: Null scmnd for RSP w/tag "
+ "%016llx\n", target->scsi_host->host_no,
(unsigned long long) rsp->tag);
scmnd->result = rsp->status;
@@ -831,7 +836,8 @@ static void srp_handle_recv(struct srp_target_port *target, struct ib_wc *wc)
if (0) {
int i;
- printk(KERN_ERR PFX "recv completion, opcode 0x%02x\n", opcode);
+ printk(KERN_ERR PFX "scsi%d: recv completion, opcode 0x%02x\n",
+ target->scsi_host->host_no, opcode);
for (i = 0; i < wc->byte_len; ++i) {
if (i % 8 == 0)
@@ -852,11 +858,13 @@ static void srp_handle_recv(struct srp_target_port *target, struct ib_wc *wc)
case SRP_T_LOGOUT:
/* XXX Handle target logout */
- printk(KERN_WARNING PFX "Got target logout request\n");
+ printk(KERN_WARNING PFX "scsi%d: Got target logout request\n",
+ target->scsi_host->host_no);
break;
default:
- printk(KERN_WARNING PFX "Unhandled SRP opcode 0x%02x\n", opcode);
+ printk(KERN_WARNING PFX "scsi%d: Unhandled SRP opcode 0x%02x\n",
+ target->scsi_host->host_no, opcode);
break;
}
@@ -872,7 +880,8 @@ static void srp_completion(struct ib_cq *cq, void *target_ptr)
ib_req_notify_cq(cq, IB_CQ_NEXT_COMP);
while (ib_poll_cq(cq, 1, &wc) > 0) {
if (wc.status) {
- printk(KERN_ERR PFX "failed %s status %d\n",
+ printk(KERN_ERR PFX "scsi%d: failed %s status %d\n",
+ target->scsi_host->host_no,
wc.wr_id & SRP_OP_RECV ? "receive" : "send",
wc.status);
target->qp_in_error = 1;
@@ -1027,12 +1036,14 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd,
len = srp_map_data(scmnd, target, req);
if (len < 0) {
- printk(KERN_ERR PFX "Failed to map data\n");
+ printk(KERN_ERR PFX "scsi%d: Failed to map data\n",
+ target->scsi_host->host_no);
goto err;
}
if (__srp_post_recv(target)) {
- printk(KERN_ERR PFX "Recv failed\n");
+ printk(KERN_ERR PFX "scsi%d: Recv failed\n",
+ target->scsi_host->host_no);
goto err_unmap;
}
@@ -1040,7 +1051,8 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd,
DMA_TO_DEVICE);
if (__srp_post_send(target, iu, len)) {
- printk(KERN_ERR PFX "Send failed\n");
+ printk(KERN_ERR PFX "scsi%d: Send failed\n",
+ target->scsi_host->host_no);
goto err_unmap;
}
@@ -1171,7 +1183,8 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
switch (event->event) {
case IB_CM_REQ_ERROR:
- printk(KERN_DEBUG PFX "Sending CM REQ failed\n");
+ printk(KERN_DEBUG PFX "scsi%d: Sending CM REQ failed\n",
+ target->scsi_host->host_no);
comp = 1;
target->status = -ECONNRESET;
break;
@@ -1186,7 +1199,8 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
target->max_ti_iu_len = be32_to_cpu(rsp->max_ti_iu_len);
target->req_lim = be32_to_cpu(rsp->req_lim_delta);
} else {
- printk(KERN_WARNING PFX "Unhandled RSP opcode %#x\n", opcode);
+ printk(KERN_WARNING PFX "scsi%d: Unhandled RSP opcode "
+ "%#x\n", target->scsi_host->host_no, opcode);
target->status = -ECONNRESET;
break;
}
@@ -1232,20 +1246,24 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
break;
case IB_CM_REJ_RECEIVED:
- printk(KERN_DEBUG PFX "REJ received\n");
+ printk(KERN_DEBUG PFX "scsi%d: REJ received\n",
+ target->scsi_host->host_no);
comp = 1;
srp_cm_rej_handler(cm_id, event, target);
break;
case IB_CM_DREQ_RECEIVED:
- printk(KERN_WARNING PFX "DREQ received - connection closed\n");
+ printk(KERN_WARNING PFX "scsi%d: DREQ received - connection "
+ "closed\n", target->scsi_host->host_no);
if (ib_send_cm_drep(cm_id, NULL, 0))
- printk(KERN_ERR PFX "Sending CM DREP failed\n");
+ printk(KERN_ERR PFX "scsi%d: Sending CM DREP failed\n",
+ target->scsi_host->host_no);
break;
case IB_CM_TIMEWAIT_EXIT:
- printk(KERN_ERR PFX "connection closed\n");
+ printk(KERN_ERR PFX "scsi%d: connection closed\n",
+ target->scsi_host->host_no);
comp = 1;
target->status = 0;
@@ -1257,7 +1275,8 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
break;
default:
- printk(KERN_WARNING PFX "Unhandled CM event %d\n", event->event);
+ printk(KERN_WARNING PFX "scsi%d: Unhandled CM event %d\n",
+ target->scsi_host->host_no, event->event);
break;
}
@@ -1334,7 +1353,8 @@ static int srp_abort(struct scsi_cmnd *scmnd)
struct srp_request *req;
int ret = SUCCESS;
- printk(KERN_ERR "SRP abort called\n");
+ printk(KERN_ERR "scsi%d: SRP abort called\n",
+ target->scsi_host->host_no);
if (target->qp_in_error)
return FAILED;
@@ -1364,7 +1384,8 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
struct srp_target_port *target = host_to_target(scmnd->device->host);
struct srp_request *req, *tmp;
- printk(KERN_ERR "SRP reset_device called\n");
+ printk(KERN_ERR "scsi%d: SRP reset_device called\n",
+ target->scsi_host->host_no);
if (target->qp_in_error)
return FAILED;
@@ -1391,7 +1412,8 @@ static int srp_reset_host(struct scsi_cmnd *scmnd)
struct srp_target_port *target = host_to_target(scmnd->device->host);
int ret = FAILED;
- printk(KERN_ERR PFX "SRP reset_host called\n");
+ printk(KERN_ERR PFX "scsi%d: SRP reset_host called\n",
+ target->scsi_host->host_no);
if (!srp_reconnect_target(target))
ret = SUCCESS;
@@ -1827,8 +1849,10 @@ static ssize_t srp_create_target(struct class_device *class_dev,
ib_get_cached_gid(host->dev->dev, host->port, 0, &target->path.sgid);
- printk(KERN_DEBUG PFX "new target: id_ext %016llx ioc_guid %016llx pkey %04x "
- "service_id %016llx dgid %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
+ printk(KERN_DEBUG PFX "scsi%d: new target: id_ext %016llx "
+ "ioc_guid %016llx pkey %04x service_id %016llx "
+ "dgid %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
+ target->scsi_host->host_no,
(unsigned long long) be64_to_cpu(target->id_ext),
(unsigned long long) be64_to_cpu(target->ioc_guid),
be16_to_cpu(target->path.pkey),
@@ -1855,7 +1879,8 @@ static ssize_t srp_create_target(struct class_device *class_dev,
target->qp_in_error = 0;
ret = srp_connect_target(target);
if (ret) {
- printk(KERN_ERR PFX "Connection failed\n");
+ printk(KERN_ERR PFX "scsi%d: Connection failed\n",
+ target->scsi_host->host_no);
goto err_cm_id;
}
More information about the general
mailing list