xprt.c (1b092092bf0e2e8b7af1c2a03f615b4e60b05d47) xprt.c (6a24dfb645dbcb05b34d08b991d082bdaa3ff072)
1/*
2 * linux/net/sunrpc/xprt.c
3 *
4 * This is a generic RPC call interface supporting congestion avoidance,
5 * and asynchronous calls.
6 *
7 * The interface works like this:
8 *

--- 424 unchanged lines hidden (view full) ---

433 struct rpc_rqst *req = task->tk_rqstp;
434
435 __xprt_put_cong(req->rq_xprt, req);
436}
437EXPORT_SYMBOL_GPL(xprt_release_rqst_cong);
438
439/**
440 * xprt_adjust_cwnd - adjust transport congestion window
1/*
2 * linux/net/sunrpc/xprt.c
3 *
4 * This is a generic RPC call interface supporting congestion avoidance,
5 * and asynchronous calls.
6 *
7 * The interface works like this:
8 *

--- 424 unchanged lines hidden (view full) ---

433 struct rpc_rqst *req = task->tk_rqstp;
434
435 __xprt_put_cong(req->rq_xprt, req);
436}
437EXPORT_SYMBOL_GPL(xprt_release_rqst_cong);
438
439/**
440 * xprt_adjust_cwnd - adjust transport congestion window
441 * @xprt: pointer to xprt
441 * @task: recently completed RPC request used to adjust window
442 * @result: result code of completed RPC request
443 *
444 * We use a time-smoothed congestion estimator to avoid heavy oscillation.
445 */
442 * @task: recently completed RPC request used to adjust window
443 * @result: result code of completed RPC request
444 *
445 * We use a time-smoothed congestion estimator to avoid heavy oscillation.
446 */
446void xprt_adjust_cwnd(struct rpc_task *task, int result)
447void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result)
447{
448 struct rpc_rqst *req = task->tk_rqstp;
448{
449 struct rpc_rqst *req = task->tk_rqstp;
449 struct rpc_xprt *xprt = task->tk_xprt;
450 unsigned long cwnd = xprt->cwnd;
451
452 if (result >= 0 && cwnd <= xprt->cong) {
453 /* The (cwnd >> 1) term makes sure
454 * the result gets rounded properly. */
455 cwnd += (RPC_CWNDSCALE * RPC_CWNDSCALE + (cwnd >> 1)) / cwnd;
456 if (cwnd > RPC_MAXCWND(xprt))
457 cwnd = RPC_MAXCWND(xprt);

--- 371 unchanged lines hidden (view full) ---

829
830 if (task->tk_status != -ETIMEDOUT)
831 return;
832 dprintk("RPC: %5u xprt_timer\n", task->tk_pid);
833
834 spin_lock_bh(&xprt->transport_lock);
835 if (!req->rq_reply_bytes_recvd) {
836 if (xprt->ops->timer)
450 unsigned long cwnd = xprt->cwnd;
451
452 if (result >= 0 && cwnd <= xprt->cong) {
453 /* The (cwnd >> 1) term makes sure
454 * the result gets rounded properly. */
455 cwnd += (RPC_CWNDSCALE * RPC_CWNDSCALE + (cwnd >> 1)) / cwnd;
456 if (cwnd > RPC_MAXCWND(xprt))
457 cwnd = RPC_MAXCWND(xprt);

--- 371 unchanged lines hidden (view full) ---

829
830 if (task->tk_status != -ETIMEDOUT)
831 return;
832 dprintk("RPC: %5u xprt_timer\n", task->tk_pid);
833
834 spin_lock_bh(&xprt->transport_lock);
835 if (!req->rq_reply_bytes_recvd) {
836 if (xprt->ops->timer)
837 xprt->ops->timer(task);
837 xprt->ops->timer(xprt, task);
838 } else
839 task->tk_status = 0;
840 spin_unlock_bh(&xprt->transport_lock);
841}
842
843static inline int xprt_has_timer(struct rpc_xprt *xprt)
844{
845 return xprt->idle_timeout != 0;

--- 462 unchanged lines hidden ---
838 } else
839 task->tk_status = 0;
840 spin_unlock_bh(&xprt->transport_lock);
841}
842
843static inline int xprt_has_timer(struct rpc_xprt *xprt)
844{
845 return xprt->idle_timeout != 0;

--- 462 unchanged lines hidden ---