Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a246b010 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust
Browse files

[PATCH] RPC: introduce client-side transport switch



 Move the bulk of client-side socket-specific code into a separate source
 file, net/sunrpc/xprtsock.c.

 Test-plan:
 Millions of fsx operations.  Performance characterization such as "sio" or
 "iozone".  Destructive testing (unplugging the network temporarily, server
 reboots).  Connectathon with v2, v3, and v4.

 Version: Thu, 11 Aug 2005 16:03:38 -0400

 Signed-off-by: default avatarChuck Lever <cel@netapp.com>
 Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 094bb20b
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -165,11 +165,6 @@ extern int csum_partial_copy_to_xdr(struct xdr_buf *, struct sk_buff *);
extern ssize_t xdr_partial_copy_from_skb(struct xdr_buf *, unsigned int,
		skb_reader_t *, skb_read_actor_t);

struct socket;
struct sockaddr;
extern int xdr_sendpages(struct socket *, struct sockaddr *, int,
		struct xdr_buf *, unsigned int, int);

extern int xdr_encode_word(struct xdr_buf *, int, u32);
extern int xdr_decode_word(struct xdr_buf *, int, u32 *);

+31 −7
Original line number Diff line number Diff line
@@ -59,7 +59,13 @@ extern unsigned int xprt_tcp_slot_table_entries;
 */
#define RPC_REESTABLISH_TIMEOUT	(15*HZ)

/* RPC call and reply header size as number of 32bit words (verifier
/*
 * RPC transport idle timeout.
 */
#define RPC_IDLE_DISCONNECT_TIMEOUT	(5*60*HZ)

/*
 * RPC call and reply header size as number of 32bit words (verifier
 * size computed separately)
 */
#define RPC_CALLHDRSIZE		6
@@ -121,12 +127,19 @@ struct rpc_rqst {
#define rq_svec			rq_snd_buf.head
#define rq_slen			rq_snd_buf.len

#define XPRT_LAST_FRAG		(1 << 0)
#define XPRT_COPY_RECM		(1 << 1)
#define XPRT_COPY_XID		(1 << 2)
#define XPRT_COPY_DATA		(1 << 3)
struct rpc_task;
struct rpc_xprt;

struct rpc_xprt_ops {
	void		(*set_buffer_size)(struct rpc_xprt *xprt);
	void		(*connect)(struct rpc_task *task);
	int		(*send_request)(struct rpc_task *task);
	void		(*close)(struct rpc_xprt *xprt);
	void		(*destroy)(struct rpc_xprt *xprt);
};

struct rpc_xprt {
	struct rpc_xprt_ops *	ops;		/* transport methods */
	struct socket *		sock;		/* BSD socket layer */
	struct sock *		inet;		/* INET layer */

@@ -199,14 +212,22 @@ struct rpc_xprt {
	wait_queue_head_t	cong_wait;
};

#define XPRT_LAST_FRAG		(1 << 0)
#define XPRT_COPY_RECM		(1 << 1)
#define XPRT_COPY_XID		(1 << 2)
#define XPRT_COPY_DATA		(1 << 3)

#ifdef __KERNEL__

struct rpc_xprt *	xprt_create_proto(int proto, struct sockaddr_in *addr,
					struct rpc_timeout *toparms);
void			xprt_disconnect(struct rpc_xprt *);
int			xprt_destroy(struct rpc_xprt *);
void			xprt_set_timeout(struct rpc_timeout *, unsigned int,
					unsigned long);

struct rpc_rqst *	xprt_lookup_rqst(struct rpc_xprt *, u32);
void			xprt_complete_rqst(struct rpc_xprt *,
					struct rpc_rqst *, int);
void			xprt_reserve(struct rpc_task *);
int			xprt_prepare_transmit(struct rpc_task *);
void			xprt_transmit(struct rpc_task *);
@@ -214,7 +235,10 @@ void xprt_receive(struct rpc_task *);
int			xprt_adjust_timeout(struct rpc_rqst *req);
void			xprt_release(struct rpc_task *);
void			xprt_connect(struct rpc_task *);
void			xprt_sock_setbufsize(struct rpc_xprt *);
int			xs_setup_udp(struct rpc_xprt *,
					struct rpc_timeout *);
int			xs_setup_tcp(struct rpc_xprt *,
					struct rpc_timeout *);

#define XPRT_LOCKED	0
#define XPRT_CONNECT	1
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
obj-$(CONFIG_SUNRPC) += sunrpc.o
obj-$(CONFIG_SUNRPC_GSS) += auth_gss/

sunrpc-y := clnt.o xprt.o socklib.o sched.o \
sunrpc-y := clnt.o xprt.o socklib.o xprtsock.o sched.o \
	    auth.o auth_null.o auth_unix.o \
	    svc.o svcsock.o svcauth.o svcauth_unix.o \
	    pmap_clnt.o timer.o xdr.o \
+1 −2
Original line number Diff line number Diff line
@@ -525,8 +525,7 @@ rpc_setbufsize(struct rpc_clnt *clnt, unsigned int sndsize, unsigned int rcvsize
	xprt->rcvsize = 0;
	if (rcvsize)
		xprt->rcvsize = rcvsize + RPC_SLACK_SPACE;
	if (xprt_connected(xprt))
		xprt_sock_setbufsize(xprt);
	xprt->ops->set_buffer_size(xprt);
}

/*
+3 −0
Original line number Diff line number Diff line
@@ -119,6 +119,9 @@ proc_dodebug(ctl_table *table, int write, struct file *file,
	return 0;
}

unsigned int xprt_udp_slot_table_entries = RPC_DEF_SLOT_TABLE;
unsigned int xprt_tcp_slot_table_entries = RPC_DEF_SLOT_TABLE;

static unsigned int min_slot_table_size = RPC_MIN_SLOT_TABLE;
static unsigned int max_slot_table_size = RPC_MAX_SLOT_TABLE;

Loading