diff options
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 72fa807b69ce..be3f4156aaab 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -807,37 +807,49 @@ static void mlx4_en_restart(struct work_struct *work) | |||
807 | mutex_unlock(&mdev->state_lock); | 807 | mutex_unlock(&mdev->state_lock); |
808 | } | 808 | } |
809 | 809 | ||
810 | 810 | static void mlx4_en_clear_stats(struct net_device *dev) | |
811 | static int mlx4_en_open(struct net_device *dev) | ||
812 | { | 811 | { |
813 | struct mlx4_en_priv *priv = netdev_priv(dev); | 812 | struct mlx4_en_priv *priv = netdev_priv(dev); |
814 | struct mlx4_en_dev *mdev = priv->mdev; | 813 | struct mlx4_en_dev *mdev = priv->mdev; |
815 | int i; | 814 | int i; |
816 | int err = 0; | ||
817 | |||
818 | mutex_lock(&mdev->state_lock); | ||
819 | |||
820 | if (!mdev->device_up) { | ||
821 | en_err(priv, "Cannot open - device down/disabled\n"); | ||
822 | err = -EBUSY; | ||
823 | goto out; | ||
824 | } | ||
825 | 815 | ||
826 | /* Reset HW statistics and performance counters */ | ||
827 | if (mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 1)) | 816 | if (mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 1)) |
828 | en_dbg(HW, priv, "Failed dumping statistics\n"); | 817 | en_dbg(HW, priv, "Failed dumping statistics\n"); |
829 | 818 | ||
830 | memset(&priv->stats, 0, sizeof(priv->stats)); | 819 | memset(&priv->stats, 0, sizeof(priv->stats)); |
831 | memset(&priv->pstats, 0, sizeof(priv->pstats)); | 820 | memset(&priv->pstats, 0, sizeof(priv->pstats)); |
821 | memset(&priv->pkstats, 0, sizeof(priv->pkstats)); | ||
822 | memset(&priv->port_stats, 0, sizeof(priv->port_stats)); | ||
832 | 823 | ||
833 | for (i = 0; i < priv->tx_ring_num; i++) { | 824 | for (i = 0; i < priv->tx_ring_num; i++) { |
834 | priv->tx_ring[i].bytes = 0; | 825 | priv->tx_ring[i].bytes = 0; |
835 | priv->tx_ring[i].packets = 0; | 826 | priv->tx_ring[i].packets = 0; |
827 | priv->tx_ring[i].tx_csum = 0; | ||
836 | } | 828 | } |
837 | for (i = 0; i < priv->rx_ring_num; i++) { | 829 | for (i = 0; i < priv->rx_ring_num; i++) { |
838 | priv->rx_ring[i].bytes = 0; | 830 | priv->rx_ring[i].bytes = 0; |
839 | priv->rx_ring[i].packets = 0; | 831 | priv->rx_ring[i].packets = 0; |
832 | priv->rx_ring[i].csum_ok = 0; | ||
833 | priv->rx_ring[i].csum_none = 0; | ||
840 | } | 834 | } |
835 | } | ||
836 | |||
837 | static int mlx4_en_open(struct net_device *dev) | ||
838 | { | ||
839 | struct mlx4_en_priv *priv = netdev_priv(dev); | ||
840 | struct mlx4_en_dev *mdev = priv->mdev; | ||
841 | int err = 0; | ||
842 | |||
843 | mutex_lock(&mdev->state_lock); | ||
844 | |||
845 | if (!mdev->device_up) { | ||
846 | en_err(priv, "Cannot open - device down/disabled\n"); | ||
847 | err = -EBUSY; | ||
848 | goto out; | ||
849 | } | ||
850 | |||
851 | /* Reset HW statistics and SW counters */ | ||
852 | mlx4_en_clear_stats(dev); | ||
841 | 853 | ||
842 | err = mlx4_en_start_port(dev); | 854 | err = mlx4_en_start_port(dev); |
843 | if (err) | 855 | if (err) |