Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 286678
b: refs/heads/master
c: b477ba6
h: refs/heads/master
v: v3
  • Loading branch information
Eugenia Emantayev authored and David S. Miller committed Jan 22, 2012
1 parent 0eca1f5 commit bf3184a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5a45f0086a2dcf50db7e6a0bf5be933880f85127
refs/heads/master: b477ba628a283ba93e631d66907f91df80e82267
36 changes: 24 additions & 12 deletions trunk/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,37 +807,49 @@ static void mlx4_en_restart(struct work_struct *work)
mutex_unlock(&mdev->state_lock);
}


static int mlx4_en_open(struct net_device *dev)
static void mlx4_en_clear_stats(struct net_device *dev)
{
struct mlx4_en_priv *priv = netdev_priv(dev);
struct mlx4_en_dev *mdev = priv->mdev;
int i;
int err = 0;

mutex_lock(&mdev->state_lock);

if (!mdev->device_up) {
en_err(priv, "Cannot open - device down/disabled\n");
err = -EBUSY;
goto out;
}

/* Reset HW statistics and performance counters */
if (mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 1))
en_dbg(HW, priv, "Failed dumping statistics\n");

memset(&priv->stats, 0, sizeof(priv->stats));
memset(&priv->pstats, 0, sizeof(priv->pstats));
memset(&priv->pkstats, 0, sizeof(priv->pkstats));
memset(&priv->port_stats, 0, sizeof(priv->port_stats));

for (i = 0; i < priv->tx_ring_num; i++) {
priv->tx_ring[i].bytes = 0;
priv->tx_ring[i].packets = 0;
priv->tx_ring[i].tx_csum = 0;
}
for (i = 0; i < priv->rx_ring_num; i++) {
priv->rx_ring[i].bytes = 0;
priv->rx_ring[i].packets = 0;
priv->rx_ring[i].csum_ok = 0;
priv->rx_ring[i].csum_none = 0;
}
}

static int mlx4_en_open(struct net_device *dev)
{
struct mlx4_en_priv *priv = netdev_priv(dev);
struct mlx4_en_dev *mdev = priv->mdev;
int err = 0;

mutex_lock(&mdev->state_lock);

if (!mdev->device_up) {
en_err(priv, "Cannot open - device down/disabled\n");
err = -EBUSY;
goto out;
}

/* Reset HW statistics and SW counters */
mlx4_en_clear_stats(dev);

err = mlx4_en_start_port(dev);
if (err)
Expand Down

0 comments on commit bf3184a

Please sign in to comment.