Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rxrpc: Timestamp DATA packets before transmitting them

Move to setting the timestamp on DATA packets before transmitting them as
part of the preparation.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://patch.msgid.link/20241204074710.990092-17-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

David Howells and committed by
Jakub Kicinski
976b0ca5 81e7761b

+17 -39
+17 -39
net/rxrpc/output.c
··· 377 377 */ 378 378 static size_t rxrpc_prepare_data_subpacket(struct rxrpc_call *call, struct rxrpc_txbuf *txb, 379 379 rxrpc_serial_t serial, 380 - int subpkt, int nr_subpkts) 380 + int subpkt, int nr_subpkts, 381 + ktime_t now) 381 382 { 382 383 struct rxrpc_wire_header *whdr = txb->kvec[0].iov_base; 383 384 struct rxrpc_jumbo_header *jumbo = (void *)(whdr + 1) - sizeof(*jumbo); ··· 438 437 rxrpc_inc_stat(call->rxnet, stat_why_req_ack[why]); 439 438 trace_rxrpc_req_ack(call->debug_id, txb->seq, why); 440 439 if (why != rxrpc_reqack_no_srv_last) { 441 - txb->flags |= RXRPC_REQUEST_ACK; 442 440 flags |= RXRPC_REQUEST_ACK; 441 + rxrpc_begin_rtt_probe(call, serial, now, rxrpc_rtt_tx_data); 442 + call->peer->rtt_last_req = now; 443 443 } 444 444 dont_set_request_ack: 445 445 ··· 476 474 { 477 475 struct rxrpc_txbuf *txb = head; 478 476 rxrpc_serial_t serial; 477 + ktime_t now = ktime_get_real(); 479 478 size_t len = 0; 480 479 481 480 /* Each transmission of a Tx packet needs a new serial number */ 482 481 serial = rxrpc_get_next_serials(call->conn, n); 483 482 484 483 for (int i = 0; i < n; i++) { 485 - len += rxrpc_prepare_data_subpacket(call, txb, serial, i, n); 484 + txb->last_sent = now; 485 + len += rxrpc_prepare_data_subpacket(call, txb, serial, i, n, now); 486 486 serial++; 487 487 txb = list_next_entry(txb, call_link); 488 488 } 489 489 490 - return len; 491 - } 490 + /* Set timeouts */ 491 + if (call->peer->rtt_count > 1) { 492 + ktime_t delay = rxrpc_get_rto_backoff(call->peer, false); 492 493 493 - /* 494 - * Set timeouts after transmitting a packet. 495 - */ 496 - static void rxrpc_tstamp_data_packets(struct rxrpc_call *call, struct rxrpc_txbuf *txb, int n) 497 - { 498 - rxrpc_serial_t serial; 499 - ktime_t now = ktime_get_real(); 500 - bool ack_requested = txb->flags & RXRPC_REQUEST_ACK; 501 - int i; 502 - 503 - call->tx_last_sent = now; 504 - 505 - for (i = 0; i < n; i++) { 506 - txb->last_sent = now; 507 - ack_requested |= txb->flags & RXRPC_REQUEST_ACK; 508 - serial = txb->serial; 509 - txb = list_next_entry(txb, call_link); 510 - } 511 - 512 - if (ack_requested) { 513 - rxrpc_begin_rtt_probe(call, serial, now, rxrpc_rtt_tx_data); 514 - 515 - call->peer->rtt_last_req = now; 516 - if (call->peer->rtt_count > 1) { 517 - ktime_t delay = rxrpc_get_rto_backoff(call->peer, false); 518 - 519 - call->ack_lost_at = ktime_add(now, delay); 520 - trace_rxrpc_timer_set(call, delay, rxrpc_timer_trace_lost_ack); 521 - } 494 + call->ack_lost_at = ktime_add(now, delay); 495 + trace_rxrpc_timer_set(call, delay, rxrpc_timer_trace_lost_ack); 522 496 } 523 497 524 498 if (!test_and_set_bit(RXRPC_CALL_BEGAN_RX_TIMER, &call->flags)) { ··· 505 527 } 506 528 507 529 rxrpc_set_keepalive(call, now); 530 + return len; 508 531 } 509 532 510 533 /* ··· 517 538 enum rxrpc_tx_point frag; 518 539 struct msghdr msg; 519 540 size_t len; 541 + bool new_call = test_bit(RXRPC_CALL_BEGAN_RX_TIMER, &call->flags); 520 542 int ret; 521 543 522 544 _enter("%x,{%d}", txb->seq, txb->pkt_len); ··· 585 605 586 606 rxrpc_tx_backoff(call, ret); 587 607 588 - done: 589 - if (ret >= 0) { 590 - rxrpc_tstamp_data_packets(call, txb, n); 591 - } else { 608 + if (ret < 0) { 592 609 /* Cancel the call if the initial transmission fails, 593 610 * particularly if that's due to network routing issues that 594 611 * aren't going away anytime soon. The layer above can arrange 595 612 * the retransmission. 596 613 */ 597 - if (!test_and_set_bit(RXRPC_CALL_BEGAN_RX_TIMER, &call->flags)) 614 + if (new_call) 598 615 rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, 599 616 RX_USER_ABORT, ret); 600 617 } 601 618 619 + done: 602 620 _leave(" = %d [%u]", ret, call->peer->max_data); 603 621 return ret; 604 622 }