aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_scsi.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c232
1 files changed, 93 insertions, 139 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 0910a9ab76a5..c94da4f2b8a6 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -50,6 +50,7 @@ void
50lpfc_adjust_queue_depth(struct lpfc_hba *phba) 50lpfc_adjust_queue_depth(struct lpfc_hba *phba)
51{ 51{
52 unsigned long flags; 52 unsigned long flags;
53 uint32_t evt_posted;
53 54
54 spin_lock_irqsave(&phba->hbalock, flags); 55 spin_lock_irqsave(&phba->hbalock, flags);
55 atomic_inc(&phba->num_rsrc_err); 56 atomic_inc(&phba->num_rsrc_err);
@@ -65,17 +66,13 @@ lpfc_adjust_queue_depth(struct lpfc_hba *phba)
65 spin_unlock_irqrestore(&phba->hbalock, flags); 66 spin_unlock_irqrestore(&phba->hbalock, flags);
66 67
67 spin_lock_irqsave(&phba->pport->work_port_lock, flags); 68 spin_lock_irqsave(&phba->pport->work_port_lock, flags);
68 if ((phba->pport->work_port_events & 69 evt_posted = phba->pport->work_port_events & WORKER_RAMP_DOWN_QUEUE;
69 WORKER_RAMP_DOWN_QUEUE) == 0) { 70 if (!evt_posted)
70 phba->pport->work_port_events |= WORKER_RAMP_DOWN_QUEUE; 71 phba->pport->work_port_events |= WORKER_RAMP_DOWN_QUEUE;
71 }
72 spin_unlock_irqrestore(&phba->pport->work_port_lock, flags); 72 spin_unlock_irqrestore(&phba->pport->work_port_lock, flags);
73 73
74 spin_lock_irqsave(&phba->hbalock, flags); 74 if (!evt_posted)
75 if (phba->work_wait) 75 lpfc_worker_wake_up(phba);
76 wake_up(phba->work_wait);
77 spin_unlock_irqrestore(&phba->hbalock, flags);
78
79 return; 76 return;
80} 77}
81 78
@@ -89,6 +86,7 @@ lpfc_rampup_queue_depth(struct lpfc_vport *vport,
89{ 86{
90 unsigned long flags; 87 unsigned long flags;
91 struct lpfc_hba *phba = vport->phba; 88 struct lpfc_hba *phba = vport->phba;
89 uint32_t evt_posted;
92 atomic_inc(&phba->num_cmd_success); 90 atomic_inc(&phba->num_cmd_success);
93 91
94 if (vport->cfg_lun_queue_depth <= sdev->queue_depth) 92 if (vport->cfg_lun_queue_depth <= sdev->queue_depth)
@@ -103,16 +101,14 @@ lpfc_rampup_queue_depth(struct lpfc_vport *vport,
103 spin_unlock_irqrestore(&phba->hbalock, flags); 101 spin_unlock_irqrestore(&phba->hbalock, flags);
104 102
105 spin_lock_irqsave(&phba->pport->work_port_lock, flags); 103 spin_lock_irqsave(&phba->pport->work_port_lock, flags);
106 if ((phba->pport->work_port_events & 104 evt_posted = phba->pport->work_port_events & WORKER_RAMP_UP_QUEUE;
107 WORKER_RAMP_UP_QUEUE) == 0) { 105 if (!evt_posted)
108 phba->pport->work_port_events |= WORKER_RAMP_UP_QUEUE; 106 phba->pport->work_port_events |= WORKER_RAMP_UP_QUEUE;
109 }
110 spin_unlock_irqrestore(&phba->pport->work_port_lock, flags); 107 spin_unlock_irqrestore(&phba->pport->work_port_lock, flags);
111 108
112 spin_lock_irqsave(&phba->hbalock, flags); 109 if (!evt_posted)
113 if (phba->work_wait) 110 lpfc_worker_wake_up(phba);
114 wake_up(phba->work_wait); 111 return;
115 spin_unlock_irqrestore(&phba->hbalock, flags);
116} 112}
117 113
118void 114void
@@ -609,9 +605,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
609 result = cmd->result; 605 result = cmd->result;
610 sdev = cmd->device; 606 sdev = cmd->device;
611 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); 607 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd);
612 spin_lock_irqsave(sdev->host->host_lock, flags);
613 lpfc_cmd->pCmd = NULL; /* This must be done before scsi_done */
614 spin_unlock_irqrestore(sdev->host->host_lock, flags);
615 cmd->scsi_done(cmd); 608 cmd->scsi_done(cmd);
616 609
617 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { 610 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) {
@@ -620,6 +613,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
620 * wake up the thread. 613 * wake up the thread.
621 */ 614 */
622 spin_lock_irqsave(sdev->host->host_lock, flags); 615 spin_lock_irqsave(sdev->host->host_lock, flags);
616 lpfc_cmd->pCmd = NULL;
623 if (lpfc_cmd->waitq) 617 if (lpfc_cmd->waitq)
624 wake_up(lpfc_cmd->waitq); 618 wake_up(lpfc_cmd->waitq);
625 spin_unlock_irqrestore(sdev->host->host_lock, flags); 619 spin_unlock_irqrestore(sdev->host->host_lock, flags);
@@ -690,6 +684,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
690 * wake up the thread. 684 * wake up the thread.
691 */ 685 */
692 spin_lock_irqsave(sdev->host->host_lock, flags); 686 spin_lock_irqsave(sdev->host->host_lock, flags);
687 lpfc_cmd->pCmd = NULL;
693 if (lpfc_cmd->waitq) 688 if (lpfc_cmd->waitq)
694 wake_up(lpfc_cmd->waitq); 689 wake_up(lpfc_cmd->waitq);
695 spin_unlock_irqrestore(sdev->host->host_lock, flags); 690 spin_unlock_irqrestore(sdev->host->host_lock, flags);
@@ -849,14 +844,15 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf *lpfc_cmd, struct lpfc_vport *vport,
849 struct lpfc_iocbq *iocbq; 844 struct lpfc_iocbq *iocbq;
850 struct lpfc_iocbq *iocbqrsp; 845 struct lpfc_iocbq *iocbqrsp;
851 int ret; 846 int ret;
847 int status;
852 848
853 if (!rdata->pnode || !NLP_CHK_NODE_ACT(rdata->pnode)) 849 if (!rdata->pnode || !NLP_CHK_NODE_ACT(rdata->pnode))
854 return FAILED; 850 return FAILED;
855 851
856 lpfc_cmd->rdata = rdata; 852 lpfc_cmd->rdata = rdata;
857 ret = lpfc_scsi_prep_task_mgmt_cmd(vport, lpfc_cmd, lun, 853 status = lpfc_scsi_prep_task_mgmt_cmd(vport, lpfc_cmd, lun,
858 FCP_TARGET_RESET); 854 FCP_TARGET_RESET);
859 if (!ret) 855 if (!status)
860 return FAILED; 856 return FAILED;
861 857
862 iocbq = &lpfc_cmd->cur_iocbq; 858 iocbq = &lpfc_cmd->cur_iocbq;
@@ -869,12 +865,15 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf *lpfc_cmd, struct lpfc_vport *vport,
869 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, 865 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
870 "0702 Issue Target Reset to TGT %d Data: x%x x%x\n", 866 "0702 Issue Target Reset to TGT %d Data: x%x x%x\n",
871 tgt_id, rdata->pnode->nlp_rpi, rdata->pnode->nlp_flag); 867 tgt_id, rdata->pnode->nlp_rpi, rdata->pnode->nlp_flag);
872 ret = lpfc_sli_issue_iocb_wait(phba, 868 status = lpfc_sli_issue_iocb_wait(phba,
873 &phba->sli.ring[phba->sli.fcp_ring], 869 &phba->sli.ring[phba->sli.fcp_ring],
874 iocbq, iocbqrsp, lpfc_cmd->timeout); 870 iocbq, iocbqrsp, lpfc_cmd->timeout);
875 if (ret != IOCB_SUCCESS) { 871 if (status != IOCB_SUCCESS) {
876 if (ret == IOCB_TIMEDOUT) 872 if (status == IOCB_TIMEDOUT) {
877 iocbq->iocb_cmpl = lpfc_tskmgmt_def_cmpl; 873 iocbq->iocb_cmpl = lpfc_tskmgmt_def_cmpl;
874 ret = TIMEOUT_ERROR;
875 } else
876 ret = FAILED;
878 lpfc_cmd->status = IOSTAT_DRIVER_REJECT; 877 lpfc_cmd->status = IOSTAT_DRIVER_REJECT;
879 } else { 878 } else {
880 ret = SUCCESS; 879 ret = SUCCESS;
@@ -1142,121 +1141,96 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)
1142 struct lpfc_iocbq *iocbq, *iocbqrsp; 1141 struct lpfc_iocbq *iocbq, *iocbqrsp;
1143 struct lpfc_rport_data *rdata = cmnd->device->hostdata; 1142 struct lpfc_rport_data *rdata = cmnd->device->hostdata;
1144 struct lpfc_nodelist *pnode = rdata->pnode; 1143 struct lpfc_nodelist *pnode = rdata->pnode;
1145 uint32_t cmd_result = 0, cmd_status = 0; 1144 unsigned long later;
1146 int ret = FAILED; 1145 int ret = SUCCESS;
1147 int iocb_status = IOCB_SUCCESS; 1146 int status;
1148 int cnt, loopcnt; 1147 int cnt;
1149 1148
1150 lpfc_block_error_handler(cmnd); 1149 lpfc_block_error_handler(cmnd);
1151 loopcnt = 0;
1152 /* 1150 /*
1153 * If target is not in a MAPPED state, delay the reset until 1151 * If target is not in a MAPPED state, delay the reset until
1154 * target is rediscovered or devloss timeout expires. 1152 * target is rediscovered or devloss timeout expires.
1155 */ 1153 */
1156 while (1) { 1154 later = msecs_to_jiffies(2 * vport->cfg_devloss_tmo * 1000) + jiffies;
1155 while (time_after(later, jiffies)) {
1157 if (!pnode || !NLP_CHK_NODE_ACT(pnode)) 1156 if (!pnode || !NLP_CHK_NODE_ACT(pnode))
1158 goto out; 1157 return FAILED;
1159
1160 if (pnode->nlp_state != NLP_STE_MAPPED_NODE) {
1161 schedule_timeout_uninterruptible(msecs_to_jiffies(500));
1162 loopcnt++;
1163 rdata = cmnd->device->hostdata;
1164 if (!rdata ||
1165 (loopcnt > ((vport->cfg_devloss_tmo * 2) + 1))){
1166 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1167 "0721 LUN Reset rport "
1168 "failure: cnt x%x rdata x%p\n",
1169 loopcnt, rdata);
1170 goto out;
1171 }
1172 pnode = rdata->pnode;
1173 if (!pnode || !NLP_CHK_NODE_ACT(pnode))
1174 goto out;
1175 }
1176 if (pnode->nlp_state == NLP_STE_MAPPED_NODE) 1158 if (pnode->nlp_state == NLP_STE_MAPPED_NODE)
1177 break; 1159 break;
1160 schedule_timeout_uninterruptible(msecs_to_jiffies(500));
1161 rdata = cmnd->device->hostdata;
1162 if (!rdata)
1163 break;
1164 pnode = rdata->pnode;
1165 }
1166 if (!rdata || pnode->nlp_state != NLP_STE_MAPPED_NODE) {
1167 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1168 "0721 LUN Reset rport "
1169 "failure: msec x%x rdata x%p\n",
1170 jiffies_to_msecs(jiffies - later), rdata);
1171 return FAILED;
1178 } 1172 }
1179
1180 lpfc_cmd = lpfc_get_scsi_buf(phba); 1173 lpfc_cmd = lpfc_get_scsi_buf(phba);
1181 if (lpfc_cmd == NULL) 1174 if (lpfc_cmd == NULL)
1182 goto out; 1175 return FAILED;
1183
1184 lpfc_cmd->timeout = 60; 1176 lpfc_cmd->timeout = 60;
1185 lpfc_cmd->rdata = rdata; 1177 lpfc_cmd->rdata = rdata;
1186 1178
1187 ret = lpfc_scsi_prep_task_mgmt_cmd(vport, lpfc_cmd, cmnd->device->lun, 1179 status = lpfc_scsi_prep_task_mgmt_cmd(vport, lpfc_cmd,
1188 FCP_TARGET_RESET); 1180 cmnd->device->lun,
1189 if (!ret) 1181 FCP_TARGET_RESET);
1190 goto out_free_scsi_buf; 1182 if (!status) {
1191 1183 lpfc_release_scsi_buf(phba, lpfc_cmd);
1184 return FAILED;
1185 }
1192 iocbq = &lpfc_cmd->cur_iocbq; 1186 iocbq = &lpfc_cmd->cur_iocbq;
1193 1187
1194 /* get a buffer for this IOCB command response */ 1188 /* get a buffer for this IOCB command response */
1195 iocbqrsp = lpfc_sli_get_iocbq(phba); 1189 iocbqrsp = lpfc_sli_get_iocbq(phba);
1196 if (iocbqrsp == NULL) 1190 if (iocbqrsp == NULL) {
1197 goto out_free_scsi_buf; 1191 lpfc_release_scsi_buf(phba, lpfc_cmd);
1198 1192 return FAILED;
1193 }
1199 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, 1194 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
1200 "0703 Issue target reset to TGT %d LUN %d " 1195 "0703 Issue target reset to TGT %d LUN %d "
1201 "rpi x%x nlp_flag x%x\n", cmnd->device->id, 1196 "rpi x%x nlp_flag x%x\n", cmnd->device->id,
1202 cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag); 1197 cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag);
1203 iocb_status = lpfc_sli_issue_iocb_wait(phba, 1198 status = lpfc_sli_issue_iocb_wait(phba,
1204 &phba->sli.ring[phba->sli.fcp_ring], 1199 &phba->sli.ring[phba->sli.fcp_ring],
1205 iocbq, iocbqrsp, lpfc_cmd->timeout); 1200 iocbq, iocbqrsp, lpfc_cmd->timeout);
1206 1201 if (status == IOCB_TIMEDOUT) {
1207 if (iocb_status == IOCB_TIMEDOUT)
1208 iocbq->iocb_cmpl = lpfc_tskmgmt_def_cmpl; 1202 iocbq->iocb_cmpl = lpfc_tskmgmt_def_cmpl;
1209 1203 ret = TIMEOUT_ERROR;
1210 if (iocb_status == IOCB_SUCCESS) 1204 } else {
1211 ret = SUCCESS; 1205 if (status != IOCB_SUCCESS)
1212 else 1206 ret = FAILED;
1213 ret = iocb_status; 1207 lpfc_release_scsi_buf(phba, lpfc_cmd);
1214 1208 }
1215 cmd_result = iocbqrsp->iocb.un.ulpWord[4]; 1209 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1216 cmd_status = iocbqrsp->iocb.ulpStatus; 1210 "0713 SCSI layer issued device reset (%d, %d) "
1217 1211 "return x%x status x%x result x%x\n",
1212 cmnd->device->id, cmnd->device->lun, ret,
1213 iocbqrsp->iocb.ulpStatus,
1214 iocbqrsp->iocb.un.ulpWord[4]);
1218 lpfc_sli_release_iocbq(phba, iocbqrsp); 1215 lpfc_sli_release_iocbq(phba, iocbqrsp);
1219
1220 /*
1221 * All outstanding txcmplq I/Os should have been aborted by the device.
1222 * Unfortunately, some targets do not abide by this forcing the driver
1223 * to double check.
1224 */
1225 cnt = lpfc_sli_sum_iocb(vport, cmnd->device->id, cmnd->device->lun, 1216 cnt = lpfc_sli_sum_iocb(vport, cmnd->device->id, cmnd->device->lun,
1226 LPFC_CTX_LUN); 1217 LPFC_CTX_TGT);
1227 if (cnt) 1218 if (cnt)
1228 lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring], 1219 lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring],
1229 cmnd->device->id, cmnd->device->lun, 1220 cmnd->device->id, cmnd->device->lun,
1230 LPFC_CTX_LUN); 1221 LPFC_CTX_TGT);
1231 loopcnt = 0; 1222 later = msecs_to_jiffies(2 * vport->cfg_devloss_tmo * 1000) + jiffies;
1232 while(cnt) { 1223 while (time_after(later, jiffies) && cnt) {
1233 schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); 1224 schedule_timeout_uninterruptible(msecs_to_jiffies(20));
1234
1235 if (++loopcnt
1236 > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT)
1237 break;
1238
1239 cnt = lpfc_sli_sum_iocb(vport, cmnd->device->id, 1225 cnt = lpfc_sli_sum_iocb(vport, cmnd->device->id,
1240 cmnd->device->lun, LPFC_CTX_LUN); 1226 cmnd->device->lun, LPFC_CTX_TGT);
1241 } 1227 }
1242
1243 if (cnt) { 1228 if (cnt) {
1244 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, 1229 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1245 "0719 device reset I/O flush failure: " 1230 "0719 device reset I/O flush failure: "
1246 "cnt x%x\n", cnt); 1231 "cnt x%x\n", cnt);
1247 ret = FAILED; 1232 ret = FAILED;
1248 } 1233 }
1249
1250out_free_scsi_buf:
1251 if (iocb_status != IOCB_TIMEDOUT) {
1252 lpfc_release_scsi_buf(phba, lpfc_cmd);
1253 }
1254 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1255 "0713 SCSI layer issued device reset (%d, %d) "
1256 "return x%x status x%x result x%x\n",
1257 cmnd->device->id, cmnd->device->lun, ret,
1258 cmd_status, cmd_result);
1259out:
1260 return ret; 1234 return ret;
1261} 1235}
1262 1236
@@ -1268,19 +1242,12 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd)
1268 struct lpfc_hba *phba = vport->phba; 1242 struct lpfc_hba *phba = vport->phba;
1269 struct lpfc_nodelist *ndlp = NULL; 1243 struct lpfc_nodelist *ndlp = NULL;
1270 int match; 1244 int match;
1271 int ret = FAILED, i, err_count = 0; 1245 int ret = SUCCESS, status, i;
1272 int cnt, loopcnt; 1246 int cnt;
1273 struct lpfc_scsi_buf * lpfc_cmd; 1247 struct lpfc_scsi_buf * lpfc_cmd;
1248 unsigned long later;
1274 1249
1275 lpfc_block_error_handler(cmnd); 1250 lpfc_block_error_handler(cmnd);
1276
1277 lpfc_cmd = lpfc_get_scsi_buf(phba);
1278 if (lpfc_cmd == NULL)
1279 goto out;
1280
1281 /* The lpfc_cmd storage is reused. Set all loop invariants. */
1282 lpfc_cmd->timeout = 60;
1283
1284 /* 1251 /*
1285 * Since the driver manages a single bus device, reset all 1252 * Since the driver manages a single bus device, reset all
1286 * targets known to the driver. Should any target reset 1253 * targets known to the driver. Should any target reset
@@ -1294,7 +1261,7 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd)
1294 if (!NLP_CHK_NODE_ACT(ndlp)) 1261 if (!NLP_CHK_NODE_ACT(ndlp))
1295 continue; 1262 continue;
1296 if (ndlp->nlp_state == NLP_STE_MAPPED_NODE && 1263 if (ndlp->nlp_state == NLP_STE_MAPPED_NODE &&
1297 i == ndlp->nlp_sid && 1264 ndlp->nlp_sid == i &&
1298 ndlp->rport) { 1265 ndlp->rport) {
1299 match = 1; 1266 match = 1;
1300 break; 1267 break;
@@ -1303,27 +1270,22 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd)
1303 spin_unlock_irq(shost->host_lock); 1270 spin_unlock_irq(shost->host_lock);
1304 if (!match) 1271 if (!match)
1305 continue; 1272 continue;
1306 1273 lpfc_cmd = lpfc_get_scsi_buf(phba);
1307 ret = lpfc_scsi_tgt_reset(lpfc_cmd, vport, i, 1274 if (lpfc_cmd) {
1308 cmnd->device->lun, 1275 lpfc_cmd->timeout = 60;
1309 ndlp->rport->dd_data); 1276 status = lpfc_scsi_tgt_reset(lpfc_cmd, vport, i,
1310 if (ret != SUCCESS) { 1277 cmnd->device->lun,
1278 ndlp->rport->dd_data);
1279 if (status != TIMEOUT_ERROR)
1280 lpfc_release_scsi_buf(phba, lpfc_cmd);
1281 }
1282 if (!lpfc_cmd || status != SUCCESS) {
1311 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, 1283 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1312 "0700 Bus Reset on target %d failed\n", 1284 "0700 Bus Reset on target %d failed\n",
1313 i); 1285 i);
1314 err_count++; 1286 ret = FAILED;
1315 break;
1316 } 1287 }
1317 } 1288 }
1318
1319 if (ret != IOCB_TIMEDOUT)
1320 lpfc_release_scsi_buf(phba, lpfc_cmd);
1321
1322 if (err_count == 0)
1323 ret = SUCCESS;
1324 else
1325 ret = FAILED;
1326
1327 /* 1289 /*
1328 * All outstanding txcmplq I/Os should have been aborted by 1290 * All outstanding txcmplq I/Os should have been aborted by
1329 * the targets. Unfortunately, some targets do not abide by 1291 * the targets. Unfortunately, some targets do not abide by
@@ -1333,27 +1295,19 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd)
1333 if (cnt) 1295 if (cnt)
1334 lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring], 1296 lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring],
1335 0, 0, LPFC_CTX_HOST); 1297 0, 0, LPFC_CTX_HOST);
1336 loopcnt = 0; 1298 later = msecs_to_jiffies(2 * vport->cfg_devloss_tmo * 1000) + jiffies;
1337 while(cnt) { 1299 while (time_after(later, jiffies) && cnt) {
1338 schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); 1300 schedule_timeout_uninterruptible(msecs_to_jiffies(20));
1339
1340 if (++loopcnt
1341 > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT)
1342 break;
1343
1344 cnt = lpfc_sli_sum_iocb(vport, 0, 0, LPFC_CTX_HOST); 1301 cnt = lpfc_sli_sum_iocb(vport, 0, 0, LPFC_CTX_HOST);
1345 } 1302 }
1346
1347 if (cnt) { 1303 if (cnt) {
1348 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, 1304 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1349 "0715 Bus Reset I/O flush failure: " 1305 "0715 Bus Reset I/O flush failure: "
1350 "cnt x%x left x%x\n", cnt, i); 1306 "cnt x%x left x%x\n", cnt, i);
1351 ret = FAILED; 1307 ret = FAILED;
1352 } 1308 }
1353
1354 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, 1309 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1355 "0714 SCSI layer issued Bus Reset Data: x%x\n", ret); 1310 "0714 SCSI layer issued Bus Reset Data: x%x\n", ret);
1356out:
1357 return ret; 1311 return ret;
1358} 1312}
1359 1313