[dpdk-dev,v5,2/5] bnx2x: add xstats support
Commit Message
Add extended stats support to provide additional statistical info.
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 | 60 ++++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 1 deletion(-)
Comments
2016-05-11 17:06, Rasesh Mody:
> Add extended stats support to provide additional statistical info.
>
> Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
> Signed-off-by: Harish Patil <harish.patil@qlogic.com>
This bnx2x patch and a qede one cannot be merged in master tree
because of an API change:
http://dpdk.org/commit/bd6aa172
http://dpdk.org/commit/e2aae1c1
Please could you rework this patch for RC2?
Sorry for the inconvenience, I should have caught it earlier.
We'll try to synchronize the branches more often in future.
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Tuesday, June 28, 2016 7:34 AM
>
> 2016-05-11 17:06, Rasesh Mody:
> > Add extended stats support to provide additional statistical info.
> >
> > Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
> > Signed-off-by: Harish Patil <harish.patil@qlogic.com>
>
> This bnx2x patch and a qede one cannot be merged in master tree because
> of an API change:
> http://dpdk.org/commit/bd6aa172
> http://dpdk.org/commit/e2aae1c1
> Please could you rework this patch for RC2?
>
> Sorry for the inconvenience, I should have caught it earlier.
> We'll try to synchronize the branches more often in future.
Will work on it and submit patches to incorporate the API change.
@@ -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 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 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 Y Y
EEPROM dump Y Y Y
Registers dump Y Y Y Y Y Y
@@ -334,6 +334,64 @@ bnx2x_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
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_buffer_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_buffer_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_buffer_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_priority_flow_control");
+ 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_priority_flow_control");
+ xstats[num++].value = HILO_U64(sc->eth_stats.pfc_frames_received_hi,
+ sc->eth_stats.pfc_frames_received_lo);
+
+ return num;
+}
+
static void
bnx2x_dev_infos_get(struct rte_eth_dev *dev, __rte_unused struct rte_eth_dev_info *dev_info)
{
@@ -376,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,
@@ -399,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,