get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 788806,
    "url": "http://patchwork.ozlabs.org/api/patches/788806/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170714132709.52657-9-alice.michael@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": "<20170714132709.52657-9-alice.michael@intel.com>",
    "list_archive_url": null,
    "date": "2017-07-14T13:27:08",
    "name": "[next,S77-V3,09/10] i40e: Enable VF to negotiate number of allocated queues",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "119532be50835408ab1c03d313c14d2bc34af555",
    "submitter": {
        "id": 71123,
        "url": "http://patchwork.ozlabs.org/api/people/71123/?format=api",
        "name": "Michael, Alice",
        "email": "alice.michael@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/20170714132709.52657-9-alice.michael@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/788806/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/788806/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 hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\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 3x8QqP6bL3z9sNd\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 15 Jul 2017 07:31:29 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 80EDA8A431;\n\tFri, 14 Jul 2017 21:31:28 +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 GRliLoMI66Ng; Fri, 14 Jul 2017 21:31:25 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 910978A43C;\n\tFri, 14 Jul 2017 21:31:25 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 8D84A1C0683\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 14 Jul 2017 21:31:20 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 86C8C8A41C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 14 Jul 2017 21:31:20 +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 n7OxSyRm5Nhv for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 14 Jul 2017 21:31:18 +0000 (UTC)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id B73038A42B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 14 Jul 2017 21:31:17 +0000 (UTC)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n\tby orsmga105.jf.intel.com with ESMTP; 14 Jul 2017 14:31:16 -0700",
            "from unknown (HELO localhost.jf.intel.com) ([10.166.16.121])\n\tby orsmga005.jf.intel.com with ESMTP; 14 Jul 2017 14:31:16 -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,360,1496127600\"; d=\"scan'208\";a=\"125288641\"",
        "From": "Alice Michael <alice.michael@intel.com>",
        "To": "alice.michael@intel.com,\n\tintel-wired-lan@lists.osuosl.org",
        "Date": "Fri, 14 Jul 2017 09:27:08 -0400",
        "Message-Id": "<20170714132709.52657-9-alice.michael@intel.com>",
        "X-Mailer": "git-send-email 2.9.3",
        "In-Reply-To": "<20170714132709.52657-1-alice.michael@intel.com>",
        "References": "<20170714132709.52657-1-alice.michael@intel.com>",
        "Subject": "[Intel-wired-lan] [next PATCH S77-V3 09/10] i40e: Enable VF to\n\tnegotiate number of allocated queues",
        "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": "From: Alan Brady <alan.brady@intel.com>\n\nCurrently the PF allocates a default number of queues for each VF and\ncannot be changed.  This patch enables the VF to request a different\nnumber of queues allocated to it.  This patch also adds a new virtchnl\nop and capability flag to facilitate this negotiation.\n\nAfter the PF receives a request message, it will set a requested number\nof queues for that VF.  Then when the VF resets, its VSI will get a new\nnumber of queues allocated to it.\n\nThis is a best effort request and since we only allocate a guaranteed\ndefault number, if the VF tries to ask for more than the guaranteed\nnumber, there may not be enough in HW to accommodate it unless other\nqueues for other VFs are freed. It should also be noted decreasing the\nnumber queues allocated to a VF to below the default will NOT enable the\nallocation of more than 32 VFs per PF and will not free queues guaranteed\nto each VF by default.\n\nSigned-off-by: Alan Brady <alan.brady@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e.h             |  1 +\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 75 ++++++++++++++++++++++\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h |  1 +\n include/linux/avf/virtchnl.h                       | 20 ++++++\n 4 files changed, 97 insertions(+)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 2f1f65e..890508f 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -77,6 +77,7 @@\n #define i40e_default_queues_per_vmdq(pf) \\\n \t\t(((pf)->hw_features & I40E_HW_RSS_AQ_CAPABLE) ? 4 : 1)\n #define I40E_DEFAULT_QUEUES_PER_VF\t4\n+#define I40E_MAX_VF_QUEUES\t\t16\n #define I40E_DEFAULT_QUEUES_PER_TC\t1 /* should be a power of 2 */\n #define i40e_pf_get_max_q_per_tc(pf) \\\n \t\t(((pf)->hw_features & I40E_HW_128_QP_RSS_CAPABLE) ? 128 : 64)\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\nindex aa8d30b..7daf6a4 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -815,6 +815,14 @@ static void i40e_free_vf_res(struct i40e_vf *vf)\n \t */\n \tclear_bit(I40E_VF_STATE_INIT, &vf->vf_states);\n \n+\t/* It's possible the VF had requeuested more queues than the default so\n+\t * do the accounting here when we're about to free them.\n+\t */\n+\tif (vf->num_queue_pairs > I40E_DEFAULT_QUEUES_PER_VF) {\n+\t\tpf->queues_left +=\n+\t\t\tvf->num_queue_pairs - I40E_DEFAULT_QUEUES_PER_VF;\n+\t}\n+\n \t/* free vsi & disconnect it from the parent uplink */\n \tif (vf->lan_vsi_idx) {\n \t\ti40e_vsi_release(pf->vsi[vf->lan_vsi_idx]);\n@@ -868,12 +876,27 @@ static int i40e_alloc_vf_res(struct i40e_vf *vf)\n \tint total_queue_pairs = 0;\n \tint ret;\n \n+\tif (vf->num_req_queues &&\n+\t    vf->num_req_queues <= pf->queues_left + I40E_DEFAULT_QUEUES_PER_VF)\n+\t\tpf->num_vf_qps = vf->num_req_queues;\n+\telse\n+\t\tpf->num_vf_qps = I40E_DEFAULT_QUEUES_PER_VF;\n+\n \t/* allocate hw vsi context & associated resources */\n \tret = i40e_alloc_vsi_res(vf, I40E_VSI_SRIOV);\n \tif (ret)\n \t\tgoto error_alloc;\n \ttotal_queue_pairs += pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs;\n \n+\t/* We account for each VF to get a default number of queue pairs.  If\n+\t * the VF has now requested more, we need to account for that to make\n+\t * certain we never request more queues than we actually have left in\n+\t * HW.\n+\t */\n+\tif (total_queue_pairs > I40E_DEFAULT_QUEUES_PER_VF)\n+\t\tpf->queues_left -=\n+\t\t\ttotal_queue_pairs - I40E_DEFAULT_QUEUES_PER_VF;\n+\n \tif (vf->trusted)\n \t\tset_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps);\n \telse\n@@ -1579,6 +1602,9 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)\n \t\t\t\t\tVIRTCHNL_VF_OFFLOAD_WB_ON_ITR;\n \t}\n \n+\tif (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_REQ_QUEUES)\n+\t\tvfres->vf_offload_flags |= VIRTCHNL_VF_OFFLOAD_REQ_QUEUES;\n+\n \tvfres->num_vsis = num_vsis;\n \tvfres->num_queue_pairs = vf->num_queue_pairs;\n \tvfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf;\n@@ -1987,6 +2013,52 @@ static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)\n }\n \n /**\n+ * i40e_vc_request_queues_msg\n+ * @vf: pointer to the VF info\n+ * @msg: pointer to the msg buffer\n+ * @msglen: msg length\n+ *\n+ * VFs get a default number of queues but can use this message to request a\n+ * different number.  Will respond with either the number requested or the\n+ * maximum we can support.\n+ **/\n+static int i40e_vc_request_queues_msg(struct i40e_vf *vf, u8 *msg, int msglen)\n+{\n+\tstruct virtchnl_vf_res_request *vfres =\n+\t\t(struct virtchnl_vf_res_request *)msg;\n+\tint req_pairs = vfres->num_queue_pairs;\n+\tint cur_pairs = vf->num_queue_pairs;\n+\tstruct i40e_pf *pf = vf->pf;\n+\n+\tif (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states))\n+\t\treturn -EINVAL;\n+\n+\tif (req_pairs <= 0) {\n+\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\"VF %d tried to request %d queues.  Ignoring.\\n\",\n+\t\t\tvf->vf_id, req_pairs);\n+\t} else if (req_pairs > I40E_MAX_VF_QUEUES) {\n+\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\"VF %d tried to request more than %d queues.\\n\",\n+\t\t\tvf->vf_id,\n+\t\t\tI40E_MAX_VF_QUEUES);\n+\t\tvfres->num_queue_pairs = I40E_MAX_VF_QUEUES;\n+\t} else if (req_pairs - cur_pairs > pf->queues_left) {\n+\t\tdev_warn(&pf->pdev->dev,\n+\t\t\t \"VF %d requested %d more queues, but only %d left.\\n\",\n+\t\t\t vf->vf_id,\n+\t\t\t req_pairs - cur_pairs,\n+\t\t\t pf->queues_left);\n+\t\tvfres->num_queue_pairs = pf->queues_left + cur_pairs;\n+\t} else {\n+\t\tvf->num_req_queues = req_pairs;\n+\t}\n+\n+\treturn i40e_vc_send_msg_to_vf(vf, VIRTCHNL_OP_REQUEST_QUEUES, 0,\n+\t\t\t\t      (u8 *)vfres, sizeof(vfres));\n+}\n+\n+/**\n  * i40e_vc_get_stats_msg\n  * @vf: pointer to the VF info\n  * @msg: pointer to the msg buffer\n@@ -2648,6 +2720,9 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode,\n \tcase VIRTCHNL_OP_SET_RSS_HENA:\n \t\tret = i40e_vc_set_rss_hena(vf, msg, msglen);\n \t\tbreak;\n+\tcase VIRTCHNL_OP_REQUEST_QUEUES:\n+\t\tret = i40e_vc_request_queues_msg(vf, msg, msglen);\n+\t\tbreak;\n \n \tcase VIRTCHNL_OP_UNKNOWN:\n \tdefault:\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\nindex 1f4b0c5..5111d05 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\n@@ -97,6 +97,7 @@ struct i40e_vf {\n \tu16 lan_vsi_id;\t\t/* ID as used by firmware */\n \n \tu8 num_queue_pairs;\t/* num of qps assigned to VF vsis */\n+\tu8 num_req_queues;\t/* num of requested qps */\n \tu64 num_mdd_events;\t/* num of mdd events detected */\n \t/* num of continuous malformed or invalid msgs detected */\n \tu64 num_invalid_msgs;\ndiff --git a/include/linux/avf/virtchnl.h b/include/linux/avf/virtchnl.h\nindex c893b95..35375a0 100644\n--- a/include/linux/avf/virtchnl.h\n+++ b/include/linux/avf/virtchnl.h\n@@ -133,6 +133,7 @@ enum virtchnl_ops {\n \tVIRTCHNL_OP_CONFIG_RSS_LUT = 24,\n \tVIRTCHNL_OP_GET_RSS_HENA_CAPS = 25,\n \tVIRTCHNL_OP_SET_RSS_HENA = 26,\n+\tVIRTCHNL_OP_REQUEST_QUEUES = 29,\n };\n \n /* This macro is used to generate a compilation error if a structure\n@@ -233,6 +234,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);\n #define VIRTCHNL_VF_OFFLOAD_RSS_AQ\t\t0x00000008\n #define VIRTCHNL_VF_OFFLOAD_RSS_REG\t\t0x00000010\n #define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR\t\t0x00000020\n+#define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES\t\t0x00000040\n #define VIRTCHNL_VF_OFFLOAD_VLAN\t\t0x00010000\n #define VIRTCHNL_VF_OFFLOAD_RX_POLLING\t\t0x00020000\n #define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2\t0x00040000\n@@ -323,6 +325,21 @@ struct virtchnl_vsi_queue_config_info {\n \tstruct virtchnl_queue_pair_info qpair[1];\n };\n \n+/* VIRTCHNL_OP_REQUEST_QUEUES\n+ * VF sends this message to request the PF to allocate additional queues to\n+ * this VF.  Each VF gets a guaranteed number of queues on init but asking for\n+ * additional queues must be negotiated.  This is a best effort request as it\n+ * is possible the PF does not have enough queues left to support the request.\n+ * If the PF cannot support the number requested it will respond with the\n+ * maximum number it is able to support; otherwise it will respond with the\n+ * number requested.\n+ */\n+\n+/* VF resource request */\n+struct virtchnl_vf_res_request {\n+\tu16 num_queue_pairs;\n+};\n+\n VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_vsi_queue_config_info);\n \n /* VIRTCHNL_OP_CONFIG_IRQ_MAP\n@@ -686,6 +703,9 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,\n \tcase VIRTCHNL_OP_SET_RSS_HENA:\n \t\tvalid_len = sizeof(struct virtchnl_rss_hena);\n \t\tbreak;\n+\tcase VIRTCHNL_OP_REQUEST_QUEUES:\n+\t\tvalid_len = sizeof(struct virtchnl_vf_res_request);\n+\t\tbreak;\n \t/* These are always errors coming from the VF. */\n \tcase VIRTCHNL_OP_EVENT:\n \tcase VIRTCHNL_OP_UNKNOWN:\n",
    "prefixes": [
        "next",
        "S77-V3",
        "09/10"
    ]
}