mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
net: stmmac: add TSO check for header length
According to the STM32MP151 documentation which covers dwmac v4.2, the hardware TSO feature can handle header lengths up to a maximum of 1023 bytes. Add a .ndo_features_check() method implementation to check the header length meets these requirements, otherwise fall back to software GSO. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://patch.msgid.link/E1w7ptO-0000000EatC-39il@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
f799b5dab9
commit
6732e474f8
|
|
@ -4385,6 +4385,20 @@ static size_t stmmac_tso_header_size(struct sk_buff *skb)
|
|||
return size;
|
||||
}
|
||||
|
||||
/* STM32MP151 (dwmac v4.2) and STM32MP25xx (dwmac v5.3) states for TDES2 normal
|
||||
* (read format) descriptor that the maximum header length supported for the
|
||||
* TSO feature is 1023 bytes.
|
||||
*
|
||||
* While IPv4 is limited to MAC+VLAN+IPv4+ext+TCP+ext = 138 bytes, the IPv6
|
||||
* extension headers aren't similarly limited.
|
||||
*/
|
||||
static bool stmmac_tso_valid_packet(struct sk_buff *skb)
|
||||
{
|
||||
size_t header_len = stmmac_tso_header_size(skb);
|
||||
|
||||
return header_len <= 1023;
|
||||
}
|
||||
|
||||
/**
|
||||
* stmmac_tso_xmit - Tx entry point of the driver for oversized frames (TSO)
|
||||
* @skb : the socket buffer
|
||||
|
|
@ -4945,7 +4959,8 @@ static netdev_features_t stmmac_features_check(struct sk_buff *skb,
|
|||
|
||||
if (skb_is_gso(skb)) {
|
||||
queue = skb_get_queue_mapping(skb);
|
||||
if (!stmmac_tso_channel_permitted(netdev_priv(dev), queue))
|
||||
if (!stmmac_tso_channel_permitted(netdev_priv(dev), queue) ||
|
||||
!stmmac_tso_valid_packet(skb))
|
||||
features &= ~NETIF_F_GSO_MASK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user