Skip to content

Commit d7ecab1

Browse files
Leon Romanovskyjgunthorpe
authored andcommitted
RDMA/mlx5: Don't call to restrack recursively
The restrack is going to manage memory of all IB objects and must be called before object is created. GSI QP in the mlx5_ib separated between creating dummy interface and HW object beneath. This was achieved by double call to ib_create_qp(). In order to skip such reentry call to internal driver create_qp code. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Mark Zhang <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 60aaeff commit d7ecab1

File tree

1 file changed

+14
-2
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+14
-2
lines changed

drivers/infiniband/hw/mlx5/gsi.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,25 @@ struct ib_qp *mlx5_ib_gsi_create_qp(struct ib_pd *pd,
182182
hw_init_attr.cap.max_send_sge = 0;
183183
hw_init_attr.cap.max_inline_data = 0;
184184
}
185-
gsi->rx_qp = ib_create_qp(pd, &hw_init_attr);
185+
186+
gsi->rx_qp = mlx5_ib_create_qp(pd, &hw_init_attr, NULL);
186187
if (IS_ERR(gsi->rx_qp)) {
187188
mlx5_ib_warn(dev, "unable to create hardware GSI QP. error %ld\n",
188189
PTR_ERR(gsi->rx_qp));
189190
ret = PTR_ERR(gsi->rx_qp);
190191
goto err_destroy_cq;
191192
}
193+
gsi->rx_qp->device = pd->device;
194+
gsi->rx_qp->pd = pd;
195+
gsi->rx_qp->real_qp = gsi->rx_qp;
196+
197+
gsi->rx_qp->qp_type = hw_init_attr.qp_type;
198+
gsi->rx_qp->send_cq = hw_init_attr.send_cq;
199+
gsi->rx_qp->recv_cq = hw_init_attr.recv_cq;
200+
gsi->rx_qp->event_handler = hw_init_attr.event_handler;
201+
spin_lock_init(&gsi->rx_qp->mr_lock);
202+
INIT_LIST_HEAD(&gsi->rx_qp->rdma_mrs);
203+
INIT_LIST_HEAD(&gsi->rx_qp->sig_mrs);
192204

193205
dev->devr.ports[init_attr->port_num - 1].gsi = gsi;
194206

@@ -219,7 +231,7 @@ int mlx5_ib_gsi_destroy_qp(struct ib_qp *qp)
219231
mlx5_ib_dbg(dev, "destroying GSI QP\n");
220232

221233
mutex_lock(&dev->devr.mutex);
222-
ret = ib_destroy_qp(gsi->rx_qp);
234+
ret = mlx5_ib_destroy_qp(gsi->rx_qp, NULL);
223235
if (ret) {
224236
mlx5_ib_warn(dev, "unable to destroy hardware GSI QP. error %d\n",
225237
ret);

0 commit comments

Comments
 (0)