Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1297894/?format=api
{ "id": 1297894, "url": "http://patchwork.ozlabs.org/api/patches/1297894/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200526105615.3315-1-piotr.kwapulinski@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": "<20200526105615.3315-1-piotr.kwapulinski@intel.com>", "list_archive_url": null, "date": "2020-05-26T10:56:15", "name": "i40e: detect and log info about pre-recovery mode", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "2d6de7d908ded4873c870103fc513a5b04c23644", "submitter": { "id": 76726, "url": "http://patchwork.ozlabs.org/api/people/76726/?format=api", "name": "Kwapulinski, Piotr", "email": "piotr.kwapulinski@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/20200526105615.3315-1-piotr.kwapulinski@intel.com/mbox/", "series": [ { "id": 179291, "url": "http://patchwork.ozlabs.org/api/series/179291/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=179291", "date": "2020-05-26T10:56:15", "name": "i40e: detect and log info about pre-recovery mode", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/179291/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1297894/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1297894/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 49WW9P0hw8z9sRK\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 26 May 2020 20:56:25 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id A5D5E84AAE;\n\tTue, 26 May 2020 10:56:23 +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 EGZTTW1j-Hel; Tue, 26 May 2020 10:56:22 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 9597584C2C;\n\tTue, 26 May 2020 10:56:22 +0000 (UTC)", "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n by ash.osuosl.org (Postfix) with ESMTP id 134E01BF84C\n for <intel-wired-lan@lists.osuosl.org>; Tue, 26 May 2020 10:56:21 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n by silver.osuosl.org (Postfix) with ESMTP id 0DB7320395\n for <intel-wired-lan@lists.osuosl.org>; Tue, 26 May 2020 10:56:21 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id IhdQTcXeaTYJ for <intel-wired-lan@lists.osuosl.org>;\n Tue, 26 May 2020 10:56:19 +0000 (UTC)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by silver.osuosl.org (Postfix) with ESMTPS id B082020334\n for <intel-wired-lan@lists.osuosl.org>; Tue, 26 May 2020 10:56:19 +0000 (UTC)", "from fmsmga006.fm.intel.com ([10.253.24.20])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 26 May 2020 03:56:18 -0700", "from pkwapuli-mobl.ger.corp.intel.com (HELO\n pkwapuli-vbox.igk.intel.com) ([10.213.10.179])\n by fmsmga006.fm.intel.com with ESMTP; 26 May 2020 03:56:17 -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 SaoBbqA8S7eltX0eUcAIUOjt7ZCQlzahXRUCDFWo+xHD5rhb4ThqIXSim665eVOPaBKuurJwal\n fIYY+2yipCjA==", "\n znp0/VeN6q/NtAEPtVv99zt2Gow34SI5TGku718XUGxAnPLuyEfkCdwQy2qwXA8QRZNndlZAch\n yC2K7uOcBi0A==" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.73,437,1583222400\"; d=\"scan'208\";a=\"468311668\"", "From": "Piotr Kwapulinski <piotr.kwapulinski@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Tue, 26 May 2020 12:56:15 +0200", "Message-Id": "<20200526105615.3315-1-piotr.kwapulinski@intel.com>", "X-Mailer": "git-send-email 2.17.1", "Subject": "[Intel-wired-lan] [PATCH] 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>", "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": "Detect 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---\n drivers/net/ethernet/intel/i40e/i40e_main.c | 74 +++++++++++++------\n .../net/ethernet/intel/i40e/i40e_register.h | 2 +\n 2 files changed, 53 insertions(+), 23 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 2a037ec..ef9630b 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -14557,28 +14557,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@@ -14614,7 +14603,7 @@ static i40e_status i40e_pf_loop_reset(struct i40e_pf *pf)\n \n \tfor (cnt = 0; cnt < MAX_CNT; ++cnt) {\n \t\tret = i40e_pf_reset(hw);\n-\t\tif (!ret)\n+\t\tif (ret == I40E_SUCCESS)\n \t\t\tbreak;\n \t\tmsleep(MSECS);\n \t}\n@@ -14628,6 +14617,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@@ -14864,11 +14894,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 d35d690..32cc874 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_register.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_register.h\n@@ -363,6 +363,8 @@\n #define I40E_GL_FWSTS_FWRI_MASK I40E_MASK(0x1, I40E_GL_FWSTS_FWRI_SHIFT)\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": [] }