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

Configure Feed

Select the types of activity you want to include in your feed.

RDMA/mana_ib: Use struct mana_ib_queue for WQs

Use struct mana_ib_queue and its helpers for WQs

Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
Link: https://lore.kernel.org/r/1711483688-24358-4-git-send-email-kotaranov@linux.microsoft.com
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>

authored by

Konstantin Taranov and committed by
Leon Romanovsky
688bac28 60a7ac0b

+10 -35
+1 -3
drivers/infiniband/hw/mana/mana_ib.h
··· 59 59 60 60 struct mana_ib_wq { 61 61 struct ib_wq ibwq; 62 - struct ib_umem *umem; 62 + struct mana_ib_queue queue; 63 63 int wqe; 64 64 u32 wq_buf_size; 65 - u64 gdma_region; 66 - u64 id; 67 65 mana_handle_t rx_object; 68 66 }; 69 67
+5 -5
drivers/infiniband/hw/mana/qp.c
··· 194 194 ibcq = ibwq->cq; 195 195 cq = container_of(ibcq, struct mana_ib_cq, ibcq); 196 196 197 - wq_spec.gdma_region = wq->gdma_region; 197 + wq_spec.gdma_region = wq->queue.gdma_region; 198 198 wq_spec.queue_size = wq->wq_buf_size; 199 199 200 200 cq_spec.gdma_region = cq->queue.gdma_region; ··· 212 212 } 213 213 214 214 /* The GDMA regions are now owned by the WQ object */ 215 - wq->gdma_region = GDMA_INVALID_DMA_REGION; 215 + wq->queue.gdma_region = GDMA_INVALID_DMA_REGION; 216 216 cq->queue.gdma_region = GDMA_INVALID_DMA_REGION; 217 217 218 - wq->id = wq_spec.queue_index; 218 + wq->queue.id = wq_spec.queue_index; 219 219 cq->queue.id = cq_spec.queue_index; 220 220 221 221 ibdev_dbg(&mdev->ib_dev, 222 222 "ret %d rx_object 0x%llx wq id %llu cq id %llu\n", 223 - ret, wq->rx_object, wq->id, cq->queue.id); 223 + ret, wq->rx_object, wq->queue.id, cq->queue.id); 224 224 225 225 resp.entries[i].cqid = cq->queue.id; 226 - resp.entries[i].wqid = wq->id; 226 + resp.entries[i].wqid = wq->queue.id; 227 227 228 228 mana_ind_table[i] = wq->rx_object; 229 229
+4 -27
drivers/infiniband/hw/mana/wq.c
··· 13 13 container_of(pd->device, struct mana_ib_dev, ib_dev); 14 14 struct mana_ib_create_wq ucmd = {}; 15 15 struct mana_ib_wq *wq; 16 - struct ib_umem *umem; 17 16 int err; 18 17 19 18 if (udata->inlen < sizeof(ucmd)) ··· 31 32 32 33 ibdev_dbg(&mdev->ib_dev, "ucmd wq_buf_addr 0x%llx\n", ucmd.wq_buf_addr); 33 34 34 - umem = ib_umem_get(pd->device, ucmd.wq_buf_addr, ucmd.wq_buf_size, 35 - IB_ACCESS_LOCAL_WRITE); 36 - if (IS_ERR(umem)) { 37 - err = PTR_ERR(umem); 35 + err = mana_ib_create_queue(mdev, ucmd.wq_buf_addr, ucmd.wq_buf_size, &wq->queue); 36 + if (err) { 38 37 ibdev_dbg(&mdev->ib_dev, 39 - "Failed to get umem for create wq, err %d\n", err); 38 + "Failed to create queue for create wq, %d\n", err); 40 39 goto err_free_wq; 41 40 } 42 41 43 - wq->umem = umem; 44 42 wq->wqe = init_attr->max_wr; 45 43 wq->wq_buf_size = ucmd.wq_buf_size; 46 44 wq->rx_object = INVALID_MANA_HANDLE; 47 - 48 - err = mana_ib_create_zero_offset_dma_region(mdev, wq->umem, &wq->gdma_region); 49 - if (err) { 50 - ibdev_dbg(&mdev->ib_dev, 51 - "Failed to create dma region for create wq, %d\n", 52 - err); 53 - goto err_release_umem; 54 - } 55 - 56 - ibdev_dbg(&mdev->ib_dev, 57 - "create_dma_region ret %d gdma_region 0x%llx\n", 58 - err, wq->gdma_region); 59 - 60 - /* WQ ID is returned at wq_create time, doesn't know the value yet */ 61 - 62 45 return &wq->ibwq; 63 - 64 - err_release_umem: 65 - ib_umem_release(umem); 66 46 67 47 err_free_wq: 68 48 kfree(wq); ··· 64 86 65 87 mdev = container_of(ib_dev, struct mana_ib_dev, ib_dev); 66 88 67 - mana_ib_gd_destroy_dma_region(mdev, wq->gdma_region); 68 - ib_umem_release(wq->umem); 89 + mana_ib_destroy_queue(mdev, &wq->queue); 69 90 70 91 kfree(wq); 71 92