Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Kirjanov <dkirjanov@suse.com>2019-03-21 10:37:11 +0100
committerDenis Kirjanov <dkirjanov@suse.com>2019-03-21 10:37:11 +0100
commit09b11afaa0614239a426e3d392e264875977605d (patch)
treea411d452119b3c6a5f181443d946a631378f46bc
parent2a80c1f4a49e62636ea47575a067289739001aa1 (diff)
net: stmmac: Use mutex instead of spinlock (git-fixes).
-rw-r--r--patches.fixes/0001-net-stmmac-Use-mutex-instead-of-spinlock.patch226
-rw-r--r--series.conf1
2 files changed, 227 insertions, 0 deletions
diff --git a/patches.fixes/0001-net-stmmac-Use-mutex-instead-of-spinlock.patch b/patches.fixes/0001-net-stmmac-Use-mutex-instead-of-spinlock.patch
new file mode 100644
index 0000000000..4733effc10
--- /dev/null
+++ b/patches.fixes/0001-net-stmmac-Use-mutex-instead-of-spinlock.patch
@@ -0,0 +1,226 @@
+From: Thierry Reding <treding@nvidia.com>
+Subject: net: stmmac: Use mutex instead of spinlock
+Patch-mainline: v4.18-rc1
+Git-commit: 29555fa3de865630570b5f53c847b953413daf1a
+References: git-fixes
+
+Some drivers, such as DWC EQOS on Tegra, need to perform operations that
+can sleep under this lock (clk_set_rate() in tegra_eqos_fix_speed()) for
+proper operation. Since there is no need for this lock to be a spinlock,
+convert it to a mutex instead.
+
+Fixes: e6ea2d16fc61 ("net: stmmac: dwc-qos: Add Tegra186 support")
+Reported-by: Jon Hunter <jonathanh@nvidia.com>
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+Tested-by: Bhadram Varka <vbhadram@nvidia.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Acked-by: Denis Kirjanov <dkirjanov@suse.com>
+---
+ drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 -
+ drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 12 +++----
+ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 31 ++++++++-----------
+ 3 files changed, 21 insertions(+), 24 deletions(-)
+
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+@@ -96,7 +96,7 @@ struct stmmac_priv {
+ struct net_device *dev;
+ struct device *device;
+ struct mac_device_info *hw;
+- spinlock_t lock;
++ struct mutex lock;
+
+ /* RX Queue */
+ struct stmmac_rx_queue rx_queue[MTL_MAX_RX_QUEUES];
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+@@ -390,13 +390,13 @@ stmmac_ethtool_set_link_ksettings(struct
+ ADVERTISED_10baseT_Half |
+ ADVERTISED_10baseT_Full);
+
+- spin_lock(&priv->lock);
++ mutex_lock(&priv->lock);
+
+ if (priv->hw->mac->pcs_ctrl_ane)
+ priv->hw->mac->pcs_ctrl_ane(priv->ioaddr, 1,
+ priv->hw->ps, 0);
+
+- spin_unlock(&priv->lock);
++ mutex_unlock(&priv->lock);
+
+ return 0;
+ }
+@@ -610,12 +610,12 @@ static void stmmac_get_wol(struct net_de
+ {
+ struct stmmac_priv *priv = netdev_priv(dev);
+
+- spin_lock_irq(&priv->lock);
++ mutex_lock(&priv->lock);
+ if (device_can_wakeup(priv->device)) {
+ wol->supported = WAKE_MAGIC | WAKE_UCAST;
+ wol->wolopts = priv->wolopts;
+ }
+- spin_unlock_irq(&priv->lock);
++ mutex_unlock(&priv->lock);
+ }
+
+ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
+@@ -644,9 +644,9 @@ static int stmmac_set_wol(struct net_dev
+ disable_irq_wake(priv->wol_irq);
+ }
+
+- spin_lock_irq(&priv->lock);
++ mutex_lock(&priv->lock);
+ priv->wolopts = wol->wolopts;
+- spin_unlock_irq(&priv->lock);
++ mutex_unlock(&priv->lock);
+
+ return 0;
+ }
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+@@ -354,7 +354,6 @@ bool stmmac_eee_init(struct stmmac_priv
+ {
+ struct net_device *ndev = priv->dev;
+ int interface = priv->plat->interface;
+- unsigned long flags;
+ bool ret = false;
+
+ if ((interface != PHY_INTERFACE_MODE_MII) &&
+@@ -381,7 +380,7 @@ bool stmmac_eee_init(struct stmmac_priv
+ * changed).
+ * In that case the driver disable own timers.
+ */
+- spin_lock_irqsave(&priv->lock, flags);
++ mutex_lock(&priv->lock);
+ if (priv->eee_active) {
+ netdev_dbg(priv->dev, "disable EEE\n");
+ del_timer_sync(&priv->eee_ctrl_timer);
+@@ -389,11 +388,11 @@ bool stmmac_eee_init(struct stmmac_priv
+ tx_lpi_timer);
+ }
+ priv->eee_active = 0;
+- spin_unlock_irqrestore(&priv->lock, flags);
++ mutex_unlock(&priv->lock);
+ goto out;
+ }
+ /* Activate the EEE and start timers */
+- spin_lock_irqsave(&priv->lock, flags);
++ mutex_lock(&priv->lock);
+ if (!priv->eee_active) {
+ priv->eee_active = 1;
+ setup_timer(&priv->eee_ctrl_timer,
+@@ -410,7 +409,7 @@ bool stmmac_eee_init(struct stmmac_priv
+ priv->hw->mac->set_eee_pls(priv->hw, ndev->phydev->link);
+
+ ret = true;
+- spin_unlock_irqrestore(&priv->lock, flags);
++ mutex_unlock(&priv->lock);
+
+ netdev_dbg(priv->dev, "Energy-Efficient Ethernet initialized\n");
+ }
+@@ -789,13 +788,12 @@ static void stmmac_adjust_link(struct ne
+ {
+ struct stmmac_priv *priv = netdev_priv(dev);
+ struct phy_device *phydev = dev->phydev;
+- unsigned long flags;
+ int new_state = 0;
+
+ if (!phydev)
+ return;
+
+- spin_lock_irqsave(&priv->lock, flags);
++ mutex_lock(&priv->lock);
+
+ if (phydev->link) {
+ u32 ctrl = readl(priv->ioaddr + MAC_CTRL_REG);
+@@ -867,7 +865,7 @@ static void stmmac_adjust_link(struct ne
+ if (new_state && netif_msg_link(priv))
+ phy_print_status(phydev);
+
+- spin_unlock_irqrestore(&priv->lock, flags);
++ mutex_unlock(&priv->lock);
+
+ if (phydev->is_pseudo_fixed_link)
+ /* Stop PHY layer to call the hook to adjust the link in case
+@@ -4202,7 +4200,7 @@ int stmmac_dvr_probe(struct device *devi
+ (8 * priv->plat->rx_queues_to_use));
+ }
+
+- spin_lock_init(&priv->lock);
++ mutex_init(&priv->lock);
+
+ /* If a specific clk_csr value is passed from the platform
+ * this means that the CSR Clock Range selection cannot be
+@@ -4283,6 +4281,7 @@ int stmmac_dvr_remove(struct device *dev
+ priv->hw->pcs != STMMAC_PCS_TBI &&
+ priv->hw->pcs != STMMAC_PCS_RTBI)
+ stmmac_mdio_unregister(ndev);
++ mutex_destroy(&priv->lock);
+ free_netdev(ndev);
+
+ return 0;
+@@ -4300,7 +4299,6 @@ int stmmac_suspend(struct device *dev)
+ {
+ struct net_device *ndev = dev_get_drvdata(dev);
+ struct stmmac_priv *priv = netdev_priv(ndev);
+- unsigned long flags;
+
+ if (!ndev || !netif_running(ndev))
+ return 0;
+@@ -4308,7 +4306,7 @@ int stmmac_suspend(struct device *dev)
+ if (ndev->phydev)
+ phy_stop(ndev->phydev);
+
+- spin_lock_irqsave(&priv->lock, flags);
++ mutex_lock(&priv->lock);
+
+ netif_device_detach(ndev);
+ stmmac_stop_all_queues(priv);
+@@ -4329,7 +4327,7 @@ int stmmac_suspend(struct device *dev)
+ clk_disable(priv->plat->pclk);
+ clk_disable(priv->plat->stmmac_clk);
+ }
+- spin_unlock_irqrestore(&priv->lock, flags);
++ mutex_unlock(&priv->lock);
+
+ priv->oldlink = 0;
+ priv->speed = SPEED_UNKNOWN;
+@@ -4373,7 +4371,6 @@ int stmmac_resume(struct device *dev)
+ {
+ struct net_device *ndev = dev_get_drvdata(dev);
+ struct stmmac_priv *priv = netdev_priv(ndev);
+- unsigned long flags;
+
+ if (!netif_running(ndev))
+ return 0;
+@@ -4385,9 +4382,9 @@ int stmmac_resume(struct device *dev)
+ * from another devices (e.g. serial console).
+ */
+ if (device_may_wakeup(priv->device)) {
+- spin_lock_irqsave(&priv->lock, flags);
++ mutex_lock(&priv->lock);
+ priv->hw->mac->pmt(priv->hw, 0);
+- spin_unlock_irqrestore(&priv->lock, flags);
++ mutex_unlock(&priv->lock);
+ priv->irq_wake = 0;
+ } else {
+ pinctrl_pm_select_default_state(priv->device);
+@@ -4401,7 +4398,7 @@ int stmmac_resume(struct device *dev)
+
+ netif_device_attach(ndev);
+
+- spin_lock_irqsave(&priv->lock, flags);
++ mutex_lock(&priv->lock);
+
+ stmmac_reset_queues_param(priv);
+
+@@ -4420,7 +4417,7 @@ int stmmac_resume(struct device *dev)
+
+ stmmac_start_all_queues(priv);
+
+- spin_unlock_irqrestore(&priv->lock, flags);
++ mutex_unlock(&priv->lock);
+
+ if (ndev->phydev)
+ phy_start(ndev->phydev);
diff --git a/series.conf b/series.conf
index d336e75833..bcfd7afccb 100644
--- a/series.conf
+++ b/series.conf
@@ -16695,6 +16695,7 @@
patches.drivers/qede-Support-flow-classification-to-the-VFs.patch
patches.drivers/qed-Support-drop-action-classification.patch
patches.drivers/bnx2x-Collect-the-device-debug-information-during-Tx.patch
+ patches.fixes/0001-net-stmmac-Use-mutex-instead-of-spinlock.patch
patches.drivers/qmi_wwan-apply-SET_DTR-quirk-to-the-SIMCOM-shared-de.patch
patches.drivers/net-hns3-Updates-RX-packet-info-fetch-in-case-of-mul.patch
patches.drivers/net-hns3-Add-support-for-tx_accept_tag2-and-tx_accep.patch