From: Sathesh Edara <sedara@marvell.com>
To: <sburla@marvell.com>, <jerinj@marvell.com>, <sedara@marvell.com>,
"Radha Mohan Chintakuntla" <radhac@marvell.com>,
Veerasenareddy Burru <vburru@marvell.com>
Cc: <dev@dpdk.org>
Subject: [PATCH v2 2/3] net/octeon_ep: support basic stats
Date: Wed, 27 Jul 2022 02:21:33 -0700 [thread overview]
Message-ID: <20220727092134.141530-3-sedara@marvell.com> (raw)
In-Reply-To: <20220727092134.141530-1-sedara@marvell.com>
Added functionality to fetch and reset ethdev stats.
Signed-off-by: Sathesh Edara <sedara@marvell.com>
---
doc/guides/nics/features/octeon_ep.ini | 1 +
drivers/net/octeon_ep/otx_ep_ethdev.c | 52 ++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/doc/guides/nics/features/octeon_ep.ini b/doc/guides/nics/features/octeon_ep.ini
index 141d918466..b304ff8877 100644
--- a/doc/guides/nics/features/octeon_ep.ini
+++ b/doc/guides/nics/features/octeon_ep.ini
@@ -8,4 +8,5 @@ Speed capabilities = P
SR-IOV = Y
Linux = Y
x86-64 = Y
+Basic stats = Y
Usage doc = Y
diff --git a/drivers/net/octeon_ep/otx_ep_ethdev.c b/drivers/net/octeon_ep/otx_ep_ethdev.c
index 806add246b..cb45bd7a8a 100644
--- a/drivers/net/octeon_ep/otx_ep_ethdev.c
+++ b/drivers/net/octeon_ep/otx_ep_ethdev.c
@@ -337,6 +337,56 @@ otx_ep_tx_queue_release(struct rte_eth_dev *dev, uint16_t q_no)
otx_ep_delete_iqs(tq->otx_ep_dev, tq->q_no);
}
+static int
+otx_ep_dev_stats_reset(struct rte_eth_dev *dev)
+{
+ struct otx_ep_device *otx_epvf = OTX_EP_DEV(dev);
+ uint32_t i;
+
+ for (i = 0; i < otx_epvf->nb_tx_queues; i++)
+ memset(&otx_epvf->instr_queue[i]->stats, 0,
+ sizeof(struct otx_ep_iq_stats));
+
+ for (i = 0; i < otx_epvf->nb_rx_queues; i++)
+ memset(&otx_epvf->droq[i]->stats, 0,
+ sizeof(struct otx_ep_droq_stats));
+
+ return 0;
+}
+
+static int
+otx_ep_dev_stats_get(struct rte_eth_dev *eth_dev,
+ struct rte_eth_stats *stats)
+{
+ struct otx_ep_device *otx_epvf = OTX_EP_DEV(eth_dev);
+ struct otx_ep_iq_stats *ostats;
+ struct otx_ep_droq_stats *istats;
+ uint32_t i;
+
+ memset(stats, 0, sizeof(struct rte_eth_stats));
+
+ for (i = 0; i < otx_epvf->nb_tx_queues; i++) {
+ ostats = &otx_epvf->instr_queue[i]->stats;
+ stats->q_opackets[i] = ostats->tx_pkts;
+ stats->q_obytes[i] = ostats->tx_bytes;
+ stats->opackets += ostats->tx_pkts;
+ stats->obytes += ostats->tx_bytes;
+ stats->oerrors += ostats->instr_dropped;
+ }
+ for (i = 0; i < otx_epvf->nb_rx_queues; i++) {
+ istats = &otx_epvf->droq[i]->stats;
+ stats->q_ipackets[i] = istats->pkts_received;
+ stats->q_ibytes[i] = istats->bytes_received;
+ stats->q_errors[i] = istats->rx_err;
+ stats->ipackets += istats->pkts_received;
+ stats->ibytes += istats->bytes_received;
+ stats->imissed += istats->rx_alloc_failure;
+ stats->ierrors += istats->rx_err;
+ stats->rx_nombuf += istats->rx_alloc_failure;
+ }
+ return 0;
+}
+
/* Define our ethernet definitions */
static const struct eth_dev_ops otx_ep_eth_dev_ops = {
.dev_configure = otx_ep_dev_configure,
@@ -347,6 +397,8 @@ static const struct eth_dev_ops otx_ep_eth_dev_ops = {
.tx_queue_setup = otx_ep_tx_queue_setup,
.tx_queue_release = otx_ep_tx_queue_release,
.dev_infos_get = otx_ep_dev_info_get,
+ .stats_get = otx_ep_dev_stats_get,
+ .stats_reset = otx_ep_dev_stats_reset,
};
static int
--
2.36.1
next prev parent reply other threads:[~2022-07-27 9:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-27 9:21 [PATCH v2 0/3] net/octeon_ep: rename driver and add features Sathesh Edara
2022-07-27 9:21 ` [PATCH v2 1/3] net: rename octeon ep PMD Sathesh Edara
2022-08-16 5:32 ` Veerasenareddy Burru
2022-08-19 12:18 ` Jerin Jacob
2022-08-22 9:10 ` [PATCH v3 0/3] net/octeon_ep: rename driver and add features Sathesh Edara
2022-08-22 9:10 ` [PATCH v3 1/3] net/octeontx_ep: rename as octeon_ep Sathesh Edara
2022-08-22 9:10 ` [PATCH v3 2/3] net/octeon_ep: support basic stats Sathesh Edara
2022-08-22 9:10 ` [PATCH v3 3/3] net/octeon_ep: support link status Sathesh Edara
2022-08-23 5:50 ` [EXT] [PATCH v3 0/3] net/octeon_ep: rename driver and add features Veerasenareddy Burru
2022-08-27 12:24 ` Jerin Jacob
2022-07-27 9:21 ` Sathesh Edara [this message]
2022-08-16 5:34 ` [PATCH v2 2/3] net/octeon_ep: support basic stats Veerasenareddy Burru
2022-07-27 9:21 ` [PATCH v2 3/3] net/octeon_ep: support link status Sathesh Edara
2022-08-16 5:34 ` Veerasenareddy Burru
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=20220727092134.141530-3-sedara@marvell.com \
--to=sedara@marvell.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=radhac@marvell.com \
--cc=sburla@marvell.com \
--cc=vburru@marvell.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).