--- v13
+++ vrfc
@@ -1,28 +1,96 @@
From: Stefan Chulski <stefanc@marvell.com>
-This patch fix GMAC TX flow control autoneg.
-Flow control autoneg wrongly were disabled with enabled TX
-flow control.
+This patch add ethtool flow control configuration support.
+
+Tx flow control retrieved correctly by ethtool get function.
+FW per port ethtool configuration capability added.
+
+Patch also takes care about mtu change procedure, if PPv2 switch
+BM pools during mtu change.
Signed-off-by: Stefan Chulski <stefanc@marvell.com>
-Acked-by: Marcin Wojtas <mw@semihalf.com>
---
- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
+ drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 53 ++++++++++++++++++++
+ 1 file changed, 53 insertions(+)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
-index e646151..883d742 100644
+index 3b85aec..4869b14 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
-@@ -6276,7 +6276,7 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode,
- old_ctrl4 = ctrl4 = readl(port->base + MVPP22_GMAC_CTRL_4_REG);
+@@ -1243,6 +1243,16 @@ static int mvpp2_bm_update_mtu(struct net_device *dev, int mtu)
+ new_long_pool = MVPP2_BM_LONG;
- ctrl0 &= ~MVPP2_GMAC_PORT_TYPE_MASK;
-- ctrl2 &= ~(MVPP2_GMAC_INBAND_AN_MASK | MVPP2_GMAC_PCS_ENABLE_MASK);
-+ ctrl2 &= ~(MVPP2_GMAC_INBAND_AN_MASK | MVPP2_GMAC_PCS_ENABLE_MASK | MVPP2_GMAC_FLOW_CTRL_MASK);
+ if (new_long_pool != port->pool_long->id) {
++ if (port->tx_fc) {
++ if (pkt_size > MVPP2_BM_LONG_PKT_SIZE)
++ mvpp2_bm_pool_update_fc(port,
++ port->pool_short,
++ false);
++ else
++ mvpp2_bm_pool_update_fc(port, port->pool_long,
++ false);
++ }
++
+ /* Remove port from old short & long pool */
+ port->pool_long = mvpp2_bm_pool_use(port, port->pool_long->id,
+ port->pool_long->pkt_size);
+@@ -1260,6 +1270,25 @@ static int mvpp2_bm_update_mtu(struct net_device *dev, int mtu)
+ mvpp2_swf_bm_pool_init(port);
- /* Configure port type */
- if (phy_interface_mode_is_8023z(state->interface)) {
+ mvpp2_set_hw_csum(port, new_long_pool);
++
++ if (port->tx_fc) {
++ if (pkt_size > MVPP2_BM_LONG_PKT_SIZE)
++ mvpp2_bm_pool_update_fc(port, port->pool_long,
++ true);
++ else
++ mvpp2_bm_pool_update_fc(port, port->pool_short,
++ true);
++ }
++
++ /* Update L4 checksum when jumbo enable/disable on port */
++ if (new_long_pool == MVPP2_BM_JUMBO && port->id != 0) {
++ dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
++ dev->hw_features &= ~(NETIF_F_IP_CSUM |
++ NETIF_F_IPV6_CSUM);
++ } else {
++ dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
++ dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
++ }
+ }
+
+ out_set:
+@@ -5373,6 +5402,30 @@ static int mvpp2_ethtool_set_pause_param(struct net_device *dev,
+ struct ethtool_pauseparam *pause)
+ {
+ struct mvpp2_port *port = netdev_priv(dev);
++ int i;
++
++ if (pause->tx_pause && port->priv->global_tx_fc) {
++ port->tx_fc = true;
++ mvpp2_rxq_enable_fc(port);
++ if (port->priv->percpu_pools) {
++ for (i = 0; i < port->nrxqs; i++)
++ mvpp2_bm_pool_update_fc(port, &port->priv->bm_pools[i], true);
++ } else {
++ mvpp2_bm_pool_update_fc(port, port->pool_long, true);
++ mvpp2_bm_pool_update_fc(port, port->pool_short, true);
++ }
++
++ } else if (port->priv->global_tx_fc) {
++ port->tx_fc = false;
++ mvpp2_rxq_disable_fc(port);
++ if (port->priv->percpu_pools) {
++ for (i = 0; i < port->nrxqs; i++)
++ mvpp2_bm_pool_update_fc(port, &port->priv->bm_pools[i], false);
++ } else {
++ mvpp2_bm_pool_update_fc(port, port->pool_long, false);
++ mvpp2_bm_pool_update_fc(port, port->pool_short, false);
++ }
++ }
+
+ if (!port->phylink)
+ return -ENOTSUPP;
--
1.9.1