Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 32731
b: refs/heads/master
c: bcf4dbf
h: refs/heads/master
i:
  32729: 8137c33
  32727: 5dcc1a7
v: v3
  • Loading branch information
James Smart authored and James Bottomley committed Jul 9, 2006
1 parent 882e0e7 commit 155d647
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9279565046f39f3ab338818c9923a23b9f25be5f
refs/heads/master: bcf4dbfaf38502d3919e0601c06afac7d5e42685
40 changes: 24 additions & 16 deletions trunk/drivers/scsi/lpfc/lpfc_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,6 @@ static void
lpfc_release_scsi_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * psb)
{
unsigned long iflag = 0;
/*
* There are only two special cases to consider. (1) the scsi command
* requested scatter-gather usage or (2) the scsi command allocated
* a request buffer, but did not request use_sg. There is a third
* case, but it does not require resource deallocation.
*/
if ((psb->seg_cnt > 0) && (psb->pCmd->use_sg)) {
dma_unmap_sg(&phba->pcidev->dev, psb->pCmd->request_buffer,
psb->seg_cnt, psb->pCmd->sc_data_direction);
} else {
if ((psb->nonsg_phys) && (psb->pCmd->request_bufflen)) {
dma_unmap_single(&phba->pcidev->dev, psb->nonsg_phys,
psb->pCmd->request_bufflen,
psb->pCmd->sc_data_direction);
}
}

spin_lock_irqsave(&phba->scsi_buf_list_lock, iflag);
psb->pCmd = NULL;
Expand Down Expand Up @@ -281,6 +265,27 @@ lpfc_scsi_prep_dma_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * lpfc_cmd)
return 0;
}

static void
lpfc_scsi_unprep_dma_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * psb)
{
/*
* There are only two special cases to consider. (1) the scsi command
* requested scatter-gather usage or (2) the scsi command allocated
* a request buffer, but did not request use_sg. There is a third
* case, but it does not require resource deallocation.
*/
if ((psb->seg_cnt > 0) && (psb->pCmd->use_sg)) {
dma_unmap_sg(&phba->pcidev->dev, psb->pCmd->request_buffer,
psb->seg_cnt, psb->pCmd->sc_data_direction);
} else {
if ((psb->nonsg_phys) && (psb->pCmd->request_bufflen)) {
dma_unmap_single(&phba->pcidev->dev, psb->nonsg_phys,
psb->pCmd->request_bufflen,
psb->pCmd->sc_data_direction);
}
}
}

static void
lpfc_handle_fcp_err(struct lpfc_scsi_buf *lpfc_cmd)
{
Expand Down Expand Up @@ -454,6 +459,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
cmd->scsi_done(cmd);

if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) {
lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd);
lpfc_release_scsi_buf(phba, lpfc_cmd);
return;
}
Expand Down Expand Up @@ -511,6 +517,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
}
}

lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd);
lpfc_release_scsi_buf(phba, lpfc_cmd);
}

Expand Down Expand Up @@ -822,6 +829,7 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
return 0;

out_host_busy_free_buf:
lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd);
lpfc_release_scsi_buf(phba, lpfc_cmd);
out_host_busy:
return SCSI_MLQUEUE_HOST_BUSY;
Expand Down

0 comments on commit 155d647

Please sign in to comment.