Commit cdeccd13 authored by Wolfram Sang's avatar Wolfram Sang Committed by Jakub Kicinski

Revert "sh_eth: remove open coded netif_running()"

This reverts commit ce1fdb06. It turned
out this actually introduces a race condition. netif_running() is not a
suitable check for get_stats.
Reported-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20230327152112.15635-1-wsa+renesas@sang-engineering.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 2600badf
...@@ -2441,6 +2441,8 @@ static int sh_eth_open(struct net_device *ndev) ...@@ -2441,6 +2441,8 @@ static int sh_eth_open(struct net_device *ndev)
netif_start_queue(ndev); netif_start_queue(ndev);
mdp->is_opened = 1;
return ret; return ret;
out_free_irq: out_free_irq:
...@@ -2563,7 +2565,7 @@ static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev) ...@@ -2563,7 +2565,7 @@ static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev)
if (mdp->cd->no_tx_cntrs) if (mdp->cd->no_tx_cntrs)
return &ndev->stats; return &ndev->stats;
if (!netif_running(ndev)) if (!mdp->is_opened)
return &ndev->stats; return &ndev->stats;
sh_eth_update_stat(ndev, &ndev->stats.tx_dropped, TROCR); sh_eth_update_stat(ndev, &ndev->stats.tx_dropped, TROCR);
...@@ -2612,6 +2614,8 @@ static int sh_eth_close(struct net_device *ndev) ...@@ -2612,6 +2614,8 @@ static int sh_eth_close(struct net_device *ndev)
/* Free all the skbuffs in the Rx queue and the DMA buffer. */ /* Free all the skbuffs in the Rx queue and the DMA buffer. */
sh_eth_ring_free(ndev); sh_eth_ring_free(ndev);
mdp->is_opened = 0;
pm_runtime_put(&mdp->pdev->dev); pm_runtime_put(&mdp->pdev->dev);
return 0; return 0;
......
...@@ -560,6 +560,7 @@ struct sh_eth_private { ...@@ -560,6 +560,7 @@ struct sh_eth_private {
unsigned no_ether_link:1; unsigned no_ether_link:1;
unsigned ether_link_active_low:1; unsigned ether_link_active_low:1;
unsigned is_opened:1;
unsigned wol_enabled:1; unsigned wol_enabled:1;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment