RDMA/mana_ib: create EQs for RNIC CQs

Create EQs within mana_ib device. Such EQs are required
for creation of RNIC CQs.

Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
Link: https://lore.kernel.org/r/1714137160-5222-2-git-send-email-kotaranov@linux.microsoft.com
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
Konstantin Taranov 2024-04-26 06:12:36 -07:00 committed by Leon Romanovsky
parent 48d80b4844
commit e73c882f0a
2 changed files with 33 additions and 2 deletions

View File

@ -658,7 +658,7 @@ int mana_ib_create_eqs(struct mana_ib_dev *mdev)
{
struct gdma_context *gc = mdev_to_gc(mdev);
struct gdma_queue_spec spec = {};
int err;
int err, i;
spec.type = GDMA_EQ;
spec.monitor_avl_buf = false;
@ -672,12 +672,42 @@ int mana_ib_create_eqs(struct mana_ib_dev *mdev)
if (err)
return err;
mdev->eqs = kcalloc(mdev->ib_dev.num_comp_vectors, sizeof(struct gdma_queue *),
GFP_KERNEL);
if (!mdev->eqs) {
err = -ENOMEM;
goto destroy_fatal_eq;
}
for (i = 0; i < mdev->ib_dev.num_comp_vectors; i++) {
spec.eq.msix_index = (i + 1) % gc->num_msix_usable;
err = mana_gd_create_mana_eq(mdev->gdma_dev, &spec, &mdev->eqs[i]);
if (err)
goto destroy_eqs;
}
return 0;
destroy_eqs:
while (i-- > 0)
mana_gd_destroy_queue(gc, mdev->eqs[i]);
kfree(mdev->eqs);
destroy_fatal_eq:
mana_gd_destroy_queue(gc, mdev->fatal_err_eq);
return err;
}
void mana_ib_destroy_eqs(struct mana_ib_dev *mdev)
{
mana_gd_destroy_queue(mdev_to_gc(mdev), mdev->fatal_err_eq);
struct gdma_context *gc = mdev_to_gc(mdev);
int i;
mana_gd_destroy_queue(gc, mdev->fatal_err_eq);
for (i = 0; i < mdev->ib_dev.num_comp_vectors; i++)
mana_gd_destroy_queue(gc, mdev->eqs[i]);
kfree(mdev->eqs);
}
int mana_ib_gd_create_rnic_adapter(struct mana_ib_dev *mdev)

View File

@ -56,6 +56,7 @@ struct mana_ib_dev {
struct gdma_dev *gdma_dev;
mana_handle_t adapter_handle;
struct gdma_queue *fatal_err_eq;
struct gdma_queue **eqs;
struct mana_ib_adapter_caps adapter_caps;
};