Skip to content

Commit

Permalink
IB/iser: Add missing counter increment in iser_data_buf_aligned_len()
Browse files Browse the repository at this point in the history
While adding sg chaining support to iSER, a "for" loop was replaced
with a "for_each_sg" loop. The "for" loop included the incrementation
of 2 variables. Only one of them is incremented in the current
"for_each_sg" loop. This caused iSER to think that all data is
unaligned, and all data was copied to aligned buffers.

This patch increments the missing counter inside the "for_each_sg"
loop whenever necessary.

Signed-off-by: Erez Zilber <erezz@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Erez Zilber authored and Roland Dreier committed Nov 24, 2007
1 parent 3fe2ed3 commit a316b79
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/infiniband/ulp/iser/iser_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,15 @@ static unsigned int iser_data_buf_aligned_len(struct iser_data_buf *data,
if (i + 1 < data->dma_nents) {
next_addr = ib_sg_dma_address(ibdev, sg_next(sg));
/* are i, i+1 fragments of the same page? */
if (end_addr == next_addr)
if (end_addr == next_addr) {
cnt++;
continue;
else if (!IS_4K_ALIGNED(end_addr)) {
} else if (!IS_4K_ALIGNED(end_addr)) {
ret_len = cnt + 1;
break;
}
}
cnt++;
}
if (i == data->dma_nents)
ret_len = cnt; /* loop ended */
Expand Down

0 comments on commit a316b79

Please sign in to comment.