get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1185787,
    "url": "http://patchwork.ozlabs.org/api/patches/1185787/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20191029003707.45245-1-jesse.brandeburg@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": "<20191029003707.45245-1-jesse.brandeburg@intel.com>",
    "list_archive_url": null,
    "date": "2019-10-29T00:37:07",
    "name": "[net-next,v2] i40e: implement VF stats NDO",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "01a214d2b338dadc73e3d12c1cde058ca751a188",
    "submitter": {
        "id": 189,
        "url": "http://patchwork.ozlabs.org/api/people/189/?format=api",
        "name": "Jesse Brandeburg",
        "email": "jesse.brandeburg@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/20191029003707.45245-1-jesse.brandeburg@intel.com/mbox/",
    "series": [
        {
            "id": 139280,
            "url": "http://patchwork.ozlabs.org/api/series/139280/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=139280",
            "date": "2019-10-29T00:37:07",
            "name": "[net-next,v2] i40e: implement VF stats NDO",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/139280/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1185787/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1185787/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@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"
        ],
        "Authentication-Results": [
            "ozlabs.org; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=osuosl.org (client-ip=140.211.166.136;\n\thelo=silver.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 472CMx47Pfz9sPK\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 29 Oct 2019 11:37:17 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 23ADD20552;\n\tTue, 29 Oct 2019 00:37:16 +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 S4F-R0iY5W8C; Tue, 29 Oct 2019 00:37:14 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id CD7CA2052C;\n\tTue, 29 Oct 2019 00:37:14 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 9331F1BF980\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 29 Oct 2019 00:37:13 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 8C2B086233\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 29 Oct 2019 00:37:13 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id cZPqY4R4csej for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 29 Oct 2019 00:37:12 +0000 (UTC)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 7FF9E853C5\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 29 Oct 2019 00:37:12 +0000 (UTC)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t28 Oct 2019 17:37:12 -0700",
            "from jfsjbrandeb002.jf.intel.com ([10.166.28.116])\n\tby orsmga007-auth.jf.intel.com with\n\tESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2019 17:37:11 -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-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-IronPort-AV": "E=Sophos;i=\"5.68,241,1569308400\"; d=\"scan'208\";a=\"189779375\"",
        "From": "Jesse Brandeburg <jesse.brandeburg@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Mon, 28 Oct 2019 17:37:07 -0700",
        "Message-Id": "<20191029003707.45245-1-jesse.brandeburg@intel.com>",
        "X-Mailer": "git-send-email 2.17.2",
        "Subject": "[Intel-wired-lan] [PATCH net-next v2] i40e: implement VF stats NDO",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@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@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "Implement the VF stats gathering via the kernel via ndo_get_vf_stats().\nThe driver will show per-VF stats in the output of the command:\nip -s link show dev <PF>\n\nTesting Hints:\nip -s link show dev eth0\nwill return non-zero VF stats.\n...\n   vf 0 MAC 00:55:aa:00:55:aa, spoof checking on, link-state enable, trust off\n   RX: bytes  packets  mcast   bcast\n   128000     1000     104     104\n   TX: bytes  packets\n   128000     1000\n\nSigned-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>\n\n---\n\nv2: remove transmit stats from multicast and broadcast based on\nfeedback, add a little to commit message.\n---\n drivers/net/ethernet/intel/i40e/i40e_main.c   |  1 +\n .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 48 +++++++++++++++++++\n .../ethernet/intel/i40e/i40e_virtchnl_pf.h    |  2 +\n 3 files changed, 51 insertions(+)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex a6f60e8a6026..56cf7bc8add3 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -12870,6 +12870,7 @@ static const struct net_device_ops i40e_netdev_ops = {\n \t.ndo_set_features\t= i40e_set_features,\n \t.ndo_set_vf_mac\t\t= i40e_ndo_set_vf_mac,\n \t.ndo_set_vf_vlan\t= i40e_ndo_set_vf_port_vlan,\n+\t.ndo_get_vf_stats\t= i40e_get_vf_stats,\n \t.ndo_set_vf_rate\t= i40e_ndo_set_vf_bw,\n \t.ndo_get_vf_config\t= i40e_ndo_get_vf_config,\n \t.ndo_set_vf_link_state\t= i40e_ndo_set_vf_link_state,\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\nindex 7787766d0eb8..6d75a35acb67 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -4527,3 +4527,51 @@ int i40e_ndo_set_vf_trust(struct net_device *netdev, int vf_id, bool setting)\n \tclear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state);\n \treturn ret;\n }\n+\n+/**\n+ * i40e_get_vf_stats - populate some stats for the VF\n+ * @netdev: the netdev of the PF\n+ * @vf_id: the host OS identifier (0-127)\n+ * @vf_stats: pointer to the OS memory to be initialized\n+ */\n+int i40e_get_vf_stats(struct net_device *netdev, int vf_id,\n+\t\t      struct ifla_vf_stats *vf_stats)\n+{\n+\tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n+\tstruct i40e_pf *pf = np->vsi->back;\n+\tstruct i40e_eth_stats *stats;\n+\tstruct i40e_vsi *vsi;\n+\tstruct i40e_vf *vf;\n+\n+\t/* validate the request */\n+\tif (i40e_validate_vf(pf, vf_id))\n+\t\treturn -EINVAL;\n+\n+\tvf = &pf->vf[vf_id];\n+\tif (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states)) {\n+\t\tdev_err(&pf->pdev->dev, \"VF %d in reset. Try again.\\n\", vf_id);\n+\t\treturn -EBUSY;\n+\t}\n+\n+\tvsi = pf->vsi[vf->lan_vsi_idx];\n+\tif (!vsi)\n+\t\treturn -EINVAL;\n+\n+\ti40e_update_eth_stats(vsi);\n+\tstats = &vsi->eth_stats;\n+\n+\tmemset(vf_stats, 0, sizeof(*vf_stats));\n+\n+\tvf_stats->rx_packets = stats->rx_unicast + stats->rx_broadcast +\n+\t\tstats->rx_multicast;\n+\tvf_stats->tx_packets = stats->tx_unicast + stats->tx_broadcast +\n+\t\tstats->tx_multicast;\n+\tvf_stats->rx_bytes   = stats->rx_bytes;\n+\tvf_stats->tx_bytes   = stats->tx_bytes;\n+\tvf_stats->broadcast  = stats->rx_broadcast;\n+\tvf_stats->multicast  = stats->rx_multicast;\n+\tvf_stats->rx_dropped = stats->rx_discards;\n+\tvf_stats->tx_dropped = stats->tx_discards;\n+\n+\treturn 0;\n+}\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\nindex 1ce06240a702..631248c0981a 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\n@@ -138,5 +138,7 @@ int i40e_ndo_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool enable);\n \n void i40e_vc_notify_link_state(struct i40e_pf *pf);\n void i40e_vc_notify_reset(struct i40e_pf *pf);\n+int i40e_get_vf_stats(struct net_device *netdev, int vf_id,\n+\t\t      struct ifla_vf_stats *vf_stats);\n \n #endif /* _I40E_VIRTCHNL_PF_H_ */\n",
    "prefixes": [
        "net-next",
        "v2"
    ]
}