diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-08 05:39:55 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-08 05:39:55 -0400 |
commit | c324b44c34050cf2a9b58830e11c974806bd85d8 (patch) | |
tree | 3ac45a783221283925cd698334a8f5e7dd4c1df8 /drivers/scsi/lpfc/lpfc_scsi.c | |
parent | 2fcf522509cceea524b6e7ece8fd6759b682175a (diff) | |
parent | caf39e87cc1182f7dae84eefc43ca14d54c78ef9 (diff) |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_scsi.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 17e4974d4445..b5ad1871d34b 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -40,11 +40,6 @@ | |||
40 | #define LPFC_RESET_WAIT 2 | 40 | #define LPFC_RESET_WAIT 2 |
41 | #define LPFC_ABORT_WAIT 2 | 41 | #define LPFC_ABORT_WAIT 2 |
42 | 42 | ||
43 | static inline void lpfc_put_lun(struct fcp_cmnd *fcmd, unsigned int lun) | ||
44 | { | ||
45 | fcmd->fcpLunLsl = 0; | ||
46 | fcmd->fcpLunMsl = swab16((uint16_t)lun); | ||
47 | } | ||
48 | 43 | ||
49 | /* | 44 | /* |
50 | * This routine allocates a scsi buffer, which contains all the necessary | 45 | * This routine allocates a scsi buffer, which contains all the necessary |
@@ -238,6 +233,8 @@ lpfc_scsi_prep_dma_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * lpfc_cmd) | |||
238 | bpl->tus.f.bdeSize = scsi_cmnd->request_bufflen; | 233 | bpl->tus.f.bdeSize = scsi_cmnd->request_bufflen; |
239 | if (datadir == DMA_TO_DEVICE) | 234 | if (datadir == DMA_TO_DEVICE) |
240 | bpl->tus.f.bdeFlags = 0; | 235 | bpl->tus.f.bdeFlags = 0; |
236 | else | ||
237 | bpl->tus.f.bdeFlags = BUFF_USE_RCV; | ||
241 | bpl->tus.w = le32_to_cpu(bpl->tus.w); | 238 | bpl->tus.w = le32_to_cpu(bpl->tus.w); |
242 | num_bde = 1; | 239 | num_bde = 1; |
243 | bpl++; | 240 | bpl++; |
@@ -245,8 +242,11 @@ lpfc_scsi_prep_dma_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * lpfc_cmd) | |||
245 | 242 | ||
246 | /* | 243 | /* |
247 | * Finish initializing those IOCB fields that are dependent on the | 244 | * Finish initializing those IOCB fields that are dependent on the |
248 | * scsi_cmnd request_buffer | 245 | * scsi_cmnd request_buffer. Note that the bdeSize is explicitly |
246 | * reinitialized since all iocb memory resources are used many times | ||
247 | * for transmit, receive, and continuation bpl's. | ||
249 | */ | 248 | */ |
249 | iocb_cmd->un.fcpi64.bdl.bdeSize = (2 * sizeof (struct ulp_bde64)); | ||
250 | iocb_cmd->un.fcpi64.bdl.bdeSize += | 250 | iocb_cmd->un.fcpi64.bdl.bdeSize += |
251 | (num_bde * sizeof (struct ulp_bde64)); | 251 | (num_bde * sizeof (struct ulp_bde64)); |
252 | iocb_cmd->ulpBdeCount = 1; | 252 | iocb_cmd->ulpBdeCount = 1; |
@@ -445,8 +445,11 @@ lpfc_scsi_prep_cmnd(struct lpfc_hba * phba, struct lpfc_scsi_buf * lpfc_cmd, | |||
445 | int datadir = scsi_cmnd->sc_data_direction; | 445 | int datadir = scsi_cmnd->sc_data_direction; |
446 | 446 | ||
447 | lpfc_cmd->fcp_rsp->rspSnsLen = 0; | 447 | lpfc_cmd->fcp_rsp->rspSnsLen = 0; |
448 | /* clear task management bits */ | ||
449 | lpfc_cmd->fcp_cmnd->fcpCntl2 = 0; | ||
448 | 450 | ||
449 | lpfc_put_lun(lpfc_cmd->fcp_cmnd, lpfc_cmd->pCmd->device->lun); | 451 | int_to_scsilun(lpfc_cmd->pCmd->device->lun, |
452 | &lpfc_cmd->fcp_cmnd->fcp_lun); | ||
450 | 453 | ||
451 | memcpy(&fcp_cmnd->fcpCdb[0], scsi_cmnd->cmnd, 16); | 454 | memcpy(&fcp_cmnd->fcpCdb[0], scsi_cmnd->cmnd, 16); |
452 | 455 | ||
@@ -545,7 +548,8 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_hba *phba, | |||
545 | piocb = &piocbq->iocb; | 548 | piocb = &piocbq->iocb; |
546 | 549 | ||
547 | fcp_cmnd = lpfc_cmd->fcp_cmnd; | 550 | fcp_cmnd = lpfc_cmd->fcp_cmnd; |
548 | lpfc_put_lun(lpfc_cmd->fcp_cmnd, lpfc_cmd->pCmd->device->lun); | 551 | int_to_scsilun(lpfc_cmd->pCmd->device->lun, |
552 | &lpfc_cmd->fcp_cmnd->fcp_lun); | ||
549 | fcp_cmnd->fcpCntl2 = task_mgmt_cmd; | 553 | fcp_cmnd->fcpCntl2 = task_mgmt_cmd; |
550 | 554 | ||
551 | piocb->ulpCommand = CMD_FCP_ICMND64_CR; | 555 | piocb->ulpCommand = CMD_FCP_ICMND64_CR; |
@@ -746,6 +750,10 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
746 | cmnd->result = ScsiResult(DID_NO_CONNECT, 0); | 750 | cmnd->result = ScsiResult(DID_NO_CONNECT, 0); |
747 | goto out_fail_command; | 751 | goto out_fail_command; |
748 | } | 752 | } |
753 | else if (ndlp->nlp_state == NLP_STE_NPR_NODE) { | ||
754 | cmnd->result = ScsiResult(DID_BUS_BUSY, 0); | ||
755 | goto out_fail_command; | ||
756 | } | ||
749 | /* | 757 | /* |
750 | * The device is most likely recovered and the driver | 758 | * The device is most likely recovered and the driver |
751 | * needs a bit more time to finish. Ask the midlayer | 759 | * needs a bit more time to finish. Ask the midlayer |