public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] inet_diag: report delayed ack timer information
@ 2026-03-04  9:43 Eric Dumazet
  2026-03-04 15:48 ` David Ahern
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2026-03-04  9:43 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, Neal Cardwell, Kuniyuki Iwashima, David Ahern,
	netdev, eric.dumazet, Eric Dumazet

inet_sk_diag_fill() populates r->idiag_timer with the following
precedence order:

1 - Retransmit timer.
4 - Probe0 timer.
2 - Keepalive timer.

This patch adds a new value, last in the list, if other timers
are not active.

5 - Delayed ACK timer.

A corresponding iproute2 patch is needed to replace "unknown"
with "delack":

ESTAB 10     0   [2002:a05:6830:1f86::]:12875 [2002:a05:6830:1f85::]:50438

    timer:(unknown,003ms,0) ino:152178 sk:3004 cgroup:unreachable:189 <->

    skmem:(r1344,rb12780520,t0,tb262144,f2752,w0,o250,bl0,d0) ts usec_ts
    sack ecnseen bbr2s wscale:12,12 rto:10 rtt:4.073/0.205 ato:4 mss:4096
    pmtu:5000 rcvmss:536 advmss:4096 cwnd:48 ssthresh:48 bytes_sent:288980
    bytes_retrans:20 bytes_acked:288960 bytes_received:288970 segs_out:28986
    segs_in:30626 data_segs_out:28898 data_segs_in:28897
    bbr2:(bw:575Mbps,mrtt:0.049,bw_hi:1.48e+08Tbps,inflight_hi:48,
    extra_acked:1,mode:2,phase:PROBE_BW_UP,pacing_gain:1.25,cwnd_gain:2.25)
    send 386Mbps lastsnd:5 lastrcv:1 lastack:1 pacing_rate 711Mbps
    delivery_rate 575Mbps delivered:28898 app_limited busy:91010ms retrans:0/2
    dsack_dups:1 rcv_rtt:151640 rcv_space:266250 rcv_ssthresh:265904
    minrtt:0.049 snd_wnd:270336 rcv_wnd:266240 rehash:1

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv4/inet_diag.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 9d215485b5c7e7ba29dd53c924f0245439d74af5..e4cb18061aefcc22df04644c00bf5c7db4e150d2 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -298,6 +298,10 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
 		r->idiag_retrans = READ_ONCE(icsk->icsk_probes_out);
 		r->idiag_expires =
 			jiffies_delta_to_msecs(icsk->icsk_keepalive_timer.expires - jiffies);
+	} else if (timer_pending(&icsk->icsk_delack_timer)) {
+		r->idiag_timer = 5;
+		r->idiag_expires =
+			jiffies_delta_to_msecs(icsk_delack_timeout(icsk) - jiffies);
 	}
 
 	if ((ext & (1 << (INET_DIAG_INFO - 1))) && handler->idiag_info_size) {
-- 
2.53.0.473.g4a7958ca14-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] inet_diag: report delayed ack timer information
  2026-03-04  9:43 [PATCH net-next] inet_diag: report delayed ack timer information Eric Dumazet
@ 2026-03-04 15:48 ` David Ahern
  2026-03-04 16:00   ` Eric Dumazet
  0 siblings, 1 reply; 6+ messages in thread
From: David Ahern @ 2026-03-04 15:48 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, Neal Cardwell, Kuniyuki Iwashima, netdev,
	eric.dumazet

On 3/4/26 2:43 AM, Eric Dumazet wrote:
> inet_sk_diag_fill() populates r->idiag_timer with the following
> precedence order:
> 
> 1 - Retransmit timer.
> 4 - Probe0 timer.
> 2 - Keepalive timer.
> 
> This patch adds a new value, last in the list, if other timers
> are not active.
> 
> 5 - Delayed ACK timer.
> 
> A corresponding iproute2 patch is needed to replace "unknown"
> with "delack":

...

> diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
> index 9d215485b5c7e7ba29dd53c924f0245439d74af5..e4cb18061aefcc22df04644c00bf5c7db4e150d2 100644
> --- a/net/ipv4/inet_diag.c
> +++ b/net/ipv4/inet_diag.c
> @@ -298,6 +298,10 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
>  		r->idiag_retrans = READ_ONCE(icsk->icsk_probes_out);
>  		r->idiag_expires =
>  			jiffies_delta_to_msecs(icsk->icsk_keepalive_timer.expires - jiffies);
> +	} else if (timer_pending(&icsk->icsk_delack_timer)) {
> +		r->idiag_timer = 5;

How come the idiag_timer values an enum in
include/uapi/linux/inet_diag.h since this is a uapi?

> +		r->idiag_expires =
> +			jiffies_delta_to_msecs(icsk_delack_timeout(icsk) - jiffies);
>  	}
>  
>  	if ((ext & (1 << (INET_DIAG_INFO - 1))) && handler->idiag_info_size) {


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] inet_diag: report delayed ack timer information
  2026-03-04 15:48 ` David Ahern
@ 2026-03-04 16:00   ` Eric Dumazet
  2026-03-04 16:55     ` Eric Dumazet
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2026-03-04 16:00 UTC (permalink / raw)
  To: David Ahern
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Simon Horman,
	Neal Cardwell, Kuniyuki Iwashima, netdev, eric.dumazet

On Wed, Mar 4, 2026 at 4:48 PM David Ahern <dsahern@kernel.org> wrote:
>
> On 3/4/26 2:43 AM, Eric Dumazet wrote:
> > inet_sk_diag_fill() populates r->idiag_timer with the following
> > precedence order:
> >
> > 1 - Retransmit timer.
> > 4 - Probe0 timer.
> > 2 - Keepalive timer.
> >
> > This patch adds a new value, last in the list, if other timers
> > are not active.
> >
> > 5 - Delayed ACK timer.
> >
> > A corresponding iproute2 patch is needed to replace "unknown"
> > with "delack":
>
> ...
>
> > diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
> > index 9d215485b5c7e7ba29dd53c924f0245439d74af5..e4cb18061aefcc22df04644c00bf5c7db4e150d2 100644
> > --- a/net/ipv4/inet_diag.c
> > +++ b/net/ipv4/inet_diag.c
> > @@ -298,6 +298,10 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
> >               r->idiag_retrans = READ_ONCE(icsk->icsk_probes_out);
> >               r->idiag_expires =
> >                       jiffies_delta_to_msecs(icsk->icsk_keepalive_timer.expires - jiffies);
> > +     } else if (timer_pending(&icsk->icsk_delack_timer)) {
> > +             r->idiag_timer = 5;
>
> How come the idiag_timer values an enum in
> include/uapi/linux/inet_diag.h since this is a uapi?

Yes, this can be done, although we survived all these years without it.

Do you want to send a patch or should I implement this idea ?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] inet_diag: report delayed ack timer information
  2026-03-04 16:00   ` Eric Dumazet
@ 2026-03-04 16:55     ` Eric Dumazet
  2026-03-04 17:01       ` Neal Cardwell
  2026-03-04 17:02       ` David Ahern
  0 siblings, 2 replies; 6+ messages in thread
From: Eric Dumazet @ 2026-03-04 16:55 UTC (permalink / raw)
  To: David Ahern
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Simon Horman,
	Neal Cardwell, Kuniyuki Iwashima, netdev, eric.dumazet

On Wed, Mar 4, 2026 at 5:00 PM Eric Dumazet <edumazet@google.com> wrote:
>
> On Wed, Mar 4, 2026 at 4:48 PM David Ahern <dsahern@kernel.org> wrote:
> >
> > On 3/4/26 2:43 AM, Eric Dumazet wrote:
> > > inet_sk_diag_fill() populates r->idiag_timer with the following
> > > precedence order:
> > >
> > > 1 - Retransmit timer.
> > > 4 - Probe0 timer.
> > > 2 - Keepalive timer.
> > >
> > > This patch adds a new value, last in the list, if other timers
> > > are not active.
> > >
> > > 5 - Delayed ACK timer.
> > >
> > > A corresponding iproute2 patch is needed to replace "unknown"
> > > with "delack":
> >
> > ...
> >
> > > diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
> > > index 9d215485b5c7e7ba29dd53c924f0245439d74af5..e4cb18061aefcc22df04644c00bf5c7db4e150d2 100644
> > > --- a/net/ipv4/inet_diag.c
> > > +++ b/net/ipv4/inet_diag.c
> > > @@ -298,6 +298,10 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
> > >               r->idiag_retrans = READ_ONCE(icsk->icsk_probes_out);
> > >               r->idiag_expires =
> > >                       jiffies_delta_to_msecs(icsk->icsk_keepalive_timer.expires - jiffies);
> > > +     } else if (timer_pending(&icsk->icsk_delack_timer)) {
> > > +             r->idiag_timer = 5;
> >
> > How come the idiag_timer values an enum in
> > include/uapi/linux/inet_diag.h since this is a uapi?
>
> Yes, this can be done, although we survived all these years without it.
>
> Do you want to send a patch or should I implement this idea ?

I will squash in V2 :

diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h
index 86bb2e8b17c9f197fd49cf7996d5e4f555a9b8e8..21f0d735fbae206cf2e1e573912a324bb2eb64d9
100644
--- a/include/uapi/linux/inet_diag.h
+++ b/include/uapi/linux/inet_diag.h
@@ -129,6 +129,15 @@ struct inet_diag_msg {
        __u32   idiag_inode;
 };

+enum {
+       IDIAG_TIMER_OFF,
+       IDIAG_TIMER_ON,
+       IDIAG_TIMER_KEEPALIVE,
+       IDIAG_TIMER_TIMEWAIT,
+       IDIAG_TIMER_PROBE0,
+       IDIAG_TIMER_DELACK,
+};
+
 /* Extensions */

 enum {
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index e4cb18061aefcc22df04644c00bf5c7db4e150d2..34b77aa87d0a48bcbceb7f2935a210a347812cc6
100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -241,7 +241,7 @@ int inet_sk_diag_fill(struct sock *sk, struct
inet_connection_sock *icsk,

        inet_diag_msg_common_fill(r, sk);
        r->idiag_state = sk->sk_state;
-       r->idiag_timer = 0;
+       r->idiag_timer = IDIAG_TIMER_OFF;
        r->idiag_retrans = 0;
        r->idiag_expires = 0;

@@ -284,22 +284,23 @@ int inet_sk_diag_fill(struct sock *sk, struct
inet_connection_sock *icsk,
        if (icsk_pending == ICSK_TIME_RETRANS ||
            icsk_pending == ICSK_TIME_REO_TIMEOUT ||
            icsk_pending == ICSK_TIME_LOSS_PROBE) {
-               r->idiag_timer = 1;
+               r->idiag_timer = IDIAG_TIMER_ON;
                r->idiag_retrans = READ_ONCE(icsk->icsk_retransmits);
                r->idiag_expires =
                        jiffies_delta_to_msecs(tcp_timeout_expires(sk)
- jiffies);
        } else if (icsk_pending == ICSK_TIME_PROBE0) {
-               r->idiag_timer = 4;
+               r->idiag_timer = IDIAG_TIMER_PROBE0;
                r->idiag_retrans = READ_ONCE(icsk->icsk_probes_out);
                r->idiag_expires =
                        jiffies_delta_to_msecs(tcp_timeout_expires(sk)
- jiffies);
        } else if (timer_pending(&icsk->icsk_keepalive_timer)) {
-               r->idiag_timer = 2;
+               r->idiag_timer = IDIAG_TIMER_KEEPALIVE;
                r->idiag_retrans = READ_ONCE(icsk->icsk_probes_out);
                r->idiag_expires =

jiffies_delta_to_msecs(icsk->icsk_keepalive_timer.expires - jiffies);
-       } else if (timer_pending(&icsk->icsk_delack_timer)) {
-               r->idiag_timer = 5;
+       } else if ((READ_ONCE(icsk->icsk_ack.pending) & ICSK_ACK_TIMER) &&
+                  timer_pending(&icsk->icsk_delack_timer)) {
+               r->idiag_timer = IDIAG_TIMER_DELACK;
                r->idiag_expires =

jiffies_delta_to_msecs(icsk_delack_timeout(icsk) - jiffies);
        }
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
index d83efd91f461c8ad0157faeebae051b32cb07bf4..3e8ee2054466e109644a758f8b4f0a646e22e456
100644
--- a/net/ipv4/tcp_diag.c
+++ b/net/ipv4/tcp_diag.c
@@ -212,7 +212,7 @@ static int tcp_twsk_diag_fill(struct sock *sk,
        r->idiag_retrans      = 0;

        r->idiag_state        = READ_ONCE(tw->tw_substate);
-       r->idiag_timer        = 3;
+       r->idiag_timer        = IDIAG_TIMER_TIMEWAIT;
        tmo = tw->tw_timer.expires - jiffies;
        r->idiag_expires      = jiffies_delta_to_msecs(tmo);
        r->idiag_rqueue       = 0;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] inet_diag: report delayed ack timer information
  2026-03-04 16:55     ` Eric Dumazet
@ 2026-03-04 17:01       ` Neal Cardwell
  2026-03-04 17:02       ` David Ahern
  1 sibling, 0 replies; 6+ messages in thread
From: Neal Cardwell @ 2026-03-04 17:01 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David Ahern, David S . Miller, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Kuniyuki Iwashima, netdev, eric.dumazet

On Wed, Mar 4, 2026 at 8:55 AM Eric Dumazet <edumazet@google.com> wrote:
>
> On Wed, Mar 4, 2026 at 5:00 PM Eric Dumazet <edumazet@google.com> wrote:
> >
> > On Wed, Mar 4, 2026 at 4:48 PM David Ahern <dsahern@kernel.org> wrote:
> > >
> > > On 3/4/26 2:43 AM, Eric Dumazet wrote:
> > > > inet_sk_diag_fill() populates r->idiag_timer with the following
> > > > precedence order:
> > > >
> > > > 1 - Retransmit timer.
> > > > 4 - Probe0 timer.
> > > > 2 - Keepalive timer.
> > > >
> > > > This patch adds a new value, last in the list, if other timers
> > > > are not active.
> > > >
> > > > 5 - Delayed ACK timer.
> > > >
> > > > A corresponding iproute2 patch is needed to replace "unknown"
> > > > with "delack":
> > >
> > > ...
> > >
> > > > diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
> > > > index 9d215485b5c7e7ba29dd53c924f0245439d74af5..e4cb18061aefcc22df04644c00bf5c7db4e150d2 100644
> > > > --- a/net/ipv4/inet_diag.c
> > > > +++ b/net/ipv4/inet_diag.c
> > > > @@ -298,6 +298,10 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
> > > >               r->idiag_retrans = READ_ONCE(icsk->icsk_probes_out);
> > > >               r->idiag_expires =
> > > >                       jiffies_delta_to_msecs(icsk->icsk_keepalive_timer.expires - jiffies);
> > > > +     } else if (timer_pending(&icsk->icsk_delack_timer)) {
> > > > +             r->idiag_timer = 5;
> > >
> > > How come the idiag_timer values an enum in
> > > include/uapi/linux/inet_diag.h since this is a uapi?
> >
> > Yes, this can be done, although we survived all these years without it.
> >
> > Do you want to send a patch or should I implement this idea ?
>
> I will squash in V2 :
>
> diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h
> index 86bb2e8b17c9f197fd49cf7996d5e4f555a9b8e8..21f0d735fbae206cf2e1e573912a324bb2eb64d9
> 100644
> --- a/include/uapi/linux/inet_diag.h
> +++ b/include/uapi/linux/inet_diag.h
> @@ -129,6 +129,15 @@ struct inet_diag_msg {
>         __u32   idiag_inode;
>  };
>
> +enum {
> +       IDIAG_TIMER_OFF,
> +       IDIAG_TIMER_ON,
> +       IDIAG_TIMER_KEEPALIVE,
> +       IDIAG_TIMER_TIMEWAIT,
> +       IDIAG_TIMER_PROBE0,
> +       IDIAG_TIMER_DELACK,
> +};
> +
>  /* Extensions */
>
>  enum {
> diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
> index e4cb18061aefcc22df04644c00bf5c7db4e150d2..34b77aa87d0a48bcbceb7f2935a210a347812cc6
> 100644
> --- a/net/ipv4/inet_diag.c
> +++ b/net/ipv4/inet_diag.c
> @@ -241,7 +241,7 @@ int inet_sk_diag_fill(struct sock *sk, struct
> inet_connection_sock *icsk,
>
>         inet_diag_msg_common_fill(r, sk);
>         r->idiag_state = sk->sk_state;
> -       r->idiag_timer = 0;
> +       r->idiag_timer = IDIAG_TIMER_OFF;
>         r->idiag_retrans = 0;
>         r->idiag_expires = 0;
>
> @@ -284,22 +284,23 @@ int inet_sk_diag_fill(struct sock *sk, struct
> inet_connection_sock *icsk,
>         if (icsk_pending == ICSK_TIME_RETRANS ||
>             icsk_pending == ICSK_TIME_REO_TIMEOUT ||
>             icsk_pending == ICSK_TIME_LOSS_PROBE) {
> -               r->idiag_timer = 1;
> +               r->idiag_timer = IDIAG_TIMER_ON;
>                 r->idiag_retrans = READ_ONCE(icsk->icsk_retransmits);
>                 r->idiag_expires =
>                         jiffies_delta_to_msecs(tcp_timeout_expires(sk)
> - jiffies);
>         } else if (icsk_pending == ICSK_TIME_PROBE0) {
> -               r->idiag_timer = 4;
> +               r->idiag_timer = IDIAG_TIMER_PROBE0;
>                 r->idiag_retrans = READ_ONCE(icsk->icsk_probes_out);
>                 r->idiag_expires =
>                         jiffies_delta_to_msecs(tcp_timeout_expires(sk)
> - jiffies);
>         } else if (timer_pending(&icsk->icsk_keepalive_timer)) {
> -               r->idiag_timer = 2;
> +               r->idiag_timer = IDIAG_TIMER_KEEPALIVE;
>                 r->idiag_retrans = READ_ONCE(icsk->icsk_probes_out);
>                 r->idiag_expires =
>
> jiffies_delta_to_msecs(icsk->icsk_keepalive_timer.expires - jiffies);
> -       } else if (timer_pending(&icsk->icsk_delack_timer)) {
> -               r->idiag_timer = 5;
> +       } else if ((READ_ONCE(icsk->icsk_ack.pending) & ICSK_ACK_TIMER) &&
> +                  timer_pending(&icsk->icsk_delack_timer)) {
> +               r->idiag_timer = IDIAG_TIMER_DELACK;
>                 r->idiag_expires =
>
> jiffies_delta_to_msecs(icsk_delack_timeout(icsk) - jiffies);
>         }
> diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
> index d83efd91f461c8ad0157faeebae051b32cb07bf4..3e8ee2054466e109644a758f8b4f0a646e22e456
> 100644
> --- a/net/ipv4/tcp_diag.c
> +++ b/net/ipv4/tcp_diag.c
> @@ -212,7 +212,7 @@ static int tcp_twsk_diag_fill(struct sock *sk,
>         r->idiag_retrans      = 0;
>
>         r->idiag_state        = READ_ONCE(tw->tw_substate);
> -       r->idiag_timer        = 3;
> +       r->idiag_timer        = IDIAG_TIMER_TIMEWAIT;
>         tmo = tw->tw_timer.expires - jiffies;
>         r->idiag_expires      = jiffies_delta_to_msecs(tmo);
>         r->idiag_rqueue       = 0;

V2 looks fantastic to me. Thanks, Eric!

neal

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] inet_diag: report delayed ack timer information
  2026-03-04 16:55     ` Eric Dumazet
  2026-03-04 17:01       ` Neal Cardwell
@ 2026-03-04 17:02       ` David Ahern
  1 sibling, 0 replies; 6+ messages in thread
From: David Ahern @ 2026-03-04 17:02 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Simon Horman,
	Neal Cardwell, Kuniyuki Iwashima, netdev, eric.dumazet

On 3/4/26 9:55 AM, Eric Dumazet wrote:
> On Wed, Mar 4, 2026 at 5:00 PM Eric Dumazet <edumazet@google.com> wrote:
>>
>> On Wed, Mar 4, 2026 at 4:48 PM David Ahern <dsahern@kernel.org> wrote:
>>>
>>> On 3/4/26 2:43 AM, Eric Dumazet wrote:
>>>> inet_sk_diag_fill() populates r->idiag_timer with the following
>>>> precedence order:
>>>>
>>>> 1 - Retransmit timer.
>>>> 4 - Probe0 timer.
>>>> 2 - Keepalive timer.
>>>>
>>>> This patch adds a new value, last in the list, if other timers
>>>> are not active.
>>>>
>>>> 5 - Delayed ACK timer.
>>>>
>>>> A corresponding iproute2 patch is needed to replace "unknown"
>>>> with "delack":
>>>
>>> ...
>>>
>>>> diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
>>>> index 9d215485b5c7e7ba29dd53c924f0245439d74af5..e4cb18061aefcc22df04644c00bf5c7db4e150d2 100644
>>>> --- a/net/ipv4/inet_diag.c
>>>> +++ b/net/ipv4/inet_diag.c
>>>> @@ -298,6 +298,10 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
>>>>               r->idiag_retrans = READ_ONCE(icsk->icsk_probes_out);
>>>>               r->idiag_expires =
>>>>                       jiffies_delta_to_msecs(icsk->icsk_keepalive_timer.expires - jiffies);
>>>> +     } else if (timer_pending(&icsk->icsk_delack_timer)) {
>>>> +             r->idiag_timer = 5;
>>>
>>> How come the idiag_timer values an enum in
>>> include/uapi/linux/inet_diag.h since this is a uapi?
>>
>> Yes, this can be done, although we survived all these years without it.
>>
>> Do you want to send a patch or should I implement this idea ?
> 
> I will squash in V2 :
> 
> diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h
> index 86bb2e8b17c9f197fd49cf7996d5e4f555a9b8e8..21f0d735fbae206cf2e1e573912a324bb2eb64d9
> 100644
> --- a/include/uapi/linux/inet_diag.h
> +++ b/include/uapi/linux/inet_diag.h
> @@ -129,6 +129,15 @@ struct inet_diag_msg {
>         __u32   idiag_inode;
>  };
> 
> +enum {
> +       IDIAG_TIMER_OFF,
> +       IDIAG_TIMER_ON,
> +       IDIAG_TIMER_KEEPALIVE,
> +       IDIAG_TIMER_TIMEWAIT,
> +       IDIAG_TIMER_PROBE0,
> +       IDIAG_TIMER_DELACK,
> +};
> +
>  /* Extensions */
> 
>  enum {
> diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
> index e4cb18061aefcc22df04644c00bf5c7db4e150d2..34b77aa87d0a48bcbceb7f2935a210a347812cc6
> 100644
> --- a/net/ipv4/inet_diag.c
> +++ b/net/ipv4/inet_diag.c
> @@ -241,7 +241,7 @@ int inet_sk_diag_fill(struct sock *sk, struct
> inet_connection_sock *icsk,
> 
>         inet_diag_msg_common_fill(r, sk);
>         r->idiag_state = sk->sk_state;
> -       r->idiag_timer = 0;
> +       r->idiag_timer = IDIAG_TIMER_OFF;
>         r->idiag_retrans = 0;
>         r->idiag_expires = 0;
> 
> @@ -284,22 +284,23 @@ int inet_sk_diag_fill(struct sock *sk, struct
> inet_connection_sock *icsk,
>         if (icsk_pending == ICSK_TIME_RETRANS ||
>             icsk_pending == ICSK_TIME_REO_TIMEOUT ||
>             icsk_pending == ICSK_TIME_LOSS_PROBE) {
> -               r->idiag_timer = 1;
> +               r->idiag_timer = IDIAG_TIMER_ON;
>                 r->idiag_retrans = READ_ONCE(icsk->icsk_retransmits);
>                 r->idiag_expires =
>                         jiffies_delta_to_msecs(tcp_timeout_expires(sk)
> - jiffies);
>         } else if (icsk_pending == ICSK_TIME_PROBE0) {
> -               r->idiag_timer = 4;
> +               r->idiag_timer = IDIAG_TIMER_PROBE0;
>                 r->idiag_retrans = READ_ONCE(icsk->icsk_probes_out);
>                 r->idiag_expires =
>                         jiffies_delta_to_msecs(tcp_timeout_expires(sk)
> - jiffies);
>         } else if (timer_pending(&icsk->icsk_keepalive_timer)) {
> -               r->idiag_timer = 2;
> +               r->idiag_timer = IDIAG_TIMER_KEEPALIVE;
>                 r->idiag_retrans = READ_ONCE(icsk->icsk_probes_out);
>                 r->idiag_expires =
> 
> jiffies_delta_to_msecs(icsk->icsk_keepalive_timer.expires - jiffies);
> -       } else if (timer_pending(&icsk->icsk_delack_timer)) {
> -               r->idiag_timer = 5;
> +       } else if ((READ_ONCE(icsk->icsk_ack.pending) & ICSK_ACK_TIMER) &&
> +                  timer_pending(&icsk->icsk_delack_timer)) {
> +               r->idiag_timer = IDIAG_TIMER_DELACK;
>                 r->idiag_expires =
> 
> jiffies_delta_to_msecs(icsk_delack_timeout(icsk) - jiffies);
>         }
> diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
> index d83efd91f461c8ad0157faeebae051b32cb07bf4..3e8ee2054466e109644a758f8b4f0a646e22e456
> 100644
> --- a/net/ipv4/tcp_diag.c
> +++ b/net/ipv4/tcp_diag.c
> @@ -212,7 +212,7 @@ static int tcp_twsk_diag_fill(struct sock *sk,
>         r->idiag_retrans      = 0;
> 
>         r->idiag_state        = READ_ONCE(tw->tw_substate);
> -       r->idiag_timer        = 3;
> +       r->idiag_timer        = IDIAG_TIMER_TIMEWAIT;
>         tmo = tw->tw_timer.expires - jiffies;
>         r->idiag_expires      = jiffies_delta_to_msecs(tmo);
>         r->idiag_rqueue       = 0;


thank you,.

Reviewed-by: David Ahern <dsahern@kernel.org>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-04 17:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04  9:43 [PATCH net-next] inet_diag: report delayed ack timer information Eric Dumazet
2026-03-04 15:48 ` David Ahern
2026-03-04 16:00   ` Eric Dumazet
2026-03-04 16:55     ` Eric Dumazet
2026-03-04 17:01       ` Neal Cardwell
2026-03-04 17:02       ` David Ahern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox