From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com,
Kalesh AP <kalesh-anakkur.purayil@broadcom.com>,
Lance Richardson <lance.richardson@broadcom.com>
Subject: [dpdk-dev] [PATCH 4/6] net/bnxt: fix output of port xstats
Date: Sat, 8 Jun 2019 23:22:06 +0400 [thread overview]
Message-ID: <20190608192208.77607-5-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20190608192208.77607-1-ajit.khaparde@broadcom.com>
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
If the HWRM_PORT_QSTATS_EXT fails to initialize
fw_rx_port_stats_ext_size or fw_tx_port_stats_ext_size,
the driver can end up passing junk statistics to the application.
Instead of relying on the application to initialize the xstats
buffer before calling the xstats_get dev_op, memset xstats
with zeros to avoid returning or displaying incorrect statistics.
Also fixed the buffer starting offset.
Fixes: f55e12f33416 ("net/bnxt: support extended port counters")
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 6 ++++--
drivers/net/bnxt/bnxt_stats.c | 2 ++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e527df1bf..4133d0bef 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3775,7 +3775,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
goto skip_ext_stats;
bp->hw_rx_port_stats_ext = (void *)
- (bp->hw_rx_port_stats + sizeof(struct rx_port_stats));
+ ((uint8_t *)bp->hw_rx_port_stats +
+ sizeof(struct rx_port_stats));
bp->hw_rx_port_stats_ext_map = bp->hw_rx_port_stats_map +
sizeof(struct rx_port_stats);
bp->flags |= BNXT_FLAG_EXT_RX_PORT_STATS;
@@ -3783,7 +3784,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
if (bp->hwrm_spec_code < HWRM_SPEC_CODE_1_9_2) {
bp->hw_tx_port_stats_ext = (void *)
- (bp->hw_tx_port_stats + sizeof(struct tx_port_stats));
+ ((uint8_t *)bp->hw_tx_port_stats +
+ sizeof(struct tx_port_stats));
bp->hw_tx_port_stats_ext_map =
bp->hw_tx_port_stats_map +
sizeof(struct tx_port_stats);
diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index ad2888774..3cd5144ec 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -415,6 +415,8 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
unsigned int stat_size = sizeof(uint64_t);
unsigned int stat_count;
+ memset(xstats, 0, sizeof(*xstats));
+
bnxt_hwrm_port_qstats(bp);
bnxt_hwrm_func_qstats_tx_drop(bp, 0xffff, &tx_drop_pkts);
bnxt_hwrm_ext_port_qstats(bp);
--
2.20.1 (Apple Git-117)
next prev parent reply other threads:[~2019-06-08 19:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-08 19:22 [dpdk-dev] [PATCH 0/6] bnxt patch series Ajit Khaparde
2019-06-08 19:22 ` [dpdk-dev] [PATCH 1/6] net/bnxt: add code to redirect tunnel packets Ajit Khaparde
2019-06-08 19:22 ` [dpdk-dev] [PATCH 2/6] net/bnxt: fix to check for NULL completion ring doorbell in int_handler Ajit Khaparde
2019-06-12 14:44 ` Ferruh Yigit
2019-06-12 14:49 ` Ferruh Yigit
2019-06-08 19:22 ` [dpdk-dev] [PATCH 3/6] net/bnxt: driver to use configured MTU value during load Ajit Khaparde
2019-06-08 19:22 ` Ajit Khaparde [this message]
2019-06-08 19:22 ` [dpdk-dev] [PATCH 5/6] net/bnxt: fix interrupt vector array initialization Ajit Khaparde
2019-06-08 19:22 ` [dpdk-dev] [PATCH 6/6] net/bnxt: address build errors reported by intel compiler Ajit Khaparde
2019-06-12 15:41 ` [dpdk-dev] [PATCH 0/6] bnxt patch series Ferruh Yigit
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=20190608192208.77607-5-ajit.khaparde@broadcom.com \
--to=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=kalesh-anakkur.purayil@broadcom.com \
--cc=lance.richardson@broadcom.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).