Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/802475/?format=api
{ "id": 802475, "url": "http://patchwork.ozlabs.org/api/patches/802475/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/150296407028.16167.6134503766227542081.stgit@anamdev.jf.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": "<150296407028.16167.6134503766227542081.stgit@anamdev.jf.intel.com>", "list_archive_url": null, "date": "2017-08-17T10:01:10", "name": "[v2,5/6,net-next] net: i40e: Refactor VF BW rate limiting function to be reused on the PF as well", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "07fa7ec27a53d06a0c99def7908b44b5febfa630", "submitter": { "id": 68504, "url": "http://patchwork.ozlabs.org/api/people/68504/?format=api", "name": "Nambiar, Amritha", "email": "amritha.nambiar@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/150296407028.16167.6134503766227542081.stgit@anamdev.jf.intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/802475/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/802475/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;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.138; helo=whitealder.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\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 3xY1wK4GPJz9t16\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 17 Aug 2017 20:02:09 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id B2BBB88F3E;\n\tThu, 17 Aug 2017 10:02:07 +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 dCbFjhTZCmQx; Thu, 17 Aug 2017 10:02:06 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id F304288F38;\n\tThu, 17 Aug 2017 10:02:05 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 8474D1C4118\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 17 Aug 2017 10:02:02 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 7C2BA88084\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 17 Aug 2017 10:02:02 +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 R7tl4NaknBqk for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 17 Aug 2017 10:02:01 +0000 (UTC)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 8BE3F88086\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 17 Aug 2017 10:02:01 +0000 (UTC)", "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t17 Aug 2017 03:02:01 -0700", "from anamdev.jf.intel.com ([10.166.29.110])\n\tby fmsmga006.fm.intel.com with ESMTP; 17 Aug 2017 03:02:01 -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.41,387,1498546800\"; d=\"scan'208\";a=\"141382155\"", "From": "Amritha Nambiar <amritha.nambiar@intel.com>", "To": "intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com", "Date": "Thu, 17 Aug 2017 03:01:10 -0700", "Message-ID": "<150296407028.16167.6134503766227542081.stgit@anamdev.jf.intel.com>", "In-Reply-To": "<150296373549.16167.14331445560838257351.stgit@anamdev.jf.intel.com>", "References": "<150296373549.16167.14331445560838257351.stgit@anamdev.jf.intel.com>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH v2 5/6] [net-next]net: i40e: Refactor VF\n\tBW rate limiting function to be reused on the PF as well", "X-BeenThere": "intel-wired-lan@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.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>", "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": "This patch refactors the BW rate limiting for Tx traffic\non the VF to be reused in the next patch for rate limiting Tx\ntraffic for the VSIs on the PF as well.\n\nSigned-off-by: Amritha Nambiar <amritha.nambiar@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e.h | 5 ++\n drivers/net/ethernet/intel/i40e/i40e_main.c | 63 ++++++++++++++++++++\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 45 +-------------\n 3 files changed, 70 insertions(+), 43 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 2565280..304921e 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -128,6 +128,10 @@\n /* default to trying for four seconds */\n #define I40E_TRY_LINK_TIMEOUT\t(4 * HZ)\n \n+/* BW rate limiting */\n+#define I40E_BW_CREDIT_DIVISOR\t\t50 /* 50Mbps per BW credit */\n+#define I40E_MAX_BW_INACTIVE_ACCUM\t4 /* accumulate 4 credits max */\n+\n /* driver state flags */\n enum i40e_state_t {\n \t__I40E_TESTING,\n@@ -1042,4 +1046,5 @@ static inline bool i40e_enabled_xdp_vsi(struct i40e_vsi *vsi)\n }\n \n int i40e_create_queue_channel(struct i40e_vsi *vsi, struct i40e_channel *ch);\n+int i40e_set_bw_limit(struct i40e_vsi *vsi, u16 seid, u64 max_tx_rate);\n #endif /* _I40E_H_ */\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 5b783fc..fcf563a 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -5405,6 +5405,69 @@ static int i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 enabled_tc)\n }\n \n /**\n+ * i40e_get_link_speed - Returns link speed for the interface\n+ * @vsi: VSI to be configured\n+ *\n+ **/\n+int i40e_get_link_speed(struct i40e_vsi *vsi)\n+{\n+\tstruct i40e_pf *pf = vsi->back;\n+\n+\tswitch (pf->hw.phy.link_info.link_speed) {\n+\tcase I40E_LINK_SPEED_40GB:\n+\t\treturn 40000;\n+\tcase I40E_LINK_SPEED_25GB:\n+\t\treturn 25000;\n+\tcase I40E_LINK_SPEED_20GB:\n+\t\treturn 20000;\n+\tcase I40E_LINK_SPEED_10GB:\n+\t\treturn 10000;\n+\tcase I40E_LINK_SPEED_1GB:\n+\t\treturn 1000;\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+}\n+\n+/**\n+ * i40e_set_bw_limit - setup BW limit for Tx traffic based on max_tx_rate\n+ * @vsi: VSI to be configured\n+ * @seid: seid of the channel/VSI\n+ * @max_tx_rate: max TX rate to be configured as BW limit\n+ *\n+ * Helper function to set BW limit for a given VSI\n+ **/\n+int i40e_set_bw_limit(struct i40e_vsi *vsi, u16 seid, u64 max_tx_rate)\n+{\n+\tstruct i40e_pf *pf = vsi->back;\n+\tint speed = 0;\n+\tint ret = 0;\n+\n+\tspeed = i40e_get_link_speed(vsi);\n+\tif (max_tx_rate > speed) {\n+\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\"Invalid max tx rate %llu specified for VSI seid %d.\",\n+\t\t\tmax_tx_rate, seid);\n+\t\treturn -EINVAL;\n+\t}\n+\tif ((max_tx_rate < 50) && (max_tx_rate > 0)) {\n+\t\tdev_warn(&pf->pdev->dev,\n+\t\t\t \"Setting max tx rate to minimum usable value of 50Mbps.\\n\");\n+\t\tmax_tx_rate = 50;\n+\t}\n+\n+ /* Tx rate credits are in values of 50Mbps, 0 is disabled*/\n+\tret = i40e_aq_config_vsi_bw_limit(&pf->hw, seid,\n+\t\t\t\t\t max_tx_rate / I40E_BW_CREDIT_DIVISOR,\n+\t\t\t\t\t I40E_MAX_BW_INACTIVE_ACCUM, NULL);\n+\tif (ret)\n+\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\"Failed set tx rate (%llu Mbps) for vsi->seid %u, error code %d.\\n\",\n+\t\t\tmax_tx_rate, seid, ret);\n+\treturn ret;\n+}\n+\n+/**\n * i40e_remove_queue_channels - Remove queue channels for the TCs\n * @vsi: VSI to be configured\n *\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\nindex 92fe06d..a1d2391 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -3061,8 +3061,6 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,\n \treturn ret;\n }\n \n-#define I40E_BW_CREDIT_DIVISOR 50 /* 50Mbps per BW credit */\n-#define I40E_MAX_BW_INACTIVE_ACCUM 4 /* device can accumulate 4 credits max */\n /**\n * i40e_ndo_set_vf_bw\n * @netdev: network interface device structure\n@@ -3078,7 +3076,6 @@ int i40e_ndo_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate,\n \tstruct i40e_pf *pf = np->vsi->back;\n \tstruct i40e_vsi *vsi;\n \tstruct i40e_vf *vf;\n-\tint speed = 0;\n \tint ret = 0;\n \n \t/* validate the request */\n@@ -3103,48 +3100,10 @@ int i40e_ndo_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate,\n \t\tgoto error;\n \t}\n \n-\tswitch (pf->hw.phy.link_info.link_speed) {\n-\tcase I40E_LINK_SPEED_40GB:\n-\t\tspeed = 40000;\n-\t\tbreak;\n-\tcase I40E_LINK_SPEED_25GB:\n-\t\tspeed = 25000;\n-\t\tbreak;\n-\tcase I40E_LINK_SPEED_20GB:\n-\t\tspeed = 20000;\n-\t\tbreak;\n-\tcase I40E_LINK_SPEED_10GB:\n-\t\tspeed = 10000;\n-\t\tbreak;\n-\tcase I40E_LINK_SPEED_1GB:\n-\t\tspeed = 1000;\n-\t\tbreak;\n-\tdefault:\n-\t\tbreak;\n-\t}\n-\n-\tif (max_tx_rate > speed) {\n-\t\tdev_err(&pf->pdev->dev, \"Invalid max tx rate %d specified for VF %d.\\n\",\n-\t\t\tmax_tx_rate, vf->vf_id);\n-\t\tret = -EINVAL;\n+\tret = i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate);\n+\tif (ret)\n \t\tgoto error;\n-\t}\n \n-\tif ((max_tx_rate < 50) && (max_tx_rate > 0)) {\n-\t\tdev_warn(&pf->pdev->dev, \"Setting max Tx rate to minimum usable value of 50Mbps.\\n\");\n-\t\tmax_tx_rate = 50;\n-\t}\n-\n-\t/* Tx rate credits are in values of 50Mbps, 0 is disabled*/\n-\tret = i40e_aq_config_vsi_bw_limit(&pf->hw, vsi->seid,\n-\t\t\t\t\t max_tx_rate / I40E_BW_CREDIT_DIVISOR,\n-\t\t\t\t\t I40E_MAX_BW_INACTIVE_ACCUM, NULL);\n-\tif (ret) {\n-\t\tdev_err(&pf->pdev->dev, \"Unable to set max tx rate, error code %d.\\n\",\n-\t\t\tret);\n-\t\tret = -EIO;\n-\t\tgoto error;\n-\t}\n \tvf->tx_rate = max_tx_rate;\n error:\n \treturn ret;\n", "prefixes": [ "v2", "5/6", "net-next" ] }