Merge branch 'mvneta-jumbo-frames'
authorDavid S. Miller <davem@davemloft.net>
Tue, 30 Jun 2015 16:37:10 +0000 (09:37 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 30 Jun 2015 16:37:10 +0000 (09:37 -0700)
Simon Guinot says:

====================
Fix Ethernet jumbo frames support for Armada 370 and 38x

This patch series fixes the Ethernet jumbo frames support for the SoCs
Armada 370, 380 and 385. Unlike Armada XP, the Ethernet controller for
this SoCs don't support TCP/IP checksumming with a frame size larger
than 1600 bytes.

This patches should be applied to the -stable kernels 3.8 and onwards.

Changes since v1:
- Use a new compatible string for the Ethernet IP found in Armada XP
  SoCs (instead of using an optional property).
- Fix the issue for the Armada 380 and 385 SoCs as well.

Changes since v2:
- Add Acked-by from Gregory Clement.
- Add "Fixes:" tag to each commits.

Changes since v3:
- Fix patch 3 name: replace prefix "ARM: mvebu:" with "net: mvneta:".
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
arch/arm/boot/dts/armada-370-xp.dtsi
arch/arm/boot/dts/armada-370.dtsi
arch/arm/boot/dts/armada-xp-mv78260.dtsi
arch/arm/boot/dts/armada-xp-mv78460.dtsi
arch/arm/boot/dts/armada-xp.dtsi
drivers/net/ethernet/marvell/mvneta.c

index 750d577e8083ee3f96c8bf823c986c162d4ac5b3..f5a8ca29aff06e84d49e3c75caf125b35c660055 100644 (file)
@@ -1,7 +1,7 @@
 * Marvell Armada 370 / Armada XP Ethernet Controller (NETA)
 
 Required properties:
-- compatible: should be "marvell,armada-370-neta".
+- compatible: "marvell,armada-370-neta" or "marvell,armada-xp-neta".
 - reg: address and length of the register set for the device.
 - interrupts: interrupt for the device
 - phy: See ethernet.txt file in the same directory.
index ec96f0b3634653a5976739688eca9fd791eaba0b..06a2f2ae9d1e4005acae33283dd18fd6a855d4e2 100644 (file)
                        };
 
                        eth0: ethernet@70000 {
-                               compatible = "marvell,armada-370-neta";
                                reg = <0x70000 0x4000>;
                                interrupts = <8>;
                                clocks = <&gateclk 4>;
                        };
 
                        eth1: ethernet@74000 {
-                               compatible = "marvell,armada-370-neta";
                                reg = <0x74000 0x4000>;
                                interrupts = <10>;
                                clocks = <&gateclk 3>;
index 00b50db57c9c0f7ab4111bbdba06d3fd0bdc93ad..ca4257b2f77dc3c64eee76acf5dff63a33978bcb 100644 (file)
                                        dmacap,memset;
                                };
                        };
+
+                       ethernet@70000 {
+                               compatible = "marvell,armada-370-neta";
+                       };
+
+                       ethernet@74000 {
+                               compatible = "marvell,armada-370-neta";
+                       };
                };
        };
 };
index 8479fdc9e9c2468e072c3592528a263610c2acc1..c5fdc99f0dbebb47f88e135a4013fdfb9d732772 100644 (file)
                        };
 
                        eth3: ethernet@34000 {
-                               compatible = "marvell,armada-370-neta";
+                               compatible = "marvell,armada-xp-neta";
                                reg = <0x34000 0x4000>;
                                interrupts = <14>;
                                clocks = <&gateclk 1>;
index 661d54c815802d1bb1d2e1fa31cb255d90caf12e..0e24f1a38540e30ccc257972537c8982074f4c75 100644 (file)
                        };
 
                        eth3: ethernet@34000 {
-                               compatible = "marvell,armada-370-neta";
+                               compatible = "marvell,armada-xp-neta";
                                reg = <0x34000 0x4000>;
                                interrupts = <14>;
                                clocks = <&gateclk 1>;
index 013d63f69e361e60bbe96466bec1883388155889..8fdd6d7c0ab12c3aa08697ade1a87518565cefc9 100644 (file)
                        };
 
                        eth2: ethernet@30000 {
-                               compatible = "marvell,armada-370-neta";
+                               compatible = "marvell,armada-xp-neta";
                                reg = <0x30000 0x4000>;
                                interrupts = <12>;
                                clocks = <&gateclk 2>;
                                };
                        };
 
+                       ethernet@70000 {
+                               compatible = "marvell,armada-xp-neta";
+                       };
+
+                       ethernet@74000 {
+                               compatible = "marvell,armada-xp-neta";
+                       };
+
                        xor@f0900 {
                                compatible = "marvell,orion-xor";
                                reg = <0xF0900 0x100
index 5bdf78231a4e78f09c360e4a2e5c0c7c5f82482b..370e20ed224c5c76eaca92954be5800d09d81ada 100644 (file)
@@ -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;
 };
 
@@ -2508,8 +2509,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
@@ -2538,9 +2541,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)
 {
@@ -2862,6 +2882,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,
 };
@@ -3107,6 +3128,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;
 
@@ -3185,6 +3209,7 @@ static int mvneta_remove(struct platform_device *pdev)
 
 static const struct of_device_id mvneta_match[] = {
        { .compatible = "marvell,armada-370-neta" },
+       { .compatible = "marvell,armada-xp-neta" },
        { }
 };
 MODULE_DEVICE_TABLE(of, mvneta_match);