netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH v2 net-next 6/8] bnxt_en: Include some hardware port statistics in ndo_get_stats64().
Date: Mon,  7 Mar 2016 15:38:46 -0500	[thread overview]
Message-ID: <1457383128-28645-7-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1457383128-28645-1-git-send-email-michael.chan@broadcom.com>

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>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index c5e812a..18a14a5 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -4934,6 +4934,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;
 }
 
-- 
1.8.3.1

  parent reply	other threads:[~2016-03-07 20:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-07 20:38 [PATCH v2 net-next 0/8] bnxt_en: Updates for net-next Michael Chan
2016-03-07 20:38 ` [PATCH v2 net-next 1/8] bnxt_en: Refactor bnxt_fw_to_ethtool_advertised_spds() Michael Chan
2016-03-07 20:38 ` [PATCH v2 net-next 2/8] bnxt_en: Add reporting of link partner advertisement Michael Chan
2016-03-07 20:38 ` [PATCH v2 net-next 3/8] bnxt_en: Use common function to get ethtool supported flags Michael Chan
2016-03-07 20:38 ` [PATCH v2 net-next 4/8] bnxt_en: Extend autoneg to all speeds Michael Chan
2016-03-07 20:38 ` [PATCH v2 net-next 5/8] bnxt_en: Add port statistics support Michael Chan
2016-03-07 20:38 ` Michael Chan [this message]
2016-03-07 20:38 ` [PATCH v2 net-next 7/8] bnxt_en: Include hardware port statistics in ethtool -S Michael Chan
2016-03-07 20:38 ` [PATCH v2 net-next 8/8] bnxt_en: Enable AER support Michael Chan
2016-03-08 19:52 ` [PATCH v2 net-next 0/8] bnxt_en: Updates for net-next David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1457383128-28645-7-git-send-email-michael.chan@broadcom.com \
    --to=michael.chan@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).