netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v0 1/1] net: mv643xx_eth: disable IP tx checksum with jumbo frames for Armada 310
@ 2024-11-13 11:00 Qingtao Cao
  2024-11-15  3:24 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Qingtao Cao @ 2024-11-13 11:00 UTC (permalink / raw)
  Cc: Qingtao Cao, Sebastian Hesselbarth, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

The Ethernet controller found in Armada 310 doesn't support TCP/IP checksum
with frame sizes larger than its TX checksum offload limit

Disable the features NETIF_F_IP_CSUM and NETIF_F_TSO when the MTU is set to
a value larger than this limit, to prevent the software TSO generating GSO
packets that are not suitable to offload to the Ethernet controller, which
would be calculated by the IP stack instead.

Signed-off-by: Qingtao Cao <qingtao.cao@digi.com>
---
 drivers/net/ethernet/marvell/mv643xx_eth.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 9e80899546d9..34d464f0be1b 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2563,6 +2563,13 @@ static int mv643xx_eth_change_mtu(struct net_device *dev, int new_mtu)
 	struct mv643xx_eth_private *mp = netdev_priv(dev);
 
 	WRITE_ONCE(dev->mtu, new_mtu);
+	if (mp->shared->tx_csum_limit &&
+	    dev->mtu > mp->shared->tx_csum_limit) {
+		dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_TSO);
+		netdev_info(dev,
+			    "Disable IP tx csum offload and software TSO for MTU larger than %dB\n",
+			    mp->shared->tx_csum_limit);
+	}
 	mv643xx_eth_recalc_skb_size(mp);
 	tx_set_rate(mp, 1000000000, 16777216);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next v0 1/1] net: mv643xx_eth: disable IP tx checksum with jumbo frames for Armada 310
  2024-11-13 11:00 [PATCH net-next v0 1/1] net: mv643xx_eth: disable IP tx checksum with jumbo frames for Armada 310 Qingtao Cao
@ 2024-11-15  3:24 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2024-11-15  3:24 UTC (permalink / raw)
  To: Qingtao Cao
  Cc: Qingtao Cao, Sebastian Hesselbarth, Andrew Lunn, David S. Miller,
	Eric Dumazet, Paolo Abeni, netdev, linux-kernel

On Wed, 13 Nov 2024 21:00:40 +1000 Qingtao Cao wrote:
> The Ethernet controller found in Armada 310 doesn't support TCP/IP checksum
> with frame sizes larger than its TX checksum offload limit
> 
> Disable the features NETIF_F_IP_CSUM and NETIF_F_TSO when the MTU is set to
> a value larger than this limit, to prevent the software TSO generating GSO
> packets that are not suitable to offload to the Ethernet controller, which
> would be calculated by the IP stack instead.

Did you consider disabling it per packet using .ndo_features_check ?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-15  3:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-13 11:00 [PATCH net-next v0 1/1] net: mv643xx_eth: disable IP tx checksum with jumbo frames for Armada 310 Qingtao Cao
2024-11-15  3:24 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).