netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Cc: Daniel Lezcano <daniel.lezcano@free.fr>,
	Julian Anastasov <ja@ssi.bg>, David Miller <davem@davemloft.net>,
	Linux Netdev List <netdev@vger.kernel.org>
Subject: Re: getsockopt(TCP_DEFER_ACCEPT) value change
Date: Tue, 05 Jan 2010 15:45:26 +0100	[thread overview]
Message-ID: <4B435086.8030306@gmail.com> (raw)
In-Reply-To: <4B4348A7.4090509@gmail.com>

Le 05/01/2010 15:11, Eric Dumazet a écrit :

> Nothing... really... we can round the value, and we indeed round it in 2.6.32
> 
> defer value is given in second by user, and converted to number of retransmits by kernel.
> 
> Program assumption is wrong.

BTW, previous kernels were rounding too :

1 -> 3
2 -> 3
3 -> 3
4 -> 6
5 -> 6
6 -> 6
7 -> 12
8 -> 12
9 -> 12
10 -> 12
11 -> 12
12 -> 12
13 -> 24
14 -> 24
15 -> 24
16 -> 24
17 -> 24
18 -> 24
19 -> 24

New kernel (or other sysctl settings, I didnot check) :

1 -> 3
2 -> 3
3 -> 3
4 -> 9
5 -> 9
6 -> 9
7 -> 9
8 -> 9
9 -> 9
10 -> 21
11 -> 21
12 -> 21
13 -> 21
14 -> 21
15 -> 21
16 -> 21
17 -> 21
18 -> 21
19 -> 21

#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>

int main(int argc, char *argv[])
{
   int i, val1 = 12, val2;
   socklen_t len = sizeof(val2);
   int fd;
     fd = socket(PF_INET, SOCK_STREAM, 0);
   if (fd < 0) {
       perror("socket");
       return -1;
   }
   for (i = 1; i < 20 ; i++) {
     val1 = i;
     if (setsockopt(fd, SOL_TCP, TCP_DEFER_ACCEPT, &val1, sizeof(val1))) {
       perror("setsockopt");
       return -1;
     }
     if (getsockopt(fd, SOL_TCP, TCP_DEFER_ACCEPT, &val2, &len)) {
       perror("getsockopt");
       return -1;
     }
   printf("%d -> %d\n", i, val2);
   }
   return 0;
}


  reply	other threads:[~2010-01-05 14:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-05 10:42 getsockopt(TCP_DEFER_ACCEPT) value change Daniel Lezcano
2010-01-05 13:40 ` Ilpo Järvinen
2010-01-05 14:11   ` Eric Dumazet
2010-01-05 14:45     ` Eric Dumazet [this message]
2010-01-05 15:45     ` Daniel Lezcano
2010-01-05 16:14       ` Eric Dumazet
2010-01-05 16:57         ` Daniel Lezcano
2010-01-05 20:29   ` 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=4B435086.8030306@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=daniel.lezcano@free.fr \
    --cc=davem@davemloft.net \
    --cc=ilpo.jarvinen@helsinki.fi \
    --cc=ja@ssi.bg \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).