svcrdma: Clean up RPC-over-RDMA Reply header encoder
authorChuck Lever <chuck.lever@oracle.com>
Tue, 7 Feb 2017 16:58:23 +0000 (11:58 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 8 Feb 2017 19:41:41 +0000 (14:41 -0500)
commit98fc21d3bfd55a36ce9eb7b32d1ce146f0d1696d
tree42a4f52ca9257d1274f8d6760c2687ab1031ba0b
parentcbaf58032efca401834518b905f528ac912449e4
svcrdma: Clean up RPC-over-RDMA Reply header encoder

Replace C structure-based XDR decoding with pointer arithmetic.
Pointer arithmetic is considered more portable, and is used
throughout the kernel's existing XDR encoders. The gcc optimizer
generates similar assembler code either way.

Byte-swapping before a memory store on x86 typically results in an
instruction pipeline stall. Avoid byte-swapping when encoding a new
header.

svcrdma currently doesn't alter a connection's credit grant value
after the connection has been accepted, so it is effectively a
constant. Cache the byte-swapped value in a separate field.

Christoph suggested pulling the header encoding logic into the only
function that uses it.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
include/linux/sunrpc/svc_rdma.h
net/sunrpc/xprtrdma/svc_rdma_marshal.c
net/sunrpc/xprtrdma/svc_rdma_sendto.c
net/sunrpc/xprtrdma/svc_rdma_transport.c