get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1245997,
    "url": "http://patchwork.ozlabs.org/api/patches/1245997/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200227181505.61720-3-anthony.l.nguyen@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": "<20200227181505.61720-3-anthony.l.nguyen@intel.com>",
    "list_archive_url": null,
    "date": "2020-02-27T18:14:53",
    "name": "[S40,03/15] ice: Improve clarity of prints and variables",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "9c9d392d1e2a894606e5f91347b049c8c787e836",
    "submitter": {
        "id": 68875,
        "url": "http://patchwork.ozlabs.org/api/people/68875/?format=api",
        "name": "Tony Nguyen",
        "email": "anthony.l.nguyen@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/20200227181505.61720-3-anthony.l.nguyen@intel.com/mbox/",
    "series": [
        {
            "id": 161280,
            "url": "http://patchwork.ozlabs.org/api/series/161280/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=161280",
            "date": "2020-02-27T18:14:51",
            "name": "[S40,01/15] iavf: Enable support for up to 16 queues",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/161280/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1245997/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1245997/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; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=osuosl.org (client-ip=140.211.166.137;\n\thelo=fraxinus.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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\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 48T17r1Zmyz9sRm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 28 Feb 2020 05:16:07 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 29E1386D8F;\n\tThu, 27 Feb 2020 18:16:06 +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 K4J1PK3Lei6i; Thu, 27 Feb 2020 18:16:03 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 4533686D9B;\n\tThu, 27 Feb 2020 18:16:02 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id A7A1A1BF3D2\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 27 Feb 2020 18:15:57 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id A121185AA0\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 27 Feb 2020 18:15:57 +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 E4JNpDPlaYYZ for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 27 Feb 2020 18:15:53 +0000 (UTC)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 19E1987FE9\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 27 Feb 2020 18:15:53 +0000 (UTC)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Feb 2020 10:15:52 -0800",
            "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby FMSMGA003.fm.intel.com with ESMTP; 27 Feb 2020 10:15:51 -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.70,492,1574150400\"; d=\"scan'208\";a=\"285408842\"",
        "From": "Tony Nguyen <anthony.l.nguyen@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Thu, 27 Feb 2020 10:14:53 -0800",
        "Message-Id": "<20200227181505.61720-3-anthony.l.nguyen@intel.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20200227181505.61720-1-anthony.l.nguyen@intel.com>",
        "References": "<20200227181505.61720-1-anthony.l.nguyen@intel.com>",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH S40 03/15] ice: Improve clarity of prints\n\tand variables",
        "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>",
        "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: Brett Creeley <brett.creeley@intel.com>\n\nCurrently when the device runs out of MSI-X interrupts a cryptic and\nunhelpful message is printed. This will cause confusion when hitting this\ncase. Fix this by clearing up the error message for both SR-IOV and non\nSR-IOV use cases.\n\nAlso, make a few minor changes to increase clarity of variables.\n1. Change per VF MSI-X and queue pair variables in the PF structure.\n2. Use ICE_NONQ_VECS_VF when determining pf->num_msix_per_vf instead of\nthe magic number \"1\". This vector is reserved for the OICR.\n\nAll of the resource tracking functions were moved to avoid adding\nany forward declaration function prototypes.\n\nSigned-off-by: Brett Creeley <brett.creeley@intel.com>\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice.h          |   4 +-\n drivers/net/ethernet/intel/ice/ice_lib.c      | 200 ++++++++++--------\n .../net/ethernet/intel/ice/ice_virtchnl_pf.c  |  66 +++---\n 3 files changed, 145 insertions(+), 125 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h\nindex 21a384ed962f..9bd45614db23 100644\n--- a/drivers/net/ethernet/intel/ice/ice.h\n+++ b/drivers/net/ethernet/intel/ice/ice.h\n@@ -369,8 +369,8 @@ struct ice_pf {\n \tstruct ice_vf *vf;\n \tint num_alloc_vfs;\t\t/* actual number of VFs allocated */\n \tu16 num_vfs_supported;\t\t/* num VFs supported for this PF */\n-\tu16 num_vf_qps;\t\t\t/* num queue pairs per VF */\n-\tu16 num_vf_msix;\t\t/* num vectors per VF */\n+\tu16 num_qps_per_vf;\n+\tu16 num_msix_per_vf;\n \t/* used to ratelimit the MDD event logging */\n \tunsigned long last_printed_mdd_jiffies;\n \tDECLARE_BITMAP(state, __ICE_STATE_NBITS);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex 0a89ce957dd2..7005a11f0c7d 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -178,12 +178,12 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id)\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/* pf->num_msix_per_vf 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 (ICE_NONQ_VECS_VF) from the\n \t\t * original vector count\n \t\t */\n-\t\tvsi->num_q_vectors = pf->num_vf_msix - ICE_NONQ_VECS_VF;\n+\t\tvsi->num_q_vectors = pf->num_msix_per_vf - ICE_NONQ_VECS_VF;\n \t\tbreak;\n \tcase ICE_VSI_LB:\n \t\tvsi->alloc_txq = 1;\n@@ -917,6 +917,109 @@ static int ice_vsi_init(struct ice_vsi *vsi, bool init_vsi)\n \treturn ret;\n }\n \n+/**\n+ * ice_free_res - free a block of resources\n+ * @res: pointer to the resource\n+ * @index: starting index previously returned by ice_get_res\n+ * @id: identifier to track owner\n+ *\n+ * Returns number of resources freed\n+ */\n+int ice_free_res(struct ice_res_tracker *res, u16 index, u16 id)\n+{\n+\tint count = 0;\n+\tint i;\n+\n+\tif (!res || index >= res->end)\n+\t\treturn -EINVAL;\n+\n+\tid |= ICE_RES_VALID_BIT;\n+\tfor (i = index; i < res->end && res->list[i] == id; i++) {\n+\t\tres->list[i] = 0;\n+\t\tcount++;\n+\t}\n+\n+\treturn count;\n+}\n+\n+/**\n+ * ice_search_res - Search the tracker for a block of resources\n+ * @res: pointer to the resource\n+ * @needed: size of the block needed\n+ * @id: identifier to track owner\n+ *\n+ * Returns the base item index of the block, or -ENOMEM for error\n+ */\n+static int ice_search_res(struct ice_res_tracker *res, u16 needed, u16 id)\n+{\n+\tint start = 0, end = 0;\n+\n+\tif (needed > res->end)\n+\t\treturn -ENOMEM;\n+\n+\tid |= ICE_RES_VALID_BIT;\n+\n+\tdo {\n+\t\t/* skip already allocated entries */\n+\t\tif (res->list[end++] & ICE_RES_VALID_BIT) {\n+\t\t\tstart = end;\n+\t\t\tif ((start + needed) > res->end)\n+\t\t\t\tbreak;\n+\t\t}\n+\n+\t\tif (end == (start + needed)) {\n+\t\t\tint i = start;\n+\n+\t\t\t/* there was enough, so assign it to the requestor */\n+\t\t\twhile (i != end)\n+\t\t\t\tres->list[i++] = id;\n+\n+\t\t\treturn start;\n+\t\t}\n+\t} while (end < res->end);\n+\n+\treturn -ENOMEM;\n+}\n+\n+/**\n+ * ice_get_free_res_count - Get free count from a resource tracker\n+ * @res: Resource tracker instance\n+ */\n+static u16 ice_get_free_res_count(struct ice_res_tracker *res)\n+{\n+\tu16 i, count = 0;\n+\n+\tfor (i = 0; i < res->end; i++)\n+\t\tif (!(res->list[i] & ICE_RES_VALID_BIT))\n+\t\t\tcount++;\n+\n+\treturn count;\n+}\n+\n+/**\n+ * ice_get_res - get a block of resources\n+ * @pf: board private structure\n+ * @res: pointer to the resource\n+ * @needed: size of the block needed\n+ * @id: identifier to track owner\n+ *\n+ * Returns the base item index of the block, or negative for error\n+ */\n+int\n+ice_get_res(struct ice_pf *pf, struct ice_res_tracker *res, u16 needed, u16 id)\n+{\n+\tif (!res || !pf)\n+\t\treturn -EINVAL;\n+\n+\tif (!needed || needed > res->num_entries || id >= ICE_RES_VALID_BIT) {\n+\t\tdev_err(ice_pf_to_dev(pf), \"param err: needed=%d, num_entries = %d id=0x%04x\\n\",\n+\t\t\tneeded, res->num_entries, id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn ice_search_res(res, needed, id);\n+}\n+\n /**\n  * ice_vsi_setup_vector_base - Set up the base vector for the given VSI\n  * @vsi: ptr to the VSI\n@@ -949,8 +1052,9 @@ static int ice_vsi_setup_vector_base(struct ice_vsi *vsi)\n \tvsi->base_vector = ice_get_res(pf, pf->irq_tracker, num_q_vectors,\n \t\t\t\t       vsi->idx);\n \tif (vsi->base_vector < 0) {\n-\t\tdev_err(dev, \"Failed to get tracking for %d vectors for VSI %d, err=%d\\n\",\n-\t\t\tnum_q_vectors, vsi->vsi_num, vsi->base_vector);\n+\t\tdev_err(dev, \"%d MSI-X interrupts available. %s %d failed to get %d MSI-X vectors\\n\",\n+\t\t\tice_get_free_res_count(pf->irq_tracker),\n+\t\t\tice_vsi_type_str(vsi->type), vsi->idx, num_q_vectors);\n \t\treturn -ENOENT;\n \t}\n \tpf->num_avail_sw_msix -= num_q_vectors;\n@@ -2395,94 +2499,6 @@ void ice_dis_vsi(struct ice_vsi *vsi, bool locked)\n \t}\n }\n \n-/**\n- * ice_free_res - free a block of resources\n- * @res: pointer to the resource\n- * @index: starting index previously returned by ice_get_res\n- * @id: identifier to track owner\n- *\n- * Returns number of resources freed\n- */\n-int ice_free_res(struct ice_res_tracker *res, u16 index, u16 id)\n-{\n-\tint count = 0;\n-\tint i;\n-\n-\tif (!res || index >= res->end)\n-\t\treturn -EINVAL;\n-\n-\tid |= ICE_RES_VALID_BIT;\n-\tfor (i = index; i < res->end && res->list[i] == id; i++) {\n-\t\tres->list[i] = 0;\n-\t\tcount++;\n-\t}\n-\n-\treturn count;\n-}\n-\n-/**\n- * ice_search_res - Search the tracker for a block of resources\n- * @res: pointer to the resource\n- * @needed: size of the block needed\n- * @id: identifier to track owner\n- *\n- * Returns the base item index of the block, or -ENOMEM for error\n- */\n-static int ice_search_res(struct ice_res_tracker *res, u16 needed, u16 id)\n-{\n-\tint start = 0, end = 0;\n-\n-\tif (needed > res->end)\n-\t\treturn -ENOMEM;\n-\n-\tid |= ICE_RES_VALID_BIT;\n-\n-\tdo {\n-\t\t/* skip already allocated entries */\n-\t\tif (res->list[end++] & ICE_RES_VALID_BIT) {\n-\t\t\tstart = end;\n-\t\t\tif ((start + needed) > res->end)\n-\t\t\t\tbreak;\n-\t\t}\n-\n-\t\tif (end == (start + needed)) {\n-\t\t\tint i = start;\n-\n-\t\t\t/* there was enough, so assign it to the requestor */\n-\t\t\twhile (i != end)\n-\t\t\t\tres->list[i++] = id;\n-\n-\t\t\treturn start;\n-\t\t}\n-\t} while (end < res->end);\n-\n-\treturn -ENOMEM;\n-}\n-\n-/**\n- * ice_get_res - get a block of resources\n- * @pf: board private structure\n- * @res: pointer to the resource\n- * @needed: size of the block needed\n- * @id: identifier to track owner\n- *\n- * Returns the base item index of the block, or negative for error\n- */\n-int\n-ice_get_res(struct ice_pf *pf, struct ice_res_tracker *res, u16 needed, u16 id)\n-{\n-\tif (!res || !pf)\n-\t\treturn -EINVAL;\n-\n-\tif (!needed || needed > res->num_entries || id >= ICE_RES_VALID_BIT) {\n-\t\tdev_err(ice_pf_to_dev(pf), \"param err: needed=%d, num_entries = %d id=0x%04x\\n\",\n-\t\t\tneeded, res->num_entries, id);\n-\t\treturn -EINVAL;\n-\t}\n-\n-\treturn ice_search_res(res, needed, id);\n-}\n-\n /**\n  * ice_vsi_dis_irq - Mask off queue interrupt generation on the VSI\n  * @vsi: the VSI being un-configured\ndiff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\nindex d1912a2a3caa..48791fc387ba 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n@@ -170,7 +170,7 @@ static void ice_free_vf_res(struct ice_vf *vf)\n \t\tvf->num_mac = 0;\n \t}\n \n-\tlast_vector_idx = vf->first_vector_idx + pf->num_vf_msix - 1;\n+\tlast_vector_idx = vf->first_vector_idx + pf->num_msix_per_vf - 1;\n \n \t/* clear VF MDD event information */\n \tmemset(&vf->mdd_tx_events, 0, sizeof(vf->mdd_tx_events));\n@@ -206,7 +206,7 @@ static void ice_dis_vf_mappings(struct ice_vf *vf)\n \twr32(hw, VPINT_ALLOC_PCI(vf->vf_id), 0);\n \n \tfirst = vf->first_vector_idx;\n-\tlast = first + pf->num_vf_msix - 1;\n+\tlast = first + pf->num_msix_per_vf - 1;\n \tfor (v = first; v <= last; v++) {\n \t\tu32 reg;\n \n@@ -315,7 +315,7 @@ void ice_free_vfs(struct ice_pf *pf)\n \t\tdev_warn(dev, \"VFs are assigned - not disabling SR-IOV\\n\");\n \n \ttmp = pf->num_alloc_vfs;\n-\tpf->num_vf_qps = 0;\n+\tpf->num_qps_per_vf = 0;\n \tpf->num_alloc_vfs = 0;\n \tfor (i = 0; i < tmp; i++) {\n \t\tif (test_bit(ICE_VF_STATE_INIT, pf->vf[i].vf_states)) {\n@@ -503,7 +503,7 @@ ice_vf_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi, u16 vf_id)\n  */\n static int ice_calc_vf_first_vector_idx(struct ice_pf *pf, struct ice_vf *vf)\n {\n-\treturn pf->sriov_base_vector + vf->vf_id * pf->num_vf_msix;\n+\treturn pf->sriov_base_vector + vf->vf_id * pf->num_msix_per_vf;\n }\n \n /**\n@@ -596,7 +596,7 @@ static int ice_alloc_vf_res(struct ice_vf *vf)\n \t */\n \ttx_rx_queue_left = min_t(int, ice_get_avail_txq_count(pf),\n \t\t\t\t ice_get_avail_rxq_count(pf));\n-\ttx_rx_queue_left += pf->num_vf_qps;\n+\ttx_rx_queue_left += pf->num_qps_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@@ -642,9 +642,9 @@ static void ice_ena_vf_mappings(struct ice_vf *vf)\n \thw = &pf->hw;\n \tvsi = pf->vsi[vf->lan_vsi_idx];\n \tfirst = vf->first_vector_idx;\n-\tlast = (first + pf->num_vf_msix) - 1;\n+\tlast = (first + pf->num_msix_per_vf) - 1;\n \tabs_first = first + pf->hw.func_caps.common_cap.msix_vector_first_id;\n-\tabs_last = (abs_first + pf->num_vf_msix) - 1;\n+\tabs_last = (abs_first + pf->num_msix_per_vf) - 1;\n \tabs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;\n \n \t/* VF Vector allocation */\n@@ -762,7 +762,7 @@ int ice_calc_vf_reg_idx(struct ice_vf *vf, struct ice_q_vector *q_vector)\n \tpf = vf->pf;\n \n \t/* always add one to account for the OICR being the first MSIX */\n-\treturn pf->sriov_base_vector + pf->num_vf_msix * vf->vf_id +\n+\treturn pf->sriov_base_vector + pf->num_msix_per_vf * vf->vf_id +\n \t\tq_vector->v_idx + 1;\n }\n \n@@ -847,56 +847,60 @@ static int ice_sriov_set_msix_res(struct ice_pf *pf, u16 num_msix_needed)\n static int ice_set_per_vf_res(struct ice_pf *pf)\n {\n \tint max_valid_res_idx = ice_get_max_valid_res_idx(pf->irq_tracker);\n+\tint msix_avail_per_vf, msix_avail_for_sriov;\n \tstruct device *dev = ice_pf_to_dev(pf);\n-\tu16 num_msix, num_txq, num_rxq;\n-\tint v;\n+\tu16 num_msix_per_vf, num_txq, num_rxq;\n \n \tif (!pf->num_alloc_vfs || max_valid_res_idx < 0)\n \t\treturn -EINVAL;\n \n \t/* determine MSI-X resources per VF */\n-\tv = (pf->hw.func_caps.common_cap.num_msix_vectors -\n-\t     pf->irq_tracker->num_entries) / pf->num_alloc_vfs;\n-\tif (v >= ICE_NUM_VF_MSIX_MED) {\n-\t\tnum_msix = ICE_NUM_VF_MSIX_MED;\n-\t} else if (v >= ICE_NUM_VF_MSIX_SMALL) {\n-\t\tnum_msix = ICE_NUM_VF_MSIX_SMALL;\n-\t} else if (v >= ICE_MIN_INTR_PER_VF) {\n-\t\tnum_msix = ICE_MIN_INTR_PER_VF;\n+\tmsix_avail_for_sriov = pf->hw.func_caps.common_cap.num_msix_vectors -\n+\t\tpf->irq_tracker->num_entries;\n+\tmsix_avail_per_vf = msix_avail_for_sriov / pf->num_alloc_vfs;\n+\tif (msix_avail_per_vf >= ICE_NUM_VF_MSIX_MED) {\n+\t\tnum_msix_per_vf = ICE_NUM_VF_MSIX_MED;\n+\t} else if (msix_avail_per_vf >= ICE_NUM_VF_MSIX_SMALL) {\n+\t\tnum_msix_per_vf = ICE_NUM_VF_MSIX_SMALL;\n+\t} else if (msix_avail_per_vf >= ICE_MIN_INTR_PER_VF) {\n+\t\tnum_msix_per_vf = ICE_MIN_INTR_PER_VF;\n \t} else {\n-\t\tdev_err(dev, \"Not enough vectors to support %d VFs\\n\",\n+\t\tdev_err(dev, \"Only %d MSI-X interrupts available for SR-IOV. Not enough to support minimum of %d MSI-X interrupts per VF for %d VFs\\n\",\n+\t\t\tmsix_avail_for_sriov, ICE_MIN_INTR_PER_VF,\n \t\t\tpf->num_alloc_vfs);\n \t\treturn -EIO;\n \t}\n \n \t/* determine queue resources per VF */\n \tnum_txq = ice_determine_res(pf, ice_get_avail_txq_count(pf),\n-\t\t\t\t    min_t(u16, num_msix - 1,\n+\t\t\t\t    min_t(u16,\n+\t\t\t\t\t  num_msix_per_vf - ICE_NONQ_VECS_VF,\n \t\t\t\t\t  ICE_MAX_RSS_QS_PER_VF),\n \t\t\t\t    ICE_MIN_QS_PER_VF);\n \n \tnum_rxq = ice_determine_res(pf, ice_get_avail_rxq_count(pf),\n-\t\t\t\t    min_t(u16, num_msix - 1,\n+\t\t\t\t    min_t(u16,\n+\t\t\t\t\t  num_msix_per_vf - ICE_NONQ_VECS_VF,\n \t\t\t\t\t  ICE_MAX_RSS_QS_PER_VF),\n \t\t\t\t    ICE_MIN_QS_PER_VF);\n \n \tif (!num_txq || !num_rxq) {\n-\t\tdev_err(dev, \"Not enough queues to support %d VFs\\n\",\n-\t\t\tpf->num_alloc_vfs);\n+\t\tdev_err(dev, \"Not enough queues to support minimum of %d queue pairs per VF for %d VFs\\n\",\n+\t\t\tICE_MIN_QS_PER_VF, pf->num_alloc_vfs);\n \t\treturn -EIO;\n \t}\n \n-\tif (ice_sriov_set_msix_res(pf, num_msix * pf->num_alloc_vfs)) {\n+\tif (ice_sriov_set_msix_res(pf, num_msix_per_vf * pf->num_alloc_vfs)) {\n \t\tdev_err(dev, \"Unable to set MSI-X resources for %d VFs\\n\",\n \t\t\tpf->num_alloc_vfs);\n \t\treturn -EINVAL;\n \t}\n \n \t/* only allow equal Tx/Rx queue count (i.e. queue pairs) */\n-\tpf->num_vf_qps = min_t(int, num_txq, num_rxq);\n-\tpf->num_vf_msix = num_msix;\n+\tpf->num_qps_per_vf = min_t(int, num_txq, num_rxq);\n+\tpf->num_msix_per_vf = num_msix_per_vf;\n \tdev_info(dev, \"Enabling %d VFs with %d vectors and %d queues per VF\\n\",\n-\t\t pf->num_alloc_vfs, num_msix, pf->num_vf_qps);\n+\t\t pf->num_alloc_vfs, pf->num_msix_per_vf, pf->num_qps_per_vf);\n \n \treturn 0;\n }\n@@ -1018,7 +1022,7 @@ static bool ice_config_res_vfs(struct ice_pf *pf)\n \tice_for_each_vf(pf, v) {\n \t\tstruct ice_vf *vf = &pf->vf[v];\n \n-\t\tvf->num_vf_qs = pf->num_vf_qps;\n+\t\tvf->num_vf_qs = pf->num_qps_per_vf;\n \t\tdev_dbg(dev, \"VF-id %d has %d queues configured\\n\", vf->vf_id,\n \t\t\tvf->num_vf_qs);\n \t\tice_cleanup_and_realloc_vf(vf);\n@@ -1702,7 +1706,7 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg)\n \tvfres->num_vsis = 1;\n \t/* Tx and Rx queue are equal for VF */\n \tvfres->num_queue_pairs = vsi->num_txq;\n-\tvfres->max_vectors = pf->num_vf_msix;\n+\tvfres->max_vectors = pf->num_msix_per_vf;\n \tvfres->rss_key_size = ICE_VSIQF_HKEY_ARRAY_SIZE;\n \tvfres->rss_lut_size = ICE_VSIQF_HLUT_ARRAY_SIZE;\n \n@@ -2361,7 +2365,7 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg)\n \t * there is actually at least a single VF queue vector mapped\n \t */\n \tif (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states) ||\n-\t    pf->num_vf_msix < num_q_vectors_mapped ||\n+\t    pf->num_msix_per_vf < num_q_vectors_mapped ||\n \t    !num_q_vectors_mapped) {\n \t\tv_ret = VIRTCHNL_STATUS_ERR_PARAM;\n \t\tgoto error_param;\n@@ -2383,7 +2387,7 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg)\n \t\t/* vector_id is always 0-based for each VF, and can never be\n \t\t * larger than or equal to the max allowed interrupts per VF\n \t\t */\n-\t\tif (!(vector_id < pf->num_vf_msix) ||\n+\t\tif (!(vector_id < pf->num_msix_per_vf) ||\n \t\t    !ice_vc_isvalid_vsi_id(vf, vsi_id) ||\n \t\t    (!vector_id && (map->rxq_map || map->txq_map))) {\n \t\t\tv_ret = VIRTCHNL_STATUS_ERR_PARAM;\n",
    "prefixes": [
        "S40",
        "03/15"
    ]
}