diff options
author | Jing Huang <huangj@brocade.com> | 2010-03-19 14:06:05 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-04-11 10:24:17 -0400 |
commit | 2eba0d4c000777ce43012d7fda806b075f6cf877 (patch) | |
tree | fdebad0f55465301bfcbd4f119311f63d358c353 /drivers/scsi/bfa/bfa_ioim.c | |
parent | b504293fe9dc42917a919044f2b672fb361329d0 (diff) |
[SCSI] bfa: fix the issue of not handling scsi_cmnd sg chaining case
Currently the driver doesn't take into consideraion of possible sg chaining
when it walks through the sg list. This is fixed by using the sg_next()
which automatically handles the chaining case. Obosolete code is removed
as a result of this change.
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/bfa/bfa_ioim.c')
-rw-r--r-- | drivers/scsi/bfa/bfa_ioim.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/scsi/bfa/bfa_ioim.c b/drivers/scsi/bfa/bfa_ioim.c index 5b107abe46e5..8a1be201d29b 100644 --- a/drivers/scsi/bfa/bfa_ioim.c +++ b/drivers/scsi/bfa/bfa_ioim.c | |||
@@ -731,6 +731,9 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) | |||
731 | static struct fcp_cmnd_s cmnd_z0 = { 0 }; | 731 | static struct fcp_cmnd_s cmnd_z0 = { 0 }; |
732 | struct bfi_sge_s *sge; | 732 | struct bfi_sge_s *sge; |
733 | u32 pgdlen = 0; | 733 | u32 pgdlen = 0; |
734 | u64 addr; | ||
735 | struct scatterlist *sg; | ||
736 | struct scsi_cmnd *cmnd = (struct scsi_cmnd *) ioim->dio; | ||
734 | 737 | ||
735 | /** | 738 | /** |
736 | * check for room in queue to send request now | 739 | * check for room in queue to send request now |
@@ -754,8 +757,10 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) | |||
754 | */ | 757 | */ |
755 | sge = &m->sges[0]; | 758 | sge = &m->sges[0]; |
756 | if (ioim->nsges) { | 759 | if (ioim->nsges) { |
757 | sge->sga = bfa_cb_ioim_get_sgaddr(ioim->dio, 0); | 760 | sg = (struct scatterlist *)scsi_sglist(cmnd); |
758 | pgdlen = bfa_cb_ioim_get_sglen(ioim->dio, 0); | 761 | addr = (u64) sg_dma_address(sg); |
762 | sge->sga = *(union bfi_addr_u *) &addr; | ||
763 | pgdlen = sg_dma_len(sg); | ||
759 | sge->sg_len = pgdlen; | 764 | sge->sg_len = pgdlen; |
760 | sge->flags = (ioim->nsges > BFI_SGE_INLINE) ? | 765 | sge->flags = (ioim->nsges > BFI_SGE_INLINE) ? |
761 | BFI_SGE_DATA_CPL : BFI_SGE_DATA_LAST; | 766 | BFI_SGE_DATA_CPL : BFI_SGE_DATA_LAST; |
@@ -868,10 +873,16 @@ bfa_ioim_sgpg_setup(struct bfa_ioim_s *ioim) | |||
868 | struct bfi_sge_s *sge; | 873 | struct bfi_sge_s *sge; |
869 | struct bfa_sgpg_s *sgpg; | 874 | struct bfa_sgpg_s *sgpg; |
870 | u32 pgcumsz; | 875 | u32 pgcumsz; |
876 | u64 addr; | ||
877 | struct scatterlist *sg; | ||
878 | struct scsi_cmnd *cmnd = (struct scsi_cmnd *) ioim->dio; | ||
871 | 879 | ||
872 | sgeid = BFI_SGE_INLINE; | 880 | sgeid = BFI_SGE_INLINE; |
873 | ioim->sgpg = sgpg = bfa_q_first(&ioim->sgpg_q); | 881 | ioim->sgpg = sgpg = bfa_q_first(&ioim->sgpg_q); |
874 | 882 | ||
883 | sg = scsi_sglist(cmnd); | ||
884 | sg = sg_next(sg); | ||
885 | |||
875 | do { | 886 | do { |
876 | sge = sgpg->sgpg->sges; | 887 | sge = sgpg->sgpg->sges; |
877 | nsges = ioim->nsges - sgeid; | 888 | nsges = ioim->nsges - sgeid; |
@@ -879,9 +890,10 @@ bfa_ioim_sgpg_setup(struct bfa_ioim_s *ioim) | |||
879 | nsges = BFI_SGPG_DATA_SGES; | 890 | nsges = BFI_SGPG_DATA_SGES; |
880 | 891 | ||
881 | pgcumsz = 0; | 892 | pgcumsz = 0; |
882 | for (i = 0; i < nsges; i++, sge++, sgeid++) { | 893 | for (i = 0; i < nsges; i++, sge++, sgeid++, sg = sg_next(sg)) { |
883 | sge->sga = bfa_cb_ioim_get_sgaddr(ioim->dio, sgeid); | 894 | addr = (u64) sg_dma_address(sg); |
884 | sge->sg_len = bfa_cb_ioim_get_sglen(ioim->dio, sgeid); | 895 | sge->sga = *(union bfi_addr_u *) &addr; |
896 | sge->sg_len = sg_dma_len(sg); | ||
885 | pgcumsz += sge->sg_len; | 897 | pgcumsz += sge->sg_len; |
886 | 898 | ||
887 | /** | 899 | /** |