[SCSI] zfcp: Set hardware timeout as requested by BSG request.

The hardware used with zfcp provides a timer for CT and ELS requests
instead of an abort capability for these commands. To correctly handle
the FC BSG timeouts, pass the timeout from the BSG requests to the
hardware.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>

authored by Swen Schillig and committed by James Bottomley 51375ee8 491ca442

+22 -16
+2 -2
drivers/s390/scsi/zfcp_ext.h
··· 130 extern int zfcp_fsf_status_read(struct zfcp_qdio *); 131 extern int zfcp_status_read_refill(struct zfcp_adapter *adapter); 132 extern int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *, struct zfcp_fsf_ct_els *, 133 - mempool_t *); 134 extern int zfcp_fsf_send_els(struct zfcp_adapter *, u32, 135 - struct zfcp_fsf_ct_els *); 136 extern int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *, 137 struct scsi_cmnd *); 138 extern void zfcp_fsf_req_free(struct zfcp_fsf_req *);
··· 130 extern int zfcp_fsf_status_read(struct zfcp_qdio *); 131 extern int zfcp_status_read_refill(struct zfcp_adapter *adapter); 132 extern int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *, struct zfcp_fsf_ct_els *, 133 + mempool_t *, unsigned int); 134 extern int zfcp_fsf_send_els(struct zfcp_adapter *, u32, 135 + struct zfcp_fsf_ct_els *, unsigned int); 136 extern int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *, 137 struct scsi_cmnd *); 138 extern void zfcp_fsf_req_free(struct zfcp_fsf_req *);
+8 -5
drivers/s390/scsi/zfcp_fc.c
··· 258 gid_pn->gid_pn_req.gid_pn.fn_wwpn = port->wwpn; 259 260 ret = zfcp_fsf_send_ct(&adapter->gs->ds, &gid_pn->ct, 261 - adapter->pool.gid_pn_req); 262 if (!ret) { 263 wait_for_completion(&completion); 264 zfcp_fc_ns_gid_pn_eval(gid_pn); ··· 422 hton24(adisc->adisc_req.adisc_port_id, 423 fc_host_port_id(adapter->scsi_host)); 424 425 - ret = zfcp_fsf_send_els(adapter, port->d_id, &adisc->els); 426 if (ret) 427 kmem_cache_free(zfcp_data.adisc_cache, adisc); 428 ··· 534 ct->req = &gpn_ft->sg_req; 535 ct->resp = gpn_ft->sg_resp; 536 537 - ret = zfcp_fsf_send_ct(&adapter->gs->ds, ct, NULL); 538 if (!ret) 539 wait_for_completion(&completion); 540 return ret; ··· 737 d_id = ntoh24(job->request->rqst_data.h_els.port_id); 738 739 els->handler = zfcp_fc_ct_els_job_handler; 740 - return zfcp_fsf_send_els(adapter, d_id, els); 741 } 742 743 static int zfcp_fc_exec_ct_job(struct fc_bsg_job *job, ··· 756 return ret; 757 758 ct->handler = zfcp_fc_ct_job_handler; 759 - ret = zfcp_fsf_send_ct(wka_port, ct, NULL); 760 if (ret) 761 zfcp_fc_wka_port_put(wka_port); 762
··· 258 gid_pn->gid_pn_req.gid_pn.fn_wwpn = port->wwpn; 259 260 ret = zfcp_fsf_send_ct(&adapter->gs->ds, &gid_pn->ct, 261 + adapter->pool.gid_pn_req, 262 + ZFCP_FC_CTELS_TMO); 263 if (!ret) { 264 wait_for_completion(&completion); 265 zfcp_fc_ns_gid_pn_eval(gid_pn); ··· 421 hton24(adisc->adisc_req.adisc_port_id, 422 fc_host_port_id(adapter->scsi_host)); 423 424 + ret = zfcp_fsf_send_els(adapter, port->d_id, &adisc->els, 425 + ZFCP_FC_CTELS_TMO); 426 if (ret) 427 kmem_cache_free(zfcp_data.adisc_cache, adisc); 428 ··· 532 ct->req = &gpn_ft->sg_req; 533 ct->resp = gpn_ft->sg_resp; 534 535 + ret = zfcp_fsf_send_ct(&adapter->gs->ds, ct, NULL, 536 + ZFCP_FC_CTELS_TMO); 537 if (!ret) 538 wait_for_completion(&completion); 539 return ret; ··· 734 d_id = ntoh24(job->request->rqst_data.h_els.port_id); 735 736 els->handler = zfcp_fc_ct_els_job_handler; 737 + return zfcp_fsf_send_els(adapter, d_id, els, job->req->timeout / HZ); 738 } 739 740 static int zfcp_fc_exec_ct_job(struct fc_bsg_job *job, ··· 753 return ret; 754 755 ct->handler = zfcp_fc_ct_job_handler; 756 + ret = zfcp_fsf_send_ct(wka_port, ct, NULL, job->req->timeout / HZ); 757 if (ret) 758 zfcp_fc_wka_port_put(wka_port); 759
+2
drivers/s390/scsi/zfcp_fc.h
··· 27 #define ZFCP_FC_GPN_FT_MAX_ENT (ZFCP_FC_GPN_FT_NUM_BUFS * \ 28 (ZFCP_FC_GPN_FT_ENT_PAGE + 1)) 29 30 /** 31 * struct zfcp_fc_gid_pn_req - container for ct header plus gid_pn request 32 * @ct_hdr: FC GS common transport header
··· 27 #define ZFCP_FC_GPN_FT_MAX_ENT (ZFCP_FC_GPN_FT_NUM_BUFS * \ 28 (ZFCP_FC_GPN_FT_ENT_PAGE + 1)) 29 30 + #define ZFCP_FC_CTELS_TMO (2 * FC_DEF_R_A_TOV / 1000) 31 + 32 /** 33 * struct zfcp_fc_gid_pn_req - container for ct header plus gid_pn request 34 * @ct_hdr: FC GS common transport header
+10 -9
drivers/s390/scsi/zfcp_fsf.c
··· 1068 static int zfcp_fsf_setup_ct_els(struct zfcp_fsf_req *req, 1069 struct scatterlist *sg_req, 1070 struct scatterlist *sg_resp, 1071 - int max_sbals) 1072 { 1073 int ret; 1074 - unsigned int fcp_chan_timeout; 1075 1076 ret = zfcp_fsf_setup_ct_els_sbals(req, sg_req, sg_resp, max_sbals); 1077 if (ret) 1078 return ret; 1079 1080 /* common settings for ct/gs and els requests */ 1081 - fcp_chan_timeout = 2 * FC_DEF_R_A_TOV / 1000; 1082 req->qtcb->bottom.support.service_class = FSF_CLASS_3; 1083 - req->qtcb->bottom.support.timeout = fcp_chan_timeout; 1084 - zfcp_fsf_start_timer(req, (fcp_chan_timeout + 10) * HZ); 1085 1086 return 0; 1087 } ··· 1092 * @pool: if non-null this mempool is used to allocate struct zfcp_fsf_req 1093 */ 1094 int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *wka_port, 1095 - struct zfcp_fsf_ct_els *ct, mempool_t *pool) 1096 { 1097 struct zfcp_qdio *qdio = wka_port->adapter->qdio; 1098 struct zfcp_fsf_req *req; ··· 1112 1113 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1114 ret = zfcp_fsf_setup_ct_els(req, ct->req, ct->resp, 1115 - FSF_MAX_SBALS_PER_REQ); 1116 if (ret) 1117 goto failed_send; 1118 ··· 1189 * @els: pointer to struct zfcp_send_els with data for the command 1190 */ 1191 int zfcp_fsf_send_els(struct zfcp_adapter *adapter, u32 d_id, 1192 - struct zfcp_fsf_ct_els *els) 1193 { 1194 struct zfcp_fsf_req *req; 1195 struct zfcp_qdio *qdio = adapter->qdio; ··· 1207 } 1208 1209 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1210 - ret = zfcp_fsf_setup_ct_els(req, els->req, els->resp, 2); 1211 1212 if (ret) 1213 goto failed_send;
··· 1068 static int zfcp_fsf_setup_ct_els(struct zfcp_fsf_req *req, 1069 struct scatterlist *sg_req, 1070 struct scatterlist *sg_resp, 1071 + int max_sbals, unsigned int timeout) 1072 { 1073 int ret; 1074 1075 ret = zfcp_fsf_setup_ct_els_sbals(req, sg_req, sg_resp, max_sbals); 1076 if (ret) 1077 return ret; 1078 1079 /* common settings for ct/gs and els requests */ 1080 + if (timeout > 255) 1081 + timeout = 255; /* max value accepted by hardware */ 1082 req->qtcb->bottom.support.service_class = FSF_CLASS_3; 1083 + req->qtcb->bottom.support.timeout = timeout; 1084 + zfcp_fsf_start_timer(req, (timeout + 10) * HZ); 1085 1086 return 0; 1087 } ··· 1092 * @pool: if non-null this mempool is used to allocate struct zfcp_fsf_req 1093 */ 1094 int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *wka_port, 1095 + struct zfcp_fsf_ct_els *ct, mempool_t *pool, 1096 + unsigned int timeout) 1097 { 1098 struct zfcp_qdio *qdio = wka_port->adapter->qdio; 1099 struct zfcp_fsf_req *req; ··· 1111 1112 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1113 ret = zfcp_fsf_setup_ct_els(req, ct->req, ct->resp, 1114 + FSF_MAX_SBALS_PER_REQ, timeout); 1115 if (ret) 1116 goto failed_send; 1117 ··· 1188 * @els: pointer to struct zfcp_send_els with data for the command 1189 */ 1190 int zfcp_fsf_send_els(struct zfcp_adapter *adapter, u32 d_id, 1191 + struct zfcp_fsf_ct_els *els, unsigned int timeout) 1192 { 1193 struct zfcp_fsf_req *req; 1194 struct zfcp_qdio *qdio = adapter->qdio; ··· 1206 } 1207 1208 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1209 + ret = zfcp_fsf_setup_ct_els(req, els->req, els->resp, 2, timeout); 1210 1211 if (ret) 1212 goto failed_send;