Commit 52e0a118 authored by Gal Pressman's avatar Gal Pressman Committed by Doug Ledford

RDMA/restrack: Track driver QP types in resource tracker

The check for QP type different than XRC has excluded driver QP
types from the resource tracker.
As a result, "rdma resource show" user command would not show opened
driver QPs which does not reflect the real state of the system.

Check QP type explicitly instead of assuming enum values/ordering.

Fixes: 40909f66 ("RDMA/efa: Add EFA verbs implementation")
Signed-off-by: default avatarGal Pressman <galpress@amazon.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Link: https://lore.kernel.org/r/20190801104354.11417-1-galpress@amazon.comSigned-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent e5366d30
...@@ -302,7 +302,9 @@ static inline struct ib_qp *_ib_create_qp(struct ib_device *dev, ...@@ -302,7 +302,9 @@ static inline struct ib_qp *_ib_create_qp(struct ib_device *dev,
struct ib_udata *udata, struct ib_udata *udata,
struct ib_uobject *uobj) struct ib_uobject *uobj)
{ {
enum ib_qp_type qp_type = attr->qp_type;
struct ib_qp *qp; struct ib_qp *qp;
bool is_xrc;
if (!dev->ops.create_qp) if (!dev->ops.create_qp)
return ERR_PTR(-EOPNOTSUPP); return ERR_PTR(-EOPNOTSUPP);
...@@ -320,7 +322,8 @@ static inline struct ib_qp *_ib_create_qp(struct ib_device *dev, ...@@ -320,7 +322,8 @@ static inline struct ib_qp *_ib_create_qp(struct ib_device *dev,
* and more importantly they are created internaly by driver, * and more importantly they are created internaly by driver,
* see mlx5 create_dev_resources() as an example. * 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; qp->res.type = RDMA_RESTRACK_QP;
if (uobj) if (uobj)
rdma_restrack_uadd(&qp->res); rdma_restrack_uadd(&qp->res);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment