aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_fsf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/scsi/zfcp_fsf.c')
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c163
1 files changed, 72 insertions, 91 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index e8fb4d9baa8b..6538742b421a 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Implementation of FSF commands. 4 * Implementation of FSF commands.
5 * 5 *
6 * Copyright IBM Corporation 2002, 2009 6 * Copyright IBM Corporation 2002, 2010
7 */ 7 */
8 8
9#define KMSG_COMPONENT "zfcp" 9#define KMSG_COMPONENT "zfcp"
@@ -14,6 +14,8 @@
14#include "zfcp_ext.h" 14#include "zfcp_ext.h"
15#include "zfcp_fc.h" 15#include "zfcp_fc.h"
16#include "zfcp_dbf.h" 16#include "zfcp_dbf.h"
17#include "zfcp_qdio.h"
18#include "zfcp_reqlist.h"
17 19
18static void zfcp_fsf_request_timeout_handler(unsigned long data) 20static void zfcp_fsf_request_timeout_handler(unsigned long data)
19{ 21{
@@ -393,7 +395,7 @@ static void zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *req)
393 case FSF_PROT_LINK_DOWN: 395 case FSF_PROT_LINK_DOWN:
394 zfcp_fsf_link_down_info_eval(req, "fspse_5", 396 zfcp_fsf_link_down_info_eval(req, "fspse_5",
395 &psq->link_down_info); 397 &psq->link_down_info);
396 /* FIXME: reopening adapter now? better wait for link up */ 398 /* go through reopen to flush pending requests */
397 zfcp_erp_adapter_reopen(adapter, 0, "fspse_6", req); 399 zfcp_erp_adapter_reopen(adapter, 0, "fspse_6", req);
398 break; 400 break;
399 case FSF_PROT_REEST_QUEUE: 401 case FSF_PROT_REEST_QUEUE:
@@ -457,15 +459,10 @@ static void zfcp_fsf_req_complete(struct zfcp_fsf_req *req)
457void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter) 459void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter)
458{ 460{
459 struct zfcp_fsf_req *req, *tmp; 461 struct zfcp_fsf_req *req, *tmp;
460 unsigned long flags;
461 LIST_HEAD(remove_queue); 462 LIST_HEAD(remove_queue);
462 unsigned int i;
463 463
464 BUG_ON(atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP); 464 BUG_ON(atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP);
465 spin_lock_irqsave(&adapter->req_list_lock, flags); 465 zfcp_reqlist_move(adapter->req_list, &remove_queue);
466 for (i = 0; i < REQUEST_LIST_SIZE; i++)
467 list_splice_init(&adapter->req_list[i], &remove_queue);
468 spin_unlock_irqrestore(&adapter->req_list_lock, flags);
469 466
470 list_for_each_entry_safe(req, tmp, &remove_queue, list) { 467 list_for_each_entry_safe(req, tmp, &remove_queue, list) {
471 list_del(&req->list); 468 list_del(&req->list);
@@ -495,8 +492,6 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
495 fc_host_port_id(shost) = ntoh24(bottom->s_id); 492 fc_host_port_id(shost) = ntoh24(bottom->s_id);
496 fc_host_speed(shost) = bottom->fc_link_speed; 493 fc_host_speed(shost) = bottom->fc_link_speed;
497 fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3; 494 fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3;
498 fc_host_supported_fc4s(shost)[2] = 1; /* FCP */
499 fc_host_active_fc4s(shost)[2] = 1; /* FCP */
500 495
501 adapter->hydra_version = bottom->adapter_type; 496 adapter->hydra_version = bottom->adapter_type;
502 adapter->timer_ticks = bottom->timer_interval; 497 adapter->timer_ticks = bottom->timer_interval;
@@ -619,6 +614,10 @@ static void zfcp_fsf_exchange_port_evaluate(struct zfcp_fsf_req *req)
619 fc_host_permanent_port_name(shost) = fc_host_port_name(shost); 614 fc_host_permanent_port_name(shost) = fc_host_port_name(shost);
620 fc_host_maxframe_size(shost) = bottom->maximum_frame_size; 615 fc_host_maxframe_size(shost) = bottom->maximum_frame_size;
621 fc_host_supported_speeds(shost) = bottom->supported_speed; 616 fc_host_supported_speeds(shost) = bottom->supported_speed;
617 memcpy(fc_host_supported_fc4s(shost), bottom->supported_fc4_types,
618 FC_FC4_LIST_SIZE);
619 memcpy(fc_host_active_fc4s(shost), bottom->active_fc4_types,
620 FC_FC4_LIST_SIZE);
622} 621}
623 622
624static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req) 623static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req)
@@ -725,12 +724,12 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio,
725 req->adapter = adapter; 724 req->adapter = adapter;
726 req->fsf_command = fsf_cmd; 725 req->fsf_command = fsf_cmd;
727 req->req_id = adapter->req_no; 726 req->req_id = adapter->req_no;
728 req->queue_req.sbal_number = 1; 727 req->qdio_req.sbal_number = 1;
729 req->queue_req.sbal_first = req_q->first; 728 req->qdio_req.sbal_first = req_q->first;
730 req->queue_req.sbal_last = req_q->first; 729 req->qdio_req.sbal_last = req_q->first;
731 req->queue_req.sbale_curr = 1; 730 req->qdio_req.sbale_curr = 1;
732 731
733 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 732 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
734 sbale[0].addr = (void *) req->req_id; 733 sbale[0].addr = (void *) req->req_id;
735 sbale[0].flags |= SBAL_FLAGS0_COMMAND; 734 sbale[0].flags |= SBAL_FLAGS0_COMMAND;
736 735
@@ -745,6 +744,7 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio,
745 return ERR_PTR(-ENOMEM); 744 return ERR_PTR(-ENOMEM);
746 } 745 }
747 746
747 req->seq_no = adapter->fsf_req_seq_no;
748 req->qtcb->prefix.req_seq_no = adapter->fsf_req_seq_no; 748 req->qtcb->prefix.req_seq_no = adapter->fsf_req_seq_no;
749 req->qtcb->prefix.req_id = req->req_id; 749 req->qtcb->prefix.req_id = req->req_id;
750 req->qtcb->prefix.ulp_info = 26; 750 req->qtcb->prefix.ulp_info = 26;
@@ -752,8 +752,6 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio,
752 req->qtcb->prefix.qtcb_version = FSF_QTCB_CURRENT_VERSION; 752 req->qtcb->prefix.qtcb_version = FSF_QTCB_CURRENT_VERSION;
753 req->qtcb->header.req_handle = req->req_id; 753 req->qtcb->header.req_handle = req->req_id;
754 req->qtcb->header.fsf_command = req->fsf_command; 754 req->qtcb->header.fsf_command = req->fsf_command;
755 req->seq_no = adapter->fsf_req_seq_no;
756 req->qtcb->prefix.req_seq_no = adapter->fsf_req_seq_no;
757 sbale[1].addr = (void *) req->qtcb; 755 sbale[1].addr = (void *) req->qtcb;
758 sbale[1].length = sizeof(struct fsf_qtcb); 756 sbale[1].length = sizeof(struct fsf_qtcb);
759 } 757 }
@@ -770,25 +768,17 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
770{ 768{
771 struct zfcp_adapter *adapter = req->adapter; 769 struct zfcp_adapter *adapter = req->adapter;
772 struct zfcp_qdio *qdio = adapter->qdio; 770 struct zfcp_qdio *qdio = adapter->qdio;
773 unsigned long flags; 771 int with_qtcb = (req->qtcb != NULL);
774 int idx; 772 int req_id = req->req_id;
775 int with_qtcb = (req->qtcb != NULL);
776 773
777 /* put allocated FSF request into hash table */ 774 zfcp_reqlist_add(adapter->req_list, req);
778 spin_lock_irqsave(&adapter->req_list_lock, flags);
779 idx = zfcp_reqlist_hash(req->req_id);
780 list_add_tail(&req->list, &adapter->req_list[idx]);
781 spin_unlock_irqrestore(&adapter->req_list_lock, flags);
782 775
783 req->queue_req.qdio_outb_usage = atomic_read(&qdio->req_q.count); 776 req->qdio_req.qdio_outb_usage = atomic_read(&qdio->req_q.count);
784 req->issued = get_clock(); 777 req->issued = get_clock();
785 if (zfcp_qdio_send(qdio, &req->queue_req)) { 778 if (zfcp_qdio_send(qdio, &req->qdio_req)) {
786 del_timer(&req->timer); 779 del_timer(&req->timer);
787 spin_lock_irqsave(&adapter->req_list_lock, flags);
788 /* lookup request again, list might have changed */ 780 /* lookup request again, list might have changed */
789 if (zfcp_reqlist_find_safe(adapter, req)) 781 zfcp_reqlist_find_rm(adapter->req_list, req_id);
790 zfcp_reqlist_remove(adapter, req);
791 spin_unlock_irqrestore(&adapter->req_list_lock, flags);
792 zfcp_erp_adapter_reopen(adapter, 0, "fsrs__1", req); 782 zfcp_erp_adapter_reopen(adapter, 0, "fsrs__1", req);
793 return -EIO; 783 return -EIO;
794 } 784 }
@@ -826,9 +816,9 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio)
826 goto out; 816 goto out;
827 } 817 }
828 818
829 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 819 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
830 sbale[2].flags |= SBAL_FLAGS_LAST_ENTRY; 820 sbale[2].flags |= SBAL_FLAGS_LAST_ENTRY;
831 req->queue_req.sbale_curr = 2; 821 req->qdio_req.sbale_curr = 2;
832 822
833 sr_buf = mempool_alloc(adapter->pool.status_read_data, GFP_ATOMIC); 823 sr_buf = mempool_alloc(adapter->pool.status_read_data, GFP_ATOMIC);
834 if (!sr_buf) { 824 if (!sr_buf) {
@@ -837,7 +827,7 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio)
837 } 827 }
838 memset(sr_buf, 0, sizeof(*sr_buf)); 828 memset(sr_buf, 0, sizeof(*sr_buf));
839 req->data = sr_buf; 829 req->data = sr_buf;
840 sbale = zfcp_qdio_sbale_curr(qdio, &req->queue_req); 830 sbale = zfcp_qdio_sbale_curr(qdio, &req->qdio_req);
841 sbale->addr = (void *) sr_buf; 831 sbale->addr = (void *) sr_buf;
842 sbale->length = sizeof(*sr_buf); 832 sbale->length = sizeof(*sr_buf);
843 833
@@ -934,7 +924,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(unsigned long old_req_id,
934 ZFCP_STATUS_COMMON_UNBLOCKED))) 924 ZFCP_STATUS_COMMON_UNBLOCKED)))
935 goto out_error_free; 925 goto out_error_free;
936 926
937 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 927 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
938 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 928 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
939 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 929 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
940 930
@@ -1029,7 +1019,7 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req,
1029{ 1019{
1030 struct zfcp_adapter *adapter = req->adapter; 1020 struct zfcp_adapter *adapter = req->adapter;
1031 struct qdio_buffer_element *sbale = zfcp_qdio_sbale_req(adapter->qdio, 1021 struct qdio_buffer_element *sbale = zfcp_qdio_sbale_req(adapter->qdio,
1032 &req->queue_req); 1022 &req->qdio_req);
1033 u32 feat = adapter->adapter_features; 1023 u32 feat = adapter->adapter_features;
1034 int bytes; 1024 int bytes;
1035 1025
@@ -1047,15 +1037,15 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req,
1047 return 0; 1037 return 0;
1048 } 1038 }
1049 1039
1050 bytes = zfcp_qdio_sbals_from_sg(adapter->qdio, &req->queue_req, 1040 bytes = zfcp_qdio_sbals_from_sg(adapter->qdio, &req->qdio_req,
1051 SBAL_FLAGS0_TYPE_WRITE_READ, 1041 SBAL_FLAGS0_TYPE_WRITE_READ,
1052 sg_req, max_sbals); 1042 sg_req, max_sbals);
1053 if (bytes <= 0) 1043 if (bytes <= 0)
1054 return -EIO; 1044 return -EIO;
1055 req->qtcb->bottom.support.req_buf_length = bytes; 1045 req->qtcb->bottom.support.req_buf_length = bytes;
1056 req->queue_req.sbale_curr = ZFCP_LAST_SBALE_PER_SBAL; 1046 req->qdio_req.sbale_curr = ZFCP_LAST_SBALE_PER_SBAL;
1057 1047
1058 bytes = zfcp_qdio_sbals_from_sg(adapter->qdio, &req->queue_req, 1048 bytes = zfcp_qdio_sbals_from_sg(adapter->qdio, &req->qdio_req,
1059 SBAL_FLAGS0_TYPE_WRITE_READ, 1049 SBAL_FLAGS0_TYPE_WRITE_READ,
1060 sg_resp, max_sbals); 1050 sg_resp, max_sbals);
1061 req->qtcb->bottom.support.resp_buf_length = bytes; 1051 req->qtcb->bottom.support.resp_buf_length = bytes;
@@ -1251,7 +1241,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
1251 } 1241 }
1252 1242
1253 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1243 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1254 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 1244 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
1255 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1245 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1256 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1246 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1257 1247
@@ -1262,13 +1252,13 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
1262 FSF_FEATURE_UPDATE_ALERT; 1252 FSF_FEATURE_UPDATE_ALERT;
1263 req->erp_action = erp_action; 1253 req->erp_action = erp_action;
1264 req->handler = zfcp_fsf_exchange_config_data_handler; 1254 req->handler = zfcp_fsf_exchange_config_data_handler;
1265 erp_action->fsf_req = req; 1255 erp_action->fsf_req_id = req->req_id;
1266 1256
1267 zfcp_fsf_start_erp_timer(req); 1257 zfcp_fsf_start_erp_timer(req);
1268 retval = zfcp_fsf_req_send(req); 1258 retval = zfcp_fsf_req_send(req);
1269 if (retval) { 1259 if (retval) {
1270 zfcp_fsf_req_free(req); 1260 zfcp_fsf_req_free(req);
1271 erp_action->fsf_req = NULL; 1261 erp_action->fsf_req_id = 0;
1272 } 1262 }
1273out: 1263out:
1274 spin_unlock_bh(&qdio->req_q_lock); 1264 spin_unlock_bh(&qdio->req_q_lock);
@@ -1293,7 +1283,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_qdio *qdio,
1293 goto out_unlock; 1283 goto out_unlock;
1294 } 1284 }
1295 1285
1296 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 1286 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
1297 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1287 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1298 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1288 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1299 req->handler = zfcp_fsf_exchange_config_data_handler; 1289 req->handler = zfcp_fsf_exchange_config_data_handler;
@@ -1349,19 +1339,19 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
1349 } 1339 }
1350 1340
1351 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1341 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1352 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 1342 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
1353 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1343 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1354 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1344 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1355 1345
1356 req->handler = zfcp_fsf_exchange_port_data_handler; 1346 req->handler = zfcp_fsf_exchange_port_data_handler;
1357 req->erp_action = erp_action; 1347 req->erp_action = erp_action;
1358 erp_action->fsf_req = req; 1348 erp_action->fsf_req_id = req->req_id;
1359 1349
1360 zfcp_fsf_start_erp_timer(req); 1350 zfcp_fsf_start_erp_timer(req);
1361 retval = zfcp_fsf_req_send(req); 1351 retval = zfcp_fsf_req_send(req);
1362 if (retval) { 1352 if (retval) {
1363 zfcp_fsf_req_free(req); 1353 zfcp_fsf_req_free(req);
1364 erp_action->fsf_req = NULL; 1354 erp_action->fsf_req_id = 0;
1365 } 1355 }
1366out: 1356out:
1367 spin_unlock_bh(&qdio->req_q_lock); 1357 spin_unlock_bh(&qdio->req_q_lock);
@@ -1398,7 +1388,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_qdio *qdio,
1398 if (data) 1388 if (data)
1399 req->data = data; 1389 req->data = data;
1400 1390
1401 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 1391 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
1402 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1392 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1403 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1393 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1404 1394
@@ -1484,7 +1474,7 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)
1484 } 1474 }
1485 1475
1486out: 1476out:
1487 put_device(&port->sysfs_device); 1477 put_device(&port->dev);
1488} 1478}
1489 1479
1490/** 1480/**
@@ -1513,7 +1503,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
1513 } 1503 }
1514 1504
1515 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1505 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1516 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 1506 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
1517 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1507 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1518 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1508 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1519 1509
@@ -1521,15 +1511,15 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
1521 hton24(req->qtcb->bottom.support.d_id, port->d_id); 1511 hton24(req->qtcb->bottom.support.d_id, port->d_id);
1522 req->data = port; 1512 req->data = port;
1523 req->erp_action = erp_action; 1513 req->erp_action = erp_action;
1524 erp_action->fsf_req = req; 1514 erp_action->fsf_req_id = req->req_id;
1525 get_device(&port->sysfs_device); 1515 get_device(&port->dev);
1526 1516
1527 zfcp_fsf_start_erp_timer(req); 1517 zfcp_fsf_start_erp_timer(req);
1528 retval = zfcp_fsf_req_send(req); 1518 retval = zfcp_fsf_req_send(req);
1529 if (retval) { 1519 if (retval) {
1530 zfcp_fsf_req_free(req); 1520 zfcp_fsf_req_free(req);
1531 erp_action->fsf_req = NULL; 1521 erp_action->fsf_req_id = 0;
1532 put_device(&port->sysfs_device); 1522 put_device(&port->dev);
1533 } 1523 }
1534out: 1524out:
1535 spin_unlock_bh(&qdio->req_q_lock); 1525 spin_unlock_bh(&qdio->req_q_lock);
@@ -1583,7 +1573,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
1583 } 1573 }
1584 1574
1585 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1575 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1586 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 1576 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
1587 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1577 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1588 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1578 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1589 1579
@@ -1591,13 +1581,13 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
1591 req->data = erp_action->port; 1581 req->data = erp_action->port;
1592 req->erp_action = erp_action; 1582 req->erp_action = erp_action;
1593 req->qtcb->header.port_handle = erp_action->port->handle; 1583 req->qtcb->header.port_handle = erp_action->port->handle;
1594 erp_action->fsf_req = req; 1584 erp_action->fsf_req_id = req->req_id;
1595 1585
1596 zfcp_fsf_start_erp_timer(req); 1586 zfcp_fsf_start_erp_timer(req);
1597 retval = zfcp_fsf_req_send(req); 1587 retval = zfcp_fsf_req_send(req);
1598 if (retval) { 1588 if (retval) {
1599 zfcp_fsf_req_free(req); 1589 zfcp_fsf_req_free(req);
1600 erp_action->fsf_req = NULL; 1590 erp_action->fsf_req_id = 0;
1601 } 1591 }
1602out: 1592out:
1603 spin_unlock_bh(&qdio->req_q_lock); 1593 spin_unlock_bh(&qdio->req_q_lock);
@@ -1660,7 +1650,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
1660 } 1650 }
1661 1651
1662 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1652 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1663 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 1653 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
1664 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1654 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1665 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1655 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1666 1656
@@ -1715,7 +1705,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port)
1715 } 1705 }
1716 1706
1717 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1707 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1718 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 1708 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
1719 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1709 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1720 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1710 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1721 1711
@@ -1809,7 +1799,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
1809 } 1799 }
1810 1800
1811 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1801 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1812 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 1802 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
1813 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1803 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1814 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1804 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1815 1805
@@ -1817,13 +1807,13 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
1817 req->qtcb->header.port_handle = erp_action->port->handle; 1807 req->qtcb->header.port_handle = erp_action->port->handle;
1818 req->erp_action = erp_action; 1808 req->erp_action = erp_action;
1819 req->handler = zfcp_fsf_close_physical_port_handler; 1809 req->handler = zfcp_fsf_close_physical_port_handler;
1820 erp_action->fsf_req = req; 1810 erp_action->fsf_req_id = req->req_id;
1821 1811
1822 zfcp_fsf_start_erp_timer(req); 1812 zfcp_fsf_start_erp_timer(req);
1823 retval = zfcp_fsf_req_send(req); 1813 retval = zfcp_fsf_req_send(req);
1824 if (retval) { 1814 if (retval) {
1825 zfcp_fsf_req_free(req); 1815 zfcp_fsf_req_free(req);
1826 erp_action->fsf_req = NULL; 1816 erp_action->fsf_req_id = 0;
1827 } 1817 }
1828out: 1818out:
1829 spin_unlock_bh(&qdio->req_q_lock); 1819 spin_unlock_bh(&qdio->req_q_lock);
@@ -1982,7 +1972,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
1982 } 1972 }
1983 1973
1984 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1974 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1985 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 1975 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
1986 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1976 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1987 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1977 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1988 1978
@@ -1991,7 +1981,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
1991 req->handler = zfcp_fsf_open_unit_handler; 1981 req->handler = zfcp_fsf_open_unit_handler;
1992 req->data = erp_action->unit; 1982 req->data = erp_action->unit;
1993 req->erp_action = erp_action; 1983 req->erp_action = erp_action;
1994 erp_action->fsf_req = req; 1984 erp_action->fsf_req_id = req->req_id;
1995 1985
1996 if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE)) 1986 if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE))
1997 req->qtcb->bottom.support.option = FSF_OPEN_LUN_SUPPRESS_BOXING; 1987 req->qtcb->bottom.support.option = FSF_OPEN_LUN_SUPPRESS_BOXING;
@@ -2000,7 +1990,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
2000 retval = zfcp_fsf_req_send(req); 1990 retval = zfcp_fsf_req_send(req);
2001 if (retval) { 1991 if (retval) {
2002 zfcp_fsf_req_free(req); 1992 zfcp_fsf_req_free(req);
2003 erp_action->fsf_req = NULL; 1993 erp_action->fsf_req_id = 0;
2004 } 1994 }
2005out: 1995out:
2006 spin_unlock_bh(&qdio->req_q_lock); 1996 spin_unlock_bh(&qdio->req_q_lock);
@@ -2068,7 +2058,7 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
2068 } 2058 }
2069 2059
2070 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 2060 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
2071 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 2061 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
2072 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 2062 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
2073 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 2063 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
2074 2064
@@ -2077,13 +2067,13 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
2077 req->handler = zfcp_fsf_close_unit_handler; 2067 req->handler = zfcp_fsf_close_unit_handler;
2078 req->data = erp_action->unit; 2068 req->data = erp_action->unit;
2079 req->erp_action = erp_action; 2069 req->erp_action = erp_action;
2080 erp_action->fsf_req = req; 2070 erp_action->fsf_req_id = req->req_id;
2081 2071
2082 zfcp_fsf_start_erp_timer(req); 2072 zfcp_fsf_start_erp_timer(req);
2083 retval = zfcp_fsf_req_send(req); 2073 retval = zfcp_fsf_req_send(req);
2084 if (retval) { 2074 if (retval) {
2085 zfcp_fsf_req_free(req); 2075 zfcp_fsf_req_free(req);
2086 erp_action->fsf_req = NULL; 2076 erp_action->fsf_req_id = 0;
2087 } 2077 }
2088out: 2078out:
2089 spin_unlock_bh(&qdio->req_q_lock); 2079 spin_unlock_bh(&qdio->req_q_lock);
@@ -2111,8 +2101,8 @@ static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi)
2111 blktrc.magic = ZFCP_BLK_DRV_DATA_MAGIC; 2101 blktrc.magic = ZFCP_BLK_DRV_DATA_MAGIC;
2112 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) 2102 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
2113 blktrc.flags |= ZFCP_BLK_REQ_ERROR; 2103 blktrc.flags |= ZFCP_BLK_REQ_ERROR;
2114 blktrc.inb_usage = req->queue_req.qdio_inb_usage; 2104 blktrc.inb_usage = req->qdio_req.qdio_inb_usage;
2115 blktrc.outb_usage = req->queue_req.qdio_outb_usage; 2105 blktrc.outb_usage = req->qdio_req.qdio_outb_usage;
2116 2106
2117 if (req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA) { 2107 if (req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA) {
2118 blktrc.flags |= ZFCP_BLK_LAT_VALID; 2108 blktrc.flags |= ZFCP_BLK_LAT_VALID;
@@ -2169,12 +2159,7 @@ static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req)
2169 zfcp_fsf_req_trace(req, scpnt); 2159 zfcp_fsf_req_trace(req, scpnt);
2170 2160
2171skip_fsfstatus: 2161skip_fsfstatus:
2172 if (scpnt->result != 0) 2162 zfcp_dbf_scsi_result(req->adapter->dbf, scpnt, req);
2173 zfcp_dbf_scsi_result("erro", 3, req->adapter->dbf, scpnt, req);
2174 else if (scpnt->retries > 0)
2175 zfcp_dbf_scsi_result("retr", 4, req->adapter->dbf, scpnt, req);
2176 else
2177 zfcp_dbf_scsi_result("norm", 6, req->adapter->dbf, scpnt, req);
2178 2163
2179 scpnt->host_scribble = NULL; 2164 scpnt->host_scribble = NULL;
2180 (scpnt->scsi_done) (scpnt); 2165 (scpnt->scsi_done) (scpnt);
@@ -2274,7 +2259,7 @@ skip_fsfstatus:
2274 else { 2259 else {
2275 zfcp_fsf_send_fcp_command_task_handler(req); 2260 zfcp_fsf_send_fcp_command_task_handler(req);
2276 req->unit = NULL; 2261 req->unit = NULL;
2277 put_device(&unit->sysfs_device); 2262 put_device(&unit->dev);
2278 } 2263 }
2279} 2264}
2280 2265
@@ -2312,7 +2297,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
2312 } 2297 }
2313 2298
2314 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 2299 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
2315 get_device(&unit->sysfs_device); 2300 get_device(&unit->dev);
2316 req->unit = unit; 2301 req->unit = unit;
2317 req->data = scsi_cmnd; 2302 req->data = scsi_cmnd;
2318 req->handler = zfcp_fsf_send_fcp_command_handler; 2303 req->handler = zfcp_fsf_send_fcp_command_handler;
@@ -2346,11 +2331,11 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
2346 fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd; 2331 fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd;
2347 zfcp_fc_scsi_to_fcp(fcp_cmnd, scsi_cmnd); 2332 zfcp_fc_scsi_to_fcp(fcp_cmnd, scsi_cmnd);
2348 2333
2349 real_bytes = zfcp_qdio_sbals_from_sg(qdio, &req->queue_req, sbtype, 2334 real_bytes = zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req, sbtype,
2350 scsi_sglist(scsi_cmnd), 2335 scsi_sglist(scsi_cmnd),
2351 FSF_MAX_SBALS_PER_REQ); 2336 FSF_MAX_SBALS_PER_REQ);
2352 if (unlikely(real_bytes < 0)) { 2337 if (unlikely(real_bytes < 0)) {
2353 if (req->queue_req.sbal_number >= FSF_MAX_SBALS_PER_REQ) { 2338 if (req->qdio_req.sbal_number >= FSF_MAX_SBALS_PER_REQ) {
2354 dev_err(&adapter->ccw_device->dev, 2339 dev_err(&adapter->ccw_device->dev,
2355 "Oversize data package, unit 0x%016Lx " 2340 "Oversize data package, unit 0x%016Lx "
2356 "on port 0x%016Lx closed\n", 2341 "on port 0x%016Lx closed\n",
@@ -2369,7 +2354,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
2369 goto out; 2354 goto out;
2370 2355
2371failed_scsi_cmnd: 2356failed_scsi_cmnd:
2372 put_device(&unit->sysfs_device); 2357 put_device(&unit->dev);
2373 zfcp_fsf_req_free(req); 2358 zfcp_fsf_req_free(req);
2374 scsi_cmnd->host_scribble = NULL; 2359 scsi_cmnd->host_scribble = NULL;
2375out: 2360out:
@@ -2415,7 +2400,7 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_unit *unit, u8 tm_flags)
2415 req->qtcb->bottom.io.service_class = FSF_CLASS_3; 2400 req->qtcb->bottom.io.service_class = FSF_CLASS_3;
2416 req->qtcb->bottom.io.fcp_cmnd_length = FCP_CMND_LEN; 2401 req->qtcb->bottom.io.fcp_cmnd_length = FCP_CMND_LEN;
2417 2402
2418 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 2403 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
2419 sbale[0].flags |= SBAL_FLAGS0_TYPE_WRITE; 2404 sbale[0].flags |= SBAL_FLAGS0_TYPE_WRITE;
2420 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 2405 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
2421 2406
@@ -2478,14 +2463,14 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter,
2478 2463
2479 req->handler = zfcp_fsf_control_file_handler; 2464 req->handler = zfcp_fsf_control_file_handler;
2480 2465
2481 sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); 2466 sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
2482 sbale[0].flags |= direction; 2467 sbale[0].flags |= direction;
2483 2468
2484 bottom = &req->qtcb->bottom.support; 2469 bottom = &req->qtcb->bottom.support;
2485 bottom->operation_subtype = FSF_CFDC_OPERATION_SUBTYPE; 2470 bottom->operation_subtype = FSF_CFDC_OPERATION_SUBTYPE;
2486 bottom->option = fsf_cfdc->option; 2471 bottom->option = fsf_cfdc->option;
2487 2472
2488 bytes = zfcp_qdio_sbals_from_sg(qdio, &req->queue_req, 2473 bytes = zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req,
2489 direction, fsf_cfdc->sg, 2474 direction, fsf_cfdc->sg,
2490 FSF_MAX_SBALS_PER_REQ); 2475 FSF_MAX_SBALS_PER_REQ);
2491 if (bytes != ZFCP_CFDC_MAX_SIZE) { 2476 if (bytes != ZFCP_CFDC_MAX_SIZE) {
@@ -2516,15 +2501,14 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx)
2516 struct qdio_buffer *sbal = qdio->resp_q.sbal[sbal_idx]; 2501 struct qdio_buffer *sbal = qdio->resp_q.sbal[sbal_idx];
2517 struct qdio_buffer_element *sbale; 2502 struct qdio_buffer_element *sbale;
2518 struct zfcp_fsf_req *fsf_req; 2503 struct zfcp_fsf_req *fsf_req;
2519 unsigned long flags, req_id; 2504 unsigned long req_id;
2520 int idx; 2505 int idx;
2521 2506
2522 for (idx = 0; idx < QDIO_MAX_ELEMENTS_PER_BUFFER; idx++) { 2507 for (idx = 0; idx < QDIO_MAX_ELEMENTS_PER_BUFFER; idx++) {
2523 2508
2524 sbale = &sbal->element[idx]; 2509 sbale = &sbal->element[idx];
2525 req_id = (unsigned long) sbale->addr; 2510 req_id = (unsigned long) sbale->addr;
2526 spin_lock_irqsave(&adapter->req_list_lock, flags); 2511 fsf_req = zfcp_reqlist_find_rm(adapter->req_list, req_id);
2527 fsf_req = zfcp_reqlist_find(adapter, req_id);
2528 2512
2529 if (!fsf_req) 2513 if (!fsf_req)
2530 /* 2514 /*
@@ -2534,11 +2518,8 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx)
2534 panic("error: unknown req_id (%lx) on adapter %s.\n", 2518 panic("error: unknown req_id (%lx) on adapter %s.\n",
2535 req_id, dev_name(&adapter->ccw_device->dev)); 2519 req_id, dev_name(&adapter->ccw_device->dev));
2536 2520
2537 list_del(&fsf_req->list); 2521 fsf_req->qdio_req.sbal_response = sbal_idx;
2538 spin_unlock_irqrestore(&adapter->req_list_lock, flags); 2522 fsf_req->qdio_req.qdio_inb_usage =
2539
2540 fsf_req->queue_req.sbal_response = sbal_idx;
2541 fsf_req->queue_req.qdio_inb_usage =
2542 atomic_read(&qdio->resp_q.count); 2523 atomic_read(&qdio->resp_q.count);
2543 zfcp_fsf_req_complete(fsf_req); 2524 zfcp_fsf_req_complete(fsf_req);
2544 2525