Commit b1b243af authored by Yevgeny Petrilin's avatar Yevgeny Petrilin Committed by David S. Miller

mlx4_en: Move to SW counters for total bytes and packets

The per ring counters are implemented in SW. Now moving to have the total
counters as the sum of all rings. This way the numbers will always be consistent
and we no longer depend on HW buffer size limitations for those counters
that can be insufficient in some cases.
Signed-off-by: default avatarYevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 45b4d66d
...@@ -151,6 +151,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) ...@@ -151,6 +151,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
struct mlx4_cmd_mailbox *mailbox; struct mlx4_cmd_mailbox *mailbox;
u64 in_mod = reset << 8 | port; u64 in_mod = reset << 8 | port;
int err; int err;
int i;
mailbox = mlx4_alloc_cmd_mailbox(mdev->dev); mailbox = mlx4_alloc_cmd_mailbox(mdev->dev);
if (IS_ERR(mailbox)) if (IS_ERR(mailbox))
...@@ -165,38 +166,18 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) ...@@ -165,38 +166,18 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
spin_lock_bh(&priv->stats_lock); spin_lock_bh(&priv->stats_lock);
stats->rx_packets = be32_to_cpu(mlx4_en_stats->RTOTFRMS) - stats->rx_packets = 0;
be32_to_cpu(mlx4_en_stats->RDROP); stats->rx_bytes = 0;
stats->tx_packets = be64_to_cpu(mlx4_en_stats->TTOT_prio_0) + for (i = 0; i < priv->rx_ring_num; i++) {
be64_to_cpu(mlx4_en_stats->TTOT_prio_1) + stats->rx_packets += priv->rx_ring[i].packets;
be64_to_cpu(mlx4_en_stats->TTOT_prio_2) + stats->rx_bytes += priv->rx_ring[i].bytes;
be64_to_cpu(mlx4_en_stats->TTOT_prio_3) + }
be64_to_cpu(mlx4_en_stats->TTOT_prio_4) + stats->tx_packets = 0;
be64_to_cpu(mlx4_en_stats->TTOT_prio_5) + stats->tx_bytes = 0;
be64_to_cpu(mlx4_en_stats->TTOT_prio_6) + for (i = 0; i <= priv->tx_ring_num; i++) {
be64_to_cpu(mlx4_en_stats->TTOT_prio_7) + stats->tx_packets += priv->tx_ring[i].packets;
be64_to_cpu(mlx4_en_stats->TTOT_novlan) + stats->tx_bytes += priv->tx_ring[i].bytes;
be64_to_cpu(mlx4_en_stats->TTOT_loopbk); }
stats->rx_bytes = be64_to_cpu(mlx4_en_stats->ROCT_prio_0) +
be64_to_cpu(mlx4_en_stats->ROCT_prio_1) +
be64_to_cpu(mlx4_en_stats->ROCT_prio_2) +
be64_to_cpu(mlx4_en_stats->ROCT_prio_3) +
be64_to_cpu(mlx4_en_stats->ROCT_prio_4) +
be64_to_cpu(mlx4_en_stats->ROCT_prio_5) +
be64_to_cpu(mlx4_en_stats->ROCT_prio_6) +
be64_to_cpu(mlx4_en_stats->ROCT_prio_7) +
be64_to_cpu(mlx4_en_stats->ROCT_novlan);
stats->tx_bytes = be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_0) +
be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_1) +
be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_2) +
be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_3) +
be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_4) +
be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_5) +
be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_6) +
be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_7) +
be64_to_cpu(mlx4_en_stats->TTTLOCT_novlan) +
be64_to_cpu(mlx4_en_stats->TTTLOCT_loopbk);
stats->rx_errors = be64_to_cpu(mlx4_en_stats->PCS) + stats->rx_errors = be64_to_cpu(mlx4_en_stats->PCS) +
be32_to_cpu(mlx4_en_stats->RdropLength) + be32_to_cpu(mlx4_en_stats->RdropLength) +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment