mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-19 03:31:26 +00:00
ib_srpt: Process chained sg lists correctly (merge r4235 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4236 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -2758,7 +2758,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
|
||||
struct srpt_send_ioctx *ioctx,
|
||||
struct scst_cmd *scmnd)
|
||||
{
|
||||
struct scatterlist *sg;
|
||||
struct scatterlist *sg, *cur_sg;
|
||||
int sg_cnt;
|
||||
scst_data_direction dir;
|
||||
struct rdma_iu *riu;
|
||||
@@ -2833,7 +2833,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
|
||||
* we need to allocate extra rdma_iu to carry extra #ib_sge in
|
||||
* another rdma wr
|
||||
*/
|
||||
for (i = 0, j = 0;
|
||||
for (i = 0, j = 0, cur_sg = sg;
|
||||
j < count && i < ioctx->n_rbuf && tsize > 0; ++i, ++riu, ++db) {
|
||||
rsize = be32_to_cpu(db->len);
|
||||
raddr = be64_to_cpu(db->va);
|
||||
@@ -2852,8 +2852,10 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
|
||||
|
||||
if (tsize > 0) {
|
||||
++j;
|
||||
if (j < count)
|
||||
dma_len = sg_dma_len(&sg[j]);
|
||||
if (j < count) {
|
||||
cur_sg = sg_next(cur_sg);
|
||||
dma_len = sg_dma_len(cur_sg);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tsize -= rsize;
|
||||
@@ -2887,7 +2889,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
|
||||
dma_addr = sg_dma_address(&sg[0]);
|
||||
|
||||
/* this second loop is really mapped sg_addres to rdma_iu->ib_sge */
|
||||
for (i = 0, j = 0;
|
||||
for (i = 0, j = 0, cur_sg = sg;
|
||||
j < count && i < ioctx->n_rbuf && tsize > 0; ++i, ++riu, ++db) {
|
||||
rsize = be32_to_cpu(db->len);
|
||||
sge = riu->sge;
|
||||
@@ -2906,9 +2908,10 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
|
||||
if (tsize > 0) {
|
||||
++j;
|
||||
if (j < count) {
|
||||
dma_len = sg_dma_len(&sg[j]);
|
||||
cur_sg = sg_next(cur_sg);
|
||||
dma_len = sg_dma_len(cur_sg);
|
||||
dma_addr =
|
||||
sg_dma_address(&sg[j]);
|
||||
sg_dma_address(cur_sg);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user