Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/802476/?format=api
{ "id": 802476, "url": "http://patchwork.ozlabs.org/api/patches/802476/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/150296407551.16167.8723726116003551646.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": "<150296407551.16167.8723726116003551646.stgit@anamdev.jf.intel.com>", "list_archive_url": null, "date": "2017-08-17T10:01:15", "name": "[v2,6/6,net-next] 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": "19561877f6c6862e644c63e7593aa4fb39a92ac8", "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/150296407551.16167.8723726116003551646.stgit@anamdev.jf.intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/802476/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/802476/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.137; helo=fraxinus.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\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 3xY1wR0GR8z9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 17 Aug 2017 20:02:14 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 6186E88095;\n\tThu, 17 Aug 2017 10:02:13 +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 ZcP9At3BDnr7; Thu, 17 Aug 2017 10:02:12 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id A669288086;\n\tThu, 17 Aug 2017 10:02:12 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id B59871C072D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 17 Aug 2017 10:02:10 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id B043B88F39\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 17 Aug 2017 10:02:10 +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 ub4e-dTlwS8M for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 17 Aug 2017 10:02:07 +0000 (UTC)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 54BCF88F48\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 17 Aug 2017 10:02:07 +0000 (UTC)", "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t17 Aug 2017 03:02:06 -0700", "from anamdev.jf.intel.com ([10.166.29.110])\n\tby fmsmga005.fm.intel.com with ESMTP; 17 Aug 2017 03:02:06 -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=\"140754307\"", "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:15 -0700", "Message-ID": "<150296407551.16167.8723726116003551646.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 6/6] [net-next]net: i40e: Add support\n\tto set 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 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_rate:0bit 0bit\n max_rate: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 304921e..8852ac0 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -359,6 +359,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 fcf563a..601a86d 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -5201,9 +5201,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@@ -5509,6 +5516,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@@ -6081,6 +6095,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@@ -6116,6 +6141,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@@ -6541,6 +6572,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@@ -6550,8 +6582,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@@ -6562,6 +6599,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@@ -6701,6 +6743,19 @@ static int i40e_setup_tc(struct net_device *netdev, enum tc_setup_type type,\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 reset;\n+\t\t}\n \t\tret = i40e_configure_queue_channels(vsi);\n \t\tif (ret) {\n \t\t\tnetdev_info(netdev,\n@@ -8140,6 +8195,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@@ -8280,6 +8347,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@@ -8362,7 +8430,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@@ -8386,8 +8454,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@@ -8398,10 +8465,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@@ -8409,10 +8476,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": [ "v2", "6/6", "net-next" ] }