get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/607709/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 607709,
    "url": "http://patchwork.ozlabs.org/api/patches/607709/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20160407225839.28139.26733.stgit@localhost6.localdomain6/",
    "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": "<20160407225839.28139.26733.stgit@localhost6.localdomain6>",
    "list_archive_url": null,
    "date": "2016-04-07T22:58:39",
    "name": "[1/2] ixgbevf: refactor ethtool stats handling",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "149a1309abbaee4667943164e0459597df2f3d9a",
    "submitter": {
        "id": 1670,
        "url": "http://patchwork.ozlabs.org/api/people/1670/?format=api",
        "name": "Tantilov, Emil S",
        "email": "emil.s.tantilov@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/20160407225839.28139.26733.stgit@localhost6.localdomain6/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/607709/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/607709/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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ozlabs.org (Postfix) with ESMTP id 3qgygJ41YSz9t3V\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Apr 2016 08:58:20 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id A862385B44;\n\tThu,  7 Apr 2016 22:58:19 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id yXFp5nUIpLES; Thu,  7 Apr 2016 22:58:19 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id F16F8842D1;\n\tThu,  7 Apr 2016 22:58:18 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 6D4181C0967\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu,  7 Apr 2016 22:58:17 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 6869C842D1\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu,  7 Apr 2016 22:58:17 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id GdEMm__QsJ-x for <intel-wired-lan@lists.osuosl.org>;\n\tThu,  7 Apr 2016 22:58:16 +0000 (UTC)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 7B45984083\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu,  7 Apr 2016 22:58:16 +0000 (UTC)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga101.fm.intel.com with ESMTP; 07 Apr 2016 15:58:16 -0700",
            "from estantil-desk3.jf.intel.com (HELO localhost6.localdomain6)\n\t([134.134.3.186])\n\tby orsmga001.jf.intel.com with ESMTP; 07 Apr 2016 15:58:16 -0700"
        ],
        "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.24,449,1455004800\"; d=\"scan'208\";a=\"927895775\"",
        "From": "Emil Tantilov <emil.s.tantilov@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Thu, 07 Apr 2016 15:58:39 -0700",
        "Message-ID": "<20160407225839.28139.26733.stgit@localhost6.localdomain6>",
        "User-Agent": "StGit/0.17.1-4-g4a0c1-dirty",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH 1/2] ixgbevf: refactor ethtool stats\n\thandling",
        "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>",
        "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 brings the logic closer to how we handle the stats in ixgbe and it\nsets us up for introducing per-queue stats.\n\nUse IXGBEVF_STAT and IXGBEVF_NETDEV_STAT for accessing the driver and\nnetdev stats respectively. This way we don't have to calculate the\nstats based on register values which could lead to the counters not\nbeing initialized properly when the interface is down.\n\nIXGBEVF_QUEUE_STATS_LEN is set to include the number of queues.\n\nAlso some defines were renamed to use the IXGBEVF prefix.\n\nSigned-off-by: Emil Tantilov <emil.s.tantilov@intel.com>\n---\n drivers/net/ethernet/intel/ixgbevf/ethtool.c |  126 +++++++++++++-------------\n 1 file changed, 64 insertions(+), 62 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c\nindex d7aa4b2..cd4d311 100644\n--- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c\n+++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c\n@@ -42,65 +42,62 @@\n \n #define IXGBE_ALL_RAR_ENTRIES 16\n \n+enum {NETDEV_STATS, IXGBEVF_STATS};\n+\n struct ixgbe_stats {\n \tchar stat_string[ETH_GSTRING_LEN];\n-\tstruct {\n-\t\tint sizeof_stat;\n-\t\tint stat_offset;\n-\t\tint base_stat_offset;\n-\t\tint saved_reset_offset;\n-\t};\n+\tint type;\n+\tint sizeof_stat;\n+\tint stat_offset;\n };\n \n-#define IXGBEVF_STAT(m, b, r) { \\\n-\t.sizeof_stat = FIELD_SIZEOF(struct ixgbevf_adapter, m), \\\n-\t.stat_offset = offsetof(struct ixgbevf_adapter, m), \\\n-\t.base_stat_offset = offsetof(struct ixgbevf_adapter, b), \\\n-\t.saved_reset_offset = offsetof(struct ixgbevf_adapter, r) \\\n+#define IXGBEVF_STAT(_name, _stat) { \\\n+\t.stat_string = _name, \\\n+\t.type = IXGBEVF_STATS, \\\n+\t.sizeof_stat = FIELD_SIZEOF(struct ixgbevf_adapter, _stat), \\\n+\t.stat_offset = offsetof(struct ixgbevf_adapter, _stat) \\\n }\n \n-#define IXGBEVF_ZSTAT(m) { \\\n-\t.sizeof_stat = FIELD_SIZEOF(struct ixgbevf_adapter, m), \\\n-\t.stat_offset = offsetof(struct ixgbevf_adapter, m), \\\n-\t.base_stat_offset = -1, \\\n-\t.saved_reset_offset = -1 \\\n+#define IXGBEVF_NETDEV_STAT(_net_stat) { \\\n+\t.stat_string = #_net_stat, \\\n+\t.type = NETDEV_STATS, \\\n+\t.sizeof_stat = FIELD_SIZEOF(struct net_device_stats, _net_stat), \\\n+\t.stat_offset = offsetof(struct net_device_stats, _net_stat) \\\n }\n \n-static const struct ixgbe_stats ixgbe_gstrings_stats[] = {\n-\t{\"rx_packets\", IXGBEVF_STAT(stats.vfgprc, stats.base_vfgprc,\n-\t\t\t\t    stats.saved_reset_vfgprc)},\n-\t{\"tx_packets\", IXGBEVF_STAT(stats.vfgptc, stats.base_vfgptc,\n-\t\t\t\t    stats.saved_reset_vfgptc)},\n-\t{\"rx_bytes\", IXGBEVF_STAT(stats.vfgorc, stats.base_vfgorc,\n-\t\t\t\t  stats.saved_reset_vfgorc)},\n-\t{\"tx_bytes\", IXGBEVF_STAT(stats.vfgotc, stats.base_vfgotc,\n-\t\t\t\t  stats.saved_reset_vfgotc)},\n-\t{\"tx_busy\", IXGBEVF_ZSTAT(tx_busy)},\n-\t{\"tx_restart_queue\", IXGBEVF_ZSTAT(restart_queue)},\n-\t{\"tx_timeout_count\", IXGBEVF_ZSTAT(tx_timeout_count)},\n-\t{\"multicast\", IXGBEVF_STAT(stats.vfmprc, stats.base_vfmprc,\n-\t\t\t\t   stats.saved_reset_vfmprc)},\n-\t{\"rx_csum_offload_errors\", IXGBEVF_ZSTAT(hw_csum_rx_error)},\n+static struct ixgbe_stats ixgbevf_gstrings_stats[] = {\n+\tIXGBEVF_NETDEV_STAT(rx_packets),\n+\tIXGBEVF_NETDEV_STAT(tx_packets),\n+\tIXGBEVF_NETDEV_STAT(rx_bytes),\n+\tIXGBEVF_NETDEV_STAT(tx_bytes),\n+\tIXGBEVF_STAT(\"tx_busy\", tx_busy),\n+\tIXGBEVF_STAT(\"tx_restart_queue\", restart_queue),\n+\tIXGBEVF_STAT(\"tx_timeout_count\", tx_timeout_count),\n+\tIXGBEVF_NETDEV_STAT(multicast),\n+\tIXGBEVF_STAT(\"rx_csum_offload_errors\", hw_csum_rx_error),\n #ifdef BP_EXTENDED_STATS\n-\t{\"rx_bp_poll_yield\", IXGBEVF_ZSTAT(bp_rx_yields)},\n-\t{\"rx_bp_cleaned\", IXGBEVF_ZSTAT(bp_rx_cleaned)},\n-\t{\"rx_bp_misses\", IXGBEVF_ZSTAT(bp_rx_missed)},\n-\t{\"tx_bp_napi_yield\", IXGBEVF_ZSTAT(bp_tx_yields)},\n-\t{\"tx_bp_cleaned\", IXGBEVF_ZSTAT(bp_tx_cleaned)},\n-\t{\"tx_bp_misses\", IXGBEVF_ZSTAT(bp_tx_missed)},\n+\tIXGBEVF_STAT(\"rx_bp_poll_yield\", bp_rx_yields),\n+\tIXGBEVF_STAT(\"rx_bp_cleaned\", bp_rx_cleaned),\n+\tIXGBEVF_STAT(\"rx_bp_misses\", bp_rx_missed),\n+\tIXGBEVF_STAT(\"tx_bp_napi_yield\", bp_tx_yields),\n+\tIXGBEVF_STAT(\"tx_bp_cleaned\", bp_tx_cleaned),\n+\tIXGBEVF_STAT(\"tx_bp_misses\", bp_tx_missed),\n #endif\n };\n \n-#define IXGBE_QUEUE_STATS_LEN 0\n-#define IXGBE_GLOBAL_STATS_LEN\tARRAY_SIZE(ixgbe_gstrings_stats)\n+#define IXGBEVF_QUEUE_STATS_LEN ( \\\n+\t(((struct ixgbevf_adapter *)netdev_priv(netdev))->num_tx_queues + \\\n+\t ((struct ixgbevf_adapter *)netdev_priv(netdev))->num_rx_queues) * \\\n+\t (sizeof(struct ixgbe_stats) / sizeof(u64)))\n+#define IXGBEVF_GLOBAL_STATS_LEN ARRAY_SIZE(ixgbevf_gstrings_stats)\n \n-#define IXGBEVF_STATS_LEN (IXGBE_GLOBAL_STATS_LEN + IXGBE_QUEUE_STATS_LEN)\n+#define IXGBEVF_STATS_LEN (IXGBEVF_GLOBAL_STATS_LEN + IXGBEVF_QUEUE_STATS_LEN)\n static const char ixgbe_gstrings_test[][ETH_GSTRING_LEN] = {\n \t\"Register test  (offline)\",\n \t\"Link test   (on/offline)\"\n };\n \n-#define IXGBE_TEST_LEN (sizeof(ixgbe_gstrings_test) / ETH_GSTRING_LEN)\n+#define IXGBEVF_TEST_LEN (sizeof(ixgbe_gstrings_test) / ETH_GSTRING_LEN)\n \n static int ixgbevf_get_settings(struct net_device *netdev,\n \t\t\t\tstruct ethtool_cmd *ecmd)\n@@ -396,9 +393,9 @@ static int ixgbevf_get_sset_count(struct net_device *dev, int stringset)\n {\n \tswitch (stringset) {\n \tcase ETH_SS_TEST:\n-\t\treturn IXGBE_TEST_LEN;\n+\t\treturn IXGBEVF_TEST_LEN;\n \tcase ETH_SS_STATS:\n-\t\treturn IXGBE_GLOBAL_STATS_LEN;\n+\t\treturn IXGBEVF_GLOBAL_STATS_LEN;\n \tdefault:\n \t\treturn -EINVAL;\n \t}\n@@ -408,8 +405,11 @@ static void ixgbevf_get_ethtool_stats(struct net_device *netdev,\n \t\t\t\t      struct ethtool_stats *stats, u64 *data)\n {\n \tstruct ixgbevf_adapter *adapter = netdev_priv(netdev);\n-\tchar *base = (char *)adapter;\n+\tstruct rtnl_link_stats64 temp;\n+\tconst struct rtnl_link_stats64 *net_stats;\n \tint i;\n+\tchar *p;\n+\n #ifdef BP_EXTENDED_STATS\n \tu64 rx_yields = 0, rx_cleaned = 0, rx_missed = 0,\n \t    tx_yields = 0, tx_cleaned = 0, tx_missed = 0;\n@@ -436,22 +436,24 @@ static void ixgbevf_get_ethtool_stats(struct net_device *netdev,\n #endif\n \n \tixgbevf_update_stats(adapter);\n-\tfor (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) {\n-\t\tchar *p = base + ixgbe_gstrings_stats[i].stat_offset;\n-\t\tchar *b = base + ixgbe_gstrings_stats[i].base_stat_offset;\n-\t\tchar *r = base + ixgbe_gstrings_stats[i].saved_reset_offset;\n-\n-\t\tif (ixgbe_gstrings_stats[i].sizeof_stat == sizeof(u64)) {\n-\t\t\tif (ixgbe_gstrings_stats[i].base_stat_offset >= 0)\n-\t\t\t\tdata[i] = *(u64 *)p - *(u64 *)b + *(u64 *)r;\n-\t\t\telse\n-\t\t\t\tdata[i] = *(u64 *)p;\n-\t\t} else {\n-\t\t\tif (ixgbe_gstrings_stats[i].base_stat_offset >= 0)\n-\t\t\t\tdata[i] = *(u32 *)p - *(u32 *)b + *(u32 *)r;\n-\t\t\telse\n-\t\t\t\tdata[i] = *(u32 *)p;\n+\tnet_stats = dev_get_stats(netdev, &temp);\n+\tfor (i = 0; i < IXGBEVF_GLOBAL_STATS_LEN; i++) {\n+\t\tswitch (ixgbevf_gstrings_stats[i].type) {\n+\t\tcase NETDEV_STATS:\n+\t\t\tp = (char *)net_stats +\n+\t\t\t\t\tixgbevf_gstrings_stats[i].stat_offset;\n+\t\t\tbreak;\n+\t\tcase IXGBEVF_STATS:\n+\t\t\tp = (char *)adapter +\n+\t\t\t\t\tixgbevf_gstrings_stats[i].stat_offset;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tdata[i] = 0;\n+\t\t\tcontinue;\n \t\t}\n+\n+\t\tdata[i] = (ixgbevf_gstrings_stats[i].sizeof_stat ==\n+\t\t\t   sizeof(u64)) ? *(u64 *)p : *(u32 *)p;\n \t}\n }\n \n@@ -464,11 +466,11 @@ static void ixgbevf_get_strings(struct net_device *netdev, u32 stringset,\n \tswitch (stringset) {\n \tcase ETH_SS_TEST:\n \t\tmemcpy(data, *ixgbe_gstrings_test,\n-\t\t       IXGBE_TEST_LEN * ETH_GSTRING_LEN);\n+\t\t       IXGBEVF_TEST_LEN * ETH_GSTRING_LEN);\n \t\tbreak;\n \tcase ETH_SS_STATS:\n-\t\tfor (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) {\n-\t\t\tmemcpy(p, ixgbe_gstrings_stats[i].stat_string,\n+\t\tfor (i = 0; i < IXGBEVF_GLOBAL_STATS_LEN; i++) {\n+\t\t\tmemcpy(p, ixgbevf_gstrings_stats[i].stat_string,\n \t\t\t       ETH_GSTRING_LEN);\n \t\t\tp += ETH_GSTRING_LEN;\n \t\t}\n",
    "prefixes": [
        "1/2"
    ]
}