Skip to content

Commit b65657f

Browse files
simonguinotdavem330
authored andcommitted
net: mvneta: disable IP checksum with jumbo frames for Armada 370
The Ethernet controller found in the Armada 370, 380 and 385 SoCs don't support TCP/IP checksumming with frame sizes larger than 1600 bytes. This patch fixes the issue by disabling the features NETIF_F_IP_CSUM and NETIF_F_TSO for the Armada 370 and compatibles SoCs when the MTU is set to a value greater than 1600 bytes. Signed-off-by: Simon Guinot <simon.guinot@sequanux.org> Fixes: c5aff18 ("net: mvneta: driver for Marvell Armada 370/XP network unit") Cc: <stable@vger.kernel.org> # v3.8+ Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ea3b55f commit b65657f

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

drivers/net/ethernet/marvell/mvneta.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ struct mvneta_port {
310310
unsigned int link;
311311
unsigned int duplex;
312312
unsigned int speed;
313+
unsigned int tx_csum_limit;
313314
int use_inband_status:1;
314315
};
315316

@@ -2508,8 +2509,10 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu)
25082509

25092510
dev->mtu = mtu;
25102511

2511-
if (!netif_running(dev))
2512+
if (!netif_running(dev)) {
2513+
netdev_update_features(dev);
25122514
return 0;
2515+
}
25132516

25142517
/* The interface is running, so we have to force a
25152518
* reallocation of the queues
@@ -2538,9 +2541,26 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu)
25382541
mvneta_start_dev(pp);
25392542
mvneta_port_up(pp);
25402543

2544+
netdev_update_features(dev);
2545+
25412546
return 0;
25422547
}
25432548

2549+
static netdev_features_t mvneta_fix_features(struct net_device *dev,
2550+
netdev_features_t features)
2551+
{
2552+
struct mvneta_port *pp = netdev_priv(dev);
2553+
2554+
if (pp->tx_csum_limit && dev->mtu > pp->tx_csum_limit) {
2555+
features &= ~(NETIF_F_IP_CSUM | NETIF_F_TSO);
2556+
netdev_info(dev,
2557+
"Disable IP checksum for MTU greater than %dB\n",
2558+
pp->tx_csum_limit);
2559+
}
2560+
2561+
return features;
2562+
}
2563+
25442564
/* Get mac address */
25452565
static void mvneta_get_mac_addr(struct mvneta_port *pp, unsigned char *addr)
25462566
{
@@ -2862,6 +2882,7 @@ static const struct net_device_ops mvneta_netdev_ops = {
28622882
.ndo_set_rx_mode = mvneta_set_rx_mode,
28632883
.ndo_set_mac_address = mvneta_set_mac_addr,
28642884
.ndo_change_mtu = mvneta_change_mtu,
2885+
.ndo_fix_features = mvneta_fix_features,
28652886
.ndo_get_stats64 = mvneta_get_stats64,
28662887
.ndo_do_ioctl = mvneta_ioctl,
28672888
};
@@ -3107,6 +3128,9 @@ static int mvneta_probe(struct platform_device *pdev)
31073128
}
31083129
}
31093130

3131+
if (of_device_is_compatible(dn, "marvell,armada-370-neta"))
3132+
pp->tx_csum_limit = 1600;
3133+
31103134
pp->tx_ring_size = MVNETA_MAX_TXD;
31113135
pp->rx_ring_size = MVNETA_MAX_RXD;
31123136

0 commit comments

Comments
 (0)