mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
net: stmmac: drop gso_enabled_types and rely on netdev features
The gso_enabled_types field is used by stmmac_xmit() to decide whether a
GSO skb should be passed to stmmac_tso_xmit(). It is updated in
stmmac_set_features() based solely on NETIF_F_TSO, so disabling IPv4
TSO while keeping IPv6 TSO (NETIF_F_TSO6) enabled zeroes the mask. As a
result IPv6 GSO frames, which the networking stack still generates since
NETIF_F_TSO6 is enabled, fall through to the non-TSO xmit path where
they are not handled.
The networking stack already manages the GSO logic: a GSO skb is only
delivered to the driver when the matching offload feature (NETIF_F_TSO,
NETIF_F_TSO6 or NETIF_F_GSO_UDP_L4) is enabled, otherwise the frame is
segmented in software before reaching ndo_start_xmit().
stmmac_features_check() also validates each GSO frame against the TSO
hardware constraints and falls back to software GSO when they are not met.
Drop the gso_enabled_types field and rely on skb_is_gso() in
stmmac_xmit() instead, which correctly routes IPv6 GSO frames to the TSO
path when NETIF_F_TSO is disabled. This also removes the data race
between stmmac_set_gso_types(), called from the feature-set path, and
the lockless read of gso_enabled_types in stmmac_xmit().
Fixes: 2e4082e4b7 ("net: stmmac: simplify GSO/TSO test in stmmac_xmit()")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20260824-stmmac-fix-tso6-features-v3-1-c73a7a4a0ec7@oss.qualcomm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
6fe66698b9
commit
9c24a504a3
|
|
@ -265,8 +265,6 @@ struct stmmac_priv {
|
|||
u32 rx_coal_frames[MTL_MAX_RX_QUEUES];
|
||||
|
||||
int hwts_tx_en;
|
||||
/* skb_shinfo(skb)->gso_type types that we handle */
|
||||
unsigned int gso_enabled_types;
|
||||
bool tx_path_in_lpi_mode;
|
||||
bool sph_active;
|
||||
bool sph_capable;
|
||||
|
|
|
|||
|
|
@ -4376,18 +4376,6 @@ static void stmmac_flush_tx_descriptors(struct stmmac_priv *priv, int queue)
|
|||
stmmac_set_queue_tx_tail_ptr(priv, tx_q, queue, tx_q->cur_tx);
|
||||
}
|
||||
|
||||
static void stmmac_set_gso_types(struct stmmac_priv *priv, bool tso)
|
||||
{
|
||||
if (!tso) {
|
||||
priv->gso_enabled_types = 0;
|
||||
} else {
|
||||
/* Manage oversized TCP frames for GMAC4 device */
|
||||
priv->gso_enabled_types = SKB_GSO_TCPV4 | SKB_GSO_TCPV6;
|
||||
if (priv->plat->core_type == DWMAC_CORE_GMAC4)
|
||||
priv->gso_enabled_types |= SKB_GSO_UDP_L4;
|
||||
}
|
||||
}
|
||||
|
||||
static void stmmac_set_gso_features(struct net_device *ndev)
|
||||
{
|
||||
struct stmmac_priv *priv = netdev_priv(ndev);
|
||||
|
|
@ -4421,8 +4409,6 @@ static void stmmac_set_gso_features(struct net_device *ndev)
|
|||
if (priv->plat->core_type == DWMAC_CORE_GMAC4)
|
||||
ndev->hw_features |= NETIF_F_GSO_UDP_L4;
|
||||
|
||||
stmmac_set_gso_types(priv, true);
|
||||
|
||||
dev_info(priv->device, "TSO feature enabled\n");
|
||||
}
|
||||
|
||||
|
|
@ -4772,8 +4758,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
if (priv->tx_path_in_lpi_mode && priv->eee_sw_timer_en)
|
||||
stmmac_stop_sw_lpi(priv);
|
||||
|
||||
if (skb_is_gso(skb) &&
|
||||
skb_shinfo(skb)->gso_type & priv->gso_enabled_types)
|
||||
if (skb_is_gso(skb))
|
||||
return stmmac_tso_xmit(skb, dev);
|
||||
|
||||
if (priv->est && priv->est->enable &&
|
||||
|
|
@ -6207,8 +6192,6 @@ static int stmmac_set_features(struct net_device *netdev,
|
|||
stmmac_enable_sph(priv, priv->ioaddr, sph_en, chan);
|
||||
}
|
||||
|
||||
stmmac_set_gso_types(priv, features & NETIF_F_TSO);
|
||||
|
||||
if (features & NETIF_F_HW_VLAN_CTAG_RX)
|
||||
priv->hw->hw_vlan_en = true;
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user