Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/8769/?format=api
http://patches.dpdk.org/api/patches/8769/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1446819175-31325-3-git-send-email-harry.van.haaren@intel.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<1446819175-31325-3-git-send-email-harry.van.haaren@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1446819175-31325-3-git-send-email-harry.van.haaren@intel.com", "date": "2015-11-06T14:12:54", "name": "[dpdk-dev,2/3] ixgbe: refactor xstats queue handling", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "0cf7877dd58af55100090e7502be4cf4ca82d04c", "submitter": { "id": 317, "url": "http://patches.dpdk.org/api/people/317/?format=api", "name": "Van Haaren, Harry", "email": "harry.van.haaren@intel.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1446819175-31325-3-git-send-email-harry.van.haaren@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/8769/comments/", "check": "pending", "checks": "http://patches.dpdk.org/api/patches/8769/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 3A25C8D9E;\n\tFri, 6 Nov 2015 15:13:37 +0100 (CET)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 12B975A58\n\tfor <dev@dpdk.org>; Fri, 6 Nov 2015 15:13:33 +0100 (CET)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga103.fm.intel.com with ESMTP; 06 Nov 2015 06:13:34 -0800", "from sie-lab-212-222.ir.intel.com (HELO\n\tsilpixa00366884.ir.intel.com) ([10.237.212.222])\n\tby fmsmga001.fm.intel.com with ESMTP; 06 Nov 2015 06:13:32 -0800" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.20,252,1444719600\"; d=\"scan'208\";a=\"829187132\"", "From": "Harry van Haaren <harry.van.haaren@intel.com>", "To": "dev@dpdk.org", "Date": "Fri, 6 Nov 2015 14:12:54 +0000", "Message-Id": "<1446819175-31325-3-git-send-email-harry.van.haaren@intel.com>", "X-Mailer": "git-send-email 1.9.1", "In-Reply-To": "<1446819175-31325-1-git-send-email-harry.van.haaren@intel.com>", "References": "<1446819175-31325-1-git-send-email-harry.van.haaren@intel.com>", "Subject": "[dpdk-dev] [PATCH 2/3] ixgbe: refactor xstats queue handling", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "This patch refactors the queue handling. Generic queue stats are\nhandled by rte_eth_xstats_get() and the ixgbe_xstats_get() exposes\nonly the extra stats.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\n---\n drivers/net/ixgbe/ixgbe_ethdev.c | 132 ++++++++++++++++-----------------------\n 1 file changed, 53 insertions(+), 79 deletions(-)", "diff": "diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c\nindex 0b0bbcf..19ddb52 100644\n--- a/drivers/net/ixgbe/ixgbe_ethdev.c\n+++ b/drivers/net/ixgbe/ixgbe_ethdev.c\n@@ -613,11 +613,25 @@ static const struct rte_ixgbe_xstats_name_off rte_ixgbe_stats_strings[] = {\n \t\t\t sizeof(rte_ixgbe_stats_strings[0]))\n \n /* Per-queue statistics */\n-#define IXBGE_NB_8_PER_Q_STATS (8 * 7)\n-#define IXBGE_NB_16_PER_Q_STATS (16 * 5)\n-#define IXGBE_NB_Q_STATS (IXBGE_NB_8_PER_Q_STATS + IXBGE_NB_16_PER_Q_STATS)\n+static const struct rte_ixgbe_xstats_name_off rte_ixgbe_rxq_strings[] = {\n+\t{\"mbuf_allocation_errors\", offsetof(struct ixgbe_hw_stats, rnbc)},\n+\t{\"dropped\", offsetof(struct ixgbe_hw_stats, mpc)},\n+\t{\"xon_packets\", offsetof(struct ixgbe_hw_stats, pxonrxc)},\n+\t{\"xoff_packets\", offsetof(struct ixgbe_hw_stats, pxoffrxc)},\n+};\n+\n+#define IXGBE_NB_RXQ_PRIO_STATS (sizeof(rte_ixgbe_rxq_strings) / \\\n+\t\t\t sizeof(rte_ixgbe_rxq_strings[0]))\n+\n+static const struct rte_ixgbe_xstats_name_off rte_ixgbe_txq_strings[] = {\n+\t{\"xon_packets\", offsetof(struct ixgbe_hw_stats, pxontxc)},\n+\t{\"xoff_packets\", offsetof(struct ixgbe_hw_stats, pxofftxc)},\n+\t{\"xon_to_xoff_packets\", offsetof(struct ixgbe_hw_stats,\n+\t\tpxon2offc)},\n+};\n \n-#define IXGBE_NB_XSTATS (IXGBE_NB_HW_STATS + IXGBE_NB_Q_STATS)\n+#define IXGBE_NB_TXQ_PRIO_STATS (sizeof(rte_ixgbe_txq_strings) / \\\n+\t\t\t sizeof(rte_ixgbe_txq_strings[0]))\n \n static const struct rte_ixgbe_xstats_name_off rte_ixgbevf_stats_strings[] = {\n \t{\"rx_multicast_packets\", offsetof(struct ixgbevf_hw_stats, vfmprc)},\n@@ -2513,6 +2527,13 @@ ixgbe_dev_stats_reset(struct rte_eth_dev *dev)\n \tmemset(stats, 0, sizeof(*stats));\n }\n \n+/* This function calculates the number of xstats based on the current config */\n+static unsigned\n+ixgbe_xstats_calc_num(void) {\n+\treturn IXGBE_NB_HW_STATS + (IXGBE_NB_RXQ_PRIO_STATS * 8) +\n+\t\t(IXGBE_NB_TXQ_PRIO_STATS * 8);\n+}\n+\n static int\n ixgbe_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstats *xstats,\n \t\t\t\t\t unsigned n)\n@@ -2522,7 +2543,9 @@ ixgbe_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstats *xstats,\n \tstruct ixgbe_hw_stats *hw_stats =\n \t\t\tIXGBE_DEV_PRIVATE_TO_STATS(dev->data->dev_private);\n \tuint64_t total_missed_rx, total_qbrc, total_qprc, total_qprdc;\n-\tunsigned i, count = IXGBE_NB_XSTATS;\n+\tunsigned i, stat, count = 0;\n+\n+\tcount = ixgbe_xstats_calc_num();\n \n \tif (n < count)\n \t\treturn count;\n@@ -2551,81 +2574,30 @@ ixgbe_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstats *xstats,\n \t\tcount++;\n \t}\n \n-\t/* Per-Q stats, with 8 queues available */\n-\tfor (i = 0; i < 8; i++) {\n-\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n-\t\t\t \"rx_q%u_mbuf_allocation_errors\", i);\n-\t\txstats[count].value = *(uint64_t *)(((char *)hw_stats) +\n-\t\t\t\toffsetof(struct ixgbe_hw_stats, rnbc[i]));\n-\t\tcount++;\n-\n-\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n-\t\t\t \"rx_q%u_missed_packets\", i);\n-\t\txstats[count].value = *(uint64_t *)(((char *)hw_stats) +\n-\t\t\t\toffsetof(struct ixgbe_hw_stats, mpc[i]));\n-\t\tcount++;\n-\n-\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n-\t\t\t \"rx_q%u_xon_priority_packets\", i);\n-\t\txstats[count].value = *(uint64_t *)(((char *)hw_stats) +\n-\t\t\t\toffsetof(struct ixgbe_hw_stats, pxonrxc[i]));\n-\t\tcount++;\n-\n-\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n-\t\t\t \"tx_q%u_xon_priority_packets\", i);\n-\t\txstats[count].value = *(uint64_t *)(((char *)hw_stats) +\n-\t\t\t\toffsetof(struct ixgbe_hw_stats, pxontxc[i]));\n-\t\tcount++;\n-\n-\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n-\t\t\t \"rx_q%u_xoff_priority_packets\", i);\n-\t\txstats[count].value = *(uint64_t *)(((char *)hw_stats) +\n-\t\t\t\toffsetof(struct ixgbe_hw_stats, pxoffrxc[i]));\n-\t\tcount++;\n-\n-\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n-\t\t\t \"tx_q%u_xoff_priority_packets\", i);\n-\t\txstats[count].value = *(uint64_t *)(((char *)hw_stats) +\n-\t\t\t\toffsetof(struct ixgbe_hw_stats, pxofftxc[i]));\n-\t\tcount++;\n-\n-\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n-\t\t\t \"xx_q%u_xon_to_xoff_priority_packets\", i);\n-\t\txstats[count].value = *(uint64_t *)(((char *)hw_stats) +\n-\t\t\t\toffsetof(struct ixgbe_hw_stats, pxon2offc[i]));\n-\t\tcount++;\n+\t/* RX Priority Stats */\n+\tfor (stat = 0; stat < IXGBE_NB_RXQ_PRIO_STATS; stat++) {\n+\t\tfor (i = 0; i < 8; i++) {\n+\t\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n+\t\t\t\t \"rx_priority%u_%s\", i,\n+\t\t\t\t rte_ixgbe_rxq_strings[stat].name);\n+\t\t\txstats[count].value = *(uint64_t *)(((char *)hw_stats) +\n+\t\t\t\t\trte_ixgbe_rxq_strings[stat].offset +\n+\t\t\t\t\t(sizeof(uint64_t) * i));\n+\t\t\tcount++;\n+\t\t}\n \t}\n \n-\tfor (i = 0; i < 16; i++) {\n-\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n-\t\t\t \"rx_q%u_packets\", i);\n-\t\txstats[count].value = *(uint64_t *)(((char *)hw_stats) +\n-\t\t\t\toffsetof(struct ixgbe_hw_stats, qprc[i]));\n-\t\tcount++;\n-\n-\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n-\t\t\t \"rx_q%u_bytes\", i);\n-\t\txstats[count].value = *(uint64_t *)(((char *)hw_stats) +\n-\t\t\t\toffsetof(struct ixgbe_hw_stats, qbrc[i]));\n-\t\tcount++;\n-\n-\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n-\t\t\t \"tx_q%u_packets\", i);\n-\t\txstats[count].value = *(uint64_t *)(((char *)hw_stats) +\n-\t\t\t\toffsetof(struct ixgbe_hw_stats, qptc[i]));\n-\t\tcount++;\n-\n-\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n-\t\t\t \"tx_q%u_bytes\", i);\n-\t\txstats[count].value = *(uint64_t *)(((char *)hw_stats) +\n-\t\t\t\toffsetof(struct ixgbe_hw_stats, qbtc[i]));\n-\t\tcount++;\n-\n-\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n-\t\t\t \"rx_q%u_dropped\", i);\n-\t\txstats[count].value = *(uint64_t *)(((char *)hw_stats) +\n-\t\t\t\toffsetof(struct ixgbe_hw_stats, qprdc[i]));\n-\t\tcount++;\n+\t/* TX Priority Stats */\n+\tfor (stat = 0; stat < IXGBE_NB_TXQ_PRIO_STATS; stat++) {\n+\t\tfor (i = 0; i < 8; i++) {\n+\t\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n+\t\t\t\t \"tx_priority%u_%s\", i,\n+\t\t\t\t rte_ixgbe_txq_strings[stat].name);\n+\t\t\txstats[count].value = *(uint64_t *)(((char *)hw_stats) +\n+\t\t\t\t\trte_ixgbe_txq_strings[stat].offset +\n+\t\t\t\t\t(sizeof(uint64_t) * i));\n+\t\t\tcount++;\n+\t\t}\n \t}\n \n \treturn count;\n@@ -2637,8 +2609,10 @@ ixgbe_dev_xstats_reset(struct rte_eth_dev *dev)\n \tstruct ixgbe_hw_stats *stats =\n \t\t\tIXGBE_DEV_PRIVATE_TO_STATS(dev->data->dev_private);\n \n+\tunsigned count = ixgbe_xstats_calc_num();\n+\n \t/* HW registers are cleared on read */\n-\tixgbe_dev_xstats_get(dev, NULL, IXGBE_NB_XSTATS);\n+\tixgbe_dev_xstats_get(dev, NULL, count);\n \n \t/* Reset software totals */\n \tmemset(stats, 0, sizeof(*stats));\n", "prefixes": [ "dpdk-dev", "2/3" ] }{ "id": 8769, "url": "