diff options
-rw-r--r-- | drivers/net/ethernet/sfc/efx.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/ethtool.c | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/net_driver.h | 1 |
3 files changed, 9 insertions, 3 deletions
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index eff5d300aa0a..8f4cbb642bf2 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c | |||
@@ -1743,8 +1743,8 @@ static struct rtnl_link_stats64 *efx_net_stats(struct net_device *net_dev, struc | |||
1743 | struct efx_mac_stats *mac_stats = &efx->mac_stats; | 1743 | struct efx_mac_stats *mac_stats = &efx->mac_stats; |
1744 | 1744 | ||
1745 | spin_lock_bh(&efx->stats_lock); | 1745 | spin_lock_bh(&efx->stats_lock); |
1746 | |||
1746 | efx->type->update_stats(efx); | 1747 | efx->type->update_stats(efx); |
1747 | spin_unlock_bh(&efx->stats_lock); | ||
1748 | 1748 | ||
1749 | stats->rx_packets = mac_stats->rx_packets; | 1749 | stats->rx_packets = mac_stats->rx_packets; |
1750 | stats->tx_packets = mac_stats->tx_packets; | 1750 | stats->tx_packets = mac_stats->tx_packets; |
@@ -1768,6 +1768,8 @@ static struct rtnl_link_stats64 *efx_net_stats(struct net_device *net_dev, struc | |||
1768 | stats->tx_errors = (stats->tx_window_errors + | 1768 | stats->tx_errors = (stats->tx_window_errors + |
1769 | mac_stats->tx_bad); | 1769 | mac_stats->tx_bad); |
1770 | 1770 | ||
1771 | spin_unlock_bh(&efx->stats_lock); | ||
1772 | |||
1771 | return stats; | 1773 | return stats; |
1772 | } | 1774 | } |
1773 | 1775 | ||
diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c index 52c9ee4c8aa3..55a25b14d304 100644 --- a/drivers/net/ethernet/sfc/ethtool.c +++ b/drivers/net/ethernet/sfc/ethtool.c | |||
@@ -489,13 +489,14 @@ static void efx_ethtool_get_stats(struct net_device *net_dev, | |||
489 | const struct efx_ethtool_stat *stat; | 489 | const struct efx_ethtool_stat *stat; |
490 | struct efx_channel *channel; | 490 | struct efx_channel *channel; |
491 | struct efx_tx_queue *tx_queue; | 491 | struct efx_tx_queue *tx_queue; |
492 | struct rtnl_link_stats64 temp; | ||
493 | int i; | 492 | int i; |
494 | 493 | ||
495 | EFX_BUG_ON_PARANOID(stats->n_stats != EFX_ETHTOOL_NUM_STATS); | 494 | EFX_BUG_ON_PARANOID(stats->n_stats != EFX_ETHTOOL_NUM_STATS); |
496 | 495 | ||
496 | spin_lock_bh(&efx->stats_lock); | ||
497 | |||
497 | /* Update MAC and NIC statistics */ | 498 | /* Update MAC and NIC statistics */ |
498 | dev_get_stats(net_dev, &temp); | 499 | efx->type->update_stats(efx); |
499 | 500 | ||
500 | /* Fill detailed statistics buffer */ | 501 | /* Fill detailed statistics buffer */ |
501 | for (i = 0; i < EFX_ETHTOOL_NUM_STATS; i++) { | 502 | for (i = 0; i < EFX_ETHTOOL_NUM_STATS; i++) { |
@@ -525,6 +526,8 @@ static void efx_ethtool_get_stats(struct net_device *net_dev, | |||
525 | break; | 526 | break; |
526 | } | 527 | } |
527 | } | 528 | } |
529 | |||
530 | spin_unlock_bh(&efx->stats_lock); | ||
528 | } | 531 | } |
529 | 532 | ||
530 | static void efx_ethtool_self_test(struct net_device *net_dev, | 533 | static void efx_ethtool_self_test(struct net_device *net_dev, |
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index 9353ce801752..b6040141ef79 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h | |||
@@ -704,6 +704,7 @@ struct efx_filter_state; | |||
704 | * can provide. Generic code converts these into a standard | 704 | * can provide. Generic code converts these into a standard |
705 | * &struct net_device_stats. | 705 | * &struct net_device_stats. |
706 | * @stats_lock: Statistics update lock. Serialises statistics fetches | 706 | * @stats_lock: Statistics update lock. Serialises statistics fetches |
707 | * and access to @mac_stats. | ||
707 | * | 708 | * |
708 | * This is stored in the private area of the &struct net_device. | 709 | * This is stored in the private area of the &struct net_device. |
709 | */ | 710 | */ |