Skip to contentSkip to conversation

ss: add support for delivered and delivered_ce fields

PATCH Applied Eric Dumazet 6 participants 9 messages Nov 27, 2018 – Dec 3, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ss: add support for delivered and delivered_ce fields

Kernel support was added in linux-4.18 in commit feb5f2ec6464 ("tcp: export packets delivery info")

Tested:

ss -ti
...
ESTAB 0 2270520 [2607:f8b0:8099:e16::]:47646 [2607:f8b0:8099:e18::]:38953

	 ts sack cubic wscale:8,8 rto:7 rtt:2.824/0.278 mss:1428
     pmtu:1500 rcvmss:536 advmss:1428 cwnd:89 ssthresh:62 bytes_acked:2097871945
    segs_out:1469144 segs_in:65221 data_segs_out:1469142 send 360.0Mbps lastsnd:2
    lastrcv:99231 lastack:2 pacing_rate 431.9Mbps delivery_rate 246.4Mbps
(*) delivered:1469099 delivered_ce:424799
    busy:99231ms unacked:44 rcv_space:14280 rcv_ssthresh:65535
    notsent:2207688 minrtt:0.228
---
 misc/ss.c | 8 ++++++++
 1 file changed, 8 insertions(+)
misc/ss.c +8 -0
index e4d6ae489e798419fa6ce6fb0f4b8b0b3232adf6..3aa94f235085512510dca9fd597e8e37aaaf0fd3 100644
@@ -817,6 +817,8 @@ struct tcpstat {
 	unsigned int	    fackets;
 	unsigned int	    reordering;
 	unsigned int	    not_sent;
+	unsigned int	    delivered;
+	unsigned int	    delivered_ce;
 	double		    rcv_rtt;
 	double		    min_rtt;
 	int		    rcv_space;
@@ -2483,6 +2485,10 @@ static void tcp_stats_print(struct tcpstat *s)
 
 	if (s->delivery_rate)
 		out(" delivery_rate %sbps", sprint_bw(b1, s->delivery_rate));
+	if (s->delivered)
+		out(" delivered:%u", s->delivered);
+	if (s->delivered_ce)
+		out(" delivered_ce:%u", s->delivered_ce);
 	if (s->app_limited)
 		out(" app_limited");
 
@@ -2829,6 +2835,8 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r,
 		s.busy_time = info->tcpi_busy_time;
 		s.rwnd_limited = info->tcpi_rwnd_limited;
 		s.sndbuf_limited = info->tcpi_sndbuf_limited;
+		s.delivered = info->tcpi_delivered;
+		s.delivered_ce = info->tcpi_delivered_ce;
 		tcp_stats_print(&s);
 		free(s.dctcp);
 		free(s.bbr_info);
Signature · 1 line
2.20.0.rc0.387.gc7a69e6b6c-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · Eric Dumazet

Kernel support was added in linux-4.18 in commit feb5f2ec6464 ("tcp: export packets delivery info")

Tested:

ss -ti
...
ESTAB 0 2270520 [2607:f8b0:8099:e16::]:47646 [2607:f8b0:8099:e18::]:38953

         ts sack cubic wscale:8,8 rto:7 rtt:2.824/0.278 mss:1428
     pmtu:1500 rcvmss:536 advmss:1428 cwnd:89 ssthresh:62 bytes_acked:2097871945
    segs_out:1469144 segs_in:65221 data_segs_out:1469142 send 360.0Mbps lastsnd:2
    lastrcv:99231 lastack:2 pacing_rate 431.9Mbps delivery_rate 246.4Mbps
(*) delivered:1469099 delivered_ce:424799
    busy:99231ms unacked:44 rcv_space:14280 rcv_ssthresh:65535
    notsent:2207688 minrtt:0.228
Quoted 1 line

Thank you Eric!

Quoted 40 lines
---
 misc/ss.c | 8 ++++++++
 1 file changed, 8 insertions(+)
misc/ss.c +8 -1
index e4d6ae489e798419fa6ce6fb0f4b8b0b3232adf6..3aa94f235085512510dca9fd597e8e37aaaf0fd3 100644
@@ -817,6 +817,8 @@ struct tcpstat {
        unsigned int        fackets;
        unsigned int        reordering;
        unsigned int        not_sent;
+       unsigned int        delivered;
+       unsigned int        delivered_ce;
        double              rcv_rtt;
        double              min_rtt;
        int                 rcv_space;
@@ -2483,6 +2485,10 @@ static void tcp_stats_print(struct tcpstat *s)
 
        if (s->delivery_rate)
                out(" delivery_rate %sbps", sprint_bw(b1, s->delivery_rate));
+       if (s->delivered)
+               out(" delivered:%u", s->delivered);
+       if (s->delivered_ce)
+               out(" delivered_ce:%u", s->delivered_ce);
        if (s->app_limited)
                out(" app_limited");
 
@@ -2829,6 +2835,8 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r,
                s.busy_time = info->tcpi_busy_time;
                s.rwnd_limited = info->tcpi_rwnd_limited;
                s.sndbuf_limited = info->tcpi_sndbuf_limited;
+               s.delivered = info->tcpi_delivered;
+               s.delivered_ce = info->tcpi_delivered_ce;
                tcp_stats_print(&s);
                free(s.dctcp);
                free(s.bbr_info);
--

2.20.0.rc0.387.gc7a69e6b6c-goog

#2 lore raw
In reply to Eric Dumazet
Quoted 16 lines · On Mon, 26 Nov 2018 14:29:53 -0800 Eric Dumazet <[email protected]> wrote:

Kernel support was added in linux-4.18 in commit feb5f2ec6464 ("tcp: export packets delivery info")

Tested:

ss -ti
...
ESTAB 0 2270520 [2607:f8b0:8099:e16::]:47646 [2607:f8b0:8099:e18::]:38953

	 ts sack cubic wscale:8,8 rto:7 rtt:2.824/0.278 mss:1428
     pmtu:1500 rcvmss:536 advmss:1428 cwnd:89 ssthresh:62 bytes_acked:2097871945
    segs_out:1469144 segs_in:65221 data_segs_out:1469142 send 360.0Mbps lastsnd:2
    lastrcv:99231 lastack:2 pacing_rate 431.9Mbps delivery_rate 246.4Mbps
(*) delivered:1469099 delivered_ce:424799
    busy:99231ms unacked:44 rcv_space:14280 rcv_ssthresh:65535
    notsent:2207688 minrtt:0.228
Quoted 1 line

Applied

#3 lore raw
Quoted 19 lines · Stephen Hemminger
Quoted 16 lines · On Mon, 26 Nov 2018 14:29:53 -0800 Eric Dumazet <[email protected]> wrote:

Kernel support was added in linux-4.18 in commit feb5f2ec6464 ("tcp: export packets delivery info")

Tested:

ss -ti
...
ESTAB 0 2270520 [2607:f8b0:8099:e16::]:47646 [2607:f8b0:8099:e18::]:38953

	 ts sack cubic wscale:8,8 rto:7 rtt:2.824/0.278 mss:1428
     pmtu:1500 rcvmss:536 advmss:1428 cwnd:89 ssthresh:62 bytes_acked:2097871945
    segs_out:1469144 segs_in:65221 data_segs_out:1469142 send 360.0Mbps lastsnd:2
    lastrcv:99231 lastack:2 pacing_rate 431.9Mbps delivery_rate 246.4Mbps
(*) delivered:1469099 delivered_ce:424799
    busy:99231ms unacked:44 rcv_space:14280 rcv_ssthresh:65535
    notsent:2207688 minrtt:0.228
Quoted 4 lines
Quoted 1 line

Applied

Thanks Stephen

BTW, it seems ss had some recent regression :

Old ss command was happy with "ss dst 127.0.0.1 and not dst :12865"

But current one is not.

root@edumazet-glaptop:/usr/src/iproute2# ss -V
ss utility, iproute2-ss171113
root@edumazet-glaptop:/usr/src/iproute2# ss dst 127.0.0.1 and not dst :12865
Netid  State      Recv-Q Send-Q                        Local Address:Port                                         Peer Address:Port                
tcp    ESTAB      0      0                                 127.0.0.1:45368                                           127.0.0.1:999                  
tcp    ESTAB      0      0                                 127.0.0.1:999                                             127.0.0.1:45368   
root@edumazet-glaptop:/usr/src/iproute2# misc/ss -V
ss utility, iproute2-ss181023
root@edumazet-glaptop:/usr/src/iproute2# misc/ss dst 127.0.0.1 and not dst :12865
ss: bison bellows (while parsing filter): "syntax error!" Sorry.
Usage: ss [ OPTIONS ]
       ss [ OPTIONS ] [ FILTER ]
...
#4 lore raw
Quoted 44 lines · Eric Dumazet
Quoted 19 lines · Stephen Hemminger
Quoted 16 lines · On Mon, 26 Nov 2018 14:29:53 -0800 Eric Dumazet <[email protected]> wrote:

Kernel support was added in linux-4.18 in commit feb5f2ec6464 ("tcp: export packets delivery info")

Tested:

ss -ti
...
ESTAB 0 2270520 [2607:f8b0:8099:e16::]:47646 [2607:f8b0:8099:e18::]:38953

	 ts sack cubic wscale:8,8 rto:7 rtt:2.824/0.278 mss:1428
     pmtu:1500 rcvmss:536 advmss:1428 cwnd:89 ssthresh:62 bytes_acked:2097871945
    segs_out:1469144 segs_in:65221 data_segs_out:1469142 send 360.0Mbps lastsnd:2
    lastrcv:99231 lastack:2 pacing_rate 431.9Mbps delivery_rate 246.4Mbps
(*) delivered:1469099 delivered_ce:424799
    busy:99231ms unacked:44 rcv_space:14280 rcv_ssthresh:65535
    notsent:2207688 minrtt:0.228
Quoted 4 lines
Quoted 1 line

Applied

Thanks Stephen

BTW, it seems ss had some recent regression :

Old ss command was happy with "ss dst 127.0.0.1 and not dst :12865"

But current one is not.

root@edumazet-glaptop:/usr/src/iproute2# ss -V
ss utility, iproute2-ss171113
root@edumazet-glaptop:/usr/src/iproute2# ss dst 127.0.0.1 and not dst :12865
Netid  State      Recv-Q Send-Q                        Local Address:Port                                         Peer Address:Port                
tcp    ESTAB      0      0                                 127.0.0.1:45368                                           127.0.0.1:999                  
tcp    ESTAB      0      0                                 127.0.0.1:999                                             127.0.0.1:45368   
Quoted 9 lines
root@edumazet-glaptop:/usr/src/iproute2# misc/ss -V
ss utility, iproute2-ss181023
root@edumazet-glaptop:/usr/src/iproute2# misc/ss dst 127.0.0.1 and not dst :12865
ss: bison bellows (while parsing filter): "syntax error!" Sorry.
Usage: ss [ OPTIONS ]
       ss [ OPTIONS ] [ FILTER ]
...

Most logical commit to ssfilter.y is:

commit 38d209ecf2ae966b9b25de4acb60cdffb0e06ced

Author: Phil Sutter <[email protected]>
Date:   Tue Aug 14 14:18:06 2018 +0200

ss: Review ssfilter

Can you revert it and see if it helps?

#5 lore raw
Quoted 58 lines · David Ahern
Quoted 44 lines · Eric Dumazet
Quoted 19 lines · Stephen Hemminger
Quoted 16 lines · On Mon, 26 Nov 2018 14:29:53 -0800 Eric Dumazet <[email protected]> wrote:

Kernel support was added in linux-4.18 in commit feb5f2ec6464 ("tcp: export packets delivery info")

Tested:

ss -ti
...
ESTAB 0 2270520 [2607:f8b0:8099:e16::]:47646 [2607:f8b0:8099:e18::]:38953

     ts sack cubic wscale:8,8 rto:7 rtt:2.824/0.278 mss:1428
     pmtu:1500 rcvmss:536 advmss:1428 cwnd:89 ssthresh:62 bytes_acked:2097871945
    segs_out:1469144 segs_in:65221 data_segs_out:1469142 send 360.0Mbps lastsnd:2
    lastrcv:99231 lastack:2 pacing_rate 431.9Mbps delivery_rate 246.4Mbps
(*) delivered:1469099 delivered_ce:424799
    busy:99231ms unacked:44 rcv_space:14280 rcv_ssthresh:65535
    notsent:2207688 minrtt:0.228
Quoted 4 lines
Quoted 1 line

Applied

Thanks Stephen

BTW, it seems ss had some recent regression :

Old ss command was happy with "ss dst 127.0.0.1 and not dst :12865"

But current one is not.

root@edumazet-glaptop:/usr/src/iproute2# ss -V
ss utility, iproute2-ss171113
root@edumazet-glaptop:/usr/src/iproute2# ss dst 127.0.0.1 and not dst :12865
Netid  State      Recv-Q Send-Q                        Local Address:Port                                         Peer Address:Port
tcp    ESTAB      0      0                                 127.0.0.1:45368                                           127.0.0.1:999
tcp    ESTAB      0      0                                 127.0.0.1:999                                             127.0.0.1:45368
Quoted 9 lines
root@edumazet-glaptop:/usr/src/iproute2# misc/ss -V
ss utility, iproute2-ss181023
root@edumazet-glaptop:/usr/src/iproute2# misc/ss dst 127.0.0.1 and not dst :12865
ss: bison bellows (while parsing filter): "syntax error!" Sorry.
Usage: ss [ OPTIONS ]
       ss [ OPTIONS ] [ FILTER ]
...

Most logical commit to ssfilter.y is:

Quoted 7 lines

commit 38d209ecf2ae966b9b25de4acb60cdffb0e06ced

Author: Phil Sutter <[email protected]>
Date:   Tue Aug 14 14:18:06 2018 +0200

ss: Review ssfilter

Can you revert it and see if it helps?

It does not help.

It seem the new way is to use : ss dst 127.0.0.1 and dport != 12865

#6 lore raw

PATCH 1/1 ssfilter: Fix for inverted last expression

When fixing for shift/reduce conflicts, possibility to invert the last expression by prefixing with '!' or 'not' was accidentally removed.

Fix this by allowing for expr to be an inverted expr so that any reference to it in exprlist accepts the inverted prefix.

Fixes b2038cc0b2403 ("ssfilter: Eliminate shift/reduce conflicts")
---
 misc/ssfilter.y | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
misc/ssfilter.y +4 -4
index 0413dddaa7584..a901ae753a284 100644
@@ -54,10 +54,6 @@ null:   /* NOTHING */ { $$ = NULL; }
         ;
 
 exprlist: expr
-        | '!' expr
-        {
-                $$ = alloc_node(SSF_NOT, $2);
-        }
         | exprlist '|' expr
         {
                 $$ = alloc_node(SSF_OR, $1);
@@ -83,6 +79,10 @@ expr:	'(' exprlist ')'
 	{
 		$$ = $2;
 	}
+	| '!' expr
+	{
+		$$ = alloc_node(SSF_NOT, $2);
+	}
 	| DCOND eq HOSTCOND
         {
 		$$ = alloc_node(SSF_DCOND, $3);
Signature · 1 line
2.19.0
Acked-by on v1 1/1
#7 lore raw

Re: [iproute PATCH] ssfilter: Fix for inverted last expression

Quoted 10 lines · Phil Sutter

When fixing for shift/reduce conflicts, possibility to invert the last expression by prefixing with '!' or 'not' was accidentally removed.

Fix this by allowing for expr to be an inverted expr so that any reference to it in exprlist accepts the inverted prefix.

Fixes b2038cc0b2403 ("ssfilter: Eliminate shift/reduce conflicts")

---

Thanks Phil !

#8 lore raw

Re: [iproute PATCH] ssfilter: Fix for inverted last expression

In reply to Phil Sutter
Quoted 9 lines · On Thu, 29 Nov 2018 13:20:37 +0100 Phil Sutter <[email protected]> wrote:

When fixing for shift/reduce conflicts, possibility to invert the last expression by prefixing with '!' or 'not' was accidentally removed.

Fix this by allowing for expr to be an inverted expr so that any reference to it in exprlist accepts the inverted prefix.

Fixes b2038cc0b2403 ("ssfilter: Eliminate shift/reduce conflicts")

Applied. THanks.