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()
258 static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req) in zfcp_fsf_status_read_handler() argument
260 struct zfcp_adapter *adapter = req->adapter; in zfcp_fsf_status_read_handler()
261 struct fsf_status_read_buffer *sr_buf = req->data; in zfcp_fsf_status_read_handler()
263 if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED) { in zfcp_fsf_status_read_handler()
264 zfcp_dbf_hba_fsf_uss("fssrh_1", req); in zfcp_fsf_status_read_handler()
266 zfcp_fsf_req_free(req); in zfcp_fsf_status_read_handler()
270 zfcp_dbf_hba_fsf_uss("fssrh_4", req); in zfcp_fsf_status_read_handler()
274 zfcp_fsf_status_read_port_closed(req); in zfcp_fsf_status_read_handler()
277 zfcp_fc_incoming_els(req); in zfcp_fsf_status_read_handler()
282 zfcp_dbf_hba_bit_err("fssrh_3", req); in zfcp_fsf_status_read_handler()
293 zfcp_fsf_status_read_link_down(req); in zfcp_fsf_status_read_handler()
325 zfcp_fsf_req_free(req); in zfcp_fsf_status_read_handler()
331 static void zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *req) in zfcp_fsf_fsfstatus_qual_eval() argument
333 switch (req->qtcb->header.fsf_status_qual.word[0]) { in zfcp_fsf_fsfstatus_qual_eval()
342 dev_err(&req->adapter->ccw_device->dev, in zfcp_fsf_fsfstatus_qual_eval()
345 zfcp_qdio_siosl(req->adapter); in zfcp_fsf_fsfstatus_qual_eval()
346 zfcp_erp_adapter_shutdown(req->adapter, 0, "fsfsqe1"); in zfcp_fsf_fsfstatus_qual_eval()
350 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_fsfstatus_qual_eval()
353 static void zfcp_fsf_fsfstatus_eval(struct zfcp_fsf_req *req) in zfcp_fsf_fsfstatus_eval() argument
355 if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ERROR)) in zfcp_fsf_fsfstatus_eval()
358 switch (req->qtcb->header.fsf_status) { in zfcp_fsf_fsfstatus_eval()
360 dev_err(&req->adapter->ccw_device->dev, in zfcp_fsf_fsfstatus_eval()
362 req->qtcb->header.fsf_command); in zfcp_fsf_fsfstatus_eval()
363 zfcp_erp_adapter_shutdown(req->adapter, 0, "fsfse_1"); in zfcp_fsf_fsfstatus_eval()
364 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_fsfstatus_eval()
367 zfcp_fsf_fsfstatus_qual_eval(req); in zfcp_fsf_fsfstatus_eval()
372 static void zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *req) in zfcp_fsf_protstatus_eval() argument
374 struct zfcp_adapter *adapter = req->adapter; in zfcp_fsf_protstatus_eval()
375 struct fsf_qtcb *qtcb = req->qtcb; in zfcp_fsf_protstatus_eval()
378 zfcp_dbf_hba_fsf_response(req); in zfcp_fsf_protstatus_eval()
380 if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED) { in zfcp_fsf_protstatus_eval()
381 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_protstatus_eval()
399 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_protstatus_eval()
417 zfcp_fsf_link_down_info_eval(req, &psq->link_down_info); in zfcp_fsf_protstatus_eval()
437 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_protstatus_eval()
442 * @req: The FSF request that has been completed.
452 static void zfcp_fsf_req_complete(struct zfcp_fsf_req *req) in zfcp_fsf_req_complete() argument
456 if (unlikely(zfcp_fsf_req_is_status_read_buffer(req))) { in zfcp_fsf_req_complete()
457 zfcp_fsf_status_read_handler(req); in zfcp_fsf_req_complete()
461 del_timer_sync(&req->timer); in zfcp_fsf_req_complete()
462 zfcp_fsf_protstatus_eval(req); in zfcp_fsf_req_complete()
463 zfcp_fsf_fsfstatus_eval(req); in zfcp_fsf_req_complete()
464 req->handler(req); in zfcp_fsf_req_complete()
466 erp_action = req->erp_action; in zfcp_fsf_req_complete()
470 if (likely(req->status & ZFCP_STATUS_FSFREQ_CLEANUP)) in zfcp_fsf_req_complete()
471 zfcp_fsf_req_free(req); in zfcp_fsf_req_complete()
473 complete(&req->completion); in zfcp_fsf_req_complete()
487 struct zfcp_fsf_req *req, *tmp; in zfcp_fsf_req_dismiss_all() local
493 list_for_each_entry_safe(req, tmp, &remove_queue, list) { in zfcp_fsf_req_dismiss_all()
494 list_del(&req->list); in zfcp_fsf_req_dismiss_all()
495 req->status |= ZFCP_STATUS_FSFREQ_DISMISSED; in zfcp_fsf_req_dismiss_all()
496 zfcp_fsf_req_complete(req); in zfcp_fsf_req_dismiss_all()
537 static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req) in zfcp_fsf_exchange_config_evaluate() argument
539 struct fsf_qtcb_bottom_config *bottom = &req->qtcb->bottom.config; in zfcp_fsf_exchange_config_evaluate()
540 struct zfcp_adapter *adapter = req->adapter; in zfcp_fsf_exchange_config_evaluate()
547 if (req->data) in zfcp_fsf_exchange_config_evaluate()
548 memcpy(req->data, bottom, sizeof(*bottom)); in zfcp_fsf_exchange_config_evaluate()
556 if (req->qtcb->header.fsf_status == FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE) in zfcp_fsf_exchange_config_evaluate()
581 static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req) in zfcp_fsf_exchange_config_data_handler() argument
583 struct zfcp_adapter *adapter = req->adapter; in zfcp_fsf_exchange_config_data_handler()
586 struct fsf_qtcb *qtcb = req->qtcb; in zfcp_fsf_exchange_config_data_handler()
589 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_exchange_config_data_handler()
608 if (zfcp_fsf_exchange_config_evaluate(req)) in zfcp_fsf_exchange_config_data_handler()
624 req->status |= ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE; in zfcp_fsf_exchange_config_data_handler()
630 zfcp_fsf_link_down_info_eval(req, in zfcp_fsf_exchange_config_data_handler()
634 if (zfcp_fsf_exchange_config_evaluate(req)) in zfcp_fsf_exchange_config_data_handler()
738 struct zfcp_fsf_req *req) in zfcp_fsf_dbf_adapter_fc_security() argument
746 zfcp_dbf_hba_fsf_fces("fsfcesa", req, ZFCP_DBF_INVALID_WWPN, in zfcp_fsf_dbf_adapter_fc_security()
753 static void zfcp_fsf_exchange_port_evaluate(struct zfcp_fsf_req *req) in zfcp_fsf_exchange_port_evaluate() argument
755 struct zfcp_adapter *adapter = req->adapter; in zfcp_fsf_exchange_port_evaluate()
756 struct fsf_qtcb_bottom_port *bottom = &req->qtcb->bottom.port; in zfcp_fsf_exchange_port_evaluate()
758 if (req->data) in zfcp_fsf_exchange_port_evaluate()
759 memcpy(req->data, bottom, sizeof(*bottom)); in zfcp_fsf_exchange_port_evaluate()
766 zfcp_fsf_dbf_adapter_fc_security(adapter, req); in zfcp_fsf_exchange_port_evaluate()
769 static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req) in zfcp_fsf_exchange_port_data_handler() argument
772 &req->adapter->diagnostics->port_data.header; in zfcp_fsf_exchange_port_data_handler()
773 struct fsf_qtcb *qtcb = req->qtcb; in zfcp_fsf_exchange_port_data_handler()
776 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_exchange_port_data_handler()
787 zfcp_scsi_shost_update_port_data(req->adapter, bottom); in zfcp_fsf_exchange_port_data_handler()
788 zfcp_fsf_exchange_port_evaluate(req); in zfcp_fsf_exchange_port_data_handler()
792 req->status |= ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE; in zfcp_fsf_exchange_port_data_handler()
794 zfcp_fsf_link_down_info_eval(req, in zfcp_fsf_exchange_port_data_handler()
797 zfcp_scsi_shost_update_port_data(req->adapter, bottom); in zfcp_fsf_exchange_port_data_handler()
798 zfcp_fsf_exchange_port_evaluate(req); in zfcp_fsf_exchange_port_data_handler()
805 struct zfcp_fsf_req *req; in zfcp_fsf_alloc() local
808 req = mempool_alloc(pool, GFP_ATOMIC); in zfcp_fsf_alloc()
810 req = kmalloc(sizeof(*req), GFP_ATOMIC); in zfcp_fsf_alloc()
812 if (unlikely(!req)) in zfcp_fsf_alloc()
815 memset(req, 0, sizeof(*req)); in zfcp_fsf_alloc()
816 req->pool = pool; in zfcp_fsf_alloc()
817 return req; in zfcp_fsf_alloc()
841 struct zfcp_fsf_req *req = zfcp_fsf_alloc(pool); in zfcp_fsf_req_create() local
843 if (unlikely(!req)) in zfcp_fsf_req_create()
849 timer_setup(&req->timer, NULL, 0); in zfcp_fsf_req_create()
850 init_completion(&req->completion); in zfcp_fsf_req_create()
852 req->adapter = adapter; in zfcp_fsf_req_create()
853 req->req_id = adapter->req_no; in zfcp_fsf_req_create()
857 req->qtcb = zfcp_fsf_qtcb_alloc( in zfcp_fsf_req_create()
860 req->qtcb = zfcp_fsf_qtcb_alloc(NULL); in zfcp_fsf_req_create()
862 if (unlikely(!req->qtcb)) { in zfcp_fsf_req_create()
863 zfcp_fsf_req_free(req); in zfcp_fsf_req_create()
867 req->qtcb->prefix.req_seq_no = adapter->fsf_req_seq_no; in zfcp_fsf_req_create()
868 req->qtcb->prefix.req_id = req->req_id; in zfcp_fsf_req_create()
869 req->qtcb->prefix.ulp_info = 26; in zfcp_fsf_req_create()
870 req->qtcb->prefix.qtcb_type = fsf_qtcb_type[fsf_cmd]; in zfcp_fsf_req_create()
871 req->qtcb->prefix.qtcb_version = FSF_QTCB_CURRENT_VERSION; in zfcp_fsf_req_create()
872 req->qtcb->header.req_handle = req->req_id; in zfcp_fsf_req_create()
873 req->qtcb->header.fsf_command = fsf_cmd; in zfcp_fsf_req_create()
876 zfcp_qdio_req_init(adapter->qdio, &req->qdio_req, req->req_id, sbtype, in zfcp_fsf_req_create()
877 req->qtcb, sizeof(struct fsf_qtcb)); in zfcp_fsf_req_create()
879 return req; in zfcp_fsf_req_create()
882 static int zfcp_fsf_req_send(struct zfcp_fsf_req *req) in zfcp_fsf_req_send() argument
884 const bool is_srb = zfcp_fsf_req_is_status_read_buffer(req); in zfcp_fsf_req_send()
885 struct zfcp_adapter *adapter = req->adapter; in zfcp_fsf_req_send()
887 u64 req_id = req->req_id; in zfcp_fsf_req_send()
889 zfcp_reqlist_add(adapter->req_list, req); in zfcp_fsf_req_send()
891 req->qdio_req.qdio_outb_usage = atomic_read(&qdio->req_q_free); in zfcp_fsf_req_send()
892 req->issued = get_tod_clock(); in zfcp_fsf_req_send()
893 if (zfcp_qdio_send(qdio, &req->qdio_req)) { in zfcp_fsf_req_send()
894 del_timer_sync(&req->timer); in zfcp_fsf_req_send()
905 * NOTE: DO NOT TOUCH ASYNC req PAST THIS POINT. in zfcp_fsf_req_send()
906 * ONLY TOUCH SYNC req AGAIN ON req->completion. in zfcp_fsf_req_send()
912 * when it is completed via req->completion, is it safe to use req in zfcp_fsf_req_send()
932 struct zfcp_fsf_req *req; in zfcp_fsf_status_read() local
941 req = zfcp_fsf_req_create(qdio, FSF_QTCB_UNSOLICITED_STATUS, in zfcp_fsf_status_read()
944 if (IS_ERR(req)) { in zfcp_fsf_status_read()
945 retval = PTR_ERR(req); in zfcp_fsf_status_read()
956 req->data = sr_buf; in zfcp_fsf_status_read()
958 zfcp_qdio_fill_next(qdio, &req->qdio_req, sr_buf, sizeof(*sr_buf)); in zfcp_fsf_status_read()
959 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_status_read()
961 retval = zfcp_fsf_req_send(req); in zfcp_fsf_status_read()
964 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */ in zfcp_fsf_status_read()
969 req->data = NULL; in zfcp_fsf_status_read()
972 zfcp_dbf_hba_fsf_uss("fssr__1", req); in zfcp_fsf_status_read()
973 zfcp_fsf_req_free(req); in zfcp_fsf_status_read()
979 static void zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *req) in zfcp_fsf_abort_fcp_command_handler() argument
981 struct scsi_device *sdev = req->data; in zfcp_fsf_abort_fcp_command_handler()
983 union fsf_status_qual *fsq = &req->qtcb->header.fsf_status_qual; in zfcp_fsf_abort_fcp_command_handler()
985 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_abort_fcp_command_handler()
990 switch (req->qtcb->header.fsf_status) { in zfcp_fsf_abort_fcp_command_handler()
995 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_abort_fcp_command_handler()
1001 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_abort_fcp_command_handler()
1005 req->status |= ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED; in zfcp_fsf_abort_fcp_command_handler()
1012 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_abort_fcp_command_handler()
1018 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_abort_fcp_command_handler()
1026 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_abort_fcp_command_handler()
1031 req->status |= ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED; in zfcp_fsf_abort_fcp_command_handler()
1044 struct zfcp_fsf_req *req = NULL; in zfcp_fsf_abort_fcp_cmnd() local
1053 req = zfcp_fsf_req_create(qdio, FSF_QTCB_ABORT_FCP_CMND, in zfcp_fsf_abort_fcp_cmnd()
1056 if (IS_ERR(req)) { in zfcp_fsf_abort_fcp_cmnd()
1057 req = NULL; in zfcp_fsf_abort_fcp_cmnd()
1065 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_abort_fcp_cmnd()
1067 req->data = sdev; in zfcp_fsf_abort_fcp_cmnd()
1068 req->handler = zfcp_fsf_abort_fcp_command_handler; in zfcp_fsf_abort_fcp_cmnd()
1069 req->qtcb->header.lun_handle = zfcp_sdev->lun_handle; in zfcp_fsf_abort_fcp_cmnd()
1070 req->qtcb->header.port_handle = zfcp_sdev->port->handle; in zfcp_fsf_abort_fcp_cmnd()
1071 req->qtcb->bottom.support.req_handle = old_req_id; in zfcp_fsf_abort_fcp_cmnd()
1073 zfcp_fsf_start_timer(req, ZFCP_FSF_SCSI_ER_TIMEOUT); in zfcp_fsf_abort_fcp_cmnd()
1074 if (!zfcp_fsf_req_send(req)) { in zfcp_fsf_abort_fcp_cmnd()
1075 /* NOTE: DO NOT TOUCH req, UNTIL IT COMPLETES! */ in zfcp_fsf_abort_fcp_cmnd()
1080 zfcp_fsf_req_free(req); in zfcp_fsf_abort_fcp_cmnd()
1081 req = NULL; in zfcp_fsf_abort_fcp_cmnd()
1084 return req; in zfcp_fsf_abort_fcp_cmnd()
1087 static void zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *req) in zfcp_fsf_send_ct_handler() argument
1089 struct zfcp_adapter *adapter = req->adapter; in zfcp_fsf_send_ct_handler()
1090 struct zfcp_fsf_ct_els *ct = req->data; in zfcp_fsf_send_ct_handler()
1091 struct fsf_qtcb_header *header = &req->qtcb->header; in zfcp_fsf_send_ct_handler()
1095 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_send_ct_handler()
1101 zfcp_dbf_san_res("fsscth2", req); in zfcp_fsf_send_ct_handler()
1104 zfcp_fsf_class_not_supp(req); in zfcp_fsf_send_ct_handler()
1110 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_send_ct_handler()
1115 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_send_ct_handler()
1125 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_send_ct_handler()
1144 static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req, in zfcp_fsf_setup_ct_els_sbals() argument
1148 struct zfcp_adapter *adapter = req->adapter; in zfcp_fsf_setup_ct_els_sbals()
1150 struct fsf_qtcb *qtcb = req->qtcb; in zfcp_fsf_setup_ct_els_sbals()
1154 if (zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req, sg_req)) in zfcp_fsf_setup_ct_els_sbals()
1158 if (zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req, sg_resp)) in zfcp_fsf_setup_ct_els_sbals()
1163 zfcp_qdio_set_data_div(qdio, &req->qdio_req, sg_nents(sg_req)); in zfcp_fsf_setup_ct_els_sbals()
1164 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_setup_ct_els_sbals()
1165 zfcp_qdio_set_scount(qdio, &req->qdio_req); in zfcp_fsf_setup_ct_els_sbals()
1171 zfcp_fsf_setup_ct_els_unchained(qdio, &req->qdio_req, in zfcp_fsf_setup_ct_els_sbals()
1179 if (zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req, sg_req)) in zfcp_fsf_setup_ct_els_sbals()
1184 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_setup_ct_els_sbals()
1185 zfcp_qdio_skip_to_last_sbale(qdio, &req->qdio_req); in zfcp_fsf_setup_ct_els_sbals()
1187 if (zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req, sg_resp)) in zfcp_fsf_setup_ct_els_sbals()
1192 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_setup_ct_els_sbals()
1197 static int zfcp_fsf_setup_ct_els(struct zfcp_fsf_req *req, in zfcp_fsf_setup_ct_els() argument
1204 ret = zfcp_fsf_setup_ct_els_sbals(req, sg_req, sg_resp); in zfcp_fsf_setup_ct_els()
1211 req->qtcb->bottom.support.service_class = FSF_CLASS_3; in zfcp_fsf_setup_ct_els()
1212 req->qtcb->bottom.support.timeout = timeout; in zfcp_fsf_setup_ct_els()
1213 zfcp_fsf_start_timer(req, (timeout + 10) * HZ); in zfcp_fsf_setup_ct_els()
1230 struct zfcp_fsf_req *req; in zfcp_fsf_send_ct() local
1237 req = zfcp_fsf_req_create(qdio, FSF_QTCB_SEND_GENERIC, in zfcp_fsf_send_ct()
1240 if (IS_ERR(req)) { in zfcp_fsf_send_ct()
1241 ret = PTR_ERR(req); in zfcp_fsf_send_ct()
1245 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; in zfcp_fsf_send_ct()
1246 ret = zfcp_fsf_setup_ct_els(req, ct->req, ct->resp, timeout); in zfcp_fsf_send_ct()
1250 req->handler = zfcp_fsf_send_ct_handler; in zfcp_fsf_send_ct()
1251 req->qtcb->header.port_handle = wka_port->handle; in zfcp_fsf_send_ct()
1253 req->data = ct; in zfcp_fsf_send_ct()
1255 zfcp_dbf_san_req("fssct_1", req, wka_port->d_id); in zfcp_fsf_send_ct()
1257 ret = zfcp_fsf_req_send(req); in zfcp_fsf_send_ct()
1260 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */ in zfcp_fsf_send_ct()
1265 zfcp_fsf_req_free(req); in zfcp_fsf_send_ct()
1271 static void zfcp_fsf_send_els_handler(struct zfcp_fsf_req *req) in zfcp_fsf_send_els_handler() argument
1273 struct zfcp_fsf_ct_els *send_els = req->data; in zfcp_fsf_send_els_handler()
1274 struct fsf_qtcb_header *header = &req->qtcb->header; in zfcp_fsf_send_els_handler()
1278 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_send_els_handler()
1284 zfcp_dbf_san_res("fsselh1", req); in zfcp_fsf_send_els_handler()
1287 zfcp_fsf_class_not_supp(req); in zfcp_fsf_send_els_handler()
1294 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_send_els_handler()
1307 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_send_els_handler()
1325 struct zfcp_fsf_req *req; in zfcp_fsf_send_els() local
1333 req = zfcp_fsf_req_create(qdio, FSF_QTCB_SEND_ELS, in zfcp_fsf_send_els()
1336 if (IS_ERR(req)) { in zfcp_fsf_send_els()
1337 ret = PTR_ERR(req); in zfcp_fsf_send_els()
1341 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; in zfcp_fsf_send_els()
1344 zfcp_qdio_sbal_limit(qdio, &req->qdio_req, 2); in zfcp_fsf_send_els()
1346 ret = zfcp_fsf_setup_ct_els(req, els->req, els->resp, timeout); in zfcp_fsf_send_els()
1351 hton24(req->qtcb->bottom.support.d_id, d_id); in zfcp_fsf_send_els()
1352 req->handler = zfcp_fsf_send_els_handler; in zfcp_fsf_send_els()
1354 req->data = els; in zfcp_fsf_send_els()
1356 zfcp_dbf_san_req("fssels1", req, d_id); in zfcp_fsf_send_els()
1358 ret = zfcp_fsf_req_send(req); in zfcp_fsf_send_els()
1361 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */ in zfcp_fsf_send_els()
1366 zfcp_fsf_req_free(req); in zfcp_fsf_send_els()
1374 struct zfcp_fsf_req *req; in zfcp_fsf_exchange_config_data() local
1382 req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_CONFIG_DATA, in zfcp_fsf_exchange_config_data()
1386 if (IS_ERR(req)) { in zfcp_fsf_exchange_config_data()
1387 retval = PTR_ERR(req); in zfcp_fsf_exchange_config_data()
1391 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; in zfcp_fsf_exchange_config_data()
1392 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_exchange_config_data()
1394 req->qtcb->bottom.config.feature_selection = in zfcp_fsf_exchange_config_data()
1399 req->erp_action = erp_action; in zfcp_fsf_exchange_config_data()
1400 req->handler = zfcp_fsf_exchange_config_data_handler; in zfcp_fsf_exchange_config_data()
1401 erp_action->fsf_req_id = req->req_id; in zfcp_fsf_exchange_config_data()
1403 zfcp_fsf_start_erp_timer(req); in zfcp_fsf_exchange_config_data()
1404 retval = zfcp_fsf_req_send(req); in zfcp_fsf_exchange_config_data()
1406 zfcp_fsf_req_free(req); in zfcp_fsf_exchange_config_data()
1409 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */ in zfcp_fsf_exchange_config_data()
1431 struct zfcp_fsf_req *req = NULL; in zfcp_fsf_exchange_config_data_sync() local
1438 req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_CONFIG_DATA, in zfcp_fsf_exchange_config_data_sync()
1441 if (IS_ERR(req)) { in zfcp_fsf_exchange_config_data_sync()
1442 retval = PTR_ERR(req); in zfcp_fsf_exchange_config_data_sync()
1446 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_exchange_config_data_sync()
1447 req->handler = zfcp_fsf_exchange_config_data_handler; in zfcp_fsf_exchange_config_data_sync()
1449 req->qtcb->bottom.config.feature_selection = in zfcp_fsf_exchange_config_data_sync()
1456 req->data = data; in zfcp_fsf_exchange_config_data_sync()
1458 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); in zfcp_fsf_exchange_config_data_sync()
1459 retval = zfcp_fsf_req_send(req); in zfcp_fsf_exchange_config_data_sync()
1463 /* NOTE: ONLY TOUCH SYNC req AGAIN ON req->completion. */ in zfcp_fsf_exchange_config_data_sync()
1464 wait_for_completion(&req->completion); in zfcp_fsf_exchange_config_data_sync()
1466 if (req->status & in zfcp_fsf_exchange_config_data_sync()
1469 else if (req->status & ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE) in zfcp_fsf_exchange_config_data_sync()
1473 zfcp_fsf_req_free(req); in zfcp_fsf_exchange_config_data_sync()
1489 struct zfcp_fsf_req *req; in zfcp_fsf_exchange_port_data() local
1499 req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_PORT_DATA, in zfcp_fsf_exchange_port_data()
1503 if (IS_ERR(req)) { in zfcp_fsf_exchange_port_data()
1504 retval = PTR_ERR(req); in zfcp_fsf_exchange_port_data()
1508 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; in zfcp_fsf_exchange_port_data()
1509 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_exchange_port_data()
1511 req->handler = zfcp_fsf_exchange_port_data_handler; in zfcp_fsf_exchange_port_data()
1512 req->erp_action = erp_action; in zfcp_fsf_exchange_port_data()
1513 erp_action->fsf_req_id = req->req_id; in zfcp_fsf_exchange_port_data()
1515 zfcp_fsf_start_erp_timer(req); in zfcp_fsf_exchange_port_data()
1516 retval = zfcp_fsf_req_send(req); in zfcp_fsf_exchange_port_data()
1518 zfcp_fsf_req_free(req); in zfcp_fsf_exchange_port_data()
1521 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */ in zfcp_fsf_exchange_port_data()
1543 struct zfcp_fsf_req *req = NULL; in zfcp_fsf_exchange_port_data_sync() local
1553 req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_PORT_DATA, in zfcp_fsf_exchange_port_data_sync()
1556 if (IS_ERR(req)) { in zfcp_fsf_exchange_port_data_sync()
1557 retval = PTR_ERR(req); in zfcp_fsf_exchange_port_data_sync()
1562 req->data = data; in zfcp_fsf_exchange_port_data_sync()
1564 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_exchange_port_data_sync()
1566 req->handler = zfcp_fsf_exchange_port_data_handler; in zfcp_fsf_exchange_port_data_sync()
1567 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); in zfcp_fsf_exchange_port_data_sync()
1568 retval = zfcp_fsf_req_send(req); in zfcp_fsf_exchange_port_data_sync()
1572 /* NOTE: ONLY TOUCH SYNC req AGAIN ON req->completion. */ in zfcp_fsf_exchange_port_data_sync()
1573 wait_for_completion(&req->completion); in zfcp_fsf_exchange_port_data_sync()
1575 if (req->status & in zfcp_fsf_exchange_port_data_sync()
1578 else if (req->status & ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE) in zfcp_fsf_exchange_port_data_sync()
1582 zfcp_fsf_req_free(req); in zfcp_fsf_exchange_port_data_sync()
1591 struct zfcp_fsf_req *req) in zfcp_fsf_log_port_fc_security() argument
1601 zfcp_dbf_hba_fsf_fces("fsfcesp", req, port->wwpn, in zfcp_fsf_log_port_fc_security()
1695 static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req) in zfcp_fsf_open_port_handler() argument
1697 struct zfcp_adapter *adapter = req->adapter; in zfcp_fsf_open_port_handler()
1698 struct zfcp_port *port = req->data; in zfcp_fsf_open_port_handler()
1699 struct fsf_qtcb_header *header = &req->qtcb->header; in zfcp_fsf_open_port_handler()
1700 struct fsf_qtcb_bottom_support *bottom = &req->qtcb->bottom.support; in zfcp_fsf_open_port_handler()
1703 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_open_port_handler()
1716 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_port_handler()
1719 zfcp_fsf_log_security_error(&req->adapter->ccw_device->dev, in zfcp_fsf_open_port_handler()
1722 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_port_handler()
1731 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_port_handler()
1741 zfcp_fsf_log_port_fc_security(port, req); in zfcp_fsf_open_port_handler()
1766 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_port_handler()
1783 struct zfcp_fsf_req *req; in zfcp_fsf_open_port() local
1790 req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_PORT_WITH_DID, in zfcp_fsf_open_port()
1794 if (IS_ERR(req)) { in zfcp_fsf_open_port()
1795 retval = PTR_ERR(req); in zfcp_fsf_open_port()
1799 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; in zfcp_fsf_open_port()
1800 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_open_port()
1802 req->handler = zfcp_fsf_open_port_handler; in zfcp_fsf_open_port()
1803 hton24(req->qtcb->bottom.support.d_id, port->d_id); in zfcp_fsf_open_port()
1804 req->data = port; in zfcp_fsf_open_port()
1805 req->erp_action = erp_action; in zfcp_fsf_open_port()
1806 erp_action->fsf_req_id = req->req_id; in zfcp_fsf_open_port()
1809 zfcp_fsf_start_erp_timer(req); in zfcp_fsf_open_port()
1810 retval = zfcp_fsf_req_send(req); in zfcp_fsf_open_port()
1812 zfcp_fsf_req_free(req); in zfcp_fsf_open_port()
1816 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */ in zfcp_fsf_open_port()
1822 static void zfcp_fsf_close_port_handler(struct zfcp_fsf_req *req) in zfcp_fsf_close_port_handler() argument
1824 struct zfcp_port *port = req->data; in zfcp_fsf_close_port_handler()
1826 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_close_port_handler()
1829 switch (req->qtcb->header.fsf_status) { in zfcp_fsf_close_port_handler()
1832 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_port_handler()
1850 struct zfcp_fsf_req *req; in zfcp_fsf_close_port() local
1857 req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PORT, in zfcp_fsf_close_port()
1861 if (IS_ERR(req)) { in zfcp_fsf_close_port()
1862 retval = PTR_ERR(req); in zfcp_fsf_close_port()
1866 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; in zfcp_fsf_close_port()
1867 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_close_port()
1869 req->handler = zfcp_fsf_close_port_handler; in zfcp_fsf_close_port()
1870 req->data = erp_action->port; in zfcp_fsf_close_port()
1871 req->erp_action = erp_action; in zfcp_fsf_close_port()
1872 req->qtcb->header.port_handle = erp_action->port->handle; in zfcp_fsf_close_port()
1873 erp_action->fsf_req_id = req->req_id; in zfcp_fsf_close_port()
1875 zfcp_fsf_start_erp_timer(req); in zfcp_fsf_close_port()
1876 retval = zfcp_fsf_req_send(req); in zfcp_fsf_close_port()
1878 zfcp_fsf_req_free(req); in zfcp_fsf_close_port()
1881 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */ in zfcp_fsf_close_port()
1887 static void zfcp_fsf_open_wka_port_handler(struct zfcp_fsf_req *req) in zfcp_fsf_open_wka_port_handler() argument
1889 struct zfcp_fc_wka_port *wka_port = req->data; in zfcp_fsf_open_wka_port_handler()
1890 struct fsf_qtcb_header *header = &req->qtcb->header; in zfcp_fsf_open_wka_port_handler()
1892 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) { in zfcp_fsf_open_wka_port_handler()
1899 dev_warn(&req->adapter->ccw_device->dev, in zfcp_fsf_open_wka_port_handler()
1903 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_wka_port_handler()
1924 struct zfcp_fsf_req *req; in zfcp_fsf_open_wka_port() local
1932 req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_PORT_WITH_DID, in zfcp_fsf_open_wka_port()
1936 if (IS_ERR(req)) { in zfcp_fsf_open_wka_port()
1937 retval = PTR_ERR(req); in zfcp_fsf_open_wka_port()
1941 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; in zfcp_fsf_open_wka_port()
1942 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_open_wka_port()
1944 req->handler = zfcp_fsf_open_wka_port_handler; in zfcp_fsf_open_wka_port()
1945 hton24(req->qtcb->bottom.support.d_id, wka_port->d_id); in zfcp_fsf_open_wka_port()
1946 req->data = wka_port; in zfcp_fsf_open_wka_port()
1948 req_id = req->req_id; in zfcp_fsf_open_wka_port()
1950 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); in zfcp_fsf_open_wka_port()
1951 retval = zfcp_fsf_req_send(req); in zfcp_fsf_open_wka_port()
1953 zfcp_fsf_req_free(req); in zfcp_fsf_open_wka_port()
1954 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */ in zfcp_fsf_open_wka_port()
1962 static void zfcp_fsf_close_wka_port_handler(struct zfcp_fsf_req *req) in zfcp_fsf_close_wka_port_handler() argument
1964 struct zfcp_fc_wka_port *wka_port = req->data; in zfcp_fsf_close_wka_port_handler()
1966 if (req->qtcb->header.fsf_status == FSF_PORT_HANDLE_NOT_VALID) { in zfcp_fsf_close_wka_port_handler()
1967 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_wka_port_handler()
1983 struct zfcp_fsf_req *req; in zfcp_fsf_close_wka_port() local
1991 req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PORT, in zfcp_fsf_close_wka_port()
1995 if (IS_ERR(req)) { in zfcp_fsf_close_wka_port()
1996 retval = PTR_ERR(req); in zfcp_fsf_close_wka_port()
2000 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; in zfcp_fsf_close_wka_port()
2001 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_close_wka_port()
2003 req->handler = zfcp_fsf_close_wka_port_handler; in zfcp_fsf_close_wka_port()
2004 req->data = wka_port; in zfcp_fsf_close_wka_port()
2005 req->qtcb->header.port_handle = wka_port->handle; in zfcp_fsf_close_wka_port()
2007 req_id = req->req_id; in zfcp_fsf_close_wka_port()
2009 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); in zfcp_fsf_close_wka_port()
2010 retval = zfcp_fsf_req_send(req); in zfcp_fsf_close_wka_port()
2012 zfcp_fsf_req_free(req); in zfcp_fsf_close_wka_port()
2013 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */ in zfcp_fsf_close_wka_port()
2021 static void zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *req) in zfcp_fsf_close_physical_port_handler() argument
2023 struct zfcp_port *port = req->data; in zfcp_fsf_close_physical_port_handler()
2024 struct fsf_qtcb_header *header = &req->qtcb->header; in zfcp_fsf_close_physical_port_handler()
2027 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_close_physical_port_handler()
2033 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_physical_port_handler()
2046 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_physical_port_handler()
2052 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_physical_port_handler()
2077 struct zfcp_fsf_req *req; in zfcp_fsf_close_physical_port() local
2084 req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PHYSICAL_PORT, in zfcp_fsf_close_physical_port()
2088 if (IS_ERR(req)) { in zfcp_fsf_close_physical_port()
2089 retval = PTR_ERR(req); in zfcp_fsf_close_physical_port()
2093 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; in zfcp_fsf_close_physical_port()
2094 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_close_physical_port()
2096 req->data = erp_action->port; in zfcp_fsf_close_physical_port()
2097 req->qtcb->header.port_handle = erp_action->port->handle; in zfcp_fsf_close_physical_port()
2098 req->erp_action = erp_action; in zfcp_fsf_close_physical_port()
2099 req->handler = zfcp_fsf_close_physical_port_handler; in zfcp_fsf_close_physical_port()
2100 erp_action->fsf_req_id = req->req_id; in zfcp_fsf_close_physical_port()
2102 zfcp_fsf_start_erp_timer(req); in zfcp_fsf_close_physical_port()
2103 retval = zfcp_fsf_req_send(req); in zfcp_fsf_close_physical_port()
2105 zfcp_fsf_req_free(req); in zfcp_fsf_close_physical_port()
2108 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */ in zfcp_fsf_close_physical_port()
2114 static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req *req) in zfcp_fsf_open_lun_handler() argument
2116 struct zfcp_adapter *adapter = req->adapter; in zfcp_fsf_open_lun_handler()
2117 struct scsi_device *sdev = req->data; in zfcp_fsf_open_lun_handler()
2119 struct fsf_qtcb_header *header = &req->qtcb->header; in zfcp_fsf_open_lun_handler()
2122 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_open_lun_handler()
2143 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_lun_handler()
2157 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_lun_handler()
2168 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_lun_handler()
2176 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_lun_handler()
2197 struct zfcp_fsf_req *req; in zfcp_fsf_open_lun() local
2204 req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_LUN, in zfcp_fsf_open_lun()
2208 if (IS_ERR(req)) { in zfcp_fsf_open_lun()
2209 retval = PTR_ERR(req); in zfcp_fsf_open_lun()
2213 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; in zfcp_fsf_open_lun()
2214 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_open_lun()
2216 req->qtcb->header.port_handle = erp_action->port->handle; in zfcp_fsf_open_lun()
2217 req->qtcb->bottom.support.fcp_lun = zfcp_scsi_dev_lun(erp_action->sdev); in zfcp_fsf_open_lun()
2218 req->handler = zfcp_fsf_open_lun_handler; in zfcp_fsf_open_lun()
2219 req->data = erp_action->sdev; in zfcp_fsf_open_lun()
2220 req->erp_action = erp_action; in zfcp_fsf_open_lun()
2221 erp_action->fsf_req_id = req->req_id; in zfcp_fsf_open_lun()
2224 req->qtcb->bottom.support.option = FSF_OPEN_LUN_SUPPRESS_BOXING; in zfcp_fsf_open_lun()
2226 zfcp_fsf_start_erp_timer(req); in zfcp_fsf_open_lun()
2227 retval = zfcp_fsf_req_send(req); in zfcp_fsf_open_lun()
2229 zfcp_fsf_req_free(req); in zfcp_fsf_open_lun()
2232 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */ in zfcp_fsf_open_lun()
2238 static void zfcp_fsf_close_lun_handler(struct zfcp_fsf_req *req) in zfcp_fsf_close_lun_handler() argument
2240 struct scsi_device *sdev = req->data; in zfcp_fsf_close_lun_handler()
2243 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_close_lun_handler()
2248 switch (req->qtcb->header.fsf_status) { in zfcp_fsf_close_lun_handler()
2251 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_lun_handler()
2255 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_lun_handler()
2262 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_lun_handler()
2265 switch (req->qtcb->header.fsf_status_qual.word[0]) { in zfcp_fsf_close_lun_handler()
2270 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_lun_handler()
2289 struct zfcp_fsf_req *req; in zfcp_fsf_close_lun() local
2296 req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_LUN, in zfcp_fsf_close_lun()
2300 if (IS_ERR(req)) { in zfcp_fsf_close_lun()
2301 retval = PTR_ERR(req); in zfcp_fsf_close_lun()
2305 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; in zfcp_fsf_close_lun()
2306 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_close_lun()
2308 req->qtcb->header.port_handle = erp_action->port->handle; in zfcp_fsf_close_lun()
2309 req->qtcb->header.lun_handle = zfcp_sdev->lun_handle; in zfcp_fsf_close_lun()
2310 req->handler = zfcp_fsf_close_lun_handler; in zfcp_fsf_close_lun()
2311 req->data = erp_action->sdev; in zfcp_fsf_close_lun()
2312 req->erp_action = erp_action; in zfcp_fsf_close_lun()
2313 erp_action->fsf_req_id = req->req_id; in zfcp_fsf_close_lun()
2315 zfcp_fsf_start_erp_timer(req); in zfcp_fsf_close_lun()
2316 retval = zfcp_fsf_req_send(req); in zfcp_fsf_close_lun()
2318 zfcp_fsf_req_free(req); in zfcp_fsf_close_lun()
2321 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */ in zfcp_fsf_close_lun()
2334 static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi) in zfcp_fsf_req_trace() argument
2340 int ticks = req->adapter->timer_ticks; in zfcp_fsf_req_trace()
2342 lat_in = &req->qtcb->prefix.prot_status_qual.latency_info; in zfcp_fsf_req_trace()
2346 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_req_trace()
2349 blktrc.outb_usage = req->qdio_req.qdio_outb_usage; in zfcp_fsf_req_trace()
2351 if (req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA && in zfcp_fsf_req_trace()
2352 !(req->status & ZFCP_STATUS_FSFREQ_ERROR)) { in zfcp_fsf_req_trace()
2358 switch (req->qtcb->bottom.io.data_direction) { in zfcp_fsf_req_trace()
2388 * @req: Pointer to FSF request.
2391 static void zfcp_fsf_fcp_handler_common(struct zfcp_fsf_req *req, in zfcp_fsf_fcp_handler_common() argument
2395 struct fsf_qtcb_header *header = &req->qtcb->header; in zfcp_fsf_fcp_handler_common()
2397 if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ERROR)) in zfcp_fsf_fcp_handler_common()
2405 zfcp_erp_adapter_reopen(req->adapter, 0, "fssfch1"); in zfcp_fsf_fcp_handler_common()
2406 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_fcp_handler_common()
2411 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_fcp_handler_common()
2414 zfcp_fsf_class_not_supp(req); in zfcp_fsf_fcp_handler_common()
2417 dev_err(&req->adapter->ccw_device->dev, in zfcp_fsf_fcp_handler_common()
2420 req->qtcb->bottom.io.data_direction, in zfcp_fsf_fcp_handler_common()
2423 zfcp_erp_adapter_shutdown(req->adapter, 0, "fssfch3"); in zfcp_fsf_fcp_handler_common()
2424 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_fcp_handler_common()
2427 dev_err(&req->adapter->ccw_device->dev, in zfcp_fsf_fcp_handler_common()
2429 req->qtcb->bottom.io.fcp_cmnd_length); in zfcp_fsf_fcp_handler_common()
2430 zfcp_erp_adapter_shutdown(req->adapter, 0, "fssfch4"); in zfcp_fsf_fcp_handler_common()
2431 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_fcp_handler_common()
2438 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_fcp_handler_common()
2444 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_fcp_handler_common()
2450 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_fcp_handler_common()
2453 zfcp_fsf_log_security_error(&req->adapter->ccw_device->dev, in zfcp_fsf_fcp_handler_common()
2457 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_fcp_handler_common()
2462 static void zfcp_fsf_fcp_cmnd_handler(struct zfcp_fsf_req *req) in zfcp_fsf_fcp_cmnd_handler() argument
2468 read_lock_irqsave(&req->adapter->abort_lock, flags); in zfcp_fsf_fcp_cmnd_handler()
2470 scpnt = req->data; in zfcp_fsf_fcp_cmnd_handler()
2472 read_unlock_irqrestore(&req->adapter->abort_lock, flags); in zfcp_fsf_fcp_cmnd_handler()
2476 zfcp_fsf_fcp_handler_common(req, scpnt->device); in zfcp_fsf_fcp_cmnd_handler()
2478 if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ERROR)) { in zfcp_fsf_fcp_cmnd_handler()
2483 switch (req->qtcb->header.fsf_status) { in zfcp_fsf_fcp_cmnd_handler()
2499 fcp_rsp = &req->qtcb->bottom.io.fcp_rsp.iu; in zfcp_fsf_fcp_cmnd_handler()
2503 zfcp_fsf_req_trace(req, scpnt); in zfcp_fsf_fcp_cmnd_handler()
2504 zfcp_dbf_scsi_result(scpnt, req); in zfcp_fsf_fcp_cmnd_handler()
2514 read_unlock_irqrestore(&req->adapter->abort_lock, flags); in zfcp_fsf_fcp_cmnd_handler()
2561 struct zfcp_fsf_req *req; in zfcp_fsf_fcp_cmnd() local
2585 req = zfcp_fsf_req_create(qdio, FSF_QTCB_FCP_CMND, in zfcp_fsf_fcp_cmnd()
2588 if (IS_ERR(req)) { in zfcp_fsf_fcp_cmnd()
2589 retval = PTR_ERR(req); in zfcp_fsf_fcp_cmnd()
2593 BUILD_BUG_ON(sizeof(scsi_cmnd->host_scribble) < sizeof(req->req_id)); in zfcp_fsf_fcp_cmnd()
2594 scsi_cmnd->host_scribble = (unsigned char *) req->req_id; in zfcp_fsf_fcp_cmnd()
2596 io = &req->qtcb->bottom.io; in zfcp_fsf_fcp_cmnd()
2597 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; in zfcp_fsf_fcp_cmnd()
2598 req->data = scsi_cmnd; in zfcp_fsf_fcp_cmnd()
2599 req->handler = zfcp_fsf_fcp_cmnd_handler; in zfcp_fsf_fcp_cmnd()
2600 req->qtcb->header.lun_handle = zfcp_sdev->lun_handle; in zfcp_fsf_fcp_cmnd()
2601 req->qtcb->header.port_handle = zfcp_sdev->port->handle; in zfcp_fsf_fcp_cmnd()
2614 fcp_cmnd = &req->qtcb->bottom.io.fcp_cmnd.iu; in zfcp_fsf_fcp_cmnd()
2619 zfcp_qdio_set_data_div(qdio, &req->qdio_req, in zfcp_fsf_fcp_cmnd()
2621 retval = zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req, in zfcp_fsf_fcp_cmnd()
2629 retval = zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req, in zfcp_fsf_fcp_cmnd()
2634 zfcp_qdio_set_sbale_last(adapter->qdio, &req->qdio_req); in zfcp_fsf_fcp_cmnd()
2636 zfcp_qdio_set_scount(qdio, &req->qdio_req); in zfcp_fsf_fcp_cmnd()
2638 retval = zfcp_fsf_req_send(req); in zfcp_fsf_fcp_cmnd()
2641 /* NOTE: DO NOT TOUCH req PAST THIS POINT! */ in zfcp_fsf_fcp_cmnd()
2646 zfcp_fsf_req_free(req); in zfcp_fsf_fcp_cmnd()
2653 static void zfcp_fsf_fcp_task_mgmt_handler(struct zfcp_fsf_req *req) in zfcp_fsf_fcp_task_mgmt_handler() argument
2655 struct scsi_device *sdev = req->data; in zfcp_fsf_fcp_task_mgmt_handler()
2659 zfcp_fsf_fcp_handler_common(req, sdev); in zfcp_fsf_fcp_task_mgmt_handler()
2661 fcp_rsp = &req->qtcb->bottom.io.fcp_rsp.iu; in zfcp_fsf_fcp_task_mgmt_handler()
2665 (req->status & ZFCP_STATUS_FSFREQ_ERROR)) in zfcp_fsf_fcp_task_mgmt_handler()
2666 req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED; in zfcp_fsf_fcp_task_mgmt_handler()
2679 struct zfcp_fsf_req *req = NULL; in zfcp_fsf_fcp_task_mgmt() local
2692 req = zfcp_fsf_req_create(qdio, FSF_QTCB_FCP_CMND, in zfcp_fsf_fcp_task_mgmt()
2696 if (IS_ERR(req)) { in zfcp_fsf_fcp_task_mgmt()
2697 req = NULL; in zfcp_fsf_fcp_task_mgmt()
2701 req->data = sdev; in zfcp_fsf_fcp_task_mgmt()
2703 req->handler = zfcp_fsf_fcp_task_mgmt_handler; in zfcp_fsf_fcp_task_mgmt()
2704 req->qtcb->header.lun_handle = zfcp_sdev->lun_handle; in zfcp_fsf_fcp_task_mgmt()
2705 req->qtcb->header.port_handle = zfcp_sdev->port->handle; in zfcp_fsf_fcp_task_mgmt()
2706 req->qtcb->bottom.io.data_direction = FSF_DATADIR_CMND; in zfcp_fsf_fcp_task_mgmt()
2707 req->qtcb->bottom.io.service_class = FSF_CLASS_3; in zfcp_fsf_fcp_task_mgmt()
2708 req->qtcb->bottom.io.fcp_cmnd_length = FCP_CMND_LEN; in zfcp_fsf_fcp_task_mgmt()
2710 zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); in zfcp_fsf_fcp_task_mgmt()
2712 fcp_cmnd = &req->qtcb->bottom.io.fcp_cmnd.iu; in zfcp_fsf_fcp_task_mgmt()
2715 zfcp_fsf_start_timer(req, ZFCP_FSF_SCSI_ER_TIMEOUT); in zfcp_fsf_fcp_task_mgmt()
2716 if (!zfcp_fsf_req_send(req)) { in zfcp_fsf_fcp_task_mgmt()
2717 /* NOTE: DO NOT TOUCH req, UNTIL IT COMPLETES! */ in zfcp_fsf_fcp_task_mgmt()
2721 zfcp_fsf_req_free(req); in zfcp_fsf_fcp_task_mgmt()
2722 req = NULL; in zfcp_fsf_fcp_task_mgmt()
2725 return req; in zfcp_fsf_fcp_task_mgmt()