Skip to content

Commit 7f4ef97

Browse files
committed
Merge branch 'mvneta-jumbo-frames'
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>
2 parents 279c6c7 + b65657f commit 7f4ef97

File tree

7 files changed

+46
-7
lines changed

7 files changed

+46
-7
lines changed

Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
* Marvell Armada 370 / Armada XP Ethernet Controller (NETA)
22

33
Required properties:
4-
- compatible: should be "marvell,armada-370-neta".
4+
- compatible: "marvell,armada-370-neta" or "marvell,armada-xp-neta".
55
- reg: address and length of the register set for the device.
66
- interrupts: interrupt for the device
77
- phy: See ethernet.txt file in the same directory.

arch/arm/boot/dts/armada-370-xp.dtsi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@
270270
};
271271

272272
eth0: ethernet@70000 {
273-
compatible = "marvell,armada-370-neta";
274273
reg = <0x70000 0x4000>;
275274
interrupts = <8>;
276275
clocks = <&gateclk 4>;
@@ -286,7 +285,6 @@
286285
};
287286

288287
eth1: ethernet@74000 {
289-
compatible = "marvell,armada-370-neta";
290288
reg = <0x74000 0x4000>;
291289
interrupts = <10>;
292290
clocks = <&gateclk 3>;

arch/arm/boot/dts/armada-370.dtsi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,14 @@
307307
dmacap,memset;
308308
};
309309
};
310+
311+
ethernet@70000 {
312+
compatible = "marvell,armada-370-neta";
313+
};
314+
315+
ethernet@74000 {
316+
compatible = "marvell,armada-370-neta";
317+
};
310318
};
311319
};
312320
};

arch/arm/boot/dts/armada-xp-mv78260.dtsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@
318318
};
319319

320320
eth3: ethernet@34000 {
321-
compatible = "marvell,armada-370-neta";
321+
compatible = "marvell,armada-xp-neta";
322322
reg = <0x34000 0x4000>;
323323
interrupts = <14>;
324324
clocks = <&gateclk 1>;

arch/arm/boot/dts/armada-xp-mv78460.dtsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@
356356
};
357357

358358
eth3: ethernet@34000 {
359-
compatible = "marvell,armada-370-neta";
359+
compatible = "marvell,armada-xp-neta";
360360
reg = <0x34000 0x4000>;
361361
interrupts = <14>;
362362
clocks = <&gateclk 1>;

arch/arm/boot/dts/armada-xp.dtsi

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
};
178178

179179
eth2: ethernet@30000 {
180-
compatible = "marvell,armada-370-neta";
180+
compatible = "marvell,armada-xp-neta";
181181
reg = <0x30000 0x4000>;
182182
interrupts = <12>;
183183
clocks = <&gateclk 2>;
@@ -220,6 +220,14 @@
220220
};
221221
};
222222

223+
ethernet@70000 {
224+
compatible = "marvell,armada-xp-neta";
225+
};
226+
227+
ethernet@74000 {
228+
compatible = "marvell,armada-xp-neta";
229+
};
230+
223231
xor@f0900 {
224232
compatible = "marvell,orion-xor";
225233
reg = <0xF0900 0x100

drivers/net/ethernet/marvell/mvneta.c

Lines changed: 26 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

@@ -3185,6 +3209,7 @@ static int mvneta_remove(struct platform_device *pdev)
31853209

31863210
static const struct of_device_id mvneta_match[] = {
31873211
{ .compatible = "marvell,armada-370-neta" },
3212+
{ .compatible = "marvell,armada-xp-neta" },
31883213
{ }
31893214
};
31903215
MODULE_DEVICE_TABLE(of, mvneta_match);

0 commit comments

Comments
 (0)