File tree 3 files changed +30
-5
lines changed
3 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -301,4 +301,31 @@ struct ib_device *ib_device_get_by_index(u32 ifindex);
301
301
/* RDMA device netlink */
302
302
void nldev_init (void );
303
303
void nldev_exit (void );
304
+
305
+ static inline struct ib_qp * _ib_create_qp (struct ib_device * dev ,
306
+ struct ib_pd * pd ,
307
+ struct ib_qp_init_attr * attr ,
308
+ struct ib_udata * udata )
309
+ {
310
+ struct ib_qp * qp ;
311
+
312
+ qp = dev -> create_qp (pd , attr , udata );
313
+ if (IS_ERR (qp ))
314
+ return qp ;
315
+
316
+ qp -> device = dev ;
317
+ qp -> pd = pd ;
318
+ /*
319
+ * We don't track XRC QPs for now, because they don't have PD
320
+ * and more importantly they are created internaly by driver,
321
+ * see mlx5 create_dev_resources() as an example.
322
+ */
323
+ if (attr -> qp_type < IB_QPT_XRC_INI ) {
324
+ qp -> res .type = RDMA_RESTRACK_QP ;
325
+ rdma_restrack_add (& qp -> res );
326
+ } else
327
+ qp -> res .valid = false;
328
+
329
+ return qp ;
330
+ }
304
331
#endif /* _CORE_PRIV_H */
Original file line number Diff line number Diff line change @@ -1514,7 +1514,7 @@ static int create_qp(struct ib_uverbs_file *file,
1514
1514
if (cmd -> qp_type == IB_QPT_XRC_TGT )
1515
1515
qp = ib_create_qp (pd , & attr );
1516
1516
else
1517
- qp = device -> create_qp ( pd , & attr , uhw );
1517
+ qp = _ib_create_qp ( device , pd , & attr , uhw );
1518
1518
1519
1519
if (IS_ERR (qp )) {
1520
1520
ret = PTR_ERR (qp );
@@ -1527,7 +1527,6 @@ static int create_qp(struct ib_uverbs_file *file,
1527
1527
goto err_cb ;
1528
1528
1529
1529
qp -> real_qp = qp ;
1530
- qp -> device = device ;
1531
1530
qp -> pd = pd ;
1532
1531
qp -> send_cq = attr .send_cq ;
1533
1532
qp -> recv_cq = attr .recv_cq ;
Original file line number Diff line number Diff line change @@ -882,7 +882,7 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd,
882
882
if (qp_init_attr -> cap .max_rdma_ctxs )
883
883
rdma_rw_init_qp (device , qp_init_attr );
884
884
885
- qp = device -> create_qp ( pd , qp_init_attr , NULL );
885
+ qp = _ib_create_qp ( device , pd , qp_init_attr , NULL );
886
886
if (IS_ERR (qp ))
887
887
return qp ;
888
888
@@ -892,7 +892,6 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd,
892
892
return ERR_PTR (ret );
893
893
}
894
894
895
- qp -> device = device ;
896
895
qp -> real_qp = qp ;
897
896
qp -> uobject = NULL ;
898
897
qp -> qp_type = qp_init_attr -> qp_type ;
@@ -922,7 +921,6 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd,
922
921
atomic_inc (& qp_init_attr -> srq -> usecnt );
923
922
}
924
923
925
- qp -> pd = pd ;
926
924
qp -> send_cq = qp_init_attr -> send_cq ;
927
925
qp -> xrcd = NULL ;
928
926
@@ -1538,6 +1536,7 @@ int ib_destroy_qp(struct ib_qp *qp)
1538
1536
if (!qp -> uobject )
1539
1537
rdma_rw_cleanup_mrs (qp );
1540
1538
1539
+ rdma_restrack_del (& qp -> res );
1541
1540
ret = qp -> device -> destroy_qp (qp );
1542
1541
if (!ret ) {
1543
1542
if (pd )
You can’t perform that action at this time.
0 commit comments