Lines Matching refs:call

48 static void rxrpc_tx_backoff(struct rxrpc_call *call, int ret)  in rxrpc_tx_backoff()  argument
51 u16 tx_backoff = READ_ONCE(call->tx_backoff); in rxrpc_tx_backoff()
54 WRITE_ONCE(call->tx_backoff, tx_backoff + 1); in rxrpc_tx_backoff()
56 WRITE_ONCE(call->tx_backoff, 0); in rxrpc_tx_backoff()
68 static void rxrpc_set_keepalive(struct rxrpc_call *call) in rxrpc_set_keepalive() argument
70 unsigned long now = jiffies, keepalive_at = call->next_rx_timo / 6; in rxrpc_set_keepalive()
73 WRITE_ONCE(call->keepalive_at, keepalive_at); in rxrpc_set_keepalive()
74 rxrpc_reduce_call_timer(call, keepalive_at, now, in rxrpc_set_keepalive()
82 struct rxrpc_call *call, in rxrpc_fill_out_ack() argument
93 call->ackr_nr_unacked = 0; in rxrpc_fill_out_ack()
94 atomic_set(&call->ackr_nr_consumed, 0); in rxrpc_fill_out_ack()
95 rxrpc_inc_stat(call->rxnet, stat_tx_ack_fill); in rxrpc_fill_out_ack()
96 clear_bit(RXRPC_CALL_RX_IS_IDLE, &call->flags); in rxrpc_fill_out_ack()
98 window = call->ackr_window; in rxrpc_fill_out_ack()
99 wtop = call->ackr_wtop; in rxrpc_fill_out_ack()
100 sack = call->ackr_sack_base % RXRPC_SACK_SIZE; in rxrpc_fill_out_ack()
109 memcpy(txb->acks, call->ackr_sack_table + sack, txb->ack.nAcks); in rxrpc_fill_out_ack()
111 memcpy(txb->acks, call->ackr_sack_table + sack, wrap); in rxrpc_fill_out_ack()
112 memcpy(txb->acks + wrap, call->ackr_sack_table, in rxrpc_fill_out_ack()
126 qsize = (window - 1) - call->rx_consumed; in rxrpc_fill_out_ack()
127 rsize = max_t(int, call->rx_winsize - qsize, 0); in rxrpc_fill_out_ack()
144 static int rxrpc_begin_rtt_probe(struct rxrpc_call *call, rxrpc_serial_t serial, in rxrpc_begin_rtt_probe() argument
147 unsigned long avail = call->rtt_avail; in rxrpc_begin_rtt_probe()
154 if (!test_and_clear_bit(rtt_slot, &call->rtt_avail)) in rxrpc_begin_rtt_probe()
157 call->rtt_serial[rtt_slot] = serial; in rxrpc_begin_rtt_probe()
158 call->rtt_sent_at[rtt_slot] = ktime_get_real(); in rxrpc_begin_rtt_probe()
160 set_bit(rtt_slot + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail); in rxrpc_begin_rtt_probe()
162 trace_rxrpc_rtt_tx(call, why, rtt_slot, serial); in rxrpc_begin_rtt_probe()
166 trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_no_slot, rtt_slot, serial); in rxrpc_begin_rtt_probe()
173 static void rxrpc_cancel_rtt_probe(struct rxrpc_call *call, in rxrpc_cancel_rtt_probe() argument
177 clear_bit(rtt_slot + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail); in rxrpc_cancel_rtt_probe()
179 set_bit(rtt_slot, &call->rtt_avail); in rxrpc_cancel_rtt_probe()
180 trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_cancel, rtt_slot, serial); in rxrpc_cancel_rtt_probe()
187 int rxrpc_send_ack_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb) in rxrpc_send_ack_packet() argument
197 if (test_bit(RXRPC_CALL_DISCONNECTED, &call->flags)) in rxrpc_send_ack_packet()
200 conn = call->conn; in rxrpc_send_ack_packet()
202 msg.msg_name = &call->peer->srx.transport; in rxrpc_send_ack_packet()
203 msg.msg_namelen = call->peer->srx.transport_len; in rxrpc_send_ack_packet()
211 n = rxrpc_fill_out_ack(conn, call, txb, &rwind); in rxrpc_send_ack_packet()
221 trace_rxrpc_tx_ack(call->debug_id, serial, in rxrpc_send_ack_packet()
227 rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_ping); in rxrpc_send_ack_packet()
229 rxrpc_inc_stat(call->rxnet, stat_tx_ack_send); in rxrpc_send_ack_packet()
232 txb->ack.previousPacket = htonl(call->rx_highest_seq); in rxrpc_send_ack_packet()
236 call->peer->last_tx_at = ktime_get_seconds(); in rxrpc_send_ack_packet()
238 trace_rxrpc_tx_fail(call->debug_id, serial, ret, in rxrpc_send_ack_packet()
241 trace_rxrpc_tx_packet(call->debug_id, &txb->wire, in rxrpc_send_ack_packet()
244 call->peer->rtt_last_req = ktime_get_real(); in rxrpc_send_ack_packet()
246 rxrpc_tx_backoff(call, ret); in rxrpc_send_ack_packet()
248 if (!__rxrpc_call_is_complete(call)) { in rxrpc_send_ack_packet()
250 rxrpc_cancel_rtt_probe(call, serial, rtt_slot); in rxrpc_send_ack_packet()
251 rxrpc_set_keepalive(call); in rxrpc_send_ack_packet()
260 int rxrpc_send_abort_packet(struct rxrpc_call *call) in rxrpc_send_abort_packet() argument
275 if (rxrpc_is_client_call(call) && in rxrpc_send_abort_packet()
276 test_bit(RXRPC_CALL_TX_ALL_ACKED, &call->flags)) in rxrpc_send_abort_packet()
279 if (test_bit(RXRPC_CALL_DISCONNECTED, &call->flags)) in rxrpc_send_abort_packet()
282 conn = call->conn; in rxrpc_send_abort_packet()
284 msg.msg_name = &call->peer->srx.transport; in rxrpc_send_abort_packet()
285 msg.msg_namelen = call->peer->srx.transport_len; in rxrpc_send_abort_packet()
291 pkt.whdr.cid = htonl(call->cid); in rxrpc_send_abort_packet()
292 pkt.whdr.callNumber = htonl(call->call_id); in rxrpc_send_abort_packet()
297 pkt.whdr.securityIndex = call->security_ix; in rxrpc_send_abort_packet()
299 pkt.whdr.serviceId = htons(call->dest_srx.srx_service); in rxrpc_send_abort_packet()
300 pkt.abort_code = htonl(call->abort_code); in rxrpc_send_abort_packet()
312 trace_rxrpc_tx_fail(call->debug_id, serial, ret, in rxrpc_send_abort_packet()
315 trace_rxrpc_tx_packet(call->debug_id, &pkt.whdr, in rxrpc_send_abort_packet()
317 rxrpc_tx_backoff(call, ret); in rxrpc_send_abort_packet()
324 int rxrpc_send_data_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb) in rxrpc_send_data_packet() argument
327 struct rxrpc_connection *conn = call->conn; in rxrpc_send_data_packet()
349 msg.msg_name = &call->peer->srx.transport; in rxrpc_send_data_packet()
350 msg.msg_namelen = call->peer->srx.transport_len; in rxrpc_send_data_packet()
366 else if (test_and_clear_bit(RXRPC_CALL_EV_ACK_LOST, &call->events)) in rxrpc_send_data_packet()
370 else if (call->cong_mode == RXRPC_CALL_SLOW_START && call->cong_cwnd <= 2) in rxrpc_send_data_packet()
372 else if (call->tx_winsize <= 2) in rxrpc_send_data_packet()
374 else if (call->peer->rtt_count < 3 && txb->seq & 1) in rxrpc_send_data_packet()
376 else if (ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000), ktime_get_real())) in rxrpc_send_data_packet()
381 rxrpc_inc_stat(call->rxnet, stat_why_req_ack[why]); in rxrpc_send_data_packet()
382 trace_rxrpc_req_ack(call->debug_id, txb->seq, why); in rxrpc_send_data_packet()
391 trace_rxrpc_tx_data(call, txb->seq, serial, in rxrpc_send_data_packet()
399 trace_rxrpc_tx_data(call, txb->seq, serial, txb->wire.flags, in rxrpc_send_data_packet()
409 cmpxchg(&call->tx_transmitted, txb->seq - 1, txb->seq); in rxrpc_send_data_packet()
413 if (txb->len >= call->peer->maxdata) in rxrpc_send_data_packet()
418 rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_data); in rxrpc_send_data_packet()
426 rxrpc_inc_stat(call->rxnet, stat_tx_data_send); in rxrpc_send_data_packet()
431 rxrpc_inc_stat(call->rxnet, stat_tx_data_send_fail); in rxrpc_send_data_packet()
432 rxrpc_cancel_rtt_probe(call, serial, rtt_slot); in rxrpc_send_data_packet()
433 trace_rxrpc_tx_fail(call->debug_id, serial, ret, in rxrpc_send_data_packet()
436 trace_rxrpc_tx_packet(call->debug_id, &txb->wire, in rxrpc_send_data_packet()
440 rxrpc_tx_backoff(call, ret); in rxrpc_send_data_packet()
446 call->tx_last_sent = txb->last_sent; in rxrpc_send_data_packet()
448 call->peer->rtt_last_req = txb->last_sent; in rxrpc_send_data_packet()
449 if (call->peer->rtt_count > 1) { in rxrpc_send_data_packet()
452 ack_lost_at = rxrpc_get_rto_backoff(call->peer, false); in rxrpc_send_data_packet()
454 WRITE_ONCE(call->ack_lost_at, ack_lost_at); in rxrpc_send_data_packet()
455 rxrpc_reduce_call_timer(call, ack_lost_at, nowj, in rxrpc_send_data_packet()
462 &call->flags)) { in rxrpc_send_data_packet()
465 expect_rx_by = nowj + call->next_rx_timo; in rxrpc_send_data_packet()
466 WRITE_ONCE(call->expect_rx_by, expect_rx_by); in rxrpc_send_data_packet()
467 rxrpc_reduce_call_timer(call, expect_rx_by, nowj, in rxrpc_send_data_packet()
471 rxrpc_set_keepalive(call); in rxrpc_send_data_packet()
478 if (!test_and_set_bit(RXRPC_CALL_BEGAN_RX_TIMER, &call->flags)) in rxrpc_send_data_packet()
479 rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, in rxrpc_send_data_packet()
483 _leave(" = %d [%u]", ret, call->peer->maxdata); in rxrpc_send_data_packet()
492 rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_data); in rxrpc_send_data_packet()
498 rxrpc_inc_stat(call->rxnet, stat_tx_data_send_frag); in rxrpc_send_data_packet()
510 rxrpc_inc_stat(call->rxnet, stat_tx_data_send_fail); in rxrpc_send_data_packet()
511 rxrpc_cancel_rtt_probe(call, serial, rtt_slot); in rxrpc_send_data_packet()
512 trace_rxrpc_tx_fail(call->debug_id, serial, ret, in rxrpc_send_data_packet()
515 trace_rxrpc_tx_packet(call->debug_id, &txb->wire, in rxrpc_send_data_packet()
518 rxrpc_tx_backoff(call, ret); in rxrpc_send_data_packet()
698 static inline void rxrpc_instant_resend(struct rxrpc_call *call, in rxrpc_instant_resend() argument
701 if (!__rxrpc_call_is_complete(call)) in rxrpc_instant_resend()
708 void rxrpc_transmit_one(struct rxrpc_call *call, struct rxrpc_txbuf *txb) in rxrpc_transmit_one() argument
712 ret = rxrpc_send_data_packet(call, txb); in rxrpc_transmit_one()
718 rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, in rxrpc_transmit_one()
723 rxrpc_instant_resend(call, txb); in rxrpc_transmit_one()
727 unsigned long resend_at = now + call->peer->rto_j; in rxrpc_transmit_one()
729 WRITE_ONCE(call->resend_at, resend_at); in rxrpc_transmit_one()
730 rxrpc_reduce_call_timer(call, resend_at, now, in rxrpc_transmit_one()