get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 972069,
    "url": "http://patchwork.ozlabs.org/api/patches/972069/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180920004308.13772-6-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": "<20180920004308.13772-6-anirudh.venkataramanan@intel.com>",
    "list_archive_url": null,
    "date": "2018-09-20T00:42:57",
    "name": "[v2,05/16] ice: Add support for VF reset events",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "bb3ca14d39a52e072b1783b5073fcff3d2437720",
    "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/20180920004308.13772-6-anirudh.venkataramanan@intel.com/mbox/",
    "series": [
        {
            "id": 66527,
            "url": "http://patchwork.ozlabs.org/api/series/66527/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=66527",
            "date": "2018-09-20T00:42:53",
            "name": "Add SR-IOV support, feature updates",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/66527/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/972069/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/972069/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 42FydN6J78z9sBW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 20 Sep 2018 10:43:20 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 3E67630698;\n\tThu, 20 Sep 2018 00:43:19 +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 TlHqBPWvdIdg; Thu, 20 Sep 2018 00:43:14 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 5D4D130942;\n\tThu, 20 Sep 2018 00:43:13 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 6491A1D0FC1\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 20 Sep 2018 00:43:11 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 60C24876F7\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 20 Sep 2018 00:43:11 +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 Bv0NvHe_E5cc for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 20 Sep 2018 00:43:10 +0000 (UTC)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 23567876DB\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 20 Sep 2018 00:43:10 +0000 (UTC)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Sep 2018 17:43:09 -0700",
            "from shasta.jf.intel.com ([10.166.241.11])\n\tby orsmga004.jf.intel.com with ESMTP; 19 Sep 2018 17:43:08 -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=\"234371595\"",
        "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Wed, 19 Sep 2018 17:42:57 -0700",
        "Message-Id": "<20180920004308.13772-6-anirudh.venkataramanan@intel.com>",
        "X-Mailer": "git-send-email 2.14.3",
        "In-Reply-To": "<20180920004308.13772-1-anirudh.venkataramanan@intel.com>",
        "References": "<20180920004308.13772-1-anirudh.venkataramanan@intel.com>",
        "Subject": "[Intel-wired-lan] [PATCH v2 05/16] ice: Add support for VF reset\n\tevents",
        "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": "Post VF initialization, there are a couple of different ways in which a\nVF reset can be triggered. One is when the underlying PF itself goes\nthrough a reset and other is via a VFLR interrupt. ice_reset_vf introduced\nin this patch handles both these cases.\n\nAlso introduced in this patch is a helper function ice_aq_send_msg_to_vf\nto send messages to VF over the mailbox queue. The PF uses this to send\nreset notifications to VFs.\n\nSigned-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>\n---\n drivers/net/ethernet/intel/ice/Makefile          |   2 +-\n drivers/net/ethernet/intel/ice/ice.h             |   2 +\n drivers/net/ethernet/intel/ice/ice_adminq_cmd.h  |  17 +++\n drivers/net/ethernet/intel/ice/ice_hw_autogen.h  |   1 +\n drivers/net/ethernet/intel/ice/ice_main.c        |  15 +++\n drivers/net/ethernet/intel/ice/ice_sriov.c       |  41 ++++++\n drivers/net/ethernet/intel/ice/ice_sriov.h       |  25 ++++\n drivers/net/ethernet/intel/ice/ice_status.h      |   3 +\n drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 163 +++++++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h |   4 +\n 10 files changed, 272 insertions(+), 1 deletion(-)\n create mode 100644 drivers/net/ethernet/intel/ice/ice_sriov.c\n create mode 100644 drivers/net/ethernet/intel/ice/ice_sriov.h",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/Makefile b/drivers/net/ethernet/intel/ice/Makefile\nindex 1999cd09239e..e5d6f684437e 100644\n--- a/drivers/net/ethernet/intel/ice/Makefile\n+++ b/drivers/net/ethernet/intel/ice/Makefile\n@@ -16,4 +16,4 @@ ice-y := ice_main.o\t\\\n \t ice_lib.o\t\\\n \t ice_txrx.o\t\\\n \t ice_ethtool.o\n-ice-$(CONFIG_PCI_IOV) += ice_virtchnl_pf.o\n+ice-$(CONFIG_PCI_IOV) += ice_virtchnl_pf.o ice_sriov.o\ndiff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h\nindex f97a23930cab..30eeb0d2d582 100644\n--- a/drivers/net/ethernet/intel/ice/ice.h\n+++ b/drivers/net/ethernet/intel/ice/ice.h\n@@ -37,6 +37,7 @@\n #include \"ice_common.h\"\n #include \"ice_sched.h\"\n #include \"ice_virtchnl_pf.h\"\n+#include \"ice_sriov.h\"\n \n extern const char ice_drv_ver[];\n #define ICE_BAR0\t\t0\n@@ -155,6 +156,7 @@ enum ice_state {\n \t__ICE_ADMINQ_EVENT_PENDING,\n \t__ICE_MAILBOXQ_EVENT_PENDING,\n \t__ICE_MDD_EVENT_PENDING,\n+\t__ICE_VFLR_EVENT_PENDING,\n \t__ICE_FLTR_OVERFLOW_PROMISC,\n \t__ICE_VF_DIS,\n \t__ICE_CFG_BUSY,\ndiff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h\nindex 7d793cc96a18..2c8f590316e9 100644\n--- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h\n+++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h\n@@ -1077,6 +1077,19 @@ struct ice_aqc_nvm {\n \t__le32 addr_low;\n };\n \n+/**\n+ * Send to PF command (indirect 0x0801) id is only used by PF\n+ *\n+ * Send to VF command (indirect 0x0802) id is only used by PF\n+ *\n+ */\n+struct ice_aqc_pf_vf_msg {\n+\t__le32 id;\n+\tu32 reserved;\n+\t__le32 addr_high;\n+\t__le32 addr_low;\n+};\n+\n /* Get/Set RSS key (indirect 0x0B04/0x0B02) */\n struct ice_aqc_get_set_rss_key {\n #define ICE_AQC_GSET_RSS_KEY_VSI_VALID\tBIT(15)\n@@ -1334,6 +1347,7 @@ struct ice_aq_desc {\n \t\tstruct ice_aqc_query_txsched_res query_sched_res;\n \t\tstruct ice_aqc_add_move_delete_elem add_move_delete_elem;\n \t\tstruct ice_aqc_nvm nvm;\n+\t\tstruct ice_aqc_pf_vf_msg virt;\n \t\tstruct ice_aqc_get_set_rss_lut get_set_rss_lut;\n \t\tstruct ice_aqc_get_set_rss_key get_set_rss_key;\n \t\tstruct ice_aqc_add_txqs add_txqs;\n@@ -1431,6 +1445,9 @@ enum ice_adminq_opc {\n \t/* NVM commands */\n \tice_aqc_opc_nvm_read\t\t\t\t= 0x0701,\n \n+\t/* PF/VF mailbox commands */\n+\tice_mbx_opc_send_msg_to_vf\t\t\t= 0x0802,\n+\n \t/* RSS commands */\n \tice_aqc_opc_set_rss_key\t\t\t\t= 0x0B02,\n \tice_aqc_opc_set_rss_lut\t\t\t\t= 0x0B03,\ndiff --git a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h\nindex 12d4c862bf05..5a4fa22d0a83 100644\n--- a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h\n+++ b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h\n@@ -136,6 +136,7 @@\n #define PFINT_OICR_PCI_EXCEPTION_M\t\tBIT(21)\n #define PFINT_OICR_HMC_ERR_M\t\t\tBIT(26)\n #define PFINT_OICR_PE_CRITERR_M\t\t\tBIT(28)\n+#define PFINT_OICR_VFLR_M\t\t\tBIT(29)\n #define PFINT_OICR_CTL\t\t\t\t0x0016CA80\n #define PFINT_OICR_CTL_MSIX_INDX_M\t\tICE_M(0x7FF, 0)\n #define PFINT_OICR_CTL_ITR_INDX_S\t\t11\ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 7e15f9e7ba95..9dd12f6cab98 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -342,6 +342,10 @@ ice_prepare_for_reset(struct ice_pf *pf)\n {\n \tstruct ice_hw *hw = &pf->hw;\n \n+\t/* Notify VFs of impending reset */\n+\tif (ice_check_sq_alive(hw, &hw->mailboxq))\n+\t\tice_vc_notify_reset(pf);\n+\n \t/* disable the VSIs and their queues that are not already DOWN */\n \tice_pf_dis_all_vsi(pf);\n \n@@ -1064,6 +1068,7 @@ static void ice_service_task(struct work_struct *work)\n \tice_check_for_hang_subtask(pf);\n \tice_sync_fltr_subtask(pf);\n \tice_handle_mdd_event(pf);\n+\tice_process_vflr_event(pf);\n \tice_watchdog_subtask(pf);\n \tice_clean_adminq_subtask(pf);\n \tice_clean_mailboxq_subtask(pf);\n@@ -1077,6 +1082,7 @@ static void ice_service_task(struct work_struct *work)\n \t */\n \tif (time_after(jiffies, (start_time + pf->serv_tmr_period)) ||\n \t    test_bit(__ICE_MDD_EVENT_PENDING, pf->state) ||\n+\t    test_bit(__ICE_VFLR_EVENT_PENDING, pf->state) ||\n \t    test_bit(__ICE_MAILBOXQ_EVENT_PENDING, pf->state) ||\n \t    test_bit(__ICE_ADMINQ_EVENT_PENDING, pf->state))\n \t\tmod_timer(&pf->serv_tmr, jiffies);\n@@ -1229,6 +1235,7 @@ static void ice_ena_misc_vector(struct ice_pf *pf)\n \t       PFINT_OICR_MAL_DETECT_M |\n \t       PFINT_OICR_GRST_M |\n \t       PFINT_OICR_PCI_EXCEPTION_M |\n+\t       PFINT_OICR_VFLR_M |\n \t       PFINT_OICR_HMC_ERR_M |\n \t       PFINT_OICR_PE_CRITERR_M);\n \n@@ -1261,6 +1268,10 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)\n \t\tena_mask &= ~PFINT_OICR_MAL_DETECT_M;\n \t\tset_bit(__ICE_MDD_EVENT_PENDING, pf->state);\n \t}\n+\tif (oicr & PFINT_OICR_VFLR_M) {\n+\t\tena_mask &= ~PFINT_OICR_VFLR_M;\n+\t\tset_bit(__ICE_VFLR_EVENT_PENDING, pf->state);\n+\t}\n \n \tif (oicr & PFINT_OICR_GRST_M) {\n \t\tu32 reset;\n@@ -3242,6 +3253,10 @@ static int ice_vsi_rebuild_all(struct ice_pf *pf)\n \t\tif (!pf->vsi[i])\n \t\t\tcontinue;\n \n+\t\t/* VF VSI rebuild isn't supported yet */\n+\t\tif (pf->vsi[i]->type == ICE_VSI_VF)\n+\t\t\tcontinue;\n+\n \t\terr = ice_vsi_rebuild(pf->vsi[i]);\n \t\tif (err) {\n \t\t\tdev_err(&pf->pdev->dev,\ndiff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ethernet/intel/ice/ice_sriov.c\nnew file mode 100644\nindex 000000000000..191e832134b6\n--- /dev/null\n+++ b/drivers/net/ethernet/intel/ice/ice_sriov.c\n@@ -0,0 +1,41 @@\n+// SPDX-License-Identifier: GPL-2.0\n+/* Copyright (c) 2018, Intel Corporation. */\n+\n+#include \"ice_common.h\"\n+#include \"ice_adminq_cmd.h\"\n+#include \"ice_sriov.h\"\n+\n+/**\n+ * ice_aq_send_msg_to_vf\n+ * @hw: pointer to the hardware structure\n+ * @vfid: VF ID to send msg\n+ * @v_opcode: opcodes for VF-PF communication\n+ * @v_retval: return error code\n+ * @msg: pointer to the msg buffer\n+ * @msglen: msg length\n+ * @cd: pointer to command details\n+ *\n+ * Send message to VF driver (0x0802) using mailbox\n+ * queue and asynchronously sending message via\n+ * ice_sq_send_cmd() function\n+ */\n+enum ice_status\n+ice_aq_send_msg_to_vf(struct ice_hw *hw, u16 vfid, u32 v_opcode, u32 v_retval,\n+\t\t      u8 *msg, u16 msglen, struct ice_sq_cd *cd)\n+{\n+\tstruct ice_aqc_pf_vf_msg *cmd;\n+\tstruct ice_aq_desc desc;\n+\n+\tice_fill_dflt_direct_cmd_desc(&desc, ice_mbx_opc_send_msg_to_vf);\n+\n+\tcmd = &desc.params.virt;\n+\tcmd->id = cpu_to_le32(vfid);\n+\n+\tdesc.cookie_high = cpu_to_le32(v_opcode);\n+\tdesc.cookie_low = cpu_to_le32(v_retval);\n+\n+\tif (msglen)\n+\t\tdesc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);\n+\n+\treturn ice_sq_send_cmd(hw, &hw->mailboxq, &desc, msg, msglen, cd);\n+}\ndiff --git a/drivers/net/ethernet/intel/ice/ice_sriov.h b/drivers/net/ethernet/intel/ice/ice_sriov.h\nnew file mode 100644\nindex 000000000000..f9b86fd05c8b\n--- /dev/null\n+++ b/drivers/net/ethernet/intel/ice/ice_sriov.h\n@@ -0,0 +1,25 @@\n+/* SPDX-License-Identifier: GPL-2.0 */\n+/* Copyright (c) 2018, Intel Corporation. */\n+\n+#ifndef _ICE_SRIOV_H_\n+#define _ICE_SRIOV_H_\n+\n+#include \"ice_common.h\"\n+\n+#ifdef CONFIG_PCI_IOV\n+enum ice_status\n+ice_aq_send_msg_to_vf(struct ice_hw *hw, u16 vfid, u32 v_opcode, u32 v_retval,\n+\t\t      u8 *msg, u16 msglen, struct ice_sq_cd *cd);\n+\n+#else /* CONFIG_PCI_IOV */\n+static inline enum ice_status\n+ice_aq_send_msg_to_vf(struct ice_hw __always_unused *hw,\n+\t\t      u16 __always_unused vfid, u32 __always_unused v_opcode,\n+\t\t      u32 __always_unused v_retval, u8 __always_unused *msg,\n+\t\t      u16 __always_unused msglen,\n+\t\t      struct ice_sq_cd __always_unused *cd)\n+{\n+\treturn 0;\n+}\n+#endif /* CONFIG_PCI_IOV */\n+#endif /* _ICE_SRIOV_H_ */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_status.h b/drivers/net/ethernet/intel/ice/ice_status.h\nindex d2dae913d81e..f49f299ddf2c 100644\n--- a/drivers/net/ethernet/intel/ice/ice_status.h\n+++ b/drivers/net/ethernet/intel/ice/ice_status.h\n@@ -6,6 +6,9 @@\n \n /* Error Codes */\n enum ice_status {\n+\tICE_SUCCESS\t\t\t\t= 0,\n+\n+\t/* Generic codes : Range -1..-49 */\n \tICE_ERR_PARAM\t\t\t\t= -1,\n \tICE_ERR_NOT_IMPL\t\t\t= -2,\n \tICE_ERR_NOT_READY\t\t\t= -3,\ndiff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\nindex 1b7017c1f190..f8f5cccb0b5c 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n@@ -4,6 +4,36 @@\n #include \"ice.h\"\n #include \"ice_lib.h\"\n \n+/**\n+ * ice_vc_vf_broadcast - Broadcast a message to all VFs on PF\n+ * @pf: pointer to the PF structure\n+ * @v_opcode: operation code\n+ * @v_retval: return value\n+ * @msg: pointer to the msg buffer\n+ * @msglen: msg length\n+ */\n+static void\n+ice_vc_vf_broadcast(struct ice_pf *pf, enum virtchnl_ops v_opcode,\n+\t\t    enum ice_status v_retval, u8 *msg, u16 msglen)\n+{\n+\tstruct ice_hw *hw = &pf->hw;\n+\tstruct ice_vf *vf = pf->vf;\n+\tint i;\n+\n+\tfor (i = 0; i < pf->num_alloc_vfs; i++, vf++) {\n+\t\t/* Not all vfs are enabled so skip the ones that are not */\n+\t\tif (!test_bit(ICE_VF_STATE_INIT, vf->vf_states) &&\n+\t\t    !test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states))\n+\t\t\tcontinue;\n+\n+\t\t/* Ignore return value on purpose - a given VF may fail, but\n+\t\t * we need to keep going and send to all of them\n+\t\t */\n+\t\tice_aq_send_msg_to_vf(hw, vf->vf_id, v_opcode, v_retval, msg,\n+\t\t\t\t      msglen, NULL);\n+\t}\n+}\n+\n /**\n  * ice_get_vf_vector - get VF interrupt vector register offset\n  * @vf_msix: number of msix vector per VF on a PF\n@@ -693,6 +723,97 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr)\n \treturn true;\n }\n \n+/**\n+ * ice_reset_vf - Reset a particular VF\n+ * @vf: pointer to the VF structure\n+ * @is_vflr: true if VFLR was issued, false if not\n+ *\n+ * Returns true if the VF is reset, false otherwise.\n+ */\n+static bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)\n+{\n+\tstruct ice_pf *pf = vf->pf;\n+\tstruct ice_hw *hw = &pf->hw;\n+\tbool rsd = false;\n+\tu32 reg;\n+\tint i;\n+\n+\t/* If the VFs have been disabled, this means something else is\n+\t * resetting the VF, so we shouldn't continue.\n+\t */\n+\tif (test_and_set_bit(__ICE_VF_DIS, pf->state))\n+\t\treturn false;\n+\n+\tice_trigger_vf_reset(vf, is_vflr);\n+\n+\tif (test_bit(ICE_VF_STATE_ENA, vf->vf_states)) {\n+\t\tice_vsi_stop_tx_rings(pf->vsi[vf->lan_vsi_idx], ICE_VF_RESET,\n+\t\t\t\t      vf->vf_id);\n+\t\tice_vsi_stop_rx_rings(pf->vsi[vf->lan_vsi_idx]);\n+\t\tclear_bit(ICE_VF_STATE_ENA, vf->vf_states);\n+\t} else {\n+\t\t/* Call Disable LAN Tx queue AQ call even when queues are not\n+\t\t * enabled. This is needed for successful completiom of VFR\n+\t\t */\n+\t\tice_dis_vsi_txq(pf->vsi[vf->lan_vsi_idx]->port_info, 0,\n+\t\t\t\tNULL, NULL, ICE_VF_RESET, vf->vf_id, NULL);\n+\t}\n+\n+\t/* poll VPGEN_VFRSTAT reg to make sure\n+\t * that reset is complete\n+\t */\n+\tfor (i = 0; i < 10; i++) {\n+\t\t/* VF reset requires driver to first reset the VF and then\n+\t\t * poll the status register to make sure that the reset\n+\t\t * completed successfully.\n+\t\t */\n+\t\tusleep_range(10000, 20000);\n+\t\treg = rd32(hw, VPGEN_VFRSTAT(vf->vf_id));\n+\t\tif (reg & VPGEN_VFRSTAT_VFRD_M) {\n+\t\t\trsd = true;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\t/* Display a warning if VF didn't manage to reset in time, but need to\n+\t * continue on with the operation.\n+\t */\n+\tif (!rsd)\n+\t\tdev_warn(&pf->pdev->dev, \"VF reset check timeout on VF %d\\n\",\n+\t\t\t vf->vf_id);\n+\n+\tusleep_range(10000, 20000);\n+\n+\t/* free VF resources to begin resetting the VSI state */\n+\tice_free_vf_res(vf);\n+\n+\tice_cleanup_and_realloc_vf(vf);\n+\n+\tice_flush(hw);\n+\tclear_bit(__ICE_VF_DIS, pf->state);\n+\n+\treturn true;\n+}\n+\n+/**\n+ * ice_vc_notify_reset - Send pending reset message to all VFs\n+ * @pf: pointer to the PF structure\n+ *\n+ * indicate a pending reset to all VFs on a given PF\n+ */\n+void ice_vc_notify_reset(struct ice_pf *pf)\n+{\n+\tstruct virtchnl_pf_event pfe;\n+\n+\tif (!pf->num_alloc_vfs)\n+\t\treturn;\n+\n+\tpfe.event = VIRTCHNL_EVENT_RESET_IMPENDING;\n+\tpfe.severity = PF_EVENT_SEVERITY_CERTAIN_DOOM;\n+\tice_vc_vf_broadcast(pf, VIRTCHNL_OP_EVENT, ICE_SUCCESS,\n+\t\t\t    (u8 *)&pfe, sizeof(struct virtchnl_pf_event));\n+}\n+\n /**\n  * ice_alloc_vfs - Allocate and set up VFs resources\n  * @pf: pointer to the PF structure\n@@ -845,3 +966,45 @@ int ice_sriov_configure(struct pci_dev *pdev, int num_vfs)\n \n \treturn 0;\n }\n+\n+/**\n+ * ice_process_vflr_event - Free VF resources via irq calls\n+ * @pf: pointer to the PF structure\n+ *\n+ * called from the vlfr irq handler to\n+ * free up VF resources and state variables\n+ */\n+void ice_process_vflr_event(struct ice_pf *pf)\n+{\n+\tstruct ice_hw *hw = &pf->hw;\n+\tint vf_id;\n+\tu32 reg;\n+\n+\tif (!test_bit(__ICE_VFLR_EVENT_PENDING, pf->state) ||\n+\t    !pf->num_alloc_vfs)\n+\t\treturn;\n+\n+\t/* Re-enable the VFLR interrupt cause here, before looking for which\n+\t * VF got reset. Otherwise, if another VF gets a reset while the\n+\t * first one is being processed, that interrupt will be lost, and\n+\t * that VF will be stuck in reset forever.\n+\t */\n+\treg = rd32(hw, PFINT_OICR_ENA);\n+\treg |= PFINT_OICR_VFLR_M;\n+\twr32(hw, PFINT_OICR_ENA, reg);\n+\tice_flush(hw);\n+\n+\tclear_bit(__ICE_VFLR_EVENT_PENDING, pf->state);\n+\tfor (vf_id = 0; vf_id < pf->num_alloc_vfs; vf_id++) {\n+\t\tstruct ice_vf *vf = &pf->vf[vf_id];\n+\t\tu32 reg_idx, bit_idx;\n+\n+\t\treg_idx = (hw->func_caps.vf_base_id + vf_id) / 32;\n+\t\tbit_idx = (hw->func_caps.vf_base_id + vf_id) % 32;\n+\t\t/* read GLGEN_VFLRSTAT register to find out the flr VFs */\n+\t\treg = rd32(hw, GLGEN_VFLRSTAT(reg_idx));\n+\t\tif (reg & BIT(bit_idx))\n+\t\t\t/* GLGEN_VFLRSTAT bit will be cleared in ice_reset_vf */\n+\t\t\tice_reset_vf(vf, true);\n+\t}\n+}\ndiff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h\nindex 3d5344d12efb..c6932559244f 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h\n@@ -51,11 +51,15 @@ struct ice_vf {\n };\n \n #ifdef CONFIG_PCI_IOV\n+void ice_process_vflr_event(struct ice_pf *pf);\n int ice_sriov_configure(struct pci_dev *pdev, int num_vfs);\n void ice_free_vfs(struct ice_pf *pf);\n+void ice_vc_notify_reset(struct ice_pf *pf);\n bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr);\n #else /* CONFIG_PCI_IOV */\n+#define ice_process_vflr_event(pf) do {} while (0)\n #define ice_free_vfs(pf) do {} while (0)\n+#define ice_vc_notify_reset(pf) do {} while (0)\n \n static inline bool\n ice_reset_all_vfs(struct ice_pf __always_unused *pf,\n",
    "prefixes": [
        "v2",
        "05/16"
    ]
}