Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1185638/?format=api
{ "id": 1185638, "url": "http://patchwork.ozlabs.org/api/patches/1185638/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20191028183714.50528-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": "<20191028183714.50528-1-jesse.brandeburg@intel.com>", "list_archive_url": null, "date": "2019-10-28T18:37:14", "name": "[net-next,v1] i40e: implement VF stats NDO", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "cb65a7313847193e7c2ba81b38e366ec18884935", "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/20191028183714.50528-1-jesse.brandeburg@intel.com/mbox/", "series": [ { "id": 139222, "url": "http://patchwork.ozlabs.org/api/series/139222/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=139222", "date": "2019-10-28T18:37:14", "name": "[net-next,v1] i40e: implement VF stats NDO", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/139222/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1185638/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1185638/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.133;\n\thelo=hemlock.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 hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\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 4723Nn0Xf6z9sPf\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 29 Oct 2019 05:37:28 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id A2F338609B;\n\tMon, 28 Oct 2019 18:37:26 +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 pXGCLAZLC07o; Mon, 28 Oct 2019 18:37:25 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 9CAF0860FC;\n\tMon, 28 Oct 2019 18:37:25 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id C155F1BF29A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Oct 2019 18:37:23 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id B9366848A3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Oct 2019 18:37:23 +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 4bdQrg+FGDnZ for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Oct 2019 18:37:22 +0000 (UTC)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 900208489C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Oct 2019 18:37:22 +0000 (UTC)", "from orsmga006.jf.intel.com ([10.7.209.51])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t28 Oct 2019 11:37:21 -0700", "from jfsjbrandeb002.jf.intel.com ([10.166.28.116])\n\tby orsmga006-auth.jf.intel.com with\n\tESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2019 11:37:21 -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,240,1569308400\"; d=\"scan'208\";a=\"203345576\"", "From": "Jesse Brandeburg <jesse.brandeburg@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Mon, 28 Oct 2019 11:37:14 -0700", "Message-Id": "<20191028183714.50528-1-jesse.brandeburg@intel.com>", "X-Mailer": "git-send-email 2.17.2", "Subject": "[Intel-wired-lan] [PATCH net-next v1] 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\nip -s link show dev <PF>\ncommand.\n\nTesting Hints (Required if no HSD): ip -s link show dev eth0,\nwill return non-zero VF stats.\n\nSigned-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>\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..84cf851cbbb7 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 + stats->tx_broadcast;\n+\tvf_stats->multicast = stats->rx_multicast + stats->tx_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", "v1" ] }