Skip to content

Commit 124c4c3

Browse files
edumazetkuba-moo
authored andcommitted
tcp: add TCP_RFC7323_PAWS_ACK drop reason
XPS can cause reorders because of the relaxed OOO conditions for pure ACK packets. For hosts not using RFS, what can happpen is that ACK packets are sent on behalf of the cpu processing NIC interrupts, selecting TX queue A for ACK packet P1. Then a subsequent sendmsg() can run on another cpu. TX queue selection uses the socket hash and can choose another queue B for packets P2 (with payload). If queue A is more congested than queue B, the ACK packet P1 could be sent on the wire after P2. A linux receiver when processing P1 (after P2) currently increments LINUX_MIB_PAWSESTABREJECTED (TcpExtPAWSEstab) and use TCP_RFC7323_PAWS drop reason. It might also send a DUPACK if not rate limited. In order to better understand this pattern, this patch adds a new drop_reason : TCP_RFC7323_PAWS_ACK. For old ACKS like these, we no longer increment LINUX_MIB_PAWSESTABREJECTED and no longer sends a DUPACK, keeping credit for other more interesting DUPACK. perf record -e skb:kfree_skb -a perf script ... swapper 0 [148] 27475.438637: skb:kfree_skb: ... location=tcp_validate_incoming+0x4f0 reason: TCP_RFC7323_PAWS_ACK swapper 0 [208] 27475.438706: skb:kfree_skb: ... location=tcp_validate_incoming+0x4f0 reason: TCP_RFC7323_PAWS_ACK swapper 0 [208] 27475.438908: skb:kfree_skb: ... location=tcp_validate_incoming+0x4f0 reason: TCP_RFC7323_PAWS_ACK swapper 0 [148] 27475.439010: skb:kfree_skb: ... location=tcp_validate_incoming+0x4f0 reason: TCP_RFC7323_PAWS_ACK swapper 0 [148] 27475.439214: skb:kfree_skb: ... location=tcp_validate_incoming+0x4f0 reason: TCP_RFC7323_PAWS_ACK swapper 0 [208] 27475.439286: skb:kfree_skb: ... location=tcp_validate_incoming+0x4f0 reason: TCP_RFC7323_PAWS_ACK ... Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Neal Cardwell <ncardwell@google.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com> Reviewed-by: Jason Xing <kerneljasonxing@gmail.com> Link: https://patch.msgid.link/20250113135558.3180360-3-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent ea98b61 commit 124c4c3

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

include/net/dropreason-core.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
FN(TCP_OVERWINDOW) \
3737
FN(TCP_OFOMERGE) \
3838
FN(TCP_RFC7323_PAWS) \
39+
FN(TCP_RFC7323_PAWS_ACK) \
3940
FN(TCP_OLD_SEQUENCE) \
4041
FN(TCP_INVALID_SEQUENCE) \
4142
FN(TCP_INVALID_ACK_SEQUENCE) \
@@ -259,6 +260,10 @@ enum skb_drop_reason {
259260
* LINUX_MIB_PAWSESTABREJECTED, LINUX_MIB_PAWSACTIVEREJECTED
260261
*/
261262
SKB_DROP_REASON_TCP_RFC7323_PAWS,
263+
/**
264+
* @SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK: PAWS check, old ACK packet.
265+
*/
266+
SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK,
262267
/** @SKB_DROP_REASON_TCP_OLD_SEQUENCE: Old SEQ field (duplicate packet) */
263268
SKB_DROP_REASON_TCP_OLD_SEQUENCE,
264269
/** @SKB_DROP_REASON_TCP_INVALID_SEQUENCE: Not acceptable SEQ field */

net/ipv4/tcp_input.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4465,7 +4465,9 @@ static enum skb_drop_reason tcp_disordered_ack_check(const struct sock *sk,
44654465

44664466
/* 2. Is its sequence not the expected one ? */
44674467
if (seq != tp->rcv_nxt)
4468-
return reason;
4468+
return before(seq, tp->rcv_nxt) ?
4469+
SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK :
4470+
reason;
44694471

44704472
/* 3. Is this not a duplicate ACK ? */
44714473
if (ack != tp->snd_una)
@@ -5967,6 +5969,12 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb,
59675969
if (unlikely(th->syn))
59685970
goto syn_challenge;
59695971

5972+
/* Old ACK are common, do not change PAWSESTABREJECTED
5973+
* and do not send a dupack.
5974+
*/
5975+
if (reason == SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK)
5976+
goto discard;
5977+
59705978
NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED);
59715979
if (!tcp_oow_rate_limited(sock_net(sk), skb,
59725980
LINUX_MIB_TCPACKSKIPPEDPAWS,

0 commit comments

Comments
 (0)