• Home
  • Raw
  • Download

Lines Matching full:call

28 					 struct rxrpc_call *call,  in rxrpc_wait_for_tx_window_intr()  argument
33 if (call->tx_top - call->tx_hard_ack < in rxrpc_wait_for_tx_window_intr()
34 min_t(unsigned int, call->tx_winsize, in rxrpc_wait_for_tx_window_intr()
35 call->cong_cwnd + call->cong_extra)) in rxrpc_wait_for_tx_window_intr()
38 if (call->state >= RXRPC_CALL_COMPLETE) in rxrpc_wait_for_tx_window_intr()
39 return call->error; in rxrpc_wait_for_tx_window_intr()
44 trace_rxrpc_transmit(call, rxrpc_transmit_wait); in rxrpc_wait_for_tx_window_intr()
45 mutex_unlock(&call->user_mutex); in rxrpc_wait_for_tx_window_intr()
47 if (mutex_lock_interruptible(&call->user_mutex) < 0) in rxrpc_wait_for_tx_window_intr()
57 struct rxrpc_call *call) in rxrpc_wait_for_tx_window_nonintr() argument
63 rtt = READ_ONCE(call->peer->rtt); in rxrpc_wait_for_tx_window_nonintr()
69 tx_start = READ_ONCE(call->tx_hard_ack); in rxrpc_wait_for_tx_window_nonintr()
74 tx_win = READ_ONCE(call->tx_hard_ack); in rxrpc_wait_for_tx_window_nonintr()
75 if (call->tx_top - tx_win < in rxrpc_wait_for_tx_window_nonintr()
76 min_t(unsigned int, call->tx_winsize, in rxrpc_wait_for_tx_window_nonintr()
77 call->cong_cwnd + call->cong_extra)) in rxrpc_wait_for_tx_window_nonintr()
80 if (call->state >= RXRPC_CALL_COMPLETE) in rxrpc_wait_for_tx_window_nonintr()
81 return call->error; in rxrpc_wait_for_tx_window_nonintr()
92 trace_rxrpc_transmit(call, rxrpc_transmit_wait); in rxrpc_wait_for_tx_window_nonintr()
102 struct rxrpc_call *call, in rxrpc_wait_for_tx_window() argument
110 call->tx_hard_ack, call->tx_top, call->tx_winsize); in rxrpc_wait_for_tx_window()
112 add_wait_queue(&call->waitq, &myself); in rxrpc_wait_for_tx_window()
115 ret = rxrpc_wait_for_tx_window_nonintr(rx, call); in rxrpc_wait_for_tx_window()
117 ret = rxrpc_wait_for_tx_window_intr(rx, call, timeo); in rxrpc_wait_for_tx_window()
119 remove_wait_queue(&call->waitq, &myself); in rxrpc_wait_for_tx_window()
128 static inline void rxrpc_instant_resend(struct rxrpc_call *call, int ix) in rxrpc_instant_resend() argument
130 spin_lock_bh(&call->lock); in rxrpc_instant_resend()
132 if (call->state < RXRPC_CALL_COMPLETE) { in rxrpc_instant_resend()
133 call->rxtx_annotations[ix] = in rxrpc_instant_resend()
134 (call->rxtx_annotations[ix] & RXRPC_TX_ANNO_LAST) | in rxrpc_instant_resend()
136 if (!test_and_set_bit(RXRPC_CALL_EV_RESEND, &call->events)) in rxrpc_instant_resend()
137 rxrpc_queue_call(call); in rxrpc_instant_resend()
140 spin_unlock_bh(&call->lock); in rxrpc_instant_resend()
144 * Notify the owner of the call that the transmit phase is ended and the last
147 static void rxrpc_notify_end_tx(struct rxrpc_sock *rx, struct rxrpc_call *call, in rxrpc_notify_end_tx() argument
151 notify_end_tx(&rx->sk, call, call->user_call_ID); in rxrpc_notify_end_tx()
158 static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call, in rxrpc_queue_packet() argument
170 ASSERTCMP(seq, ==, call->tx_top + 1); in rxrpc_queue_packet()
174 set_bit(RXRPC_CALL_TX_LASTQ, &call->flags); in rxrpc_queue_packet()
184 call->rxtx_annotations[ix] = annotation; in rxrpc_queue_packet()
186 call->rxtx_buffer[ix] = skb; in rxrpc_queue_packet()
187 call->tx_top = seq; in rxrpc_queue_packet()
189 trace_rxrpc_transmit(call, rxrpc_transmit_queue_last); in rxrpc_queue_packet()
191 trace_rxrpc_transmit(call, rxrpc_transmit_queue); in rxrpc_queue_packet()
193 if (last || call->state == RXRPC_CALL_SERVER_ACK_REQUEST) { in rxrpc_queue_packet()
195 write_lock_bh(&call->state_lock); in rxrpc_queue_packet()
196 switch (call->state) { in rxrpc_queue_packet()
198 call->state = RXRPC_CALL_CLIENT_AWAIT_REPLY; in rxrpc_queue_packet()
199 rxrpc_notify_end_tx(rx, call, notify_end_tx); in rxrpc_queue_packet()
202 call->state = RXRPC_CALL_SERVER_SEND_REPLY; in rxrpc_queue_packet()
204 WRITE_ONCE(call->ack_at, now + MAX_JIFFY_OFFSET); in rxrpc_queue_packet()
205 if (call->ackr_reason == RXRPC_ACK_DELAY) in rxrpc_queue_packet()
206 call->ackr_reason = 0; in rxrpc_queue_packet()
207 trace_rxrpc_timer(call, rxrpc_timer_init_for_send_reply, now); in rxrpc_queue_packet()
212 call->state = RXRPC_CALL_SERVER_AWAIT_ACK; in rxrpc_queue_packet()
213 rxrpc_notify_end_tx(rx, call, notify_end_tx); in rxrpc_queue_packet()
218 write_unlock_bh(&call->state_lock); in rxrpc_queue_packet()
221 if (seq == 1 && rxrpc_is_client_call(call)) in rxrpc_queue_packet()
222 rxrpc_expose_client_call(call); in rxrpc_queue_packet()
224 ret = rxrpc_send_data_packet(call, skb, false); in rxrpc_queue_packet()
230 rxrpc_set_call_completion(call, in rxrpc_queue_packet()
233 rxrpc_notify_socket(call); in rxrpc_queue_packet()
237 rxrpc_instant_resend(call, ix); in rxrpc_queue_packet()
241 if (call->peer->rtt_usage > 1) in rxrpc_queue_packet()
242 resend_at = nsecs_to_jiffies(call->peer->rtt * 3 / 2); in rxrpc_queue_packet()
249 WRITE_ONCE(call->resend_at, resend_at); in rxrpc_queue_packet()
250 rxrpc_reduce_call_timer(call, resend_at, now, in rxrpc_queue_packet()
262 * - The caller holds the call user access mutex, but not the socket lock.
265 struct rxrpc_call *call, in rxrpc_send_data() argument
286 if (call->tx_total_len != -1) { in rxrpc_send_data()
287 if (len > call->tx_total_len) in rxrpc_send_data()
289 if (!more && len != call->tx_total_len) in rxrpc_send_data()
293 skb = call->tx_pending; in rxrpc_send_data()
294 call->tx_pending = NULL; in rxrpc_send_data()
300 if (call->ackr_reason == RXRPC_ACK_PING_RESPONSE) in rxrpc_send_data()
301 rxrpc_send_ack_packet(call, false, NULL); in rxrpc_send_data()
308 if (call->tx_top - call->tx_hard_ack >= in rxrpc_send_data()
309 min_t(unsigned int, call->tx_winsize, in rxrpc_send_data()
310 call->cong_cwnd + call->cong_extra)) { in rxrpc_send_data()
314 ret = rxrpc_wait_for_tx_window(rx, call, in rxrpc_send_data()
322 max -= call->conn->security_size; in rxrpc_send_data()
323 max &= ~(call->conn->size_align - 1UL); in rxrpc_send_data()
329 space = chunk + call->conn->size_align; in rxrpc_send_data()
330 space &= ~(call->conn->size_align - 1UL); in rxrpc_send_data()
332 size = space + call->conn->security_size; in rxrpc_send_data()
348 _debug("HS: %u", call->conn->security_size); in rxrpc_send_data()
349 skb_reserve(skb, call->conn->security_size); in rxrpc_send_data()
350 skb->len += call->conn->security_size; in rxrpc_send_data()
386 if (call->tx_total_len != -1) in rxrpc_send_data()
387 call->tx_total_len -= copy; in rxrpc_send_data()
393 struct rxrpc_connection *conn = call->conn; in rxrpc_send_data()
407 seq = call->tx_top + 1; in rxrpc_send_data()
415 else if (call->tx_top - call->tx_hard_ack < in rxrpc_send_data()
416 call->tx_winsize) in rxrpc_send_data()
420 call, skb, skb->mark, skb->head); in rxrpc_send_data()
424 rxrpc_queue_packet(rx, call, skb, in rxrpc_send_data()
430 /* Check for the far side aborting the call or a network error in rxrpc_send_data()
433 * call can be retried or redirected. in rxrpc_send_data()
435 if (call->state == RXRPC_CALL_COMPLETE) { in rxrpc_send_data()
436 ret = call->error; in rxrpc_send_data()
444 call->tx_pending = skb; in rxrpc_send_data()
486 p->call.user_call_ID = *(u32 *)CMSG_DATA(cmsg); in rxrpc_sendmsg_cmsg()
490 p->call.user_call_ID = *(unsigned long *) in rxrpc_sendmsg_cmsg()
528 if (p->call.tx_total_len != -1 || len != sizeof(__s64)) in rxrpc_sendmsg_cmsg()
530 p->call.tx_total_len = *(__s64 *)CMSG_DATA(cmsg); in rxrpc_sendmsg_cmsg()
531 if (p->call.tx_total_len < 0) in rxrpc_sendmsg_cmsg()
538 memcpy(&p->call.timeouts, CMSG_DATA(cmsg), len); in rxrpc_sendmsg_cmsg()
539 p->call.nr_timeouts = len / 4; in rxrpc_sendmsg_cmsg()
540 if (p->call.timeouts.hard > INT_MAX / HZ) in rxrpc_sendmsg_cmsg()
542 if (p->call.nr_timeouts >= 2 && p->call.timeouts.idle > 60 * 60 * 1000) in rxrpc_sendmsg_cmsg()
544 if (p->call.nr_timeouts >= 3 && p->call.timeouts.normal > 60 * 60 * 1000) in rxrpc_sendmsg_cmsg()
555 if (p->call.tx_total_len != -1 && p->command != RXRPC_CMD_SEND_DATA) in rxrpc_sendmsg_cmsg()
562 * Create a new client call for sendmsg().
564 * - If it returns a call, the call's lock will need releasing by the caller.
570 __acquires(&call->user_mutex) in rxrpc_new_client_call_for_sendmsg()
573 struct rxrpc_call *call; in rxrpc_new_client_call_for_sendmsg() local
596 call = rxrpc_new_client_call(rx, &cp, srx, &p->call, GFP_KERNEL, in rxrpc_new_client_call_for_sendmsg()
601 _leave(" = %p\n", call); in rxrpc_new_client_call_for_sendmsg()
602 return call; in rxrpc_new_client_call_for_sendmsg()
606 * send a message forming part of a client call through an RxRPC socket
612 __releases(&call->user_mutex) in rxrpc_do_sendmsg()
615 struct rxrpc_call *call; in rxrpc_do_sendmsg() local
620 .call.tx_total_len = -1, in rxrpc_do_sendmsg()
621 .call.user_call_ID = 0, in rxrpc_do_sendmsg()
622 .call.nr_timeouts = 0, in rxrpc_do_sendmsg()
639 call = rxrpc_accept_call(rx, p.call.user_call_ID, NULL); in rxrpc_do_sendmsg()
641 if (IS_ERR(call)) in rxrpc_do_sendmsg()
642 return PTR_ERR(call); in rxrpc_do_sendmsg()
647 call = rxrpc_find_call_by_user_ID(rx, p.call.user_call_ID); in rxrpc_do_sendmsg()
648 if (!call) { in rxrpc_do_sendmsg()
652 call = rxrpc_new_client_call_for_sendmsg(rx, msg, &p); in rxrpc_do_sendmsg()
654 if (IS_ERR(call)) in rxrpc_do_sendmsg()
655 return PTR_ERR(call); in rxrpc_do_sendmsg()
656 /* ... and we have the call lock. */ in rxrpc_do_sendmsg()
658 if (READ_ONCE(call->state) == RXRPC_CALL_COMPLETE) in rxrpc_do_sendmsg()
661 switch (READ_ONCE(call->state)) { in rxrpc_do_sendmsg()
667 rxrpc_put_call(call, rxrpc_call_put); in rxrpc_do_sendmsg()
674 ret = mutex_lock_interruptible(&call->user_mutex); in rxrpc_do_sendmsg()
681 if (p.call.tx_total_len != -1) { in rxrpc_do_sendmsg()
683 if (call->tx_total_len != -1 || in rxrpc_do_sendmsg()
684 call->tx_pending || in rxrpc_do_sendmsg()
685 call->tx_top != 0) in rxrpc_do_sendmsg()
687 call->tx_total_len = p.call.tx_total_len; in rxrpc_do_sendmsg()
691 switch (p.call.nr_timeouts) { in rxrpc_do_sendmsg()
693 j = msecs_to_jiffies(p.call.timeouts.normal); in rxrpc_do_sendmsg()
694 if (p.call.timeouts.normal > 0 && j == 0) in rxrpc_do_sendmsg()
696 WRITE_ONCE(call->next_rx_timo, j); in rxrpc_do_sendmsg()
699 j = msecs_to_jiffies(p.call.timeouts.idle); in rxrpc_do_sendmsg()
700 if (p.call.timeouts.idle > 0 && j == 0) in rxrpc_do_sendmsg()
702 WRITE_ONCE(call->next_req_timo, j); in rxrpc_do_sendmsg()
705 if (p.call.timeouts.hard > 0) { in rxrpc_do_sendmsg()
706 j = msecs_to_jiffies(p.call.timeouts.hard); in rxrpc_do_sendmsg()
709 WRITE_ONCE(call->expect_term_by, j); in rxrpc_do_sendmsg()
710 rxrpc_reduce_call_timer(call, j, now, in rxrpc_do_sendmsg()
716 state = READ_ONCE(call->state); in rxrpc_do_sendmsg()
717 _debug("CALL %d USR %lx ST %d on CONN %p", in rxrpc_do_sendmsg()
718 call->debug_id, call->user_call_ID, state, call->conn); in rxrpc_do_sendmsg()
721 /* it's too late for this call */ in rxrpc_do_sendmsg()
725 if (rxrpc_abort_call("CMD", call, 0, p.abort_code, -ECONNABORTED)) in rxrpc_do_sendmsg()
726 ret = rxrpc_send_abort_packet(call); in rxrpc_do_sendmsg()
729 } else if (rxrpc_is_client_call(call) && in rxrpc_do_sendmsg()
731 /* request phase complete for this client call */ in rxrpc_do_sendmsg()
733 } else if (rxrpc_is_service_call(call) && in rxrpc_do_sendmsg()
736 /* Reply phase not begun or not complete for service call. */ in rxrpc_do_sendmsg()
739 ret = rxrpc_send_data(rx, call, msg, len, NULL); in rxrpc_do_sendmsg()
743 mutex_unlock(&call->user_mutex); in rxrpc_do_sendmsg()
745 rxrpc_put_call(call, rxrpc_call_put); in rxrpc_do_sendmsg()
755 * rxrpc_kernel_send_data - Allow a kernel service to send data on a call
756 * @sock: The socket the call is on
757 * @call: The call to send data through
762 * Allow a kernel service to send data on a call. The call must be in an state
767 int rxrpc_kernel_send_data(struct socket *sock, struct rxrpc_call *call, in rxrpc_kernel_send_data() argument
773 _enter("{%d,%s},", call->debug_id, rxrpc_call_states[call->state]); in rxrpc_kernel_send_data()
778 mutex_lock(&call->user_mutex); in rxrpc_kernel_send_data()
780 _debug("CALL %d USR %lx ST %d on CONN %p", in rxrpc_kernel_send_data()
781 call->debug_id, call->user_call_ID, call->state, call->conn); in rxrpc_kernel_send_data()
783 switch (READ_ONCE(call->state)) { in rxrpc_kernel_send_data()
787 ret = rxrpc_send_data(rxrpc_sk(sock->sk), call, msg, len, in rxrpc_kernel_send_data()
791 read_lock_bh(&call->state_lock); in rxrpc_kernel_send_data()
792 ret = call->error; in rxrpc_kernel_send_data()
793 read_unlock_bh(&call->state_lock); in rxrpc_kernel_send_data()
796 /* Request phase complete for this client call */ in rxrpc_kernel_send_data()
797 trace_rxrpc_rx_eproto(call, 0, tracepoint_string("late_send")); in rxrpc_kernel_send_data()
802 mutex_unlock(&call->user_mutex); in rxrpc_kernel_send_data()
809 * rxrpc_kernel_abort_call - Allow a kernel service to abort a call
810 * @sock: The socket the call is on
811 * @call: The call to be aborted
816 * Allow a kernel service to abort a call, if it's still in an abortable state
817 * and return true if the call was aborted, false if it was already complete.
819 bool rxrpc_kernel_abort_call(struct socket *sock, struct rxrpc_call *call, in rxrpc_kernel_abort_call() argument
824 _enter("{%d},%d,%d,%s", call->debug_id, abort_code, error, why); in rxrpc_kernel_abort_call()
826 mutex_lock(&call->user_mutex); in rxrpc_kernel_abort_call()
828 aborted = rxrpc_abort_call(why, call, 0, abort_code, error); in rxrpc_kernel_abort_call()
830 rxrpc_send_abort_packet(call); in rxrpc_kernel_abort_call()
832 mutex_unlock(&call->user_mutex); in rxrpc_kernel_abort_call()
838 * rxrpc_kernel_set_tx_length - Set the total Tx length on a call
839 * @sock: The socket the call is on
840 * @call: The call to be informed
841 * @tx_total_len: The amount of data to be transmitted for this call
843 * Allow a kernel service to set the total transmit length on a call. This
847 * request length can be set when beginning the call.
849 void rxrpc_kernel_set_tx_length(struct socket *sock, struct rxrpc_call *call, in rxrpc_kernel_set_tx_length() argument
852 WARN_ON(call->tx_total_len != -1); in rxrpc_kernel_set_tx_length()
853 call->tx_total_len = tx_total_len; in rxrpc_kernel_set_tx_length()