mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
RDMA/irdma: Add irdma_cq fields to track pbl allocations
These fields will be used in a subsequent commit which adds refcounting to user CQ MRs. Signed-off-by: Jacob Moroni <jmoroni@google.com> Link: https://patch.msgid.link/20260618201458.875740-4-jmoroni@google.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
parent
a7d0a6b582
commit
971e99623e
|
|
@ -2129,6 +2129,11 @@ static int irdma_resize_cq(struct ib_cq *ibcq, unsigned int entries,
|
|||
goto error;
|
||||
|
||||
spin_lock_irqsave(&iwcq->lock, flags);
|
||||
if (udata)
|
||||
/* Only update if the resize was successful. Otherwise, HW is
|
||||
* still pointing to the old PBL.
|
||||
*/
|
||||
iwcq->iwpbl = iwpbl_buf;
|
||||
if (cq_buf) {
|
||||
cq_buf->kmem_buf = iwcq->kmem;
|
||||
cq_buf->hw = dev->hw;
|
||||
|
|
@ -2499,6 +2504,8 @@ static int irdma_create_cq(struct ib_cq *ibcq,
|
|||
INIT_LIST_HEAD(&iwcq->resize_list);
|
||||
INIT_LIST_HEAD(&iwcq->cmpl_generated);
|
||||
iwcq->cq_num = cq_num;
|
||||
iwcq->iwpbl = NULL;
|
||||
iwcq->iwpbl_shadow = NULL;
|
||||
info.dev = dev;
|
||||
ukinfo->cq_size = max(entries, 4);
|
||||
ukinfo->cq_id = cq_num;
|
||||
|
|
@ -2518,8 +2525,6 @@ static int irdma_create_cq(struct ib_cq *ibcq,
|
|||
struct irdma_ucontext *ucontext;
|
||||
struct irdma_create_cq_req req = {};
|
||||
struct irdma_cq_mr *cqmr;
|
||||
struct irdma_pbl *iwpbl;
|
||||
struct irdma_pbl *iwpbl_shadow;
|
||||
struct irdma_cq_mr *cqmr_shadow;
|
||||
|
||||
iwcq->user_mode = true;
|
||||
|
|
@ -2533,34 +2538,34 @@ static int irdma_create_cq(struct ib_cq *ibcq,
|
|||
}
|
||||
|
||||
spin_lock_irqsave(&ucontext->cq_reg_mem_list_lock, flags);
|
||||
iwpbl = irdma_get_pbl((unsigned long)req.user_cq_buf,
|
||||
&ucontext->cq_reg_mem_list);
|
||||
iwcq->iwpbl = irdma_get_pbl((unsigned long)req.user_cq_buf,
|
||||
&ucontext->cq_reg_mem_list);
|
||||
spin_unlock_irqrestore(&ucontext->cq_reg_mem_list_lock, flags);
|
||||
if (!iwpbl) {
|
||||
if (!iwcq->iwpbl) {
|
||||
err_code = -EPROTO;
|
||||
goto cq_free_rsrc;
|
||||
}
|
||||
|
||||
cqmr = &iwpbl->cq_mr;
|
||||
cqmr = &iwcq->iwpbl->cq_mr;
|
||||
|
||||
if (rf->sc_dev.hw_attrs.uk_attrs.feature_flags &
|
||||
IRDMA_FEATURE_CQ_RESIZE) {
|
||||
spin_lock_irqsave(&ucontext->cq_reg_mem_list_lock, flags);
|
||||
iwpbl_shadow = irdma_get_pbl(
|
||||
iwcq->iwpbl_shadow = irdma_get_pbl(
|
||||
(unsigned long)req.user_shadow_area,
|
||||
&ucontext->cq_reg_mem_list);
|
||||
spin_unlock_irqrestore(&ucontext->cq_reg_mem_list_lock, flags);
|
||||
|
||||
if (!iwpbl_shadow) {
|
||||
if (!iwcq->iwpbl_shadow) {
|
||||
err_code = -EPROTO;
|
||||
goto cq_free_rsrc;
|
||||
}
|
||||
cqmr_shadow = &iwpbl_shadow->cq_mr;
|
||||
cqmr_shadow = &iwcq->iwpbl_shadow->cq_mr;
|
||||
info.shadow_area_pa = cqmr_shadow->cq_pbl.addr;
|
||||
} else {
|
||||
info.shadow_area_pa = cqmr->shadow;
|
||||
}
|
||||
if (iwpbl->pbl_allocated) {
|
||||
if (iwcq->iwpbl->pbl_allocated) {
|
||||
info.virtual_map = true;
|
||||
info.pbl_chunk_size = 1;
|
||||
info.first_pm_pbl_idx = cqmr->cq_pbl.idx;
|
||||
|
|
|
|||
|
|
@ -153,6 +153,8 @@ struct irdma_cq {
|
|||
struct list_head resize_list;
|
||||
struct irdma_cq_poll_info cur_cqe;
|
||||
struct list_head cmpl_generated;
|
||||
struct irdma_pbl *iwpbl;
|
||||
struct irdma_pbl *iwpbl_shadow;
|
||||
};
|
||||
|
||||
struct irdma_cmpl_gen {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user