From: Simon Guinot <simon.guinot@sequanux.org> To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>, Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>, Gregory Clement <gregory.clement@free-electrons.com>, Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Vincent Donnefort <vdonnefort@gmail.com>, <stable@vger.kernel.org> Subject: [PATCH v2 3/3] ARM: mvebu: disable IP checksum with jumbo frames for Armada 370 Date: Wed, 17 Jun 2015 15:19:22 +0200 [thread overview] Message-ID: <1434547162-6275-4-git-send-email-simon.guinot@sequanux.org> (raw) In-Reply-To: <1434547162-6275-1-git-send-email-simon.guinot@sequanux.org> 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> Cc: <stable@vger.kernel.org> # v3.8+ --- drivers/net/ethernet/marvell/mvneta.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index aceb977b104d..9b2b7478fe47 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -310,6 +310,7 @@ struct mvneta_port { unsigned int link; unsigned int duplex; unsigned int speed; + unsigned int tx_csum_limit; int use_inband_status:1; }; @@ -2502,8 +2503,10 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu) dev->mtu = mtu; - if (!netif_running(dev)) + if (!netif_running(dev)) { + netdev_update_features(dev); return 0; + } /* The interface is running, so we have to force a * reallocation of the queues @@ -2532,9 +2535,26 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu) mvneta_start_dev(pp); mvneta_port_up(pp); + netdev_update_features(dev); + return 0; } +static netdev_features_t mvneta_fix_features(struct net_device *dev, + netdev_features_t features) +{ + struct mvneta_port *pp = netdev_priv(dev); + + if (pp->tx_csum_limit && dev->mtu > pp->tx_csum_limit) { + features &= ~(NETIF_F_IP_CSUM | NETIF_F_TSO); + netdev_info(dev, + "Disable IP checksum for MTU greater than %dB\n", + pp->tx_csum_limit); + } + + return features; +} + /* Get mac address */ static void mvneta_get_mac_addr(struct mvneta_port *pp, unsigned char *addr) { @@ -2856,6 +2876,7 @@ static const struct net_device_ops mvneta_netdev_ops = { .ndo_set_rx_mode = mvneta_set_rx_mode, .ndo_set_mac_address = mvneta_set_mac_addr, .ndo_change_mtu = mvneta_change_mtu, + .ndo_fix_features = mvneta_fix_features, .ndo_get_stats64 = mvneta_get_stats64, .ndo_do_ioctl = mvneta_ioctl, }; @@ -3101,6 +3122,9 @@ static int mvneta_probe(struct platform_device *pdev) } } + if (of_device_is_compatible(dn, "marvell,armada-370-neta")) + pp->tx_csum_limit = 1600; + pp->tx_ring_size = MVNETA_MAX_TXD; pp->rx_ring_size = MVNETA_MAX_RXD; -- 2.1.4
WARNING: multiple messages have this Message-ID (diff)
From: simon.guinot@sequanux.org (Simon Guinot) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/3] ARM: mvebu: disable IP checksum with jumbo frames for Armada 370 Date: Wed, 17 Jun 2015 15:19:22 +0200 [thread overview] Message-ID: <1434547162-6275-4-git-send-email-simon.guinot@sequanux.org> (raw) In-Reply-To: <1434547162-6275-1-git-send-email-simon.guinot@sequanux.org> 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> Cc: <stable@vger.kernel.org> # v3.8+ --- drivers/net/ethernet/marvell/mvneta.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index aceb977b104d..9b2b7478fe47 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -310,6 +310,7 @@ struct mvneta_port { unsigned int link; unsigned int duplex; unsigned int speed; + unsigned int tx_csum_limit; int use_inband_status:1; }; @@ -2502,8 +2503,10 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu) dev->mtu = mtu; - if (!netif_running(dev)) + if (!netif_running(dev)) { + netdev_update_features(dev); return 0; + } /* The interface is running, so we have to force a * reallocation of the queues @@ -2532,9 +2535,26 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu) mvneta_start_dev(pp); mvneta_port_up(pp); + netdev_update_features(dev); + return 0; } +static netdev_features_t mvneta_fix_features(struct net_device *dev, + netdev_features_t features) +{ + struct mvneta_port *pp = netdev_priv(dev); + + if (pp->tx_csum_limit && dev->mtu > pp->tx_csum_limit) { + features &= ~(NETIF_F_IP_CSUM | NETIF_F_TSO); + netdev_info(dev, + "Disable IP checksum for MTU greater than %dB\n", + pp->tx_csum_limit); + } + + return features; +} + /* Get mac address */ static void mvneta_get_mac_addr(struct mvneta_port *pp, unsigned char *addr) { @@ -2856,6 +2876,7 @@ static const struct net_device_ops mvneta_netdev_ops = { .ndo_set_rx_mode = mvneta_set_rx_mode, .ndo_set_mac_address = mvneta_set_mac_addr, .ndo_change_mtu = mvneta_change_mtu, + .ndo_fix_features = mvneta_fix_features, .ndo_get_stats64 = mvneta_get_stats64, .ndo_do_ioctl = mvneta_ioctl, }; @@ -3101,6 +3122,9 @@ static int mvneta_probe(struct platform_device *pdev) } } + if (of_device_is_compatible(dn, "marvell,armada-370-neta")) + pp->tx_csum_limit = 1600; + pp->tx_ring_size = MVNETA_MAX_TXD; pp->rx_ring_size = MVNETA_MAX_RXD; -- 2.1.4
next prev parent reply other threads:[~2015-06-17 13:19 UTC|newest] Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-06-17 13:19 [PATCH v2 0/3] Fix Ethernet jumbo frames support for Armada 370 and 38x Simon Guinot 2015-06-17 13:19 ` Simon Guinot 2015-06-17 13:19 ` [PATCH v2 1/3] net: mvneta: introduce compatible string "marvell,armada-xp-neta" Simon Guinot 2015-06-17 13:19 ` [PATCH v2 1/3] net: mvneta: introduce compatible string "marvell, armada-xp-neta" Simon Guinot 2015-06-17 15:12 ` [PATCH v2 1/3] net: mvneta: introduce compatible string "marvell,armada-xp-neta" Gregory CLEMENT 2015-06-17 15:12 ` [PATCH v2 1/3] net: mvneta: introduce compatible string "marvell, armada-xp-neta" Gregory CLEMENT 2015-06-17 15:15 ` Gregory CLEMENT 2015-06-17 15:15 ` Gregory CLEMENT 2015-06-17 17:01 ` Jason Cooper 2015-06-17 17:01 ` Jason Cooper 2015-06-17 20:43 ` Thomas Petazzoni 2015-06-17 20:43 ` Thomas Petazzoni 2015-06-17 21:39 ` Jason Cooper 2015-06-17 21:39 ` Jason Cooper 2015-06-17 21:39 ` Jason Cooper 2015-06-18 7:31 ` Thomas Petazzoni 2015-06-18 7:31 ` Thomas Petazzoni 2015-06-19 12:32 ` Simon Guinot 2015-06-19 12:32 ` Simon Guinot 2015-06-25 9:13 ` Simon Guinot 2015-06-25 9:13 ` Simon Guinot 2015-06-25 13:20 ` Jason Cooper 2015-06-25 13:20 ` Jason Cooper 2015-06-29 13:03 ` Gregory CLEMENT 2015-06-29 13:03 ` Gregory CLEMENT 2015-06-29 13:03 ` [PATCH v2 1/3] net: mvneta: introduce compatible string "marvell,armada-xp-neta" Gregory CLEMENT 2015-06-29 13:03 ` [PATCH v2 1/3] net: mvneta: introduce compatible string "marvell, armada-xp-neta" Gregory CLEMENT 2015-06-17 13:19 ` [PATCH v2 2/3] ARM: mvebu: update Ethernet compatible string for Armada XP Simon Guinot 2015-06-17 13:19 ` Simon Guinot 2015-06-29 13:04 ` Gregory CLEMENT 2015-06-29 13:04 ` Gregory CLEMENT 2015-06-17 13:19 ` Simon Guinot [this message] 2015-06-17 13:19 ` [PATCH v2 3/3] ARM: mvebu: disable IP checksum with jumbo frames for Armada 370 Simon Guinot 2015-06-17 15:24 ` [PATCH v2 0/3] Fix Ethernet jumbo frames support for Armada 370 and 38x Thomas Petazzoni 2015-06-17 15:24 ` Thomas Petazzoni 2015-06-17 17:22 ` Simon Guinot 2015-06-17 17:22 ` Simon Guinot 2015-06-17 20:43 ` Thomas Petazzoni 2015-06-17 20:43 ` Thomas Petazzoni
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1434547162-6275-4-git-send-email-simon.guinot@sequanux.org \ --to=simon.guinot@sequanux.org \ --cc=andrew@lunn.ch \ --cc=gregory.clement@free-electrons.com \ --cc=jason@lakedaemon.net \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=netdev@vger.kernel.org \ --cc=sebastian.hesselbarth@gmail.com \ --cc=stable@vger.kernel.org \ --cc=thomas.petazzoni@free-electrons.com \ --cc=vdonnefort@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.