Patch "net-timestamp: support TCP GSO case for a few missing flags" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net-timestamp: support TCP GSO case for a few missing flags

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-timestamp-support-tcp-gso-case-for-a-few-missing.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f2538e27eb1d1f9670b7cb17d9362b201702b7d6
Author: Jason Xing <kerneljasonxing@xxxxxxxxx>
Date:   Tue Mar 4 08:44:29 2025 +0800

    net-timestamp: support TCP GSO case for a few missing flags
    
    [ Upstream commit 3c9231ea6497dfc50ac0ef69fff484da27d0df66 ]
    
    When I read through the TSO codes, I found out that we probably
    miss initializing the tx_flags of last seg when TSO is turned
    off, which means at the following points no more timestamp
    (for this last one) will be generated. There are three flags
    to be handled in this patch:
    1. SKBTX_HW_TSTAMP
    2. SKBTX_BPF
    3. SKBTX_SCHED_TSTAMP
    Note that SKBTX_BPF[1] was added in 6.14.0-rc2 by commit
    6b98ec7e882af ("bpf: Add BPF_SOCK_OPS_TSTAMP_SCHED_CB callback")
    and only belongs to net-next branch material for now. The common
    issue of the above three flags can be fixed by this single patch.
    
    This patch initializes the tx_flags to SKBTX_ANY_TSTAMP like what
    the UDP GSO does to make the newly segmented last skb inherit the
    tx_flags so that requested timestamp will be generated in each
    certain layer, or else that last one has zero value of tx_flags
    which leads to no timestamp at all.
    
    Fixes: 4ed2d765dfacc ("net-timestamp: TCP timestamping")
    Signed-off-by: Jason Xing <kerneljasonxing@xxxxxxxxx>
    Reviewed-by: Willem de Bruijn <willemb@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
index fc61cd3fea652..27b7887f4f4eb 100644
--- a/net/ipv4/tcp_offload.c
+++ b/net/ipv4/tcp_offload.c
@@ -11,12 +11,15 @@
 #include <net/tcp.h>
 #include <net/protocol.h>
 
-static void tcp_gso_tstamp(struct sk_buff *skb, unsigned int ts_seq,
+static void tcp_gso_tstamp(struct sk_buff *skb, struct sk_buff *gso_skb,
 			   unsigned int seq, unsigned int mss)
 {
+	u32 flags = skb_shinfo(gso_skb)->tx_flags & SKBTX_ANY_TSTAMP;
+	u32 ts_seq = skb_shinfo(gso_skb)->tskey;
+
 	while (skb) {
 		if (before(ts_seq, seq + mss)) {
-			skb_shinfo(skb)->tx_flags |= SKBTX_SW_TSTAMP;
+			skb_shinfo(skb)->tx_flags |= flags;
 			skb_shinfo(skb)->tskey = ts_seq;
 			return;
 		}
@@ -115,8 +118,8 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb,
 	th = tcp_hdr(skb);
 	seq = ntohl(th->seq);
 
-	if (unlikely(skb_shinfo(gso_skb)->tx_flags & SKBTX_SW_TSTAMP))
-		tcp_gso_tstamp(segs, skb_shinfo(gso_skb)->tskey, seq, mss);
+	if (unlikely(skb_shinfo(gso_skb)->tx_flags & SKBTX_ANY_TSTAMP))
+		tcp_gso_tstamp(segs, gso_skb, seq, mss);
 
 	newcheck = ~csum_fold((__force __wsum)((__force u32)th->check +
 					       (__force u32)delta));




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux