]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: stmmac: add GSO MSS checks
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 1 Apr 2026 07:21:39 +0000 (08:21 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 2 Apr 2026 18:28:19 +0000 (11:28 -0700)
Add GSO MSS checks to stmmac_features_check().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1w7ptT-0000000EatI-3feh@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index c23de66227245cd1028197472d8cc886e11c3854..e6dff31188e6d09a272aee38249d5d06b01df743 100644 (file)
@@ -4391,12 +4391,19 @@ static size_t stmmac_tso_header_size(struct sk_buff *skb)
  *
  * While IPv4 is limited to MAC+VLAN+IPv4+ext+TCP+ext = 138 bytes, the IPv6
  * extension headers aren't similarly limited.
+ *
+ * Fall back to software GSO for these skbs. Also check that the MSS is >=
+ * the recommended 64 bytes (documented in ETH_DMACxCR register description),
+ * and that a the header plus MSS is not larger than 16383 (documented in
+ * "Building the Descriptor and the packet for the TSO feature").
  */
 static bool stmmac_tso_valid_packet(struct sk_buff *skb)
 {
        size_t header_len = stmmac_tso_header_size(skb);
+       unsigned int gso_size = skb_shinfo(skb)->gso_size;
 
-       return header_len <= 1023;
+       return header_len <= 1023 && gso_size >= 64 &&
+              header_len + gso_size < 16383;
 }
 
 /**