aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprt.c
diff options
context:
space:
mode:
authorChuck Lever <cel@netapp.com>2005-08-25 19:25:52 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-09-23 12:38:43 -0400
commit1570c1e41eabf6b7031f3e4322a2cf1cbe319fee (patch)
treeeee53757ac3e03d55b6c01bb0500996ba520a8bb /net/sunrpc/xprt.c
parent46c0ee8bc4ad3743de05e8b8b20201df44dcb6d3 (diff)
[PATCH] RPC: add generic interface for adjusting the congestion window
A new interface that allows transports to adjust their congestion window using the Van Jacobson implementation in xprt.c is provided. Test-plan: Use WAN simulation to cause sporadic bursty packet loss. Look for significant regression in performance or client stability. 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.c66
1 files changed, 26 insertions, 40 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index ffc595592af3..707806fe1a23 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -592,55 +592,41 @@ struct rpc_rqst *xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid)
592} 592}
593 593
594/** 594/**
595 * xprt_update_rtt - update an RPC client's RTT state after receiving a reply
596 * @task: RPC request that recently completed
597 *
598 */
599void xprt_update_rtt(struct rpc_task *task)
600{
601 struct rpc_rqst *req = task->tk_rqstp;
602 struct rpc_rtt *rtt = task->tk_client->cl_rtt;
603 unsigned timer = task->tk_msg.rpc_proc->p_timer;
604
605 if (timer) {
606 if (req->rq_ntrans == 1)
607 rpc_update_rtt(rtt, timer,
608 (long)jiffies - req->rq_xtime);
609 rpc_set_timeo(rtt, timer, req->rq_ntrans - 1);
610 }
611}
612
613/**
595 * xprt_complete_rqst - called when reply processing is complete 614 * xprt_complete_rqst - called when reply processing is complete
596 * @xprt: controlling transport 615 * @task: RPC request that recently completed
597 * @req: RPC request that just completed
598 * @copied: actual number of bytes received from the transport 616 * @copied: actual number of bytes received from the transport
599 * 617 *
618 * Caller holds transport lock.
600 */ 619 */
601void xprt_complete_rqst(struct rpc_xprt *xprt, struct rpc_rqst *req, int copied) 620void xprt_complete_rqst(struct rpc_task *task, int copied)
602{ 621{
603 struct rpc_task *task = req->rq_task; 622 struct rpc_rqst *req = task->tk_rqstp;
604 struct rpc_clnt *clnt = task->tk_client;
605
606 /* Adjust congestion window */
607 if (!xprt->nocong) {
608 unsigned timer = task->tk_msg.rpc_proc->p_timer;
609 xprt_adjust_cwnd(task, copied);
610 if (timer) {
611 if (req->rq_ntrans == 1)
612 rpc_update_rtt(clnt->cl_rtt, timer,
613 (long)jiffies - req->rq_xtime);
614 rpc_set_timeo(clnt->cl_rtt, timer, req->rq_ntrans - 1);
615 }
616 }
617 623
618#ifdef RPC_PROFILE 624 dprintk("RPC: %5u xid %08x complete (%d bytes received)\n",
619 /* Profile only reads for now */ 625 task->tk_pid, ntohl(req->rq_xid), copied);
620 if (copied > 1024) {
621 static unsigned long nextstat;
622 static unsigned long pkt_rtt, pkt_len, pkt_cnt;
623
624 pkt_cnt++;
625 pkt_len += req->rq_slen + copied;
626 pkt_rtt += jiffies - req->rq_xtime;
627 if (time_before(nextstat, jiffies)) {
628 printk("RPC: %lu %ld cwnd\n", jiffies, xprt->cwnd);
629 printk("RPC: %ld %ld %ld %ld stat\n",
630 jiffies, pkt_cnt, pkt_len, pkt_rtt);
631 pkt_rtt = pkt_len = pkt_cnt = 0;
632 nextstat = jiffies + 5 * HZ;
633 }
634 }
635#endif
636 626
637 dprintk("RPC: %4d has input (%d bytes)\n", task->tk_pid, copied);
638 list_del_init(&req->rq_list); 627 list_del_init(&req->rq_list);
639 req->rq_received = req->rq_private_buf.len = copied; 628 req->rq_received = req->rq_private_buf.len = copied;
640
641 /* ... and wake up the process. */
642 rpc_wake_up_task(task); 629 rpc_wake_up_task(task);
643 return;
644} 630}
645 631
646static void xprt_timer(struct rpc_task *task) 632static void xprt_timer(struct rpc_task *task)