linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: menglong8.dong@gmail.com
To: kuba@kernel.org
Cc: davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	dsahern@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Menglong Dong <imagedong@tencent.com>
Subject: [PATCH net-next 1/3] net: tcp: add sysctl for controling tcp window shrink
Date: Wed, 17 May 2023 20:41:59 +0800	[thread overview]
Message-ID: <20230517124201.441634-2-imagedong@tencent.com> (raw)
In-Reply-To: <20230517124201.441634-1-imagedong@tencent.com>

From: Menglong Dong <imagedong@tencent.com>

Introduce the sysctl 'tcp_wnd_shrink', which will be used in the
following patches.

Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
 include/net/tcp.h          | 1 +
 net/ipv4/sysctl_net_ipv4.c | 9 +++++++++
 net/ipv4/tcp.c             | 3 +++
 3 files changed, 13 insertions(+)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index a0a91a988272..a6cf6d823e34 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -247,6 +247,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
 /* sysctl variables for tcp */
 extern int sysctl_tcp_max_orphans;
 extern long sysctl_tcp_mem[3];
+extern int sysctl_tcp_wnd_shrink;
 
 #define TCP_RACK_LOSS_DETECTION  0x1 /* Use RACK to detect losses */
 #define TCP_RACK_STATIC_REO_WND  0x2 /* Use static RACK reo wnd */
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 0d0cc4ef2b85..fd6cb5a5c2b9 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -577,6 +577,15 @@ static struct ctl_table ipv4_table[] = {
 		.extra1		= &sysctl_fib_sync_mem_min,
 		.extra2		= &sysctl_fib_sync_mem_max,
 	},
+	{
+		.procname       = "tcp_wnd_shrink",
+		.data           = &sysctl_tcp_wnd_shrink,
+		.maxlen         = sizeof(int),
+		.mode           = 0644,
+		.proc_handler   = proc_dointvec_minmax,
+		.extra1         = SYSCTL_ZERO,
+		.extra2         = SYSCTL_ONE
+	},
 	{ }
 };
 
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index fd68d49490f2..db0483b2159f 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -297,6 +297,9 @@ EXPORT_SYMBOL(tcp_memory_allocated);
 DEFINE_PER_CPU(int, tcp_memory_per_cpu_fw_alloc);
 EXPORT_PER_CPU_SYMBOL_GPL(tcp_memory_per_cpu_fw_alloc);
 
+int sysctl_tcp_wnd_shrink __read_mostly;
+EXPORT_SYMBOL(sysctl_tcp_wnd_shrink);
+
 #if IS_ENABLED(CONFIG_SMC)
 DEFINE_STATIC_KEY_FALSE(tcp_have_smc);
 EXPORT_SYMBOL(tcp_have_smc);
-- 
2.40.1


  reply	other threads:[~2023-05-17 12:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 12:41 [PATCH net-next 0/3] net: tcp: add support of window shrink menglong8.dong
2023-05-17 12:41 ` menglong8.dong [this message]
2023-05-17 12:42 ` [PATCH net-next 2/3] net: tcp: send zero-window when no memory menglong8.dong
2023-05-17 14:44   ` Eric Dumazet
2023-05-18  2:14     ` Menglong Dong
2023-05-18 14:25     ` Menglong Dong
2023-05-17 12:42 ` [PATCH net-next 3/3] net: tcp: handle window shrink properly menglong8.dong
2023-05-17 14:47   ` Eric Dumazet
2023-05-18  2:34     ` Menglong Dong
2023-05-18 13:40       ` Neal Cardwell
2023-05-18 14:11         ` Menglong Dong
2023-05-18 16:03           ` Neal Cardwell
2023-05-20  9:07             ` Menglong Dong
2023-05-20 14:28               ` Neal Cardwell
2023-05-22  2:55                 ` Menglong Dong
2023-05-22 15:04                   ` Neal Cardwell
2023-05-23  8:59                     ` Menglong Dong
2023-05-23 13:27                       ` Neal Cardwell
2023-05-24 12:16                         ` Menglong Dong
2023-05-24 14:49                           ` Neal Cardwell
2023-05-23 10:26                     ` Eric Dumazet
2023-05-17 16:55   ` kernel test robot

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=20230517124201.441634-2-imagedong@tencent.com \
    --to=menglong8.dong@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=imagedong@tencent.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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).