Lines Matching refs:task
75 static void xprt_request_init(struct rpc_task *task);
265 int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_reserve_xprt() argument
267 struct rpc_rqst *req = task->tk_rqstp; in xprt_reserve_xprt()
270 if (task == xprt->snd_task) in xprt_reserve_xprt()
276 xprt->snd_task = task; in xprt_reserve_xprt()
279 trace_xprt_reserve_xprt(xprt, task); in xprt_reserve_xprt()
285 task->tk_status = -EAGAIN; in xprt_reserve_xprt()
286 if (RPC_IS_SOFT(task)) in xprt_reserve_xprt()
287 rpc_sleep_on_timeout(&xprt->sending, task, NULL, in xprt_reserve_xprt()
290 rpc_sleep_on(&xprt->sending, task, NULL); in xprt_reserve_xprt()
329 int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_reserve_xprt_cong() argument
331 struct rpc_rqst *req = task->tk_rqstp; in xprt_reserve_xprt_cong()
334 if (task == xprt->snd_task) in xprt_reserve_xprt_cong()
339 xprt->snd_task = task; in xprt_reserve_xprt_cong()
345 xprt->snd_task = task; in xprt_reserve_xprt_cong()
351 task->tk_status = -EAGAIN; in xprt_reserve_xprt_cong()
352 if (RPC_IS_SOFT(task)) in xprt_reserve_xprt_cong()
353 rpc_sleep_on_timeout(&xprt->sending, task, NULL, in xprt_reserve_xprt_cong()
356 rpc_sleep_on(&xprt->sending, task, NULL); in xprt_reserve_xprt_cong()
359 trace_xprt_reserve_cong(xprt, task); in xprt_reserve_xprt_cong()
364 static inline int xprt_lock_write(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_lock_write() argument
368 if (test_bit(XPRT_LOCKED, &xprt->state) && xprt->snd_task == task) in xprt_lock_write()
371 retval = xprt->ops->reserve_xprt(xprt, task); in xprt_lock_write()
376 static bool __xprt_lock_write_func(struct rpc_task *task, void *data) in __xprt_lock_write_func() argument
380 xprt->snd_task = task; in __xprt_lock_write_func()
419 void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_release_xprt() argument
421 if (xprt->snd_task == task) { in xprt_release_xprt()
425 trace_xprt_release_xprt(xprt, task); in xprt_release_xprt()
437 void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_release_xprt_cong() argument
439 if (xprt->snd_task == task) { in xprt_release_xprt_cong()
443 trace_xprt_release_cong(xprt, task); in xprt_release_xprt_cong()
447 void xprt_release_write(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_release_write() argument
449 if (xprt->snd_task != task) in xprt_release_write()
452 xprt->ops->release_xprt(xprt, task); in xprt_release_write()
518 void xprt_release_rqst_cong(struct rpc_task *task) in xprt_release_rqst_cong() argument
520 struct rpc_rqst *req = task->tk_rqstp; in xprt_release_rqst_cong()
562 void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result) in xprt_adjust_cwnd() argument
564 struct rpc_rqst *req = task->tk_rqstp; in xprt_adjust_cwnd()
678 static void xprt_init_majortimeo(struct rpc_task *task, struct rpc_rqst *req) in xprt_init_majortimeo() argument
686 time_init = xprt_abs_ktime_to_jiffies(task->tk_start); in xprt_init_majortimeo()
687 req->rq_timeout = task->tk_client->cl_timeout->to_initval; in xprt_init_majortimeo()
803 xprt_request_retransmit_after_disconnect(struct rpc_task *task) in xprt_request_retransmit_after_disconnect() argument
805 struct rpc_rqst *req = task->tk_rqstp; in xprt_request_retransmit_after_disconnect()
879 struct rpc_task *task, in xprt_lock_connect() argument
887 if (xprt->snd_task != task) in xprt_lock_connect()
920 void xprt_connect(struct rpc_task *task) in xprt_connect() argument
922 struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt; in xprt_connect()
927 task->tk_status = -EAGAIN; in xprt_connect()
930 if (!xprt_lock_write(xprt, task)) in xprt_connect()
934 task->tk_rqstp->rq_connect_cookie = xprt->connect_cookie; in xprt_connect()
935 rpc_sleep_on_timeout(&xprt->pending, task, NULL, in xprt_connect()
936 xprt_request_timeout(task->tk_rqstp)); in xprt_connect()
945 xprt->ops->connect(xprt, task); in xprt_connect()
948 task->tk_status = 0; in xprt_connect()
949 rpc_wake_up_queued_task(&xprt->pending, task); in xprt_connect()
952 xprt_release_write(xprt, task); in xprt_connect()
1124 xprt_request_data_received(struct rpc_task *task) in xprt_request_data_received() argument
1126 return !test_bit(RPC_TASK_NEED_RECV, &task->tk_runstate) && in xprt_request_data_received()
1127 READ_ONCE(task->tk_rqstp->rq_reply_bytes_recvd) != 0; in xprt_request_data_received()
1131 xprt_request_need_enqueue_receive(struct rpc_task *task, struct rpc_rqst *req) in xprt_request_need_enqueue_receive() argument
1133 return !test_bit(RPC_TASK_NEED_RECV, &task->tk_runstate) && in xprt_request_need_enqueue_receive()
1134 READ_ONCE(task->tk_rqstp->rq_reply_bytes_recvd) == 0; in xprt_request_need_enqueue_receive()
1143 xprt_request_enqueue_receive(struct rpc_task *task) in xprt_request_enqueue_receive() argument
1145 struct rpc_rqst *req = task->tk_rqstp; in xprt_request_enqueue_receive()
1149 if (!xprt_request_need_enqueue_receive(task, req)) in xprt_request_enqueue_receive()
1152 ret = xprt_request_prepare(task->tk_rqstp, &req->rq_rcv_buf); in xprt_request_enqueue_receive()
1163 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()
1228 xprt_request_dequeue_receive_locked(task); in xprt_complete_rqst()
1229 rpc_wake_up_queued_task(&xprt->pending, task); in xprt_complete_rqst()
1233 static void xprt_timer(struct rpc_task *task) in xprt_timer() argument
1235 struct rpc_rqst *req = task->tk_rqstp; in xprt_timer()
1238 if (task->tk_status != -ETIMEDOUT) in xprt_timer()
1241 trace_xprt_timer(xprt, req->rq_xid, task->tk_status); in xprt_timer()
1244 xprt->ops->timer(xprt, task); in xprt_timer()
1246 task->tk_status = 0; in xprt_timer()
1258 void xprt_wait_for_reply_request_def(struct rpc_task *task) in xprt_wait_for_reply_request_def() argument
1260 struct rpc_rqst *req = task->tk_rqstp; in xprt_wait_for_reply_request_def()
1262 rpc_sleep_on_timeout(&req->rq_xprt->pending, task, xprt_timer, in xprt_wait_for_reply_request_def()
1274 void xprt_wait_for_reply_request_rtt(struct rpc_task *task) in xprt_wait_for_reply_request_rtt() argument
1276 int timer = task->tk_msg.rpc_proc->p_timer; in xprt_wait_for_reply_request_rtt()
1277 struct rpc_clnt *clnt = task->tk_client; in xprt_wait_for_reply_request_rtt()
1279 struct rpc_rqst *req = task->tk_rqstp; in xprt_wait_for_reply_request_rtt()
1287 rpc_sleep_on_timeout(&req->rq_xprt->pending, task, xprt_timer, in xprt_wait_for_reply_request_rtt()
1297 void xprt_request_wait_receive(struct rpc_task *task) in xprt_request_wait_receive() argument
1299 struct rpc_rqst *req = task->tk_rqstp; in xprt_request_wait_receive()
1302 if (!test_bit(RPC_TASK_NEED_RECV, &task->tk_runstate)) in xprt_request_wait_receive()
1310 if (test_bit(RPC_TASK_NEED_RECV, &task->tk_runstate)) { in xprt_request_wait_receive()
1311 xprt->ops->wait_for_reply_request(task); in xprt_request_wait_receive()
1317 if (xprt_request_retransmit_after_disconnect(task)) in xprt_request_wait_receive()
1319 task, -ENOTCONN); in xprt_request_wait_receive()
1325 xprt_request_need_enqueue_transmit(struct rpc_task *task, struct rpc_rqst *req) in xprt_request_need_enqueue_transmit() argument
1327 return !test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate); in xprt_request_need_enqueue_transmit()
1337 xprt_request_enqueue_transmit(struct rpc_task *task) in xprt_request_enqueue_transmit() argument
1339 struct rpc_rqst *pos, *req = task->tk_rqstp; in xprt_request_enqueue_transmit()
1343 if (xprt_request_need_enqueue_transmit(task, req)) { in xprt_request_enqueue_transmit()
1344 ret = xprt_request_prepare(task->tk_rqstp, &req->rq_snd_buf); in xprt_request_enqueue_transmit()
1346 task->tk_status = ret; in xprt_request_enqueue_transmit()
1367 if (pos->rq_task->tk_owner != task->tk_owner) in xprt_request_enqueue_transmit()
1378 set_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate); in xprt_request_enqueue_transmit()
1391 xprt_request_dequeue_transmit_locked(struct rpc_task *task) in xprt_request_dequeue_transmit_locked() argument
1393 struct rpc_rqst *req = task->tk_rqstp; in xprt_request_dequeue_transmit_locked()
1395 if (!test_and_clear_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) in xprt_request_dequeue_transmit_locked()
1418 xprt_request_dequeue_transmit(struct rpc_task *task) in xprt_request_dequeue_transmit() argument
1420 struct rpc_rqst *req = task->tk_rqstp; in xprt_request_dequeue_transmit()
1424 xprt_request_dequeue_transmit_locked(task); in xprt_request_dequeue_transmit()
1436 xprt_request_dequeue_xprt(struct rpc_task *task) in xprt_request_dequeue_xprt() argument
1438 struct rpc_rqst *req = task->tk_rqstp; in xprt_request_dequeue_xprt()
1441 if (test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate) || in xprt_request_dequeue_xprt()
1442 test_bit(RPC_TASK_NEED_RECV, &task->tk_runstate) || in xprt_request_dequeue_xprt()
1446 set_bit(RPC_TASK_MSG_PIN_WAIT, &task->tk_runstate); in xprt_request_dequeue_xprt()
1450 clear_bit(RPC_TASK_MSG_PIN_WAIT, &task->tk_runstate); in xprt_request_dequeue_xprt()
1452 xprt_request_dequeue_transmit_locked(task); in xprt_request_dequeue_xprt()
1453 xprt_request_dequeue_receive_locked(task); in xprt_request_dequeue_xprt()
1485 xprt_request_need_retransmit(struct rpc_task *task) in xprt_request_need_retransmit() argument
1487 return xprt_request_retransmit_after_disconnect(task); in xprt_request_need_retransmit()
1495 bool xprt_prepare_transmit(struct rpc_task *task) in xprt_prepare_transmit() argument
1497 struct rpc_rqst *req = task->tk_rqstp; in xprt_prepare_transmit()
1500 if (!xprt_lock_write(xprt, task)) { in xprt_prepare_transmit()
1502 if (!test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) in xprt_prepare_transmit()
1504 task, 0); in xprt_prepare_transmit()
1514 void xprt_end_transmit(struct rpc_task *task) in xprt_end_transmit() argument
1516 struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt; in xprt_end_transmit()
1519 xprt_release_write(xprt, task); in xprt_end_transmit()
1536 struct rpc_task *task = req->rq_task; in xprt_request_transmit() local
1538 int is_retrans = RPC_WAS_SENT(task); in xprt_request_transmit()
1542 if (xprt_request_data_received(task)) { in xprt_request_transmit()
1547 if (rpcauth_xmit_need_reencode(task)) { in xprt_request_transmit()
1551 if (RPC_SIGNALLED(task)) { in xprt_request_transmit()
1564 trace_rpc_xdr_sendto(task, &req->rq_snd_buf); in xprt_request_transmit()
1574 task->tk_client->cl_stats->rpcretrans++; in xprt_request_transmit()
1580 task->tk_flags |= RPC_TASK_SENT; in xprt_request_transmit()
1593 xprt_request_dequeue_transmit(task); in xprt_request_transmit()
1594 rpc_wake_up_queued_task_set_status(&xprt->sending, task, status); in xprt_request_transmit()
1608 xprt_transmit(struct rpc_task *task) in xprt_transmit() argument
1610 struct rpc_rqst *next, *req = task->tk_rqstp; in xprt_transmit()
1622 status = xprt_request_transmit(next, task); in xprt_transmit()
1628 if (test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) in xprt_transmit()
1629 task->tk_status = status; in xprt_transmit()
1633 if (xprt_request_data_received(task) && in xprt_transmit()
1634 !test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) in xprt_transmit()
1641 static void xprt_complete_request_init(struct rpc_task *task) in xprt_complete_request_init() argument
1643 if (task->tk_rqstp) in xprt_complete_request_init()
1644 xprt_request_init(task); in xprt_complete_request_init()
1647 void xprt_add_backlog(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_add_backlog() argument
1650 rpc_sleep_on(&xprt->backlog, task, xprt_complete_request_init); in xprt_add_backlog()
1654 static bool __xprt_set_rq(struct rpc_task *task, void *data) in __xprt_set_rq() argument
1658 if (task->tk_rqstp == NULL) { in __xprt_set_rq()
1660 task->tk_rqstp = req; in __xprt_set_rq()
1676 static bool xprt_throttle_congested(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_throttle_congested() argument
1684 xprt_add_backlog(xprt, task); in xprt_throttle_congested()
1720 void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_alloc_slot() argument
1737 task->tk_status = -ENOMEM; in xprt_alloc_slot()
1740 xprt_add_backlog(xprt, task); in xprt_alloc_slot()
1744 task->tk_status = -EAGAIN; in xprt_alloc_slot()
1753 task->tk_status = 0; in xprt_alloc_slot()
1754 task->tk_rqstp = req; in xprt_alloc_slot()
1872 xprt_request_init(struct rpc_task *task) in xprt_request_init() argument
1874 struct rpc_xprt *xprt = task->tk_xprt; in xprt_request_init()
1875 struct rpc_rqst *req = task->tk_rqstp; in xprt_request_init()
1877 req->rq_task = task; in xprt_request_init()
1889 xprt_init_majortimeo(task, req); in xprt_request_init()
1895 xprt_do_reserve(struct rpc_xprt *xprt, struct rpc_task *task) in xprt_do_reserve() argument
1897 xprt->ops->alloc_slot(xprt, task); in xprt_do_reserve()
1898 if (task->tk_rqstp != NULL) in xprt_do_reserve()
1899 xprt_request_init(task); in xprt_do_reserve()
1910 void xprt_reserve(struct rpc_task *task) in xprt_reserve() argument
1912 struct rpc_xprt *xprt = task->tk_xprt; in xprt_reserve()
1914 task->tk_status = 0; in xprt_reserve()
1915 if (task->tk_rqstp != NULL) in xprt_reserve()
1918 task->tk_status = -EAGAIN; in xprt_reserve()
1919 if (!xprt_throttle_congested(xprt, task)) in xprt_reserve()
1920 xprt_do_reserve(xprt, task); in xprt_reserve()
1932 void xprt_retry_reserve(struct rpc_task *task) in xprt_retry_reserve() argument
1934 struct rpc_xprt *xprt = task->tk_xprt; in xprt_retry_reserve()
1936 task->tk_status = 0; in xprt_retry_reserve()
1937 if (task->tk_rqstp != NULL) in xprt_retry_reserve()
1940 task->tk_status = -EAGAIN; in xprt_retry_reserve()
1941 xprt_do_reserve(xprt, task); in xprt_retry_reserve()
1949 void xprt_release(struct rpc_task *task) in xprt_release() argument
1952 struct rpc_rqst *req = task->tk_rqstp; in xprt_release()
1955 if (task->tk_client) { in xprt_release()
1956 xprt = task->tk_xprt; in xprt_release()
1957 xprt_release_write(xprt, task); in xprt_release()
1963 xprt_request_dequeue_xprt(task); in xprt_release()
1965 xprt->ops->release_xprt(xprt, task); in xprt_release()
1967 xprt->ops->release_request(task); in xprt_release()
1971 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()