Lines Matching refs:req

80 static void zfcp_fsf_class_not_supp(struct zfcp_fsf_req *req)
82 dev_err(&req->adapter->ccw_device->dev, "FCP device not "
84 zfcp_erp_adapter_shutdown(req->adapter, 0, "fscns_1");
85 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
90 * @req: pointer to struct zfcp_fsf_req
92 void zfcp_fsf_req_free(struct zfcp_fsf_req *req)
94 if (likely(req->pool)) {
95 if (likely(!zfcp_fsf_req_is_status_read_buffer(req)))
96 mempool_free(req->qtcb, req->adapter->pool.qtcb_pool);
97 mempool_free(req, req->pool);
101 if (likely(!zfcp_fsf_req_is_status_read_buffer(req)))
102 kmem_cache_free(zfcp_fsf_qtcb_cache, req->qtcb);
103 kfree(req);
106 static void zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *req)
109 struct fsf_status_read_buffer *sr_buf = req->data;
110 struct zfcp_adapter *adapter = req->adapter;
144 static void zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *req,
147 struct zfcp_adapter *adapter = req->adapter;
163 dev_warn(&req->adapter->ccw_device->dev,
168 dev_warn(&req->adapter->ccw_device->dev,
173 dev_warn(&req->adapter->ccw_device->dev,
178 dev_warn(&req->adapter->ccw_device->dev,
183 dev_warn(&req->adapter->ccw_device->dev,
188 dev_warn(&req->adapter->ccw_device->dev,
192 dev_warn(&req->adapter->ccw_device->dev,
196 dev_warn(&req->adapter->ccw_device->dev,
201 dev_warn(&req->adapter->ccw_device->dev,
206 dev_warn(&req->adapter->ccw_device->dev,
211 dev_warn(&req->adapter->ccw_device->dev,
216 dev_warn(&req->adapter->ccw_device->dev,
221 dev_warn(&req->adapter->ccw_device->dev,
229 static void zfcp_fsf_status_read_link_down(struct zfcp_fsf_req *req)
231 struct fsf_status_read_buffer *sr_buf = req->data;
238 zfcp_fsf_link_down_info_eval(req, ldi);
241 zfcp_fsf_link_down_info_eval(req, NULL);
245 static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req)
247 struct zfcp_adapter *adapter = req->adapter;
248 struct fsf_status_read_buffer *sr_buf = req->data;
250 if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED) {
251 zfcp_dbf_hba_fsf_uss("fssrh_1", req);
253 zfcp_fsf_req_free(req);
257 zfcp_dbf_hba_fsf_uss("fssrh_4", req);
261 zfcp_fsf_status_read_port_closed(req);
264 zfcp_fc_incoming_els(req);
269 zfcp_dbf_hba_bit_err("fssrh_3", req);
280 zfcp_fsf_status_read_link_down(req);
306 zfcp_fsf_req_free(req);
312 static void zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *req)
314 switch (req->qtcb->header.fsf_status_qual.word[0]) {
323 dev_err(&req->adapter->ccw_device->dev,
326 zfcp_qdio_siosl(req->adapter);
327 zfcp_erp_adapter_shutdown(req->adapter, 0, "fsfsqe1");
331 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
334 static void zfcp_fsf_fsfstatus_eval(struct zfcp_fsf_req *req)
336 if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ERROR))
339 switch (req->qtcb->header.fsf_status) {
341 dev_err(&req->adapter->ccw_device->dev,
343 req->qtcb->header.fsf_command);
344 zfcp_erp_adapter_shutdown(req->adapter, 0, "fsfse_1");
345 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
348 zfcp_fsf_fsfstatus_qual_eval(req);
353 static void zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *req)
355 struct zfcp_adapter *adapter = req->adapter;
356 struct fsf_qtcb *qtcb = req->qtcb;
359 zfcp_dbf_hba_fsf_response(req);
361 if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED) {
362 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
380 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
398 zfcp_fsf_link_down_info_eval(req, &psq->link_down_info);
418 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
423 * @req: The FSF request that has been completed.
433 static void zfcp_fsf_req_complete(struct zfcp_fsf_req *req)
437 if (unlikely(zfcp_fsf_req_is_status_read_buffer(req))) {
438 zfcp_fsf_status_read_handler(req);
442 del_timer_sync(&req->timer);
443 zfcp_fsf_protstatus_eval(req);
444 zfcp_fsf_fsfstatus_eval(req);
445 req->handler(req);
447 erp_action = req->erp_action;
451 if (likely(req->status & ZFCP_STATUS_FSFREQ_CLEANUP))
452 zfcp_fsf_req_free(req);
454 complete(&req->completion);
468 struct zfcp_fsf_req *req, *tmp;
474 list_for_each_entry_safe(req, tmp, &remove_queue, list) {
475 list_del(&req->list);
476 req->status |= ZFCP_STATUS_FSFREQ_DISMISSED;
477 zfcp_fsf_req_complete(req);
518 static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
520 struct fsf_qtcb_bottom_config *bottom = &req->qtcb->bottom.config;
521 struct zfcp_adapter *adapter = req->adapter;
528 if (req->data)
529 memcpy(req->data, bottom, sizeof(*bottom));
537 if (req->qtcb->header.fsf_status == FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE)
562 static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req)
564 struct zfcp_adapter *adapter = req->adapter;
567 struct fsf_qtcb *qtcb = req->qtcb;
570 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
589 if (zfcp_fsf_exchange_config_evaluate(req))
605 req->status |= ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE;
611 zfcp_fsf_link_down_info_eval(req,
615 if (zfcp_fsf_exchange_config_evaluate(req))
719 struct zfcp_fsf_req *req)
727 zfcp_dbf_hba_fsf_fces("fsfcesa", req, ZFCP_DBF_INVALID_WWPN,
734 static void zfcp_fsf_exchange_port_evaluate(struct zfcp_fsf_req *req)
736 struct zfcp_adapter *adapter = req->adapter;
737 struct fsf_qtcb_bottom_port *bottom = &req->qtcb->bottom.port;
739 if (req->data)
740 memcpy(req->data, bottom, sizeof(*bottom));
747 zfcp_fsf_dbf_adapter_fc_security(adapter, req);
750 static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req)
753 &req->adapter->diagnostics->port_data.header;
754 struct fsf_qtcb *qtcb = req->qtcb;
757 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
768 zfcp_scsi_shost_update_port_data(req->adapter, bottom);
769 zfcp_fsf_exchange_port_evaluate(req);
773 req->status |= ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE;
775 zfcp_fsf_link_down_info_eval(req,
778 zfcp_scsi_shost_update_port_data(req->adapter, bottom);
779 zfcp_fsf_exchange_port_evaluate(req);
786 struct zfcp_fsf_req *req;
789 req = mempool_alloc(pool, GFP_ATOMIC);
791 req = kmalloc(sizeof(*req), GFP_ATOMIC);
793 if (unlikely(!req))
796 memset(req, 0, sizeof(*req));
797 req->pool = pool;
798 return req;
822 struct zfcp_fsf_req *req = zfcp_fsf_alloc(pool);
824 if (unlikely(!req))
830 INIT_LIST_HEAD(&req->list);
831 timer_setup(&req->timer, NULL, 0);
832 init_completion(&req->completion);
834 req->adapter = adapter;
835 req->req_id = adapter->req_no;
839 req->qtcb = zfcp_fsf_qtcb_alloc(
842 req->qtcb = zfcp_fsf_qtcb_alloc(NULL);
844 if (unlikely(!req->qtcb)) {
845 zfcp_fsf_req_free(req);
849 req->qtcb->prefix.req_seq_no = adapter->fsf_req_seq_no;
850 req->qtcb->prefix.req_id = req->req_id;
851 req->qtcb->prefix.ulp_info = 26;
852 req->qtcb->prefix.qtcb_type = fsf_qtcb_type[fsf_cmd];
853 req->qtcb->prefix.qtcb_version = FSF_QTCB_CURRENT_VERSION;
854 req->qtcb->header.req_handle = req->req_id;
855 req->qtcb->header.fsf_command = fsf_cmd;
858 zfcp_qdio_req_init(adapter->qdio, &req->qdio_req, req->req_id, sbtype,
859 req->qtcb, sizeof(struct fsf_qtcb));
861 return req;
864 static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
866 const bool is_srb = zfcp_fsf_req_is_status_read_buffer(req);
867 struct zfcp_adapter *adapter = req->adapter;
869 unsigned long req_id = req->req_id;
871 zfcp_reqlist_add(adapter->req_list, req);
873 req->qdio_req.qdio_outb_usage = atomic_read(&qdio->req_q_free);
874 req->issued = get_tod_clock();
875 if (zfcp_qdio_send(qdio, &req->qdio_req)) {
876 del_timer_sync(&req->timer);
884 * NOTE: DO NOT TOUCH ASYNC req PAST THIS POINT.
885 * ONLY TOUCH SYNC req AGAIN ON req->completion.
891 * when it is completed via req->completion, is it safe to use req
911 struct zfcp_fsf_req *req;
920 req = zfcp_fsf_req_create(qdio, FSF_QTCB_UNSOLICITED_STATUS,
923 if (IS_ERR(req)) {
924 retval = PTR_ERR(req);
935 req->data = sr_buf;
937 zfcp_qdio_fill_next(qdio, &req->qdio_req, sr_buf, sizeof(*sr_buf));
938 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
940 retval = zfcp_fsf_req_send(req);
943 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */
948 req->data = NULL;
951 zfcp_dbf_hba_fsf_uss("fssr__1", req);
952 zfcp_fsf_req_free(req);
958 static void zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *req)
960 struct scsi_device *sdev = req->data;
962 union fsf_status_qual *fsq = &req->qtcb->header.fsf_status_qual;
964 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
969 switch (req->qtcb->header.fsf_status) {
974 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
980 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
984 req->status |= ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED;
991 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
997 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1005 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1010 req->status |= ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED;
1023 struct zfcp_fsf_req *req = NULL;
1032 req = zfcp_fsf_req_create(qdio, FSF_QTCB_ABORT_FCP_CMND,
1035 if (IS_ERR(req)) {
1036 req = NULL;
1044 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1046 req->data = sdev;
1047 req->handler = zfcp_fsf_abort_fcp_command_handler;
1048 req->qtcb->header.lun_handle = zfcp_sdev->lun_handle;
1049 req->qtcb->header.port_handle = zfcp_sdev->port->handle;
1050 req->qtcb->bottom.support.req_handle = (u64) old_req_id;
1052 zfcp_fsf_start_timer(req, ZFCP_FSF_SCSI_ER_TIMEOUT);
1053 if (!zfcp_fsf_req_send(req)) {
1054 /* NOTE: DO NOT TOUCH req, UNTIL IT COMPLETES! */
1059 zfcp_fsf_req_free(req);
1060 req = NULL;
1063 return req;
1066 static void zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *req)
1068 struct zfcp_adapter *adapter = req->adapter;
1069 struct zfcp_fsf_ct_els *ct = req->data;
1070 struct fsf_qtcb_header *header = &req->qtcb->header;
1074 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
1080 zfcp_dbf_san_res("fsscth2", req);
1083 zfcp_fsf_class_not_supp(req);
1089 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1094 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1104 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1123 static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req,
1127 struct zfcp_adapter *adapter = req->adapter;
1129 struct fsf_qtcb *qtcb = req->qtcb;
1133 if (zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req, sg_req))
1137 if (zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req, sg_resp))
1142 zfcp_qdio_set_data_div(qdio, &req->qdio_req, sg_nents(sg_req));
1143 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1144 zfcp_qdio_set_scount(qdio, &req->qdio_req);
1150 zfcp_fsf_setup_ct_els_unchained(qdio, &req->qdio_req,
1158 if (zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req, sg_req))
1163 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1164 zfcp_qdio_skip_to_last_sbale(qdio, &req->qdio_req);
1166 if (zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req, sg_resp))
1171 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1176 static int zfcp_fsf_setup_ct_els(struct zfcp_fsf_req *req,
1183 ret = zfcp_fsf_setup_ct_els_sbals(req, sg_req, sg_resp);
1190 req->qtcb->bottom.support.service_class = FSF_CLASS_3;
1191 req->qtcb->bottom.support.timeout = timeout;
1192 zfcp_fsf_start_timer(req, (timeout + 10) * HZ);
1209 struct zfcp_fsf_req *req;
1216 req = zfcp_fsf_req_create(qdio, FSF_QTCB_SEND_GENERIC,
1219 if (IS_ERR(req)) {
1220 ret = PTR_ERR(req);
1224 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1225 ret = zfcp_fsf_setup_ct_els(req, ct->req, ct->resp, timeout);
1229 req->handler = zfcp_fsf_send_ct_handler;
1230 req->qtcb->header.port_handle = wka_port->handle;
1232 req->data = ct;
1234 zfcp_dbf_san_req("fssct_1", req, wka_port->d_id);
1236 ret = zfcp_fsf_req_send(req);
1239 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */
1244 zfcp_fsf_req_free(req);
1250 static void zfcp_fsf_send_els_handler(struct zfcp_fsf_req *req)
1252 struct zfcp_fsf_ct_els *send_els = req->data;
1253 struct fsf_qtcb_header *header = &req->qtcb->header;
1257 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
1263 zfcp_dbf_san_res("fsselh1", req);
1266 zfcp_fsf_class_not_supp(req);
1273 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1286 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1304 struct zfcp_fsf_req *req;
1312 req = zfcp_fsf_req_create(qdio, FSF_QTCB_SEND_ELS,
1315 if (IS_ERR(req)) {
1316 ret = PTR_ERR(req);
1320 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1323 zfcp_qdio_sbal_limit(qdio, &req->qdio_req, 2);
1325 ret = zfcp_fsf_setup_ct_els(req, els->req, els->resp, timeout);
1330 hton24(req->qtcb->bottom.support.d_id, d_id);
1331 req->handler = zfcp_fsf_send_els_handler;
1333 req->data = els;
1335 zfcp_dbf_san_req("fssels1", req, d_id);
1337 ret = zfcp_fsf_req_send(req);
1340 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */
1345 zfcp_fsf_req_free(req);
1353 struct zfcp_fsf_req *req;
1361 req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_CONFIG_DATA,
1365 if (IS_ERR(req)) {
1366 retval = PTR_ERR(req);
1370 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1371 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1373 req->qtcb->bottom.config.feature_selection =
1378 req->erp_action = erp_action;
1379 req->handler = zfcp_fsf_exchange_config_data_handler;
1380 erp_action->fsf_req_id = req->req_id;
1382 zfcp_fsf_start_erp_timer(req);
1383 retval = zfcp_fsf_req_send(req);
1385 zfcp_fsf_req_free(req);
1388 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */
1410 struct zfcp_fsf_req *req = NULL;
1417 req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_CONFIG_DATA,
1420 if (IS_ERR(req)) {
1421 retval = PTR_ERR(req);
1425 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1426 req->handler = zfcp_fsf_exchange_config_data_handler;
1428 req->qtcb->bottom.config.feature_selection =
1435 req->data = data;
1437 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
1438 retval = zfcp_fsf_req_send(req);
1442 /* NOTE: ONLY TOUCH SYNC req AGAIN ON req->completion. */
1443 wait_for_completion(&req->completion);
1445 if (req->status &
1448 else if (req->status & ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE)
1452 zfcp_fsf_req_free(req);
1468 struct zfcp_fsf_req *req;
1478 req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_PORT_DATA,
1482 if (IS_ERR(req)) {
1483 retval = PTR_ERR(req);
1487 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1488 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1490 req->handler = zfcp_fsf_exchange_port_data_handler;
1491 req->erp_action = erp_action;
1492 erp_action->fsf_req_id = req->req_id;
1494 zfcp_fsf_start_erp_timer(req);
1495 retval = zfcp_fsf_req_send(req);
1497 zfcp_fsf_req_free(req);
1500 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */
1522 struct zfcp_fsf_req *req = NULL;
1532 req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_PORT_DATA,
1535 if (IS_ERR(req)) {
1536 retval = PTR_ERR(req);
1541 req->data = data;
1543 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1545 req->handler = zfcp_fsf_exchange_port_data_handler;
1546 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
1547 retval = zfcp_fsf_req_send(req);
1551 /* NOTE: ONLY TOUCH SYNC req AGAIN ON req->completion. */
1552 wait_for_completion(&req->completion);
1554 if (req->status &
1557 else if (req->status & ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE)
1561 zfcp_fsf_req_free(req);
1570 struct zfcp_fsf_req *req)
1580 zfcp_dbf_hba_fsf_fces("fsfcesp", req, port->wwpn,
1674 static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)
1676 struct zfcp_adapter *adapter = req->adapter;
1677 struct zfcp_port *port = req->data;
1678 struct fsf_qtcb_header *header = &req->qtcb->header;
1679 struct fsf_qtcb_bottom_support *bottom = &req->qtcb->bottom.support;
1682 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
1695 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1698 zfcp_fsf_log_security_error(&req->adapter->ccw_device->dev,
1701 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1710 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1720 zfcp_fsf_log_port_fc_security(port, req);
1745 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1762 struct zfcp_fsf_req *req;
1769 req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_PORT_WITH_DID,
1773 if (IS_ERR(req)) {
1774 retval = PTR_ERR(req);
1778 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1779 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1781 req->handler = zfcp_fsf_open_port_handler;
1782 hton24(req->qtcb->bottom.support.d_id, port->d_id);
1783 req->data = port;
1784 req->erp_action = erp_action;
1785 erp_action->fsf_req_id = req->req_id;
1788 zfcp_fsf_start_erp_timer(req);
1789 retval = zfcp_fsf_req_send(req);
1791 zfcp_fsf_req_free(req);
1795 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */
1801 static void zfcp_fsf_close_port_handler(struct zfcp_fsf_req *req)
1803 struct zfcp_port *port = req->data;
1805 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
1808 switch (req->qtcb->header.fsf_status) {
1811 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1829 struct zfcp_fsf_req *req;
1836 req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PORT,
1840 if (IS_ERR(req)) {
1841 retval = PTR_ERR(req);
1845 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1846 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1848 req->handler = zfcp_fsf_close_port_handler;
1849 req->data = erp_action->port;
1850 req->erp_action = erp_action;
1851 req->qtcb->header.port_handle = erp_action->port->handle;
1852 erp_action->fsf_req_id = req->req_id;
1854 zfcp_fsf_start_erp_timer(req);
1855 retval = zfcp_fsf_req_send(req);
1857 zfcp_fsf_req_free(req);
1860 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */
1866 static void zfcp_fsf_open_wka_port_handler(struct zfcp_fsf_req *req)
1868 struct zfcp_fc_wka_port *wka_port = req->data;
1869 struct fsf_qtcb_header *header = &req->qtcb->header;
1871 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) {
1878 dev_warn(&req->adapter->ccw_device->dev,
1882 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1903 struct zfcp_fsf_req *req;
1911 req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_PORT_WITH_DID,
1915 if (IS_ERR(req)) {
1916 retval = PTR_ERR(req);
1920 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1921 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1923 req->handler = zfcp_fsf_open_wka_port_handler;
1924 hton24(req->qtcb->bottom.support.d_id, wka_port->d_id);
1925 req->data = wka_port;
1927 req_id = req->req_id;
1929 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
1930 retval = zfcp_fsf_req_send(req);
1932 zfcp_fsf_req_free(req);
1933 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */
1941 static void zfcp_fsf_close_wka_port_handler(struct zfcp_fsf_req *req)
1943 struct zfcp_fc_wka_port *wka_port = req->data;
1945 if (req->qtcb->header.fsf_status == FSF_PORT_HANDLE_NOT_VALID) {
1946 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1962 struct zfcp_fsf_req *req;
1970 req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PORT,
1974 if (IS_ERR(req)) {
1975 retval = PTR_ERR(req);
1979 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1980 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
1982 req->handler = zfcp_fsf_close_wka_port_handler;
1983 req->data = wka_port;
1984 req->qtcb->header.port_handle = wka_port->handle;
1986 req_id = req->req_id;
1988 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
1989 retval = zfcp_fsf_req_send(req);
1991 zfcp_fsf_req_free(req);
1992 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */
2000 static void zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *req)
2002 struct zfcp_port *port = req->data;
2003 struct fsf_qtcb_header *header = &req->qtcb->header;
2006 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
2012 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2025 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2031 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2056 struct zfcp_fsf_req *req;
2063 req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PHYSICAL_PORT,
2067 if (IS_ERR(req)) {
2068 retval = PTR_ERR(req);
2072 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
2073 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
2075 req->data = erp_action->port;
2076 req->qtcb->header.port_handle = erp_action->port->handle;
2077 req->erp_action = erp_action;
2078 req->handler = zfcp_fsf_close_physical_port_handler;
2079 erp_action->fsf_req_id = req->req_id;
2081 zfcp_fsf_start_erp_timer(req);
2082 retval = zfcp_fsf_req_send(req);
2084 zfcp_fsf_req_free(req);
2087 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */
2093 static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req *req)
2095 struct zfcp_adapter *adapter = req->adapter;
2096 struct scsi_device *sdev = req->data;
2098 struct fsf_qtcb_header *header = &req->qtcb->header;
2101 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
2122 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2136 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2147 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2155 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2176 struct zfcp_fsf_req *req;
2183 req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_LUN,
2187 if (IS_ERR(req)) {
2188 retval = PTR_ERR(req);
2192 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
2193 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
2195 req->qtcb->header.port_handle = erp_action->port->handle;
2196 req->qtcb->bottom.support.fcp_lun = zfcp_scsi_dev_lun(erp_action->sdev);
2197 req->handler = zfcp_fsf_open_lun_handler;
2198 req->data = erp_action->sdev;
2199 req->erp_action = erp_action;
2200 erp_action->fsf_req_id = req->req_id;
2203 req->qtcb->bottom.support.option = FSF_OPEN_LUN_SUPPRESS_BOXING;
2205 zfcp_fsf_start_erp_timer(req);
2206 retval = zfcp_fsf_req_send(req);
2208 zfcp_fsf_req_free(req);
2211 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */
2217 static void zfcp_fsf_close_lun_handler(struct zfcp_fsf_req *req)
2219 struct scsi_device *sdev = req->data;
2222 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
2227 switch (req->qtcb->header.fsf_status) {
2230 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2234 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2241 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2244 switch (req->qtcb->header.fsf_status_qual.word[0]) {
2249 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2268 struct zfcp_fsf_req *req;
2275 req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_LUN,
2279 if (IS_ERR(req)) {
2280 retval = PTR_ERR(req);
2284 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
2285 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
2287 req->qtcb->header.port_handle = erp_action->port->handle;
2288 req->qtcb->header.lun_handle = zfcp_sdev->lun_handle;
2289 req->handler = zfcp_fsf_close_lun_handler;
2290 req->data = erp_action->sdev;
2291 req->erp_action = erp_action;
2292 erp_action->fsf_req_id = req->req_id;
2294 zfcp_fsf_start_erp_timer(req);
2295 retval = zfcp_fsf_req_send(req);
2297 zfcp_fsf_req_free(req);
2300 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */
2313 static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi)
2319 int ticks = req->adapter->timer_ticks;
2321 lat_in = &req->qtcb->prefix.prot_status_qual.latency_info;
2325 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
2328 blktrc.outb_usage = req->qdio_req.qdio_outb_usage;
2330 if (req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA &&
2331 !(req->status & ZFCP_STATUS_FSFREQ_ERROR)) {
2337 switch (req->qtcb->bottom.io.data_direction) {
2367 * @req: Pointer to FSF request.
2370 static void zfcp_fsf_fcp_handler_common(struct zfcp_fsf_req *req,
2374 struct fsf_qtcb_header *header = &req->qtcb->header;
2376 if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ERROR))
2384 zfcp_erp_adapter_reopen(req->adapter, 0, "fssfch1");
2385 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2390 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2393 zfcp_fsf_class_not_supp(req);
2396 dev_err(&req->adapter->ccw_device->dev,
2399 req->qtcb->bottom.io.data_direction,
2402 zfcp_erp_adapter_shutdown(req->adapter, 0, "fssfch3");
2403 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2406 dev_err(&req->adapter->ccw_device->dev,
2408 req->qtcb->bottom.io.fcp_cmnd_length);
2409 zfcp_erp_adapter_shutdown(req->adapter, 0, "fssfch4");
2410 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2417 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2423 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2429 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2432 zfcp_fsf_log_security_error(&req->adapter->ccw_device->dev,
2436 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2441 static void zfcp_fsf_fcp_cmnd_handler(struct zfcp_fsf_req *req)
2447 read_lock_irqsave(&req->adapter->abort_lock, flags);
2449 scpnt = req->data;
2451 read_unlock_irqrestore(&req->adapter->abort_lock, flags);
2455 zfcp_fsf_fcp_handler_common(req, scpnt->device);
2457 if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ERROR)) {
2462 switch (req->qtcb->header.fsf_status) {
2478 fcp_rsp = &req->qtcb->bottom.io.fcp_rsp.iu;
2482 zfcp_fsf_req_trace(req, scpnt);
2483 zfcp_dbf_scsi_result(scpnt, req);
2493 read_unlock_irqrestore(&req->adapter->abort_lock, flags);
2540 struct zfcp_fsf_req *req;
2564 req = zfcp_fsf_req_create(qdio, FSF_QTCB_FCP_CMND,
2567 if (IS_ERR(req)) {
2568 retval = PTR_ERR(req);
2572 scsi_cmnd->host_scribble = (unsigned char *) req->req_id;
2574 io = &req->qtcb->bottom.io;
2575 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
2576 req->data = scsi_cmnd;
2577 req->handler = zfcp_fsf_fcp_cmnd_handler;
2578 req->qtcb->header.lun_handle = zfcp_sdev->lun_handle;
2579 req->qtcb->header.port_handle = zfcp_sdev->port->handle;
2592 fcp_cmnd = &req->qtcb->bottom.io.fcp_cmnd.iu;
2597 zfcp_qdio_set_data_div(qdio, &req->qdio_req,
2599 retval = zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req,
2607 retval = zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req,
2612 zfcp_qdio_set_sbale_last(adapter->qdio, &req->qdio_req);
2614 zfcp_qdio_set_scount(qdio, &req->qdio_req);
2616 retval = zfcp_fsf_req_send(req);
2619 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */
2624 zfcp_fsf_req_free(req);
2631 static void zfcp_fsf_fcp_task_mgmt_handler(struct zfcp_fsf_req *req)
2633 struct scsi_device *sdev = req->data;
2637 zfcp_fsf_fcp_handler_common(req, sdev);
2639 fcp_rsp = &req->qtcb->bottom.io.fcp_rsp.iu;
2643 (req->status & ZFCP_STATUS_FSFREQ_ERROR))
2644 req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED;
2657 struct zfcp_fsf_req *req = NULL;
2670 req = zfcp_fsf_req_create(qdio, FSF_QTCB_FCP_CMND,
2674 if (IS_ERR(req)) {
2675 req = NULL;
2679 req->data = sdev;
2681 req->handler = zfcp_fsf_fcp_task_mgmt_handler;
2682 req->qtcb->header.lun_handle = zfcp_sdev->lun_handle;
2683 req->qtcb->header.port_handle = zfcp_sdev->port->handle;
2684 req->qtcb->bottom.io.data_direction = FSF_DATADIR_CMND;
2685 req->qtcb->bottom.io.service_class = FSF_CLASS_3;
2686 req->qtcb->bottom.io.fcp_cmnd_length = FCP_CMND_LEN;
2688 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
2690 fcp_cmnd = &req->qtcb->bottom.io.fcp_cmnd.iu;
2693 zfcp_fsf_start_timer(req, ZFCP_FSF_SCSI_ER_TIMEOUT);
2694 if (!zfcp_fsf_req_send(req)) {
2695 /* NOTE: DO NOT TOUCH req, UNTIL IT COMPLETES! */
2699 zfcp_fsf_req_free(req);
2700 req = NULL;
2703 return req;