[SCSI] lpfc: fix NPIV mapping problems
This patch uses dma_map_sg with phba->pcidev->dev instead of scsi_dma_map. scsi_dma_map doesn't work for NPIV since fc_vport->dev isn't fully initialized. check_addr() in arch/x86_64/kernel/pci-nommu.c leads to the crash since dev->dma_mask is NULL. For more details: http://marc.info/?l=linux-scsi&m=118312448030633&w=2 Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: James Smart <James.Smart@Emulex.Com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
parent
d4bd4cd063
commit
c59fd9ebc4
1 changed files with 7 additions and 4 deletions
|
@ -332,8 +332,7 @@ lpfc_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
|
||||||
* data bde entry.
|
* data bde entry.
|
||||||
*/
|
*/
|
||||||
bpl += 2;
|
bpl += 2;
|
||||||
nseg = scsi_dma_map(scsi_cmnd);
|
if (scsi_sg_count(scsi_cmnd)) {
|
||||||
if (nseg > 0) {
|
|
||||||
/*
|
/*
|
||||||
* The driver stores the segment count returned from pci_map_sg
|
* The driver stores the segment count returned from pci_map_sg
|
||||||
* because this a count of dma-mappings used to map the use_sg
|
* because this a count of dma-mappings used to map the use_sg
|
||||||
|
@ -341,6 +340,11 @@ lpfc_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
|
||||||
* architectures that implement an IOMMU.
|
* architectures that implement an IOMMU.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
nseg = dma_map_sg(&phba->pcidev->dev, scsi_sglist(scsi_cmnd),
|
||||||
|
scsi_sg_count(scsi_cmnd), datadir);
|
||||||
|
if (unlikely(!nseg))
|
||||||
|
return 1;
|
||||||
|
|
||||||
lpfc_cmd->seg_cnt = nseg;
|
lpfc_cmd->seg_cnt = nseg;
|
||||||
if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) {
|
if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) {
|
||||||
printk(KERN_ERR "%s: Too many sg segments from "
|
printk(KERN_ERR "%s: Too many sg segments from "
|
||||||
|
@ -370,8 +374,7 @@ lpfc_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
|
||||||
bpl++;
|
bpl++;
|
||||||
num_bde++;
|
num_bde++;
|
||||||
}
|
}
|
||||||
} else if (nseg < 0)
|
}
|
||||||
return 1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finish initializing those IOCB fields that are dependent on the
|
* Finish initializing those IOCB fields that are dependent on the
|
||||||
|
|
Reference in a new issue