summaryrefslogtreecommitdiff
path: root/target/linux/ramips
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2013-12-09 17:29:29 +0000
committerJohn Crispin <john@openwrt.org>2013-12-09 17:29:29 +0000
commit0ef939c93b2335491935f2dda36fba763df4cf98 (patch)
treebe7c9d5cad5e5d4d4691fa7ac0523c6473943330 /target/linux/ramips
parent09a933ed7364ac8dfd2e16a08f05356c09c75ae5 (diff)
downloadmtk-20170518-0ef939c93b2335491935f2dda36fba763df4cf98.zip
mtk-20170518-0ef939c93b2335491935f2dda36fba763df4cf98.tar.gz
mtk-20170518-0ef939c93b2335491935f2dda36fba763df4cf98.tar.bz2
ralink: add TSO
Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 39019
Diffstat (limited to 'target/linux/ramips')
-rw-r--r--target/linux/ramips/patches-3.10/0111-NET-MIPS-add-ralink-SoC-ethernet-driver.patch267
1 files changed, 205 insertions, 62 deletions
diff --git a/target/linux/ramips/patches-3.10/0111-NET-MIPS-add-ralink-SoC-ethernet-driver.patch b/target/linux/ramips/patches-3.10/0111-NET-MIPS-add-ralink-SoC-ethernet-driver.patch
index 5ad4f35..b298c53 100644
--- a/target/linux/ramips/patches-3.10/0111-NET-MIPS-add-ralink-SoC-ethernet-driver.patch
+++ b/target/linux/ramips/patches-3.10/0111-NET-MIPS-add-ralink-SoC-ethernet-driver.patch
@@ -46,8 +46,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
create mode 100644 drivers/net/ethernet/ralink/soc_rt305x.c
create mode 100644 drivers/net/ethernet/ralink/soc_rt3883.c
---- /dev/null
-+++ b/arch/mips/include/asm/mach-ralink/rt305x_esw_platform.h
+Index: linux-3.10.21/arch/mips/include/asm/mach-ralink/rt305x_esw_platform.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/arch/mips/include/asm/mach-ralink/rt305x_esw_platform.h 2013-12-09 13:26:42.320125202 +0100
@@ -0,0 +1,27 @@
+/*
+ * Ralink RT305x SoC platform device registration
@@ -76,9 +78,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+};
+
+#endif /* _RT305X_ESW_PLATFORM_H */
---- a/arch/mips/ralink/rt305x.c
-+++ b/arch/mips/ralink/rt305x.c
-@@ -221,6 +221,7 @@ void __init ralink_clk_init(void)
+Index: linux-3.10.21/arch/mips/ralink/rt305x.c
+===================================================================
+--- linux-3.10.21.orig/arch/mips/ralink/rt305x.c 2013-11-29 20:12:03.000000000 +0100
++++ linux-3.10.21/arch/mips/ralink/rt305x.c 2013-12-09 14:04:34.200179338 +0100
+@@ -221,6 +221,7 @@
}
ralink_clk_add("cpu", cpu_rate);
@@ -86,9 +90,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
ralink_clk_add("10000b00.spi", sys_rate);
ralink_clk_add("10000100.timer", wdt_rate);
ralink_clk_add("10000120.watchdog", wdt_rate);
---- a/drivers/net/ethernet/Kconfig
-+++ b/drivers/net/ethernet/Kconfig
-@@ -135,6 +135,7 @@ config ETHOC
+Index: linux-3.10.21/drivers/net/ethernet/Kconfig
+===================================================================
+--- linux-3.10.21.orig/drivers/net/ethernet/Kconfig 2013-11-29 20:12:03.000000000 +0100
++++ linux-3.10.21/drivers/net/ethernet/Kconfig 2013-12-09 13:26:42.324125203 +0100
+@@ -135,6 +135,7 @@
source "drivers/net/ethernet/packetengines/Kconfig"
source "drivers/net/ethernet/pasemi/Kconfig"
source "drivers/net/ethernet/qlogic/Kconfig"
@@ -96,9 +102,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
source "drivers/net/ethernet/realtek/Kconfig"
source "drivers/net/ethernet/renesas/Kconfig"
source "drivers/net/ethernet/rdc/Kconfig"
---- a/drivers/net/ethernet/Makefile
-+++ b/drivers/net/ethernet/Makefile
-@@ -53,6 +53,7 @@ obj-$(CONFIG_ETHOC) += ethoc.o
+Index: linux-3.10.21/drivers/net/ethernet/Makefile
+===================================================================
+--- linux-3.10.21.orig/drivers/net/ethernet/Makefile 2013-11-29 20:12:03.000000000 +0100
++++ linux-3.10.21/drivers/net/ethernet/Makefile 2013-12-09 13:26:42.324125203 +0100
+@@ -53,6 +53,7 @@
obj-$(CONFIG_NET_PACKET_ENGINE) += packetengines/
obj-$(CONFIG_NET_VENDOR_PASEMI) += pasemi/
obj-$(CONFIG_NET_VENDOR_QLOGIC) += qlogic/
@@ -106,8 +114,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
obj-$(CONFIG_NET_VENDOR_REALTEK) += realtek/
obj-$(CONFIG_SH_ETH) += renesas/
obj-$(CONFIG_NET_VENDOR_RDC) += rdc/
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/Kconfig
+Index: linux-3.10.21/drivers/net/ethernet/ralink/Kconfig
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/Kconfig 2013-12-09 13:26:42.324125203 +0100
@@ -0,0 +1,32 @@
+config NET_RALINK
+ tristate "Ralink RT288X/RT3X5X/RT3662/RT3883/MT7620 ethernet driver"
@@ -141,8 +151,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ select PHYLIB
+ select SWCONFIG
+endif
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/Makefile
+Index: linux-3.10.21/drivers/net/ethernet/ralink/Makefile
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/Makefile 2013-12-09 13:26:42.324125203 +0100
@@ -0,0 +1,18 @@
+#
+# Makefile for the Ralink SoCs built-in ethernet macs
@@ -162,8 +174,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ralink-eth-$(CONFIG_SOC_MT7620) += soc_mt7620.o
+
+obj-$(CONFIG_NET_RALINK) += ralink-eth.o
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/esw_rt3052.c
+Index: linux-3.10.21/drivers/net/ethernet/ralink/esw_rt3052.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/esw_rt3052.c 2013-12-09 13:26:42.328125203 +0100
@@ -0,0 +1,1463 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -1628,8 +1642,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+{
+ platform_driver_unregister(&esw_driver);
+}
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/esw_rt3052.h
+Index: linux-3.10.21/drivers/net/ethernet/ralink/esw_rt3052.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/esw_rt3052.h 2013-12-09 13:26:42.328125203 +0100
@@ -0,0 +1,32 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -1663,8 +1679,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+#endif
+#endif
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/gsw_mt7620a.c
+Index: linux-3.10.21/drivers/net/ethernet/ralink/gsw_mt7620a.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/gsw_mt7620a.c 2013-12-09 13:26:42.328125203 +0100
@@ -0,0 +1,566 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -2232,8 +2250,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+ return 0;
+}
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/gsw_mt7620a.h
+Index: linux-3.10.21/drivers/net/ethernet/ralink/gsw_mt7620a.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/gsw_mt7620a.h 2013-12-09 13:26:42.328125203 +0100
@@ -0,0 +1,30 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -2265,8 +2285,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+extern int mt7620a_has_carrier(struct fe_priv *priv);
+
+#endif
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/mdio.c
+Index: linux-3.10.21/drivers/net/ethernet/ralink/mdio.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/mdio.c 2013-12-09 13:26:42.328125203 +0100
@@ -0,0 +1,244 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -2512,8 +2534,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ of_node_put(priv->mii_bus->dev.of_node);
+ kfree(priv->mii_bus);
+}
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/mdio.h
+Index: linux-3.10.21/drivers/net/ethernet/ralink/mdio.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/mdio.h 2013-12-09 13:26:42.328125203 +0100
@@ -0,0 +1,29 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -2544,8 +2568,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+static inline void fe_mdio_cleanup(struct fe_priv *priv) {}
+#endif
+#endif
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/mdio_rt2880.c
+Index: linux-3.10.21/drivers/net/ethernet/ralink/mdio_rt2880.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/mdio_rt2880.c 2013-12-09 13:26:42.328125203 +0100
@@ -0,0 +1,232 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -2779,8 +2805,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+ return;
+}
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/mdio_rt2880.h
+Index: linux-3.10.21/drivers/net/ethernet/ralink/mdio_rt2880.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/mdio_rt2880.h 2013-12-09 13:26:42.328125203 +0100
@@ -0,0 +1,26 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -2808,9 +2836,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+void rt2880_port_init(struct fe_priv *priv, struct device_node *np);
+
+#endif
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/ralink_soc_eth.c
-@@ -0,0 +1,769 @@
+Index: linux-3.10.21/drivers/net/ethernet/ralink/ralink_soc_eth.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/ralink_soc_eth.c 2013-12-09 14:01:00.060174130 +0100
+@@ -0,0 +1,846 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
@@ -2850,8 +2880,9 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+#include "esw_rt3052.h"
+#include "mdio.h"
+
-+#define TX_TIMEOUT (20 * HZ / 100)
++#define TX_TIMEOUT (2 * HZ)
+#define MAX_RX_LENGTH 1536
++#define DMA_DUMMY_DESC 0xffffffff
+
+static const u32 fe_reg_table_default[FE_REG_COUNT] = {
+ [FE_REG_PDMA_GLO_CFG] = FE_PDMA_GLO_CFG,
@@ -3052,12 +3083,41 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ netdev_reset_queue(priv->netdev);
+}
+
++static void fe_start_tso(struct sk_buff *skb, struct net_device *dev, unsigned int nr_frags, int idx)
++{
++ struct fe_priv *priv = netdev_priv(dev);
++ struct skb_frag_struct *frag;
++ int i;
++
++ for (i = 0; i < nr_frags; i++) {
++ dma_addr_t mapped_addr;
++
++ frag = &skb_shinfo(skb)->frags[i];
++ mapped_addr = skb_frag_dma_map(&dev->dev, frag, 0, skb_frag_size(frag), DMA_TO_DEVICE);
++ if (i % 2) {
++ idx = (idx + 1) % NUM_DMA_DESC;
++ priv->tx_dma[idx].txd1 = mapped_addr;
++ if (i == nr_frags - 1)
++ priv->tx_dma[idx].txd2 = TX_DMA_LSO | TX_DMA_PLEN0(frag->size);
++ else
++ priv->tx_dma[idx].txd2 = TX_DMA_PLEN0(frag->size);
++ } else {
++ priv->tx_dma[idx].txd3 = mapped_addr;
++ if (i == nr_frags - 1)
++ priv->tx_dma[idx].txd2 |= TX_DMA_LS1 | TX_DMA_PLEN1(frag->size);
++ else
++ priv->tx_dma[idx].txd2 |= TX_DMA_PLEN1(frag->size);
++ }
++ }
++}
++
+static int fe_start_xmit(struct sk_buff *skb, struct net_device *dev)
+{
++ unsigned int nr_frags = skb_shinfo(skb)->nr_frags;
+ struct fe_priv *priv = netdev_priv(dev);
+ dma_addr_t mapped_addr;
-+ u32 tx_next;
-+ u32 tx;
++ u32 tx_next, tx, tx_num = 1;
++ int i;
+
+ if (priv->soc->min_pkt_len) {
+ if (skb->len < priv->soc->min_pkt_len) {
@@ -3078,8 +3138,9 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ spin_lock(&priv->page_lock);
+
+ tx = fe_reg_r32(FE_REG_TX_CTX_IDX0);
-+ tx_next = (tx + 1) % NUM_DMA_DESC;
-+
++ if (priv->soc->tso && nr_frags)
++ tx_num += nr_frags >> 1;
++ tx_next = (tx + tx_num) % NUM_DMA_DESC;
+ if ((priv->tx_skb[tx]) || (priv->tx_skb[tx_next]) ||
+ !(priv->tx_dma[tx].txd2 & TX_DMA_DONE) ||
+ !(priv->tx_dma[tx_next].txd2 & TX_DMA_DONE))
@@ -3091,7 +3152,15 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ return NETDEV_TX_OK;
+ }
+
-+ priv->tx_skb[tx] = skb;
++ if (priv->soc->tso) {
++ int t = tx_num;
++
++ priv->tx_skb[(tx + t - 1) % NUM_DMA_DESC] = skb;
++ while (--t)
++ priv->tx_skb[(tx + t - 1) % NUM_DMA_DESC] = (struct sk_buff *) DMA_DUMMY_DESC;
++ } else {
++ priv->tx_skb[tx] = skb;
++ }
+ priv->tx_dma[tx].txd1 = (unsigned int) mapped_addr;
+ wmb();
+
@@ -3106,9 +3175,36 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ else
+ priv->tx_dma[tx].txd4 &= ~TX_DMA_CHKSUM;
+
++ if (priv->soc->tso)
++ fe_start_tso(skb, dev, nr_frags, tx);
++
++ if (skb_shinfo(skb)->gso_segs > 1) {
++ struct iphdr *iph = NULL;
++ struct tcphdr *th = NULL;
++ struct ipv6hdr *ip6h = NULL;
++
++ ip6h = (struct ipv6hdr *) skb_network_header(skb);
++ iph = (struct iphdr *) skb_network_header(skb);
++ if ((iph->version == 4) && (iph->protocol == IPPROTO_TCP)) {
++ th = (struct tcphdr *)skb_transport_header(skb);
++ priv->tx_dma[tx].txd4 |= BIT(28);
++ th->check = htons(skb_shinfo(skb)->gso_size);
++ dma_cache_sync(NULL, th, sizeof(struct tcphdr), DMA_TO_DEVICE);
++ } else if ((ip6h->version == 6) && (ip6h->nexthdr == NEXTHDR_TCP)) {
++ th = (struct tcphdr *)skb_transport_header(skb);
++ priv->tx_dma[tx].txd4 |= BIT(28);
++ th->check = htons(skb_shinfo(skb)->gso_size);
++ dma_cache_sync(NULL, th, sizeof(struct tcphdr), DMA_TO_DEVICE);
++ }
++ }
++
++ for (i = 0; i < tx_num; i++)
++ dma_cache_sync(NULL, &priv->tx_dma[tx + i], sizeof(struct fe_tx_dma), DMA_TO_DEVICE);
++
+ dev->stats.tx_packets++;
+ dev->stats.tx_bytes += skb->len;
+
++ wmb();
+ fe_reg_w32(tx_next, FE_REG_TX_CTX_IDX0);
+ netdev_sent_queue(dev, skb->len);
+
@@ -3206,10 +3302,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ if (!(txd->txd2 & TX_DMA_DONE) || !(priv->tx_skb[priv->tx_free_idx]))
+ break;
+
-+ bytes_compl += priv->tx_skb[priv->tx_free_idx]->len;
++ if (priv->tx_skb[priv->tx_free_idx] != (struct sk_buff *) DMA_DUMMY_DESC) {
++ bytes_compl += priv->tx_skb[priv->tx_free_idx]->len;
++ dev_kfree_skb_irq(priv->tx_skb[priv->tx_free_idx]);
++ }
+ pkts_compl++;
-+
-+ dev_kfree_skb_irq(priv->tx_skb[priv->tx_free_idx]);
+ priv->tx_skb[priv->tx_free_idx] = NULL;
+ priv->tx_free_idx++;
+ if (priv->tx_free_idx >= NUM_DMA_DESC)
@@ -3458,6 +3555,9 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+ match = of_match_device(of_fe_match, &pdev->dev);
+ soc = (struct fe_soc_data *) match->data;
++
++ if (soc->init_data)
++ soc->init_data(soc);
+ if (soc->reg_table)
+ fe_reg_table = soc->reg_table;
+
@@ -3480,6 +3580,13 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ if (fe_reg_table[FE_REG_FE_DMA_VID_BASE])
+ netdev->features |= NETIF_F_HW_VLAN_CTAG_TX;
+
++ if (soc->tso) {
++ dev_info(&pdev->dev, "Enabling TSO\n");
++ netdev->features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_IPV6_CSUM;
++ }
++
++ netdev->hw_features = netdev->vlan_features = netdev->features;
++
+ netdev->irq = platform_get_irq(pdev, 0);
+ if (netdev->irq < 0) {
+ dev_err(&pdev->dev, "no IRQ resource found\n");
@@ -3580,9 +3687,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");
+MODULE_DESCRIPTION("Ethernet driver for Ralink SoC");
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/ralink_soc_eth.h
-@@ -0,0 +1,380 @@
+Index: linux-3.10.21/drivers/net/ethernet/ralink/ralink_soc_eth.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/ralink_soc_eth.h 2013-12-09 13:26:42.332125203 +0100
+@@ -0,0 +1,384 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
@@ -3864,6 +3973,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+#define TX_DMA_PLEN0_MASK ((0x3fff) << 16)
+#define TX_DMA_PLEN0(_x) (((_x) & 0x3fff) << 16)
++#define TX_DMA_PLEN1(_x) ((_x) & 0x3fff)
++#define TX_DMA_LS1 BIT(14)
+#define TX_DMA_LSO BIT(30)
+#define TX_DMA_DONE BIT(31)
+#define TX_DMA_QN(_x) ((_x) << 16)
@@ -3902,6 +4013,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ unsigned char mac[6];
+ const u32 *reg_table;
+
++ void (*init_data)(struct fe_soc_data *data);
+ void (*reset_fe)(void);
+ void (*set_mac)(struct fe_priv *priv, unsigned char *mac);
+ void (*fwd_config)(struct fe_priv *priv);
@@ -3923,6 +4035,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ u32 rx_dly_int;
+ u32 tx_dly_int;
+ u32 checksum_bit;
++ u32 tso;
+
+ int min_pkt_len;
+};
@@ -3963,9 +4076,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+u32 fe_r32(unsigned reg);
+
+#endif /* FE_ETH_H */
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/soc_mt7620.c
-@@ -0,0 +1,154 @@
+Index: linux-3.10.21/drivers/net/ethernet/ralink/soc_mt7620.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/soc_mt7620.c 2013-12-09 13:26:42.332125203 +0100
+@@ -0,0 +1,172 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
@@ -3989,6 +4104,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+#include <asm/mach-ralink/ralink_regs.h>
+
++#include <mt7620.h>
+#include "ralink_soc_eth.h"
+#include "gsw_mt7620a.h"
+
@@ -4046,10 +4162,20 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+static void mt7620_tx_dma(struct fe_priv *priv, int idx, struct sk_buff *skb)
+{
-+ if (skb)
-+ priv->tx_dma[idx].txd2 = TX_DMA_LSO | TX_DMA_PLEN0(skb->len);
-+ else
++ unsigned int nr_frags = 0;
++ unsigned int len = 0;
++
++ if (skb) {
++ nr_frags = skb_shinfo(skb)->nr_frags;
++ len = skb->len - skb->data_len;
++ }
++
++ if (!skb)
+ priv->tx_dma[idx].txd2 = TX_DMA_LSO | TX_DMA_DONE;
++ else if (!nr_frags)
++ priv->tx_dma[idx].txd2 = TX_DMA_LSO | TX_DMA_PLEN0(len);
++ else
++ priv->tx_dma[idx].txd2 = TX_DMA_PLEN0(len);
+
+ if(skb && vlan_tx_tag_present(skb))
+ priv->tx_dma[idx].txd4 = 0x80 | (vlan_tx_tag_get(skb) >> 13) << 4 | (vlan_tx_tag_get(skb) & 0xF);
@@ -4089,8 +4215,15 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+}
+#endif
+
++static void mt7620_init_data(struct fe_soc_data *data)
++{
++ if (mt7620_get_eco() >= 5)
++ data->tso = 1;
++}
++
+static struct fe_soc_data mt7620_data = {
+ .mac = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 },
++ .init_data = mt7620_init_data,
+ .reset_fe = mt7620_fe_reset,
+ .set_mac = mt7620_set_mac,
+ .fwd_config = mt7620_fwd_config,
@@ -4120,8 +4253,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+};
+
+MODULE_DEVICE_TABLE(of, of_fe_match);
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/soc_rt2880.c
+Index: linux-3.10.21/drivers/net/ethernet/ralink/soc_rt2880.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/soc_rt2880.c 2013-12-09 13:26:42.332125203 +0100
@@ -0,0 +1,51 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -4174,8 +4309,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+};
+
+MODULE_DEVICE_TABLE(of, of_fe_match);
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/soc_rt305x.c
+Index: linux-3.10.21/drivers/net/ethernet/ralink/soc_rt305x.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/soc_rt305x.c 2013-12-09 13:26:42.332125203 +0100
@@ -0,0 +1,113 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -4290,8 +4427,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+};
+
+MODULE_DEVICE_TABLE(of, of_fe_match);
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/soc_rt3883.c
+Index: linux-3.10.21/drivers/net/ethernet/ralink/soc_rt3883.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/soc_rt3883.c 2013-12-09 13:26:42.332125203 +0100
@@ -0,0 +1,60 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -4353,8 +4492,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+MODULE_DEVICE_TABLE(of, of_fe_match);
+
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/mt7530.c
+Index: linux-3.10.21/drivers/net/ethernet/ralink/mt7530.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/mt7530.c 2013-12-09 13:26:42.336125203 +0100
@@ -0,0 +1,467 @@
+/*
+ * This program is free software; you can redistribute it and/or
@@ -4823,8 +4964,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+ return 0;
+}
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/mt7530.h
+Index: linux-3.10.21/drivers/net/ethernet/ralink/mt7530.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.21/drivers/net/ethernet/ralink/mt7530.h 2013-12-09 13:26:42.336125203 +0100
@@ -0,0 +1,20 @@
+/*
+ * This program is free software; you can redistribute it and/or