Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: b3dcb3127786 ("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>

authored by

Yan Wang and committed by
David S. Miller
35226750 d8bb3824

+9 -3
+9 -3
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 6377 6377 bool is_double = false; 6378 6378 int ret; 6379 6379 6380 + ret = pm_runtime_resume_and_get(priv->device); 6381 + if (ret < 0) 6382 + return ret; 6383 + 6380 6384 if (be16_to_cpu(proto) == ETH_P_8021AD) 6381 6385 is_double = true; 6382 6386 ··· 6388 6384 ret = stmmac_vlan_update(priv, is_double); 6389 6385 if (ret) { 6390 6386 clear_bit(vid, priv->active_vlans); 6391 - return ret; 6387 + goto err_pm_put; 6392 6388 } 6393 6389 6394 6390 if (priv->hw->num_vlan) { 6395 6391 ret = stmmac_add_hw_vlan_rx_fltr(priv, ndev, priv->hw, proto, vid); 6396 6392 if (ret) 6397 - return ret; 6393 + goto err_pm_put; 6398 6394 } 6395 + err_pm_put: 6396 + pm_runtime_put(priv->device); 6399 6397 6400 - return 0; 6398 + return ret; 6401 6399 } 6402 6400 6403 6401 static int stmmac_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vid)