From: Chuck Lever <chuck.lever@oracle.com>
To: linux-rdma@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: [PATCH v2 04/20] xprtrdma: Clean up hdrlen
Date: Tue, 13 Jan 2015 11:25:16 -0500 [thread overview]
Message-ID: <20150113162516.14086.54951.stgit@manet.1015granger.net> (raw)
In-Reply-To: <20150113161440.14086.24801.stgit@manet.1015granger.net>
Clean up: Replace naked integers with a documenting macro.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
include/linux/sunrpc/rpc_rdma.h | 5 ++++-
net/sunrpc/xprtrdma/rpc_rdma.c | 12 +++++++-----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/include/linux/sunrpc/rpc_rdma.h b/include/linux/sunrpc/rpc_rdma.h
index 1578ed2..f33c5a4 100644
--- a/include/linux/sunrpc/rpc_rdma.h
+++ b/include/linux/sunrpc/rpc_rdma.h
@@ -98,7 +98,10 @@ struct rpcrdma_msg {
} rm_body;
};
-#define RPCRDMA_HDRLEN_MIN 28
+/*
+ * Smallest RPC/RDMA header: rm_xid through rm_type, then rm_nochunks
+ */
+#define RPCRDMA_HDRLEN_MIN (sizeof(__be32) * 7)
enum rpcrdma_errcode {
ERR_VERS = 1,
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index 150dd76..dcf5ebc 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -472,7 +472,7 @@ rpcrdma_marshal_req(struct rpc_rqst *rqst)
return -EIO;
}
- hdrlen = 28; /*sizeof *headerp;*/
+ hdrlen = RPCRDMA_HDRLEN_MIN;
padlen = 0;
/*
@@ -748,7 +748,7 @@ rpcrdma_reply_handler(struct rpcrdma_rep *rep)
}
return;
}
- if (rep->rr_len < 28) {
+ if (rep->rr_len < RPCRDMA_HDRLEN_MIN) {
dprintk("RPC: %s: short/invalid reply\n", __func__);
goto repost;
}
@@ -830,8 +830,9 @@ repost:
} else {
/* else ordinary inline */
rdmalen = 0;
- iptr = (__be32 *)((unsigned char *)headerp + 28);
- rep->rr_len -= 28; /*sizeof *headerp;*/
+ iptr = (__be32 *)((unsigned char *)headerp +
+ RPCRDMA_HDRLEN_MIN);
+ rep->rr_len -= RPCRDMA_HDRLEN_MIN;
status = rep->rr_len;
}
/* Fix up the rpc results for upper layer */
@@ -845,7 +846,8 @@ repost:
headerp->rm_body.rm_chunks[2] != xdr_one ||
req->rl_nchunks == 0)
goto badheader;
- iptr = (__be32 *)((unsigned char *)headerp + 28);
+ iptr = (__be32 *)((unsigned char *)headerp +
+ RPCRDMA_HDRLEN_MIN);
rdmalen = rpcrdma_count_chunks(rep, req->rl_nchunks, 0, &iptr);
if (rdmalen < 0)
goto badheader;
next prev parent reply other threads:[~2015-01-13 16:25 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-13 16:24 [PATCH v2 00/20] NFS/RDMA client for 3.20 Chuck Lever
2015-01-13 16:24 ` [PATCH v2 01/20] xprtrdma: human-readable completion status Chuck Lever
2015-01-13 16:25 ` [PATCH v2 02/20] xprtrdma: Modernize htonl and ntohl Chuck Lever
2015-01-16 18:33 ` Anna Schumaker
2015-01-16 18:56 ` Chuck Lever
2015-01-16 19:01 ` Anna Schumaker
2015-01-13 16:25 ` [PATCH v2 03/20] xprtrdma: Display XIDs in host byte order Chuck Lever
2015-01-13 16:25 ` Chuck Lever [this message]
2015-01-13 16:25 ` [PATCH v2 05/20] xprtrdma: Rename "xprt" and "rdma_connect" fields in struct rpcrdma_xprt Chuck Lever
2015-01-13 16:25 ` [PATCH v2 06/20] xprtrdma: Remove rpcrdma_ep::rep_ia Chuck Lever
2015-01-13 16:25 ` [PATCH v2 07/20] xprtrdma: Remove rl_mr field, and the mr_chunk union Chuck Lever
2015-01-13 16:25 ` [PATCH v2 08/20] xprtrdma: Move credit update to RPC reply handler Chuck Lever
2015-01-13 16:25 ` [PATCH v2 09/20] xprtrdma: Remove rpcrdma_ep::rep_func and ::rep_xprt Chuck Lever
2015-01-13 16:26 ` [PATCH v2 10/20] xprtrdma: Free the pd if ib_query_qp() fails Chuck Lever
2015-01-13 16:26 ` [PATCH v2 11/20] xprtrdma: Take struct ib_device_attr off the stack Chuck Lever
2015-01-13 16:26 ` [PATCH v2 12/20] xprtrdma: Take struct ib_qp_attr and ib_qp_init_attr " Chuck Lever
2015-01-13 16:26 ` [PATCH v2 13/20] xprtrdma: Simplify synopsis of rpcrdma_buffer_create() Chuck Lever
2015-01-13 16:26 ` [PATCH v2 14/20] xprtrdma: Refactor rpcrdma_buffer_create() and rpcrdma_buffer_destroy() Chuck Lever
2015-01-13 16:26 ` [PATCH v2 15/20] xprtrdma: Add struct rpcrdma_regbuf and helpers Chuck Lever
2015-01-13 16:26 ` [PATCH v2 16/20] xprtrdma: Allocate RPC send buffer separately from struct rpcrdma_req Chuck Lever
2015-01-13 16:27 ` [PATCH v2 17/20] xprtrdma: Allocate RPC/RDMA " Chuck Lever
2015-01-13 16:27 ` [PATCH v2 18/20] xprtrdma: Allocate RPC/RDMA receive buffer separately from struct rpcrdma_rep Chuck Lever
2015-01-13 16:27 ` [PATCH v2 19/20] xprtrdma: Allocate zero pad separately from rpcrdma_buffer Chuck Lever
2015-01-13 16:27 ` [PATCH v2 20/20] xprtrdma: Clean up after adding regbuf management Chuck Lever
2015-01-13 17:44 ` [PATCH v2 00/20] NFS/RDMA client for 3.20 Steve Wise
2015-01-16 21:02 ` Anna Schumaker
2015-01-16 21:04 ` 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=20150113162516.14086.54951.stgit@manet.1015granger.net \
--to=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-rdma@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox