aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/marvell/mvneta.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@linaro.org>2015-07-22 08:17:15 -0700
committerKevin Hilman <khilman@linaro.org>2015-07-22 08:17:15 -0700
commit2447e09699cca5db52f86182f163f3a25d1089ab (patch)
treee16730dba489e5ea0f16737597525724daa5c770 /drivers/net/ethernet/marvell/mvneta.c
parent5a277b6839c4ef6c6ccacff49b64f302598264bf (diff)
parentc8bde72f9af412de57f0ceae218d648640118b0b (diff)
Merge branch 'linux-4.1.y' of git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable into linux-linaro-lsk-v4.1lsk-v4.1-15.07
* 'linux-4.1.y' of git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable: (126 commits) Linux 4.1.3 Input: pixcir_i2c_ts - fix receive error of/pci: Fix pci_address_to_pio() conversion of CPU address to I/O port PCI: pciehp: Wait for hotplug command completion where necessary PCI: Add pci_bus_addr_t PCI: Propagate the "ignore hotplug" setting to parent mtd: dc21285: use raw spinlock functions for nw_gpio_lock mtd: fix: avoid race condition when accessing mtd->usecount leds / PM: fix hibernation on arm when gpio-led used with CPU led trigger video: mxsfb: Make sure axi clock is enabled when accessing registers genirq: devres: Fix testing return value of request_any_context_irq() IB/srp: Fix reconnection failure handling IB/srp: Fix connection state tracking IB/srp: Fix a connection setup race IB/srp: Remove an extraneous scsi_host_put() from an error path scsi_transport_srp: Fix a race condition scsi_transport_srp: Introduce srp_wait_for_queuecommand() spi: pl022: Specify 'num-cs' property as required in devicetree binding spi: orion: Fix maximum baud rates for Armada 370/XP spi: fix race freeing dummy_tx/rx before it is unmapped ...
Diffstat (limited to 'drivers/net/ethernet/marvell/mvneta.c')
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index ce5f7f9cff06..74d0389bf233 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;
};
@@ -1013,6 +1014,12 @@ static void mvneta_defaults_set(struct mvneta_port *pp)
val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
val |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
+ } else {
+ val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
+ val &= ~(MVNETA_GMAC_INBAND_AN_ENABLE |
+ MVNETA_GMAC_AN_SPEED_EN |
+ MVNETA_GMAC_AN_DUPLEX_EN);
+ mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
}
mvneta_set_ucast_table(pp, -1);
@@ -2502,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
@@ -2532,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)
{
@@ -2856,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,
};
@@ -3101,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;
@@ -3179,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);