get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 864986,
    "url": "http://patchwork.ozlabs.org/api/patches/864986/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180123165106.28900-9-avinash.dayanand@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": "<20180123165106.28900-9-avinash.dayanand@intel.com>",
    "list_archive_url": null,
    "date": "2018-01-23T16:51:02",
    "name": "[v3,next-queue,08/12] i40e: Service request to configure bandwidth for ADq on a VF",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "a244d67cb23d56374865f44d098bd1c1e815acd0",
    "submitter": {
        "id": 67689,
        "url": "http://patchwork.ozlabs.org/api/people/67689/?format=api",
        "name": "Dayanand, Avinash",
        "email": "avinash.dayanand@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/20180123165106.28900-9-avinash.dayanand@intel.com/mbox/",
    "series": [
        {
            "id": 24988,
            "url": "http://patchwork.ozlabs.org/api/series/24988/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=24988",
            "date": "2018-01-23T16:51:00",
            "name": "Enable queue channel and cloud filter support on i40evf",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/24988/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/864986/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/864986/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 3zQzVF158jz9s7s\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 24 Jan 2018 06:52:37 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id BAB7D87963;\n\tTue, 23 Jan 2018 19:52:35 +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 buev69jpG53c; Tue, 23 Jan 2018 19:52:33 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 83EB4879E8;\n\tTue, 23 Jan 2018 19:52:33 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 3EDC51C0521\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 23 Jan 2018 19:52:31 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 3B90B88200\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 23 Jan 2018 19:52: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 tD3+CSgUHWls for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 23 Jan 2018 19:52:24 +0000 (UTC)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 13BCC8823F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 23 Jan 2018 19:52:23 +0000 (UTC)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t23 Jan 2018 11:52:22 -0800",
            "from avi-linux2.jf.intel.com ([10.166.244.156])\n\tby orsmga001.jf.intel.com with ESMTP; 23 Jan 2018 11:52:06 -0800"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.46,402,1511856000\"; d=\"scan'208\";a=\"25768878\"",
        "From": "Avinash Dayanand <avinash.dayanand@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Tue, 23 Jan 2018 08:51:02 -0800",
        "Message-Id": "<20180123165106.28900-9-avinash.dayanand@intel.com>",
        "X-Mailer": "git-send-email 2.9.4",
        "In-Reply-To": "<20180123165106.28900-1-avinash.dayanand@intel.com>",
        "References": "<20180123165106.28900-1-avinash.dayanand@intel.com>",
        "Subject": "[Intel-wired-lan] [PATCH v3 next-queue 08/12] i40e: Service request\n\tto configure bandwidth for ADq on a VF",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.24",
        "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": "This patch handles the request from ADq enabled VF to allocate\nbandwidth to each traffic class which means for each VSI.\n\nSigned-off-by: Avinash Dayanand <avinash.dayanand@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 56 ++++++++++++++++++++--\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h |  1 +\n 2 files changed, 54 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\nindex 0c1c699..989664a 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -711,6 +711,7 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, u8 idx)\n \tstruct i40e_mac_filter *f = NULL;\n \tstruct i40e_pf *pf = vf->pf;\n \tstruct i40e_vsi *vsi;\n+\tu64 max_tx_rate = 0;\n \tint ret = 0;\n \n \tvsi = i40e_vsi_setup(pf, I40E_VSI_SRIOV, pf->vsi[pf->lan_vsi]->seid,\n@@ -770,8 +771,15 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, u8 idx)\n \n \t/* Set VF bandwidth if specified */\n \tif (vf->tx_rate) {\n+\t\tmax_tx_rate = vf->tx_rate;\n+\t} else if (vf->ch[idx].max_tx_rate) {\n+\t\tmax_tx_rate = vf->ch[idx].max_tx_rate;\n+\t}\n+\n+\tif (max_tx_rate) {\n+\t\tmax_tx_rate = div_u64(max_tx_rate, I40E_BW_CREDIT_DIVISOR);\n \t\tret = i40e_aq_config_vsi_bw_limit(&pf->hw, vsi->seid,\n-\t\t\t\t\t\t  vf->tx_rate / 50, 0, NULL);\n+\t\t\t\t\t\t  max_tx_rate, 0, NULL);\n \t\tif (ret)\n \t\t\tdev_err(&pf->pdev->dev, \"Unable to set tx rate, VF %d, error code %d.\\n\",\n \t\t\t\tvf->vf_id, ret);\n@@ -2918,7 +2926,8 @@ static int i40e_vc_add_qch_msg(struct i40e_vf *vf, u8 *msg)\n \tstruct virtchnl_tc_info *tci =\n \t\t(struct virtchnl_tc_info *)msg;\n \tstruct i40e_pf *pf = vf->pf;\n-\tint i, adq_request_qps = 0;\n+\tstruct i40e_link_status *ls = &pf->hw.phy.link_info;\n+\tint i, adq_request_qps = 0, speed = 0;\n \ti40e_status aq_ret = 0;\n \n \tif (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {\n@@ -2979,10 +2988,51 @@ static int i40e_vc_add_qch_msg(struct i40e_vf *vf, u8 *msg)\n \t\tvf->num_queue_pairs = I40E_MAX_VF_QUEUES;\n \t}\n \n+\t/* get link speed in MB to validate rate limit */\n+\tswitch (ls->link_speed) {\n+\tcase VIRTCHNL_LINK_SPEED_100MB:\n+\t\tspeed = SPEED_100;\n+\t\tbreak;\n+\tcase VIRTCHNL_LINK_SPEED_1GB:\n+\t\tspeed = SPEED_1000;\n+\t\tbreak;\n+\tcase VIRTCHNL_LINK_SPEED_10GB:\n+\t\tspeed = SPEED_10000;\n+\t\tbreak;\n+\tcase VIRTCHNL_LINK_SPEED_20GB:\n+\t\tspeed = SPEED_20000;\n+\t\tbreak;\n+\tcase VIRTCHNL_LINK_SPEED_25GB:\n+\t\tspeed = SPEED_25000;\n+\t\tbreak;\n+\tcase VIRTCHNL_LINK_SPEED_40GB:\n+\t\tspeed = SPEED_40000;\n+\t\tbreak;\n+\tdefault:\n+\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\"Cannot detect link speed\\n\");\n+\t\taq_ret = I40E_ERR_PARAM;\n+\t\tgoto err;\n+\t}\n+\n \t/* parse data from the queue channel info */\n \tvf->num_tc = tci->num_tc;\n-\tfor (i = 0; i < vf->num_tc; i++)\n+\tfor (i = 0; i < vf->num_tc; i++) {\n+\t\tif (tci->list[i].max_tx_rate) {\n+\t\t\tif (tci->list[i].max_tx_rate > speed) {\n+\t\t\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\t\t\"Invalid max tx rate %llu specified for VF %d.\",\n+\t\t\t\t\ttci->list[i].max_tx_rate,\n+\t\t\t\t\tvf->vf_id);\n+\t\t\t\taq_ret = I40E_ERR_PARAM;\n+\t\t\t\tgoto err;\n+\t\t\t} else {\n+\t\t\t\tvf->ch[i].max_tx_rate =\n+\t\t\t\t\ttci->list[i].max_tx_rate;\n+\t\t\t}\n+\t\t}\n \t\tvf->ch[i].num_qps = tci->list[i].count;\n+\t}\n \n \t/* set this flag only after making sure all inputs are sane */\n \tvf->adq_enabled = true;\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\nindex 67543db..6e794c8 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\n@@ -79,6 +79,7 @@ struct i40evf_channel {\n \tu16 vsi_idx; /* index in PF struct for all channel VSIs */\n \tu16 vsi_id; /* VSI ID used by firmware */\n \tu16 num_qps; /* number of queue pairs requested by user */\n+\tu64 max_tx_rate; /* bandwidth rate allocation for VSIs */\n };\n \n /* VF information structure */\n",
    "prefixes": [
        "v3",
        "next-queue",
        "08/12"
    ]
}