Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/579582/?format=api
{ "id": 579582, "url": "http://patchwork.ozlabs.org/api/patches/579582/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1454697789-22420-2-git-send-email-jacob.e.keller@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1454697789-22420-2-git-send-email-jacob.e.keller@intel.com>", "list_archive_url": null, "date": "2016-02-05T18:43:09", "name": "[2/2] fm10k: use fm10k_stats structures for per-queue statistics", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "99f38363786fcd40bd655716e68522e37110848c", "submitter": { "id": 9784, "url": "http://patchwork.ozlabs.org/api/people/9784/?format=api", "name": "Jacob Keller", "email": "jacob.e.keller@intel.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1454697789-22420-2-git-send-email-jacob.e.keller@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/579582/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/579582/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Received": [ "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ozlabs.org (Postfix) with ESMTP id 7D0D814031F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 6 Feb 2016 05:44:40 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 4E7A28AEB9;\n\tFri, 5 Feb 2016 18:44:39 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id aSnb8qtYrCKM; Fri, 5 Feb 2016 18:44:38 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 6A85F894E5;\n\tFri, 5 Feb 2016 18:44:38 +0000 (UTC)", "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id E83F71C0866\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 5 Feb 2016 18:44:36 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id E366C3208A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 5 Feb 2016 18:44:36 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 1N8Q3mXsA8dJ for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 5 Feb 2016 18:44:35 +0000 (UTC)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby silver.osuosl.org (Postfix) with ESMTP id 6801B319D3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 5 Feb 2016 18:44:35 +0000 (UTC)", "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga103.fm.intel.com with ESMTP; 05 Feb 2016 10:43:11 -0800", "from jekeller-desk.amr.corp.intel.com (HELO\n\tjekeller-desk.jekeller.internal) ([134.134.3.65])\n\tby orsmga001.jf.intel.com with ESMTP; 05 Feb 2016 10:43:11 -0800" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.22,401,1449561600\"; d=\"scan'208\";a=\"877979044\"", "From": "Jacob Keller <jacob.e.keller@intel.com>", "To": "Intel Wired LAN <intel-wired-lan@lists.osuosl.org>", "Date": "Fri, 5 Feb 2016 10:43:09 -0800", "Message-Id": "<1454697789-22420-2-git-send-email-jacob.e.keller@intel.com>", "X-Mailer": "git-send-email 2.7.0.236.gda096a0.dirty", "In-Reply-To": "<1454697789-22420-1-git-send-email-jacob.e.keller@intel.com>", "References": "<1454697789-22420-1-git-send-email-jacob.e.keller@intel.com>", "Subject": "[Intel-wired-lan] [PATCH 2/2] fm10k: use fm10k_stats structures for\n\tper-queue statistics", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "This will allow us numerous advantages, including\n\n(a) rework the per-queue stats to only display active queues, reducing\n clutter on the output. This is important since we often don't have\n all possible queues enabled.\n\n(b) use the new streamlined helper functions, reducing duplicate code\n and increasing readability of the stats logic\n\n(c) add the additional per-tx and per-rx statistics when\n debug-statistics is enabled, which may be helpful for future debug\n work.\n\nThe primary motivation for this change is (a), though (b) and (c) are\nuseful additions which were noticed while developing the change.\n\nNote that this code currently assumes we have the same number of Tx and\nRx queues which should be true of our driver pretty much always. Even if\nthere are a non equal number of Tx and Rx queues, the only result will\nbe a few extra statistics displaying 0s. This is better than the current\nsetup which shows every disabled queue with all 0s.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\n---\n\nThese two patches apply on top of my previous series, though I do not\nbelieve there would be any complications re-ordering them.\n\n drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 118 ++++++++++++++++++-----\n 1 file changed, 93 insertions(+), 25 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c\nindex 1496c4b44b7e..7a959713daa3 100644\n--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c\n+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c\n@@ -121,18 +121,52 @@ static const struct fm10k_stats fm10k_gstrings_mbx_stats[] = {\n \tFM10K_MBX_STAT(\"mbx_rx_mbmem_pushed\", rx_mbmem_pushed),\n };\n \n+#define FM10K_QUEUE_STAT(_name, _stat) { \\\n+\t.stat_string = _name, \\\n+\t.sizeof_stat = FIELD_SIZEOF(struct fm10k_ring, _stat), \\\n+\t.stat_offset = offsetof(struct fm10k_ring, _stat) \\\n+}\n+\n+static const struct fm10k_stats fm10k_gstrings_queue_stats[] = {\n+\tFM10K_QUEUE_STAT(\"packets\", stats.packets),\n+\tFM10K_QUEUE_STAT(\"bytes\", stats.packets),\n+};\n+\n+static const struct fm10k_stats fm10k_gstrings_tx_queue_stats[] = {\n+\tFM10K_QUEUE_STAT(\"restart_queue\", tx_stats.restart_queue),\n+\tFM10K_QUEUE_STAT(\"csum_err\", tx_stats.restart_queue),\n+\tFM10K_QUEUE_STAT(\"tx_busy\", tx_stats.restart_queue),\n+\tFM10K_QUEUE_STAT(\"tx_done_old\", tx_stats.restart_queue),\n+\tFM10K_QUEUE_STAT(\"csum_good\", tx_stats.restart_queue),\n+};\n+\n+static const struct fm10k_stats fm10k_gstrings_rx_queue_stats[] = {\n+\tFM10K_QUEUE_STAT(\"alloc_failed\", rx_stats.alloc_failed),\n+\tFM10K_QUEUE_STAT(\"csum_err\", rx_stats.csum_err),\n+\tFM10K_QUEUE_STAT(\"errors\", rx_stats.errors),\n+\tFM10K_QUEUE_STAT(\"csum_good\", rx_stats.csum_good),\n+\tFM10K_QUEUE_STAT(\"switch_errors\", rx_stats.switch_errors),\n+\tFM10K_QUEUE_STAT(\"drops\", rx_stats.drops),\n+\tFM10K_QUEUE_STAT(\"pp_errors\", rx_stats.pp_errors),\n+\tFM10K_QUEUE_STAT(\"link_errors\", rx_stats.link_errors),\n+\tFM10K_QUEUE_STAT(\"length_errors\", rx_stats.length_errors),\n+\n+};\n+\n #define FM10K_GLOBAL_STATS_LEN ARRAY_SIZE(fm10k_gstrings_global_stats)\n #define FM10K_DEBUG_STATS_LEN ARRAY_SIZE(fm10k_gstrings_debug_stats)\n #define FM10K_PF_STATS_LEN ARRAY_SIZE(fm10k_gstrings_pf_stats)\n #define FM10K_MBX_STATS_LEN ARRAY_SIZE(fm10k_gstrings_mbx_stats)\n \n-#define FM10K_QUEUE_STATS_LEN(_n) \\\n-\t((_n) * 2 * (sizeof(struct fm10k_queue_stats) / sizeof(u64)))\n-\n #define FM10K_STATIC_STATS_LEN (FM10K_GLOBAL_STATS_LEN + \\\n \t\t\t\tFM10K_NETDEV_STATS_LEN + \\\n \t\t\t\tFM10K_MBX_STATS_LEN)\n \n+/* non-static stats based on number of Tx/Rx queues */\n+#define FM10K_QUEUE_STATS_LEN ARRAY_SIZE(fm10k_gstrings_queue_stats)\n+#define FM10K_TX_QUEUE_STATS_LEN ARRAY_SIZE(fm10k_gstrings_tx_queue_stats)\n+#define FM10K_RX_QUEUE_STATS_LEN ARRAY_SIZE(fm10k_gstrings_rx_queue_stats)\n+\n static const char fm10k_gstrings_test[][ETH_GSTRING_LEN] = {\n \t\"Mailbox test (on/offline)\"\n };\n@@ -153,6 +187,11 @@ static const char fm10k_prv_flags[FM10K_PRV_FLAG_LEN][ETH_GSTRING_LEN] = {\n \t\"debug-statistics\",\n };\n \n+static unsigned int fm10k_queues_in_use(struct fm10k_intfc *interface)\n+{\n+\treturn max(interface->num_tx_queues, interface->num_rx_queues);\n+}\n+\n static void fm10k_add_stat_strings(char **p, const char *prefix,\n \t\t\t\t const struct fm10k_stats stats[],\n \t\t\t\t const unsigned int size)\n@@ -201,15 +240,30 @@ static void fm10k_get_stat_strings(struct net_device *dev, u8 *data)\n \t\t}\n \t}\n \n-\tfor (i = 0; i < interface->hw.mac.max_queues; i++) {\n-\t\tsnprintf(p, ETH_GSTRING_LEN, \"tx_queue_%u_packets\", i);\n-\t\tp += ETH_GSTRING_LEN;\n-\t\tsnprintf(p, ETH_GSTRING_LEN, \"tx_queue_%u_bytes\", i);\n-\t\tp += ETH_GSTRING_LEN;\n-\t\tsnprintf(p, ETH_GSTRING_LEN, \"rx_queue_%u_packets\", i);\n-\t\tp += ETH_GSTRING_LEN;\n-\t\tsnprintf(p, ETH_GSTRING_LEN, \"rx_queue_%u_bytes\", i);\n-\t\tp += ETH_GSTRING_LEN;\n+\tfor (i = 0; i < fm10k_queues_in_use(interface); i++) {\n+\t\tchar prefix[ETH_GSTRING_LEN];\n+\n+\t\tsnprintf(prefix, ETH_GSTRING_LEN, \"tx_queue_%u_\", i);\n+\t\tfm10k_add_stat_strings(&p, prefix,\n+\t\t\t\t fm10k_gstrings_queue_stats,\n+\t\t\t\t FM10K_QUEUE_STATS_LEN);\n+\n+\t\tif (interface->flags & FM10K_FLAG_DEBUG_STATS) {\n+\t\t\tfm10k_add_stat_strings(&p, prefix,\n+\t\t\t\t\t fm10k_gstrings_tx_queue_stats,\n+\t\t\t\t\t FM10K_TX_QUEUE_STATS_LEN);\n+\t\t}\n+\n+\t\tsnprintf(prefix, ETH_GSTRING_LEN, \"rx_queue_%u_\", i);\n+\t\tfm10k_add_stat_strings(&p, prefix,\n+\t\t\t\t fm10k_gstrings_queue_stats,\n+\t\t\t\t FM10K_QUEUE_STATS_LEN);\n+\n+\t\tif (interface->flags & FM10K_FLAG_DEBUG_STATS) {\n+\t\t\tfm10k_add_stat_strings(&p, prefix,\n+\t\t\t\t\t fm10k_gstrings_rx_queue_stats,\n+\t\t\t\t\t FM10K_RX_QUEUE_STATS_LEN);\n+\t\t}\n \t}\n }\n \n@@ -239,12 +293,15 @@ static int fm10k_get_sset_count(struct net_device *dev, int sset)\n \tstruct fm10k_iov_data *iov_data = interface->iov_data;\n \tstruct fm10k_hw *hw = &interface->hw;\n \tint stats_len = FM10K_STATIC_STATS_LEN;\n+\tint tx_queues = interface->num_tx_queues;\n+\tint rx_queues = interface->num_rx_queues;\n+\n \n \tswitch (sset) {\n \tcase ETH_SS_TEST:\n \t\treturn FM10K_TEST_LEN;\n \tcase ETH_SS_STATS:\n-\t\tstats_len += FM10K_QUEUE_STATS_LEN(hw->mac.max_queues);\n+\t\tstats_len += (tx_queues + rx_queues) * FM10K_QUEUE_STATS_LEN;\n \n \t\tif (hw->mac.type != fm10k_mac_vf)\n \t\t\tstats_len += FM10K_PF_STATS_LEN;\n@@ -252,6 +309,9 @@ static int fm10k_get_sset_count(struct net_device *dev, int sset)\n \t\tif (interface->flags & FM10K_FLAG_DEBUG_STATS) {\n \t\t\tstats_len += FM10K_DEBUG_STATS_LEN;\n \n+\t\t\tstats_len += tx_queues * FM10K_TX_QUEUE_STATS_LEN;\n+\t\t\tstats_len += rx_queues * FM10K_RX_QUEUE_STATS_LEN;\n+\n \t\t\tif (iov_data)\n \t\t\t\tstats_len += FM10K_MBX_STATS_LEN *\n \t\t\t\t\tiov_data->num_vfs;\n@@ -304,11 +364,10 @@ static void fm10k_get_ethtool_stats(struct net_device *netdev,\n \t\t\t\t struct ethtool_stats __always_unused *stats,\n \t\t\t\t u64 *data)\n {\n-\tconst int stat_count = sizeof(struct fm10k_queue_stats) / sizeof(u64);\n \tstruct fm10k_intfc *interface = netdev_priv(netdev);\n \tstruct fm10k_iov_data *iov_data = interface->iov_data;\n \tstruct net_device_stats *net_stats = &netdev->stats;\n-\tint i, j;\n+\tint i;\n \n \tfm10k_update_stats(interface);\n \n@@ -345,21 +404,30 @@ static void fm10k_get_ethtool_stats(struct net_device *netdev,\n \t\t}\n \t}\n \n-\tfor (i = 0; i < interface->hw.mac.max_queues; i++) {\n+\tfor (i = 0; i < fm10k_queues_in_use(interface); i++) {\n \t\tstruct fm10k_ring *ring;\n-\t\tu64 *queue_stat;\n \n \t\tring = interface->tx_ring[i];\n-\t\tif (ring)\n-\t\t\tqueue_stat = (u64 *)&ring->stats;\n-\t\tfor (j = 0; j < stat_count; j++)\n-\t\t\t*(data++) = ring ? queue_stat[j] : 0;\n+\t\tfm10k_add_ethtool_stats(&data, ring,\n+\t\t\t\t\tfm10k_gstrings_queue_stats,\n+\t\t\t\t\tFM10K_QUEUE_STATS_LEN);\n+\n+\t\tif (interface->flags & FM10K_FLAG_DEBUG_STATS) {\n+\t\t\tfm10k_add_ethtool_stats(&data, ring,\n+\t\t\t\t\t\tfm10k_gstrings_tx_queue_stats,\n+\t\t\t\t\t\tFM10K_TX_QUEUE_STATS_LEN);\n+\t\t}\n \n \t\tring = interface->rx_ring[i];\n-\t\tif (ring)\n-\t\t\tqueue_stat = (u64 *)&ring->stats;\n-\t\tfor (j = 0; j < stat_count; j++)\n-\t\t\t*(data++) = ring ? queue_stat[j] : 0;\n+\t\tfm10k_add_ethtool_stats(&data, ring,\n+\t\t\t\t\tfm10k_gstrings_queue_stats,\n+\t\t\t\t\tFM10K_QUEUE_STATS_LEN);\n+\n+\t\tif (interface->flags & FM10K_FLAG_DEBUG_STATS) {\n+\t\t\tfm10k_add_ethtool_stats(&data, ring,\n+\t\t\t\t\t\tfm10k_gstrings_rx_queue_stats,\n+\t\t\t\t\t\tFM10K_RX_QUEUE_STATS_LEN);\n+\t\t}\n \t}\n }\n \n", "prefixes": [ "2/2" ] }