]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bnxt_en: Include some hardware port statistics in ndo_get_stats64().
authorMichael Chan <michael.chan@broadcom.com>
Mon, 7 Mar 2016 20:38:46 +0000 (15:38 -0500)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 7 Jul 2016 00:37:04 +0000 (17:37 -0700)
Orabug: 23221795

Include some of the port error counters (e.g. crc) in ->ndo_get_stats64()
for the PF device.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9947f83fb79ca501f5ab24c370211bfb78b6b364)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 2e6ba05cc73d94d79e56b0e27b079c2abb9c2faf..2d740517519427b6fb08ecfa0fe36580810d4a4f 100644 (file)
@@ -4954,6 +4954,22 @@ bnxt_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
                stats->tx_dropped += le64_to_cpu(hw_stats->tx_drop_pkts);
        }
 
+       if (bp->flags & BNXT_FLAG_PORT_STATS) {
+               struct rx_port_stats *rx = bp->hw_rx_port_stats;
+               struct tx_port_stats *tx = bp->hw_tx_port_stats;
+
+               stats->rx_crc_errors = le64_to_cpu(rx->rx_fcs_err_frames);
+               stats->rx_frame_errors = le64_to_cpu(rx->rx_align_err_frames);
+               stats->rx_length_errors = le64_to_cpu(rx->rx_undrsz_frames) +
+                                         le64_to_cpu(rx->rx_ovrsz_frames) +
+                                         le64_to_cpu(rx->rx_runt_frames);
+               stats->rx_errors = le64_to_cpu(rx->rx_false_carrier_frames) +
+                                  le64_to_cpu(rx->rx_jbr_frames);
+               stats->collisions = le64_to_cpu(tx->tx_total_collisions);
+               stats->tx_fifo_errors = le64_to_cpu(tx->tx_fifo_underruns);
+               stats->tx_errors = le64_to_cpu(tx->tx_err);
+       }
+
        return stats;
 }