[SRU][F][PULL][PATCH v2 05/23] Revert "Revert "UBUNTU: SAUCE: Fix intermittent OOB link up issue""

Asmaa Mnebhi asmaa at nvidia.com
Fri Jul 9 19:08:12 UTC 2021


BugLink: https://bugs.launchpad.net/bugs/1934923

This reverts commit 846c602c6b93c9ff08abc6615973efcdd35a92bb.

Signed-off-by: Asmaa Mnebhi <asmaa at nvidia.com>
---
 .../mellanox/mlxbf_gige/mlxbf_gige_main.c     | 39 +++++--------------
 .../mellanox/mlxbf_gige/mlxbf_gige_mdio.c     |  4 +-
 2 files changed, 12 insertions(+), 31 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
index 85a7ce19a6ff..63ea74ad5ee5 100644
--- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
+++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
@@ -21,7 +21,7 @@
 #include "mlxbf_gige_regs.h"
 
 #define DRV_NAME    "mlxbf_gige"
-#define DRV_VERSION "1.10"
+#define DRV_VERSION "1.14"
 
 static void mlxbf_gige_set_mac_rx_filter(struct mlxbf_gige *priv,
 					 unsigned int index, u64 dmac)
@@ -862,34 +862,18 @@ static int mlxbf_gige_clean_port(struct mlxbf_gige *priv)
 	return err;
 }
 
-static int mlxbf_gige_phy_enable_interrupt(struct phy_device *phydev)
+static int mlxbf_gige_phy_disable_interrupt(struct phy_device *phydev)
 {
 	int err = 0;
 
-	if (phydev->drv->ack_interrupt)
-		err = phydev->drv->ack_interrupt(phydev);
-	if (err < 0)
-		return err;
-
-	phydev->interrupts = PHY_INTERRUPT_ENABLED;
+	phydev->interrupts = PHY_INTERRUPT_DISABLED;
 	if (phydev->drv->config_intr)
 		err = phydev->drv->config_intr(phydev);
-
-	return err;
-}
-
-static int mlxbf_gige_phy_disable_interrupt(struct phy_device *phydev)
-{
-	int err = 0;
-
-	if (phydev->drv->ack_interrupt)
-		err = phydev->drv->ack_interrupt(phydev);
 	if (err < 0)
 		return err;
 
-	phydev->interrupts = PHY_INTERRUPT_DISABLED;
-	if (phydev->drv->config_intr)
-		err = phydev->drv->config_intr(phydev);
+	if (phydev->drv->ack_interrupt)
+		err = phydev->drv->ack_interrupt(phydev);
 
 	return err;
 }
@@ -915,15 +899,10 @@ static int mlxbf_gige_open(struct net_device *netdev)
 	if (err)
 		return err;
 
+	phydev->irq = priv->phy_irq;
+	mlxbf_gige_mdio_enable_phy_int(priv);
+
 	phy_start(phydev);
-	/* Always make sure interrupts are enabled since phy_start calls
-	 * __phy_resume which may reset the PHY interrupt control reg.
-	 * __phy_resume only reenables the interrupts if
-	 * phydev->irq != IRQ_IGNORE_INTERRUPT.
-	 */
-	err = mlxbf_gige_phy_enable_interrupt(phydev);
-	if (err)
-		return err;
 
 	netif_napi_add(netdev, &priv->napi, mlxbf_gige_poll, NAPI_POLL_WEIGHT);
 	napi_enable(&priv->napi);
@@ -1292,6 +1271,8 @@ static int mlxbf_gige_remove(struct platform_device *pdev)
 	struct mlxbf_gige *priv = platform_get_drvdata(pdev);
 
 	unregister_netdev(priv->netdev);
+	priv->netdev->phydev->irq = PHY_IGNORE_INTERRUPT;
+	mlxbf_gige_phy_disable_interrupt(priv->netdev->phydev);
 	phy_disconnect(priv->netdev->phydev);
 	mlxbf_gige_mdio_remove(priv);
 	platform_set_drvdata(pdev, NULL);
diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c
index 636e19cf7050..4b063330ec28 100644
--- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c
+++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c
@@ -161,7 +161,7 @@ static void mlxbf_gige_mdio_disable_phy_int(struct mlxbf_gige *priv)
 	spin_unlock_irqrestore(&priv->gpio_lock, flags);
 }
 
-static void mlxbf_gige_mdio_enable_phy_int(struct mlxbf_gige *priv)
+void mlxbf_gige_mdio_enable_phy_int(struct mlxbf_gige *priv)
 {
 	unsigned long flags;
 	u32 val;
@@ -258,7 +258,7 @@ int mlxbf_gige_mdio_probe(struct platform_device *pdev, struct mlxbf_gige *priv)
 		phy_int_gpio = MLXBF_GIGE_GPIO12_BIT;
 	priv->phy_int_gpio_mask = BIT(phy_int_gpio);
 
-	mlxbf_gige_mdio_enable_phy_int(priv);
+	mlxbf_gige_mdio_disable_phy_int(priv);
 
 	priv->mdiobus = devm_mdiobus_alloc(dev);
 	if (!priv->mdiobus) {
-- 
2.30.1




More information about the kernel-team mailing list