diff options
author | Steve Wise <swise@opengridcomputing.com> | 2008-01-21 15:42:11 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-01-25 17:17:45 -0500 |
commit | d08ca26ceec4dfbcfdbada4ad728db742ccaecd1 (patch) | |
tree | 15c79eb89ce17fcb2b96f1497e52c352d433b0ff | |
parent | 856b5925047d73a85557203d124d62c5eea1fbd3 (diff) |
RDMA/cxgb3: Fix page shift calculation in build_phys_page_list()
The existing logic incorrectly maps this buffer list:
0: addr 0x10001000, size 0x1000
1: addr 0x10002000, size 0x1000
To this bogus page list:
0: 0x10000000
1: 0x10002000
The shift calculation must also take into account the address of the
first entry masked by the page_mask as well as the last address+size
rounded up to the next page size.
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | drivers/infiniband/hw/cxgb3/iwch_mem.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/cxgb3/iwch_mem.c b/drivers/infiniband/hw/cxgb3/iwch_mem.c index a6c2c4ba29e6..73bfd1656f86 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_mem.c +++ b/drivers/infiniband/hw/cxgb3/iwch_mem.c | |||
@@ -122,6 +122,13 @@ int build_phys_page_list(struct ib_phys_buf *buffer_list, | |||
122 | *total_size += buffer_list[i].size; | 122 | *total_size += buffer_list[i].size; |
123 | if (i > 0) | 123 | if (i > 0) |
124 | mask |= buffer_list[i].addr; | 124 | mask |= buffer_list[i].addr; |
125 | else | ||
126 | mask |= buffer_list[i].addr & PAGE_MASK; | ||
127 | if (i != num_phys_buf - 1) | ||
128 | mask |= buffer_list[i].addr + buffer_list[i].size; | ||
129 | else | ||
130 | mask |= (buffer_list[i].addr + buffer_list[i].size + | ||
131 | PAGE_SIZE - 1) & PAGE_MASK; | ||
125 | } | 132 | } |
126 | 133 | ||
127 | if (*total_size > 0xFFFFFFFFULL) | 134 | if (*total_size > 0xFFFFFFFFULL) |