[PATCH mptcp-next 1/3] mptcp: rename add_addr_timeout to add_addr_timeout_max

Geliang Tang posted 3 patches 1 month, 2 weeks ago
There is a newer version of this series
[PATCH mptcp-next 1/3] mptcp: rename add_addr_timeout to add_addr_timeout_max
Posted by Geliang Tang 1 month, 2 weeks ago
From: Geliang Tang <tanggeliang@kylinos.cn>

This renames the MPTCP sysctl variable to better reflect its purpose as
the maximum ADD_ADDR retransmission timeout.

The patch includes updates to:
 - Documentation/networking/mptcp-sysctl.rst
 - net/mptcp/ctrl.c
 - net/mptcp/pm.c
 - net/mptcp/protocol.h

All references to the old variable name have been updated to use the new
naming convention.

The functionality remains unchanged.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 Documentation/networking/mptcp-sysctl.rst |  6 +++---
 net/mptcp/ctrl.c                          | 12 ++++++------
 net/mptcp/pm.c                            |  6 +++---
 net/mptcp/protocol.h                      |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/Documentation/networking/mptcp-sysctl.rst b/Documentation/networking/mptcp-sysctl.rst
index 5bfab01eff5a..1af35757a235 100644
--- a/Documentation/networking/mptcp-sysctl.rst
+++ b/Documentation/networking/mptcp-sysctl.rst
@@ -7,9 +7,9 @@ MPTCP Sysfs variables
 /proc/sys/net/mptcp/* Variables
 ===============================
 
-add_addr_timeout - INTEGER (seconds)
-	Set the timeout after which an ADD_ADDR control message will be
-	resent to an MPTCP peer that has not acknowledged a previous
+add_addr_timeout_max - INTEGER (seconds)
+	Set the maximum value of timeout after which an ADD_ADDR control message
+	will be resent to an MPTCP peer that has not acknowledged a previous
 	ADD_ADDR message.
 
 	The default value matches TCP_RTO_MAX. This is a per-namespace
diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c
index fed40dae5583..9a408e96c07f 100644
--- a/net/mptcp/ctrl.c
+++ b/net/mptcp/ctrl.c
@@ -27,7 +27,7 @@ struct mptcp_pernet {
 	struct ctl_table_header *ctl_table_hdr;
 #endif
 
-	unsigned int add_addr_timeout;
+	unsigned int add_addr_timeout_max;
 	unsigned int blackhole_timeout;
 	unsigned int close_timeout;
 	unsigned int stale_loss_cnt;
@@ -52,9 +52,9 @@ int mptcp_is_enabled(const struct net *net)
 	return mptcp_get_pernet(net)->mptcp_enabled;
 }
 
-unsigned int mptcp_get_add_addr_timeout(const struct net *net)
+unsigned int mptcp_get_add_addr_timeout_max(const struct net *net)
 {
-	return mptcp_get_pernet(net)->add_addr_timeout;
+	return mptcp_get_pernet(net)->add_addr_timeout_max;
 }
 
 int mptcp_is_checksum_enabled(const struct net *net)
@@ -97,7 +97,7 @@ const char *mptcp_get_scheduler(const struct net *net)
 static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet)
 {
 	pernet->mptcp_enabled = 1;
-	pernet->add_addr_timeout = TCP_RTO_MAX;
+	pernet->add_addr_timeout_max = TCP_RTO_MAX;
 	pernet->blackhole_timeout = 3600;
 	pernet->syn_retrans_before_tcp_fallback = 2;
 	atomic_set(&pernet->active_disable_times, 0);
@@ -284,7 +284,7 @@ static struct ctl_table mptcp_sysctl_table[] = {
 		.extra2       = SYSCTL_ONE
 	},
 	{
-		.procname = "add_addr_timeout",
+		.procname = "add_addr_timeout_max",
 		.maxlen = sizeof(unsigned int),
 		.mode = 0644,
 		.proc_handler = proc_dointvec_jiffies,
@@ -377,7 +377,7 @@ static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet)
 	}
 
 	table[0].data = &pernet->mptcp_enabled;
-	table[1].data = &pernet->add_addr_timeout;
+	table[1].data = &pernet->add_addr_timeout_max;
 	table[2].data = &pernet->checksum_enabled;
 	table[3].data = &pernet->allow_join_initial_addr_port;
 	table[4].data = &pernet->stale_loss_cnt;
diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
index 687dbb59d084..40e8ebe566e5 100644
--- a/net/mptcp/pm.c
+++ b/net/mptcp/pm.c
@@ -302,7 +302,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
 
 	if (entry->retrans_times < ADD_ADDR_RETRANS_MAX)
 		sk_reset_timer(sk, timer,
-			       jiffies + mptcp_get_add_addr_timeout(sock_net(sk)));
+			       jiffies + mptcp_get_add_addr_timeout_max(sock_net(sk)));
 
 	spin_unlock_bh(&msk->pm.lock);
 
@@ -354,7 +354,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
 			return false;
 
 		sk_reset_timer(sk, &add_entry->add_timer,
-			       jiffies + mptcp_get_add_addr_timeout(net));
+			       jiffies + mptcp_get_add_addr_timeout_max(net));
 		return true;
 	}
 
@@ -370,7 +370,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
 
 	timer_setup(&add_entry->add_timer, mptcp_pm_add_timer, 0);
 	sk_reset_timer(sk, &add_entry->add_timer,
-		       jiffies + mptcp_get_add_addr_timeout(net));
+		       jiffies + mptcp_get_add_addr_timeout_max(net));
 
 	return true;
 }
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index db50b216143a..f2dd45148e63 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -708,7 +708,7 @@ mptcp_subflow_delegated_next(struct mptcp_delegated_action *delegated)
 }
 
 int mptcp_is_enabled(const struct net *net);
-unsigned int mptcp_get_add_addr_timeout(const struct net *net);
+unsigned int mptcp_get_add_addr_timeout_max(const struct net *net);
 int mptcp_is_checksum_enabled(const struct net *net);
 int mptcp_allow_join_id0(const struct net *net);
 unsigned int mptcp_stale_loss_cnt(const struct net *net);
-- 
2.48.1
Re: [PATCH mptcp-next 1/3] mptcp: rename add_addr_timeout to add_addr_timeout_max
Posted by Matthieu Baerts 1 month, 2 weeks ago
Hi Geliang,

On 29/07/2025 10:22, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> This renames the MPTCP sysctl variable to better reflect its purpose as
> the maximum ADD_ADDR retransmission timeout.

I don't think we can rename a sysctl knob: it is sort of part of the API
as it is exposed. Either we deprecate it with a warning in the doc +
pr_warn() somewhere, or use it as a max value without renaming it (at
least not renaming the exposed variable: .procname).

I think it should be fine to use it as a max value because it was set to
TCP_RTO_MAX by default, and this timeout is in second. If you do that,
you can probably squash patch 1 and 2.

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.