Lines Matching refs:task

75 static void	 xprt_request_init(struct rpc_task *task);
264 int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_reserve_xprt() argument
266 struct rpc_rqst *req = task->tk_rqstp; in xprt_reserve_xprt()
269 if (task == xprt->snd_task) in xprt_reserve_xprt()
275 xprt->snd_task = task; in xprt_reserve_xprt()
278 trace_xprt_reserve_xprt(xprt, task); in xprt_reserve_xprt()
284 task->tk_status = -EAGAIN; in xprt_reserve_xprt()
285 if (RPC_IS_SOFT(task)) in xprt_reserve_xprt()
286 rpc_sleep_on_timeout(&xprt->sending, task, NULL, in xprt_reserve_xprt()
289 rpc_sleep_on(&xprt->sending, task, NULL); in xprt_reserve_xprt()
328 int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_reserve_xprt_cong() argument
330 struct rpc_rqst *req = task->tk_rqstp; in xprt_reserve_xprt_cong()
333 if (task == xprt->snd_task) in xprt_reserve_xprt_cong()
338 xprt->snd_task = task; in xprt_reserve_xprt_cong()
344 xprt->snd_task = task; in xprt_reserve_xprt_cong()
350 task->tk_status = -EAGAIN; in xprt_reserve_xprt_cong()
351 if (RPC_IS_SOFT(task)) in xprt_reserve_xprt_cong()
352 rpc_sleep_on_timeout(&xprt->sending, task, NULL, in xprt_reserve_xprt_cong()
355 rpc_sleep_on(&xprt->sending, task, NULL); in xprt_reserve_xprt_cong()
358 trace_xprt_reserve_cong(xprt, task); in xprt_reserve_xprt_cong()
363 static inline int xprt_lock_write(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_lock_write() argument
367 if (test_bit(XPRT_LOCKED, &xprt->state) && xprt->snd_task == task) in xprt_lock_write()
370 retval = xprt->ops->reserve_xprt(xprt, task); in xprt_lock_write()
375 static bool __xprt_lock_write_func(struct rpc_task *task, void *data) in __xprt_lock_write_func() argument
379 xprt->snd_task = task; in __xprt_lock_write_func()
418 void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_release_xprt() argument
420 if (xprt->snd_task == task) { in xprt_release_xprt()
424 trace_xprt_release_xprt(xprt, task); in xprt_release_xprt()
436 void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_release_xprt_cong() argument
438 if (xprt->snd_task == task) { in xprt_release_xprt_cong()
442 trace_xprt_release_cong(xprt, task); in xprt_release_xprt_cong()
446 void xprt_release_write(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_release_write() argument
448 if (xprt->snd_task != task) in xprt_release_write()
451 xprt->ops->release_xprt(xprt, task); in xprt_release_write()
517 void xprt_release_rqst_cong(struct rpc_task *task) in xprt_release_rqst_cong() argument
519 struct rpc_rqst *req = task->tk_rqstp; in xprt_release_rqst_cong()
561 void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result) in xprt_adjust_cwnd() argument
563 struct rpc_rqst *req = task->tk_rqstp; in xprt_adjust_cwnd()
677 static void xprt_init_majortimeo(struct rpc_task *task, struct rpc_rqst *req) in xprt_init_majortimeo() argument
685 time_init = xprt_abs_ktime_to_jiffies(task->tk_start); in xprt_init_majortimeo()
686 req->rq_timeout = task->tk_client->cl_timeout->to_initval; in xprt_init_majortimeo()
802 xprt_request_retransmit_after_disconnect(struct rpc_task *task) in xprt_request_retransmit_after_disconnect() argument
804 struct rpc_rqst *req = task->tk_rqstp; in xprt_request_retransmit_after_disconnect()
878 struct rpc_task *task, in xprt_lock_connect() argument
886 if (xprt->snd_task != task) in xprt_lock_connect()
919 void xprt_connect(struct rpc_task *task) in xprt_connect() argument
921 struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt; in xprt_connect()
926 task->tk_status = -EAGAIN; in xprt_connect()
929 if (!xprt_lock_write(xprt, task)) in xprt_connect()
938 task->tk_rqstp->rq_connect_cookie = xprt->connect_cookie; in xprt_connect()
939 rpc_sleep_on_timeout(&xprt->pending, task, NULL, in xprt_connect()
940 xprt_request_timeout(task->tk_rqstp)); in xprt_connect()
949 xprt->ops->connect(xprt, task); in xprt_connect()
952 task->tk_status = 0; in xprt_connect()
953 rpc_wake_up_queued_task(&xprt->pending, task); in xprt_connect()
956 xprt_release_write(xprt, task); in xprt_connect()
1128 xprt_request_data_received(struct rpc_task *task) in xprt_request_data_received() argument
1130 return !test_bit(RPC_TASK_NEED_RECV, &task->tk_runstate) && in xprt_request_data_received()
1131 READ_ONCE(task->tk_rqstp->rq_reply_bytes_recvd) != 0; in xprt_request_data_received()
1135 xprt_request_need_enqueue_receive(struct rpc_task *task, struct rpc_rqst *req) in xprt_request_need_enqueue_receive() argument
1137 return !test_bit(RPC_TASK_NEED_RECV, &task->tk_runstate) && in xprt_request_need_enqueue_receive()
1138 READ_ONCE(task->tk_rqstp->rq_reply_bytes_recvd) == 0; in xprt_request_need_enqueue_receive()
1147 xprt_request_enqueue_receive(struct rpc_task *task) in xprt_request_enqueue_receive() argument
1149 struct rpc_rqst *req = task->tk_rqstp; in xprt_request_enqueue_receive()
1152 if (!xprt_request_need_enqueue_receive(task, req)) in xprt_request_enqueue_receive()
1155 xprt_request_prepare(task->tk_rqstp); in xprt_request_enqueue_receive()
1164 set_bit(RPC_TASK_NEED_RECV, &task->tk_runstate); in xprt_request_enqueue_receive()
1178 xprt_request_dequeue_receive_locked(struct rpc_task *task) in xprt_request_dequeue_receive_locked() argument
1180 struct rpc_rqst *req = task->tk_rqstp; in xprt_request_dequeue_receive_locked()
1182 if (test_and_clear_bit(RPC_TASK_NEED_RECV, &task->tk_runstate)) in xprt_request_dequeue_receive_locked()
1192 void xprt_update_rtt(struct rpc_task *task) in xprt_update_rtt() argument
1194 struct rpc_rqst *req = task->tk_rqstp; in xprt_update_rtt()
1195 struct rpc_rtt *rtt = task->tk_client->cl_rtt; in xprt_update_rtt()
1196 unsigned int timer = task->tk_msg.rpc_proc->p_timer; in xprt_update_rtt()
1214 void xprt_complete_rqst(struct rpc_task *task, int copied) in xprt_complete_rqst() argument
1216 struct rpc_rqst *req = task->tk_rqstp; in xprt_complete_rqst()
1226 xprt_request_dequeue_receive_locked(task); in xprt_complete_rqst()
1227 rpc_wake_up_queued_task(&xprt->pending, task); in xprt_complete_rqst()
1231 static void xprt_timer(struct rpc_task *task) in xprt_timer() argument
1233 struct rpc_rqst *req = task->tk_rqstp; in xprt_timer()
1236 if (task->tk_status != -ETIMEDOUT) in xprt_timer()
1239 trace_xprt_timer(xprt, req->rq_xid, task->tk_status); in xprt_timer()
1242 xprt->ops->timer(xprt, task); in xprt_timer()
1244 task->tk_status = 0; in xprt_timer()
1256 void xprt_wait_for_reply_request_def(struct rpc_task *task) in xprt_wait_for_reply_request_def() argument
1258 struct rpc_rqst *req = task->tk_rqstp; in xprt_wait_for_reply_request_def()
1260 rpc_sleep_on_timeout(&req->rq_xprt->pending, task, xprt_timer, in xprt_wait_for_reply_request_def()
1272 void xprt_wait_for_reply_request_rtt(struct rpc_task *task) in xprt_wait_for_reply_request_rtt() argument
1274 int timer = task->tk_msg.rpc_proc->p_timer; in xprt_wait_for_reply_request_rtt()
1275 struct rpc_clnt *clnt = task->tk_client; in xprt_wait_for_reply_request_rtt()
1277 struct rpc_rqst *req = task->tk_rqstp; in xprt_wait_for_reply_request_rtt()
1285 rpc_sleep_on_timeout(&req->rq_xprt->pending, task, xprt_timer, in xprt_wait_for_reply_request_rtt()
1295 void xprt_request_wait_receive(struct rpc_task *task) in xprt_request_wait_receive() argument
1297 struct rpc_rqst *req = task->tk_rqstp; in xprt_request_wait_receive()
1300 if (!test_bit(RPC_TASK_NEED_RECV, &task->tk_runstate)) in xprt_request_wait_receive()
1308 if (test_bit(RPC_TASK_NEED_RECV, &task->tk_runstate)) { in xprt_request_wait_receive()
1309 xprt->ops->wait_for_reply_request(task); in xprt_request_wait_receive()
1315 if (xprt_request_retransmit_after_disconnect(task)) in xprt_request_wait_receive()
1317 task, -ENOTCONN); in xprt_request_wait_receive()
1323 xprt_request_need_enqueue_transmit(struct rpc_task *task, struct rpc_rqst *req) in xprt_request_need_enqueue_transmit() argument
1325 return !test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate); in xprt_request_need_enqueue_transmit()
1335 xprt_request_enqueue_transmit(struct rpc_task *task) in xprt_request_enqueue_transmit() argument
1337 struct rpc_rqst *pos, *req = task->tk_rqstp; in xprt_request_enqueue_transmit()
1340 if (xprt_request_need_enqueue_transmit(task, req)) { in xprt_request_enqueue_transmit()
1357 } else if (RPC_IS_SWAPPER(task)) { in xprt_request_enqueue_transmit()
1370 if (pos->rq_task->tk_owner != task->tk_owner) in xprt_request_enqueue_transmit()
1381 set_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate); in xprt_request_enqueue_transmit()
1394 xprt_request_dequeue_transmit_locked(struct rpc_task *task) in xprt_request_dequeue_transmit_locked() argument
1396 struct rpc_rqst *req = task->tk_rqstp; in xprt_request_dequeue_transmit_locked()
1398 if (!test_and_clear_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) in xprt_request_dequeue_transmit_locked()
1420 xprt_request_dequeue_transmit(struct rpc_task *task) in xprt_request_dequeue_transmit() argument
1422 struct rpc_rqst *req = task->tk_rqstp; in xprt_request_dequeue_transmit()
1426 xprt_request_dequeue_transmit_locked(task); in xprt_request_dequeue_transmit()
1438 xprt_request_dequeue_xprt(struct rpc_task *task) in xprt_request_dequeue_xprt() argument
1440 struct rpc_rqst *req = task->tk_rqstp; in xprt_request_dequeue_xprt()
1443 if (test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate) || in xprt_request_dequeue_xprt()
1444 test_bit(RPC_TASK_NEED_RECV, &task->tk_runstate) || in xprt_request_dequeue_xprt()
1447 xprt_request_dequeue_transmit_locked(task); in xprt_request_dequeue_xprt()
1448 xprt_request_dequeue_receive_locked(task); in xprt_request_dequeue_xprt()
1450 set_bit(RPC_TASK_MSG_PIN_WAIT, &task->tk_runstate); in xprt_request_dequeue_xprt()
1454 clear_bit(RPC_TASK_MSG_PIN_WAIT, &task->tk_runstate); in xprt_request_dequeue_xprt()
1483 xprt_request_need_retransmit(struct rpc_task *task) in xprt_request_need_retransmit() argument
1485 return xprt_request_retransmit_after_disconnect(task); in xprt_request_need_retransmit()
1493 bool xprt_prepare_transmit(struct rpc_task *task) in xprt_prepare_transmit() argument
1495 struct rpc_rqst *req = task->tk_rqstp; in xprt_prepare_transmit()
1498 if (!xprt_lock_write(xprt, task)) { in xprt_prepare_transmit()
1500 if (!test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) in xprt_prepare_transmit()
1502 task, 0); in xprt_prepare_transmit()
1509 void xprt_end_transmit(struct rpc_task *task) in xprt_end_transmit() argument
1511 struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt; in xprt_end_transmit()
1514 xprt_release_write(xprt, task); in xprt_end_transmit()
1531 struct rpc_task *task = req->rq_task; in xprt_request_transmit() local
1533 int is_retrans = RPC_WAS_SENT(task); in xprt_request_transmit()
1537 if (xprt_request_data_received(task)) { in xprt_request_transmit()
1542 if (rpcauth_xmit_need_reencode(task)) { in xprt_request_transmit()
1546 if (RPC_SIGNALLED(task)) { in xprt_request_transmit()
1559 trace_rpc_xdr_sendto(task, &req->rq_snd_buf); in xprt_request_transmit()
1569 task->tk_client->cl_stats->rpcretrans++; in xprt_request_transmit()
1575 task->tk_flags |= RPC_TASK_SENT; in xprt_request_transmit()
1588 xprt_request_dequeue_transmit(task); in xprt_request_transmit()
1589 rpc_wake_up_queued_task_set_status(&xprt->sending, task, status); in xprt_request_transmit()
1603 xprt_transmit(struct rpc_task *task) in xprt_transmit() argument
1605 struct rpc_rqst *next, *req = task->tk_rqstp; in xprt_transmit()
1617 status = xprt_request_transmit(next, task); in xprt_transmit()
1623 if (test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) in xprt_transmit()
1624 task->tk_status = status; in xprt_transmit()
1628 if (xprt_request_data_received(task) && in xprt_transmit()
1629 !test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) in xprt_transmit()
1636 static void xprt_complete_request_init(struct rpc_task *task) in xprt_complete_request_init() argument
1638 if (task->tk_rqstp) in xprt_complete_request_init()
1639 xprt_request_init(task); in xprt_complete_request_init()
1642 void xprt_add_backlog(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_add_backlog() argument
1645 rpc_sleep_on(&xprt->backlog, task, xprt_complete_request_init); in xprt_add_backlog()
1649 static bool __xprt_set_rq(struct rpc_task *task, void *data) in __xprt_set_rq() argument
1653 if (task->tk_rqstp == NULL) { in __xprt_set_rq()
1655 task->tk_rqstp = req; in __xprt_set_rq()
1671 static bool xprt_throttle_congested(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_throttle_congested() argument
1679 xprt_add_backlog(xprt, task); in xprt_throttle_congested()
1715 void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_alloc_slot() argument
1732 task->tk_status = -ENOMEM; in xprt_alloc_slot()
1735 xprt_add_backlog(xprt, task); in xprt_alloc_slot()
1739 task->tk_status = -EAGAIN; in xprt_alloc_slot()
1748 task->tk_status = 0; in xprt_alloc_slot()
1749 task->tk_rqstp = req; in xprt_alloc_slot()
1870 xprt_request_init(struct rpc_task *task) in xprt_request_init() argument
1872 struct rpc_xprt *xprt = task->tk_xprt; in xprt_request_init()
1873 struct rpc_rqst *req = task->tk_rqstp; in xprt_request_init()
1875 req->rq_task = task; in xprt_request_init()
1887 xprt_init_majortimeo(task, req); in xprt_request_init()
1893 xprt_do_reserve(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_do_reserve() argument
1895 xprt->ops->alloc_slot(xprt, task); in xprt_do_reserve()
1896 if (task->tk_rqstp != NULL) in xprt_do_reserve()
1897 xprt_request_init(task); in xprt_do_reserve()
1908 void xprt_reserve(struct rpc_task *task) in xprt_reserve() argument
1910 struct rpc_xprt *xprt = task->tk_xprt; in xprt_reserve()
1912 task->tk_status = 0; in xprt_reserve()
1913 if (task->tk_rqstp != NULL) in xprt_reserve()
1916 task->tk_status = -EAGAIN; in xprt_reserve()
1917 if (!xprt_throttle_congested(xprt, task)) in xprt_reserve()
1918 xprt_do_reserve(xprt, task); in xprt_reserve()
1930 void xprt_retry_reserve(struct rpc_task *task) in xprt_retry_reserve() argument
1932 struct rpc_xprt *xprt = task->tk_xprt; in xprt_retry_reserve()
1934 task->tk_status = 0; in xprt_retry_reserve()
1935 if (task->tk_rqstp != NULL) in xprt_retry_reserve()
1938 task->tk_status = -EAGAIN; in xprt_retry_reserve()
1939 xprt_do_reserve(xprt, task); in xprt_retry_reserve()
1947 void xprt_release(struct rpc_task *task) in xprt_release() argument
1950 struct rpc_rqst *req = task->tk_rqstp; in xprt_release()
1953 if (task->tk_client) { in xprt_release()
1954 xprt = task->tk_xprt; in xprt_release()
1955 xprt_release_write(xprt, task); in xprt_release()
1961 xprt_request_dequeue_xprt(task); in xprt_release()
1963 xprt->ops->release_xprt(xprt, task); in xprt_release()
1965 xprt->ops->release_request(task); in xprt_release()
1969 xprt->ops->buf_free(task); in xprt_release()
1977 task->tk_rqstp = NULL; in xprt_release()
1986 xprt_init_bc_request(struct rpc_rqst *req, struct rpc_task *task) in xprt_init_bc_request() argument
1990 task->tk_rqstp = req; in xprt_init_bc_request()
1991 req->rq_task = task; in xprt_init_bc_request()