* [PATCH net-next v4 0/2] support TCP_RTO_MIN_US and TCP_DELACK_MAX_US for set/getsockopt
@ 2025-03-17 12:03 Jason Xing
2025-03-17 12:03 ` [PATCH net-next v4 1/2] tcp: support TCP_RTO_MIN_US for set/getsockopt use Jason Xing
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Jason Xing @ 2025-03-17 12:03 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, horms, ncardwell, kuniyu, dsahern
Cc: netdev, Jason Xing
Add set/getsockopt supports for TCP_RTO_MIN_US and TCP_DELACK_MAX_US.
v4
1. add more detailed information into commit log (Eric)
2. use val directly in do_tcp_getsockopt (Eric)
Jason Xing (2):
tcp: support TCP_RTO_MIN_US for set/getsockopt use
tcp: support TCP_DELACK_MAX_US for set/getsockopt use
Documentation/networking/ip-sysctl.rst | 4 ++--
include/net/tcp.h | 2 +-
include/uapi/linux/tcp.h | 2 ++
net/ipv4/tcp.c | 26 ++++++++++++++++++++++++--
net/ipv4/tcp_output.c | 2 +-
5 files changed, 30 insertions(+), 6 deletions(-)
--
2.43.5
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net-next v4 1/2] tcp: support TCP_RTO_MIN_US for set/getsockopt use
2025-03-17 12:03 [PATCH net-next v4 0/2] support TCP_RTO_MIN_US and TCP_DELACK_MAX_US for set/getsockopt Jason Xing
@ 2025-03-17 12:03 ` Jason Xing
2025-03-25 11:09 ` Eric Dumazet
2025-03-17 12:03 ` [PATCH net-next v4 2/2] tcp: support TCP_DELACK_MAX_US " Jason Xing
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Jason Xing @ 2025-03-17 12:03 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, horms, ncardwell, kuniyu, dsahern
Cc: netdev, Jason Xing
Support adjusting/reading RTO MIN for socket level by using set/getsockopt().
This new option has the same effect as TCP_BPF_RTO_MIN, which means it
doesn't affect RTAX_RTO_MIN usage (by using ip route...). Considering that
bpf option was implemented before this patch, so we need to use a standalone
new option for pure tcp set/getsockopt() use.
When the socket is created, its icsk_rto_min is set to the default
value that is controlled by sysctl_tcp_rto_min_us. Then if application
calls setsockopt() with TCP_RTO_MIN_US flag to pass a valid value, then
icsk_rto_min will be overridden in jiffies unit.
This patch adds WRITE_ONCE/READ_ONCE to avoid data-race around
icsk_rto_min.
Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
---
Documentation/networking/ip-sysctl.rst | 4 ++--
include/net/tcp.h | 2 +-
include/uapi/linux/tcp.h | 1 +
net/ipv4/tcp.c | 13 ++++++++++++-
4 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/networking/ip-sysctl.rst
index 054561f8dcae..5c63ab928b97 100644
--- a/Documentation/networking/ip-sysctl.rst
+++ b/Documentation/networking/ip-sysctl.rst
@@ -1229,8 +1229,8 @@ tcp_pingpong_thresh - INTEGER
tcp_rto_min_us - INTEGER
Minimal TCP retransmission timeout (in microseconds). Note that the
rto_min route option has the highest precedence for configuring this
- setting, followed by the TCP_BPF_RTO_MIN socket option, followed by
- this tcp_rto_min_us sysctl.
+ setting, followed by the TCP_BPF_RTO_MIN and TCP_RTO_MIN_US socket
+ options, followed by this tcp_rto_min_us sysctl.
The recommended practice is to use a value less or equal to 200000
microseconds.
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 7207c52b1fc9..6a7aab854b86 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -806,7 +806,7 @@ u32 tcp_delack_max(const struct sock *sk);
static inline u32 tcp_rto_min(const struct sock *sk)
{
const struct dst_entry *dst = __sk_dst_get(sk);
- u32 rto_min = inet_csk(sk)->icsk_rto_min;
+ u32 rto_min = READ_ONCE(inet_csk(sk)->icsk_rto_min);
if (dst && dst_metric_locked(dst, RTAX_RTO_MIN))
rto_min = dst_metric_rtt(dst, RTAX_RTO_MIN);
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
index 32a27b4a5020..b2476cf7058e 100644
--- a/include/uapi/linux/tcp.h
+++ b/include/uapi/linux/tcp.h
@@ -137,6 +137,7 @@ enum {
#define TCP_IS_MPTCP 43 /* Is MPTCP being used? */
#define TCP_RTO_MAX_MS 44 /* max rto time in ms */
+#define TCP_RTO_MIN_US 45 /* min rto time in us */
#define TCP_REPAIR_ON 1
#define TCP_REPAIR_OFF 0
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 46951e749308..b89c1b676b8e 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3352,7 +3352,7 @@ int tcp_disconnect(struct sock *sk, int flags)
icsk->icsk_probes_out = 0;
icsk->icsk_probes_tstamp = 0;
icsk->icsk_rto = TCP_TIMEOUT_INIT;
- icsk->icsk_rto_min = TCP_RTO_MIN;
+ WRITE_ONCE(icsk->icsk_rto_min, TCP_RTO_MIN);
icsk->icsk_delack_max = TCP_DELACK_MAX;
tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
tcp_snd_cwnd_set(tp, TCP_INIT_CWND);
@@ -3833,6 +3833,14 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname,
return -EINVAL;
WRITE_ONCE(inet_csk(sk)->icsk_rto_max, msecs_to_jiffies(val));
return 0;
+ case TCP_RTO_MIN_US: {
+ int rto_min = usecs_to_jiffies(val);
+
+ if (rto_min > TCP_RTO_MIN || rto_min < TCP_TIMEOUT_MIN)
+ return -EINVAL;
+ WRITE_ONCE(inet_csk(sk)->icsk_rto_min, rto_min);
+ return 0;
+ }
}
sockopt_lock_sock(sk);
@@ -4672,6 +4680,9 @@ int do_tcp_getsockopt(struct sock *sk, int level,
case TCP_RTO_MAX_MS:
val = jiffies_to_msecs(tcp_rto_max(sk));
break;
+ case TCP_RTO_MIN_US:
+ val = jiffies_to_usecs(READ_ONCE(inet_csk(sk)->icsk_rto_min));
+ break;
default:
return -ENOPROTOOPT;
}
--
2.43.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next v4 2/2] tcp: support TCP_DELACK_MAX_US for set/getsockopt use
2025-03-17 12:03 [PATCH net-next v4 0/2] support TCP_RTO_MIN_US and TCP_DELACK_MAX_US for set/getsockopt Jason Xing
2025-03-17 12:03 ` [PATCH net-next v4 1/2] tcp: support TCP_RTO_MIN_US for set/getsockopt use Jason Xing
@ 2025-03-17 12:03 ` Jason Xing
2025-03-25 11:13 ` Eric Dumazet
2025-03-24 16:35 ` [PATCH net-next v4 0/2] support TCP_RTO_MIN_US and TCP_DELACK_MAX_US for set/getsockopt Jason Xing
2025-03-25 11:40 ` patchwork-bot+netdevbpf
3 siblings, 1 reply; 9+ messages in thread
From: Jason Xing @ 2025-03-17 12:03 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, horms, ncardwell, kuniyu, dsahern
Cc: netdev, Jason Xing
Support adjusting/reading delayed ack max for socket level by using
set/getsockopt().
This option aligns with TCP_BPF_DELACK_MAX usage. Considering that bpf
option was implemented before this patch, so we need to use a standalone
new option for pure tcp set/getsockopt() use.
Add WRITE_ONCE/READ_ONCE() to prevent data-race if setsockopt()
happens to write one value to icsk_delack_max while icsk_delack_max is
being read.
Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
---
include/uapi/linux/tcp.h | 1 +
net/ipv4/tcp.c | 13 ++++++++++++-
net/ipv4/tcp_output.c | 2 +-
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
index b2476cf7058e..2377e22f2c4b 100644
--- a/include/uapi/linux/tcp.h
+++ b/include/uapi/linux/tcp.h
@@ -138,6 +138,7 @@ enum {
#define TCP_IS_MPTCP 43 /* Is MPTCP being used? */
#define TCP_RTO_MAX_MS 44 /* max rto time in ms */
#define TCP_RTO_MIN_US 45 /* min rto time in us */
+#define TCP_DELACK_MAX_US 46 /* max delayed ack time in us */
#define TCP_REPAIR_ON 1
#define TCP_REPAIR_OFF 0
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index b89c1b676b8e..578e79024955 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3353,7 +3353,7 @@ int tcp_disconnect(struct sock *sk, int flags)
icsk->icsk_probes_tstamp = 0;
icsk->icsk_rto = TCP_TIMEOUT_INIT;
WRITE_ONCE(icsk->icsk_rto_min, TCP_RTO_MIN);
- icsk->icsk_delack_max = TCP_DELACK_MAX;
+ WRITE_ONCE(icsk->icsk_delack_max, TCP_DELACK_MAX);
tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
tcp_snd_cwnd_set(tp, TCP_INIT_CWND);
tp->snd_cwnd_cnt = 0;
@@ -3841,6 +3841,14 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname,
WRITE_ONCE(inet_csk(sk)->icsk_rto_min, rto_min);
return 0;
}
+ case TCP_DELACK_MAX_US: {
+ int delack_max = usecs_to_jiffies(val);
+
+ if (delack_max > TCP_DELACK_MAX || delack_max < TCP_TIMEOUT_MIN)
+ return -EINVAL;
+ WRITE_ONCE(inet_csk(sk)->icsk_delack_max, delack_max);
+ return 0;
+ }
}
sockopt_lock_sock(sk);
@@ -4683,6 +4691,9 @@ int do_tcp_getsockopt(struct sock *sk, int level,
case TCP_RTO_MIN_US:
val = jiffies_to_usecs(READ_ONCE(inet_csk(sk)->icsk_rto_min));
break;
+ case TCP_DELACK_MAX_US:
+ val = jiffies_to_usecs(READ_ONCE(inet_csk(sk)->icsk_delack_max));
+ break;
default:
return -ENOPROTOOPT;
}
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 24e56bf96747..65aa26d65987 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -4179,7 +4179,7 @@ u32 tcp_delack_max(const struct sock *sk)
{
u32 delack_from_rto_min = max(tcp_rto_min(sk), 2) - 1;
- return min(inet_csk(sk)->icsk_delack_max, delack_from_rto_min);
+ return min(READ_ONCE(inet_csk(sk)->icsk_delack_max), delack_from_rto_min);
}
/* Send out a delayed ack, the caller does the policy checking
--
2.43.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH net-next v4 0/2] support TCP_RTO_MIN_US and TCP_DELACK_MAX_US for set/getsockopt
2025-03-17 12:03 [PATCH net-next v4 0/2] support TCP_RTO_MIN_US and TCP_DELACK_MAX_US for set/getsockopt Jason Xing
2025-03-17 12:03 ` [PATCH net-next v4 1/2] tcp: support TCP_RTO_MIN_US for set/getsockopt use Jason Xing
2025-03-17 12:03 ` [PATCH net-next v4 2/2] tcp: support TCP_DELACK_MAX_US " Jason Xing
@ 2025-03-24 16:35 ` Jason Xing
2025-03-24 16:57 ` Jason Xing
2025-03-25 11:40 ` patchwork-bot+netdevbpf
3 siblings, 1 reply; 9+ messages in thread
From: Jason Xing @ 2025-03-24 16:35 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, horms, ncardwell, kuniyu, dsahern; +Cc: netdev
On Mon, Mar 17, 2025 at 8:03 PM Jason Xing <kerneljasonxing@gmail.com> wrote:
>
> Add set/getsockopt supports for TCP_RTO_MIN_US and TCP_DELACK_MAX_US.
>
> v4
> 1. add more detailed information into commit log (Eric)
> 2. use val directly in do_tcp_getsockopt (Eric)
>
> Jason Xing (2):
> tcp: support TCP_RTO_MIN_US for set/getsockopt use
> tcp: support TCP_DELACK_MAX_US for set/getsockopt use
Gentle ping here :) I noticed that net-next is closed, so I decided to
reply to this thread.
Thanks,
Jason
>
> Documentation/networking/ip-sysctl.rst | 4 ++--
> include/net/tcp.h | 2 +-
> include/uapi/linux/tcp.h | 2 ++
> net/ipv4/tcp.c | 26 ++++++++++++++++++++++++--
> net/ipv4/tcp_output.c | 2 +-
> 5 files changed, 30 insertions(+), 6 deletions(-)
>
> --
> 2.43.5
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next v4 0/2] support TCP_RTO_MIN_US and TCP_DELACK_MAX_US for set/getsockopt
2025-03-24 16:35 ` [PATCH net-next v4 0/2] support TCP_RTO_MIN_US and TCP_DELACK_MAX_US for set/getsockopt Jason Xing
@ 2025-03-24 16:57 ` Jason Xing
0 siblings, 0 replies; 9+ messages in thread
From: Jason Xing @ 2025-03-24 16:57 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, horms, ncardwell, kuniyu, dsahern; +Cc: netdev
On Tue, Mar 25, 2025 at 12:35 AM Jason Xing <kerneljasonxing@gmail.com> wrote:
>
> On Mon, Mar 17, 2025 at 8:03 PM Jason Xing <kerneljasonxing@gmail.com> wrote:
> >
> > Add set/getsockopt supports for TCP_RTO_MIN_US and TCP_DELACK_MAX_US.
> >
> > v4
> > 1. add more detailed information into commit log (Eric)
> > 2. use val directly in do_tcp_getsockopt (Eric)
> >
> > Jason Xing (2):
> > tcp: support TCP_RTO_MIN_US for set/getsockopt use
> > tcp: support TCP_DELACK_MAX_US for set/getsockopt use
>
> Gentle ping here :) I noticed that net-next is closed, so I decided to
> reply to this thread.
Oh, I should have noticed that most of the core maintainers are absent
these days. Sorry, I don't expect to add more burden so I can resend
after net-next is open. Anyway, either way is fine with me. Just
please let me know :)
Thank you.
>
> Thanks,
> Jason
>
> >
> > Documentation/networking/ip-sysctl.rst | 4 ++--
> > include/net/tcp.h | 2 +-
> > include/uapi/linux/tcp.h | 2 ++
> > net/ipv4/tcp.c | 26 ++++++++++++++++++++++++--
> > net/ipv4/tcp_output.c | 2 +-
> > 5 files changed, 30 insertions(+), 6 deletions(-)
> >
> > --
> > 2.43.5
> >
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next v4 1/2] tcp: support TCP_RTO_MIN_US for set/getsockopt use
2025-03-17 12:03 ` [PATCH net-next v4 1/2] tcp: support TCP_RTO_MIN_US for set/getsockopt use Jason Xing
@ 2025-03-25 11:09 ` Eric Dumazet
0 siblings, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2025-03-25 11:09 UTC (permalink / raw)
To: Jason Xing; +Cc: davem, kuba, pabeni, horms, ncardwell, kuniyu, dsahern, netdev
On Mon, Mar 17, 2025 at 1:03 PM Jason Xing <kerneljasonxing@gmail.com> wrote:
>
> Support adjusting/reading RTO MIN for socket level by using set/getsockopt().
>
> This new option has the same effect as TCP_BPF_RTO_MIN, which means it
> doesn't affect RTAX_RTO_MIN usage (by using ip route...). Considering that
> bpf option was implemented before this patch, so we need to use a standalone
> new option for pure tcp set/getsockopt() use.
>
> When the socket is created, its icsk_rto_min is set to the default
> value that is controlled by sysctl_tcp_rto_min_us. Then if application
> calls setsockopt() with TCP_RTO_MIN_US flag to pass a valid value, then
> icsk_rto_min will be overridden in jiffies unit.
>
> This patch adds WRITE_ONCE/READ_ONCE to avoid data-race around
> icsk_rto_min.
>
> Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
> ---
> Documentation/networking/ip-sysctl.rst | 4 ++--
> include/net/tcp.h | 2 +-
> include/uapi/linux/tcp.h | 1 +
> net/ipv4/tcp.c | 13 ++++++++++++-
> 4 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/networking/ip-sysctl.rst
> index 054561f8dcae..5c63ab928b97 100644
> --- a/Documentation/networking/ip-sysctl.rst
> +++ b/Documentation/networking/ip-sysctl.rst
> @@ -1229,8 +1229,8 @@ tcp_pingpong_thresh - INTEGER
> tcp_rto_min_us - INTEGER
> Minimal TCP retransmission timeout (in microseconds). Note that the
> rto_min route option has the highest precedence for configuring this
> - setting, followed by the TCP_BPF_RTO_MIN socket option, followed by
> - this tcp_rto_min_us sysctl.
> + setting, followed by the TCP_BPF_RTO_MIN and TCP_RTO_MIN_US socket
> + options, followed by this tcp_rto_min_us sysctl.
>
> The recommended practice is to use a value less or equal to 200000
> microseconds.
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index 7207c52b1fc9..6a7aab854b86 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -806,7 +806,7 @@ u32 tcp_delack_max(const struct sock *sk);
> static inline u32 tcp_rto_min(const struct sock *sk)
> {
> const struct dst_entry *dst = __sk_dst_get(sk);
> - u32 rto_min = inet_csk(sk)->icsk_rto_min;
> + u32 rto_min = READ_ONCE(inet_csk(sk)->icsk_rto_min);
>
> if (dst && dst_metric_locked(dst, RTAX_RTO_MIN))
> rto_min = dst_metric_rtt(dst, RTAX_RTO_MIN);
> diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
> index 32a27b4a5020..b2476cf7058e 100644
> --- a/include/uapi/linux/tcp.h
> +++ b/include/uapi/linux/tcp.h
> @@ -137,6 +137,7 @@ enum {
>
> #define TCP_IS_MPTCP 43 /* Is MPTCP being used? */
> #define TCP_RTO_MAX_MS 44 /* max rto time in ms */
> +#define TCP_RTO_MIN_US 45 /* min rto time in us */
>
> #define TCP_REPAIR_ON 1
> #define TCP_REPAIR_OFF 0
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 46951e749308..b89c1b676b8e 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -3352,7 +3352,7 @@ int tcp_disconnect(struct sock *sk, int flags)
> icsk->icsk_probes_out = 0;
> icsk->icsk_probes_tstamp = 0;
> icsk->icsk_rto = TCP_TIMEOUT_INIT;
> - icsk->icsk_rto_min = TCP_RTO_MIN;
> + WRITE_ONCE(icsk->icsk_rto_min, TCP_RTO_MIN);
Semi-orthogonal to your patch, apparently at disconnect() we throw
away user/eBPF choice.
Most socket options, once set via setsockopt() should stay even if the
socket is re-used.
Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next v4 2/2] tcp: support TCP_DELACK_MAX_US for set/getsockopt use
2025-03-17 12:03 ` [PATCH net-next v4 2/2] tcp: support TCP_DELACK_MAX_US " Jason Xing
@ 2025-03-25 11:13 ` Eric Dumazet
2025-03-26 11:54 ` Jason Xing
0 siblings, 1 reply; 9+ messages in thread
From: Eric Dumazet @ 2025-03-25 11:13 UTC (permalink / raw)
To: Jason Xing; +Cc: davem, kuba, pabeni, horms, ncardwell, kuniyu, dsahern, netdev
On Mon, Mar 17, 2025 at 1:03 PM Jason Xing <kerneljasonxing@gmail.com> wrote:
>
> Support adjusting/reading delayed ack max for socket level by using
> set/getsockopt().
>
> This option aligns with TCP_BPF_DELACK_MAX usage. Considering that bpf
> option was implemented before this patch, so we need to use a standalone
> new option for pure tcp set/getsockopt() use.
>
> Add WRITE_ONCE/READ_ONCE() to prevent data-race if setsockopt()
> happens to write one value to icsk_delack_max while icsk_delack_max is
> being read.
>
> Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
> ---
> include/uapi/linux/tcp.h | 1 +
> net/ipv4/tcp.c | 13 ++++++++++++-
> net/ipv4/tcp_output.c | 2 +-
> 3 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
> index b2476cf7058e..2377e22f2c4b 100644
> --- a/include/uapi/linux/tcp.h
> +++ b/include/uapi/linux/tcp.h
> @@ -138,6 +138,7 @@ enum {
> #define TCP_IS_MPTCP 43 /* Is MPTCP being used? */
> #define TCP_RTO_MAX_MS 44 /* max rto time in ms */
> #define TCP_RTO_MIN_US 45 /* min rto time in us */
> +#define TCP_DELACK_MAX_US 46 /* max delayed ack time in us */
>
> #define TCP_REPAIR_ON 1
> #define TCP_REPAIR_OFF 0
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index b89c1b676b8e..578e79024955 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -3353,7 +3353,7 @@ int tcp_disconnect(struct sock *sk, int flags)
> icsk->icsk_probes_tstamp = 0;
> icsk->icsk_rto = TCP_TIMEOUT_INIT;
> WRITE_ONCE(icsk->icsk_rto_min, TCP_RTO_MIN);
> - icsk->icsk_delack_max = TCP_DELACK_MAX;
> + WRITE_ONCE(icsk->icsk_delack_max, TCP_DELACK_MAX);
Same comment here as the first patch, I think we should not change
csk->icsk_delack_max in tcp_disconnect(),
otherwise a prior setsockopt() setting is erased.
Probably not a big deal, and if it is, could be fixed in a followup patch.
Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next v4 0/2] support TCP_RTO_MIN_US and TCP_DELACK_MAX_US for set/getsockopt
2025-03-17 12:03 [PATCH net-next v4 0/2] support TCP_RTO_MIN_US and TCP_DELACK_MAX_US for set/getsockopt Jason Xing
` (2 preceding siblings ...)
2025-03-24 16:35 ` [PATCH net-next v4 0/2] support TCP_RTO_MIN_US and TCP_DELACK_MAX_US for set/getsockopt Jason Xing
@ 2025-03-25 11:40 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-03-25 11:40 UTC (permalink / raw)
To: Jason Xing
Cc: davem, edumazet, kuba, pabeni, horms, ncardwell, kuniyu, dsahern,
netdev
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 17 Mar 2025 20:03:12 +0800 you wrote:
> Add set/getsockopt supports for TCP_RTO_MIN_US and TCP_DELACK_MAX_US.
>
> v4
> 1. add more detailed information into commit log (Eric)
> 2. use val directly in do_tcp_getsockopt (Eric)
>
> Jason Xing (2):
> tcp: support TCP_RTO_MIN_US for set/getsockopt use
> tcp: support TCP_DELACK_MAX_US for set/getsockopt use
>
> [...]
Here is the summary with links:
- [net-next,v4,1/2] tcp: support TCP_RTO_MIN_US for set/getsockopt use
https://git.kernel.org/netdev/net-next/c/f38805c5d26f
- [net-next,v4,2/2] tcp: support TCP_DELACK_MAX_US for set/getsockopt use
https://git.kernel.org/netdev/net-next/c/9552f90835ef
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next v4 2/2] tcp: support TCP_DELACK_MAX_US for set/getsockopt use
2025-03-25 11:13 ` Eric Dumazet
@ 2025-03-26 11:54 ` Jason Xing
0 siblings, 0 replies; 9+ messages in thread
From: Jason Xing @ 2025-03-26 11:54 UTC (permalink / raw)
To: Eric Dumazet
Cc: davem, kuba, pabeni, horms, ncardwell, kuniyu, dsahern, netdev
On Tue, Mar 25, 2025 at 7:13 PM Eric Dumazet <edumazet@google.com> wrote:
>
> On Mon, Mar 17, 2025 at 1:03 PM Jason Xing <kerneljasonxing@gmail.com> wrote:
> >
> > Support adjusting/reading delayed ack max for socket level by using
> > set/getsockopt().
> >
> > This option aligns with TCP_BPF_DELACK_MAX usage. Considering that bpf
> > option was implemented before this patch, so we need to use a standalone
> > new option for pure tcp set/getsockopt() use.
> >
> > Add WRITE_ONCE/READ_ONCE() to prevent data-race if setsockopt()
> > happens to write one value to icsk_delack_max while icsk_delack_max is
> > being read.
> >
> > Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
> > ---
> > include/uapi/linux/tcp.h | 1 +
> > net/ipv4/tcp.c | 13 ++++++++++++-
> > net/ipv4/tcp_output.c | 2 +-
> > 3 files changed, 14 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
> > index b2476cf7058e..2377e22f2c4b 100644
> > --- a/include/uapi/linux/tcp.h
> > +++ b/include/uapi/linux/tcp.h
> > @@ -138,6 +138,7 @@ enum {
> > #define TCP_IS_MPTCP 43 /* Is MPTCP being used? */
> > #define TCP_RTO_MAX_MS 44 /* max rto time in ms */
> > #define TCP_RTO_MIN_US 45 /* min rto time in us */
> > +#define TCP_DELACK_MAX_US 46 /* max delayed ack time in us */
> >
> > #define TCP_REPAIR_ON 1
> > #define TCP_REPAIR_OFF 0
> > diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> > index b89c1b676b8e..578e79024955 100644
> > --- a/net/ipv4/tcp.c
> > +++ b/net/ipv4/tcp.c
> > @@ -3353,7 +3353,7 @@ int tcp_disconnect(struct sock *sk, int flags)
> > icsk->icsk_probes_tstamp = 0;
> > icsk->icsk_rto = TCP_TIMEOUT_INIT;
> > WRITE_ONCE(icsk->icsk_rto_min, TCP_RTO_MIN);
> > - icsk->icsk_delack_max = TCP_DELACK_MAX;
> > + WRITE_ONCE(icsk->icsk_delack_max, TCP_DELACK_MAX);
>
> Same comment here as the first patch, I think we should not change
> csk->icsk_delack_max in tcp_disconnect(),
> otherwise a prior setsockopt() setting is erased.
>
> Probably not a big deal, and if it is, could be fixed in a followup patch.
Got it. Thanks.
Thanks,
Jason
>
> Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-03-26 11:54 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-17 12:03 [PATCH net-next v4 0/2] support TCP_RTO_MIN_US and TCP_DELACK_MAX_US for set/getsockopt Jason Xing
2025-03-17 12:03 ` [PATCH net-next v4 1/2] tcp: support TCP_RTO_MIN_US for set/getsockopt use Jason Xing
2025-03-25 11:09 ` Eric Dumazet
2025-03-17 12:03 ` [PATCH net-next v4 2/2] tcp: support TCP_DELACK_MAX_US " Jason Xing
2025-03-25 11:13 ` Eric Dumazet
2025-03-26 11:54 ` Jason Xing
2025-03-24 16:35 ` [PATCH net-next v4 0/2] support TCP_RTO_MIN_US and TCP_DELACK_MAX_US for set/getsockopt Jason Xing
2025-03-24 16:57 ` Jason Xing
2025-03-25 11:40 ` patchwork-bot+netdevbpf
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).