ipv4: Add option to get TCP_FASTOPEN to getsockopt()
Subsystems (3)
PATCH v2 1/1 ipv4: Add option to get TCP_FASTOPEN to getsockopt()
Hi,
TCP_FASTOPEN option can be set via setsockopt(), but the value cannot be gotten via getsockopt(). This patch adds the option to getsockopt().
Add option to get TCP_FASTOPEN to getsockopt()
--- net/ipv4/tcp.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/ipv4/tcp.c +7 -0
@@ -2916,6 +2916,13 @@ static int do_tcp_getsockopt(struct sock *sk, int level,case TCP_USER_TIMEOUT : val =jiffies_to_msecs (icsk->icsk_user_timeout);break ; + +case TCP_FASTOPEN : + val = icsk->icsk_accept_queue.fastopenq ? + icsk->icsk_accept_queue.fastopenq->max_qlen + : sysctl_tcp_fastopen; +break ; +case TCP_TIMESTAMP : val = tcp_time_stamp + tp->tsoffset;break ;
--
1.9.0
Quoted 31 lines · Kenjiro Nakayama
Hi,
TCP_FASTOPENoption can be set viasetsockopt(), but the value cannot be gotten viagetsockopt(). This patch adds the option togetsockopt().Sighned-off-by Kenjiro Nakayama <[email protected]>(quoted diff) +0
-1Add option to get TCP_FASTOPEN to getsockopt() --- net/ipv4/tcp.c | 7 +++++++ 1 file changed, 7 insertions(+)net/ipv4/tcp.c +7
-1@@ -2916,6 +2916,13 @@ static int do_tcp_getsockopt(struct sock *sk, int level,case TCP_USER_TIMEOUT : val =jiffies_to_msecs (icsk->icsk_user_timeout);break ; + +case TCP_FASTOPEN : + val = icsk->icsk_accept_queue.fastopenq ? + icsk->icsk_accept_queue.fastopenq->max_qlen + : sysctl_tcp_fastopen; +break ; +case TCP_TIMESTAMP : val = tcp_time_stamp + tp->tsoffset;break ; --
Quoted 1 line
1.9.0
I have no idea why you keep using sysctl_tcp_fastopen in your patches.
It seems you only want your application to
read /proc/sys/net/ipv4/tcp_fastopen ?
And you don't have CONFIG_PROC_FS maybe, and you add a workaround ?
As already mentioned, even if sysctl_tcp_fastopen is set to one, it does not mean this socket is fastopen enabled.
setsockopt()/getsockopt() for a given key should be symmetrical.
ie :
getsockopt(fd, SOL_TCP, TCP_FASTOPEN, &val, &len); setsockopt(fd, SOL_TCP, TCP_FASTOPEN, &val, sizeof(val));
should be a no operation. Its obviously not the case with your proposal.
Please address Neal concerns, and add in the changelog what is this option supposed to do _exactly_.
hint : max_qlen and sysctl_tcp_fastopen do not have the same units, its like comparing apples and oranges.
Thanks
Neal Cardwell
maintainerQuoted 1 line · Kenjiro Nakayama
Hi,
Please omit the "Hi," at the top of the patch description, so the top of the email can be used directly as a git commit description.
Quoted 4 lines
TCP_FASTOPENoption can be set viasetsockopt(), but the value cannot be gotten viagetsockopt(). This patch adds the option togetsockopt().Sighned-off-by Kenjiro Nakayama <[email protected]>
Typo: this should be "Signed-off-by:"
Quoted 1 line
Add option to get
TCP_FASTOPENtogetsockopt()
Likewise, please omit the extra descriptive text below the "Signed-off-by:" footer.
(And, of course, please note Eric's remarks as well...)
thanks,
neal