* [PATCH] tcp: add SYN/data info to TCP_INFO
@ 2012-10-20 1:14 Yuchung Cheng
2012-10-20 2:11 ` Neal Cardwell
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yuchung Cheng @ 2012-10-20 1:14 UTC (permalink / raw)
To: davem, ncardwell, edumazet, hkchu; +Cc: netdev, Yuchung Cheng
Add a bit TCPI_OPT_SYN_DATA (32) to the socket option TCP_INFO:tcpi_options.
It's set if the data in SYN (sent or received) is acked by SYN-ACK. Server or
client application can use this information to check Fast Open success rate.
Signed-off-by: Yuchung Cheng <ycheng@google.com>
---
include/linux/tcp.h | 3 ++-
include/uapi/linux/tcp.h | 1 +
net/ipv4/tcp.c | 2 ++
net/ipv4/tcp_input.c | 1 +
net/ipv4/tcp_ipv4.c | 1 +
net/ipv4/tcp_minisocks.c | 1 +
6 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 8a7fc4b..60b7aac 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -191,7 +191,8 @@ struct tcp_sock {
u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */
early_retrans_delayed:1, /* Delayed ER timer installed */
syn_data:1, /* SYN includes data */
- syn_fastopen:1; /* SYN includes Fast Open option */
+ syn_fastopen:1, /* SYN includes Fast Open option */
+ syn_data_acked:1;/* data in SYN is acked by SYN-ACK */
/* RTT measurement */
u32 srtt; /* smoothed round trip time << 3 */
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
index c4b89a5..e962faa 100644
--- a/include/uapi/linux/tcp.h
+++ b/include/uapi/linux/tcp.h
@@ -130,6 +130,7 @@ enum {
#define TCPI_OPT_WSCALE 4
#define TCPI_OPT_ECN 8 /* ECN was negociated at TCP session init */
#define TCPI_OPT_ECN_SEEN 16 /* we received at least one packet with ECT */
+#define TCPI_OPT_SYN_DATA 32 /* SYN-ACK acked data in SYN sent or rcvd */
enum tcp_ca_state {
TCP_CA_Open = 0,
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index b7c2f43..197c000 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2764,6 +2764,8 @@ void tcp_get_info(const struct sock *sk, struct tcp_info *info)
info->tcpi_options |= TCPI_OPT_ECN;
if (tp->ecn_flags & TCP_ECN_SEEN)
info->tcpi_options |= TCPI_OPT_ECN_SEEN;
+ if (tp->syn_data_acked)
+ info->tcpi_options |= TCPI_OPT_SYN_DATA;
info->tcpi_rto = jiffies_to_usecs(icsk->icsk_rto);
info->tcpi_ato = jiffies_to_usecs(icsk->icsk_ack.ato);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 432c366..036f857 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5646,6 +5646,7 @@ static bool tcp_rcv_fastopen_synack(struct sock *sk, struct sk_buff *synack,
tcp_rearm_rto(sk);
return true;
}
+ tp->syn_data_acked = tp->syn_data;
return false;
}
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index ef998b0..0c4a643 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1461,6 +1461,7 @@ static int tcp_v4_conn_req_fastopen(struct sock *sk,
skb_set_owner_r(skb, child);
__skb_queue_tail(&child->sk_receive_queue, skb);
tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
+ tp->syn_data_acked = 1;
}
sk->sk_data_ready(sk, 0);
bh_unlock_sock(child);
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 27536ba..a7302d9 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -510,6 +510,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
newtp->rx_opt.mss_clamp = req->mss;
TCP_ECN_openreq_child(newtp, req);
newtp->fastopen_rsk = NULL;
+ newtp->syn_data_acked = 0;
TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_PASSIVEOPENS);
}
--
1.7.7.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] tcp: add SYN/data info to TCP_INFO
2012-10-20 1:14 [PATCH] tcp: add SYN/data info to TCP_INFO Yuchung Cheng
@ 2012-10-20 2:11 ` Neal Cardwell
2012-10-20 7:50 ` Eric Dumazet
2012-10-22 19:16 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Neal Cardwell @ 2012-10-20 2:11 UTC (permalink / raw)
To: Yuchung Cheng; +Cc: David Miller, Eric Dumazet, Jerry Chu, Netdev
On Fri, Oct 19, 2012 at 9:14 PM, Yuchung Cheng <ycheng@google.com> wrote:
> Add a bit TCPI_OPT_SYN_DATA (32) to the socket option TCP_INFO:tcpi_options.
> It's set if the data in SYN (sent or received) is acked by SYN-ACK. Server or
> client application can use this information to check Fast Open success rate.
>
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
neal
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tcp: add SYN/data info to TCP_INFO
2012-10-20 1:14 [PATCH] tcp: add SYN/data info to TCP_INFO Yuchung Cheng
2012-10-20 2:11 ` Neal Cardwell
@ 2012-10-20 7:50 ` Eric Dumazet
2012-10-22 19:16 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2012-10-20 7:50 UTC (permalink / raw)
To: Yuchung Cheng; +Cc: davem, ncardwell, edumazet, hkchu, netdev
On Fri, 2012-10-19 at 18:14 -0700, Yuchung Cheng wrote:
> Add a bit TCPI_OPT_SYN_DATA (32) to the socket option TCP_INFO:tcpi_options.
> It's set if the data in SYN (sent or received) is acked by SYN-ACK. Server or
> client application can use this information to check Fast Open success rate.
>
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
> ---
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tcp: add SYN/data info to TCP_INFO
2012-10-20 1:14 [PATCH] tcp: add SYN/data info to TCP_INFO Yuchung Cheng
2012-10-20 2:11 ` Neal Cardwell
2012-10-20 7:50 ` Eric Dumazet
@ 2012-10-22 19:16 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-10-22 19:16 UTC (permalink / raw)
To: ycheng; +Cc: ncardwell, edumazet, hkchu, netdev
From: Yuchung Cheng <ycheng@google.com>
Date: Fri, 19 Oct 2012 18:14:44 -0700
> Add a bit TCPI_OPT_SYN_DATA (32) to the socket option TCP_INFO:tcpi_options.
> It's set if the data in SYN (sent or received) is acked by SYN-ACK. Server or
> client application can use this information to check Fast Open success rate.
>
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
Applied to 'net'
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-10-22 19:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-20 1:14 [PATCH] tcp: add SYN/data info to TCP_INFO Yuchung Cheng
2012-10-20 2:11 ` Neal Cardwell
2012-10-20 7:50 ` Eric Dumazet
2012-10-22 19:16 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox