get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1038986,
    "url": "http://patchwork.ozlabs.org/api/patches/1038986/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190208205112.12180-3-anirudh.venkataramanan@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": "<20190208205112.12180-3-anirudh.venkataramanan@intel.com>",
    "list_archive_url": null,
    "date": "2019-02-08T20:50:58",
    "name": "[S13,02/16] ice: Fix issue reconfiguring VF queues",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "b33f1756b6dd69674c312a0631810624d807f595",
    "submitter": {
        "id": 73601,
        "url": "http://patchwork.ozlabs.org/api/people/73601/?format=api",
        "name": "Anirudh Venkataramanan",
        "email": "anirudh.venkataramanan@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/20190208205112.12180-3-anirudh.venkataramanan@intel.com/mbox/",
    "series": [
        {
            "id": 90916,
            "url": "http://patchwork.ozlabs.org/api/series/90916/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=90916",
            "date": "2019-02-08T20:50:57",
            "name": "Bug fixes and minor feature updates for ice",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/90916/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1038986/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1038986/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.136; helo=silver.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 43x6qq5XM9z9sNL\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  9 Feb 2019 07:54:31 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id EA56723491;\n\tFri,  8 Feb 2019 20:54:29 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id qW8M6wGyzG-j; Fri,  8 Feb 2019 20:54:26 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 0E71931417;\n\tFri,  8 Feb 2019 20:54:25 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 442831BF973\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  8 Feb 2019 20:52:34 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id B978F2279E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  8 Feb 2019 20:52:31 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id YsxNWcbMHMvD for <intel-wired-lan@lists.osuosl.org>;\n\tFri,  8 Feb 2019 20:52:30 +0000 (UTC)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 271C03140B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  8 Feb 2019 20:52:30 +0000 (UTC)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t08 Feb 2019 12:51:13 -0800",
            "from shasta.jf.intel.com ([10.166.241.11])\n\tby fmsmga008.fm.intel.com with ESMTP; 08 Feb 2019 12:51:12 -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.58,348,1544515200\"; d=\"scan'208\";a=\"123065498\"",
        "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Fri,  8 Feb 2019 12:50:58 -0800",
        "Message-Id": "<20190208205112.12180-3-anirudh.venkataramanan@intel.com>",
        "X-Mailer": "git-send-email 2.14.5",
        "In-Reply-To": "<20190208205112.12180-1-anirudh.venkataramanan@intel.com>",
        "References": "<20190208205112.12180-1-anirudh.venkataramanan@intel.com>",
        "Subject": "[Intel-wired-lan] [PATCH S13 02/16] ice: Fix issue reconfiguring VF\n\tqueues",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "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: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>\n\nWhen VF requested for queues changes, we need to update LAN Tx queue with\ncorrect number of VF queue pairs and re-allocate VF resources based on\nthis new requested number of queues, which is constraint within maximum\nqueue supported per VF.\n\nSigned-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>\nSigned-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_lib.c         | 34 +++++++++++---\n drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 58 ++++++++++++++++++++----\n drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h |  1 +\n 3 files changed, 77 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex af72bb4f8f6f..be377107d9a9 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -297,13 +297,19 @@ static void ice_vsi_set_num_desc(struct ice_vsi *vsi)\n /**\n  * ice_vsi_set_num_qs - Set number of queues, descriptors and vectors for a VSI\n  * @vsi: the VSI being configured\n+ * @vf_id: Id of the VF being configured\n  *\n  * Return 0 on success and a negative value on error\n  */\n-static void ice_vsi_set_num_qs(struct ice_vsi *vsi)\n+static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id)\n {\n \tstruct ice_pf *pf = vsi->back;\n \n+\tstruct ice_vf *vf = NULL;\n+\n+\tif (vsi->type == ICE_VSI_VF)\n+\t\tvsi->vf_id = vf_id;\n+\n \tswitch (vsi->type) {\n \tcase ICE_VSI_PF:\n \t\tvsi->alloc_txq = pf->num_lan_tx;\n@@ -319,8 +325,9 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi)\n \t\tvsi->num_q_vectors = max_t(int, pf->num_lan_rx, pf->num_lan_tx);\n \t\tbreak;\n \tcase ICE_VSI_VF:\n-\t\tvsi->alloc_txq = pf->num_vf_qps;\n-\t\tvsi->alloc_rxq = pf->num_vf_qps;\n+\t\tvf = &pf->vf[vsi->vf_id];\n+\t\tvsi->alloc_txq = vf->num_vf_qs;\n+\t\tvsi->alloc_rxq = vf->num_vf_qs;\n \t\t/* pf->num_vf_msix includes (VF miscellaneous vector +\n \t\t * data queue interrupts). Since vsi->num_q_vectors is number\n \t\t * of queues vectors, subtract 1 from the original vector\n@@ -480,10 +487,12 @@ static irqreturn_t ice_msix_clean_rings(int __always_unused irq, void *data)\n  * ice_vsi_alloc - Allocates the next available struct VSI in the PF\n  * @pf: board private structure\n  * @type: type of VSI\n+ * @vf_id: Id of the VF being configured\n  *\n  * returns a pointer to a VSI on success, NULL on failure.\n  */\n-static struct ice_vsi *ice_vsi_alloc(struct ice_pf *pf, enum ice_vsi_type type)\n+static struct ice_vsi *\n+ice_vsi_alloc(struct ice_pf *pf, enum ice_vsi_type type, u16 vf_id)\n {\n \tstruct ice_vsi *vsi = NULL;\n \n@@ -509,7 +518,11 @@ static struct ice_vsi *ice_vsi_alloc(struct ice_pf *pf, enum ice_vsi_type type)\n \tvsi->idx = pf->next_vsi;\n \tvsi->work_lmt = ICE_DFLT_IRQ_WORK;\n \n-\tice_vsi_set_num_qs(vsi);\n+\tvsi->idx = pf->next_vsi;\n+\tif (type == ICE_VSI_VF)\n+\t\tice_vsi_set_num_qs(vsi, vf_id);\n+\telse\n+\t\tice_vsi_set_num_qs(vsi, ICE_INVAL_VFID);\n \n \tswitch (vsi->type) {\n \tcase ICE_VSI_PF:\n@@ -2196,7 +2209,11 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,\n \tstruct ice_vsi *vsi;\n \tint ret, i;\n \n-\tvsi = ice_vsi_alloc(pf, type);\n+\tif (type == ICE_VSI_VF)\n+\t\tvsi = ice_vsi_alloc(pf, type, vf_id);\n+\telse\n+\t\tvsi = ice_vsi_alloc(pf, type, ICE_INVAL_VFID);\n+\n \tif (!vsi) {\n \t\tdev_err(dev, \"could not allocate VSI\\n\");\n \t\treturn NULL;\n@@ -2719,7 +2736,10 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)\n \tice_dev_onetime_setup(&vsi->back->hw);\n \tif (vsi->req_txq || vsi->req_rxq)\n \t\tice_vsi_put_qs(vsi);\n-\tice_vsi_set_num_qs(vsi);\n+\tif (vsi->type == ICE_VSI_VF)\n+\t\tice_vsi_set_num_qs(vsi, vf->vf_id);\n+\telse\n+\t\tice_vsi_set_num_qs(vsi, ICE_INVAL_VFID);\n \tif (vsi->req_txq || vsi->req_rxq)\n \t\tice_vsi_get_qs(vsi);\n \tice_vsi_set_tc_cfg(vsi);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\nindex a93db0a7ac1c..c4f2bea0b670 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n@@ -495,6 +495,8 @@ static int ice_alloc_vsi_res(struct ice_vf *vf)\n  */\n static int ice_alloc_vf_res(struct ice_vf *vf)\n {\n+\tstruct ice_pf *pf = vf->pf;\n+\tint tx_rx_queue_left;\n \tint status;\n \n \t/* setup VF VSI and necessary resources */\n@@ -502,6 +504,15 @@ static int ice_alloc_vf_res(struct ice_vf *vf)\n \tif (status)\n \t\tgoto ice_alloc_vf_res_exit;\n \n+\t/* Update number of VF queues, in case VF had requested for queue\n+\t * changes\n+\t */\n+\ttx_rx_queue_left = min_t(int, pf->q_left_tx, pf->q_left_rx);\n+\ttx_rx_queue_left += ICE_DFLT_QS_PER_VF;\n+\tif (vf->num_req_qs && vf->num_req_qs <= tx_rx_queue_left &&\n+\t    vf->num_req_qs != vf->num_vf_qs)\n+\t\tvf->num_vf_qs = vf->num_req_qs;\n+\n \tif (vf->trusted)\n \t\tset_bit(ICE_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps);\n \telse\n@@ -835,8 +846,18 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr)\n \tusleep_range(10000, 20000);\n \n \t/* free VF resources to begin resetting the VSI state */\n-\tfor (v = 0; v < pf->num_alloc_vfs; v++)\n-\t\tice_free_vf_res(&pf->vf[v]);\n+\tfor (v = 0; v < pf->num_alloc_vfs; v++) {\n+\t\tvf = &pf->vf[v];\n+\n+\t\tice_free_vf_res(vf);\n+\n+\t\t/* Free VF queues as well, and reallocate later.\n+\t\t * If a given VF has different number of queues\n+\t\t * configured, the request for update will come\n+\t\t * via mailbox communication.\n+\t\t */\n+\t\tvf->num_vf_qs = 0;\n+\t}\n \n \tif (ice_check_avail_res(pf)) {\n \t\tdev_err(&pf->pdev->dev,\n@@ -845,8 +866,15 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr)\n \t}\n \n \t/* Finish the reset on each VF */\n-\tfor (v = 0; v < pf->num_alloc_vfs; v++)\n-\t\tice_cleanup_and_realloc_vf(&pf->vf[v]);\n+\tfor (v = 0; v < pf->num_alloc_vfs; v++) {\n+\t\tvf = &pf->vf[v];\n+\n+\t\tvf->num_vf_qs = pf->num_vf_qps;\n+\t\tdev_dbg(&pf->pdev->dev,\n+\t\t\t\"VF-id %d has %d queues configured\\n\",\n+\t\t\tvf->vf_id, vf->num_vf_qs);\n+\t\tice_cleanup_and_realloc_vf(vf);\n+\t}\n \n \tice_flush(hw);\n \tclear_bit(__ICE_VF_DIS, pf->state);\n@@ -1766,6 +1794,7 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)\n \tstruct virtchnl_vsi_queue_config_info *qci =\n \t    (struct virtchnl_vsi_queue_config_info *)msg;\n \tstruct virtchnl_queue_pair_info *qpi;\n+\tstruct ice_pf *pf = vf->pf;\n \tenum ice_status aq_ret = 0;\n \tstruct ice_vsi *vsi;\n \tint i;\n@@ -1786,6 +1815,14 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)\n \t\tgoto error_param;\n \t}\n \n+\tif (qci->num_queue_pairs > ICE_MAX_BASE_QS_PER_VF) {\n+\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\"VF-%d requesting more than supported number of queues: %d\\n\",\n+\t\t\tvf->vf_id, qci->num_queue_pairs);\n+\t\taq_ret = ICE_ERR_PARAM;\n+\t\tgoto error_param;\n+\t}\n+\n \tfor (i = 0; i < qci->num_queue_pairs; i++) {\n \t\tqpi = &qci->qpair[i];\n \t\tif (qpi->txq.vsi_id != qci->vsi_id ||\n@@ -2013,6 +2050,7 @@ static int ice_vc_request_qs_msg(struct ice_vf *vf, u8 *msg)\n \tint req_queues = vfres->num_queue_pairs;\n \tenum ice_status aq_ret = 0;\n \tstruct ice_pf *pf = vf->pf;\n+\tint max_allowed_vf_queues;\n \tint tx_rx_queue_left;\n \tint cur_queues;\n \n@@ -2021,22 +2059,24 @@ static int ice_vc_request_qs_msg(struct ice_vf *vf, u8 *msg)\n \t\tgoto error_param;\n \t}\n \n-\tcur_queues = pf->num_vf_qps;\n+\tcur_queues = vf->num_vf_qs;\n \ttx_rx_queue_left = min_t(int, pf->q_left_tx, pf->q_left_rx);\n+\tmax_allowed_vf_queues = tx_rx_queue_left + cur_queues;\n \tif (req_queues <= 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_queues);\n-\t} else if (req_queues > ICE_MAX_QS_PER_VF) {\n+\t} else if (req_queues > ICE_MAX_BASE_QS_PER_VF) {\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, ICE_MAX_QS_PER_VF);\n-\t\tvfres->num_queue_pairs = ICE_MAX_QS_PER_VF;\n+\t\t\tvf->vf_id, ICE_MAX_BASE_QS_PER_VF);\n+\t\tvfres->num_queue_pairs = ICE_MAX_BASE_QS_PER_VF;\n \t} else if (req_queues - cur_queues > tx_rx_queue_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, req_queues - cur_queues, tx_rx_queue_left);\n-\t\tvfres->num_queue_pairs = tx_rx_queue_left + cur_queues;\n+\t\tvfres->num_queue_pairs = min_t(int, max_allowed_vf_queues,\n+\t\t\t\t\t       ICE_MAX_BASE_QS_PER_VF);\n \t} else {\n \t\t/* request is successful, then reset VF */\n \t\tvf->num_req_qs = req_queues;\ndiff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h\nindex 01470a8ee03a..7bf3535feffb 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h\n@@ -70,6 +70,7 @@ struct ice_vf {\n \tu8 spoofchk;\n \tu16 num_mac;\n \tu16 num_vlan;\n+\tu16 num_vf_qs;\t\t\t/* num of queue configured per VF */\n \tu8 num_req_qs;\t\t\t/* num of queue pairs requested by VF */\n };\n \n",
    "prefixes": [
        "S13",
        "02/16"
    ]
}