Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: liujian56@huawei.com
Cc: davem@davemloft.net, kuznet@ms2.inr.ac.ru,
	yoshfuji@linux-ipv6.org, edumazet@google.com, ycheng@google.com,
	hkchu@google.com, netdev@vger.kernel.org, weiyongjun1@huawei.com
Subject: Re: [PATCH] tcp: TCP_USER_TIMEOUT can not work in tcp_probe_timer()
Date: Mon, 11 Sep 2017 08:13:05 -0700	[thread overview]
Message-ID: <1505142785.15310.117.camel@edumazet-glaptop3.roam.corp.google.com> (raw)
In-Reply-To: <1505141357.15310.115.camel@edumazet-glaptop3.roam.corp.google.com>

On Mon, 2017-09-11 at 07:49 -0700, Eric Dumazet wrote:
> On Mon, 2017-09-11 at 14:27 +0800, liujian56@huawei.com wrote:
> > From: liujian <liujian56@huawei.com>
> > 
> > After the tcp socket go to ESTABLISHED stat, change IP address (server
> > side),
> > then the tcp socket will go tcp_probe_timer process.
> > 
> > [root@localhost net]# netstat -toe
> > Active Internet connections (w/o servers)
> > Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode      Timer
> > tcp        0   1104 9.81.254:personal-agent 9.84.201.213:23597      ESTABLISHED root       12819      probe (4.36/0/7)
> > [root@localhost net]# cat /proc/net/tcp
> >   sl  local_address rem_address   st tx_queue rx_queue tr tm->when retrnsmt   uid  timeout inode                                                     
> >    3: B1FE5109:15B3 D5C95409:5C2D 01 00000495:00000000 04:0000005E 00000000     0        7 12819 2 ffff95cdcf45a000 20 4 1 10 -1 
> > 
> > In my test case, tcp_write_queue_head(sk) and tcp_send_head(sk) is  same
> > SKB.
> > And ((s32)(tcp_time_stamp(tp) - start_ts) >
> > jiffies_to_msecs(icsk->icsk_user_timeout))
> >  always is false.
> 
> Interesting.
> 
> >  Here use keepalive_time_elapsed(tp) to do the compare as
> > tcp_keepalive_timer do.
> 
> 
> But zero window probe and TCP_USER_TIMEOUT can be used without
> keepalives...
> 
> 
> A packetdrill test would help, I will write one.

So existing code seems to work :

# cat window-probe-without-data-user-timeout.pkt

    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
   +0 bind(3, ..., ...) = 0
   +0 listen(3, 1) = 0

   +0 < S 0:0(0) win 0 <mss 1460,sackOK,nop,nop,nop,wscale 7>
   +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>

// Client advertises a zero receive window, so we can't send.
  +.1 < . 1:1(0) ack 1 win 0
   +0 accept(3, ..., ...) = 4

   +0 setsockopt(4, SOL_TCP, TCP_USER_TIMEOUT, [3000], 4) = 0
   +0 write(4, ..., 2920) = 2920

// Window probes are scheduled just like RTOs.
  +.3~+.31 > . 0:0(0) ack 1
  +.6~+.62 > . 0:0(0) ack 1
 +1.2~+1.24 > . 0:0(0) ack 1
 +2.4~+2.48 > . 0:0(0) ack 1

# ./packetdrill window-probe-without-data-user_timeout.pkt
08:10:39.306137 IP 192.0.2.1.58149 > 192.168.79.31.8080: Flags [S], seq 0, win 0, options [mss 1460,sackOK,nop,nop,nop,wscale 7], length 0
08:10:39.306166 IP 192.168.79.31.8080 > 192.0.2.1.58149: Flags [S.], seq 3982794529, ack 1, win 29200, options [mss 1460,nop,nop,sackOK,nop,wscale 8], length 0
08:10:39.406296 IP 192.0.2.1.58149 > 192.168.79.31.8080: Flags [.], ack 1, win 0, length 0
08:10:39.716004 IP 192.168.79.31.8080 > 192.0.2.1.58149: Flags [.], ack 1, win 115, length 0
08:10:40.327133 IP 192.168.79.31.8080 > 192.0.2.1.58149: Flags [.], ack 1, win 115, length 0
08:10:41.540243 IP 192.168.79.31.8080 > 192.0.2.1.58149: Flags [.], ack 1, win 115, length 0

You can see we got only 3 probes, not 4.

  reply	other threads:[~2017-09-11 15:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-11  6:27 [PATCH] tcp: TCP_USER_TIMEOUT can not work in tcp_probe_timer() liujian56
2017-09-11 14:49 ` Eric Dumazet
2017-09-11 15:13   ` Eric Dumazet [this message]
2017-09-11 15:22     ` Eric Dumazet
2017-09-12  6:08       ` liujian
2017-09-12 15:05         ` Eric Dumazet
2017-09-12 15:38           ` Eric Dumazet
2017-09-13  6:56             ` liujian
2017-09-13  7:15               ` liujian
2017-09-13 14:40                 ` Eric Dumazet
2017-09-14  3:30                   ` [PATCH net] tcp: update skb->skb_mstamp more carefully Eric Dumazet
2017-09-14  8:17                     ` liujian
2017-09-14 13:57                     ` Neal Cardwell
2017-09-14 16:32                       ` Yuchung Cheng
2017-09-14 16:41                         ` Soheil Hassas Yeganeh
2017-09-15 21:37                     ` David Miller
2017-09-15 23:16                       ` Eric Dumazet
2017-09-15 23:47                         ` [PATCH net] tcp: fix data delivery rate Eric Dumazet
2017-09-16  1:33                           ` Soheil Hassas Yeganeh
2017-09-16 16:07                           ` David Miller

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=1505142785.15310.117.camel@edumazet-glaptop3.roam.corp.google.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkchu@google.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=liujian56@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=weiyongjun1@huawei.com \
    --cc=ycheng@google.com \
    --cc=yoshfuji@linux-ipv6.org \
    /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