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: Introduce helpers to create and destroy mana queues

Intoduce helpers to work with mana ib queues (struct mana_ib_queue).
A queue always consists of umem, gdma_region, and id.
A queue can become a WQ or a CQ.

Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
Link: https://lore.kernel.org/r/1711483688-24358-2-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
46f5be7c ca537a34

+53
+43
drivers/infiniband/hw/mana/main.c
··· 237 237 ibdev_dbg(ibdev, "Failed to destroy doorbell page %d\n", ret); 238 238 } 239 239 240 + int mana_ib_create_queue(struct mana_ib_dev *mdev, u64 addr, u32 size, 241 + struct mana_ib_queue *queue) 242 + { 243 + struct ib_umem *umem; 244 + int err; 245 + 246 + queue->umem = NULL; 247 + queue->id = INVALID_QUEUE_ID; 248 + queue->gdma_region = GDMA_INVALID_DMA_REGION; 249 + 250 + umem = ib_umem_get(&mdev->ib_dev, addr, size, IB_ACCESS_LOCAL_WRITE); 251 + if (IS_ERR(umem)) { 252 + err = PTR_ERR(umem); 253 + ibdev_dbg(&mdev->ib_dev, "Failed to get umem, %d\n", err); 254 + return err; 255 + } 256 + 257 + err = mana_ib_create_zero_offset_dma_region(mdev, umem, &queue->gdma_region); 258 + if (err) { 259 + ibdev_dbg(&mdev->ib_dev, "Failed to create dma region, %d\n", err); 260 + goto free_umem; 261 + } 262 + queue->umem = umem; 263 + 264 + ibdev_dbg(&mdev->ib_dev, 265 + "create_dma_region ret %d gdma_region 0x%llx\n", 266 + err, queue->gdma_region); 267 + 268 + return 0; 269 + free_umem: 270 + ib_umem_release(umem); 271 + return err; 272 + } 273 + 274 + void mana_ib_destroy_queue(struct mana_ib_dev *mdev, struct mana_ib_queue *queue) 275 + { 276 + /* Ignore return code as there is not much we can do about it. 277 + * The error message is printed inside. 278 + */ 279 + mana_ib_gd_destroy_dma_region(mdev, queue->gdma_region); 280 + ib_umem_release(queue->umem); 281 + } 282 + 240 283 static int 241 284 mana_ib_gd_first_dma_region(struct mana_ib_dev *dev, 242 285 struct gdma_context *gc,
+10
drivers/infiniband/hw/mana/mana_ib.h
··· 45 45 u32 max_inline_data_size; 46 46 }; 47 47 48 + struct mana_ib_queue { 49 + struct ib_umem *umem; 50 + u64 gdma_region; 51 + u64 id; 52 + }; 53 + 48 54 struct mana_ib_dev { 49 55 struct ib_device ib_dev; 50 56 struct gdma_dev *gdma_dev; ··· 174 168 175 169 int mana_ib_gd_destroy_dma_region(struct mana_ib_dev *dev, 176 170 mana_handle_t gdma_region); 171 + 172 + int mana_ib_create_queue(struct mana_ib_dev *mdev, u64 addr, u32 size, 173 + struct mana_ib_queue *queue); 174 + void mana_ib_destroy_queue(struct mana_ib_dev *mdev, struct mana_ib_queue *queue); 177 175 178 176 struct ib_wq *mana_ib_create_wq(struct ib_pd *pd, 179 177 struct ib_wq_init_attr *init_attr,