Lines Matching full:call
23 void rxrpc_propose_ping(struct rxrpc_call *call, u32 serial, in rxrpc_propose_ping() argument
29 if (time_before(ping_at, call->ping_at)) { in rxrpc_propose_ping()
30 WRITE_ONCE(call->ping_at, ping_at); in rxrpc_propose_ping()
31 rxrpc_reduce_call_timer(call, ping_at, now, in rxrpc_propose_ping()
33 trace_rxrpc_propose_ack(call, why, RXRPC_ACK_PING, serial); in rxrpc_propose_ping()
40 void rxrpc_propose_delay_ACK(struct rxrpc_call *call, rxrpc_serial_t serial, in rxrpc_propose_delay_ACK() argument
48 if (call->peer->srtt_us != 0) in rxrpc_propose_delay_ACK()
49 ack_at = usecs_to_jiffies(call->peer->srtt_us >> 3); in rxrpc_propose_delay_ACK()
53 ack_at += READ_ONCE(call->tx_backoff); in rxrpc_propose_delay_ACK()
55 if (time_before(ack_at, call->delay_ack_at)) { in rxrpc_propose_delay_ACK()
56 WRITE_ONCE(call->delay_ack_at, ack_at); in rxrpc_propose_delay_ACK()
57 rxrpc_reduce_call_timer(call, ack_at, now, in rxrpc_propose_delay_ACK()
61 trace_rxrpc_propose_ack(call, why, RXRPC_ACK_DELAY, serial); in rxrpc_propose_delay_ACK()
67 void rxrpc_send_ACK(struct rxrpc_call *call, u8 ack_reason, in rxrpc_send_ACK() argument
72 if (test_bit(RXRPC_CALL_DISCONNECTED, &call->flags)) in rxrpc_send_ACK()
75 rxrpc_inc_stat(call->rxnet, stat_tx_acks[ack_reason]); in rxrpc_send_ACK()
77 txb = rxrpc_alloc_txbuf(call, RXRPC_PACKET_TYPE_ACK, in rxrpc_send_ACK()
96 trace_rxrpc_send_ack(call, why, ack_reason, serial); in rxrpc_send_ACK()
97 rxrpc_send_ack_packet(call, txb); in rxrpc_send_ACK()
104 static void rxrpc_congestion_timeout(struct rxrpc_call *call) in rxrpc_congestion_timeout() argument
106 set_bit(RXRPC_CALL_RETRANS_TIMEOUT, &call->flags); in rxrpc_congestion_timeout()
112 void rxrpc_resend(struct rxrpc_call *call, struct sk_buff *ack_skb) in rxrpc_resend() argument
118 rxrpc_seq_t transmitted = READ_ONCE(call->tx_transmitted); in rxrpc_resend()
124 _enter("{%d,%d}", call->acks_hard_ack, call->tx_top); in rxrpc_resend()
127 max_age = ktime_sub_us(now, jiffies_to_usecs(call->peer->rto_j)); in rxrpc_resend()
130 if (list_empty(&call->tx_buffer)) in rxrpc_resend()
133 if (list_empty(&call->tx_buffer)) in rxrpc_resend()
136 trace_rxrpc_resend(call, ack_skb); in rxrpc_resend()
137 txb = list_first_entry(&call->tx_buffer, struct rxrpc_txbuf, call_link); in rxrpc_resend()
156 list_for_each_entry_from(txb, &call->tx_buffer, call_link) { in rxrpc_resend()
163 if (after(ntohl(txb->wire.serial), call->acks_highest_serial)) in rxrpc_resend()
173 trace_rxrpc_retransmit(call, txb->seq, in rxrpc_resend()
177 if (list_is_last(&txb->call_link, &call->tx_buffer)) in rxrpc_resend()
190 if (after_eq(READ_ONCE(call->acks_prev_seq), READ_ONCE(call->tx_transmitted))) in rxrpc_resend()
193 list_for_each_entry_from(txb, &call->tx_buffer, call_link) { in rxrpc_resend()
194 if (before_eq(txb->seq, READ_ONCE(call->acks_prev_seq))) in rxrpc_resend()
196 if (after(txb->seq, READ_ONCE(call->tx_transmitted))) in rxrpc_resend()
214 rxrpc_inc_stat(call->rxnet, stat_tx_data_retrans); in rxrpc_resend()
221 resend_at += jiffies + rxrpc_get_rto_backoff(call->peer, in rxrpc_resend()
223 WRITE_ONCE(call->resend_at, resend_at); in rxrpc_resend()
226 rxrpc_congestion_timeout(call); in rxrpc_resend()
233 rxrpc_reduce_call_timer(call, resend_at, jiffies, in rxrpc_resend()
235 ack_ts = ktime_sub(now, call->acks_latest_ts); in rxrpc_resend()
236 if (ktime_to_us(ack_ts) < (call->peer->srtt_us >> 3)) in rxrpc_resend()
238 rxrpc_send_ACK(call, RXRPC_ACK_PING, 0, in rxrpc_resend()
247 rxrpc_transmit_one(call, txb); in rxrpc_resend()
258 static void rxrpc_begin_service_reply(struct rxrpc_call *call) in rxrpc_begin_service_reply() argument
262 rxrpc_set_call_state(call, RXRPC_CALL_SERVER_SEND_REPLY); in rxrpc_begin_service_reply()
263 WRITE_ONCE(call->delay_ack_at, now + MAX_JIFFY_OFFSET); in rxrpc_begin_service_reply()
264 if (call->ackr_reason == RXRPC_ACK_DELAY) in rxrpc_begin_service_reply()
265 call->ackr_reason = 0; in rxrpc_begin_service_reply()
266 trace_rxrpc_timer(call, rxrpc_timer_init_for_send_reply, now); in rxrpc_begin_service_reply()
271 * transmitted in the call.
273 static void rxrpc_close_tx_phase(struct rxrpc_call *call) in rxrpc_close_tx_phase() argument
277 switch (__rxrpc_call_state(call)) { in rxrpc_close_tx_phase()
279 rxrpc_set_call_state(call, RXRPC_CALL_CLIENT_AWAIT_REPLY); in rxrpc_close_tx_phase()
282 rxrpc_set_call_state(call, RXRPC_CALL_SERVER_AWAIT_ACK); in rxrpc_close_tx_phase()
289 static bool rxrpc_tx_window_has_space(struct rxrpc_call *call) in rxrpc_tx_window_has_space() argument
291 unsigned int winsize = min_t(unsigned int, call->tx_winsize, in rxrpc_tx_window_has_space()
292 call->cong_cwnd + call->cong_extra); in rxrpc_tx_window_has_space()
293 rxrpc_seq_t window = call->acks_hard_ack, wtop = window + winsize; in rxrpc_tx_window_has_space()
294 rxrpc_seq_t tx_top = call->tx_top; in rxrpc_tx_window_has_space()
304 static void rxrpc_decant_prepared_tx(struct rxrpc_call *call) in rxrpc_decant_prepared_tx() argument
308 if (!test_bit(RXRPC_CALL_EXPOSED, &call->flags)) { in rxrpc_decant_prepared_tx()
309 if (list_empty(&call->tx_sendmsg)) in rxrpc_decant_prepared_tx()
311 rxrpc_expose_client_call(call); in rxrpc_decant_prepared_tx()
314 while ((txb = list_first_entry_or_null(&call->tx_sendmsg, in rxrpc_decant_prepared_tx()
316 spin_lock(&call->tx_lock); in rxrpc_decant_prepared_tx()
318 spin_unlock(&call->tx_lock); in rxrpc_decant_prepared_tx()
320 call->tx_top = txb->seq; in rxrpc_decant_prepared_tx()
321 list_add_tail(&txb->call_link, &call->tx_buffer); in rxrpc_decant_prepared_tx()
324 rxrpc_close_tx_phase(call); in rxrpc_decant_prepared_tx()
326 rxrpc_transmit_one(call, txb); in rxrpc_decant_prepared_tx()
328 if (!rxrpc_tx_window_has_space(call)) in rxrpc_decant_prepared_tx()
333 static void rxrpc_transmit_some_data(struct rxrpc_call *call) in rxrpc_transmit_some_data() argument
335 switch (__rxrpc_call_state(call)) { in rxrpc_transmit_some_data()
337 if (list_empty(&call->tx_sendmsg)) in rxrpc_transmit_some_data()
339 rxrpc_begin_service_reply(call); in rxrpc_transmit_some_data()
344 if (!rxrpc_tx_window_has_space(call)) in rxrpc_transmit_some_data()
346 if (list_empty(&call->tx_sendmsg)) { in rxrpc_transmit_some_data()
347 rxrpc_inc_stat(call->rxnet, stat_tx_data_underflow); in rxrpc_transmit_some_data()
350 rxrpc_decant_prepared_tx(call); in rxrpc_transmit_some_data()
361 static void rxrpc_send_initial_ping(struct rxrpc_call *call) in rxrpc_send_initial_ping() argument
363 if (call->peer->rtt_count < 3 || in rxrpc_send_initial_ping()
364 ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000), in rxrpc_send_initial_ping()
366 rxrpc_send_ACK(call, RXRPC_ACK_PING, 0, in rxrpc_send_initial_ping()
373 bool rxrpc_input_call_event(struct rxrpc_call *call, struct sk_buff *skb) in rxrpc_input_call_event() argument
379 rxrpc_see_call(call, rxrpc_call_see_input); in rxrpc_input_call_event()
383 call->debug_id, rxrpc_call_states[__rxrpc_call_state(call)], in rxrpc_input_call_event()
384 call->events); in rxrpc_input_call_event()
386 if (__rxrpc_call_is_complete(call)) in rxrpc_input_call_event()
390 abort_code = smp_load_acquire(&call->send_abort); in rxrpc_input_call_event()
392 rxrpc_abort_call(call, 0, call->send_abort, call->send_abort_err, in rxrpc_input_call_event()
393 call->send_abort_why); in rxrpc_input_call_event()
402 t = READ_ONCE(call->expect_rx_by); in rxrpc_input_call_event()
404 trace_rxrpc_timer(call, rxrpc_timer_exp_normal, now); in rxrpc_input_call_event()
408 t = READ_ONCE(call->expect_req_by); in rxrpc_input_call_event()
409 if (__rxrpc_call_state(call) == RXRPC_CALL_SERVER_RECV_REQUEST && in rxrpc_input_call_event()
411 trace_rxrpc_timer(call, rxrpc_timer_exp_idle, now); in rxrpc_input_call_event()
415 t = READ_ONCE(call->expect_term_by); in rxrpc_input_call_event()
417 trace_rxrpc_timer(call, rxrpc_timer_exp_hard, now); in rxrpc_input_call_event()
421 t = READ_ONCE(call->delay_ack_at); in rxrpc_input_call_event()
423 trace_rxrpc_timer(call, rxrpc_timer_exp_ack, now); in rxrpc_input_call_event()
424 cmpxchg(&call->delay_ack_at, t, now + MAX_JIFFY_OFFSET); in rxrpc_input_call_event()
425 rxrpc_send_ACK(call, RXRPC_ACK_DELAY, 0, in rxrpc_input_call_event()
429 t = READ_ONCE(call->ack_lost_at); in rxrpc_input_call_event()
431 trace_rxrpc_timer(call, rxrpc_timer_exp_lost_ack, now); in rxrpc_input_call_event()
432 cmpxchg(&call->ack_lost_at, t, now + MAX_JIFFY_OFFSET); in rxrpc_input_call_event()
433 set_bit(RXRPC_CALL_EV_ACK_LOST, &call->events); in rxrpc_input_call_event()
436 t = READ_ONCE(call->keepalive_at); in rxrpc_input_call_event()
438 trace_rxrpc_timer(call, rxrpc_timer_exp_keepalive, now); in rxrpc_input_call_event()
439 cmpxchg(&call->keepalive_at, t, now + MAX_JIFFY_OFFSET); in rxrpc_input_call_event()
440 rxrpc_send_ACK(call, RXRPC_ACK_PING, 0, in rxrpc_input_call_event()
444 t = READ_ONCE(call->ping_at); in rxrpc_input_call_event()
446 trace_rxrpc_timer(call, rxrpc_timer_exp_ping, now); in rxrpc_input_call_event()
447 cmpxchg(&call->ping_at, t, now + MAX_JIFFY_OFFSET); in rxrpc_input_call_event()
448 rxrpc_send_ACK(call, RXRPC_ACK_PING, 0, in rxrpc_input_call_event()
452 t = READ_ONCE(call->resend_at); in rxrpc_input_call_event()
454 trace_rxrpc_timer(call, rxrpc_timer_exp_resend, now); in rxrpc_input_call_event()
455 cmpxchg(&call->resend_at, t, now + MAX_JIFFY_OFFSET); in rxrpc_input_call_event()
460 rxrpc_input_call_packet(call, skb); in rxrpc_input_call_event()
462 rxrpc_transmit_some_data(call); in rxrpc_input_call_event()
468 rxrpc_congestion_degrade(call); in rxrpc_input_call_event()
471 if (test_and_clear_bit(RXRPC_CALL_EV_INITIAL_PING, &call->events)) in rxrpc_input_call_event()
472 rxrpc_send_initial_ping(call); in rxrpc_input_call_event()
476 if (test_bit(RXRPC_CALL_RX_HEARD, &call->flags) && in rxrpc_input_call_event()
477 (int)call->conn->hi_serial - (int)call->rx_serial > 0) { in rxrpc_input_call_event()
478 trace_rxrpc_call_reset(call); in rxrpc_input_call_event()
479 rxrpc_abort_call(call, 0, RX_CALL_DEAD, -ECONNRESET, in rxrpc_input_call_event()
482 rxrpc_abort_call(call, 0, RX_CALL_TIMEOUT, -ETIME, in rxrpc_input_call_event()
488 if (test_and_clear_bit(RXRPC_CALL_EV_ACK_LOST, &call->events)) in rxrpc_input_call_event()
489 rxrpc_send_ACK(call, RXRPC_ACK_PING, 0, in rxrpc_input_call_event()
492 if (resend && __rxrpc_call_state(call) != RXRPC_CALL_CLIENT_RECV_REPLY) in rxrpc_input_call_event()
493 rxrpc_resend(call, NULL); in rxrpc_input_call_event()
495 if (test_and_clear_bit(RXRPC_CALL_RX_IS_IDLE, &call->flags)) in rxrpc_input_call_event()
496 rxrpc_send_ACK(call, RXRPC_ACK_IDLE, 0, in rxrpc_input_call_event()
499 if (call->ackr_nr_unacked > 2) { in rxrpc_input_call_event()
500 if (call->peer->rtt_count < 3) in rxrpc_input_call_event()
501 rxrpc_send_ACK(call, RXRPC_ACK_PING, 0, in rxrpc_input_call_event()
503 else if (ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000), in rxrpc_input_call_event()
505 rxrpc_send_ACK(call, RXRPC_ACK_PING, 0, in rxrpc_input_call_event()
508 rxrpc_send_ACK(call, RXRPC_ACK_IDLE, 0, in rxrpc_input_call_event()
513 if (!__rxrpc_call_is_complete(call)) { in rxrpc_input_call_event()
514 next = call->expect_rx_by; in rxrpc_input_call_event()
518 set(call->expect_req_by); in rxrpc_input_call_event()
519 set(call->expect_term_by); in rxrpc_input_call_event()
520 set(call->delay_ack_at); in rxrpc_input_call_event()
521 set(call->ack_lost_at); in rxrpc_input_call_event()
522 set(call->resend_at); in rxrpc_input_call_event()
523 set(call->keepalive_at); in rxrpc_input_call_event()
524 set(call->ping_at); in rxrpc_input_call_event()
528 rxrpc_poke_call(call, rxrpc_call_poke_timer_now); in rxrpc_input_call_event()
530 rxrpc_reduce_call_timer(call, next, now, rxrpc_timer_restart); in rxrpc_input_call_event()
534 if (__rxrpc_call_is_complete(call)) { in rxrpc_input_call_event()
535 del_timer_sync(&call->timer); in rxrpc_input_call_event()
536 if (!test_bit(RXRPC_CALL_DISCONNECTED, &call->flags)) in rxrpc_input_call_event()
537 rxrpc_disconnect_call(call); in rxrpc_input_call_event()
538 if (call->security) in rxrpc_input_call_event()
539 call->security->free_call_crypto(call); in rxrpc_input_call_event()
541 if (call->acks_hard_ack != call->tx_bottom) in rxrpc_input_call_event()
542 rxrpc_shrink_call_tx_buffer(call); in rxrpc_input_call_event()