From nobody Fri Dec 19 04:58:06 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC9031ADFEC for ; Wed, 4 Dec 2024 07:48:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298513; cv=none; b=NUB4G6LIIbTFGN7w/EfE2byN5J4z1DCRgPUNYqpZedeeu8qO65LUigr17TrIFf+5GneHC0FNGJJoQasH+/H+NfdFro8krX4xCqMqzYY9AxWq9SS542uICkpRihbeilmWbA3SSl3qlDwWaAAe7lVrwAl8P7S+783GqJuBNmknHWg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298513; c=relaxed/simple; bh=LMN8Ulwf59aLgyl4A1j1+zjAzdJwNO938nCa3KYT1UY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tbl5Q0BSe29D93leflHfu9Euh22wVb4gBA1kk1HBmy0mOzK6QGM5AMbdEhuZieKVktMkllIc15GI5pt+bX+dxAZHi0O19mhoYxqcuOpQZNkDtrOq3Ge/IFvLDkVvFgkIe5MEBc0oFHHTgC4AFRsOhOvKRQv4bv02ecCB/FcM6hs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=CmvMuBIz; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CmvMuBIz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733298510; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=r9x8r4zhIkxB5FDvVdvdm+yMP8eMcmsqzxa/soPgL/c=; b=CmvMuBIzzT69eKszZFVqsyjNfQOTSxcwZ9DpBtQgj4Qec0eNEXoLI8jCxBYjP23o7Hy/5j dRM3wNjYXetKOIyt+ioVFcUNhdsPQFJQz0VS99JtzTjIH3LQlHmz3I4UeAgwHrDopMEGS8 bI6L6e4hUJZG4M1zjOGFBlV8JiBoGxw= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-400-Nsi335YWNZKeu5eHReALGA-1; Wed, 04 Dec 2024 02:48:26 -0500 X-MC-Unique: Nsi335YWNZKeu5eHReALGA-1 X-Mimecast-MFC-AGG-ID: Nsi335YWNZKeu5eHReALGA Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 564F81955D53; Wed, 4 Dec 2024 07:48:25 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.48]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C09B83000199; Wed, 4 Dec 2024 07:48:22 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , Marc Dionne , Yunsheng Lin , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 16/39] rxrpc: Timestamp DATA packets before transmitting them Date: Wed, 4 Dec 2024 07:46:44 +0000 Message-ID: <20241204074710.990092-17-dhowells@redhat.com> In-Reply-To: <20241204074710.990092-1-dhowells@redhat.com> References: <20241204074710.990092-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" Move to setting the timestamp on DATA packets before transmitting them as part of the preparation. Signed-off-by: David Howells cc: Marc Dionne cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni cc: linux-afs@lists.infradead.org cc: netdev@vger.kernel.org --- net/rxrpc/output.c | 56 ++++++++++++++-------------------------------- 1 file changed, 17 insertions(+), 39 deletions(-) diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c index 3d992023f80f..400c3389d492 100644 --- a/net/rxrpc/output.c +++ b/net/rxrpc/output.c @@ -377,7 +377,8 @@ int rxrpc_send_abort_packet(struct rxrpc_call *call) */ static size_t rxrpc_prepare_data_subpacket(struct rxrpc_call *call, struct= rxrpc_txbuf *txb, rxrpc_serial_t serial, - int subpkt, int nr_subpkts) + int subpkt, int nr_subpkts, + ktime_t now) { struct rxrpc_wire_header *whdr =3D txb->kvec[0].iov_base; struct rxrpc_jumbo_header *jumbo =3D (void *)(whdr + 1) - sizeof(*jumbo); @@ -437,8 +438,9 @@ static size_t rxrpc_prepare_data_subpacket(struct rxrpc= _call *call, struct rxrpc rxrpc_inc_stat(call->rxnet, stat_why_req_ack[why]); trace_rxrpc_req_ack(call->debug_id, txb->seq, why); if (why !=3D rxrpc_reqack_no_srv_last) { - txb->flags |=3D RXRPC_REQUEST_ACK; flags |=3D RXRPC_REQUEST_ACK; + rxrpc_begin_rtt_probe(call, serial, now, rxrpc_rtt_tx_data); + call->peer->rtt_last_req =3D now; } dont_set_request_ack: =20 @@ -474,49 +476,25 @@ static size_t rxrpc_prepare_data_packet(struct rxrpc_= call *call, struct rxrpc_tx { struct rxrpc_txbuf *txb =3D head; rxrpc_serial_t serial; + ktime_t now =3D ktime_get_real(); size_t len =3D 0; =20 /* Each transmission of a Tx packet needs a new serial number */ serial =3D rxrpc_get_next_serials(call->conn, n); =20 for (int i =3D 0; i < n; i++) { - len +=3D rxrpc_prepare_data_subpacket(call, txb, serial, i, n); - serial++; - txb =3D list_next_entry(txb, call_link); - } - - return len; -} - -/* - * Set timeouts after transmitting a packet. - */ -static void rxrpc_tstamp_data_packets(struct rxrpc_call *call, struct rxrp= c_txbuf *txb, int n) -{ - rxrpc_serial_t serial; - ktime_t now =3D ktime_get_real(); - bool ack_requested =3D txb->flags & RXRPC_REQUEST_ACK; - int i; - - call->tx_last_sent =3D now; - - for (i =3D 0; i < n; i++) { txb->last_sent =3D now; - ack_requested |=3D txb->flags & RXRPC_REQUEST_ACK; - serial =3D txb->serial; + len +=3D rxrpc_prepare_data_subpacket(call, txb, serial, i, n, now); + serial++; txb =3D list_next_entry(txb, call_link); } =20 - if (ack_requested) { - rxrpc_begin_rtt_probe(call, serial, now, rxrpc_rtt_tx_data); - - call->peer->rtt_last_req =3D now; - if (call->peer->rtt_count > 1) { - ktime_t delay =3D rxrpc_get_rto_backoff(call->peer, false); + /* Set timeouts */ + if (call->peer->rtt_count > 1) { + ktime_t delay =3D rxrpc_get_rto_backoff(call->peer, false); =20 - call->ack_lost_at =3D ktime_add(now, delay); - trace_rxrpc_timer_set(call, delay, rxrpc_timer_trace_lost_ack); - } + call->ack_lost_at =3D ktime_add(now, delay); + trace_rxrpc_timer_set(call, delay, rxrpc_timer_trace_lost_ack); } =20 if (!test_and_set_bit(RXRPC_CALL_BEGAN_RX_TIMER, &call->flags)) { @@ -527,6 +505,7 @@ static void rxrpc_tstamp_data_packets(struct rxrpc_call= *call, struct rxrpc_txbu } =20 rxrpc_set_keepalive(call, now); + return len; } =20 /* @@ -538,6 +517,7 @@ static int rxrpc_send_data_packet(struct rxrpc_call *ca= ll, struct rxrpc_txbuf *t enum rxrpc_tx_point frag; struct msghdr msg; size_t len; + bool new_call =3D test_bit(RXRPC_CALL_BEGAN_RX_TIMER, &call->flags); int ret; =20 _enter("%x,{%d}", txb->seq, txb->pkt_len); @@ -605,20 +585,18 @@ static int rxrpc_send_data_packet(struct rxrpc_call *= call, struct rxrpc_txbuf *t =20 rxrpc_tx_backoff(call, ret); =20 -done: - if (ret >=3D 0) { - rxrpc_tstamp_data_packets(call, txb, n); - } else { + if (ret < 0) { /* Cancel the call if the initial transmission fails, * particularly if that's due to network routing issues that * aren't going away anytime soon. The layer above can arrange * the retransmission. */ - if (!test_and_set_bit(RXRPC_CALL_BEGAN_RX_TIMER, &call->flags)) + if (new_call) rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, RX_USER_ABORT, ret); } =20 +done: _leave(" =3D %d [%u]", ret, call->peer->max_data); return ret; }