All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH v1 01/20] xprtrdma: human-readable completion status
Date: Wed, 07 Jan 2015 18:11:54 -0500	[thread overview]
Message-ID: <20150107231154.13466.72247.stgit@manet.1015granger.net> (raw)
In-Reply-To: <20150107230859.13466.67723.stgit@manet.1015granger.net>

Make it easier to grep the system log for specific error conditions.

The wc.opcode field is not included because opcode numbers are
sparse, and because wc.opcode is not necessarily valid when
completion reports an error.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 net/sunrpc/xprtrdma/verbs.c |   70 +++++++++++++++++++++++++++++++++++--------
 1 file changed, 57 insertions(+), 13 deletions(-)

diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index c98e406..56f705d 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -173,18 +173,54 @@ rpcrdma_cq_async_error_upcall(struct ib_event *event, void *context)
 	}
 }
 
+static const char * const wc_status[] = {
+	"success",
+	"local length error",
+	"local QP operation error",
+	"local EE context operation error",
+	"local protection error",
+	"WR flushed",
+	"memory management operation error",
+	"bad response error",
+	"local access error",
+	"remote invalid request error",
+	"remote access error",
+	"remote operation error",
+	"transport retry counter exceeded",
+	"RNR retrycounter exceeded",
+	"local RDD violation error",
+	"remove invalid RD request",
+	"operation aborted",
+	"invalid EE context number",
+	"invalid EE context state",
+	"fatal error",
+	"response timeout error",
+	"general error",
+};
+
+#define COMPLETION_MSG(status)					\
+	((status) < ARRAY_SIZE(wc_status) ?			\
+		wc_status[(status)] : "unexpected completion error")
+
 static void
 rpcrdma_sendcq_process_wc(struct ib_wc *wc)
 {
-	struct rpcrdma_mw *frmr = (struct rpcrdma_mw *)(unsigned long)wc->wr_id;
+	if (likely(wc->status == IB_WC_SUCCESS))
+		return;
 
-	dprintk("RPC:       %s: frmr %p status %X opcode %d\n",
-		__func__, frmr, wc->status, wc->opcode);
+	/* WARNING: Only wr_id and status are reliable at this point */
+	if (wc->wr_id == 0ULL) {
+		if (wc->status != IB_WC_WR_FLUSH_ERR)
+			pr_err("RPC:       %s: SEND: %s\n",
+			       __func__, COMPLETION_MSG(wc->status));
+	} else {
+		struct rpcrdma_mw *r;
 
-	if (wc->wr_id == 0ULL)
-		return;
-	if (wc->status != IB_WC_SUCCESS)
-		frmr->r.frmr.fr_state = FRMR_IS_STALE;
+		r = (struct rpcrdma_mw *)(unsigned long)wc->wr_id;
+		r->r.frmr.fr_state = FRMR_IS_STALE;
+		pr_err("RPC:       %s: frmr %p (stale): %s\n",
+		       __func__, r, COMPLETION_MSG(wc->status));
+	}
 }
 
 static int
@@ -248,16 +284,17 @@ rpcrdma_recvcq_process_wc(struct ib_wc *wc, struct list_head *sched_list)
 	struct rpcrdma_rep *rep =
 			(struct rpcrdma_rep *)(unsigned long)wc->wr_id;
 
-	dprintk("RPC:       %s: rep %p status %X opcode %X length %u\n",
-		__func__, rep, wc->status, wc->opcode, wc->byte_len);
+	/* WARNING: Only wr_id and status are reliable at this point */
+	if (wc->status != IB_WC_SUCCESS)
+		goto out_fail;
 
-	if (wc->status != IB_WC_SUCCESS) {
-		rep->rr_len = ~0U;
-		goto out_schedule;
-	}
+	/* status == SUCCESS means all fields in wc are trustworthy */
 	if (wc->opcode != IB_WC_RECV)
 		return;
 
+	dprintk("RPC:       %s: rep %p opcode 'recv', length %u: success\n",
+		__func__, rep, wc->byte_len);
+
 	rep->rr_len = wc->byte_len;
 	ib_dma_sync_single_for_cpu(rdmab_to_ia(rep->rr_buffer)->ri_id->device,
 			rep->rr_iov.addr, rep->rr_len, DMA_FROM_DEVICE);
@@ -275,6 +312,13 @@ rpcrdma_recvcq_process_wc(struct ib_wc *wc, struct list_head *sched_list)
 
 out_schedule:
 	list_add_tail(&rep->rr_list, sched_list);
+	return;
+out_fail:
+	if (wc->status != IB_WC_WR_FLUSH_ERR)
+		pr_err("RPC:       %s: rep %p: %s\n",
+		       __func__, rep, COMPLETION_MSG(wc->status));
+	rep->rr_len = ~0U;
+	goto out_schedule;
 }
 
 static int


  reply	other threads:[~2015-01-07 23:11 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07 23:11 [PATCH v1 00/20] NFS/RDMA client for 3.20 Chuck Lever
2015-01-07 23:11 ` Chuck Lever [this message]
2015-01-07 23:12 ` [PATCH v1 02/20] xprtrdma: Modernize htonl and ntohl Chuck Lever
2015-01-07 23:12 ` [PATCH v1 03/20] xprtrdma: Display XIDs in host byte order Chuck Lever
2015-01-07 23:12 ` [PATCH v1 04/20] xprtrdma: Clean up hdrlen Chuck Lever
2015-01-07 23:12 ` [PATCH v1 05/20] xprtrdma: Rename "xprt" and "rdma_connect" fields in struct rpcrdma_xprt Chuck Lever
2015-01-07 23:12 ` [PATCH v1 06/20] xprtrdma: Remove rpcrdma_ep::rep_ia Chuck Lever
2015-01-07 23:12 ` [PATCH v1 07/20] xprtrdma: Remove rl_mr field, and the mr_chunk union Chuck Lever
2015-01-07 23:12 ` [PATCH v1 08/20] xprtrdma: Move credit update to RPC reply handler Chuck Lever
2015-01-08 15:53   ` Anna Schumaker
2015-01-08 16:10     ` Chuck Lever
2015-01-08 17:49       ` Anna Schumaker
2015-01-07 23:13 ` [PATCH v1 09/20] xprtrdma: Remove rpcrdma_ep::rep_func and ::rep_xprt Chuck Lever
2015-01-07 23:13 ` [PATCH v1 10/20] xprtrdma: Free the pd if ib_query_qp() fails Chuck Lever
2015-01-07 23:13 ` [PATCH v1 11/20] xprtrdma: Take struct ib_device_attr off the stack Chuck Lever
2015-01-07 23:13 ` [PATCH v1 12/20] xprtrdma: Take struct ib_qp_attr and ib_qp_init_attr " Chuck Lever
2015-01-07 23:13 ` [PATCH v1 13/20] xprtrdma: Simplify synopsis of rpcrdma_buffer_create() Chuck Lever
2015-01-07 23:13 ` [PATCH v1 14/20] xprtrdma: Refactor rpcrdma_buffer_create() and rpcrdma_buffer_destroy() Chuck Lever
2015-01-07 23:13 ` [PATCH v1 15/20] xprtrdma: Add struct rpcrdma_regbuf and helpers Chuck Lever
2015-01-07 23:13 ` [PATCH v1 16/20] xprtrdma: Allocate RPC send buffer separately from struct rpcrdma_req Chuck Lever
2015-01-07 23:14 ` [PATCH v1 17/20] xprtrdma: Allocate RDMA/RPC " Chuck Lever
2015-01-07 23:14 ` [PATCH v1 18/20] xprtrdma: Allocate RPC/RDMA receive buffer separately from struct rpcrdma_rep Chuck Lever
2015-01-07 23:14 ` [PATCH v1 19/20] xprtrdma: Allocate zero pad separately from rpcrdma_buffer Chuck Lever
2015-01-07 23:14 ` [PATCH v1 20/20] xprtrdma: Clean up after adding regbuf management Chuck Lever

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=20150107231154.13466.72247.stgit@manet.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.