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