mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 12:15:15 +07:00
RDMA/rxe: Use for_each_sg_page iterator on umem SGL
The driver walks the umem SGL assuming a 1:1 mapping between SGE and system page. Update to use the for_each_sg_page iterator to get individual pages contained in the SGEs. This is a pre-requisite before adding page combining into SGEs while building the scatter table in IB core. Additionally, purge umem->page_shift usage in the driver as its only relevant for ODP MRs. Use system page size and shift instead. Signed-off-by: Shiraz, Saleem <shiraz.saleem@intel.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
be8c456abf
commit
8317d6cdc1
@ -162,11 +162,10 @@ int rxe_mem_init_user(struct rxe_pd *pd, u64 start,
|
|||||||
u64 length, u64 iova, int access, struct ib_udata *udata,
|
u64 length, u64 iova, int access, struct ib_udata *udata,
|
||||||
struct rxe_mem *mem)
|
struct rxe_mem *mem)
|
||||||
{
|
{
|
||||||
int entry;
|
|
||||||
struct rxe_map **map;
|
struct rxe_map **map;
|
||||||
struct rxe_phys_buf *buf = NULL;
|
struct rxe_phys_buf *buf = NULL;
|
||||||
struct ib_umem *umem;
|
struct ib_umem *umem;
|
||||||
struct scatterlist *sg;
|
struct sg_page_iter sg_iter;
|
||||||
int num_buf;
|
int num_buf;
|
||||||
void *vaddr;
|
void *vaddr;
|
||||||
int err;
|
int err;
|
||||||
@ -191,16 +190,16 @@ int rxe_mem_init_user(struct rxe_pd *pd, u64 start,
|
|||||||
goto err1;
|
goto err1;
|
||||||
}
|
}
|
||||||
|
|
||||||
mem->page_shift = umem->page_shift;
|
mem->page_shift = PAGE_SHIFT;
|
||||||
mem->page_mask = BIT(umem->page_shift) - 1;
|
mem->page_mask = PAGE_SIZE - 1;
|
||||||
|
|
||||||
num_buf = 0;
|
num_buf = 0;
|
||||||
map = mem->map;
|
map = mem->map;
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
buf = map[0]->buf;
|
buf = map[0]->buf;
|
||||||
|
|
||||||
for_each_sg(umem->sg_head.sgl, sg, umem->nmap, entry) {
|
for_each_sg_page(umem->sg_head.sgl, &sg_iter, umem->nmap, 0) {
|
||||||
vaddr = page_address(sg_page(sg));
|
vaddr = page_address(sg_page_iter_page(&sg_iter));
|
||||||
if (!vaddr) {
|
if (!vaddr) {
|
||||||
pr_warn("null vaddr\n");
|
pr_warn("null vaddr\n");
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
@ -208,7 +207,7 @@ int rxe_mem_init_user(struct rxe_pd *pd, u64 start,
|
|||||||
}
|
}
|
||||||
|
|
||||||
buf->addr = (uintptr_t)vaddr;
|
buf->addr = (uintptr_t)vaddr;
|
||||||
buf->size = BIT(umem->page_shift);
|
buf->size = PAGE_SIZE;
|
||||||
num_buf++;
|
num_buf++;
|
||||||
buf++;
|
buf++;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user