[ofa-general] page mask calculation in mthca mthca_reg_phys_mr
Liang Zhen
Zhen.Liang at Sun.COM
Tue Jan 29 04:37:24 PST 2008
Hi,
I think there is a similar bug in mthca as in cxgb3
(http://lists.openfabrics.org/pipermail/general/2008-January/045246.html),
in mthca_reg_phys_mr(), mask is built like this way:
for (i = 0; i < num_phys_buf; ++i) {
if (i != 0)
mask |= buffer_list[i].addr;
if (i != num_phys_buf - 1)
mask |= buffer_list[i].addr + buffer_list[i].size;
total_size += buffer_list[i].size;
}
It can get wrong mask as start address of the first fragment and end
address of the last fragment are ignored, here is some example of this:
INPUT:
ipb[0].addr = 0x10002000;
ipb[0].size = 0x4000;
ipb[1].addr = 0x10006000;
ipb[1].size = 0x1000;
OUTPUT:
shift 13 npages 3
page_list[0] = 10002000
page_list[1] = 10004000
page_list[2] = 10006000
2) --------------------------------
INPUT:
ipb[0].addr = 0x10001000;
ipb[0].size = 0x4000;
ipb[1].addr = 0x10006000;
ipb[1].size = 0x1000;
OUTPUT:
shift 12 npages 5
page_list[0] = 10001000
page_list[1] = 10002000
page_list[2] = 10003000
page_list[3] = 10004000
page_list[4] = 10006000
Regards
Liang
More information about the general
mailing list