Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 37 additions & 8 deletions drivers/infiniband/hw/mana/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ void mana_ib_uncfg_vport(struct mana_ib_dev *dev, struct mana_ib_pd *pd,
pd->vport_use_count--;
WARN_ON(pd->vport_use_count < 0);

if (!pd->vport_use_count)
if (!pd->vport_use_count) {
mana_destroy_eq(mpc);
mana_uncfg_vport(mpc);
}

mutex_unlock(&pd->vport_mutex);
}
Expand Down Expand Up @@ -55,15 +57,21 @@ int mana_ib_cfg_vport(struct mana_ib_dev *dev, u32 port, struct mana_ib_pd *pd,
return err;
}

mutex_unlock(&pd->vport_mutex);

pd->tx_shortform_allowed = mpc->tx_shortform_allowed;
pd->tx_vp_offset = mpc->tx_vp_offset;
err = mana_create_eq(mpc);
if (err) {
mana_uncfg_vport(mpc);
pd->vport_use_count--;
}

mutex_unlock(&pd->vport_mutex);

ibdev_dbg(&dev->ib_dev, "vport handle %llx pdid %x doorbell_id %x\n",
mpc->port_handle, pd->pdn, doorbell_id);

return 0;
return err;
}

int mana_ib_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)
Expand Down Expand Up @@ -780,6 +788,7 @@ int mana_ib_create_eqs(struct mana_ib_dev *mdev)
{
struct gdma_context *gc = mdev_to_gc(mdev);
struct gdma_queue_spec spec = {};
struct gdma_irq_context *gic;
int err, i;

spec.type = GDMA_EQ;
Expand All @@ -790,9 +799,15 @@ int mana_ib_create_eqs(struct mana_ib_dev *mdev)
spec.eq.log2_throttle_limit = LOG2_EQ_THROTTLE;
spec.eq.msix_index = 0;

gic = mana_gd_get_gic(gc, false, &spec.eq.msix_index);
if (!gic)
return -ENOMEM;

err = mana_gd_create_mana_eq(mdev->gdma_dev, &spec, &mdev->fatal_err_eq);
if (err)
if (err) {
mana_gd_put_gic(gc, false, 0);
return err;
}

mdev->eqs = kcalloc(mdev->ib_dev.num_comp_vectors, sizeof(struct gdma_queue *),
GFP_KERNEL);
Expand All @@ -803,31 +818,45 @@ int mana_ib_create_eqs(struct mana_ib_dev *mdev)
spec.eq.callback = NULL;
for (i = 0; i < mdev->ib_dev.num_comp_vectors; i++) {
spec.eq.msix_index = (i + 1) % gc->num_msix_usable;

gic = mana_gd_get_gic(gc, false, &spec.eq.msix_index);
if (!gic)
goto destroy_eqs;

err = mana_gd_create_mana_eq(mdev->gdma_dev, &spec, &mdev->eqs[i]);
if (err)
if (err) {
mana_gd_put_gic(gc, false, spec.eq.msix_index);
goto destroy_eqs;
}
}

return 0;

destroy_eqs:
while (i-- > 0)
while (i-- > 0) {
mana_gd_put_gic(gc, false, (i + 1) % gc->num_msix_usable);
mana_gd_destroy_queue(gc, mdev->eqs[i]);
}
kfree(mdev->eqs);
destroy_fatal_eq:
mana_gd_put_gic(gc, false, 0);
mana_gd_destroy_queue(gc, mdev->fatal_err_eq);
return err;
}

void mana_ib_destroy_eqs(struct mana_ib_dev *mdev)
{
struct gdma_context *gc = mdev_to_gc(mdev);
int i;
int i, msi;

mana_gd_destroy_queue(gc, mdev->fatal_err_eq);
mana_gd_put_gic(gc, false, 0);

for (i = 0; i < mdev->ib_dev.num_comp_vectors; i++)
for (i = 0; i < mdev->ib_dev.num_comp_vectors; i++) {
mana_gd_destroy_queue(gc, mdev->eqs[i]);
msi = (i + 1) % gc->num_msix_usable;
mana_gd_put_gic(gc, false, msi);
}

kfree(mdev->eqs);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/infiniband/hw/mana/qp.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
cq_spec.gdma_region = cq->queue.gdma_region;
cq_spec.queue_size = cq->cqe * COMP_ENTRY_SIZE;
cq_spec.modr_ctx_id = 0;
eq = &mpc->ac->eqs[cq->comp_vector];
eq = &mpc->eqs[cq->comp_vector % mpc->num_queues];
cq_spec.attached_eq = eq->eq->id;

ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
Expand Down Expand Up @@ -341,7 +341,7 @@ static int mana_ib_create_qp_raw(struct ib_qp *ibqp, struct ib_pd *ibpd,
cq_spec.queue_size = send_cq->cqe * COMP_ENTRY_SIZE;
cq_spec.modr_ctx_id = 0;
eq_vec = send_cq->comp_vector;
eq = &mpc->ac->eqs[eq_vec];
eq = &mpc->eqs[eq_vec % mpc->num_queues];
cq_spec.attached_eq = eq->eq->id;

err = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_SQ, &wq_spec,
Expand Down
Loading