Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <chandramohan.akula@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Link: https://patch.msgid.link/1724945645-14989-3-git-send-email-selvin.xavier@broadcom.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>

authored by

Chandramohan Akula and committed by
Leon Romanovsky
b4207630 640c2cf8

+7 -11
+7 -11
drivers/infiniband/hw/bnxt_re/ib_verbs.c
··· 4519 4519 struct bnxt_re_ucontext *uctx; 4520 4520 struct ib_ucontext *ib_uctx; 4521 4521 struct bnxt_re_dev *rdev; 4522 + u32 length = PAGE_SIZE; 4522 4523 struct bnxt_re_cq *cq; 4523 4524 u64 mem_offset; 4525 + u32 offset = 0; 4524 4526 u64 addr = 0; 4525 - u32 length; 4526 - u32 offset; 4527 - u32 cq_id; 4527 + u32 res_id; 4528 4528 int err; 4529 4529 4530 4530 ib_uctx = ib_uverbs_get_ucontext(attrs); ··· 4537 4537 4538 4538 uctx = container_of(ib_uctx, struct bnxt_re_ucontext, ib_uctx); 4539 4539 rdev = uctx->rdev; 4540 + err = uverbs_copy_from(&res_id, attrs, BNXT_RE_TOGGLE_MEM_RES_ID); 4541 + if (err) 4542 + return err; 4540 4543 4541 4544 switch (res_type) { 4542 4545 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); 4548 4547 if (!cq) 4549 4548 return -EINVAL; 4550 4549 4551 - length = PAGE_SIZE; 4552 4550 addr = (u64)cq->uctx_cq_page; 4553 - mmap_flag = BNXT_RE_MMAP_TOGGLE_PAGE; 4554 - offset = 0; 4555 4551 break; 4556 4552 case BNXT_RE_SRQ_TOGGLE_MEM: 4557 4553 break;