tcp: inherit timestamp on mtu probe [Linux 4.9.192]

This Linux kernel change "tcp: inherit timestamp on mtu probe" is included in the Linux 4.9.192 release. This change is authored by Willem de Bruijn <willemb [at]> on Tue Aug 27 15:09:33 2019 -0400. The commit for this change in Linux stable tree is 217fc82 (patch) which is from upstream commit 888a5c5. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 888a5c5.

tcp: inherit timestamp on mtu probe

[ Upstream commit 888a5c53c0d8be6e98bc85b677f179f77a647873 ]

TCP associates tx timestamp requests with a byte in the bytestream.
If merging skbs in tcp_mtu_probe, migrate the tstamp request.

Similar to MSG_EOR, do not allow moving a timestamp from any segment
in the probe but the last. This to avoid merging multiple timestamps.

Tested with the packetdrill script at

Fixes: 4ed2d765dfac ("net-timestamp: TCP timestamping")
Signed-off-by: Willem de Bruijn <>
Signed-off-by: Eric Dumazet <>
Signed-off-by: David S. Miller <>
Signed-off-by: Greg Kroah-Hartman <>

There are 3 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/ipv4/tcp_output.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 9ddb05b..2e77e78 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1943,7 +1943,7 @@ static bool tcp_can_coalesce_send_queue_head(struct sock *sk, int len)
        if (len <= skb->len)

-       if (unlikely(TCP_SKB_CB(skb)->eor))
+       if (unlikely(TCP_SKB_CB(skb)->eor) || tcp_has_tx_tstamp(skb))
            return false;

        len -= skb->len;
@@ -2066,6 +2066,7 @@ static int tcp_mtu_probe(struct sock *sk)
             * we need to propagate it to the new skb.
            TCP_SKB_CB(nskb)->eor = TCP_SKB_CB(skb)->eor;
+           tcp_skb_collapse_tstamp(nskb, skb);
            tcp_unlink_write_queue(skb, sk);
            sk_wmem_free_skb(sk, skb);
        } else {

Leave a Reply

Your email address will not be published. Required fields are marked *