mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
RDMA/umem: Fix ib_umem_find_best_pgsz()
commit36798d5ae1upstream. Except for the last entry, the ending iova alignment sets the maximum possible page size as the low bits of the iova must be zero when starting the next chunk. Fixes:4a35339958("RDMA/umem: Add API to find best driver supported page size in an MR") Link: https://lore.kernel.org/r/20200128135612.174820-1-leon@kernel.org Signed-off-by: Artemy Kovalyov <artemyko@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Tested-by: Gal Pressman <galpress@amazon.com> Reviewed-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
56b22525ab
commit
21702236f3
@@ -166,10 +166,13 @@ unsigned long ib_umem_find_best_pgsz(struct ib_umem *umem,
|
||||
* for any address.
|
||||
*/
|
||||
mask |= (sg_dma_address(sg) + pgoff) ^ va;
|
||||
if (i && i != (umem->nmap - 1))
|
||||
/* restrict by length as well for interior SGEs */
|
||||
mask |= sg_dma_len(sg);
|
||||
va += sg_dma_len(sg) - pgoff;
|
||||
/* Except for the last entry, the ending iova alignment sets
|
||||
* the maximum possible page size as the low bits of the iova
|
||||
* must be zero when starting the next chunk.
|
||||
*/
|
||||
if (i != (umem->nmap - 1))
|
||||
mask |= va;
|
||||
pgoff = 0;
|
||||
}
|
||||
best_pg_bit = rdma_find_pg_bit(mask, pgsz_bitmap);
|
||||
|
||||
Reference in New Issue
Block a user