Lines Matching +full:ports +full:- +full:word +full:- +full:length

1 // SPDX-License-Identifier: GPL-2.0
35 …"Shuts down FCP devices for FCP channels that report a bit-error count in excess of its threshold …
40 struct zfcp_adapter *adapter = fsf_req->adapter; in zfcp_fsf_request_timeout_handler()
50 fsf_req->timer.function = zfcp_fsf_request_timeout_handler; in zfcp_fsf_start_timer()
51 fsf_req->timer.expires = jiffies + timeout; in zfcp_fsf_start_timer()
52 add_timer(&fsf_req->timer); in zfcp_fsf_start_timer()
57 BUG_ON(!fsf_req->erp_action); in zfcp_fsf_start_erp_timer()
58 fsf_req->timer.function = zfcp_erp_timeout_handler; in zfcp_fsf_start_erp_timer()
59 fsf_req->timer.expires = jiffies + 30 * HZ; in zfcp_fsf_start_erp_timer()
60 add_timer(&fsf_req->timer); in zfcp_fsf_start_erp_timer()
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()
89 * zfcp_fsf_req_free - free memory used by fsf request
94 if (likely(req->pool)) { 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()
102 kmem_cache_free(zfcp_fsf_qtcb_cache, req->qtcb); in zfcp_fsf_req_free()
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()
112 int d_id = ntoh24(sr_buf->d_id); in zfcp_fsf_status_read_port_closed()
114 read_lock_irqsave(&adapter->port_list_lock, flags); in zfcp_fsf_status_read_port_closed()
115 list_for_each_entry(port, &adapter->port_list, list) in zfcp_fsf_status_read_port_closed()
116 if (port->d_id == d_id) { in zfcp_fsf_status_read_port_closed()
120 read_unlock_irqrestore(&adapter->port_list_lock, flags); in zfcp_fsf_status_read_port_closed()
125 struct Scsi_Host *shost = adapter->scsi_host; in zfcp_fsf_fc_host_link_down()
127 adapter->hydra_version = 0; in zfcp_fsf_fc_host_link_down()
128 adapter->peer_wwpn = 0; in zfcp_fsf_fc_host_link_down()
129 adapter->peer_wwnn = 0; in zfcp_fsf_fc_host_link_down()
130 adapter->peer_d_id = 0; in zfcp_fsf_fc_host_link_down()
132 /* if there is no shost yet, we have nothing to zero-out */ in zfcp_fsf_fc_host_link_down()
147 struct zfcp_adapter *adapter = req->adapter; in zfcp_fsf_link_down_info_eval()
149 if (atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED) in zfcp_fsf_link_down_info_eval()
152 atomic_or(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, &adapter->status); in zfcp_fsf_link_down_info_eval()
161 switch (link_down->error_code) { 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()
193 "The FCP adapter cannot support more NPIV ports\n"); in zfcp_fsf_link_down_info_eval()
196 dev_warn(&req->adapter->ccw_device->dev, in zfcp_fsf_link_down_info_eval()
198 "more NPIV ports\n"); 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()
217 "All NPIV ports on the FCP adapter have " in zfcp_fsf_link_down_info_eval()
221 dev_warn(&req->adapter->ccw_device->dev, in zfcp_fsf_link_down_info_eval()
231 struct fsf_status_read_buffer *sr_buf = req->data; in zfcp_fsf_status_read_link_down()
233 (struct fsf_link_down_info *) &sr_buf->payload; in zfcp_fsf_status_read_link_down()
235 switch (sr_buf->status_subtype) { in zfcp_fsf_status_read_link_down()
249 if (sr_buf->status_subtype == FSF_STATUS_READ_SUB_LIC_CHANGE) { in zfcp_fsf_status_read_version_change()
250 u32 version = sr_buf->payload.version_change.current_version; in zfcp_fsf_status_read_version_change()
252 WRITE_ONCE(adapter->fsf_lic_version, version); in zfcp_fsf_status_read_version_change()
253 snprintf(fc_host_firmware_version(adapter->scsi_host), in zfcp_fsf_status_read_version_change()
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()
265 mempool_free(virt_to_page(sr_buf), adapter->pool.sr_data); in zfcp_fsf_status_read_handler()
272 switch (sr_buf->status_type) { in zfcp_fsf_status_read_handler()
284 dev_warn(&adapter->ccw_device->dev, in zfcp_fsf_status_read_handler()
288 dev_warn(&adapter->ccw_device->dev, in zfcp_fsf_status_read_handler()
297 dev_info(&adapter->ccw_device->dev, in zfcp_fsf_status_read_handler()
299 /* All ports should be marked as ready to run again */ in zfcp_fsf_status_read_handler()
310 if (sr_buf->status_subtype & FSF_STATUS_READ_SUB_INCOMING_ELS) in zfcp_fsf_status_read_handler()
312 if (sr_buf->status_subtype & FSF_STATUS_READ_SUB_VERSION_CHANGE) in zfcp_fsf_status_read_handler()
313 queue_work(adapter->work_queue, in zfcp_fsf_status_read_handler()
314 &adapter->version_change_lost_work); in zfcp_fsf_status_read_handler()
317 adapter->adapter_features = sr_buf->payload.word[0]; in zfcp_fsf_status_read_handler()
324 mempool_free(virt_to_page(sr_buf), adapter->pool.sr_data); in zfcp_fsf_status_read_handler()
327 atomic_inc(&adapter->stat_miss); in zfcp_fsf_status_read_handler()
328 queue_work(adapter->work_queue, &adapter->stat_work); in zfcp_fsf_status_read_handler()
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()
349 /* all non-return stats set FSFREQ_ERROR*/ in zfcp_fsf_fsfstatus_qual_eval()
350 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_fsfstatus_qual_eval()
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()
374 struct zfcp_adapter *adapter = req->adapter; in zfcp_fsf_protstatus_eval()
375 struct fsf_qtcb *qtcb = req->qtcb; in zfcp_fsf_protstatus_eval()
376 union fsf_prot_status_qual *psq = &qtcb->prefix.prot_status_qual; 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()
385 switch (qtcb->prefix.prot_status) { in zfcp_fsf_protstatus_eval()
390 dev_err(&adapter->ccw_device->dev, in zfcp_fsf_protstatus_eval()
393 psq->word[0], psq->word[1]); in zfcp_fsf_protstatus_eval()
399 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_protstatus_eval()
402 dev_err(&adapter->ccw_device->dev, in zfcp_fsf_protstatus_eval()
408 &adapter->status); in zfcp_fsf_protstatus_eval()
411 dev_err(&adapter->ccw_device->dev, in zfcp_fsf_protstatus_eval()
413 (unsigned long long)qtcb->bottom.support.req_handle); in zfcp_fsf_protstatus_eval()
417 zfcp_fsf_link_down_info_eval(req, &psq->link_down_info); in zfcp_fsf_protstatus_eval()
422 /* All ports should be marked as ready to run again */ in zfcp_fsf_protstatus_eval()
431 dev_err(&adapter->ccw_device->dev, in zfcp_fsf_protstatus_eval()
433 qtcb->prefix.prot_status); in zfcp_fsf_protstatus_eval()
437 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_protstatus_eval()
441 * zfcp_fsf_req_complete - process completion of a FSF request
449 * adapter->req_list, to protect against concurrent modification
461 del_timer_sync(&req->timer); 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()
473 complete(&req->completion); in zfcp_fsf_req_complete()
477 * zfcp_fsf_req_dismiss_all - dismiss all fsf requests
490 BUG_ON(atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP); in zfcp_fsf_req_dismiss_all()
491 zfcp_reqlist_move(adapter->req_list, &remove_queue); 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()
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()
544 plogi = (struct fc_els_flogi *) ((u8 *)&bottom->plogi_payload in zfcp_fsf_exchange_config_evaluate()
545 - sizeof(u32)); 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()
550 adapter->timer_ticks = bottom->timer_interval & ZFCP_FSF_TIMER_INT_MASK; in zfcp_fsf_exchange_config_evaluate()
551 adapter->stat_read_buf_num = max(bottom->status_read_buf_num, in zfcp_fsf_exchange_config_evaluate()
556 if (req->qtcb->header.fsf_status == FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE) in zfcp_fsf_exchange_config_evaluate()
559 adapter->hydra_version = bottom->adapter_type; in zfcp_fsf_exchange_config_evaluate()
561 switch (bottom->fc_topology) { in zfcp_fsf_exchange_config_evaluate()
563 adapter->peer_d_id = ntoh24(bottom->peer_d_id); in zfcp_fsf_exchange_config_evaluate()
564 adapter->peer_wwpn = be64_to_cpu(plogi->fl_wwpn); in zfcp_fsf_exchange_config_evaluate()
565 adapter->peer_wwnn = be64_to_cpu(plogi->fl_wwnn); in zfcp_fsf_exchange_config_evaluate()
571 dev_err(&adapter->ccw_device->dev, in zfcp_fsf_exchange_config_evaluate()
575 return -EIO; in zfcp_fsf_exchange_config_evaluate()
583 struct zfcp_adapter *adapter = req->adapter; in zfcp_fsf_exchange_config_data_handler()
585 &adapter->diagnostics->config_data.header; in zfcp_fsf_exchange_config_data_handler()
586 struct fsf_qtcb *qtcb = req->qtcb; in zfcp_fsf_exchange_config_data_handler()
587 struct fsf_qtcb_bottom_config *bottom = &qtcb->bottom.config; in zfcp_fsf_exchange_config_data_handler()
589 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_exchange_config_data_handler()
592 adapter->fsf_lic_version = bottom->lic_version; in zfcp_fsf_exchange_config_data_handler()
593 adapter->adapter_features = bottom->adapter_features; in zfcp_fsf_exchange_config_data_handler()
594 adapter->connection_features = bottom->connection_features; in zfcp_fsf_exchange_config_data_handler()
595 adapter->peer_wwpn = 0; in zfcp_fsf_exchange_config_data_handler()
596 adapter->peer_wwnn = 0; in zfcp_fsf_exchange_config_data_handler()
597 adapter->peer_d_id = 0; in zfcp_fsf_exchange_config_data_handler()
599 switch (qtcb->header.fsf_status) { in zfcp_fsf_exchange_config_data_handler()
611 if (bottom->max_qtcb_size < sizeof(struct fsf_qtcb)) { in zfcp_fsf_exchange_config_data_handler()
612 dev_err(&adapter->ccw_device->dev, in zfcp_fsf_exchange_config_data_handler()
615 bottom->max_qtcb_size); in zfcp_fsf_exchange_config_data_handler()
620 &adapter->status); in zfcp_fsf_exchange_config_data_handler()
624 req->status |= ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE; in zfcp_fsf_exchange_config_data_handler()
629 &adapter->status); in zfcp_fsf_exchange_config_data_handler()
631 &qtcb->header.fsf_status_qual.link_down_info); in zfcp_fsf_exchange_config_data_handler()
642 if (adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT) in zfcp_fsf_exchange_config_data_handler()
643 adapter->hardware_version = bottom->hardware_version; in zfcp_fsf_exchange_config_data_handler()
645 if (FSF_QTCB_CURRENT_VERSION < bottom->low_qtcb_version) { in zfcp_fsf_exchange_config_data_handler()
646 dev_err(&adapter->ccw_device->dev, in zfcp_fsf_exchange_config_data_handler()
652 if (FSF_QTCB_CURRENT_VERSION > bottom->high_qtcb_version) { in zfcp_fsf_exchange_config_data_handler()
653 dev_err(&adapter->ccw_device->dev, in zfcp_fsf_exchange_config_data_handler()
679 * zfcp_fsf_scnprint_fc_security() - translate FC Endpoint Security flags into
724 len += scnprintf(buf + len, size - len, "%s%s", prefix, in zfcp_fsf_scnprint_fc_security()
731 len += scnprintf(buf + len, size - len, "%s0x%08x", in zfcp_fsf_scnprint_fc_security()
740 if (adapter->fc_security_algorithms == in zfcp_fsf_dbf_adapter_fc_security()
741 adapter->fc_security_algorithms_old) { in zfcp_fsf_dbf_adapter_fc_security()
747 adapter->fc_security_algorithms_old, in zfcp_fsf_dbf_adapter_fc_security()
748 adapter->fc_security_algorithms); in zfcp_fsf_dbf_adapter_fc_security()
750 adapter->fc_security_algorithms_old = adapter->fc_security_algorithms; in zfcp_fsf_dbf_adapter_fc_security()
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()
761 if (adapter->adapter_features & FSF_FEATURE_FC_SECURITY) in zfcp_fsf_exchange_port_evaluate()
762 adapter->fc_security_algorithms = in zfcp_fsf_exchange_port_evaluate()
763 bottom->fc_security_algorithms; in zfcp_fsf_exchange_port_evaluate()
765 adapter->fc_security_algorithms = 0; in zfcp_fsf_exchange_port_evaluate()
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()
774 struct fsf_qtcb_bottom_port *bottom = &qtcb->bottom.port; in zfcp_fsf_exchange_port_data_handler()
776 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_exchange_port_data_handler()
779 switch (qtcb->header.fsf_status) { in zfcp_fsf_exchange_port_data_handler()
787 zfcp_scsi_shost_update_port_data(req->adapter, bottom); in zfcp_fsf_exchange_port_data_handler()
792 req->status |= ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE; in zfcp_fsf_exchange_port_data_handler()
795 &qtcb->header.fsf_status_qual.link_down_info); in zfcp_fsf_exchange_port_data_handler()
797 zfcp_scsi_shost_update_port_data(req->adapter, bottom); in zfcp_fsf_exchange_port_data_handler()
816 req->pool = pool; in zfcp_fsf_alloc()
840 struct zfcp_adapter *adapter = qdio->adapter; in zfcp_fsf_req_create()
844 return ERR_PTR(-ENOMEM); in zfcp_fsf_req_create()
846 if (adapter->req_no == 0) in zfcp_fsf_req_create()
847 adapter->req_no++; 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()
858 adapter->pool.qtcb_pool); 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()
864 return ERR_PTR(-ENOMEM); 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()
885 struct zfcp_adapter *adapter = req->adapter; in zfcp_fsf_req_send()
886 struct zfcp_qdio *qdio = adapter->qdio; 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()
897 if (zfcp_reqlist_find_rm(adapter->req_list, req_id) == NULL) in zfcp_fsf_req_send()
901 return -EIO; in zfcp_fsf_req_send()
906 * ONLY TOUCH SYNC req AGAIN ON req->completion. in zfcp_fsf_req_send()
909 * now. This is not protected by the QDIO-lock (req_q_lock). So any in zfcp_fsf_req_send()
910 * uncontrolled access after this might result in an use-after-free bug. in zfcp_fsf_req_send()
912 * when it is completed via req->completion, is it safe to use req in zfcp_fsf_req_send()
918 adapter->fsf_req_seq_no++; in zfcp_fsf_req_send()
919 adapter->req_no++; in zfcp_fsf_req_send()
925 * zfcp_fsf_status_read - send status read request
931 struct zfcp_adapter *adapter = qdio->adapter; in zfcp_fsf_status_read()
935 int retval = -EIO; in zfcp_fsf_status_read()
937 spin_lock_irq(&qdio->req_q_lock); in zfcp_fsf_status_read()
943 adapter->pool.status_read_req); in zfcp_fsf_status_read()
949 page = mempool_alloc(adapter->pool.sr_data, GFP_ATOMIC); in zfcp_fsf_status_read()
951 retval = -ENOMEM; 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()
969 req->data = NULL; in zfcp_fsf_status_read()
970 mempool_free(virt_to_page(sr_buf), adapter->pool.sr_data); in zfcp_fsf_status_read()
975 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_status_read()
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()
992 if (fsq->word[0] == fsq->word[1]) { in zfcp_fsf_abort_fcp_command_handler()
993 zfcp_erp_adapter_reopen(zfcp_sdev->port->adapter, 0, in zfcp_fsf_abort_fcp_command_handler()
995 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_abort_fcp_command_handler()
999 if (fsq->word[0] == fsq->word[1]) { in zfcp_fsf_abort_fcp_command_handler()
1000 zfcp_erp_port_reopen(zfcp_sdev->port, 0, "fsafch2"); 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()
1008 zfcp_erp_set_port_status(zfcp_sdev->port, in zfcp_fsf_abort_fcp_command_handler()
1010 zfcp_erp_port_reopen(zfcp_sdev->port, 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()
1021 switch (fsq->word[0]) { in zfcp_fsf_abort_fcp_command_handler()
1023 zfcp_fc_test_link(zfcp_sdev->port); 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()
1037 * zfcp_fsf_abort_fcp_cmnd - abort running SCSI command
1045 struct scsi_device *sdev = scmnd->device; in zfcp_fsf_abort_fcp_cmnd()
1047 struct zfcp_qdio *qdio = zfcp_sdev->port->adapter->qdio; in zfcp_fsf_abort_fcp_cmnd()
1048 u64 old_req_id = (u64) scmnd->host_scribble; in zfcp_fsf_abort_fcp_cmnd()
1050 spin_lock_irq(&qdio->req_q_lock); in zfcp_fsf_abort_fcp_cmnd()
1055 qdio->adapter->pool.scsi_abort); in zfcp_fsf_abort_fcp_cmnd()
1061 if (unlikely(!(atomic_read(&zfcp_sdev->status) & 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()
1083 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_abort_fcp_cmnd()
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()
1093 ct->status = -EINVAL; in zfcp_fsf_send_ct_handler()
1095 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_send_ct_handler()
1098 switch (header->fsf_status) { in zfcp_fsf_send_ct_handler()
1100 ct->status = 0; in zfcp_fsf_send_ct_handler()
1107 switch (header->fsf_status_qual.word[0]){ 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()
1130 if (ct->handler) in zfcp_fsf_send_ct_handler()
1131 ct->handler(ct->handler_data); in zfcp_fsf_send_ct_handler()
1139 zfcp_qdio_fill_next(qdio, q_req, sg_virt(sg_req), sg_req->length); in zfcp_fsf_setup_ct_els_unchained()
1140 zfcp_qdio_fill_next(qdio, q_req, sg_virt(sg_resp), sg_resp->length); in zfcp_fsf_setup_ct_els_unchained()
1148 struct zfcp_adapter *adapter = req->adapter; in zfcp_fsf_setup_ct_els_sbals()
1149 struct zfcp_qdio *qdio = adapter->qdio; in zfcp_fsf_setup_ct_els_sbals()
1150 struct fsf_qtcb *qtcb = req->qtcb; in zfcp_fsf_setup_ct_els_sbals()
1151 u32 feat = adapter->adapter_features; 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()
1155 return -EIO; in zfcp_fsf_setup_ct_els_sbals()
1156 qtcb->bottom.support.req_buf_length = 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()
1159 return -EIO; in zfcp_fsf_setup_ct_els_sbals()
1160 qtcb->bottom.support.resp_buf_length = 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()
1177 return -EOPNOTSUPP; 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()
1180 return -EIO; in zfcp_fsf_setup_ct_els_sbals()
1182 qtcb->bottom.support.req_buf_length = zfcp_qdio_real_bytes(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()
1188 return -EIO; in zfcp_fsf_setup_ct_els_sbals()
1190 qtcb->bottom.support.resp_buf_length = zfcp_qdio_real_bytes(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()
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()
1219 * zfcp_fsf_send_ct - initiate a Generic Service request (FC-GS)
1222 * @pool: if non-null this mempool is used to allocate struct zfcp_fsf_req
1229 struct zfcp_qdio *qdio = wka_port->adapter->qdio; in zfcp_fsf_send_ct()
1231 int ret = -EIO; in zfcp_fsf_send_ct()
1233 spin_lock_irq(&qdio->req_q_lock); 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()
1252 ct->d_id = wka_port->d_id; 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()
1267 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_send_ct()
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()
1276 send_els->status = -EINVAL; in zfcp_fsf_send_els_handler()
1278 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_send_els_handler()
1281 switch (header->fsf_status) { in zfcp_fsf_send_els_handler()
1283 send_els->status = 0; in zfcp_fsf_send_els_handler()
1290 switch (header->fsf_status_qual.word[0]){ 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()
1311 if (send_els->handler) in zfcp_fsf_send_els_handler()
1312 send_els->handler(send_els->handler_data); in zfcp_fsf_send_els_handler()
1316 * zfcp_fsf_send_els - initiate an ELS command (FC-FS)
1326 struct zfcp_qdio *qdio = adapter->qdio; in zfcp_fsf_send_els()
1327 int ret = -EIO; in zfcp_fsf_send_els()
1329 spin_lock_irq(&qdio->req_q_lock); 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()
1353 els->d_id = d_id; in zfcp_fsf_send_els()
1354 req->data = els; in zfcp_fsf_send_els()
1368 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_send_els()
1375 struct zfcp_qdio *qdio = erp_action->adapter->qdio; in zfcp_fsf_exchange_config_data()
1376 int retval = -EIO; in zfcp_fsf_exchange_config_data()
1378 spin_lock_irq(&qdio->req_q_lock); in zfcp_fsf_exchange_config_data()
1384 qdio->adapter->pool.erp_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()
1407 erp_action->fsf_req_id = 0; in zfcp_fsf_exchange_config_data()
1411 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_exchange_config_data()
1417 * zfcp_fsf_exchange_config_data_sync() - Request information about FCP channel.
1418 * @qdio: pointer to the QDIO-Queue to use for sending the command.
1419 * @data: pointer to the QTCB-Bottom for storing the result of the command,
1423 * * 0 - Exchange Config Data was successful, @data is complete
1424 * * -EIO - Exchange Config Data was not successful, @data is invalid
1425 * * -EAGAIN - @data contains incomplete data
1426 * * -ENOMEM - Some memory allocation failed along the way
1432 int retval = -EIO; in zfcp_fsf_exchange_config_data_sync()
1434 spin_lock_irq(&qdio->req_q_lock); 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()
1460 spin_unlock_irq(&qdio->req_q_lock); 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()
1468 retval = -EIO; in zfcp_fsf_exchange_config_data_sync()
1469 else if (req->status & ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE) in zfcp_fsf_exchange_config_data_sync()
1470 retval = -EAGAIN; in zfcp_fsf_exchange_config_data_sync()
1477 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_exchange_config_data_sync()
1482 * zfcp_fsf_exchange_port_data - request information about local port
1488 struct zfcp_qdio *qdio = erp_action->adapter->qdio; in zfcp_fsf_exchange_port_data()
1490 int retval = -EIO; in zfcp_fsf_exchange_port_data()
1492 if (!(qdio->adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) in zfcp_fsf_exchange_port_data()
1493 return -EOPNOTSUPP; in zfcp_fsf_exchange_port_data()
1495 spin_lock_irq(&qdio->req_q_lock); in zfcp_fsf_exchange_port_data()
1501 qdio->adapter->pool.erp_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()
1519 erp_action->fsf_req_id = 0; in zfcp_fsf_exchange_port_data()
1523 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_exchange_port_data()
1528 * zfcp_fsf_exchange_port_data_sync() - Request information about local port.
1529 * @qdio: pointer to the QDIO-Queue to use for sending the command.
1530 * @data: pointer to the QTCB-Bottom for storing the result of the command,
1534 * * 0 - Exchange Port Data was successful, @data is complete
1535 * * -EIO - Exchange Port Data was not successful, @data is invalid
1536 * * -EAGAIN - @data contains incomplete data
1537 * * -ENOMEM - Some memory allocation failed along the way
1538 * * -EOPNOTSUPP - This operation is not supported
1544 int retval = -EIO; in zfcp_fsf_exchange_port_data_sync()
1546 if (!(qdio->adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) in zfcp_fsf_exchange_port_data_sync()
1547 return -EOPNOTSUPP; in zfcp_fsf_exchange_port_data_sync()
1549 spin_lock_irq(&qdio->req_q_lock); 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()
1569 spin_unlock_irq(&qdio->req_q_lock); 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()
1577 retval = -EIO; in zfcp_fsf_exchange_port_data_sync()
1578 else if (req->status & ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE) in zfcp_fsf_exchange_port_data_sync()
1579 retval = -EAGAIN; in zfcp_fsf_exchange_port_data_sync()
1586 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_exchange_port_data_sync()
1596 if (port->connection_info == port->connection_info_old) { in zfcp_fsf_log_port_fc_security()
1601 zfcp_dbf_hba_fsf_fces("fsfcesp", req, port->wwpn, in zfcp_fsf_log_port_fc_security()
1602 port->connection_info_old, in zfcp_fsf_log_port_fc_security()
1603 port->connection_info); in zfcp_fsf_log_port_fc_security()
1606 port->connection_info_old, in zfcp_fsf_log_port_fc_security()
1609 port->connection_info, in zfcp_fsf_log_port_fc_security()
1618 if (port->connection_info_old == 0) { in zfcp_fsf_log_port_fc_security()
1620 dev_info(&port->adapter->ccw_device->dev, in zfcp_fsf_log_port_fc_security()
1622 port->wwpn, mnemonic_new); in zfcp_fsf_log_port_fc_security()
1623 } else if (port->connection_info == 0) { in zfcp_fsf_log_port_fc_security()
1625 dev_warn(&port->adapter->ccw_device->dev, in zfcp_fsf_log_port_fc_security()
1627 port->wwpn, mnemonic_old); in zfcp_fsf_log_port_fc_security()
1630 dev_warn(&port->adapter->ccw_device->dev, in zfcp_fsf_log_port_fc_security()
1632 port->wwpn, mnemonic_old, mnemonic_new); in zfcp_fsf_log_port_fc_security()
1636 port->connection_info_old = port->connection_info; in zfcp_fsf_log_port_fc_security()
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()
1706 switch (header->fsf_status) { in zfcp_fsf_open_port_handler()
1710 dev_warn(&adapter->ccw_device->dev, in zfcp_fsf_open_port_handler()
1713 (unsigned long long)port->wwpn); 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()
1720 header->fsf_status_qual.word[0], in zfcp_fsf_open_port_handler()
1721 port->wwpn); in zfcp_fsf_open_port_handler()
1722 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_port_handler()
1725 switch (header->fsf_status_qual.word[0]) { in zfcp_fsf_open_port_handler()
1731 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_port_handler()
1736 port->handle = header->port_handle; in zfcp_fsf_open_port_handler()
1737 if (adapter->adapter_features & FSF_FEATURE_FC_SECURITY) in zfcp_fsf_open_port_handler()
1738 port->connection_info = bottom->connection_info; in zfcp_fsf_open_port_handler()
1740 port->connection_info = 0; in zfcp_fsf_open_port_handler()
1743 ZFCP_STATUS_PORT_PHYS_OPEN, &port->status); in zfcp_fsf_open_port_handler()
1745 &port->status); in zfcp_fsf_open_port_handler()
1752 * target ports. So, our heroic attempt to make things safe in zfcp_fsf_open_port_handler()
1757 * mind that one should be able to cross-check by means of in zfcp_fsf_open_port_handler()
1761 plogi = (struct fc_els_flogi *) bottom->els; in zfcp_fsf_open_port_handler()
1762 if (bottom->els1_length >= FSF_PLOGI_MIN_LEN) in zfcp_fsf_open_port_handler()
1766 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_port_handler()
1771 put_device(&port->dev); in zfcp_fsf_open_port_handler()
1775 * zfcp_fsf_open_port - create and send open port request
1781 struct zfcp_qdio *qdio = erp_action->adapter->qdio; in zfcp_fsf_open_port()
1782 struct zfcp_port *port = erp_action->port; in zfcp_fsf_open_port()
1784 int retval = -EIO; in zfcp_fsf_open_port()
1786 spin_lock_irq(&qdio->req_q_lock); in zfcp_fsf_open_port()
1792 qdio->adapter->pool.erp_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()
1807 get_device(&port->dev); in zfcp_fsf_open_port()
1813 erp_action->fsf_req_id = 0; in zfcp_fsf_open_port()
1814 put_device(&port->dev); in zfcp_fsf_open_port()
1818 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_open_port()
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()
1831 zfcp_erp_adapter_reopen(port->adapter, 0, "fscph_1"); in zfcp_fsf_close_port_handler()
1832 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_port_handler()
1843 * zfcp_fsf_close_port - create and send close port request
1849 struct zfcp_qdio *qdio = erp_action->adapter->qdio; in zfcp_fsf_close_port()
1851 int retval = -EIO; in zfcp_fsf_close_port()
1853 spin_lock_irq(&qdio->req_q_lock); in zfcp_fsf_close_port()
1859 qdio->adapter->pool.erp_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()
1879 erp_action->fsf_req_id = 0; in zfcp_fsf_close_port()
1883 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_close_port()
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()
1893 wka_port->status = ZFCP_FC_WKA_PORT_OFFLINE; in zfcp_fsf_open_wka_port_handler()
1897 switch (header->fsf_status) { in zfcp_fsf_open_wka_port_handler()
1899 dev_warn(&req->adapter->ccw_device->dev, in zfcp_fsf_open_wka_port_handler()
1900 "Opening WKA port 0x%x failed\n", wka_port->d_id); in zfcp_fsf_open_wka_port_handler()
1903 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_wka_port_handler()
1904 wka_port->status = ZFCP_FC_WKA_PORT_OFFLINE; in zfcp_fsf_open_wka_port_handler()
1907 wka_port->handle = header->port_handle; in zfcp_fsf_open_wka_port_handler()
1910 wka_port->status = ZFCP_FC_WKA_PORT_ONLINE; in zfcp_fsf_open_wka_port_handler()
1913 wake_up(&wka_port->opened); in zfcp_fsf_open_wka_port_handler()
1917 * zfcp_fsf_open_wka_port - create and send open wka-port request
1923 struct zfcp_qdio *qdio = wka_port->adapter->qdio; in zfcp_fsf_open_wka_port()
1926 int retval = -EIO; in zfcp_fsf_open_wka_port()
1928 spin_lock_irq(&qdio->req_q_lock); in zfcp_fsf_open_wka_port()
1934 qdio->adapter->pool.erp_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()
1956 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_open_wka_port()
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()
1968 zfcp_erp_adapter_reopen(wka_port->adapter, 0, "fscwph1"); in zfcp_fsf_close_wka_port_handler()
1971 wka_port->status = ZFCP_FC_WKA_PORT_OFFLINE; in zfcp_fsf_close_wka_port_handler()
1972 wake_up(&wka_port->closed); in zfcp_fsf_close_wka_port_handler()
1976 * zfcp_fsf_close_wka_port - create and send close wka port request
1982 struct zfcp_qdio *qdio = wka_port->adapter->qdio; in zfcp_fsf_close_wka_port()
1985 int retval = -EIO; in zfcp_fsf_close_wka_port()
1987 spin_lock_irq(&qdio->req_q_lock); in zfcp_fsf_close_wka_port()
1993 qdio->adapter->pool.erp_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()
2015 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_close_wka_port()
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()
2030 switch (header->fsf_status) { in zfcp_fsf_close_physical_port_handler()
2032 zfcp_erp_adapter_reopen(port->adapter, 0, "fscpph1"); in zfcp_fsf_close_physical_port_handler()
2033 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_physical_port_handler()
2038 atomic_andnot(ZFCP_STATUS_PORT_PHYS_OPEN, &port->status); in zfcp_fsf_close_physical_port_handler()
2039 shost_for_each_device(sdev, port->adapter->scsi_host) in zfcp_fsf_close_physical_port_handler()
2040 if (sdev_to_zfcp(sdev)->port == port) in zfcp_fsf_close_physical_port_handler()
2042 &sdev_to_zfcp(sdev)->status); in zfcp_fsf_close_physical_port_handler()
2046 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_physical_port_handler()
2049 switch (header->fsf_status_qual.word[0]) { in zfcp_fsf_close_physical_port_handler()
2052 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_physical_port_handler()
2060 atomic_andnot(ZFCP_STATUS_PORT_PHYS_OPEN, &port->status); in zfcp_fsf_close_physical_port_handler()
2061 shost_for_each_device(sdev, port->adapter->scsi_host) in zfcp_fsf_close_physical_port_handler()
2062 if (sdev_to_zfcp(sdev)->port == port) in zfcp_fsf_close_physical_port_handler()
2064 &sdev_to_zfcp(sdev)->status); in zfcp_fsf_close_physical_port_handler()
2070 * zfcp_fsf_close_physical_port - close physical port
2076 struct zfcp_qdio *qdio = erp_action->adapter->qdio; in zfcp_fsf_close_physical_port()
2078 int retval = -EIO; in zfcp_fsf_close_physical_port()
2080 spin_lock_irq(&qdio->req_q_lock); in zfcp_fsf_close_physical_port()
2086 qdio->adapter->pool.erp_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()
2106 erp_action->fsf_req_id = 0; in zfcp_fsf_close_physical_port()
2110 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_close_physical_port()
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()
2120 union fsf_status_qual *qual = &header->fsf_status_qual; in zfcp_fsf_open_lun_handler()
2122 if (req->status & ZFCP_STATUS_FSFREQ_ERROR) in zfcp_fsf_open_lun_handler()
2129 &zfcp_sdev->status); in zfcp_fsf_open_lun_handler()
2131 switch (header->fsf_status) { in zfcp_fsf_open_lun_handler()
2139 zfcp_erp_set_port_status(zfcp_sdev->port, in zfcp_fsf_open_lun_handler()
2141 zfcp_erp_port_reopen(zfcp_sdev->port, in zfcp_fsf_open_lun_handler()
2143 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_lun_handler()
2146 if (qual->word[0]) in zfcp_fsf_open_lun_handler()
2147 dev_warn(&zfcp_sdev->port->adapter->ccw_device->dev, in zfcp_fsf_open_lun_handler()
2151 (unsigned long long)zfcp_sdev->port->wwpn, in zfcp_fsf_open_lun_handler()
2152 qual->fsf_queue_designator.cssid, in zfcp_fsf_open_lun_handler()
2153 qual->fsf_queue_designator.hla); in zfcp_fsf_open_lun_handler()
2157 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_lun_handler()
2160 dev_warn(&adapter->ccw_device->dev, in zfcp_fsf_open_lun_handler()
2164 (unsigned long long)zfcp_sdev->port->wwpn); in zfcp_fsf_open_lun_handler()
2168 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_lun_handler()
2171 switch (header->fsf_status_qual.word[0]) { in zfcp_fsf_open_lun_handler()
2173 zfcp_fc_test_link(zfcp_sdev->port); in zfcp_fsf_open_lun_handler()
2176 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_open_lun_handler()
2182 zfcp_sdev->lun_handle = header->lun_handle; in zfcp_fsf_open_lun_handler()
2183 atomic_or(ZFCP_STATUS_COMMON_OPEN, &zfcp_sdev->status); in zfcp_fsf_open_lun_handler()
2189 * zfcp_fsf_open_lun - open LUN
2195 struct zfcp_adapter *adapter = erp_action->adapter; in zfcp_fsf_open_lun()
2196 struct zfcp_qdio *qdio = adapter->qdio; in zfcp_fsf_open_lun()
2198 int retval = -EIO; in zfcp_fsf_open_lun()
2200 spin_lock_irq(&qdio->req_q_lock); in zfcp_fsf_open_lun()
2206 adapter->pool.erp_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()
2223 if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE)) in zfcp_fsf_open_lun()
2224 req->qtcb->bottom.support.option = FSF_OPEN_LUN_SUPPRESS_BOXING; in zfcp_fsf_open_lun()
2230 erp_action->fsf_req_id = 0; in zfcp_fsf_open_lun()
2234 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_open_lun()
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()
2250 zfcp_erp_adapter_reopen(zfcp_sdev->port->adapter, 0, "fscuh_1"); in zfcp_fsf_close_lun_handler()
2251 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_lun_handler()
2254 zfcp_erp_port_reopen(zfcp_sdev->port, 0, "fscuh_2"); in zfcp_fsf_close_lun_handler()
2255 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_lun_handler()
2258 zfcp_erp_set_port_status(zfcp_sdev->port, in zfcp_fsf_close_lun_handler()
2260 zfcp_erp_port_reopen(zfcp_sdev->port, 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()
2267 zfcp_fc_test_link(zfcp_sdev->port); in zfcp_fsf_close_lun_handler()
2270 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_close_lun_handler()
2275 atomic_andnot(ZFCP_STATUS_COMMON_OPEN, &zfcp_sdev->status); in zfcp_fsf_close_lun_handler()
2281 * zfcp_fsf_close_lun - close LUN
2287 struct zfcp_qdio *qdio = erp_action->adapter->qdio; in zfcp_fsf_close_lun()
2288 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(erp_action->sdev); in zfcp_fsf_close_lun()
2290 int retval = -EIO; in zfcp_fsf_close_lun()
2292 spin_lock_irq(&qdio->req_q_lock); in zfcp_fsf_close_lun()
2298 qdio->adapter->pool.erp_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()
2319 erp_action->fsf_req_id = 0; in zfcp_fsf_close_lun()
2323 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_close_lun()
2329 lat_rec->sum += lat; in zfcp_fsf_update_lat()
2330 lat_rec->min = min(lat_rec->min, lat); in zfcp_fsf_update_lat()
2331 lat_rec->max = max(lat_rec->max, lat); in zfcp_fsf_update_lat()
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()
2353 zfcp_sdev = sdev_to_zfcp(scsi->device); in zfcp_fsf_req_trace()
2355 blktrc.channel_lat = lat_in->channel_lat * ticks; in zfcp_fsf_req_trace()
2356 blktrc.fabric_lat = lat_in->fabric_lat * ticks; in zfcp_fsf_req_trace()
2358 switch (req->qtcb->bottom.io.data_direction) { in zfcp_fsf_req_trace()
2362 lat = &zfcp_sdev->latencies.read; in zfcp_fsf_req_trace()
2367 lat = &zfcp_sdev->latencies.write; in zfcp_fsf_req_trace()
2370 lat = &zfcp_sdev->latencies.cmd; in zfcp_fsf_req_trace()
2375 spin_lock(&zfcp_sdev->latencies.lock); in zfcp_fsf_req_trace()
2376 zfcp_fsf_update_lat(&lat->channel, lat_in->channel_lat); in zfcp_fsf_req_trace()
2377 zfcp_fsf_update_lat(&lat->fabric, lat_in->fabric_lat); in zfcp_fsf_req_trace()
2378 lat->counter++; in zfcp_fsf_req_trace()
2379 spin_unlock(&zfcp_sdev->latencies.lock); in zfcp_fsf_req_trace()
2387 * zfcp_fsf_fcp_handler_common() - FCP response handler common to I/O and TMF.
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()
2402 switch (header->fsf_status) { 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()
2410 zfcp_erp_port_reopen(zfcp_sdev->port, 0, "fssfch2"); in zfcp_fsf_fcp_handler_common()
2411 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 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()
2422 (unsigned long long)zfcp_sdev->port->wwpn); 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()
2428 "Incorrect FCP_CMND length %d, FCP device closed\n", 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()
2434 zfcp_erp_set_port_status(zfcp_sdev->port, in zfcp_fsf_fcp_handler_common()
2436 zfcp_erp_port_reopen(zfcp_sdev->port, 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()
2447 if (header->fsf_status_qual.word[0] == in zfcp_fsf_fcp_handler_common()
2449 zfcp_fc_test_link(zfcp_sdev->port); 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()
2454 header->fsf_status_qual.word[0], in zfcp_fsf_fcp_handler_common()
2455 zfcp_sdev->port->wwpn); in zfcp_fsf_fcp_handler_common()
2456 zfcp_erp_port_forced_reopen(zfcp_sdev->port, 0, "fssfch7"); in zfcp_fsf_fcp_handler_common()
2457 req->status |= ZFCP_STATUS_FSFREQ_ERROR; in zfcp_fsf_fcp_handler_common()
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()
2506 scpnt->host_scribble = NULL; in zfcp_fsf_fcp_cmnd_handler()
2514 read_unlock_irqrestore(&req->adapter->abort_lock, flags); in zfcp_fsf_fcp_cmnd_handler()
2521 switch (scsi_cmnd->sc_data_direction) { in zfcp_fsf_set_data_dir()
2532 return -EINVAL; in zfcp_fsf_set_data_dir()
2549 return -EINVAL; in zfcp_fsf_set_data_dir()
2556 * zfcp_fsf_fcp_cmnd - initiate an FCP command (for a SCSI command)
2564 int retval = -EIO; in zfcp_fsf_fcp_cmnd()
2565 struct scsi_device *sdev = scsi_cmnd->device; in zfcp_fsf_fcp_cmnd()
2567 struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; in zfcp_fsf_fcp_cmnd()
2568 struct zfcp_qdio *qdio = adapter->qdio; in zfcp_fsf_fcp_cmnd()
2572 if (unlikely(!(atomic_read(&zfcp_sdev->status) & in zfcp_fsf_fcp_cmnd()
2574 return -EBUSY; in zfcp_fsf_fcp_cmnd()
2576 spin_lock_irqsave(&qdio->req_q_lock, flags); in zfcp_fsf_fcp_cmnd()
2577 if (atomic_read(&qdio->req_q_free) <= 0) { in zfcp_fsf_fcp_cmnd()
2578 atomic_inc(&qdio->req_q_full); in zfcp_fsf_fcp_cmnd()
2582 if (scsi_cmnd->sc_data_direction == DMA_TO_DEVICE) in zfcp_fsf_fcp_cmnd()
2586 sbtype, adapter->pool.scsi_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()
2602 io->service_class = FSF_CLASS_3; in zfcp_fsf_fcp_cmnd()
2603 io->fcp_cmnd_length = FCP_CMND_LEN; in zfcp_fsf_fcp_cmnd()
2606 io->data_block_length = scsi_prot_interval(scsi_cmnd); in zfcp_fsf_fcp_cmnd()
2607 io->ref_tag_value = scsi_prot_ref_tag(scsi_cmnd); in zfcp_fsf_fcp_cmnd()
2610 if (zfcp_fsf_set_data_dir(scsi_cmnd, &io->data_direction)) 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()
2625 io->prot_data_length = zfcp_qdio_real_bytes( 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()
2647 scsi_cmnd->host_scribble = NULL; in zfcp_fsf_fcp_cmnd()
2649 spin_unlock_irqrestore(&qdio->req_q_lock, flags); in zfcp_fsf_fcp_cmnd()
2655 struct scsi_device *sdev = req->data; in zfcp_fsf_fcp_task_mgmt_handler()
2661 fcp_rsp = &req->qtcb->bottom.io.fcp_rsp.iu; in zfcp_fsf_fcp_task_mgmt_handler()
2664 if ((rsp_info->rsp_code != FCP_TMF_CMPL) || 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()
2670 * zfcp_fsf_fcp_task_mgmt() - Send SCSI task management command (TMF).
2682 struct zfcp_qdio *qdio = zfcp_sdev->port->adapter->qdio; in zfcp_fsf_fcp_task_mgmt()
2684 if (unlikely(!(atomic_read(&zfcp_sdev->status) & in zfcp_fsf_fcp_task_mgmt()
2688 spin_lock_irq(&qdio->req_q_lock); in zfcp_fsf_fcp_task_mgmt()
2694 qdio->adapter->pool.scsi_req); 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()
2724 spin_unlock_irq(&qdio->req_q_lock); in zfcp_fsf_fcp_task_mgmt()
2729 * zfcp_fsf_reqid_check - validate req_id contained in SBAL returned by QDIO
2735 struct zfcp_adapter *adapter = qdio->adapter; in zfcp_fsf_reqid_check()
2736 struct qdio_buffer *sbal = qdio->res_q[sbal_idx]; in zfcp_fsf_reqid_check()
2744 sbale = &sbal->element[idx]; in zfcp_fsf_reqid_check()
2745 req_id = dma64_to_u64(sbale->addr); in zfcp_fsf_reqid_check()
2746 fsf_req = zfcp_reqlist_find_rm(adapter->req_list, req_id); in zfcp_fsf_reqid_check()
2755 req_id, dev_name(&adapter->ccw_device->dev)); in zfcp_fsf_reqid_check()
2760 if (likely(sbale->eflags & SBAL_EFLAGS_LAST_ENTRY)) in zfcp_fsf_reqid_check()