Skip to content

Commit

Permalink
bnxt_en: Fix context memory allocation.
Browse files Browse the repository at this point in the history
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: 08fe9d1 ("bnxt_en: Add Level 2 context memory paging support.")
Reported-by: Eric Davis <eric.davis@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Michael Chan authored and David S. Miller committed Jan 12, 2019
1 parent 0b81502 commit 6ef982d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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->depth = 1;
rmem->nr_pages = MAX_CTX_PAGES;
if (i == (nr_tbls - 1))
rmem->nr_pages = ctx_pg->nr_pages %
MAX_CTX_PAGES;
if (i == (nr_tbls - 1)) {
int rem = ctx_pg->nr_pages % MAX_CTX_PAGES;

if (rem)
rmem->nr_pages = rem;
}
rc = bnxt_alloc_ctx_mem_blk(bp, pg_tbl);
if (rc)
break;
Expand Down

0 comments on commit 6ef982d

Please sign in to comment.