diff options
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/en_netdev.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 38 |
1 files changed, 26 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..467ae5824875 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -702,6 +702,8 @@ int mlx4_en_start_port(struct net_device *dev) | |||
702 | /* Schedule multicast task to populate multicast list */ | 702 | /* Schedule multicast task to populate multicast list */ |
703 | queue_work(mdev->workqueue, &priv->mcast_task); | 703 | queue_work(mdev->workqueue, &priv->mcast_task); |
704 | 704 | ||
705 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); | ||
706 | |||
705 | priv->port_up = true; | 707 | priv->port_up = true; |
706 | netif_tx_start_all_queues(dev); | 708 | netif_tx_start_all_queues(dev); |
707 | return 0; | 709 | return 0; |
@@ -807,38 +809,50 @@ static void mlx4_en_restart(struct work_struct *work) | |||
807 | mutex_unlock(&mdev->state_lock); | 809 | mutex_unlock(&mdev->state_lock); |
808 | } | 810 | } |
809 | 811 | ||
810 | 812 | static void mlx4_en_clear_stats(struct net_device *dev) | |
811 | static int mlx4_en_open(struct net_device *dev) | ||
812 | { | 813 | { |
813 | struct mlx4_en_priv *priv = netdev_priv(dev); | 814 | struct mlx4_en_priv *priv = netdev_priv(dev); |
814 | struct mlx4_en_dev *mdev = priv->mdev; | 815 | struct mlx4_en_dev *mdev = priv->mdev; |
815 | int i; | 816 | 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 | 817 | ||
826 | /* Reset HW statistics and performance counters */ | ||
827 | if (mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 1)) | 818 | if (mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 1)) |
828 | en_dbg(HW, priv, "Failed dumping statistics\n"); | 819 | en_dbg(HW, priv, "Failed dumping statistics\n"); |
829 | 820 | ||
830 | memset(&priv->stats, 0, sizeof(priv->stats)); | 821 | memset(&priv->stats, 0, sizeof(priv->stats)); |
831 | memset(&priv->pstats, 0, sizeof(priv->pstats)); | 822 | memset(&priv->pstats, 0, sizeof(priv->pstats)); |
823 | memset(&priv->pkstats, 0, sizeof(priv->pkstats)); | ||
824 | memset(&priv->port_stats, 0, sizeof(priv->port_stats)); | ||
832 | 825 | ||
833 | for (i = 0; i < priv->tx_ring_num; i++) { | 826 | for (i = 0; i < priv->tx_ring_num; i++) { |
834 | priv->tx_ring[i].bytes = 0; | 827 | priv->tx_ring[i].bytes = 0; |
835 | priv->tx_ring[i].packets = 0; | 828 | priv->tx_ring[i].packets = 0; |
829 | priv->tx_ring[i].tx_csum = 0; | ||
836 | } | 830 | } |
837 | for (i = 0; i < priv->rx_ring_num; i++) { | 831 | for (i = 0; i < priv->rx_ring_num; i++) { |
838 | priv->rx_ring[i].bytes = 0; | 832 | priv->rx_ring[i].bytes = 0; |
839 | priv->rx_ring[i].packets = 0; | 833 | priv->rx_ring[i].packets = 0; |
834 | priv->rx_ring[i].csum_ok = 0; | ||
835 | priv->rx_ring[i].csum_none = 0; | ||
836 | } | ||
837 | } | ||
838 | |||
839 | static int mlx4_en_open(struct net_device *dev) | ||
840 | { | ||
841 | struct mlx4_en_priv *priv = netdev_priv(dev); | ||
842 | struct mlx4_en_dev *mdev = priv->mdev; | ||
843 | int err = 0; | ||
844 | |||
845 | mutex_lock(&mdev->state_lock); | ||
846 | |||
847 | if (!mdev->device_up) { | ||
848 | en_err(priv, "Cannot open - device down/disabled\n"); | ||
849 | err = -EBUSY; | ||
850 | goto out; | ||
840 | } | 851 | } |
841 | 852 | ||
853 | /* Reset HW statistics and SW counters */ | ||
854 | mlx4_en_clear_stats(dev); | ||
855 | |||
842 | err = mlx4_en_start_port(dev); | 856 | err = mlx4_en_start_port(dev); |
843 | if (err) | 857 | if (err) |
844 | en_err(priv, "Failed starting port:%d\n", priv->port); | 858 | en_err(priv, "Failed starting port:%d\n", priv->port); |