get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1299228,
    "url": "http://patchwork.ozlabs.org/api/patches/1299228/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200527211204.234642-1-jeffrey.t.kirsher@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": "<20200527211204.234642-1-jeffrey.t.kirsher@intel.com>",
    "list_archive_url": null,
    "date": "2020-05-27T21:12:04",
    "name": "[next-queue,v2] i40e: detect and log info about pre-recovery mode",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "b3e139a9802f09b2c28ce7bea64a2fcebc370e79",
    "submitter": {
        "id": 473,
        "url": "http://patchwork.ozlabs.org/api/people/473/?format=api",
        "name": "Kirsher, Jeffrey T",
        "email": "jeffrey.t.kirsher@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/20200527211204.234642-1-jeffrey.t.kirsher@intel.com/mbox/",
    "series": [
        {
            "id": 179722,
            "url": "http://patchwork.ozlabs.org/api/series/179722/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=179722",
            "date": "2020-05-27T21:12:04",
            "name": "[next-queue,v2] i40e: detect and log info about pre-recovery mode",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/179722/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1299228/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1299228/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 spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=140.211.166.137; helo=fraxinus.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=<UNKNOWN>)",
            "ozlabs.org;\n dmarc=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 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 49XNnR4Cd3z9sSW\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 28 May 2020 07:12:11 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 2A50886B2A;\n\tWed, 27 May 2020 21:12:10 +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 7LRQW_Totv5h; Wed, 27 May 2020 21:12:09 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 3BE6C86D15;\n\tWed, 27 May 2020 21:12:09 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n by ash.osuosl.org (Postfix) with ESMTP id 053A51BF40A\n for <intel-wired-lan@lists.osuosl.org>; Wed, 27 May 2020 21:12:07 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by hemlock.osuosl.org (Postfix) with ESMTP id EFB5B88A41\n for <intel-wired-lan@lists.osuosl.org>; Wed, 27 May 2020 21:12:07 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id 1QjHsXEFj2r7 for <intel-wired-lan@lists.osuosl.org>;\n Wed, 27 May 2020 21:12:07 +0000 (UTC)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n by hemlock.osuosl.org (Postfix) with ESMTPS id E059688A43\n for <intel-wired-lan@lists.osuosl.org>; Wed, 27 May 2020 21:12:06 +0000 (UTC)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 27 May 2020 14:12:06 -0700",
            "from jtkirshe-desk1.jf.intel.com ([134.134.177.86])\n by orsmga005.jf.intel.com with ESMTP; 27 May 2020 14:12:05 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "IronPort-SDR": [
            "\n M2M7KTsNcpKK3U+20V1kshYqVTEn5A4WMw3ZQ/KW2PCsEyPwAv23jLsYXL+oFoTeIXHxJj/5DJ\n PGh0KfDlQnuw==",
            "\n RmSDxme5mrmZzP2wIyduuYCJs+a5K8t/YthLy1j5QlInMpZBCKU+cCsYZct1+uprsXFuso+V4w\n gs+fCKAe/BcQ=="
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.73,442,1583222400\"; d=\"scan'208\";a=\"442678515\"",
        "From": "Jeff Kirsher <jeffrey.t.kirsher@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Wed, 27 May 2020 14:12:04 -0700",
        "Message-Id": "<20200527211204.234642-1-jeffrey.t.kirsher@intel.com>",
        "X-Mailer": "git-send-email 2.26.2",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [next-queue v2] i40e: detect and log info about\n pre-recovery mode",
        "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 <intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <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 <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Cc": "Piotr Kwapulinski <piotr.kwapulinski@intel.com>,\n Aleksandr Loktionov <aleksandr.loktionov@intel.com>",
        "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: Piotr Kwapulinski <piotr.kwapulinski@intel.com>\n\nDetect and log information about pre-recovery mode when firmware\ntransitions to a recovery mode.\nWhen a firmware transitions to a recovery mode it stores a number\nof unexpected EMP resets in one of its registers. The number of EMP\nresets ranging from 0x21 to 0x2A indicates that FW transitions\nto recovery mode. Use these values to emit log entry about transition\nprocess. Previously the pre-recovery mode may not have been detected\nand there was no log entry when NIC was in pre-recovery mode.\n\nReviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>\nSigned-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>\n---\nv2: Fixed conflicts when trying to apply to next-queue tree\n\n drivers/net/ethernet/intel/i40e/i40e_main.c   | 72 +++++++++++++------\n .../net/ethernet/intel/i40e/i40e_register.h   |  2 +\n 2 files changed, 52 insertions(+), 22 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 5c21b7bafd8a..fe53cda1a187 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -14562,28 +14562,17 @@ void i40e_set_fec_in_flags(u8 fec_cfg, u32 *flags)\n  **/\n static bool i40e_check_recovery_mode(struct i40e_pf *pf)\n {\n-\tu32 val = rd32(&pf->hw, I40E_GL_FWSTS) & I40E_GL_FWSTS_FWS1B_MASK;\n-\tbool is_recovery_mode = false;\n-\n-\tif (pf->hw.mac.type == I40E_MAC_XL710)\n-\t\tis_recovery_mode =\n-\t\tval == I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK ||\n-\t\tval == I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK ||\n-\t\tval == I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_TRANSITION_MASK ||\n-\t\tval == I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_NVM_MASK;\n-\tif (pf->hw.mac.type == I40E_MAC_X722)\n-\t\tis_recovery_mode =\n-\t\tval == I40E_X722_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK ||\n-\t\tval == I40E_X722_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK;\n-\tif (is_recovery_mode) {\n-\t\tdev_notice(&pf->pdev->dev, \"Firmware recovery mode detected. Limiting functionality.\\n\");\n-\t\tdev_notice(&pf->pdev->dev, \"Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware recovery mode.\\n\");\n+\tu32 val = rd32(&pf->hw, I40E_GL_FWSTS);\n+\n+\tif (val & I40E_GL_FWSTS_FWS1B_MASK) {\n+\t\tdev_crit(&pf->pdev->dev, \"Firmware recovery mode detected. Limiting functionality.\\n\");\n+\t\tdev_crit(&pf->pdev->dev, \"Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware recovery mode.\\n\");\n \t\tset_bit(__I40E_RECOVERY_MODE, pf->state);\n \n \t\treturn true;\n \t}\n-\tif (test_and_clear_bit(__I40E_RECOVERY_MODE, pf->state))\n-\t\tdev_info(&pf->pdev->dev, \"Reinitializing in normal mode with full functionality.\\n\");\n+\tif (test_bit(__I40E_RECOVERY_MODE, pf->state))\n+\t\tdev_info(&pf->pdev->dev, \"Please do Power-On Reset to initialize adapter in normal mode with full functionality.\\n\");\n \n \treturn false;\n }\n@@ -14631,6 +14620,47 @@ static i40e_status i40e_pf_loop_reset(struct i40e_pf *pf)\n \treturn ret;\n }\n \n+/**\n+ * i40e_check_fw_empr - check if FW issued unexpected EMP Reset\n+ * @pf: board private structure\n+ *\n+ * Check FW registers to determine if FW issued unexpected EMP Reset.\n+ * Every time when unexpected EMP Reset occurs the FW increments\n+ * a counter of unexpected EMP Resets. When the counter reaches 10\n+ * the FW should enter the Recovery mode\n+ *\n+ * Returns true if FW issued unexpected EMP Reset\n+ **/\n+static inline bool i40e_check_fw_empr(struct i40e_pf *pf)\n+{\n+\tconst u32 fw_sts = rd32(&pf->hw, I40E_GL_FWSTS) &\n+\t\t\t   I40E_GL_FWSTS_FWS1B_MASK;\n+\treturn (fw_sts > I40E_GL_FWSTS_FWS1B_EMPR_0) &&\n+\t       (fw_sts <= I40E_GL_FWSTS_FWS1B_EMPR_10);\n+}\n+\n+/**\n+ * i40e_handle_resets - handle EMP resets and PF resets\n+ * @pf: board private structure\n+ *\n+ * Handle both EMP resets and PF resets and conclude whether there are\n+ * any issues regarding these resets. If there are any issues then\n+ * generate log entry.\n+ *\n+ * Return 0 if NIC is healthy or negative value when there are issues\n+ * with resets\n+ **/\n+static inline i40e_status i40e_handle_resets(struct i40e_pf *pf)\n+{\n+\tconst i40e_status pfr = i40e_pf_loop_reset(pf);\n+\tconst bool is_empr = i40e_check_fw_empr(pf);\n+\n+\tif (is_empr || pfr != I40E_SUCCESS)\n+\t\tdev_crit(&pf->pdev->dev, \"Entering recovery mode due to repeated FW resets. This may take several minutes. Refer to the Intel(R) Ethernet Adapters and Devices User Guide.\\n\");\n+\n+\treturn is_empr ? I40E_ERR_RESET_FAILED : pfr;\n+}\n+\n /**\n  * i40e_init_recovery_mode - initialize subsystems needed in recovery mode\n  * @pf: board private structure\n@@ -14867,11 +14897,9 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \t\tgoto err_pf_reset;\n \t}\n \n-\terr = i40e_pf_loop_reset(pf);\n-\tif (err) {\n-\t\tdev_info(&pdev->dev, \"Initial pf_reset failed: %d\\n\", err);\n+\terr = i40e_handle_resets(pf);\n+\tif (err)\n \t\tgoto err_pf_reset;\n-\t}\n \n \ti40e_check_recovery_mode(pf);\n \ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_register.h b/drivers/net/ethernet/intel/i40e/i40e_register.h\nindex d9c8ff6a47d3..8b9a12393a50 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_register.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_register.h\n@@ -43,6 +43,8 @@\n #define I40E_GL_FWSTS 0x00083048 /* Reset: POR */\n #define I40E_GL_FWSTS_FWS1B_SHIFT 16\n #define I40E_GL_FWSTS_FWS1B_MASK I40E_MASK(0xFF, I40E_GL_FWSTS_FWS1B_SHIFT)\n+#define I40E_GL_FWSTS_FWS1B_EMPR_0 I40E_MASK(0x20, I40E_GL_FWSTS_FWS1B_SHIFT)\n+#define I40E_GL_FWSTS_FWS1B_EMPR_10 I40E_MASK(0x2A, I40E_GL_FWSTS_FWS1B_SHIFT)\n #define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK I40E_MASK(0x30, I40E_GL_FWSTS_FWS1B_SHIFT)\n #define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK I40E_MASK(0x31, I40E_GL_FWSTS_FWS1B_SHIFT)\n #define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_TRANSITION_MASK I40E_MASK(0x32, I40E_GL_FWSTS_FWS1B_SHIFT)\n",
    "prefixes": [
        "next-queue",
        "v2"
    ]
}