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.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 74dee32afba8..e6dae3744e79 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -526,6 +526,7 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
526 break; 526 break;
527 case FSF_TOPO_AL: 527 case FSF_TOPO_AL:
528 fc_host_port_type(shost) = FC_PORTTYPE_NLPORT; 528 fc_host_port_type(shost) = FC_PORTTYPE_NLPORT;
529 /* fall through */
529 default: 530 default:
530 dev_err(&adapter->ccw_device->dev, 531 dev_err(&adapter->ccw_device->dev,
531 "Unknown or unsupported arbitrated loop " 532 "Unknown or unsupported arbitrated loop "
@@ -897,6 +898,7 @@ static void zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *req)
897 switch (fsq->word[0]) { 898 switch (fsq->word[0]) {
898 case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: 899 case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE:
899 zfcp_test_link(unit->port); 900 zfcp_test_link(unit->port);
901 /* fall through */
900 case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: 902 case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED:
901 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 903 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
902 break; 904 break;
@@ -993,6 +995,7 @@ static void zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *req)
993 break; 995 break;
994 case FSF_PORT_HANDLE_NOT_VALID: 996 case FSF_PORT_HANDLE_NOT_VALID:
995 zfcp_erp_adapter_reopen(adapter, 0, "fsscth1", req); 997 zfcp_erp_adapter_reopen(adapter, 0, "fsscth1", req);
998 /* fall through */
996 case FSF_GENERIC_COMMAND_REJECTED: 999 case FSF_GENERIC_COMMAND_REJECTED:
997 case FSF_PAYLOAD_SIZE_MISMATCH: 1000 case FSF_PAYLOAD_SIZE_MISMATCH:
998 case FSF_REQUEST_SIZE_TOO_LARGE: 1001 case FSF_REQUEST_SIZE_TOO_LARGE:
@@ -1399,7 +1402,7 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)
1399 struct fsf_plogi *plogi; 1402 struct fsf_plogi *plogi;
1400 1403
1401 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) 1404 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
1402 return; 1405 goto out;
1403 1406
1404 switch (header->fsf_status) { 1407 switch (header->fsf_status) {
1405 case FSF_PORT_ALREADY_OPEN: 1408 case FSF_PORT_ALREADY_OPEN:
@@ -1461,6 +1464,9 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)
1461 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1464 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1462 break; 1465 break;
1463 } 1466 }
1467
1468out:
1469 zfcp_port_put(port);
1464} 1470}
1465 1471
1466/** 1472/**
@@ -1473,6 +1479,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
1473 struct qdio_buffer_element *sbale; 1479 struct qdio_buffer_element *sbale;
1474 struct zfcp_adapter *adapter = erp_action->adapter; 1480 struct zfcp_adapter *adapter = erp_action->adapter;
1475 struct zfcp_fsf_req *req; 1481 struct zfcp_fsf_req *req;
1482 struct zfcp_port *port = erp_action->port;
1476 int retval = -EIO; 1483 int retval = -EIO;
1477 1484
1478 spin_lock_bh(&adapter->req_q_lock); 1485 spin_lock_bh(&adapter->req_q_lock);
@@ -1493,16 +1500,18 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
1493 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1500 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1494 1501
1495 req->handler = zfcp_fsf_open_port_handler; 1502 req->handler = zfcp_fsf_open_port_handler;
1496 req->qtcb->bottom.support.d_id = erp_action->port->d_id; 1503 req->qtcb->bottom.support.d_id = port->d_id;
1497 req->data = erp_action->port; 1504 req->data = port;
1498 req->erp_action = erp_action; 1505 req->erp_action = erp_action;
1499 erp_action->fsf_req = req; 1506 erp_action->fsf_req = req;
1507 zfcp_port_get(port);
1500 1508
1501 zfcp_fsf_start_erp_timer(req); 1509 zfcp_fsf_start_erp_timer(req);
1502 retval = zfcp_fsf_req_send(req); 1510 retval = zfcp_fsf_req_send(req);
1503 if (retval) { 1511 if (retval) {
1504 zfcp_fsf_req_free(req); 1512 zfcp_fsf_req_free(req);
1505 erp_action->fsf_req = NULL; 1513 erp_action->fsf_req = NULL;
1514 zfcp_port_put(port);
1506 } 1515 }
1507out: 1516out:
1508 spin_unlock_bh(&adapter->req_q_lock); 1517 spin_unlock_bh(&adapter->req_q_lock);
@@ -1590,8 +1599,10 @@ static void zfcp_fsf_open_wka_port_handler(struct zfcp_fsf_req *req)
1590 case FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED: 1599 case FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED:
1591 dev_warn(&req->adapter->ccw_device->dev, 1600 dev_warn(&req->adapter->ccw_device->dev,
1592 "Opening WKA port 0x%x failed\n", wka_port->d_id); 1601 "Opening WKA port 0x%x failed\n", wka_port->d_id);
1602 /* fall through */
1593 case FSF_ADAPTER_STATUS_AVAILABLE: 1603 case FSF_ADAPTER_STATUS_AVAILABLE:
1594 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1604 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1605 /* fall through */
1595 case FSF_ACCESS_DENIED: 1606 case FSF_ACCESS_DENIED:
1596 wka_port->status = ZFCP_WKA_PORT_OFFLINE; 1607 wka_port->status = ZFCP_WKA_PORT_OFFLINE;
1597 break; 1608 break;
@@ -1876,7 +1887,7 @@ static void zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *req)
1876 1887
1877 if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE) && 1888 if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE) &&
1878 (adapter->adapter_features & FSF_FEATURE_LUN_SHARING) && 1889 (adapter->adapter_features & FSF_FEATURE_LUN_SHARING) &&
1879 (adapter->ccw_device->id.dev_model != ZFCP_DEVICE_MODEL_PRIV)) { 1890 !zfcp_ccw_priv_sch(adapter)) {
1880 exclusive = (bottom->lun_access_info & 1891 exclusive = (bottom->lun_access_info &
1881 FSF_UNIT_ACCESS_EXCLUSIVE); 1892 FSF_UNIT_ACCESS_EXCLUSIVE);
1882 readwrite = (bottom->lun_access_info & 1893 readwrite = (bottom->lun_access_info &
@@ -2314,7 +2325,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
2314{ 2325{
2315 struct zfcp_fsf_req *req; 2326 struct zfcp_fsf_req *req;
2316 struct fcp_cmnd_iu *fcp_cmnd_iu; 2327 struct fcp_cmnd_iu *fcp_cmnd_iu;
2317 unsigned int sbtype; 2328 unsigned int sbtype = SBAL_FLAGS0_TYPE_READ;
2318 int real_bytes, retval = -EIO; 2329 int real_bytes, retval = -EIO;
2319 struct zfcp_adapter *adapter = unit->port->adapter; 2330 struct zfcp_adapter *adapter = unit->port->adapter;
2320 2331
@@ -2356,11 +2367,9 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
2356 switch (scsi_cmnd->sc_data_direction) { 2367 switch (scsi_cmnd->sc_data_direction) {
2357 case DMA_NONE: 2368 case DMA_NONE:
2358 req->qtcb->bottom.io.data_direction = FSF_DATADIR_CMND; 2369 req->qtcb->bottom.io.data_direction = FSF_DATADIR_CMND;
2359 sbtype = SBAL_FLAGS0_TYPE_READ;
2360 break; 2370 break;
2361 case DMA_FROM_DEVICE: 2371 case DMA_FROM_DEVICE:
2362 req->qtcb->bottom.io.data_direction = FSF_DATADIR_READ; 2372 req->qtcb->bottom.io.data_direction = FSF_DATADIR_READ;
2363 sbtype = SBAL_FLAGS0_TYPE_READ;
2364 fcp_cmnd_iu->rddata = 1; 2373 fcp_cmnd_iu->rddata = 1;
2365 break; 2374 break;
2366 case DMA_TO_DEVICE: 2375 case DMA_TO_DEVICE:
@@ -2369,8 +2378,6 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
2369 fcp_cmnd_iu->wddata = 1; 2378 fcp_cmnd_iu->wddata = 1;
2370 break; 2379 break;
2371 case DMA_BIDIRECTIONAL: 2380 case DMA_BIDIRECTIONAL:
2372 default:
2373 retval = -EIO;
2374 goto failed_scsi_cmnd; 2381 goto failed_scsi_cmnd;
2375 } 2382 }
2376 2383
@@ -2394,9 +2401,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
2394 scsi_sglist(scsi_cmnd), 2401 scsi_sglist(scsi_cmnd),
2395 FSF_MAX_SBALS_PER_REQ); 2402 FSF_MAX_SBALS_PER_REQ);
2396 if (unlikely(real_bytes < 0)) { 2403 if (unlikely(real_bytes < 0)) {
2397 if (req->sbal_number < FSF_MAX_SBALS_PER_REQ) 2404 if (req->sbal_number >= FSF_MAX_SBALS_PER_REQ) {
2398 retval = -EIO;
2399 else {
2400 dev_err(&adapter->ccw_device->dev, 2405 dev_err(&adapter->ccw_device->dev,
2401 "Oversize data package, unit 0x%016Lx " 2406 "Oversize data package, unit 0x%016Lx "
2402 "on port 0x%016Lx closed\n", 2407 "on port 0x%016Lx closed\n",