Commit 82d416ff authored by Bryan Rosenburg's avatar Bryan Rosenburg Committed by Roland Dreier

RDMA/cxgb3: Fix shift calc in build_phys_page_list() for 1-entry page lists

A single entry (addr 0x10001000, size 0x2000) will get converted to
page address 0x10000000 with a page size of 0x4000.  The code as it
stands doesn't address the single buffer case, but in fact it allows
the subsequent single-buffer special case to be eliminated entirely.
Because the mask now includes the (page adjusted) starting and ending
addresses, the general case works for the single buffer case as well.
Signed-off-by: default avatarBryan Rosenburg <rosnbrg@us.ibm.com>
Acked-by: default avatarSteve Wise <swise@opengridcomputing.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent bfa274e2
...@@ -136,14 +136,8 @@ int build_phys_page_list(struct ib_phys_buf *buffer_list, ...@@ -136,14 +136,8 @@ int build_phys_page_list(struct ib_phys_buf *buffer_list,
/* Find largest page shift we can use to cover buffers */ /* Find largest page shift we can use to cover buffers */
for (*shift = PAGE_SHIFT; *shift < 27; ++(*shift)) for (*shift = PAGE_SHIFT; *shift < 27; ++(*shift))
if (num_phys_buf > 1) { if ((1ULL << *shift) & mask)
if ((1ULL << *shift) & mask) break;
break;
} else
if (1ULL << *shift >=
buffer_list[0].size +
(buffer_list[0].addr & ((1ULL << *shift) - 1)))
break;
buffer_list[0].size += buffer_list[0].addr & ((1ULL << *shift) - 1); buffer_list[0].size += buffer_list[0].addr & ((1ULL << *shift) - 1);
buffer_list[0].addr &= ~0ull << *shift; buffer_list[0].addr &= ~0ull << *shift;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment