zfcp_fsf.c (f76ccaac4f82c463a037aa4a1e4ccb85c7011814) zfcp_fsf.c (663e0890e31cb85f0cca5ac1faaee0d2d52880b5)
1/*
2 * zfcp device driver
3 *
4 * Implementation of FSF commands.
5 *
6 * Copyright IBM Corp. 2002, 2010
7 */
8

--- 240 unchanged lines hidden (view full) ---

249 zfcp_erp_adapter_reopen(adapter,
250 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED |
251 ZFCP_STATUS_COMMON_ERP_FAILED,
252 "fssrh_2");
253 zfcp_fc_enqueue_event(adapter, FCH_EVT_LINKUP, 0);
254
255 break;
256 case FSF_STATUS_READ_NOTIFICATION_LOST:
1/*
2 * zfcp device driver
3 *
4 * Implementation of FSF commands.
5 *
6 * Copyright IBM Corp. 2002, 2010
7 */
8

--- 240 unchanged lines hidden (view full) ---

249 zfcp_erp_adapter_reopen(adapter,
250 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED |
251 ZFCP_STATUS_COMMON_ERP_FAILED,
252 "fssrh_2");
253 zfcp_fc_enqueue_event(adapter, FCH_EVT_LINKUP, 0);
254
255 break;
256 case FSF_STATUS_READ_NOTIFICATION_LOST:
257 if (sr_buf->status_subtype & FSF_STATUS_READ_SUB_ACT_UPDATED)
258 zfcp_cfdc_adapter_access_changed(adapter);
259 if (sr_buf->status_subtype & FSF_STATUS_READ_SUB_INCOMING_ELS)
260 zfcp_fc_conditional_port_scan(adapter);
261 break;
257 if (sr_buf->status_subtype & FSF_STATUS_READ_SUB_INCOMING_ELS)
258 zfcp_fc_conditional_port_scan(adapter);
259 break;
262 case FSF_STATUS_READ_CFDC_UPDATED:
263 zfcp_cfdc_adapter_access_changed(adapter);
264 break;
265 case FSF_STATUS_READ_FEATURE_UPDATE_ALERT:
266 adapter->adapter_features = sr_buf->payload.word[0];
267 break;
268 }
269
270 mempool_free(virt_to_page(sr_buf), adapter->pool.sr_data);
271 zfcp_fsf_req_free(req);
272

--- 657 unchanged lines hidden (view full) ---

930 case FSF_ADAPTER_STATUS_AVAILABLE:
931 switch (header->fsf_status_qual.word[0]){
932 case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE:
933 case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED:
934 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
935 break;
936 }
937 break;
260 case FSF_STATUS_READ_FEATURE_UPDATE_ALERT:
261 adapter->adapter_features = sr_buf->payload.word[0];
262 break;
263 }
264
265 mempool_free(virt_to_page(sr_buf), adapter->pool.sr_data);
266 zfcp_fsf_req_free(req);
267

--- 657 unchanged lines hidden (view full) ---

925 case FSF_ADAPTER_STATUS_AVAILABLE:
926 switch (header->fsf_status_qual.word[0]){
927 case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE:
928 case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED:
929 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
930 break;
931 }
932 break;
938 case FSF_ACCESS_DENIED:
939 break;
940 case FSF_PORT_BOXED:
941 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
942 break;
943 case FSF_PORT_HANDLE_NOT_VALID:
944 zfcp_erp_adapter_reopen(adapter, 0, "fsscth1");
945 /* fall through */
946 case FSF_GENERIC_COMMAND_REJECTED:
947 case FSF_PAYLOAD_SIZE_MISMATCH:

--- 137 unchanged lines hidden (view full) ---

1085out:
1086 spin_unlock_irq(&qdio->req_q_lock);
1087 return ret;
1088}
1089
1090static void zfcp_fsf_send_els_handler(struct zfcp_fsf_req *req)
1091{
1092 struct zfcp_fsf_ct_els *send_els = req->data;
933 case FSF_PORT_BOXED:
934 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
935 break;
936 case FSF_PORT_HANDLE_NOT_VALID:
937 zfcp_erp_adapter_reopen(adapter, 0, "fsscth1");
938 /* fall through */
939 case FSF_GENERIC_COMMAND_REJECTED:
940 case FSF_PAYLOAD_SIZE_MISMATCH:

--- 137 unchanged lines hidden (view full) ---

1078out:
1079 spin_unlock_irq(&qdio->req_q_lock);
1080 return ret;
1081}
1082
1083static void zfcp_fsf_send_els_handler(struct zfcp_fsf_req *req)
1084{
1085 struct zfcp_fsf_ct_els *send_els = req->data;
1093 struct zfcp_port *port = send_els->port;
1094 struct fsf_qtcb_header *header = &req->qtcb->header;
1095
1096 send_els->status = -EINVAL;
1097
1098 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
1099 goto skip_fsfstatus;
1100
1101 switch (header->fsf_status) {

--- 13 unchanged lines hidden (view full) ---

1115 break;
1116 }
1117 break;
1118 case FSF_ELS_COMMAND_REJECTED:
1119 case FSF_PAYLOAD_SIZE_MISMATCH:
1120 case FSF_REQUEST_SIZE_TOO_LARGE:
1121 case FSF_RESPONSE_SIZE_TOO_LARGE:
1122 break;
1086 struct fsf_qtcb_header *header = &req->qtcb->header;
1087
1088 send_els->status = -EINVAL;
1089
1090 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
1091 goto skip_fsfstatus;
1092
1093 switch (header->fsf_status) {

--- 13 unchanged lines hidden (view full) ---

1107 break;
1108 }
1109 break;
1110 case FSF_ELS_COMMAND_REJECTED:
1111 case FSF_PAYLOAD_SIZE_MISMATCH:
1112 case FSF_REQUEST_SIZE_TOO_LARGE:
1113 case FSF_RESPONSE_SIZE_TOO_LARGE:
1114 break;
1123 case FSF_ACCESS_DENIED:
1124 if (port) {
1125 zfcp_cfdc_port_denied(port, &header->fsf_status_qual);
1126 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1127 }
1128 break;
1129 case FSF_SBAL_MISMATCH:
1130 /* should never occur, avoided in zfcp_fsf_send_els */
1131 /* fall through */
1132 default:
1133 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1134 break;
1135 }
1136skip_fsfstatus:

--- 71 unchanged lines hidden (view full) ---

1208 retval = PTR_ERR(req);
1209 goto out;
1210 }
1211
1212 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1213 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1214
1215 req->qtcb->bottom.config.feature_selection =
1115 case FSF_SBAL_MISMATCH:
1116 /* should never occur, avoided in zfcp_fsf_send_els */
1117 /* fall through */
1118 default:
1119 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1120 break;
1121 }
1122skip_fsfstatus:

--- 71 unchanged lines hidden (view full) ---

1194 retval = PTR_ERR(req);
1195 goto out;
1196 }
1197
1198 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1199 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1200
1201 req->qtcb->bottom.config.feature_selection =
1216 FSF_FEATURE_CFDC |
1217 FSF_FEATURE_LUN_SHARING |
1218 FSF_FEATURE_NOTIFICATION_LOST |
1219 FSF_FEATURE_UPDATE_ALERT;
1220 req->erp_action = erp_action;
1221 req->handler = zfcp_fsf_exchange_config_data_handler;
1222 erp_action->fsf_req_id = req->req_id;
1223
1224 zfcp_fsf_start_erp_timer(req);
1225 retval = zfcp_fsf_req_send(req);

--- 23 unchanged lines hidden (view full) ---

1249 retval = PTR_ERR(req);
1250 goto out_unlock;
1251 }
1252
1253 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1254 req->handler = zfcp_fsf_exchange_config_data_handler;
1255
1256 req->qtcb->bottom.config.feature_selection =
1202 FSF_FEATURE_NOTIFICATION_LOST |
1203 FSF_FEATURE_UPDATE_ALERT;
1204 req->erp_action = erp_action;
1205 req->handler = zfcp_fsf_exchange_config_data_handler;
1206 erp_action->fsf_req_id = req->req_id;
1207
1208 zfcp_fsf_start_erp_timer(req);
1209 retval = zfcp_fsf_req_send(req);

--- 23 unchanged lines hidden (view full) ---

1233 retval = PTR_ERR(req);
1234 goto out_unlock;
1235 }
1236
1237 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1238 req->handler = zfcp_fsf_exchange_config_data_handler;
1239
1240 req->qtcb->bottom.config.feature_selection =
1257 FSF_FEATURE_CFDC |
1258 FSF_FEATURE_LUN_SHARING |
1259 FSF_FEATURE_NOTIFICATION_LOST |
1260 FSF_FEATURE_UPDATE_ALERT;
1261
1262 if (data)
1263 req->data = data;
1264
1265 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
1266 retval = zfcp_fsf_req_send(req);

--- 110 unchanged lines hidden (view full) ---

1377 struct fc_els_flogi *plogi;
1378
1379 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
1380 goto out;
1381
1382 switch (header->fsf_status) {
1383 case FSF_PORT_ALREADY_OPEN:
1384 break;
1241 FSF_FEATURE_NOTIFICATION_LOST |
1242 FSF_FEATURE_UPDATE_ALERT;
1243
1244 if (data)
1245 req->data = data;
1246
1247 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
1248 retval = zfcp_fsf_req_send(req);

--- 110 unchanged lines hidden (view full) ---

1359 struct fc_els_flogi *plogi;
1360
1361 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
1362 goto out;
1363
1364 switch (header->fsf_status) {
1365 case FSF_PORT_ALREADY_OPEN:
1366 break;
1385 case FSF_ACCESS_DENIED:
1386 zfcp_cfdc_port_denied(port, &header->fsf_status_qual);
1387 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1388 break;
1389 case FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED:
1390 dev_warn(&req->adapter->ccw_device->dev,
1391 "Not enough FCP adapter resources to open "
1392 "remote port 0x%016Lx\n",
1393 (unsigned long long)port->wwpn);
1394 zfcp_erp_set_port_status(port,
1395 ZFCP_STATUS_COMMON_ERP_FAILED);
1396 req->status |= ZFCP_STATUS_FSFREQ_ERROR;

--- 166 unchanged lines hidden (view full) ---

1563
1564 switch (header->fsf_status) {
1565 case FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED:
1566 dev_warn(&req->adapter->ccw_device->dev,
1567 "Opening WKA port 0x%x failed\n", wka_port->d_id);
1568 /* fall through */
1569 case FSF_ADAPTER_STATUS_AVAILABLE:
1570 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1367 case FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED:
1368 dev_warn(&req->adapter->ccw_device->dev,
1369 "Not enough FCP adapter resources to open "
1370 "remote port 0x%016Lx\n",
1371 (unsigned long long)port->wwpn);
1372 zfcp_erp_set_port_status(port,
1373 ZFCP_STATUS_COMMON_ERP_FAILED);
1374 req->status |= ZFCP_STATUS_FSFREQ_ERROR;

--- 166 unchanged lines hidden (view full) ---

1541
1542 switch (header->fsf_status) {
1543 case FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED:
1544 dev_warn(&req->adapter->ccw_device->dev,
1545 "Opening WKA port 0x%x failed\n", wka_port->d_id);
1546 /* fall through */
1547 case FSF_ADAPTER_STATUS_AVAILABLE:
1548 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1571 /* fall through */
1572 case FSF_ACCESS_DENIED:
1573 wka_port->status = ZFCP_FC_WKA_PORT_OFFLINE;
1574 break;
1575 case FSF_GOOD:
1576 wka_port->handle = header->port_handle;
1577 /* fall through */
1578 case FSF_PORT_ALREADY_OPEN:
1579 wka_port->status = ZFCP_FC_WKA_PORT_ONLINE;
1580 }

--- 103 unchanged lines hidden (view full) ---

1684 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
1685 return;
1686
1687 switch (header->fsf_status) {
1688 case FSF_PORT_HANDLE_NOT_VALID:
1689 zfcp_erp_adapter_reopen(port->adapter, 0, "fscpph1");
1690 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1691 break;
1549 wka_port->status = ZFCP_FC_WKA_PORT_OFFLINE;
1550 break;
1551 case FSF_GOOD:
1552 wka_port->handle = header->port_handle;
1553 /* fall through */
1554 case FSF_PORT_ALREADY_OPEN:
1555 wka_port->status = ZFCP_FC_WKA_PORT_ONLINE;
1556 }

--- 103 unchanged lines hidden (view full) ---

1660 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
1661 return;
1662
1663 switch (header->fsf_status) {
1664 case FSF_PORT_HANDLE_NOT_VALID:
1665 zfcp_erp_adapter_reopen(port->adapter, 0, "fscpph1");
1666 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1667 break;
1692 case FSF_ACCESS_DENIED:
1693 zfcp_cfdc_port_denied(port, &header->fsf_status_qual);
1694 break;
1695 case FSF_PORT_BOXED:
1696 /* can't use generic zfcp_erp_modify_port_status because
1697 * ZFCP_STATUS_COMMON_OPEN must not be reset for the port */
1698 atomic_clear_mask(ZFCP_STATUS_PORT_PHYS_OPEN, &port->status);
1699 shost_for_each_device(sdev, port->adapter->scsi_host)
1700 if (sdev_to_zfcp(sdev)->port == port)
1701 atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN,
1702 &sdev_to_zfcp(sdev)->status);

--- 69 unchanged lines hidden (view full) ---

1772}
1773
1774static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req *req)
1775{
1776 struct zfcp_adapter *adapter = req->adapter;
1777 struct scsi_device *sdev = req->data;
1778 struct zfcp_scsi_dev *zfcp_sdev;
1779 struct fsf_qtcb_header *header = &req->qtcb->header;
1668 case FSF_PORT_BOXED:
1669 /* can't use generic zfcp_erp_modify_port_status because
1670 * ZFCP_STATUS_COMMON_OPEN must not be reset for the port */
1671 atomic_clear_mask(ZFCP_STATUS_PORT_PHYS_OPEN, &port->status);
1672 shost_for_each_device(sdev, port->adapter->scsi_host)
1673 if (sdev_to_zfcp(sdev)->port == port)
1674 atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN,
1675 &sdev_to_zfcp(sdev)->status);

--- 69 unchanged lines hidden (view full) ---

1745}
1746
1747static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req *req)
1748{
1749 struct zfcp_adapter *adapter = req->adapter;
1750 struct scsi_device *sdev = req->data;
1751 struct zfcp_scsi_dev *zfcp_sdev;
1752 struct fsf_qtcb_header *header = &req->qtcb->header;
1780 struct fsf_qtcb_bottom_support *bottom = &req->qtcb->bottom.support;
1753 union fsf_status_qual *qual = &header->fsf_status_qual;
1781
1782 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
1783 return;
1784
1785 zfcp_sdev = sdev_to_zfcp(sdev);
1786
1787 atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED |
1754
1755 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
1756 return;
1757
1758 zfcp_sdev = sdev_to_zfcp(sdev);
1759
1760 atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED |
1788 ZFCP_STATUS_COMMON_ACCESS_BOXED |
1789 ZFCP_STATUS_LUN_SHARED |
1790 ZFCP_STATUS_LUN_READONLY,
1761 ZFCP_STATUS_COMMON_ACCESS_BOXED,
1791 &zfcp_sdev->status);
1792
1793 switch (header->fsf_status) {
1794
1795 case FSF_PORT_HANDLE_NOT_VALID:
1796 zfcp_erp_adapter_reopen(adapter, 0, "fsouh_1");
1797 /* fall through */
1798 case FSF_LUN_ALREADY_OPEN:
1799 break;
1762 &zfcp_sdev->status);
1763
1764 switch (header->fsf_status) {
1765
1766 case FSF_PORT_HANDLE_NOT_VALID:
1767 zfcp_erp_adapter_reopen(adapter, 0, "fsouh_1");
1768 /* fall through */
1769 case FSF_LUN_ALREADY_OPEN:
1770 break;
1800 case FSF_ACCESS_DENIED:
1801 zfcp_cfdc_lun_denied(sdev, &header->fsf_status_qual);
1802 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1803 break;
1804 case FSF_PORT_BOXED:
1805 zfcp_erp_set_port_status(zfcp_sdev->port,
1806 ZFCP_STATUS_COMMON_ACCESS_BOXED);
1807 zfcp_erp_port_reopen(zfcp_sdev->port,
1808 ZFCP_STATUS_COMMON_ERP_FAILED, "fsouh_2");
1809 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1810 break;
1811 case FSF_LUN_SHARING_VIOLATION:
1771 case FSF_PORT_BOXED:
1772 zfcp_erp_set_port_status(zfcp_sdev->port,
1773 ZFCP_STATUS_COMMON_ACCESS_BOXED);
1774 zfcp_erp_port_reopen(zfcp_sdev->port,
1775 ZFCP_STATUS_COMMON_ERP_FAILED, "fsouh_2");
1776 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1777 break;
1778 case FSF_LUN_SHARING_VIOLATION:
1812 zfcp_cfdc_lun_shrng_vltn(sdev, &header->fsf_status_qual);
1779 if (qual->word[0])
1780 dev_warn(&zfcp_sdev->port->adapter->ccw_device->dev,
1781 "LUN 0x%Lx on port 0x%Lx is already in "
1782 "use by CSS%d, MIF Image ID %x\n",
1783 zfcp_scsi_dev_lun(sdev),
1784 (unsigned long long)zfcp_sdev->port->wwpn,
1785 qual->fsf_queue_designator.cssid,
1786 qual->fsf_queue_designator.hla);
1787 zfcp_erp_set_lun_status(sdev,
1788 ZFCP_STATUS_COMMON_ERP_FAILED |
1789 ZFCP_STATUS_COMMON_ACCESS_DENIED);
1813 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1814 break;
1815 case FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED:
1816 dev_warn(&adapter->ccw_device->dev,
1817 "No handle is available for LUN "
1818 "0x%016Lx on port 0x%016Lx\n",
1819 (unsigned long long)zfcp_scsi_dev_lun(sdev),
1820 (unsigned long long)zfcp_sdev->port->wwpn);

--- 11 unchanged lines hidden (view full) ---

1832 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1833 break;
1834 }
1835 break;
1836
1837 case FSF_GOOD:
1838 zfcp_sdev->lun_handle = header->lun_handle;
1839 atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &zfcp_sdev->status);
1790 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1791 break;
1792 case FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED:
1793 dev_warn(&adapter->ccw_device->dev,
1794 "No handle is available for LUN "
1795 "0x%016Lx on port 0x%016Lx\n",
1796 (unsigned long long)zfcp_scsi_dev_lun(sdev),
1797 (unsigned long long)zfcp_sdev->port->wwpn);

--- 11 unchanged lines hidden (view full) ---

1809 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1810 break;
1811 }
1812 break;
1813
1814 case FSF_GOOD:
1815 zfcp_sdev->lun_handle = header->lun_handle;
1816 atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &zfcp_sdev->status);
1840 zfcp_cfdc_open_lun_eval(sdev, bottom);
1841 break;
1842 }
1843}
1844
1845/**
1846 * zfcp_fsf_open_lun - open LUN
1847 * @erp_action: pointer to struct zfcp_erp_action
1848 * Returns: 0 on success, error otherwise

--- 211 unchanged lines hidden (view full) ---

2060 case FSF_FCPLUN_NOT_VALID:
2061 case FSF_LUN_HANDLE_NOT_VALID:
2062 zfcp_erp_port_reopen(zfcp_sdev->port, 0, "fssfch2");
2063 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2064 break;
2065 case FSF_SERVICE_CLASS_NOT_SUPPORTED:
2066 zfcp_fsf_class_not_supp(req);
2067 break;
1817 break;
1818 }
1819}
1820
1821/**
1822 * zfcp_fsf_open_lun - open LUN
1823 * @erp_action: pointer to struct zfcp_erp_action
1824 * Returns: 0 on success, error otherwise

--- 211 unchanged lines hidden (view full) ---

2036 case FSF_FCPLUN_NOT_VALID:
2037 case FSF_LUN_HANDLE_NOT_VALID:
2038 zfcp_erp_port_reopen(zfcp_sdev->port, 0, "fssfch2");
2039 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2040 break;
2041 case FSF_SERVICE_CLASS_NOT_SUPPORTED:
2042 zfcp_fsf_class_not_supp(req);
2043 break;
2068 case FSF_ACCESS_DENIED:
2069 zfcp_cfdc_lun_denied(sdev, &header->fsf_status_qual);
2070 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2071 break;
2072 case FSF_DIRECTION_INDICATOR_NOT_VALID:
2073 dev_err(&req->adapter->ccw_device->dev,
2074 "Incorrect direction %d, LUN 0x%016Lx on port "
2075 "0x%016Lx closed\n",
2076 req->qtcb->bottom.io.data_direction,
2077 (unsigned long long)zfcp_scsi_dev_lun(sdev),
2078 (unsigned long long)zfcp_sdev->port->wwpn);
2079 zfcp_erp_adapter_shutdown(zfcp_sdev->port->adapter, 0,

--- 284 unchanged lines hidden (view full) ---

2364
2365 zfcp_fsf_req_free(req);
2366 req = NULL;
2367out:
2368 spin_unlock_irq(&qdio->req_q_lock);
2369 return req;
2370}
2371
2044 case FSF_DIRECTION_INDICATOR_NOT_VALID:
2045 dev_err(&req->adapter->ccw_device->dev,
2046 "Incorrect direction %d, LUN 0x%016Lx on port "
2047 "0x%016Lx closed\n",
2048 req->qtcb->bottom.io.data_direction,
2049 (unsigned long long)zfcp_scsi_dev_lun(sdev),
2050 (unsigned long long)zfcp_sdev->port->wwpn);
2051 zfcp_erp_adapter_shutdown(zfcp_sdev->port->adapter, 0,

--- 284 unchanged lines hidden (view full) ---

2336
2337 zfcp_fsf_req_free(req);
2338 req = NULL;
2339out:
2340 spin_unlock_irq(&qdio->req_q_lock);
2341 return req;
2342}
2343
2372static void zfcp_fsf_control_file_handler(struct zfcp_fsf_req *req)
2373{
2374}
2375
2376/**
2344/**
2377 * zfcp_fsf_control_file - control file upload/download
2378 * @adapter: pointer to struct zfcp_adapter
2379 * @fsf_cfdc: pointer to struct zfcp_fsf_cfdc
2380 * Returns: on success pointer to struct zfcp_fsf_req, NULL otherwise
2381 */
2382struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter,
2383 struct zfcp_fsf_cfdc *fsf_cfdc)
2384{
2385 struct zfcp_qdio *qdio = adapter->qdio;
2386 struct zfcp_fsf_req *req = NULL;
2387 struct fsf_qtcb_bottom_support *bottom;
2388 int retval = -EIO;
2389 u8 direction;
2390
2391 if (!(adapter->adapter_features & FSF_FEATURE_CFDC))
2392 return ERR_PTR(-EOPNOTSUPP);
2393
2394 switch (fsf_cfdc->command) {
2395 case FSF_QTCB_DOWNLOAD_CONTROL_FILE:
2396 direction = SBAL_SFLAGS0_TYPE_WRITE;
2397 break;
2398 case FSF_QTCB_UPLOAD_CONTROL_FILE:
2399 direction = SBAL_SFLAGS0_TYPE_READ;
2400 break;
2401 default:
2402 return ERR_PTR(-EINVAL);
2403 }
2404
2405 spin_lock_irq(&qdio->req_q_lock);
2406 if (zfcp_qdio_sbal_get(qdio))
2407 goto out;
2408
2409 req = zfcp_fsf_req_create(qdio, fsf_cfdc->command, direction, NULL);
2410 if (IS_ERR(req)) {
2411 retval = -EPERM;
2412 goto out;
2413 }
2414
2415 req->handler = zfcp_fsf_control_file_handler;
2416
2417 bottom = &req->qtcb->bottom.support;
2418 bottom->operation_subtype = FSF_CFDC_OPERATION_SUBTYPE;
2419 bottom->option = fsf_cfdc->option;
2420
2421 retval = zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req, fsf_cfdc->sg);
2422
2423 if (retval ||
2424 (zfcp_qdio_real_bytes(fsf_cfdc->sg) != ZFCP_CFDC_MAX_SIZE)) {
2425 zfcp_fsf_req_free(req);
2426 retval = -EIO;
2427 goto out;
2428 }
2429 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
2430 if (zfcp_adapter_multi_buffer_active(adapter))
2431 zfcp_qdio_set_scount(qdio, &req->qdio_req);
2432
2433 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
2434 retval = zfcp_fsf_req_send(req);
2435out:
2436 spin_unlock_irq(&qdio->req_q_lock);
2437
2438 if (!retval) {
2439 wait_for_completion(&req->completion);
2440 return req;
2441 }
2442 return ERR_PTR(retval);
2443}
2444
2445/**
2446 * zfcp_fsf_reqid_check - validate req_id contained in SBAL returned by QDIO
2447 * @adapter: pointer to struct zfcp_adapter
2448 * @sbal_idx: response queue index of SBAL to be processed
2449 */
2450void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx)
2451{
2452 struct zfcp_adapter *adapter = qdio->adapter;
2453 struct qdio_buffer *sbal = qdio->res_q[sbal_idx];

--- 37 unchanged lines hidden ---
2345 * zfcp_fsf_reqid_check - validate req_id contained in SBAL returned by QDIO
2346 * @adapter: pointer to struct zfcp_adapter
2347 * @sbal_idx: response queue index of SBAL to be processed
2348 */
2349void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx)
2350{
2351 struct zfcp_adapter *adapter = qdio->adapter;
2352 struct qdio_buffer *sbal = qdio->res_q[sbal_idx];

--- 37 unchanged lines hidden ---