Commit 6ef982de authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

bnxt_en: Fix context memory allocation.

When allocating memory pages for context memory, if the last page table
should be fully populated, the current code will set nr_pages to 0 when
calling bnxt_alloc_ctx_mem_blk().  This will cause the last page table
to be completely blank and causing some RDMA failures.

Fix it by setting the last page table's nr_pages to the remainder only
if it is non-zero.

Fixes: 08fe9d18 ("bnxt_en: Add Level 2 context memory paging support.")
Reported-by: default avatarEric Davis <eric.davis@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0b815023
...@@ -6222,9 +6222,12 @@ static int bnxt_alloc_ctx_pg_tbls(struct bnxt *bp, ...@@ -6222,9 +6222,12 @@ static int bnxt_alloc_ctx_pg_tbls(struct bnxt *bp,
rmem->pg_tbl_map = ctx_pg->ctx_dma_arr[i]; rmem->pg_tbl_map = ctx_pg->ctx_dma_arr[i];
rmem->depth = 1; rmem->depth = 1;
rmem->nr_pages = MAX_CTX_PAGES; rmem->nr_pages = MAX_CTX_PAGES;
if (i == (nr_tbls - 1)) if (i == (nr_tbls - 1)) {
rmem->nr_pages = ctx_pg->nr_pages % int rem = ctx_pg->nr_pages % MAX_CTX_PAGES;
MAX_CTX_PAGES;
if (rem)
rmem->nr_pages = rem;
}
rc = bnxt_alloc_ctx_mem_blk(bp, pg_tbl); rc = bnxt_alloc_ctx_mem_blk(bp, pg_tbl);
if (rc) if (rc)
break; break;
......
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