Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH for-rc] RDMA/restrack: Track driver QP types in resource tracker
@ 2019-07-30 11:01 Gal Pressman
  2019-07-30 12:19 ` Jason Gunthorpe
  2019-07-30 13:38 ` Leon Romanovsky
  0 siblings, 2 replies; 12+ messages in thread
From: Gal Pressman @ 2019-07-30 11:01 UTC (permalink / raw)
  To: Jason Gunthorpe, Doug Ledford, Leon Romanovsky; +Cc: linux-rdma, Gal Pressman

The check for QP type different than XRC has wrongly excluded driver QP
types from the resource tracker.

Fixes: 78a0cd648a80 ("RDMA/core: Add resource tracking for create and destroy QPs")
Signed-off-by: Gal Pressman <galpress@amazon.com>
---
 drivers/infiniband/core/core_priv.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h
index 589ed805e0ad..3a8b0911c3bc 100644
--- a/drivers/infiniband/core/core_priv.h
+++ b/drivers/infiniband/core/core_priv.h
@@ -321,7 +321,9 @@ static inline struct ib_qp *_ib_create_qp(struct ib_device *dev,
 					  struct ib_udata *udata,
 					  struct ib_uobject *uobj)
 {
+	enum ib_qp_type qp_type = attr->qp_type;
 	struct ib_qp *qp;
+	bool is_xrc;
 
 	if (!dev->ops.create_qp)
 		return ERR_PTR(-EOPNOTSUPP);
@@ -339,7 +341,8 @@ static inline struct ib_qp *_ib_create_qp(struct ib_device *dev,
 	 * and more importantly they are created internaly by driver,
 	 * see mlx5 create_dev_resources() as an example.
 	 */
-	if (attr->qp_type < IB_QPT_XRC_INI) {
+	is_xrc = qp_type == IB_QPT_XRC_INI || qp_type == IB_QPT_XRC_TGT;
+	if ((qp_type < IB_QPT_MAX && !is_xrc) || qp_type == IB_QPT_DRIVER) {
 		qp->res.type = RDMA_RESTRACK_QP;
 		if (uobj)
 			rdma_restrack_uadd(&qp->res);
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-07-31 10:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-30 11:01 [PATCH for-rc] RDMA/restrack: Track driver QP types in resource tracker Gal Pressman
2019-07-30 12:19 ` Jason Gunthorpe
2019-07-30 12:21   ` Gal Pressman
2019-07-30 13:38 ` Leon Romanovsky
2019-07-30 13:49   ` Gal Pressman
2019-07-30 15:19     ` Leon Romanovsky
2019-07-31  7:05       ` Gal Pressman
2019-07-31  7:46         ` Leon Romanovsky
2019-07-31  7:53           ` Gal Pressman
2019-07-31  8:34             ` Leon Romanovsky
2019-07-31  8:51               ` Gal Pressman
2019-07-31 10:01                 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox