aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorDavid Dillow <dillowda@ornl.gov>2008-01-07 18:23:41 -0500
committerRoland Dreier <rolandd@cisco.com>2008-01-25 17:15:38 -0500
commit7aa54bd730df1468c90ae84b56ade7f322b44de7 (patch)
tree249aa5c24972a08f6550b2c83378aa921f64e6da /drivers/infiniband
parent586a693448676de5174e752426ced69ec79ab174 (diff)
IB/srp: Add identifying information to log messages
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@ornl.gov> Acked-by: Pete Wyckoff <pw@osc.edu> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c117
1 files changed, 71 insertions, 46 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 66dade7ab38b..f2d2c7e2c76b 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,
272 272
273 target->status = status; 273 target->status = status;
274 if (status) 274 if (status)
275 printk(KERN_ERR PFX "Got failed path rec status %d\n", status); 275 shost_printk(KERN_ERR, target->scsi_host,
276 PFX "Got failed path rec status %d\n", status);
276 else 277 else
277 target->path = *pathrec; 278 target->path = *pathrec;
278 complete(&target->done); 279 complete(&target->done);
@@ -303,7 +304,8 @@ static int srp_lookup_path(struct srp_target_port *target)
303 wait_for_completion(&target->done); 304 wait_for_completion(&target->done);
304 305
305 if (target->status < 0) 306 if (target->status < 0)
306 printk(KERN_WARNING PFX "Path record query failed\n"); 307 shost_printk(KERN_WARNING, target->scsi_host,
308 PFX "Path record query failed\n");
307 309
308 return target->status; 310 return target->status;
309} 311}
@@ -379,9 +381,10 @@ static int srp_send_req(struct srp_target_port *target)
379 * the second 8 bytes to the local node GUID. 381 * the second 8 bytes to the local node GUID.
380 */ 382 */
381 if (srp_target_is_topspin(target)) { 383 if (srp_target_is_topspin(target)) {
382 printk(KERN_DEBUG PFX "Topspin/Cisco initiator port ID workaround " 384 shost_printk(KERN_DEBUG, target->scsi_host,
383 "activated for target GUID %016llx\n", 385 PFX "Topspin/Cisco initiator port ID workaround "
384 (unsigned long long) be64_to_cpu(target->ioc_guid)); 386 "activated for target GUID %016llx\n",
387 (unsigned long long) be64_to_cpu(target->ioc_guid));
385 memset(req->priv.initiator_port_id, 0, 8); 388 memset(req->priv.initiator_port_id, 0, 8);
386 memcpy(req->priv.initiator_port_id + 8, 389 memcpy(req->priv.initiator_port_id + 8,
387 &target->srp_host->dev->dev->node_guid, 8); 390 &target->srp_host->dev->dev->node_guid, 8);
@@ -400,7 +403,8 @@ static void srp_disconnect_target(struct srp_target_port *target)
400 403
401 init_completion(&target->done); 404 init_completion(&target->done);
402 if (ib_send_cm_dreq(target->cm_id, NULL, 0)) { 405 if (ib_send_cm_dreq(target->cm_id, NULL, 0)) {
403 printk(KERN_DEBUG PFX "Sending CM DREQ failed\n"); 406 shost_printk(KERN_DEBUG, target->scsi_host,
407 PFX "Sending CM DREQ failed\n");
404 return; 408 return;
405 } 409 }
406 wait_for_completion(&target->done); 410 wait_for_completion(&target->done);
@@ -568,7 +572,8 @@ static int srp_reconnect_target(struct srp_target_port *target)
568 return ret; 572 return ret;
569 573
570err: 574err:
571 printk(KERN_ERR PFX "reconnect failed (%d), removing target port.\n", ret); 575 shost_printk(KERN_ERR, target->scsi_host,
576 PFX "reconnect failed (%d), removing target port.\n", ret);
572 577
573 /* 578 /*
574 * We couldn't reconnect, so kill our target port off. 579 * We couldn't reconnect, so kill our target port off.
@@ -683,8 +688,9 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target,
683 688
684 if (scmnd->sc_data_direction != DMA_FROM_DEVICE && 689 if (scmnd->sc_data_direction != DMA_FROM_DEVICE &&
685 scmnd->sc_data_direction != DMA_TO_DEVICE) { 690 scmnd->sc_data_direction != DMA_TO_DEVICE) {
686 printk(KERN_WARNING PFX "Unhandled data direction %d\n", 691 shost_printk(KERN_WARNING, target->scsi_host,
687 scmnd->sc_data_direction); 692 PFX "Unhandled data direction %d\n",
693 scmnd->sc_data_direction);
688 return -EINVAL; 694 return -EINVAL;
689 } 695 }
690 696
@@ -786,8 +792,9 @@ static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp)
786 } else { 792 } else {
787 scmnd = req->scmnd; 793 scmnd = req->scmnd;
788 if (!scmnd) 794 if (!scmnd)
789 printk(KERN_ERR "Null scmnd for RSP w/tag %016llx\n", 795 shost_printk(KERN_ERR, target->scsi_host,
790 (unsigned long long) rsp->tag); 796 "Null scmnd for RSP w/tag %016llx\n",
797 (unsigned long long) rsp->tag);
791 scmnd->result = rsp->status; 798 scmnd->result = rsp->status;
792 799
793 if (rsp->flags & SRP_RSP_FLAG_SNSVALID) { 800 if (rsp->flags & SRP_RSP_FLAG_SNSVALID) {
@@ -831,7 +838,8 @@ static void srp_handle_recv(struct srp_target_port *target, struct ib_wc *wc)
831 if (0) { 838 if (0) {
832 int i; 839 int i;
833 840
834 printk(KERN_ERR PFX "recv completion, opcode 0x%02x\n", opcode); 841 shost_printk(KERN_ERR, target->scsi_host,
842 PFX "recv completion, opcode 0x%02x\n", opcode);
835 843
836 for (i = 0; i < wc->byte_len; ++i) { 844 for (i = 0; i < wc->byte_len; ++i) {
837 if (i % 8 == 0) 845 if (i % 8 == 0)
@@ -852,11 +860,13 @@ static void srp_handle_recv(struct srp_target_port *target, struct ib_wc *wc)
852 860
853 case SRP_T_LOGOUT: 861 case SRP_T_LOGOUT:
854 /* XXX Handle target logout */ 862 /* XXX Handle target logout */
855 printk(KERN_WARNING PFX "Got target logout request\n"); 863 shost_printk(KERN_WARNING, target->scsi_host,
864 PFX "Got target logout request\n");
856 break; 865 break;
857 866
858 default: 867 default:
859 printk(KERN_WARNING PFX "Unhandled SRP opcode 0x%02x\n", opcode); 868 shost_printk(KERN_WARNING, target->scsi_host,
869 PFX "Unhandled SRP opcode 0x%02x\n", opcode);
860 break; 870 break;
861 } 871 }
862 872
@@ -872,9 +882,10 @@ static void srp_completion(struct ib_cq *cq, void *target_ptr)
872 ib_req_notify_cq(cq, IB_CQ_NEXT_COMP); 882 ib_req_notify_cq(cq, IB_CQ_NEXT_COMP);
873 while (ib_poll_cq(cq, 1, &wc) > 0) { 883 while (ib_poll_cq(cq, 1, &wc) > 0) {
874 if (wc.status) { 884 if (wc.status) {
875 printk(KERN_ERR PFX "failed %s status %d\n", 885 shost_printk(KERN_ERR, target->scsi_host,
876 wc.wr_id & SRP_OP_RECV ? "receive" : "send", 886 PFX "failed %s status %d\n",
877 wc.status); 887 wc.wr_id & SRP_OP_RECV ? "receive" : "send",
888 wc.status);
878 target->qp_in_error = 1; 889 target->qp_in_error = 1;
879 break; 890 break;
880 } 891 }
@@ -1027,12 +1038,13 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd,
1027 1038
1028 len = srp_map_data(scmnd, target, req); 1039 len = srp_map_data(scmnd, target, req);
1029 if (len < 0) { 1040 if (len < 0) {
1030 printk(KERN_ERR PFX "Failed to map data\n"); 1041 shost_printk(KERN_ERR, target->scsi_host,
1042 PFX "Failed to map data\n");
1031 goto err; 1043 goto err;
1032 } 1044 }
1033 1045
1034 if (__srp_post_recv(target)) { 1046 if (__srp_post_recv(target)) {
1035 printk(KERN_ERR PFX "Recv failed\n"); 1047 shost_printk(KERN_ERR, target->scsi_host, PFX "Recv failed\n");
1036 goto err_unmap; 1048 goto err_unmap;
1037 } 1049 }
1038 1050
@@ -1040,7 +1052,7 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd,
1040 DMA_TO_DEVICE); 1052 DMA_TO_DEVICE);
1041 1053
1042 if (__srp_post_send(target, iu, len)) { 1054 if (__srp_post_send(target, iu, len)) {
1043 printk(KERN_ERR PFX "Send failed\n"); 1055 shost_printk(KERN_ERR, target->scsi_host, PFX "Send failed\n");
1044 goto err_unmap; 1056 goto err_unmap;
1045 } 1057 }
1046 1058
@@ -1095,6 +1107,7 @@ static void srp_cm_rej_handler(struct ib_cm_id *cm_id,
1095 struct ib_cm_event *event, 1107 struct ib_cm_event *event,
1096 struct srp_target_port *target) 1108 struct srp_target_port *target)
1097{ 1109{
1110 struct Scsi_Host *shost = target->scsi_host;
1098 struct ib_class_port_info *cpi; 1111 struct ib_class_port_info *cpi;
1099 int opcode; 1112 int opcode;
1100 1113
@@ -1120,19 +1133,22 @@ static void srp_cm_rej_handler(struct ib_cm_id *cm_id,
1120 memcpy(target->path.dgid.raw, 1133 memcpy(target->path.dgid.raw,
1121 event->param.rej_rcvd.ari, 16); 1134 event->param.rej_rcvd.ari, 16);
1122 1135
1123 printk(KERN_DEBUG PFX "Topspin/Cisco redirect to target port GID %016llx%016llx\n", 1136 shost_printk(KERN_DEBUG, shost,
1124 (unsigned long long) be64_to_cpu(target->path.dgid.global.subnet_prefix), 1137 PFX "Topspin/Cisco redirect to target port GID %016llx%016llx\n",
1125 (unsigned long long) be64_to_cpu(target->path.dgid.global.interface_id)); 1138 (unsigned long long) be64_to_cpu(target->path.dgid.global.subnet_prefix),
1139 (unsigned long long) be64_to_cpu(target->path.dgid.global.interface_id));
1126 1140
1127 target->status = SRP_PORT_REDIRECT; 1141 target->status = SRP_PORT_REDIRECT;
1128 } else { 1142 } else {
1129 printk(KERN_WARNING " REJ reason: IB_CM_REJ_PORT_REDIRECT\n"); 1143 shost_printk(KERN_WARNING, shost,
1144 " REJ reason: IB_CM_REJ_PORT_REDIRECT\n");
1130 target->status = -ECONNRESET; 1145 target->status = -ECONNRESET;
1131 } 1146 }
1132 break; 1147 break;
1133 1148
1134 case IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID: 1149 case IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID:
1135 printk(KERN_WARNING " REJ reason: IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID\n"); 1150 shost_printk(KERN_WARNING, shost,
1151 " REJ reason: IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID\n");
1136 target->status = -ECONNRESET; 1152 target->status = -ECONNRESET;
1137 break; 1153 break;
1138 1154
@@ -1143,20 +1159,21 @@ static void srp_cm_rej_handler(struct ib_cm_id *cm_id,
1143 u32 reason = be32_to_cpu(rej->reason); 1159 u32 reason = be32_to_cpu(rej->reason);
1144 1160
1145 if (reason == SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE) 1161 if (reason == SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE)
1146 printk(KERN_WARNING PFX 1162 shost_printk(KERN_WARNING, shost,
1147 "SRP_LOGIN_REJ: requested max_it_iu_len too large\n"); 1163 PFX "SRP_LOGIN_REJ: requested max_it_iu_len too large\n");
1148 else 1164 else
1149 printk(KERN_WARNING PFX 1165 shost_printk(KERN_WARNING, shost,
1150 "SRP LOGIN REJECTED, reason 0x%08x\n", reason); 1166 PFX "SRP LOGIN REJECTED, reason 0x%08x\n", reason);
1151 } else 1167 } else
1152 printk(KERN_WARNING " REJ reason: IB_CM_REJ_CONSUMER_DEFINED," 1168 shost_printk(KERN_WARNING, shost,
1153 " opcode 0x%02x\n", opcode); 1169 " REJ reason: IB_CM_REJ_CONSUMER_DEFINED,"
1170 " opcode 0x%02x\n", opcode);
1154 target->status = -ECONNRESET; 1171 target->status = -ECONNRESET;
1155 break; 1172 break;
1156 1173
1157 default: 1174 default:
1158 printk(KERN_WARNING " REJ reason 0x%x\n", 1175 shost_printk(KERN_WARNING, shost, " REJ reason 0x%x\n",
1159 event->param.rej_rcvd.reason); 1176 event->param.rej_rcvd.reason);
1160 target->status = -ECONNRESET; 1177 target->status = -ECONNRESET;
1161 } 1178 }
1162} 1179}
@@ -1171,7 +1188,8 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
1171 1188
1172 switch (event->event) { 1189 switch (event->event) {
1173 case IB_CM_REQ_ERROR: 1190 case IB_CM_REQ_ERROR:
1174 printk(KERN_DEBUG PFX "Sending CM REQ failed\n"); 1191 shost_printk(KERN_DEBUG, target->scsi_host,
1192 PFX "Sending CM REQ failed\n");
1175 comp = 1; 1193 comp = 1;
1176 target->status = -ECONNRESET; 1194 target->status = -ECONNRESET;
1177 break; 1195 break;
@@ -1189,7 +1207,8 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
1189 target->scsi_host->can_queue = min(target->req_lim, 1207 target->scsi_host->can_queue = min(target->req_lim,
1190 target->scsi_host->can_queue); 1208 target->scsi_host->can_queue);
1191 } else { 1209 } else {
1192 printk(KERN_WARNING PFX "Unhandled RSP opcode %#x\n", opcode); 1210 shost_printk(KERN_WARNING, target->scsi_host,
1211 PFX "Unhandled RSP opcode %#x\n", opcode);
1193 target->status = -ECONNRESET; 1212 target->status = -ECONNRESET;
1194 break; 1213 break;
1195 } 1214 }
@@ -1235,20 +1254,23 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
1235 break; 1254 break;
1236 1255
1237 case IB_CM_REJ_RECEIVED: 1256 case IB_CM_REJ_RECEIVED:
1238 printk(KERN_DEBUG PFX "REJ received\n"); 1257 shost_printk(KERN_DEBUG, target->scsi_host, PFX "REJ received\n");
1239 comp = 1; 1258 comp = 1;
1240 1259
1241 srp_cm_rej_handler(cm_id, event, target); 1260 srp_cm_rej_handler(cm_id, event, target);
1242 break; 1261 break;
1243 1262
1244 case IB_CM_DREQ_RECEIVED: 1263 case IB_CM_DREQ_RECEIVED:
1245 printk(KERN_WARNING PFX "DREQ received - connection closed\n"); 1264 shost_printk(KERN_WARNING, target->scsi_host,
1265 PFX "DREQ received - connection closed\n");
1246 if (ib_send_cm_drep(cm_id, NULL, 0)) 1266 if (ib_send_cm_drep(cm_id, NULL, 0))
1247 printk(KERN_ERR PFX "Sending CM DREP failed\n"); 1267 shost_printk(KERN_ERR, target->scsi_host,
1268 PFX "Sending CM DREP failed\n");
1248 break; 1269 break;
1249 1270
1250 case IB_CM_TIMEWAIT_EXIT: 1271 case IB_CM_TIMEWAIT_EXIT:
1251 printk(KERN_ERR PFX "connection closed\n"); 1272 shost_printk(KERN_ERR, target->scsi_host,
1273 PFX "connection closed\n");
1252 1274
1253 comp = 1; 1275 comp = 1;
1254 target->status = 0; 1276 target->status = 0;
@@ -1260,7 +1282,8 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
1260 break; 1282 break;
1261 1283
1262 default: 1284 default:
1263 printk(KERN_WARNING PFX "Unhandled CM event %d\n", event->event); 1285 shost_printk(KERN_WARNING, target->scsi_host,
1286 PFX "Unhandled CM event %d\n", event->event);
1264 break; 1287 break;
1265 } 1288 }
1266 1289
@@ -1337,7 +1360,7 @@ static int srp_abort(struct scsi_cmnd *scmnd)
1337 struct srp_request *req; 1360 struct srp_request *req;
1338 int ret = SUCCESS; 1361 int ret = SUCCESS;
1339 1362
1340 printk(KERN_ERR "SRP abort called\n"); 1363 shost_printk(KERN_ERR, target->scsi_host, "SRP abort called\n");
1341 1364
1342 if (target->qp_in_error) 1365 if (target->qp_in_error)
1343 return FAILED; 1366 return FAILED;
@@ -1367,7 +1390,7 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
1367 struct srp_target_port *target = host_to_target(scmnd->device->host); 1390 struct srp_target_port *target = host_to_target(scmnd->device->host);
1368 struct srp_request *req, *tmp; 1391 struct srp_request *req, *tmp;
1369 1392
1370 printk(KERN_ERR "SRP reset_device called\n"); 1393 shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n");
1371 1394
1372 if (target->qp_in_error) 1395 if (target->qp_in_error)
1373 return FAILED; 1396 return FAILED;
@@ -1394,7 +1417,7 @@ static int srp_reset_host(struct scsi_cmnd *scmnd)
1394 struct srp_target_port *target = host_to_target(scmnd->device->host); 1417 struct srp_target_port *target = host_to_target(scmnd->device->host);
1395 int ret = FAILED; 1418 int ret = FAILED;
1396 1419
1397 printk(KERN_ERR PFX "SRP reset_host called\n"); 1420 shost_printk(KERN_ERR, target->scsi_host, PFX "SRP reset_host called\n");
1398 1421
1399 if (!srp_reconnect_target(target)) 1422 if (!srp_reconnect_target(target))
1400 ret = SUCCESS; 1423 ret = SUCCESS;
@@ -1820,8 +1843,9 @@ static ssize_t srp_create_target(struct class_device *class_dev,
1820 1843
1821 ib_get_cached_gid(host->dev->dev, host->port, 0, &target->path.sgid); 1844 ib_get_cached_gid(host->dev->dev, host->port, 0, &target->path.sgid);
1822 1845
1823 printk(KERN_DEBUG PFX "new target: id_ext %016llx ioc_guid %016llx pkey %04x " 1846 shost_printk(KERN_DEBUG, target->scsi_host, PFX
1824 "service_id %016llx dgid %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", 1847 "new target: id_ext %016llx ioc_guid %016llx pkey %04x "
1848 "service_id %016llx dgid %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
1825 (unsigned long long) be64_to_cpu(target->id_ext), 1849 (unsigned long long) be64_to_cpu(target->id_ext),
1826 (unsigned long long) be64_to_cpu(target->ioc_guid), 1850 (unsigned long long) be64_to_cpu(target->ioc_guid),
1827 be16_to_cpu(target->path.pkey), 1851 be16_to_cpu(target->path.pkey),
@@ -1848,7 +1872,8 @@ static ssize_t srp_create_target(struct class_device *class_dev,
1848 target->qp_in_error = 0; 1872 target->qp_in_error = 0;
1849 ret = srp_connect_target(target); 1873 ret = srp_connect_target(target);
1850 if (ret) { 1874 if (ret) {
1851 printk(KERN_ERR PFX "Connection failed\n"); 1875 shost_printk(KERN_ERR, target->scsi_host,
1876 PFX "Connection failed\n");
1852 goto err_cm_id; 1877 goto err_cm_id;
1853 } 1878 }
1854 1879