Skip to contentSkip to conversation

tcp: add a new PAWS_ACK drop reason

PATCH Superseded Eric Dumazet 4 participants 13 messages Jan 10, 2025 – Jan 13, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover tcp: add a new PAWS_ACK drop reason

Current TCP_RFC7323_PAWS drop reason is too generic and can cause confusion.

One common source for these drops are ACK packets coming too late.

A prior packet with payload already changed tp->rcv_nxt.

Add TCP_RFC7323_PAWS_ACK new drop reason, and do not generate a DUPACK for such old ACK.

Eric Dumazet (2):
tcp: add drop_reason support to tcp_disordered_ack()
tcp: add TCP_RFC7323_PAWS_ACK drop reason

 include/net/dropreason-core.h |  5 +++
 net/ipv4/tcp_input.c          | 85 +++++++++++++++++++++--------------
 2 files changed, 56 insertions(+), 34 deletions(-)
Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog
#1 lore raw

PATCH 1/2 tcp: add drop_reason support to tcp_disordered_ack()

Following patch is adding a new drop_reason to tcp_validate_incoming().

Change tcp_disordered_ack() to not return a boolean anymore, but a drop reason.

Change its name to tcp_disordered_ack_check()

Refactor tcp_validate_incoming() to ease the code review of the following patch, and reduce indentation level.

This patch is a refactor, with no functional change.

---
 net/ipv4/tcp_input.c | 79 ++++++++++++++++++++++++--------------------
 1 file changed, 44 insertions(+), 35 deletions(-)
net/ipv4/tcp_input.c +44 -35
index 4811727b8a02258ec6fa1fd129beecf7cbb0f90e..24966dd3e49f698e110f8601e098b65afdf0718a 100644
@@ -4450,34 +4450,38 @@ static u32 tcp_tsval_replay(const struct sock *sk)
 	return inet_csk(sk)->icsk_rto * 1200 / HZ;
 }
 
-static int tcp_disordered_ack(const struct sock *sk, const struct sk_buff *skb)
+static enum skb_drop_reason tcp_disordered_ack_check(const struct sock *sk,
+						     const struct sk_buff *skb)
 {
 	const struct tcp_sock *tp = tcp_sk(sk);
 	const struct tcphdr *th = tcp_hdr(skb);
-	u32 seq = TCP_SKB_CB(skb)->seq;
+	SKB_DR_INIT(reason, TCP_RFC7323_PAWS);
 	u32 ack = TCP_SKB_CB(skb)->ack_seq;
+	u32 seq = TCP_SKB_CB(skb)->seq;
 
-	return	/* 1. Pure ACK with correct sequence number. */
-		(th->ack && seq == TCP_SKB_CB(skb)->end_seq && seq == tp->rcv_nxt) &&
+	/* 1. Is this not a pure ACK ? */
+	if (!th->ack || seq != TCP_SKB_CB(skb)->end_seq)
+		return reason;
 
-		/* 2. ... and duplicate ACK. */
-		ack == tp->snd_una &&
+	/* 2. Is its sequence not the expected one ? */
+	if (seq != tp->rcv_nxt)
+		return reason;
 
-		/* 3. ... and does not update window. */
-		!tcp_may_update_window(tp, ack, seq, ntohs(th->window) << tp->rx_opt.snd_wscale) &&
+	/* 3. Is this not a duplicate ACK ? */
+	if (ack != tp->snd_una)
+		return reason;
 
-		/* 4. ... and sits in replay window. */
-		(s32)(tp->rx_opt.ts_recent - tp->rx_opt.rcv_tsval) <=
-		tcp_tsval_replay(sk);
-}
+	/* 4. Is this updating the window ? */
+	if (tcp_may_update_window(tp, ack, seq, ntohs(th->window) <<
+						tp->rx_opt.snd_wscale))
+		return reason;
 
-static inline bool tcp_paws_discard(const struct sock *sk,
-				   const struct sk_buff *skb)
-{
-	const struct tcp_sock *tp = tcp_sk(sk);
+	/* 5. Is this not in the replay window ? */
+	if ((s32)(tp->rx_opt.ts_recent - tp->rx_opt.rcv_tsval) >
+	    tcp_tsval_replay(sk))
+		return reason;
 
-	return !tcp_paws_check(&tp->rx_opt, TCP_PAWS_WINDOW) &&
-	       !tcp_disordered_ack(sk, skb);
+	return 0;
 }
 
 /* Check segment sequence number for validity.
@@ -5949,23 +5953,28 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb,
 	SKB_DR(reason);
 
 	/* RFC1323: H1. Apply PAWS check first. */
-	if (tcp_fast_parse_options(sock_net(sk), skb, th, tp) &&
-	    tp->rx_opt.saw_tstamp &&
-	    tcp_paws_discard(sk, skb)) {
-		if (!th->rst) {
-			if (unlikely(th->syn))
-				goto syn_challenge;
-			NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED);
-			if (!tcp_oow_rate_limited(sock_net(sk), skb,
-						  LINUX_MIB_TCPACKSKIPPEDPAWS,
-						  &tp->last_oow_ack_time))
-				tcp_send_dupack(sk, skb);
-			SKB_DR_SET(reason, TCP_RFC7323_PAWS);
-			goto discard;
-		}
-		/* Reset is accepted even if it did not pass PAWS. */
-	}
-
+	if (!tcp_fast_parse_options(sock_net(sk), skb, th, tp) ||
+	    !tp->rx_opt.saw_tstamp ||
+	    tcp_paws_check(&tp->rx_opt, TCP_PAWS_WINDOW))
+		goto step1;
+
+	reason = tcp_disordered_ack_check(sk, skb);
+	if (!reason)
+		goto step1;
+	/* Reset is accepted even if it did not pass PAWS. */
+	if (th->rst)
+		goto step1;
+	if (unlikely(th->syn))
+		goto syn_challenge;
+
+	NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED);
+	if (!tcp_oow_rate_limited(sock_net(sk), skb,
+				  LINUX_MIB_TCPACKSKIPPEDPAWS,
+				  &tp->last_oow_ack_time))
+		tcp_send_dupack(sk, skb);
+	goto discard;
+
+step1:
 	/* Step 1: check sequence number */
 	reason = tcp_sequence(tp, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq);
 	if (reason) {
Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog
#5 lore raw

PATCH 2/2 tcp: add TCP_RFC7323_PAWS_ACK drop reason

In reply to Eric Dumazet

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 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

...

---
 include/net/dropreason-core.h |  5 +++++
 net/ipv4/tcp_input.c          | 10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
include/net/dropreason-core.h +5 -0
index 3a6602f379783078388eaaad3a9237b11baad534..28555109f9bdf883af2567f74dea86a327beba26 100644
@@ -36,6 +36,7 @@
 	FN(TCP_OVERWINDOW)		\
 	FN(TCP_OFOMERGE)		\
 	FN(TCP_RFC7323_PAWS)		\
+	FN(TCP_RFC7323_PAWS_ACK)	\
 	FN(TCP_OLD_SEQUENCE)		\
 	FN(TCP_INVALID_SEQUENCE)	\
 	FN(TCP_INVALID_ACK_SEQUENCE)	\
@@ -259,6 +260,10 @@ enum skb_drop_reason {
 	 * LINUX_MIB_PAWSESTABREJECTED, LINUX_MIB_PAWSACTIVEREJECTED
 	 */
 	SKB_DROP_REASON_TCP_RFC7323_PAWS,
+	/**
+	 * @SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK: PAWS check, old ACK packet.
+	 */
+	SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK,
 	/** @SKB_DROP_REASON_TCP_OLD_SEQUENCE: Old SEQ field (duplicate packet) */
 	SKB_DROP_REASON_TCP_OLD_SEQUENCE,
 	/** @SKB_DROP_REASON_TCP_INVALID_SEQUENCE: Not acceptable SEQ field */
net/ipv4/tcp_input.c +9 -1
index 24966dd3e49f698e110f8601e098b65afdf0718a..dc0e88bcc5352dafee38143076f9e4feebdf8be3 100644
@@ -4465,7 +4465,9 @@ static enum skb_drop_reason tcp_disordered_ack_check(const struct sock *sk,
 
 	/* 2. Is its sequence not the expected one ? */
 	if (seq != tp->rcv_nxt)
-		return reason;
+		return before(seq, tp->rcv_nxt) ?
+			SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK :
+			reason;
 
 	/* 3. Is this not a duplicate ACK ? */
 	if (ack != tp->snd_una)
@@ -5967,6 +5969,12 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb,
 	if (unlikely(th->syn))
 		goto syn_challenge;
 
+	/* Old ACK are common, do not change PAWSESTABREJECTED
+	 * and do not send a dupack.
+	 */
+	if (reason == SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK)
+		goto discard;
+
 	NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED);
 	if (!tcp_oow_rate_limited(sock_net(sk), skb,
 				  LINUX_MIB_TCPACKSKIPPEDPAWS,
Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog
maintainer Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH net-next 1/2] tcp: add drop_reason support to tcp_disordered_ack()

In reply to Eric Dumazet
Quoted 12 lines · Eric Dumazet

Following patch is adding a new drop_reason to tcp_validate_incoming().

Change tcp_disordered_ack() to not return a boolean anymore, but a drop reason.

Change its name to tcp_disordered_ack_check()

Refactor tcp_validate_incoming() to ease the code review of the following patch, and reduce indentation level.

Quoted 7 lines

This patch is a refactor, with no functional change.

---
 net/ipv4/tcp_input.c | 79 ++++++++++++++++++++++++--------------------
 1 file changed, 44 insertions(+), 35 deletions(-)

Looks great to me. Thanks, Eric!

neal

maintainer Reviewed-by on v1 2/2
#6 lore raw

Re: [PATCH net-next 2/2] tcp: add TCP_RFC7323_PAWS_ACK drop reason

In reply to Eric Dumazet
Quoted 37 lines · Eric Dumazet

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 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
Quoted 7 lines

...

---
 include/net/dropreason-core.h |  5 +++++
 net/ipv4/tcp_input.c          | 10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

Looks great to me. Thanks, Eric!

neal

Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH net-next 1/2] tcp: add drop_reason support to tcp_disordered_ack()

In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>
Date: Fri, 10 Jan 2025 14:33:14 +0000

Quoted 7 lines

Following patch is adding a new drop_reason to tcp_validate_incoming().

Change tcp_disordered_ack() to not return a boolean anymore, but a drop reason.

Change its name to tcp_disordered_ack_check()

Quoted 7 lines

Refactor tcp_validate_incoming() to ease the code review of the following patch, and reduce indentation level.

This patch is a refactor, with no functional change.

Reviewed-by on v1 2/2
#7 lore raw

Re: [PATCH net-next 2/2] tcp: add TCP_RFC7323_PAWS_ACK drop reason

In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>
Date: Fri, 10 Jan 2025 14:33:15 +0000

Quoted 36 lines

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 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
Quoted 3 lines

...

Reviewed-by on v1 1/2
#4 lore raw

Re: [PATCH net-next 1/2] tcp: add drop_reason support to tcp_disordered_ack()

In reply to Eric Dumazet
Quoted 8 lines · Eric Dumazet

Following patch is adding a new drop_reason to tcp_validate_incoming().

Change tcp_disordered_ack() to not return a boolean anymore, but a drop reason.

Change its name to tcp_disordered_ack_check()

Quoted 7 lines

Refactor tcp_validate_incoming() to ease the code review of the following patch, and reduce indentation level.

This patch is a refactor, with no functional change.

#8 lore raw

Re: [PATCH net-next 2/2] tcp: add TCP_RFC7323_PAWS_ACK drop reason

In reply to Eric Dumazet

Hello Eric,

Quoted 21 lines · Eric Dumazet

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 P2 currently increments LINUX_MIB_PAWSESTABREJECTED (TcpExtPAWSEstab) and use TCP_RFC7323_PAWS drop reason.
It might also send a DUPACK if not rate limited.

Quoted 5 lines

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,

I'm afraid that not all the hosts enable the XPS feature. In this way, this patch will lead the hosts that don't enable XPS not sending DUPACK any more if OOO happens.

So I wonder if it would affect those non XPS cases?

Thanks,
Jason

Quoted 74 lines

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

...

---
 include/net/dropreason-core.h |  5 +++++
 net/ipv4/tcp_input.c          | 10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
include/net/dropreason-core.h +5 -0
index 3a6602f379783078388eaaad3a9237b11baad534..28555109f9bdf883af2567f74dea86a327beba26 100644
@@ -36,6 +36,7 @@
        FN(TCP_OVERWINDOW)              \
        FN(TCP_OFOMERGE)                \
        FN(TCP_RFC7323_PAWS)            \
+       FN(TCP_RFC7323_PAWS_ACK)        \
        FN(TCP_OLD_SEQUENCE)            \
        FN(TCP_INVALID_SEQUENCE)        \
        FN(TCP_INVALID_ACK_SEQUENCE)    \
@@ -259,6 +260,10 @@ enum skb_drop_reason {
         * LINUX_MIB_PAWSESTABREJECTED, LINUX_MIB_PAWSACTIVEREJECTED
         */
        SKB_DROP_REASON_TCP_RFC7323_PAWS,
+       /**
+        * @SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK: PAWS check, old ACK packet.
+        */
+       SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK,
        /** @SKB_DROP_REASON_TCP_OLD_SEQUENCE: Old SEQ field (duplicate packet) */
        SKB_DROP_REASON_TCP_OLD_SEQUENCE,
        /** @SKB_DROP_REASON_TCP_INVALID_SEQUENCE: Not acceptable SEQ field */
net/ipv4/tcp_input.c +9 -2
index 24966dd3e49f698e110f8601e098b65afdf0718a..dc0e88bcc5352dafee38143076f9e4feebdf8be3 100644
@@ -4465,7 +4465,9 @@ static enum skb_drop_reason tcp_disordered_ack_check(const struct sock *sk,
 
        /* 2. Is its sequence not the expected one ? */
        if (seq != tp->rcv_nxt)
-               return reason;
+               return before(seq, tp->rcv_nxt) ?
+                       SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK :
+                       reason;
 
        /* 3. Is this not a duplicate ACK ? */
        if (ack != tp->snd_una)
@@ -5967,6 +5969,12 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb,
        if (unlikely(th->syn))
                goto syn_challenge;
 
+       /* Old ACK are common, do not change PAWSESTABREJECTED
+        * and do not send a dupack.
+        */
+       if (reason == SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK)
+               goto discard;
+
        NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED);
        if (!tcp_oow_rate_limited(sock_net(sk), skb,
                                  LINUX_MIB_TCPACKSKIPPEDPAWS,
--

2.47.1.613.gc27f4b7a9f-goog

#9 lore raw

Re: [PATCH net-next 2/2] tcp: add TCP_RFC7323_PAWS_ACK drop reason

Quoted 28 lines · Jason Xing

Hello Eric,

Quoted 24 lines · Eric Dumazet

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 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.

Quoted 8 lines
Quoted 2 lines

For old ACKS like these, we no longer increment LINUX_MIB_PAWSESTABREJECTED and no longer sends a DUPACK,

I'm afraid that not all the hosts enable the XPS feature. In this way, this patch will lead the hosts that don't enable XPS not sending DUPACK any more if OOO happens.

So I wonder if it would affect those non XPS cases?

Everything is fine. The non XPS cases will be handled perfectly well.

For the record, all TCP packetdrill tests we currently have are passing.

Feel free to cook a packetdrill test to show exactly the issue you are thinking of,
chances are very high you won't find a concerning problem.

#10 lore raw

Re: [PATCH net-next 2/2] tcp: add TCP_RFC7323_PAWS_ACK drop reason

Quoted 18 lines · Eric Dumazet
Quoted 16 lines · Jason Xing

Hello Eric,

Quoted 12 lines · Eric Dumazet

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).

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

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 P2 currently increments

Maybe P1? If the receiver processes the P2 packet (as you said, with payload) earlier than P1 (pure ack) and it really returns with a drop reason, I think it should hit #1 case instead of #2 case.

IIUC, the receiver processes the P1 and finds that P1.seq < rcv.nxt because P2 already updates rcv.nxt earlier.

Quoted 16 lines
Quoted 7 lines
Quoted 7 lines

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.

Quoted 8 lines
Quoted 2 lines

For old ACKS like these, we no longer increment LINUX_MIB_PAWSESTABREJECTED and no longer sends a DUPACK,

I'm afraid that not all the hosts enable the XPS feature. In this way, this patch will lead the hosts that don't enable XPS not sending DUPACK any more if OOO happens.

So I wonder if it would affect those non XPS cases?

Quoted 7 lines

Everything is fine. The non XPS cases will be handled perfectly well.

For the record, all TCP packetdrill tests we currently have are passing.

Feel free to cook a packetdrill test to show exactly the issue you are thinking of,
chances are very high you won't find a concerning problem.

Thanks for your reply. I don't think it's a concerning issue either even if it happens. Admittedly, OOO pure ack happens really rarely from my experience.

Thanks,
Jason

#11 lore raw

Re: [PATCH net-next 2/2] tcp: add TCP_RFC7323_PAWS_ACK drop reason

Quoted 24 lines · Jason Xing
Quoted 22 lines · Eric Dumazet
Quoted 20 lines · Jason Xing

Hello Eric,

Quoted 16 lines · Eric Dumazet

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.

Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

A linux receiver when processing P2 currently increments

Maybe P1? If the receiver processes the P2 packet (as you said, with payload) earlier than P1 (pure ack) and it really returns with a drop reason, I think it should hit #1 case instead of #2 case.

Sure, this is a typo of course.

Quoted 23 lines

IIUC, the receiver processes the P1 and finds that P1.seq < rcv.nxt because P2 already updates rcv.nxt earlier.

Quoted 20 lines
Quoted 7 lines
Quoted 7 lines

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.

Quoted 8 lines
Quoted 2 lines

For old ACKS like these, we no longer increment LINUX_MIB_PAWSESTABREJECTED and no longer sends a DUPACK,

I'm afraid that not all the hosts enable the XPS feature. In this way, this patch will lead the hosts that don't enable XPS not sending DUPACK any more if OOO happens.

So I wonder if it would affect those non XPS cases?

Everything is fine. The non XPS cases will be handled perfectly well.

For the record, all TCP packetdrill tests we currently have are passing.

Quoted 7 lines
Quoted 3 lines

Feel free to cook a packetdrill test to show exactly the issue you are thinking of,
chances are very high you won't find a concerning problem.

Thanks for your reply. I don't think it's a concerning issue either even if it happens. Admittedly, OOO pure ack happens really rarely from my experience.

Good then :)

#12 lore raw
In reply to Eric Dumazet
Quoted 6 lines · Eric Dumazet

Current TCP_RFC7323_PAWS drop reason is too generic and can cause confusion.

One common source for these drops are ACK packets coming too late.

Quoted 9 lines

A prior packet with payload already changed tp->rcv_nxt.

Add TCP_RFC7323_PAWS_ACK new drop reason, and do not generate a DUPACK for such old ACK.

Eric Dumazet (2):
tcp: add drop_reason support to tcp_disordered_ack()
tcp: add TCP_RFC7323_PAWS_ACK drop reason

I am sending a V2 :
- Adding one SNMP counter (Neal Cardwell suggestion)
- Fix one typo in changelog