get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 660510,
    "url": "http://patchwork.ozlabs.org/api/patches/660510/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1471542901-13405-3-git-send-email-sridhar.samudrala@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": "<1471542901-13405-3-git-send-email-sridhar.samudrala@intel.com>",
    "list_archive_url": null,
    "date": "2016-08-18T17:55:00",
    "name": "[dev-queue,v2,2/3] i40e: Enable VF specific ethtool statistics via VF Port representor netdevs.",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "bddbed0f5260f46897a9940ce6312f18227717b9",
    "submitter": {
        "id": 65219,
        "url": "http://patchwork.ozlabs.org/api/people/65219/?format=api",
        "name": "Samudrala, Sridhar",
        "email": "sridhar.samudrala@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/1471542901-13405-3-git-send-email-sridhar.samudrala@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/660510/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/660510/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\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3sFb6L1Xcgz9t1F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 19 Aug 2016 05:01:14 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 5A8BB899C8;\n\tThu, 18 Aug 2016 19:01:12 +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 EBHSEd+icj0j; Thu, 18 Aug 2016 19:01:11 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 7E0508A48A;\n\tThu, 18 Aug 2016 19:01:11 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 5F8001C2D62\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 18 Aug 2016 19:01:10 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 5972E306EF\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 18 Aug 2016 19:01:10 +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 9wyb0L2B9Lki for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 18 Aug 2016 19:01:08 +0000 (UTC)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby silver.osuosl.org (Postfix) with ESMTP id C9DEF3176E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 18 Aug 2016 19:01:08 +0000 (UTC)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby orsmga103.jf.intel.com with ESMTP; 18 Aug 2016 12:01:08 -0700",
            "from unknown (HELO sri-mi-02.jf.intel.com) ([10.166.31.66])\n\tby fmsmga001.fm.intel.com with ESMTP; 18 Aug 2016 12:01:09 -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.28,541,1464678000\"; d=\"scan'208\";\n\ta=\"1027890227\"",
        "From": "Sridhar Samudrala <sridhar.samudrala@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org, anjali.singhai@intel.com,\n\tjohn.r.fastabend@intel.com, amritha.nambiar@intel.com,\n\talexander.h.duyck@intel.com",
        "Date": "Thu, 18 Aug 2016 19:55:00 +0200",
        "Message-Id": "<1471542901-13405-3-git-send-email-sridhar.samudrala@intel.com>",
        "X-Mailer": "git-send-email 2.5.5",
        "In-Reply-To": "<1471542901-13405-1-git-send-email-sridhar.samudrala@intel.com>",
        "References": "<1471542901-13405-1-git-send-email-sridhar.samudrala@intel.com>",
        "Subject": "[Intel-wired-lan] [dev-queue PATCH v2 2/3] i40e: Enable VF specific\n\tethtool statistics via VF Port representor netdevs.",
        "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": "Sample script that shows ethtool stats on VF representor netdev\nPF: enp5s0f0, VF0: enp5s2  VF_REP0: enp5s0f0-vf0\n\n   # echo 2 > /sys/class/net/enp5s0f0/device/sriov_numvfs\n   # ip link set enp5s2 up\n   # ethtool -S enp5s0f0-vf0\n   NIC statistics:\n     rx_bytes: 0\n     rx_unicast: 0\n     rx_multicast: 0\n     rx_broadcast: 0\n     rx_discards: 0\n     rx_unknown_protocol: 0\n     tx_bytes: 140\n     tx_unicast: 0\n     tx_multicast: 2\n     tx_broadcast: 0\n     tx_discards: 0\n     tx_errors: 0\n\nSigned-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e.h             |  1 +\n drivers/net/ethernet/intel/i40e/i40e_ethtool.c     | 67 ++++++++++++++++++++++\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |  1 +\n 3 files changed, 69 insertions(+)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 8dc98c2..ad3a720 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -869,4 +869,5 @@ i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf);\n i40e_status i40e_set_npar_bw_setting(struct i40e_pf *pf);\n i40e_status i40e_commit_npar_bw_setting(struct i40e_pf *pf);\n void i40e_print_link_message(struct i40e_vsi *vsi, bool isup);\n+void i40e_set_vf_netdev_ethtool_ops(struct net_device *netdev);\n #endif /* _I40E_H_ */\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\nindex 1835186..104d2fb 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n@@ -3116,3 +3116,70 @@ void i40e_set_ethtool_ops(struct net_device *netdev)\n {\n \tnetdev->ethtool_ops = &i40e_ethtool_ops;\n }\n+\n+static const char i40e_vf_netdev_ethtool_sset[][ETH_GSTRING_LEN] = {\n+\t\"rx_bytes\",\n+\t\"rx_unicast\",\n+\t\"rx_multicast\",\n+\t\"rx_broadcast\",\n+\t\"rx_discards\",\n+\t\"rx_unknown_protocol\",\n+\t\"tx_bytes\",\n+\t\"tx_unicast\",\n+\t\"tx_multicast\",\n+\t\"tx_broadcast\",\n+\t\"tx_discards\",\n+\t\"tx_errors\",\n+};\n+\n+#define I40E_VF_NETDEV_ETHTOOL_STAT_COUNT \\\n+\t\t\tARRAY_SIZE(i40e_vf_netdev_ethtool_sset)\n+\n+static void i40e_vf_netdev_ethtool_get_strings(struct net_device *dev,\n+\t\t\t\t\t       u32 stringset,\n+\t\t\t\t\t       u8 *ethtool_strings)\n+{\n+\tswitch (stringset) {\n+\tcase ETH_SS_STATS:\n+\t\tmemcpy(ethtool_strings, &i40e_vf_netdev_ethtool_sset,\n+\t\t       sizeof(i40e_vf_netdev_ethtool_sset));\n+\t\tbreak;\n+\t}\n+}\n+\n+static int i40e_vf_netdev_ethtool_get_sset_count(struct net_device *dev,\n+\t\t\t\t\t\t int stringset)\n+{\n+\tswitch (stringset) {\n+\tcase ETH_SS_STATS:\n+\t\treturn I40E_VF_NETDEV_ETHTOOL_STAT_COUNT;\n+\tdefault:\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+}\n+\n+static void i40e_vf_netdev_ethtool_get_stats(struct net_device *dev,\n+\t\t\t\tstruct ethtool_stats *target_ethtool_stats,\n+\t\t\t\tu64 *target_stat_values)\n+{\n+\tstruct i40e_vf_netdev_priv *priv = netdev_priv(dev);\n+\tstruct i40e_vf *vf = priv->vf;\n+\tstruct i40e_pf *pf = vf->pf;\n+\tstruct i40e_vsi *vsi;\n+\n+\tvsi = pf->vsi[vf->lan_vsi_idx];\n+\ti40e_update_stats(vsi);\n+\tmemcpy(target_stat_values, &vsi->eth_stats,\n+\t       I40E_VF_NETDEV_ETHTOOL_STAT_COUNT * 8);\n+}\n+\n+static const struct ethtool_ops i40e_vf_netdev_ethtool_ops = {\n+\t.get_strings\t\t= i40e_vf_netdev_ethtool_get_strings,\n+\t.get_ethtool_stats      = i40e_vf_netdev_ethtool_get_stats,\n+\t.get_sset_count         = i40e_vf_netdev_ethtool_get_sset_count,\n+};\n+\n+void i40e_set_vf_netdev_ethtool_ops(struct net_device *netdev)\n+{\n+\tnetdev->ethtool_ops = &i40e_vf_netdev_ethtool_ops;\n+}\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\nindex 6167e56..b5a716e 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -1049,6 +1049,7 @@ int i40e_alloc_vf_netdev(struct i40e_vf *vf, u16 vf_num)\n \tpriv->vf = &(pf->vf[vf_num]);\n \n \tnetdev->netdev_ops = &i40e_vf_netdev_ops;\n+\ti40e_set_vf_netdev_ethtool_ops(netdev);\n \n \tnetif_carrier_off(netdev);\n \tnetif_tx_disable(netdev);\n",
    "prefixes": [
        "dev-queue",
        "v2",
        "2/3"
    ]
}