diff options
author | Felix Fietkau <nbd@nbd.name> | 2018-04-15 19:24:42 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2018-04-17 11:29:31 +0200 |
commit | 173d93ea23dabf4f08228dc2aaf70a004cf4141c (patch) | |
tree | 1ddd936fa0d8f79ec64ee01273f7b1ad5f0aebe2 /target/linux/ramips/files-4.14/drivers/net/ethernet/mtk | |
parent | e988b0fe0dc96997755580201e2c3681791d02bd (diff) | |
download | upstream-173d93ea23dabf4f08228dc2aaf70a004cf4141c.tar.gz upstream-173d93ea23dabf4f08228dc2aaf70a004cf4141c.tar.bz2 upstream-173d93ea23dabf4f08228dc2aaf70a004cf4141c.zip |
ramips: fix locking issues in the ethernet driver
The stats update needs to protect against being interrupted by a tasklet
The u64 stats seqlock needs to be initialized
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target/linux/ramips/files-4.14/drivers/net/ethernet/mtk')
-rw-r--r-- | target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.c index 49505eab86..d0d88b92c5 100644 --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.c +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.c @@ -477,9 +477,9 @@ static void fe_get_stats64(struct net_device *dev, } if (netif_running(dev) && netif_device_present(dev)) { - if (spin_trylock(&hwstats->stats_lock)) { + if (spin_trylock_bh(&hwstats->stats_lock)) { fe_stats_update(priv); - spin_unlock(&hwstats->stats_lock); + spin_unlock_bh(&hwstats->stats_lock); } } @@ -1581,6 +1581,7 @@ static int fe_probe(struct platform_device *pdev) priv->tx_ring.tx_ring_size = NUM_DMA_DESC; priv->rx_ring.rx_ring_size = NUM_DMA_DESC; INIT_WORK(&priv->pending_work, fe_pending_work); + u64_stats_init(&priv->hw_stats->syncp); napi_weight = 16; if (priv->flags & FE_FLAG_NAPI_WEIGHT) { |