tcp: Add TCP_INFO counter for packets received out-of-order
Subsystems (3)
PATCH v3 1/2 tcp: Add TCP_INFO counter for packets received out-of-order
For receive-heavy cases on the server-side, we want to track the connection quality for individual client IPs. This counter, similar to the existing system-wide TCPOFOQueue counter in /proc/net/netstat, tracks out-of-order packet reception. By providing this counter in TCP_INFO, it will allow understanding to what degree receive-heavy sockets are experiencing out-of-order delivery and packet drops indicating congestion.
Please note that this is similar to the counter in NetBSD TCP_INFO, and has the same name.
--- include/linux/tcp.h | 2 ++ include/uapi/linux/tcp.h | 2 ++ net/ipv4/tcp.c | 2 ++ net/ipv4/tcp_input.c | 1 + 4 files changed, 7 insertions(+)
include/linux/tcp.h +2 -0
@@ -393,6 +393,8 @@ struct tcp_sock {*/ struct request_sock *fastopen_rsk;u32 *saved_syn; + +u32 rcv_ooopack;/* Received out-of-order packets, for tcpinfo */ };enum tsq_enum {
include/uapi/linux/tcp.h +2 -0
@@ -270,6 +270,8 @@ struct tcp_info {__u64 tcpi_bytes_retrans;/* RFC4898 tcpEStatsPerfOctetsRetrans */ __u32 tcpi_dsack_dups;/* RFC4898 tcpEStatsStackDSACKDups */ __u32 tcpi_reord_seen;/* reordering events seen */ + +__u32 tcpi_rcv_ooopack;/* Out-of-order packets received */ };/* netlink attributes types for SCM_TIMESTAMPING_OPT_STATS */
net/ipv4/tcp.c +2 -0
@@ -2653,6 +2653,7 @@ int tcp_disconnect(struct sock *sk, int flags) tp->rx_opt.saw_tstamp =0 ; tp->rx_opt.dsack =0 ; tp->rx_opt.num_sacks =0 ; + tp->rcv_ooopack =0 ;/* Clean up fastopen related fields */
@@ -3295,6 +3296,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) info->tcpi_bytes_retrans = tp->bytes_retrans; info->tcpi_dsack_dups = tp->dsack_dups; info->tcpi_reord_seen = tp->reord_seen; + info->tcpi_rcv_ooopack = tp->rcv_ooopack;unlock_sock_fast (sk, slow); }EXPORT_SYMBOL_GPL (tcp_get_info);
net/ipv4/tcp_input.c +1 -0
@@ -4555,6 +4555,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb) tp->pred_flags =0 ;inet_csk_schedule_ack (sk); + tp->rcv_ooopack +=max_t (u16,1 ,skb_shinfo (skb)->gso_segs);NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPOFOQUEUE ); seq =TCP_SKB_CB (skb)->seq; end_seq =TCP_SKB_CB (skb)->end_seq;
Signature · 1 line
2.17.1
PATCH v3 2/2 tcp: Add rcv_wnd to TCP_INFO
Neal Cardwell mentioned that rcv_wnd would be useful for helping diagnose whether a flow is receive-window-limited at a given instant.
This serves the purpose of adding an additional __u32 to avoid the would-be hole caused by the addition of the tcpi_rcvi_ooopack field.
--- include/uapi/linux/tcp.h | 1 + net/ipv4/tcp.c | 1 + 2 files changed, 2 insertions(+)
include/uapi/linux/tcp.h +1 -0
@@ -272,6 +272,7 @@ struct tcp_info {__u32 tcpi_reord_seen;/* reordering events seen */ __u32 tcpi_rcv_ooopack;/* Out-of-order packets received */ +__u32 tcpi_rcv_wnd;/* Receive window size */ };/* netlink attributes types for SCM_TIMESTAMPING_OPT_STATS */
net/ipv4/tcp.c +1 -0
@@ -3297,6 +3297,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) info->tcpi_dsack_dups = tp->dsack_dups; info->tcpi_reord_seen = tp->reord_seen; info->tcpi_rcv_ooopack = tp->rcv_ooopack; + info->tcpi_rcv_wnd = tp->rcv_wnd;unlock_sock_fast (sk, slow); }EXPORT_SYMBOL_GPL (tcp_get_info);
Signature · 1 line
2.17.1
Neal Cardwell
maintainerRe: [PATCH v3 2/2] tcp: Add rcv_wnd to TCP_INFO
Quoted 9 lines · Thomas Higdon
Neal Cardwell mentioned that
rcv_wndwould be useful for helping diagnose whether a flow is receive-window-limited at a given instant.This serves the purpose of adding an additional
__u32to avoid the would-be hole caused by the addition of thetcpi_rcvi_ooopackfield.Signed-off-by Thomas Higdon <[email protected]>---
Thanks, Thomas.
I know that when I mentioned this before I mentioned the idea of both tp->snd_wnd (send-side receive window) and tp->rcv_wnd (receive-side receive window) in tcp_info, and did not express a preference between the two. Now that we are faced with a decision between the two, personally I think it would be a little more useful to start with tp->snd_wnd. :-)
Two main reasons:
(1) Usually when we're diagnosing TCP performance problems, we do so from the sender, since the sender makes most of the performance-critical decisions (cwnd, pacing, TSO size, TSQ, etc). From the sender-side the thing that would be most useful is to see tp->snd_wnd, the receive window that the receiver has advertised to the sender.
(2) From the receiver side, "ss" can already show a fair amount of info about receive-side buffer/window limits, like:info->tcpi_rcv_ssthresh, info->tcpi_rcv_space, skmeminfo[SK_MEMINFO_RMEM_ALLOC], skmeminfo[SK_MEMINFO_RCVBUF]. Often the rwin can be approximated by combining those.
Hopefully Eric, Yuchung, and Soheil can weigh in on the question of snd_wnd vs rcv_wnd. Or we can perhaps think of another field, and add the tcpi_rcvi_ooopack, snd_wnd, rcv_wnd, and that final field, all together.
thanks,
neal
Re: [PATCH v3 2/2] tcp: Add rcv_wnd to TCP_INFO
Quoted 21 lines · Neal Cardwell
Quoted 9 lines · Thomas Higdon
Neal Cardwell mentioned that
rcv_wndwould be useful for helping diagnose whether a flow is receive-window-limited at a given instant.This serves the purpose of adding an additional
__u32to avoid the would-be hole caused by the addition of thetcpi_rcvi_ooopackfield.Signed-off-by Thomas Higdon <[email protected]>---
Thanks, Thomas.
I know that when I mentioned this before I mentioned the idea of both
tp->snd_wnd(send-side receive window) andtp->rcv_wnd(receive-side receive window) intcp_info, and did not express a preference between the two. Now that we are faced with a decision between the two, personally I think it would be a little more useful to start withtp->snd_wnd. :-)
Quoted 8 lines
Two main reasons:
(1) Usually when we're diagnosing TCP performance problems, we do so from the sender, since the sender makes most of the performance-critical decisions (cwnd, pacing, TSO size, TSQ, etc). From the sender-side the thing that would be most useful is to see
tp->snd_wnd, the receive window that the receiver has advertised to the sender.
I am under the impression, that particularly in the mobile space, that network behavior
is often governed by rcv_wnd. At least, there's been so many papers on this that I'd
tended to assume so.
Given a desire to do both vars, is there a *third* u32 we could add to fill in the next hole? :)
ecn marks?
Quoted 14 lines
(2) From the receiver side, "ss" can already show a fair amount of info about receive-side buffer/window limits, like:
info->tcpi_rcv_ssthresh,info->tcpi_rcv_space, skmeminfo[SK_MEMINFO_RMEM_ALLOC], skmeminfo[SK_MEMINFO_RCVBUF]. Often the rwin can be approximated by combining those.Hopefully Eric, Yuchung, and Soheil can weigh in on the question of
snd_wndvsrcv_wnd. Or we can perhaps think of another field, and add thetcpi_rcvi_ooopack,snd_wnd,rcv_wnd, and that final field, all together.thanks,
neal
Signature · 4 lines
Dave Täht CTO, TekLibre, LLC http://www.teklibre.com Tel: 1-831-205-9740
Re: [PATCH v3 2/2] tcp: Add rcv_wnd to TCP_INFO
Quoted 37 lines · Dave Taht
Quoted 21 lines · Neal Cardwell
Quoted 9 lines · Thomas Higdon
Neal Cardwell mentioned that
rcv_wndwould be useful for helping diagnose whether a flow is receive-window-limited at a given instant.This serves the purpose of adding an additional
__u32to avoid the would-be hole caused by the addition of thetcpi_rcvi_ooopackfield.Signed-off-by Thomas Higdon <[email protected]>---
Thanks, Thomas.
I know that when I mentioned this before I mentioned the idea of both
tp->snd_wnd(send-side receive window) andtp->rcv_wnd(receive-side receive window) intcp_info, and did not express a preference between the two. Now that we are faced with a decision between the two, personally I think it would be a little more useful to start withtp->snd_wnd. :-)Quoted 8 lines
Two main reasons:
(1) Usually when we're diagnosing TCP performance problems, we do so from the sender, since the sender makes most of the performance-critical decisions (cwnd, pacing, TSO size, TSQ, etc). From the sender-side the thing that would be most useful is to see
tp->snd_wnd, the receive window that the receiver has advertised to the sender.I am under the impression, that particularly in the mobile space, that network behavior
is often governed byrcv_wnd. At least, there's been so many papers on this that I'd
tended to assume so.
Quoted 3 lines
Given a desire to do both vars, is there a *third* u32 we could add to fill in the next hole? :)
ecn marks?
Neal makes some good points -- there is a fair amount of existing information for deriving receive window. It seems like snd_wnd would be more valuable at this moment. For the purpose of pairing up these __u32s to get something we can commit, I propose that we go with the rcv_ooopack/snd_wnd pair for now, and when something comes up later, one might consider pairing up rcv_wnd.
Neal Cardwell
maintainerRe: [PATCH v3 2/2] tcp: Add rcv_wnd to TCP_INFO
Quoted 43 lines · Thomas Higdon
Quoted 37 lines · Dave Taht
Quoted 21 lines · Neal Cardwell
Quoted 9 lines · Thomas Higdon
Neal Cardwell mentioned that
rcv_wndwould be useful for helping diagnose whether a flow is receive-window-limited at a given instant.This serves the purpose of adding an additional
__u32to avoid the would-be hole caused by the addition of thetcpi_rcvi_ooopackfield.Signed-off-by Thomas Higdon <[email protected]>---
Thanks, Thomas.
I know that when I mentioned this before I mentioned the idea of both
tp->snd_wnd(send-side receive window) andtp->rcv_wnd(receive-side receive window) intcp_info, and did not express a preference between the two. Now that we are faced with a decision between the two, personally I think it would be a little more useful to start withtp->snd_wnd. :-)Quoted 8 lines
Two main reasons:
(1) Usually when we're diagnosing TCP performance problems, we do so from the sender, since the sender makes most of the performance-critical decisions (cwnd, pacing, TSO size, TSQ, etc). From the sender-side the thing that would be most useful is to see
tp->snd_wnd, the receive window that the receiver has advertised to the sender.I am under the impression, that particularly in the mobile space, that network behavior
is often governed byrcv_wnd. At least, there's been so many papers on this that I'd
tended to assume so.Quoted 3 lines
Given a desire to do both vars, is there a *third* u32 we could add to fill in the next hole? :)
ecn marks?
Quoted 6 lines
Neal makes some good points -- there is a fair amount of existing information for deriving receive window. It seems like
snd_wndwould be more valuable at this moment. For the purpose of pairing up these__u32sto get something we can commit, I propose that we go with the rcv_ooopack/snd_wnd pair for now, and when something comes up later, one might consider pairing uprcv_wnd.
FWIW that sounds like a great plan to me. Thanks, Thomas!
neal