diff options
author | Chuck Lever <cel@citi.umich.edu> | 2005-08-11 16:25:20 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-09-23 12:38:11 -0400 |
commit | 094bb20b9fcab3a1652a77741caba6b78097d622 (patch) | |
tree | 85347e557be116ed1fa8bbf63555fcb83920baf5 /net/sunrpc/xprt.c | |
parent | 602f83273c89fdd25f24757564d8001cf723e740 (diff) |
[PATCH] RPC: extract socket logic common to both client and server
Clean-up: Move some code that is common to both RPC client- and server-side
socket transports into its own source file, net/sunrpc/socklib.c.
Test-plan:
Compile kernel with CONFIG_NFS enabled. Millions of fsx operations over
UDP, client and server. Connectathon over UDP.
Version: Thu, 11 Aug 2005 16:03:09 -0400
Signed-off-by: Chuck Lever <cel@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprt.c')
-rw-r--r-- | net/sunrpc/xprt.c | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 0e4ffdaa0129..67444f494fea 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -691,70 +691,6 @@ xprt_complete_rqst(struct rpc_xprt *xprt, struct rpc_rqst *req, int copied) | |||
691 | return; | 691 | return; |
692 | } | 692 | } |
693 | 693 | ||
694 | static size_t | ||
695 | skb_read_bits(skb_reader_t *desc, void *to, size_t len) | ||
696 | { | ||
697 | if (len > desc->count) | ||
698 | len = desc->count; | ||
699 | if (skb_copy_bits(desc->skb, desc->offset, to, len)) | ||
700 | return 0; | ||
701 | desc->count -= len; | ||
702 | desc->offset += len; | ||
703 | return len; | ||
704 | } | ||
705 | |||
706 | static size_t | ||
707 | skb_read_and_csum_bits(skb_reader_t *desc, void *to, size_t len) | ||
708 | { | ||
709 | unsigned int csum2, pos; | ||
710 | |||
711 | if (len > desc->count) | ||
712 | len = desc->count; | ||
713 | pos = desc->offset; | ||
714 | csum2 = skb_copy_and_csum_bits(desc->skb, pos, to, len, 0); | ||
715 | desc->csum = csum_block_add(desc->csum, csum2, pos); | ||
716 | desc->count -= len; | ||
717 | desc->offset += len; | ||
718 | return len; | ||
719 | } | ||
720 | |||
721 | /* | ||
722 | * We have set things up such that we perform the checksum of the UDP | ||
723 | * packet in parallel with the copies into the RPC client iovec. -DaveM | ||
724 | */ | ||
725 | int | ||
726 | csum_partial_copy_to_xdr(struct xdr_buf *xdr, struct sk_buff *skb) | ||
727 | { | ||
728 | skb_reader_t desc; | ||
729 | |||
730 | desc.skb = skb; | ||
731 | desc.offset = sizeof(struct udphdr); | ||
732 | desc.count = skb->len - desc.offset; | ||
733 | |||
734 | if (skb->ip_summed == CHECKSUM_UNNECESSARY) | ||
735 | goto no_checksum; | ||
736 | |||
737 | desc.csum = csum_partial(skb->data, desc.offset, skb->csum); | ||
738 | if (xdr_partial_copy_from_skb(xdr, 0, &desc, skb_read_and_csum_bits) < 0) | ||
739 | return -1; | ||
740 | if (desc.offset != skb->len) { | ||
741 | unsigned int csum2; | ||
742 | csum2 = skb_checksum(skb, desc.offset, skb->len - desc.offset, 0); | ||
743 | desc.csum = csum_block_add(desc.csum, csum2, desc.offset); | ||
744 | } | ||
745 | if (desc.count) | ||
746 | return -1; | ||
747 | if ((unsigned short)csum_fold(desc.csum)) | ||
748 | return -1; | ||
749 | return 0; | ||
750 | no_checksum: | ||
751 | if (xdr_partial_copy_from_skb(xdr, 0, &desc, skb_read_bits) < 0) | ||
752 | return -1; | ||
753 | if (desc.count) | ||
754 | return -1; | ||
755 | return 0; | ||
756 | } | ||
757 | |||
758 | /* | 694 | /* |
759 | * Input handler for RPC replies. Called from a bottom half and hence | 695 | * Input handler for RPC replies. Called from a bottom half and hence |
760 | * atomic. | 696 | * atomic. |