From: David Howells <dhowells@redhat.com>
To: netdev@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>,
Marc Dionne <marc.dionne@auristor.com>,
Simon Horman <horms@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next v3 06/21] rxrpc: Remove atomic handling on some fields only used in I/O thread
Date: Wed, 6 Mar 2024 00:06:36 +0000 [thread overview]
Message-ID: <20240306000655.1100294-7-dhowells@redhat.com> (raw)
In-Reply-To: <20240306000655.1100294-1-dhowells@redhat.com>
call->tx_transmitted and call->acks_prev_seq don't need to be managed with
cmpxchg() and barriers as it's only used within the singular I/O thread.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
---
net/rxrpc/call_event.c | 10 ++++------
net/rxrpc/output.c | 8 +++-----
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
index 84eedbb49fcb..1184518dcdb8 100644
--- a/net/rxrpc/call_event.c
+++ b/net/rxrpc/call_event.c
@@ -115,7 +115,7 @@ void rxrpc_resend(struct rxrpc_call *call, struct sk_buff *ack_skb)
struct rxrpc_skb_priv *sp;
struct rxrpc_txbuf *txb;
unsigned long resend_at;
- rxrpc_seq_t transmitted = READ_ONCE(call->tx_transmitted);
+ rxrpc_seq_t transmitted = call->tx_transmitted;
ktime_t now, max_age, oldest, ack_ts;
bool unacked = false;
unsigned int i;
@@ -184,16 +184,14 @@ void rxrpc_resend(struct rxrpc_call *call, struct sk_buff *ack_skb)
* seen. Anything between the soft-ACK table and that point will get
* ACK'd or NACK'd in due course, so don't worry about it here; here we
* need to consider retransmitting anything beyond that point.
- *
- * Note that ACK for a packet can beat the update of tx_transmitted.
*/
- if (after_eq(READ_ONCE(call->acks_prev_seq), READ_ONCE(call->tx_transmitted)))
+ if (after_eq(call->acks_prev_seq, call->tx_transmitted))
goto no_further_resend;
list_for_each_entry_from(txb, &call->tx_buffer, call_link) {
- if (before_eq(txb->seq, READ_ONCE(call->acks_prev_seq)))
+ if (before_eq(txb->seq, call->acks_prev_seq))
continue;
- if (after(txb->seq, READ_ONCE(call->tx_transmitted)))
+ if (after(txb->seq, call->tx_transmitted))
break; /* Not transmitted yet */
if (ack && ack->reason == RXRPC_ACK_PING_RESPONSE &&
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index 2386b01b2231..1e039b6f4494 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -397,12 +397,10 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb)
/* Track what we've attempted to transmit at least once so that the
* retransmission algorithm doesn't try to resend what we haven't sent
- * yet. However, this can race as we can receive an ACK before we get
- * to this point. But, OTOH, if we won't get an ACK mentioning this
- * packet unless the far side received it (though it could have
- * discarded it anyway and NAK'd it).
+ * yet.
*/
- cmpxchg(&call->tx_transmitted, txb->seq - 1, txb->seq);
+ if (txb->seq == call->tx_transmitted + 1)
+ call->tx_transmitted = txb->seq;
/* send the packet with the don't fragment bit set if we currently
* think it's small enough */
next prev parent reply other threads:[~2024-03-06 0:07 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 0:06 [PATCH net-next v3 00/21] rxrpc: Miscellaneous changes and make use of MSG_SPLICE_PAGES David Howells
2024-03-06 0:06 ` [PATCH net-next v3 01/21] rxrpc: Record the Tx serial in the rxrpc_txbuf and retransmit trace David Howells
2024-03-06 0:06 ` [PATCH net-next v3 02/21] rxrpc: Convert rxrpc_txbuf::flags into a mask and don't use atomics David Howells
2024-03-06 0:06 ` [PATCH net-next v3 03/21] rxrpc: Note cksum in txbuf David Howells
2024-03-06 0:06 ` [PATCH net-next v3 04/21] rxrpc: Fix the names of the fields in the ACK trailer struct David Howells
2024-03-06 0:06 ` [PATCH net-next v3 05/21] rxrpc: Strip barriers and atomics off of timer tracking David Howells
2024-03-06 0:06 ` David Howells [this message]
2024-03-06 0:06 ` [PATCH net-next v3 07/21] rxrpc: Do lazy DF flag resetting David Howells
2024-03-06 0:06 ` [PATCH net-next v3 08/21] rxrpc: Merge together DF/non-DF branches of data Tx function David Howells
2024-03-06 0:06 ` [PATCH net-next v3 09/21] rxrpc: Add a kvec[] to the rxrpc_txbuf struct David Howells
2024-03-06 0:06 ` [PATCH net-next v3 10/21] rxrpc: Split up the DATA packet transmission function David Howells
2024-03-06 0:06 ` [PATCH net-next v3 11/21] rxrpc: Don't pick values out of the wire header when setting up security David Howells
2024-03-06 0:06 ` [PATCH net-next v3 12/21] rxrpc: Move rxrpc_send_ACK() to output.c with rxrpc_send_ack_packet() David Howells
2024-03-06 0:06 ` [PATCH net-next v3 13/21] rxrpc: Use rxrpc_txbuf::kvec[0] instead of rxrpc_txbuf::wire David Howells
2024-03-06 0:06 ` [PATCH net-next v3 14/21] rxrpc: Do zerocopy using MSG_SPLICE_PAGES and page frags David Howells
2024-03-06 0:06 ` [PATCH net-next v3 15/21] rxrpc: Parse received packets before dealing with timeouts David Howells
2024-03-06 0:06 ` [PATCH net-next v3 16/21] rxrpc: Don't permit resending after all Tx packets acked David Howells
2024-03-06 0:06 ` [PATCH net-next v3 17/21] rxrpc: Differentiate PING ACK transmission traces David Howells
2024-03-06 0:06 ` [PATCH net-next v3 18/21] rxrpc: Use ktimes for call timeout tracking and set the timer lazily David Howells
2024-03-06 0:06 ` [PATCH net-next v3 19/21] rxrpc: Record probes after transmission and reduce number of time-gets David Howells
2024-03-06 0:06 ` [PATCH net-next v3 20/21] rxrpc: Clean up the resend algorithm David Howells
2024-03-06 0:06 ` [PATCH net-next v3 21/21] rxrpc: Extract useful fields from a received ACK to skb priv data David Howells
2024-03-07 9:39 ` [PATCH net-next v3 00/21] rxrpc: Miscellaneous changes and make use of MSG_SPLICE_PAGES Simon Horman
2024-03-08 5:10 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240306000655.1100294-7-dhowells@redhat.com \
--to=dhowells@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).