net/mlx4_en: get rid of private net_device_stats
We simply can use the standard net_device stats. We do not need to clear fields that are already 0. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Willem de Bruijn <willemb@google.com> Cc: Eugenia Emantayev <eugenia@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9ed17db17f
commit
f73a6f439f
|
@ -362,7 +362,7 @@ static void mlx4_en_get_ethtool_stats(struct net_device *dev,
|
|||
|
||||
for (i = 0; i < NUM_MAIN_STATS; i++, bitmap_iterator_inc(&it))
|
||||
if (bitmap_iterator_test(&it))
|
||||
data[index++] = ((unsigned long *)&priv->stats)[i];
|
||||
data[index++] = ((unsigned long *)&dev->stats)[i];
|
||||
|
||||
for (i = 0; i < NUM_PORT_STATS; i++, bitmap_iterator_inc(&it))
|
||||
if (bitmap_iterator_test(&it))
|
||||
|
|
|
@ -1302,7 +1302,7 @@ mlx4_en_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
|
|||
struct mlx4_en_priv *priv = netdev_priv(dev);
|
||||
|
||||
spin_lock_bh(&priv->stats_lock);
|
||||
netdev_stats_to_stats64(stats, &priv->stats);
|
||||
netdev_stats_to_stats64(stats, &dev->stats);
|
||||
spin_unlock_bh(&priv->stats_lock);
|
||||
|
||||
return stats;
|
||||
|
@ -1877,7 +1877,6 @@ static void mlx4_en_clear_stats(struct net_device *dev)
|
|||
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));
|
||||
|
|
|
@ -152,8 +152,9 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
|
|||
struct mlx4_counter tmp_counter_stats;
|
||||
struct mlx4_en_stat_out_mbox *mlx4_en_stats;
|
||||
struct mlx4_en_stat_out_flow_control_mbox *flowstats;
|
||||
struct mlx4_en_priv *priv = netdev_priv(mdev->pndev[port]);
|
||||
struct net_device_stats *stats = &priv->stats;
|
||||
struct net_device *dev = mdev->pndev[port];
|
||||
struct mlx4_en_priv *priv = netdev_priv(dev);
|
||||
struct net_device_stats *stats = &dev->stats;
|
||||
struct mlx4_cmd_mailbox *mailbox;
|
||||
u64 in_mod = reset << 8 | port;
|
||||
int err;
|
||||
|
@ -239,20 +240,11 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
|
|||
stats->multicast = en_stats_adder(&mlx4_en_stats->MCAST_prio_0,
|
||||
&mlx4_en_stats->MCAST_prio_1,
|
||||
NUM_PRIORITIES);
|
||||
stats->collisions = 0;
|
||||
stats->rx_dropped = be32_to_cpu(mlx4_en_stats->RDROP) +
|
||||
sw_rx_dropped;
|
||||
stats->rx_length_errors = be32_to_cpu(mlx4_en_stats->RdropLength);
|
||||
stats->rx_over_errors = 0;
|
||||
stats->rx_crc_errors = be32_to_cpu(mlx4_en_stats->RCRC);
|
||||
stats->rx_frame_errors = 0;
|
||||
stats->rx_fifo_errors = be32_to_cpu(mlx4_en_stats->RdropOvflw);
|
||||
stats->rx_missed_errors = 0;
|
||||
stats->tx_aborted_errors = 0;
|
||||
stats->tx_carrier_errors = 0;
|
||||
stats->tx_fifo_errors = 0;
|
||||
stats->tx_heartbeat_errors = 0;
|
||||
stats->tx_window_errors = 0;
|
||||
stats->tx_dropped += be32_to_cpu(mlx4_en_stats->TDROP);
|
||||
|
||||
/* RX stats */
|
||||
|
|
|
@ -483,7 +483,6 @@ struct mlx4_en_priv {
|
|||
struct mlx4_en_port_profile *prof;
|
||||
struct net_device *dev;
|
||||
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
|
||||
struct net_device_stats stats;
|
||||
struct mlx4_en_port_state port_state;
|
||||
spinlock_t stats_lock;
|
||||
struct ethtool_flow_id ethtool_rules[MAX_NUM_OF_FS_RULES];
|
||||
|
|
Loading…
Reference in New Issue