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 RAW QPs

Use struct mana_ib_queue and its helpers for RAW QPs

Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
Link: https://lore.kernel.org/r/1711483688-24358-5-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
f10242b3 688bac28

+18 -46
+2 -6
drivers/infiniband/hw/mana/mana_ib.h
··· 94 94 struct mana_ib_qp { 95 95 struct ib_qp ibqp; 96 96 97 - /* Work queue info */ 98 - struct ib_umem *sq_umem; 99 - int sqe; 100 - u64 sq_gdma_region; 101 - u64 sq_id; 102 - mana_handle_t tx_object; 97 + mana_handle_t qp_handle; 98 + struct mana_ib_queue raw_sq; 103 99 104 100 /* The port on the IB device, starting with 1 */ 105 101 u32 port;
+16 -40
drivers/infiniband/hw/mana/qp.c
··· 297 297 struct mana_obj_spec cq_spec = {}; 298 298 struct mana_port_context *mpc; 299 299 struct net_device *ndev; 300 - struct ib_umem *umem; 301 300 struct mana_eq *eq; 302 301 int eq_vec; 303 302 u32 port; ··· 345 346 ibdev_dbg(&mdev->ib_dev, "ucmd sq_buf_addr 0x%llx port %u\n", 346 347 ucmd.sq_buf_addr, ucmd.port); 347 348 348 - umem = ib_umem_get(ibpd->device, ucmd.sq_buf_addr, ucmd.sq_buf_size, 349 - IB_ACCESS_LOCAL_WRITE); 350 - if (IS_ERR(umem)) { 351 - err = PTR_ERR(umem); 352 - ibdev_dbg(&mdev->ib_dev, 353 - "Failed to get umem for create qp-raw, err %d\n", 354 - err); 355 - goto err_free_vport; 356 - } 357 - qp->sq_umem = umem; 358 - 359 - err = mana_ib_create_zero_offset_dma_region(mdev, qp->sq_umem, 360 - &qp->sq_gdma_region); 349 + err = mana_ib_create_queue(mdev, ucmd.sq_buf_addr, ucmd.sq_buf_size, &qp->raw_sq); 361 350 if (err) { 362 351 ibdev_dbg(&mdev->ib_dev, 363 - "Failed to create dma region for create qp-raw, %d\n", 364 - err); 365 - goto err_release_umem; 352 + "Failed to create queue for create qp-raw, err %d\n", err); 353 + goto err_free_vport; 366 354 } 367 355 368 - ibdev_dbg(&mdev->ib_dev, 369 - "create_dma_region ret %d gdma_region 0x%llx\n", 370 - err, qp->sq_gdma_region); 371 - 372 356 /* Create a WQ on the same port handle used by the Ethernet */ 373 - wq_spec.gdma_region = qp->sq_gdma_region; 357 + wq_spec.gdma_region = qp->raw_sq.gdma_region; 374 358 wq_spec.queue_size = ucmd.sq_buf_size; 375 359 376 360 cq_spec.gdma_region = send_cq->queue.gdma_region; ··· 364 382 cq_spec.attached_eq = eq->eq->id; 365 383 366 384 err = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_SQ, &wq_spec, 367 - &cq_spec, &qp->tx_object); 385 + &cq_spec, &qp->qp_handle); 368 386 if (err) { 369 387 ibdev_dbg(&mdev->ib_dev, 370 388 "Failed to create wq for create raw-qp, err %d\n", 371 389 err); 372 - goto err_destroy_dma_region; 390 + goto err_destroy_queue; 373 391 } 374 392 375 393 /* The GDMA regions are now owned by the WQ object */ 376 - qp->sq_gdma_region = GDMA_INVALID_DMA_REGION; 394 + qp->raw_sq.gdma_region = GDMA_INVALID_DMA_REGION; 377 395 send_cq->queue.gdma_region = GDMA_INVALID_DMA_REGION; 378 396 379 - qp->sq_id = wq_spec.queue_index; 397 + qp->raw_sq.id = wq_spec.queue_index; 380 398 send_cq->queue.id = cq_spec.queue_index; 381 399 382 400 /* Create CQ table entry */ ··· 385 403 goto err_destroy_wq_obj; 386 404 387 405 ibdev_dbg(&mdev->ib_dev, 388 - "ret %d qp->tx_object 0x%llx sq id %llu cq id %llu\n", err, 389 - qp->tx_object, qp->sq_id, send_cq->queue.id); 406 + "ret %d qp->qp_handle 0x%llx sq id %llu cq id %llu\n", err, 407 + qp->qp_handle, qp->raw_sq.id, send_cq->queue.id); 390 408 391 - resp.sqid = qp->sq_id; 409 + resp.sqid = qp->raw_sq.id; 392 410 resp.cqid = send_cq->queue.id; 393 411 resp.tx_vp_offset = pd->tx_vp_offset; 394 412 ··· 407 425 gc->cq_table[send_cq->queue.id] = NULL; 408 426 409 427 err_destroy_wq_obj: 410 - mana_destroy_wq_obj(mpc, GDMA_SQ, qp->tx_object); 428 + mana_destroy_wq_obj(mpc, GDMA_SQ, qp->qp_handle); 411 429 412 - err_destroy_dma_region: 413 - mana_ib_gd_destroy_dma_region(mdev, qp->sq_gdma_region); 414 - 415 - err_release_umem: 416 - ib_umem_release(umem); 430 + err_destroy_queue: 431 + mana_ib_destroy_queue(mdev, &qp->raw_sq); 417 432 418 433 err_free_vport: 419 434 mana_ib_uncfg_vport(mdev, pd, port); ··· 484 505 mpc = netdev_priv(ndev); 485 506 pd = container_of(ibpd, struct mana_ib_pd, ibpd); 486 507 487 - mana_destroy_wq_obj(mpc, GDMA_SQ, qp->tx_object); 508 + mana_destroy_wq_obj(mpc, GDMA_SQ, qp->qp_handle); 488 509 489 - if (qp->sq_umem) { 490 - mana_ib_gd_destroy_dma_region(mdev, qp->sq_gdma_region); 491 - ib_umem_release(qp->sq_umem); 492 - } 510 + mana_ib_destroy_queue(mdev, &qp->raw_sq); 493 511 494 512 mana_ib_uncfg_vport(mdev, pd, qp->port); 495 513