1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* RxRPC packet transmission
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
8 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
10 #include <linux/net.h>
11 #include <linux/gfp.h>
12 #include <linux/skbuff.h>
13 #include <linux/export.h>
15 #include <net/af_rxrpc.h>
17 #include "ar-internal.h"
19 extern int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len);
21 static ssize_t do_udp_sendmsg(struct socket *socket, struct msghdr *msg, size_t len)
23 struct sockaddr *sa = msg->msg_name;
24 struct sock *sk = socket->sk;
26 if (IS_ENABLED(CONFIG_AF_RXRPC_IPV6)) {
27 if (sa->sa_family == AF_INET6) {
28 if (sk->sk_family != AF_INET6) {
29 pr_warn("AF_INET6 address on AF_INET socket\n");
32 return udpv6_sendmsg(sk, msg, len);
35 return udp_sendmsg(sk, msg, len);
38 struct rxrpc_abort_buffer {
39 struct rxrpc_wire_header whdr;
43 static const char rxrpc_keepalive_string[] = "";
46 * Increase Tx backoff on transmission failure and clear it on success.
48 static void rxrpc_tx_backoff(struct rxrpc_call *call, int ret)
51 u16 tx_backoff = READ_ONCE(call->tx_backoff);
54 WRITE_ONCE(call->tx_backoff, tx_backoff + 1);
56 WRITE_ONCE(call->tx_backoff, 0);
61 * Arrange for a keepalive ping a certain time after we last transmitted. This
62 * lets the far side know we're still interested in this call and helps keep
63 * the route through any intervening firewall open.
65 * Receiving a response to the ping will prevent the ->expect_rx_by timer from
68 static void rxrpc_set_keepalive(struct rxrpc_call *call)
70 unsigned long now = jiffies, keepalive_at = call->next_rx_timo / 6;
73 WRITE_ONCE(call->keepalive_at, keepalive_at);
74 rxrpc_reduce_call_timer(call, keepalive_at, now,
75 rxrpc_timer_set_for_keepalive);
79 * Fill out an ACK packet.
81 static size_t rxrpc_fill_out_ack(struct rxrpc_connection *conn,
82 struct rxrpc_call *call,
83 struct rxrpc_txbuf *txb)
85 struct rxrpc_ackinfo ackinfo;
87 rxrpc_seq_t window, wtop, wrap_point, ix, first;
92 u8 sack_buffer[sizeof(call->ackr_sack_table)] __aligned(8);
94 atomic_set(&call->ackr_nr_unacked, 0);
95 atomic_set(&call->ackr_nr_consumed, 0);
96 rxrpc_inc_stat(call->rxnet, stat_tx_ack_fill);
98 /* Barrier against rxrpc_input_data(). */
100 wtmp = atomic64_read_acquire(&call->ackr_window);
101 window = lower_32_bits(wtmp);
102 wtop = upper_32_bits(wtmp);
103 txb->ack.firstPacket = htonl(window);
106 if (after(wtop, window)) {
107 /* Try to copy the SACK ring locklessly. We can use the copy,
108 * only if the now-current top of the window didn't go past the
109 * previously read base - otherwise we can't know whether we
110 * have old data or new data.
112 memcpy(sack_buffer, call->ackr_sack_table, sizeof(sack_buffer));
113 wrap_point = window + RXRPC_SACK_SIZE - 1;
114 wtmp = atomic64_read_acquire(&call->ackr_window);
115 window = lower_32_bits(wtmp);
116 wtop = upper_32_bits(wtmp);
117 if (after(wtop, wrap_point)) {
122 /* The buffer is maintained as a ring with an invariant mapping
123 * between bit position and sequence number, so we'll probably
126 txb->ack.nAcks = wtop - window;
127 ix = window % RXRPC_SACK_SIZE;
128 first = sizeof(sack_buffer) - ix;
130 if (ix + txb->ack.nAcks <= RXRPC_SACK_SIZE) {
131 memcpy(txb->acks, sack_buffer + ix, txb->ack.nAcks);
133 memcpy(txb->acks, sack_buffer + ix, first);
134 memcpy(txb->acks + first, sack_buffer,
135 txb->ack.nAcks - first);
138 ackp += txb->ack.nAcks;
139 } else if (before(wtop, window)) {
140 pr_warn("ack window backward %x %x", window, wtop);
141 } else if (txb->ack.reason == RXRPC_ACK_DELAY) {
142 txb->ack.reason = RXRPC_ACK_IDLE;
145 mtu = conn->peer->if_mtu;
146 mtu -= conn->peer->hdrsize;
147 jmax = rxrpc_rx_jumbo_max;
148 qsize = (window - 1) - call->rx_consumed;
149 rsize = max_t(int, call->rx_winsize - qsize, 0);
150 ackinfo.rxMTU = htonl(rxrpc_rx_mtu);
151 ackinfo.maxMTU = htonl(mtu);
152 ackinfo.rwind = htonl(rsize);
153 ackinfo.jumbo_max = htonl(jmax);
158 memcpy(ackp, &ackinfo, sizeof(ackinfo));
159 return txb->ack.nAcks + 3 + sizeof(ackinfo);
163 * Record the beginning of an RTT probe.
165 static int rxrpc_begin_rtt_probe(struct rxrpc_call *call, rxrpc_serial_t serial,
166 enum rxrpc_rtt_tx_trace why)
168 unsigned long avail = call->rtt_avail;
171 if (!(avail & RXRPC_CALL_RTT_AVAIL_MASK))
174 rtt_slot = __ffs(avail & RXRPC_CALL_RTT_AVAIL_MASK);
175 if (!test_and_clear_bit(rtt_slot, &call->rtt_avail))
178 call->rtt_serial[rtt_slot] = serial;
179 call->rtt_sent_at[rtt_slot] = ktime_get_real();
180 smp_wmb(); /* Write data before avail bit */
181 set_bit(rtt_slot + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail);
183 trace_rxrpc_rtt_tx(call, why, rtt_slot, serial);
187 trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_no_slot, rtt_slot, serial);
192 * Cancel an RTT probe.
194 static void rxrpc_cancel_rtt_probe(struct rxrpc_call *call,
195 rxrpc_serial_t serial, int rtt_slot)
197 if (rtt_slot != -1) {
198 clear_bit(rtt_slot + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail);
199 smp_wmb(); /* Clear pending bit before setting slot */
200 set_bit(rtt_slot, &call->rtt_avail);
201 trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_cancel, rtt_slot, serial);
206 * Transmit an ACK packet.
208 int rxrpc_send_ack_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb)
210 struct rxrpc_connection *conn;
213 rxrpc_serial_t serial;
215 int ret, rtt_slot = -1;
217 if (test_bit(RXRPC_CALL_DISCONNECTED, &call->flags))
222 msg.msg_name = &call->peer->srx.transport;
223 msg.msg_namelen = call->peer->srx.transport_len;
224 msg.msg_control = NULL;
225 msg.msg_controllen = 0;
228 if (txb->ack.reason == RXRPC_ACK_PING)
229 txb->wire.flags |= RXRPC_REQUEST_ACK;
231 n = rxrpc_fill_out_ack(conn, call, txb);
235 iov[0].iov_base = &txb->wire;
236 iov[0].iov_len = sizeof(txb->wire) + sizeof(txb->ack) + n;
237 len = iov[0].iov_len;
239 serial = atomic_inc_return(&conn->serial);
240 txb->wire.serial = htonl(serial);
241 trace_rxrpc_tx_ack(call->debug_id, serial,
242 ntohl(txb->ack.firstPacket),
243 ntohl(txb->ack.serial), txb->ack.reason, txb->ack.nAcks);
245 if (txb->ack.reason == RXRPC_ACK_PING)
246 rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_ping);
248 rxrpc_inc_stat(call->rxnet, stat_tx_ack_send);
250 /* Grab the highest received seq as late as possible */
251 txb->ack.previousPacket = htonl(call->rx_highest_seq);
253 iov_iter_kvec(&msg.msg_iter, WRITE, iov, 1, len);
254 ret = do_udp_sendmsg(conn->local->socket, &msg, len);
255 call->peer->last_tx_at = ktime_get_seconds();
257 trace_rxrpc_tx_fail(call->debug_id, serial, ret,
258 rxrpc_tx_point_call_ack);
260 trace_rxrpc_tx_packet(call->debug_id, &txb->wire,
261 rxrpc_tx_point_call_ack);
262 if (txb->wire.flags & RXRPC_REQUEST_ACK)
263 call->peer->rtt_last_req = ktime_get_real();
265 rxrpc_tx_backoff(call, ret);
267 if (!__rxrpc_call_is_complete(call)) {
269 rxrpc_cancel_rtt_probe(call, serial, rtt_slot);
270 rxrpc_set_keepalive(call);
277 * Send an ABORT call packet.
279 int rxrpc_send_abort_packet(struct rxrpc_call *call)
281 struct rxrpc_connection *conn;
282 struct rxrpc_abort_buffer pkt;
285 rxrpc_serial_t serial;
288 /* Don't bother sending aborts for a client call once the server has
289 * hard-ACK'd all of its request data. After that point, we're not
290 * going to stop the operation proceeding, and whilst we might limit
291 * the reply, it's not worth it if we can send a new call on the same
292 * channel instead, thereby closing off this call.
294 if (rxrpc_is_client_call(call) &&
295 test_bit(RXRPC_CALL_TX_ALL_ACKED, &call->flags))
298 if (test_bit(RXRPC_CALL_DISCONNECTED, &call->flags))
303 msg.msg_name = &call->peer->srx.transport;
304 msg.msg_namelen = call->peer->srx.transport_len;
305 msg.msg_control = NULL;
306 msg.msg_controllen = 0;
309 pkt.whdr.epoch = htonl(conn->proto.epoch);
310 pkt.whdr.cid = htonl(call->cid);
311 pkt.whdr.callNumber = htonl(call->call_id);
313 pkt.whdr.type = RXRPC_PACKET_TYPE_ABORT;
314 pkt.whdr.flags = conn->out_clientflag;
315 pkt.whdr.userStatus = 0;
316 pkt.whdr.securityIndex = call->security_ix;
318 pkt.whdr.serviceId = htons(call->dest_srx.srx_service);
319 pkt.abort_code = htonl(call->abort_code);
321 iov[0].iov_base = &pkt;
322 iov[0].iov_len = sizeof(pkt);
324 serial = atomic_inc_return(&conn->serial);
325 pkt.whdr.serial = htonl(serial);
327 iov_iter_kvec(&msg.msg_iter, WRITE, iov, 1, sizeof(pkt));
328 ret = do_udp_sendmsg(conn->local->socket, &msg, sizeof(pkt));
329 conn->peer->last_tx_at = ktime_get_seconds();
331 trace_rxrpc_tx_fail(call->debug_id, serial, ret,
332 rxrpc_tx_point_call_abort);
334 trace_rxrpc_tx_packet(call->debug_id, &pkt.whdr,
335 rxrpc_tx_point_call_abort);
336 rxrpc_tx_backoff(call, ret);
341 * send a packet through the transport endpoint
343 int rxrpc_send_data_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb)
345 enum rxrpc_req_ack_trace why;
346 struct rxrpc_connection *conn = call->conn;
349 rxrpc_serial_t serial;
351 int ret, rtt_slot = -1;
353 _enter("%x,{%d}", txb->seq, txb->len);
355 /* Each transmission of a Tx packet needs a new serial number */
356 serial = atomic_inc_return(&conn->serial);
357 txb->wire.serial = htonl(serial);
359 if (test_bit(RXRPC_CONN_PROBING_FOR_UPGRADE, &conn->flags) &&
361 txb->wire.userStatus = RXRPC_USERSTATUS_SERVICE_UPGRADE;
363 iov[0].iov_base = &txb->wire;
364 iov[0].iov_len = sizeof(txb->wire) + txb->len;
365 len = iov[0].iov_len;
366 iov_iter_kvec(&msg.msg_iter, WRITE, iov, 1, len);
368 msg.msg_name = &call->peer->srx.transport;
369 msg.msg_namelen = call->peer->srx.transport_len;
370 msg.msg_control = NULL;
371 msg.msg_controllen = 0;
374 /* If our RTT cache needs working on, request an ACK. Also request
375 * ACKs if a DATA packet appears to have been lost.
377 * However, we mustn't request an ACK on the last reply packet of a
378 * service call, lest OpenAFS incorrectly send us an ACK with some
379 * soft-ACKs in it and then never follow up with a proper hard ACK.
381 if (txb->wire.flags & RXRPC_REQUEST_ACK)
382 why = rxrpc_reqack_already_on;
383 else if (test_bit(RXRPC_TXBUF_LAST, &txb->flags) && rxrpc_sending_to_client(txb))
384 why = rxrpc_reqack_no_srv_last;
385 else if (test_and_clear_bit(RXRPC_CALL_EV_ACK_LOST, &call->events))
386 why = rxrpc_reqack_ack_lost;
387 else if (test_bit(RXRPC_TXBUF_RESENT, &txb->flags))
388 why = rxrpc_reqack_retrans;
389 else if (call->cong_mode == RXRPC_CALL_SLOW_START && call->cong_cwnd <= 2)
390 why = rxrpc_reqack_slow_start;
391 else if (call->tx_winsize <= 2)
392 why = rxrpc_reqack_small_txwin;
393 else if (call->peer->rtt_count < 3 && txb->seq & 1)
394 why = rxrpc_reqack_more_rtt;
395 else if (ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000), ktime_get_real()))
396 why = rxrpc_reqack_old_rtt;
398 goto dont_set_request_ack;
400 rxrpc_inc_stat(call->rxnet, stat_why_req_ack[why]);
401 trace_rxrpc_req_ack(call->debug_id, txb->seq, why);
402 if (why != rxrpc_reqack_no_srv_last)
403 txb->wire.flags |= RXRPC_REQUEST_ACK;
404 dont_set_request_ack:
406 if (IS_ENABLED(CONFIG_AF_RXRPC_INJECT_LOSS)) {
408 if ((lose++ & 7) == 7) {
410 trace_rxrpc_tx_data(call, txb->seq, serial,
412 test_bit(RXRPC_TXBUF_RESENT, &txb->flags),
418 trace_rxrpc_tx_data(call, txb->seq, serial, txb->wire.flags,
419 test_bit(RXRPC_TXBUF_RESENT, &txb->flags), false);
421 /* Track what we've attempted to transmit at least once so that the
422 * retransmission algorithm doesn't try to resend what we haven't sent
423 * yet. However, this can race as we can receive an ACK before we get
424 * to this point. But, OTOH, if we won't get an ACK mentioning this
425 * packet unless the far side received it (though it could have
426 * discarded it anyway and NAK'd it).
428 cmpxchg(&call->tx_transmitted, txb->seq - 1, txb->seq);
430 /* send the packet with the don't fragment bit set if we currently
431 * think it's small enough */
432 if (txb->len >= call->peer->maxdata)
433 goto send_fragmentable;
435 down_read(&conn->local->defrag_sem);
437 txb->last_sent = ktime_get_real();
438 if (txb->wire.flags & RXRPC_REQUEST_ACK)
439 rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_data);
441 /* send the packet by UDP
442 * - returns -EMSGSIZE if UDP would have to fragment the packet
443 * to go out of the interface
444 * - in which case, we'll have processed the ICMP error
445 * message and update the peer record
447 rxrpc_inc_stat(call->rxnet, stat_tx_data_send);
448 ret = do_udp_sendmsg(conn->local->socket, &msg, len);
449 conn->peer->last_tx_at = ktime_get_seconds();
451 up_read(&conn->local->defrag_sem);
453 rxrpc_inc_stat(call->rxnet, stat_tx_data_send_fail);
454 rxrpc_cancel_rtt_probe(call, serial, rtt_slot);
455 trace_rxrpc_tx_fail(call->debug_id, serial, ret,
456 rxrpc_tx_point_call_data_nofrag);
458 trace_rxrpc_tx_packet(call->debug_id, &txb->wire,
459 rxrpc_tx_point_call_data_nofrag);
462 rxrpc_tx_backoff(call, ret);
463 if (ret == -EMSGSIZE)
464 goto send_fragmentable;
468 call->tx_last_sent = txb->last_sent;
469 if (txb->wire.flags & RXRPC_REQUEST_ACK) {
470 call->peer->rtt_last_req = txb->last_sent;
471 if (call->peer->rtt_count > 1) {
472 unsigned long nowj = jiffies, ack_lost_at;
474 ack_lost_at = rxrpc_get_rto_backoff(call->peer, false);
476 WRITE_ONCE(call->ack_lost_at, ack_lost_at);
477 rxrpc_reduce_call_timer(call, ack_lost_at, nowj,
478 rxrpc_timer_set_for_lost_ack);
483 !test_and_set_bit(RXRPC_CALL_BEGAN_RX_TIMER,
485 unsigned long nowj = jiffies, expect_rx_by;
487 expect_rx_by = nowj + call->next_rx_timo;
488 WRITE_ONCE(call->expect_rx_by, expect_rx_by);
489 rxrpc_reduce_call_timer(call, expect_rx_by, nowj,
490 rxrpc_timer_set_for_normal);
493 rxrpc_set_keepalive(call);
495 /* Cancel the call if the initial transmission fails,
496 * particularly if that's due to network routing issues that
497 * aren't going away anytime soon. The layer above can arrange
498 * the retransmission.
500 if (!test_and_set_bit(RXRPC_CALL_BEGAN_RX_TIMER, &call->flags))
501 rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR,
505 _leave(" = %d [%u]", ret, call->peer->maxdata);
509 /* attempt to send this message with fragmentation enabled */
510 _debug("send fragment");
512 down_write(&conn->local->defrag_sem);
514 txb->last_sent = ktime_get_real();
515 if (txb->wire.flags & RXRPC_REQUEST_ACK)
516 rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_data);
518 switch (conn->local->srx.transport.family) {
521 ip_sock_set_mtu_discover(conn->local->socket->sk,
523 rxrpc_inc_stat(call->rxnet, stat_tx_data_send_frag);
524 ret = do_udp_sendmsg(conn->local->socket, &msg, len);
525 conn->peer->last_tx_at = ktime_get_seconds();
527 ip_sock_set_mtu_discover(conn->local->socket->sk,
536 rxrpc_inc_stat(call->rxnet, stat_tx_data_send_fail);
537 rxrpc_cancel_rtt_probe(call, serial, rtt_slot);
538 trace_rxrpc_tx_fail(call->debug_id, serial, ret,
539 rxrpc_tx_point_call_data_frag);
541 trace_rxrpc_tx_packet(call->debug_id, &txb->wire,
542 rxrpc_tx_point_call_data_frag);
544 rxrpc_tx_backoff(call, ret);
546 up_write(&conn->local->defrag_sem);
551 * Transmit a connection-level abort.
553 void rxrpc_send_conn_abort(struct rxrpc_connection *conn)
555 struct rxrpc_wire_header whdr;
563 msg.msg_name = &conn->peer->srx.transport;
564 msg.msg_namelen = conn->peer->srx.transport_len;
565 msg.msg_control = NULL;
566 msg.msg_controllen = 0;
569 whdr.epoch = htonl(conn->proto.epoch);
570 whdr.cid = htonl(conn->proto.cid);
573 whdr.type = RXRPC_PACKET_TYPE_ABORT;
574 whdr.flags = conn->out_clientflag;
576 whdr.securityIndex = conn->security_ix;
578 whdr.serviceId = htons(conn->service_id);
580 word = htonl(conn->abort_code);
582 iov[0].iov_base = &whdr;
583 iov[0].iov_len = sizeof(whdr);
584 iov[1].iov_base = &word;
585 iov[1].iov_len = sizeof(word);
587 len = iov[0].iov_len + iov[1].iov_len;
589 serial = atomic_inc_return(&conn->serial);
590 whdr.serial = htonl(serial);
592 iov_iter_kvec(&msg.msg_iter, WRITE, iov, 2, len);
593 ret = do_udp_sendmsg(conn->local->socket, &msg, len);
595 trace_rxrpc_tx_fail(conn->debug_id, serial, ret,
596 rxrpc_tx_point_conn_abort);
597 _debug("sendmsg failed: %d", ret);
601 trace_rxrpc_tx_packet(conn->debug_id, &whdr, rxrpc_tx_point_conn_abort);
603 conn->peer->last_tx_at = ktime_get_seconds();
607 * Reject a packet through the local endpoint.
609 void rxrpc_reject_packet(struct rxrpc_local *local, struct sk_buff *skb)
611 struct rxrpc_wire_header whdr;
612 struct sockaddr_rxrpc srx;
613 struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
620 rxrpc_see_skb(skb, rxrpc_skb_see_reject);
622 iov[0].iov_base = &whdr;
623 iov[0].iov_len = sizeof(whdr);
624 iov[1].iov_base = &code;
625 iov[1].iov_len = sizeof(code);
627 msg.msg_name = &srx.transport;
628 msg.msg_control = NULL;
629 msg.msg_controllen = 0;
632 memset(&whdr, 0, sizeof(whdr));
635 case RXRPC_SKB_MARK_REJECT_BUSY:
636 whdr.type = RXRPC_PACKET_TYPE_BUSY;
640 case RXRPC_SKB_MARK_REJECT_ABORT:
641 whdr.type = RXRPC_PACKET_TYPE_ABORT;
642 code = htonl(skb->priority);
643 size = sizeof(whdr) + sizeof(code);
650 if (rxrpc_extract_addr_from_skb(&srx, skb) == 0) {
651 msg.msg_namelen = srx.transport_len;
653 whdr.epoch = htonl(sp->hdr.epoch);
654 whdr.cid = htonl(sp->hdr.cid);
655 whdr.callNumber = htonl(sp->hdr.callNumber);
656 whdr.serviceId = htons(sp->hdr.serviceId);
657 whdr.flags = sp->hdr.flags;
658 whdr.flags ^= RXRPC_CLIENT_INITIATED;
659 whdr.flags &= RXRPC_CLIENT_INITIATED;
661 iov_iter_kvec(&msg.msg_iter, WRITE, iov, ioc, size);
662 ret = do_udp_sendmsg(local->socket, &msg, size);
664 trace_rxrpc_tx_fail(local->debug_id, 0, ret,
665 rxrpc_tx_point_reject);
667 trace_rxrpc_tx_packet(local->debug_id, &whdr,
668 rxrpc_tx_point_reject);
673 * Send a VERSION reply to a peer as a keepalive.
675 void rxrpc_send_keepalive(struct rxrpc_peer *peer)
677 struct rxrpc_wire_header whdr;
685 msg.msg_name = &peer->srx.transport;
686 msg.msg_namelen = peer->srx.transport_len;
687 msg.msg_control = NULL;
688 msg.msg_controllen = 0;
691 whdr.epoch = htonl(peer->local->rxnet->epoch);
696 whdr.type = RXRPC_PACKET_TYPE_VERSION; /* Not client-initiated */
697 whdr.flags = RXRPC_LAST_PACKET;
699 whdr.securityIndex = 0;
703 iov[0].iov_base = &whdr;
704 iov[0].iov_len = sizeof(whdr);
705 iov[1].iov_base = (char *)rxrpc_keepalive_string;
706 iov[1].iov_len = sizeof(rxrpc_keepalive_string);
708 len = iov[0].iov_len + iov[1].iov_len;
710 iov_iter_kvec(&msg.msg_iter, WRITE, iov, 2, len);
711 ret = do_udp_sendmsg(peer->local->socket, &msg, len);
713 trace_rxrpc_tx_fail(peer->debug_id, 0, ret,
714 rxrpc_tx_point_version_keepalive);
716 trace_rxrpc_tx_packet(peer->debug_id, &whdr,
717 rxrpc_tx_point_version_keepalive);
719 peer->last_tx_at = ktime_get_seconds();
724 * Schedule an instant Tx resend.
726 static inline void rxrpc_instant_resend(struct rxrpc_call *call,
727 struct rxrpc_txbuf *txb)
729 if (!__rxrpc_call_is_complete(call))
734 * Transmit one packet.
736 void rxrpc_transmit_one(struct rxrpc_call *call, struct rxrpc_txbuf *txb)
740 ret = rxrpc_send_data_packet(call, txb);
746 rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR,
750 _debug("need instant resend %d", ret);
751 rxrpc_instant_resend(call, txb);
754 unsigned long now = jiffies;
755 unsigned long resend_at = now + call->peer->rto_j;
757 WRITE_ONCE(call->resend_at, resend_at);
758 rxrpc_reduce_call_timer(call, resend_at, now,
759 rxrpc_timer_set_for_send);