Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/972030/?format=api
{ "id": 972030, "url": "http://patchwork.ozlabs.org/api/patches/972030/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180920002319.10971-4-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": "<20180920002319.10971-4-anirudh.venkataramanan@intel.com>", "list_archive_url": null, "date": "2018-09-20T00:23:06", "name": "[03/16] ice: Move common functions out of ice_main.c part 3/7", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "d92d961417a80a96830903439ff61c8293c4e88c", "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/20180920002319.10971-4-anirudh.venkataramanan@intel.com/mbox/", "series": [ { "id": 66525, "url": "http://patchwork.ozlabs.org/api/series/66525/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=66525", "date": "2018-09-20T00:23:03", "name": "Implementation updates for ice", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/66525/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/972030/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/972030/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>)", "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com" ], "Received": [ "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\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 42FyBb1KL8z9s9J\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 20 Sep 2018 10:23:35 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 9CFF287D54;\n\tThu, 20 Sep 2018 00:23:33 +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 QjDQvXJ3dEld; Thu, 20 Sep 2018 00:23:30 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 4E62D87EAF;\n\tThu, 20 Sep 2018 00:23:30 +0000 (UTC)", "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id C9BFC1C08AF\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 20 Sep 2018 00:23:27 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id C6EAD3024C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 20 Sep 2018 00:23:27 +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 7qG0dzzObzZc for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 20 Sep 2018 00:23:24 +0000 (UTC)", "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 58B7B30698\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 20 Sep 2018 00:23:24 +0000 (UTC)", "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Sep 2018 17:23:23 -0700", "from shasta.jf.intel.com ([10.166.241.11])\n\tby fmsmga006.fm.intel.com with ESMTP; 19 Sep 2018 17:23:19 -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-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.53,396,1531810800\"; d=\"scan'208\";a=\"265057692\"", "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Wed, 19 Sep 2018 17:23:06 -0700", "Message-Id": "<20180920002319.10971-4-anirudh.venkataramanan@intel.com>", "X-Mailer": "git-send-email 2.14.3", "In-Reply-To": "<20180920002319.10971-1-anirudh.venkataramanan@intel.com>", "References": "<20180920002319.10971-1-anirudh.venkataramanan@intel.com>", "Subject": "[Intel-wired-lan] [PATCH 03/16] ice: Move common functions out of\n\tice_main.c part 3/7", "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 continues the code move out of ice_main.c\n\nThe following top level functions (and related dependency functions) were\nmoved to ice_lib.c:\nice_vsi_delete\nice_free_res\nice_get_res\nice_is_reset_recovery_pending\nice_vsi_put_qs\nice_vsi_dis_irq\nice_vsi_free_irq\nice_vsi_free_rx_rings\nice_vsi_free_tx_rings\nice_msix_clean_rings\n\nSigned-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_lib.c | 388 ++++++++++++++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_lib.h | 22 ++\n drivers/net/ethernet/intel/ice/ice_main.c | 386 -----------------------------\n 3 files changed, 410 insertions(+), 386 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex 8fb7821f021e..25b5575771bb 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -225,6 +225,67 @@ static int ice_vsi_ctrl_rx_rings(struct ice_vsi *vsi, bool ena)\n \treturn ret;\n }\n \n+/**\n+ * ice_vsi_delete - delete a VSI from the switch\n+ * @vsi: pointer to VSI being removed\n+ */\n+void ice_vsi_delete(struct ice_vsi *vsi)\n+{\n+\tstruct ice_pf *pf = vsi->back;\n+\tstruct ice_vsi_ctx ctxt;\n+\tenum ice_status status;\n+\n+\tctxt.vsi_num = vsi->vsi_num;\n+\n+\tmemcpy(&ctxt.info, &vsi->info, sizeof(struct ice_aqc_vsi_props));\n+\n+\tstatus = ice_free_vsi(&pf->hw, vsi->idx, &ctxt, false, NULL);\n+\tif (status)\n+\t\tdev_err(&pf->pdev->dev, \"Failed to delete VSI %i in FW\\n\",\n+\t\t\tvsi->vsi_num);\n+}\n+\n+/**\n+ * ice_msix_clean_rings - MSIX mode Interrupt Handler\n+ * @irq: interrupt number\n+ * @data: pointer to a q_vector\n+ */\n+irqreturn_t ice_msix_clean_rings(int __always_unused irq, void *data)\n+{\n+\tstruct ice_q_vector *q_vector = (struct ice_q_vector *)data;\n+\n+\tif (!q_vector->tx.ring && !q_vector->rx.ring)\n+\t\treturn IRQ_HANDLED;\n+\n+\tnapi_schedule(&q_vector->napi);\n+\n+\treturn IRQ_HANDLED;\n+}\n+\n+/**\n+ * ice_vsi_put_qs - Release queues from VSI to PF\n+ * @vsi: the VSI thats going to release queues\n+ */\n+void ice_vsi_put_qs(struct ice_vsi *vsi)\n+{\n+\tstruct ice_pf *pf = vsi->back;\n+\tint i;\n+\n+\tmutex_lock(&pf->avail_q_mutex);\n+\n+\tfor (i = 0; i < vsi->alloc_txq; i++) {\n+\t\tclear_bit(vsi->txq_map[i], pf->avail_txqs);\n+\t\tvsi->txq_map[i] = ICE_INVAL_Q_INDEX;\n+\t}\n+\n+\tfor (i = 0; i < vsi->alloc_rxq; i++) {\n+\t\tclear_bit(vsi->rxq_map[i], pf->avail_rxqs);\n+\t\tvsi->rxq_map[i] = ICE_INVAL_Q_INDEX;\n+\t}\n+\n+\tmutex_unlock(&pf->avail_q_mutex);\n+}\n+\n /**\n * ice_add_mac_to_list - Add a mac address filter entry to the list\n * @vsi: the VSI to be forwarded to\n@@ -747,3 +808,330 @@ int ice_vsi_stop_tx_rings(struct ice_vsi *vsi)\n \n \treturn err;\n }\n+\n+/**\n+ * ice_cfg_vlan_pruning - enable or disable VLAN pruning on the VSI\n+ * @vsi: VSI to enable or disable VLAN pruning on\n+ * @ena: set to true to enable VLAN pruning and false to disable it\n+ *\n+ * returns 0 if VSI is updated, negative otherwise\n+ */\n+int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena)\n+{\n+\tstruct ice_vsi_ctx *ctxt;\n+\tstruct device *dev;\n+\tint status;\n+\n+\tif (!vsi)\n+\t\treturn -EINVAL;\n+\n+\tdev = &vsi->back->pdev->dev;\n+\tctxt = devm_kzalloc(dev, sizeof(*ctxt), GFP_KERNEL);\n+\tif (!ctxt)\n+\t\treturn -ENOMEM;\n+\n+\tctxt->info = vsi->info;\n+\n+\tif (ena) {\n+\t\tctxt->info.sec_flags |=\n+\t\t\tICE_AQ_VSI_SEC_TX_VLAN_PRUNE_ENA <<\n+\t\t\tICE_AQ_VSI_SEC_TX_PRUNE_ENA_S;\n+\t\tctxt->info.sw_flags2 |= ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;\n+\t} else {\n+\t\tctxt->info.sec_flags &=\n+\t\t\t~(ICE_AQ_VSI_SEC_TX_VLAN_PRUNE_ENA <<\n+\t\t\t ICE_AQ_VSI_SEC_TX_PRUNE_ENA_S);\n+\t\tctxt->info.sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;\n+\t}\n+\n+\tctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID |\n+\t\t\t\t\t\tICE_AQ_VSI_PROP_SW_VALID);\n+\tctxt->vsi_num = vsi->vsi_num;\n+\tstatus = ice_aq_update_vsi(&vsi->back->hw, ctxt, NULL);\n+\tif (status) {\n+\t\tnetdev_err(vsi->netdev, \"%sabling VLAN pruning on VSI %d failed, err = %d, aq_err = %d\\n\",\n+\t\t\t ena ? \"Ena\" : \"Dis\", vsi->vsi_num, status,\n+\t\t\t vsi->back->hw.adminq.sq_last_status);\n+\t\tgoto err_out;\n+\t}\n+\n+\tvsi->info.sec_flags = ctxt->info.sec_flags;\n+\tvsi->info.sw_flags2 = ctxt->info.sw_flags2;\n+\n+\tdevm_kfree(dev, ctxt);\n+\treturn 0;\n+\n+err_out:\n+\tdevm_kfree(dev, ctxt);\n+\treturn -EIO;\n+}\n+\n+/**\n+ * ice_vsi_release_msix - Clear the queue to Interrupt mapping in HW\n+ * @vsi: the VSI being cleaned up\n+ */\n+static void ice_vsi_release_msix(struct ice_vsi *vsi)\n+{\n+\tstruct ice_pf *pf = vsi->back;\n+\tu16 vector = vsi->base_vector;\n+\tstruct ice_hw *hw = &pf->hw;\n+\tu32 txq = 0;\n+\tu32 rxq = 0;\n+\tint i, q;\n+\n+\tfor (i = 0; i < vsi->num_q_vectors; i++, vector++) {\n+\t\tstruct ice_q_vector *q_vector = vsi->q_vectors[i];\n+\n+\t\twr32(hw, GLINT_ITR(ICE_RX_ITR, vector), 0);\n+\t\twr32(hw, GLINT_ITR(ICE_TX_ITR, vector), 0);\n+\t\tfor (q = 0; q < q_vector->num_ring_tx; q++) {\n+\t\t\twr32(hw, QINT_TQCTL(vsi->txq_map[txq]), 0);\n+\t\t\ttxq++;\n+\t\t}\n+\n+\t\tfor (q = 0; q < q_vector->num_ring_rx; q++) {\n+\t\t\twr32(hw, QINT_RQCTL(vsi->rxq_map[rxq]), 0);\n+\t\t\trxq++;\n+\t\t}\n+\t}\n+\n+\tice_flush(hw);\n+}\n+\n+/**\n+ * ice_vsi_free_irq - Free the irq association with the OS\n+ * @vsi: the VSI being configured\n+ */\n+void ice_vsi_free_irq(struct ice_vsi *vsi)\n+{\n+\tstruct ice_pf *pf = vsi->back;\n+\tint base = vsi->base_vector;\n+\n+\tif (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) {\n+\t\tint i;\n+\n+\t\tif (!vsi->q_vectors || !vsi->irqs_ready)\n+\t\t\treturn;\n+\n+\t\tvsi->irqs_ready = false;\n+\t\tfor (i = 0; i < vsi->num_q_vectors; i++) {\n+\t\t\tu16 vector = i + base;\n+\t\t\tint irq_num;\n+\n+\t\t\tirq_num = pf->msix_entries[vector].vector;\n+\n+\t\t\t/* free only the irqs that were actually requested */\n+\t\t\tif (!vsi->q_vectors[i] ||\n+\t\t\t !(vsi->q_vectors[i]->num_ring_tx ||\n+\t\t\t vsi->q_vectors[i]->num_ring_rx))\n+\t\t\t\tcontinue;\n+\n+\t\t\t/* clear the affinity notifier in the IRQ descriptor */\n+\t\t\tirq_set_affinity_notifier(irq_num, NULL);\n+\n+\t\t\t/* clear the affinity_mask in the IRQ descriptor */\n+\t\t\tirq_set_affinity_hint(irq_num, NULL);\n+\t\t\tsynchronize_irq(irq_num);\n+\t\t\tdevm_free_irq(&pf->pdev->dev, irq_num,\n+\t\t\t\t vsi->q_vectors[i]);\n+\t\t}\n+\t\tice_vsi_release_msix(vsi);\n+\t}\n+}\n+\n+/**\n+ * ice_vsi_free_tx_rings - Free Tx resources for VSI queues\n+ * @vsi: the VSI having resources freed\n+ */\n+void ice_vsi_free_tx_rings(struct ice_vsi *vsi)\n+{\n+\tint i;\n+\n+\tif (!vsi->tx_rings)\n+\t\treturn;\n+\n+\tice_for_each_txq(vsi, i)\n+\t\tif (vsi->tx_rings[i] && vsi->tx_rings[i]->desc)\n+\t\t\tice_free_tx_ring(vsi->tx_rings[i]);\n+}\n+\n+/**\n+ * ice_vsi_free_rx_rings - Free Rx resources for VSI queues\n+ * @vsi: the VSI having resources freed\n+ */\n+void ice_vsi_free_rx_rings(struct ice_vsi *vsi)\n+{\n+\tint i;\n+\n+\tif (!vsi->rx_rings)\n+\t\treturn;\n+\n+\tice_for_each_rxq(vsi, i)\n+\t\tif (vsi->rx_rings[i] && vsi->rx_rings[i]->desc)\n+\t\t\tice_free_rx_ring(vsi->rx_rings[i]);\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->num_entries)\n+\t\treturn -EINVAL;\n+\n+\tid |= ICE_RES_VALID_BIT;\n+\tfor (i = index; i < res->num_entries && 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 = res->search_hint;\n+\tint end = start;\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->num_entries)\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\tif (end == res->num_entries)\n+\t\t\t\tend = 0;\n+\n+\t\t\tres->search_hint = end;\n+\t\t\treturn start;\n+\t\t}\n+\t} while (1);\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 -ENOMEM for error\n+ * The search_hint trick and lack of advanced fit-finding only works\n+ * because we're highly likely to have all the same sized requests.\n+ * Linear search time and any fragmentation should be minimal.\n+ */\n+int\n+ice_get_res(struct ice_pf *pf, struct ice_res_tracker *res, u16 needed, u16 id)\n+{\n+\tint ret;\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(&pf->pdev->dev,\n+\t\t\t\"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+\t/* search based on search_hint */\n+\tret = ice_search_res(res, needed, id);\n+\n+\tif (ret < 0) {\n+\t\t/* previous search failed. Reset search hint and try again */\n+\t\tres->search_hint = 0;\n+\t\tret = ice_search_res(res, needed, id);\n+\t}\n+\n+\treturn ret;\n+}\n+\n+/**\n+ * ice_vsi_dis_irq - Mask off queue interrupt generation on the VSI\n+ * @vsi: the VSI being un-configured\n+ */\n+void ice_vsi_dis_irq(struct ice_vsi *vsi)\n+{\n+\tstruct ice_pf *pf = vsi->back;\n+\tstruct ice_hw *hw = &pf->hw;\n+\tint base = vsi->base_vector;\n+\tu32 val;\n+\tint i;\n+\n+\t/* disable interrupt causation from each queue */\n+\tif (vsi->tx_rings) {\n+\t\tice_for_each_txq(vsi, i) {\n+\t\t\tif (vsi->tx_rings[i]) {\n+\t\t\t\tu16 reg;\n+\n+\t\t\t\treg = vsi->tx_rings[i]->reg_idx;\n+\t\t\t\tval = rd32(hw, QINT_TQCTL(reg));\n+\t\t\t\tval &= ~QINT_TQCTL_CAUSE_ENA_M;\n+\t\t\t\twr32(hw, QINT_TQCTL(reg), val);\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\tif (vsi->rx_rings) {\n+\t\tice_for_each_rxq(vsi, i) {\n+\t\t\tif (vsi->rx_rings[i]) {\n+\t\t\t\tu16 reg;\n+\n+\t\t\t\treg = vsi->rx_rings[i]->reg_idx;\n+\t\t\t\tval = rd32(hw, QINT_RQCTL(reg));\n+\t\t\t\tval &= ~QINT_RQCTL_CAUSE_ENA_M;\n+\t\t\t\twr32(hw, QINT_RQCTL(reg), val);\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\t/* disable each interrupt */\n+\tif (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) {\n+\t\tfor (i = vsi->base_vector;\n+\t\t i < (vsi->num_q_vectors + vsi->base_vector); i++)\n+\t\t\twr32(hw, GLINT_DYN_CTL(i), 0);\n+\n+\t\tice_flush(hw);\n+\t\tfor (i = 0; i < vsi->num_q_vectors; i++)\n+\t\t\tsynchronize_irq(pf->msix_entries[i + base].vector);\n+\t}\n+}\n+\n+/**\n+ * ice_is_reset_recovery_pending - schedule a reset\n+ * @state: pf state field\n+ */\n+bool ice_is_reset_recovery_pending(unsigned long *state)\n+{\n+\treturn test_bit(__ICE_RESET_RECOVERY_PENDING, state);\n+}\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h\nindex ad4257929b9b..cbde99f38798 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.h\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.h\n@@ -33,4 +33,26 @@ int ice_vsi_stop_rx_rings(struct ice_vsi *vsi);\n \n int ice_vsi_stop_tx_rings(struct ice_vsi *vsi);\n \n+int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena);\n+\n+void ice_vsi_delete(struct ice_vsi *vsi);\n+\n+int ice_free_res(struct ice_res_tracker *res, u16 index, u16 id);\n+\n+int\n+ice_get_res(struct ice_pf *pf, struct ice_res_tracker *res, u16 needed, u16 id);\n+\n+bool ice_is_reset_recovery_pending(unsigned long *state);\n+\n+void ice_vsi_put_qs(struct ice_vsi *vsi);\n+\n+void ice_vsi_dis_irq(struct ice_vsi *vsi);\n+\n+void ice_vsi_free_irq(struct ice_vsi *vsi);\n+\n+void ice_vsi_free_rx_rings(struct ice_vsi *vsi);\n+\n+void ice_vsi_free_tx_rings(struct ice_vsi *vsi);\n+\n+irqreturn_t ice_msix_clean_rings(int __always_unused irq, void *data);\n #endif /* !_ICE_LIB_H_ */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 454479bf50e4..5d893e53976c 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -141,109 +141,6 @@ static int ice_get_free_slot(void *array, int size, int curr)\n \treturn next;\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- * 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 = res->search_hint;\n-\tint end = start;\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->num_entries)\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\tif (end == res->num_entries)\n-\t\t\t\tend = 0;\n-\n-\t\t\tres->search_hint = end;\n-\t\t\treturn start;\n-\t\t}\n-\t} while (1);\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 -ENOMEM for error\n- * The search_hint trick and lack of advanced fit-finding only works\n- * because we're highly likely to have all the same sized requests.\n- * Linear search time and any fragmentation should be minimal.\n- */\n-static int\n-ice_get_res(struct ice_pf *pf, struct ice_res_tracker *res, u16 needed, u16 id)\n-{\n-\tint ret;\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(&pf->pdev->dev,\n-\t\t\t\"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-\t/* search based on search_hint */\n-\tret = ice_search_res(res, needed, id);\n-\n-\tif (ret < 0) {\n-\t\t/* previous search failed. Reset search hint and try again */\n-\t\tres->search_hint = 0;\n-\t\tret = ice_search_res(res, needed, id);\n-\t}\n-\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- * Returns number of resources freed\n- */\n-static 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->num_entries)\n-\t\treturn -EINVAL;\n-\n-\tid |= ICE_RES_VALID_BIT;\n-\tfor (i = index; i < res->num_entries && 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_add_mac_to_sync_list - creates list of mac addresses to be synced\n * @netdev: the net device on which the sync is happening\n@@ -299,63 +196,6 @@ static bool ice_vsi_fltr_changed(struct ice_vsi *vsi)\n \t test_bit(ICE_VSI_FLAG_VLAN_FLTR_CHANGED, vsi->flags);\n }\n \n-/**\n- * ice_cfg_vlan_pruning - enable or disable VLAN pruning on the VSI\n- * @vsi: VSI to enable or disable VLAN pruning on\n- * @ena: set to true to enable VLAN pruning and false to disable it\n- *\n- * returns 0 if VSI is updated, negative otherwise\n- */\n-static int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena)\n-{\n-\tstruct ice_vsi_ctx *ctxt;\n-\tstruct device *dev;\n-\tint status;\n-\n-\tif (!vsi)\n-\t\treturn -EINVAL;\n-\n-\tdev = &vsi->back->pdev->dev;\n-\tctxt = devm_kzalloc(dev, sizeof(*ctxt), GFP_KERNEL);\n-\tif (!ctxt)\n-\t\treturn -ENOMEM;\n-\n-\tctxt->info = vsi->info;\n-\n-\tif (ena) {\n-\t\tctxt->info.sec_flags |=\n-\t\t\tICE_AQ_VSI_SEC_TX_VLAN_PRUNE_ENA <<\n-\t\t\tICE_AQ_VSI_SEC_TX_PRUNE_ENA_S;\n-\t\tctxt->info.sw_flags2 |= ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;\n-\t} else {\n-\t\tctxt->info.sec_flags &=\n-\t\t\t~(ICE_AQ_VSI_SEC_TX_VLAN_PRUNE_ENA <<\n-\t\t\t ICE_AQ_VSI_SEC_TX_PRUNE_ENA_S);\n-\t\tctxt->info.sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;\n-\t}\n-\n-\tctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID |\n-\t\t\t\t\t\tICE_AQ_VSI_PROP_SW_VALID);\n-\tctxt->vsi_num = vsi->vsi_num;\n-\tstatus = ice_aq_update_vsi(&vsi->back->hw, ctxt, NULL);\n-\tif (status) {\n-\t\tnetdev_err(vsi->netdev, \"%sabling VLAN pruning on VSI %d failed, err = %d, aq_err = %d\\n\",\n-\t\t\t ena ? \"Ena\" : \"Dis\", vsi->vsi_num, status,\n-\t\t\t vsi->back->hw.adminq.sq_last_status);\n-\t\tgoto err_out;\n-\t}\n-\n-\tvsi->info.sec_flags = ctxt->info.sec_flags;\n-\tvsi->info.sw_flags2 = ctxt->info.sw_flags2;\n-\n-\tdevm_kfree(dev, ctxt);\n-\treturn 0;\n-\n-err_out:\n-\tdevm_kfree(dev, ctxt);\n-\treturn -EIO;\n-}\n-\n /**\n * ice_vsi_sync_fltr - Update the VSI filter list to the HW\n * @vsi: ptr to the VSI\n@@ -520,15 +360,6 @@ static void ice_sync_fltr_subtask(struct ice_pf *pf)\n \t\t}\n }\n \n-/**\n- * ice_is_reset_recovery_pending - schedule a reset\n- * @state: pf state field\n- */\n-static bool ice_is_reset_recovery_pending(unsigned long int *state)\n-{\n-\treturn test_bit(__ICE_RESET_RECOVERY_PENDING, state);\n-}\n-\n /**\n * ice_prepare_for_reset - prep for the core to reset\n * @pf: board private structure\n@@ -1292,57 +1123,6 @@ static void ice_irq_affinity_notify(struct irq_affinity_notify *notify,\n */\n static void ice_irq_affinity_release(struct kref __always_unused *ref) {}\n \n-/**\n- * ice_vsi_dis_irq - Mask off queue interrupt generation on the VSI\n- * @vsi: the VSI being un-configured\n- */\n-static void ice_vsi_dis_irq(struct ice_vsi *vsi)\n-{\n-\tstruct ice_pf *pf = vsi->back;\n-\tstruct ice_hw *hw = &pf->hw;\n-\tint base = vsi->base_vector;\n-\tu32 val;\n-\tint i;\n-\n-\t/* disable interrupt causation from each queue */\n-\tif (vsi->tx_rings) {\n-\t\tice_for_each_txq(vsi, i) {\n-\t\t\tif (vsi->tx_rings[i]) {\n-\t\t\t\tu16 reg;\n-\n-\t\t\t\treg = vsi->tx_rings[i]->reg_idx;\n-\t\t\t\tval = rd32(hw, QINT_TQCTL(reg));\n-\t\t\t\tval &= ~QINT_TQCTL_CAUSE_ENA_M;\n-\t\t\t\twr32(hw, QINT_TQCTL(reg), val);\n-\t\t\t}\n-\t\t}\n-\t}\n-\n-\tif (vsi->rx_rings) {\n-\t\tice_for_each_rxq(vsi, i) {\n-\t\t\tif (vsi->rx_rings[i]) {\n-\t\t\t\tu16 reg;\n-\n-\t\t\t\treg = vsi->rx_rings[i]->reg_idx;\n-\t\t\t\tval = rd32(hw, QINT_RQCTL(reg));\n-\t\t\t\tval &= ~QINT_RQCTL_CAUSE_ENA_M;\n-\t\t\t\twr32(hw, QINT_RQCTL(reg), val);\n-\t\t\t}\n-\t\t}\n-\t}\n-\n-\t/* disable each interrupt */\n-\tif (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) {\n-\t\tfor (i = vsi->base_vector;\n-\t\t i < (vsi->num_q_vectors + vsi->base_vector); i++)\n-\t\t\twr32(hw, GLINT_DYN_CTL(i), 0);\n-\n-\t\tice_flush(hw);\n-\t\tfor (i = 0; i < vsi->num_q_vectors; i++)\n-\t\t\tsynchronize_irq(pf->msix_entries[i + base].vector);\n-\t}\n-}\n-\n /**\n * ice_vsi_ena_irq - Enable IRQ for the given VSI\n * @vsi: the VSI being configured\n@@ -1363,26 +1143,6 @@ static int ice_vsi_ena_irq(struct ice_vsi *vsi)\n \treturn 0;\n }\n \n-/**\n- * ice_vsi_delete - delete a VSI from the switch\n- * @vsi: pointer to VSI being removed\n- */\n-static void ice_vsi_delete(struct ice_vsi *vsi)\n-{\n-\tstruct ice_pf *pf = vsi->back;\n-\tstruct ice_vsi_ctx ctxt;\n-\tenum ice_status status;\n-\n-\tctxt.vsi_num = vsi->vsi_num;\n-\n-\tmemcpy(&ctxt.info, &vsi->info, sizeof(struct ice_aqc_vsi_props));\n-\n-\tstatus = ice_free_vsi(&pf->hw, vsi->idx, &ctxt, false, NULL);\n-\tif (status)\n-\t\tdev_err(&pf->pdev->dev, \"Failed to delete VSI %i in FW\\n\",\n-\t\t\tvsi->vsi_num);\n-}\n-\n /**\n * ice_vsi_req_irq_msix - get MSI-X vectors from the OS for the VSI\n * @vsi: the VSI being configured\n@@ -1689,38 +1449,6 @@ static int ice_vsi_init(struct ice_vsi *vsi)\n \treturn ret;\n }\n \n-/**\n- * ice_vsi_release_msix - Clear the queue to Interrupt mapping in HW\n- * @vsi: the VSI being cleaned up\n- */\n-static void ice_vsi_release_msix(struct ice_vsi *vsi)\n-{\n-\tstruct ice_pf *pf = vsi->back;\n-\tu16 vector = vsi->base_vector;\n-\tstruct ice_hw *hw = &pf->hw;\n-\tu32 txq = 0;\n-\tu32 rxq = 0;\n-\tint i, q;\n-\n-\tfor (i = 0; i < vsi->num_q_vectors; i++, vector++) {\n-\t\tstruct ice_q_vector *q_vector = vsi->q_vectors[i];\n-\n-\t\twr32(hw, GLINT_ITR(ICE_RX_ITR, vector), 0);\n-\t\twr32(hw, GLINT_ITR(ICE_TX_ITR, vector), 0);\n-\t\tfor (q = 0; q < q_vector->num_ring_tx; q++) {\n-\t\t\twr32(hw, QINT_TQCTL(vsi->txq_map[txq]), 0);\n-\t\t\ttxq++;\n-\t\t}\n-\n-\t\tfor (q = 0; q < q_vector->num_ring_rx; q++) {\n-\t\t\twr32(hw, QINT_RQCTL(vsi->rxq_map[rxq]), 0);\n-\t\t\trxq++;\n-\t\t}\n-\t}\n-\n-\tice_flush(hw);\n-}\n-\n /**\n * ice_vsi_clear_rings - Deallocates the Tx and Rx rings for VSI\n * @vsi: the VSI having rings deallocated\n@@ -1803,47 +1531,6 @@ static int ice_vsi_alloc_rings(struct ice_vsi *vsi)\n \treturn -ENOMEM;\n }\n \n-/**\n- * ice_vsi_free_irq - Free the irq association with the OS\n- * @vsi: the VSI being configured\n- */\n-static void ice_vsi_free_irq(struct ice_vsi *vsi)\n-{\n-\tstruct ice_pf *pf = vsi->back;\n-\tint base = vsi->base_vector;\n-\n-\tif (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) {\n-\t\tint i;\n-\n-\t\tif (!vsi->q_vectors || !vsi->irqs_ready)\n-\t\t\treturn;\n-\n-\t\tvsi->irqs_ready = false;\n-\t\tfor (i = 0; i < vsi->num_q_vectors; i++) {\n-\t\t\tu16 vector = i + base;\n-\t\t\tint irq_num;\n-\n-\t\t\tirq_num = pf->msix_entries[vector].vector;\n-\n-\t\t\t/* free only the irqs that were actually requested */\n-\t\t\tif (!vsi->q_vectors[i] ||\n-\t\t\t !(vsi->q_vectors[i]->num_ring_tx ||\n-\t\t\t vsi->q_vectors[i]->num_ring_rx))\n-\t\t\t\tcontinue;\n-\n-\t\t\t/* clear the affinity notifier in the IRQ descriptor */\n-\t\t\tirq_set_affinity_notifier(irq_num, NULL);\n-\n-\t\t\t/* clear the affinity_mask in the IRQ descriptor */\n-\t\t\tirq_set_affinity_hint(irq_num, NULL);\n-\t\t\tsynchronize_irq(irq_num);\n-\t\t\tdevm_free_irq(&pf->pdev->dev, irq_num,\n-\t\t\t\t vsi->q_vectors[i]);\n-\t\t}\n-\t\tice_vsi_release_msix(vsi);\n-\t}\n-}\n-\n /**\n * ice_ena_misc_vector - enable the non-queue interrupts\n * @pf: board private structure\n@@ -2096,23 +1783,6 @@ static int ice_vsi_alloc_arrays(struct ice_vsi *vsi, bool alloc_qvectors)\n \treturn -ENOMEM;\n }\n \n-/**\n- * ice_msix_clean_rings - MSIX mode Interrupt Handler\n- * @irq: interrupt number\n- * @data: pointer to a q_vector\n- */\n-static irqreturn_t ice_msix_clean_rings(int __always_unused irq, void *data)\n-{\n-\tstruct ice_q_vector *q_vector = (struct ice_q_vector *)data;\n-\n-\tif (!q_vector->tx.ring && !q_vector->rx.ring)\n-\t\treturn IRQ_HANDLED;\n-\n-\tnapi_schedule(&q_vector->napi);\n-\n-\treturn IRQ_HANDLED;\n-}\n-\n /**\n * ice_vsi_alloc - Allocates the next available struct vsi in the PF\n * @pf: board private structure\n@@ -2399,30 +2069,6 @@ static int ice_vsi_get_qs(struct ice_vsi *vsi)\n \treturn ret;\n }\n \n-/**\n- * ice_vsi_put_qs - Release queues from VSI to PF\n- * @vsi: the VSI thats going to release queues\n- */\n-static void ice_vsi_put_qs(struct ice_vsi *vsi)\n-{\n-\tstruct ice_pf *pf = vsi->back;\n-\tint i;\n-\n-\tmutex_lock(&pf->avail_q_mutex);\n-\n-\tfor (i = 0; i < vsi->alloc_txq; i++) {\n-\t\tclear_bit(vsi->txq_map[i], pf->avail_txqs);\n-\t\tvsi->txq_map[i] = ICE_INVAL_Q_INDEX;\n-\t}\n-\n-\tfor (i = 0; i < vsi->alloc_rxq; i++) {\n-\t\tclear_bit(vsi->rxq_map[i], pf->avail_rxqs);\n-\t\tvsi->rxq_map[i] = ICE_INVAL_Q_INDEX;\n-\t}\n-\n-\tmutex_unlock(&pf->avail_q_mutex);\n-}\n-\n /**\n * ice_free_q_vector - Free memory allocated for a specific interrupt vector\n * @vsi: VSI having the memory freed\n@@ -4443,38 +4089,6 @@ static int ice_vsi_req_irq(struct ice_vsi *vsi, char *basename)\n \treturn err;\n }\n \n-/**\n- * ice_vsi_free_tx_rings - Free Tx resources for VSI queues\n- * @vsi: the VSI having resources freed\n- */\n-static void ice_vsi_free_tx_rings(struct ice_vsi *vsi)\n-{\n-\tint i;\n-\n-\tif (!vsi->tx_rings)\n-\t\treturn;\n-\n-\tice_for_each_txq(vsi, i)\n-\t\tif (vsi->tx_rings[i] && vsi->tx_rings[i]->desc)\n-\t\t\tice_free_tx_ring(vsi->tx_rings[i]);\n-}\n-\n-/**\n- * ice_vsi_free_rx_rings - Free Rx resources for VSI queues\n- * @vsi: the VSI having resources freed\n- */\n-static void ice_vsi_free_rx_rings(struct ice_vsi *vsi)\n-{\n-\tint i;\n-\n-\tif (!vsi->rx_rings)\n-\t\treturn;\n-\n-\tice_for_each_rxq(vsi, i)\n-\t\tif (vsi->rx_rings[i] && vsi->rx_rings[i]->desc)\n-\t\t\tice_free_rx_ring(vsi->rx_rings[i]);\n-}\n-\n /**\n * ice_vsi_open - Called when a network interface is made active\n * @vsi: the VSI to open\n", "prefixes": [ "03/16" ] }