Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/786539/?format=api
{ "id": 786539, "url": "http://patchwork.ozlabs.org/api/patches/786539/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/149976834155.2896.1061095686386969972.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": "<149976834155.2896.1061095686386969972.stgit@anamdev.jf.intel.com>", "list_archive_url": null, "date": "2017-07-11T10:19:01", "name": "[6/6,next-queue] net: i40e: Add support to set max bandwidth rates for TCs offloaded via tc/mqprio", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "df2b689749fc43684148adde2f2e0a4d84514b0b", "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/149976834155.2896.1061095686386969972.stgit@anamdev.jf.intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/786539/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/786539/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 3x6J3V6CvQz9s0Z\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 11 Jul 2017 20:19:34 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 35CC186E44;\n\tTue, 11 Jul 2017 10:19:33 +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 8K5qYlOIC3tX; Tue, 11 Jul 2017 10:19:32 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 0BA8D86E4A;\n\tTue, 11 Jul 2017 10:19:32 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 89E6C1C2082\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 11 Jul 2017 10:19:31 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 844BA88B4B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 11 Jul 2017 10:19:31 +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 j9Ckf0cG73zG for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 11 Jul 2017 10:19:30 +0000 (UTC)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id A716388B31\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 11 Jul 2017 10:19:30 +0000 (UTC)", "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t11 Jul 2017 03:19:30 -0700", "from anamdev.jf.intel.com ([10.166.29.110])\n\tby fmsmga005.fm.intel.com with ESMTP; 11 Jul 2017 03:19:29 -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=\"125101588\"", "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:19:01 -0700", "Message-ID": "<149976834155.2896.1061095686386969972.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 6/6] [next-queue]net: i40e: Add support to\n\tset max bandwidth rates for TCs offloaded via tc/mqprio", "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 enables setting up maximum Tx rates for the traffic\nclasses in i40e. The maximum rate offloaded to the hardware through\nthe mqprio framework is configured for the VSI. Configuring\nminimum Tx rate limit is not supported in the device. The minimum\nusable value for Tx rate is 50Mbps.\n\nExample:\n# tc qdisc add dev eth0 root mqprio num_tc 2 map 0 0 0 0 1 1 1 1\\\n queues 4@0 4@4 min_rate 0Mbit 0Mbit max_rate 55Mbit 60Mbit hw 2\n\nTo dump the bandwidth rates:\n# tc qdisc show dev eth0\n\nqdisc mqprio 804a: root tc 2 map 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0\n queues:(0:3) (4:7)\n min rates:0bit 0bit\n max rates:55Mbit 60Mbit\n\nSigned-off-by: Amritha Nambiar <amritha.nambiar@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e.h | 2 +\n drivers/net/ethernet/intel/i40e/i40e_main.c | 99 +++++++++++++++++++++++++--\n 2 files changed, 92 insertions(+), 9 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex c545be6..7a4a338 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -357,6 +357,8 @@ struct i40e_channel {\n \tu8 enabled_tc;\n \tstruct i40e_aqc_vsi_properties_data info;\n \n+\tu64 max_tx_rate;\n+\n \t/* track this channel belongs to which VSI */\n \tstruct i40e_vsi *parent_vsi;\n };\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 409ef09..c5a625c 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -5193,9 +5193,16 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc,\n \ti40e_status ret;\n \tint i;\n \n-\tif ((vsi->back->flags & I40E_FLAG_TC_MQPRIO) ||\n-\t !vsi->mqprio_qopt.qopt.hw)\n+\tif (vsi->back->flags & I40E_FLAG_TC_MQPRIO)\n \t\treturn 0;\n+\tif (!vsi->mqprio_qopt.qopt.hw) {\n+\t\tret = i40e_set_bw_limit(vsi, vsi->seid, 0);\n+\t\tif (ret)\n+\t\t\tdev_info(&vsi->back->pdev->dev,\n+\t\t\t\t \"Failed to reset tx rate for vsi->seid %u\\n\",\n+\t\t\t\t vsi->seid);\n+\t\treturn ret;\n+\t}\n \tbw_data.tc_valid_bits = enabled_tc;\n \tfor (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++)\n \t\tbw_data.tc_bw_credits[i] = bw_share[i];\n@@ -5501,6 +5508,13 @@ static void i40e_remove_queue_channels(struct i40e_vsi *vsi)\n \t\t\trx_ring->ch = NULL;\n \t\t}\n \n+\t\t/* Reset BW configured for this VSI via mqprio */\n+\t\tret = i40e_set_bw_limit(vsi, ch->seid, 0);\n+\t\tif (ret)\n+\t\t\tdev_info(&vsi->back->pdev->dev,\n+\t\t\t\t \"Failed to reset tx rate for ch->seid %u\\n\",\n+\t\t\t\t ch->seid);\n+\n \t\t/* delete VSI from FW */\n \t\tret = i40e_aq_delete_element(&vsi->back->hw, ch->seid,\n \t\t\t\t\t NULL);\n@@ -6073,6 +6087,17 @@ int i40e_create_queue_channel(struct i40e_vsi *vsi,\n \t\t \"Setup channel (id:%u) utilizing num_queues %d\\n\",\n \t\t ch->seid, ch->num_queue_pairs);\n \n+\t/* configure VSI for BW limit */\n+\tif (ch->max_tx_rate) {\n+\t\tif (i40e_set_bw_limit(vsi, ch->seid, ch->max_tx_rate))\n+\t\t\treturn -EINVAL;\n+\n+\t\tdev_dbg(&pf->pdev->dev,\n+\t\t\t\"Set tx rate of %llu Mbps (count of 50Mbps %llu) for vsi->seid %u\\n\",\n+\t\t\tch->max_tx_rate,\n+\t\t\tch->max_tx_rate / I40E_BW_CREDIT_DIVISOR, ch->seid);\n+\t}\n+\n \t/* in case of VF, this will be main SRIOV VSI */\n \tch->parent_vsi = vsi;\n \n@@ -6108,6 +6133,12 @@ static int i40e_configure_queue_channels(struct i40e_vsi *vsi)\n \t\t\tch->base_queue =\n \t\t\t\tvsi->tc_config.tc_info[i].qoffset;\n \n+\t\t\t/* Bandwidth limit through tc interface is in bytes/s,\n+\t\t\t * change to Mbit/s\n+\t\t\t */\n+\t\t\tch->max_tx_rate =\n+\t\t\t\t(vsi->mqprio_qopt.max_rate[i] * 8) / 1000000;\n+\n \t\t\tlist_add_tail(&ch->list, &vsi->ch_list);\n \n \t\t\tret = i40e_create_queue_channel(vsi, ch);\n@@ -6527,6 +6558,7 @@ void i40e_down(struct i40e_vsi *vsi)\n static int i40e_validate_mqprio_qopt(struct i40e_vsi *vsi,\n \t\t\t\t struct tc_mqprio_qopt_offload *mqprio_qopt)\n {\n+\tu64 sum_max_rate = 0;\n \tint i;\n \n \tif ((mqprio_qopt->qopt.offset[0] != 0) ||\n@@ -6536,8 +6568,13 @@ static int i40e_validate_mqprio_qopt(struct i40e_vsi *vsi,\n \tfor (i = 0; ; i++) {\n \t\tif (!mqprio_qopt->qopt.count[i])\n \t\t\treturn -EINVAL;\n-\t\tif (mqprio_qopt->min_rate[i] || mqprio_qopt->max_rate[i])\n+\t\tif (mqprio_qopt->min_rate[i]) {\n+\t\t\tdev_err(&vsi->back->pdev->dev,\n+\t\t\t\t\"Invalid min tx rate (greater than 0) specified\\n\");\n \t\t\treturn -EINVAL;\n+\t\t}\n+\t\tsum_max_rate += ((mqprio_qopt->max_rate[i] * 8) / 1000000);\n+\n \t\tif (i >= mqprio_qopt->qopt.num_tc - 1)\n \t\t\tbreak;\n \t\tif (mqprio_qopt->qopt.offset[i + 1] !=\n@@ -6548,6 +6585,11 @@ static int i40e_validate_mqprio_qopt(struct i40e_vsi *vsi,\n \t (mqprio_qopt->qopt.offset[i] + mqprio_qopt->qopt.count[i])) {\n \t\treturn -EINVAL;\n \t}\n+\tif (sum_max_rate > i40e_get_link_speed(vsi)) {\n+\t\tdev_err(&vsi->back->pdev->dev,\n+\t\t\t\"Invalid max tx rate specified\\n\");\n+\t\treturn -EINVAL;\n+\t}\n \treturn 0;\n }\n \n@@ -6654,6 +6696,19 @@ static int i40e_setup_tc(struct net_device *netdev, struct tc_to_netdev *tc)\n \t}\n \n \tif (pf->flags & I40E_FLAG_TC_MQPRIO) {\n+\t\tif (vsi->mqprio_qopt.max_rate[0]) {\n+\t\t\tu64 max_tx_rate = (vsi->mqprio_qopt.max_rate[0] * 8) /\n+\t\t\t\t\t\t\t\t1000000;\n+\t\t\tret = i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate);\n+\t\t\tif (!ret)\n+\t\t\t\tdev_dbg(&vsi->back->pdev->dev,\n+\t\t\t\t\t\"Set tx rate of %llu Mbps (count of 50Mbps %llu) for vsi->seid %u\\n\",\n+\t\t\t\t\tmax_tx_rate,\n+\t\t\t\t\tmax_tx_rate / I40E_BW_CREDIT_DIVISOR,\n+\t\t\t\t\tvsi->seid);\n+\t\t\telse\n+\t\t\t\tgoto exit;\n+\t\t}\n \t\tret = i40e_configure_queue_channels(vsi);\n \t\tif (ret) {\n \t\t\tnetdev_info(netdev,\n@@ -8088,6 +8143,18 @@ static int i40e_rebuild_channels(struct i40e_vsi *vsi)\n \t\t\t\t vsi->uplink_seid);\n \t\t\treturn ret;\n \t\t}\n+\t\tif (ch->max_tx_rate) {\n+\t\t\tif (i40e_set_bw_limit(vsi, ch->seid,\n+\t\t\t\t\t ch->max_tx_rate))\n+\t\t\t\treturn -EINVAL;\n+\n+\t\t\tdev_dbg(&vsi->back->pdev->dev,\n+\t\t\t\t\"Set tx rate of %llu Mbps (count of 50Mbps %llu) for vsi->seid %u\\n\",\n+\t\t\t\tch->max_tx_rate,\n+\t\t\t\tch->max_tx_rate /\n+\t\t\t\t\t\tI40E_BW_CREDIT_DIVISOR,\n+\t\t\t\tch->seid);\n+\t\t}\n \t}\n \treturn 0;\n }\n@@ -8228,6 +8295,7 @@ static int i40e_reset(struct i40e_pf *pf)\n **/\n static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)\n {\n+\tstruct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];\n \tstruct i40e_hw *hw = &pf->hw;\n \tu8 set_fc_aq_fail = 0;\n \ti40e_status ret;\n@@ -8310,7 +8378,7 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)\n \t * If there were VEBs but the reconstitution failed, we'll try\n \t * try to recover minimal use by getting the basic PF VSI working.\n \t */\n-\tif (pf->vsi[pf->lan_vsi]->uplink_seid != pf->mac_seid) {\n+\tif (vsi->uplink_seid != pf->mac_seid) {\n \t\tdev_dbg(&pf->pdev->dev, \"attempting to rebuild switch\\n\");\n \t\t/* find the one VEB connected to the MAC, and find orphans */\n \t\tfor (v = 0; v < I40E_MAX_VEB; v++) {\n@@ -8334,8 +8402,7 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)\n \t\t\t\t\tdev_info(&pf->pdev->dev,\n \t\t\t\t\t\t \"rebuild of switch failed: %d, will try to set up simple PF connection\\n\",\n \t\t\t\t\t\t ret);\n-\t\t\t\t\tpf->vsi[pf->lan_vsi]->uplink_seid\n-\t\t\t\t\t\t\t\t= pf->mac_seid;\n+\t\t\t\t\tvsi->uplink_seid = pf->mac_seid;\n \t\t\t\t\tbreak;\n \t\t\t\t} else if (pf->veb[v]->uplink_seid == 0) {\n \t\t\t\t\tdev_info(&pf->pdev->dev,\n@@ -8346,10 +8413,10 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)\n \t\t}\n \t}\n \n-\tif (pf->vsi[pf->lan_vsi]->uplink_seid == pf->mac_seid) {\n+\tif (vsi->uplink_seid == pf->mac_seid) {\n \t\tdev_dbg(&pf->pdev->dev, \"attempting to rebuild PF VSI\\n\");\n \t\t/* no VEB, so rebuild only the Main VSI */\n-\t\tret = i40e_add_vsi(pf->vsi[pf->lan_vsi]);\n+\t\tret = i40e_add_vsi(vsi);\n \t\tif (ret) {\n \t\t\tdev_info(&pf->pdev->dev,\n \t\t\t\t \"rebuild of Main VSI failed: %d\\n\", ret);\n@@ -8357,10 +8424,24 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)\n \t\t}\n \t}\n \n+\tif (vsi->mqprio_qopt.max_rate[0]) {\n+\t\tu64 max_tx_rate = (vsi->mqprio_qopt.max_rate[0] * 8) / 1000000;\n+\n+\t\tret = i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate);\n+\t\tif (!ret)\n+\t\t\tdev_dbg(&vsi->back->pdev->dev,\n+\t\t\t\t\"Set tx rate of %llu Mbps (count of 50Mbps %llu) for vsi->seid %u\\n\",\n+\t\t\t\tmax_tx_rate,\n+\t\t\t\tmax_tx_rate / I40E_BW_CREDIT_DIVISOR,\n+\t\t\t\tvsi->seid);\n+\t\telse\n+\t\t\tgoto end_unlock;\n+\t}\n+\n \t/* PF Main VSI is rebuild by now, go ahead and rebuild channel VSIs\n \t * for this main VSI if they exist\n \t */\n-\tret = i40e_rebuild_channels(pf->vsi[pf->lan_vsi]);\n+\tret = i40e_rebuild_channels(vsi);\n \tif (ret)\n \t\tgoto end_unlock;\n \n", "prefixes": [ "6/6", "next-queue" ] }