Skip to content

Commit b420763

Browse files
chandramohan-akularleon
authored andcommitted
RDMA/bnxt_re: Refactor the BNXT_RE_METHOD_GET_TOGGLE_MEM method
Refactor the code in this function to have common code. This is used in subsequent patches. Signed-off-by: Chandramohan Akula <[email protected]> Signed-off-by: Selvin Xavier <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 640c2cf commit b420763

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

drivers/infiniband/hw/bnxt_re/ib_verbs.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4519,12 +4519,12 @@ static int UVERBS_HANDLER(BNXT_RE_METHOD_GET_TOGGLE_MEM)(struct uverbs_attr_bund
45194519
struct bnxt_re_ucontext *uctx;
45204520
struct ib_ucontext *ib_uctx;
45214521
struct bnxt_re_dev *rdev;
4522+
u32 length = PAGE_SIZE;
45224523
struct bnxt_re_cq *cq;
45234524
u64 mem_offset;
4525+
u32 offset = 0;
45244526
u64 addr = 0;
4525-
u32 length;
4526-
u32 offset;
4527-
u32 cq_id;
4527+
u32 res_id;
45284528
int err;
45294529

45304530
ib_uctx = ib_uverbs_get_ucontext(attrs);
@@ -4537,21 +4537,17 @@ static int UVERBS_HANDLER(BNXT_RE_METHOD_GET_TOGGLE_MEM)(struct uverbs_attr_bund
45374537

45384538
uctx = container_of(ib_uctx, struct bnxt_re_ucontext, ib_uctx);
45394539
rdev = uctx->rdev;
4540+
err = uverbs_copy_from(&res_id, attrs, BNXT_RE_TOGGLE_MEM_RES_ID);
4541+
if (err)
4542+
return err;
45404543

45414544
switch (res_type) {
45424545
case BNXT_RE_CQ_TOGGLE_MEM:
4543-
err = uverbs_copy_from(&cq_id, attrs, BNXT_RE_TOGGLE_MEM_RES_ID);
4544-
if (err)
4545-
return err;
4546-
4547-
cq = bnxt_re_search_for_cq(rdev, cq_id);
4546+
cq = bnxt_re_search_for_cq(rdev, res_id);
45484547
if (!cq)
45494548
return -EINVAL;
45504549

4551-
length = PAGE_SIZE;
45524550
addr = (u64)cq->uctx_cq_page;
4553-
mmap_flag = BNXT_RE_MMAP_TOGGLE_PAGE;
4554-
offset = 0;
45554551
break;
45564552
case BNXT_RE_SRQ_TOGGLE_MEM:
45574553
break;

0 commit comments

Comments
 (0)