Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/786537/?format=api
{ "id": 786537, "url": "http://patchwork.ozlabs.org/api/patches/786537/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/149976833611.2896.14684072908307834234.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": "<149976833611.2896.14684072908307834234.stgit@anamdev.jf.intel.com>", "list_archive_url": null, "date": "2017-07-11T10:18:56", "name": "[5/6,next-queue] 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/149976833611.2896.14684072908307834234.stgit@anamdev.jf.intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/786537/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/786537/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" ], "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 3x6J3Q3JM0z9s0Z\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 11 Jul 2017 20:19:30 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 99F5F86F89;\n\tTue, 11 Jul 2017 10:19:28 +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 JgJoKvdTqOPj; Tue, 11 Jul 2017 10:19:27 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 83A1D866CE;\n\tTue, 11 Jul 2017 10:19:27 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 8D7AB1C2082\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 11 Jul 2017 10:19:25 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 85E3688B4B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 11 Jul 2017 10:19:25 +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 AuIEwm5pCu+5 for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 11 Jul 2017 10:19:24 +0000 (UTC)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 9411D88B31\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 11 Jul 2017 10:19:24 +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\t11 Jul 2017 03:19:24 -0700", "from anamdev.jf.intel.com ([10.166.29.110])\n\tby fmsmga006.fm.intel.com with ESMTP; 11 Jul 2017 03:19:23 -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.40,345,1496127600\"; d=\"scan'208\";a=\"125691190\"", "From": "Amritha Nambiar <amritha.nambiar@intel.com>", "To": "intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com", "Date": "Tue, 11 Jul 2017 03:18:56 -0700", "Message-ID": "<149976833611.2896.14684072908307834234.stgit@anamdev.jf.intel.com>", "In-Reply-To": "<149976762072.2896.5722904915197643856.stgit@anamdev.jf.intel.com>", "References": "<149976762072.2896.5722904915197643856.stgit@anamdev.jf.intel.com>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "Cc": "netdev@vger.kernel.org, mitch.a.williams@intel.com", "Subject": "[Intel-wired-lan] [PATCH 5/6] [next-queue]net: i40e: Refactor VF BW\n\trate 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 501d62e..c545be6 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -127,6 +127,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@@ -1040,4 +1044,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 40084b7..409ef09 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -5397,6 +5397,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 be172f8..7a0f953 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -2926,8 +2926,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@@ -2943,7 +2941,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@@ -2968,48 +2965,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": [ "5/6", "next-queue" ] }