Skip to content

Commit 3522675

Browse files
louts-rockdavem330
authored andcommitted
net: stmmac:fix system hang when setting up tag_8021q VLAN for DSA ports
The system hang because of dsa_tag_8021q_port_setup()-> stmmac_vlan_rx_add_vid(). I found in stmmac_drv_probe() that cailing pm_runtime_put() disabled the clock. First, when the kernel is compiled with CONFIG_PM=y,The stmmac's resume/suspend is active. Secondly,stmmac as DSA master,the dsa_tag_8021q_port_setup() function will callback stmmac_vlan_rx_add_vid when DSA dirver starts. However, The system is hanged for the stmmac_vlan_rx_add_vid() accesses its registers after stmmac's clock is closed. I would suggest adding the pm_runtime_resume_and_get() to the stmmac_vlan_rx_add_vid().This guarantees that resuming clock output while in use. Fixes: b3dcb31 ("net: stmmac: correct clocks enabled in stmmac_vlan_rx_kill_vid()") Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Yan Wang <rk.code@outlook.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d8bb382 commit 3522675

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6377,23 +6377,29 @@ static int stmmac_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid
63776377
bool is_double = false;
63786378
int ret;
63796379

6380+
ret = pm_runtime_resume_and_get(priv->device);
6381+
if (ret < 0)
6382+
return ret;
6383+
63806384
if (be16_to_cpu(proto) == ETH_P_8021AD)
63816385
is_double = true;
63826386

63836387
set_bit(vid, priv->active_vlans);
63846388
ret = stmmac_vlan_update(priv, is_double);
63856389
if (ret) {
63866390
clear_bit(vid, priv->active_vlans);
6387-
return ret;
6391+
goto err_pm_put;
63886392
}
63896393

63906394
if (priv->hw->num_vlan) {
63916395
ret = stmmac_add_hw_vlan_rx_fltr(priv, ndev, priv->hw, proto, vid);
63926396
if (ret)
6393-
return ret;
6397+
goto err_pm_put;
63946398
}
6399+
err_pm_put:
6400+
pm_runtime_put(priv->device);
63956401

6396-
return 0;
6402+
return ret;
63976403
}
63986404

63996405
static int stmmac_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vid)

0 commit comments

Comments
 (0)