RDMA/irdma: Do not request 2-level PBLEs for CQ alloc
[ Upstream commit 8f7e2daa6336f9f4b6f8a4715a809674606df16b ]
When allocating PBLE's for a large CQ, it is possible
that a 2-level PBLE is returned which would cause the
CQ allocation to fail since 1-level is assumed and checked for.
Fix this by requesting a level one PBLE only.
Fixes: b48c24c2d7 ("RDMA/irdma: Implement device supported verb APIs")
Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Link: https://lore.kernel.org/r/20221115011701.1379-4-shiraz.saleem@intel.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c22ac849aa
commit
5cc70e78bb
@@ -2272,9 +2272,10 @@ static bool irdma_check_mr_contiguous(struct irdma_pble_alloc *palloc,
|
||||
* @rf: RDMA PCI function
|
||||
* @iwmr: mr pointer for this memory registration
|
||||
* @use_pbles: flag if to use pble's
|
||||
* @lvl_1_only: request only level 1 pble if true
|
||||
*/
|
||||
static int irdma_setup_pbles(struct irdma_pci_f *rf, struct irdma_mr *iwmr,
|
||||
bool use_pbles)
|
||||
bool use_pbles, bool lvl_1_only)
|
||||
{
|
||||
struct irdma_pbl *iwpbl = &iwmr->iwpbl;
|
||||
struct irdma_pble_alloc *palloc = &iwpbl->pble_alloc;
|
||||
@@ -2285,7 +2286,7 @@ static int irdma_setup_pbles(struct irdma_pci_f *rf, struct irdma_mr *iwmr,
|
||||
|
||||
if (use_pbles) {
|
||||
status = irdma_get_pble(rf->pble_rsrc, palloc, iwmr->page_cnt,
|
||||
false);
|
||||
lvl_1_only);
|
||||
if (status)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -2328,16 +2329,10 @@ static int irdma_handle_q_mem(struct irdma_device *iwdev,
|
||||
bool ret = true;
|
||||
|
||||
pg_size = iwmr->page_size;
|
||||
err = irdma_setup_pbles(iwdev->rf, iwmr, use_pbles);
|
||||
err = irdma_setup_pbles(iwdev->rf, iwmr, use_pbles, true);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (use_pbles && palloc->level != PBLE_LEVEL_1) {
|
||||
irdma_free_pble(iwdev->rf->pble_rsrc, palloc);
|
||||
iwpbl->pbl_allocated = false;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (use_pbles)
|
||||
arr = palloc->level1.addr;
|
||||
|
||||
@@ -2808,7 +2803,7 @@ static struct ib_mr *irdma_reg_user_mr(struct ib_pd *pd, u64 start, u64 len,
|
||||
case IRDMA_MEMREG_TYPE_MEM:
|
||||
use_pbles = (iwmr->page_cnt != 1);
|
||||
|
||||
err = irdma_setup_pbles(iwdev->rf, iwmr, use_pbles);
|
||||
err = irdma_setup_pbles(iwdev->rf, iwmr, use_pbles, false);
|
||||
if (err)
|
||||
goto error;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user