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.c24
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
43static 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