Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/810969/?format=api
{ "id": 810969, "url": "http://patchwork.ozlabs.org/api/patches/810969/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/150478202784.24662.17062791162973773248.stgit@anamdev.jf.intel.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<150478202784.24662.17062791162973773248.stgit@anamdev.jf.intel.com>", "list_archive_url": null, "date": "2017-09-07T11:00:27", "name": "[RFC,v3,5/6] i40e: Refactor VF BW rate limiting", "commit_ref": null, "pull_url": null, "state": "rfc", "archived": true, "hash": "2016bae7389d0a3ec6d3cc0a612eba9e9cb21057", "submitter": { "id": 68504, "url": "http://patchwork.ozlabs.org/api/people/68504/?format=api", "name": "Nambiar, Amritha", "email": "amritha.nambiar@intel.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/150478202784.24662.17062791162973773248.stgit@anamdev.jf.intel.com/mbox/", "series": [ { "id": 1978, "url": "http://patchwork.ozlabs.org/api/series/1978/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=1978", "date": "2017-09-07T11:00:01", "name": "Configuring traffic classes via new hardware offload mechanism in tc/mqprio", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/1978/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/810969/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/810969/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xnyFF3N3zz9s7C\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 7 Sep 2017 21:01:37 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1755161AbdIGLBg (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 7 Sep 2017 07:01:36 -0400", "from mga05.intel.com ([192.55.52.43]:21306 \"EHLO mga05.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1755141AbdIGLBd (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tThu, 7 Sep 2017 07:01:33 -0400", "from orsmga005.jf.intel.com ([10.7.209.41])\n\tby fmsmga105.fm.intel.com with ESMTP; 07 Sep 2017 04:01:32 -0700", "from anamdev.jf.intel.com ([10.166.29.110])\n\tby orsmga005.jf.intel.com with ESMTP; 07 Sep 2017 04:01:32 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.42,357,1500966000\"; d=\"scan'208\";a=\"146520891\"", "Subject": "[RFC PATCH v3 5/6] i40e: Refactor VF BW rate limiting", "From": "Amritha Nambiar <amritha.nambiar@intel.com>", "To": "intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com", "Cc": "alexander.h.duyck@intel.com, netdev@vger.kernel.org,\n\tamritha.nambiar@intel.com", "Date": "Thu, 07 Sep 2017 04:00:27 -0700", "Message-ID": "<150478202784.24662.17062791162973773248.stgit@anamdev.jf.intel.com>", "In-Reply-To": "<150478158684.24662.17975701233699487888.stgit@anamdev.jf.intel.com>", "References": "<150478158684.24662.17975701233699487888.stgit@anamdev.jf.intel.com>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.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\nv3: Minor fixes, clean up log messages based on Shannon's comments.\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 | 64 ++++++++++++++++++++\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 45 +-------------\n 3 files changed, 71 insertions(+), 43 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex ddb7292..2ee0197 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 a953c2e..7f13bc7 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -5406,6 +5406,70 @@ 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 && max_tx_rate < 50) {\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+\t/* 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, err %s aq_err %s\\n\",\n+\t\t\tmax_tx_rate, seid, i40e_stat_str(&pf->hw, ret),\n+\t\t\ti40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));\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 ac88d96..06b2548 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -3115,8 +3115,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@@ -3132,7 +3130,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@@ -3157,48 +3154,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": [ "RFC", "v3", "5/6" ] }