DPDK patches and discussions
 help / color / mirror / Atom feed
From: Harry van Haaren <harry.van.haaren@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v4 06/10] ixgbe: add extended statistic strings
Date: Fri, 30 Oct 2015 11:36:34 +0000	[thread overview]
Message-ID: <1446204998-17151-7-git-send-email-harry.van.haaren@intel.com> (raw)
In-Reply-To: <1446204998-17151-1-git-send-email-harry.van.haaren@intel.com>

Added and updated statistic strings as used by xstats_get(),
exposed extended queue statistics.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 203 +++++++++++++++++++++++++++++++++------
 1 file changed, 172 insertions(+), 31 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 4373661..c657955 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -510,33 +510,95 @@ struct rte_ixgbe_xstats_name_off {
 };
 
 static const struct rte_ixgbe_xstats_name_off rte_ixgbe_stats_strings[] = {
-	{"rx_illegal_byte_err", offsetof(struct ixgbe_hw_stats, errbc)},
-	{"rx_len_err", offsetof(struct ixgbe_hw_stats, rlec)},
-	{"rx_undersize_count", offsetof(struct ixgbe_hw_stats, ruc)},
-	{"rx_oversize_count", offsetof(struct ixgbe_hw_stats, roc)},
-	{"rx_fragment_count", offsetof(struct ixgbe_hw_stats, rfc)},
-	{"rx_jabber_count", offsetof(struct ixgbe_hw_stats, rjc)},
-	{"l3_l4_xsum_error", offsetof(struct ixgbe_hw_stats, xec)},
-	{"mac_local_fault", offsetof(struct ixgbe_hw_stats, mlfc)},
-	{"mac_remote_fault", offsetof(struct ixgbe_hw_stats, mrfc)},
-	{"mac_short_pkt_discard", offsetof(struct ixgbe_hw_stats, mspdc)},
-	{"fccrc_error", offsetof(struct ixgbe_hw_stats, fccrc)},
-	{"fcoe_drop", offsetof(struct ixgbe_hw_stats, fcoerpdc)},
-	{"fc_last_error", offsetof(struct ixgbe_hw_stats, fclast)},
-	{"rx_broadcast_packets", offsetof(struct ixgbe_hw_stats, bprc)},
-	{"rx_phy_multicast_packets", offsetof(struct ixgbe_hw_stats, mprc)},
-	{"mgmt_pkts_dropped", offsetof(struct ixgbe_hw_stats, mngpdc)},
 	{"rx_crc_errors", offsetof(struct ixgbe_hw_stats, crcerrs)},
-	{"fdir_match", offsetof(struct ixgbe_hw_stats, fdirmatch)},
-	{"fdir_miss", offsetof(struct ixgbe_hw_stats, fdirmiss)},
-	{"tx_flow_control_xon", offsetof(struct ixgbe_hw_stats, lxontxc)},
-	{"rx_flow_control_xon", offsetof(struct ixgbe_hw_stats, lxonrxc)},
-	{"tx_flow_control_xoff", offsetof(struct ixgbe_hw_stats, lxofftxc)},
-	{"rx_flow_control_xoff", offsetof(struct ixgbe_hw_stats, lxoffrxc)},
+	{"rx_illegal_byte_errors", offsetof(struct ixgbe_hw_stats, illerrc)},
+	{"rx_error_bytes", offsetof(struct ixgbe_hw_stats, errbc)},
+	{"mac_local_errors", offsetof(struct ixgbe_hw_stats, mlfc)},
+	{"mac_remote_errors", offsetof(struct ixgbe_hw_stats, mrfc)},
+	{"rx_length_errors", offsetof(struct ixgbe_hw_stats, rlec)},
+	{"tx_xon_packets", offsetof(struct ixgbe_hw_stats, lxontxc)},
+	{"rx_xon_packets", offsetof(struct ixgbe_hw_stats, lxonrxc)},
+	{"tx_xoff_packets", offsetof(struct ixgbe_hw_stats, lxofftxc)},
+	{"rx_xoff_packets", offsetof(struct ixgbe_hw_stats, lxoffrxc)},
+	{"rx_size_64_packets", offsetof(struct ixgbe_hw_stats, prc64)},
+	{"rx_size_65_to_127_packets", offsetof(struct ixgbe_hw_stats, prc127)},
+	{"rx_size_128_to_255_packets", offsetof(struct ixgbe_hw_stats, prc255)},
+	{"rx_size_256_to_511_packets", offsetof(struct ixgbe_hw_stats, prc511)},
+	{"rx_size_512_to_1023_packets", offsetof(struct ixgbe_hw_stats,
+		prc1023)},
+	{"rx_size_1024_to_max_packets", offsetof(struct ixgbe_hw_stats,
+		prc1522)},
+	{"rx_broadcast_packets", offsetof(struct ixgbe_hw_stats, bprc)},
+	{"rx_multicast_packets", offsetof(struct ixgbe_hw_stats, mprc)},
+	{"rx_fragment_errors", offsetof(struct ixgbe_hw_stats, rfc)},
+	{"rx_undersize_errors", offsetof(struct ixgbe_hw_stats, ruc)},
+	{"rx_oversize_errors", offsetof(struct ixgbe_hw_stats, roc)},
+	{"rx_jabber_errors", offsetof(struct ixgbe_hw_stats, rjc)},
+	{"rx_managment_packets", offsetof(struct ixgbe_hw_stats, mngprc)},
+	{"rx_managment_dropped", offsetof(struct ixgbe_hw_stats, mngpdc)},
+	{"tx_managment_packets", offsetof(struct ixgbe_hw_stats, mngptc)},
+	{"rx_total_packets", offsetof(struct ixgbe_hw_stats, tpr)},
+	{"rx_total_bytes", offsetof(struct ixgbe_hw_stats, tor)},
+	{"tx_total_packets", offsetof(struct ixgbe_hw_stats, tpt)},
+	{"tx_size_64_packets", offsetof(struct ixgbe_hw_stats, ptc64)},
+	{"tx_size_65_to_127_packets", offsetof(struct ixgbe_hw_stats, ptc127)},
+	{"tx_size_128_to_255_packets", offsetof(struct ixgbe_hw_stats, ptc255)},
+	{"tx_size_256_to_511_packets", offsetof(struct ixgbe_hw_stats, ptc511)},
+	{"tx_size_512_to_1023_packets", offsetof(struct ixgbe_hw_stats,
+		ptc1023)},
+	{"tx_size_1024_to_max_packets", offsetof(struct ixgbe_hw_stats,
+		ptc1522)},
+	{"tx_multicast_packets", offsetof(struct ixgbe_hw_stats, mptc)},
+	{"tx_broadcast_packets", offsetof(struct ixgbe_hw_stats, bptc)},
+	{"rx_mac_short_packet_dropped", offsetof(struct ixgbe_hw_stats, mspdc)},
+	{"rx_l3_l4_xsum_error", offsetof(struct ixgbe_hw_stats, xec)},
+
+	{"flow_director_added_filters", offsetof(struct ixgbe_hw_stats,
+		fdirustat_add)},
+	{"flow_director_removed_filters", offsetof(struct ixgbe_hw_stats,
+		fdirustat_remove)},
+	{"flow_director_filter_add_errors", offsetof(struct ixgbe_hw_stats,
+		fdirfstat_fadd)},
+	{"flow_director_filter_remove_errors", offsetof(struct ixgbe_hw_stats,
+		fdirfstat_fremove)},
+	{"flow_director_matched_filters", offsetof(struct ixgbe_hw_stats,
+		fdirmatch)},
+	{"flow_director_missed_filters", offsetof(struct ixgbe_hw_stats,
+		fdirmiss)},
+
+	{"rx_fcoe_crc_errors", offsetof(struct ixgbe_hw_stats, fccrc)},
+	{"rx_fcoe_dropped", offsetof(struct ixgbe_hw_stats, fcoerpdc)},
+	{"rx_fcoe_mbuf_allocation_errors", offsetof(struct ixgbe_hw_stats,
+		fclast)},
+	{"rx_fcoe_packets", offsetof(struct ixgbe_hw_stats, fcoeprc)},
+	{"tx_fcoe_packets", offsetof(struct ixgbe_hw_stats, fcoeptc)},
+	{"rx_fcoe_bytes", offsetof(struct ixgbe_hw_stats, fcoedwrc)},
+	{"tx_fcoe_bytes", offsetof(struct ixgbe_hw_stats, fcoedwtc)},
+	{"rx_fcoe_no_direct_data_placement", offsetof(struct ixgbe_hw_stats,
+		fcoe_noddp)},
+	{"rx_fcoe_no_direct_data_placement_ext_buff",
+		offsetof(struct ixgbe_hw_stats, fcoe_noddp_ext_buff)},
+
+	{"tx_flow_control_xon_packets", offsetof(struct ixgbe_hw_stats,
+		lxontxc)},
+	{"rx_flow_control_xon_packets", offsetof(struct ixgbe_hw_stats,
+		lxonrxc)},
+	{"tx_flow_control_xoff_packets", offsetof(struct ixgbe_hw_stats,
+		lxofftxc)},
+	{"rx_flow_control_xoff_packets", offsetof(struct ixgbe_hw_stats,
+		lxoffrxc)},
+	{"rx_total_missed_packets", offsetof(struct ixgbe_hw_stats, mpctotal)},
 };
 
-#define IXGBE_NB_XSTATS (sizeof(rte_ixgbe_stats_strings) /	\
-		sizeof(rte_ixgbe_stats_strings[0]))
+#define IXGBE_NB_HW_STATS (sizeof(rte_ixgbe_stats_strings) / \
+			   sizeof(rte_ixgbe_stats_strings[0]))
+
+/* Per-queue statistics */
+#define IXBGE_NB_8_PER_Q_STATS (8 * 7)
+#define IXBGE_NB_16_PER_Q_STATS (16 * 5)
+#define IXGBE_NB_Q_STATS (IXBGE_NB_8_PER_Q_STATS + IXBGE_NB_16_PER_Q_STATS)
+
+#define IXGBE_NB_XSTATS (IXGBE_NB_HW_STATS + IXGBE_NB_Q_STATS)
 
 /**
  * Atomically reads the link status information from global
@@ -2257,7 +2319,7 @@ ixgbe_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstats *xstats,
 	total_qprdc = 0;
 
 	ixgbe_read_stats_registers(hw, hw_stats, &total_missed_rx, &total_qbrc,
-							   &total_qprc, &total_qprdc);
+				   &total_qprc, &total_qprdc);
 
 	/* If this is a reset xstats is NULL, and we have cleared the
 	 * registers by reading them.
@@ -2265,12 +2327,91 @@ ixgbe_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstats *xstats,
 	if (!xstats)
 		return 0;
 
-	/* Extended stats */
-	for (i = 0; i < IXGBE_NB_XSTATS; i++) {
-		snprintf(xstats[i].name, sizeof(xstats[i].name),
-				"%s", rte_ixgbe_stats_strings[i].name);
-		xstats[i].value = *(uint64_t *)(((char *)hw_stats) +
-							rte_ixgbe_stats_strings[i].offset);
+	/* Extended stats from ixgbe_hw_stats */
+	count = 0;
+	for (i = 0; i < IXGBE_NB_HW_STATS; i++) {
+		snprintf(xstats[count].name, sizeof(xstats[count].name), "%s",
+			 rte_ixgbe_stats_strings[i].name);
+		xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
+				rte_ixgbe_stats_strings[i].offset);
+		count++;
+	}
+
+	/* Per-Q stats, with 8 queues available */
+	for (i = 0; i < 8; i++) {
+		snprintf(xstats[count].name, sizeof(xstats[count].name),
+			 "rx_q%u_mbuf_allocation_errors", i);
+		xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
+				offsetof(struct ixgbe_hw_stats, rnbc[i]));
+		count++;
+
+		snprintf(xstats[count].name, sizeof(xstats[count].name),
+			 "rx_q%u_missed_packets", i);
+		xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
+				offsetof(struct ixgbe_hw_stats, mpc[i]));
+		count++;
+
+		snprintf(xstats[count].name, sizeof(xstats[count].name),
+			 "rx_q%u_xon_priority_packets", i);
+		xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
+				offsetof(struct ixgbe_hw_stats, pxonrxc[i]));
+		count++;
+
+		snprintf(xstats[count].name, sizeof(xstats[count].name),
+			 "tx_q%u_xon_priority_packets", i);
+		xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
+				offsetof(struct ixgbe_hw_stats, pxontxc[i]));
+		count++;
+
+		snprintf(xstats[count].name, sizeof(xstats[count].name),
+			 "rx_q%u_xoff_priority_packets", i);
+		xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
+				offsetof(struct ixgbe_hw_stats, pxoffrxc[i]));
+		count++;
+
+		snprintf(xstats[count].name, sizeof(xstats[count].name),
+			 "tx_q%u_xoff_priority_packets", i);
+		xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
+				offsetof(struct ixgbe_hw_stats, pxofftxc[i]));
+		count++;
+
+		snprintf(xstats[count].name, sizeof(xstats[count].name),
+			 "xx_q%u_xon_to_xoff_priority_packets", i);
+		xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
+				offsetof(struct ixgbe_hw_stats, pxon2offc[i]));
+		count++;
+	}
+
+	for (i = 0; i < 16; i++) {
+		snprintf(xstats[count].name, sizeof(xstats[count].name),
+			 "rx_q%u_packets", i);
+		xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
+				offsetof(struct ixgbe_hw_stats, qprc[i]));
+		count++;
+
+		snprintf(xstats[count].name, sizeof(xstats[count].name),
+			 "rx_q%u_bytes", i);
+		xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
+				offsetof(struct ixgbe_hw_stats, qbrc[i]));
+		count++;
+
+		snprintf(xstats[count].name, sizeof(xstats[count].name),
+			 "tx_q%u_packets", i);
+		xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
+				offsetof(struct ixgbe_hw_stats, qptc[i]));
+		count++;
+
+		snprintf(xstats[count].name, sizeof(xstats[count].name),
+			 "tx_q%u_bytes", i);
+		xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
+				offsetof(struct ixgbe_hw_stats, qbtc[i]));
+		count++;
+
+		snprintf(xstats[count].name, sizeof(xstats[count].name),
+			 "rx_q%u_dropped", i);
+		xstats[count].value = *(uint64_t *)(((char *)hw_stats) +
+				offsetof(struct ixgbe_hw_stats, qprdc[i]));
+		count++;
 	}
 
 	return count;
-- 
1.9.1

  parent reply	other threads:[~2015-10-30 11:37 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30  9:40 [dpdk-dev] [PATCH v2 00/11] Port XStats Harry van Haaren
2015-09-30  9:40 ` [dpdk-dev] [PATCH v2 01/11] doc: add extended statistics notes Harry van Haaren
2015-10-22 15:48   ` [dpdk-dev] [PATCH v3 00/11] Port XStats Harry van Haaren
2015-10-22 15:48     ` [dpdk-dev] [PATCH v3 01/11] doc: add extended statistics notes Harry van Haaren
2015-10-30 11:36       ` [dpdk-dev] [PATCH v4 00/10] Port XStats Harry van Haaren
2015-10-30 11:36         ` [dpdk-dev] [PATCH v4 01/10] doc: add extended statistics to prog_guide Harry van Haaren
2015-11-02 10:18           ` [dpdk-dev] [PATCH v5 00/10] Port XStats Harry van Haaren
2015-11-02 10:18             ` [dpdk-dev] [PATCH v5 01/10] doc: add extended statistics to prog_guide Harry van Haaren
2015-11-02 10:18             ` [dpdk-dev] [PATCH v5 02/10] ethdev: update xstats_get() strings and Q handling Harry van Haaren
2015-11-02 10:19             ` [dpdk-dev] [PATCH v5 03/10] virtio: add xstats() implementation Harry van Haaren
2015-11-02 10:19             ` [dpdk-dev] [PATCH v5 04/10] igb: " Harry van Haaren
2015-11-02 10:19             ` [dpdk-dev] [PATCH v5 05/10] igbvf: " Harry van Haaren
2015-11-02 10:19             ` [dpdk-dev] [PATCH v5 06/10] ixgbe: add extended statistic strings Harry van Haaren
2015-11-02 22:31               ` Thomas Monjalon
2015-11-02 10:19             ` [dpdk-dev] [PATCH v5 07/10] ixgbevf: add xstats() implementation Harry van Haaren
2015-11-02 10:19             ` [dpdk-dev] [PATCH v5 08/10] i40e: " Harry van Haaren
2015-11-02 10:19             ` [dpdk-dev] [PATCH v5 09/10] i40evf: " Harry van Haaren
2015-11-02 10:19             ` [dpdk-dev] [PATCH v5 10/10] fm10k: " Harry van Haaren
2015-11-02 10:24             ` [dpdk-dev] [PATCH v5 00/10] Port XStats Van Haaren, Harry
2015-11-02 23:23               ` Thomas Monjalon
2015-10-30 11:36         ` [dpdk-dev] [PATCH v4 02/10] ethdev: update xstats_get() strings and Q handling Harry van Haaren
2015-11-02  7:59           ` Thomas Monjalon
2015-11-02 10:17             ` Van Haaren, Harry
2015-11-02 16:23               ` Thomas Monjalon
2015-10-30 11:36         ` [dpdk-dev] [PATCH v4 03/10] virtio: add xstats() implementation Harry van Haaren
2015-10-30 11:36         ` [dpdk-dev] [PATCH v4 04/10] igb: " Harry van Haaren
2015-10-30 11:36         ` [dpdk-dev] [PATCH v4 05/10] igbvf: " Harry van Haaren
2015-10-30 11:36         ` Harry van Haaren [this message]
2015-10-30 11:36         ` [dpdk-dev] [PATCH v4 07/10] ixgbevf: " Harry van Haaren
2015-10-30 11:36         ` [dpdk-dev] [PATCH v4 08/10] i40e: " Harry van Haaren
2015-10-30 11:36         ` [dpdk-dev] [PATCH v4 09/10] i40evf: " Harry van Haaren
2015-10-30 11:36         ` [dpdk-dev] [PATCH v4 10/10] fm10k: " Harry van Haaren
2015-10-30 13:21         ` [dpdk-dev] [PATCH v4 00/10] Port XStats Tahhan, Maryam
2015-11-02  8:04         ` Thomas Monjalon
2015-10-22 15:48     ` [dpdk-dev] [PATCH v3 02/11] doc: add extended statistics to prog_guide Harry van Haaren
2015-10-23 14:29       ` Tahhan, Maryam
2015-10-22 15:48     ` [dpdk-dev] [PATCH v3 03/11] ethdev: update xstats_get() strings and Q handling Harry van Haaren
2015-10-23 14:35       ` Tahhan, Maryam
2015-10-23 15:28         ` Tahhan, Maryam
2015-10-23 15:28       ` Tahhan, Maryam
2015-10-22 15:48     ` [dpdk-dev] [PATCH v3 04/11] virtio: add xstats() implementation Harry van Haaren
2015-10-29 16:19       ` Tahhan, Maryam
2015-10-22 15:48     ` [dpdk-dev] [PATCH v3 05/11] igb: " Harry van Haaren
2015-10-23 14:56       ` Tahhan, Maryam
2015-10-22 15:48     ` [dpdk-dev] [PATCH v3 06/11] igbvf: " Harry van Haaren
2015-10-28 12:17       ` Tahhan, Maryam
2015-10-22 15:48     ` [dpdk-dev] [PATCH v3 07/11] ixgbe: update statistic strings to scheme Harry van Haaren
2015-10-23 14:41       ` Tahhan, Maryam
2015-10-22 15:48     ` [dpdk-dev] [PATCH v3 08/11] ixgbevf: add xstats() functions to VF Harry van Haaren
2015-10-28 12:16       ` Tahhan, Maryam
2015-10-22 15:48     ` [dpdk-dev] [PATCH v3 09/11] i40e: add xstats() implementation Harry van Haaren
2015-10-23 15:11       ` Tahhan, Maryam
2015-10-22 15:48     ` [dpdk-dev] [PATCH v3 10/11] i40evf: " Harry van Haaren
2015-10-28 12:15       ` Tahhan, Maryam
2015-10-22 15:48     ` [dpdk-dev] [PATCH v3 11/11] fm10k: " Harry van Haaren
2015-10-29 16:41       ` Tahhan, Maryam
2015-10-28 17:35     ` [dpdk-dev] [PATCH v3 00/11] Port XStats Tom Crugnale
2015-10-28 21:32       ` Stephen Hemminger
2015-10-29  0:55         ` Tom Crugnale
2015-10-29 12:55           ` Kyle Larose
2015-10-29 13:10             ` Thomas Monjalon
2015-10-29 13:57               ` Kyle Larose
2015-10-29 14:01                 ` Thomas Monjalon
2015-10-29 14:10                   ` Kyle Larose
2015-10-29 13:17             ` Van Haaren, Harry
2015-09-30  9:40 ` [dpdk-dev] [PATCH v2 02/11] doc: add extended statistics to prog_guide Harry van Haaren
2015-09-30  9:40 ` [dpdk-dev] [PATCH v2 03/11] ethdev: update xstats_get() strings and Q handling Harry van Haaren
2015-09-30  9:40 ` [dpdk-dev] [PATCH v2 04/11] virtio: add xstats() implementation Harry van Haaren
2015-09-30 17:44   ` Stephen Hemminger
2015-10-01  8:00     ` Van Haaren, Harry
2015-09-30  9:40 ` [dpdk-dev] [PATCH v2 05/11] igb: " Harry van Haaren
2015-09-30  9:40 ` [dpdk-dev] [PATCH v2 06/11] igbvf: " Harry van Haaren
2015-09-30  9:40 ` [dpdk-dev] [PATCH v2 07/11] ixgbe: update statistic strings to scheme Harry van Haaren
2015-09-30  9:40 ` [dpdk-dev] [PATCH v2 08/11] ixgbevf: add xstats() functions to VF Harry van Haaren
2015-09-30  9:40 ` [dpdk-dev] [PATCH v2 09/11] i40e: add xstats() implementation Harry van Haaren
2015-09-30  9:40 ` [dpdk-dev] [PATCH v2 10/11] i40evf: " Harry van Haaren
2015-09-30  9:40 ` [dpdk-dev] [PATCH v2 11/11] fm10k: " Harry van Haaren

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=1446204998-17151-7-git-send-email-harry.van.haaren@intel.com \
    --to=harry.van.haaren@intel.com \
    --cc=dev@dpdk.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).