diff mbox series

[net-next,v6,07/11] tcp: add more specific possible drop reasons in tcp_rcv_synsent_state_process()

Message ID 20240219032838.91723-8-kerneljasonxing@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series introduce drop reasons for tcp receive path | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next, async
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 943 this patch: 943
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 958 this patch: 958
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 960 this patch: 960
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest pending net-next-2024-02-19--09-00 (tests: 391)

Commit Message

Jason Xing Feb. 19, 2024, 3:28 a.m. UTC
From: Jason Xing <kernelxing@tencent.com>

This patch does two things:
1) add two more new reasons
2) only change the return value(1) to various drop reason values
for the future use

For now, we still cannot trace those two reasons. We'll implement the full
function in the subsequent patch in this serie.

Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
 net/ipv4/tcp_input.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Kuniyuki Iwashima Feb. 19, 2024, 4:54 a.m. UTC | #1
From: Jason Xing <kerneljasonxing@gmail.com>
Date: Mon, 19 Feb 2024 11:28:34 +0800
> From: Jason Xing <kernelxing@tencent.com>
> 
> This patch does two things:
> 1) add two more new reasons

description was not updated since this patch was split.


> 2) only change the return value(1) to various drop reason values
> for the future use
> 
> For now, we still cannot trace those two reasons. We'll implement the full
> function in the subsequent patch in this serie.
> 
> Signed-off-by: Jason Xing <kernelxing@tencent.com>
Jason Xing Feb. 19, 2024, 5:07 a.m. UTC | #2
On Mon, Feb 19, 2024 at 12:55 PM Kuniyuki Iwashima <kuniyu@amazon.com> wrote:
>
> From: Jason Xing <kerneljasonxing@gmail.com>
> Date: Mon, 19 Feb 2024 11:28:34 +0800
> > From: Jason Xing <kernelxing@tencent.com>
> >
> > This patch does two things:
> > 1) add two more new reasons
>
> description was not updated since this patch was split.

I checked that since v3 patchset the current patch has not changed.
The description from my perspective is right because it truly adds two
reasons in tcp_rcv_synsent_state_process().

The first series in v4:
For "patch v4 [1/5]" - "patch v4 [5/5]", they correspond to "patch v6
[1/11]" - "patch v6 [5/11]".

The other series in v4:
For "patch v4 [1/6]" - "patch v4 [6/6]", they correspond to "patch v6
[6/11]" - "patch v6 [11/11]".

>
>
> > 2) only change the return value(1) to various drop reason values
> > for the future use
> >
> > For now, we still cannot trace those two reasons. We'll implement the full
> > function in the subsequent patch in this serie.
> >
> > Signed-off-by: Jason Xing <kernelxing@tencent.com>
diff mbox series

Patch

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 74c03f0a6c0c..83308cca1610 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -6361,6 +6361,7 @@  static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
 				inet_csk_reset_xmit_timer(sk,
 						ICSK_TIME_RETRANS,
 						TCP_TIMEOUT_MIN, TCP_RTO_MAX);
+			SKB_DR_SET(reason, TCP_INVALID_ACK_SEQUENCE);
 			goto reset_and_undo;
 		}
 
@@ -6369,6 +6370,7 @@  static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
 			     tcp_time_stamp_ts(tp))) {
 			NET_INC_STATS(sock_net(sk),
 					LINUX_MIB_PAWSACTIVEREJECTED);
+			SKB_DR_SET(reason, TCP_RFC7323_PAWS);
 			goto reset_and_undo;
 		}
 
@@ -6572,7 +6574,8 @@  static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
 reset_and_undo:
 	tcp_clear_options(&tp->rx_opt);
 	tp->rx_opt.mss_clamp = saved_clamp;
-	return 1;
+	/* we can reuse/return @reason to its caller to handle the exception */
+	return reason;
 }
 
 static void tcp_rcv_synrecv_state_fastopen(struct sock *sk)