[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>
This commit is contained in:
Chuck Lever 2005-08-25 16:25:52 -07:00 committed by Trond Myklebust
parent 46c0ee8bc4
commit 1570c1e41e
3 changed files with 31 additions and 47 deletions

View File

@ -258,9 +258,10 @@ void xprt_set_retrans_timeout_rtt(struct rpc_task *task);
void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
void xprt_wait_for_buffer_space(struct rpc_task *task); void xprt_wait_for_buffer_space(struct rpc_task *task);
void xprt_write_space(struct rpc_xprt *xprt); void xprt_write_space(struct rpc_xprt *xprt);
void xprt_update_rtt(struct rpc_task *task);
void xprt_adjust_cwnd(struct rpc_task *task, int result); void xprt_adjust_cwnd(struct rpc_task *task, int result);
struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid); struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid);
void xprt_complete_rqst(struct rpc_xprt *xprt, struct rpc_rqst *req, int copied); void xprt_complete_rqst(struct rpc_task *task, int copied);
void xprt_disconnect(struct rpc_xprt *xprt); void xprt_disconnect(struct rpc_xprt *xprt);
/* /*

View File

@ -592,55 +592,41 @@ struct rpc_rqst *xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid)
} }
/** /**
* xprt_complete_rqst - called when reply processing is complete * xprt_update_rtt - update an RPC client's RTT state after receiving a reply
* @xprt: controlling transport * @task: RPC request that recently completed
* @req: RPC request that just completed
* @copied: actual number of bytes received from the transport
* *
*/ */
void xprt_complete_rqst(struct rpc_xprt *xprt, struct rpc_rqst *req, int copied) void xprt_update_rtt(struct rpc_task *task)
{ {
struct rpc_task *task = req->rq_task; struct rpc_rqst *req = task->tk_rqstp;
struct rpc_clnt *clnt = task->tk_client; struct rpc_rtt *rtt = task->tk_client->cl_rtt;
unsigned timer = task->tk_msg.rpc_proc->p_timer;
/* Adjust congestion window */ if (timer) {
if (!xprt->nocong) { if (req->rq_ntrans == 1)
unsigned timer = task->tk_msg.rpc_proc->p_timer; rpc_update_rtt(rtt, timer,
xprt_adjust_cwnd(task, copied); (long)jiffies - req->rq_xtime);
if (timer) { rpc_set_timeo(rtt, timer, req->rq_ntrans - 1);
if (req->rq_ntrans == 1)
rpc_update_rtt(clnt->cl_rtt, timer,
(long)jiffies - req->rq_xtime);
rpc_set_timeo(clnt->cl_rtt, timer, req->rq_ntrans - 1);
}
} }
}
#ifdef RPC_PROFILE /**
/* Profile only reads for now */ * xprt_complete_rqst - called when reply processing is complete
if (copied > 1024) { * @task: RPC request that recently completed
static unsigned long nextstat; * @copied: actual number of bytes received from the transport
static unsigned long pkt_rtt, pkt_len, pkt_cnt; *
* Caller holds transport lock.
*/
void xprt_complete_rqst(struct rpc_task *task, int copied)
{
struct rpc_rqst *req = task->tk_rqstp;
pkt_cnt++; dprintk("RPC: %5u xid %08x complete (%d bytes received)\n",
pkt_len += req->rq_slen + copied; task->tk_pid, ntohl(req->rq_xid), copied);
pkt_rtt += jiffies - req->rq_xtime;
if (time_before(nextstat, jiffies)) {
printk("RPC: %lu %ld cwnd\n", jiffies, xprt->cwnd);
printk("RPC: %ld %ld %ld %ld stat\n",
jiffies, pkt_cnt, pkt_len, pkt_rtt);
pkt_rtt = pkt_len = pkt_cnt = 0;
nextstat = jiffies + 5 * HZ;
}
}
#endif
dprintk("RPC: %4d has input (%d bytes)\n", task->tk_pid, copied);
list_del_init(&req->rq_list); list_del_init(&req->rq_list);
req->rq_received = req->rq_private_buf.len = copied; req->rq_received = req->rq_private_buf.len = copied;
/* ... and wake up the process. */
rpc_wake_up_task(task); rpc_wake_up_task(task);
return;
} }
static void xprt_timer(struct rpc_task *task) static void xprt_timer(struct rpc_task *task)

View File

@ -460,8 +460,6 @@ static void xs_udp_data_ready(struct sock *sk, int len)
goto out_unlock; goto out_unlock;
task = rovr->rq_task; task = rovr->rq_task;
dprintk("RPC: %4d received reply\n", task->tk_pid);
if ((copied = rovr->rq_private_buf.buflen) > repsize) if ((copied = rovr->rq_private_buf.buflen) > repsize)
copied = repsize; copied = repsize;
@ -472,7 +470,9 @@ static void xs_udp_data_ready(struct sock *sk, int len)
/* Something worked... */ /* Something worked... */
dst_confirm(skb->dst); dst_confirm(skb->dst);
xprt_complete_rqst(xprt, rovr, copied); xprt_adjust_cwnd(task, copied);
xprt_update_rtt(task);
xprt_complete_rqst(task, copied);
out_unlock: out_unlock:
spin_unlock(&xprt->transport_lock); spin_unlock(&xprt->transport_lock);
@ -634,11 +634,8 @@ static inline void xs_tcp_read_request(struct rpc_xprt *xprt, skb_reader_t *desc
} }
out: out:
if (!(xprt->tcp_flags & XPRT_COPY_DATA)) { if (!(xprt->tcp_flags & XPRT_COPY_DATA))
dprintk("RPC: %4d received reply complete\n", xprt_complete_rqst(req->rq_task, xprt->tcp_copied);
req->rq_task->tk_pid);
xprt_complete_rqst(xprt, req, xprt->tcp_copied);
}
spin_unlock(&xprt->transport_lock); spin_unlock(&xprt->transport_lock);
xs_tcp_check_recm(xprt); xs_tcp_check_recm(xprt);
} }