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