DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rasesh Mody <rasesh.mody@qlogic.com>
To: <dev@dpdk.org>
Cc: <Dept-EngDPDKDev@qlogic.com>,
	Rasesh Mody <rasesh.mody@qlogic.com>,
	Harish Patil <harish.patil@qlogic.com>
Subject: [dpdk-dev] [PATCH v4 2/3] bnx2x: enhance stats get
Date: Tue, 3 May 2016 22:38:21 -0700	[thread overview]
Message-ID: <1462340302-25683-2-git-send-email-rasesh.mody@qlogic.com> (raw)
In-Reply-To: <1462340302-25683-1-git-send-email-rasesh.mody@qlogic.com>

Enhance the stats_get() routine to display drop counters under
imissed counter.
Added extended stats get support to provide additional info.
Encorporated review comment to rename some of the stats.

Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Signed-off-by: Harish Patil <harish.patil@qlogic.com>
---
 doc/guides/nics/overview.rst     |    2 +-
 drivers/net/bnx2x/bnx2x_ethdev.c |   76 ++++++++++++++++++++++++++++++++++++++
 drivers/net/bnx2x/bnx2x_rxtx.c   |    2 +
 3 files changed, 79 insertions(+), 1 deletion(-)

diff --git a/doc/guides/nics/overview.rst b/doc/guides/nics/overview.rst
index f08039e..70b0caf 100644
--- a/doc/guides/nics/overview.rst
+++ b/doc/guides/nics/overview.rst
@@ -128,7 +128,7 @@ Most of these differences are summarized below.
    Packet type parsing          Y     Y Y   Y   Y Y Y   Y   Y Y Y Y Y Y
    Timesync                             Y Y     Y   Y Y
    Basic stats            Y Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y       Y   Y Y Y Y
-   Extended stats                   Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y                   Y Y
+   Extended stats         Y Y       Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y                   Y Y
    Stats per queue              Y                   Y Y     Y Y Y Y Y Y           Y   Y Y
    EEPROM dump                                  Y   Y Y
    Registers dump                               Y Y Y Y Y Y
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 071b44f..062ffbc 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -276,6 +276,9 @@ static void
 bnx2x_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 {
 	struct bnx2x_softc *sc = dev->data->dev_private;
+	uint32_t brb_truncate_discard;
+	uint64_t brb_drops;
+	uint64_t brb_truncates;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -316,6 +319,77 @@ bnx2x_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	stats->rx_nombuf =
 		HILO_U64(sc->eth_stats.no_buff_discard_hi,
 				sc->eth_stats.no_buff_discard_lo);
+
+	brb_drops =
+		HILO_U64(sc->eth_stats.brb_drop_hi,
+			 sc->eth_stats.brb_drop_lo);
+
+	brb_truncates =
+		HILO_U64(sc->eth_stats.brb_truncate_hi,
+			 sc->eth_stats.brb_truncate_lo);
+
+	brb_truncate_discard = sc->eth_stats.brb_truncate_discard;
+
+	stats->imissed = brb_drops + brb_truncates +
+			 brb_truncate_discard + stats->rx_nombuf;
+}
+
+#define BNX2X_EXTENDED_STATS 9
+
+static int
+bnx2x_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstats *xstats,
+		     unsigned int n)
+{
+	struct bnx2x_softc *sc = dev->data->dev_private;
+	unsigned int num = BNX2X_EXTENDED_STATS;
+
+	if (n < num)
+		return num;
+
+	num = 0;
+
+	bnx2x_stats_handle(sc, STATS_EVENT_UPDATE);
+
+	snprintf(xstats[num].name, sizeof(xstats[num].name), "rx_buf_drops");
+	xstats[num++].value = HILO_U64(sc->eth_stats.brb_drop_hi,
+				       sc->eth_stats.brb_drop_lo);
+
+	snprintf(xstats[num].name, sizeof(xstats[num].name),
+		 "rx_buf_truncates");
+	xstats[num++].value = HILO_U64(sc->eth_stats.brb_truncate_hi,
+				       sc->eth_stats.brb_truncate_lo);
+
+	snprintf(xstats[num].name, sizeof(xstats[num].name),
+		 "rx_buf_truncate_discard");
+	xstats[num++].value = sc->eth_stats.brb_truncate_discard;
+
+	snprintf(xstats[num].name, sizeof(xstats[num].name),
+		 "mac_filter_discard");
+	xstats[num++].value = sc->eth_stats.mac_filter_discard;
+
+	snprintf(xstats[num].name, sizeof(xstats[num].name),
+		 "no_match_vlan_tag_discard");
+	xstats[num++].value = sc->eth_stats.mf_tag_discard;
+
+	snprintf(xstats[num].name, sizeof(xstats[num].name), "tx_pause");
+	xstats[num++].value = HILO_U64(sc->eth_stats.pause_frames_sent_hi,
+				       sc->eth_stats.pause_frames_sent_lo);
+
+	snprintf(xstats[num].name, sizeof(xstats[num].name), "rx_pause");
+	xstats[num++].value = HILO_U64(sc->eth_stats.pause_frames_received_hi,
+				       sc->eth_stats.pause_frames_received_lo);
+
+	snprintf(xstats[num].name, sizeof(xstats[num].name),
+		 "tx_prio_flow_ctrl");
+	xstats[num++].value = HILO_U64(sc->eth_stats.pfc_frames_sent_hi,
+				       sc->eth_stats.pfc_frames_sent_lo);
+
+	snprintf(xstats[num].name, sizeof(xstats[num].name),
+		 "rx_prio_flow_ctrl");
+	xstats[num++].value = HILO_U64(sc->eth_stats.pfc_frames_received_hi,
+				       sc->eth_stats.pfc_frames_received_lo);
+
+	return num;
 }
 
 static void
@@ -360,6 +434,7 @@ static const struct eth_dev_ops bnx2x_eth_dev_ops = {
 	.allmulticast_disable         = bnx2x_dev_allmulticast_disable,
 	.link_update                  = bnx2x_dev_link_update,
 	.stats_get                    = bnx2x_dev_stats_get,
+	.xstats_get                   = bnx2x_dev_xstats_get,
 	.dev_infos_get                = bnx2x_dev_infos_get,
 	.rx_queue_setup               = bnx2x_dev_rx_queue_setup,
 	.rx_queue_release             = bnx2x_dev_rx_queue_release,
@@ -383,6 +458,7 @@ static const struct eth_dev_ops bnx2xvf_eth_dev_ops = {
 	.allmulticast_disable         = bnx2x_dev_allmulticast_disable,
 	.link_update                  = bnx2xvf_dev_link_update,
 	.stats_get                    = bnx2x_dev_stats_get,
+	.xstats_get                   = bnx2x_dev_xstats_get,
 	.dev_infos_get                = bnx2x_dev_infos_get,
 	.rx_queue_setup               = bnx2x_dev_rx_queue_setup,
 	.rx_queue_release             = bnx2x_dev_rx_queue_release,
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index 8b047d4..60bd08b 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -405,6 +405,8 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		new_mb = bnx2x_rxmbuf_alloc(rxq->mb_pool);
 		if (unlikely(!new_mb)) {
 			PMD_RX_LOG(ERR, "mbuf alloc fail fp[%02d]", fp->index);
+			rte_eth_devices[rxq->port_id].data->
+					rx_mbuf_alloc_failed++;
 			goto next_rx;
 		}
 
-- 
1.7.10.3

  reply	other threads:[~2016-05-04  5:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04  5:38 [dpdk-dev] [PATCH v4 1/3] bnx2x: refactor Tx routine for single doorbell mechanism Rasesh Mody
2016-05-04  5:38 ` Rasesh Mody [this message]
2016-05-06 14:47   ` [dpdk-dev] [PATCH v4 2/3] bnx2x: enhance stats get Bruce Richardson
2016-05-07  0:14     ` Rasesh Mody
2016-05-10 10:27       ` Remy Horton
2016-05-11  0:58         ` Rasesh Mody
2016-06-21  9:00           ` Remy Horton
2016-05-04  5:38 ` [dpdk-dev] [PATCH v4 3/3] bnx2x: update PMD version to 1.0.1.1 Rasesh Mody
2016-05-06 14:45 ` [dpdk-dev] [PATCH v4 1/3] bnx2x: refactor Tx routine for single doorbell mechanism Bruce Richardson
2016-05-11  5:41   ` Harish Patil

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=1462340302-25683-2-git-send-email-rasesh.mody@qlogic.com \
    --to=rasesh.mody@qlogic.com \
    --cc=Dept-EngDPDKDev@qlogic.com \
    --cc=dev@dpdk.org \
    --cc=harish.patil@qlogic.com \
    /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).