get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/823594/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 823594,
    "url": "http://patchwork.ozlabs.org/api/patches/823594/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20171009224845.3216-1-alan.brady@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": "<20171009224845.3216-1-alan.brady@intel.com>",
    "list_archive_url": null,
    "date": "2017-10-09T22:48:45",
    "name": "[net-next] i40e: fix u64 division usage",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e6b773449ab50abb36ea636f8aaa7ce10c0630d6",
    "submitter": {
        "id": 69551,
        "url": "http://patchwork.ozlabs.org/api/people/69551/?format=api",
        "name": "Alan Brady",
        "email": "alan.brady@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/20171009224845.3216-1-alan.brady@intel.com/mbox/",
    "series": [
        {
            "id": 7264,
            "url": "http://patchwork.ozlabs.org/api/series/7264/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=7264",
            "date": "2017-10-09T22:48:45",
            "name": "[net-next] i40e: fix u64 division usage",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/7264/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/823594/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/823594/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 3y9wTx6lxHz9s7v\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 10 Oct 2017 09:51:49 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 31F5488600;\n\tMon,  9 Oct 2017 22:51:47 +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 lMyug-i4we1V; Mon,  9 Oct 2017 22:51:46 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id EA739885D3;\n\tMon,  9 Oct 2017 22:51:45 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id A3DA51C024B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon,  9 Oct 2017 22:51:44 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 9E673874BF\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon,  9 Oct 2017 22:51:44 +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 r83utaztsjHH for <intel-wired-lan@lists.osuosl.org>;\n\tMon,  9 Oct 2017 22:51:42 +0000 (UTC)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id AFB9186EC3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon,  9 Oct 2017 22:51:42 +0000 (UTC)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t09 Oct 2017 15:51:42 -0700",
            "from dev1-atbrady.jf.intel.com ([10.165.248.38])\n\tby fmsmga001.fm.intel.com with ESMTP; 09 Oct 2017 15:51:41 -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.42,501,1500966000\"; d=\"scan'208\";\n\ta=\"1204015735\"",
        "From": "Alan Brady <alan.brady@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Mon,  9 Oct 2017 15:48:45 -0700",
        "Message-Id": "<20171009224845.3216-1-alan.brady@intel.com>",
        "X-Mailer": "git-send-email 2.14.1",
        "Subject": "[Intel-wired-lan] [PATCH net-next] i40e: fix u64 division usage",
        "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>",
        "MIME-Version": "1.0",
        "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": "Commit 52eb1ff93e98 (\"i40e: Add support setting TC max bandwidth rates\")\nand commit 1ea6f21ae530 (\"i40e: Refactor VF BW rate limiting\") add some\nneeded functionality for TC bandwidth rate limiting.  Unfortunately they\nintroduce several usages of unsigned 64-bit division which needs to be\nhandled special by the kernel to support all architectures.\n\nFixes: 52eb1ff93e98 (\"i40e: Add support setting TC max bandwidth\nrates\")\nFixes: 1ea6f21ae530 (\"i40e: Refactor VF BW rate limiting\")\n\nSigned-off-by: Alan Brady <alan.brady@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e.h      |  3 +-\n drivers/net/ethernet/intel/i40e/i40e_main.c | 59 +++++++++++++++++++----------\n 2 files changed, 42 insertions(+), 20 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 266e1dc5e786..eb017763646d 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -130,7 +130,8 @@\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+#define I40E_BW_MBPS_DIVISOR\t\t125000 /* rate / (1000000 / 8) Mbps */\n+#define I40E_MAX_BW_INACTIVE_ACCUM\t4 /* accumulate 4 credits max */\n \n /* driver state flags */\n enum i40e_state_t {\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex b8ab17d18cd6..303c8885d987 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -5442,6 +5442,7 @@ int i40e_get_link_speed(struct i40e_vsi *vsi)\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+\tu64 credits = 0;\n \tint speed = 0;\n \tint ret = 0;\n \n@@ -5459,8 +5460,9 @@ int i40e_set_bw_limit(struct i40e_vsi *vsi, u16 seid, u64 max_tx_rate)\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+\tcredits = max_tx_rate;\n+\tdo_div(credits, I40E_BW_CREDIT_DIVISOR);\n+\tret = i40e_aq_config_vsi_bw_limit(&pf->hw, seid, credits,\n \t\t\t\t\t  I40E_MAX_BW_INACTIVE_ACCUM, NULL);\n \tif (ret)\n \t\tdev_err(&pf->pdev->dev,\n@@ -6063,13 +6065,17 @@ int i40e_create_queue_channel(struct i40e_vsi *vsi,\n \n \t/* configure VSI for BW limit */\n \tif (ch->max_tx_rate) {\n+\t\tu64 credits = ch->max_tx_rate;\n+\n \t\tif (i40e_set_bw_limit(vsi, ch->seid, ch->max_tx_rate))\n \t\t\treturn -EINVAL;\n \n+\t\tdo_div(credits, I40E_BW_CREDIT_DIVISOR);\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\t\tcredits,\n+\t\t\tch->seid);\n \t}\n \n \t/* in case of VF, this will be main SRIOV VSI */\n@@ -6090,6 +6096,7 @@ int i40e_create_queue_channel(struct i40e_vsi *vsi,\n static int i40e_configure_queue_channels(struct i40e_vsi *vsi)\n {\n \tstruct i40e_channel *ch;\n+\tu64 max_rate = 0;\n \tint ret = 0, i;\n \n \t/* Create app vsi with the TCs. Main VSI with TC0 is already set up */\n@@ -6110,8 +6117,9 @@ static int i40e_configure_queue_channels(struct i40e_vsi *vsi)\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\tvsi->mqprio_qopt.max_rate[i] / (1000000 / 8);\n+\t\t\tmax_rate = vsi->mqprio_qopt.max_rate[i];\n+\t\t\tdo_div(max_rate, I40E_BW_MBPS_DIVISOR);\n+\t\t\tch->max_tx_rate = max_rate;\n \n \t\t\tlist_add_tail(&ch->list, &vsi->ch_list);\n \n@@ -6540,6 +6548,7 @@ 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+\tu64 max_rate = 0;\n \tint i;\n \n \tif ((mqprio_qopt->qopt.offset[0] != 0) ||\n@@ -6554,7 +6563,9 @@ static int i40e_validate_mqprio_qopt(struct i40e_vsi *vsi,\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] / (1000000 / 8));\n+\t\tmax_rate = mqprio_qopt->max_rate[i];\n+\t\tdo_div(max_rate, I40E_BW_MBPS_DIVISOR);\n+\t\tsum_max_rate += max_rate;\n \n \t\tif (i >= mqprio_qopt->qopt.num_tc - 1)\n \t\t\tbreak;\n@@ -6698,14 +6709,18 @@ static int i40e_setup_tc(struct net_device *netdev, void *type_data)\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] /\n-\t\t\t\t\t\t\t\t(1000000 / 8);\n+\t\t\tu64 max_tx_rate = vsi->mqprio_qopt.max_rate[0];\n+\n+\t\t\tdo_div(max_tx_rate, I40E_BW_MBPS_DIVISOR);\n \t\t\tret = i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate);\n \t\t\tif (!ret) {\n+\t\t\t\tu64 credits = max_tx_rate;\n+\n+\t\t\t\tdo_div(credits, I40E_BW_CREDIT_DIVISOR);\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\tcredits,\n \t\t\t\t\tvsi->seid);\n \t\t\t} else {\n \t\t\t\tneed_reset = true;\n@@ -8166,15 +8181,17 @@ static int i40e_rebuild_channels(struct i40e_vsi *vsi)\n \t\t\treturn ret;\n \t\t}\n \t\tif (ch->max_tx_rate) {\n+\t\t\tu64 credits = ch->max_tx_rate;\n+\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\tdo_div(credits, I40E_BW_CREDIT_DIVISOR);\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\tcredits,\n \t\t\t\tch->seid);\n \t\t}\n \t}\n@@ -8447,17 +8464,21 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)\n \t}\n \n \tif (vsi->mqprio_qopt.max_rate[0]) {\n-\t\tu64 max_tx_rate = vsi->mqprio_qopt.max_rate[0] / (1000000 / 8);\n+\t\tu64 max_tx_rate = vsi->mqprio_qopt.max_rate[0];\n+\t\tu64 credits = 0;\n \n+\t\tdo_div(max_tx_rate, I40E_BW_MBPS_DIVISOR);\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\tif (ret)\n \t\t\tgoto end_unlock;\n+\n+\t\tcredits = max_tx_rate;\n+\t\tdo_div(credits, I40E_BW_CREDIT_DIVISOR);\n+\t\tdev_dbg(&vsi->back->pdev->dev,\n+\t\t\t\"Set tx rate of %llu Mbps (count of 50Mbps %llu) for vsi->seid %u\\n\",\n+\t\t\tmax_tx_rate,\n+\t\t\tcredits,\n+\t\t\tvsi->seid);\n \t}\n \n \t/* PF Main VSI is rebuild by now, go ahead and rebuild channel VSIs\n",
    "prefixes": [
        "net-next"
    ]
}