]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/net/ethernet/mellanox/mlx4/en_port.c
net/mlx4_en: Use HW counters for rx/tx bytes/packets in PF device
[linux.git] / drivers / net / ethernet / mellanox / mlx4 / en_port.c
index 73f6277d9ac1e454b726e5efecb8072f90420786..ee99e67187f5b1cc68fc224b91d5b2bf2d133b05 100644 (file)
@@ -203,6 +203,20 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
                priv->port_stats.tso_packets       += ring->tso_packets;
                priv->port_stats.xmit_more         += ring->xmit_more;
        }
+       if (mlx4_is_master(mdev->dev)) {
+               stats->rx_packets = en_stats_adder(&mlx4_en_stats->RTOT_prio_0,
+                                                  &mlx4_en_stats->RTOT_prio_1,
+                                                  NUM_PRIORITIES);
+               stats->tx_packets = en_stats_adder(&mlx4_en_stats->TTOT_prio_0,
+                                                  &mlx4_en_stats->TTOT_prio_1,
+                                                  NUM_PRIORITIES);
+               stats->rx_bytes = en_stats_adder(&mlx4_en_stats->ROCT_prio_0,
+                                                &mlx4_en_stats->ROCT_prio_1,
+                                                NUM_PRIORITIES);
+               stats->tx_bytes = en_stats_adder(&mlx4_en_stats->TOCT_prio_0,
+                                                &mlx4_en_stats->TOCT_prio_1,
+                                                NUM_PRIORITIES);
+       }
 
        /* net device stats */
        stats->rx_errors = be64_to_cpu(mlx4_en_stats->PCS) +