From: Patrisious Haddad <phaddad@nvidia.com>
To: Sagi Grimberg <sagi@grimberg.me>, Christoph Hellwig <hch@lst.de>
Cc: Patrisious Haddad <phaddad@nvidia.com>,
Leon Romanovsky <leonro@nvidia.com>,
Linux-nvme <linux-nvme@lists.infradead.org>,
<linux-rdma@vger.kernel.org>,
Michael Guralnik <michaelgur@nvidia.com>,
Israel Rukshin <israelr@nvidia.com>,
Maor Gottlieb <maorg@nvidia.com>,
"Max Gurtovoy" <mgurtovoy@nvidia.com>
Subject: [PATCH rdma-next 2/4] RDMA/core: Introduce ib_get_qp_err_syndrome function
Date: Wed, 7 Sep 2022 14:37:58 +0300 [thread overview]
Message-ID: <20220907113800.22182-3-phaddad@nvidia.com> (raw)
In-Reply-To: <20220907113800.22182-1-phaddad@nvidia.com>
Introduce ib_get_qp_err_syndrome function, which enables kernel
applications to query the reason the QP moved to error state.
Even in cases in which no CQE was generated.
Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
---
drivers/infiniband/core/device.c | 1 +
drivers/infiniband/core/verbs.c | 8 ++++++++
include/rdma/ib_verbs.h | 13 +++++++++++++
3 files changed, 22 insertions(+)
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index ae60c73babcc..8235b8fa1100 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -2657,6 +2657,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
SET_DEVICE_OP(dev_ops, get_netdev);
SET_DEVICE_OP(dev_ops, get_numa_node);
SET_DEVICE_OP(dev_ops, get_port_immutable);
+ SET_DEVICE_OP(dev_ops, get_qp_err_syndrome);
SET_DEVICE_OP(dev_ops, get_vector_affinity);
SET_DEVICE_OP(dev_ops, get_vf_config);
SET_DEVICE_OP(dev_ops, get_vf_guid);
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index e54b3f1b730e..ac20af8be33a 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -1952,6 +1952,14 @@ int ib_query_qp(struct ib_qp *qp,
}
EXPORT_SYMBOL(ib_query_qp);
+int ib_get_qp_err_syndrome(struct ib_qp *qp, char *str)
+{
+ return qp->device->ops.get_qp_err_syndrome ?
+ qp->device->ops.get_qp_err_syndrome(qp->real_qp,
+ str) : -EOPNOTSUPP;
+}
+EXPORT_SYMBOL(ib_get_qp_err_syndrome);
+
int ib_close_qp(struct ib_qp *qp)
{
struct ib_qp *real_qp;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 975d6e9efbcb..9a94f2ef993c 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2465,6 +2465,7 @@ struct ib_device_ops {
int qp_attr_mask, struct ib_udata *udata);
int (*query_qp)(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr);
+ int (*get_qp_err_syndrome)(struct ib_qp *qp, char *str);
int (*destroy_qp)(struct ib_qp *qp, struct ib_udata *udata);
int (*create_cq)(struct ib_cq *cq, const struct ib_cq_init_attr *attr,
struct ib_udata *udata);
@@ -3777,6 +3778,18 @@ int ib_query_qp(struct ib_qp *qp,
int qp_attr_mask,
struct ib_qp_init_attr *qp_init_attr);
+#define IB_ERR_SYNDROME_LENGTH 256
+
+/**
+ * ib_get_qp_err_syndrome - Returns a string that describes the reason
+ * the specified QP moved to error state.
+ * @qp : The QP to query.
+ * @str: The reason the qp moved to error state.
+ *
+ * NOTE: the user must pass a str with size of at least IB_ERR_SYNDROME_LENGTH
+ */
+int ib_get_qp_err_syndrome(struct ib_qp *qp, char *str);
+
/**
* ib_destroy_qp - Destroys the specified QP.
* @qp: The QP to destroy.
--
2.18.1
next prev parent reply other threads:[~2022-09-07 11:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-07 11:37 [PATCH rdma-next 0/4] Provide more error details when a QP moves to Patrisious Haddad
2022-09-07 11:37 ` [PATCH rdma-next 1/4] net/mlx5: Introduce CQE error syndrome Patrisious Haddad
2022-09-07 11:37 ` Patrisious Haddad [this message]
2022-09-07 11:37 ` [PATCH rdma-next 3/4] RDMA/mlx5: Implement ib_get_qp_err_syndrome Patrisious Haddad
2022-09-07 11:38 ` [PATCH rdma-next 4/4] nvme-rdma: add more error details when a QP moves to an error state Patrisious Haddad
2022-09-07 12:02 ` Christoph Hellwig
2022-09-07 12:11 ` Leon Romanovsky
2022-09-07 12:34 ` Sagi Grimberg
2022-09-07 12:51 ` Leon Romanovsky
2022-09-07 15:16 ` Sagi Grimberg
2022-09-07 15:18 ` Christoph Hellwig
2022-09-07 17:39 ` Leon Romanovsky
2022-11-01 9:12 ` Mark Zhang
2022-11-02 1:56 ` Mark Zhang
2022-09-08 7:55 ` Patrisious Haddad
2022-09-07 17:29 ` Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220907113800.22182-3-phaddad@nvidia.com \
--to=phaddad@nvidia.com \
--cc=hch@lst.de \
--cc=israelr@nvidia.com \
--cc=leonro@nvidia.com \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-rdma@vger.kernel.org \
--cc=maorg@nvidia.com \
--cc=mgurtovoy@nvidia.com \
--cc=michaelgur@nvidia.com \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).